Skip to content

Instantly share code, notes, and snippets.

@Th3Shadowbroker
Last active January 27, 2023 17:41
Show Gist options
  • Save Th3Shadowbroker/12c03bbcecbc0876bc67c386a77645a6 to your computer and use it in GitHub Desktop.
Save Th3Shadowbroker/12c03bbcecbc0876bc67c386a77645a6 to your computer and use it in GitHub Desktop.
Remove the view count no one asked for from the timeline view.
// ==UserScript==
// @name Remove View Count
// @namespace https://github.com/th3shadowbroker
// @version 1.0.1
// @updateURL https://gist.githubusercontent.com/Th3Shadowbroker/12c03bbcecbc0876bc67c386a77645a6/raw
// @downloadURL https://gist.githubusercontent.com/Th3Shadowbroker/12c03bbcecbc0876bc67c386a77645a6/raw
// @description Remove the view count no one asked for from the timeline view.
// @author Th3Shadowbroker
// @match https://twitter.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
const body = document.querySelector("body");
const selector = ".css-1dbjc4n.r-1ta3fxp.r-18u37iz.r-1wtj0ep.r-1s2bzr4.r-1mdbhws";
const observationFunction = function(mutationsList, observer) {
mutationsList.forEach(mutation => {
const elements = document.querySelectorAll(selector);
elements.forEach(element => {
console.log("Hiding", element);
element.childNodes[3].style.display = 'none';
});
});
}
const observer = new MutationObserver(observationFunction);
const observerConfig = {
attributes: true,
childList: true,
subtree: true
}
observer.observe(body, observerConfig);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment