Guest User

Pagebound: auto-reveal spoilers

a guest
Sep 23rd, 2026
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Pagebound: auto-reveal spoilers
  3. // @match https://pagebound.co/*
  4. // @run-at document-idle
  5. // @grant none
  6. // ==/UserScript==
  7.  
  8. (function () {
  9. 'use strict';
  10.  
  11. const SPOILER_BUTTON_SELECTOR = 'div[aria-hidden="true"].blur-md + button';
  12. const clickedButtons = new WeakSet();
  13. let scanScheduled = false;
  14.  
  15. function isOnFeedPage() {
  16. return location.pathname.startsWith('/feed');
  17. }
  18.  
  19. function clickUnclickedSpoilerButtons() {
  20. scanScheduled = false;
  21. if (!isOnFeedPage()) return;
  22.  
  23. document.querySelectorAll(SPOILER_BUTTON_SELECTOR).forEach((button) => {
  24. if (clickedButtons.has(button)) return;
  25. clickedButtons.add(button);
  26. button.click();
  27. });
  28. }
  29.  
  30. function scheduleScan() {
  31. if (scanScheduled) return;
  32. scanScheduled = true;
  33. requestAnimationFrame(clickUnclickedSpoilerButtons);
  34. }
  35.  
  36. new MutationObserver(scheduleScan).observe(document.body, {
  37. childList: true,
  38. subtree: true,
  39. });
  40.  
  41. scheduleScan();
  42. })();
Add Comment
Please, Sign In to add comment