Last active
November 16, 2023 15:22
-
-
Save CodeF0x/4ae5d6bb10fc31c2beebcfd964a8815e to your computer and use it in GitHub Desktop.
UserScript to Remove YouTube Statement Banners
This file contains 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 Fuck YouTube Theme banners | |
// @namespace https://codef0x.dev | |
// @version 1.0 | |
// @description Removes YouTube Theme banners | |
// @author Tobias "CodeF0x" Oettl | |
// @match *://*.youtube.com/* | |
// @grant none | |
// ==/UserScript== | |
(() => { | |
// remove on initial page load | |
removeBanner(); | |
const target = document.querySelector('#content'); | |
const config = { attributes: false, childList: true, subtree: true }; | |
const callback = (mutationList, observer) => { | |
removeBanner(); | |
} | |
const observer = new MutationObserver(callback); | |
observer.observe(target, config); | |
})(); | |
function removeBanner() { | |
const banner = document.querySelector('ytd-statement-banner-renderer'); | |
if (banner) { | |
banner.parentElement.removeChild(banner); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The callback fires like a billion times if you just move the mouse, but that's a small price to get rid of the fucking banner