Skip to content

Instantly share code, notes, and snippets.

@p4ul
Created July 15, 2012 23:21
Show Gist options
  • Save p4ul/3119138 to your computer and use it in GitHub Desktop.
Save p4ul/3119138 to your computer and use it in GitHub Desktop.
JS Clips for trello
/**
sum everything in format ($100) for list one
**/
var sum = 0;
$('.list:eq(0) .list-card-title').each(function(d,v){
matches = $(v).text().match(/([0-9]+)(?=\))/);
if(matches !== null) {
sum += parseInt(matches.pop());
}
});
$('.list:eq(0) h2').append(" = $"+sum);
/**
sum everything task lists in ($100) format
**/
var sum = 0;
$('.task-list').each(function(d,v){
matches = $(v).text().match(/([0-9]+)(?=\))/);
if(matches !== null) {
sum += parseInt(matches.pop());
}
});
$('.window h2').append(" ~ $"+sum);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment