Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,55 @@ | ||
|
||
(function() { | ||
(function() { | ||
|
||
var calculate = function () { | ||
$("article.todolist").each(function( index ) { | ||
$("article.todolist").each(function (index) { | ||
|
||
var done = 0; | ||
var todo = 0; | ||
|
||
$(this).find("ul.todos span.content:visible").each(function( index ) { | ||
var regExp = /\(([^)]+)\)/; | ||
var regExp = /\(([^)]+)\)/; | ||
|
||
$(this).find("ul.todos span.content:visible").each(function (index) { | ||
|
||
var matches = regExp.exec($(this).text()); | ||
|
||
if(matches) | ||
{ | ||
matches.forEach(function(entry) { | ||
if(parseInt(entry)){ | ||
|
||
if (matches) { | ||
matches.forEach(function (entry) { | ||
if (parseInt(entry)) { | ||
todo = todo + parseInt(entry); | ||
} | ||
}); | ||
} | ||
}); | ||
|
||
|
||
$(this).find("ul.completed span.content").each(function (index) { | ||
var regExp = /\(([^)]+)\)/; | ||
|
||
var matches = regExp.exec($(this).text()); | ||
|
||
if(matches) | ||
{ | ||
matches.forEach(function(entry) { | ||
if(parseInt(entry)){ | ||
|
||
if (matches) { | ||
matches.forEach(function (entry) { | ||
if (parseInt(entry)) { | ||
done = done + parseInt(entry); | ||
} | ||
}); | ||
} | ||
}); | ||
|
||
//todo: cleanup previous calculation.. $(this).find("h3").text().replace(/\(*\)/g, ""); | ||
$(this).find("h3").append(" ("+ todo +"/"+ done +")"); | ||
|
||
$(this).find("h3").append(" (" + todo + "/" + done + ")"); | ||
}); | ||
}; | ||
|
||
var init = function() | ||
{ | ||
//todo: check if you are in basecamp, other wise ignore complete initialization. | ||
$(":checkbox").change(function(){ | ||
//todo: only fired once, not when click the checkbox twice.. | ||
calculate(); | ||
}); | ||
|
||
calculate(); //run calculate onload.. | ||
calculate(); //run calculate onload.. | ||
}; | ||
|
||
init(); | ||
|
||
|
||
|
||
$(document).ready(function() { | ||
init(); | ||
}); | ||
|
||
})(); | ||
|
||
|