Skip to content

Instantly share code, notes, and snippets.

@rndomhack
Last active August 30, 2020 22:19
Show Gist options
  • Save rndomhack/52ce66a99587deff8802 to your computer and use it in GitHub Desktop.
Save rndomhack/52ce66a99587deff8802 to your computer and use it in GitHub Desktop.
BugToDragon
(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