Greasy Fork is available in English.
自定义的相关网站自动跳转
当前为
// ==UserScript==
// @name 指定网站跳转
// @description 自定义的相关网站自动跳转
// @namespace http://greasyfork.icu/zh-CN/scripts/372716
// @version 0.7
// @author lqzh
// @copyright lqzh
// @grant none
// @include http*://eslint.org/*
// @include http*://developer.mozilla.org/*
// @include http*://reactjs.org/*
// ==/UserScript==
const list = [
{ o: "//eslint.org/",r: "//cn.eslint.org/",},
{ o: "//developer.mozilla.org/en-US",r: "//developer.mozilla.org/zh-CN",},
{ o: "//reactjs.org/",r: "//zh-hans.reactjs.org/",},
];
(function () {
'use strict';
let host = location.href;
for (let i = 0; i < list.length; i++) {
let site = list[i];
let keyWord = location.protocol + site.o;
console.log(keyWord);
if (host.startsWith(keyWord)) {
let re = new RegExp("^" + keyWord);
location.href = host.replace( re ,location.protocol + '//'+ site.r)
break;
}
}
})();