Greasy Fork is available in English.
当打开其他语言的官方网站时,自动重定向到相应的中文官方网站。支持: Rollup Vue.js
当前为
// ==UserScript==
// @name 自动跳转到中文网站
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Automatically redirect to the corresponding Chinese official website when opening official websites in other languages. Support: Rollup Vue.js
// @description:zh-CN 当打开其他语言的官方网站时,自动重定向到相应的中文官方网站。支持: Rollup Vue.js
// @run-at document-start
// @author wasdjkl
// @match https://*.rollupjs.org/*
// @match https://*.vuejs.org/*
// @match https://*.vitejs.dev/*
// @copyright https://www.wasdjkl.com
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// @license MIT
// ==/UserScript==
(function () {
'use strict'
const host = location.host.toString()
const hostListCN = [
{ rules: 'rollupjs.org', cn: 'cn.rollupjs.org' },
{ rules: 'vuejs.org', cn: 'cn.vuejs.org' },
{ rules: 'ja.vuejs.org', cn: 'cn.vuejs.org' },
{ rules: 'ua.vuejs.org', cn: 'cn.vuejs.org' },
{ rules: 'fr.vuejs.org', cn: 'cn.vuejs.org' },
{ rules: 'vitejs.dev', cn: 'cn.vitejs.dev' },
{ rules: 'ja.vitejs.dev', cn: 'cn.vitejs.dev' },
{ rules: 'es.vitejs.dev', cn: 'cn.vitejs.dev' },
{ rules: 'pt.vitejs.dev', cn: 'cn.vitejs.dev' },
]
for (const item of hostListCN) {
if (host === item.rules) {
location.host = item.cn
}
}
})()