Snippets

Mythics Jira - auto-refresh issues list

Created by Jonathan Hult last modified
// Only on issues list
if (/^(\/issues\/)/i.test(location.pathname)) {

    var AutoRefreshIssuesList = AutoRefreshIssuesList || {};

    // Main function
    AutoRefreshIssuesList.init = function() {

        // Wait until page is loaded
        AJS.toInit(function() {
            // Wait for 60 seconds before calling setInterval which fires immediately
            setTimeout(function() {
                // Refresh table every 60 seconds
                setInterval(function() {
                    AutoRefreshIssuesList.refresh();
                }, 60000);
            }, 60000);
        });
    };
    
    // Refresh function - must use this to again test URL since AJAX can otherwise allow refreshes where we don't want
    AutoRefreshIssuesList.refresh = function() {
        if (/^(\/issues\/)/i.test(location.pathname)) {
            AJS.$(".refresh-table").click();
        }
    }

    // Fire on initial page load
    AutoRefreshIssuesList.init();
}

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.