Template:DoneCounter/Counter.js

dojo.addOnLoad(function{ var doneCounts = dojo.query('.doneCount');  for(var i=0; i<doneCounts.length; i++) {    var doneCount = doneCounts[i];    var parentElement = doneCount.parentNode;    while(parentElement && parentElement.nodeName!='UL' && parentElement.nodeName!='OL' && parentElement.nodeName!='TABLE') {     parentElement = parentElement.nextSibling;    }    var numTodo = dojo.query('.todo',parentElement).length;    var numDone = dojo.query('.done',parentElement).length;    doneCount.innerHTML = ' (' + numDone + ' out of ' + (numDone+numTodo) + ' done)';  } });