返回首頁 

Greasy Fork is available in English.

MDN 文档自动重定向到中文

将 MDN 的文档自动重定向到中文


Installer ce script?
  1. // ==UserScript==// @name MDN 文档自动重定向到中文// @namespace http://tampermonkey.net/// @version 0.1// @description 将 MDN 的文档自动重定向到中文// @license ISC// @author mscststs// @match https://developer.mozilla.org/*// @icon https://www.google.com/s2/favicons?sz=64&domain=mozilla.org// @grant none// ==/UserScript==(function() {'use strict';function handleChangeMock(lang){document.querySelector("#languages-switcher-button").dispatchEvent(new Event("click",{bubbles:true}));setTimeout(()=>{document.querySelector(`button[name='${lang}']`).dispatchEvent(new Event("click",{bubbles:true}))},100)}const hydration = JSON.parse(document.querySelector("#hydration").innerText);console.log(hydration);for(let item of hydration.doc.other_translations){if(item.locale === "zh-CN"){handleChangeMock("zh-CN");return;}}})();