Skip to content

Commit

Permalink
Fixed Views not being hidden under timeline tweets on mobile
Browse files Browse the repository at this point in the history
Views are only displayed at larger widths on mobile
  • Loading branch information
insin committed Jan 30, 2023
1 parent 4b4869a commit 1ed923e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tweak-new-twitter.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]',
Expand Down Expand Up @@ -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)',
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 1ed923e

Please sign in to comment.