NoHeisePlus

Remove Heise+ links

当前为 2021-04-27 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @author Tobias Becker
  3. // @name NoHeisePlus
  4. // @description Remove Heise+ links
  5. // @match https://www.heise.de/*
  6. // @version 1
  7. // @grant none
  8. // @namespace https://cmdq.org/greasemonkey/NoHeisePlus
  9. // ==/UserScript==
  10.  
  11. walkUp = function(element) {
  12. if (element === null) {
  13. return element;
  14. }
  15. if (element.nodeName === "ARTICLE") {
  16. return element;
  17. }
  18. return walkUp(element.parentElement);
  19. };
  20.  
  21.  
  22. // Start from the logos as seeds:
  23. logos = document.getElementsByClassName("heiseplus-logo-small");
  24.  
  25. // Go up to the blocks.
  26. blocks = new Set();
  27. for (const elm of logos) {
  28. parent = walkUp(elm);
  29. if (parent !== null) {
  30. blocks.add(parent);
  31. }
  32. }
  33.  
  34. // Now remove all unique ones.
  35. for (const block of blocks) {
  36. block.remove();
  37. }
  38.  
  39. // And lastly that remaining empty stage:
  40. for (const stage of document.getElementsByClassName("stage--heiseplus")) {
  41. stage.remove();
  42. }