移除困难的

移除困难的 Leetcode 题目

  1. // ==UserScript==
  2. // @name remove difficult
  3. // @name:zh-CN 移除困难的
  4. // @namespace mailto: 1405056768@qq.com
  5. // @version 0.0.11
  6. // @license MIT
  7. // @description remove difficult Problems
  8. // @description:zh-CN 移除困难的 Leetcode 题目
  9. // @author 1405056768
  10. // @match https://leetcode.cn/problemset/*
  11. // @match https://leetcode.cn/tag/*
  12. // @match https://leetcode.cn/problem-list/*
  13. // @match https://leetcode.com/problemset/*
  14. // @match https://leetcode.com/problem-list/*
  15. // @match https://leetcode.cn/search/?q=*
  16. // @icon https://www.google.com/s2/favicons?sz=64&domain=leetcode.cn
  17. // @grant none
  18. // ==/UserScript==
  19.  
  20. (function() {
  21. 'use strict';
  22. main();
  23. })();
  24.  
  25. function main() {
  26. setInterval(remove, 3000);
  27. }
  28.  
  29. function remove() {
  30. // 查找所有包含特定 span 的元素
  31. const spans = document.querySelectorAll('span.text-red-s');
  32.  
  33. // 遍历每个找到的 span
  34. spans.forEach(span => {
  35. // 获取 span 的父节点
  36. const parentNode = span.parentNode;
  37. // 获取父节点的父节点
  38. const grandParentNode = parentNode.parentNode;
  39. // 隐藏父节点的父节点
  40. grandParentNode.style.display = 'none';
  41. });
  42. }