From 4a3b9d056378068bef32befa9245eb492db43eec Mon Sep 17 00:00:00 2001 From: Shan Wenxiao Date: Sun, 22 Mar 2026 16:52:04 +0800 Subject: [PATCH 01/19] Add ELXMOJ client section to index.html Added a new section for ELXMOJ client with links and description. Signed-off-by: Shan Wenxiao --- index.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/index.html b/index.html index 06c99abe..3eabad31 100644 --- a/index.html +++ b/index.html @@ -52,6 +52,9 @@ Alpha + @@ -299,6 +302,16 @@

安装小明的OJ增强脚本

点击后,Tampermonkey扩展会自动打开,您可以在弹出的提示框中点击“安装”按钮,等待安装完成。

+
+

ELXMOJ 客户端

+

+ ELXMOJ + 是 XMOJ-Script 的网页客户端,提供更便捷的小明的OJ使用体验,无需安装浏览器扩展即可享受增强功能。 + 您可以点击 + 这里 + 访问 ELXMOJ 客户端。 +

+

反馈

From cc75291988b6cc009595bbd0af121c391f3312f1 Mon Sep 17 00:00:00 2001 From: Shan Wenxiao Date: Sun, 22 Mar 2026 16:55:04 +0800 Subject: [PATCH 02/19] Correct spelling of 'ELxmoj' to 'ELXMOJ' Signed-off-by: Shan Wenxiao --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 3eabad31..522de611 100644 --- a/index.html +++ b/index.html @@ -53,7 +53,7 @@

