summaryrefslogtreecommitdiffstats
path: root/application/basilisk/base/content/newtab/sites.js
diff options
context:
space:
mode:
authoradeshkp <adeshkp@users.noreply.github.com>2019-05-25 11:19:38 -0400
committeradeshkp <adeshkp@users.noreply.github.com>2019-05-25 11:19:38 -0400
commit1eca3c3a6306e33efe3c18ce60e91d2a71095c56 (patch)
tree0b6b13a2a36652702da9ec571c30e16670137050 /application/basilisk/base/content/newtab/sites.js
parent915ffc660053cc48153c00dec66b913517dba794 (diff)
downloadUXP-1eca3c3a6306e33efe3c18ce60e91d2a71095c56.tar
UXP-1eca3c3a6306e33efe3c18ce60e91d2a71095c56.tar.gz
UXP-1eca3c3a6306e33efe3c18ce60e91d2a71095c56.tar.lz
UXP-1eca3c3a6306e33efe3c18ce60e91d2a71095c56.tar.xz
UXP-1eca3c3a6306e33efe3c18ce60e91d2a71095c56.zip
Issue #246 - Revert "Revert "Remove unwanted newtab page code""
Page thumbnails hiccups seem to have resolved, so it can be landed again. This reverts commit 51792b31a36b9539fdd1b4b85abe486c1652b6c4. Conflicts: application/basilisk/modules/DirectoryLinksProvider.jsm
Diffstat (limited to 'application/basilisk/base/content/newtab/sites.js')
-rw-r--r--application/basilisk/base/content/newtab/sites.js73
1 files changed, 2 insertions, 71 deletions
diff --git a/application/basilisk/base/content/newtab/sites.js b/application/basilisk/base/content/newtab/sites.js
index 9d103ce9b..b952deca5 100644
--- a/application/basilisk/base/content/newtab/sites.js
+++ b/application/basilisk/base/content/newtab/sites.js
@@ -171,11 +171,8 @@ Site.prototype = {
// first check for end time, as it may modify the link
this._checkLinkEndTime();
// setup display variables
- let enhanced = gAllPages.enhanced && DirectoryLinksProvider.getEnhancedLink(this.link);
let url = this.url;
- let title = enhanced && enhanced.title ? enhanced.title :
- this.link.type == "history" ? this.link.baseDomain :
- this.title;
+ let title = this.link.type == "history" ? this.link.baseDomain : this.title;
let tooltip = (this.title == url ? this.title : this.title + "\n" + url);
let link = this._querySelector(".newtab-link");
@@ -244,8 +241,7 @@ Site.prototype = {
*/
refreshThumbnail: function Site_refreshThumbnail() {
// Only enhance tiles if that feature is turned on
- let link = gAllPages.enhanced && DirectoryLinksProvider.getEnhancedLink(this.link) ||
- this.link;
+ let link = this.link;
let thumbnail = this._querySelector(".newtab-thumbnail.thumbnail");
if (link.bgColor) {
@@ -267,16 +263,6 @@ Site.prototype = {
placeholder.style.backgroundColor = "hsl(" + hue + ",80%,40%)";
placeholder.textContent = link.baseDomain.substr(0,1).toUpperCase();
}
-
- if (link.enhancedImageURI) {
- let enhanced = this._querySelector(".enhanced-content");
- enhanced.style.backgroundImage = 'url("' + link.enhancedImageURI + '")';
-
- if (this.link.type != link.type) {
- this.node.setAttribute("type", "enhanced");
- this.enhancedId = link.directoryId;
- }
- }
},
_ignoreHoverEvents: function(element) {
@@ -296,13 +282,6 @@ Site.prototype = {
this._node.addEventListener("dragstart", this, false);
this._node.addEventListener("dragend", this, false);
this._node.addEventListener("mouseover", this, false);
-
- // Specially treat the sponsored icon & suggested explanation
- // text to prevent regular hover effects
- let sponsored = this._querySelector(".newtab-sponsored");
- let suggested = this._querySelector(".newtab-suggested");
- this._ignoreHoverEvents(sponsored);
- this._ignoreHoverEvents(suggested);
},
/**
@@ -333,31 +312,6 @@ Site.prototype = {
.add(aIndex);
},
- _toggleLegalText: function(buttonClass, explanationTextClass) {
- let button = this._querySelector(buttonClass);
- if (button.hasAttribute("active")) {
- let explain = this._querySelector(explanationTextClass);
- explain.parentNode.removeChild(explain);
-
- button.removeAttribute("active");
- }
- else {
- let explain = document.createElementNS(HTML_NAMESPACE, "div");
- explain.className = explanationTextClass.slice(1); // Slice off the first character, '.'
- this.node.appendChild(explain);
-
- let link = '<a href="' + TILES_EXPLAIN_LINK + '">' +
- newTabString("learn.link") + "</a>";
- let type = (this.node.getAttribute("suggested") && this.node.getAttribute("type") == "affiliate") ?
- "suggested" : this.node.getAttribute("type");
- let icon = '<input type="button" class="newtab-control newtab-' +
- (type == "enhanced" ? "customize" : "control-block") + '"/>';
- explain.innerHTML = newTabString(type + (type == "sponsored" ? ".explain2" : ".explain"), [icon, link]);
-
- button.setAttribute("active", "true");
- }
- },
-
/**
* Handles site click events.
*/
@@ -376,31 +330,13 @@ Site.prototype = {
action = "click";
}
}
- // Handle sponsored explanation link click
- else if (target.parentElement.classList.contains("sponsored-explain")) {
- action = "sponsored_link";
- }
- else if (target.parentElement.classList.contains("suggested-explain")) {
- action = "suggested_link";
- }
// Only handle primary clicks for the remaining targets
else if (button == 0) {
aEvent.preventDefault();
if (target.classList.contains("newtab-control-block")) {
- // Notify DirectoryLinksProvider of suggested tile block, this may
- // affect if and how suggested tiles are recommended and needs to
- // be reported before pages are updated inside block() call
- if (this.link.targetedSite) {
- DirectoryLinksProvider.handleSuggestedTileBlock();
- }
this.block();
action = "block";
}
- else if (target.classList.contains("sponsored-explain") ||
- target.classList.contains("newtab-sponsored")) {
- this._toggleLegalText(".newtab-sponsored", ".sponsored-explain");
- action = "sponsored";
- }
else if (pinned && target.classList.contains("newtab-control-pin")) {
this.unpin();
action = "unpin";
@@ -413,11 +349,6 @@ Site.prototype = {
action = "pin";
}
}
-
- // Report all link click actions
- if (action) {
- DirectoryLinksProvider.reportSitesAction(gGrid.sites, action, tileIndex);
- }
},
/**