chiark / gitweb /
routesearch: support circular routes
[ypp-sc-tools.db-live.git] / yarrg / web / query_age
index 88bc7ea16b73fa686bb30628761a725c4bd242c3..d9b234dd559e074353641f7c1ccd5fae7f9b4916 100644 (file)
@@ -80,34 +80,18 @@ $sth->execute();
 <tr id=<% $rowid %> class="<% 'datarow'.($rowix & 1) %>"
    > <td><% $row->{'archipelago'} |h
   %> <td><% $row->{'islandname'} |h
-  %> <td id="<% $cellid %>"><% prettyprint_age($age) %> </tr>
+  %> <td id="<% $cellid %>" align=right><% prettyprint_age($age) %> </tr>
 %      $rowix++;
 % }
 </table>
 
-<& tabsort, table => 'ts_table', rowclass => 'datarow', cols => [
-       {}, {},
-       { DoReverse => 1,
-         Numeric => 1,
-         SortKey => "da_ages[rowid]" }]
-  &>
-
-<p>
-Time since this page loaded:
-<span id="cid_loaded">(not known; times above not updating)</span>
-
-<form action="lookup" method="get">
-<input type=submit name=submit value="Reload">
-<& "lookup:formhidden", ours => sub { 0; } &>
-</form>
-
+<& SELF:dataages, id2age => \%da_ages, elemidprefix => "'c'+" &>
 <%method dataages>
 <%args>
   $id2age
   $elemidprefix => ''
 </%args>
 <&| script &>
-  da_ages= <% to_json_protecttags($id2age) %>;
   function da_Refresh() {
     var now= Date.now();
     debug('updating now='+now);
@@ -119,21 +103,29 @@ Time since this page loaded:
       el.innerHTML= newhtml;
     }
   }
+  da_ages= <% to_json_protecttags($id2age) %>;
   window.setInterval(da_Refresh, 10000);
+  register_onload(da_Refresh);
 </&>
 </%method>
 
-<& SELF:dataages, id2age => \%da_ages, elemidprefix => "'c'+" &>
-
-<&| script &>
+<&| tabsort, table => 'ts_table', rowclass => 'datarow', cols => [
+       {}, {},
+       { DoReverse => 1,
+         Numeric => 1,
+         SortKey => "da_ages[rowid]" }]
+  &>
   ts_sortkeys= <% to_json_protecttags(\%ts_sortkeys) %>;
+</&tabsort>
 
-  function all_onload() {
-    ts_onload__ts_table();
-    da_Refresh();
-  }
-  window.onload= all_onload;
-</&script>
+<p>
+Time since this page loaded:
+<span id="cid_loaded">(not known; times above not updating)</span>
+
+<form action="lookup" method="get">
+<input type=submit name=submit value="Reload">
+<& "lookup:formhidden", ours => sub { 0; } &>
+</form>
 
 <%init>
 use POSIX;