Skip to content

Instantly share code, notes, and snippets.

@DragorWW
Created January 31, 2020 06:13
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 DragorWW/4293222ca2449a4377315416eabd15c9 to your computer and use it in GitHub Desktop.
Save DragorWW/4293222ca2449a4377315416eabd15c9 to your computer and use it in GitHub Desktop.
function textNodesUnder(el){
var n, a=[], walk=document.createTreeWalker(el,NodeFilter.SHOW_TEXT,null,false);
while(n=walk.nextNode()) a.push(n);
return a;
}
function removeText(text) {
return 'ауоыиэяюёе'.split('').reduce((acc, i) => acc.replace(RegExp(i,'gi'), ''),text)
}
textNodesUnder(document.body).forEach(i => i.replaceWith(removeText(i.wholeText)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment