From f86cc2b69f7a2233fe043d8953e14b6a0ac1f271 Mon Sep 17 00:00:00 2001 From: boomzero Date: Mon, 9 Jun 2025 16:15:09 +0800 Subject: [PATCH 01/14] Remove statistics button from contest page --- XMOJ.user.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/XMOJ.user.js b/XMOJ.user.js index 2156c297..7f952afd 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -2115,13 +2115,6 @@ window.addEventListener('DOMContentLoaded', async () => { document.querySelector("body > div > div.mt-3 > center > br:nth-child(2)").remove(); document.querySelector("body > div > div.mt-3 > center > br:nth-child(2)").remove(); document.querySelector("body > div > div.mt-3 > center > div > .red").innerHTML = String(document.querySelector("body > div > div.mt-3 > center > div > .red").innerHTML).replaceAll("
", "

"); - let StaticButton = document.createElement("button"); - document.querySelectorAll("body > div > div.mt-3 > center > div > .red")[1].appendChild(StaticButton); - StaticButton.className = "btn btn-outline-secondary"; - StaticButton.innerText = "统计"; - StaticButton.addEventListener("click", () => { - location.href = "https://www.xmoj.tech/conteststatistics.php?cid=" + SearchParams.get("cid"); - }); document.querySelector("#problemset > tbody").innerHTML = String(document.querySelector("#problemset > tbody").innerHTML).replaceAll(/\t ([0-9]*)      问题  ([^<]*)/g, "$2. $1"); From d98768a3bd8c5d9564c7579f242504fd88656cca Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 9 Jun 2025 08:16:36 +0000 Subject: [PATCH 02/14] 1.7.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 845293fd..30153282 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "1.7.0", + "version": "1.7.1", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From 536064ddf480d8891456a332b988808de5934f72 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 9 Jun 2025 08:16:42 +0000 Subject: [PATCH 03/14] Update version info to 1.7.1 --- Update.json | 11 +++++++++++ XMOJ.user.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Update.json b/Update.json index 4b5234ad..4540e66b 100644 --- a/Update.json +++ b/Update.json @@ -2851,6 +2851,17 @@ } ], "Notes": "No release notes were provided for this release." + }, + "1.7.1": { + "UpdateDate": 1749456996459, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 806, + "Description": "Remove the statistics button from contest page" + } + ], + "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 7f952afd..fe042e9f 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 1.7.0 +// @version 1.7.1 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen From c9d9879de7e5c149e164edf67c55ab187a887208 Mon Sep 17 00:00:00 2001 From: boomzero Date: Mon, 9 Jun 2025 16:17:46 +0800 Subject: [PATCH 04/14] Remove conteststatistics.php code --- XMOJ.user.js | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/XMOJ.user.js b/XMOJ.user.js index fe042e9f..4e01002d 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -3141,39 +3141,6 @@ window.addEventListener('DOMContentLoaded', async () => { }); }); } - } else if (location.pathname == "/conteststatistics.php") { - if (new URL(location.href).searchParams.get("cid") != null) { - document.title = "比赛 " + new URL(location.href).searchParams.get("cid") + " 统计"; - } - document.querySelector("body > div > div.mt-3 > center > h3").innerText = "比赛统计"; - if (UtilityEnabled("ResetType")) { - let Temp = document.getElementById("submission").childNodes; - for (let i = 0; i < Temp.length; i++) { - Temp[i].remove(); - } - eval(document.querySelector("body > div.container > div > center > table:nth-child(4) > script:nth-child(6)").innerHTML); - document.querySelector("#cs > thead > tr > th:nth-child(1)").innerText = "题目编号"; - document.querySelector("#cs > thead > tr > th:nth-child(10)").remove(); - document.querySelector("#cs > thead > tr > th:nth-child(11)").innerText = "总和"; - document.querySelector("#cs > thead > tr > th:nth-child(12)").remove(); - document.querySelector("#cs > thead > tr > th:nth-child(12)").remove(); - document.querySelector("#cs > thead > tr > th:nth-child(12)").remove(); - document.querySelector("#cs > tbody > tr:last-child > td").innerText = "总和"; - TidyTable(document.getElementById("cs")); - Temp = document.querySelector("#cs > tbody").children; - for (let i = 0; i < Temp.length; i++) { - let CurrentRowChildren = Temp[i].children; - CurrentRowChildren[9].remove(); - CurrentRowChildren[11].remove(); - CurrentRowChildren[11].remove(); - CurrentRowChildren[11].remove(); - for (let j = 0; j < CurrentRowChildren.length; j++) { - if (CurrentRowChildren[j].innerText == "") { - CurrentRowChildren[j].innerText = "0"; - } - } - } - } } else if (location.pathname == "/comparesource.php") { if (UtilityEnabled("CompareSource")) { if (location.search == "") { From f1f6d542840866995233666366ab764bcb256abb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 9 Jun 2025 08:18:26 +0000 Subject: [PATCH 05/14] Update time and description of 1.7.1 --- Update.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Update.json b/Update.json index 4540e66b..afebbac9 100644 --- a/Update.json +++ b/Update.json @@ -2853,7 +2853,7 @@ "Notes": "No release notes were provided for this release." }, "1.7.1": { - "UpdateDate": 1749456996459, + "UpdateDate": 1749457101103, "Prerelease": true, "UpdateContents": [ { From 2863f2fc64670b0689fd336aa7d1d46cb1e71ddc Mon Sep 17 00:00:00 2001 From: boomzero Date: Sat, 14 Jun 2025 09:34:06 +0800 Subject: [PATCH 06/14] feat: Enhance keyboard shortcuts for better cross-platform support - Updated keyboard shortcuts to support both `Ctrl` and `Cmd` keys for macOS and Windows/Linux users. - Improved consistency across multiple event listeners for actions like form submission and button clicks. --- XMOJ.user.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/XMOJ.user.js b/XMOJ.user.js index 4e01002d..185588ef 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1075,7 +1075,7 @@ window.addEventListener('DOMContentLoaded', async () => { // Remove the preloader style now that the page is loading and Bootstrap 5 will take over. const preloadStyleElement = document.getElementById('tampermonkey-dark-preload'); if (preloadStyleElement) { - preloadStyleElement.remove(); + preloadStyleElement.remove(); console.log("Removed minimal dark preload styles."); } fetch(ServerURL + "/Update.json", {cache: "no-cache"}) @@ -2233,7 +2233,7 @@ window.addEventListener('DOMContentLoaded', async () => { if (Submitted) location.reload(); else AutoCheatButton.innerHTML = "自动提交当年代码"; }); document.addEventListener("keydown", (Event) => { - if (Event.code === 'Enter' && Event.ctrlKey) { + if (Event.code === 'Enter' && (Event.metaKey || Event.ctrlKey)) { AutoCheatButton.click(); } }); @@ -4211,7 +4211,7 @@ int main() TurnstileScript.src = "https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit&onload=CaptchaLoadedCallback"; document.body.appendChild(TurnstileScript); ContentElement.addEventListener("keydown", (Event) => { - if (Event.ctrlKey && Event.keyCode == 13) { + if ((Event.metaKey || Event.ctrlKey) && Event.keyCode == 13) { SubmitElement.click(); } }); @@ -4388,7 +4388,7 @@ int main() TurnstileScript.src = "https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit&onload=CaptchaLoadedCallback"; document.body.appendChild(TurnstileScript); ContentElement.addEventListener("keydown", (Event) => { - if (Event.ctrlKey && Event.keyCode == 13) { + if ((Event.metaKey || Event.ctrlKey) && Event.keyCode == 13) { SubmitElement.click(); } }); @@ -4642,7 +4642,7 @@ int main() ContentEditor.value = ContentEditor.value.substring(0, ContentEditor.value.indexOf("
")); } ContentEditor.addEventListener("keydown", (Event) => { - if (Event.ctrlKey && Event.keyCode == 13) { + if ((Event.metaKey || Event.ctrlKey) && Event.keyCode == 13) { OKButton.click(); } }); From acfe7cf7927633d67a0a83662fc28d1cb73ec5d4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 14 Jun 2025 01:35:55 +0000 Subject: [PATCH 07/14] 1.7.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 30153282..76b8b358 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "1.7.1", + "version": "1.7.2", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From 5bff16be4a9d7a397405ef3fe16fb9e16b09f9e7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 14 Jun 2025 01:36:01 +0000 Subject: [PATCH 08/14] Update version info to 1.7.2 --- Update.json | 11 +++++++++++ XMOJ.user.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Update.json b/Update.json index afebbac9..ecb9baef 100644 --- a/Update.json +++ b/Update.json @@ -2862,6 +2862,17 @@ } ], "Notes": "No release notes were provided for this release." + }, + "1.7.2": { + "UpdateDate": 1749864956162, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 808, + "Description": "feat: Enhance keyboard shortcuts for better cross-platform support" + } + ], + "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 185588ef..6075d804 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 1.7.1 +// @version 1.7.2 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen From a703618d389b414da0a17416db62eb915179616a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 14 Jun 2025 01:36:56 +0000 Subject: [PATCH 09/14] Update time and description of 1.7.2 --- Update.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Update.json b/Update.json index ecb9baef..ce92ef55 100644 --- a/Update.json +++ b/Update.json @@ -2864,7 +2864,7 @@ "Notes": "No release notes were provided for this release." }, "1.7.2": { - "UpdateDate": 1749864956162, + "UpdateDate": 1749865010938, "Prerelease": true, "UpdateContents": [ { From d83c522f31569bed9d81388b9d1dafec7fe2ffa9 Mon Sep 17 00:00:00 2001 From: boomzero Date: Sun, 22 Jun 2025 20:17:32 +0800 Subject: [PATCH 10/14] fix: Redirect to login page if profile element is missing Closes #286 --- XMOJ.user.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/XMOJ.user.js b/XMOJ.user.js index 6075d804..0961d23a 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -559,6 +559,9 @@ window.addEventListener('DOMContentLoaded', async () => { let SearchParams = new URLSearchParams(location.search); let ServerURL = (UtilityEnabled("DebugMode") ? "https://ghpages.xmoj-bbs.me/" : "https://www.xmoj-bbs.me") + if (document.querySelector("#profile") === null) { + location.href = "https://www.xmoj.tech/loginpage.php"; + } let CurrentUsername = document.querySelector("#profile").innerText; CurrentUsername = CurrentUsername.replaceAll(/[^a-zA-Z0-9]/g, ""); let IsAdmin = AdminUserList.indexOf(CurrentUsername) !== -1; From f6742dc03bec4f7f6613e27bd0a4f65c215c8343 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 22 Jun 2025 12:19:28 +0000 Subject: [PATCH 11/14] 1.7.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 76b8b358..e034b7fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "1.7.2", + "version": "1.7.3", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From b28f440cc8db7b63b40047baa2f5e92ffec2bd46 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 22 Jun 2025 12:19:34 +0000 Subject: [PATCH 12/14] Update version info to 1.7.3 --- Update.json | 11 +++++++++++ XMOJ.user.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Update.json b/Update.json index ce92ef55..ecb95bec 100644 --- a/Update.json +++ b/Update.json @@ -2873,6 +2873,17 @@ } ], "Notes": "No release notes were provided for this release." + }, + "1.7.3": { + "UpdateDate": 1750594769202, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 811, + "Description": "fix: Redirect to login page if profile element is missing" + } + ], + "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 0961d23a..ebaa803b 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 1.7.2 +// @version 1.7.3 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen From 9200ff6cacd267d9cbb385c692a36d6a372808cf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 22 Jun 2025 12:20:23 +0000 Subject: [PATCH 13/14] 1.8.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e034b7fc..671feb46 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "1.7.3", + "version": "1.8.0", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From 4ecfc320015317a082826e977a1414b3530796a7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 22 Jun 2025 12:20:24 +0000 Subject: [PATCH 14/14] Update to release 1.8.0 --- Update.json | 19 +++++++++++++++++++ XMOJ.user.js | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Update.json b/Update.json index ecb95bec..6c9b251e 100644 --- a/Update.json +++ b/Update.json @@ -2884,6 +2884,25 @@ } ], "Notes": "No release notes were provided for this release." + }, + "1.8.0": { + "UpdateDate": 1750594823374, + "Prerelease": false, + "UpdateContents": [ + { + "PR": 806, + "Description": "Remove the statistics button from contest page" + }, + { + "PR": 808, + "Description": "feat: Enhance keyboard shortcuts for better cross-platform support" + }, + { + "PR": 811, + "Description": "fix: Redirect to login page if profile element is missing" + } + ], + "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 ebaa803b..f2c8fdf9 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 1.7.3 +// @version 1.8.0 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen