Restore Read in English button

Restore the Read in English button at docs.microsoft.com

目前為 2019-09-24 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Restore Read in English button
// @namespace    http://qpwakaba.xyz/
// @version      0.1
// @description  Restore the Read in English button at docs.microsoft.com
// @author       King (qpwakaba)
// @match        https://docs.microsoft.com/*
// @grant        none
// @run-at       document-body
// ==/UserScript==

(function() {
  'use strict';
  var pageActions = document.getElementById('page-actions');
  if (!pageActions) return;
  if (pageActions.children.length === 0) return;
  var menu = pageActions.children[0];
  var switchLang = document.createElement('li');
  switchLang.innerHTML = '<div class="lang-toggle-container" style="display: flex;"><label for="language-toggle" aria-hidden="true" tabindex="-1" class="x-hidden-focus">Read in English</label><div class="checkbox-toggle-wrapper"><input type="checkbox" id="language-toggle" aria-label="Read in English" data-m="{&quot;cN&quot;:&quot;language-toggle&quot;,&quot;value&quot;:&quot;off&quot;}"><label for="language-toggle" class="switch"></label></div></div>'
  if (menu.children.length >= 5) {
    menu.insertBefore(switchLang, menu.children[4]);
  } else {
    menu.appendChild(switchLang);
  }
})();

QingJ © 2025

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