Skip to content

Instantly share code, notes, and snippets.

@vontell
Created February 7, 2016 01:18
Show Gist options
  • Save vontell/f4c6dbdf545ca17f99be to your computer and use it in GitHub Desktop.
Save vontell/f4c6dbdf545ca17f99be to your computer and use it in GitHub Desktop.
var result = document.evaluate("//text()", document.body, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < result.snapshotLength; ++i) {
var node = result.snapshotItem(i);
if ((node.textContent+"").match(/\w/)&&node.parentNode.nodeName != "STYLE") {
node.textContent = node.textContent.replace(/[A-Z0-9]/g, "X").replace(/[a-z]/g, "x");
}
}
void 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment