维基百科简体中文化

Wikipedia 维基百科和 wikiwand 默认语言转简体中文。

  1. // ==UserScript==
  2. // @name 维基百科简体中文化
  3. // @version 0.03
  4. // @description Wikipedia 维基百科和 wikiwand 默认语言转简体中文。
  5. // @author Fionnghall
  6. // @include http*://zh.wikipedia.org/*
  7. // @include http*://en.wikipedia.org/*
  8. // @include http*://www.wikiwand.com/*
  9. // @namespace https://greasyfork.org/users/293425
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. // ==================================================
  15. // 请优先使用维基百科自带的语言选择功能,需要登陆账号。
  16. // 在参数设置里选择,不同的地区语言,链接可能不同。
  17. // https://zh.wikipedia.org/wiki/Special:参数设置
  18. // ==================================================
  19.  
  20. console.log('自动切换维基语言')
  21. //let current_lang = document.querySelector('.uls-display-settings-anon-label span').firstChild.nodeValue
  22. if (document.URL.includes('en')) {
  23. let wiki_href = ""
  24. // if (document.URL.includes.('wikipedia.org')){
  25. let target_href = document.querySelector('#p-lang .vector-menu-content .vector-menu-content-list .interwiki-zh a').getAttribute('href')
  26. wiki_href = target_href
  27. window.location = target_href
  28. console.log('切换成功!')
  29. // }
  30. // if (document.URL.includes.('wikiwand.com')){
  31. // window.location = target_href
  32. // console.log('切换成功!')
  33. // }
  34. }
  35.  
  36.  
  37. })();