Skip to content

Commit e4f659f

Browse files
authored
Merge pull request #813 from XMOJ-Script-dev/dev
Release!
2 parents c8ed5aa + b1582c8 commit e4f659f

File tree

3 files changed

+62
-47
lines changed

3 files changed

+62
-47
lines changed

Update.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2851,6 +2851,58 @@
28512851
}
28522852
],
28532853
"Notes": "No release notes were provided for this release."
2854+
},
2855+
"1.7.1": {
2856+
"UpdateDate": 1749457101103,
2857+
"Prerelease": true,
2858+
"UpdateContents": [
2859+
{
2860+
"PR": 806,
2861+
"Description": "Remove the statistics button from contest page"
2862+
}
2863+
],
2864+
"Notes": "No release notes were provided for this release."
2865+
},
2866+
"1.7.2": {
2867+
"UpdateDate": 1749865010938,
2868+
"Prerelease": true,
2869+
"UpdateContents": [
2870+
{
2871+
"PR": 808,
2872+
"Description": "feat: Enhance keyboard shortcuts for better cross-platform support"
2873+
}
2874+
],
2875+
"Notes": "No release notes were provided for this release."
2876+
},
2877+
"1.7.3": {
2878+
"UpdateDate": 1750594769202,
2879+
"Prerelease": true,
2880+
"UpdateContents": [
2881+
{
2882+
"PR": 811,
2883+
"Description": "fix: Redirect to login page if profile element is missing"
2884+
}
2885+
],
2886+
"Notes": "No release notes were provided for this release."
2887+
},
2888+
"1.8.0": {
2889+
"UpdateDate": 1750594823374,
2890+
"Prerelease": false,
2891+
"UpdateContents": [
2892+
{
2893+
"PR": 806,
2894+
"Description": "Remove the statistics button from contest page"
2895+
},
2896+
{
2897+
"PR": 808,
2898+
"Description": "feat: Enhance keyboard shortcuts for better cross-platform support"
2899+
},
2900+
{
2901+
"PR": 811,
2902+
"Description": "fix: Redirect to login page if profile element is missing"
2903+
}
2904+
],
2905+
"Notes": "No release notes were provided for this release."
28542906
}
28552907
}
28562908
}

XMOJ.user.js

