mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-30 20:37:31 +09:00
Issue #246 - Remove "enhanced" newtab code from Pale Moon
This commit is contained in:
parent
05276951a7
commit
825f472a93
4 changed files with 2 additions and 69 deletions
|
|
@ -1077,9 +1077,6 @@ pref("browser.newtab.preload", false);
|
||||||
// Toggles the content of 'about:newtab'. Shows the grid when enabled.
|
// Toggles the content of 'about:newtab'. Shows the grid when enabled.
|
||||||
pref("browser.newtabpage.enabled", true);
|
pref("browser.newtabpage.enabled", true);
|
||||||
|
|
||||||
// XXX: Remove this when "enhanced" tiles are dead
|
|
||||||
pref("browser.newtabpage.enhanced", false);
|
|
||||||
|
|
||||||
// Disables capturing of page thumbnails
|
// Disables capturing of page thumbnails
|
||||||
pref("browser.pagethumbnails.capturing_disabled", false);
|
pref("browser.pagethumbnails.capturing_disabled", false);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -130,13 +130,9 @@ var gGrid = {
|
||||||
|
|
||||||
// Create sites.
|
// Create sites.
|
||||||
let numLinks = Math.min(links.length, cells.length);
|
let numLinks = Math.min(links.length, cells.length);
|
||||||
let hasHistoryTiles = false;
|
|
||||||
for (let i = 0; i < numLinks; i++) {
|
for (let i = 0; i < numLinks; i++) {
|
||||||
if (links[i]) {
|
if (links[i]) {
|
||||||
this.createSite(links[i], cells[i]);
|
this.createSite(links[i], cells[i]);
|
||||||
if (links[i].type == "history") {
|
|
||||||
hasHistoryTiles = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,11 +47,6 @@ var gPage = {
|
||||||
let enabled = gAllPages.enabled;
|
let enabled = gAllPages.enabled;
|
||||||
this._updateAttributes(enabled);
|
this._updateAttributes(enabled);
|
||||||
|
|
||||||
// Update thumbnails to the new enhanced setting
|
|
||||||
if (aData == "browser.newtabpage.enhanced") {
|
|
||||||
this.update();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize the whole page if we haven't done that, yet.
|
// Initialize the whole page if we haven't done that, yet.
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
this._init();
|
this._init();
|
||||||
|
|
@ -166,16 +161,6 @@ var gPage = {
|
||||||
*/
|
*/
|
||||||
_handleUnloadEvent: function Page_handleUnloadEvent() {
|
_handleUnloadEvent: function Page_handleUnloadEvent() {
|
||||||
gAllPages.unregister(this);
|
gAllPages.unregister(this);
|
||||||
// compute page life-span and send telemetry probe: using milli-seconds will leave
|
|
||||||
// many low buckets empty. Instead we use half-second precision to make low end
|
|
||||||
// of histogram linear and not lose the change in user attention
|
|
||||||
let delta = Math.round((Date.now() - this._firstVisibleTime) / 500);
|
|
||||||
if (this._suggestedTilePresent) {
|
|
||||||
Services.telemetry.getHistogramById("NEWTAB_PAGE_LIFE_SPAN_SUGGESTED").add(delta);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Services.telemetry.getHistogramById("NEWTAB_PAGE_LIFE_SPAN").add(delta);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -250,43 +235,10 @@ var gPage = {
|
||||||
},
|
},
|
||||||
|
|
||||||
onPageVisibleAndLoaded() {
|
onPageVisibleAndLoaded() {
|
||||||
// Send the index of the last visible tile.
|
|
||||||
this.reportLastVisibleTileIndex();
|
|
||||||
// Maybe tell the user they can undo an initial automigration
|
|
||||||
this.maybeShowAutoMigrationUndoNotification();
|
|
||||||
},
|
|
||||||
|
|
||||||
reportLastVisibleTileIndex() {
|
|
||||||
let cwu = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
||||||
.getInterface(Ci.nsIDOMWindowUtils);
|
|
||||||
|
|
||||||
let rect = cwu.getBoundsWithoutFlushing(gGrid.node);
|
|
||||||
let nodes = cwu.nodesFromRect(rect.left, rect.top, 0, rect.width,
|
|
||||||
rect.height, 0, true, false);
|
|
||||||
|
|
||||||
let i = -1;
|
|
||||||
let lastIndex = -1;
|
|
||||||
let sites = gGrid.sites;
|
|
||||||
|
|
||||||
for (let node of nodes) {
|
|
||||||
if (node.classList && node.classList.contains("newtab-cell")) {
|
|
||||||
if (sites[++i]) {
|
|
||||||
lastIndex = i;
|
|
||||||
if (sites[i].link.targetedSite) {
|
|
||||||
// record that suggested tile is shown to use suggested-tiles-histogram
|
|
||||||
this._suggestedTilePresent = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleEnabled: function(aEvent) {
|
toggleEnabled: function(aEvent) {
|
||||||
gAllPages.enabled = !gAllPages.enabled;
|
gAllPages.enabled = !gAllPages.enabled;
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
},
|
}
|
||||||
|
|
||||||
maybeShowAutoMigrationUndoNotification() {
|
|
||||||
// sendAsyncMessage("NewTab:MaybeShowAutoMigrationUndoNotification");
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -136,15 +136,6 @@ Site.prototype = {
|
||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getSuggestedTileExplanation: function() {
|
|
||||||
let targetedName = `<strong> ${this.link.targetedName} </strong>`;
|
|
||||||
let targetedSite = `<strong> ${this.link.targetedSite} </strong>`;
|
|
||||||
if (this.link.explanation) {
|
|
||||||
return this._newTabString(this.link.explanation, [targetedName, targetedSite]);
|
|
||||||
}
|
|
||||||
return newTabString("suggested.button", [targetedName]);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks for and modifies link at campaign end time
|
* Checks for and modifies link at campaign end time
|
||||||
*/
|
*/
|
||||||
|
|
@ -155,11 +146,8 @@ Site.prototype = {
|
||||||
this.link.url = Services.io.newURI(this.url, null, null).resolve("/");
|
this.link.url = Services.io.newURI(this.url, null, null).resolve("/");
|
||||||
// clear supplied images - this triggers thumbnail download for new url
|
// clear supplied images - this triggers thumbnail download for new url
|
||||||
delete this.link.imageURI;
|
delete this.link.imageURI;
|
||||||
delete this.link.enhancedImageURI;
|
|
||||||
// remove endTime to avoid further time checks
|
// remove endTime to avoid further time checks
|
||||||
delete this.link.endTime;
|
delete this.link.endTime;
|
||||||
// clear enhanced-content image that may still exist in preloaded page
|
|
||||||
this._querySelector(".enhanced-content").style.backgroundImage = "";
|
|
||||||
gPinnedLinks.replace(oldUrl, this.link);
|
gPinnedLinks.replace(oldUrl, this.link);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -337,7 +325,7 @@ Site.prototype = {
|
||||||
}
|
}
|
||||||
else if (!pinned && target.classList.contains("newtab-control-pin")) {
|
else if (!pinned && target.classList.contains("newtab-control-pin")) {
|
||||||
if (this.pin()) {
|
if (this.pin()) {
|
||||||
// suggested link has changed - update rest of the pages
|
// link has changed - update rest of the pages
|
||||||
gAllPages.update(gPage);
|
gAllPages.update(gPage);
|
||||||
}
|
}
|
||||||
action = "pin";
|
action = "pin";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue