Skip to content

Instantly share code, notes, and snippets.

@AABoyles
Created August 27, 2014 20:54
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 AABoyles/b9770083f74f3078760d to your computer and use it in GitHub Desktop.
Save AABoyles/b9770083f74f3078760d to your computer and use it in GitHub Desktop.
FunkyStats
function htmlreplace(element){
var nodes=element.childNodes;
for(var n=0;n<nodes.length;n++){
if(nodes[n].nodeType==3){
var r=new RegExp('[pP][^A-Za-z0-9]+[vV]alue', 'gi');
if(nodes[n].textContent){
nodes[n].nodeValue=nodes[n].textContent.replace(r,'P. Funk');
}else{
nodes[n].nodeValue=nodes[n].nodeValue.replace(r,'P. Funk');
}
}else{
htmlreplace(nodes[n]);
}
}
}
htmlreplace(document.body);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment