Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
974c28d
1.9.0
github-actions[bot] Jul 10, 2025
dc53891
Update to release 1.9.0
github-actions[bot] Jul 10, 2025
1df6609
Merge pull request #820 from XMOJ-Script-dev/actions/temp
github-actions[bot] Jul 10, 2025
5896806
修复工具栏
boomzero Jul 25, 2025
dce386f
1.9.1
github-actions[bot] Jul 25, 2025
4408f99
Update version info to 1.9.1
github-actions[bot] Jul 25, 2025
82480fd
Merge pull request #821 from XMOJ-Script-dev/boomzero/nav
boomzero Jul 25, 2025
14f4346
1.10.0
github-actions[bot] Jul 25, 2025
587bd5d
Update to release 1.10.0
github-actions[bot] Jul 25, 2025
5f10eba
Merge pull request #824 from XMOJ-Script-dev/actions/temp
boomzero Jul 25, 2025
7156afb
feat: Add version comparison function to check for updates
boomzero Aug 9, 2025
1bd9828
2.0.0
boomzero Aug 9, 2025
407453b
Update version info to 2.0.0
github-actions[bot] Aug 9, 2025
59fd3b3
Update time and description of 2.0.0
github-actions[bot] Aug 9, 2025
d78daed
Update XMOJ.user.js
boomzero Aug 9, 2025
09ac964
Update AdminUserList and remove specific badge for chenlangning
boomzero Aug 9, 2025
e009b6b
Update time and description of 2.0.0
github-actions[bot] Aug 9, 2025
f69ecc0
Update time and description of 2.0.0
github-actions[bot] Aug 9, 2025
6c505cf
Update XMOJ.user.js
boomzero Aug 9, 2025
caf8769
Update time and description of 2.0.0
github-actions[bot] Aug 9, 2025
eb5b73c
Merge pull request #826 from XMOJ-Script-dev/boomzero/upd
boomzero Aug 9, 2025
e900464
2.1.0
github-actions[bot] Aug 9, 2025
5e68c57
Update to release 2.1.0
github-actions[bot] Aug 9, 2025
ed758de
Merge pull request #828 from XMOJ-Script-dev/actions/temp
github-actions[bot] Aug 9, 2025
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
55 changes: 55 additions & 0 deletions Update.json
Original file line number Diff line number Diff line change
Expand Up @@ -2914,6 +2914,61 @@
}
],
"Notes": "No release notes were provided for this release."
},
"1.9.0": {
"UpdateDate": 1752132111562,
"Prerelease": false,
"UpdateContents": [
{
"PR": 817,
"Description": "fix: reinfo.php shows no test results even if test results are available "
}
],
"Notes": "No release notes were provided for this release."
},
"1.9.1": {
"UpdateDate": 1753443057292,
"Prerelease": true,
"UpdateContents": [
{
"PR": 821,
"Description": "修复工具栏"
}
],
"Notes": "No release notes were provided for this release."
},
"1.10.0": {
"UpdateDate": 1753443146018,
"Prerelease": false,
"UpdateContents": [
{
"PR": 821,
"Description": "修复工具栏"
}
],
"Notes": "No release notes were provided for this release."
},
"2.0.0": {
"UpdateDate": 1754724044036,
"Prerelease": true,
"UpdateContents": [
{
"PR": 826,
"Description": "修复更新"
}
],
"Notes": "No release notes were provided for this release."
},
"2.1.0": {
"UpdateDate": 1754724455081,
"Prerelease": false,
"UpdateContents": [
{
"PR": 826,
"Description": "修复更新"
}
],
"Notes": "No release notes were provided for this release."
}
}
}
29 changes: 22 additions & 7 deletions XMOJ.user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name XMOJ
// @version 1.8.1
// @version 2.1.0
// @description XMOJ增强脚本
// @author @XMOJ-Script-dev, @langningchen and the community
// @namespace https://github/langningchen
Expand Down Expand Up @@ -39,7 +39,7 @@
*/

const CaptchaSiteKey = "0x4AAAAAAALBT58IhyDViNmv";
const AdminUserList = ["zhuchenrui2", "shanwenxiao", "admin"];
const AdminUserList = ["zhuchenrui2", "shanwenxiao", "chenlangning", "admin"];

let escapeHTML = (str) => {
return str.replace(/[&<>"']/g, function (match) {
Expand Down Expand Up @@ -107,6 +107,24 @@ let GetRelativeTime = (Input) => {
}
}
};

function compareVersions(currVer, remoteVer) {
const currParts = currVer.split('.').map(Number);
const remoteParts = remoteVer.split('.').map(Number);

const maxLen = Math.max(currParts.length, remoteParts.length);
for (let i = 0; i < maxLen; i++) {
const curr = currParts[i] !== undefined ? currParts[i] : 0;
const remote = remoteParts[i] !== undefined ? remoteParts[i] : 0;
if (remote > curr) {
return true; // update needed
} else if (remote < curr) {
return false; // no update needed
}
}
return false; // versions are equal
}

let RenderMathJax = async () => {
try {
if (document.getElementById("MathJax-script") === null) {
Expand Down Expand Up @@ -270,9 +288,6 @@ let GetUsernameHTML = async (Element, Username, Simple = false, Href = "https://
if (AdminUserList.includes(Username)) {
HTMLData += `<span class="badge text-bg-danger ms-2">脚本管理员</span>`;
}
if (Username == "chenlangning") {
HTMLData += `<span class="badge ms-2" style="background-color: #6633cc; color: #ffffff">吉祥物</span>`;
}
let BadgeInfo = await GetUserBadge(Username);
if (BadgeInfo.Content != "") {
HTMLData += `<span class="badge ms-2" style="background-color: ${BadgeInfo.BackgroundColor}; color: ${BadgeInfo.Color}">${BadgeInfo.Content}</span>`;
Expand Down Expand Up @@ -922,7 +937,7 @@ async function main() {
hideDropdownItems();
}
});
} else if (document.querySelector("#navbar > ul.nav.navbar-nav.navbar-right > li > ul > li:nth-child(3) > a > span") != undefined && document.querySelector("#navbar > ul.nav.navbar-nav.navbar-right > li > ul > li:nth-child(3) > a > span").innerText != "个人中心") {
} else if (document.querySelector("#navbar > ul.nav.navbar-nav.navbar-right > li > ul") != undefined && document.querySelector("#navbar > ul.nav.navbar-nav.navbar-right > li > ul > li:nth-child(2)").innerText != "个人中心") {
let PopupUL = document.querySelector("#navbar > ul.nav.navbar-nav.navbar-right > li > ul");
PopupUL.style.cursor = 'pointer';
PopupUL.innerHTML = `<li class="dropdown-item">修改帐号</li>
Expand Down Expand Up @@ -1031,7 +1046,7 @@ async function main() {
break;
}
}
if (CurrentVersion < LatestVersion) {
if (compareVersions(CurrentVersion, LatestVersion)) {
let UpdateDiv = document.createElement("div");
UpdateDiv.innerHTML = `
<div class="alert alert-warning alert-dismissible fade show mt-2" role="alert">
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.1",
"version": "2.1.0",
"description": "an improvement script for xmoj.tech",
"main": "AddonScript.js",
"scripts": {
Expand Down