Template:DoneCounter

From 2009.igem.org

(Difference between revisions)
m
m (Bug fixed)
Line 1: Line 1:
-
<html>
+
<includeonly><html>
<script type="text/javascript" src="http://o.aolcdn.com/dojo/1.3.0/dojo/dojo.xd.js"></script>
<script type="text/javascript" src="http://o.aolcdn.com/dojo/1.3.0/dojo/dojo.xd.js"></script>
<script type="text/javascript">
<script type="text/javascript">
/*<![CDATA[*/
/*<![CDATA[*/
-
function showDoneCounts() {
+
dojo.addOnLoad(function(){
   var doneCounts = dojo.query('.doneCount');
   var doneCounts = dojo.query('.doneCount');
   for(var i=0; i<doneCounts.length; i++) {
   for(var i=0; i<doneCounts.length; i++) {
Line 11: Line 11:
             parentElement.nodeName=='UL' ||
             parentElement.nodeName=='UL' ||
             parentElement.nodeName=='OL' ||
             parentElement.nodeName=='OL' ||
-
             parentElement.nodeName=='TABLE')) {
+
             parentElement.nodeName=='TABLE')) { // This works around ampersands not working.
       parentElement = parentElement.nextSibling;
       parentElement = parentElement.nextSibling;
     }
     }
Line 17: Line 17:
     var numDone = dojo.query('.done',parentElement).length;
     var numDone = dojo.query('.done',parentElement).length;
     doneCount.innerHTML = ' (' + numDone + ' out of ' + (numDone+numTodo) + ' done)';
     doneCount.innerHTML = ' (' + numDone + ' out of ' + (numDone+numTodo) + ' done)';
-
}
+
  }
-
dojo.addOnLoad(showDoneCounts);
+
});
/*]]>*/
/*]]>*/
</script>
</script>
-
</html>
+
</html></includeonly><noinclude>This is a script that counts the number of done items in a task list and puts it in the element with class doneCount above the list.</noinclude>

Revision as of 14:15, 14 May 2009

This is a script that counts the number of done items in a task list and puts it in the element with class doneCount above the list.