Skip to content

Instantly share code, notes, and snippets.

@simevidas
Created February 6, 2024 20:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simevidas/52a37d7849de3d3855ea88822975fe3e to your computer and use it in GitHub Desktop.
Save simevidas/52a37d7849de3d3855ea88822975fe3e to your computer and use it in GitHub Desktop.
Load all comments
// ==UserScript==
// @name Load all comments
// @match https://github.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=github.com
// ==/UserScript==
(function() {
'use strict';
function start() {
let buttons = document.querySelectorAll('button');
let loaders = [];
for (let i = 0; i < buttons.length; i += 1) {
if (buttons[i].textContent.trim() == 'Load more%E2%80%A6') {
loaders.push(buttons[i]);
buttons[i].dispatchEvent(new MouseEvent('click', {
view: window,
bubbles: false
}))
}
}
if (loaders.length > 0) {
setTimeout(start, 5000)
}
}
setTimeout(start, 500);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment