Skip to content

Instantly share code, notes, and snippets.

@KartSriv
Last active May 14, 2019 04:20
Show Gist options
  • Save KartSriv/729afa967bc646301700a7f68d6260f2 to your computer and use it in GitHub Desktop.
Save KartSriv/729afa967bc646301700a7f68d6260f2 to your computer and use it in GitHub Desktop.
// ==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