Lines changed: 9 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name XMOJ
3-
// @version 1.7.0
3+
// @version 1.8.0
44
// @description XMOJ增强脚本
55
// @author @XMOJ-Script-dev, @langningchen and the community
66
// @namespace https://github/langningchen
@@ -559,6 +559,9 @@ window.addEventListener('DOMContentLoaded', async () => {
559559

560560
let SearchParams = new URLSearchParams(location.search);
561561
let ServerURL = (UtilityEnabled("DebugMode") ? "https://ghpages.xmoj-bbs.me/" : "https://www.xmoj-bbs.me")
562+
if (document.querySelector("#profile") === null) {
563+
location.href = "https://www.xmoj.tech/loginpage.php";
564+
}
562565
let CurrentUsername = document.querySelector("#profile").innerText;
563566
CurrentUsername = CurrentUsername.replaceAll(/[^a-zA-Z0-9]/g, "");
564567
let IsAdmin = AdminUserList.indexOf(CurrentUsername) !== -1;
@@ -1075,7 +1078,7 @@ window.addEventListener('DOMContentLoaded', async () => {
10751078
// Remove the preloader style now that the page is loading and Bootstrap 5 will take over.
10761079
const preloadStyleElement = document.getElementById('tampermonkey-dark-preload');
10771080
if (preloadStyleElement) {
1078-
preloadStyleElement.remove();
1081+
preloadStyleElement.remove();
10791082
console.log("Removed minimal dark preload styles.");
10801083
}
10811084
fetch(ServerURL + "/Update.json", {cache: "no-cache"})
@@ -2115,13 +2118,6 @@ window.addEventListener('DOMContentLoaded', async () => {
21152118
document.querySelector("body > div > div.mt-3 > center > br:nth-child(2)").remove();
21162119
document.querySelector("body > div > div.mt-3 > center > br:nth-child(2)").remove();
21172120
document.querySelector("body > div > div.mt-3 > center > div > .red").innerHTML = String(document.querySelector("body > div > div.mt-3 > center > div > .red").innerHTML).replaceAll("<br>", "<br><br>");
2118-
let StaticButton = document.createElement("button");
2119-
document.querySelectorAll("body > div > div.mt-3 > center > div > .red")[1].appendChild(StaticButton);
2120-
StaticButton.className = "btn btn-outline-secondary";
2121-
StaticButton.innerText = "统计";
2122-
StaticButton.addEventListener("click", () => {
2123-
location.href = "https://www.xmoj.tech/conteststatistics.php?cid=" + SearchParams.get("cid");
2124-
});
21252121

21262122
document.querySelector("#problemset > tbody").innerHTML = String(document.querySelector("#problemset > tbody").innerHTML).replaceAll(/\t&nbsp;([0-9]*) &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;([^<]*)/g, "$2. $1");
21272123

@@ -2240,7 +2236,7 @@ window.addEventListener('DOMContentLoaded', async () => {
22402236
if (Submitted) location.reload(); else AutoCheatButton.innerHTML = "自动提交当年代码";
22412237
});
22422238
document.addEventListener("keydown", (Event) => {
2243-
if (Event.code === 'Enter' && Event.ctrlKey) {
2239+
if (Event.code === 'Enter' && (Event.metaKey || Event.ctrlKey)) {
22442240
AutoCheatButton.click();
22452241
}
22462242
});
@@ -3148,39 +3144,6 @@ window.addEventListener('DOMContentLoaded', async () => {
31483144
});
31493145
});
31503146
}
3151-
} else if (location.pathname == "/conteststatistics.php") {
3152-
if (new URL(location.href).searchParams.get("cid") != null) {
3153-
document.title = "比赛 " + new URL(location.href).searchParams.get("cid") + " 统计";
3154-
}
3155-
document.querySelector("body > div > div.mt-3 > center > h3").innerText = "比赛统计";
3156-
if (UtilityEnabled("ResetType")) {
3157-
let Temp = document.getElementById("submission").childNodes;
3158-
for (let i = 0; i < Temp.length; i++) {
3159-
Temp[i].remove();
3160-
}
3161-
eval(document.querySelector("body > div.container > div > center > table:nth-child(4) > script:nth-child(6)").innerHTML);
3162-
document.querySelector("#cs > thead > tr > th:nth-child(1)").innerText = "题目编号";
3163-
document.querySelector("#cs > thead > tr > th:nth-child(10)").remove();
3164-
document.querySelector("#cs > thead > tr > th:nth-child(11)").innerText = "总和";
3165-
document.querySelector("#cs > thead > tr > th:nth-child(12)").remove();
3166-
document.querySelector("#cs > thead > tr > th:nth-child(12)").remove();
3167-
document.querySelector("#cs > thead > tr > th:nth-child(12)").remove();
3168-
document.querySelector("#cs > tbody > tr:last-child > td").innerText = "总和";
3169-
TidyTable(document.getElementById("cs"));
3170-
Temp = document.querySelector("#cs > tbody").children;
3171-
for (let i = 0; i < Temp.length; i++) {
3172-
let CurrentRowChildren = Temp[i].children;
3173-
CurrentRowChildren[9].remove();
3174-
CurrentRowChildren[11].remove();
3175-
CurrentRowChildren[11].remove();
3176-
CurrentRowChildren[11].remove();
3177-
for (let j = 0; j < CurrentRowChildren.length; j++) {
3178-
if (CurrentRowChildren[j].innerText == "") {
3179-
CurrentRowChildren[j].innerText = "0";
3180-
}
3181-
}
3182-
}
3183-
}
31843147
} else if (location.pathname == "/comparesource.php") {
31853148
if (UtilityEnabled("CompareSource")) {
31863149
if (location.search == "") {
@@ -4251,7 +4214,7 @@ int main()
42514214
TurnstileScript.src = "https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit&onload=CaptchaLoadedCallback";
42524215
document.body.appendChild(TurnstileScript);
42534216
ContentElement.addEventListener("keydown", (Event) => {
4254-
if (Event.ctrlKey && Event.keyCode == 13) {
4217+
if ((Event.metaKey || Event.ctrlKey) && Event.keyCode == 13) {
42554218
SubmitElement.click();
42564219
}
42574220
});
@@ -4428,7 +4391,7 @@ int main()
44284391
TurnstileScript.src = "https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit&onload=CaptchaLoadedCallback";
44294392
document.body.appendChild(TurnstileScript);
44304393
ContentElement.addEventListener("keydown", (Event) => {
4431-
if (Event.ctrlKey && Event.keyCode == 13) {
4394+
if ((Event.metaKey || Event.ctrlKey) && Event.keyCode == 13) {
44324395
SubmitElement.click();
44334396
}
44344397
});
@@ -4682,7 +4645,7 @@ int main()
46824645
ContentEditor.value = ContentEditor.value.substring(0, ContentEditor.value.indexOf("<br>"));
46834646
}
46844647
ContentEditor.addEventListener("keydown", (Event) => {
4685-
if (Event.ctrlKey && Event.keyCode == 13) {
4648+
if ((Event.metaKey || Event.ctrlKey) && Event.keyCode == 13) {
46864649
OKButton.click();
46874650
}
46884651
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xmoj-script",
3-
"version": "1.7.0",
3+
"version": "1.8.0",
44
"description": "an improvement script for xmoj.tech",
55
"main": "AddonScript.js",
66
"scripts": {

0 commit comments

Comments
 (0)