xmoj-script 1.2.10 → 1.2.12
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/Update.json +22 -0
- package/XMOJ.user.js +25 -36
- package/package.json +1 -1
package/Update.json
CHANGED
@@ -1792,6 +1792,28 @@
|
|
1792
1792
|
}
|
1793
1793
|
],
|
1794
1794
|
"Notes": "No release notes were provided for this release."
|
1795
|
+
},
|
1796
|
+
"1.2.11": {
|
1797
|
+
"UpdateDate": 1722432013017,
|
1798
|
+
"Prerelease": true,
|
1799
|
+
"UpdateContents": [
|
1800
|
+
{
|
1801
|
+
"PR": 575,
|
1802
|
+
"Description": "Upgrade bootstrap + cdnjs"
|
1803
|
+
}
|
1804
|
+
],
|
1805
|
+
"Notes": "No release notes were provided for this release."
|
1806
|
+
},
|
1807
|
+
"1.2.12": {
|
1808
|
+
"UpdateDate": 1722433643071,
|
1809
|
+
"Prerelease": true,
|
1810
|
+
"UpdateContents": [
|
1811
|
+
{
|
1812
|
+
"PR": 576,
|
1813
|
+
"Description": "fix tidytable"
|
1814
|
+
}
|
1815
|
+
],
|
1816
|
+
"Notes": "No release notes were provided for this release."
|
1795
1817
|
}
|
1796
1818
|
}
|
1797
1819
|
}
|
package/XMOJ.user.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
// ==UserScript==
|
2
2
|
// @name XMOJ
|
3
|
-
// @version 1.2.
|
3
|
+
// @version 1.2.12
|
4
4
|
// @description XMOJ增强脚本
|
5
5
|
// @author @XMOJ-Script-dev, @langningchen and the community
|
6
6
|
// @namespace https://github/langningchen
|
@@ -80,6 +80,9 @@ let RenderMathJax = async () => {
|
|
80
80
|
ScriptElement.id = "MathJax-script";
|
81
81
|
ScriptElement.type = "text/javascript";
|
82
82
|
ScriptElement.src = "https://cdn.bootcdn.net/ajax/libs/mathjax/3.0.5/es5/tex-chtml.js";
|
83
|
+
if (UtilityEnabled("cdnjs")) {
|
84
|
+
ScriptElement.src = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.0.5/es5/tex-chtml.js";
|
85
|
+
}
|
83
86
|
document.body.appendChild(ScriptElement);
|
84
87
|
await new Promise((Resolve) => {
|
85
88
|
ScriptElement.onload = () => {
|
@@ -289,37 +292,13 @@ let TimeToStringTime = (Time) => {
|
|
289
292
|
* @param {HTMLElement} Table - The table element to be tidied up.
|
290
293
|
*/
|
291
294
|
let TidyTable = (Table) => {
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
// Table.querySelector("thead > tr").removeAttribute("align");
|
296
|
-
// Table.querySelector("thead > tr").innerHTML = Table.querySelector("thead > tr").innerHTML.replaceAll("td", "th");
|
297
|
-
// let Temp = Table.querySelector("thead > tr").children;
|
298
|
-
// for (let j = 0; j < Temp.length; j++) {
|
299
|
-
// let Width = Temp[j].style.width;
|
300
|
-
// Temp[j].removeAttribute("style");
|
301
|
-
// Temp[j].style.width = Width;
|
302
|
-
// Temp[j].removeAttribute("onclick");
|
303
|
-
// Temp[j].removeAttribute("align");
|
304
|
-
// }
|
305
|
-
// Table.querySelector("tbody").className = "table-group-divider";
|
306
|
-
// Temp = Table.querySelector("tbody").children;
|
307
|
-
// for (let j = 0; j < Temp.length; j++) {
|
308
|
-
// Temp[j].removeAttribute("align");
|
309
|
-
// let Temp2 = Temp[j].querySelectorAll("*");
|
310
|
-
// for (let k = 0; k < Temp2.length; k++) {
|
311
|
-
// Temp2[k].classList.remove("left");
|
312
|
-
// Temp2[k].classList.remove("center");
|
313
|
-
// if (Temp2[k].className == "") {
|
314
|
-
// Temp2[k].removeAttribute("class");
|
315
|
-
// }
|
316
|
-
// }
|
317
|
-
// }
|
318
|
-
// }
|
295
|
+
if (UtilityEnabled("NewBootstrap") && Table != null) {
|
296
|
+
Table.className = "table table-hover";
|
297
|
+
}
|
319
298
|
};
|
320
299
|
let UtilityEnabled = (Name) => {
|
321
300
|
if (localStorage.getItem("UserScript-Setting-" + Name) == null) {
|
322
|
-
const defaultOffItems = ["DebugMode", "
|
301
|
+
const defaultOffItems = ["DebugMode", "cdnjs", "SuperDebug", "ReplaceXM"];
|
323
302
|
localStorage.setItem("UserScript-Setting-" + Name, defaultOffItems.includes(Name) ? "false" : "true");
|
324
303
|
}
|
325
304
|
return localStorage.getItem("UserScript-Setting-" + Name) == "true";
|
@@ -485,16 +464,19 @@ async function main() {
|
|
485
464
|
rel: 'stylesheet'
|
486
465
|
}, {
|
487
466
|
type: 'link',
|
488
|
-
href: 'https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.
|
467
|
+
href: 'https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.3/css/bootstrap.min.css',
|
489
468
|
rel: 'stylesheet'
|
490
469
|
}, {
|
491
470
|
type: 'script',
|
492
|
-
src: 'https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.
|
471
|
+
src: 'https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.3/js/bootstrap.bundle.min.js',
|
493
472
|
isModule: true
|
494
473
|
}];
|
495
|
-
if (UtilityEnabled("
|
496
|
-
resources[
|
497
|
-
resources[
|
474
|
+
if (UtilityEnabled("cdnjs")) {
|
475
|
+
resources[0].href = 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/codemirror.min.css';
|
476
|
+
resources[1].href = 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/theme/darcula.min.css';
|
477
|
+
resources[2].href = 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/addon/merge/merge.min.css';
|
478
|
+
resources[3].href = 'https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/css/bootstrap.min.css';
|
479
|
+
resources[4].src = 'https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/js/bootstrap.bundle.min.js';
|
498
480
|
}
|
499
481
|
let loadResources = async () => {
|
500
482
|
let promises = resources.map(resource => {
|
@@ -1102,7 +1084,7 @@ async function main() {
|
|
1102
1084
|
"ID": "DebugMode", "Type": "A", "Name": "调试模式(仅供开发者使用)"
|
1103
1085
|
}, {
|
1104
1086
|
"ID": "SuperDebug", "Type": "A", "Name": "本地调试模式(仅供开发者使用) (未经授权的擅自开启将导致大部分功能不可用!)"
|
1105
|
-
}, {"ID": "
|
1087
|
+
}, {"ID": "cdnjs", "Type": "A", "Name": "使用 cdnjs (如果延迟不大, 建议使用)"},]));
|
1106
1088
|
let UtilitiesCardFooter = document.createElement("div");
|
1107
1089
|
UtilitiesCardFooter.className = "card-footer text-muted";
|
1108
1090
|
UtilitiesCardFooter.innerText = "* 不建议关闭,可能会导致系统不稳定、界面错乱、功能缺失等问题\n绿色:增加功能 黄色:修改功能 红色:删除功能";
|
@@ -1162,6 +1144,10 @@ async function main() {
|
|
1162
1144
|
<div class="cnt-row-head title">倒计时</div>
|
1163
1145
|
<div class="cnt-row-body">${CountDownData}</div>
|
1164
1146
|
</div>`;
|
1147
|
+
let Tables = document.getElementsByTagName("table");
|
1148
|
+
for (let i = 0; i < Tables.length; i++) {
|
1149
|
+
TidyTable(Tables[i]);
|
1150
|
+
}
|
1165
1151
|
document.querySelector("body > div > div.mt-3 > div > div.col-md-4").innerHTML += `<div class="cnt-row">
|
1166
1152
|
<div class="cnt-row-head title">公告</div>
|
1167
1153
|
<div class="cnt-row-body">加载中...</div>
|
@@ -1993,8 +1979,8 @@ async function main() {
|
|
1993
1979
|
})
|
1994
1980
|
.then(async (Response) => {
|
1995
1981
|
RankData = [];
|
1996
|
-
|
1997
1982
|
let Table = document.querySelector("#rank");
|
1983
|
+
Table.classList.add("table");
|
1998
1984
|
Table.innerHTML = "";
|
1999
1985
|
let StartPosition = Response.indexOf("var solutions=") + 14;
|
2000
1986
|
let EndPosition = Response.indexOf("}];", StartPosition) + 2;
|
@@ -2776,6 +2762,9 @@ async function main() {
|
|
2776
2762
|
let ACCode = Response.split("------------------------------------------------------\r\n");
|
2777
2763
|
let ScriptElement = document.createElement("script");
|
2778
2764
|
ScriptElement.src = "https://cdn.bootcdn.net/ajax/libs/jszip/3.10.1/jszip.min.js";
|
2765
|
+
if (UtilityEnabled("cdnjs")) {
|
2766
|
+
ScriptElement.src = "https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js";
|
2767
|
+
}
|
2779
2768
|
document.head.appendChild(ScriptElement);
|
2780
2769
|
ScriptElement.onload = () => {
|
2781
2770
|
var Zip = new JSZip();
|