X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=yarrg%2Fweb%2Fquery_age;h=4f8ba814b7f1e5ddf2b0ce0fc22549ad560b728d;hb=fc8ad971bcaad7dfc125dcc65e3ee2a3e11bbe9c;hp=7cfe54e291799e6c8daa53ec0207c0f4d37eeead;hpb=1da4d6e0bbabfb308c1cc5d1e08a2712ce647259;p=ypp-sc-tools.db-live.git
diff --git a/yarrg/web/query_age b/yarrg/web/query_age
index 7cfe54e..4f8ba81 100644
--- a/yarrg/web/query_age
+++ b/yarrg/web/query_age
@@ -52,6 +52,7 @@ my $sth= $dbh->prepare("SELECT archipelago, islandid, islandname, timestamp
$sth->execute();
%perl>
+
<& SELF:pageload &>
<%method pageload>
@@ -69,19 +70,17 @@ $sth->execute();
$now
$fetchrow
%args>
-
+
Archipelago
| Island
| Age
- |
% my $row;
% my %da_ages;
% my %ts_sortkeys;
% $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;
@@ -142,6 +142,7 @@ Time since this page loaded:
<& "lookup:formhidden", ours => sub { 0; } &>
+
<%init>
use POSIX;
use CommodsWeb;