0x3f-problem-solution

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

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

  1. // ==UserScript==
  2. // @name 0x3f-problem-solution
  3. // @namespace https://gf.qytechs.cn/zh-CN/scripts/501134-0x3f-problem-solution
  4. // @version 0.0.4.1
  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://gf.qytechs.cn/zh-CN/scripts/501134-0x3f-problem-solution
  10. // @match https://leetcode.cn/circle/discuss/*
  11. // @match https://leetcode.cn/problems/*
  12. // @match https://leetcode.cn/contest/weekly-contest-*/problems/*
  13. // @match https://leetcode.cn/contest/biweekly-contest-*/problems/*
  14. // @require https://cdn.jsdelivr.net/npm/vue@3.4.31/dist/vue.global.prod.js
  15. // @require data:application/javascript,%3Bwindow.Vue%3DVue%3B
  16. // @require https://unpkg.com/element-plus@2.7.6/dist/index.full.js
  17. // @resource elementPlusCss https://unpkg.com/element-plus@2.7.6/dist/index.css
  18. // @grant GM_addStyle
  19. // @grant GM_deleteValue
  20. // @grant GM_getResourceText
  21. // @grant GM_getValue
  22. // @grant GM_registerMenuCommand
  23. // @grant GM_setValue
  24. // ==/UserScript==
  25.  
  26. (t=>{if(typeof GM_addStyle=="function"){GM_addStyle(t);return}const e=document.createElement("style");e.textContent=t,document.head.append(e)})(" .m-setting-button[data-v-21ece41e]{position:fixed;top:200px;right:0;z-index:100000}.m-button[data-v-21ece41e]{margin-left:16px!important;padding:5px!important;font-size:14px!important}.processs-flex[data-v-21ece41e]{display:flex;justify-content:center;align-items:center} ");
  27.  
  28. (function (vue, ElementPlus) {
  29. 'use strict';
  30.  
  31. var _GM_deleteValue = /* @__PURE__ */ (() => typeof GM_deleteValue != "undefined" ? GM_deleteValue : void 0)();
  32. var _GM_getValue = /* @__PURE__ */ (() => typeof GM_getValue != "undefined" ? GM_getValue : void 0)();
  33. var _GM_registerMenuCommand = /* @__PURE__ */ (() => typeof GM_registerMenuCommand != "undefined" ? GM_registerMenuCommand : void 0)();
  34. var _GM_setValue = /* @__PURE__ */ (() => typeof GM_setValue != "undefined" ? GM_setValue : void 0)();
  35. class Cache {
  36. set(k, v) {
  37. _GM_setValue(k, v);
  38. }
  39. get(k, parse = true, name = String.name) {
  40. try {
  41. let v = _GM_getValue(k);
  42. switch (name) {
  43. case String.name:
  44. if (v == null) {
  45. return "null";
  46. }
  47. return v;
  48. case Object.name:
  49. if (v == null || v == void 0 || typeof v != "object") {
  50. return {};
  51. }
  52. return v;
  53. case Boolean.name:
  54. if (v === null || v == void 0) {
  55. return false;
  56. }
  57. if (v == false || v == "false" || v == "" || v == "null") {
  58. return false;
  59. }
  60. return v;
  61. case Array.name:
  62. if (v === null || v == void 0 || !Array.isArray(v)) {
  63. return [];
  64. }
  65. return v;
  66. default:
  67. return v;
  68. }
  69. } catch (E) {
  70. return null;
  71. }
  72. }
  73. remove(k) {
  74. _GM_deleteValue(k);
  75. }
  76. }
  77. const Cache$1 = new Cache();
  78. const _export_sfc = (sfc, props) => {
  79. const target = sfc.__vccOpts || sfc;
  80. for (const [key, val] of props) {
  81. target[key] = val;
  82. }
  83. return target;
  84. };
  85. const _sfc_main$1 = {};
  86. const _hoisted_1$1 = /* @__PURE__ */ vue.createElementVNode("p", null, " 1. 本人目前测试过,没有封号,但是对于查询过题目会缓存在本地,因此尽量不要清空浏览器缓存 ", -1);
  87. const _hoisted_2$1 = /* @__PURE__ */ vue.createElementVNode("p", null, " 2. 脚本会监控题做题提交状态 ,当题目提交时候会缓存题目状态,如果题单中有这个题目,会直接从缓存中获取 ", -1);
  88. const _hoisted_3$1 = [
  89. _hoisted_1$1,
  90. _hoisted_2$1
  91. ];
  92. function _sfc_render(_ctx, _cache) {
  93. return vue.openBlock(), vue.createElementBlock("div", null, _hoisted_3$1);
  94. }
  95. const Q1 = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render]]);
  96. const isLeetCodeCircleUrl = (url = window.location.href) => url && url.indexOf("https://leetcode.cn/circle") != -1;
  97. const isProblem = (url = window.location.href) => /^https?:\/\/leetcode.cn\/problems\/.*/i.test(url);
  98. const isContest = (url = window.location.href) => url.indexOf("https://leetcode.cn/contest/weekly-contest") != -1 || url.indexOf("https://leetcode.cn/contest/biweekly-contest") != -1;
  99. const width = 14;
  100. const height = 14;
  101. const problemFinsh = `
  102.  
  103. <svg width="${width}px" height="${height}px" status="ac" viewBox="0 0 1024 1024" version="1.1"
  104. xmlns="http://www.w3.org/2000/svg">
  105. <path d="M512 512m-448 0a448 448 0 1 0 896 0 448 448 0 1 0-896 0Z" fill="#4CAF50" />
  106. <path
  107. d="M738.133333 311.466667L448 601.6l-119.466667-119.466667-59.733333 59.733334 179.2 179.2 349.866667-349.866667z"
  108. fill="#CCFF90" />
  109. </svg>
  110.  
  111. `;
  112. const problemsTry = `
  113. <svg width="${width}px" height="${height}px" status="notac" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg"
  114. xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512"
  115. style="enable-background:new 0 0 512 512;" xml:space="preserve">
  116. <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
  117. S390.101,12.8,256,12.8z" />
  118. <g>
  119. <path style="fill:#573A32;" d="M256,115.2c-49.271,0-92.561,25.353-117.726,63.676l18.859,18.859
  120. 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
  121. C396.8,178.244,333.764,115.2,256,115.2z" />
  122. <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
  123. 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" />
  124. <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
  125. 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
  126. C334.822,348.194,298.266,371.2,256,371.2z" />
  127. </g>
  128. </svg>
  129.  
  130. `;
  131. const problemsNo = `
  132.  
  133. `;
  134. const inf = 4e3;
  135. const mi = 1e3;
  136. const __0x3f_problmes_solution__ = "__0x3f_problmes_solution__";
  137. const __0x3f_problmes_urls__ = "__0x3f_problmes_urls__";
  138. const __0x3f_problmes_update__ = "__0x3f_problmes_update__";
  139. const __is_none_0x3f_problmes_button__ = "__is_none_0x3f_problmes_button__";
  140. const __add_cur__ = "__add_cur__";
  141. const defaultObj = {
  142. min: mi,
  143. max: inf,
  144. visiableMember: true,
  145. onlyUrls: false,
  146. useDefaultSetting: true,
  147. hiddenAc: false
  148. };
  149. function isShow(text, min, max) {
  150. if (!text) {
  151. return true;
  152. }
  153. let res = text.match(/\d+/ig);
  154. if (!res) {
  155. return true;
  156. }
  157. if (Array.isArray(res) && res.length < 2) {
  158. return true;
  159. }
  160. let s = 0;
  161. for (let i = res.length - 1; i >= 0; i--) {
  162. s = res[i];
  163. if (s >= mi && s <= inf) {
  164. return s >= min && s <= max;
  165. }
  166. }
  167. return true;
  168. }
  169. let A = void 0;
  170. const queryProblem = () => Array.from(document.querySelectorAll(".css-1ayia3m-MarkdownContent li>a")).filter((item) => item && item instanceof HTMLAnchorElement && isProblem(item.href));
  171. function loadProblems() {
  172. A = queryProblem();
  173. }
  174. function handlerProblem(data) {
  175. var _a;
  176. try {
  177. loadProblems();
  178. let { min, max, visiableMember, useDefaultSetting, onlyUrls, hiddenAc } = data;
  179. if (isNaN(min) || isNaN(max)) {
  180. min = mi;
  181. max = inf;
  182. }
  183. if (min < mi) {
  184. min = mi;
  185. }
  186. if (max < min) {
  187. max = inf;
  188. }
  189. min = Number(min);
  190. max = Number(max);
  191. data.min = min;
  192. data.max = max;
  193. Cache$1.set(__0x3f_problmes_solution__, data);
  194. for (let i = 0; i < A.length; i++) {
  195. if (!(A[i] instanceof HTMLAnchorElement)) {
  196. continue;
  197. }
  198. let d = (_a = A[i]) == null ? void 0 : _a.parentNode;
  199. if (!d) {
  200. continue;
  201. }
  202. let none = false;
  203. let Nohidden = isShow(d.textContent, min, max);
  204. d.style.display = Nohidden ? "" : "none";
  205. if (!Nohidden) {
  206. continue;
  207. }
  208. if (hiddenAc) {
  209. const svg = d.querySelector("svg");
  210. if (svg && svg.getAttribute("status")) {
  211. d.style.display = svg.getAttribute("status") == STATUS["AC"] ? "none" : "";
  212. }
  213. } else {
  214. d.style.display = "";
  215. }
  216. let c = d.textContent && d.textContent.indexOf("会员") != -1;
  217. if (!c) {
  218. continue;
  219. }
  220. d.style.display = visiableMember ? "" : "none";
  221. }
  222. } catch (e) {
  223. console.log("error", e);
  224. }
  225. }
  226. const initUrls = () => Cache$1.get(__0x3f_problmes_update__, true, Boolean.name) ? Cache$1.get(__0x3f_problmes_urls__, true, Array.name) : defaultUrls;
  227. const initObj = () => Cache$1.get(__0x3f_problmes_solution__) ? Object.assign(defaultObj, Cache$1.get(__0x3f_problmes_solution__)) : defaultObj;
  228. const support_plugins = () => {
  229. const u = initObj();
  230. if (!u || !u.onlyUrls) return true;
  231. let url = window.location.href;
  232. if (isLeetCodeCircleUrl(url) && url.indexOf("view") != -1) {
  233. try {
  234. url = url.split("view")[0];
  235. } catch (e) {
  236. url = window.location.href;
  237. }
  238. }
  239. const urls = initUrls();
  240. for (let info of urls) {
  241. if (!info || !(info == null ? void 0 : info.link)) {
  242. continue;
  243. }
  244. if (info.link.indexOf(url) != -1) {
  245. return true;
  246. }
  247. }
  248. return false;
  249. };
  250. const defaultUrls = [
  251. {
  252. title: "贪心算法(基本贪心策略/反悔/区间/字典序/数学/思维/构造)",
  253. link: "https://leetcode.cn/circle/discuss/g6KTKL/"
  254. },
  255. {
  256. title: "滑动窗口(定长/不定长/多指针)",
  257. link: "https://leetcode.cn/circle/discuss/0viNMK/"
  258. },
  259. {
  260. title: "二分算法(二分答案/最小化最大值/最大化最小值/第K小)",
  261. link: "https://leetcode.cn/circle/discuss/SqopEo/"
  262. },
  263. {
  264. title: "单调栈(矩形面积/贡献法/最小字典序)",
  265. link: "https://leetcode.cn/circle/discuss/9oZFK9/"
  266. },
  267. {
  268. title: "网格图(DFS/BFS/综合应用)",
  269. link: "https://leetcode.cn/circle/discuss/YiXPXW/"
  270. },
  271. {
  272. title: "位运算(基础/性质/拆位/试填/恒等式/贪心/脑筋急转弯)",
  273. link: "https://leetcode.cn/circle/discuss/dHn9Vk/"
  274. },
  275. {
  276. title: "图论算法(DFS/BFS/拓扑排序/最短路/最小生成树/二分图/基环树/欧拉路径)",
  277. link: "https://leetcode.cn/circle/discuss/01LUak/"
  278. },
  279. {
  280. title: "动态规划(入门/背包/状态机/划分/区间/状压/数位/树形/数据结构优化)",
  281. link: "https://leetcode.cn/circle/discuss/tXLS3i/"
  282. },
  283. {
  284. title: "常用数据结构(前缀和/差分/栈/队列/堆/字典树/并查集/树状数组/线段树)",
  285. link: "https://leetcode.cn/circle/discuss/mOr1u6/"
  286. },
  287. {
  288. title: "数学算法(数论/组合/概率期望/博弈/计算几何/随机算法)",
  289. link: "https://leetcode.cn/circle/discuss/IYT3ss/"
  290. }
  291. ];
  292. function getId(problemUrl) {
  293. if (isContest(problemUrl) || isProblem(problemUrl)) {
  294. try {
  295. return problemUrl.split("problems")[1].split("/")[1];
  296. } catch (e) {
  297. return "";
  298. }
  299. }
  300. return "";
  301. }
  302. const local_ok_problem_key = "__local_ok_problem_key__";
  303. const STATUS = {
  304. "AC": "ac",
  305. "NO": "null",
  306. "notac": "notac"
  307. };
  308. function postData(ID) {
  309. return {
  310. "query": "\n query userQuestionStatus($titleSlug: String!) {\n question(titleSlug: $titleSlug) {\n status\n }\n}\n ",
  311. "variables": {
  312. "titleSlug": ID
  313. },
  314. "operationName": "userQuestionStatus"
  315. };
  316. }
  317. function addProcess(reload = true) {
  318. var _a;
  319. loadProblems();
  320. let problems_doms = A;
  321. const cache = getLocalProblemStatus();
  322. let uid = 0;
  323. let updateCnt = 0;
  324. for (let i = 0; i < problems_doms.length; i++) {
  325. let cur = problems_doms[i].parentElement;
  326. if (!(cur instanceof HTMLElement)) {
  327. continue;
  328. }
  329. const ID = getId((_a = problems_doms[i]) == null ? void 0 : _a.href);
  330. if (!ID) {
  331. continue;
  332. }
  333. if (cache[ID]) {
  334. let status = cache[ID];
  335. uid++;
  336. const svg = cur.querySelector("svg");
  337. if (svg) {
  338. if (svg.getAttribute("status") == status) {
  339. continue;
  340. }
  341. svg.remove();
  342. updateCnt++;
  343. }
  344. cur.innerHTML = cur.innerHTML + (status == STATUS["AC"] ? problemFinsh : status == STATUS["notac"] ? problemsTry : problemsNo);
  345. } else {
  346. fetch("https://leetcode.cn/graphql/", {
  347. method: "POST",
  348. credentials: "include",
  349. headers: {
  350. "Content-Type": "application/json"
  351. },
  352. body: JSON.stringify(postData(ID))
  353. }).then((res) => res.json()).then((response) => {
  354. var _a2, _b;
  355. const status = (_b = (_a2 = response == null ? void 0 : response.data) == null ? void 0 : _a2.question) == null ? void 0 : _b.status;
  356. if (status == STATUS["AC"]) {
  357. cur.innerHTML = cur.innerHTML + problemFinsh;
  358. } else if (status == STATUS["notac"]) {
  359. cur.innerHTML = cur.innerHTML + problemsTry;
  360. } else {
  361. {
  362. cur.innerHTML = cur.innerHTML + problemsNo;
  363. }
  364. }
  365. cache[ID] = status == null ? "null" : status;
  366. if (cur.parentElement) {
  367. cur.parentElement.status = cache[ID];
  368. }
  369. }).catch((ignore) => {
  370. });
  371. }
  372. }
  373. console.log("cache num :", uid, ",update cnt", updateCnt, ",tot:", A.length);
  374. if (reload) {
  375. let cnt = 10;
  376. let timeId = setInterval(() => {
  377. Cache$1.set(local_ok_problem_key, cache);
  378. cnt--;
  379. if (cnt == 0) {
  380. window.clearInterval(timeId);
  381. }
  382. }, 3e3);
  383. }
  384. }
  385. const submitProblems = (url = window.location.href) => {
  386. const ID = getId(url);
  387. if (!ID) {
  388. return;
  389. }
  390. setTimeout(() => {
  391. const cache = getLocalProblemStatus();
  392. console.log("ID:", ID, "query status: ", cache[ID]);
  393. if (cache[ID] == void 0 || cache[ID] != STATUS["AC"]) {
  394. fetch("https://leetcode.cn/graphql/", {
  395. method: "POST",
  396. credentials: "include",
  397. headers: {
  398. "Content-Type": "application/json"
  399. },
  400. body: JSON.stringify(postData(ID))
  401. }).then((res) => res.json()).then((response) => {
  402. var _a, _b;
  403. const status = (_b = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.question) == null ? void 0 : _b.status;
  404. if (cache[ID] != status) {
  405. cache[ID] = status == null ? "null" : status;
  406. console.log("save local status :", cache[ID]);
  407. Cache$1.set(local_ok_problem_key, cache);
  408. }
  409. }).catch((ignore) => {
  410. });
  411. }
  412. }, 500);
  413. };
  414. function getProcess() {
  415. loadProblems();
  416. const cache = getLocalProblemStatus();
  417. let cnt = 0;
  418. for (let i = 0; i < A.length; i++) {
  419. let ID = getId(A[i].href);
  420. if (ID && cache[ID] == STATUS["AC"]) {
  421. cnt++;
  422. }
  423. }
  424. return [cnt, A.length];
  425. }
  426. function getLocalProblemStatus() {
  427. return Cache$1.get(local_ok_problem_key, true, Object.name);
  428. }
  429. const _hoisted_1 = { class: "processs-flex" };
  430. const _hoisted_2 = { style: { "text-align": "center", "color": "#121212" } };
  431. const _hoisted_3 = { class: "dialog-footer" };
  432. const formLabelWidth = "44px";
  433. const _sfc_main = {
  434. __name: "App",
  435. setup(__props) {
  436. let totProblem = vue.ref(0);
  437. let finishProblem = vue.ref(0);
  438. const drawer = vue.ref(false);
  439. const viewSetting = () => {
  440. drawer.value = !drawer.value;
  441. let [cur, tot] = getProcess();
  442. finishProblem.value = cur;
  443. totProblem.value = tot;
  444. };
  445. const finishProcess = vue.computed(() => {
  446. try {
  447. const s = String(finishProblem.value / totProblem.value);
  448. let x1 = s.split(".")[1].padEnd(3).substring(0, 3);
  449. return Math.min(100, Number(x1) / 10);
  450. } catch (e) {
  451. return (finishProblem.value / totProblem.value).toFixed(3) * 100;
  452. }
  453. });
  454. const processColors = [
  455. { color: "#f56c6c", percentage: 20 },
  456. { color: "#1989fa", percentage: 40 },
  457. { color: "#e6a23c", percentage: 60 },
  458. { color: "#6f7ad3", percentage: 80 },
  459. { color: "#5cb87a", percentage: 100 }
  460. ];
  461. const fromData = vue.reactive(initObj());
  462. vue.watch(fromData, () => {
  463. handlerProblem(vue.toRaw(Object.assign({}, fromData)));
  464. });
  465. let tableData = vue.reactive(initUrls());
  466. const keywords = vue.ref("");
  467. const dialogTableVisible = vue.ref(false);
  468. const urlsData = vue.computed(() => tableData.filter((v) => v && v.title && v.title.indexOf(keywords.value) != -1));
  469. const isDisabbled = vue.computed(() => !!tableData.find((v) => (v == null ? void 0 : v.link) && (v == null ? void 0 : v.link.indexOf(window.location.href)) != -1));
  470. const dialogFormVisible = vue.ref(false);
  471. const info = vue.reactive({
  472. title: "",
  473. link: "",
  474. status: "add"
  475. });
  476. const addlocal = () => {
  477. if (!isDisabbled) {
  478. return;
  479. }
  480. tableData.unshift({ title: document.title, link: window.location.href });
  481. };
  482. const updateIndex = vue.ref(-1);
  483. const showProblems = () => {
  484. dialogTableVisible.value = true;
  485. let o = Cache$1.get(__add_cur__) == "true" || Cache$1.get(__add_cur__) == true;
  486. if (o) {
  487. addlocal();
  488. }
  489. };
  490. const handlerProblems = (status, updateInfo = { title: "", link: "" }, index = -1) => {
  491. dialogFormVisible.value = true;
  492. info.status = status;
  493. updateIndex.value = index;
  494. Object.assign(info, updateInfo);
  495. };
  496. const handlerMessage = (u, title, link) => {
  497. const a = u ? "添加" : "修改";
  498. const error = !title || !/https?:\/\/.*/.test(link);
  499. if (error) {
  500. ElementPlus.ElMessage.error(`${a} 失败 请保证标题或者链接有效 `);
  501. } else {
  502. ElementPlus.ElMessage.success(`${a} 成功 `);
  503. }
  504. return !error;
  505. };
  506. const addOrUpdate = () => {
  507. if (!handlerMessage(info.status == "add", info.title, info.link)) {
  508. return;
  509. }
  510. if (info.status == "add") {
  511. tableData.unshift({ title: info.title, link: info.link });
  512. } else {
  513. let index = updateIndex.value;
  514. if (index != -1 && index < tableData.length) {
  515. tableData[index].link = info.link;
  516. tableData[index].title = info.title;
  517. }
  518. }
  519. dialogFormVisible.value = false;
  520. };
  521. const deleteProblems = (index) => {
  522. tableData.splice(index, 1);
  523. Cache$1.set(__0x3f_problmes_urls__, vue.toRaw(tableData));
  524. };
  525. const handlerDefault = () => {
  526. ElementPlus.ElMessageBox.confirm(
  527. "确认使用默认题单,将会重置题单?",
  528. "警告",
  529. {
  530. confirmButtonText: "确认",
  531. cancelButtonText: "取消",
  532. type: "warning"
  533. }
  534. ).then(() => {
  535. for (let i = 0; i < tableData.length; i++) {
  536. delete tableData[i];
  537. }
  538. for (let item of defaultUrls) {
  539. tableData.unshift(item);
  540. }
  541. ElementPlus.ElMessage({
  542. type: "success",
  543. message: "重置成功"
  544. });
  545. }).catch(() => {
  546. ElementPlus.ElMessage({
  547. type: "info",
  548. message: "取消重置"
  549. });
  550. });
  551. };
  552. window.addEventListener("beforeunload", () => {
  553. Cache$1.set(__0x3f_problmes_urls__, vue.toRaw(tableData).filter((u) => u != null && u != void 0));
  554. Cache$1.set(__0x3f_problmes_update__, true);
  555. Cache$1.set(__add_cur__, false);
  556. });
  557. vue.onMounted(() => {
  558. if (support_plugins()) {
  559. let times = 30;
  560. let loadTimeId = setInterval(() => {
  561. let a = queryProblem();
  562. times--;
  563. if (Array.isArray(a) && a.length > 0) {
  564. handlerProblem(vue.toRaw(Object.assign({}, fromData)));
  565. addProcess();
  566. window.clearInterval(loadTimeId);
  567. }
  568. if (times == 0) {
  569. window.clearInterval(loadTimeId);
  570. }
  571. }, 500);
  572. setInterval(() => {
  573. addProcess(false);
  574. }, 1e3 * 30);
  575. }
  576. });
  577. const q1 = vue.ref(false);
  578. return (_ctx, _cache) => {
  579. const _component_el_button = vue.resolveComponent("el-button");
  580. const _component_el_progress = vue.resolveComponent("el-progress");
  581. const _component_el_divider = vue.resolveComponent("el-divider");
  582. const _component_el_input = vue.resolveComponent("el-input");
  583. const _component_el_col = vue.resolveComponent("el-col");
  584. const _component_el_form_item = vue.resolveComponent("el-form-item");
  585. const _component_el_switch = vue.resolveComponent("el-switch");
  586. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  587. const _component_el_form = vue.resolveComponent("el-form");
  588. const _component_el_dialog = vue.resolveComponent("el-dialog");
  589. const _component_el_row = vue.resolveComponent("el-row");
  590. const _component_el_link = vue.resolveComponent("el-link");
  591. const _component_el_table_column = vue.resolveComponent("el-table-column");
  592. const _component_el_table = vue.resolveComponent("el-table");
  593. const _component_el_drawer = vue.resolveComponent("el-drawer");
  594. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  595. vue.createElementVNode("div", null, [
  596. vue.createVNode(_component_el_button, {
  597. type: "primary",
  598. style: {},
  599. onClick: viewSetting,
  600. class: "m-setting-button m-button",
  601. circle: "",
  602. size: "large"
  603. }, {
  604. default: vue.withCtx(() => [
  605. vue.createTextVNode(" 0X3F ")
  606. ]),
  607. _: 1
  608. })
  609. ]),
  610. vue.createVNode(_component_el_drawer, {
  611. modelValue: drawer.value,
  612. "onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => drawer.value = $event),
  613. "with-header": false,
  614. size: "30%"
  615. }, {
  616. default: vue.withCtx(() => [
  617. vue.createElementVNode("div", _hoisted_1, [
  618. vue.createVNode(_component_el_progress, {
  619. type: "circle",
  620. percentage: finishProcess.value,
  621. color: processColors
  622. }, {
  623. default: vue.withCtx(({ percentage }) => [
  624. vue.createElementVNode("p", null, vue.toDisplayString(percentage) + "%", 1)
  625. ]),
  626. _: 1
  627. }, 8, ["percentage"])
  628. ]),
  629. vue.createElementVNode("p", _hoisted_2, vue.toDisplayString(vue.unref(finishProblem)) + " / " + vue.toDisplayString(vue.unref(totProblem)), 1),
  630. vue.createCommentVNode("", true),
  631. vue.createVNode(_component_el_divider),
  632. vue.createVNode(_component_el_form, {
  633. "label-position": "left",
  634. "label-width": "auto",
  635. model: fromData,
  636. style: { "max-width": "600px" }
  637. }, {
  638. default: vue.withCtx(() => [
  639. vue.createVNode(_component_el_form_item, { label: "分数区间" }, {
  640. default: vue.withCtx(() => [
  641. vue.createVNode(_component_el_col, { span: 10 }, {
  642. default: vue.withCtx(() => [
  643. vue.createVNode(_component_el_input, {
  644. modelValue: fromData.min,
  645. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => fromData.min = $event),
  646. "aria-placeholder": "",
  647. placeholder: " min "
  648. }, null, 8, ["modelValue"])
  649. ]),
  650. _: 1
  651. }),
  652. vue.createVNode(_component_el_col, {
  653. class: "text-center",
  654. span: 1,
  655. style: { "margin": "0 0.5rem" }
  656. }, {
  657. default: vue.withCtx(() => [
  658. vue.createTextVNode("-")
  659. ]),
  660. _: 1
  661. }),
  662. vue.createVNode(_component_el_col, { span: 10 }, {
  663. default: vue.withCtx(() => [
  664. vue.createVNode(_component_el_input, {
  665. modelValue: fromData.max,
  666. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => fromData.max = $event),
  667. "aria-placeholder": "",
  668. placeholder: " max"
  669. }, null, 8, ["modelValue"])
  670. ]),
  671. _: 1
  672. })
  673. ]),
  674. _: 1
  675. }),
  676. vue.createVNode(_component_el_form_item, { label: "显示会员题" }, {
  677. default: vue.withCtx(() => [
  678. vue.createVNode(_component_el_switch, {
  679. modelValue: fromData.visiableMember,
  680. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => fromData.visiableMember = $event)
  681. }, null, 8, ["modelValue"])
  682. ]),
  683. _: 1
  684. }),
  685. vue.createVNode(_component_el_form_item, { label: "隐藏AC题目" }, {
  686. default: vue.withCtx(() => [
  687. vue.createVNode(_component_el_switch, {
  688. modelValue: fromData.hiddenAc,
  689. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => fromData.hiddenAc = $event)
  690. }, null, 8, ["modelValue"])
  691. ]),
  692. _: 1
  693. }),
  694. vue.createVNode(_component_el_form_item, { label: "收藏题单中生效" }, {
  695. default: vue.withCtx(() => [
  696. vue.createVNode(_component_el_tooltip, {
  697. content: "插件只在收藏题单中生效,刷新生效 ",
  698. placement: "bottom-end"
  699. }, {
  700. default: vue.withCtx(() => [
  701. vue.createVNode(_component_el_switch, {
  702. modelValue: fromData.onlyUrls,
  703. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => fromData.onlyUrls = $event)
  704. }, null, 8, ["modelValue"])
  705. ]),
  706. _: 1
  707. })
  708. ]),
  709. _: 1
  710. }),
  711. vue.createVNode(_component_el_form_item, { label: "使用题单" }, {
  712. default: vue.withCtx(() => [
  713. vue.createVNode(_component_el_switch, {
  714. modelValue: fromData.useDefaultSetting,
  715. "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => fromData.useDefaultSetting = $event)
  716. }, null, 8, ["modelValue"])
  717. ]),
  718. _: 1
  719. })
  720. ]),
  721. _: 1
  722. }, 8, ["model"]),
  723. fromData.useDefaultSetting ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  724. vue.createVNode(_component_el_divider),
  725. vue.createVNode(_component_el_button, {
  726. plain: "",
  727. onClick: showProblems
  728. }, {
  729. default: vue.withCtx(() => [
  730. vue.createTextVNode(" 查看收藏的题单 ")
  731. ]),
  732. _: 1
  733. }),
  734. vue.createVNode(_component_el_divider)
  735. ], 64)) : vue.createCommentVNode("", true),
  736. vue.createVNode(_component_el_button, {
  737. plain: "",
  738. onClick: _cache[8] || (_cache[8] = ($event) => q1.value = !q1.value)
  739. }, {
  740. default: vue.withCtx(() => [
  741. vue.createTextVNode(" 问题1 ")
  742. ]),
  743. _: 1
  744. }),
  745. vue.createVNode(_component_el_divider),
  746. vue.createVNode(_component_el_dialog, {
  747. modelValue: q1.value,
  748. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => q1.value = $event),
  749. title: "关于查询状态会不会被封号 ?"
  750. }, {
  751. default: vue.withCtx(() => [
  752. vue.createVNode(Q1)
  753. ]),
  754. _: 1
  755. }, 8, ["modelValue"]),
  756. vue.createVNode(_component_el_dialog, {
  757. modelValue: dialogTableVisible.value,
  758. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => dialogTableVisible.value = $event),
  759. title: "题单"
  760. }, {
  761. default: vue.withCtx(() => [
  762. vue.createVNode(_component_el_row, { gutter: 10 }, {
  763. default: vue.withCtx(() => [
  764. vue.createVNode(_component_el_col, { span: 8 }, {
  765. default: vue.withCtx(() => [
  766. vue.createVNode(_component_el_input, {
  767. modelValue: keywords.value,
  768. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => keywords.value = $event),
  769. placeholder: "请输入关键词过滤",
  770. clearable: ""
  771. }, null, 8, ["modelValue"])
  772. ]),
  773. _: 1
  774. }),
  775. vue.createVNode(_component_el_col, { span: 16 }, {
  776. default: vue.withCtx(() => [
  777. vue.createVNode(_component_el_button, {
  778. plain: "",
  779. onClick: addlocal,
  780. disabled: isDisabbled.value
  781. }, {
  782. default: vue.withCtx(() => [
  783. vue.createTextVNode(" 添加本页 ")
  784. ]),
  785. _: 1
  786. }, 8, ["disabled"]),
  787. vue.createVNode(_component_el_button, {
  788. plain: "",
  789. onClick: _cache[11] || (_cache[11] = ($event) => handlerProblems("add"))
  790. }, {
  791. default: vue.withCtx(() => [
  792. vue.createTextVNode(" 自定义 ")
  793. ]),
  794. _: 1
  795. }),
  796. vue.createVNode(_component_el_button, {
  797. plain: "",
  798. onClick: handlerDefault
  799. }, {
  800. default: vue.withCtx(() => [
  801. vue.createTextVNode(" 默认 ")
  802. ]),
  803. _: 1
  804. })
  805. ]),
  806. _: 1
  807. })
  808. ]),
  809. _: 1
  810. }),
  811. vue.createVNode(_component_el_table, {
  812. data: urlsData.value,
  813. height: "300",
  814. style: { "width": "100%", "margin-top": "10px" }
  815. }, {
  816. default: vue.withCtx(() => [
  817. vue.createVNode(_component_el_table_column, {
  818. label: "标题",
  819. width: "auto",
  820. align: "center"
  821. }, {
  822. default: vue.withCtx((scope) => [
  823. vue.createVNode(_component_el_link, {
  824. href: scope.row.link,
  825. target: "_blank",
  826. type: "default"
  827. }, {
  828. default: vue.withCtx(() => [
  829. vue.createTextVNode(vue.toDisplayString(scope.row.title), 1)
  830. ]),
  831. _: 2
  832. }, 1032, ["href"])
  833. ]),
  834. _: 1
  835. }),
  836. vue.createVNode(_component_el_table_column, {
  837. label: "操作",
  838. width: "auto",
  839. align: "center"
  840. }, {
  841. default: vue.withCtx((scope) => [
  842. vue.createVNode(_component_el_button, {
  843. type: "primary",
  844. size: "small",
  845. onClick: ($event) => handlerProblems("update", scope.row, scope.$index)
  846. }, {
  847. default: vue.withCtx(() => [
  848. vue.createTextVNode("编辑")
  849. ]),
  850. _: 2
  851. }, 1032, ["onClick"]),
  852. vue.createVNode(_component_el_button, {
  853. type: "danger",
  854. size: "small",
  855. onClick: ($event) => deleteProblems(scope.$index)
  856. }, {
  857. default: vue.withCtx(() => [
  858. vue.createTextVNode("删除")
  859. ]),
  860. _: 2
  861. }, 1032, ["onClick"])
  862. ]),
  863. _: 1
  864. })
  865. ]),
  866. _: 1
  867. }, 8, ["data"])
  868. ]),
  869. _: 1
  870. }, 8, ["modelValue"]),
  871. vue.createVNode(_component_el_dialog, {
  872. modelValue: dialogFormVisible.value,
  873. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => dialogFormVisible.value = $event),
  874. title: `${info.status == "add" ? "添加" : "编辑"}`,
  875. width: "400"
  876. }, {
  877. footer: vue.withCtx(() => [
  878. vue.createElementVNode("div", _hoisted_3, [
  879. vue.createVNode(_component_el_button, {
  880. onClick: _cache[15] || (_cache[15] = ($event) => dialogFormVisible.value = false)
  881. }, {
  882. default: vue.withCtx(() => [
  883. vue.createTextVNode("取消")
  884. ]),
  885. _: 1
  886. }),
  887. vue.createVNode(_component_el_button, {
  888. type: "primary",
  889. onClick: addOrUpdate
  890. }, {
  891. default: vue.withCtx(() => [
  892. vue.createTextVNode(" 确认 ")
  893. ]),
  894. _: 1
  895. })
  896. ])
  897. ]),
  898. default: vue.withCtx(() => [
  899. vue.createVNode(_component_el_form, null, {
  900. default: vue.withCtx(() => [
  901. vue.createVNode(_component_el_form_item, {
  902. label: "标题",
  903. "label-width": formLabelWidth
  904. }, {
  905. default: vue.withCtx(() => [
  906. vue.createVNode(_component_el_input, {
  907. modelValue: info.title,
  908. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => info.title = $event),
  909. autocomplete: "off"
  910. }, null, 8, ["modelValue"])
  911. ]),
  912. _: 1
  913. }),
  914. vue.createVNode(_component_el_form_item, {
  915. label: "链接",
  916. "label-width": formLabelWidth
  917. }, {
  918. default: vue.withCtx(() => [
  919. vue.createVNode(_component_el_input, {
  920. modelValue: info.link,
  921. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => info.link = $event),
  922. autocomplete: "off"
  923. }, null, 8, ["modelValue"])
  924. ]),
  925. _: 1
  926. })
  927. ]),
  928. _: 1
  929. })
  930. ]),
  931. _: 1
  932. }, 8, ["modelValue", "title"])
  933. ]),
  934. _: 1
  935. }, 8, ["modelValue"])
  936. ], 64);
  937. };
  938. }
  939. };
  940. const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-21ece41e"]]);
  941. const cssLoader = (e) => {
  942. const t = GM_getResourceText(e);
  943. return GM_addStyle(t), t;
  944. };
  945. cssLoader("elementPlusCss");
  946. const stopRankingKey = "__is_stop_rating_ranking__";
  947. let conetstTimeId = null;
  948. function run$1() {
  949. const container = document.querySelector(".contest-question-info .list-group");
  950. if (!container) return;
  951. const ls = Array.from(container.querySelectorAll(".list-group-item .pull-right"));
  952. for (let i = 0; i < 4; i++) {
  953. if (i >= ls.length) {
  954. break;
  955. }
  956. if (ls[i] instanceof HTMLElement) {
  957. ls[i].textContent = "0";
  958. }
  959. }
  960. window.clearInterval(conetstTimeId);
  961. }
  962. function startStopRanking() {
  963. if (!isContest(window.location.href)) {
  964. return;
  965. }
  966. const isNext = !!document.querySelector("#__next");
  967. if (isNext) {
  968. return;
  969. }
  970. const use = Cache$1.get(stopRankingKey);
  971. _GM_registerMenuCommand(`${use ? "使用" : "关闭"} 排行榜`, () => {
  972. Cache$1.set(stopRankingKey, !use);
  973. window.location.reload();
  974. }, { title: "对于不想看到排行榜的可以使用此功能 默认开启" });
  975. if (!use) {
  976. return;
  977. }
  978. conetstTimeId = setInterval(() => {
  979. run$1();
  980. }, 10);
  981. }
  982. const local_url = window.location.href;
  983. let loadID = 0;
  984. let submitCnt = 0;
  985. function watchDom(dom) {
  986. if (!(dom instanceof HTMLElement)) {
  987. return;
  988. }
  989. let m = new MutationObserver(() => {
  990. if (submitCnt % 2 == 1) {
  991. submitProblems(local_url);
  992. }
  993. submitCnt++;
  994. });
  995. m.observe(dom, {
  996. childList: true,
  997. attributes: true
  998. });
  999. }
  1000. function run() {
  1001. loadID++;
  1002. if (isProblem(local_url) || isContest(local_url)) {
  1003. if (isProblem(local_url) && loadID == 1) {
  1004. submitProblems(local_url);
  1005. }
  1006. setTimeout(() => {
  1007. let submitbutton = null;
  1008. const isNext = !!document.querySelector("#__next");
  1009. if (isProblem(local_url) || isNext) {
  1010. submitbutton = document.querySelector("div [data-e2e-locator=console-submit-button]");
  1011. } else {
  1012. let buttons = Array.from(document.querySelectorAll(".question-detail-bottom .pull-right button"));
  1013. for (let i = buttons.length - 1; i >= 0; i--) {
  1014. if (buttons[i].textContent.indexOf("提交解答") != -1) {
  1015. submitbutton = buttons[i];
  1016. break;
  1017. }
  1018. }
  1019. }
  1020. if (submitbutton) {
  1021. watchDom(submitbutton);
  1022. } else if (loadID < 10) {
  1023. run();
  1024. }
  1025. }, 3e3);
  1026. } else if (isLeetCodeCircleUrl(local_url)) {
  1027. let Container = null;
  1028. let ok = Cache$1.get(__is_none_0x3f_problmes_button__, true, Boolean.name);
  1029. const start = () => {
  1030. Container = document.createElement("div");
  1031. const body = document.querySelector("body");
  1032. body.append(Container);
  1033. Container.style.display = ok && support_plugins() ? "block" : "none";
  1034. return Container;
  1035. };
  1036. let dom = start();
  1037. const VueApp = vue.createApp(App);
  1038. _GM_registerMenuCommand(`${ok ? "隐藏按钮" : "显示按钮"}`, () => {
  1039. ok = !ok;
  1040. Container.style.display = ok ? "block" : "none";
  1041. Cache$1.set(__is_none_0x3f_problmes_button__, ok);
  1042. }, { title: "可以手动关闭或者显示按钮 默认显示 刷新生效" });
  1043. _GM_registerMenuCommand(`${initObj().onlyUrls ? "仅在收藏题单页面生效" : "所有题单生效"}`, () => {
  1044. const u = initObj();
  1045. u.onlyUrls = !u.onlyUrls;
  1046. Container.style.display = support_plugins() ? "block" : "none";
  1047. Cache$1.set(__0x3f_problmes_solution__, u);
  1048. });
  1049. _GM_registerMenuCommand(`添加本页`, () => {
  1050. const urls = initUrls();
  1051. let ok2 = false;
  1052. let url = window.location.href;
  1053. for (let info of urls) {
  1054. if (!info || !(info == null ? void 0 : info.link)) {
  1055. continue;
  1056. }
  1057. if (info.link.indexOf(url) != -1) {
  1058. ok2 = true;
  1059. break;
  1060. }
  1061. }
  1062. if (ok2) {
  1063. ElementPlus.ElMessage({
  1064. message: "收藏失败,链接已经存在!",
  1065. type: "error"
  1066. });
  1067. } else {
  1068. if (isLeetCodeCircleUrl(url) && url.indexOf("view") != -1) {
  1069. try {
  1070. url = url.split("view")[0];
  1071. } catch (e) {
  1072. url = window.location.href;
  1073. }
  1074. }
  1075. urls.unshift({
  1076. title: document.title,
  1077. link: url
  1078. });
  1079. Container.style.display = "block";
  1080. Cache$1.set(__0x3f_problmes_urls__, urls);
  1081. Cache$1.set(__0x3f_problmes_update__, true);
  1082. Cache$1.set(__add_cur__, true);
  1083. ElementPlus.ElMessage({
  1084. message: "收藏成功!刷新生效",
  1085. type: "success"
  1086. });
  1087. }
  1088. });
  1089. VueApp.use(ElementPlus).mount(dom);
  1090. }
  1091. }
  1092. run();
  1093. startStopRanking();
  1094.  
  1095. })(Vue, ElementPlus);

QingJ © 2025

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