Remove Specific Elements from truyenwikidich.net

删除特定页面上的指定元素

当前为 2024-07-20 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Remove Specific Elements from truyenwikidich.net
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description 删除特定页面上的指定元素
  6. // @author Your Name
  7. // @match https://truyenwikidich.net/truyen*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. // 等待页面完全加载后删除元素
  15. window.addEventListener('load', function() {
  16. // 删除第一个元素
  17. var element1 = document.evaluate('/html/body/main/div[2]/div[3]/div[1]/div[2]/div[1]/div[1]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  18. if (element1) {
  19. element1.remove();
  20. }
  21.  
  22. // 删除第二个元素
  23. var element2 = document.evaluate('/html/body/div[8]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  24. if (element2) {
  25. element2.remove();
  26. }
  27.  
  28. // 删除第三个元素
  29. var element3 = document.evaluate('/html/body/main/div[2]/div[3]/div[1]/div[2]/div[2]/div', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  30. if (element3) {
  31. element3.remove();
  32. }
  33. });
  34. })();