diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-06-21 12:13:12 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-06-21 12:13:12 +0200 |
commit | b3fd353723ef4b9a180c363f457e2582ff665ca1 (patch) | |
tree | 527dac2cac246c8ae1bf1b44b690b75f0cc9730d /application/palemoon/base/content/newtab/sites.js | |
parent | 072b81e0a5d4ea4dedc9ae98632a49b7cb4c24ef (diff) | |
download | UXP-b3fd353723ef4b9a180c363f457e2582ff665ca1.tar UXP-b3fd353723ef4b9a180c363f457e2582ff665ca1.tar.gz UXP-b3fd353723ef4b9a180c363f457e2582ff665ca1.tar.lz UXP-b3fd353723ef4b9a180c363f457e2582ff665ca1.tar.xz UXP-b3fd353723ef4b9a180c363f457e2582ff665ca1.zip |
Issue #517 Part 7: Remove enhanced/sponsored links styling and page code
Diffstat (limited to 'application/palemoon/base/content/newtab/sites.js')
-rw-r--r-- | application/palemoon/base/content/newtab/sites.js | 81 |
1 files changed, 3 insertions, 78 deletions
diff --git a/application/palemoon/base/content/newtab/sites.js b/application/palemoon/base/content/newtab/sites.js index 4473cf339..a368146bb 100644 --- a/application/palemoon/base/content/newtab/sites.js +++ b/application/palemoon/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; @@ -171,10 +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 : + let title = this.link.type == "history" ? this.link.baseDomain : this.title; let tooltip = (this.title == url ? this.title : this.title + "\n" + url); @@ -189,22 +187,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 = - `<div class='newtab-suggested-bounds'> ${explanation} </div>`; - } - if (this.isPinned()) this._updateAttributes(true); // Capture the page if the thumbnail is missing, which will cause page.js @@ -243,9 +225,7 @@ Site.prototype = { * Refreshes the thumbnail for the site. */ 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 +247,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 +266,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); }, /** @@ -341,21 +304,6 @@ Site.prototype = { 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"); - } }, /** @@ -376,31 +324,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 +343,6 @@ Site.prototype = { action = "pin"; } } - - // Report all link click actions - if (action) { - // DirectoryLinksProvider.reportSitesAction(gGrid.sites, action, tileIndex); - } }, /** |