Created
October 25, 2019 12:59
-
-
Save Darker/73817f6e5865afc0f661b85a7ed95b21 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function changeText(originalText) { | |
return "đź’©"; | |
} | |
// Najde všechny texty v dokumentu | |
var walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT, null, null); | |
// Sem budeme dávat nalezený texty | |
var node = null; | |
// dokud walker.nextNode() vracĂ text a ne null | |
while(node = walker.nextNode()) { | |
// "text node" má "data", to je text co je pak vidět v browseru | |
node.data = changeText(node.data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment