0x3f-problem-solution

自定义分数区间显示题目 标记题目状态 配合灵茶山艾府题单解题

当前为 2025-03-04 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name 0x3f-problem-solution
  3. // @namespace https://greasyfork.org//zh-CN/scripts/501134-0x3f-problem-solution
  4. // @version 0.0.5.5
  5. // @author wuxin0011
  6. // @description 自定义分数区间显示题目 标记题目状态 配合灵茶山艾府题单解题
  7. // @license MIT
  8. // @icon https://assets.leetcode.cn/aliyun-lc-upload/users/endlesscheng/avatar_1690721039.png
  9. // @source https://github.com/wuxin0011/tampermonkey-script/tree/main/0x3f-leetcode
  10. // @supportURL https://greasyfork.org//zh-CN/scripts/501134-0x3f-problem-solution/feedback
  11. // @match https://leetcode.cn/circle/discuss/*
  12. // @match https://leetcode.cn/discuss/*
  13. // @match https://leetcode.cn/problems/*
  14. // @match https://leetcode.cn/contest/*/problems/*
  15. // @match https://leetcode.com/circle/discuss/*
  16. // @match https://leetcode.com/discuss/*
  17. // @match https://leetcode.com/problems/*
  18. // @match https://leetcode.com/contest/*/problems/*
  19. // @require https://unpkg.com/vue@3.4.31/dist/vue.global.prod.js
  20. // @require data:application/javascript,%3Bwindow.Vue%3DVue%3B
  21. // @require https://unpkg.com/element-plus@2.7.6/dist/index.full.js
  22. // @resource elementPlusCss https://unpkg.com/element-plus@2.7.6/dist/index.css
  23. // @grant GM_addStyle
  24. // @grant GM_deleteValue
  25. // @grant GM_getResourceText
  26. // @grant GM_getValue
  27. // @grant GM_registerMenuCommand
  28. // @grant GM_setValue
  29. // ==/UserScript==
  30.  
  31. (t=>{if(typeof GM_addStyle=="function"){GM_addStyle(t);return}const n=document.createElement("style");n.textContent=t,document.head.append(n)})(" h2[data-v-6b5a9c54]{color:#000!important;margin:10px 0!important;font-size:20px!important}.m-setting-button[data-v-76dd1ba0]{position:fixed;top:200px;right:0;z-index:100000}.m-button[data-v-76dd1ba0]{margin-left:16px!important;padding:5px!important;font-size:14px!important}.processs-flex[data-v-76dd1ba0]{display:flex;justify-content:center;align-items:center}.m-setting-button[data-v-6868725a]{position:fixed;top:200px;right:0;z-index:100000}.m-button[data-v-6868725a]{margin-left:16px!important;padding:5px!important;font-size:14px!important}.processs-flex[data-v-6868725a]{display:flex;justify-content:center;align-items:center} ");
  32.  
  33. (function (ElementPlus, vue) {
  34. 'use strict';
  35.  
  36. var _GM_deleteValue = /* @__PURE__ */ (() => typeof GM_deleteValue != "undefined" ? GM_deleteValue : void 0)();
  37. var _GM_getValue = /* @__PURE__ */ (() => typeof GM_getValue != "undefined" ? GM_getValue : void 0)();
  38. var _GM_registerMenuCommand = /* @__PURE__ */ (() => typeof GM_registerMenuCommand != "undefined" ? GM_registerMenuCommand : void 0)();
  39. var _GM_setValue = /* @__PURE__ */ (() => typeof GM_setValue != "undefined" ? GM_setValue : void 0)();
  40. let Cache$1 = class Cache2 {
  41. set(k, v) {
  42. _GM_setValue(k, v);
  43. }
  44. get(k, parse = true, name = String.name) {
  45. try {
  46. let v = _GM_getValue(k);
  47. switch (name) {
  48. case String.name:
  49. if (v == null) {
  50. return "null";
  51. }
  52. return v;
  53. case Object.name:
  54. if (v == null || v == void 0 || typeof v != "object") {
  55. return {};
  56. }
  57. return v;
  58. case Boolean.name:
  59. if (v === null || v == void 0) {
  60. return false;
  61. }
  62. if (v == false || v == "false" || v == "" || v == "null") {
  63. return false;
  64. }
  65. return v;
  66. case Array.name:
  67. if (v === null || v == void 0 || !Array.isArray(v)) {
  68. return [];
  69. }
  70. return v;
  71. default:
  72. return v;
  73. }
  74. } catch (E) {
  75. return null;
  76. }
  77. }
  78. remove(k) {
  79. _GM_deleteValue(k);
  80. }
  81. };
  82. const Cache$2 = new Cache$1();
  83. const width = 14;
  84. const height = 14;
  85. const svg_css_style = () => isEnglishENV() ? "" : document.querySelector('#lc-content [class*="CollapsibleMarkdownContent"] [class*="MarkdownContent"]') ? ` ` : "display:inline;margin-bottom:3px;";
  86. const bilibiliSVG = () => {
  87. return `<svg width="${width}px" height="${height}px" style="${svg_css_style()}" status="bilibili" title="bilibili" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" fill="#00a3d9">
  88. <path fill="none" d="M0 0h24v24H0z"></path>
  89. <path d="M18.223 3.086a1.25 1.25 0 0 1 0 1.768L17.08 5.996h1.17A3.75 3.75 0 0 1 22 9.747v7.5a3.75 3.75 0 0 1-3.75 3.75H5.75A3.75 3.75 0 0 1 2 17.247v-7.5a3.75 3.75 0 0 1 3.75-3.75h1.166L5.775 4.855a1.25 1.25 0 1 1 1.767-1.768l2.652 2.652q.119.119.198.257h3.213q.08-.14.199-.258l2.651-2.652a1.25 1.25 0 0 1 1.768 0m.027 5.42H5.75a1.25 1.25 0 0 0-1.247 1.157l-.003.094v7.5c0 .659.51 1.199 1.157 1.246l.093.004h12.5a1.25 1.25 0 0 0 1.247-1.157l.003-.093v-7.5c0-.69-.56-1.25-1.25-1.25zm-10 2.5c.69 0 1.25.56 1.25 1.25v1.25a1.25 1.25 0 1 1-2.5 0v-1.25c0-.69.56-1.25 1.25-1.25m7.5 0c.69 0 1.25.56 1.25 1.25v1.25a1.25 1.25 0 1 1-2.5 0v-1.25c0-.69.56-1.25 1.25-1.25"></path>
  90. </svg>
  91. `;
  92. };
  93. const problemContenst = () => `
  94. <svg width="${width}px" height="${height}px" style="${svg_css_style()}" status="contest" title="竞赛题目专属图标" viewBox="-3.5 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
  95. <path d="M9.73795 18.8436L12.9511 20.6987L6.42625 32L4.55349 27.8233L9.73795 18.8436Z" fill="#CE4444"/>
  96. <path d="M9.73795 18.8436L6.52483 16.9885L0 28.2898L4.55349 27.8233L9.73795 18.8436Z" fill="#983535"/>
  97. <path d="M14.322 18.8436L11.1088 20.6987L17.6337 32L19.5064 27.8233L14.322 18.8436Z" fill="#983535"/>
  98. <path d="M14.322 18.8436L17.5351 16.9885L24.0599 28.2898L19.5064 27.8233L14.322 18.8436Z" fill="#CE4444"/>
  99. <path d="M22.9936 11.0622C22.9936 17.1716 18.0409 22.1243 11.9314 22.1243C5.82194 22.1243 0.869249 17.1716 0.869249 11.0622C0.869249 4.9527 5.82194 0 11.9314 0C18.0409 0 22.9936 4.9527 22.9936 11.0622Z" fill="url(#paint0_linear_103_1801)"/>
  100. <path d="M20.5665 11.0621C20.5665 15.8311 16.7004 19.6972 11.9315 19.6972C7.16247 19.6972 3.29645 15.8311 3.29645 11.0621C3.29645 6.29315 7.16247 2.42713 11.9315 2.42713C16.7004 2.42713 20.5665 6.29315 20.5665 11.0621Z" fill="#A88300"/>
  101. <path d="M21.0477 11.984C21.0477 16.7641 17.1727 20.6391 12.3926 20.6391C7.61251 20.6391 3.73748 16.7641 3.73748 11.984C3.73748 7.20389 7.61251 3.32887 12.3926 3.32887C17.1727 3.32887 21.0477 7.20389 21.0477 11.984Z" fill="#C28B37"/>
  102. <path d="M20.5868 11.0621C20.5868 15.8422 16.7118 19.7172 11.9317 19.7172C7.15159 19.7172 3.27656 15.8422 3.27656 11.0621C3.27656 6.28205 7.15159 2.40702 11.9317 2.40702C16.7118 2.40702 20.5868 6.28205 20.5868 11.0621Z" fill="#C09525"/>
  103. <path d="M11.9781 5.04096L13.8451 8.77502L17.5792 9.24178L15.0151 12.117L15.7122 16.2431L11.9781 14.3761L8.24404 16.2431L8.94729 12.117L6.37701 9.24178L10.1111 8.77502L11.9781 5.04096Z" fill="url(#paint1_linear_103_1801)"/>
  104. <defs>
  105. <linearGradient id="paint0_linear_103_1801" x1="11.1804" y1="4.03192" x2="12.6813" y2="31.965" gradientUnits="userSpaceOnUse">
  106. <stop stop-color="#FFC600"/>
  107. <stop offset="1" stop-color="#FFDE69"/>
  108. </linearGradient>
  109. <linearGradient id="paint1_linear_103_1801" x1="11.9783" y1="5.04096" x2="11.9783" y2="16.2431" gradientUnits="userSpaceOnUse">
  110. <stop stop-color="#FFFCDD"/>
  111. <stop offset="1" stop-color="#FFE896"/>
  112. </linearGradient>
  113. </defs>
  114. </svg>
  115.  
  116. `;
  117. const problemFinsh = () => `
  118.  
  119. <svg width="${width}px" height="${height}px" style="${svg_css_style()}" status="ac" title="AC专属图标" viewBox="0 0 1024 1024" version="1.1"
  120. xmlns="http://www.w3.org/2000/svg">
  121. <path d="M512 512m-448 0a448 448 0 1 0 896 0 448 448 0 1 0-896 0Z" fill="#4CAF50" />
  122. <path
  123. d="M738.133333 311.466667L448 601.6l-119.466667-119.466667-59.733333 59.733334 179.2 179.2 349.866667-349.866667z"
  124. fill="#CCFF90" />
  125. </svg>
  126.  
  127. `;
  128. const problemsTry = () => `
  129. <svg width="${width}px" height="${height}px" style="${svg_css_style()}" status="notac" title="尝试过" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg"
  130. xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512"
  131. style="enable-background:new 0 0 512 512;" xml:space="preserve">
  132. <path style="fill:#FEDEA1;" d="M256,12.8C121.899,12.8,12.8,121.899,12.8,256S121.899,499.2,256,499.2S499.2,390.101,499.2,256
  133. S390.101,12.8,256,12.8z" />
  134. <g>
  135. <path style="fill:#573A32;" d="M256,115.2c-49.271,0-92.561,25.353-117.726,63.676l18.859,18.859
  136. C177.178,163.806,213.734,140.8,256,140.8c63.625,0,115.2,51.567,115.2,115.2h-38.4l51.2,51.2l51.2-51.2h-38.4
  137. C396.8,178.244,333.764,115.2,256,115.2z" />
  138. <path style="fill:#573A32;" d="M256,0C114.62,0,0,114.62,0,256s114.62,256,256,256s256-114.62,256-256S397.38,0,256,0z M256,486.4
  139. C128.956,486.4,25.6,383.044,25.6,256S128.956,25.6,256,25.6S486.4,128.956,486.4,256S383.044,486.4,256,486.4z" />
  140. <path style="fill:#573A32;" d="M256,371.2c-63.625,0-115.2-51.567-115.2-115.2h38.4L128,204.8L76.8,256h38.4
  141. c0,77.756,63.036,140.8,140.8,140.8c49.272,0,92.561-25.353,117.726-63.676l-18.859-18.859
  142. C334.822,348.194,298.266,371.2,256,371.2z" />
  143. </g>
  144. </svg>
  145.  
  146. `;
  147. const problemsNo = () => install_pos() ? `
  148. <svg width="${width}px" height="${height}px" style="${svg_css_style()}" status="null" title="未尝试" viewBox="0 0 24 24" id="meteor-icon-kit__regular-circle" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12C0 5.37258 5.37258 0 12 0C18.6274 0 24 5.37258 24 12Z" fill="#758CA3"/></svg>
  149. ` : ``;
  150. const createStatus = (status, link) => {
  151. var _a;
  152. let node;
  153. if (!link) {
  154. return;
  155. }
  156. const curUrl = (link == null ? void 0 : link.href) ?? ((_a = link.querySelector("a")) == null ? void 0 : _a.href);
  157. node = link instanceof HTMLAnchorElement ? link.parentElement : link;
  158. if (node) {
  159. node.status = status;
  160. }
  161. let installSVG = "";
  162. if (isContest(curUrl)) {
  163. installSVG = problemContenst();
  164. } else if (isLeetCodeCircleUrl(curUrl)) ;
  165. else if (isBilibili(curUrl)) {
  166. installSVG = bilibiliSVG();
  167. } else {
  168. if (status == STATUS["AC"]) {
  169. installSVG = problemFinsh();
  170. } else if (status == STATUS["notac"]) {
  171. installSVG = problemsTry();
  172. } else if (status == STATUS["NO"]) {
  173. installSVG = problemsNo();
  174. }
  175. }
  176. let svg = node.querySelector("svg");
  177. if (svg) {
  178. if (svg.getAttribute("status") == status || svg.getAttribute("status") == STATUS["AC"]) {
  179. return false;
  180. }
  181. svg.remove();
  182. }
  183. if (isBilibili(curUrl)) {
  184. node.innerHTML = node.innerHTML + "&nbsp;" + installSVG;
  185. } else {
  186. node.innerHTML = install_pos() ? installSVG + node.innerHTML : node.innerHTML + installSVG;
  187. }
  188. return true;
  189. };
  190. const inf = 4e3;
  191. const mi = 1e3;
  192. const __0X3F_PROBLEM_KEYS__$1 = {
  193. "__0x3f_problmes_solution__": "__0x3f_problmes_solution__",
  194. // 基本信息
  195. "__0x3f_problmes_urls__": "__0x3f_problmes_urls__",
  196. // 题单key
  197. "__0x3f_problmes_update__": "__0x3f_problmes_update__",
  198. // 是否修改了默认题单key
  199. "__0x3f_problmes_button_is_none__": "__is_none_0x3f_problmes_button__",
  200. // 是否隐藏设置按钮
  201. "__0x3f_problmes_insert_pos__": "__0x3f_problmes_insert_pos__",
  202. // 安装位置
  203. "__0x3f_problmes_status_update__": "__0x3f_problmes_status_update__",
  204. "__0x3f_problmes_plugin_load_ok__": "__0x3f_problmes_plugin_load_ok__",
  205. // 是否使用插件
  206. "__0x3f_problmes_add_cur__": "__0x3f_problmes_add_cur__",
  207. // 添加 url
  208. "__0x3f_problmes_ac_key__": "__local_ok_problem_key__",
  209. // ac key
  210. "__0x3f_problmes_ac_version__": "__0x3f_problmes_ac_version__",
  211. // TODO ac key version
  212. "__0x3f_problmes_all_problems__": "__0x3f_problmes_all_problems__",
  213. // all problems
  214. "__0x3f_problmes_random_problems_key__": "__0x3f_problmes_random_problems_key__",
  215. //随机题目快捷键
  216. "__0x3f_problmes_random_problems__": "__0x3f_problmes_random_problems__",
  217. //随机题目
  218. "__0x3f_problme_support_type__": "__0x3f_problme_support_type__",
  219. //是否替换到com 默认cn
  220. "__0x3f_problme_support_type_tips__": "__0x3f_problme_support_type_tips__"
  221. //是否替换到com 默认cn 不再提示key
  222. };
  223. const STATUS = {
  224. "AC": "ac",
  225. "NO": "null",
  226. "notac": "notac",
  227. "Accepted": "ac",
  228. "Wrong Answer": "notac"
  229. };
  230. const defaultObj = {
  231. min: mi,
  232. max: inf,
  233. visiableMember: true,
  234. onlyUrls: false,
  235. useDefaultSetting: true,
  236. hiddenAc: false,
  237. showAcConfig: true,
  238. sortedType: 0
  239. };
  240. function install_pos() {
  241. return !Cache$2.get(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_insert_pos__"], false, Boolean.name);
  242. }
  243. function isShow(text, min, max) {
  244. if (!text) {
  245. return true;
  246. }
  247. let res = text.match(/\d+/ig);
  248. if (!res) {
  249. return true;
  250. }
  251. if (Array.isArray(res) && res.length < 2) {
  252. return true;
  253. }
  254. let s = 0;
  255. for (let i = res.length - 1; i >= 0; i--) {
  256. s = res[i];
  257. if (s >= mi && s <= inf) {
  258. return s >= min && s <= max;
  259. }
  260. }
  261. return true;
  262. }
  263. let A = void 0;
  264. const linkCssSelector_pre = () => isEnglishENV() ? ".discuss-markdown-container" : document.querySelector('#lc-content [class*="CollapsibleMarkdownContent"] [class*="MarkdownContent"]') ? `#lc-content [class*="CollapsibleMarkdownContent"] [class*="MarkdownContent"]` : `.break-words`;
  265. const linkCssSelector = `${linkCssSelector_pre()} li>a`;
  266. const queryProblem = () => Array.from(document.querySelectorAll(linkCssSelector)).filter((item) => item && item instanceof HTMLAnchorElement && (isProblem(item.href) || isContest(item.href)));
  267. function loadProblems() {
  268. A = queryProblem();
  269. return A;
  270. }
  271. function handlerProblem(data) {
  272. var _a;
  273. try {
  274. loadProblems();
  275. let { min, max, visiableMember, useDefaultSetting, onlyUrls, hiddenAc } = data;
  276. if (isNaN(min) || isNaN(max)) {
  277. min = mi;
  278. max = inf;
  279. }
  280. if (min < mi) {
  281. min = mi;
  282. }
  283. if (max < min) {
  284. max = inf;
  285. }
  286. min = Number(min);
  287. max = Number(max);
  288. data.min = min;
  289. data.max = max;
  290. Cache$2.set(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_solution__"], data);
  291. for (let i = 0; i < A.length; i++) {
  292. if (!(A[i] instanceof HTMLAnchorElement)) {
  293. continue;
  294. }
  295. let d = (_a = A[i]) == null ? void 0 : _a.parentNode;
  296. if (!d) {
  297. continue;
  298. }
  299. let none = false;
  300. let Nohidden = isShow(d.textContent, min, max);
  301. d.style.display = Nohidden ? "" : "none";
  302. if (!Nohidden) {
  303. continue;
  304. }
  305. if (hiddenAc) {
  306. const svg = d.querySelector("svg");
  307. if (svg && svg.getAttribute("status")) {
  308. d.style.display = svg.getAttribute("status") == STATUS["AC"] ? "none" : "";
  309. }
  310. } else {
  311. d.style.display = "";
  312. }
  313. let c = d.textContent && d.textContent.indexOf("会员") != -1;
  314. if (!c) {
  315. continue;
  316. }
  317. d.style.display = visiableMember ? "" : "none";
  318. }
  319. } catch (e) {
  320. console.log("error", e);
  321. }
  322. }
  323. function computeAcInfo(saveUrls = [], deleteOk = true) {
  324. let infos = [];
  325. let set = /* @__PURE__ */ new Set();
  326. for (let i = 0, u = null; Array.isArray(saveUrls) && i < saveUrls.length; i++) {
  327. try {
  328. u = saveUrls[i];
  329. if (!(u == null ? void 0 : u.link) || !(u == null ? void 0 : u.title) || !(u == null ? void 0 : u.id) || set.has(u.link)) {
  330. continue;
  331. }
  332. if (u["select"] == void 0) u.select = true;
  333. if (u["loading"] == void 0 || u["loading"]) u["loading"] = false;
  334. let s = Object.values(u).join("");
  335. if (s == "null" || !Cache$2.get(u.link) || !getAcCountKey(u.link) || !Cache$2.get(getAcCountKey(u.link))) {
  336. continue;
  337. }
  338. let o = Cache$2.get(getAcCountKey(u.link));
  339. u["ac"] = isNaN(o["ac"]) ? 0 : parseInt(o["ac"]);
  340. u["tot"] = isNaN(o["tot"]) ? 0 : parseInt(o["tot"]);
  341. set.add(u.link);
  342. } catch (e) {
  343. }
  344. infos.push(Object.assign({}, u));
  345. }
  346. if (deleteOk) {
  347. for (let i = 0; i < saveUrls[i]; i++) {
  348. delete saveUrls[i];
  349. }
  350. for (let info of infos) {
  351. saveUrls.push(info);
  352. }
  353. }
  354. return infos;
  355. }
  356. const initUrls = () => {
  357. let saveUrls = Cache$2.get(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_update__"], true, Boolean.name) ? Cache$2.get(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_urls__"], true, Array.name) : defaultUrls;
  358. return computeAcInfo(saveUrls);
  359. };
  360. const initObj = () => {
  361. let obj = Cache$2.get(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_solution__"]) ? Object.assign(defaultObj, Cache$2.get(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_solution__"])) : defaultObj;
  362. if (obj["showAcConfig"] == null || obj["showAcConfig"] == void 0) {
  363. obj.showAcConfig = true;
  364. }
  365. if (obj["sortedType"] == null || obj["sortedType"] == void 0) {
  366. obj.sortedType = 0;
  367. }
  368. let temp = {};
  369. for (let key of Object.keys(obj)) {
  370. if (!isNaN(key) || defaultObj[`${key}`] == void 0) continue;
  371. temp[`${key}`] = obj[`${key}`];
  372. }
  373. return temp;
  374. };
  375. const support_plugins = () => {
  376. const u = initObj();
  377. if (!u || !u.onlyUrls) return true;
  378. let url = window.location.href;
  379. if (isLeetCodeCircleUrl(url) && url.indexOf("view") != -1) {
  380. try {
  381. url = url.split("view")[0];
  382. } catch (e) {
  383. url = window.location.href;
  384. }
  385. }
  386. const urls = initUrls();
  387. for (let info of urls) {
  388. if (!info || !(info == null ? void 0 : info.link)) {
  389. continue;
  390. }
  391. if (info.link.indexOf(url) != -1) {
  392. return true;
  393. }
  394. }
  395. return false;
  396. };
  397. const defaultUrls = [
  398. { "title": "数学算法(数论/组合/概率期望/博弈/计算几何/随机算法", "link": "https://leetcode.cn/circle/discuss/IYT3ss/", "tot": 0, "ac": 0, "id": 1, "disabled": false, "select": true },
  399. { "title": "常用数据结构(前缀和/差分/栈/队列/堆/字典树/并查集/树状数组/线段树)", "link": "https://leetcode.cn/circle/discuss/mOr1u6/", "tot": 0, "ac": 0, "id": 2, "disabled": false, "select": true },
  400. { "title": "动态规划(入门/背包/状态机/划分/区间/状压/数位/树形/数据结构优化)", "link": "https://leetcode.cn/circle/discuss/tXLS3i/", "tot": 0, "ac": 0, "id": 3, "disabled": false, "select": true },
  401. { "title": "图论算法(DFS/BFS/拓扑排序/最短路/最小生成树/二分图/基环树/欧拉路径)", "link": "https://leetcode.cn/circle/discuss/01LUak/", "tot": 0, "ac": 0, "id": 4, "disabled": false, "select": true },
  402. { "title": "位运算(基础/性质/拆位/试填/恒等式/贪心/脑筋急转弯)", "link": "https://leetcode.cn/circle/discuss/dHn9Vk/", "tot": 0, "ac": 0, "id": 5, "disabled": false, "select": true },
  403. { "title": "网格图(DFS/BFS/综合应用)", "link": "https://leetcode.cn/circle/discuss/YiXPXW/", "tot": 0, "ac": 0, "id": 6, "disabled": false, "select": true },
  404. { "title": "单调栈(矩形面积/贡献法/最小字典序", "link": "https://leetcode.cn/circle/discuss/9oZFK9/", "tot": 0, "ac": 0, "id": 7, "disabled": false, "select": true },
  405. { "title": "二分算法(二分答案/最小化最大值/最大化最小值/第K小", "link": "https://leetcode.cn/circle/discuss/SqopEo/", "tot": 0, "ac": 0, "id": 8, "disabled": true, "select": true },
  406. { "title": "滑动窗口(定长/不定长/多指针", "link": "https://leetcode.cn/circle/discuss/0viNMK/", "tot": 0, "ac": 0, "id": 9, "disabled": false, "select": true },
  407. { "title": "贪心算法(基本贪心策略/反悔/区间/字典序/数学/思维/构造)", "link": "https://leetcode.cn/circle/discuss/g6KTKL/", "tot": 0, "ac": 0, "id": 10, "disabled": false, "select": true },
  408. { "title": "链表、二叉树与一般树(前后指针/快慢指针/DFS/BFS/直径/LCA)", "link": "https://leetcode.cn/circle/discuss/K0n2gO/", "tot": 0, "ac": 0, "id": 11, "disabled": false, "select": true },
  409. { "title": "字符串(KMP/Z函数/Manacher/字符串哈希/AC自动机/后缀数组/子序列自动机)", "link": "https://leetcode.cn/circle/discuss/SJFwQI/", "tot": 0, "ac": 0, "id": 12, "disabled": false, "select": true }
  410. // { 'title': '灵茶题单完成情况', 'link': 'https://leetcode.cn/u/endlesscheng/', 'tot': 0, 'ac': 0, 'id': 0x3f3f3f3f,'disabled':true,'select':false },
  411. ];
  412. function getId(problemUrl) {
  413. if (isContest(problemUrl) || isProblem(problemUrl)) {
  414. try {
  415. return problemUrl.split("problems")[1].split("/")[1];
  416. } catch (e) {
  417. return "";
  418. }
  419. }
  420. return "";
  421. }
  422. function postData(ID2) {
  423. return {
  424. "query": "\n query userQuestionStatus($titleSlug: String!) {\n question(titleSlug: $titleSlug) {\n status\n }\n}\n ",
  425. "variables": {
  426. "titleSlug": ID2
  427. },
  428. "operationName": "userQuestionStatus"
  429. };
  430. }
  431. async function queryStatus(ID2 = "", cache = {}, cur = void 0, watch2 = false) {
  432. var _a, _b, _c;
  433. if (!ID2) {
  434. return;
  435. }
  436. if (cache[ID2] == void 0 || cache[ID2] != STATUS["AC"]) {
  437. const response = await getProblemAcInfo(ID2);
  438. if (isDev()) {
  439. console.log("query result response:", response);
  440. }
  441. if ((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.question) {
  442. const status = (_c = (_b = response == null ? void 0 : response.data) == null ? void 0 : _b.question) == null ? void 0 : _c.status;
  443. if (cache[ID2] == void 0 || cache[ID2] != status) {
  444. cache[ID2] = status == null ? "null" : status;
  445. if (watch2) {
  446. if (isDev()) {
  447. console.log("save local status :", cache[ID2], "status = ", status, "get local status :", Cache$2.get(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_ac_key__"])[ID2]);
  448. }
  449. watchSaveStatus(ID2, cache[ID2]);
  450. }
  451. createStatus(cache[ID2], cur);
  452. }
  453. } else {
  454. console.warn("query result is undefined");
  455. createStatus(cache[ID2], cur);
  456. }
  457. }
  458. }
  459. async function addProcess(reload = true, doms = void 0, asyncAc = false) {
  460. var _a;
  461. let problems_doms = Array.isArray(doms) ? doms : loadProblems();
  462. const cache = getLocalProblemStatus();
  463. let uid = 0, query_cnt = 0;
  464. const isReplaceEnglish = isEnglish();
  465. for (let i = 0; i < problems_doms.length; i++) {
  466. let cur = problems_doms[i].parentElement;
  467. if (!(cur instanceof HTMLElement)) {
  468. continue;
  469. }
  470. const ID2 = getId((_a = problems_doms[i]) == null ? void 0 : _a.href);
  471. if (!ID2) {
  472. continue;
  473. }
  474. if (install_pos()) {
  475. cur.style.listStyleType = "none";
  476. }
  477. if (isReplaceEnglish && problems_doms[i].href) {
  478. problems_doms[i].href = problems_doms[i].href.replace("leetcode.cn", "leetcode.com");
  479. }
  480. if (!cache[ID2] || cache[ID2] != STATUS["AC"] && asyncAc) {
  481. await sleep(50);
  482. await queryStatus(ID2, cache, cur, false);
  483. query_cnt++;
  484. if (query_cnt % 10 == 0) {
  485. Cache$2.set(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_ac_key__"], cache);
  486. }
  487. } else {
  488. let status = cache[ID2];
  489. uid++;
  490. createStatus(status, cur);
  491. }
  492. }
  493. if (isDev()) {
  494. console.log("cache num :", uid, ",tot:", A.length);
  495. }
  496. getProcess();
  497. Cache$2.set(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_ac_key__"], cache);
  498. let other = Array.from(document.querySelectorAll(`${linkCssSelector_pre()} p>a`)).filter((item) => item && item instanceof HTMLAnchorElement && isBilibili(item.href));
  499. for (let i = 0; i < other.length; i++) {
  500. createStatus("null", other[i]);
  501. }
  502. }
  503. const submitProblems = (url = window.location.href, timeout = 500) => {
  504. const ID2 = getId(url);
  505. if (!ID2) {
  506. return;
  507. }
  508. setTimeout(() => {
  509. const cache = getLocalProblemStatus();
  510. if (isDev()) {
  511. console.log("ID:", ID2, "query status: ", cache[ID2]);
  512. }
  513. queryStatus(ID2, cache, void 0, true);
  514. }, timeout);
  515. };
  516. const watchSaveStatus = (ID2, status) => {
  517. const cache = getLocalProblemStatus();
  518. if (cache[ID2] != "ac") {
  519. cache[ID2] = status;
  520. Cache$2.set(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_ac_key__"], cache);
  521. window.localStorage.setItem(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_status_update__"], JSON.stringify({
  522. "id": ID2,
  523. "status": status
  524. }));
  525. }
  526. };
  527. const watchLinkStatusUpdate = (e) => {
  528. var _a;
  529. if (e.key != __0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_status_update__"]) {
  530. return;
  531. }
  532. let { id, status } = JSON.parse(e.newValue);
  533. if (!id || !status) {
  534. return;
  535. }
  536. let thisLink = `${CUR_URL}/problems/${id}`;
  537. if (isDev()) {
  538. console.log("update", thisLink, "status", status);
  539. }
  540. let link = document.querySelector(`${linkCssSelector}[href^="${CUR_URL}/problems/${id}"]`);
  541. if (!link || !(link == null ? void 0 : link.parentElement)) {
  542. let doms = loadProblems();
  543. for (let i = 0; i < doms.length; i++) {
  544. if (!doms[i] || !((_a = doms[i]) == null ? void 0 : _a.parentElement)) {
  545. continue;
  546. }
  547. if (doms[i].href.indexOf(thisLink) != -1) {
  548. link = doms[i];
  549. break;
  550. }
  551. }
  552. }
  553. createStatus(status, link);
  554. };
  555. function getAcCountKey(k) {
  556. if (!k) return "";
  557. return `0x3f_ac_key_${k}`;
  558. }
  559. function deleteAllACCountKeys() {
  560. let urls = initUrls();
  561. let keys = [];
  562. for (let urlInfo of urls) {
  563. let key = getAcCountKey(urlInfo.link);
  564. Cache$2.remove(key);
  565. keys.push(key);
  566. }
  567. Cache$2.remove(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_ac_key__"]);
  568. return keys;
  569. }
  570. async function getProcess() {
  571. var _a;
  572. loadProblems();
  573. const cache = getLocalProblemStatus();
  574. const config = initObj();
  575. const response = await githubProblem(true);
  576. const mapInfo = response[1];
  577. let cnt = 0;
  578. let tot = 0;
  579. for (let i = 0; i < A.length; i++) {
  580. let ID2 = getId(A[i].href);
  581. if (!(config == null ? void 0 : config.visiableMember) && ((_a = mapInfo.get(ID2)) == null ? void 0 : _a.member)) {
  582. continue;
  583. }
  584. if (ID2 && cache[ID2] == STATUS["AC"]) {
  585. cnt++;
  586. }
  587. tot++;
  588. }
  589. let url = window.location.href;
  590. if (A.length > 0 && getAcCountKey(url)) {
  591. Cache$2.set(getAcCountKey(url), { "tot": tot, "ac": cnt });
  592. }
  593. return [cnt, tot];
  594. }
  595. function getLocalProblemStatus() {
  596. return Cache$2.get(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_ac_key__"], true, Object.name);
  597. }
  598. function getRandomInfo(array) {
  599. if (!Array.isArray(array)) return void 0;
  600. return array[Math.floor(Math.random() * array.length)];
  601. }
  602. function isEnglish() {
  603. return Cache$2.get(__0X3F_PROBLEM_KEYS__$1["__0x3f_problme_support_type__"], Boolean.name) == true;
  604. }
  605. function changeEnglishType() {
  606. Cache$2.set(__0X3F_PROBLEM_KEYS__$1["__0x3f_problme_support_type__"], !isEnglish());
  607. if (Cache$2.get(__0X3F_PROBLEM_KEYS__$1["__0x3f_problme_support_type_tips__"], String.name) != "NO") {
  608. Cache$2.set(__0X3F_PROBLEM_KEYS__$1["__0x3f_problme_support_type_tips__"], "OK");
  609. }
  610. window.location.reload();
  611. }
  612. function installEnglishLinkChangeCommand() {
  613. if (!isLeetCodeCircleUrl() || isEnglishENV()) {
  614. return;
  615. }
  616. _GM_registerMenuCommand(`题目链接切换到${isEnglish() ? "国服🎈" : "美服🌎"}`, () => {
  617. changeEnglishType();
  618. }, { title: "将题单链接替换为国服或者替换为美服" });
  619. }
  620. async function githubProblem(not_filter_member = true) {
  621. let allProbmems;
  622. if (!Array.isArray(allProbmems) || allProbmems.length == 0) {
  623. let response = await getProblemsJSON();
  624. if (Array.isArray(response)) {
  625. allProbmems = [...response];
  626. Cache$2.set(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_all_problems__"], [...response]);
  627. }
  628. } else {
  629. allProbmems = Cache$2.get(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_all_problems__"], true, Array.name);
  630. }
  631. if (!Array.isArray(allProbmems)) {
  632. ElementPlus.ElMessage({
  633. type: "error",
  634. message: "随机题目失败获取不到任何信息 !请如果出现这种情况,请前往 https://github.com/wuxin0011/tampermonkey-script/issues 反馈",
  635. duration: 6e3
  636. });
  637. return;
  638. }
  639. let config = initObj();
  640. let urlsData = initUrls();
  641. let set = /* @__PURE__ */ new Set();
  642. for (let info of urlsData) {
  643. if (info.link && info.select) {
  644. set.add(info.link);
  645. }
  646. }
  647. let acMap = Cache$2.get(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_ac_key__"], true, Object.name);
  648. if (isDev()) {
  649. console.log("config and set", config, set);
  650. console.log("acMap", acMap);
  651. }
  652. let infos = [];
  653. let mapInfo = /* @__PURE__ */ new Map();
  654. let totInfo = [];
  655. for (let info of allProbmems) {
  656. if (!(info == null ? void 0 : info.problemUrl) || !set.has(info == null ? void 0 : info.problemUrl) || !Array.isArray(info.problems) || info.problems.length == 0) {
  657. continue;
  658. }
  659. let cur_infos = [];
  660. for (let i = 0; Array.isArray(info.problems) && i < info.problems.length; i++) {
  661. try {
  662. let { title, url, member, score, titleSlug } = info.problems[i];
  663. if (!url || !title) continue;
  664. if (!(config == null ? void 0 : config.visiableMember) && member || !not_filter_member && member) {
  665. continue;
  666. }
  667. let new_obj = { title, url, member, score, titleSlug, "status": acMap[titleSlug] };
  668. infos.push(new_obj);
  669. cur_infos.push(new_obj);
  670. mapInfo.set(titleSlug, new_obj);
  671. } catch (e) {
  672. console.log("error", e);
  673. }
  674. }
  675. info.problems = cur_infos;
  676. totInfo.push(info);
  677. }
  678. return [infos, mapInfo, totInfo];
  679. }
  680. async function randomProblem() {
  681. let responseDatas = await githubProblem();
  682. let acMap = Cache$2.get(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_ac_key__"], true, Object.name);
  683. let config = initObj();
  684. let problems = responseDatas[0];
  685. let infos = [];
  686. for (let i = 0; Array.isArray(problems) && i < problems.length; i++) {
  687. try {
  688. let { title, url, member, score, titleSlug } = problems[i];
  689. if (!url || !title) continue;
  690. if (isDev()) {
  691. }
  692. if (!(config == null ? void 0 : config.showAcConfig) && acMap[titleSlug] == "ac") {
  693. continue;
  694. }
  695. if (!(config == null ? void 0 : config.visiableMember) && member) {
  696. continue;
  697. }
  698. if (score != 0 && (score < (config == null ? void 0 : config.min) || score > (config == null ? void 0 : config.max))) {
  699. continue;
  700. }
  701. infos.push({ title, url, member, score, titleSlug, "status": acMap[titleSlug] });
  702. } catch (e) {
  703. console.log("error", e);
  704. }
  705. }
  706. let data = getRandomInfo(infos);
  707. if (data.url && isEnglish()) {
  708. data.url = data.url.replace(ZH_URL, EN_URL);
  709. }
  710. ElementPlus.ElMessage({
  711. dangerouslyUseHTMLString: !!(data && (data == null ? void 0 : data.url) && (data == null ? void 0 : data.title)),
  712. type: (data == null ? void 0 : data.url) && (data == null ? void 0 : data.title) ? "success" : "error",
  713. message: (data == null ? void 0 : data.url) && (data == null ? void 0 : data.title) ? `<div>随机题目☕:&nbsp;<a href="${data.url}" target="_blank" style="color:#5d99f2;">${data.title}</a> ${(data == null ? void 0 : data.score) && (data == null ? void 0 : data.score) > 0 ? `&nbsp;分值${data.score}` : ""}</div>` : `没有符合条件的题目,请重新配置条件!`,
  714. duration: 6e3
  715. });
  716. }
  717. function isEnglishENV() {
  718. return window.location.href.indexOf("https://leetcode.com") != -1;
  719. }
  720. const isHttp = (url) => /^https?:\/\/.*$/.test(url);
  721. const isLeetCodeCircleUrl = (url = window.location.href) => /^https?:\/\/leetcode\.(com|cn).*\/discuss\/.*/i.test(url);
  722. const isProblem = (url = window.location.href) => /^https?:\/\/leetcode\.(com|cn)\/problems\/.*/i.test(url);
  723. const isContest = (url = window.location.href) => /^https?:\/\/leetcode\.(com|cn)\/contest\/.*\/problems\/.*/.test(url);
  724. const isBilibili = (url = window.location.href) => /.*bilibili.*/.test(url);
  725. const isZH = (url = window.location.href) => /^https?:\/\/leetcode\.cn/.test(url);
  726. const sleep = async (time = 500) => new Promise((resolove) => setTimeout(resolove, time));
  727. const EN_URL = "https://leetcode.com";
  728. const ZH_URL = "https://leetcode.cn";
  729. const LC_COPY_HTML_PLUGIN = "https://greasyfork.org//zh-CN/scripts/491969-lc-to-markdown-txt-html";
  730. const EN_SOLUTION_DEMO = "https://leetcode.com/discuss/interview-question/6032972/leetcode";
  731. const CUR_URL = isEnglishENV() ? EN_URL : ZH_URL;
  732. const isDev = () => JSON.parse("false");
  733. async function GetHubJSONInfo(url) {
  734. return fetch(url, {
  735. method: "get",
  736. mode: "cors"
  737. }).then((res) => res.json());
  738. }
  739. async function getProblemsJSON() {
  740. return GetHubJSONInfo("https://raw.githubusercontent.com/wuxin0011/tampermonkey-script/main/0x3f-leetcode/0x3f.json");
  741. }
  742. const LEETCODE_PROBLEM_API = `${CUR_URL}/graphql/`;
  743. async function PostLeetCodeApi(data) {
  744. return fetch(LEETCODE_PROBLEM_API, {
  745. method: "POST",
  746. credentials: "include",
  747. headers: {
  748. "Content-Type": "application/json"
  749. },
  750. body: JSON.stringify(data)
  751. }).then((res) => res.json());
  752. }
  753. async function getProblemAcInfo(titleSlug) {
  754. return PostLeetCodeApi(postData(titleSlug));
  755. }
  756. const _export_sfc = (sfc, props) => {
  757. const target = sfc.__vccOpts || sfc;
  758. for (const [key, val] of props) {
  759. target[key] = val;
  760. }
  761. return target;
  762. };
  763. const _sfc_main$1 = {};
  764. const _withScopeId = (n) => (vue.pushScopeId("data-v-6b5a9c54"), n = n(), vue.popScopeId(), n);
  765. const _hoisted_1$1 = /* @__PURE__ */ vue.createStaticVNode('<h2 data-v-6b5a9c54> 🎈必读内容 </h2><ul data-v-6b5a9c54><li style="color:red !important;" data-v-6b5a9c54> 同步功能使用前请确保为登录状态 </li></ul><h2 data-v-6b5a9c54> ❓ 题单进度不一致 </h2><ul data-v-6b5a9c54><li data-v-6b5a9c54> 防止一次性访问题单太多,对服务器产生压力,所以采用单个题单访问然后保存状态 , 这样避免访问量问题 </li><li data-v-6b5a9c54> 默认情况下会缓存访问的题单情况,对于没有访问的题单,可以手动在对应题单中同步 </li><li data-v-6b5a9c54> 题目状态根据用户提交题目情况会实时更新,只会在提交访问一次 </li></ul><h2 data-v-6b5a9c54> ❓ 如何使用随机题目? </h2><ul data-v-6b5a9c54><li data-v-6b5a9c54> 这个可以根据自己要求,配置好之后,可以使用 <em data-v-6b5a9c54> ctrl + alt + j </em> 触发 </li><li data-v-6b5a9c54> 如果这个快捷键影响,可以在命令设置中关闭 </li></ul><h2 data-v-6b5a9c54> ❓ 如何使用美服 </h2>', 7);
  766. const _hoisted_8 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("h2", null, " 🔗 反馈更新 ", -1));
  767. function _sfc_render(_ctx, _cache) {
  768. const _component_el_link = vue.resolveComponent("el-link");
  769. return vue.openBlock(), vue.createElementBlock("div", null, [
  770. _hoisted_1$1,
  771. vue.createElementVNode("ul", null, [
  772. vue.createElementVNode("li", null, [
  773. vue.createTextVNode(" 处于网络安全策略,对于不同网站请求有 "),
  774. vue.createVNode(_component_el_link, {
  775. underline: false,
  776. href: "https://developer.mozilla.org/zh-CN/docs/Web/HTTP/CORS",
  777. type: "primary",
  778. target: "_blank"
  779. }, {
  780. default: vue.withCtx(() => [
  781. vue.createTextVNode("跨域机制保护")
  782. ]),
  783. _: 1
  784. }),
  785. vue.createTextVNode(" 美服和国服是两个不同网站,因此无法实现不同网站题单同步 。 ")
  786. ]),
  787. vue.createElementVNode("li", null, [
  788. vue.createTextVNode(" 如果想使用美服,请复制一份题单到美服中 "),
  789. vue.createVNode(_component_el_link, {
  790. underline: false,
  791. href: "https://greasyfork.org//zh-CN/scripts/491969-lc-to-markdown-txt-html",
  792. type: "primary",
  793. target: "_blank"
  794. }, {
  795. default: vue.withCtx(() => [
  796. vue.createTextVNode("lc-to-markdown-txt-html")
  797. ]),
  798. _: 1
  799. }),
  800. vue.createTextVNode(" 这个插件来复制题单 ")
  801. ]),
  802. vue.createElementVNode("li", null, [
  803. vue.createVNode(_component_el_link, {
  804. underline: false,
  805. href: "https://leetcode.com/discuss/interview-question/6032972/leetcode",
  806. type: "primary",
  807. target: "_blank"
  808. }, {
  809. default: vue.withCtx(() => [
  810. vue.createTextVNode("美服题单演示")
  811. ]),
  812. _: 1
  813. })
  814. ])
  815. ]),
  816. _hoisted_8,
  817. vue.createElementVNode("ul", null, [
  818. vue.createElementVNode("li", null, [
  819. vue.createTextVNode(" 你可以在 "),
  820. vue.createVNode(_component_el_link, {
  821. underline: false,
  822. href: "https://greasyfork.org//zh-CN/scripts/501134-0x3f-problem-solution/feedback",
  823. type: "success",
  824. target: "_blank"
  825. }, {
  826. default: vue.withCtx(() => [
  827. vue.createTextVNode("油猴")
  828. ]),
  829. _: 1
  830. }),
  831. vue.createTextVNode("   "),
  832. vue.createVNode(_component_el_link, {
  833. underline: false,
  834. href: "https://scriptcat.org/zh-CN/script-show-page/1967",
  835. type: "success",
  836. target: "_blank"
  837. }, {
  838. default: vue.withCtx(() => [
  839. vue.createTextVNode("脚本猫")
  840. ]),
  841. _: 1
  842. }),
  843. vue.createTextVNode(" 中更新或下载 ")
  844. ]),
  845. vue.createElementVNode("li", null, [
  846. vue.createVNode(_component_el_link, {
  847. underline: false,
  848. href: "https://greasyfork.org//zh-CN/scripts/501134-0x3f-problem-solution/feedback",
  849. type: "primary",
  850. target: "_blank"
  851. }, {
  852. default: vue.withCtx(() => [
  853. vue.createTextVNode("点击")
  854. ]),
  855. _: 1
  856. }),
  857. vue.createTextVNode("这里反馈 或者 "),
  858. vue.createVNode(_component_el_link, {
  859. target: "_blank",
  860. underline: false,
  861. href: "https://github.com/wuxin0011/tampermonkey-script/issues",
  862. type: "primary"
  863. }, {
  864. default: vue.withCtx(() => [
  865. vue.createTextVNode("issues")
  866. ]),
  867. _: 1
  868. })
  869. ])
  870. ])
  871. ]);
  872. }
  873. const Q1 = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__scopeId", "data-v-6b5a9c54"]]);
  874. function Message(title = "确认操作", callback = () => {
  875. }, canlcelCallback = () => {
  876. }) {
  877. ElementPlus.ElMessageBox.confirm(
  878. `${title} ?`,
  879. "警告",
  880. {
  881. confirmButtonText: "确认",
  882. cancelButtonText: "取消",
  883. type: "warning"
  884. }
  885. ).then(() => {
  886. callback();
  887. }).catch(() => {
  888. ElementPlus.ElMessage({
  889. type: "info",
  890. message: "已取消"
  891. });
  892. canlcelCallback();
  893. });
  894. }
  895. function tips_message() {
  896. if (isEnglish() && isZH() && Cache$2.get(__0X3F_PROBLEM_KEYS__$1["__0x3f_problme_support_type_tips__"]) == "OK") {
  897. ElementPlus.ElMessageBox.alert(
  898. `<div>
  899. <p>检查到当前环境为国服,如果需要同步功能需要切换到美服,或者复制一份题单到美服自己使用 否则仅保留替换链接功能,没有同步功能 </p>
  900. <ul>
  901. <li>你可以使用<a style="color:blue;" target="_blank" href="${LC_COPY_HTML_PLUGIN}">lc-to-markdown-txt-html</a> 来复制题单 </li>
  902. <li><a style="color:red;" target="_blank" href="${EN_SOLUTION_DEMO}">查看美服题单示例</a> </li>
  903. <ul>
  904. <div>`,
  905. "提示",
  906. {
  907. dangerouslyUseHTMLString: true,
  908. showCancelButton: true,
  909. cancelButtonText: "下次再说",
  910. confirmButtonText: "不再提示"
  911. }
  912. ).then((e) => {
  913. Cache$2.set(__0X3F_PROBLEM_KEYS__$1["__0x3f_problme_support_type_tips__"], "NO");
  914. }).catch((e) => {
  915. if (e == "cancel") {
  916. Cache$2.set(__0X3F_PROBLEM_KEYS__$1["__0x3f_problme_support_type_tips__"]) == "OK_1";
  917. ElementPlus.ElMessage.warning({
  918. message: "下次切换到美服环境提示"
  919. });
  920. }
  921. });
  922. }
  923. }
  924. function update_version() {
  925. GM_registerMenuCommand(`更新脚本📣`, () => {
  926. ElementPlus.ElMessageBox.alert(
  927. `<div>
  928. <p>📣 提示:最近油猴需要科学工具才能访问,如果你使用油猴,可以到脚本猫中找到源代码,复制覆盖当前脚本也能更新 </p>
  929. <br/>
  930. <p><a style="color:blue;" target="_blank" href="https://scriptcat.org/zh-CN/script-show-page/1967/"> 脚本猫🐱 </a></p>
  931. <p><a style="color:blue;" target="_blank" href="https://greasyfork.org//zh-CN/scripts/501134-0x3f-problem-solution"> 油猴🐒 </a>【需要科学工具访问】</p>
  932. <p><a style="color:blue;" target="_blank" href="https://gfork.dahi.icu/zh-CN/scripts/501134-0x3f-problem-solution"> 油猴镜像🐒 </a> 【不保证镜像存在】</p>
  933. <p><a style="color:blue;" target="_blank" href="https://github.com/wuxin0011/tampermonkey-script/blob/main/0x3f-leetcode/dist/0x3f-leetcode-problems.js"> github 源代码更新 </a> 【最直接方式】</p>
  934. <div>`,
  935. "更新☕",
  936. {
  937. dangerouslyUseHTMLString: true,
  938. showCancelButton: true,
  939. cancelButtonText: "取消",
  940. confirmButtonText: "确认"
  941. }
  942. );
  943. }, { title: "点击更新更新脚本" });
  944. }
  945. const _hoisted_1 = { class: "dialog-footer" };
  946. const _hoisted_2 = { class: "processs-flex" };
  947. const _hoisted_3 = { style: { "text-align": "center", "color": "#121212" } };
  948. const TARGET_URL = "https://leetcode.cn/u/endlesscheng/";
  949. const formLabelWidth = "44px";
  950. const _sfc_main = {
  951. __name: "App",
  952. setup(__props) {
  953. const fromData = vue.reactive(initObj());
  954. const tableButtonSize = vue.ref("default");
  955. let tableData = vue.reactive(initUrls());
  956. const keywords = vue.ref("");
  957. const dialogTableVisible = vue.ref(false);
  958. const showAddLocalButton = vue.computed(() => isLeetCodeCircleUrl());
  959. let urlsData = vue.computed(() => {
  960. let map = /* @__PURE__ */ new Map();
  961. let infos = tableData.filter((info2) => {
  962. if ((info2 == null ? void 0 : info2.title) && (info2 == null ? void 0 : info2.link) && !map.has(info2.link)) {
  963. map.set(info2.link, info2);
  964. return info2 && (info2.title && info2.title.indexOf(keywords.value) != -1 || info2.link && info2.link.indexOf(keywords.value) != -1);
  965. } else {
  966. return false;
  967. }
  968. });
  969. let tot = 0, ac = 0;
  970. for (let i = 0, c = info.length; i < infos.length; i++) {
  971. let info2 = infos[i];
  972. if (info2["ac"] && info2["tot"]) {
  973. tot += info2["tot"];
  974. ac += info2["ac"];
  975. }
  976. if (!info2["id"]) {
  977. info2["id"] = c + 1;
  978. c++;
  979. }
  980. }
  981. let type = isNaN(fromData.sortType) ? 0 : fromData.sortType;
  982. if (type == 0) {
  983. infos.sort((info1, info2) => info2.id - info1.id);
  984. } else if (type == 1) {
  985. infos.sort((info1, info2) => info2.tot - info1.tot);
  986. } else if (type == 2) {
  987. infos.sort((info1, info2) => info2.ac - info1.ac);
  988. } else if (type == 3) {
  989. infos.sort((info1, info2) => computeProcess(info2.ac, info2.tot) - computeProcess(info1.ac, info1.tot));
  990. }
  991. infos.unshift({ "title": "灵茶题单完成情况", "link": TARGET_URL, "tot": tot, "ac": ac, "id": 67108863 });
  992. return infos;
  993. });
  994. const rowIsDisabled = vue.computed(() => (info2) => asyncButtonLoad.value || info2 && info2.link == TARGET_URL);
  995. const isDisabbled = vue.computed(() => !!tableData.find((v) => (v == null ? void 0 : v.link) && (v == null ? void 0 : v.link.indexOf(window.location.href)) != -1));
  996. const dialogFormVisible = vue.ref(false);
  997. const computeProcess = (ac = 0, tot = 0) => {
  998. if (isNaN(ac) || isNaN(tot) || tot === 0) return 0;
  999. let p = 0;
  1000. if (tot == ac) {
  1001. return 100;
  1002. }
  1003. const s = String(ac / tot);
  1004. try {
  1005. let x1 = s.split(".")[1] || "";
  1006. x1 = x1.padEnd(3, "0").substring(0, 3);
  1007. p = Math.min(100, Number(x1) / 10);
  1008. } catch (e) {
  1009. console.log("calc error", e.message, s == void 0, ac, tot);
  1010. p = (ac / tot).toFixed(3) * 100;
  1011. }
  1012. return isNaN(p) ? 0 : p;
  1013. };
  1014. const processColors = [
  1015. { color: "#f56c6c", percentage: 20 },
  1016. { color: "#1989fa", percentage: 40 },
  1017. { color: "#e6a23c", percentage: 60 },
  1018. { color: "#6f7ad3", percentage: 80 },
  1019. { color: "#67c23a", percentage: 100 }
  1020. ];
  1021. vue.watch(fromData, () => {
  1022. handlerProblem(vue.toRaw(Object.assign({}, fromData)));
  1023. });
  1024. const info = vue.reactive({
  1025. title: "",
  1026. link: "",
  1027. status: "add"
  1028. });
  1029. const addlocal = async () => {
  1030. if (!isDisabbled) {
  1031. return;
  1032. }
  1033. let [cur, tot] = await getProcess();
  1034. tableData.unshift({ title: document.title, link: window.location.href, "ac": cur, "tot": tot, "id": tableData.length + 10 });
  1035. };
  1036. const updateIndex = vue.ref(-1);
  1037. const handlerProblems = (status, updateInfo = { title: "", link: "", id: 0 }, index = -1) => {
  1038. dialogFormVisible.value = true;
  1039. info.status = status;
  1040. updateIndex.value = updateInfo.id;
  1041. Object.assign(info, updateInfo);
  1042. };
  1043. const handlerMessage = (u, title, link) => {
  1044. const a = u ? "添加" : "修改";
  1045. const error = !(!!title && isHttp(link));
  1046. if (error) {
  1047. ElementPlus.ElMessage.error(`${a} 失败 请保证标题或者链接有效 `);
  1048. } else {
  1049. ElementPlus.ElMessage.success(`${a} 成功 `);
  1050. }
  1051. return !error;
  1052. };
  1053. const addOrUpdate = () => {
  1054. if (!handlerMessage(info.status == "add", info.title, info.link)) {
  1055. return;
  1056. }
  1057. if (info.status == "add") {
  1058. tableData.unshift({ title: info.title, link: info.link, "ac": 0, "tot": 0, "id": tableData.length + 10 });
  1059. } else {
  1060. let id = updateIndex.value;
  1061. for (let i = 0; i < tableData.length; i++) {
  1062. if (tableData[i] && tableData[i].id && tableData[i]["id"] == id) {
  1063. tableData[i]["title"] = info.title;
  1064. tableData[i]["link"] = info.link;
  1065. break;
  1066. }
  1067. }
  1068. }
  1069. dialogFormVisible.value = false;
  1070. };
  1071. const deleteProblems = (id) => {
  1072. for (let i = 0; i < tableData.length; i++) {
  1073. if (tableData[i] && tableData[i].id && tableData[i]["id"] == id) {
  1074. delete tableData[i];
  1075. break;
  1076. }
  1077. }
  1078. Cache$2.set(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_urls__"], vue.toRaw(tableData));
  1079. };
  1080. const handlerDefault = () => {
  1081. Message("确认使用默认题单,将会重置题单", () => {
  1082. for (let i = 0; i < tableData.length; i++) {
  1083. delete tableData[i];
  1084. }
  1085. let infos = computeAcInfo(defaultUrls);
  1086. for (let item of infos) {
  1087. tableData.unshift(item);
  1088. }
  1089. ElementPlus.ElMessage({
  1090. type: "success",
  1091. message: "重置成功"
  1092. });
  1093. });
  1094. };
  1095. window.addEventListener("beforeunload", () => {
  1096. Cache$2.set(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_urls__"], vue.toRaw(tableData).filter((u) => u != null && u != void 0));
  1097. Cache$2.set(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_update__"], true);
  1098. Cache$2.set(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_add_cur__"], false);
  1099. });
  1100. vue.onMounted(async () => {
  1101. if (support_plugins()) {
  1102. let times = 30;
  1103. let loadTimeId = setInterval(() => {
  1104. let a = queryProblem();
  1105. times--;
  1106. if (Array.isArray(a) && a.length > 0) {
  1107. handlerProblem(vue.toRaw(Object.assign({}, fromData)));
  1108. addProcess();
  1109. window.clearInterval(loadTimeId);
  1110. }
  1111. if (times == 0) {
  1112. window.clearInterval(loadTimeId);
  1113. }
  1114. }, 200);
  1115. }
  1116. window.addEventListener("storage", (e) => {
  1117. watchLinkStatusUpdate(e);
  1118. });
  1119. });
  1120. _GM_registerMenuCommand(`题单配置信息🛠`, () => {
  1121. dialogTableVisible.value = !dialogTableVisible.value;
  1122. }, { title: "AC标记安装位置,默认左侧,刷新生效" });
  1123. const selectHandlerChange = (row) => {
  1124. let infos = [];
  1125. for (let i = 0; i < urlsData.value.length; i++) {
  1126. if (urlsData.value[i]["link"] == TARGET_URL) continue;
  1127. infos.push(vue.toRaw(Object.assign({}, urlsData.value[i])));
  1128. }
  1129. for (let i = 0; i < tableData.length; i++) {
  1130. if (row.id == tableData[i].id) {
  1131. tableData[i].select = row.select;
  1132. break;
  1133. }
  1134. }
  1135. Cache$2.set(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_urls__"], infos);
  1136. };
  1137. const asyncButtonLoad = vue.ref(false);
  1138. const asyncButtonLoadBreak = vue.ref(false);
  1139. const showProcess = vue.ref(false);
  1140. const allProblemNum = vue.ref(0);
  1141. const asyncProblemNum = vue.ref(0);
  1142. const asyncVisableDialog = vue.ref(false);
  1143. const showProblemsProcessInfo = vue.reactive({
  1144. title: "",
  1145. link: "",
  1146. cnt: "",
  1147. ac: "",
  1148. id: "",
  1149. select: true
  1150. });
  1151. const showProblemsInfo = (info2 = {}) => {
  1152. asyncVisableDialog.value = !asyncVisableDialog.value;
  1153. Object.assign(showProblemsProcessInfo, info2);
  1154. };
  1155. const loadProcess = vue.computed(() => computeProcess(asyncProblemNum.value, allProblemNum.value));
  1156. const asyncProblemStatus = async (row = {}) => {
  1157. if (!(row == null ? void 0 : row.link)) return;
  1158. let callback = async () => {
  1159. var _a, _b, _c, _d, _e;
  1160. let rowData = void 0;
  1161. let asyncAll = (row == null ? void 0 : row.link) == TARGET_URL;
  1162. let cache = Cache$2.get(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_ac_key__"], true, Object.name);
  1163. if (isDev()) {
  1164. console.log("async ac cache:", cache);
  1165. }
  1166. let map = /* @__PURE__ */ new Map();
  1167. try {
  1168. for (let info2 of tableData) {
  1169. if ((info2 == null ? void 0 : info2.link) && (info2 == null ? void 0 : info2.title) && (info2 == null ? void 0 : info2.id)) {
  1170. if (rowData == void 0 && (info2 == null ? void 0 : info2.id) == row.id) {
  1171. rowData = info2;
  1172. }
  1173. if (!map.has(info2.link)) {
  1174. map.set(info2.link, info2);
  1175. }
  1176. }
  1177. }
  1178. if (rowData) {
  1179. rowData.loading = true;
  1180. }
  1181. asyncButtonLoad.value = true;
  1182. asyncButtonLoadBreak.value = false;
  1183. allProblemNum.value = 0;
  1184. asyncProblemNum.value = 0;
  1185. showProcess.value = true;
  1186. await sleep(500);
  1187. let githubInfo = await githubProblem(fromData.visiableMember);
  1188. let jsonInfo = githubInfo[2];
  1189. let datas = [];
  1190. for (let i = 0; Array.isArray(jsonInfo) && i < jsonInfo.length; i++) {
  1191. let key = `${(_a = jsonInfo[i]) == null ? void 0 : _a.problemUrl}`;
  1192. let origin = map.get(key);
  1193. if (!origin) {
  1194. continue;
  1195. }
  1196. if (asyncAll) {
  1197. for (let p of jsonInfo[i].problems) {
  1198. datas.push(Object.assign({ "origin": jsonInfo[i].problemUrl }, p));
  1199. }
  1200. origin.tot = Math.max(jsonInfo[i].problems.length, 0);
  1201. origin.ac = 0;
  1202. } else if (jsonInfo[i].problemUrl == row.link) {
  1203. for (let p of jsonInfo[i].problems) {
  1204. datas.push(Object.assign({ "origin": jsonInfo[i].problemUrl }, p));
  1205. }
  1206. origin.tot = Math.max(jsonInfo[i].problems.length, 0);
  1207. origin.ac = 0;
  1208. break;
  1209. }
  1210. }
  1211. if (Array.isArray(datas) && datas.length > 0) {
  1212. allProblemNum.value = datas.length;
  1213. asyncProblemNum.value = 0;
  1214. let pre = 0;
  1215. for (let i = 0; i < datas.length; i++) {
  1216. let info2 = datas[i];
  1217. try {
  1218. if (asyncButtonLoadBreak.value) {
  1219. break;
  1220. }
  1221. await sleep(80);
  1222. let ID2 = info2.titleSlug;
  1223. let key = `${info2.origin}`;
  1224. let origin = map.get(key);
  1225. if (cache[ID2] != "ac") {
  1226. let response = await getProblemAcInfo(ID2);
  1227. const status = (_c = (_b = response == null ? void 0 : response.data) == null ? void 0 : _b.question) == null ? void 0 : _c.status;
  1228. cache[ID2] = status == null ? "null" : status;
  1229. }
  1230. if (origin) {
  1231. if (cache[ID2] == "ac") {
  1232. origin.ac = origin.ac + 1;
  1233. }
  1234. }
  1235. asyncProblemNum.value += 1;
  1236. if (loadProcess.value < pre && isDev()) {
  1237. console.warn("calc result is error");
  1238. }
  1239. pre = loadProcess.value;
  1240. } catch (e) {
  1241. if (isDev()) {
  1242. console.log("process error", e.message, "asyncProblemNum.value", asyncProblemNum.value, "all", allProblemNum.value);
  1243. }
  1244. }
  1245. if (i % 100 == 0) {
  1246. Cache$2.set(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_ac_key__"], Object.assign({}, cache));
  1247. }
  1248. }
  1249. }
  1250. } catch (e) {
  1251. console.log("error", e);
  1252. } finally {
  1253. if (rowData) {
  1254. rowData.loading = false;
  1255. }
  1256. asyncButtonLoad.value = false;
  1257. Cache$2.set(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_urls__"], vue.toRaw(tableData));
  1258. Cache$2.set(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_ac_key__"], Object.assign({}, cache));
  1259. if (isDev()) {
  1260. console.log("同步完成🥰", asyncProblemNum.value, allProblemNum.value, loadProcess.value);
  1261. }
  1262. await sleep(500);
  1263. ElementPlus.ElMessage({
  1264. type: allProblemNum.value == asyncProblemNum.value ? "success" : asyncButtonLoadBreak.value ? "error" : "warning",
  1265. message: allProblemNum.value == asyncProblemNum.value ? `同步完成🥰` : asyncButtonLoadBreak.value ? `同步中断 ${loadProcess.value}% ` : `同步率 ${loadProcess.value}% `,
  1266. duration: 3e3
  1267. });
  1268. await sleep(6e3);
  1269. allProblemNum.value = 0;
  1270. asyncProblemNum.value = 0;
  1271. showProcess.value = false;
  1272. asyncButtonLoadBreak.value = false;
  1273. for (let i = 0; i < tableData.length; i++) {
  1274. if (getAcCountKey((_d = tableData[i]) == null ? void 0 : _d.link)) {
  1275. Cache$2.set(getAcCountKey(tableData[i].link), { "tot": tableData[i].tot, "ac": tableData[i].ac });
  1276. }
  1277. if ((_e = tableData[i]) == null ? void 0 : _e.loading) {
  1278. tableData[i].loading = false;
  1279. }
  1280. }
  1281. }
  1282. };
  1283. if (row.link == TARGET_URL) {
  1284. Message("该操作将同步所有题单,耗时可能较长 确认操作?", callback);
  1285. } else {
  1286. callback();
  1287. }
  1288. };
  1289. const q1 = vue.ref(false);
  1290. vue.ref(false);
  1291. return (_ctx, _cache) => {
  1292. const _component_el_dialog = vue.resolveComponent("el-dialog");
  1293. const _component_el_input = vue.resolveComponent("el-input");
  1294. const _component_el_form_item = vue.resolveComponent("el-form-item");
  1295. const _component_el_form = vue.resolveComponent("el-form");
  1296. const _component_el_button = vue.resolveComponent("el-button");
  1297. const _component_el_progress = vue.resolveComponent("el-progress");
  1298. const _component_el_col = vue.resolveComponent("el-col");
  1299. const _component_el_option = vue.resolveComponent("el-option");
  1300. const _component_el_select = vue.resolveComponent("el-select");
  1301. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  1302. const _component_el_row = vue.resolveComponent("el-row");
  1303. const _component_el_table_column = vue.resolveComponent("el-table-column");
  1304. const _component_el_link = vue.resolveComponent("el-link");
  1305. const _component_el_switch = vue.resolveComponent("el-switch");
  1306. const _component_el_table = vue.resolveComponent("el-table");
  1307. return vue.openBlock(), vue.createElementBlock("div", null, [
  1308. vue.createVNode(_component_el_dialog, {
  1309. modelValue: q1.value,
  1310. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => q1.value = $event)
  1311. }, {
  1312. default: vue.withCtx(() => [
  1313. vue.createVNode(Q1)
  1314. ]),
  1315. _: 1
  1316. }, 8, ["modelValue"]),
  1317. vue.createVNode(_component_el_dialog, {
  1318. modelValue: dialogFormVisible.value,
  1319. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => dialogFormVisible.value = $event),
  1320. title: `${info.status == "add" ? "添加" : "编辑"}`,
  1321. width: "400"
  1322. }, {
  1323. footer: vue.withCtx(() => [
  1324. vue.createElementVNode("div", _hoisted_1, [
  1325. vue.createVNode(_component_el_button, {
  1326. onClick: _cache[3] || (_cache[3] = ($event) => dialogFormVisible.value = false)
  1327. }, {
  1328. default: vue.withCtx(() => [
  1329. vue.createTextVNode("取消")
  1330. ]),
  1331. _: 1
  1332. }),
  1333. vue.createVNode(_component_el_button, { onClick: addOrUpdate }, {
  1334. default: vue.withCtx(() => [
  1335. vue.createTextVNode(" 确认 ")
  1336. ]),
  1337. _: 1
  1338. })
  1339. ])
  1340. ]),
  1341. default: vue.withCtx(() => [
  1342. vue.createVNode(_component_el_form, null, {
  1343. default: vue.withCtx(() => [
  1344. vue.createVNode(_component_el_form_item, {
  1345. label: "标题",
  1346. "label-width": formLabelWidth
  1347. }, {
  1348. default: vue.withCtx(() => [
  1349. vue.createVNode(_component_el_input, {
  1350. modelValue: info.title,
  1351. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => info.title = $event),
  1352. autocomplete: "off"
  1353. }, null, 8, ["modelValue"])
  1354. ]),
  1355. _: 1
  1356. }),
  1357. vue.createVNode(_component_el_form_item, {
  1358. label: "链接",
  1359. "label-width": formLabelWidth
  1360. }, {
  1361. default: vue.withCtx(() => [
  1362. vue.createVNode(_component_el_input, {
  1363. modelValue: info.link,
  1364. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => info.link = $event),
  1365. autocomplete: "off"
  1366. }, null, 8, ["modelValue"])
  1367. ]),
  1368. _: 1
  1369. })
  1370. ]),
  1371. _: 1
  1372. })
  1373. ]),
  1374. _: 1
  1375. }, 8, ["modelValue", "title"]),
  1376. vue.createVNode(_component_el_dialog, {
  1377. modelValue: dialogTableVisible.value,
  1378. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => dialogTableVisible.value = $event),
  1379. title: asyncButtonLoadBreak.value ? `同步已中断 ${asyncProblemNum.value}/${allProblemNum.value}` : showProcess.value ? loadProcess.value < 100 ? `同步中...${asyncProblemNum.value}/${allProblemNum.value}` : "统计完成" : "题单信息",
  1380. width: "60%"
  1381. }, {
  1382. default: vue.withCtx(() => [
  1383. showProcess.value ? (vue.openBlock(), vue.createBlock(_component_el_progress, {
  1384. key: 0,
  1385. color: processColors,
  1386. percentage: loadProcess.value,
  1387. "stroke-width": 15,
  1388. striped: "",
  1389. "striped-flow": "",
  1390. style: { "margin-bottom": "20px" },
  1391. status: `${loadProcess.value == 100 ? "success" : ""}`
  1392. }, null, 8, ["percentage", "status"])) : vue.createCommentVNode("", true),
  1393. vue.createVNode(_component_el_row, { gutter: 10 }, {
  1394. default: vue.withCtx(() => [
  1395. vue.createVNode(_component_el_col, { span: 4 }, {
  1396. default: vue.withCtx(() => [
  1397. vue.createVNode(_component_el_input, {
  1398. modelValue: keywords.value,
  1399. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => keywords.value = $event),
  1400. placeholder: "请输入关键词过滤",
  1401. clearable: ""
  1402. }, null, 8, ["modelValue"])
  1403. ]),
  1404. _: 1
  1405. }),
  1406. vue.createVNode(_component_el_col, { span: 20 }, {
  1407. default: vue.withCtx(() => [
  1408. showAddLocalButton.value ? (vue.openBlock(), vue.createBlock(_component_el_button, {
  1409. key: 0,
  1410. plain: "",
  1411. onClick: addlocal,
  1412. disabled: isDisabbled.value,
  1413. size: tableButtonSize.value
  1414. }, {
  1415. default: vue.withCtx(() => [
  1416. vue.createTextVNode(" 添加本页 ")
  1417. ]),
  1418. _: 1
  1419. }, 8, ["disabled", "size"])) : vue.createCommentVNode("", true),
  1420. showAddLocalButton.value ? (vue.openBlock(), vue.createBlock(_component_el_button, {
  1421. key: 1,
  1422. plain: "",
  1423. onClick: _cache[6] || (_cache[6] = ($event) => handlerProblems("add")),
  1424. size: tableButtonSize.value
  1425. }, {
  1426. default: vue.withCtx(() => [
  1427. vue.createTextVNode(" 自定义 ")
  1428. ]),
  1429. _: 1
  1430. }, 8, ["size"])) : vue.createCommentVNode("", true),
  1431. vue.createVNode(_component_el_select, {
  1432. modelValue: fromData.sortType,
  1433. "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => fromData.sortType = $event),
  1434. style: { "margin": "0 5px", "width": "100px" },
  1435. disabled: asyncButtonLoad.value
  1436. }, {
  1437. default: vue.withCtx(() => [
  1438. vue.createVNode(_component_el_option, {
  1439. label: "默认排序",
  1440. value: 0
  1441. }, {
  1442. default: vue.withCtx(() => [
  1443. vue.createTextVNode("默认排序")
  1444. ]),
  1445. _: 1
  1446. }),
  1447. vue.createVNode(_component_el_option, {
  1448. label: "题目数量",
  1449. value: 1
  1450. }, {
  1451. default: vue.withCtx(() => [
  1452. vue.createTextVNode("题目数量")
  1453. ]),
  1454. _: 1
  1455. }),
  1456. vue.createVNode(_component_el_option, {
  1457. label: "AC数量",
  1458. value: 2
  1459. }, {
  1460. default: vue.withCtx(() => [
  1461. vue.createTextVNode("AC数量")
  1462. ]),
  1463. _: 1
  1464. }),
  1465. vue.createVNode(_component_el_option, {
  1466. label: "完成度",
  1467. value: 3
  1468. }, {
  1469. default: vue.withCtx(() => [
  1470. vue.createTextVNode("完成度")
  1471. ]),
  1472. _: 1
  1473. })
  1474. ]),
  1475. _: 1
  1476. }, 8, ["modelValue", "disabled"]),
  1477. vue.createVNode(_component_el_tooltip, { content: "同步所有题单" }, {
  1478. default: vue.withCtx(() => [
  1479. vue.createVNode(_component_el_button, {
  1480. type: asyncButtonLoad.value ? "success" : "danger",
  1481. onClick: _cache[8] || (_cache[8] = ($event) => asyncProblemStatus({ "link": "https://leetcode.cn/u/endlesscheng/" })),
  1482. size: tableButtonSize.value,
  1483. loading: asyncButtonLoad.value
  1484. }, {
  1485. default: vue.withCtx(() => [
  1486. vue.createTextVNode(vue.toDisplayString(asyncButtonLoad.value ? "同步中" : "同步题单"), 1)
  1487. ]),
  1488. _: 1
  1489. }, 8, ["type", "size", "loading"])
  1490. ]),
  1491. _: 1
  1492. }),
  1493. asyncButtonLoad.value ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  1494. key: 2,
  1495. content: "点击中断同步"
  1496. }, {
  1497. default: vue.withCtx(() => [
  1498. asyncButtonLoad.value ? (vue.openBlock(), vue.createBlock(_component_el_button, {
  1499. key: 0,
  1500. type: "warning",
  1501. text: "",
  1502. onClick: _cache[9] || (_cache[9] = ($event) => asyncButtonLoadBreak.value = !asyncButtonLoadBreak.value),
  1503. size: tableButtonSize.value
  1504. }, {
  1505. default: vue.withCtx(() => [
  1506. vue.createTextVNode(" 中断同步 ")
  1507. ]),
  1508. _: 1
  1509. }, 8, ["size"])) : vue.createCommentVNode("", true)
  1510. ]),
  1511. _: 1
  1512. })) : vue.createCommentVNode("", true),
  1513. vue.createVNode(_component_el_tooltip, { content: "随机一道灵茶题单中题目,快捷键 Ctrl + Alt + J 可以触发" }, {
  1514. default: vue.withCtx(() => [
  1515. vue.createVNode(_component_el_button, {
  1516. type: "primary",
  1517. text: "",
  1518. onClick: vue.unref(randomProblem),
  1519. size: tableButtonSize.value
  1520. }, {
  1521. default: vue.withCtx(() => [
  1522. vue.createTextVNode(" 随机题目 ")
  1523. ]),
  1524. _: 1
  1525. }, 8, ["onClick", "size"])
  1526. ]),
  1527. _: 1
  1528. })
  1529. ]),
  1530. _: 1
  1531. })
  1532. ]),
  1533. _: 1
  1534. }),
  1535. vue.createVNode(_component_el_table, {
  1536. data: vue.unref(urlsData),
  1537. height: "300",
  1538. style: { "width": "100%", "margin-top": "10px" }
  1539. }, {
  1540. default: vue.withCtx(() => [
  1541. vue.createVNode(_component_el_table_column, { type: "index" }),
  1542. vue.createVNode(_component_el_table_column, {
  1543. label: "标题",
  1544. width: "auto",
  1545. align: "center"
  1546. }, {
  1547. default: vue.withCtx((scope) => [
  1548. vue.createVNode(_component_el_link, {
  1549. href: scope.row.link,
  1550. target: "_blank",
  1551. type: "default"
  1552. }, {
  1553. default: vue.withCtx(() => [
  1554. vue.createTextVNode(vue.toDisplayString(scope.row.title), 1)
  1555. ]),
  1556. _: 2
  1557. }, 1032, ["href"])
  1558. ]),
  1559. _: 1
  1560. }),
  1561. vue.createVNode(_component_el_table_column, {
  1562. label: "随机",
  1563. width: "70",
  1564. align: "center"
  1565. }, {
  1566. default: vue.withCtx((scope) => [
  1567. vue.createVNode(_component_el_switch, {
  1568. modelValue: scope.row.select,
  1569. "onUpdate:modelValue": ($event) => scope.row.select = $event,
  1570. onChange: ($event) => selectHandlerChange(scope.row),
  1571. disabled: rowIsDisabled.value(scope.row),
  1572. size: "small"
  1573. }, null, 8, ["modelValue", "onUpdate:modelValue", "onChange", "disabled"])
  1574. ]),
  1575. _: 1
  1576. }),
  1577. vue.createVNode(_component_el_table_column, {
  1578. label: "AC",
  1579. width: "70",
  1580. align: "center"
  1581. }, {
  1582. default: vue.withCtx((scope) => [
  1583. vue.createVNode(_component_el_link, {
  1584. type: "success",
  1585. underline: false,
  1586. onClick: ($event) => showProblemsInfo(scope.row)
  1587. }, {
  1588. default: vue.withCtx(() => [
  1589. vue.createTextVNode(vue.toDisplayString(isNaN(scope.row.ac) ? 0 : scope.row.ac), 1)
  1590. ]),
  1591. _: 2
  1592. }, 1032, ["onClick"])
  1593. ]),
  1594. _: 1
  1595. }),
  1596. vue.createVNode(_component_el_table_column, {
  1597. label: "Total",
  1598. width: "70",
  1599. align: "center"
  1600. }, {
  1601. default: vue.withCtx((scope) => [
  1602. vue.createVNode(_component_el_link, {
  1603. type: "primary",
  1604. underline: false,
  1605. onClick: ($event) => showProblemsInfo(scope.row)
  1606. }, {
  1607. default: vue.withCtx(() => [
  1608. vue.createTextVNode(vue.toDisplayString(isNaN(scope.row.tot) ? 0 : scope.row.tot), 1)
  1609. ]),
  1610. _: 2
  1611. }, 1032, ["onClick"])
  1612. ]),
  1613. _: 1
  1614. }),
  1615. vue.createVNode(_component_el_table_column, {
  1616. label: "进度",
  1617. width: "70",
  1618. align: "center"
  1619. }, {
  1620. default: vue.withCtx((scope) => [
  1621. vue.createVNode(_component_el_link, {
  1622. onClick: ($event) => showProblemsInfo(scope.row),
  1623. type: "warning",
  1624. underline: false
  1625. }, {
  1626. default: vue.withCtx(() => {
  1627. var _a, _b, _c;
  1628. return [
  1629. vue.createTextVNode(vue.toDisplayString(((_a = scope == null ? void 0 : scope.row) == null ? void 0 : _a.tot) == 0 ? 0 : `${computeProcess((_b = scope == null ? void 0 : scope.row) == null ? void 0 : _b.ac, (_c = scope == null ? void 0 : scope.row) == null ? void 0 : _c.tot)}%`), 1)
  1630. ];
  1631. }),
  1632. _: 2
  1633. }, 1032, ["onClick"])
  1634. ]),
  1635. _: 1
  1636. }),
  1637. vue.createVNode(_component_el_table_column, {
  1638. label: "操作",
  1639. width: "200px",
  1640. align: "center"
  1641. }, {
  1642. default: vue.withCtx((scope) => [
  1643. vue.createVNode(_component_el_button, {
  1644. loading: scope.row.loading,
  1645. onClick: ($event) => asyncProblemStatus(scope.row),
  1646. size: "small",
  1647. type: "success",
  1648. disabled: rowIsDisabled.value(scope.row),
  1649. link: ""
  1650. }, {
  1651. default: vue.withCtx(() => [
  1652. vue.createTextVNode(vue.toDisplayString(scope.row.loading ? "" : "同步"), 1)
  1653. ]),
  1654. _: 2
  1655. }, 1032, ["loading", "onClick", "disabled"]),
  1656. vue.createVNode(_component_el_button, {
  1657. onClick: ($event) => handlerProblems("update", scope.row, scope.$index),
  1658. size: "small",
  1659. type: "primary",
  1660. disabled: rowIsDisabled.value(scope.row),
  1661. link: ""
  1662. }, {
  1663. default: vue.withCtx(() => [
  1664. vue.createTextVNode("编辑")
  1665. ]),
  1666. _: 2
  1667. }, 1032, ["onClick", "disabled"]),
  1668. vue.createVNode(_component_el_button, {
  1669. onClick: ($event) => deleteProblems(scope.row.id),
  1670. size: "small",
  1671. type: "danger",
  1672. link: "",
  1673. disabled: rowIsDisabled.value(scope.row)
  1674. }, {
  1675. default: vue.withCtx(() => [
  1676. vue.createTextVNode("删除")
  1677. ]),
  1678. _: 2
  1679. }, 1032, ["onClick", "disabled"])
  1680. ]),
  1681. _: 1
  1682. })
  1683. ]),
  1684. _: 1
  1685. }, 8, ["data"]),
  1686. vue.createVNode(_component_el_row, {
  1687. gutter: 10,
  1688. style: { "margin": "10px 0" }
  1689. }, {
  1690. default: vue.withCtx(() => [
  1691. vue.createVNode(_component_el_col, { span: 10 }, {
  1692. default: vue.withCtx(() => [
  1693. vue.createTextVNode(" 会员  "),
  1694. vue.createVNode(_component_el_tooltip, { content: "过滤会员题目,会员题不会出现在随机题目中和讨论区显示。另外会员题目将不参与进度统计,默认显示" }, {
  1695. default: vue.withCtx(() => [
  1696. vue.createVNode(_component_el_switch, {
  1697. modelValue: fromData.visiableMember,
  1698. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => fromData.visiableMember = $event)
  1699. }, null, 8, ["modelValue"])
  1700. ]),
  1701. _: 1
  1702. }),
  1703. showAddLocalButton.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  1704. vue.createTextVNode(" 隐藏AC  "),
  1705. vue.createVNode(_component_el_tooltip, { content: "是否在讨论区显示AC题目,默认显示 " }, {
  1706. default: vue.withCtx(() => [
  1707. vue.createVNode(_component_el_switch, {
  1708. modelValue: fromData.hiddenAc,
  1709. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => fromData.hiddenAc = $event)
  1710. }, null, 8, ["modelValue"])
  1711. ]),
  1712. _: 1
  1713. })
  1714. ], 64)) : vue.createCommentVNode("", true),
  1715. vue.createTextVNode(" 随机ac  "),
  1716. vue.createVNode(_component_el_tooltip, { content: "随机题目配置: 过滤AC的题目,AC题目出现在随机题目中,默认不过滤" }, {
  1717. default: vue.withCtx(() => [
  1718. vue.createVNode(_component_el_switch, {
  1719. modelValue: fromData.showAcConfig,
  1720. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => fromData.showAcConfig = $event)
  1721. }, null, 8, ["modelValue"])
  1722. ]),
  1723. _: 1
  1724. })
  1725. ]),
  1726. _: 1
  1727. }),
  1728. vue.createVNode(_component_el_col, { span: 8 }, {
  1729. default: vue.withCtx(() => [
  1730. vue.createTextVNode("   "),
  1731. vue.createVNode(_component_el_tooltip, { content: "随机题目和讨论区题目将会在这个区间(没有分数题目无法操作)" }, {
  1732. default: vue.withCtx(() => [
  1733. vue.createVNode(_component_el_link, {
  1734. underline: false,
  1735. type: "primary"
  1736. }, {
  1737. default: vue.withCtx(() => [
  1738. vue.createTextVNode("分数区间")
  1739. ]),
  1740. _: 1
  1741. })
  1742. ]),
  1743. _: 1
  1744. }),
  1745. vue.createTextVNode("   "),
  1746. vue.createVNode(_component_el_input, {
  1747. modelValue: fromData.min,
  1748. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => fromData.min = $event),
  1749. "aria-placeholder": "",
  1750. placeholder: " min ",
  1751. style: { "width": "60px" }
  1752. }, null, 8, ["modelValue"]),
  1753. vue.createTextVNode("- "),
  1754. vue.createVNode(_component_el_input, {
  1755. modelValue: fromData.max,
  1756. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => fromData.max = $event),
  1757. "aria-placeholder": "",
  1758. placeholder: " max",
  1759. style: { "width": "60px" }
  1760. }, null, 8, ["modelValue"])
  1761. ]),
  1762. _: 1
  1763. }),
  1764. vue.createVNode(_component_el_col, { span: 6 }, {
  1765. default: vue.withCtx(() => [
  1766. vue.createVNode(_component_el_tooltip, { content: "重置题单" }, {
  1767. default: vue.withCtx(() => [
  1768. vue.createVNode(_component_el_button, {
  1769. plain: "",
  1770. onClick: handlerDefault,
  1771. size: tableButtonSize.value,
  1772. disabled: showProcess.value
  1773. }, {
  1774. default: vue.withCtx(() => [
  1775. vue.createTextVNode(" 默认 ")
  1776. ]),
  1777. _: 1
  1778. }, 8, ["size", "disabled"])
  1779. ]),
  1780. _: 1
  1781. }),
  1782. vue.createVNode(_component_el_button, {
  1783. plain: "",
  1784. onClick: _cache[15] || (_cache[15] = ($event) => q1.value = !q1.value),
  1785. size: tableButtonSize.value
  1786. }, {
  1787. default: vue.withCtx(() => [
  1788. vue.createTextVNode(" 使用说明 ")
  1789. ]),
  1790. _: 1
  1791. }, 8, ["size"])
  1792. ]),
  1793. _: 1
  1794. })
  1795. ]),
  1796. _: 1
  1797. })
  1798. ]),
  1799. _: 1
  1800. }, 8, ["modelValue", "title"]),
  1801. vue.createVNode(_component_el_dialog, {
  1802. modelValue: asyncVisableDialog.value,
  1803. "onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => asyncVisableDialog.value = $event),
  1804. width: "35%"
  1805. }, {
  1806. default: vue.withCtx(() => [
  1807. vue.createElementVNode("p", null, [
  1808. vue.createVNode(_component_el_link, {
  1809. href: showProblemsProcessInfo.link,
  1810. type: "info",
  1811. underline: false
  1812. }, {
  1813. default: vue.withCtx(() => [
  1814. vue.createTextVNode(vue.toDisplayString(showProblemsProcessInfo.title), 1)
  1815. ]),
  1816. _: 1
  1817. }, 8, ["href"])
  1818. ]),
  1819. vue.createElementVNode("div", _hoisted_2, [
  1820. vue.createVNode(_component_el_progress, {
  1821. type: "circle",
  1822. percentage: computeProcess(showProblemsProcessInfo.ac, showProblemsProcessInfo.tot),
  1823. color: processColors
  1824. }, {
  1825. default: vue.withCtx(({ percentage }) => [
  1826. vue.createElementVNode("p", null, vue.toDisplayString(percentage) + "%", 1)
  1827. ]),
  1828. _: 1
  1829. }, 8, ["percentage"])
  1830. ]),
  1831. vue.createElementVNode("p", _hoisted_3, vue.toDisplayString(showProblemsProcessInfo.ac) + " / " + vue.toDisplayString(showProblemsProcessInfo.tot), 1)
  1832. ]),
  1833. _: 1
  1834. }, 8, ["modelValue"])
  1835. ]);
  1836. };
  1837. }
  1838. };
  1839. const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-76dd1ba0"]]);
  1840. const cssLoader = (e) => {
  1841. const t = GM_getResourceText(e);
  1842. return GM_addStyle(t), t;
  1843. };
  1844. cssLoader("elementPlusCss");
  1845. const stopRankingKey = "__is_stop_rating_ranking__";
  1846. let conetstTimeId = null;
  1847. function run$1() {
  1848. const container = document.querySelector(".contest-question-info .list-group");
  1849. if (!container) return;
  1850. const ls = Array.from(container.querySelectorAll(".list-group-item .pull-right"));
  1851. for (let i = 0; i < 4; i++) {
  1852. if (i >= ls.length) {
  1853. break;
  1854. }
  1855. if (ls[i] instanceof HTMLElement) {
  1856. ls[i].textContent = "0";
  1857. }
  1858. }
  1859. window.clearInterval(conetstTimeId);
  1860. }
  1861. function startStopRanking() {
  1862. if (!isContest(window.location.href)) {
  1863. return;
  1864. }
  1865. const isNext = !!document.querySelector("#__next");
  1866. if (isNext) {
  1867. return;
  1868. }
  1869. const use = Cache$2.get(stopRankingKey);
  1870. if (use) {
  1871. conetstTimeId = setInterval(() => {
  1872. run$1();
  1873. }, 10);
  1874. }
  1875. _GM_registerMenuCommand(`${use ? "使用" : "关闭"} 排行榜`, () => {
  1876. Cache$2.set(stopRankingKey, !use);
  1877. window.location.reload();
  1878. }, { title: "对于不想看到排行榜的可以使用此功能 默认开启" });
  1879. }
  1880. const local_url$1 = window.location.href;
  1881. let loadID$1 = 0;
  1882. let submitCnt = 0;
  1883. let submitbutton = null;
  1884. function watchDom(dom) {
  1885. if (!(dom instanceof HTMLElement)) {
  1886. return;
  1887. }
  1888. let m = new MutationObserver(() => {
  1889. if (submitCnt % 2 == 1) {
  1890. submitProblems(local_url$1);
  1891. }
  1892. submitCnt++;
  1893. });
  1894. m.observe(dom, {
  1895. childList: true,
  1896. attributes: true
  1897. });
  1898. }
  1899. function handler() {
  1900. loadID$1++;
  1901. let findSubmitButton = function(sel) {
  1902. if (!sel) return null;
  1903. return Array.from(document.querySelectorAll(sel && { length: 0 })).find((e) => {
  1904. return e && e.innerText == "提交解答" || e.innerText == "提交";
  1905. });
  1906. };
  1907. const isNext = !!document.querySelector("#__next");
  1908. submitbutton = findSubmitButton(isProblem(local_url$1) || isNext ? "" : ".question-detail-bottom .pull-right button");
  1909. if (!submitbutton) {
  1910. submitbutton = document.querySelector('[data-e2e-locator="console-submit-button"]');
  1911. }
  1912. if (submitbutton) {
  1913. watchDom(submitbutton);
  1914. submitbutton.addEventListener("click", () => {
  1915. submitProblems(local_url$1, 10 * 1e3);
  1916. });
  1917. } else if (loadID$1 < 10) {
  1918. setTimeout(() => {
  1919. handlerNotFound();
  1920. }, 3e3);
  1921. }
  1922. }
  1923. function watchSubmit() {
  1924. if (!isProblem()) {
  1925. return;
  1926. }
  1927. try {
  1928. if ((window == null ? void 0 : window.fetch) && (window == null ? void 0 : window.unsafeWindow)) {
  1929. let originalFetch = window == null ? void 0 : window.fetch;
  1930. window.unsafeWindow.fetch = function() {
  1931. return originalFetch.apply(this, arguments).then(function(response) {
  1932. let res = response.clone();
  1933. res.text().then(function(bodyText) {
  1934. let url = res.url;
  1935. if (isDev()) {
  1936. console.log("query result", bodyText);
  1937. }
  1938. if (!/https:\/\/leetcode\.(cn|com)\/submissions\/detail\/\d+\/check\/.*/.test(url)) {
  1939. return;
  1940. }
  1941. if (res.status == 200 && res.ok) {
  1942. let result = JSON.parse(bodyText);
  1943. const ID2 = getId(local_url$1);
  1944. const status = (result == null ? void 0 : result.status_msg) == "Accepted" ? "ac" : (result == null ? void 0 : result.status_msg) == "Wrong Answer" ? "notac" : "null";
  1945. watchSaveStatus(ID2, status);
  1946. }
  1947. const cache = Cache.get(__0X3F_PROBLEM_KEYS__["__0x3f_problmes_ac_key__"], true, Object.name);
  1948. if (cache[ID] == null || cache[Id] == void 0) {
  1949. submitProblems(local_url$1);
  1950. }
  1951. });
  1952. return response;
  1953. });
  1954. };
  1955. } else {
  1956. console.warn("浏览器当前环境不支持 unsafeWindow 将做兼容处理 ");
  1957. handler();
  1958. }
  1959. } catch (e) {
  1960. console.error(e);
  1961. }
  1962. }
  1963. const local_url = window.location.href;
  1964. const randomProblemKey = () => Cache$2.get(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_random_problems_key__"]) == void 0 ? true : Cache$2.get(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_random_problems_key__"]);
  1965. let Container = null;
  1966. Cache$2.get(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_button_is_none__"], true, Boolean.name);
  1967. if (isProblem() || isLeetCodeCircleUrl()) {
  1968. const start = () => {
  1969. Container = document.createElement("div");
  1970. const body = document.querySelector("body");
  1971. body.append(Container);
  1972. Container.style.display = "block";
  1973. return Container;
  1974. };
  1975. let dom = start();
  1976. const VueApp = vue.createApp(App);
  1977. VueApp.use(ElementPlus).mount(dom);
  1978. }
  1979. if (isProblem() || isLeetCodeCircleUrl()) {
  1980. _GM_registerMenuCommand(`随机一道题 ☕`, randomProblem, { title: "随机一道题目,你可以通过ctrl+atl+j显示一道题目" });
  1981. _GM_registerMenuCommand(`${randomProblemKey() ? "关闭" : "启用"} 随机题目快捷键 ☕`, () => {
  1982. Cache$2.set(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_random_problems_key__"], !randomProblemKey());
  1983. window.location.reload();
  1984. }, { title: "该功能是随机一道题的快捷键,你可以通过ctrl+atl+j显示一道题目" });
  1985. if (isLeetCodeCircleUrl()) {
  1986. installEnglishLinkChangeCommand();
  1987. }
  1988. if (randomProblemKey()) {
  1989. document.addEventListener("keydown", async function(event) {
  1990. if (event.ctrlKey && event.altKey && event.key === "j") {
  1991. randomProblem();
  1992. }
  1993. });
  1994. }
  1995. }
  1996. let loadID = 0;
  1997. async function run() {
  1998. loadID++;
  1999. if (isProblem(local_url)) {
  2000. await sleep(3e3);
  2001. if (isProblem(local_url) && loadID == 1) {
  2002. submitProblems(local_url);
  2003. }
  2004. } else if (isLeetCodeCircleUrl(local_url)) {
  2005. _GM_registerMenuCommand(`安装到${install_pos() ? "右侧" : "左侧"} 🎁`, () => {
  2006. Cache$2.set(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_insert_pos__"], install_pos());
  2007. window.location.reload();
  2008. }, { title: "AC标记安装位置,默认左侧,刷新生效" });
  2009. _GM_registerMenuCommand(`清空题目状态缓存 🚀`, () => {
  2010. Message("确认清空题目状态缓存", () => {
  2011. deleteAllACCountKeys();
  2012. window.location.reload();
  2013. });
  2014. }, { title: "如果题目状态出现问题,可以试试,一般情况下不建议使用" });
  2015. _GM_registerMenuCommand(`同步题目状态 🚀`, () => {
  2016. Message("确认同步题目状态", async () => {
  2017. await addProcess(true, void 0, true);
  2018. });
  2019. }, { title: "如果不在同一个浏览器答题,会出现ac题目状态没有及时同步,可以使用此功能" });
  2020. _GM_registerMenuCommand(`${initObj().onlyUrls ? "仅在收藏题单页面生效" : "所有题单生效"}`, () => {
  2021. const u = initObj();
  2022. u.onlyUrls = !u.onlyUrls;
  2023. Cache$2.set(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_solution__"], u);
  2024. }, { title: "插件默认会在所有讨论发布页生效,如果只想在收藏链接生效,可以使用此功能" });
  2025. _GM_registerMenuCommand(`添加本页`, () => {
  2026. const urls = initUrls();
  2027. let ok = false;
  2028. let url = window.location.href;
  2029. for (let info of urls) {
  2030. if (!info || !(info == null ? void 0 : info.link)) {
  2031. continue;
  2032. }
  2033. if (info.link.indexOf(url) != -1) {
  2034. ok = true;
  2035. break;
  2036. }
  2037. }
  2038. if (ok) {
  2039. ElementPlus.ElMessage({
  2040. message: "收藏失败,链接已经存在!",
  2041. type: "error"
  2042. });
  2043. } else {
  2044. if (isLeetCodeCircleUrl(url) && url.indexOf("view") != -1) {
  2045. try {
  2046. url = url.split("view")[0];
  2047. } catch (e) {
  2048. url = window.location.href;
  2049. }
  2050. }
  2051. urls.unshift({
  2052. title: document.title,
  2053. link: url
  2054. });
  2055. Container.style.display = "block";
  2056. Cache$2.set(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_urls__"], urls);
  2057. Cache$2.set(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_update__"], true);
  2058. Cache$2.set(__0X3F_PROBLEM_KEYS__$1["__0x3f_problmes_add_cur__"], true);
  2059. ElementPlus.ElMessage({
  2060. message: "收藏成功!刷新生效",
  2061. type: "success"
  2062. });
  2063. }
  2064. });
  2065. }
  2066. }
  2067. tips_message();
  2068. update_version();
  2069. watchSubmit();
  2070. run();
  2071. startStopRanking();
  2072.  
  2073. })(ElementPlus, Vue);