Skip to content

Instantly share code, notes, and snippets.

@miyl
Last active May 12, 2020 15:13
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 miyl/547547e6a8f682f2f9289ce245c788a3 to your computer and use it in GitHub Desktop.
Save miyl/547547e6a8f682f2f9289ce245c788a3 to your computer and use it in GitHub Desktop.
Rasmus Pandekage
// ==UserScript==
// @name Rasmus Pandekage
// @namespace rasmuspandekage
// @include *
// @version 0.2
// ==/UserScript==
// Just the source for the Chrome extension Rasmus Pandekage by tykfyr,
// so you can easily add it as a script for GreaseMonkey or Tampermonkey, including in other browsers than Chrome.
// Original extension link: https://chrome.google.com/webstore/detail/rasmus-pandekage/pfhcceonfnhnmmfgkeblckhfphmiiafi?hl=da
var allElements = [...document.body.getElementsByTagName('*')];
function findAndReplace() {
allElements.forEach(element => {
element.childNodes.forEach(child => {
if (child.nodeType === 3) {
replaceText(child);
}
});
});
}
function replaceText(node) {
let value = node.nodeValue;
if (value.includes("muslimer") && value.includes("Paludan")) {
value = value.replace(/muslimer/gi, 'pandekager')
}
value = value.replace(/Stram Kurs/gi, 'Kærligt Kram');
value = value.replace(/Paludan/gi, 'Klump');
node.nodeValue = value;
}
window.onload = findAndReplace;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment