Skip to content

Instantly share code, notes, and snippets.

@adrian154
Created April 1, 2026 20:15
Show Gist options
  • Select an option

  • Save adrian154/e9023797004518a56fe0ffdea3eaefb2 to your computer and use it in GitHub Desktop.

Select an option

Save adrian154/e9023797004518a56fe0ffdea3eaefb2 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Twitter Ad Remover
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Nuke ads
// @author adrian154
// @match https://x.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com
// ==/UserScript==
(function () {
'use strict';
const removeAds = () => {
[...document.querySelectorAll("span")].filter(s => s.textContent == "Ad").forEach(span => {
let elem = span;
do {
elem = elem.parentElement;
} while(elem.tagName != "ARTICLE");
elem.style.display = "none";
console.log("removed ad");
});
};
setInterval(removeAds, 1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment