[GreaseMonkey Script] Load all hidden Github comments in long thread

This is not strictly related to Rust - however, I've had this come up frequently when reading RFC threads.

When a Github issue/PR thread gets over a certain length, Github will hide some of the comments on page load. To see all comments, it's necessary to repeatedly click on a "Show hidden" button, waiting after each click for a new set of comments to load.

This can be extremely frustrating when reading an RFC PR, as discussions frequently grow to hundreds of comments in length. I've seen the same point be brought up multiple times in a single thread, since searching for the previous occurrence would require clicking on "Show hidden" multiple times.

I've created a simple GreaseMonkey script which automatically loads all hidden comments on page load. I find that this makes long discussions much easier to read and search through. Hopefully, other people find this useful as well:

https://greasyfork.org/en/scripts/397376-github-load-all-comments

If you have any ideas for how to improve this, please let me know!

18 Likes

I was excited to try this out on the stress test PR...:

...but it doesn't seem to load all 600+ comments?

3 Likes

It looks like the undocumented API endpoint allows loading a maximum of 250 comments at once. I'm working on an update that will repeatedly load comments in chunks of 250.

7 Likes

That's great! I think we could improve the match part, something like:

// @match        https://github.com/*/*/issues/*
// @match        https://github.com/*/*/pull/*

Actually, current match is wide a bit and seems to cause unexpected expandation on some pages (e.g. profile page). I forked your repository then I noticed it didn't contain the source, so leaving comment here.

I use GitHub PR: expand, expand, expand! for this, which seems to serve the same purpose. I tested it on the "Allow non-ASCII identifiers" pull request and it expanded all the comments, so maybe it's worth using that one rather than duplicating the work :slight_smile:

8 Likes

This is great, thanks a lot :slight_smile:

Wait so they have an internal API that loads 250 comments but when I click "load more" they'll only load around 80 or so because I like clicking so much? :angry:

6 Likes