browser: additional footer row with browser families
authorMischa POSLAWSKY <perl@shiar.org>
Wed, 4 Feb 2015 09:25:33 +0000 (10:25 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 5 Feb 2015 21:46:21 +0000 (22:46 +0100)
base.css
browser.plp

index 1246519069d4ee42fc7f71324483989e28e3056d..3db71e83630d2c7f8fb07b30b97e27deb40692b9 100644 (file)
--- a/base.css
+++ b/base.css
@@ -223,6 +223,7 @@ thead th, td {
 /* table headers */
 
 th,
+tfoot td,
 thead td {
        border: 0;
        background: transparent !important;
@@ -245,6 +246,9 @@ th {
        font-size: 70%;
        text-transform: uppercase;
 }
+tfoot .cat th {
+       border-top: 1px solid #888;
+}
 
 /* digraphs map */
 
index bd6d8abde4ec1a195bbf32a599397da1502e3bb1..322fa36d42d31b206302b1070c5a7a79e37bf3cd 100644 (file)
@@ -240,7 +240,22 @@ for my $browser (@browsers) {
 }
 print '<td>' x 1;
 say '</thead>';
-say '<tfoot>', $header, '</tfoot>';
+say '<tfoot>', $header;
+{
+       # prefix indicates browser family; count adjacent families
+       my (@families, %familycount);
+       for my $browser (@browsers) {
+               my $family = $caniuse->{agents}->{$browser}->{prefix};
+               push @families, $family unless $familycount{$family};
+               $familycount{$family} += @{ $versions{$browser} };
+       }
+
+       print "\n", '<tr class="cat">';
+       print '<td>' x 3;
+       printf '<th colspan="%d">%s', $familycount{$_}, $_ for @families;
+       print '<td>';
+}
+say '</tfoot>';
 
 sub featurescore {
        # relative amount of support for given feature