Last active
January 5, 2023 20:44
-
-
Save Bowiemtl/79bb0bb36a8d5bb7ed53358cca2d4d79 to your computer and use it in GitHub Desktop.
Tampermonkey script to remove the views you see under every tweet. (Not tested across browsers or versions)
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 Remove twitter analytics | |
| // @namespace http://tampermonkey.net/ | |
| // @version 1.0 | |
| // @description removes the ugly view analytics from twitter | |
| // @author Bowiemtl | |
| // @match *://*.twitter.com/* | |
| // @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com | |
| // @require http://code.jquery.com/jquery-latest.js | |
| // ==/UserScript== | |
| /* | |
| * Just a simple script to remove the views from showing up under every tweet. | |
| * This is not robust in any way, it is not tested extensively nor do I plan to but feel free to modify it in any way if needed. | |
| * As of v1.0 the focussed tweet has the views nested where as non-focussed tweets do not. This makes an empty div linger around and take up space | |
| * Update 2023-03-01: Unintended side effect; you can't delete your own tweet with this script installed by clicking the 3 dots for the dropdown. | |
| */ | |
| function removeAnalytics () { | |
| let elements = document.querySelectorAll('a[href*="analytics"]'); | |
| elements.forEach(element => { | |
| element.parentNode.remove(); | |
| }); | |
| } | |
| const observer = new MutationObserver(removeAnalytics); | |
| observer.observe(document, { childList: true, subtree: true }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you!!