insin / control-panel-for-twitter

Browser extension which gives you more control over your Twitter timeline and adds missing features and UI improvements - available for desktop and mobile browsers
https://jbscript.dev/control-panel-for-twitter
MIT License
1.92k stars 62 forks source link

Feature: hide users with NFT profile pics #89

Closed jarcane closed 1 year ago

jarcane commented 2 years ago

Better TweetDeck has rolled out a feature to hide accounts with the new NFT avatars from Twitter Blue: https://twitter.com/BetterTDeck/status/1484233899920150529/photo/1

It would be really great to have this function in TNT as well.

eramdam commented 2 years ago

I'd be happy to assist in the implementation. I would open a PR but I'm not familiar with TNT's codebase 😛

insin commented 2 years ago

I've not seen one in my timeline yet - I'd need a timeline full of it to test this properly, and I really don't want to follow any crypto shills 😞

To do this you'd need to add a new boolean config option (example commit which shows adding a new option: https://github.com/insin/tweak-new-twitter/commit/0128ef77c493dcad2ee1bc68757430c191cd8151)

Then you'd need to check if the new option is enabled prior to this line: https://github.com/insin/tweak-new-twitter/blob/8ce1d91678cfe2726be8b02bbd209e32834a092a/tweak-new-twitter.user.js#L2240

If the option is enabled, to check if the tweet contains an NFT avatar you'd do something like this:

let hasNftAvatar = Boolean($tweet.querySelector('a[role="link"] > div[style^="clip-path: url(\\"#hex-hw-shapeclip-clipconfig\\")"]'))

If the tweet contains an NFT avatar, you can then set hideItem = true directly as we know we're going to hide it without ever checking what type it is, otherwise fall back to the line linked above.

The existing code should then handle things like also hiding tweets of non-NFT avatars replying to an NFT avatar.

eramdam commented 2 years ago

I'd need a timeline full of it to test this properly, and I really don't want to follow any crypto shills 😞

you can probably just open a search on the NewNFTProfilePic hashtag to test this, at least that's how I have been doing it for BTD 😁

insin commented 1 year ago

On second thoughts, this is a bit too niche for Tweak New Twitter - I rarely see these things any more