Created
May 17, 2016 06:53
-
-
Save martinvirtel/54746a9b1cfd0e98bb33c8789e6245c1 to your computer and use it in GitHub Desktop.
Wikimedia against capital D
This file contains 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 characters
/* http://stackoverflow.com/questions/10730309/find-all-text-nodes-in-html-page */ | |
function textNodesUnder(el){ | |
var n, a=[], walk=document.createTreeWalker(el,NodeFilter.SHOW_TEXT,null,false); | |
while(n=walk.nextNode()) a.push(n); | |
return a; | |
} | |
f=textNodesUnder(document); | |
f.forEach(function(e,i) { a=e.textContent; b=a.replace(/\bDpa/g,"dpa"); e.textContent=b; }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment