Skip to content

Instantly share code, notes, and snippets.

@jelmervdl
Created March 19, 2012 21:38
Show Gist options
  • Save jelmervdl/2127304 to your computer and use it in GitHub Desktop.
Save jelmervdl/2127304 to your computer and use it in GitHub Desktop.
Stupid script with a typo
// ==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