Skip to content

Instantly share code, notes, and snippets.

@Reedbeta
Created May 14, 2017 21:31
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 Reedbeta/15b9c4553a8302c316bb0d5a974ec7b2 to your computer and use it in GitHub Desktop.
Save Reedbeta/15b9c4553a8302c316bb0d5a974ec7b2 to your computer and use it in GitHub Desktop.
Letter swapper Greasemonkey script. Just for shits and giggles.
// ==UserScript==
// @name Letter Swapper
// @namespace reedbeta.com
// @version 1
// @grant none
// @include *
// @exclude https://*.google.com/*
// ==/UserScript==
var swaps =
{
'a': 'e', 'A': 'E',
'e': 'a', 'E': 'A',
'm': 'n', 'M': 'N',
'n': 'm', 'N': 'M',
'o': 'u', 'O': 'U',
'u': 'o', 'U': 'O',
};
// Walk over all text nodes in the document
var walker = document.createTreeWalker(document, NodeFilter.SHOW_TEXT);
while (n = walker.nextNode())
{
var text = n.nodeValue, newText = "";
for (c of text)
{
if (c in swaps)
c = swaps[c];
newText += c;
}
n.nodeValue = newText;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment