When I am viewing a large code review in Differential, the page lags a lot unless I keep most of the files collapsed.
Unfortunately, the only way I could find to collapse all the files is to use the keyboard shortcuts for next file, and collapse repeatedly, once for each file.
Is it possible to collapse all files in relatively few clicks or keys?
On a related note, is it possible to default all diffs above a certain size to collapse all files?
I've run into similar issues and haven't found a good solution yet, so I wrote JavaScript that would go through and manually click the 'Collapse File' for each file in the diff on the page. I saved it as a browser bookmark for convenience (just copy/paste this code as a new bookmark in your browser). Hopefully this'll help you too, OP
javascript:(() => {
function collapseFiles() {
function clickCollapseFileViewOption() {
var viewOptionsHTMLCollection = document.getElementsByClassName("phabricator-action-view-item"),
viewOptionsArr = [].slice.call(viewOptionsHTMLCollection);
viewOptionsArr.find(viewOption => viewOption.text === 'Collapse File').click();
}
var buttonDivsHTMLCollection = document.getElementsByClassName("differential-changeset-buttons"),
buttonDivsArr = [].slice.call(buttonDivsHTMLCollection),
buttonAnchorsArr_unflattened = buttonDivsArr.map(buttonDiv => [].slice.call(buttonDiv.getElementsByTagName("a"))),
buttonAnchorsArr = [].concat.apply([], buttonAnchorsArr_unflattened);
buttonAnchorsArr.forEach((buttonAnchor, index) => {
setTimeout(function() {
this.click();
clickCollapseFileViewOption();
}.bind(buttonAnchor), 250 * index);
});
}
collapseFiles();
})();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With