Last active
May 14, 2019 04:20
-
-
Save KartSriv/729afa967bc646301700a7f68d6260f2 to your computer and use it in GitHub Desktop.
Changes Windows to Garbage, Linux to Cocaine and macOS to BabySeater xD: https://devrant.com/rants/2010343/wrote-a-js-code-for-greasemonkey-to-replace-linux-with-cocaine-download-from-htt
This file contains 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 Reality | |
// @description Changes Windows to Garbage, Linux to Cocaine and macOS to BabySeater XD | |
// @author KartSriv | |
// @match https://google.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
var replacements, regex, key, textnodes, node, s; | |
replacements = { | |
"Windows": "Garbage", | |
"Linux": "Cocaine", | |
"macOS": "BabySitter", | |
"Google": "Bing", | |
"Bing": "Google", | |
"Gmail": "Bmail", | |
"Creative": "Butt", | |
}; | |
regex = {}; | |
for (key in replacements) { | |
regex[key] = new RegExp(key, 'g'); | |
} | |
textnodes = document.evaluate( "//body//text()", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); | |
for (var i = 0; i < textnodes.snapshotLength; i++) { | |
node = textnodes.snapshotItem(i); | |
s = node.data; | |
for (key in replacements) { | |
s = s.replace(regex[key], replacements[key]); | |
} | |
node.data = s; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment