Greasy Fork

Greasy Fork is available in English.

自动跳转到中文网站

当打开其他语言的官方网站时,自动重定向到相应的中文官方网站。支持: Rollup Vue.js

当前为 2023-04-24 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==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
    }
  }
})()