mirror of
https://github.com/zedeus/nitter.git
synced 2024-12-12 11:06:30 +00:00
views/tweet: add .author-$user, .retweet-$user to classlist for adblock
Allow users to control what content they see or don't in their timelines by exposing author and retweeter information via dedicated CSS classes. Using adblock extensions is at least a little of a cop out, especially considered the changes to extensions that Chrome will soon force on extensions, but it's also the simplest change that will do the trick... at least on desktop. Server-side blocking would require an account system to exist, whereas javascript-side blocking would require javascript to be enabled, something that nitter doesn't give for granted (see also: video playback). Javascript-side blocking would also benefit some kind of change very much like the one I'm making here (the alternative being scraping the DOM this piece of code is generating).
This commit is contained in:
parent
2ac3afa5b2
commit
8e762c592a
1 changed files with 4 additions and 0 deletions
|
@ -295,6 +295,7 @@ proc renderTweet*(tweet: Tweet; prefs: Prefs; path: string; class=""; index=0;
|
|||
divClass = "thread-last " & class
|
||||
|
||||
if not tweet.available:
|
||||
divClass &= " author-" & tweet.user.username
|
||||
return buildHtml(tdiv(class=divClass & "unavailable timeline-item")):
|
||||
tdiv(class="unavailable-box"):
|
||||
if tweet.tombstone.len > 0:
|
||||
|
@ -313,6 +314,9 @@ proc renderTweet*(tweet: Tweet; prefs: Prefs; path: string; class=""; index=0;
|
|||
if tweet.retweet.isSome:
|
||||
tweet = tweet.retweet.get
|
||||
retweet = fullTweet.user.fullname
|
||||
divClass &= " retweet-" & retweet
|
||||
|
||||
divClass &= " author-" & tweet.user.fullname
|
||||
|
||||
buildHtml(tdiv(class=("timeline-item " & divClass))):
|
||||
if not mainTweet:
|
||||
|
|
Loading…
Reference in a new issue