Skip to content

Commit

Permalink
fix post->tweet replacer in tombstones
Browse files Browse the repository at this point in the history
  • Loading branch information
dimdenGD committed Sep 12, 2023
1 parent 1ee2b76 commit 1a6bc2f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions layouts/tweet/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -688,16 +688,16 @@ async function appendComposeComponent(container, replyTweet) {
});
}
async function appendTombstone(timelineContainer, text, replyTweet) {
tweets.push(['tombstone', text, replyTweet]);
let tombstone = document.createElement('div');
tombstone.className = 'tweet-tombstone';
try {
if(typeof text === 'string') LOC.replacer_post_to_tweet.message.split('|').forEach(el => {
let [or, nr] = el.split('->');
or = or[0].toUpperCase() + or.slice(1);
text = text.replace(new RegExp(or, "g"), nr);
});
} catch(e) {}
tweets.push(['tombstone', text, replyTweet]);
let tombstone = document.createElement('div');
tombstone.className = 'tweet-tombstone';
tombstone.innerHTML = text;
timelineContainer.append(tombstone);
if(replyTweet) {
Expand Down
12 changes: 7 additions & 5 deletions scripts/tweetviewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2493,17 +2493,19 @@ class TweetViewer {
}
}
async appendTombstone(timelineContainer, text) {
this.tweets.push(['tombstone', text]);
let tombstone = document.createElement('div');
tombstone.className = 'tweet-tombstone';
tombstone.innerHTML = text;
try {
if(typeof text === 'string') LOC.replacer_post_to_tweet.message.split('|').forEach(el => {
let [or, nr] = el.split('->');
or = or[0].toUpperCase() + or.slice(1);
text = text.replace(new RegExp(or, "g"), nr);
});
} catch(e) {}
} catch(e) {
console.error(e);
}
this.tweets.push(['tombstone', text]);
let tombstone = document.createElement('div');
tombstone.className = 'tweet-tombstone';
tombstone.innerHTML = text;
timelineContainer.append(tombstone);
}
init() {
Expand Down

0 comments on commit 1a6bc2f

Please sign in to comment.