Skip to content

Instantly share code, notes, and snippets.

@sxslex
Last active March 14, 2019 22:16
Show Gist options
  • Save sxslex/cca5ec03ff59269bff7b32884f547488 to your computer and use it in GitHub Desktop.
Save sxslex/cca5ec03ff59269bff7b32884f547488 to your computer and use it in GitHub Desktop.
Troca todo o texto de um site para outro texto passado
function dePara(de,para){var t=0;if(document.documentElement.innerText.indexOf(de)===-1)return t;Array.from(document.getElementsByTagName("*")).forEach(function(e){Array.from(e.attributes).forEach(function(f){if(['title','alt'].indexOf(f.name)>-1&&f.value){f.value=f.value.split(de).join(para);t++}});e.childNodes.forEach(function(f){if(f.nodeType===3&&f.nodeValue){f.nodeValue=f.nodeValue.split(de).join(para);t++}})});return t}
dePara('Compartilhe','Cadê DeDe???');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment