Last active
May 18, 2024 03:20
-
-
Save daohoangson/c8c03f8f237ef635d7d7052b726716bc to your computer and use it in GitHub Desktop.
Expand all diffs in a GitHub PR https://geek.daohoangson.com/2024/05/code-snippet-expand-all-diffs-in-github.html
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
(async () => { | |
const unviewedDetails = [...document.querySelectorAll('.Details[data-file-type=".png"]')] | |
.filter(details => !details.hidden) | |
const loadDiffs = unviewedDetails.map(details => details.querySelector('.js-button-text')) | |
.filter(btn => btn !== null && btn.innerText === 'Load diff'); | |
for (const loadDiff of loadDiffs) { | |
loadDiff.click(); | |
await new Promise(r => setTimeout(r, 2000)); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment