Last active
November 24, 2019 00:23
-
-
Save james-s-tayler/4370ccfbfd47c031f923e0a26e4e0ef9 to your computer and use it in GitHub Desktop.
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
viewedFiles.forEach(viewedFile => { | |
const currentFile = document.querySelectorAll(`div[data-path="${viewedFile.path}"]`)[0] || undefined; | |
if(currentFile) { | |
let currentDiffstat = currentFile.querySelectorAll("span.diffstat")[0].getAttribute('aria-label'); | |
let match = viewedFile.diffstats === currentDiffstat; | |
console.log(`match: ${match} - ${viewedFile.path} - viewedDiffstat: ${viewedFile.diffstats}, currentDiffstat: ${currentDiffstat}`); | |
if(match) { | |
let checkbox = currentFile.querySelectorAll('input[type="checkbox"]')[0]; | |
let viewed = checkbox.checked || false; | |
if(!viewed) { | |
checkbox.click(); | |
console.log('changed to viewed!'); | |
} else { | |
console.log('already is viewed!'); | |
} | |
} | |
} else { | |
console.log(`match: skipped - ${viewedFile.path}`); | |
} | |
}); |
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
const diffHeaders = [...document.querySelectorAll("div.file-header")].map(node => ( | |
{ | |
path: node.attributes['data-path'].value, | |
diffstats: node.querySelectorAll("span.diffstat")[0].getAttribute('aria-label') | |
}) | |
); |
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
//run the diff-headers script to dump the list of viewed files into an array | |
//perform the actions stated here to transfer the data to another open PR | |
//run the dedupe script to mark as 'viewed' all the files that have matching pathnames + diffstats | |
JSON.stringify(diffHeaders); | |
switch tab -> | |
const diffHeaders = ... ctrl+v to paste the raw json, delete the outer most quotes and surround by `` | |
const viewedFiles = JSON.parse(diffHeaders); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment