0x3f-problem-solution

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

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

QingJ © 2025

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