Created
March 2, 2017 18:42
Star
You must be signed in to star a gist
Github PR bookmarklet: Load all file diffs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: | |
document.querySelectorAll('.load-diff-button').forEach(node => node.click()) |
Well, that really must be a massive PR.
Mine was ~1.6k files changed and I never hit that...
Woah, I guess we could batch the requests for x files at a time? Might seem a bit excessive for a bookmark though. Up to anyone else if they want to improve on the script.
Thanks! I just put the Javascript in my browser URI field and voila!
I had to modify a little:
Array.from(document.getElementsByClassName('load-diff-button')).map(button => button.click())`
The original from 2017 above seems to work for me. Thanks!
This didn't work for me on a PR with 1200 files changed, so I came up with this code that I ran from the console. I ran it with up to 50 files at a time (in the slice and splice) with great success!
// Find all files in the PR
let files = Array.from(document.querySelectorAll('.file'));
// Filter by the files that aren't reviewed already
let filteredFiles = files.filter(file => !file.querySelector('.js-reviewed-checkbox').checked);
// Load the next 10 files
filteredFiles.slice(0, 10).forEach(file => file.querySelector('.load-diff-button').click());
// After reviewing all 10 files, run these commands to mark them as reviewed
// and delete them from the filtered array
filteredFiles.slice(0, 10).forEach(file => file.querySelector('.js-reviewed-checkbox').click());
filteredFiles.splice(0, 10);
Niiice :) It worked for 600 files / 3k lines changed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ah ha!