From fb0c89e03e37f873cb7ab70de4ee711d22252f66 Mon Sep 17 00:00:00 2001 From: dimden Date: Sun, 24 Sep 2023 23:23:58 +0300 Subject: [PATCH] terrible fix for some tweets having ghost thread line --- layouts/home/script.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/layouts/home/script.js b/layouts/home/script.js index f2fe49e8..a90ede04 100644 --- a/layouts/home/script.js +++ b/layouts/home/script.js @@ -16,6 +16,19 @@ let selectedCircle = undefined; let cursorBottom, cursorTop; let repliesToIgnore = []; +function fixTweetThreadLine() { + let tweets = document.getElementsByClassName('tweet'); + for(let i = 0; i < tweets.length; i++) { + let tweet = tweets[i]; + let tweet2 = tweets[i + 1]; + if(!tweet2) continue; + if(tweet.tweet.threadContinuation && !tweet2.tweet.noTop) { + delete tweet2.tweet.threadContinuation; + tweet.getElementsByClassName('tweet-self-thread-div')[0].hidden = true; + } + } +} + async function createShamelessPlug(firstTime = true) { let dimden = await API.user.getV2('dimdenEFF'); chrome.storage.local.set({'followingDeveloper': dimden.following}, () => {}); @@ -68,7 +81,7 @@ setTimeout(() => {

(OldTwitter) ${LOC.new_version.message} - ${chrome.runtime.getManifest().version}

Want to support me? You can donate, follow me or leave a review.
@@ -316,6 +329,8 @@ async function renderTimeline(options = {}) { document.getElementById('loading-box').hidden = true; document.getElementById('tweets-loading').hidden = true; document.getElementById('load-more').hidden = false; + + setTimeout(fixTweetThreadLine, 100); return true; } function renderNewTweetsButton() { @@ -1003,6 +1018,7 @@ setTimeout(async () => { document.getElementById('new-tweet-text').classList.remove('new-tweet-text-focused'); document.getElementById('new-tweet-media-div').classList.remove('new-tweet-media-div-focused'); newTweetButton.disabled = false; + setTimeout(fixTweetThreadLine, 100); }); newTweetText.addEventListener('blur', () => { newTweetText.dataset.blurSince = Date.now(); @@ -1228,6 +1244,7 @@ setTimeout(async () => { document.addEventListener('newTweet', e => { let tweet = e.detail; appendTweet(tweet, document.getElementById('timeline'), { prepend: true, bigFont: tweet.full_text.length < 75 }); + setTimeout(fixTweetThreadLine, 100); }); if(location.hash === "#dm") {