Greasy Fork

指定网站跳转

自定义的相关网站自动跳转

目前为 2018-09-30 提交的版本。查看 最新版本

// ==UserScript==
// @name         指定网站跳转
// @description  自定义的相关网站自动跳转
// @namespace    https://greasyfork.org/zh-CN/scripts/372716
// @version      0.2
// @author       lqzh
// @copyright    lqzh
// @include      http*://eslint.org/*
// @grant        none
// ==/UserScript==

const list = [{
	o: "eslint.org",
	r: "cn.eslint.org",
}];

(function () {
	'use strict';
	let host = location.host;
	for (let i = 0; i < list.length; i++) {
		let site = list[i];
		if (host == site.o) {
			location.href = location.protocal + site.r + location.pathname + location.search;
			break;
		}
	}
})();