// ==UserScript== // @name 深圳大学OJ美化 // @namespace https://www1.szu.edu.cn/szu.asp // @version 1.1.3 // @description Use a better user interface // @author LK // @match http://172.31.234.11/* // @match http://172.31.234.12/* // @match http://172.31.234.14/* // @match http://172.31.234.21/* // @match http://172.31.234.46/* // @match http://172.31.234.47/* // @require https://cdn.staticfile.org/jquery/3.3.1/jquery.min.js // @grant none // @downloadURL https://update.greasyfork.icu/scripts/374485/%E6%B7%B1%E5%9C%B3%E5%A4%A7%E5%AD%A6OJ%E7%BE%8E%E5%8C%96.user.js // @updateURL https://update.greasyfork.icu/scripts/374485/%E6%B7%B1%E5%9C%B3%E5%A4%A7%E5%AD%A6OJ%E7%BE%8E%E5%8C%96.meta.js // ==/UserScript== (function() { 'use strict'; let url = window.location.href; let ip = /(172(\.\d{1,3}){3})/.exec(url)[1]; let cssFontface = "@font-face{font-family:'iconfont';src:url('//at.alicdn.com/t/font_903081_3u0cf7ap816.eot');src:url('//at.alicdn.com/t/font_903081_3u0cf7ap816.eot?#iefix') format('embedded-opentype'),url('//at.alicdn.com/t/font_903081_3u0cf7ap816.woff') format('woff'),url('//at.alicdn.com/t/font_903081_3u0cf7ap816.ttf') format('truetype'),url('//at.alicdn.com/t/font_903081_3u0cf7ap816.svg#iconfont') format('svg')}"; let cssGlobal = ".iconfont{font-family:'iconfont'!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-webkit-text-stroke-width:.2px;-moz-osx-font-smoothing:grayscale}.No_Select{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none}body{font-family:'microsoft yahei'}*::selection{background-color:#3c3;color:#fff}html{min-width:1200px;min-height:100%;position:relative}body{min-height:100%;margin:0;padding:0;background-color:#EEE}ul{margin:0;padding:0}li{list-style:none;color:#555}a{text-decoration:none;color:inherit}i{color:inherit}input{font-family:inherit}.Navigation_Bar{width:100%;min-width:1200px;height:75px;box-shadow:0 0 10px #888;background-color:#FFF;z-index:9999999;position:fixed}.Navigation_Bar_UL{text-align:center;white-space:nowrap;z-index:123456789}.Navigation_Bar_UL>li{height:75px;display:inline-block;position:relative;-webkit-transition:color .3s ease-in-out;-moz-transition:color .3s ease-in-out;-ms-transition:color .3s ease-in-out;-o-transition:color .3s ease-in-out;transition:color .3s ease-in-out}.Navigation_Bar_UL>li>a{width:175px;height:75px;line-height:75px;text-align:center;position:relative;text-indent:1em;font-size:18px;display:block}.Navigation_Bar_UL>li>a:before{top:50%;left:50%;width:100%;border-bottom:2px transparent solid;content:'_';color:transparent;position:absolute;-webkit-transform:translate(-50%,-50%);-moz-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);-o-transform:translate(-50%,-50%);transform:translate(-50%,-50%);-webkit-transition:border-color .3s ease-in-out;-moz-transition:border-color .3s ease-in-out;-ms-transition:border-color .3s ease-in-out;-o-transition:border-color .3s ease-in-out;transition:border-color .3s ease-in-out}.Navigation_Bar_UL>li:hover>a:before,.Navigation_Bar_Selected a:before{border-color:#39f!important}.Navigation_Bar_UL>li:hover,.Navigation_Bar_Selected{color:#39f}.Navigation_Bar_UL>li i{top:50%;left:20%;position:absolute;font-size:1.3em;-webkit-transform:translate(-50%,-50%);-moz-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);-o-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.Navigation_Bar_Mine{width:75px;float:right}.Navigation_Bar_Mine_UL{background-color:#fff;box-shadow:0 0 10px #888;z-index:123456788;display:none;float:right}.Navigation_Bar_Mine_UL li{width:200px;height:50px;line-height:50px;text-align:center}.Navigation_Bar_Mine_UL li a{height:50px;display:block;-webkit-transition:all .3s ease-in-out;-moz-transition:all .3s ease-in-out;-ms-transition:all .3s ease-in-out;-o-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.Navigation_Bar_Mine_UL li a:hover{background-color:#39f;color:#fff}.Footer{top:100%;width:100%;height:90px;padding:15px 0;line-height:30px;background-color:#fff;box-shadow:0 0 10px #888;box-sizing:border-box;text-align:center;position:absolute;color:#555;-webkit-transform:translateY(-100%);-moz-transform:translateY(-100%);-ms-transform:translateY(-100%);-o-transform:translateY(-100%);transform:translateY(-100%)}.Footer p{margin:0;padding:0}.Footer a{color:#39f;-webkit-transition:all .3s ease-in-out;-moz-transition:all .3s ease-in-out;-ms-transition:all .3s ease-in-out;-o-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.Footer a:hover{color:#22f}"; let jsNavMine = ""; function addNavMine() { let iFrame = document.createElement("iframe"); iFrame.src = "http://" + ip + "/JudgeOnline/"; iFrame.style = "display: none"; document.getElementsByTagName("body")[0].append(iFrame); iFrame.onload = function() { let navMine = iFrame.contentDocument.children[0].children[1].children[0].children[0].children[4]; $(".Navigation_Bar_UL").append(navMine); iFrame.parentNode.removeChild(iFrame); activeNavMine(); }; } function activeNavMine() { let navBarMine = false; $(".Navigation_Bar_Mine").hover(function() { navBarMine = true; $(".Navigation_Bar_Mine_UL").stop(true).show(500); }, function() { navBarMine = false; setTimeout(function() { if (!navBarMine) { $(".Navigation_Bar_Mine_UL").stop(true).hide(500); } }, 200); }) } if (url.match(/status\.php/i)) { /* * ======================== * 状态 * ======================== */ console.log("状态"); let x; let titles = ["运行编号", "用户", "问题", "结果", "内存", "耗时", "语言", "代码长度", "提交时间"]; let nav = $("table.toprow").children("tbody").children("tr").children("td").children("a"); let pageNav = []; for (let i = 0; i < nav.length; i++) { pageNav[i] = nav[i].href; } let profile = $("#profile"); let mailNumber = ""; let userId = ""; let logged; if (profile.text().match(/登录/)) { logged = false; } else if (profile.text().match(/注销/)) { logged = true; userId = /\s*(\w+)\s/.exec(profile.text())[1]; mailNumber = /\((\d*)\)/.exec(profile.text())[1]; } let trs = $(".content-box-header tbody").eq(1).children("tr"); let tdas = []; let tds = []; for (let i = 0; i < trs.length; i++) { tdas[i] = []; tds[i] = []; let str = trs[i].innerHTML.replace(/(\n|<\/?td>)/g, "\t"); // console.log(trs[i].innerHTML); let strs = str.split("\t"); for (let j = 0, k = 0; j < titles.length; j++, k++) { if (strs[k] == "") { j--; continue; } tds[i][j] = strs[k]; } tdas[i][0] = /href=\"([^<]*)\"/.exec(tds[i][1])[1]; tdas[i][1] = /href=\"([^<]*)\"/.exec(tds[i][2])[1]; if (tds[i][3].match(/(点击看详细|Click)/)) { tdas[i][2] = /href=\"([^<]*)\"/.exec(tds[i][3])[1]; } if (tds[i][6] != "----" && tds[i][6].match(//, "").replace(/<.*>/, ""); } } let inputLanguageSelected = $("select[name='language']")[0].selectedIndex; let inputResultSelected = $("select[name='jresult']")[0].selectedIndex; x = $("#main").children("#center").eq(2).children("a"); let pagePrev = x.eq(1).attr("href"); let pageNext = x.eq(2).attr("href"); let cid; if (url.match(/cid=/i)) { cid = /cid=(\d+)&?/i.exec(url)[1].trim(); } else { cid = ""; } /*for (let i = 0; i < tds.length; i++) { for (let j = 0; j < tds[i].length; j++) { console.log(titles[j], tds[i][j]); } console.log("\n"); }*/ let head = ""; let body = ""; head += " \n"; head += " \n"; head += " \n"; head += " SZUOJ - 状态\n"; head += " \n"; head += "\n"; body += " \n"; body += "
\n"; body += " \n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += "
\n"; body += "
    \n"; body += "
  • \n"; body += " \n"; body += "
  • \n"; body += "
  • \n"; body += " \n"; body += "
  • \n"; body += "
  • \n"; body += " \n"; body += "
  • \n"; body += "
  • \n"; body += " \n"; body += "
  • \n"; body += "
  • \n"; if (cid != "") { body += " \n"; } body += " \n"; body += "
  • \n"; body += "
\n"; body += "
\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += "
    \n"; body += "
  • 运行编号
  • \n"; body += "
  • 用户
  • \n"; body += "
  • 问题
  • \n"; body += "
  • 结果
  • \n"; body += "
  • 内存
  • \n"; body += "
  • 耗时
  • \n"; body += "
  • 语言
  • \n"; body += "
  • 代码长度
  • \n"; body += "
  • 提交时间
  • \n"; body += "
\n"; body += "
\n"; for (let i = 0; i < tds.length; i++) { tds[i][6] = tds[i][6].replace(/\/Edit/g, ""); if (tds[i][3] != "正确" && tds[i][3] != "Accepted") { if (tds[i][3].match(/\((点击看详细|Click)\)/i)) { tds[i][3] = tds[i][3].replace(/\((点击看详细|Click)\)/i, ""); if (!tds[i][3].match(/(编译|Compile)/i)) { tds[i][3] = "" + tds[i][3] + ""; } else { tds[i][3] = "" + tds[i][3] + ""; } } else if (tds[i][3].match(/(等待|编译|评判|Pending|Compiling|Running)/i)) { tds[i][3] = "
" + tds[i][3] + "
"; } else { tds[i][3] = "
" + tds[i][3] + "
"; } } body += "
\n"; body += "
    \n"; body += "
  • " + tds[i][0] + "
  • \n"; body += "
  • " + tds[i][1] + "
  • \n"; body += "
  • " + tds[i][2] + "
  • \n"; body += "
  • " + tds[i][3] + "
  • \n"; body += "
  • " + tds[i][4] + "
  • \n"; body += "
  • " + tds[i][5] + "
  • \n"; if (tds[i][6] != "----" && tdas[i][4] != undefined) { body += "
  • " + tds[i][6] + "
  • \n"; } else { body += "
  • " + tds[i][6] + "
  • \n"; } if (tds[i][7] != "----") { if (tdas[i][3] != undefined) { body += "
  • " + tds[i][7] + "ytes
  • \n"; } else { body += "
  • " + tds[i][7] + "ytes
  • \n"; } } else { body += "
  • ----
  • \n"; } body += "
  • " + tds[i][8] + "
  • \n"; body += "
