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
Binary file added ._.idea
Binary file not shown.
Binary file added ._XMOJ.user.js
Binary file not shown.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
fetch-depth: 0 # a full history is required for pull request analysis
- name: 'Qodana Scan'
uses: JetBrains/qodana-action@v2024.1
uses: JetBrains/qodana-action@v2024.3
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
37 changes: 37 additions & 0 deletions Update.json
Original file line number Diff line number Diff line change
Expand Up @@ -2644,6 +2644,43 @@
}
],
"Notes": "No release notes were provided for this release."
},
"1.2.71": {
"UpdateDate": 1732545478542,
"Prerelease": true,
"UpdateContents": [
{
"PR": 753,
"Description": "fix: 修复代码长度单位换算错误"
}
],
"Notes": "No release notes were provided for this release."
},
"1.2.72": {
"UpdateDate": 1738077477956,
"Prerelease": true,
"UpdateContents": [
{
"PR": 758,
"Description": "Fix #714"
}
],
"Notes": "No release notes were provided for this release."
},
"1.2.73": {
"UpdateDate": 1738925550389,
"Prerelease": false,
"UpdateContents": [
{
"PR": 753,
"Description": "fix: 修复代码长度单位换算错误"
},
{
"PR": 758,
"Description": "Fix #714"
}
],
"Notes": "No release notes were provided for this release."
}
}
}
28 changes: 25 additions & 3 deletions XMOJ.user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name XMOJ
// @version 1.2.70
// @version 1.2.73
// @description XMOJ增强脚本
// @author @XMOJ-Script-dev, @langningchen and the community
// @namespace https://github/langningchen
Expand Down Expand Up @@ -215,7 +215,7 @@ let GetUserBadge = async (Username) => {
*/
let GetUsernameHTML = async (Element, Username, Simple = false, Href = "https://www.xmoj.tech/userinfo.php?user=") => {
try {
Username = Username.replaceAll(/[^a-zA-Z0-9]/g, "");
//Username = Username.replaceAll(/[^a-zA-Z0-9]/g, "");
let ID = "Username-" + Username + "-" + Math.random();
Element.id = ID;
Element.innerHTML = `<div class="spinner-border spinner-border-sm me-2" role="status"></div>`;
Expand Down Expand Up @@ -340,6 +340,28 @@ let SizeToStringSize = (Memory) => {
}
}
};
let CodeSizeToStringSize = (Memory) => {
try {
if (UtilityEnabled("AddUnits")) {
if (Memory < 1024) {
return Memory + "B";
} else if (Memory < 1024 * 1024) {
return (Memory / 1024).toFixed(2) + "KB";
} else if (Memory < 1024 * 1024 * 1024) {
return (Memory / 1024 / 1024).toFixed(2) + "MB";
} else {
return (Memory / 1024 / 1024 / 1024).toFixed(2) + "GB";
}
} else {
return Memory;
}
} catch (e) {
console.error(e);
if (UtilityEnabled("DebugMode")) {
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.");
}
}
};
/**
* Converts a time value to a string representation.
* @param {number} Time - The time value to convert.
Expand Down Expand Up @@ -1836,7 +1858,7 @@ async function main() {
Temp[i].childNodes[3].childNodes[0].innerText = SizeToStringSize(Temp[i].childNodes[3].childNodes[0].innerText);
Temp[i].childNodes[4].childNodes[0].innerText = TimeToStringTime(Temp[i].childNodes[4].childNodes[0].innerText);
Temp[i].childNodes[5].innerText = Temp[i].childNodes[5].childNodes[0].innerText;
Temp[i].childNodes[6].innerText = SizeToStringSize(Temp[i].childNodes[6].innerText.substring(0, Temp[i].childNodes[6].innerText.length - 1));
Temp[i].childNodes[6].innerText = CodeSizeToStringSize(Temp[i].childNodes[6].innerText.substring(0, Temp[i].childNodes[6].innerText.length - 1));
Temp[i].childNodes[9].innerText = (Temp[i].childNodes[9].innerText == "" ? "否" : "是");
}
if (SearchParams.get("cid") === null) {
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": "1.2.70",
"version": "1.2.73",
"description": "an improvement script for xmoj.tech",
"main": "AddonScript.js",
"scripts": {
Expand Down