Skip to content
Permalink
Browse files

Hide reviews, users and rating if they are unknown

  • Loading branch information...
JustOff committed Jan 29, 2019
1 parent 6d0fd5f commit 5b48924126489c2eb234395633caad7b5a3c0360
Showing with 30 additions and 10 deletions.
  1. +12 −6 content/addon.js
  2. +14 −4 content/list.js
  3. +4 −0 skin/ca-archive.css
@@ -45,9 +45,17 @@ let Addon = {
} catch (e) {
return null;
}
data.reviews = new Intl.NumberFormat("en-US").format(dbQuery.row.reviews);
if (dbQuery.row.reviews >= 0) {
data.reviews = '<span itemprop="ratingCount">' + new Intl.NumberFormat("en-US").format(dbQuery.row.reviews) + '</span> user reviews';
} else {
data.reviews = '';
}
data.rating = Math.round(dbQuery.row.rating);
data.users = new Intl.NumberFormat("en-US").format(dbQuery.row.users);
if (dbQuery.row.users >= 0) {
data.users = '<div id="daily-users">' + new Intl.NumberFormat("en-US").format(dbQuery.row.users) + ' users</div>';
} else {
data.users = '';
}
if (dbQuery.row.icon) {
data.icon_url = "chrome://ca-archive/skin/icons/" + dbQuery.row.icon + ".png";
} else {
@@ -266,16 +274,14 @@ let Addon = {
<div>
<a id="reviews-link" target="_blank" title="Open Reviews on Wayback Machine" href=%WBM%reviews/>
<span itemprop="ratingCount">%REVIEWS%</span> user reviews
%REVIEWS%
</a>
</div>
</div>
%GRATING%
<div id="daily-users">
%USERS% users
</div>
%USERS%
</aside>
@@ -154,9 +154,19 @@ let List = {
} else {
item = item.replace("%ICON%", "chrome://ca-archive/skin/icons/" + Math.trunc(dbQuery.row.addon_id/1000) + "/" + dbQuery.row.addon_id + ".png");
}
let users = new Intl.NumberFormat("en-US").format(dbQuery.row.users);
let users;
if (dbQuery.row.users >= 0) {
users = '<div class="adu">' + new Intl.NumberFormat("en-US").format(dbQuery.row.users) + ' users</div>';
} else {
users = '';
}
item = item.replace("%USERS%", users);
let reviews = new Intl.NumberFormat("en-US").format(dbQuery.row.reviews);
let reviews;
if (dbQuery.row.reviews >= 0) {
reviews = '(' + new Intl.NumberFormat("en-US").format(dbQuery.row.reviews) + ')';
} else {
reviews = '';
}
item = item.replace("%REVIEWS%", reviews);
let restart = "";
if (dbQuery.row.is_restart_required == false) {
@@ -302,9 +312,9 @@ let List = {
<div class="vitals c">
<span class="rating">
<span class="stars stars-%RATING%" title="Rated %RATING% out of 5 stars">Rated %RATING% out of 5 stars</span>
<a href="caa:addon/%SLUG%">(%REVIEWS%)</a>
<a href="caa:addon/%SLUG%">%REVIEWS%</a>
</span>
<div class="adu">%USERS% users</div>
%USERS%
</div>
</div>
<div class="action">
@@ -1252,6 +1252,10 @@ button.search-button {
background-position: -65px 0
}

.stars.stars--1 {
display: none !important
}

.stars.large {
display: block;
background: url(stars-16.png) no-repeat left top;

0 comments on commit 5b48924

Please sign in to comment.
You can’t perform that action at this time.