Skip to content
Merged
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 @@ -3192,6 +3192,17 @@
}
],
"Notes": "XMOJ-Script 2.5.0 新增了比赛题目切换器,方便您在题目之间快速切换。此功能默认启用,您也可以在设置中禁用它。本版本还修复了一个导致时间显示为“NaN年前”的错误, 更新了一些 CSS selector,以适应 XMOJ 网站的最新变化."
},
"2.5.1": {
"UpdateDate": 1759830659949,
"Prerelease": true,
"UpdateContents": [
{
"PR": 876,
"Description": "refactor: simplify SubmitLink selection by querying all anchors and finding by text"
}
],
"Notes": "No release notes were provided for this release."
}
}
}
23 changes: 3 additions & 20 deletions XMOJ.user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name XMOJ
// @version 2.5.0
// @version 2.5.1
// @description XMOJ增强脚本
// @author @XMOJ-Script-dev, @langningchen and the community
// @namespace https://github/langningchen
Expand Down Expand Up @@ -1710,25 +1710,8 @@ async function main() {
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
SubmitLink = document.querySelector('.mt-3 > center:nth-child(1) > a:nth-child(10)');
}
if (SubmitLink == null) {
SubmitLink = document.querySelector('.mt-3 > center:nth-child(1) > a:nth-child(11)');
}
if (SubmitLink == null) {
SubmitLink = document.querySelector('.mt-3 > center:nth-child(1) > a:nth-child(13)');
}
if (SubmitLink == null) {
SubmitLink = document.querySelector('.mt-3 > center:nth-child(1) > a:nth-child(9)');
}
if (SubmitLink == null) { //为什么这个破东西老是换位置
SubmitLink = document.querySelector('.mt-3 > center:nth-child(1) > a:nth-child(7)');
}
if (SubmitLink == null) { //tmd又换位置
SubmitLink = document.querySelector('.mt-3 > center:nth-child(1) > a:nth-child(8)');
}
const links = document.querySelectorAll('.mt-3 > center:nth-child(1) > a');
const SubmitLink = Array.from(links).find(a => a.textContent.trim() === '提交');
let SubmitButton = document.createElement('button');
SubmitButton.id = 'SubmitButton';
SubmitButton.className = 'btn btn-outline-secondary';
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": "2.5.0",
"version": "2.5.1",
"description": "an improvement script for xmoj.tech",
"main": "AddonScript.js",
"scripts": {
Expand Down
Loading