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

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