MSDN语言切换

切换MSDN文档的中英语言版版本(switch Chinese/English language in MSDN)

  1. // ==UserScript==
  2. // @name MSDN语言切换
  3. // @namespace https://github.com/maidouofgithub
  4. // @version 0.2.1
  5. // @description 切换MSDN文档的中英语言版版本(switch Chinese/English language in MSDN)
  6. // @author landwind
  7. // @match https://docs.microsoft.com/*
  8. // ==/UserScript==
  9.  
  10. (function() {
  11. 'use strict';
  12.  
  13. Init();
  14.  
  15. function Init()
  16. {
  17. AppendButton();
  18. }
  19.  
  20. function AppendButton()
  21. {
  22.  
  23. console.log('will append language switch button!');
  24. let url = location.href;
  25. var a = document.createElement('a');
  26. a.style.cssText = 'background-color:#66CC99;text-align:center;opacity:0.7;color:white;cursor:pointer;position:fixed;bottom:70%;width:45px;height:25px;right:10px;z-index:9999';
  27. a.innerHTML ='中/英';
  28. a.addEventListener('click', function(){
  29. if (url.indexOf('en-us')> -1){
  30. window.location.replace(url.replace('en-us','zh-cn'));
  31. }
  32. else if (url.indexOf('zh-cn') >= -1){
  33. window.location.replace(url.replace('zh-cn','en-us'));
  34. }
  35. }, false );
  36. document.body.appendChild(a);
  37. }
  38. })();

QingJ © 2025

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