Last active
July 3, 2020 08:56
-
-
Save haridsv/7ffb51c1d8212e76bf21fc78e6c38984 to your computer and use it in GitHub Desktop.
Expand all pages ("Load more..." buttons) in a Github PR conversation view.
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
NOTE: Doesn't work because of github CSP meta tags. | |
javascript:s=document.createElement('script');s.type='text/javascript';document.body.appendChild(s);s.src='https://git.io/JJTwA';void(0); |
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
var tgtMutationCnt = 0; | |
var rcvdMutationCnt = 0; | |
var level = 0; | |
const observer = new MutationObserver(function(mutationsList, observer) { | |
++rcvdMutationCnt; | |
console.log("Current mutation count: " + rcvdMutationCnt + " target mutation count: " + tgtMutationCnt + " in level: " + level); | |
if (rcvdMutationCnt == tgtMutationCnt) { | |
++level; | |
console.log("Target mutation count achieved, checking if level: " + level + " exists"); | |
loadAll(); | |
} | |
}); | |
function loadAll() { | |
var paginationButtons = document.querySelectorAll(".ajax-pagination-btn"); | |
console.log("loadAll found " + paginationButtons.length + " buttons in level: " + level); | |
tgtMutationCnt += paginationButtons.length; | |
paginationButtons.forEach(l => { | |
observer.observe(l, { childList: true, subtree: true }); | |
l.click(); | |
}); | |
} | |
loadAll(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment