keys: qwerak layout
[sheet.git] / browser.plp
index 3f7b6f865e6c462960bc5c1a21386100d462cd02..75605fd1492e6570dcdb01fe349bc14b435c3f27 100644 (file)
@@ -20,6 +20,7 @@ Html({
 with <a href="http://stats.wikimedia.org/archive/squid_reports/">Wikimedia</a>
 browser usage statistics.</p>
 
+<div id="browser">
 <:
 my $caniuse = do 'browser-support.inc.pl' or die $! || $@;
 
@@ -50,9 +51,22 @@ if (my ($somerow) = values %{ $caniuse->{data} }) {
        }
 }
 
-my $canihas = do 'browser-usage.inc.pl' or do {
+my $canihas = do 'browser-usage.inc.pl' || do {
        printf "<p>Browser usage data not found: <em>%s</em>.</p>\n", $_
                for $! || $@;
+       +{
+               map {
+                       $_ => +{
+                               map {
+                                       ($_->[4] =>  0 ), # future
+                                       ($_->[3] =>  .5), # next
+                                       ($_->[0] =>  5 ), # past
+                                       ($_->[1] => 10 ), # previous
+                                       ($_->[2] => 30 ), # current
+                               } $caniuse->{agents}->{$_}->{versions}
+                       }
+               } @browsers
+       }; # fallback hash based on release semantics
 };
 my $scorediv = (max(map { sum(values %$_) } values %$canihas) // 1) / 100;
 
@@ -131,7 +145,14 @@ for my $id (sort {
                my $cell = $_ ? lc $_->[0] : '-';
                print '<th>', $cell;
        }
-       printf '<td title="%s">%s', $row->{description}, $row->{title};
+       print '<td>', $row->{title};
+       print '<div class=aside>';
+       s/\.?$/./, print "<p>$_</p>" for map { ref $_ ? @$_ : $_ || () }
+               $row->{description}, $row->{notes};
+       printf 'Resources: %s.', join(', ',
+               map { qq(<a href="$_->{url}">$_->{title}</a>) } @$_
+       ) for $row->{links} // ();
+       print '</div>';
        for ($row->{status}) {
                my $cell = $_ // '-';
                $cell = sprintf '<a href="%s">%s</a>', $_, $cell for $row->{spec} // ();
@@ -174,7 +195,7 @@ print '</table>';
 sub paddedver {
        # normalised version number comparable as string (cmp)
        shift =~ /^(\d*)(.*)/;
-       return sprintf('%02d', $1) . $2;
+       return sprintf('%02d', $1 || 0) . $2;
 }
 
 sub showversions {
@@ -186,7 +207,8 @@ sub showversions {
        return join('‒', @span);
 }
 
-:>
+:></div>
+
 <hr>
 
 <div class="legend">
@@ -196,6 +218,7 @@ sub showversions {
        <td class="X l4">partial
        <td class="X l2">external (js/plugin)
        <td class="X l0">missing
+       <td class="X l9">unknown
        </table>
 
        <div>