Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Big5KHSCS
- // @namespace Modifications
- // @description Changes documents that specify Big5 encoding to specify Big5-HKSCS instead
- // @include *
- // ==/UserScript==
- //document.title = "";
- metaTags = document.getElementsByTagName("meta");
- for( i=0 ; i<metaTags.length ; i++)
- {
- // Look for: <meta charset="Big5">
- var cs = metaTags[i].getAttribute("charset");
- if (cs && (cs == "Big5")) {
- metaTags[i].setAttribute("charset","Big5-HKSCS");
- // document.title += "Charset UTF8! "; // Debug output
- }
- // Look for: <meta http-equiv="content-type" content="x=a;y=b;charset=Big5">
- var equiv = metaTags[i].getAttribute("http-equiv");
- if(equiv && (equiv=="content-type"))
- {
- var content = metaTags[i].getAttribute("content");
- if (content) {
- content.replace("charset=Big5","charset=Big5-HKSCS");
- // document.title = "Content! "; // Debug output
- metaTags[i].setAttribute("content",content);
- }
- }
- }
- //document.title += "Finished!"; // Debug output
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement