Last active
December 29, 2015 08:39
-
-
Save 3mkay/7645300 to your computer and use it in GitHub Desktop.
JavaScript Bookmarklet to add-up all the estimated checklist items on a card in Trello.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $lists=$(".checklist"); | |
$.each($lists, function( key, value ) { | |
var $lName = $(value).find(".checklist-title h3"); | |
var $lNameInput = $(value).find(".checklist-title input"); | |
var $items = $(value).find(".checklist-item"); | |
var $tot = 0; | |
$.each($items, function(key, value) { | |
var $itemText = $(value).find(".checklist-item-details-text"); | |
var $itemEst = $itemText[0].innerText.match(/\(\d+\.?\d*\)/g); | |
if ($itemEst) { | |
$itemEst = new Number($itemEst[0].replace("(", '').replace(")", '')); | |
if (!isNaN($itemEst)) { | |
$tot += $itemEst; | |
} | |
} | |
}); | |
$lNameUp = $lName[0].innerText.match(/^[^\(]*/i); | |
$lNameUp += ' (' + $tot + ')'; | |
$lName[0].innerText = $lNameUp; | |
$lNameInput.val($lNameUp); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
well done! Could you please advise how to aggregate now checklists to card name?
Then Scrum for Trello plugin will be compatible