Jira Table Counter

Displays the total amount of table columns

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

作者のサイトでサポートを受ける。または、このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name        Jira Table Counter
// @namespace   https://github.com/RayWangQvQ/Ray.Tampermonkey/
// @description Displays the total amount of table columns
// @include     https://*jira*
// @author      Ray
// @supportURL  https://github.com/RayWangQvQ/Ray.Tampermonkey/blob/main/JiraTableCounter/README.md
// @require     http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
// @require     https://greatest.deepsurf.us/scripts/383527-wait-for-key-elements/code/Wait_for_key_elements.js?version=701631
// @version     0.0.1
// @icon        https://raw.githubusercontent.com/RayWangQvQ/Ray.Tampermonkey/main/JiraStoryCounter/jira-software_logo.png
// @grant       none
// @license     MIT
// ==/UserScript==

this.$ = this.jQuery = jQuery.noConflict(true);

waitForKeyElements('.issue-table', getNumPoints);
waitForKeyElements('#issuetable', getNumPoints);

// jNode is the table
function getNumPoints(jNode) {
    var columns = {};

    // init header and set value = 0
    var columnHeaders = jNode.find('.rowHeader');
    columnHeaders.each(function () {
        $(this).children('th').each(function () {
            var id = $(this).attr('data-id');
            columns[id] = 0;
        });
    });

    // count
    var rows = jNode.find('.issuerow');
    rows.each(function () {
        var row = $(this);
        var tds = row.children('td');
        tds.each(function () {
            var td = $(this);
            var columnId = td.attr('class');
            var point = parseFloat(td.context.innerText || 0);

            if (point > 0) {
                columns[columnId] += point;
            }
        })
    });

    // append sum num to header
    columnHeaders.each(function () {
        $(this).children('th').each(function () {
            var id = $(this).attr('data-id');
            var totalCount = columns[id];
            if (totalCount > 0) {
                $(this).children('span').append(' (' + totalCount + ')');
            }
        });
    });
}