Skip to content

Instantly share code, notes, and snippets.

@moklick moklick/content.js
Created Jan 2, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.