publink-arxiv-light

light arxiv

  1. // ==UserScript==
  2. // @name publink-arxiv-light
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description light arxiv
  6. // @author huangbc
  7. // @include *://*
  8. // @license MIT
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=shb.ltd
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. function changeTheme() {
  17. const htmlElement = document.documentElement; // 获取 <html> 元素
  18. htmlElement.setAttribute('data-theme', 'light');
  19. console.log(`Theme changed to: ${htmlElement.getAttribute('data-theme')}`);
  20. }
  21.  
  22. // 检查当前 URL 是否为 labs.arxiv.org
  23. if (window.location.href.includes('labs.arxiv.org')) {
  24. // 立即执行一次
  25. changeTheme();
  26.  
  27. // 1秒后执行一次
  28. setTimeout(changeTheme, 1000);
  29.  
  30. // 3秒后执行一次
  31. setTimeout(changeTheme, 3000);
  32.  
  33. // 5秒后执行一次
  34. setTimeout(changeTheme, 5000);
  35. } else {
  36. console.log('This script only runs on labs.arxiv.org');
  37. }
  38.  
  39.  
  40.  
  41. })();