diff --git a/Update.json b/Update.json index 3b3cbb17..3a138d87 100644 --- a/Update.json +++ b/Update.json @@ -3032,6 +3032,17 @@ } ], "Notes": "No release notes were provided for this release." + }, + "2.2.2": { + "UpdateDate": 1757851046240, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 852, + "Description": "Fix the submit button on some pages" + } + ], + "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 510f5680..1d4a4c7f 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 2.2.1 +// @version 2.2.2 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen @@ -444,7 +444,7 @@ let UtilityEnabled = (Name) => { let storeCredential = async (username, password) => { if ('credentials' in navigator && window.PasswordCredential) { try { - const credential = new PasswordCredential({ id: username, password: password }); + const credential = new PasswordCredential({id: username, password: password}); await navigator.credentials.store(credential); } catch (e) { console.error(e); @@ -454,7 +454,7 @@ let storeCredential = async (username, password) => { let getCredential = async () => { if ('credentials' in navigator && window.PasswordCredential) { try { - return await navigator.credentials.get({ password: true, mediation: 'optional' }); + return await navigator.credentials.get({password: true, mediation: 'optional'}); } catch (e) { console.error(e); } @@ -1627,8 +1627,9 @@ async function main() { }, 1000); } else { let PID = localStorage.getItem("UserScript-Contest-" + SearchParams.get("cid") + "-Problem-" + SearchParams.get("pid") + "-PID"); - - document.querySelector("body > div > div.mt-3 > center").lastChild.style.marginLeft = "10px"; + if (document.querySelector("body > div > div.mt-3 > center").lastElementChild !== null) { + document.querySelector("body > div > div.mt-3 > center").lastElementChild.style.marginLeft = "10px"; + } //修复提交按钮 let SubmitLink = document.querySelector('.mt-3 > center:nth-child(1) > a:nth-child(12)'); if (SubmitLink == null) { //a special type of problem diff --git a/package.json b/package.json index 5cd94bd3..8b9fa844 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "2.2.1", + "version": "2.2.2", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": {