Show all Jira Cloud comments (and more)

Clicks buttons like 'View ... remaining ...' and 'Show more replies'. Works on Jira Cloud as of May 2025. Inspired by https://greasyfork.org/scripts/432731 (no external dependencies).

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Show all Jira Cloud comments (and more)
// @namespace   https://greasyfork.org/users/1047370
// @description Clicks buttons like 'View ... remaining ...' and 'Show more replies'. Works on Jira Cloud as of May 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.6
// @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-view-activity-comment.comment-show-more-replies.show-more-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();
})();