diff --git a/Update.json b/Update.json index 9c32d04e..09973f9b 100644 --- a/Update.json +++ b/Update.json @@ -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." } } } \ No newline at end of file diff --git a/XMOJ.user.js b/XMOJ.user.js index 7fa972a9..f8c3a504 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -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 @@ -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) { @@ -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) { @@ -270,9 +288,6 @@ let GetUsernameHTML = async (Element, Username, Simple = false, Href = "https:// if (AdminUserList.includes(Username)) { HTMLData += `脚本管理员`; } - if (Username == "chenlangning") { - HTMLData += `吉祥物`; - } let BadgeInfo = await GetUserBadge(Username); if (BadgeInfo.Content != "") { HTMLData += `${BadgeInfo.Content}`; @@ -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 = ` @@ -1031,7 +1046,7 @@ async function main() { break; } } - if (CurrentVersion < LatestVersion) { + if (compareVersions(CurrentVersion, LatestVersion)) { let UpdateDiv = document.createElement("div"); UpdateDiv.innerHTML = `