Skip to content

Instantly share code, notes, and snippets.

@ilevantis
Last active October 13, 2021 08:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilevantis/98fc8762727f69f14457ae30a6a87b39 to your computer and use it in GitHub Desktop.
Save ilevantis/98fc8762727f69f14457ae30a6a87b39 to your computer and use it in GitHub Desktop.
Jira Point summary script for running in tampermonkey
// ==UserScript==
// @name Points for Jira
// @author mariotatis
// @namespace https://openuserjs.org/users/mariotatis/scripts
// @description Points for Jira cumulated story points and shows total points in each column
// @icon https://www.mariotatis.com/wp-content/uploads/2020/05/favicon-32x32-1.png
// @copyright 2020+, mariotatis.com
// @version 2.0.4
// @license MIT
// @grant none
// @include /^https?:\/\/.*atlassian.*
// ==/UserScript==
// edited version of https://www.mariotatis.com/dev/total-story-points-per-column/
(function() {
'use strict';
function setColumnPoints(){
var totalPoints = [];
var allTotalPoints = 0;
jQuery('.ghx-swimlane').each(function(index, swimlane){
jQuery(swimlane).find('.ghx-columns li').each(function(index, column) {
var points = 0;
jQuery(column).find('[data-tooltip^="Story Points"] > span, .ghx-estimate').each(function(index) {
jQuery(this).addClass('aui-badge');
var point = parseFloat(jQuery(this).text());
if(!isNaN(parseFloat(point)))
points += point;
});
totalPoints[index] = totalPoints[index] === undefined ? points : totalPoints[index] + points;
})
})
allTotalPoints = totalPoints.reduce(function(acc, val) { return acc + val; }, 0);
$('#subnav-title').find('.subnavigator-title').each(function(index) {
jQuery("#ghx-estimate-total").remove();
jQuery(this).after('<aui-badge class="ghx-estimate f-estimate" style="margin-left: 4px;" id="ghx-estimate-total">'+ allTotalPoints +'</aui-badge>');
})
$('.ghx-column-header-flex').find('.ghx-column-header-flex-1').each(function(index) {
jQuery("#ghx-estimate"+index+1).remove();
jQuery(this).after('<aui-badge class="ghx-estimate f-estimate" style="margin-left: 4px;" id="ghx-estimate'+index+1+'">'+ totalPoints[index] +'</aui-badge>');
})
}
setInterval(() => {
setColumnPoints();
}, 1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment