Created
February 6, 2024 20:53
-
-
Save simevidas/52a37d7849de3d3855ea88822975fe3e to your computer and use it in GitHub Desktop.
Load all comments
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 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