// ==UserScript== // @name SCAU OJ小工具(Beta) // @namespace YelloooBlue_SCAU_OJ_TimerTool // @version 0.3 // @description 适用于:SCAU华南农业大学OJ平台; // @author YelloooBlue // @match *://172.26.14.60:8000/uoj/mainMenu.html* // @match *://202.116.161.81:8000/uoj/mainMenu.html* // @match *://acm.scau.edu.cn:8000/uoj/mainMenu.html* // @match *://acm.scau.net.cn:8000/uoj/mainMenu.html* // @grant // @downloadURL https://update.greasyfork.icu/scripts/427574/SCAU%20OJ%E5%B0%8F%E5%B7%A5%E5%85%B7%28Beta%29.user.js // @updateURL https://update.greasyfork.icu/scripts/427574/SCAU%20OJ%E5%B0%8F%E5%B7%A5%E5%85%B7%28Beta%29.meta.js // ==/UserScript== var timeS = 60;//倒计时时间,可修改 //跳转到特定提交列表 function showList(code){ var iframeContent_2=$('#rightMain').contents().find("iframe").contents(); if(iframeContent_2.length){ switch(code) { case 0: iframeContent_2.get(0).location.href="/uoj/common_solution_listAllRecent_PUBLIC.html";//OJ系统最近提交(可以看见别人)10条 break; case 1: iframeContent_2.get(0).location.href="/uoj/common_solution_listByUserRecent_PUBLIC.html";//该用户最近提交记录 20条 break; case 2: iframeContent_2.get(0).location.href="/uoj/common_solution_listByUser_PUBLIC.html";//该用户所有提交记录 分页 break; } }else alert("请先进入实验界面") } //用户信息显示div var tip=$("
"); tip.css({"display":"inline-block","height":"50px","line-height":"50px","margin":"10px","text-align":"center","overflow":" hidden","color":"#ffffff"}) var id=localStorage["userId"] var code=localStorage["userCode"] if(!id||!code)alert("小工具未读取到您的用户ID或学号,请访问“编辑个人信息”页面获取ID") tip.html("用户ID:"+id+" 学号:"+code) $("#top").prepend(tip); //存放跳转按钮的div var buttonDiv = $("
"); buttonDiv.css({"display":"inline-block","height":"50px","line-height":"50px","margin":"10px","text-align":"center","overflow":" hidden"}) //三个跳转按钮 var button=document.createElement("input"); button.type="button"; button.value="系统最近提交(所有人)"; button.style="padding:5px;margin:10px"; button.onclick =function(){showList(0)}; buttonDiv.append(button); button=document.createElement("input"); button.type="button"; button.value="用户最近提交"; button.style="padding:5px;margin:10px"; button.onclick =function(){showList(1)}; buttonDiv.append(button); button=document.createElement("input"); button.type="button"; button.value="用户历史提交"; button.style="padding:5px;margin:10px"; button.onclick = function(){showList(2)}; buttonDiv.append(button); $("#top").prepend(buttonDiv); //倒计时显示div var div = document.createElement("div"); div.style.cssText = "background: #044599;display:inline-block;color:#ffffff;overflow: hidden;z-index: 99999999;margin:10px;text-align:center;line-height:50px;width: 50px;height: 50px;"; div.title = "插件制作:Copyright©YelloooBlue\n 联系方式:YelloooBlue@qq.com"; $("#top").prepend(div); function setDivContent(content) { div.innerHTML = content; } (function () { 'use strict'; var flag = 0; //0为正在检测提交界面 1为当前处于提交界面 2为正在倒计时 setDivContent("init"); //一秒后初始化 setTimeout(function(){ alert("目前版本为Beta版,存在许多Bug,如有新版本发布请关注【yellowblue.top】") setDivContent("inited"); $("#nav_module").hide()//隐藏业务模块标题 $("#nav_resource").css({"margin":"0"}) $("#top_nav").hide()//隐藏顶部位置栏 $("#top_logo").hide()//隐藏logo $("#main").css({"top":"70px","overflow":" hidden"})//main向上补位 },1000) function ready(form) { div.style.backgroundColor = "green" setDivContent("ready"); form.submit(function (e) { flag =2; div.style.backgroundColor = "OrangeRed" var sec=timeS; //计时函数 var timer = setInterval(function () { sec--; setDivContent( sec ); //倒计时结束 if (!sec) { div.style.backgroundColor = "#044599" setDivContent("find"); sec = timeS; flag = 0; clearInterval(timer); } }, 1000); }) } //每秒执行一次 setInterval(function () { //$("#main").css({"left":"200px","top":"70px","overflow":" hidden"}) var iframeContent_1=$('#rightMain').contents(); var iframeContent_2=$('#rightMain').contents().find("iframe").contents(); var form = iframeContent_2.find('#form1');//提交表单 var formT = iframeContent_1.find('#form1');//考试表单 if (form.length) { if(flag==0){ flag = 1; ready(form); } } else if (formT.length) { if(flag==0){ flag = 1; ready(formT); } } else{ if(flag==1){ flag=0; div.style.backgroundColor = "#044599" setDivContent("find"); } } //二级iframe if(iframeContent_2.length){ //console.log("已经打开二级iframe") //提交代码转textarea方便复制 // var sourceCodeDiv=iframeContent_2.find('#divsource');//定位到源代码div // if (sourceCodeDiv.find("pre").length&&!form.length) { // sourceCodeDiv.html($('