Hikouma

SG Hider

Jul 5th, 2025
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | Source Code | 0 0
  1. // ==UserScript==
  2. // @name 4chan Starlight Glimmer Hider
  3. // @namespace http://example.com/
  4. // @version 0.2
  5. // @match *://boards.4chan.org/*/*
  6. // @grant none
  7. // ==/UserScript==
  8. (function(){
  9. 'use strict';
  10. // CSS selector matching the Starlight Glimmer flag element
  11. const FLAG_SELECTOR = '.postContainer .bfl.bfl-stl[title="Starlight Glimmer"]';
  12.  
  13. // Hide any postContainer that contains the flag
  14. function hidePosts(root) {
  15. root.querySelectorAll(FLAG_SELECTOR).forEach(flag => {
  16. const post = flag.closest('.postContainer');
  17. if (post) post.style.display = 'none';
  18. });
  19. }
  20.  
  21. // Run on initial load
  22. hidePosts(document);
  23.  
  24. // Observe for new posts loaded dynamically
  25. new MutationObserver(muts => {
  26. muts.forEach(m => {
  27. m.addedNodes.forEach(node => {
  28. if (node.nodeType === 1) hidePosts(node);
  29. });
  30. });
  31. }).observe(document.body, { childList: true, subtree: true });
  32. })();
  33.  
Advertisement
Add Comment
Please, Sign In to add comment