- for my $browser (@browsers) {
- my ($prev, @span);
- for my $ver (@{ $versions{$browser} }, undef) {
- unless (!defined $prev
- or $data->{$browser}->{$prev} ~~ $data->{$browser}->{$ver}) {
- printf '<td class="%s" colspan="%d">%s',
- $CSTATS{ $data->{$browser}->{$prev} },
- scalar @span,
- showversions(\@span),
- undef $prev;
- @span = ();
- }
- push @span, $ver;
- $prev = $ver;
+}
+
+sub saybrowsercols {
+ my ($id, $browser) = @_;
+ my $data = $caniuse->{data}->{$id}->{stats}->{$browser};
+
+ my ($prev, @span);
+ for my $ver (@{ $versions{$browser} }, undef) {
+ 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',
+ join(' ',
+ X => $CSTATS{ ref $data eq 'HASH' && $data->{$prev} || 'u' },
+ !$usage ? ('p0') : ('p',
+ sprintf('p%01d', $usage / 10),
+ sprintf('p%02d', $usage),
+ ),
+ sprintf('pp%02d', $usage / $scorediv),
+ ),
+ scalar @span,
+ $usage,
+ showversions(@span),
+ undef $prev;
+ @span = ();