vPlus

让 v2ex 跟随系统的深色/浅色模式

目前为 2020-05-08 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name vPlus
  3. // @namespace https://gf.qytechs.cn/en/users/190451-leo-aee
  4. // @version 0.1.1
  5. // @description 让 v2ex 跟随系统的深色/浅色模式
  6. // @author Leoaee
  7. // @icon https://cdn.jsdelivr.net/gh/mopig/oss@master/uPic/202005/v_logo.png
  8. // @include https://*.v2ex.com/*
  9. // @include https://v2ex.com/*
  10. // @match <$URL$>
  11. // @grant GPL
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. // Your code here...
  18. function detectColorScheme(){
  19. var ret = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
  20. return ret;
  21. }
  22. var curScheme = detectColorScheme()
  23. var curColor = document.querySelector('.light-toggle > img').alt.toLowerCase()
  24. if(curScheme !== curColor) {
  25. document.querySelector('.light-toggle').click()
  26. }
  27. })();

QingJ © 2025

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