0x3f-problem-solution

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

当前为 2024-11-11 提交的版本,查看 最新版本

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

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址