Created
January 2, 2018 23:06
-
-
Save moklick/a7ad3a6caeb6d01fb0fa7da375f26eb2 to your computer and use it in GitHub Desktop.
Revisions
-
moklick created this gist
Jan 2, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ // via http://stackoverflow.com/questions/10730309/find-all-text-nodes-in-html-page#answer-10730777 function findTextNodes(el) { var node; var textNodes = []; var walk = document.createTreeWalker(el, NodeFilter.SHOW_TEXT, null, false); while (node = walk.nextNode()) { textNodes.push(node); } return textNodes; } findTextNodes(document.body).forEach(function(e) { e.textContent = e.textContent.replace(/\be(in|ine|inen|iner|inem)\b/gi, '1'); });