mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 644086 - Only show Show More button if addons are hidden r=mfinkle
This commit is contained in:
parent
170c710ac7
commit
c0945da8e6
@ -546,6 +546,7 @@ var ExtensionsView = {
|
||||
appendSearchResults: function(aAddons, aShowRating, aShowCount) {
|
||||
let urlproperties = [ "iconURL", "homepageURL" ];
|
||||
let foundItem = false;
|
||||
let appendedAddons = 0;
|
||||
for (let i = 0; i < aAddons.length; i++) {
|
||||
let addon = aAddons[i];
|
||||
|
||||
@ -563,6 +564,7 @@ var ExtensionsView = {
|
||||
continue;
|
||||
}
|
||||
|
||||
appendedAddons++;
|
||||
// Convert the numeric type to a string
|
||||
let types = {"2":"extension", "4":"theme", "8":"locale"};
|
||||
addon.type = types[addon.type];
|
||||
@ -584,6 +586,7 @@ var ExtensionsView = {
|
||||
if (aShowCount < 0)
|
||||
item.hidden = true;
|
||||
}
|
||||
return appendedAddons;
|
||||
},
|
||||
|
||||
showMoreSearchResults: function showMoreSearchResults() {
|
||||
@ -652,15 +655,16 @@ var ExtensionsView = {
|
||||
// We only show extra browse add-ons if the recommended count is small. Otherwise, the user
|
||||
// can see more by pressing the "Show More" button
|
||||
this.appendSearchResults(aRecommendedAddons, false, aRecommendedAddons.length);
|
||||
this.appendSearchResults(aBrowseAddons, true, (aRecommendedAddons.length >= kAddonPageSize ? 0 : kAddonPageSize));
|
||||
let minOverflow = (aRecommendedAddons.length >= kAddonPageSize ? 0 : kAddonPageSize);
|
||||
let numAdded = this.appendSearchResults(aBrowseAddons, true, minOverflow);
|
||||
|
||||
let totalAddons = aRecommendedAddons.length + aBrowseAddons.length;
|
||||
let totalAddons = aRecommendedAddons.length + numAdded;
|
||||
|
||||
let showmore = document.createElement("richlistitem");
|
||||
showmore.setAttribute("typeName", "showmore");
|
||||
showmore.setAttribute("pagelabel", strings.GetStringFromName("addonsBrowseAll.seeMore"));
|
||||
showmore.setAttribute("onpagecommand", "ExtensionsView.showMoreSearchResults();");
|
||||
showmore.setAttribute("hidepage", totalAddons > kAddonPageSize ? "false" : "true");
|
||||
showmore.setAttribute("hidepage", numAdded > minOverflow ? "false" : "true");
|
||||
showmore.setAttribute("sitelabel", strings.GetStringFromName("addonsBrowseAll.browseSite"));
|
||||
showmore.setAttribute("onsitecommand", "ExtensionsView.showMoreResults('" + browseURL + "');");
|
||||
this.addItem(showmore, "repo");
|
||||
|
Loading…
Reference in New Issue
Block a user