Last active
December 15, 2016 07:06
-
-
Save roytam1/d33245d4d1946e93e45edf2d0bd40b3f to your computer and use it in GitHub Desktop.
ecms-tc-to-sc-supplement
This file contains 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
javascript:void%20function(){function%20C(u,e,F){F||(F=document.body);for(var%20n=F.childNodes,o=0;o%3Cn.length;o++)if(3==n[o].nodeType){var%20E=new%20RegExp(u,%22gi%22);n[o].nodeValue=n[o].nodeValue.replace(E,e)}else%20C(u,e,n[o])}for(var%20u=[[%22%5Cu65BC%22,%22%5Cu4E8E%22],[%22%5Cu5F8C%22,%22%5Cu540E%22],[%22%5Cu7BC4%22,%22%5Cu8303%22],[%22%5Cu5925%22,%22%5Cu4F19%22],[%22%5Cu4E7E%22,%22%5Cu5E72%22],[%22%5Cu9EBD%22,%22%5Cu4E48%22],[%22%5Cu81FA%22,%22%5Cu53F0%22],[%22%5Cu83F8%22,%22%5Cu70DF%22],[%22%5Cu9592%22,%22%5Cu95F2%22],[%22%5Cu50AD%22,%22%5Cu4F63%22],[%22%5Cu5FB5%22,%22%5Cu5F81%22],[%22%5Cu6A38%22,%22%5Cu6734%22],[%22%5Cu8768%22,%22%5Cu8671%22],[%22%5Cu9336%22,%22%5Cu8868%22],[%22%5Cu8814%22,%22%5Cu869D%22],[%22%5Cu7662%22,%22%5Cu75D2%22],[%22%5Cu7665%22,%22%5Cu75C7%22],[%22%5Cu7051%22,%22%5Cu6D12%22],[%22%5Cu9451%22,%22%5Cu9274%22],[%22%5Cu965C%22,%22%5Cu9655%22],[%22%5Cu859F%22,%22%5Cu83B6%22],[%22%5Cu92B9%22,%22%5Cu9508%22],[%22%5Cu58BB%22,%22%5Cu5899%22],[%22%5Cu7CA7%22,%22%5Cu5986%22],[%22%5Cu5AFA%22,%22%5Cu5A34%22],[%22/tc/%22,%22/sc/%22]],e=0;e%3Cu.length;e++)C(u[e][0],u[e][1])}(); |
This file contains 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
/* | |
ECMS TC to SC supplement, works with "Source mode" only | |
Use http://chriszarate.github.io/bookmarkleter/ to create bookmarklet | |
*/ | |
var tcsc = [ | |
["於", "于"], | |
["後", "后"], | |
["範", "范"], | |
["夥", "伙"], | |
["乾", "干"], | |
["麽", "么"], | |
["臺", "台"], | |
["菸", "烟"], | |
["閒", "闲"], | |
["傭", "佣"], | |
["徵", "征"], | |
["樸", "朴"], | |
["蝨", "虱"], | |
["錶", "表"], | |
["蠔", "蚝"], | |
["癢", "痒"], | |
["癥", "症"], | |
["灑", "洒"], | |
["鑑", "鉴"], | |
["陜", "陕"], | |
["薟", "莶"], | |
["銹", "锈"], | |
["墻", "墙"], | |
["粧", "妆"], | |
["嫺", "娴"], | |
["/tc/", "/sc/"] | |
]; | |
function htmlreplace(a, b, element) { | |
if (!element) element = document.body; | |
var nodes = element.childNodes; | |
for (var n=0; n<nodes.length; n++) { | |
if (nodes[n].nodeType == 3) { //Node.TEXT_NODE == 3 | |
var r = new RegExp(a, 'gi'); | |
nodes[n].nodeValue = nodes[n].nodeValue.replace(r, b); | |
} else { | |
htmlreplace(a, b, nodes[n]); | |
} | |
} | |
} | |
for(var i=0; i<tcsc.length; i++) {htmlreplace(tcsc[i][0],tcsc[i][1]);} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment