Skip to content

Instantly share code, notes, and snippets.

@tvoklov
Created January 11, 2023 00:24
Show Gist options
  • Save tvoklov/69cf9d5e94255d439bd504bcad096608 to your computer and use it in GitHub Desktop.
Save tvoklov/69cf9d5e94255d439bd504bcad096608 to your computer and use it in GitHub Desktop.
a (tampermonkey) js script that makes the entire internet yell at you
// ==UserScript==
// @name SHOUT EVERYTHING
// @version 0.1
// @description make every website shout at you
// @author tvoklov
// @match HTTP://*/*
// @match HTTPS://*/*
// @grant GM_log
// ==/UserScript==
(function() {
'use strict';
function recursiveUppercase(elem) {
if (elem.hasChildNodes()) {
Array.from(elem.childNodes).filter(x => !x.nodeName.toLowerCase().endsWith("script") && !x.nodeName.toLowerCase().endsWith("style")).map(recursiveUppercase);
} else if (elem.nodeName.toLowerCase().endsWith("text")) {
elem.textContent = elem.textContent.toUpperCase();
}
}
let body = document.getElementsByTagName("body")[0];
GM_log("running SHOUT EVERYTHING");
recursiveUppercase(body);
GM_log("setting up observer for SHOUT EVERYTHING");
let mb = new MutationObserver (function (mutations) {
for (const mutation of mutations) {
if (mutation.addedNodes.length) {
GM_log("mutated " + mutation.addedNodes.length + " nodes")
Array.from(mutation.addedNodes).map(recursiveUppercase);
}
}
});
mb.observe(body, {childList : true } )
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment