// ==UserScript== // @name 0x3f-problem-solution // @namespace https://greasyfork.org//zh-CN/scripts/501134-0x3f-problem-solution // @version 0.0.6.0 // @author wuxin0011 // @description 自定义分数区间显示题目 标记题目状态 配合灵茶山艾府题单解题 // @license MIT // @icon https://assets.leetcode.cn/aliyun-lc-upload/users/endlesscheng/avatar_1690721039.png // @source https://github.com/wuxin0011/tampermonkey-script/tree/main/0x3f-leetcode // @supportURL https://greasyfork.org//zh-CN/scripts/501134-0x3f-problem-solution/feedback // @match https://leetcode.cn/circle/discuss/* // @match https://leetcode.cn/discuss/* // @match https://leetcode.cn/ // @match https://leetcode.cn/problems/* // @match https://leetcode.cn/contest/*/problems/* // @match https://leetcode.com // @match https://leetcode.com/circle/discuss/* // @match https://leetcode.com/discuss/* // @match https://leetcode.com/problems/* // @match https://leetcode.com/contest/*/problems/* // @require https://unpkg.com/vue@3.4.31/dist/vue.global.prod.js // @require data:application/javascript,%3Bwindow.Vue%3DVue%3B // @require https://unpkg.com/element-plus@2.7.6/dist/index.full.js // @resource elementPlusCss https://unpkg.com/element-plus@2.7.6/dist/index.css // @grant GM_addStyle // @grant GM_deleteValue // @grant GM_getResourceText // @grant GM_getValue // @grant GM_registerMenuCommand // @grant GM_setValue // ==/UserScript== (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-3d821394]{position:fixed;top:200px;right:0;z-index:100000}.m-button[data-v-3d821394]{margin-left:16px!important;padding:5px!important;font-size:14px!important}.processs-flex[data-v-3d821394]{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} "); (function (ElementPlus, vue) { 'use strict'; var _GM_addStyle = /* @__PURE__ */ (() => typeof GM_addStyle != "undefined" ? GM_addStyle : void 0)(); var _GM_deleteValue = /* @__PURE__ */ (() => typeof GM_deleteValue != "undefined" ? GM_deleteValue : void 0)(); var _GM_getValue = /* @__PURE__ */ (() => typeof GM_getValue != "undefined" ? GM_getValue : void 0)(); var _GM_registerMenuCommand = /* @__PURE__ */ (() => typeof GM_registerMenuCommand != "undefined" ? GM_registerMenuCommand : void 0)(); var _GM_setValue = /* @__PURE__ */ (() => typeof GM_setValue != "undefined" ? GM_setValue : void 0)(); let Cache$1 = class Cache2 { set(k, v) { _GM_setValue(k, v); } get(k, parse = true, name = String.name) { try { let v = _GM_getValue(k); switch (name) { case String.name: if (v == null) { return "null"; } return v; case Object.name: if (v == null || v == void 0 || typeof v != "object") { return {}; } return v; case Boolean.name: if (v === null || v == void 0) { return false; } if (v == false || v == "false" || v == "" || v == "null") { return false; } return v; case Array.name: if (v === null || v == void 0 || !Array.isArray(v)) { return []; } return v; default: return v; } } catch (E) { return null; } } remove(k) { _GM_deleteValue(k); } }; const Cache$2 = new Cache$1(); function isEnglishENV() { return window.location.href.indexOf("https://leetcode.com") != -1; } const isHttp = (url) => /^https?:\/\/.*$/.test(url); const isLeetCodeCircleUrl = (url = window.location.href) => /^https?:\/\/leetcode\.(com|cn).*\/discuss\/.*/i.test(url); const isProblem = (url = window.location.href) => /^https?:\/\/leetcode\.(com|cn)\/problems\/.*/i.test(url); const isContest = (url = window.location.href) => /^https?:\/\/leetcode\.(com|cn)\/contest\/.*\/problems\/.*/.test(url); const isBilibili = (url = window.location.href) => /.*bilibili.*/.test(url); const isHome = () => window.location.href == "https://leetcode.cn/" || window.location.href == "https://leetcode.com/"; const isZH = (url = window.location.href) => /^https?:\/\/leetcode\.cn/.test(url); const sleep = async (time = 500) => new Promise((resolove) => setTimeout(resolove, time)); const EN_URL = "https://leetcode.com"; const ZH_URL = "https://leetcode.cn"; const LC_COPY_HTML_PLUGIN = "https://greasyfork.org//zh-CN/scripts/491969-lc-to-markdown-txt-html"; const EN_SOLUTION_DEMO = "https://leetcode.com/discuss/interview-question/6032972/leetcode"; const CUR_URL = isEnglishENV() ? EN_URL : ZH_URL; const isDev = () => JSON.parse("false"); const width = 14; const height = 14; const svg_css_style = () => isNewUI() ? "display:inline;margin-bottom:3px;" : ""; const bilibiliSVG = () => { return ` `; }; const problemContenst = () => ` `; const problemFinsh = () => ` `; const problemsTry = () => ` `; const resetSVG = (size = 20) => ` `; const updateSVG = (size = 20) => ` `; const problemsNo = () => install_pos() ? ` ` : ``; const createStatus = (status, link, removeSvg = false) => { var _a; let node; if (!link) { return; } const curUrl = (link == null ? void 0 : link.href) ?? ((_a = link.querySelector("a")) == null ? void 0 : _a.href); node = link instanceof HTMLAnchorElement ? link.parentElement : link; if (node) { node.status = status; } if (removeSvg) { let svg2 = node.querySelector("svg"); if (svg2) { svg2.remove(); } } let installSVG = ""; if (isContest(curUrl)) { installSVG = problemContenst(); } else if (isLeetCodeCircleUrl(curUrl)) ; else if (isBilibili(curUrl)) { installSVG = bilibiliSVG(); } else { if (status == STATUS["AC"]) { installSVG = problemFinsh(); } else if (status == STATUS["notac"]) { installSVG = problemsTry(); } else if (status == STATUS["NO"]) { installSVG = problemsNo(); } } let svg = node.querySelector("svg"); if (svg) { if (svg.getAttribute("status") == status || svg.getAttribute("status") == STATUS["AC"]) { return false; } svg.remove(); } if (isBilibili(curUrl)) { node.innerHTML = node.innerHTML + " " + installSVG; } else { node.innerHTML = install_pos() ? installSVG + node.innerHTML : node.innerHTML + installSVG; } return true; }; function Message(title = "确认操作", callback = () => { }, canlcelCallback = () => { }) { ElementPlus.ElMessageBox.confirm( `${title} ?`, "警告", { confirmButtonText: "确认", cancelButtonText: "取消", type: "warning" } ).then(() => { callback(); }).catch(() => { ElementPlus.ElMessage({ type: "info", message: "已取消" }); canlcelCallback(); }); } function tips_message() { if (isEnglish() && isZH() && Cache$2.get(__0X3F_PROBLEM_KEYS__$1["__0x3f_problme_support_type_tips__"]) == "OK") { ElementPlus.ElMessageBox.alert( `

检查到当前环境为国服,如果需要同步功能需要切换到美服,或者复制一份题单到美服自己使用 否则仅保留替换链接功能,没有同步功能