JIRA - Show Total Number of Points for Each Column

Displays the total amount of points in each column of your board

  1. // ==UserScript==
  2. // @name JIRA - Show Total Number of Points for Each Column
  3. // @namespace chriskim06
  4. // @description Displays the total amount of points in each column of your board
  5. // @include https://*jira*com/secure/*Board*
  6. // @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
  7. // @require https://greasyfork.org/scripts/5392-waitforkeyelements/code/WaitForKeyElements.js?version=19641
  8. // @version 1.0.2
  9. // @grant none
  10. // @locale en
  11. // ==/UserScript==
  12.  
  13. this.$ = this.jQuery = jQuery.noConflict(true);
  14.  
  15. waitForKeyElements('#ghx-pool', getNumPoints);
  16.  
  17. // jNode is the board
  18. function getNumPoints(jNode) {
  19.  
  20. var columns = {};
  21. var columnHeaders = $('#ghx-column-headers');
  22. columnHeaders.children('li').each(function() {
  23. // Initialize each of the values to 0
  24. columns[$(this).attr('data-id')] = 0;
  25. });
  26.  
  27. // For each swimlane...
  28. jNode.find('.ghx-columns').each(function() {
  29. // Get each column...
  30. $(this).children('li').each(function() {
  31. var id = $(this).attr('data-column-id');
  32. // For each ticket in the column...
  33. $(this).children('div').each(function() {
  34. // Add its point value to the total for the column
  35. var points = parseInt($(this).find('.ghx-end').find('span.aui-badge').html(), 10);
  36. if (points > 0) {
  37. columns[id] += points;
  38. }
  39. });
  40. });
  41. });
  42.  
  43. // Append the total point value for this column to the column's name
  44. columnHeaders.children('li').each(function() {
  45. var columnId = $(this).attr('data-id');
  46. $(this).find('h2').append(' (' + columns[columnId] + ')');
  47. });
  48.  
  49. }