Repository navigation
Add expand-all-collapsed-code feature - #2434
Conversation
There was a problem hiding this comment.
A few notes:
- use for-of instead of forEach
- don’t use
subtree: true, listen to some GitHub events instead, or observe elements more selectively - if you need MutationObserver, declare one in the module’s scope and then
.observe()elements later - use
select-dominstead of querySelector* - use
delegate-itinstead of listening on each element
|
Can you suggest to what events should I listen? I checked Also, I'm not very experienced with Github, so I want to ask at what pages this feature should be present at. Ideally I would like to just get the necessary |
expand-all-collapsed-code feature (#2151)expand-all-collapsed-code feature
fregante
left a comment
There was a problem hiding this comment.
I think it's almost done ^__^
Thanks for the changes
Co-Authored-By: Federico Brigante <[email protected]>
Since there's only ever one element observed at once, the `mutations` array will only have one element.
|
Thank you! This works correctly. On a slow connection it might take a bit to expand a whole file but it's not terribly annoying, just a bit slow. |
|
Some distros have already alt click actions bound. |
|
I'm interested in that feature and as I see this has been merged I still can't unfold all folded files with ALT+click. |
|
single works as in the demo, but the feature title says expand-all-collapsed-code |
|
It does not work for me, not even for a single file. I've tried Firefox and Chrome. Alt+mouse click on the icon within file only expands that one code block and only once. In order to see one entire file expanded I still have to repeatedly click the expand icon. I've read through the comments above as well as the comments in #2151 |

Closes #2151
I used the easier solution of clicking on expand buttons until none left, with observing DOM changes via MutationObserver to trigger the subsequent clicks. I also included this script on single commit pages.
Test
Alt-click on any expand button on PR commit or single commit page. Try doing simple clicks and then alt-click.
Files tab on PRs: https://github.com/sindresorhus/refined-github/pull/2429/files
Single commits: 8a2c66c
PR commit: 8a2c66c
IssueHunt Summary
Referenced issues
This pull request has been submitted to:
IssueHunt has been backed by the following sponsors. Become a sponsor