From dcea068cd0c7c1420a8c75e5749dd85f12985354 Mon Sep 17 00:00:00 2001 From: boomzero Date: Thu, 2 Oct 2025 21:44:50 +0800 Subject: [PATCH 01/25] Update CSS selector --- XMOJ.user.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/XMOJ.user.js b/XMOJ.user.js index 7236b5a8..44942855 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1669,6 +1669,9 @@ async function main() { if (SubmitLink == null) { SubmitLink = document.querySelector('.mt-3 > center:nth-child(1) > a:nth-child(9)'); } + if (SubmitLink == null) { //为什么这个破东西老是换位置 + SubmitLink = document.querySelector('.mt-3 > center:nth-child(1) > a:nth-child(7)'); + } let SubmitButton = document.createElement('button'); SubmitButton.id = 'SubmitButton'; SubmitButton.className = 'btn btn-outline-secondary'; From 081f7f325f02b9104899cc15902d35b94b9a731b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 2 Oct 2025 13:47:30 +0000 Subject: [PATCH 02/25] 2.4.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dbafb19a..13e14585 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "2.4.0", + "version": "2.4.1", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From d0f4549e60cde6b6eb87a562ba08a4fe2f5079d3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 2 Oct 2025 13:47:36 +0000 Subject: [PATCH 03/25] Update version info to 2.4.1 --- Update.json | 11 +++++++++++ XMOJ.user.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Update.json b/Update.json index 2ae346f5..55d41a62 100644 --- a/Update.json +++ b/Update.json @@ -3080,6 +3080,17 @@ } ], "Notes": "请尽快升级至本版本!" + }, + "2.4.1": { + "UpdateDate": 1759412851092, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 861, + "Description": "Update CSS selector" + } + ], + "Notes": "No release notes were provided for this release." } } } \ No newline at end of file diff --git a/XMOJ.user.js b/XMOJ.user.js index 44942855..0cb98cfd 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 2.4.0 +// @version 2.4.1 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen From 249456f06a3f2c3dd5e25efac41c3496a1b4367e Mon Sep 17 00:00:00 2001 From: boomzero Date: Thu, 2 Oct 2025 21:58:09 +0800 Subject: [PATCH 04/25] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E2=80=9CNaN=E5=B9=B4?= =?UTF-8?q?=E5=89=8D=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- XMOJ.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/XMOJ.user.js b/XMOJ.user.js index 0cb98cfd..4e52b30e 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -81,7 +81,7 @@ let SmartAlert = (Message) => { */ let GetRelativeTime = (Input) => { try { - Input = new Date(Input); + Input = new Date(parseInt(Input)); let Now = new Date().getTime(); let Delta = Now - Input.getTime(); let RelativeName = ""; From 7841538fbf9edf485eb6a54458c63c41fdb12fb8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 2 Oct 2025 13:59:44 +0000 Subject: [PATCH 05/25] 2.4.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 13e14585..96024050 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "2.4.1", + "version": "2.4.2", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From 6b6ffe03a572733ee00060398d72982eda346588 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 2 Oct 2025 13:59:50 +0000 Subject: [PATCH 06/25] Update version info to 2.4.2 --- Update.json | 11 +++++++++++ XMOJ.user.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Update.json b/Update.json index 55d41a62..2d12bb6d 100644 --- a/Update.json +++ b/Update.json @@ -3091,6 +3091,17 @@ } ], "Notes": "No release notes were provided for this release." + }, + "2.4.2": { + "UpdateDate": 1759413584731, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 863, + "Description": "修复“NaN年前“" + } + ], + "Notes": "修复“NaN年前“" } } } \ No newline at end of file diff --git a/XMOJ.user.js b/XMOJ.user.js index 4e52b30e..76e939a4 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 2.4.1 +// @version 2.4.2 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen From 3b4873f59aae28c1055557ffe71140a0983dba1d Mon Sep 17 00:00:00 2001 From: boomzero Date: Thu, 2 Oct 2025 22:06:16 +0800 Subject: [PATCH 07/25] =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- XMOJ.user.js | 117 +-------------------------------------------------- 1 file changed, 1 insertion(+), 116 deletions(-) diff --git a/XMOJ.user.js b/XMOJ.user.js index 76e939a4..33c8a789 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1469,7 +1469,7 @@ async function main() { "Name": "恢复讨论与短消息功能" }, { "ID": "MoreSTD", "Type": "F", "Name": "查看到更多标程" - }, {"ID": "ApplyData", "Type": "A", "Name": "获取数据功能"}, { + }, { "ID": "AutoCheat", "Type": "A", "Name": "自动提交当年代码" }, {"ID": "Rating", "Type": "A", "Name": "添加用户评分和用户名颜色"}, { "ID": "AutoRefresh", "Type": "A", "Name": "比赛列表、比赛排名界面自动刷新" @@ -3420,121 +3420,6 @@ async function main() { if (document.getElementById("apply_data")) { let ApplyDiv = document.getElementById("apply_data").parentElement; console.log("启动!!!"); - if (UtilityEnabled("ApplyData")) { - let GetDataButton = document.createElement("button"); - GetDataButton.className = "ms-2 btn btn-outline-secondary"; - GetDataButton.innerText = "获取数据"; - console.log("按钮创建成功"); - ApplyDiv.appendChild(GetDataButton); - GetDataButton.addEventListener("click", async () => { - GetDataButton.disabled = true; - GetDataButton.innerText = "正在获取数据..."; - let PID = localStorage.getItem("UserScript-Solution-" + SearchParams.get("sid") + "-Problem"); - if (PID == null) { - GetDataButton.innerText = "失败! 无法获取PID"; - GetDataButton.disabled = false; - await new Promise((resolve) => { - setTimeout(resolve, 800); - }); - GetDataButton.innerText = "获取数据"; - return; - } - let Code = ""; - if (localStorage.getItem(`UserScript-Problem-${PID}-IOFilename`) !== null) { - Code = `#define IOFile "${localStorage.getItem(`UserScript-Problem-${PID}-IOFilename`)}"\n`; - } - Code += `//XMOJ-Script 获取数据代码 - #include -using namespace std; -string Base64Encode(string Input) -{ - const string Base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - string Output; - for (int i = 0; i < Input.length(); i += 3) - { - Output.push_back(i + 0 > Input.length() ? '=' : Base64Chars[(Input[i + 0] & 0xfc) >> 2]); - Output.push_back(i + 1 > Input.length() ? '=' : Base64Chars[((Input[i + 0] & 0x03) << 4) + ((Input[i + 1] & 0xf0) >> 4)]); - Output.push_back(i + 2 > Input.length() ? '=' : Base64Chars[((Input[i + 1] & 0x0f) << 2) + ((Input[i + 2] & 0xc0) >> 6)]); - Output.push_back(i + 3 > Input.length() ? '=' : Base64Chars[Input[i + 2] & 0x3f]); - } - return Output; -} -int main() -{ -#ifdef IOFile - freopen(IOFile ".in", "r", stdin); - freopen(IOFile ".out", "w", stdout); -#endif - string Input; - while (1) - { - char Data = getchar(); - if (Data == EOF) - break; - Input.push_back(Data); - } - throw runtime_error("[" + Base64Encode(Input.c_str()) + "]"); - return 0; -}`; - - await fetch("https://www.xmoj.tech/submit.php", { - "headers": { - "content-type": "application/x-www-form-urlencoded" - }, - "referrer": "https://www.xmoj.tech/submitpage.php?id=" + PID, - "method": "POST", - "body": "id=" + PID + "&" + "language=1&" + "source=" + encodeURIComponent(Code) + "&" + "enable_O2=on" - }); - - let SID = await fetch("https://www.xmoj.tech/status.php").then((Response) => { - return Response.text(); - }).then((Response) => { - let ParsedDocument = new DOMParser().parseFromString(Response, "text/html"); - return ParsedDocument.querySelector("#result-tab > tbody > tr:nth-child(1) > td:nth-child(2)").innerText; - }); - - await new Promise((Resolve) => { - let Interval = setInterval(async () => { - await fetch("status-ajax.php?solution_id=" + SID).then((Response) => { - return Response.text(); - }).then((Response) => { - if (Response.split(",")[0] >= 4) { - clearInterval(Interval); - Resolve(); - } - }); - }, 500); - }); - - await fetch(`https://www.xmoj.tech/reinfo.php?sid=${SID}`).then((Response) => { - return Response.text(); - }).then((Response) => { - let ParsedDocument = new DOMParser().parseFromString(Response, "text/html"); - let ErrorData = ParsedDocument.getElementById("errtxt").innerText; - let MatchResult = ErrorData.match(/\what\(\): \[([A-Za-z0-9+\/=]+)\]/g); - if (MatchResult === null) { - GetDataButton.innerText = "获取数据失败"; - GetDataButton.disabled = false; - return; - } - for (let i = 0; i < MatchResult.length; i++) { - let Data = CryptoJS.enc.Base64.parse(MatchResult[i].substring(10, MatchResult[i].length - 1)).toString(CryptoJS.enc.Utf8); - ApplyDiv.appendChild(document.createElement("hr")); - ApplyDiv.appendChild(document.createTextNode("数据" + (i + 1) + ":")); - let CodeElement = document.createElement("div"); - ApplyDiv.appendChild(CodeElement); - CodeMirror(CodeElement, { - value: Data, - theme: (UtilityEnabled("DarkMode") ? "darcula" : "default"), - lineNumbers: true, - readOnly: true - }).setSize("100%", "auto"); - } - GetDataButton.innerText = "获取数据成功"; - GetDataButton.disabled = false; - }); - }); - } document.getElementById("apply_data").addEventListener("click", () => { let ApplyElements = document.getElementsByClassName("data"); for (let i = 0; i < ApplyElements.length; i++) { From 037a14eeb12b4a814fb660b7f1ee37d4bf5af0fd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 2 Oct 2025 14:10:58 +0000 Subject: [PATCH 08/25] 2.4.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 96024050..8bee29cf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "2.4.2", + "version": "2.4.3", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From d5a66904c3efae720dea5c952766287408653940 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 2 Oct 2025 14:11:04 +0000 Subject: [PATCH 09/25] Update version info to 2.4.3 --- Update.json | 11 +++++++++++ XMOJ.user.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Update.json b/Update.json index 2d12bb6d..b1d2d6cf 100644 --- a/Update.json +++ b/Update.json @@ -3102,6 +3102,17 @@ } ], "Notes": "修复“NaN年前“" + }, + "2.4.3": { + "UpdateDate": 1759414259108, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 865, + "Description": "删除获取数据功能" + } + ], + "Notes": "因为它利用的bug被修复了" } } } \ No newline at end of file diff --git a/XMOJ.user.js b/XMOJ.user.js index 33c8a789..812c41a0 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 2.4.2 +// @version 2.4.3 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen From 565b959885f9541bcb3404ec4ed43cc931dcaea2 Mon Sep 17 00:00:00 2001 From: boomzero Date: Thu, 2 Oct 2025 22:37:29 +0800 Subject: [PATCH 10/25] =?UTF-8?q?=E6=AF=94=E8=B5=9B=E9=A2=98=E7=9B=AE?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=87=8C=E5=B7=A6=E4=BE=A7=E6=A0=8F=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E9=A2=98=E7=9B=AE=E5=BA=8F=E5=8F=B7=E5=88=97=E8=A1=A8?= =?UTF-8?q?(#860)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- XMOJ.user.js | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/XMOJ.user.js b/XMOJ.user.js index 812c41a0..2d74a0ec 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1644,6 +1644,53 @@ async function main() { await RenderMathJax(); if (SearchParams.get("cid") != null) { document.getElementsByTagName("h2")[0].innerHTML += " (" + localStorage.getItem("UserScript-Contest-" + SearchParams.get("cid") + "-Problem-" + SearchParams.get("pid") + "-PID") + ")"; + let ContestProblemList = localStorage.getItem("UserScript-Contest-" + SearchParams.get("cid") + "-ProblemList"); + if (ContestProblemList == null) { + const contestReq = await fetch("https://www.xmoj.tech/contest.php?cid=" + SearchParams.get("cid")); + const res = await contestReq.text(); + if (contestReq.status === 200 && res.indexOf("比赛尚未开始或私有,不能查看题目。") === -1) { + const parser = new DOMParser(); + const dom = parser.parseFromString(res, "text/html"); + const rows = (dom.querySelector("#problemset > tbody")).rows; + let problemList = []; + for (let i = 0; i < rows.length; i++) { + problemList.push({ + "title": rows[i].children[2].innerText, + "url": rows[i].children[2].children[0].href + }); + } + localStorage.setItem("UserScript-Contest-" + SearchParams.get("cid") + "-ProblemList", JSON.stringify(problemList)); + ContestProblemList = JSON.stringify(problemList); + } + } + + let problemSwitcher = document.createElement("div"); + problemSwitcher.style.position = "fixed"; + problemSwitcher.style.top = "50%"; + problemSwitcher.style.left = "0"; + problemSwitcher.style.transform = "translateY(-50%)"; + problemSwitcher.style.width = "auto"; + if (document.querySelector("html").getAttribute("data-bs-theme") == "dark") { + problemSwitcher.style.backgroundColor = "rgba(0, 0, 0, 0.8)"; + } else { + problemSwitcher.style.backgroundColor = "rgba(255, 255, 255, 0.8)"; + } + problemSwitcher.style.padding = "10px"; + problemSwitcher.style.borderRadius = "0 10px 10px 0"; + problemSwitcher.style.display = "flex"; + problemSwitcher.style.flexDirection = "column"; + + let problemList = JSON.parse(ContestProblemList); + for (let i = 0; i < problemList.length; i++) { + let buttonText = ""; + if (i < 26) { + buttonText = String.fromCharCode(65 + i); + } else { + buttonText = String.fromCharCode(97 + (i - 26)); + } + problemSwitcher.innerHTML += `${buttonText}`; + } + document.body.appendChild(problemSwitcher); } if (document.querySelector("body > div > div.mt-3 > h2") != null) { document.querySelector("body > div > div.mt-3").innerHTML = "没有此题目或题目对你不可见"; From 44821f1057c7ad5eeb930ceaaa88f2b161340b98 Mon Sep 17 00:00:00 2001 From: boomzero Date: Thu, 2 Oct 2025 23:00:00 +0800 Subject: [PATCH 11/25] Make this feature disableable --- XMOJ.user.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/XMOJ.user.js b/XMOJ.user.js index 2d74a0ec..46bda834 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1506,6 +1506,8 @@ async function main() { }, { "ID": "RefreshSolution", "Type": "F", "Name": "状态页面结果自动刷新每次只能刷新一个" }, {"ID": "CopyMD", "Type": "A", "Name": "复制题目或题解内容"}, { + "ID": "ProblemSwitcher", "Type": "A", "Name": "比赛题目切换器" + }, { "ID": "OpenAllProblem", "Type": "A", "Name": "比赛题目界面一键打开所有题目" }, { "ID": "CheckCode", "Type": "A", "Name": "提交代码前对代码进行检查", "Children": [{ @@ -1642,7 +1644,7 @@ async function main() { } } else if (location.pathname == "/problem.php") { await RenderMathJax(); - if (SearchParams.get("cid") != null) { + if (SearchParams.get("cid") != null && UtilityEnabled("ProblemSwitcher")) { document.getElementsByTagName("h2")[0].innerHTML += " (" + localStorage.getItem("UserScript-Contest-" + SearchParams.get("cid") + "-Problem-" + SearchParams.get("pid") + "-PID") + ")"; let ContestProblemList = localStorage.getItem("UserScript-Contest-" + SearchParams.get("cid") + "-ProblemList"); if (ContestProblemList == null) { @@ -1669,7 +1671,8 @@ async function main() { problemSwitcher.style.top = "50%"; problemSwitcher.style.left = "0"; problemSwitcher.style.transform = "translateY(-50%)"; - problemSwitcher.style.width = "auto"; + problemSwitcher.style.maxHeight = "80vh"; + problemSwitcher.style.overflowY = "auto"; if (document.querySelector("html").getAttribute("data-bs-theme") == "dark") { problemSwitcher.style.backgroundColor = "rgba(0, 0, 0, 0.8)"; } else { @@ -1688,7 +1691,11 @@ async function main() { } else { buttonText = String.fromCharCode(97 + (i - 26)); } - problemSwitcher.innerHTML += `${buttonText}`; + let activeClass = ""; + if (problemList[i].url === location.href) { + activeClass = "active"; + } + problemSwitcher.innerHTML += `${buttonText}`; } document.body.appendChild(problemSwitcher); } From 1f71aa85c57351409d420127b3bc2037ee578821 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 2 Oct 2025 15:02:42 +0000 Subject: [PATCH 12/25] 2.4.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8bee29cf..169470fd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "2.4.3", + "version": "2.4.4", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From 095531164d0f9d0b5ba543c061666436505b4d45 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 2 Oct 2025 15:02:48 +0000 Subject: [PATCH 13/25] Update version info to 2.4.4 --- Update.json | 11 +++++++++++ XMOJ.user.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Update.json b/Update.json index b1d2d6cf..96f64b2d 100644 --- a/Update.json +++ b/Update.json @@ -3113,6 +3113,17 @@ } ], "Notes": "因为它利用的bug被修复了" + }, + "2.4.4": { + "UpdateDate": 1759417362937, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 866, + "Description": "比赛题目页面里左侧栏加入题目序号列表" + } + ], + "Notes": "#860 ..." } } } \ No newline at end of file diff --git a/XMOJ.user.js b/XMOJ.user.js index 46bda834..69dfca7f 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 2.4.3 +// @version 2.4.4 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen From e6ca3d73fa51c79d233980b31bc0416775b45526 Mon Sep 17 00:00:00 2001 From: boomzero Date: Fri, 3 Oct 2025 18:28:33 +0800 Subject: [PATCH 14/25] Update CSS selector (#868) --- XMOJ.user.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/XMOJ.user.js b/XMOJ.user.js index 69dfca7f..e0cb1829 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1726,6 +1726,9 @@ async function main() { if (SubmitLink == null) { //为什么这个破东西老是换位置 SubmitLink = document.querySelector('.mt-3 > center:nth-child(1) > a:nth-child(7)'); } + if (SubmitLink == null) { //tmd又换位置 + SubmitLink = document.querySelector('.mt-3 > center:nth-child(1) > a:nth-child(8)'); + } let SubmitButton = document.createElement('button'); SubmitButton.id = 'SubmitButton'; SubmitButton.className = 'btn btn-outline-secondary'; From a6d9d067fb6597a62d4a88ef59065bc4ccad518b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 3 Oct 2025 10:30:12 +0000 Subject: [PATCH 15/25] 2.4.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 169470fd..a3ac3141 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "2.4.4", + "version": "2.4.5", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From 76864317db669c04876971159eca757f189452cb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 3 Oct 2025 10:30:18 +0000 Subject: [PATCH 16/25] Update version info to 2.4.5 --- Update.json | 11 +++++++++++ XMOJ.user.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Update.json b/Update.json index 96f64b2d..9c4a525a 100644 --- a/Update.json +++ b/Update.json @@ -3124,6 +3124,17 @@ } ], "Notes": "#860 ..." + }, + "2.4.5": { + "UpdateDate": 1759487413226, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 869, + "Description": "Update CSS selector (again...)" + } + ], + "Notes": "为什么这个破东西老是换位置" } } } \ No newline at end of file diff --git a/XMOJ.user.js b/XMOJ.user.js index e0cb1829..f10f0fa4 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 2.4.4 +// @version 2.4.5 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen From 84054aa0959963d827e998592a97ebe1cbc9999b Mon Sep 17 00:00:00 2001 From: boomzero Date: Sat, 4 Oct 2025 11:32:31 +0800 Subject: [PATCH 17/25] Add tooltip for ProblemSwitcher --- XMOJ.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/XMOJ.user.js b/XMOJ.user.js index f10f0fa4..f6e4f285 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1695,7 +1695,7 @@ async function main() { if (problemList[i].url === location.href) { activeClass = "active"; } - problemSwitcher.innerHTML += `${buttonText}`; + problemSwitcher.innerHTML += `${buttonText}`; } document.body.appendChild(problemSwitcher); } From a0727e2595abf8b84d1b431cd863d0e0b5b2d98a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 4 Oct 2025 03:35:58 +0000 Subject: [PATCH 18/25] 2.4.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a3ac3141..d377dcd3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "2.4.5", + "version": "2.4.6", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From 822bb4ded3b3d7ebf03c68cadfd9e40b7c3eca0a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 4 Oct 2025 03:36:03 +0000 Subject: [PATCH 19/25] Update version info to 2.4.6 --- Update.json | 11 +++++++++++ XMOJ.user.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Update.json b/Update.json index 9c4a525a..f47aa41b 100644 --- a/Update.json +++ b/Update.json @@ -3135,6 +3135,17 @@ } ], "Notes": "为什么这个破东西老是换位置" + }, + "2.4.6": { + "UpdateDate": 1759548958578, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 871, + "Description": "Add tooltip for ProblemSwitcher" + } + ], + "Notes": "现在, 你只需要将鼠标悬浮在比赛题目切换器上方, 即可查看题目名称" } } } \ No newline at end of file diff --git a/XMOJ.user.js b/XMOJ.user.js index f6e4f285..5db634a6 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 2.4.5 +// @version 2.4.6 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen From 4aaa1a3227b3b2435abffcb1796a50d1d1b848e6 Mon Sep 17 00:00:00 2001 From: boomzero Date: Sat, 4 Oct 2025 11:47:19 +0800 Subject: [PATCH 20/25] =?UTF-8?q?Revert=20"=E5=88=A0=E9=99=A4=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=95=B0=E6=8D=AE=E5=8A=9F=E8=83=BD"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 3b4873f59aae28c1055557ffe71140a0983dba1d. --- XMOJ.user.js | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 116 insertions(+), 1 deletion(-) diff --git a/XMOJ.user.js b/XMOJ.user.js index 5db634a6..290bb789 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1469,7 +1469,7 @@ async function main() { "Name": "恢复讨论与短消息功能" }, { "ID": "MoreSTD", "Type": "F", "Name": "查看到更多标程" - }, { + }, {"ID": "ApplyData", "Type": "A", "Name": "获取数据功能"}, { "ID": "AutoCheat", "Type": "A", "Name": "自动提交当年代码" }, {"ID": "Rating", "Type": "A", "Name": "添加用户评分和用户名颜色"}, { "ID": "AutoRefresh", "Type": "A", "Name": "比赛列表、比赛排名界面自动刷新" @@ -3477,6 +3477,121 @@ async function main() { if (document.getElementById("apply_data")) { let ApplyDiv = document.getElementById("apply_data").parentElement; console.log("启动!!!"); + if (UtilityEnabled("ApplyData")) { + let GetDataButton = document.createElement("button"); + GetDataButton.className = "ms-2 btn btn-outline-secondary"; + GetDataButton.innerText = "获取数据"; + console.log("按钮创建成功"); + ApplyDiv.appendChild(GetDataButton); + GetDataButton.addEventListener("click", async () => { + GetDataButton.disabled = true; + GetDataButton.innerText = "正在获取数据..."; + let PID = localStorage.getItem("UserScript-Solution-" + SearchParams.get("sid") + "-Problem"); + if (PID == null) { + GetDataButton.innerText = "失败! 无法获取PID"; + GetDataButton.disabled = false; + await new Promise((resolve) => { + setTimeout(resolve, 800); + }); + GetDataButton.innerText = "获取数据"; + return; + } + let Code = ""; + if (localStorage.getItem(`UserScript-Problem-${PID}-IOFilename`) !== null) { + Code = `#define IOFile "${localStorage.getItem(`UserScript-Problem-${PID}-IOFilename`)}"\n`; + } + Code += `//XMOJ-Script 获取数据代码 + #include +using namespace std; +string Base64Encode(string Input) +{ + const string Base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + string Output; + for (int i = 0; i < Input.length(); i += 3) + { + Output.push_back(i + 0 > Input.length() ? '=' : Base64Chars[(Input[i + 0] & 0xfc) >> 2]); + Output.push_back(i + 1 > Input.length() ? '=' : Base64Chars[((Input[i + 0] & 0x03) << 4) + ((Input[i + 1] & 0xf0) >> 4)]); + Output.push_back(i + 2 > Input.length() ? '=' : Base64Chars[((Input[i + 1] & 0x0f) << 2) + ((Input[i + 2] & 0xc0) >> 6)]); + Output.push_back(i + 3 > Input.length() ? '=' : Base64Chars[Input[i + 2] & 0x3f]); + } + return Output; +} +int main() +{ +#ifdef IOFile + freopen(IOFile ".in", "r", stdin); + freopen(IOFile ".out", "w", stdout); +#endif + string Input; + while (1) + { + char Data = getchar(); + if (Data == EOF) + break; + Input.push_back(Data); + } + throw runtime_error("[" + Base64Encode(Input.c_str()) + "]"); + return 0; +}`; + + await fetch("https://www.xmoj.tech/submit.php", { + "headers": { + "content-type": "application/x-www-form-urlencoded" + }, + "referrer": "https://www.xmoj.tech/submitpage.php?id=" + PID, + "method": "POST", + "body": "id=" + PID + "&" + "language=1&" + "source=" + encodeURIComponent(Code) + "&" + "enable_O2=on" + }); + + let SID = await fetch("https://www.xmoj.tech/status.php").then((Response) => { + return Response.text(); + }).then((Response) => { + let ParsedDocument = new DOMParser().parseFromString(Response, "text/html"); + return ParsedDocument.querySelector("#result-tab > tbody > tr:nth-child(1) > td:nth-child(2)").innerText; + }); + + await new Promise((Resolve) => { + let Interval = setInterval(async () => { + await fetch("status-ajax.php?solution_id=" + SID).then((Response) => { + return Response.text(); + }).then((Response) => { + if (Response.split(",")[0] >= 4) { + clearInterval(Interval); + Resolve(); + } + }); + }, 500); + }); + + await fetch(`https://www.xmoj.tech/reinfo.php?sid=${SID}`).then((Response) => { + return Response.text(); + }).then((Response) => { + let ParsedDocument = new DOMParser().parseFromString(Response, "text/html"); + let ErrorData = ParsedDocument.getElementById("errtxt").innerText; + let MatchResult = ErrorData.match(/\what\(\): \[([A-Za-z0-9+\/=]+)\]/g); + if (MatchResult === null) { + GetDataButton.innerText = "获取数据失败"; + GetDataButton.disabled = false; + return; + } + for (let i = 0; i < MatchResult.length; i++) { + let Data = CryptoJS.enc.Base64.parse(MatchResult[i].substring(10, MatchResult[i].length - 1)).toString(CryptoJS.enc.Utf8); + ApplyDiv.appendChild(document.createElement("hr")); + ApplyDiv.appendChild(document.createTextNode("数据" + (i + 1) + ":")); + let CodeElement = document.createElement("div"); + ApplyDiv.appendChild(CodeElement); + CodeMirror(CodeElement, { + value: Data, + theme: (UtilityEnabled("DarkMode") ? "darcula" : "default"), + lineNumbers: true, + readOnly: true + }).setSize("100%", "auto"); + } + GetDataButton.innerText = "获取数据成功"; + GetDataButton.disabled = false; + }); + }); + } document.getElementById("apply_data").addEventListener("click", () => { let ApplyElements = document.getElementsByClassName("data"); for (let i = 0; i < ApplyElements.length; i++) { From 1d8db8bcfdf6729c9b6d7eddafda07458bea3e47 Mon Sep 17 00:00:00 2001 From: boomzero Date: Sat, 4 Oct 2025 11:48:58 +0800 Subject: [PATCH 21/25] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- XMOJ.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/XMOJ.user.js b/XMOJ.user.js index 290bb789..5223c9c9 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -3530,7 +3530,7 @@ int main() break; Input.push_back(Data); } - throw runtime_error("[" + Base64Encode(Input.c_str()) + "]"); + throw logic_error("[" + Base64Encode(Input.c_str()) + "]"); return 0; }`; From b297b717f10cf689fb268a04a689a8e9768f94c2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 4 Oct 2025 03:50:26 +0000 Subject: [PATCH 22/25] 2.4.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d377dcd3..bed46fd2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "2.4.6", + "version": "2.4.7", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From eef02d8ec437bd0414f49f12488985316b0d6acf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 4 Oct 2025 03:50:31 +0000 Subject: [PATCH 23/25] Update version info to 2.4.7 --- Update.json | 11 +++++++++++ XMOJ.user.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Update.json b/Update.json index f47aa41b..3cfa82ff 100644 --- a/Update.json +++ b/Update.json @@ -3146,6 +3146,17 @@ } ], "Notes": "现在, 你只需要将鼠标悬浮在比赛题目切换器上方, 即可查看题目名称" + }, + "2.4.7": { + "UpdateDate": 1759549826774, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 872, + "Description": "修复获取数据" + } + ], + "Notes": "funny" } } } \ No newline at end of file diff --git a/XMOJ.user.js b/XMOJ.user.js index 5223c9c9..a27eb5ec 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 2.4.6 +// @version 2.4.7 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen From ef32bc926bd3ca63bccfec0d60e6fdef1c86e206 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 4 Oct 2025 08:55:03 +0000 Subject: [PATCH 24/25] 2.5.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bed46fd2..b0598518 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "2.4.7", + "version": "2.5.0", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From a33be0b5d570828f5c8c47b06aa2f389544138eb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 4 Oct 2025 08:55:04 +0000 Subject: [PATCH 25/25] Update to release 2.5.0 --- Update.json | 35 +++++++++++++++++++++++++++++++++++ XMOJ.user.js | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/Update.json b/Update.json index 3cfa82ff..7c45a663 100644 --- a/Update.json +++ b/Update.json @@ -3157,6 +3157,41 @@ } ], "Notes": "funny" + }, + "2.5.0": { + "UpdateDate": 1759568103629, + "Prerelease": false, + "UpdateContents": [ + { + "PR": 861, + "Description": "Update CSS selector" + }, + { + "PR": 863, + "Description": "修复“NaN年前“" + }, + { + "PR": 865, + "Description": "删除获取数据功能" + }, + { + "PR": 866, + "Description": "比赛题目页面里左侧栏加入题目序号列表" + }, + { + "PR": 869, + "Description": "Update CSS selector (again...)" + }, + { + "PR": 871, + "Description": "Add tooltip for ProblemSwitcher" + }, + { + "PR": 872, + "Description": "修复获取数据" + } + ], + "Notes": "XMOJ-Script 2.5.0 新增了比赛题目切换器,方便您在题目之间快速切换。此功能默认启用,您也可以在设置中禁用它。本版本还修复了一个导致时间显示为“NaN年前”的错误, 更新了一些 CSS selector,以适应 XMOJ 网站的最新变化." } } } \ No newline at end of file diff --git a/XMOJ.user.js b/XMOJ.user.js index a27eb5ec..9382516b 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 2.4.7 +// @version 2.5.0 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen