X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/bd77795ed44d7b642c66b05e0982bff026fdc68f..2d8ef982c433355f3716b2f3e0de9f814e3b3313:/browser.plp?ds=sidebyside diff --git a/browser.plp b/browser.plp index ea23d0a..f385042 100644 --- a/browser.plp +++ b/browser.plp @@ -17,8 +17,18 @@ Html({
Alternate view of Fyrd's when can I use... page -with Wikimedia -browser usage statistics.
+<: +my $canihas = do 'browser-usage.inc.pl' + or printf "Browser usage data not found: %s.
\n", $! || $@; + +print "with $_ browser usage statistics." for map { + my $ref = $_->{-source} || 'unknown'; + $ref = sprintf '%s', $_, $ref for $_->{-url} || (); + $ref .= " $_" for $_->{-date} || (); + $ref +} $canihas || (); +:> +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; +$canihas ||= { + map { + $_ => +{ + map { + my $zero = $#$_ - 2; # baseline index + ($_->[$zero - 2] => .5), # past + ($_->[$zero - 1] => 10 ), # previous + ($_->[$zero + 2] => 0 ), # future + ($_->[$zero + 1] => .5), # next + ($_->[$zero ] => 30 ), # current + } $caniuse->{agents}->{$_}->{versions} + } + } @browsers +}; # fallback hash based on release semantics +my $scorediv = (max(map { ref $_ eq 'HASH' && sum(values %$_) } values %$canihas) // 1) / 100; print '', $cell; } - print ' | ', $row->{title}; + print ' | ', map {
+ sprintf('%s',
+ "#$id",
+ sprintf("try { %s; return false } catch(err) { return true }",
+ "document.getElementById('$id').classList.toggle('target')",
+ ),
+ $_,
+ );
+ } $row->{title};
print ' ';
s/\.?$/./, print " $_ " for map { ref $_ ? @$_ : $_ || () } $row->{description}, $row->{notes}; |
---|