JIRA - Show Total Number of Points for Each Column

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

当前为 2016-01-24 提交的版本,查看 最新版本

  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.1
  9. // @grant none
  10. // @locale en
  11. // ==/UserScript==
  12.  
  13. this.$ = this.jQuery = jQuery.noConflict(true);
  14.  
  15. $(function() {
  16.  
  17. var columns = {};
  18. var columnHeaders = $('#ghx-column-headers');
  19. waitForKeyElements('.ghx-columns', getNumPoints);
  20. // Each jNode is a swimlane on the board
  21. function getNumPoints(jNode) {
  22. // For each column in this swimlane...
  23. jNode.find('.ghx-column.ui-sortable').each(function() {
  24. var columnId = jNode.attr('data-column-id');
  25. columns[columnId] = 0;
  26. // For each ticket in this column...
  27. $(this).children().each(function() {
  28. // Add the point value to the total
  29. columns[columnId] += parseInt($(this).find('.ghx-end').find('span.aui-badge').html(), 10);
  30. });
  31. // Append the total point value for this column to the column's name
  32. var columnTitle = columnHeaders.find('li[data-id="' + columnId + '"]').find('h2');
  33. columnTitle.append(' (' + columns[columnId] + ')');
  34. console.log("POINTS - " + columnTitle.html() + ": " + columns[columnId]);
  35. });
  36. }
  37. });