Last active
November 7, 2019 15:43
-
-
Save petitJAM/b722e657bc306c66d8336ee652d60c88 to your computer and use it in GitHub Desktop.
Bookmark JS for collapsing junk iOS files on GitHub PRs
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
/* | |
* Paste the following into a new bookmark, then click it on | |
* a GitHub PR to mark all the yucky Pod files as viewed. | |
*/ | |
javascript:Array.from(document.querySelectorAll('a[title*=".xcodeproj"],a[title$=".storyboard"],a[title$=".pbxproj"],a[title^="Pods/"],a[title="Podfile.lock"]')).map(el => el.closest('.file-header').querySelector('.js-reviewed-checkbox')).forEach(function(el, i) { if (!el.checked) { el.click() } }) | |
/* | |
* Readable version | |
*/ | |
// Make the bookmark run JavaScript | |
javascript: | |
// querySelectorAll returns a NodeList, so we need to convert that to an Array | |
Array.from( | |
// Find links with the appropriate titles | |
document.querySelectorAll( | |
'a[title*=".xcodeproj"],a[title$=".storyboard"],a[title$=".pbxproj"],a[title^="Pods/"],a[title="Podfile.lock"]' | |
) | |
) | |
// Map over the links and find the checkbox that's part of that file header | |
.map(el => el.closest('.file-header').querySelector('.js-reviewed-checkbox')) | |
// Click them if they're unchecked | |
.forEach(function(el, i) { if (!el.checked) { el.click() } }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment