chiark / gitweb /
Use hasOwnProperty to eliminate unhelpful JS stuff in Object
[ypp-sc-tools.web-live.git] / yarrg / web / query_age
index fd2044d97b4463457d88776b71dc0000b45590ea..4f8ba814b7f1e5ddf2b0ce0fc22549ad560b728d 100644 (file)
@@ -81,7 +81,6 @@ $sth->execute();
 % $da_ages{'id_loaded'}= 0;
 % my $rowix= 0;
 % while ($row= $fetchrow->()) {
-%      print STDERR "$row\n";
 %      my $rowid= "id_$row->{'islandid'}";
 %      my $cellid= "c$rowid";
 %      my $age= $now - $row->{'timestamp'};
@@ -124,6 +123,7 @@ Time since this page loaded:
     var now= Date.now();
     debug('updating now='+now);
     for (var ageid in <% $jsprefix %>ages) {
+      if (!<% $jsprefix %>ages.hasOwnProperty(ageid)) continue;
       var oldage= <% $jsprefix %>ages[ageid];
       var el= document.getElementById(<% $elemidprefix %>ageid);
       var age= oldage + (now - da_pageload) / 1000;