Remove Ignored Posts and Comments

Удаляет комментарии и посты с классом "ignored"

  1. // ==UserScript==
  2. // @name Remove Ignored Posts and Comments
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.0
  5. // @description Удаляет комментарии и посты с классом "ignored"
  6. // @author eretly
  7. // @match https://lolz.live/*
  8. // @license MIT
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. function removeIgnoredElements() {
  16. const ignoredElements = document.querySelectorAll('.ignored');
  17. ignoredElements.forEach(element => {
  18. if (element.closest('li.message, li.comment, li.messageSimple')) {
  19. element.closest('li.message, li.comment, li.messageSimple').remove();
  20. } else {
  21. element.style.display = 'none';
  22. }
  23. });
  24. }
  25.  
  26. removeIgnoredElements();
  27.  
  28. const observer = new MutationObserver(() => {
  29. removeIgnoredElements();
  30. });
  31.  
  32. observer.observe(document.body, { childList: true, subtree: true });
  33. })();