X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/d2ca80f8d1714a6ea6f8184cfa58b67bf0720f2c..1fce3b7a43db2a10c3dbab2b3bc89dc7a90c3bad:/browser.plp diff --git a/browser.plp b/browser.plp index 9a865d4..27dcb1b 100644 --- a/browser.plp +++ b/browser.plp @@ -8,38 +8,17 @@ Html({ version => 'v1.0', description => "caniuse.", - keywords => [qw'html css browser feature'], + keywords => [qw' + web browser support compatibility usage available feature + html html5 css css3 svg javascript js dom mobile + ie internet explorer firefox chrome safari webkit opera + '], stylesheet => [qw'circus dark mono red light'], data => ['browser-support.inc.pl'], }); -:> -

Browser compatibility

- -

Alternate view of Fyrd's when can I use... page<: -my ($canihas, $usage); -given ($get{usage} // 'wm') { - when (!$_) { - # none - } - when (!/^\w+$/) { - printf "

Invalid browser usage data request: %s", - 'identifier must be alphanumeric name or 0'; - } - $canihas = do "browser-usage-$_.inc.pl" or do { - printf "

Browser usage data not found: %s", $! || $@; - break; - }; - $usage = $_; - my $ref = $canihas->{-source} || 'unknown'; - $ref = sprintf '%s', $_, $ref for $canihas->{-url} || (); - $ref .= " $_" for $canihas->{-date} || (); - print "\nwith $ref browser usage statistics"; -} -:>. -

+say "

Browser compatibility

\n"; -<: my $caniuse = do 'browser-support.inc.pl' or die $! || $@; $_->{verrelease} = { # mark last two (future) versions as unreleased, ensure current isn't @@ -90,6 +69,32 @@ if (my ($somerow) = values %{ $caniuse->{data} }) { my @browsers = grep { $versions{$_} } qw(trident gecko webkit_saf ios_saf webkit_chr android presto op_mob op_mini); +print <<''; +

Alternate rendition of Fyrd's when can I use... page + +my ($canihas, $usage); +given ($get{usage} // 'wm') { + when (!$_) { + # none + } + when (!/^\w+$/) { + printf "

Invalid browser usage data request: %s", + 'identifier must be alphanumeric name or 0'; + } + $canihas = do "browser-usage-$_.inc.pl" or do { + printf "

Browser usage data not found: %s", $! || $@; + break; + }; + $usage = $_; + my $ref = $canihas->{-source} || 'unknown'; + $ref = sprintf '%s', $_, $ref for $canihas->{-url} || (); + $ref .= " $_" for $canihas->{-date} || (); + print "\nwith $ref browser usage statistics"; +} +:>. +

+ +<: $canihas ||= { map { $_ => +{ @@ -107,9 +112,9 @@ $canihas ||= { my $scorediv = (max(map { ref $_ eq 'HASH' && sum(values %$_) } values %$canihas) // 1) / 100; print ''; -print '' x 3; +print ''; # should match first thead row printf '', scalar @{ $versions{$_} } for @browsers; -print "\n"; +say ''; my $header = join('', '', @@ -119,7 +124,7 @@ my $header = join('', sprintf('
%s', scalar @{ $versions{$_} }, join(' ', map {"b-a-$_"} grep {$_} - $_, $caniuse->{agents}->{$_}->{prefix}, + $_, @{ $caniuse->{agents}->{$_} }{'prefix', 'type'}, ), join(' ', sprintf('%.1f%%', sum(values %{ $canihas->{$_} })), @@ -192,6 +197,7 @@ sub saytitlecol { for ($row->{categories}) { my $cell = $_ ? lc $_->[0] : '-'; + $cell =~ s/ api$//; # trim unessential fluff in 'js api' printf '%s', join(' + ', @$_), $cell; }