1

Given Reddit post which consist large amount of comments such as this one:

I'm looking for Chrome compatible extension to scan the page for 'load more comments' links and uncollapse/load them all.

I've checked Tampermonkey' user scripts at OpenUserJS, but I didn't find any suitable scripts.

Any suggestions?

1
  • Not an answer, but on the prowl for UserScripts you could also check with GreasyFork.
    – Izzy
    Jan 19, 2018 at 7:06

1 Answer 1

1

There is Reddit All Comments Viewer extension for Chrome web-browser. It adds a button to Load all comments on Reddit page.

GitHub page: https://github.com/shadyabhi/reddit-all-comments-viewer

Read more at: Reddit All Comments Viewer (Expand all comments in Reddit) (mirror).

Content Script used:

function runAgain(){
    //Run every one second
    window.setTimeout(addButton,1e3)
    }

function addButton(){
    //All buttons have class as "button"
    var first_button = document.getElementsByClassName("button")[0];
    if (first_button == null){
        alert("Sorry, no comments to expand");
        return;
    }

    if (first_button.innerHTML == "loading..."){
        first_button.className = ""; //To fix later
    }
    else{
       var theEvent = document.createEvent("MouseEvent");
       theEvent.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
       first_button.dispatchEvent(theEvent);
    }

    if(first_button.id) 
        runAgain();
    };

//Link created and added as child to "pane"
var pane = document.getElementsByClassName("panestack-title")[0];
var newlink = document.createElement("a");
newlink.appendChild(document.createTextNode("Load all comments"));
newlink.id = "loadmorecomments";
newlink.href = "javascript:void(0)";
newlink.className="title-button ";
newlink.title = 'Opens all "load more comments" link every 1 second';
newlink.addEventListener('click', runAgain, false);
pane.appendChild(newlink);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.