Created
March 19, 2012 21:38
-
-
Save jelmervdl/2127304 to your computer and use it in GitHub Desktop.
Stupid script with a typo
This file contains hidden or 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 Stupid script with a typo | |
// @include http://*/* | |
// ==/UserScript== | |
function filterNode(node) | |
{ | |
switch (node.nodeType) | |
{ | |
case Node.ELEMENT_NODE: | |
filterElement(node); | |
break; | |
case Node.TEXT_NODE: | |
filterTextNode(node); | |
break; | |
} | |
} | |
function filterTextNode(node) | |
{ | |
node.data = node.data.replace(/keyboard/ig, "leopard"); | |
} | |
function filterElement(element) | |
{ | |
Array.prototype.forEach.call(element.childNodes, filterNode); | |
} | |
filterElement(document); | |
document.addEventListener('DOMNodeInserted', function(e) { | |
filterNode(e.target); | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment