Wikipedia Auto Theme

Automatically selects 'Automatic' theme on Wikipedia.

  1. // ==UserScript==
  2. // @name Wikipedia Auto Theme
  3. // @description Automatically selects 'Automatic' theme on Wikipedia.
  4. // @match https://*.wikipedia.org/*
  5. // @grant none
  6. // @version 0.0.1.20250309201107
  7. // @namespace https://gf.qytechs.cn/users/1435046
  8. // ==/UserScript==
  9.  
  10. (function() {
  11. "use strict";
  12. function setTheme() {
  13. let theme = document.querySelector('input[name="skin-client-pref-skin-theme-group"][value="os"]');
  14. if (theme && !theme.checked) {
  15. theme.checked = true;
  16. theme.dispatchEvent(new Event("change", { bubbles: true }));
  17. }
  18. }
  19. new MutationObserver(setTheme).observe(document.body, { childList: true, subtree: true });
  20. setTheme();
  21. })();

QingJ © 2025

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