LeetCodeRating|English

LeetCodeRating The score of the weekly competition is displayed, and currently supports the tag page, question bank page, problem_list page and question page

当前为 2023-08-27 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name LeetCodeRating|English
  3. // @namespace https://github.com/zhang-wangz
  4. // @version 1.1.3
  5. // @license MIT
  6. // @description LeetCodeRating The score of the weekly competition is displayed, and currently supports the tag page, question bank page, problem_list page and question page
  7. // @author 小东是个阳光蛋(Leetcode Nickname of chinese site
  8. // @leetcodehomepage https://leetcode.cn/u/runonline/
  9. // @homepageURL https://github.com/zhang-wangz/LeetCodeRating
  10. // @contributionURL https://www.showdoc.com.cn/2069209189620830
  11. // @match *://*leetcode.com/*
  12. // @grant GM_xmlhttpRequest
  13. // @grant GM_setValue
  14. // @grant GM_getValue
  15. // @grant GM_addStyle
  16. // @grant GM_getResourceText
  17. // @connect zerotrac.github.io
  18. // @connect raw.staticdn.net
  19. // @connect raw.gitmirror.com
  20. // @connect raw.githubusercontents.com
  21. // @connect raw.githubusercontent.com
  22. // @require https://gcore.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js
  23. // @require https://gcore.jsdelivr.net/gh/andywang425/BLTH@4368883c643af57c07117e43785cd28adcb0cb3e/assets/js/library/layer.min.js
  24. // @resource css https://gcore.jsdelivr.net/gh/andywang425/BLTH@d25aa353c8c5b2d73d2217b1b43433a80100c61e/assets/css/layer.css
  25. // @grant unsafeWindow
  26. // @run-at document-end
  27. // @note 2022-12-29 1.1.0 add english site support
  28. // @note 2022-12-29 1.1.1 fix when the dark mode is turned on, the prompt display is abnormal
  29. // @note 2023-01-05 1.1.2 modify the cdn access address
  30. // @note 2023-08-05 1.1.3 remaintain the project
  31. // ==/UserScript==
  32.  
  33. (function () {
  34. 'use strict';
  35. let t2rate = {}
  36. let latestpb = {}
  37. let id1 = ""
  38. let id2 = ""
  39. let id3 = ""
  40. let id4 = ""
  41. let id5 = ""
  42. let id6 = ""
  43. let version = "1.1.3"
  44. let preDate
  45. let allUrl = "https://leetcode.com/problemset"
  46. let tagUrl = "https://leetcode.com/tag"
  47. let pblistUrl = "https://leetcode.com/problem-list"
  48. let pbUrl = "https://leetcode.com/problems"
  49. GM_addStyle(GM_getResourceText("css"));
  50.  
  51. // 深拷贝 deep clone
  52. function deepclone(obj) {
  53. let str = JSON.stringify(obj);
  54. return JSON.parse(str);
  55. }
  56.  
  57. // 获取数字 get the contest number
  58. function getcontestNumber(url) {
  59. return parseInt(url.substr(15));
  60. }
  61.  
  62. // 获取时间
  63. function getCurrentDate(format) {
  64. let now = new Date();
  65. let year = now.getFullYear(); //得到年份
  66. let month = now.getMonth(); //得到月份
  67. let date = now.getDate(); //得到日期
  68. let hour = now.getHours(); //得到小时
  69. let minu = now.getMinutes(); //得到分钟
  70. let sec = now.getSeconds(); //得到秒
  71. month = month + 1;
  72. if (month < 10) month = "0" + month;
  73. if (date < 10) date = "0" + date;
  74. if (hour < 10) hour = "0" + hour;
  75. if (minu < 10) minu = "0" + minu;
  76. if (sec < 10) sec = "0" + sec;
  77. let time = "";
  78. // 精确到天
  79. if (format == 1) {
  80. time = year + "年" + month + "月" + date + "日";
  81. }
  82. // 精确到分
  83. else if (format == 2) {
  84. time = year + "-" + month + "-" + date + " " + hour + ":" + minu + ":" + sec;
  85. }
  86. return time;
  87. }
  88.  
  89.  
  90.  
  91. let t // all and tag
  92. let t1, le // pb
  93. function getData() {
  94. try {
  95. const problemList = document.querySelector("#__next > div > div > div.grid.grid-cols-4.gap-4.md\\:grid-cols-3.lg\\:grid-cols-4.lg\\:gap-6 > div.col-span-4.z-base.md\\:col-span-2.lg\\:col-span-3 > div:nth-child(6) > div:nth-child(2) > div > div > div:nth-child(2)")
  96. // pb页面加载时直接返回
  97. if (problemList == undefined) {
  98. return
  99. }
  100.  
  101. // 防止过多的无效操作
  102. if (t != undefined && t == problemList.lastChild.innerHTML) {
  103. return
  104. }
  105.  
  106. const problems = problemList.childNodes
  107. for (const problem of problems) {
  108. const length = problem.childNodes.length
  109. const problemTitle = problem.childNodes[1].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].innerText
  110. const problemIndex = parseInt(problemTitle.split(".")[0], 10)
  111. let problemDifficulty = problem.childNodes[4].childNodes[0].innerHTML
  112. if (t2rate[problemIndex] != undefined) {
  113. problemDifficulty = t2rate[problemIndex]["Rating"]
  114. problem.childNodes[4].childNodes[0].innerHTML = problemDifficulty
  115. }
  116. }
  117. t = deepclone(problemList.lastChild.innerHTML)
  118. } catch (e) {
  119. return
  120. }
  121. }
  122.  
  123.  
  124. function getTagData() {
  125. if (!window.location.href.startsWith(tagUrl)) {
  126. clearInterval(id2)
  127. id3 = setInterval(getpb, 1)
  128. GM_setValue("pb", id3)
  129. return
  130. }
  131. try {
  132. const problemList = document.querySelector("#app > div > div.ant-row.content__xk8m > div > div > div > table > tbody")
  133. if (t != undefined && t == problemList.lastChild.innerHTML) {
  134. return
  135. }
  136. let problems = problemList.childNodes
  137. for (let problem of problems) {
  138. let length = problem.childNodes.length
  139. let problemIndex = problem.childNodes[1].innerText.trim()
  140. let problemDifficulty = problem.childNodes[4].childNodes[0].innerHTML
  141. if (t2rate[problemIndex] != undefined) {
  142. problemDifficulty = t2rate[problemIndex]["Rating"]
  143. problem.childNodes[4].childNodes[0].innerHTML = problemDifficulty
  144. }
  145. }
  146. t = deepclone(problemList.lastChild.innerHTML)
  147. } catch (e) {
  148. return
  149. }
  150. }
  151.  
  152.  
  153.  
  154. function getPblistData() {
  155. if (!window.location.href.startsWith(pblistUrl)) {
  156. clearInterval(id5)
  157. id3 = setInterval(getpb, 1)
  158. GM_setValue("pb", id3)
  159. return
  160. }
  161. try {
  162. const problemList = document.querySelector("#__next > div > div.mx-auto.mt-\\[50px\\].w-full.grow.p-4.md\\:mt-0.md\\:max-w-\\[888px\\].md\\:p-6.lg\\:max-w-screen-xl.bg-overlay-1.dark\\:bg-dark-overlay-1.md\\:bg-paper.md\\:dark\\:bg-dark-paper > div > div.col-span-4.md\\:col-span-2.lg\\:col-span-3 > div:nth-child(2) > div.-mx-4.md\\:mx-0 > div > div > div:nth-child(2)")
  163. if (t != undefined && t == problemList.lastChild.innerHTML) {
  164. return
  165. }
  166. let problems = problemList.childNodes
  167. for (let problem of problems) {
  168. let length = problem.childNodes.length
  169. let problemTitle = problem.childNodes[1].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].innerText
  170. let problemIndex = problemTitle.split(".")[0].trim()
  171. let problemDifficulty = problem.childNodes[4].childNodes[0].innerHTML
  172.  
  173. if (t2rate[problemIndex] != undefined) {
  174. problemDifficulty = t2rate[problemIndex]["Rating"]
  175. problem.childNodes[4].childNodes[0].innerHTML = problemDifficulty
  176. } else {
  177. let nd2ch = { "text-olive dark:text-dark-olive": "Easy", "text-yellow dark:text-dark-yellow": "Medium", "text-pink dark:text-dark-pink": "Hard" }
  178. let cls = problem.childNodes[4].childNodes[0].getAttribute("class")
  179. problem.childNodes[4].childNodes[0].innerHTML = nd2ch[cls]
  180. }
  181. }
  182. t = deepclone(problemList.lastChild.innerHTML)
  183. } catch (e) {
  184. return
  185. }
  186. }
  187.  
  188. function getpb() {
  189. if (!window.location.href.startsWith(pbUrl)) {
  190. clearInterval(id3)
  191. if (window.location.href.startsWith(allUrl)) {
  192. id1 = setInterval(getData, 1)
  193. GM_setValue("all", id1)
  194. } else if (window.location.href.startsWith(tagUrl)) {
  195. id2 = setInterval(getTagData, 1)
  196. GM_setValue("tag", id2)
  197. } else if (window.location.href.startsWith(pblistUrl)) {
  198. id5 = setInterval(getPblistData, 1)
  199. GM_setValue("pblist", id5)
  200. }
  201. return
  202. }
  203.  
  204. try {
  205.  
  206. // 旧版的标题位置
  207. let problemTitle = document.querySelector("#app > div > div.main__2_tD > div.content__3fR6 > div > div.side-tools-wrapper__1TS9 > div > div.css-1gd46d6-Container.e5i1odf0 > div.css-jtoecv > div > div.tab-pane__ncJk.css-1eusa4c-TabContent.e5i1odf5 > div > div.css-101rr4k > div.css-v3d350")
  208. if (problemTitle == undefined) {
  209. // 新版逻辑
  210. problemTitle = document.querySelector("#qd-content > div.h-full.flex-col.ssg__qd-splitter-primary-w > div > div > div > div.flex.h-full.w-full.overflow-y-auto > div > div > div.w-full.px-5.pt-5 > div > div:nth-child(1) > div.flex-1 > div > a")
  211. if (problemTitle == undefined) {
  212. t1 = "unknown"
  213. return
  214. }
  215. const problemIndex = problemTitle.innerText.split(".")[0].trim()
  216. const colorSpan = document.querySelector("#qd-content > div.h-full.flex-col.ssg__qd-splitter-primary-w > div > div > div > div.flex.h-full.w-full.overflow-y-auto > div > div > div.w-full.px-5.pt-5 > div > div.mt-3.flex.space-x-4 > div:nth-child(1)") // 不确定要不要删除最后一个 "div"
  217. // const pa = colorSpan.parentNode.parentNode
  218. if (t1 != undefined && t1 == problemIndex) {
  219. return
  220. }
  221. // 新版统计难度分数并且修改
  222. let problemDifficulty = colorSpan.getAttribute("class")
  223. if (t2rate[problemIndex] != undefined) {
  224. colorSpan.innerHTML = t2rate[problemIndex]["Rating"]
  225. }
  226. /*
  227. // 新版逻辑,准备做周赛链接,如果已经不存在组件就执行操作
  228. let url = "https://leetcode.com/contest/"
  229. let zhUrl = "https://leetcode.com/contest/"
  230. let q = pa.lastChild
  231. let le = pa.childNodes.length
  232. if (q.textContent == "") {
  233. let abody = document.createElement("a")
  234. abody.setAttribute("data-small-spacing", "true")
  235. abody.setAttribute("class", "css-nabodd-Button e167268t1")
  236.  
  237. let abody2 = document.createElement("a")
  238. abody2.setAttribute("data-small-spacing", "true")
  239. abody2.setAttribute("class", "css-nabodd-Button e167268t1")
  240.  
  241. let span = document.createElement("span")
  242. let span2 = document.createElement("span")
  243. // ContestID_en ContestSlug
  244. if (t2rate[problemIndex] != undefined) {
  245. let contestUrl;
  246. let num = getcontestNumber(t2rate[problemIndex]["ContestSlug"])
  247. contestUrl = url
  248. span.innerText = t2rate[problemIndex]["ContestID_en"]
  249. span2.innerText = t2rate[problemIndex]["ProblemIndex"]
  250.  
  251. abody.setAttribute("href", contestUrl + t2rate[problemIndex]["ContestSlug"])
  252. abody.setAttribute("target", "_blank")
  253. abody.removeAttribute("hidden")
  254.  
  255. abody2.setAttribute("href", contestUrl + t2rate[problemIndex]["ContestSlug"] + "/problems/" + t2rate[problemIndex]["TitleSlug"])
  256. abody2.setAttribute("target", "_blank")
  257. abody2.removeAttribute("hidden")
  258. } else {
  259. span.innerText = "Unknown"
  260. abody.setAttribute("href", "")
  261. abody.setAttribute("target", "_self")
  262. abody.setAttribute("hidden", "true")
  263.  
  264. span2.innerText = "Unknown"
  265. abody2.setAttribute("href", "")
  266. abody2.setAttribute("target", "_self")
  267. abody2.setAttribute("hidden", "true")
  268. }
  269. abody.appendChild(span)
  270. abody2.appendChild(span2)
  271. pa.appendChild(abody)
  272. pa.appendChild(abody2)
  273. } else if (q.textContent.charAt(0) == "Q" || q.textContent == "未知") { // 存在就直接替换
  274. if (t2rate[problemIndex] != undefined) {
  275. let contestUrl;
  276. let num = getcontestNumber(t2rate[problemIndex]["ContestSlug"])
  277. contestUrl = url
  278. pa.childNodes[le - 2].childNodes[0].innerText = t2rate[problemIndex]["ContestID_en"]
  279. pa.childNodes[le - 2].setAttribute("href", contestUrl + t2rate[problemIndex]["ContestSlug"])
  280. pa.childNodes[le - 2].setAttribute("target", "_blank")
  281. pa.childNodes[le - 2].removeAttribute("hidden")
  282.  
  283. pa.childNodes[le - 1].childNodes[0].innerText = t2rate[problemIndex]["ProblemIndex"]
  284. pa.childNodes[le - 1].setAttribute("href", contestUrl + t2rate[problemIndex]["ContestSlug"] + "/problems/" + t2rate[problemIndex]["TitleSlug"])
  285. pa.childNodes[le - 1].setAttribute("target", "_blank")
  286. pa.childNodes[le - 1].removeAttribute("hidden")
  287. } else {
  288. pa.childNodes[le - 2].childNodes[0].innerText = "unknown"
  289. pa.childNodes[le - 2].setAttribute("href", "")
  290. pa.childNodes[le - 2].setAttribute("target", "_self")
  291. pa.childNodes[le - 2].setAttribute("hidden", "true")
  292.  
  293. pa.childNodes[le - 1].childNodes[0].innerText = "unknown"
  294. pa.childNodes[le - 1].setAttribute("href", "")
  295. pa.childNodes[le - 1].setAttribute("target", "_self")
  296. pa.childNodes[le - 1].setAttribute("hidden", "true")
  297. }
  298. }
  299. t1 = deepclone(id)
  300.  
  301. } else {
  302. // 旧版逻辑,使用参数t和t1,分别代表标题的html和标题id
  303.  
  304. // 旧版题目左侧列表里面所有分数
  305. let pbAll = document.querySelector("body > div.question-picker-detail__2A9V.show__GfjG > div.question-picker-detail-menu__3NQq.show__3hiR > div.lc-theme-dark.question-picker-questions-wrapper__13qM > div")
  306. if (pbAll != undefined) {
  307. let childs = pbAll.childNodes
  308. for (const element of childs) {
  309. let v = element
  310. let length = v.childNodes.length
  311. let t = v.childNodes[0].childNodes[1].innerText
  312. let data = t.split(" ")[0]
  313. let id = data.slice(1)
  314. let nd = v.childNodes[length - 1].childNodes[0].innerText
  315. if (t2rate[id] != undefined) {
  316. nd = t2rate[id]["Rating"]
  317. v.childNodes[length - 1].childNodes[0].innerText = nd
  318. }
  319. }
  320. }
  321. // 旧版标题修改位置
  322. let data = t.innerText.split(".")
  323. let id = data[0].trim()
  324. let colorSpan = document.querySelector("#app > div > div.main__2_tD > div.content__3fR6 > div > div.side-tools-wrapper__1TS9 > div > div.css-1gd46d6-Container.e5i1odf0 > div.css-jtoecv > div > div.tab-pane__ncJk.css-1eusa4c-TabContent.e5i1odf5 > div > div.css-101rr4k > div.css-10o4wqw > div")
  325. let pa = colorSpan.parentNode
  326. if ((t1 != undefined && t1 == id) && (le != undefined && le <= pa.childNodes.length)) {
  327. return
  328. }
  329. // 统计难度分数
  330. let nd = colorSpan.getAttribute("diff")
  331. let nd2ch = { "easy": "Easy", "medium": "Medium", "hard": "Hard" }
  332. if (t2rate[id] != undefined) {
  333. colorSpan.innerHTML = t2rate[id]["Rating"]
  334. } else {
  335. colorSpan.innerHTML = nd2ch[nd]
  336. }
  337. // 准备做周赛链接,如果已经不存在组件就执行操作
  338. let url = "https://leetcode.com/contest/"
  339. let zhUrl = "https://leetcode.com/contest/"
  340. if (le == undefined || le != pa.childNodes.length) {
  341.  
  342. let button = document.createElement("button")
  343. button.setAttribute("class", "btn__r7r7 css-1rdgofi")
  344. let abody = document.createElement("a")
  345. abody.setAttribute("style", "color: #546E7A;")
  346.  
  347. let button2 = document.createElement("button")
  348. button2.setAttribute("class", "btn__r7r7 css-1rdgofi")
  349. let abody2 = document.createElement("a")
  350. abody2.setAttribute("style", "color: #546E7A;")
  351.  
  352. // ContestID_en ContestSlug
  353. if (t2rate[id] != undefined) {
  354. let contestUrl;
  355. let num = getcontestNumber(t2rate[id]["ContestSlug"])
  356. if (num < 83) { contestUrl = zhUrl } else { contestUrl = url }
  357. abody.innerText = t2rate[id]["ContestID_en"]
  358. abody2.innerText = t2rate[id]["ProblemIndex"]
  359.  
  360. abody.setAttribute("href", contestUrl + t2rate[id]["ContestSlug"])
  361. abody.setAttribute("target", "_blank")
  362. abody.removeAttribute("hidden")
  363.  
  364. abody2.setAttribute("href", contestUrl + t2rate[id]["ContestSlug"] + "/problems/" + t2rate[id]["TitleSlug"])
  365. abody2.setAttribute("target", "_blank")
  366. abody2.removeAttribute("hidden")
  367. } else {
  368. span.innerText = "对应周赛未知"
  369. abody.setAttribute("href", "")
  370. abody.setAttribute("target", "_self")
  371. abody.setAttribute("hidden", "true")
  372.  
  373. span2.innerText = "未知"
  374. abody2.setAttribute("href", "")
  375. abody2.setAttribute("target", "_self")
  376. abody2.setAttribute("hidden", "true")
  377. }
  378.  
  379. button.appendChild(abody)
  380. button2.appendChild(abody2)
  381. pa.appendChild(button)
  382. pa.appendChild(button2)
  383. } else if (le == pa.childNodes.length) { // 存在就直接替换
  384. if (t2rate[id] != undefined) {
  385. let contestUrl;
  386. let num = getcontestNumber(t2rate[id]["ContestSlug"])
  387. if (num < 83) { contestUrl = zhUrl } else { contestUrl = url }
  388. pa.childNodes[le - 2].childNodes[0].innerText = t2rate[id]["ContestID_en"]
  389. pa.childNodes[le - 2].setAttribute("href", contestUrl + t2rate[id]["ContestSlug"])
  390. pa.childNodes[le - 2].setAttribute("target", "_blank")
  391. pa.childNodes[le - 2].removeAttribute("hidden")
  392.  
  393. pa.childNodes[le - 1].childNodes[0].childNodes[0].innerText = t2rate[id]["ProblemIndex"]
  394. pa.childNodes[le - 1].childNodes[0].setAttribute("href", contestUrl + t2rate[id]["ContestSlug"] + "/problems/" + t2rate[id]["TitleSlug"])
  395. pa.childNodes[le - 1].childNodes[0].setAttribute("target", "_blank")
  396. pa.childNodes[le - 1].childNodes[0].removeAttribute("hidden")
  397. } else {
  398. pa.childNodes[le - 2].childNodes[0].innerText = "对应周赛未知"
  399. pa.childNodes[le - 2].setAttribute("href", "")
  400. pa.childNodes[le - 2].setAttribute("target", "_self")
  401. pa.childNodes[le - 2].setAttribute("hidden", "true")
  402.  
  403. pa.childNodes[le - 1].childNodes[0].childNodes[0].innerText = "未知"
  404. pa.childNodes[le - 1].childNodes[0].setAttribute("href", "")
  405. pa.childNodes[le - 1].childNodes[0].setAttribute("target", "_self")
  406. pa.childNodes[le - 1].childNodes[0].setAttribute("hidden", "true")
  407. }
  408. }
  409. */
  410. // le = pa.childNodes.length
  411. t1 = deepclone(id)
  412. }
  413. } catch (e) {
  414. return
  415. }
  416. }
  417.  
  418. t2rate = JSON.parse(GM_getValue("t2ratedb", "{}").toString())
  419. latestpb = JSON.parse(GM_getValue("latestpb", "{}").toString())
  420. preDate = GM_getValue("preDate", "")
  421. let now = getCurrentDate(1)
  422. if (t2rate["tagVersion"] == undefined || (preDate == "" || preDate != now)) {
  423. GM_xmlhttpRequest({
  424. method: "get",
  425. url: 'https://raw.githubusercontents.com/zerotrac/leetcode_problem_rating/main/data.json' + "?timeStamp=" + new Date().getTime(),
  426. headers: {
  427. "Content-Type": "application/x-www-form-urlencoded"
  428. },
  429. onload: function (res) {
  430. if (res.status === 200) {
  431. // 保留唯一标识
  432. t2rate = {}
  433. let dataStr = res.response
  434. let json = eval(dataStr)
  435. for (const element of json) {
  436. t2rate[element.ID] = element
  437. t2rate[element.ID]["Rating"] = Number.parseInt(Number.parseFloat(element["Rating"]) + 0.5)
  438. }
  439. t2rate["tagVersion"] = {}
  440. console.log("everyday getdate once...")
  441. preDate = now
  442. GM_setValue("preDate", preDate)
  443. GM_setValue("t2ratedb", JSON.stringify(t2rate))
  444. }
  445. },
  446. onerror: function (err) {
  447. console.log('error')
  448. console.log(err)
  449. }
  450. });
  451. }
  452.  
  453. function clearAndStart(start, func, timeout) {
  454. let lst = ['all', 'tag', 'pb', 'company', 'pblist', 'search']
  455. lst.forEach(each => {
  456. if (each !== start) {
  457. let tmp = GM_getValue(each, -1)
  458. clearInterval(tmp)
  459. }
  460. })
  461. if (start !== "") {
  462. let cnt = lst.indexOf(start) + 1
  463. switch (cnt) {
  464. case 1:
  465. id1 = setInterval(func, timeout)
  466. GM_setValue(start, id1)
  467. break
  468. case 2:
  469. id2 = setInterval(func, timeout)
  470. GM_setValue(start, id2)
  471. break
  472. case 3:
  473. id3 = setInterval(func, timeout)
  474. GM_setValue(start, id3)
  475. break
  476. case 4:
  477. id4 = setInterval(func, timeout)
  478. GM_setValue(start, id4)
  479. break
  480. case 5:
  481. id5 = setInterval(func, timeout)
  482. GM_setValue(start, id5)
  483. break
  484. case 6:
  485. id6 = setInterval(func, timeout)
  486. GM_setValue(start, id6)
  487. break
  488. }
  489. }
  490. }
  491.  
  492. [...document.querySelectorAll('*')].forEach(item => {
  493. item.oncopy = function (e) {
  494. e.stopPropagation();
  495. }
  496. });
  497.  
  498. if (window.location.href.startsWith(allUrl)) {
  499. // 版本更新机制
  500. GM_xmlhttpRequest({
  501. method: "get",
  502. url: 'https://raw.githubusercontents.com/zhang-wangz/LeetCodeRating/english/version.json' + "?timeStamp=" + new Date().getTime(),
  503. headers: {
  504. "Content-Type": "application/x-www-form-urlencoded"
  505. },
  506. onload: function (res) {
  507. if (res.status === 200) {
  508. console.log("enter home page check version once...")
  509. let dataStr = res.response
  510. let json = JSON.parse(dataStr)
  511. let v = json["version"]
  512. let upcontent = json["content"]
  513. if (v != version) {
  514. layer.open({
  515. content: '<pre style="color:#000">Update notice: <br/>leetcodeRating difficulty plugin has a new version, please go to update ~ <br/>' + "update content: <br/>" + upcontent + "</pre>",
  516. yes: function (index, layer0) {
  517. let c = window.open("https://raw.githubusercontents.com/zhang-wangz/LeetCodeRating/english/leetcodeRating_greasyfork.user.js" + "?timeStamp=" + new Date().getTime())
  518. c.close()
  519. layer.close(index)
  520. }
  521. });
  522. } else {
  523. console.log("leetcodeRating difficulty plugin is currently the latest version~")
  524. }
  525. }
  526. },
  527. onerror: function (err) {
  528. console.log('error')
  529. console.log(err)
  530. }
  531. });
  532. clearAndStart('all', getData, 1)
  533. } else if (window.location.href.startsWith(tagUrl)) {
  534. clearAndStart('tag', getTagData, 1)
  535. } else if (window.location.href.startsWith(pbUrl)) {
  536. clearAndStart('pb', getpb, 1)
  537. let id = setInterval(getData, 1)
  538. GM_setValue("all", id)
  539. } else if (window.location.href.startsWith(pblistUrl)) {
  540. clearAndStart('pblist', getPblistData, 1)
  541. } else {
  542. clearAndStart('', undefined, 1)
  543. }
  544. })();

QingJ © 2025

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