diff --git a/trelloscrum.js b/trelloscrum.js index 797de5d..e382100 100644 --- a/trelloscrum.js +++ b/trelloscrum.js @@ -16,6 +16,7 @@ ** Kit Glennon ** Samuel Gaus ** Sean Colombo +** Geoffrey Tisserand ** */ @@ -27,7 +28,7 @@ var debounce = function (func, threshold, execAsap) { function delayed () { if (!execAsap) func.apply(obj, args); - timeout = null; + timeout = null; }; if (timeout) @@ -39,6 +40,9 @@ var debounce = function (func, threshold, execAsap) { }; } +// Store the points for each members +var membersPoints = {}; + // For MutationObserver var obsConfig = { childList: true, characterData: true, attributes: false, subtree: true }; @@ -91,7 +95,7 @@ if(typeof chrome !== 'undefined'){ scrumLogoUrl = self.options.scrumLogoUrl; scrumLogo18Url = self.options.scrumLogo18Url; } - + // FIREFOX_BEGIN_REMOVE (will just remove this closing bracket). } // FIREFOX_END_REMOVE @@ -114,14 +118,8 @@ var CrossBrowser = { }; CrossBrowser.init(); - - //what to do when DOM loads $(function(){ - //watch filtering - function updateFilters() { - setTimeout(calcListPoints); - }; $('.js-toggle-label-filter, .js-select-member, .js-due-filter, .js-clear-all').off('mouseup'); $('.js-toggle-label-filter, .js-select-member, .js-due-filter, .js-clear-all').on('mouseup', calcListPoints); $('.js-input').off('keyup'); @@ -158,6 +156,7 @@ var recalcTotalsObserver = new CrossBrowser.MutationObserver(function(mutations) if(! ($target.hasClass('list-total') || $target.hasClass('list-title') || $target.hasClass('list-header') + || $target.hasClass('js-trello-scrum-member-points') || $target.hasClass('date') // the 'time-ago' functionality changes date spans every minute || $target.hasClass('js-phrase') // this is constantly updated by Trello, but doesn't affect estimates. || $target.hasClass('member') @@ -170,30 +169,34 @@ var recalcTotalsObserver = new CrossBrowser.MutationObserver(function(mutations) if($target.hasClass('badge')){ if(!$target.hasClass("consumed")){ refreshJustTotals = true; - } + } } else { // It appears this was an actual modification and not a recursive notification. doFullRefresh = true; } } }); - + if(doFullRefresh){ recalcListAndTotal(); } else if(refreshJustTotals){ calcListPoints(); } - + + if (doFullRefresh || refreshJustTotals) { + refreshTotalPointsPerAssignee(); + } + // There appears to be a change to have the card-title always be a textarea. We'll allow for either way, to // start (in case this is A/B testing, or they don't keep it). 20160409 - $editControls = $(".card-detail-title .edit-controls"); // old selector + $editControls = $(".card-detail-title .edit-controls"); // old selector if($editControls.length == 0){ $editControls = $(".js-card-detail-title-input.is-editing").closest('.window-header'); // new selector } - if($editControls.length > 0) - { - showPointPicker($editControls.get(0)); - } + if($editControls.length > 0) + { + showPointPicker($editControls.get(0)); + } }); recalcTotalsObserver.observe(document.body, obsConfig); @@ -253,7 +256,7 @@ function showBurndown() var windowHeaderUtils = $('
', {class: 'window-header-utils dialog-close-button'}).append( $('', {class: 'icon-lg icon-close dark-hover js-close-window', href: '#', title:'Close this dialog window.'}) ); var iFrameWrapper = $('
', {style: 'padding:10px; padding-top: 13px;'}); var flameIcon = $('', {style: 'position:absolute; margin-left: 20px; margin-top:15px;', src:flame18Url}); - + var actualIFrame = $('