Greasy Fork is available in English.

Show all Jira Cloud comments (and more)

Clicks all 'View ... remaining ...' buttons. Works on Jira Cloud as of January 2025. Inspired by https://greasyfork.org/scripts/432731 (no external dependencies).

// ==UserScript==
// @name        Show all Jira Cloud comments (and more)
// @namespace   https://greasyfork.org/users/1047370
// @description Clicks all 'View ... remaining ...' buttons. Works on Jira Cloud as of January 2025. Inspired by https://greasyfork.org/scripts/432731 (no external dependencies).
// @include     https://jira.*
// @include     http://jira.*
// @include     https://*.atlassian.net/jira/*
// @include     https://*.atlassian.net/browse/*
// @include     https://*.atlassian.net/issues/*
// @match       https://jira.*
// @match       http://jira.*
// @match       https://*.atlassian.net/jira/*
// @match       https://*.atlassian.net/browse/*
// @match       https://*.atlassian.net/issues/*
// @version     0.2
// @author      Marnix Klooster <[email protected]>
// @copyright   public domain
// @license     public domain
// @homepage    https://greasyfork.org/scripts/518853
// @grant       none
// ==/UserScript==

(function() {
    var theInterval = null;
    var lastClickedButton = null;

    function start() {
        if (theInterval) {
            console.log(`SOMETHING WENT WRONG.  Ignoring this call to start().`);
            return;
        }

        theInterval = setInterval(function() {
            // click any 'View ... remaining ...' or 'Load more' button in sight...
            var remainingButtons = document.querySelectorAll(
                [
                    '[data-testid="issue.activity.common.component.load-more-button.loading-button"]',
                    '[data-testid="issue-history.ui.history-items.load-more-button"]>button',
                ].join(','));
            if (lastClickedButton) {
                for (var b of remainingButtons) {
                    if (b.isSameNode(lastClickedButton)) {
                        console.log(`waiting for last click to have been handled`);
                        return;
                    }
                }
                lastClickedButton = null;
                console.log(`wait one more round, just to be certain, before we potentially click other buttons`);
                return;
            }
            if (remainingButtons.length > 0) {
                lastClickedButton = remainingButtons[0];
                console.log(`Clicking the button marked "${lastClickedButton.innerText}"...`);
                lastClickedButton.click();
                return;
            }
        }, 1000);
    }

    start();
})();