Last active
December 15, 2015 02:09
-
-
Save shesek/5185168 to your computer and use it in GitHub Desktop.
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
(function(){var e;e=function(e){var t,n;t=+(((n=e.match(/^\s*(?:#\d+)?\s*\(([\d\.]+)\)/))!=null?n[1]:void 0)||0);if(t===t){return t}else{return 0}};$(".list").each(function(){var t,n,r;t=$(this);n=t.find(".list-header h2");r=t.find(".list-card-title:visible").get().reduce(function(t,n){return t+e(n.innerText)},0);return n.find(".total").remove().end().append($("<span>").addClass("total").text(r))});return function(e){return $("<style>").attr({type:"text/css"}).text(e).appendTo("head")}(".list-header .total { float: right }")})() |
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
# Counts the total points for each list | |
# Points should be added to the beginning of the | |
# card title, e.g. "(3) Foo bar baz" | |
do -> | |
get_points = (t) -> | |
n = +((t.match /^\s*(?:#\d+)?\s*\(([\d\.]+)\)/)?[1] or 0) | |
if n is n then n else 0 | |
$('.list').each -> | |
$t = $ this | |
$title = $t.find '.list-header h2' | |
total_points = $t.find('.list-card-title:visible').get().reduce ((a, b) -> a + get_points b.innerText), 0 | |
$title.find('.total').remove().end().append $('<span>').addClass('total').text(total_points) | |
((style) -> $('<style>').attr(type:'text/css').text(style).appendTo('head')) """ | |
.list-header .total { float: right } | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment