Show all comments on github issue

Automatically clicks the "xxx hidden items" button on Github issue pages to successively load in all the comments in the page on load.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Show all comments on github issue
// @namespace    https://www.taylrr.co.uk
// @version      0.1
// @description  Automatically clicks the "xxx hidden items" button on Github issue pages to successively load in all the comments in the page on load.
// @author       taylor8294
// @match        https://github.com/*/issues/*
// @icon         https://icons.duckduckgo.com/ip2/github.com.ico
// @grant        none
// @license      GPLv3
// ==/UserScript==

(function() {
    'use strict';

    function ready(fn) {
        if (document.attachEvent ? document.readyState === "complete" : document.readyState !== "loading"){
            fn();
        } else {
            document.addEventListener('DOMContentLoaded', fn);
        }
    }

    function clickButton(){
        let button = document.querySelector('.ajax-pagination-form button');
        if(button){
            if(!button.disabled) button.click();
            setTimeout(clickButton,50);
        } else console.log('All comments are now showing.')
    }
    ready(()=>{setTimeout(clickButton,2000)});
})();