Skip to content

Instantly share code, notes, and snippets.

@roger-mo-gusto
Created December 16, 2019 18:44
Show Gist options
  • Save roger-mo-gusto/f7e091d33fe9eb1e376b4c162139bd2e to your computer and use it in GitHub Desktop.
Save roger-mo-gusto/f7e091d33fe9eb1e376b4c162139bd2e to your computer and use it in GitHub Desktop.
2SHANEZ
(function () {
const ELEMENT_NODE = 1;
const TEXT_NODE = 3;
// https://stackoverflow.com/a/34559316
function walkText(node) {
if (node.nodeType == TEXT_NODE) {
node.data = node.data.replace(/(?<=[ \t]|(?:^|\"|\-|\=|(?:[.!?]\s)))(Sean|sean)(?=([ \t]|\.|\'||\-|\=|\"|\?|\/|\,))/g, "Shane");
} else if (node.nodeType == ELEMENT_NODE && node.nodeName != "SCRIPT") {
for (var i = 0; i < node.childNodes.length; i++) {
walkText(node.childNodes[i]);
}
}
}
walkText(document.body);
document.title = document.title.replace(/(?<=[ \t]|(?:^|\"|\-|\=|(?:[.!?]\s)))(Sean|sean)(?=([ \t]|\.|\'||\-|\=|\"|\?|\/|\,))/g, "Shane");
})();
{
"name": "2Shanez",
"version": "1.0",
"description": "Sean 2 Shane",
"manifest_version": 2,
"persistent": false,
"content_scripts": [
{
"matches": [
"<all_urls>"
],
"js": [
"background.js"
],
"run_at": "document_end"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment