Skip to content

Instantly share code, notes, and snippets.

@CodeF0x
Last active November 16, 2023 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CodeF0x/4ae5d6bb10fc31c2beebcfd964a8815e to your computer and use it in GitHub Desktop.
Save CodeF0x/4ae5d6bb10fc31c2beebcfd964a8815e to your computer and use it in GitHub Desktop.
UserScript to Remove YouTube Statement Banners
// ==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);
}
}
@CodeF0x
Copy link
Author

CodeF0x commented Nov 16, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment