xmoj-script 1.2.45 → 1.2.46

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. package/Update.json +11 -0
  2. package/XMOJ.user.js +29 -23
  3. package/package.json +1 -1
package/Update.json CHANGED
@@ -2285,6 +2285,17 @@
2285
2285
  }
2286
2286
  ],
2287
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."
2288
2299
  }
2289
2300
  }
2290
2301
  }
package/XMOJ.user.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // ==UserScript==
2
2
  // @name XMOJ
3
- // @version 1.2.45
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
- alert("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\n Don't want to see this message? Disable DebugMode.");
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
- alert("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\n Don't want to see this message? Disable DebugMode.");
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
- alert("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\n Don't want to see this message? Disable DebugMode.");
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
- alert("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\n Don't want to see this message? Disable DebugMode.");
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
- alert("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\n Don't want to see this message? Disable DebugMode.");
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
- alert("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\n Don't want to see this message? Disable DebugMode.");
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
- alert("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\n Don't want to see this message? Disable DebugMode.");
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
- alert("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\n Don't want to see this message? Disable DebugMode.");
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
- alert("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\n Don't want to see this message? Disable DebugMode.");
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
- alert("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\n Don't want to see this message? Disable DebugMode.");
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
- alert("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\n Don't want to see this message? Disable DebugMode.");
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
- alert("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\n Don't want to see this message? Disable DebugMode.");
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
- alert("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\n Don't want to see this message? Disable DebugMode.");
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
- alert("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\n Don't want to see this message? Disable DebugMode.");
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
- alert("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\n Don't want to see this message? Disable DebugMode.");
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
- alert("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\n Don't want to see this message? Disable DebugMode.");
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
- alert("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\n Don't want to see this message? Disable DebugMode.");
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
- alert("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\n Don't want to see this message? Disable DebugMode.");
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
- alert("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\n Don't want to see this message? Disable DebugMode.");
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
- alert(Response.Message);
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
- alert(Response.Message);
3269
+ SmartAlert(Response.Message);
3264
3270
  }
3265
3271
  });
3266
3272
  });
@@ -5052,7 +5058,7 @@ int main()
5052
5058
  } catch (e) {
5053
5059
  console.error(e);
5054
5060
  if (UtilityEnabled("DebugMode")) {
5055
- alert("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\n Don't want to see this message? Disable DebugMode.");
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.");
5056
5062
  }
5057
5063
  }
5058
5064
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xmoj-script",
3
- "version": "1.2.45",
3
+ "version": "1.2.46",
4
4
  "description": "an improvement script for xmoj.tech",
5
5
  "main": "AddonScript.js",
6
6
  "scripts": {