Created
May 18, 2022 07:28
-
-
Save ComiR/7f36f2f04a27e3e3e1efb85f9669262b to your computer and use it in GitHub Desktop.
GitHub PR: always load more
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
// ==UserScript== | |
// @name GitHub PR: always load more | |
// @description Always loads everything in a pull request | |
// @author ComiR | |
// @version dev | |
// @match https://github.com/*/*/pull/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const start = () => { | |
const conversationTab = document.querySelectorAll('#partial-discussion-header + .tabnav a')[0]; | |
if (conversationTab.classList.contains('selected')) { | |
load(); | |
} | |
} | |
const load = () => { | |
const loadMore = document.querySelectorAll('.ajax-pagination-btn:not(.color-fg-muted)'); | |
if (loadMore.length !== 0) { | |
console.log('Found ' + loadMore.length + ' "load more". Clicking...'); | |
for (const button of loadMore) { | |
button.click(); | |
} | |
setTimeout(load, 500); | |
return; | |
} | |
console.log('No pagination present'); | |
}; | |
setTimeout(start, 1000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment