Skip to content

Commit 50cb487

Browse files
authored
Merge pull request #760 from XMOJ-Script-dev/dev
2025年第一个新版本发布
2 parents 80caf33 + 522e5bd commit 50cb487

6 files changed

Lines changed: 64 additions & 5 deletions

File tree

._.idea

4 KB
Binary file not shown.

._XMOJ.user.js

4 KB
Binary file not shown.

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ jobs:
2020
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
2121
fetch-depth: 0 # a full history is required for pull request analysis
2222
- name: 'Qodana Scan'
23-
uses: JetBrains/qodana-action@v2024.1
23+
uses: JetBrains/qodana-action@v2024.3
2424
env:
2525
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}

Update.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2644,6 +2644,43 @@
26442644
}
26452645
],
26462646
"Notes": "No release notes were provided for this release."
2647+
},
2648+
"1.2.71": {
2649+
"UpdateDate": 1732545478542,
2650+
"Prerelease": true,
2651+
"UpdateContents": [
2652+
{
2653+
"PR": 753,
2654+
"Description": "fix: 修复代码长度单位换算错误"
2655+
}
2656+
],
2657+
"Notes": "No release notes were provided for this release."
2658+
},
2659+
"1.2.72": {
2660+
"UpdateDate": 1738077477956,
2661+
"Prerelease": true,
2662+
"UpdateContents": [
2663+
{
2664+
"PR": 758,
2665+
"Description": "Fix #714"
2666+
}
2667+
],
2668+
"Notes": "No release notes were provided for this release."
2669+
},
2670+
"1.2.73": {
2671+
"UpdateDate": 1738925550389,
2672+
"Prerelease": false,
2673+
"UpdateContents": [
2674+
{
2675+
"PR": 753,
2676+
"Description": "fix: 修复代码长度单位换算错误"
2677+
},
2678+
{
2679+
"PR": 758,
2680+
"Description": "Fix #714"
2681+
}
2682+
],
2683+
"Notes": "No release notes were provided for this release."
26472684
}
26482685
}
26492686
}

XMOJ.user.js

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name XMOJ
3-
// @version 1.2.70
3+
// @version 1.2.73
44
// @description XMOJ增强脚本
55
// @author @XMOJ-Script-dev, @langningchen and the community
66
// @namespace https://github/langningchen
@@ -215,7 +215,7 @@ let GetUserBadge = async (Username) => {
215215
*/
216216
let GetUsernameHTML = async (Element, Username, Simple = false, Href = "https://www.xmoj.tech/userinfo.php?user=") => {
217217
try {
218-
Username = Username.replaceAll(/[^a-zA-Z0-9]/g, "");
218+
//Username = Username.replaceAll(/[^a-zA-Z0-9]/g, "");
219219
let ID = "Username-" + Username + "-" + Math.random();
220220
Element.id = ID;
221221
Element.innerHTML = `<div class="spinner-border spinner-border-sm me-2" role="status"></div>`;
@@ -340,6 +340,28 @@ let SizeToStringSize = (Memory) => {
340340
}
341341
}
342342
};
343+
let CodeSizeToStringSize = (Memory) => {
344+
try {
345+
if (UtilityEnabled("AddUnits")) {
346+
if (Memory < 1024) {
347+
return Memory + "B";
348+
} else if (Memory < 1024 * 1024) {
349+
return (Memory / 1024).toFixed(2) + "KB";
350+
} else if (Memory < 1024 * 1024 * 1024) {
351+
return (Memory / 1024 / 1024).toFixed(2) + "MB";
352+
} else {
353+
return (Memory / 1024 / 1024 / 1024).toFixed(2) + "GB";
354+
}
355+
} else {
356+
return Memory;
357+
}
358+
} catch (e) {
359+
console.error(e);
360+
if (UtilityEnabled("DebugMode")) {
361+
SmartAlert("XMOJ-Script internal error!\n\n" + e + "\n\n" + "If you see this message, please report it to the developer.\nDon't forget to include console logs and a way to reproduce the error!\n\nDon't want to see this message? Disable DebugMode.");
362+
}
363+
}
364+
};
343365
/**
344366
* Converts a time value to a string representation.
345367
* @param {number} Time - The time value to convert.
@@ -1836,7 +1858,7 @@ async function main() {
18361858
Temp[i].childNodes[3].childNodes[0].innerText = SizeToStringSize(Temp[i].childNodes[3].childNodes[0].innerText);
18371859
Temp[i].childNodes[4].childNodes[0].innerText = TimeToStringTime(Temp[i].childNodes[4].childNodes[0].innerText);
18381860
Temp[i].childNodes[5].innerText = Temp[i].childNodes[5].childNodes[0].innerText;
1839-
Temp[i].childNodes[6].innerText = SizeToStringSize(Temp[i].childNodes[6].innerText.substring(0, Temp[i].childNodes[6].innerText.length - 1));
1861+
Temp[i].childNodes[6].innerText = CodeSizeToStringSize(Temp[i].childNodes[6].innerText.substring(0, Temp[i].childNodes[6].innerText.length - 1));
18401862
Temp[i].childNodes[9].innerText = (Temp[i].childNodes[9].innerText == "" ? "否" : "是");
18411863
}
18421864
if (SearchParams.get("cid") === null) {

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.2.70",
3+
"version": "1.2.73",
44
"description": "an improvement script for xmoj.tech",
55
"main": "AddonScript.js",
66
"scripts": {

0 commit comments

Comments
 (0)