scripts/ajax.js
changeset 13 b5db2345c397
parent 11 0faea3a6c881
child 14 7a1573676cc4
--- a/scripts/ajax.js	Wed Mar 26 10:24:20 2008 -0400
+++ b/scripts/ajax.js	Wed Mar 26 11:10:20 2008 -0400
@@ -293,6 +293,10 @@
 {
   var count_seconds = time % 60;
   var count_minutes = ( time - count_seconds ) / 60;
+  if ( isNaN(count_seconds) )
+    count_seconds = 0;
+  if ( isNaN(count_minutes) )
+    count_minutes = 0;
   return fill_zeroes(count_minutes) + ':' + fill_zeroes(count_seconds);
 }
 
@@ -335,13 +339,16 @@
       $(booby).rmClass(match[2]);
     }
   }
+  // recalculate list of rows that should pulse
   var tdlist_new = document.getElementsByClassName('current', 'tr');
   if ( pulsar_current == 0 && tdlist_new == pulsar_tdlist )
   {
     return true;
   }
+  // reset everything to 0
   pulsar_tdlist = tdlist_new;
   pulsar_current = 0;
+  pulsar_direction = 1;
   for ( var i = 0; i < pulsar_tdlist.length; i++ )
   {
     var td = pulsar_reset[i];
@@ -361,6 +368,10 @@
 
 var pulsar_advance = function()
 {
+  // this should be as optimized as possible, it should use a precalculated
+  // list of elements to pulse and whatnot... heck even right now it's not
+  // really as optimized as it should be due to the logic, but a lot of it's
+  // kinda more or less necessary.
   if ( !is_playing )
     return true;
   if ( pulsar_current + pulsar_direction == 10 )