移除困难的

移除困难的 Leetcode 题目

当前为 2025-02-12 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name remove difficult
  3. // @name:zh-CN 移除困难的
  4. // @namespace mailto: 1405056768@qq.com
  5. // @version 0.0.1
  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. // @icon https://www.google.com/s2/favicons?sz=64&domain=leetcode.cn
  16. // @grant none
  17. // ==/UserScript==
  18.  
  19. (function() {
  20. 'use strict';
  21. main();
  22. })();
  23.  
  24. function main() {
  25. setInterval(remove, 3000);
  26. }
  27.  
  28. function remove() {
  29. // 查找所有包含特定 span 的元素
  30. const spans = document.querySelectorAll('span.text-red-s');
  31.  
  32. // 遍历每个找到的 span
  33. spans.forEach(span => {
  34. // 获取 span 的父节点
  35. const parentNode = span.parentNode;
  36. // 获取父节点的父节点
  37. const grandParentNode = parentNode.parentNode;
  38. // 隐藏父节点的父节点
  39. grandParentNode.style.display = 'none';
  40. });
  41. }