xmoj-script 1.2.54 → 1.2.56

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 CHANGED
@@ -2420,6 +2420,28 @@
2420
2420
  }
2421
2421
  ],
2422
2422
  "Notes": "No release notes were provided for this release."
2423
+ },
2424
+ "1.2.55": {
2425
+ "UpdateDate": 1723461779306,
2426
+ "Prerelease": true,
2427
+ "UpdateContents": [
2428
+ {
2429
+ "PR": 698,
2430
+ "Description": "Set turnstile theme and language"
2431
+ }
2432
+ ],
2433
+ "Notes": "No release notes were provided for this release."
2434
+ },
2435
+ "1.2.56": {
2436
+ "UpdateDate": 1723956966458,
2437
+ "Prerelease": true,
2438
+ "UpdateContents": [
2439
+ {
2440
+ "PR": 704,
2441
+ "Description": "登录界面优化"
2442
+ }
2443
+ ],
2444
+ "Notes": "No release notes were provided for this release."
2423
2445
  }
2424
2446
  }
2425
2447
  }
package/XMOJ.user.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // ==UserScript==
2
2
  // @name XMOJ
3
- // @version 1.2.54
3
+ // @version 1.2.56
4
4
  // @description XMOJ增强脚本
5
5
  // @author @XMOJ-Script-dev, @langningchen and the community
6
6
  // @namespace https://github/langningchen
@@ -878,10 +878,15 @@ async function main() {
878
878
  }
879
879
  if (UtilityEnabled("ResetType")) {
880
880
  if (document.querySelector("#profile") != undefined && document.querySelector("#profile").innerHTML == "登录") {
881
- if (document.querySelector("#navbar > ul.nav.navbar-nav.navbar-right > li > ul").childNodes.length == 3) {
882
- document.querySelector("#navbar > ul.nav.navbar-nav.navbar-right > li > ul").childNodes[3].remove();
883
- }
884
- } else if (document.querySelector("#navbar > ul.nav.navbar-nav.navbar-right > li > ul > li:nth-child(3) > a > span") != undefined && document.querySelector("#navbar > ul.nav.navbar-nav.navbar-right > li > ul > li:nth-child(3) > a > span").innerText != "个人中心") {
881
+ let PopupUL = document.querySelector("#navbar > ul.nav.navbar-nav.navbar-right > li > ul");
882
+ PopupUL.innerHTML = `<li class="dropdown-item">登录</li>`;
883
+ PopupUL.children[0].addEventListener("click", () => {
884
+ location.href = "https://www.xmoj.tech/loginpage.php";
885
+ });
886
+ let parentLi = document.querySelector("#navbar > ul.nav.navbar-nav.navbar-right > li");
887
+ document.addEventListener("click", (event) => { if (!parentLi.contains(event.target) && PopupUL.style.display === 'block') {hideDropdownItems();}});
888
+ }
889
+ else if (document.querySelector("#navbar > ul.nav.navbar-nav.navbar-right > li > ul > li:nth-child(3) > a > span") != undefined && document.querySelector("#navbar > ul.nav.navbar-nav.navbar-right > li > ul > li:nth-child(3) > a > span").innerText != "个人中心") {
885
890
  let PopupUL = document.querySelector("#navbar > ul.nav.navbar-nav.navbar-right > li > ul");
886
891
  PopupUL.innerHTML = `<li class="dropdown-item">修改帐号</li>
887
892
  <li class="dropdown-item">个人中心</li>
@@ -2754,8 +2759,8 @@ async function main() {
2754
2759
  ErrorElement.style.display = "none";
2755
2760
  document.querySelector("#Submit").disabled = true;
2756
2761
  document.querySelector("#Submit").value = "正在提交...";
2757
- let o2Switch="&enable_O2=on";
2758
- if(!document.querySelector("#enable_O2").checked)o2Switch="";
2762
+ let o2Switch = "&enable_O2=on";
2763
+ if (!document.querySelector("#enable_O2").checked) o2Switch = "";
2759
2764
  await fetch("https://www.xmoj.tech/submit.php", {
2760
2765
  "headers": {
2761
2766
  "content-type": "application/x-www-form-urlencoded"
@@ -2803,8 +2808,8 @@ async function main() {
2803
2808
  ErrorMessage.style.color = "red";
2804
2809
  ErrorMessage.innerText = "比赛已结束, 正在尝试像题目 " + rPID + " 提交";
2805
2810
  console.log("比赛已结束, 正在尝试像题目 " + rPID + " 提交");
2806
- let o2Switch="&enable_O2=on";
2807
- if(!document.querySelector("#enable_O2").checked)o2Switch="";
2811
+ let o2Switch = "&enable_O2=on";
2812
+ if (!document.querySelector("#enable_O2").checked) o2Switch = "";
2808
2813
  await fetch("https://www.xmoj.tech/submit.php", {
2809
2814
  "headers": {
2810
2815
  "content-type": "application/x-www-form-urlencoded"
@@ -4682,6 +4687,7 @@ int main()
4682
4687
  let CaptchaSecretKey = "";
4683
4688
  unsafeWindow.CaptchaLoadedCallback = () => {
4684
4689
  turnstile.render("#CaptchaContainer", {
4690
+ theme: UtilityEnabled("DarkMode") ? "dark" : "light", language: "zh-cn",
4685
4691
  sitekey: CaptchaSiteKey, callback: function (CaptchaSecretKeyValue) {
4686
4692
  CaptchaSecretKey = CaptchaSecretKeyValue;
4687
4693
  SubmitElement.disabled = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xmoj-script",
3
- "version": "1.2.54",
3
+ "version": "1.2.56",
4
4
  "description": "an improvement script for xmoj.tech",
5
5
  "main": "AddonScript.js",
6
6
  "scripts": {