Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
162d588
Merge pull request #772 from XMOJ-Script-dev/dev
boomzero Feb 8, 2025
d724438
Merge pull request #781 from XMOJ-Script-dev/dev
boomzero Feb 21, 2025
8b4a2c1
Merge pull request #786 from XMOJ-Script-dev/dev
boomzero Feb 23, 2025
e40b292
Merge pull request #800 from XMOJ-Script-dev/dev
boomzero May 4, 2025
c8ed5aa
Merge pull request #804 from XMOJ-Script-dev/dev
boomzero Jun 4, 2025
e4f659f
Merge pull request #813 from XMOJ-Script-dev/dev
boomzero Jun 22, 2025
d24fe86
Merge pull request #819 from XMOJ-Script-dev/dev
boomzero Jul 10, 2025
1a75572
Merge pull request #823 from XMOJ-Script-dev/dev
boomzero Jul 25, 2025
b789bf2
Update Update.json
boomzero Jul 25, 2025
13058b6
Merge pull request #827 from XMOJ-Script-dev/dev
boomzero Aug 9, 2025
c22fd31
Merge pull request #836 from XMOJ-Script-dev/dev
boomzero Aug 22, 2025
6adac8d
Parse release notes from comment block
boomzero Aug 24, 2025
f86a45e
Update bug.yml
boomzero Aug 24, 2025
84474cc
Merge pull request #854 from XMOJ-Script-dev/dev
boomzero Sep 14, 2025
7950ae8
Merge pull request #857 from XMOJ-Script-dev/dev
boomzero Sep 27, 2025
dfe8cf8
Merge pull request #874 from XMOJ-Script-dev/dev
boomzero Oct 4, 2025
54d39cf
Update GitHub Actions workflow to skip bot triggers
PythonSmall-Q Feb 7, 2026
462621a
Merge pull request #891 from XMOJ-Script-dev/dev
PythonSmall-Q Feb 7, 2026
27863a7
Prevent UpdateVersion from running if last commit was by github-actio…
boomzero Feb 11, 2026
280bc24
Merge branch 'master' of github.com:XMOJ-Script-dev/XMOJ-Script
boomzero Feb 11, 2026
4a671fc
Merge pull request #908 from XMOJ-Script-dev/dev
boomzero Feb 16, 2026
e3bbe9e
Merge pull request #912 from XMOJ-Script-dev/dev
boomzero Feb 19, 2026
fab6593
Allow metadata updates on edited PRs after bot version commit
boomzero Feb 23, 2026
2f7e9d6
Allow metadata updates on edited PRs after bot version commit
boomzero Feb 23, 2026
e14e33c
Merge pull request #921 from XMOJ-Script-dev/dev
boomzero Feb 27, 2026
a5182a6
Fix Problem Switcher Not Update
def-WA2025 Mar 12, 2026
ba48f22
Fix Problem Switcher Not Update
def-WA2025 Mar 13, 2026
9baa291
Merge branch 'dev' into fix-problem-switcher-not-update
def-WA2025 Mar 13, 2026
478101d
3.3.2
github-actions[bot] Mar 13, 2026
4f5c2e0
Update version info to 3.3.2
github-actions[bot] Mar 13, 2026
7710089
Fix Version List (1.999999.0 -> 1.10.0)
def-WA2025 Mar 13, 2026
62b1755
Update time and description of 3.3.2
github-actions[bot] Mar 13, 2026
33535ec
Fix Problem Switcher Null Problem
def-WA2025 Mar 13, 2026
a8bf01b
Update time and description of 3.3.2
github-actions[bot] Mar 13, 2026
c34f666
Fix XSS bug
def-WA2025 Mar 14, 2026
c87d08f
Update time and description of 3.3.2
github-actions[bot] Mar 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Update.json
Original file line number Diff line number Diff line change
Expand Up @@ -3433,6 +3433,17 @@
}
],
"Notes": "No release notes were provided for this release."
},
"3.3.2": {
"UpdateDate": 1773495619873,
"Prerelease": true,
"UpdateContents": [
{
"PR": 933,
"Description": "Fix problem switcher not update"
}
],
"Notes": "Fix ProblemSwitcher Not Update"
}
}
}
54 changes: 36 additions & 18 deletions XMOJ.user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name XMOJ
// @version 3.3.1
// @version 3.3.2
// @description XMOJ增强脚本
// @author @XMOJ-Script-dev, @langningchen and the community
// @namespace https://github/langningchen
Expand Down Expand Up @@ -533,6 +533,29 @@ let RequestAPI = (Action, Data, CallBack) => {
}
};

unsafeWindow.GetContestProblemList = async function(RefreshList) {
try {
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));
if (RefreshList) location.reload();
}
} catch (e) {
console.error(e);
}
}

// WebSocket Notification System
let NotificationSocket = null;
let NotificationSocketReconnectAttempts = 0;
Expand Down Expand Up @@ -1551,6 +1574,9 @@ async function main() {
display: none !important;
}
}
.refreshList {
cursor: pointer;
}

/* Contain images */
img {
Expand Down Expand Up @@ -1616,6 +1642,11 @@ async function main() {
border: 1px solid var(--bs-secondary-bg);
border-top: none;
border-radius: 0 0 0.3rem 0.3rem;
}
.refreshList {
cursor: pointer;
color: #6c757d;
text-decoration: none;
}`;
}
if (UtilityEnabled("AddAnimation")) {
Expand Down Expand Up @@ -2272,22 +2303,8 @@ async function main() {
}
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);
}
await unsafeWindow.GetContestProblemList(false);
ContestProblemList = localStorage.getItem("UserScript-Contest-" + SearchParams.get("cid") + "-ProblemList");
}

let problemSwitcher = document.createElement("div");
Expand All @@ -2310,6 +2327,7 @@ async function main() {
problemSwitcher.style.flexDirection = "column";

let problemList = JSON.parse(ContestProblemList);
problemSwitcher.innerHTML += `<a onclick="GetContestProblemList(true)" title="刷新列表" class="refreshList mb-2" style="text-align: center;" active>刷新</a>`;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-document-method): User controlled data in methods like innerHTML, outerHTML or document.write is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-innerhtml): User controlled data in a problemSwitcher.innerHTML is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-document-method): User controlled data in methods like innerHTML, outerHTML or document.write is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (javascript.browser.security.insecure-innerhtml): User controlled data in a problemSwitcher.innerHTML is an anti-pattern that can lead to XSS vulnerabilities

Source: opengrep

for (let i = 0; i < problemList.length; i++) {
let buttonText = "";
if (i < 26) {
Expand Down Expand Up @@ -6069,4 +6087,4 @@ int main()

main().then(r => {
console.log("XMOJ-Script loaded successfully!");
});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xmoj-script",
"version": "3.3.1",
"version": "3.3.2",
"description": "an improvement script for xmoj.tech",
"main": "AddonScript.js",
"scripts": {
Expand Down