MDN 自动切换中文

谷歌搜索的时候经常点击MDN文档打开的默认都是英文的, 很不方便, 来一个自动跳转, 如果需要其他语言, 手动点页面切换即可

  1. // ==UserScript==
  2. // @name MDN 自动切换中文
  3. // @namespace https://gf.qytechs.cn/zh-CN/scripts/421190
  4. // @version 0.5
  5. // @author zhenhappy<q505507538@gmail.com>
  6. // @description 谷歌搜索的时候经常点击MDN文档打开的默认都是英文的, 很不方便, 来一个自动跳转, 如果需要其他语言, 手动点页面切换即可
  7. // @icon https://developer.mozilla.org/favicon-512x512.png
  8. // @match https://developer.mozilla.org/**
  9. // @run-at document-start
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. if (window.name !== 'true') {
  15. window.name = true
  16. var url = window.location.href.replace(/(developer\.mozilla\.org\/(?!zh\-CN))([^/]+)(\/.*)$/i, '$1zh-CN$3')
  17. window.location.href !== url && window.location.replace(url)
  18. document.querySelector('.mdn-cta-container').style.display = 'none'
  19. }
  20. })()

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址