Last active
December 22, 2022 13:05
-
-
Save shinmai/a9bdcf21918ce3e721e700a6bbba6135 to your computer and use it in GitHub Desktop.
UserScript: Hide tweets from Blue for Business users
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Hide tweets from Blue for Business users | |
| // @namespace rip.aapo.userscripts | |
| // @version 0.0.2 | |
| // @description install a mutation listener on Twitter pages that looks for added nodes, and hides them if they are tweets from users with the square Blue for Business profile picture frame | |
| // @author @shinmai - https://shinmai.wtf | |
| // @match https://twitter.com/* | |
| // @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com | |
| // @grant none | |
| // @updateURL https://gist.github.com/shinmai/a9bdcf21918ce3e721e700a6bbba6135/raw/good-for-health_bad-for-business.user.js | |
| // @downloadURL https://gist.github.com/shinmai/a9bdcf21918ce3e721e700a6bbba6135/raw/good-for-health_bad-for-business.user.js | |
| // ==/UserScript== | |
| /** | |
| * Changelog: | |
| * 0.0.1 (221220) - initial version (who's a big old dummie? it me. i the dummie) | |
| * 0.0.2 (221222) - rewrite the selector to target ALL Blue for Business users, not just the TwitterBusiness account 🤦♀️ | |
| */ | |
| (function() { | |
| 'use strict'; | |
| const observer = new MutationObserver( | |
| ml => { | |
| for (const m of ml) | |
| m.addedNodes.forEach( | |
| e => { | |
| e.querySelectorAll('article div[style*="#rounded-square-hw-shapeclip-clipconfi"] > a[role="link"]').forEach( | |
| ba => { | |
| ba.closest('article[data-testid="tweet"]')?.closest('div[data-testid="cellInnerDiv"]')?.style.setProperty('display','none','important') | |
| }) | |
| }) | |
| } | |
| ) | |
| observer.observe(document.body,{attributes:false,childList:true,subtree:true}) | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment