xmoj-script 1.2.44 → 1.2.46
Sign up to get free protection for your applications and to get access to all the features.
- package/AddonScript.js +1 -0
- package/Update.json +22 -0
- package/XMOJ.user.js +43 -27
- package/package.json +1 -1
package/AddonScript.js
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
console.log("AddonScript.js has loaded.");
|
package/Update.json
CHANGED
@@ -2274,6 +2274,28 @@
|
|
2274
2274
|
}
|
2275
2275
|
],
|
2276
2276
|
"Notes": "No release notes were provided for this release."
|
2277
|
+
},
|
2278
|
+
"1.2.45": {
|
2279
|
+
"UpdateDate": 1723180072602,
|
2280
|
+
"Prerelease": true,
|
2281
|
+
"UpdateContents": [
|
2282
|
+
{
|
2283
|
+
"PR": 667,
|
2284
|
+
"Description": "fix replying(again)"
|
2285
|
+
}
|
2286
|
+
],
|
2287
|
+
"Notes": "No release notes were provided for this release."
|
2288
|
+
},
|
2289
|
+
"1.2.46": {
|
2290
|
+
"UpdateDate": 1723181112001,
|
2291
|
+
"Prerelease": true,
|
2292
|
+
"UpdateContents": [
|
2293
|
+
{
|
2294
|
+
"PR": 669,
|
2295
|
+
"Description": "smartAlert!"
|
2296
|
+
}
|
2297
|
+
],
|
2298
|
+
"Notes": "No release notes were provided for this release."
|
2277
2299
|
}
|
2278
2300
|
}
|
2279
2301
|
}
|
package/XMOJ.user.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
// ==UserScript==
|
2
2
|
// @name XMOJ
|
3
|
-
// @version 1.2.
|
3
|
+
// @version 1.2.46
|
4
4
|
// @description XMOJ增强脚本
|
5
5
|
// @author @XMOJ-Script-dev, @langningchen and the community
|
6
6
|
// @namespace https://github/langningchen
|
@@ -50,10 +50,16 @@ let PurifyHTML = (Input) => {
|
|
50
50
|
} catch (e) {
|
51
51
|
console.error(e);
|
52
52
|
if (UtilityEnabled("DebugMode")) {
|
53
|
-
|
53
|
+
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.");
|
54
54
|
}
|
55
55
|
}
|
56
56
|
}
|
57
|
+
let SmartAlert = (Message) => {
|
58
|
+
if (localStorage.getItem("UserScript-Alert") !== Message) {
|
59
|
+
alert(Message);
|
60
|
+
}
|
61
|
+
localStorage.setItem("UserScript-Alert", Message);
|
62
|
+
}
|
57
63
|
/**
|
58
64
|
* Calculates the relative time based on the input date.
|
59
65
|
* @param {string|Date} Input - The input date.
|
@@ -84,7 +90,7 @@ let GetRelativeTime = (Input) => {
|
|
84
90
|
} catch (e) {
|
85
91
|
console.error(e);
|
86
92
|
if (UtilityEnabled("DebugMode")) {
|
87
|
-
|
93
|
+
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.");
|
88
94
|
}
|
89
95
|
}
|
90
96
|
};
|
@@ -113,7 +119,7 @@ let RenderMathJax = async () => {
|
|
113
119
|
} catch (e) {
|
114
120
|
console.error(e);
|
115
121
|
if (UtilityEnabled("DebugMode")) {
|
116
|
-
|
122
|
+
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.");
|
117
123
|
}
|
118
124
|
}
|
119
125
|
};
|
@@ -150,7 +156,7 @@ let GetUserInfo = async (Username) => {
|
|
150
156
|
} catch (e) {
|
151
157
|
console.error(e);
|
152
158
|
if (UtilityEnabled("DebugMode")) {
|
153
|
-
|
159
|
+
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.");
|
154
160
|
}
|
155
161
|
}
|
156
162
|
};
|
@@ -198,7 +204,7 @@ let GetUserBadge = async (Username) => {
|
|
198
204
|
} catch (e) {
|
199
205
|
console.error(e);
|
200
206
|
if (UtilityEnabled("DebugMode")) {
|
201
|
-
|
207
|
+
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.");
|
202
208
|
}
|
203
209
|
}
|
204
210
|
};
|
@@ -272,7 +278,7 @@ let GetUsernameHTML = async (Element, Username, Simple = false, Href = "https://
|
|
272
278
|
} catch (e) {
|
273
279
|
console.error(e);
|
274
280
|
if (UtilityEnabled("DebugMode")) {
|
275
|
-
|
281
|
+
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.");
|
276
282
|
}
|
277
283
|
}
|
278
284
|
};
|
@@ -290,7 +296,7 @@ let SecondsToString = (InputSeconds) => {
|
|
290
296
|
} catch (e) {
|
291
297
|
console.error(e);
|
292
298
|
if (UtilityEnabled("DebugMode")) {
|
293
|
-
|
299
|
+
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.");
|
294
300
|
}
|
295
301
|
}
|
296
302
|
}
|
@@ -306,7 +312,7 @@ let StringToSeconds = (InputString) => {
|
|
306
312
|
} catch (e) {
|
307
313
|
console.error(e);
|
308
314
|
if (UtilityEnabled("DebugMode")) {
|
309
|
-
|
315
|
+
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.");
|
310
316
|
}
|
311
317
|
}
|
312
318
|
}
|
@@ -333,7 +339,7 @@ let SizeToStringSize = (Memory) => {
|
|
333
339
|
} catch (e) {
|
334
340
|
console.error(e);
|
335
341
|
if (UtilityEnabled("DebugMode")) {
|
336
|
-
|
342
|
+
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.");
|
337
343
|
}
|
338
344
|
}
|
339
345
|
};
|
@@ -356,7 +362,7 @@ let TimeToStringTime = (Time) => {
|
|
356
362
|
} catch (e) {
|
357
363
|
console.error(e);
|
358
364
|
if (UtilityEnabled("DebugMode")) {
|
359
|
-
|
365
|
+
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.");
|
360
366
|
}
|
361
367
|
}
|
362
368
|
};
|
@@ -373,7 +379,7 @@ let TidyTable = (Table) => {
|
|
373
379
|
} catch (e) {
|
374
380
|
console.error(e);
|
375
381
|
if (UtilityEnabled("DebugMode")) {
|
376
|
-
|
382
|
+
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.");
|
377
383
|
}
|
378
384
|
}
|
379
385
|
};
|
@@ -387,7 +393,7 @@ let UtilityEnabled = (Name) => {
|
|
387
393
|
} catch (e) {
|
388
394
|
console.error(e);
|
389
395
|
if (UtilityEnabled("DebugMode")) {
|
390
|
-
|
396
|
+
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.");
|
391
397
|
}
|
392
398
|
}
|
393
399
|
};
|
@@ -433,7 +439,7 @@ let RequestAPI = (Action, Data, CallBack) => {
|
|
433
439
|
} catch (e) {
|
434
440
|
console.error(e);
|
435
441
|
if (UtilityEnabled("DebugMode")) {
|
436
|
-
|
442
|
+
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.");
|
437
443
|
}
|
438
444
|
}
|
439
445
|
};
|
@@ -480,7 +486,7 @@ class NavbarStyler {
|
|
480
486
|
} catch (e) {
|
481
487
|
console.error(e);
|
482
488
|
if (UtilityEnabled("DebugMode")) {
|
483
|
-
|
489
|
+
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.");
|
484
490
|
}
|
485
491
|
}
|
486
492
|
}
|
@@ -495,7 +501,7 @@ class NavbarStyler {
|
|
495
501
|
} catch (e) {
|
496
502
|
console.error(e);
|
497
503
|
if (UtilityEnabled("DebugMode")) {
|
498
|
-
|
504
|
+
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.");
|
499
505
|
}
|
500
506
|
}
|
501
507
|
}
|
@@ -516,7 +522,7 @@ class NavbarStyler {
|
|
516
522
|
} catch (e) {
|
517
523
|
console.error(e);
|
518
524
|
if (UtilityEnabled("DebugMode")) {
|
519
|
-
|
525
|
+
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.");
|
520
526
|
}
|
521
527
|
}
|
522
528
|
}
|
@@ -543,7 +549,7 @@ class NavbarStyler {
|
|
543
549
|
} catch (e) {
|
544
550
|
console.error(e);
|
545
551
|
if (UtilityEnabled("DebugMode")) {
|
546
|
-
|
552
|
+
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.");
|
547
553
|
}
|
548
554
|
}
|
549
555
|
}
|
@@ -561,7 +567,7 @@ class NavbarStyler {
|
|
561
567
|
} catch (e) {
|
562
568
|
console.error(e);
|
563
569
|
if (UtilityEnabled("DebugMode")) {
|
564
|
-
|
570
|
+
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.");
|
565
571
|
}
|
566
572
|
}
|
567
573
|
}
|
@@ -590,7 +596,7 @@ class NavbarStyler {
|
|
590
596
|
} catch (e) {
|
591
597
|
console.error(e);
|
592
598
|
if (UtilityEnabled("DebugMode")) {
|
593
|
-
|
599
|
+
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.");
|
594
600
|
}
|
595
601
|
}
|
596
602
|
}
|
@@ -3234,7 +3240,7 @@ async function main() {
|
|
3234
3240
|
}
|
3235
3241
|
window.location.reload();
|
3236
3242
|
} else {
|
3237
|
-
|
3243
|
+
SmartAlert(Response.Message);
|
3238
3244
|
}
|
3239
3245
|
});
|
3240
3246
|
}
|
@@ -3260,7 +3266,7 @@ async function main() {
|
|
3260
3266
|
}
|
3261
3267
|
window.location.reload();
|
3262
3268
|
} else {
|
3263
|
-
|
3269
|
+
SmartAlert(Response.Message);
|
3264
3270
|
}
|
3265
3271
|
});
|
3266
3272
|
});
|
@@ -4757,10 +4763,20 @@ int main()
|
|
4757
4763
|
ReplyButton.addEventListener("click", () => {
|
4758
4764
|
let Content = Replies[i].Content;
|
4759
4765
|
Content = Content.split("\n").map((Line) => {
|
4760
|
-
|
4761
|
-
|
4762
|
-
|
4763
|
-
|
4766
|
+
// Count the number of '>' characters at the beginning of the line
|
4767
|
+
let nestingLevel = 0;
|
4768
|
+
while (Line.startsWith(">")) {
|
4769
|
+
nestingLevel++;
|
4770
|
+
Line = Line.substring(1).trim();
|
4771
|
+
}
|
4772
|
+
// If the line is nested more than 2 levels deep, skip it
|
4773
|
+
if (nestingLevel > 2) {
|
4774
|
+
return null;
|
4775
|
+
}
|
4776
|
+
// Reconstruct the line with the appropriate number of '>' characters
|
4777
|
+
return "> ".repeat(nestingLevel + 1) + Line;
|
4778
|
+
}).filter(Line => Line !== null) // Remove null entries
|
4779
|
+
.join("\n");
|
4764
4780
|
ContentElement.value += Content + `\n\n@${Replies[i].UserID} `;
|
4765
4781
|
ContentElement.focus();
|
4766
4782
|
});
|
@@ -5042,7 +5058,7 @@ int main()
|
|
5042
5058
|
} catch (e) {
|
5043
5059
|
console.error(e);
|
5044
5060
|
if (UtilityEnabled("DebugMode")) {
|
5045
|
-
|
5061
|
+
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.");
|
5046
5062
|
}
|
5047
5063
|
}
|
5048
5064
|
}
|