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 @@ -2903,6 +2903,17 @@
}
],
"Notes": "No release notes were provided for this release."
},
"1.8.1": {
"UpdateDate": 1751814421274,
"Prerelease": true,
"UpdateContents": [
{
"PR": 815,
"Description": "fix: reinfo.php shows no test results even if test results are available"
}
],
"Notes": "No release notes were provided for this release."
}
}
}
7 changes: 3 additions & 4 deletions XMOJ.user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name XMOJ
// @version 1.8.0
// @version 1.8.1
// @description XMOJ增强脚本
// @author @XMOJ-Script-dev, @langningchen and the community
// @namespace https://github/langningchen
Expand Down Expand Up @@ -3355,9 +3355,7 @@ window.addEventListener('DOMContentLoaded', async () => {
}
} else if (location.pathname == "/reinfo.php") {
document.title = "测试点信息: " + SearchParams.get("sid");
if (document.querySelector("#results > div") == undefined) {
document.querySelector("#results").parentElement.innerHTML = "没有测试点信息";
} else {
if (document.querySelector("#results > div") != undefined) {
Copy link

Copilot AI Jul 6, 2025

Choose a reason for hiding this comment

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

The fallback message for when no test results are available was removed. Reintroduce an else branch to display “没有测试点信息” when document.querySelector("#results > div") returns undefined.

Copilot uses AI. Check for mistakes.
for (let i = 0; i < document.querySelector("#results > div").children.length; i++) {
let CurrentElement = document.querySelector("#results > div").children[i].children[0].children[0].children[0];
Comment on lines +3358 to 3360
Copy link

Copilot AI Jul 6, 2025

Choose a reason for hiding this comment

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

Cache the result of document.querySelector("#results > div") into a variable before the loop to avoid repeated DOM queries and improve readability.

Suggested change
if (document.querySelector("#results > div") != undefined) {
for (let i = 0; i < document.querySelector("#results > div").children.length; i++) {
let CurrentElement = document.querySelector("#results > div").children[i].children[0].children[0].children[0];
const resultsDiv = document.querySelector("#results > div");
if (resultsDiv != undefined) {
for (let i = 0; i < resultsDiv.children.length; i++) {
let CurrentElement = resultsDiv.children[i].children[0].children[0].children[0];

Copilot uses AI. Check for mistakes.
let Temp = CurrentElement.innerText.substring(0, CurrentElement.innerText.length - 2).split("/");
Expand Down Expand Up @@ -3508,6 +3506,7 @@ int main()
});
}
}
document.body.innerHTML = String(document.body.innerHTML).replaceAll("<pre id=\"errtxt\" class=\"alert alert-error\">sorry , not available (,,,1)</pre>", "没有测试点信息");
Copy link

Copilot AI Jul 6, 2025

Choose a reason for hiding this comment

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

Replacing the entire body.innerHTML can break event listeners and is fragile. Instead, target the specific <pre id="errtxt"> element (e.g., via getElementById) and update its textContent.

Suggested change
document.body.innerHTML = String(document.body.innerHTML).replaceAll("<pre id=\"errtxt\" class=\"alert alert-error\">sorry , not available (,,,1)</pre>", "没有测试点信息");
let errorTextElement = document.getElementById("errtxt");
if (errorTextElement) {
errorTextElement.textContent = "没有测试点信息";
}

Copilot uses AI. Check for mistakes.
} else if (location.pathname == "/downloads.php") {
let SoftwareList = document.querySelector("body > div > ul");
SoftwareList.remove();
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": "1.8.0",
"version": "1.8.1",
"description": "an improvement script for xmoj.tech",
"main": "AddonScript.js",
"scripts": {
Expand Down