0x3f-problem-solution

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

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