Show/Hide ACed problems

Show or hide accepted problem in the luogu training session

  1. // ==UserScript==
  2. // @name Show/Hide ACed problems
  3. // @namespace http://tampermonkey.net/
  4. // @version v1.2.0
  5. // @description Show or hide accepted problem in the luogu training session
  6. // @author limesarine
  7. // @match https://luogu.com/training/*
  8. // @match https://luogu.com.cn/training/*
  9. // @match https://*.luogu.com/training/*
  10. // @match https://*.luogu.com.cn/training/*
  11. // @license © 2024 Limesarine. All rights reserved.
  12. // @icon https://www.google.com/s2/favicons?sz=64&domain=luogu.com.cn
  13. // @grant none
  14. // ==/UserScript==
  15.  
  16. function getVal()
  17. {
  18. let e=document.getElementById('min-score');
  19. e=e.value;
  20. if(e=='')
  21. {
  22. return 101;
  23. }
  24. if(e>=0 && e<=100)
  25. {
  26. return e;
  27. }
  28. return 101;
  29. }
  30.  
  31. function displayAC(display)
  32. {
  33. let x=document.getElementsByClassName('border table')[0];
  34. let val=getVal();
  35. if(x){}
  36. else{return;}
  37. x=x.childNodes[2].childNodes;
  38. for(let i=1;i<x.length;i++)
  39. {
  40. if(x[i].childNodes[2].childNodes[0].childNodes[0].classList[2]=='fa-check' || +x[i].childNodes[2].childNodes[0].childNodes[0].innerHTML>=val)
  41. {
  42. x[i].style.display=display;
  43. }
  44. }
  45. }
  46.  
  47. function showAC()
  48. {
  49. let x=document.getElementsByClassName('border table')[0];
  50. let val=getVal();
  51. if(x){}
  52. else{return;}
  53. x=x.childNodes[2].childNodes;
  54. for(let i=1;i<x.length;i++)
  55. {
  56. x[i].style.display='';
  57. }
  58. }
  59.  
  60. (function() {
  61. 'use strict';
  62.  
  63. const observer=new MutationObserver(function(mutationsList,observer){
  64. if(document.getElementsByClassName('bottom-inner')[0].childNodes[0].innerText=="多选")
  65. {
  66. let e=document.createElement('a');
  67. e.setAttribute("href","javascript:void 0");
  68. e.setAttribute("colorscheme","default");
  69. e.setAttribute("class","color-default");
  70. function temp(){
  71. if(e.innerHTML=="隐藏已AC题目")
  72. {
  73. e.innerHTML="显示已AC题目";
  74. displayAC("none");
  75. }
  76. else
  77. {
  78. e.innerHTML="隐藏已AC题目";
  79. showAC();
  80. }
  81. }
  82. e.onclick=temp;
  83. e.innerHTML="隐藏已AC题目";
  84. // displayAC('none');
  85. let input=document.createElement('input');
  86. input.setAttribute('placeholder','隐藏下限');
  87. input.setAttribute('type','number');
  88. input.setAttribute('max','101');
  89. input.setAttribute('min','0');
  90. input.setAttribute('step','1');
  91. input.setAttribute('style','font-size: 15px;');
  92. input.style.width="75px";
  93. input.style.margin="5px";
  94. input.setAttribute('id','min-score');
  95. input.value=90;
  96. document.getElementsByClassName('bottom-inner')[0].childNodes[0].appendChild(e);
  97. document.getElementsByClassName('bottom-inner')[0].childNodes[0].appendChild(input);
  98. temp();
  99. }
  100. });
  101. observer.observe(document,{childList:true,subtree:true});
  102. })();

QingJ © 2025

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