From e0cde606a812da7fc8e45b1376e7c233190ada88 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 22 Mar 2026 09:05:26 +0000 Subject: [PATCH 03/19] Initial plan From 0e4d8c5c5e199cf4631145b95888d13c52b3db77 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 22 Mar 2026 09:09:44 +0000 Subject: [PATCH 04/19] fix: include image links as markdown when copying solution/problem content Co-authored-by: PythonSmall-Q <106425289+PythonSmall-Q@users.noreply.github.com> Agent-Logs-Url: https://github.com/XMOJ-Script-dev/XMOJ-Script/sessions/dbcbbaed-e0e2-4aa7-959e-869a3b011a32 --- XMOJ.user.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/XMOJ.user.js b/XMOJ.user.js index 275ef481..1c4fda93 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1039,6 +1039,23 @@ function replaceMarkdownImages(text, string) { return text.replace(/!\[.*?\]\(.*?\)/g, string); } +function GetMDText(element) { + let result = ''; + for (let node of element.childNodes) { + if (node.nodeType === Node.TEXT_NODE) { + result += node.textContent; + } else if (node.nodeName === 'IMG') { + let src = node.getAttribute('src'); + if (src) { + result += `![](${new URL(src, location.href).href})`; + } + } else { + result += GetMDText(node); + } + } + return result; +} + async function main() { try { if (location.href.startsWith('http://')) { @@ -2436,7 +2453,7 @@ async function main() { CopyMDButton.type = "button"; document.querySelectorAll(".cnt-row-head.title")[i].appendChild(CopyMDButton); CopyMDButton.addEventListener("click", () => { - GM_setClipboard(Temp[i].children[0].innerText.trim().replaceAll("\n\t", "\n").replaceAll("\n\n", "\n")); + GM_setClipboard(GetMDText(Temp[i].children[0]).trim().replaceAll("\n\t", "\n").replaceAll("\n\n", "\n")); CopyMDButton.innerText = "复制成功"; setTimeout(() => { CopyMDButton.innerText = "复制"; @@ -4464,7 +4481,7 @@ int main() CopyMDButton.type = "button"; document.querySelector("body > div > div.mt-3 > center > h2").appendChild(CopyMDButton); CopyMDButton.addEventListener("click", () => { - GM_setClipboard(ParsedDocument.querySelector("body > div > div > div").innerText.trim().replaceAll("\n\t", "\n").replaceAll("\n\n", "\n")); + GM_setClipboard(GetMDText(ParsedDocument.querySelector("body > div > div > div")).trim().replaceAll("\n\t", "\n").replaceAll("\n\n", "\n")); CopyMDButton.innerText = "复制成功"; setTimeout(() => { CopyMDButton.innerText = "复制"; From df7de3aea35313addf2d2b3a6702979c29bcdc3f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 22 Mar 2026 09:39:48 +0000 Subject: [PATCH 05/19] 3.3.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6c733c70..515cd2e9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "3.3.5", + "version": "3.3.6", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From ead676a7430a17835c6bcd6f39299456692ca5d0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 22 Mar 2026 09:39:55 +0000 Subject: [PATCH 06/19] Update version info to 3.3.6 --- Update.json | 13 ++++++++++++- XMOJ.user.js | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Update.json b/Update.json index 00700095..6936997b 100644 --- a/Update.json +++ b/Update.json @@ -3477,6 +3477,17 @@ } ], "Notes": "No release notes were provided for this release." + }, + "3.3.6": { + "UpdateDate": 1774172389346, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 955, + "Description": "[WIP] Fix issue where copied solutions do not include image links" + } + ], + "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 1c4fda93..24284814 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 3.3.5 +// @version 3.3.6 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen From 00c3007e6d60593827d01c37b6be7d7aeabf0b6d Mon Sep 17 00:00:00 2001 From: Shan Wenxiao Date: Sun, 22 Mar 2026 17:40:36 +0800 Subject: [PATCH 07/19] Fix description for update PR 955 Signed-off-by: Shan Wenxiao --- Update.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Update.json b/Update.json index 6936997b..b15fadb0 100644 --- a/Update.json +++ b/Update.json @@ -3484,10 +3484,10 @@ "UpdateContents": [ { "PR": 955, - "Description": "[WIP] Fix issue where copied solutions do not include image links" + "Description": "Fix issue where copied solutions do not include image links" } ], "Notes": "No release notes were provided for this release." } } -} \ No newline at end of file +} From 6a88db6b178b7d1e2dd9a45cfaeab60ae9c666b7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 22 Mar 2026 09:41:00 +0000 Subject: [PATCH 08/19] Update time and description of 3.3.6 --- Update.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Update.json b/Update.json index b15fadb0..bd81ebbd 100644 --- a/Update.json +++ b/Update.json @@ -3479,15 +3479,15 @@ "Notes": "No release notes were provided for this release." }, "3.3.6": { - "UpdateDate": 1774172389346, + "UpdateDate": 1774172454729, "Prerelease": true, "UpdateContents": [ { "PR": 955, - "Description": "Fix issue where copied solutions do not include image links" + "Description": "fix: include image links as markdown when copying solution/problem content" } ], "Notes": "No release notes were provided for this release." } } -} +} \ No newline at end of file From 2e72cbfa59665802de414fb7ff3f5e86b948c165 Mon Sep 17 00:00:00 2001 From: Shan Wenxiao Date: Sun, 22 Mar 2026 17:42:10 +0800 Subject: [PATCH 09/19] fix lines Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Shan Wenxiao --- XMOJ.user.js | 48 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/XMOJ.user.js b/XMOJ.user.js index 24284814..d66f8574 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1041,18 +1041,56 @@ function replaceMarkdownImages(text, string) { function GetMDText(element) { let result = ''; - for (let node of element.childNodes) { + + function traverse(node) { if (node.nodeType === Node.TEXT_NODE) { result += node.textContent; - } else if (node.nodeName === 'IMG') { - let src = node.getAttribute('src'); + return; + } + + if (node.nodeType !== Node.ELEMENT_NODE) { + return; + } + + const tag = node.nodeName.toUpperCase(); + + // Preserve line breaks for
+ if (tag === 'BR') { + result += '\n'; + return; + } + + // Convert images to Markdown + if (tag === 'IMG') { + const src = node.getAttribute('src'); if (src) { result += `![](${new URL(src, location.href).href})`; } - } else { - result += GetMDText(node); + return; + } + + // Common block-level elements: add newlines around their content + const blockTags = new Set([ + 'P', 'DIV', 'SECTION', 'ARTICLE', 'HEADER', 'FOOTER', 'NAV', + 'UL', 'OL', 'LI', 'PRE', 'BLOCKQUOTE', + 'H1', 'H2', 'H3', 'H4', 'H5', 'H6' + ]); + const isBlock = blockTags.has(tag); + + if (isBlock && !result.endsWith('\n')) { + result += '\n'; + } + + for (let child of node.childNodes) { + traverse(child); + } + + if (isBlock && !result.endsWith('\n')) { + result += '\n'; } } + + traverse(element); return result; } From 3b978d8f5c574857a651efb8a5cb02e3a98d302c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 22 Mar 2026 09:42:36 +0000 Subject: [PATCH 10/19] Update time and description of 3.3.6 --- Update.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Update.json b/Update.json index bd81ebbd..6b32e5e9 100644 --- a/Update.json +++ b/Update.json @@ -3479,7 +3479,7 @@ "Notes": "No release notes were provided for this release." }, "3.3.6": { - "UpdateDate": 1774172454729, + "UpdateDate": 1774172550170, "Prerelease": true, "UpdateContents": [ { From 294c920ed2356c6a272acad2fa1ae171e5264f32 Mon Sep 17 00:00:00 2001 From: Shan Wenxiao Date: Sun, 22 Mar 2026 17:43:32 +0800 Subject: [PATCH 11/19] fix src Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Shan Wenxiao --- XMOJ.user.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/XMOJ.user.js b/XMOJ.user.js index d66f8574..daa9a554 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1064,7 +1064,13 @@ function GetMDText(element) { if (tag === 'IMG') { const src = node.getAttribute('src'); if (src) { - result += `![](${new URL(src, location.href).href})`; + let resolvedSrc = src; + try { + resolvedSrc = new URL(src, location.href).href; + } catch (e) { + // Fallback to the raw src if URL construction fails + } + result += `![](${resolvedSrc})`; } return; } From 7f71fa1525280309623863f3f72a0deb7b6c3c6c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 22 Mar 2026 09:44:00 +0000 Subject: [PATCH 12/19] Update time and description of 3.3.6 --- Update.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Update.json b/Update.json index 6b32e5e9..da8cdebc 100644 --- a/Update.json +++ b/Update.json @@ -3479,7 +3479,7 @@ "Notes": "No release notes were provided for this release." }, "3.3.6": { - "UpdateDate": 1774172550170, + "UpdateDate": 1774172635638, "Prerelease": true, "UpdateContents": [ { From 20807b89f398e61620c9d759a601696efb7c95b0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 22 Mar 2026 15:09:02 +0000 Subject: [PATCH 13/19] 3.4.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6c733c70..86a7ba56 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "3.3.5", + "version": "3.4.0", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From 2490abda3693accfe4b29b916029d26518f18bfe Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 22 Mar 2026 15:09:03 +0000 Subject: [PATCH 14/19] Update to release 3.4.0 --- Update.json | 29 ++++++++++++++++++++++++++++- XMOJ.user.js | 2 +- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Update.json b/Update.json index 00700095..063dee80 100644 --- a/Update.json +++ b/Update.json @@ -3477,6 +3477,33 @@ } ], "Notes": "No release notes were provided for this release." + }, + "3.4.0": { + "UpdateDate": 1774192142561, + "Prerelease": false, + "UpdateContents": [ + { + "PR": 924, + "Description": "Add ImageEnlarger feature with modal viewer" + }, + { + "PR": 933, + "Description": "Fix problem switcher not update" + }, + { + "PR": 937, + "Description": "Display status.php Query Content" + }, + { + "PR": 939, + "Description": "fix: gate MonochromeUI-specific styling in contestrank pages behind flag" + }, + { + "PR": 948, + "Description": "Remove problem translate button" + } + ], + "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 275ef481..b85dddb7 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 3.3.5 +// @version 3.4.0 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen From 0698aaa8c81633c835012e66e09f542f9767a354 Mon Sep 17 00:00:00 2001 From: Shan Wenxiao Date: Sat, 28 Mar 2026 09:09:08 +0800 Subject: [PATCH 15/19] Revert "Update to release 3.4.0" --- Update.json | 29 +---------------------------- XMOJ.user.js | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 30 deletions(-) diff --git a/Update.json b/Update.json index 063dee80..00700095 100644 --- a/Update.json +++ b/Update.json @@ -3477,33 +3477,6 @@ } ], "Notes": "No release notes were provided for this release." - }, - "3.4.0": { - "UpdateDate": 1774192142561, - "Prerelease": false, - "UpdateContents": [ - { - "PR": 924, - "Description": "Add ImageEnlarger feature with modal viewer" - }, - { - "PR": 933, - "Description": "Fix problem switcher not update" - }, - { - "PR": 937, - "Description": "Display status.php Query Content" - }, - { - "PR": 939, - "Description": "fix: gate MonochromeUI-specific styling in contestrank pages behind flag" - }, - { - "PR": 948, - "Description": "Remove problem translate button" - } - ], - "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 b85dddb7..275ef481 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 3.4.0 +// @version 3.3.5 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen diff --git a/package.json b/package.json index 86a7ba56..6c733c70 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "3.4.0", + "version": "3.3.5", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From 54f3ae34b649bae54a3b55ee069c4d4aa520afed Mon Sep 17 00:00:00 2001 From: pythonSmall-Q Date: Sat, 28 Mar 2026 09:21:23 +0800 Subject: [PATCH 16/19] Preserve table cell separators in GetMDText Update GetMDText in XMOJ.user.js: hoist block-level tag set, add a cellTags set (TD/TH), and insert tab characters before and after table cell content when copying as plain text. This keeps table cells visually separated while preserving existing block-level newline behavior. --- XMOJ.user.js | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/XMOJ.user.js b/XMOJ.user.js index daa9a554..e6bd3e6d 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1041,6 +1041,13 @@ function replaceMarkdownImages(text, string) { function GetMDText(element) { let result = ''; + const blockTags = new Set([ + 'P', 'DIV', 'SECTION', 'ARTICLE', 'HEADER', 'FOOTER', 'NAV', + 'UL', 'OL', 'LI', 'PRE', 'BLOCKQUOTE', + 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', + 'TABLE', 'THEAD', 'TBODY', 'TFOOT', 'TR' + ]); + const cellTags = new Set(['TD', 'TH']); function traverse(node) { if (node.nodeType === Node.TEXT_NODE) { @@ -1075,22 +1082,26 @@ function GetMDText(element) { return; } - // Common block-level elements: add newlines around their content - const blockTags = new Set([ - 'P', 'DIV', 'SECTION', 'ARTICLE', 'HEADER', 'FOOTER', 'NAV', - 'UL', 'OL', 'LI', 'PRE', 'BLOCKQUOTE', - 'H1', 'H2', 'H3', 'H4', 'H5', 'H6' - ]); const isBlock = blockTags.has(tag); + const isCell = cellTags.has(tag); if (isBlock && !result.endsWith('\n')) { result += '\n'; } + // Keep table cells visually separated when copied as plain text. + if (isCell && result.length > 0 && !result.endsWith('\n') && !result.endsWith('\t') && !result.endsWith(' ')) { + result += '\t'; + } + for (let child of node.childNodes) { traverse(child); } + if (isCell && !result.endsWith('\n') && !result.endsWith('\t')) { + result += '\t'; + } + if (isBlock && !result.endsWith('\n')) { result += '\n'; } From 73c86d44e5165c11e418119735db8b22d9a737c3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 28 Mar 2026 01:21:36 +0000 Subject: [PATCH 17/19] Update time and description of 3.3.6 --- Update.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Update.json b/Update.json index da8cdebc..a25619d5 100644 --- a/Update.json +++ b/Update.json @@ -3479,7 +3479,7 @@ "Notes": "No release notes were provided for this release." }, "3.3.6": { - "UpdateDate": 1774172635638, + "UpdateDate": 1774660895572, "Prerelease": true, "UpdateContents": [ { From 2efd66dfb2618fb78b27e28a77146837adbafd01 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 28 Mar 2026 01:22:47 +0000 Subject: [PATCH 18/19] 3.4.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 515cd2e9..86a7ba56 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "3.3.6", + "version": "3.4.0", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": { From 581d9666821025209f3c9dfb25dd7434797bed22 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 28 Mar 2026 01:22:48 +0000 Subject: [PATCH 19/19] Update to release 3.4.0 --- Update.json | 31 +++++++++++++++++++++++++++++++ XMOJ.user.js | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/Update.json b/Update.json index a25619d5..8fb7414c 100644 --- a/Update.json +++ b/Update.json @@ -3488,6 +3488,37 @@ } ], "Notes": "No release notes were provided for this release." + }, + "3.4.0": { + "UpdateDate": 1774660967491, + "Prerelease": false, + "UpdateContents": [ + { + "PR": 924, + "Description": "Add ImageEnlarger feature with modal viewer" + }, + { + "PR": 933, + "Description": "Fix problem switcher not update" + }, + { + "PR": 937, + "Description": "Display status.php Query Content" + }, + { + "PR": 939, + "Description": "fix: gate MonochromeUI-specific styling in contestrank pages behind flag" + }, + { + "PR": 948, + "Description": "Remove problem translate button" + }, + { + "PR": 955, + "Description": "fix: include image links as markdown when copying solution/problem content" + } + ], + "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 e6bd3e6d..19f60be8 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 3.3.6 +// @version 3.4.0 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen