Skip to content

Instantly share code, notes, and snippets.

@wam
Created October 23, 2012 20:48
Show Gist options
  • Save wam/3941449 to your computer and use it in GitHub Desktop.
Save wam/3941449 to your computer and use it in GitHub Desktop.
Bookmarklet that replaces the word "founder" with "flounder"
// 1. Copy and paste this into a browser toolbar bookmark
// 2. Encounter a page that makes excessive use of the word "founder"
// 3. Clicky clicky
javascript:function htmlreplace(a,b,element){if(!element)element=document.body;var nodes=element.childNodes;for(var n=0;n<nodes.length;n++){if(nodes[n].nodeType==Node.TEXT_NODE){nodes[n].textContent=nodes[n].textContent.replace(new RegExp(a,'gi'),b);}else{htmlreplace(a,b,nodes[n]);}}}htmlreplace('([fF])ounder','$1lounder');
// Entirely ganked from http://stackoverflow.com/questions/1175775/find-all-instances-of-old-in-a-webpage-and-replace-each-with-new-using-a-ja with the exception of two crucial words.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment