Atlassian JIRA - Auto-expand Issue Links

Automatically expands the Issue Links list. By default, it's 5 and it's hardcoded: https://community.atlassian.com/t5/Jira-questions/Is-it-possible-to-change-the-number-of-Issue-Links-that-display/qaq-p/103076

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Atlassian JIRA - Auto-expand Issue Links
// @description  Automatically expands the Issue Links list. By default, it's 5 and it's hardcoded: https://community.atlassian.com/t5/Jira-questions/Is-it-possible-to-change-the-number-of-Issue-Links-that-display/qaq-p/103076
// @include      https://jira.*
// @include      http://jira.*
// @match        https://jira.*
// @match        http://jira.*
// @version      0.2
// @require      https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js
// @namespace    https://greasyfork.org/users/741506
// @icon         https://jira.atlassian.com/favicon.ico
// ==/UserScript==

/* Notes */
// scripts/5392-waitforkeyelements was delete for unknown reason.
// I've copied/pasted the script content here.
/* eslint-env jquery */
/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts, that detects and handles AJAXed content.
Usage example:
waitForKeyElements ("div.comments", commentCallbackFunction);
//--- Page-specific function to do what we want when the node is found.
function commentCallbackFunction (jNode) {
    jNode.text ("This comment changed by waitForKeyElements().");
}
IMPORTANT: This function requires your script to have loaded jQuery.
*/

function waitForKeyElements(
selectorTxt, /* Required: The jQuery selector string that specifies the desired element(s). */
 actionFunction, /* Required: The code to run when elements are found. It is passed a jNode to the matched element. */
 bWaitOnce, /* Optional: If false, will continue to scan for new elements even after the first match is found. */
 iframeSelector /* Optional: If set, identifies the iframe to search. */
) {
    var targetNodes, btargetsFound;

    if (typeof iframeSelector == "undefined") {
        targetNodes = $(selectorTxt);
    } else {
        targetNodes = $(iframeSelector).contents().find(selectorTxt);
    }

    if (targetNodes && targetNodes.length > 0) {
        btargetsFound = true;
        /*--- Found target node(s). Go through each and act if they are new. */
        targetNodes.each(function() {
            var jThis = $(this);
            var alreadyFound = jThis.data('alreadyFound') || false;

            if (!alreadyFound) {
                //--- Call the payload function.
                var cancelFound = actionFunction(jThis);
                if (cancelFound) {
                    btargetsFound = false;
                } else {
                    jThis.data('alreadyFound', true);
                }
            }
        });
    }
    else {
        btargetsFound = false;
    }

    //--- Get the timer-control variable for this selector.
    var controlObj = waitForKeyElements.controlObj || {};
    var controlKey = selectorTxt.replace(/[^\w]/g, "_");
    var timeControl = controlObj[controlKey];

    //--- Now set or clear the timer as appropriate.
    if (btargetsFound && bWaitOnce && timeControl) {
        //--- The only condition where we need to clear the timer.
        clearInterval(timeControl);
        delete controlObj[controlKey];
    } else {
        //--- Set a timer, if needed.
        if (!timeControl) {
            timeControl = setInterval(function () { waitForKeyElements(selectorTxt, actionFunction, bWaitOnce, iframeSelector); }, 300);
            controlObj[controlKey] = timeControl;
        }
    }
    waitForKeyElements.controlObj = controlObj;
}

function clickWhenItAppears(jNode) {
    var clickEvent = document.createEvent('MouseEvents');
    clickEvent.initEvent('click', true, true);
    jNode[0].dispatchEvent(clickEvent);
}

waitForKeyElements("button[id='show-more-links-link']", clickWhenItAppears);