\n"; body += "
\n"; } body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += " \n"; body += "   上一页\n"; body += "
\n"; body += " \n"; body += "
\n"; body += " \n"; body += " 下一页  \n"; body += "
\n"; body += "
\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "

All Copyright Reserved 2010-2011\n"; body += " 深圳大学在线判题教学平台 TEAM

\n"; body += "

UI Modified By L.K.

\n"; body += "
\n"; body += " \n"; body += jsNavMine; $("head").html(head); $("body").html(body); $("select[name='language']")[0].selectedIndex = inputLanguageSelected; $("select[name='jresult']")[0].selectedIndex = inputResultSelected; if (pageNav[1] != undefined) { addNavMine(); } } else if (url.match(/contest\.php\?cid=/i)) { /* * ======================== * 问题列表 * ======================== */ console.log("问题列表"); let nav = $("table.toprow").children("tbody").children("tr").children("td").children("a"); let pageNav = []; for (let i = 0; i < nav.length; i++) { pageNav[i] = nav[i].href; } let title = /\([^<>]*)\<\/title\>/.exec($("head").html())[1]; let mainHTML = $("#main").html(); let cid = /cid=(\d+)&?/i.exec(url)[1].trim(); let head = ""; head += " \n"; head += " \n"; head += " \n"; head += " SZUOJ - " + title + "\n"; head += " \n"; if (mainHTML.match(/Not invited or not login/i) || mainHTML.match(/Private Contest is used/i) || (title.match(/No Such Contest/i) && cid != "0")) { let body = ""; body += " \n"; body += "
\n"; body += " \n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += "
\n"; body += " " + title + "\n"; body += "
\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; if (mainHTML.match(/Not invited or not login/i)) { body += "

没有权限查看或未登录

"; } else if (mainHTML.match(/Private Contest is used/i)) { body += "

实验尚未开始

"; } else { body += "

未找到该实验

"; } body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "

All Copyright Reserved 2010-2011\n"; body += " 深圳大学在线判题教学平台 TEAM

\n"; body += "

UI Modified By L.K.

\n"; body += "
\n"; body += " \n"; $("head").html(head); $("body").html(body); let iFrame = document.createElement("iframe"); iFrame.src = "http://" + ip + "/JudgeOnline/"; iFrame.style = "display: none"; document.getElementsByTagName("body")[0].append(iFrame); iFrame.onload = function() { let navMine = iFrame.contentDocument.children[0].children[1].children[0].children[0].children[4]; $(".Navigation_Bar_UL").append(navMine); iFrame.parentNode.removeChild(iFrame); let navBarMine = false; $(".Navigation_Bar_Mine").hover(function() { navBarMine = true; $(".Navigation_Bar_Mine_UL").stop(true).show(500); }, function() { navBarMine = false; setTimeout(function() { if (!navBarMine) { $(".Navigation_Bar_Mine_UL").stop(true).hide(500); } }, 200); }) if ($(".Body_Note").html().match(/没有权限查看或未登录/)) { if ($(".Navigation_Bar_Mine_UL").html().match(/登录/)) { $(".Body_Note").children("h1").html("未登录"); } else { $(".Body_Note").children("h1").html("没有权限查看"); } } }; return; } let x = $("#main").children("center").children("div").text(); let content = document.getElementById("main").children[1].children[0].innerHTML; let startTime = /Start Time:\s*([-0-9: ]*)\s*End Time/.exec(x)[1]; let endTime = /End Time:\s*([-0-9: ]*)\s*Current/.exec(x)[1]; let status = /Status:\s*([a-zA-Z]*)\s*([a-zA-Z]*)\s*\[Status/.exec(x); let problems = document.getElementById("problemset").children[1].children; content = content.substring(0, content.match(/\Start/).index) .substring(content.match(/\/).index) .replace(/\\s*\<\/p\>/g, "") .replace(/\brn\b/g, "
") .replace(/^\s+$/g, ""); let body = ""; body += " \n"; body += "
\n"; body += " \n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += "
\n"; body += " " + title + "\n"; body += "
\n"; body += "
\n"; body += "
\n"; body += " 开始时间:" + startTime + "\n"; body += "
\n"; body += "
\n"; body += " 结束时间:" + endTime + "\n"; body += "
\n"; if (status[1].match(/Running/i)) { body += "
\n"; body += " 进行中\n"; body += "
\n"; } else { body += "
\n"; body += " 已结束\n"; body += "
\n"; } if (status[2].match(/Public/i)) { body += "
\n"; body += " 公开\n"; body += "
\n"; } else { body += "
\n"; body += " 私密\n"; body += "
\n"; } body += "
\n"; body += "
\n"; body += "\n"; if (content.length > 0) { body += "
\n"; body += "\n"; body += "
\n"; body += content; body += "
\n"; } body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += "
    \n"; body += "
  • 状态
  • \n"; body += "
  • 题目编号
  • \n"; body += "
  • 标题
  • \n"; body += "
  • 来源
  • \n"; body += "
  • 正确
  • \n"; body += "
  • 提交
  • \n"; body += "
\n"; body += "
\n"; for (let i = 0; i < problems.length; i++) { x = problems[i].children; x[1].innerText = x[1].innerText.replace(/\s+/g, " "); body += "
\n"; body += "
    \n"; if (x[0].innerText.match(/Y/i)) { body += "
  • \n"; } else if (x[0].innerText.match(/N/i)) { body += "
  • \n"; } else { body += "
  • \n"; } body += "
  • " + x[1].innerText + "
  • \n"; body += "
  • " + x[2].innerText + "
  • \n"; body += "
  • " + x[3].innerText + "
  • \n"; body += "
  • " + x[4].innerText + "
  • \n"; body += "
  • " + x[5].innerText + "
  • \n"; body += "
\n"; body += "
\n"; } body += "
\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "

All Copyright Reserved 2010-2011\n"; body += " 深圳大学在线判题教学平台 TEAM

\n"; body += "

UI Modified By L.K.

\n"; body += "
\n"; body += " \n"; body += jsNavMine; $("head").html(head); $("body").html(body); addNavMine(); } else if (url.match(/contest\.php/i)) { /* * ======================== * 测验列表 * ======================== */ console.log("测验列表"); let nav = $("table.toprow").children("tbody").children("tr").children("td").children("a"); let pageNav = []; for (let i = 0; i < nav.length; i++) { pageNav[i] = nav[i].href; } let profile = $("#profile"); let mailNumber = ""; let userId = ""; let logged; if (profile.text().match(/登录/)) { logged = false; } else if (profile.text().match(/注销/)) { logged = true; userId = /\s*([a-zA-Z0-9]+)\s/.exec(profile.text())[1]; mailNumber = /\((\d*)\)/.exec(profile.text())[1]; } let contests = document.getElementById("main").children[0].children[2].children[1].children; let head = ""; let body = ""; head += " \n"; head += " \n"; head += " \n"; head += " SZUOJ - 测验\n"; head += " \n"; head += "\n"; body += " \n"; body += "
\n"; body += " \n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += " 测验列表\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += "
    \n"; body += "
  • ID
  • \n"; body += "
  • 测验名称
  • \n"; body += "
  • 状态
  • \n"; body += "
  • 公开性
  • \n"; body += "
\n"; body += "
\n"; body += " \n"; for (let i = 0; i < contests.length; i++) { let x = contests[i].children; body += "
\n"; body += "
    \n"; body += "
  • " + x[0].innerText + "
  • \n"; body += "
  • " + x[1].innerText + "
  • \n"; if (x[2].innerText.match(/Running/i)) { body += "
  • 进行中
  • \n"; } else if (x[2].innerText.match(/Ended/i)) { body += "
  • 已结束" + x[2].innerText.replace(/Ended/i, "") + "
  • \n"; } else { body += "
  • 未开始" + x[2].innerText.replace(/Start/i, "") + "
  • \n"; } if (x[3].innerText.match(/Public/i)) { body += "
  • 公开
  • \n"; } else { body += "
  • 私密
  • \n"; } body += "
\n"; body += "
\n"; } body += "
\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "

All Copyright Reserved 2010-2011\n"; body += " 深圳大学在线判题教学平台 TEAM

\n"; body += "

UI Modified By L.K.

\n"; body += "
\n"; body += " \n"; body += jsNavMine; $("head").html(head); $("body").html(body); } else if (url.match(/loginpage\.php/i)) { /* * ======================== * 登录 * ======================== */ console.log("登录"); let head = ""; let body = ""; head += " \n"; head += " \n"; head += " \n"; head += " SZUOJ - 登录\n"; head += " \n"; head += "\n"; body += " \n"; body += "
\n"; body += " \n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += "
\n"; body += " 登录\n"; body += "
\n"; body += "
\n"; body += " \n"; body += "
\n"; body += "
\n"; body += " \n"; body += "
\n"; body += "
\n"; body += " \n"; body += " \n"; body += "
\n"; body += "
\n"; body += " \n"; body += "
\n"; body += "
\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "

All Copyright Reserved 2010-2011\n"; body += " 深圳大学在线判题教学平台 TEAM

\n"; body += "

UI Modified By L.K.

\n"; body += "
\n"; body += "\n"; body += " \n"; body += jsNavMine; body += " \n"; $("head").html(head); $("body").html(body); } else if (url.match(/contestrank\.php/i)) { /* * ======================== * 名次 * ======================== */ console.log("名次"); let nav = $("table.toprow").children("tbody").children("tr").children("td").children("a"); let pageNav = []; for (let i = 0; i < nav.length; i++) { pageNav[i] = nav[i].href; } let title = /\Contest RankList -- ([^<>]*)\<\/h3\>/.exec(document.getElementById("main").children[4].innerHTML)[1]; let contents = document.getElementById("main").children[5].children[0].children; let liWidth = "width: calc((100% - 610px) / " + (contents[0].children.length - 5) + ")"; let head = ""; let body = ""; head += " \n"; head += " \n"; head += " \n"; head += " SZUOJ - 测验排名\n"; head += " \n"; body += " \n"; body += "
\n"; body += " \n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += " 测验排名 -- " + title + "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "\n"; body += "
\n"; body += "
\n"; body += "
    \n"; body += "
  • 名次
  • \n"; body += "
  • 用户名
  • \n"; body += "
  • 昵称
  • \n"; body += "
  • 解决
  • \n"; body += "
  • 罚时
  • \n"; body += "\n"; for (let i = 5; i < contents[0].children.length; i++) { body += "
  • " + contents[0].children[i].innerHTML + "
  • \n"; } body += "
\n"; body += "
\n"; body += "\n"; for (let i = 1; i < contents.length; i++) { let x = contents[i].children; body += "
\n"; body += " \n"; body += "\n"; body += "
\n"; body += "
    \n"; for (let j = 5; j < x.length; j++) { if (x[j].bgColor.match(/aaffaa/i)) { body += "
  • " + x[j].innerText + "
  • \n"; } else if (x[j].bgColor.match(/ffaaaa/i)) { body += "
  • " + x[j].innerText + "
  • \n"; } else { body += "
  • \n"; } } body += "
\n"; body += "
\n"; body += "
\n"; } body += "\n"; body += "
\n"; body += " \n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "

All Copyright Reserved 2010-2011\n"; body += " 深圳大学在线判题教学平台 TEAM

\n"; body += "

UI Modified By L.K.

\n"; body += "
\n"; body += " \n"; $("head").html(head); $("body").html(body); addNavMine(); } else if (url.match(/problem\.php/i)) { /* * ======================== * 问题 * ======================== */ console.log("问题"); let nav = $("table.toprow").children("tbody").children("tr").children("td").children("a"); let pageNav = []; for (let i = 0; i < nav.length; i++) { pageNav[i] = nav[i].href; } let title = /\([^<>]*)\<\/title\>/.exec($("head").html())[1]; let mainHTML = $("#main").html(); let contents = $("#main").children(".content"); let submitHref = document.getElementById("main").children[1].children; let info = $("#main").children("center").html(); let timeLimit = /\<\/span\>\s*(\d+)\s*Sec/i.exec(info)[1]; let spaceLimit = /\<\/span\>\s*(\d+)\s*MB/i.exec(info)[1]; let submitNum = /提交: \s*\<\/span\>\s*(\d+)\s*/i.exec(info)[1]; let solvedNum = /解决: \s*\<\/span\>\s*(\d+)\s*/i.exec(info)[1]; let head = ""; let body = ""; head += " \n"; head += " \n"; head += " \n"; head += " SZUOJ - " + title + "\n"; head += " \n"; body += " \n"; body += "
\n"; body += " \n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += "
\n"; body += " " + title + "\n"; body += "
\n"; body += "
\n"; body += "
\n"; body += " 时间限制:" + timeLimit + " 秒\n"; body += "
\n"; body += "
\n"; body += " 内存限制:" + spaceLimit + " MB\n"; body += "
\n"; body += "
\n"; body += " 提交:" + submitNum + "\n"; body += "
\n"; body += "
\n"; body += " 解决:" + solvedNum + "\n"; body += "
\n"; body += "
\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += "
\n"; body += " 题目描述\n"; body += "
\n"; body += "
\n"; body += contents[0].innerHTML; body += "
\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += " 输入\n"; body += "
\n"; body += "
\n"; body += contents[1].innerHTML; body += "
\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += " 输出\n"; body += "
\n"; body += "
\n"; body += contents[2].innerHTML; body += "
\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += " 样例输入\n"; body += " \n"; body += " \n"; body += "
\n"; body += "
\n"; body += contents[3].innerHTML + "

"; body += "
\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += " 样例输出\n"; body += " \n"; body += " \n"; body += "
\n"; body += "
\n"; body += contents[4].innerHTML + "

"; body += "
\n"; body += "
\n"; body += "\n"; if (contents[5].innerHTML.replace(/(\<\s*br\s*\/?\>|\\s*\<\/p\>|\s*)/ig, "").length > 0) { body += "
\n"; body += "
\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += " 提示\n"; body += "
\n"; body += "
\n"; body += contents[5].innerHTML; body += "
\n"; body += "
\n"; } body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += " 提交\n"; body += "
\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += " 复制成功\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "

All Copyright Reserved 2010-2011\n"; body += " 深圳大学在线判题教学平台 TEAM

\n"; body += "

UI Modified By L.K.

\n"; body += "
\n"; body += " \n"; $("head").html(head); $("body").html(body); $(document).ready(function() { $(".Body_Main_Div_Title").children("i").click(function() { $(this).parent().children("textarea").get(0).select(); document.execCommand("Copy"); $(".Message_Box").stop(true).fadeIn(500); setTimeout(function() { $(".Message_Box").stop(true).fadeOut(500); }, 1500); }); addNavMine(); }); } else if (url.match(/\/JudgeOnline\/$/i)) { /* * ======================== * 主页 * ======================== */ // console.log("主页"); let profile = $("#profile"); let mailNumber = ""; let userId = ""; let logged; if (profile.text().match(/登录/)) { logged = false; } else if (profile.text().match(/注销/)) { logged = true; userId = /\s*([a-zA-Z0-9]+)\s/.exec(profile.text())[1]; mailNumber = /\((\d*)\)/.exec(profile.text())[1]; } let head = ""; let body = ""; head += " \n"; head += " \n"; head += " \n"; head += " SZUOJ - 测验\n"; head += " \n"; head += "\n"; body += " \n"; body += "
\n"; body += " \n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += " 公告\n"; body += "
\n"; body += " \n"; body += "
\n"; body += " \n"; body += "
\n"; body += document.getElementById("main").children[0].innerHTML; body += "
\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "

All Copyright Reserved 2010-2011\n"; body += " 深圳大学在线判题教学平台 TEAM

\n"; body += "

UI Modified By L.K.

\n"; body += "
\n"; body += " \n"; body += jsNavMine; $("head").html(head); $("body").html(body); } else if (url.match(/faqs.\w+\.php/i)) { /* * ======================== * 常见问答 * ======================== */ console.log("常见问答"); let profile = $("#profile"); let mailNumber = ""; let userId = ""; let logged; if (profile.text().match(/登录/)) { logged = false; } else if (profile.text().match(/注销/)) { logged = true; userId = /\s*([a-zA-Z0-9]+)\s/.exec(profile.text())[1]; mailNumber = /\((\d*)\)/.exec(profile.text())[1]; } let head = ""; let body = ""; head += " \n"; head += " \n"; head += " \n"; head += " SZUOJ - 常见问答\n"; head += " \n"; head += "\n"; body += " \n"; body += "
\n"; body += " \n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += document.getElementById("main").innerHTML; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "

All Copyright Reserved 2010-2011\n"; body += " 深圳大学在线判题教学平台 TEAM

\n"; body += "

UI Modified By L.K.

\n"; body += "
\n"; body += " \n"; body += jsNavMine; $("head").html(head); $("body").html(body); } else if (url.match(/showsource\.php\?id=/i)) { /* * ======================== * 源代码 * ======================== */ console.log("源代码"); window.stop(); let nav = $("table.toprow").children("tbody").children("tr").children("td").children("a"); let pageNav = []; for (let i = 0; i < nav.length; i++) { pageNav[i] = nav[i].href; } let profile = $("#profile"); let mailNumber = ""; let userId = ""; let logged; if (profile.text().match(/登录/)) { logged = false; } else if (profile.text().match(/注销/)) { logged = true; userId = /\s*(\w+)\s/.exec(profile.text())[1]; mailNumber = /\((\d*)\)/.exec(profile.text())[1]; } let pre = document.getElementsByTagName("pre")[0]; let codes = ""; if (pre) { codes = pre.innerText.replace(/\s*$/, ""); } else { codes = document.getElementsByClassName("code")[0].innerText.replace(/\s*$/, ""); } let id = /id=(\d+)/.exec(url)[1]; let head = ""; let body = ""; head += " \n"; head += " \n"; head += " \n"; head += " \n"; head += " SZUOJ - 源代码\n"; head += " \n"; body += " \n"; body += "
\n"; body += " \n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += " 源代码 - ID " + id + "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += " \n"; body += " Darcula\n"; body += "
\n"; body += "
    \n"; body += "
  • Darcula
  • \n"; body += "
  • Monokai
  • \n"; body += "
  • Neo
  • \n"; body += "
\n"; body += "
\n"; body += " \n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += " \n"; body += "
\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "

All Copyright Reserved 2010-2011\n"; body += " 深圳大学在线判题教学平台 TEAM

\n"; body += "

UI Modified By L.K.

\n"; body += "
\n"; body += " \n"; body += "\n"; body += jsNavMine; $("head").html(head); $("body").html(body); jQuery.getScript("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/codemirror.min.js", function(data, status) { let cnt = 0; if (status.match(/success/i)) { jQuery.getScript("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/clike/clike.min.js", function(data, status) { cnt += status.match(/success/i) ? 1 : 0; if (cnt == 4) { loadEditor(); } }); jQuery.getScript("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/addon/hint/show-hint.min.js", function(data, status) { cnt += status.match(/success/i) ? 1 : 0; if (cnt == 4) { loadEditor(); } }); jQuery.getScript("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/addon/edit/matchbrackets.min.js", function(data, status) { cnt += status.match(/success/i) ? 1 : 0; if (cnt == 4) { loadEditor(); } }); jQuery.getScript("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/addon/selection/active-line.min.js", function(data, status) { cnt += status.match(/success/i) ? 1 : 0; if (cnt == 4) { loadEditor(); } }); } }); function loadEditor() { var editor = CodeMirror.fromTextArea(document.getElementById("code"), { lineNumbers: true, indentUnit: 4, styleActiveLine: true, matchBrackets: true, mode: "text/x-c++src", lineWrapping: true, readOnly: true, theme: 'darcula' }); editor.setOption("extraKeys", { Tab: function(cm) { var spaces = Array(cm.getOption("indentUnit") + 1).join(" "); cm.replaceSelection(spaces); } }); editor.setSize('100%', 'auto'); function themeSelect(obj) { let theme = obj.options[obj.selectedIndex].innerText; if (theme.match(/darcula/i)) { editor.setOption("theme", "darcula"); } else if (theme.match(/monokai/i)) { editor.setOption("theme", "monokai"); } else if (theme.match(/neo/i)) { editor.setOption("theme", "neo"); } document.getElementsByClassName("Body_Theme_Span")[0].innerText = theme; } let selectShow = false; $(".Body_Theme").hover(function() { selectShow = true; $(this).children(".Body_Select").stop(true).slideDown(500); }, function() { selectShow = false; setTimeout(function() { if (!selectShow) { $(this).children(".Body_Select").stop(true).slideUp(500); } }.bind(this), 200); }); $(".Body_Theme").children(".Body_Select").children("ul").children("li").click(function() { let x = $(this).parent().parent().parent().children("select").get(0); x.selectedIndex = $(this).index(); themeSelect(x); }); let x = document.getElementsByTagName("select")[0]; if (codes.match(/\#include/)) { editor.setOption("mode", "text/x-c++src"); } else if (codes.match(/(import java\.|public\s+class\s+Main)/)) { editor.setOption("mode", "text/x-java"); } if (pageNav[1] != undefined) { addNavMine(); } else { activeNavMine(); } }; } else if (url.match(/[cr]einfo\.php\?sid=/i)) { /* * ======================== * 错误信息 * ======================== */ console.log("错误信息"); let profile = $("#profile"); let mailNumber = ""; let userId = ""; let logged; if (profile.text().match(/登录/)) { logged = false; } else if (profile.text().match(/注销/)) { logged = true; userId = /\s*([a-zA-Z0-9]+)\s/.exec(profile.text())[1]; mailNumber = /\((\d*)\)/.exec(profile.text())[1]; } let head = ""; let body = ""; head += " \n"; head += " \n"; head += " \n"; head += " SZUOJ - 错误信息\n"; head += " \n"; head += "\n"; body += " \n"; body += "
\n"; body += " \n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += " 错误信息\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += document.getElementById("main").innerHTML; body += "\n"; body += "
\n"; body += " \n"; body += "
\n"; body += "\n"; body += "
\n"; body += " \n"; body += document.getElementById("errexp").innerHTML; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += " 返回\n"; body += "
\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "

All Copyright Reserved 2010-2011\n"; body += " 深圳大学在线判题教学平台 TEAM

\n"; body += "

UI Modified By L.K.

\n"; body += "
\n"; body += " \n"; body += jsNavMine; $("head").html(head); $("body").html(body); } else if (url.match(/submitpage\.php\?/i)) { /* * ======================== * 提交 * ======================== */ console.log("提交"); window.stop(); if (document.body.innerText.match(/Please Login/i)) { window.location.href = "loginpage.php"; } let nav = $("table.toprow").children("tbody").children("tr").children("td").children("a"); let pageNav = []; for (let i = 0; i < nav.length; i++) { pageNav[i] = nav[i].href; } let profile = $("#profile"); let mailNumber = ""; let userId = ""; let logged; if (profile.text().match(/登录/)) { logged = false; } else if (profile.text().match(/注销/)) { logged = true; userId = /\s*(\w+)\s/.exec(profile.text())[1]; mailNumber = /\((\d*)\)/.exec(profile.text())[1]; } let codes = document.getElementsByTagName("textarea")[0].value; let cid = ""; let pid = ""; if (url.match(/cid=/i)) { cid = /cid=(\d+)/.exec(url)[1]; } if (url.match(/pid=/i)) { pid = /pid=(\d+)/.exec(url)[1]; } let head = ""; let body = ""; head += " \n"; head += " \n"; head += " \n"; head += " \n"; head += " SZUOJ - 提交\n"; head += " \n"; body += " \n"; body += "
\n"; body += " \n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += "
\n"; body += " 提交代码 - 问题 " + document.getElementsByTagName("form")[0].children[0].innerText + "\n"; body += "
\n"; body += "\n"; if (cid != "") { body += " \n"; } if (pid != "") { body += " \n"; } body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "
\n"; body += " \n"; body += " C++\n"; body += "
\n"; body += "
    \n"; body += "
  • C
  • \n"; body += "
  • C++
  • \n"; body += "
  • Java
  • \n"; body += "
\n"; body += "
\n"; body += " \n"; body += "
\n"; body += "\n"; body += "
\n"; body += " \n"; body += " Darcula\n"; body += "
\n"; body += "
    \n"; body += "
  • Darcula
  • \n"; body += "
  • Monokai
  • \n"; body += "
  • Neo
  • \n"; body += "
\n"; body += "
\n"; body += " \n"; body += "
\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += " \n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += " \n"; body += "
\n"; body += "
\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "\n"; body += "
\n"; body += "

All Copyright Reserved 2010-2011\n"; body += " 深圳大学在线判题教学平台 TEAM

\n"; body += "

UI Modified By L.K.

\n"; body += "
\n"; body += " \n"; body += "\n"; body += jsNavMine; $("head").html(head); $("body").html(body); jQuery.getScript("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/codemirror.min.js", function(data, status) { let cnt = 0; if (status.match(/success/i)) { jQuery.getScript("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/clike/clike.min.js", function(data, status) { cnt += status.match(/success/i) ? 1 : 0; if (cnt == 4) { loadEditor(); } }); jQuery.getScript("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/addon/hint/show-hint.min.js", function(data, status) { cnt += status.match(/success/i) ? 1 : 0; if (cnt == 4) { loadEditor(); } }); jQuery.getScript("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/addon/edit/matchbrackets.min.js", function(data, status) { cnt += status.match(/success/i) ? 1 : 0; if (cnt == 4) { loadEditor(); } }); jQuery.getScript("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/addon/selection/active-line.min.js", function(data, status) { cnt += status.match(/success/i) ? 1 : 0; if (cnt == 4) { loadEditor(); } }); } }); function loadEditor() { var editor = CodeMirror.fromTextArea(document.getElementById("code"), { lineNumbers: true, indentUnit: 4, styleActiveLine: true, matchBrackets: true, lineWrapping: true, theme: 'darcula', mode: "text/x-c++src" }); editor.setOption("extraKeys", { Tab: function(cm) { var spaces = Array(cm.getOption("indentUnit") + 1).join(" "); cm.replaceSelection(spaces); } }); editor.setSize('100%', '100%'); function languageSelect(obj) { let lang = obj.options[obj.selectedIndex].innerText; if (lang.match(/C/i)) { editor.setOption("mode", "text/x-csrc"); } else if (lang.match(/C\+\+/i)) { editor.setOption("mode", "text/x-c++src"); } else if (lang.match(/Java/i)) { editor.setOption("mode", "text/x-java"); } document.getElementsByClassName("Body_Control_Span")[0].innerText = lang; } function themeSelect(obj) { let theme = obj.options[obj.selectedIndex].innerText; if (theme.match(/darcula/i)) { editor.setOption("theme", "darcula"); } else if (theme.match(/monokai/i)) { editor.setOption("theme", "monokai"); } else if (theme.match(/neo/i)) { editor.setOption("theme", "neo"); } document.getElementsByClassName("Body_Control_Span")[1].innerText = theme; } let selectShow = [false, false]; $(".Body_Control").children("div").hover(function() { selectShow[$(this).index()] = true; $(this).children(".Body_Select").stop(true).slideDown(500); }, function() { selectShow[$(this).index()] = false; setTimeout(function() { if (!selectShow[$(this).index()]) { $(this).children(".Body_Select").stop(true).slideUp(500); } }.bind(this), 200); }); $(".Body_Language").children(".Body_Select").children("ul").children("li").click(function() { let x = $(this).parent().parent().parent().children("select").get(0); x.selectedIndex = $(this).index(); languageSelect(x); }); $(".Body_Theme").children(".Body_Select").children("ul").children("li").click(function() { let x = $(this).parent().parent().parent().children("select").get(0); x.selectedIndex = $(this).index(); themeSelect(x); }); let x = document.getElementsByTagName("select")[0]; if (codes.match(/(\#include|int\s+main(\s+))/)) { x.selectedIndex = 1; languageSelect(x); } else if (codes.match(/(import\s+java\.|public\s+class\s+Main)/)) { x.selectedIndex = 2; languageSelect(x); } if (pageNav[1] != undefined) { addNavMine(); } else { activeNavMine(); } }; } })();