Skip to content

Instantly share code, notes, and snippets.

@gabesumner
Last active March 16, 2018 00:14
Show Gist options
  • Save gabesumner/a8a3ac290fae1acc02f33479caf2a896 to your computer and use it in GitHub Desktop.
Save gabesumner/a8a3ac290fae1acc02f33479caf2a896 to your computer and use it in GitHub Desktop.
TamperMonkey Heroku Search/Replace Names
// ==UserScript==
// @name         TamperMonkey Heroku Search/Replace Names
// @match       https://dashboard.heroku.com/*
// @grant none
// ==/UserScript==
function replaceDreamhouse() {
var replaceArry = [
[/dreamhouse/gi, 'pecten']
];
var numTerms = replaceArry.length;
var txtWalker = document.createTreeWalker (
document.body,
NodeFilter.SHOW_TEXT,
{ acceptNode: function (node) {
//-- Skip whitespace-only nodes
if (node.nodeValue.trim() )
return NodeFilter.FILTER_ACCEPT;
return NodeFilter.FILTER_SKIP;
}
},
false
);
var txtNode = null;
while (txtNode = txtWalker.nextNode () ) {
var oldTxt = txtNode.nodeValue;
for (var J = 0; J < numTerms; J++) {
oldTxt = oldTxt.replace (replaceArry[J][0], replaceArry[J][1]);
}
txtNode.nodeValue = oldTxt;
}
setTimeout(function() {
replaceDreamhouse();
}, 300);
}
(function() {
var count = 0;
replaceDreamhouse();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment