diff --git a/Update.json b/Update.json
index 38e5a669..00700095 100644
--- a/Update.json
+++ b/Update.json
@@ -3422,6 +3422,61 @@
}
],
"Notes": "Bug 修复
\n- 修复了暗色模式下比赛排名表(contestrank-oi.php 和 contestrank-correct.php)颜色显示异常的问题(#916)
\n- 修复了 WebSocket 弹窗通知未遵循各功能独立弹窗开关(BBSPopup/MessagePopup)的问题(#919)"
+ },
+ "3.3.1": {
+ "UpdateDate": 1772981411290,
+ "Prerelease": true,
+ "UpdateContents": [
+ {
+ "PR": 924,
+ "Description": "Add ImageEnlarger feature with modal viewer"
+ }
+ ],
+ "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"
+ },
+ "3.3.3": {
+ "UpdateDate": 1773550684270,
+ "Prerelease": true,
+ "UpdateContents": [
+ {
+ "PR": 937,
+ "Description": "Display status.php Query Content"
+ }
+ ],
+ "Notes": "Display status.php query content."
+ },
+ "3.3.4": {
+ "UpdateDate": 1773559861504,
+ "Prerelease": true,
+ "UpdateContents": [
+ {
+ "PR": 939,
+ "Description": "fix: gate MonochromeUI-specific styling in contestrank pages behind flag"
+ }
+ ],
+ "Notes": "修复了未开启「极简黑白界面风格」时,比赛排行榜表头仍显示为黑白样式的问题 (#932)"
+ },
+ "3.3.5": {
+ "UpdateDate": 1773559861504,
+ "Prerelease": true,
+ "UpdateContents": [
+ {
+ "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 4c9d072c..275ef481 100644
--- a/XMOJ.user.js
+++ b/XMOJ.user.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name XMOJ
-// @version 3.3.0
+// @version 3.3.5
// @description XMOJ增强脚本
// @author @XMOJ-Script-dev, @langningchen and the community
// @namespace https://github/langningchen
@@ -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;
@@ -1551,6 +1574,9 @@ async function main() {
display: none !important;
}
}
+ .refreshList {
+ cursor: pointer;
+ }
/* Contain images */
img {
@@ -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")) {
@@ -2121,6 +2152,8 @@ async function main() {
}, {"ID": "CompareSource", "Type": "A", "Name": "比较代码"}, {
"ID": "BBSPopup", "Type": "A", "Name": "讨论提醒"
}, {"ID": "MessagePopup", "Type": "A", "Name": "短消息提醒"}, {
+ "ID": "ImageEnlarger", "Type": "A", "Name": "图片放大功能"
+ }, {
"ID": "DebugMode", "Type": "A", "Name": "调试模式(仅供开发者使用)"
}, {
"ID": "SuperDebug", "Type": "A", "Name": "本地调试模式(仅供开发者使用) (未经授权的擅自开启将导致大部分功能不可用!)"
@@ -2244,6 +2277,11 @@ async function main() {
localStorage.setItem("UserScript-Problem-" + Temp[i].children[1].innerText + "-Name", Temp[i].children[2].innerText);
}
} else if (location.pathname == "/problem.php") {
+ let transZhEn = document.getElementById("lang_cn_to_en");
+ let transEnZh = document.getElementById("lang_en_to_cn");
+ if (transZhEn !== null) transZhEn.remove();
+ if (transEnZh !== null) transEnZh.remove();
+
await RenderMathJax();
if (SearchParams.get("cid") != null && UtilityEnabled("ProblemSwitcher")) {
let pid = localStorage.getItem("UserScript-Contest-" + SearchParams.get("cid") + "-Problem-" + SearchParams.get("pid") + "-PID");
@@ -2270,22 +2308,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");
@@ -2308,6 +2332,7 @@ async function main() {
problemSwitcher.style.flexDirection = "column";
let problemList = JSON.parse(ContestProblemList);
+ problemSwitcher.innerHTML += `刷新`;
for (let i = 0; i < problemList.length; i++) {
let buttonText = "";
if (i < 26) {
@@ -2506,6 +2531,20 @@ async function main() {
document.title = "提交状态";
document.querySelector("body > script:nth-child(5)").remove();
if (UtilityEnabled("NewBootstrap")) {
+ var checkNum = function(str) {
+ var patrn = /^[0-9]{1,20}$/;
+ var ans = true;
+ if (!patrn.exec(str)) ans = false;
+ return ans;
+ }
+
+ const params = new URL(location.href).searchParams;
+ let CurrentProblemId = checkNum(params.get("problem_id")) ? Number(params.get("problem_id")) : "";
+ let CurrentLanguageParam = params.get("language");
+ let CurrentLanguage = checkNum(CurrentLanguageParam) && -1 <= CurrentLanguageParam && CurrentLanguageParam <= 2 ? Number(CurrentLanguageParam) : "-1";
+ let CurrentJresultParam = params.get("jresult");
+ let CurrentJresult = checkNum(CurrentJresultParam) && -1 <= CurrentJresultParam && CurrentJresultParam <= 11 ? Number(CurrentJresultParam) : "-1";
+
document.querySelector("#simform").outerHTML = `