browser: describe target of tooltip usage percentages
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 7 Dec 2010 15:40:43 +0000 (16:40 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 15 Dec 2010 21:40:44 +0000 (22:40 +0100)
browser.plp

index 13e6b5e..ef260e1 100644 (file)
@@ -58,6 +58,20 @@ my %CSTATS = (
        'p p' => 'l2',
        'u'   => 'l0',
 );
+my %DSTATS = (
+       u => 'unknown',
+       n => 'unsupported',
+       p => 'plugin required',
+       j => 'javascript required',
+       a => 'partial',
+       y => 'supported',
+       x => sub {
+               join(' ',
+                       'requires prefix',
+                       (map "-$_-", $caniuse->{agents}->{$_[0]}->{prefix} // ()),
+               );
+       },
+);
 my %CSTATUS = (
        unoff => 'l1', # unofficial
        wd    => 'l3', # draft
@@ -121,8 +135,11 @@ print '<thead>', $header;
 print "\n<tr>";
 print '<td>' x 3;
 for my $browser (@browsers) {
-       printf('<td title="%.1f%%"%s>%s',
-               $canihas->{$browser}->{$_},
+       printf('<td title="%s"%s>%s',
+               join(' ',
+                       sprintf('%.1f%%', $canihas->{$browser}->{$_}),
+                       "version $_",
+               ),
                (map {
                        defined $_ && !$_ && ' class="ex"'
                } $caniuse->{agents}->{$browser}->{verrelease}->{$_}),
@@ -214,7 +231,7 @@ sub saybrowsercols {
                unless (!defined $prev
                or ref $data eq 'HASH' && $data->{$prev} ~~ $data->{$ver}) {
                        my $usage = sum(map { $canihas->{$browser}->{$_} } @span);
-                       printf '<td class="%s" colspan="%d" title="%.1f%%">%s',
+                       printf '<td class="%s" colspan="%d" title="%s">%s',
                                join(' ',
                                        X => $CSTATS{ ref $data eq 'HASH' && $data->{$prev} || 'u' },
                                        !$usage ? ('p0') : ('p',
@@ -224,7 +241,12 @@ sub saybrowsercols {
                                        sprintf('pp%02d', $usage / $scorediv),
                                ),
                                scalar @span,
-                               $usage,
+                               sprintf('%.1f%% %s', $usage, join(', ',
+                                       map { ref $_ eq 'CODE' ? $_->($browser) : $_ }
+                                       map { $DSTATS{$_} // () }
+                                       map { split / /, $_ }
+                                       ref $data eq 'HASH' && $data->{$prev} || 'u'
+                               )),
                                showversions(@span),
                        undef $prev;
                        @span = ();