Skip to content

Instantly share code, notes, and snippets.

@todomodo
Last active September 8, 2023 04:25
Show Gist options
  • Save todomodo/7b1c7598b0469f51e6fe93c64b70a5b3 to your computer and use it in GitHub Desktop.
Save todomodo/7b1c7598b0469f51e6fe93c64b70a5b3 to your computer and use it in GitHub Desktop.
A GreaseMonkey script for eliminating the SJW button from YT home page.
// ==UserScript==
// @name classic_yt_button
// @namespace https://gist.github.com/todomodo/
// @description Strip the (SJW) image from YT home button, so it can be later replaced with the classic version
// @include https://www.youtube.com/*
// ==/UserScript==
var loop_count = 0;
// the page will try to render and then re-render the SJW button several times.
var intv = setInterval(function() {
// find the IMG element and clear the image
elem = document.querySelector('img.ytd-yoodle-renderer');
if (elem) {
if (elem.getAttribute("src")) {
console.log("whacked one!...");
elem.setAttribute("src", "");
elem.setAttribute("alt", "Heil Jesus");
}
}
// find the SOURCE element and clear the set
elem = document.querySelector('source.ytd-yoodle-renderer');
if (elem) {
if (elem.getAttribute("srcset")) {
console.log("whacked one!...");
elem.setAttribute("srcset", "");
}
}
// exit the loop after 5 seconds
if (loop_count>200) {
// 25ms x 200 cycles = 5 seconds
clearInterval(intv);
console.log("...done");
} else {
loop_count+=1;
}
}, 25); // check every 25 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment