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'],
});
-:>
-<h1>Browser compatibility</h1>
+say "<h1>Browser compatibility</h1>\n";
-<p id="intro">Alternate view of Fyrd's <a href="http://caniuse.com/">when can I use...</a> page<:
-my ($canihas, $usage);
-given ($get{usage} // 'wm') {
- when (!$_) {
- # none
- }
- when (!/^\w+$/) {
- printf "<p>Invalid browser usage data request: <em>%s</em>",
- 'identifier must be alphanumeric name or <q>0</q>';
- }
- $canihas = do "browser-usage-$_.inc.pl" or do {
- printf "<p>Browser usage data not found: <em>%s</em>", $! || $@;
- break;
- };
- $usage = $_;
- my $ref = $canihas->{-source} || 'unknown';
- $ref = sprintf '<a href="%s">%s</a>', $_, $ref for $canihas->{-url} || ();
- $ref .= " $_" for $canihas->{-date} || ();
- print "\nwith $ref browser usage statistics";
-}
-:>.
-</p>
-
-<:
my $caniuse = do 'browser-support.inc.pl' or die $! || $@;
$_->{verrelease} = {
# mark last two (future) versions as unreleased, ensure current isn't
my @browsers = grep { $versions{$_} }
qw(trident gecko webkit_saf ios_saf webkit_chr android presto op_mob op_mini);
+print <<'';
+<p id="intro">Alternate rendition of Fyrd's <a href="http://caniuse.com/">when can I use...</a> page
+
+my ($canihas, $usage);
+given ($get{usage} // 'wm') {
+ when (!$_) {
+ # none
+ }
+ when (!/^\w+$/) {
+ printf "<p>Invalid browser usage data request: <em>%s</em>",
+ 'identifier must be alphanumeric name or <q>0</q>';
+ }
+ $canihas = do "browser-usage-$_.inc.pl" or do {
+ printf "<p>Browser usage data not found: <em>%s</em>", $! || $@;
+ break;
+ };
+ $usage = $_;
+ my $ref = $canihas->{-source} || 'unknown';
+ $ref = sprintf '<a href="%s">%s</a>', $_, $ref for $canihas->{-url} || ();
+ $ref .= " $_" for $canihas->{-date} || ();
+ print "\nwith $ref browser usage statistics";
+}
+:>.
+</p>
+
+<:
$canihas ||= {
map {
$_ => +{
my $scorediv = (max(map { ref $_ eq 'HASH' && sum(values %$_) } values %$canihas) // 1) / 100;
print '<table class="mapped">';
-print '<col>' x 3;
+print '<col span="3">'; # should match first thead row
printf '<colgroup span="%d">', scalar @{ $versions{$_} } for @browsers;
-print "\n";
+say '</colgroup><col>';
my $header = join('',
'<tr>',
'<th colspan="3">feature',
(map {
my $name = $caniuse->{agents}->{$_}->{browser};
- sprintf('<th colspan="%d" title="%s">%s',
+ sprintf('<th colspan="%d" class="%s" title="%s">%s',
scalar @{ $versions{$_} },
+ join(' ', map {"b-a-$_"} grep {$_}
+ $_, @{ $caniuse->{agents}->{$_} }{'prefix', 'type'},
+ ),
join(' ',
sprintf('%.1f%%', sum(values %{ $canihas->{$_} })),
$name,
for ($row->{categories}) {
my $cell = $_ ? lc $_->[0] : '-';
+ $cell =~ s/ api$//; # trim unessential fluff in 'js api'
printf '<th title="%s">%s', join(' + ', @$_), $cell;
}