X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/9dfef01d97d7c0f4f7137671e2c370e3cfc686a3..2ef4dd5f39564f1333dd68bc39c6d8e561efcaf3:/browser.plp
diff --git a/browser.plp b/browser.plp
index 8c0bd6a..fc3d5f0 100644
--- a/browser.plp
+++ b/browser.plp
@@ -9,7 +9,7 @@ Html({
description =>
"caniuse.",
keywords => [qw'html css browser feature'],
- stylesheet => [qw'circus dark mono red'],
+ stylesheet => [qw'circus dark mono red light'],
data => ['browser-support.inc.pl'],
});
@@ -20,6 +20,7 @@ Html({
with Wikimedia
browser usage statistics.
+
<:
my $caniuse = do 'browser-support.inc.pl' or die $! || $@;
@@ -32,14 +33,14 @@ my %CSTATS = (
'p j' => 'l2',
'j' => 'l2',
'p' => 'l2',
- 'u' => 'ex',
+ 'u' => 'l9',
);
my %CSTATUS = (
- unoff => 'ex', # unofficial
- wd => 'l0', # draft
- pr => 'l2', # proposed
- cr => 'l4', # candidate
- rec => 'l5', # recommendation
+ unoff => 'l0', # unofficial
+ wd => 'l4', # draft
+ cr => 'l5', # candidate
+ pr => 'l5', # proposed
+ rec => 'l6', # recommendation
ietf => 'l6', # standard
);
my @browsers = qw(trident gecko webkit_saf webkit_chr presto);
@@ -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 "
Browser usage data not found: %s.
\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 '
', $cell;
}
- printf ' | %s', $row->{description}, $row->{title};
+ print ' | ', $row->{title};
+ print '';
+ s/\.?$/./, print " $_ " for map { ref $_ ? @$_ : $_ || () }
+ $row->{description}, $row->{notes};
+ printf 'Resources: %s.', join(', ',
+ map { qq( $_->{title}) } @$_
+ ) for $row->{links} // ();
+ print ' ';
for ($row->{status}) {
my $cell = $_ // '-';
$cell = sprintf '%s', $_, $cell for $row->{spec} // ();
@@ -147,7 +168,11 @@ for my $id (sort {
printf ' | %s',
join(' ',
X => $CSTATS{ $data->{$browser}->{$prev} },
- sprintf('opacity%.0f', $usage / $scorediv),
+ !$usage ? ('p0') : ('p',
+ sprintf('p%01d', $usage / 10),
+ sprintf('p%02d', $usage),
+ ),
+ sprintf('pp%02d', $usage / $scorediv),
),
scalar @span,
$usage,
@@ -170,7 +195,7 @@ print '';
sub paddedver {
# normalised version number comparable as string (cmp)
shift =~ /^(\d*)(.*)/;
- return sprintf('%02d', $1) . $2;
+ return sprintf('%02d', $1 || 0) . $2;
}
sub showversions {
@@ -182,20 +207,8 @@ sub showversions {
return join('â', @span);
}
-:>
-
+:>
+
@@ -207,6 +220,16 @@ alert(t);
missing
+
+ Usage percentage:
+ 0 -
+ .01 -
+ 1-9 -
+ 10 -
+ 20 -
+ majority
+
+
| |