Skip to content

Instantly share code, notes, and snippets.

@KartSriv

KartSriv/Reality.js

Last active May 14, 2019
Embed
What would you like to do?
// ==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