Skip to content

Instantly share code, notes, and snippets.

@moklick
Created January 2, 2018 23:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moklick/a7ad3a6caeb6d01fb0fa7da375f26eb2 to your computer and use it in GitHub Desktop.
Save moklick/a7ad3a6caeb6d01fb0fa7da375f26eb2 to your computer and use it in GitHub Desktop.
was ist das fuer 1 extension
// 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');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment