BIT-Programming-Refresh result

自动刷新结果页

目前为 2023-07-17 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name BIT-Programming-Refresh result
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2.2
  5. // @description 自动刷新结果页
  6. // @license GPL-3.0-or-later
  7. // @supportURL https://github.com/YDX-2147483647/BIT-enhanced/issues
  8. // @author Y.D.X.
  9. // @match https://lexue.bit.edu.cn/mod/programming/result.php?*
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. 'use strict'
  15. function auto_refresh () {
  16. const titles = document.querySelectorAll('[role=main] > h3')
  17. if (titles[0].innerText === '查看程序的测试结果' &&
  18. titles[0].nextSibling.innerText === '找不到您的程序') {
  19. return
  20. }
  21. if (titles[titles.length - 1].innerText !== '测试结果') {
  22. window.location.reload()
  23. }
  24. }
  25. window.setInterval(auto_refresh, 2000)
  26. })()