LuoguO2Enabler

Automatically enable O2 in luogu problems

  1. // ==UserScript==
  2. // @name LuoguO2Enabler
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Automatically enable O2 in luogu problems
  6. // @author 2_3_3
  7. // @match https://www.luogu.com.cn/problem/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=luogu.com.cn
  9. // @grant none
  10. // @license MIT
  11. // @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16. function wait(calb, cond) {
  17. if (cond()) {
  18. return calb();
  19. } else {
  20. setTimeout(function() {
  21. wait(calb, cond);
  22. }, 0);
  23. }
  24. }
  25. wait(function() {
  26. let t = document.getElementsByTagName("input");
  27. for (let i = 0; i < t.length; i++) {
  28. if (t[i].id !== "") {
  29. $("#" + t[i].id).click();
  30. }
  31. }
  32. }, function() {
  33. if (location.href.split('#').length !== 2) {
  34. return false;
  35. }
  36. let t = document.getElementsByTagName("input");
  37. for (let i = 0; i < t.length; i++) {
  38. if (t[i].id !== "") {
  39. return true;
  40. }
  41. }
  42. return false;
  43. });
  44. })();

QingJ © 2025

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