Skip to content
This repository has been archived by the owner on Dec 28, 2022. It is now read-only.

Commit

Permalink
Overturn "one tile per site" change in Firefox 33
Browse files Browse the repository at this point in the history
  • Loading branch information
darktrojan committed Sep 5, 2014
1 parent 2115e29 commit 8a013df
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,28 @@ function startup(aParams, aReason) {
userPrefs.setIntPref("version", parseInt(aParams.version));

NewTabUtils.links._oldGetLinks = NewTabUtils.links.getLinks;
NewTabUtils.links.getLinks = function() {
let list = NewTabUtils.links._oldGetLinks();
NewTabUtils.links.getLinks = function Links_getLinks() {
let pinnedLinks = Array.slice(NewTabUtils.pinnedLinks.links);
let links = this._getMergedProviderLinks();

// Filter blocked and pinned links.
links = links.filter(function (link) {
return !NewTabUtils.blockedLinks.isBlocked(link) && !NewTabUtils.pinnedLinks.isPinned(link);
});

// Try to fill the gaps between pinned links.
for (let i = 0; i < pinnedLinks.length && links.length; i++)
if (!pinnedLinks[i])
pinnedLinks[i] = links.shift();

// Append the remaining links if any.
if (links.length)
pinnedLinks = pinnedLinks.concat(links);

if (userPrefs.prefHasUserValue("filter")) {
let countPref = userPrefs.getCharPref("filter");
let counts = JSON.parse(countPref);
return list.filter(function(aItem) {
return pinnedLinks.filter(function(aItem) {
if (NewTabUtils.pinnedLinks.isPinned(aItem))
return true;
let match = /^https?:\/\/([^\/]+)\//.exec(aItem.url);
Expand All @@ -89,7 +105,7 @@ function startup(aParams, aReason) {
return true;
});
} else {
return list;
return pinnedLinks;
}
}

Expand Down

0 comments on commit 8a013df

Please sign in to comment.