Patreon: Load and show all comments

On a post's page, this automates loading all the comments instead of requiring the user to click for each batch

  1. // ==UserScript==
  2. // @name Patreon: Load and show all comments
  3. // @namespace http://tampermonkey.net/
  4. // @version 2024.08.12
  5. // @description On a post's page, this automates loading all the comments instead of requiring the user to click for each batch
  6. // @author You
  7. // @match https://www.patreon.com/posts/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=patreon.com
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. function loaded(){
  14. let lmc = Array.from(document.querySelectorAll("div[data-tag='post-card'] button")).find(x=>x.innerText == "Load more comments");
  15. if(lmc){
  16. lmc.innerHTML = "Load ALL comments";
  17. let obs = new MutationObserver(mut => { if(mut[0].addedNodes.length>0 && lmc){lmc.click();} }); //auto click button after a batch of comments added
  18. obs.observe(lmc.parentElement.parentElement, { childList: true, subtree: true }); //each comment is a sibling of the parent div of the lmc button
  19. }
  20. }
  21. window.addEventListener('load', function() {
  22. setTimeout(loaded, 2000);
  23. })
  24. })();