Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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": 1773497456666,
"Prerelease": true,
"UpdateContents": [
{
"PR": 934,
"Description": "feat: add refresh button to ProblemSwitcher"
}
],
"Notes": "Added a refresh button (↻) to the ProblemSwitcher panel. Clicking it invalidates the cached contest problem list and reloads the page, useful when contest problems are updated mid-contest."
}
}
}
26 changes: 25 additions & 1 deletion 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 @@ -2323,6 +2323,30 @@ async function main() {
}
problemSwitcher.innerHTML += `<a href="${problemList[i].url}" title="${problemList[i].title.trim()}" class="btn btn-outline-secondary mb-2 ${activeClass}">${buttonText}</a>`;
}
let refreshCid = SearchParams.get("cid");
let refreshBtn = document.createElement("a");
refreshBtn.title = "刷新缓存";
refreshBtn.classList.add("btn", "btn-outline-secondary", "mt-2");
refreshBtn.innerHTML = "↻";
refreshBtn.href = "#";
if (refreshCid) {
refreshBtn.addEventListener("click", function(e) {
e.preventDefault();
let prefix = "UserScript-Contest-" + refreshCid + "-";
let keysToRemove = [];
for (let k = 0; k < localStorage.length; k++) {
let key = localStorage.key(k);
if (key && key.startsWith(prefix)) {
keysToRemove.push(key);
}
}
keysToRemove.forEach(k => localStorage.removeItem(k));
location.reload();
});
} else {
refreshBtn.style.display = "none";
}
problemSwitcher.appendChild(refreshBtn);
document.body.appendChild(problemSwitcher);
}
if (document.querySelector("body > div > div.mt-3 > h2") != null) {
Expand Down
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",
Copy link

@cubic-dev-ai cubic-dev-ai bot Mar 14, 2026

Choose a reason for hiding this comment

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

P2: Do not bump the package version manually here; the release workflow is responsible for updating and synchronizing version numbers.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At package.json, line 3:

<comment>Do not bump the package version manually here; the release workflow is responsible for updating and synchronizing version numbers.</comment>

<file context>
@@ -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",
</file context>
Suggested change
"version": "3.3.2",
"version": "3.3.1",
Fix with Cubic

"description": "an improvement script for xmoj.tech",
"main": "AddonScript.js",
"scripts": {
Expand Down