Skip to content

Instantly share code, notes, and snippets.

@monperrus
Last active September 8, 2024 08:32
Show Gist options
  • Save monperrus/a094ccf2941c4c76f4ea77cec252ad77 to your computer and use it in GitHub Desktop.
Save monperrus/a094ccf2941c4c76f4ea77cec252ad77 to your computer and use it in GitHub Desktop.
Showing all hidden comments on Github

Problem

Github collapses comments when there are too many.

When you open a page and Ctrl-F, you don't find what you want.

Solution

Automatically loads all comments at page start with Greasemonkey / Tampermonhey / Violentmonkey userscript:
https://gist.github.com/monperrus/4f3fa3ecd4fcc9c617734acb7069869c

See also

Refined-github almost supports this, if you click on any "Load more" button while holding the alt key, everything is loaded. Still requires a manual action.

https://github.com/ludios/expand-everything does it for many websites

https://github.com/glemaitre/userscripts/blob/master/github-expand-all.user.js registers a keyboard shortcut to expands all outdated comments.

https://github.com/findepi/user.js/blob/master/github-expand-expand-expand.user.js adds a button expand expand

Debug

The button to click is

<button type="submit" class="ajax-pagination-btn no-underline pb-1 pt-0 px-4 mt-0 mb-1 color-bg-default border-0" data-disable-with="Loading…">
            Load more…
          </button>

Part of

<form class="ajax-pagination-form js-ajax-pagination pagination-loader-container mt-4 mb-4 ml-0 text-center" data-turbo="false" action="/ASSERT-KTH/software-engineering-research/issues/4/partials/load_more?after_cursor=Y3Vyc29yOnYyOpPPAAABcDVxCAgAqTU4NDc3MzcyNQ%3D%3D&amp;before_cursor=Y3Vyc29yOnYyOpPPAAABjRI1kUgAqjE4OTM2MzE2MDM%3D" accept-charset="UTF-8" method="get">
...
</form>

when one clicks, it creates a call to

  • https://github.com/<org>/<repo>/issues/4/partials/load_more?after_cursor=<before_cursor>&before_cursor=<after_cursor> example

Test pages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment