Skip to content

Instantly share code, notes, and snippets.

@ComiR
Created May 18, 2022 07:28
Show Gist options
  • Save ComiR/7f36f2f04a27e3e3e1efb85f9669262b to your computer and use it in GitHub Desktop.
Save ComiR/7f36f2f04a27e3e3e1efb85f9669262b to your computer and use it in GitHub Desktop.
GitHub PR: always load more
// ==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