自動簡轉繁

try to take over the world!

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         自動簡轉繁
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  try to take over the world!
// @author       You
// @include      *
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_registerMenuCommand
// ==/UserScript==

function sc2tc() {
    function init() {
        document.getElementById("StranLink").style="display:none;";
        job = setInterval(StranBody, 1000);
    }
    var remoteScript = document.createElement('script');
    remoteScript.src = 'https://admin-ll55.github.io/sc2tc/locale.simplified.min.js?ts='+(+new Date());
    remoteScript.onload = init;
    document.body.appendChild(remoteScript);
}
function add2matchlist () {
    if (domain_list.indexOf(domain) == -1) {
        domain_list.push(domain);
        GM_setValue("domain_list", JSON.stringify(domain_list));
        sc2tc();
        console.log(JSON.parse(GM_getValue("domain_list")))
    }
}
function removefrommatchlist () {
    var index = domain_list.indexOf(domain);
    if (index != -1) {
        domain_list.splice(index, 1);
        GM_setValue("domain_list", JSON.stringify(domain_list));
        clearInterval(job);
        document.querySelector("a[name='StranLink']").remove();
        console.log(JSON.parse(GM_getValue("domain_list")))
    }
}
var domain = window.location.href.match(/\/\/(.*?)\//)[1];
var domain_list = GM_getValue("domain_list");
if (domain_list) {
    domain_list = JSON.parse(domain_list);
}
else {
    domain_list = [];
}
console.log(domain_list);
GM_registerMenuCommand ("Add "+domain+" to match list", add2matchlist, "A");
GM_registerMenuCommand ("Remove "+domain+" from match list", removefrommatchlist, "R");

var job;
if (domain_list.indexOf(domain) != -1) {
    sc2tc();
}