git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
browser: normalise score as percentage
[sheet.git]
/
browser.plp
diff --git
a/browser.plp
b/browser.plp
index 7d78670255463e64223d93a4307474768c322f72..7e52a03bf07584a5129b5b05de7fe0a61c8aaf71 100644
(file)
--- a/
browser.plp
+++ b/
browser.plp
@@
-43,7
+43,7
@@
my $caniuse = from_json($source, {
my %CSTATS = (
n => 'di-b',
my %CSTATS = (
n => 'di-b',
- y => 'di-a',
+ y => 'di-a
a
',
a => 'di-d',
j => 'di-prop',
p => 'di-prop',
a => 'di-d',
j => 'di-prop',
p => 'di-prop',
@@
-55,7
+55,7
@@
my %CSTATUS = (
pr => 'di-prop', # proposed
cr => 'di-d', # candidate
rec => 'di-a', # recommendation
pr => 'di-prop', # proposed
cr => 'di-d', # candidate
rec => 'di-a', # recommendation
- ietf => 'di-a', # standard
+ ietf => 'di-a
a
', # standard
);
my @browsers = qw(trident gecko webkit_saf presto);
my %versions;
);
my @browsers = qw(trident gecko webkit_saf presto);
my %versions;
@@
-80,12
+80,11
@@
print '<tr>';
print '<td>' x $_ for 2, map { scalar @{ $versions{$_} } } @browsers;
print "</thead>\n";
print '<td>' x $_ for 2, map { scalar @{ $versions{$_} } } @browsers;
print "</thead>\n";
-sub feature
rank
{
+sub feature
score
{
# relative amount of support for given feature
state $statspts = { y=>10, 'y x'=>9, a=>5, j=>2, p=>1 };
# relative amount of support for given feature
state $statspts = { y=>10, 'y x'=>9, a=>5, j=>2, p=>1 };
- my ($id) = @_;
my $rank = 0;
my $rank = 0;
- if (my $row =
$caniuse->{data}->{$id}->{stats}
) {
+ if (my $row =
shift
) {
while (my ($browser, $vercols) = each %versions) {
my $div = 0; # multiplier exponent (decreased to lower value)
my @vers = map { $row->{$browser}->{$_} } @$vercols;
while (my ($browser, $vercols) = each %versions) {
my $div = 0; # multiplier exponent (decreased to lower value)
my @vers = map { $row->{$browser}->{$_} } @$vercols;
@@
-105,7
+104,8
@@
sub featurerank {
}
for my $id (sort {
}
for my $id (sort {
- featurerank($b) <=> featurerank($a)
+ featurescore($caniuse->{data}->{$b}->{stats})
+ <=> featurescore($caniuse->{data}->{$a}->{stats})
} keys %{ $caniuse->{data} }) {
my $row = $caniuse->{data}->{$id};
my $data = $row->{stats} or next; # skip metadata [summary]
} keys %{ $caniuse->{data} }) {
my $row = $caniuse->{data}->{$id};
my $data = $row->{stats} or next; # skip metadata [summary]
@@
-128,7
+128,10
@@
for my $id (sort {
$prev = $ver;
}
}
$prev = $ver;
}
}
- print '<td>', int featurerank($id);
+ state $maxscore = featurescore({ # yes for every possible version
+ map { $_ => { map {$_ => 'y'} @{$versions{$_}} } } keys %versions
+ });
+ print '<td>', int featurescore($caniuse->{data}->{$id}->{stats}) / $maxscore * 100;
}
print '</table>';
}
print '</table>';
@@
-143,10
+146,11
@@
sub paddedver {
<div class="legend">
<table class="glyphs"><tr>
<div class="legend">
<table class="glyphs"><tr>
- <td class="X di-a">yes
- <td class="X di-d">almost
- <td class="X di-prop">plugin or js
- <td class="X di-b">no
+ <td class="X di-aa">supported
+ <td class="X di-a">prefixed
+ <td class="X di-d">partial
+ <td class="X di-prop">external (js/plugin)
+ <td class="X di-b">missing
</table>
<div class="right">
</table>
<div class="right">