Skip to content

Instantly share code, notes, and snippets.

@AldanaQuintana
Created July 2, 2016 20:57
Show Gist options
  • Save AldanaQuintana/84d8e66db41a63417ca1025c0d0807fc to your computer and use it in GitHub Desktop.
Save AldanaQuintana/84d8e66db41a63417ca1025c0d0807fc to your computer and use it in GitHub Desktop.
javascript:(function(){
if(window.location["href"].match("trello") == null){ return; }
var uploadDom = function(){
var lists = document.getElementsByClassName("js-list-content");
for (var i = 0; i < lists.length; i++) {
var listStoryPoints = 0;
var list = lists[i];
var headerTextArea = list.getElementsByClassName("list-header-name")[0];
var headerContent = headerTextArea.textContent.split(" (")[0];
var listCards = list.getElementsByClassName("list-card");
if(listCards != undefined && listCards.length > 0){
for (var j = 0; j < listCards.length; j++) {
var card = listCards[j];
var cardId = card.getElementsByClassName("card-short-id")[0];
var cardName = card.getElementsByClassName("js-card-name")[0];
if(cardName != undefined && cardId != undefined){
var textToTrim = cardId.textContent;
var cardContent = cardName.textContent;
cardContent = cardContent.split(textToTrim)[1];
var splitted = cardContent.split("/SP");
if(splitted.length == 2){
listStoryPoints += parseInt(splitted[0]);
}
}
}
}
headerTextArea.textContent = headerContent + " (" + listStoryPoints.toString() + "/SP)";
}
}
setInterval(uploadDom, 200);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment