xmoj-script 2.1.2 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/AutoLabelIssue.yml +1 -1
- package/.github/workflows/CodeQL.yml +1 -1
- package/.github/workflows/DependencyScan.yml +1 -1
- package/.github/workflows/Prerelease.yml +1 -1
- package/.github/workflows/Release.yml +1 -1
- package/.github/workflows/UpdateToRelease.yml +1 -1
- package/.github/workflows/UpdateVersion.yml +1 -1
- package/.github/workflows/main.yml +2 -2
- package/.github/workflows/sync-to-extern-contrib.yml +1 -1
- package/Update.json +30 -0
- package/XMOJ.user.js +46 -3
- package/package.json +1 -1
@@ -21,6 +21,6 @@ jobs:
|
|
21
21
|
with:
|
22
22
|
app-id: ${{ secrets.APP_ID }}
|
23
23
|
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
24
|
-
- uses: actions/checkout@
|
24
|
+
- uses: actions/checkout@v5
|
25
25
|
- name: Update version
|
26
26
|
run: node ./Update/UpdateVersion.js ${{ steps.generate_token.outputs.token }} ${{ github.event.number }} "${{ github.event.pull_request.title }}"
|
@@ -15,11 +15,11 @@ jobs:
|
|
15
15
|
pull-requests: write
|
16
16
|
checks: write
|
17
17
|
steps:
|
18
|
-
- uses: actions/checkout@
|
18
|
+
- uses: actions/checkout@v5
|
19
19
|
with:
|
20
20
|
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
|
21
21
|
fetch-depth: 0 # a full history is required for pull request analysis
|
22
22
|
- name: 'Qodana Scan'
|
23
|
-
uses: JetBrains/qodana-action@
|
23
|
+
uses: JetBrains/qodana-action@v2025.2
|
24
24
|
env:
|
25
25
|
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
|
package/Update.json
CHANGED
@@ -2991,6 +2991,36 @@
|
|
2991
2991
|
}
|
2992
2992
|
],
|
2993
2993
|
"Notes": "No release notes were provided for this release."
|
2994
|
+
},
|
2995
|
+
"2.1.3": {
|
2996
|
+
"UpdateDate": 1755596470421,
|
2997
|
+
"Prerelease": true,
|
2998
|
+
"UpdateContents": [
|
2999
|
+
{
|
3000
|
+
"PR": 835,
|
3001
|
+
"Description": "feat: add user-selectable theme"
|
3002
|
+
}
|
3003
|
+
],
|
3004
|
+
"Notes": "No release notes were provided for this release."
|
3005
|
+
},
|
3006
|
+
"2.2.0": {
|
3007
|
+
"UpdateDate": 1755767075588,
|
3008
|
+
"Prerelease": false,
|
3009
|
+
"UpdateContents": [
|
3010
|
+
{
|
3011
|
+
"PR": 829,
|
3012
|
+
"Description": "Update diff-match-patch library source URL"
|
3013
|
+
},
|
3014
|
+
{
|
3015
|
+
"PR": 834,
|
3016
|
+
"Description": "feat: use credential management api"
|
3017
|
+
},
|
3018
|
+
{
|
3019
|
+
"PR": 835,
|
3020
|
+
"Description": "feat: add user-selectable theme"
|
3021
|
+
}
|
3022
|
+
],
|
3023
|
+
"Notes": "No release notes were provided for this release."
|
2994
3024
|
}
|
2995
3025
|
}
|
2996
3026
|
}
|
package/XMOJ.user.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
// ==UserScript==
|
2
2
|
// @name XMOJ
|
3
|
-
// @version 2.
|
3
|
+
// @version 2.2.0
|
4
4
|
// @description XMOJ增强脚本
|
5
5
|
// @author @XMOJ-Script-dev, @langningchen and the community
|
6
6
|
// @namespace https://github/langningchen
|
@@ -552,6 +552,24 @@ let CurrentUsername = document.querySelector("#profile").innerText;
|
|
552
552
|
CurrentUsername = CurrentUsername.replaceAll(/[^a-zA-Z0-9]/g, "");
|
553
553
|
let IsAdmin = AdminUserList.indexOf(CurrentUsername) !== -1;
|
554
554
|
|
555
|
+
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)");
|
556
|
+
const applyTheme = (theme) => {
|
557
|
+
document.querySelector("html").setAttribute("data-bs-theme", theme);
|
558
|
+
localStorage.setItem("UserScript-Setting-DarkMode", theme === "dark" ? "true" : "false");
|
559
|
+
};
|
560
|
+
const applySystemTheme = (e) => applyTheme(e.matches ? "dark" : "light");
|
561
|
+
let initTheme = () => {
|
562
|
+
const saved = localStorage.getItem("UserScript-Setting-Theme") || "auto";
|
563
|
+
if (saved === "auto") {
|
564
|
+
applyTheme(prefersDark.matches ? "dark" : "light");
|
565
|
+
prefersDark.addEventListener("change", applySystemTheme);
|
566
|
+
} else {
|
567
|
+
applyTheme(saved);
|
568
|
+
prefersDark.removeEventListener("change", applySystemTheme);
|
569
|
+
}
|
570
|
+
};
|
571
|
+
initTheme();
|
572
|
+
|
555
573
|
|
556
574
|
class NavbarStyler {
|
557
575
|
constructor() {
|
@@ -1359,7 +1377,32 @@ async function main() {
|
|
1359
1377
|
} else if (Data[i].Type == "D") {
|
1360
1378
|
Row.classList.add("list-group-item-danger");
|
1361
1379
|
}
|
1362
|
-
if (Data[i].
|
1380
|
+
if (Data[i].ID == "Theme") {
|
1381
|
+
let Label = document.createElement("label");
|
1382
|
+
Label.classList.add("me-2");
|
1383
|
+
Label.htmlFor = "UserScript-Setting-Theme";
|
1384
|
+
Label.innerText = Data[i].Name;
|
1385
|
+
Row.appendChild(Label);
|
1386
|
+
let Select = document.createElement("select");
|
1387
|
+
Select.classList.add("form-select", "form-select-sm", "w-auto", "d-inline");
|
1388
|
+
Select.id = "UserScript-Setting-Theme";
|
1389
|
+
[
|
1390
|
+
["light", "亮色"],
|
1391
|
+
["dark", "暗色"],
|
1392
|
+
["auto", "跟随系统"]
|
1393
|
+
].forEach(opt => {
|
1394
|
+
let option = document.createElement("option");
|
1395
|
+
option.value = opt[0];
|
1396
|
+
option.innerText = opt[1];
|
1397
|
+
Select.appendChild(option);
|
1398
|
+
});
|
1399
|
+
Select.value = localStorage.getItem("UserScript-Setting-Theme") || "auto";
|
1400
|
+
Select.addEventListener("change", () => {
|
1401
|
+
localStorage.setItem("UserScript-Setting-Theme", Select.value);
|
1402
|
+
initTheme();
|
1403
|
+
});
|
1404
|
+
Row.appendChild(Select);
|
1405
|
+
} else if (Data[i].Children == undefined) {
|
1363
1406
|
let CheckBox = document.createElement("input");
|
1364
1407
|
CheckBox.classList.add("form-check-input");
|
1365
1408
|
CheckBox.classList.add("me-1");
|
@@ -1417,7 +1460,7 @@ async function main() {
|
|
1417
1460
|
}, {"ID": "ResetType", "Type": "F", "Name": "重新排版*"}, {
|
1418
1461
|
"ID": "AddColorText", "Type": "A", "Name": "增加彩色文字"
|
1419
1462
|
}, {"ID": "AddUnits", "Type": "A", "Name": "状态界面内存与耗时添加单位"}, {
|
1420
|
-
"ID": "
|
1463
|
+
"ID": "Theme", "Type": "A", "Name": "界面主题"
|
1421
1464
|
}, {"ID": "AddAnimation", "Type": "A", "Name": "增加动画"}, {
|
1422
1465
|
"ID": "ReplaceYN", "Type": "F", "Name": "题目前状态提示替换为好看的图标"
|
1423
1466
|
}, {"ID": "RemoveAlerts", "Type": "D", "Name": "去除多余反复的提示"}, {
|