闵棋 發表於 2025-4-25 15:31:00

内卷监视器

<p>同学给的,原出处不知道哪里。</p>
<p>使用方法:打开洛谷,把下面的东西中 <code>user</code> 替换成要看用户名,粘贴到控制台的命令行里回车。</p>
<pre><code>var userlist =
["user","user","user"];
                &lt;!-- 观察成员列表 --&gt;
var pages =2;&lt;!-- 初始检查做题记录页数,建议设置为 1-2 --&gt;
var cd = 8000; &lt;!-- 自动检查每个人时间间隔,建议保持为 10000,以免 GG--&gt;
function onSearch(obj)
{
    var storeId=document.getElementById('store');
    var rowsLength=storeId.rows.length;
    var key=document.getElementById('key').value;
    for(var i=1;i &lt; rowsLength;i++)
    {
      var searchText=storeId.rows.cells.innerHTML;
      if(key=="*"||searchText.match(key))
            storeId.rows.style.display='';
      else
            storeId.rows.style.display='none';
    }
};
str='&lt;div&gt;&lt;select onchange="onSearch()" name="key" id="key"&gt;&lt;option value="*"&gt;*&lt;/option&gt;';
for(var i=0;i &lt; userlist.length;i++)
    str+='&lt;option value="'+userlist+'"&gt;'+userlist+'&lt;/option&gt;';
str+='&lt;/select&gt;&lt;/div&gt;&lt;table id="store" style="white-space: nowrap;"&gt;&lt;tr&gt;&lt;th&gt;用户&lt;/th&gt;&lt;th&gt;题号&lt;/th&gt;&lt;th&gt;标题&lt;/th&gt;&lt;/tr&gt;&lt;/table&gt;';
document.body.innerHTML = "&lt;h1 style='text-align:center;color:red;font-family:Microsoft Yahei'&gt;内卷监视工具&lt;/h1&gt;";
document.body.innerHTML += "&lt;b style='text-align:center;font-family:FangSong'&gt;运筹首页之中,偷袭千里之外&amp;#128517;&lt;/b&gt;&lt;hr&gt;" + str;
&lt;!-- Output Emoji &amp; Option --&gt;
var colors=['rgb(191, 191, 191)','rgb(254, 76, 97)','rgb(243, 156, 17)','rgb(255, 193, 22)','rgb(82, 196, 26)','rgb(52, 152, 219)','rgb(157, 61, 207)','rgb(14, 29, 105)'];
var name="灰红橙黄绿蓝紫黑";
var lst=Array();
var cnt=0;
function PARSE(First=false)
{
    cnt=(cnt+1)%userlist.length;
    var user=userlist;
    var Pagenum=1;if(First)Pagenum=pages;
    for(;Pagenum&gt;0;Pagenum--)
    {
      var httpRequest=new XMLHttpRequest();
      httpRequest.open('GET','https://www.luogu.com.cn/record/list?user='+user+'&amp;page='+Pagenum,false);
      httpRequest.send();
      if(httpRequest.readyState==4&amp;&amp;httpRequest.status==200)
      {
            var content=httpRequest.responseText;
            var patten=/decodeURIComponent\(".*?"\)/;
            content=patten.exec(content);
            content=content.substr(20,content.length-22);
            content=JSON.parse(decodeURIComponent(content));
            var prob,col,pid,title;
            for(var i=Math.min(content.currentData.records.result.length-1,19);i&gt;=0;i--)
                if(content.currentData.records.result.status==12&amp;&amp;content.currentData.records.result.id&gt;lst)
                {
                  prob=content.currentData.records.result.problem;
                  col=colors;
                  pid=prob.pid;
                  title=prob.title;
                  document.getElementById('store').childNodes.innerHTML
                        +='&lt;tr&gt;&lt;td&gt;'+user+'&lt;/td&gt;&lt;td&gt;'+pid+'&lt;/td&gt;&lt;td&gt;'+
                            "&lt;a style='color:"+col+"' href='https://www.luogu.com.cn/problem/"+pid+"' target='_blank'&gt;"
                        +title+"&lt;/a&gt;"+'&lt;/td&gt;&lt;/tr&gt;';
                  if(!First)
                        alert(user+" 刚刚卷了"+name+"题 "+pid+" "+title);
                  lst=content.currentData.records.result.id
                }
      }
    }
}
for(var i=0;i &lt; userlist.length;i++)lst=0;
for(var i=0;i &lt; userlist.length;i++)PARSE(true);
window.setInterval(PARSE,cd);
</code></pre><br><br>
来源:https://www.cnblogs.com/Xuan-tmp/p/18846816
頁: [1]
查看完整版本: 内卷监视器