Last active
August 30, 2020 22:19
-
-
Save rndomhack/52ce66a99587deff8802 to your computer and use it in GitHub Desktop.
BugToDragon
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() { | |
var list, toDragon; | |
list = [["bug", "dragon"], ["Bug", "Dragon"], ["バグ", "ドラゴン"], ["ばぐ", "どらごん"], ["バグ", "ドラゴン"]]; | |
(toDragon = function(node) { | |
if (node.nodeValue !== null) { | |
[].forEach.call(list, function(item) { | |
node.nodeValue = node.nodeValue.split(item[0]).join(item[1]); | |
}); | |
} | |
[].forEach.call(node.childNodes, function(child) { | |
toDragon(child); | |
}); | |
})(document.body); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment