From 73d1087fce186a8932db294866306f10ab01059b Mon Sep 17 00:00:00 2001 From: adeshkp Date: Sat, 25 May 2019 11:21:55 -0400 Subject: Issue #246 - Remove more of compact mode and newtab junk from Basilisk --- .../basilisk/base/content/newtab/customize.js | 8 ++--- application/basilisk/base/content/newtab/grid.js | 7 ---- application/basilisk/base/content/newtab/page.js | 37 ---------------------- application/basilisk/base/content/newtab/sites.js | 32 ++----------------- 4 files changed, 4 insertions(+), 80 deletions(-) (limited to 'application/basilisk/base') diff --git a/application/basilisk/base/content/newtab/customize.js b/application/basilisk/base/content/newtab/customize.js index 39724fa91..bc4903f6c 100644 --- a/application/basilisk/base/content/newtab/customize.js +++ b/application/basilisk/base/content/newtab/customize.js @@ -9,7 +9,6 @@ var gCustomize = { "blank", "button", "classic", - "enhanced", "panel", "overlay", "learn" @@ -83,13 +82,10 @@ var gCustomize = { } switch (event.currentTarget.id) { case "newtab-customize-blank": - sendAsyncMessage("NewTab:Customize", {enabled: false, enhanced: false}); + sendAsyncMessage("NewTab:Customize", {enabled: false}); break; case "newtab-customize-classic": - sendAsyncMessage("NewTab:Customize", {enabled: true, enhanced: false}); - break; - case "newtab-customize-enhanced": - sendAsyncMessage("NewTab:Customize", {enabled: true, enhanced: !gAllPages.enhanced}); + sendAsyncMessage("NewTab:Customize", {enabled: true}); break; case "newtab-customize-learn": this.showLearn(); diff --git a/application/basilisk/base/content/newtab/grid.js b/application/basilisk/base/content/newtab/grid.js index 415a25933..726150a6c 100644 --- a/application/basilisk/base/content/newtab/grid.js +++ b/application/basilisk/base/content/newtab/grid.js @@ -141,13 +141,9 @@ var gGrid = { // Create sites. let numLinks = Math.min(links.length, cells.length); - let hasHistoryTiles = false; for (let i = 0; i < numLinks; i++) { if (links[i]) { this.createSite(links[i], cells[i]); - if (links[i].type == "history") { - hasHistoryTiles = true; - } } } @@ -156,9 +152,6 @@ var gGrid = { this._gridDefaultContent.nextSibling.remove(); } this._node.appendChild(fragment); - - document.getElementById("topsites-heading").textContent = - hasHistoryTiles ? "Your Top Sites" : "Top Sites"; }, /** diff --git a/application/basilisk/base/content/newtab/page.js b/application/basilisk/base/content/newtab/page.js index b92d3d5ce..7c19a9827 100644 --- a/application/basilisk/base/content/newtab/page.js +++ b/application/basilisk/base/content/newtab/page.js @@ -162,16 +162,6 @@ var gPage = { */ _handleUnloadEvent: function Page_handleUnloadEvent() { 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); - } }, /** @@ -246,32 +236,5 @@ var gPage = { }, onPageVisibleAndLoaded() { - // Send the index of the last visible tile. - this.reportLastVisibleTileIndex(); - }, - - 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; - } - } - } - } } }; diff --git a/application/basilisk/base/content/newtab/sites.js b/application/basilisk/base/content/newtab/sites.js index b952deca5..00f81869a 100644 --- a/application/basilisk/base/content/newtab/sites.js +++ b/application/basilisk/base/content/newtab/sites.js @@ -62,7 +62,7 @@ Site.prototype = { this._updateAttributes(true); let changed = gPinnedLinks.pin(this._link, aIndex); if (changed) { - // render site again to remove suggested/sponsored tags + // render site again this._render(); } return changed; @@ -136,15 +136,6 @@ Site.prototype = { return str; }, - _getSuggestedTileExplanation: function() { - let targetedName = ` ${this.link.targetedName} `; - let targetedSite = ` ${this.link.targetedSite} `; - 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 */ @@ -155,11 +146,8 @@ Site.prototype = { this.link.url = Services.io.newURI(this.url, null, null).resolve("/"); // clear supplied images - this triggers thumbnail download for new url delete this.link.imageURI; - delete this.link.enhancedImageURI; // remove endTime to avoid further time checks 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); } }, @@ -186,22 +174,6 @@ Site.prototype = { titleNode.style.backgroundColor = this.link.titleBgColor; } - // remove "suggested" attribute to avoid showing "suggested" tag - // after site was pinned or dropped - this.node.removeAttribute("suggested"); - - if (this.link.targetedSite) { - if (this.node.getAttribute("type") != "sponsored") { - this._querySelector(".newtab-sponsored").textContent = - newTabString("suggested.tag"); - } - - this.node.setAttribute("suggested", true); - let explanation = this._getSuggestedTileExplanation(); - this._querySelector(".newtab-suggested").innerHTML = - `
${explanation}
`; - } - if (this.isPinned()) this._updateAttributes(true); // Capture the page if the thumbnail is missing, which will cause page.js @@ -343,7 +315,7 @@ Site.prototype = { } else if (!pinned && target.classList.contains("newtab-control-pin")) { if (this.pin()) { - // suggested link has changed - update rest of the pages + // link has changed - update rest of the pages gAllPages.update(gPage); } action = "pin"; -- cgit v1.2.3