From 1ed923e90c6a64cb928e09c1dc43976f86081fc6 Mon Sep 17 00:00:00 2001 From: Jonny Buchanan Date: Mon, 30 Jan 2023 10:52:14 +1000 Subject: [PATCH] Fixed Views not being hidden under timeline tweets on mobile Views are only displayed at larger widths on mobile --- tweak-new-twitter.user.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tweak-new-twitter.user.js b/tweak-new-twitter.user.js index a203f85..8c72e36 100644 --- a/tweak-new-twitter.user.js +++ b/tweak-new-twitter.user.js @@ -1925,7 +1925,7 @@ const configureCss = (() => { } if (config.hideShareTweetButton) { hideCssSelectors.push( - // Under timeline-style tweets + // Under timeline tweets `[data-testid="tweet"][tabindex="0"] [role="group"] > div[style]`, // Under individual tweets '[data-testid="tweet"][tabindex="-1"] [role="group"] > div[style]', @@ -2166,7 +2166,7 @@ const configureCss = (() => { } if (config.hideViews) { hideCssSelectors.push( - // Under timeline-style tweets + // Under timeline tweets // The Buffer extension adds a new button in position 2 - use their added class to avoid // hiding the wrong button (#209) '[data-testid="tweet"][tabindex="0"] [role="group"]:not(.buffer-inserted) > div:nth-of-type(4)', @@ -2272,6 +2272,14 @@ const configureCss = (() => { `body.MobilePhoto [role="group"] > div[style]`, ) } + if (config.hideViews) { + hideCssSelectors.push( + // Under timeline tweets + // Views only display on mobile at larger widths - only hide the 4th button if there are 5 + '[data-testid="tweet"][tabindex="0"] [role="group"]:not(.buffer-inserted) > div:nth-child(4):nth-last-child(2)', + '[data-testid="tweet"][tabindex="0"] [role="group"].buffer-inserted > div:nth-child(4):nth-last-child(2)', + ) + } if (config.retweets == 'separate' || config.quoteTweets == 'separate') { // Use CSS to tweak layout of mobile header elements on pages where it's // needed, as changes made directly to them can persist across pages.