From 3bdf86228d2b92e51b0b4756632cad7bb0de7e0d Mon Sep 17 00:00:00 2001 From: Rick Pastoor Date: Mon, 7 Sep 2015 22:47:04 +0200 Subject: [PATCH] Observe a little more Fixed #4 --- scrummer.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scrummer.js b/scrummer.js index 0f66c2d..1a4b004 100644 --- a/scrummer.js +++ b/scrummer.js @@ -30,7 +30,8 @@ var listChangeObserver = new MutationObserver(function (mutations) { // If the list was modified, recalculate if (mutation.target.classList.contains('list-cards') || - mutation.target.classList.contains('list-header-num-cards')) { + mutation.target.classList.contains('list-header-num-cards') || + mutation.target.classList.contains('js-list-sortable')) { setTimeout(calculateStoryPointsForBoardDebounced); return; } @@ -110,7 +111,6 @@ var calculateStoryPointsForCard = function (card) { } var calculateStoryPointsForList = function (list) { - // Observe this list for changes listChangeObserver.observe(list, { childList: true, characterData: false, @@ -148,6 +148,12 @@ var calculateStoryPointsForBoard = function () { for (var i = 0; i < lists.length; i++) { calculateStoryPointsForList(lists[i]); } + + listChangeObserver.observe(document.querySelector('.js-list-sortable'), { + childList: true, + characterData: false, + attributes: false + }); } var calculateStoryPointsForBoardDebounced = function () {