diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2019-05-26 21:11:44 -0400 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2019-05-26 21:11:44 -0400 |
commit | 855fd1dfe369303a055e02b9188e602b1f9ed9ac (patch) | |
tree | 1b97e9228d694c46d46b07a4a621195b3f24fa49 | |
parent | 4e485f439d45e26d446e74838b1585d5658ce772 (diff) | |
download | iceweasel-uxp-855fd1dfe369303a055e02b9188e602b1f9ed9ac.tar.gz |
Backport UXP #246 - Remove more of compact mode and newtab junk
-rw-r--r-- | app/profile/iceweasel-uxp.js | 6 | ||||
-rw-r--r-- | base/content/newtab/customize.js | 7 | ||||
-rw-r--r-- | base/content/newtab/page.js | 35 | ||||
-rw-r--r-- | base/content/newtab/sites.js | 63 | ||||
-rw-r--r-- | components/newtab/NewTabPrefsProvider.jsm | 2 | ||||
-rw-r--r-- | locales/en-US/chrome/browser/newTab.dtd | 1 | ||||
-rw-r--r-- | modules/AboutNewTab.jsm | 1 | ||||
-rw-r--r-- | themes/preprocess-tab-svgs.pyc | bin | 0 -> 1213 bytes | |||
-rw-r--r-- | themes/shared/newtab/newTab.inc.css | 76 |
9 files changed, 67 insertions, 124 deletions
diff --git a/app/profile/iceweasel-uxp.js b/app/profile/iceweasel-uxp.js index 3be621a..5600495 100644 --- a/app/profile/iceweasel-uxp.js +++ b/app/profile/iceweasel-uxp.js @@ -1003,12 +1003,6 @@ pref("browser.newtabpage.introShown", false); // Toggles the content of 'about:newtab'. Shows the grid when enabled. pref("browser.newtabpage.enabled", true); -// Toggles the enhanced content of 'about:newtab'. -sticky_pref("browser.newtabpage.enhanced", false); - -// enables Activity Stream inspired layout -pref("browser.newtabpage.compact", false); - // enables showing basic placeholders for missing thumbnails pref("browser.newtabpage.thumbnailPlaceholder", false); diff --git a/base/content/newtab/customize.js b/base/content/newtab/customize.js index f50d83a..4cfb452 100644 --- a/base/content/newtab/customize.js +++ b/base/content/newtab/customize.js @@ -9,7 +9,6 @@ var gCustomize = { "blank", "button", "classic", - "enhanced", "panel", "overlay", ], @@ -81,13 +80,13 @@ 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}); + sendAsyncMessage("NewTab:Customize", {enabled: true}); break; case "newtab-customize-enhanced": - sendAsyncMessage("NewTab:Customize", {enabled: true, enhanced: !gAllPages.enhanced}); + sendAsyncMessage("NewTab:Customize", {enabled: true}); break; } }, diff --git a/base/content/newtab/page.js b/base/content/newtab/page.js index 3df8e9a..257a98c 100644 --- a/base/content/newtab/page.js +++ b/base/content/newtab/page.js @@ -48,11 +48,6 @@ var gPage = { let enabled = gAllPages.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. if (enabled) { this._init(); @@ -79,10 +74,7 @@ var gPage = { update(reason = "") { // Update immediately if we're visible. if (!document.hidden) { - // Ignore updates where reason=links-changed as those signal that the - // provider's set of links changed. We don't want to update visible pages - // in that case, it is ok to wait until the user opens the next tab. - if (reason != "links-changed" && gGrid.ready) { + if (gGrid.ready) { gGrid.refresh(); } @@ -94,14 +86,14 @@ var gPage = { return; } - this._scheduleUpdateTimeout = requestIdleCallback(() => { + this._scheduleUpdateTimeout = setTimeout(() => { // Refresh if the grid is ready. if (gGrid.ready) { gGrid.refresh(); } this._scheduleUpdateTimeout = null; - }, {timeout: SCHEDULE_UPDATE_TIMEOUT_MS}); + }, SCHEDULE_UPDATE_TIMEOUT_MS); }, /** @@ -119,10 +111,6 @@ var gPage = { document.getElementById("newtab-search-submit").value = document.body.getAttribute("dir") == "ltr" ? "\u25B6" : "\u25C0"; - if (Services.prefs.getBoolPref("browser.newtabpage.compact")) { - document.body.classList.add("compact"); - } - // Initialize search. gSearch.init(); @@ -211,7 +199,7 @@ var gPage = { case "visibilitychange": // Cancel any delayed updates for hidden pages now that we're visible. if (this._scheduleUpdateTimeout) { - cancelIdleCallback(this._scheduleUpdateTimeout); + clearTimeout(this._scheduleUpdateTimeout); this._scheduleUpdateTimeout = null; // An update was pending so force an update now. @@ -228,7 +216,10 @@ var gPage = { for (let site of gGrid.sites) { if (site) { - site.captureIfMissing(); + // The site may need to modify and/or re-render itself if + // something changed after newtab was created by preloader. + // For example, the suggested tile endTime may have passed. + site.onFirstVisible(); } } @@ -243,11 +234,5 @@ var gPage = { }, onPageVisibleAndLoaded() { - // Maybe tell the user they can undo an initial automigration - this.maybeShowAutoMigrationUndoNotification(); - }, - - maybeShowAutoMigrationUndoNotification() { - sendAsyncMessage("NewTab:MaybeShowAutoMigrationUndoNotification"); - }, -};
\ No newline at end of file + } +}; diff --git a/base/content/newtab/sites.js b/base/content/newtab/sites.js index 694cd07..1ede993 100644 --- a/base/content/newtab/sites.js +++ b/base/content/newtab/sites.js @@ -53,13 +53,19 @@ Site.prototype = { /** * Pins the site on its current or a given index. * @param aIndex The pinned index (optional). + * @return true if link changed type after pin */ pin: function Site_pin(aIndex) { if (typeof aIndex == "undefined") aIndex = this.cell.index; this._updateAttributes(true); - gPinnedLinks.pin(this._link, aIndex); + let changed = gPinnedLinks.pin(this._link, aIndex); + if (changed) { + // render site again + this._render(); + } + return changed; }, /** @@ -131,15 +137,30 @@ Site.prototype = { }, /** + * Checks for and modifies link at campaign end time + */ + _checkLinkEndTime: function Site_checkLinkEndTime() { + if (this.link.endTime && this.link.endTime < Date.now()) { + let oldUrl = this.url; + // chop off the path part from url + 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; + // remove endTime to avoid further time checks + delete this.link.endTime; + gPinnedLinks.replace(oldUrl, this.link); + } + }, + + /** * Renders the site's data (fills the HTML fragment). */ _render: function Site_render() { + // first check for end time, as it may modify the link + this._checkLinkEndTime(); // setup display variables - let enhanced = gAllPages.enhanced 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"); @@ -163,6 +184,21 @@ Site.prototype = { }, /** + * Called when the site's tab becomes visible for the first time. + * Since the newtab may be preloaded long before it's displayed, + * check for changed conditions and re-render if needed + */ + onFirstVisible: function Site_onFirstVisible() { + if (this.link.endTime && this.link.endTime < Date.now()) { + // site needs to change landing url and background image + this._render(); + } + else { + this.captureIfMissing(); + } + }, + + /** * Captures the site's thumbnail in the background, but only if there's no * existing thumbnail and the page allows background captures. */ @@ -177,8 +213,7 @@ Site.prototype = { */ refreshThumbnail: function Site_refreshThumbnail() { // Only enhance tiles if that feature is turned on - let link = gAllPages.enhanced - this.link; + let link = this.link; let thumbnail = this._querySelector(".newtab-thumbnail.thumbnail"); if (link.bgColor) { @@ -200,11 +235,15 @@ 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 + '")'; - } + _ignoreHoverEvents: function(element) { + element.addEventListener("mouseover", () => { + this.cell.node.setAttribute("ignorehover", "true"); + }); + element.addEventListener("mouseout", () => { + this.cell.node.removeAttribute("ignorehover"); + }); }, /** @@ -304,4 +343,4 @@ Site.prototype = { break; } } -};
\ No newline at end of file +}; diff --git a/components/newtab/NewTabPrefsProvider.jsm b/components/newtab/NewTabPrefsProvider.jsm index c1d8b41..ad0d1e5 100644 --- a/components/newtab/NewTabPrefsProvider.jsm +++ b/components/newtab/NewTabPrefsProvider.jsm @@ -21,7 +21,6 @@ const gPrefsMap = new Map([ ["browser.newtabpage.remote.mode", "str"], ["browser.newtabpage.remote.version", "str"], ["browser.newtabpage.enabled", "bool"], - ["browser.newtabpage.enhanced", "bool"], ["browser.newtabpage.introShown", "bool"], ["browser.newtabpage.updateIntroShown", "bool"], ["browser.newtabpage.pinned", "str"], @@ -34,7 +33,6 @@ const gPrefsMap = new Map([ // prefs that are important for the newtab page const gNewtabPagePrefs = new Set([ "browser.newtabpage.enabled", - "browser.newtabpage.enhanced", "browser.newtabpage.pinned", "browser.newtabpage.blocked", "browser.newtabpage.introShown", diff --git a/locales/en-US/chrome/browser/newTab.dtd b/locales/en-US/chrome/browser/newTab.dtd index b6e7abf..2a4b65b 100644 --- a/locales/en-US/chrome/browser/newTab.dtd +++ b/locales/en-US/chrome/browser/newTab.dtd @@ -5,7 +5,6 @@ <!-- These strings are used in the about:newtab page --> <!ENTITY newtab.pageTitle "New Tab"> <!ENTITY newtab.customize.classic "Show your top sites"> -<!ENTITY newtab.customize.cog.enhanced "Include suggested sites"> <!ENTITY newtab.customize.cog.title2 "NEW TAB CONTROLS"> <!ENTITY newtab.customize.title "Customize your New Tab page"> <!ENTITY newtab.customize.blank2 "Show blank page"> diff --git a/modules/AboutNewTab.jsm b/modules/AboutNewTab.jsm index 4337c5a..e170e9c 100644 --- a/modules/AboutNewTab.jsm +++ b/modules/AboutNewTab.jsm @@ -33,7 +33,6 @@ var AboutNewTab = { customize: function(message) { NewTabUtils.allPages.enabled = message.data.enabled; - NewTabUtils.allPages.enhanced = message.data.enhanced; }, uninit: function() { diff --git a/themes/preprocess-tab-svgs.pyc b/themes/preprocess-tab-svgs.pyc Binary files differnew file mode 100644 index 0000000..e07d857 --- /dev/null +++ b/themes/preprocess-tab-svgs.pyc diff --git a/themes/shared/newtab/newTab.inc.css b/themes/shared/newtab/newTab.inc.css index 4db815d..e94dd0b 100644 --- a/themes/shared/newtab/newTab.inc.css +++ b/themes/shared/newtab/newTab.inc.css @@ -99,19 +99,6 @@ border-radius: 2px; } -/* GRID */ -#topsites-heading { - color: #7A7A7A; - font-size: 1em; - font-weight: normal; - /* Position the heading such that it doesn't affect how many cells we - can fit into the grid. */ - position: absolute; - /* The top margin moves the heading away from the grid. - The horizontal margin aligns the heading with the cells. */ - margin: -1em 10px 0; -} - /* CELLS */ .newtab-cell { --cell-corner-radius: 8px; @@ -119,10 +106,6 @@ border-radius: var(--cell-corner-radius); } -body.compact .newtab-cell { - --cell-corner-radius: 2px; -} - .newtab-cell:empty { outline: 2px dashed #c1c1c1; outline-offset: -2px; @@ -171,31 +154,16 @@ body.compact .newtab-cell { transition: opacity 100ms ease-out; } -body.compact .newtab-thumbnail { - height: 100%; - border-radius: calc(var(--cell-corner-radius) + 1px); - outline: 1px solid hsla(0,0%,0%,.1); - -moz-outline-radius: var(--cell-corner-radius); - outline-offset: -1px; -} - .newtab-thumbnail.placeholder { color: white; font-size: 85px; line-height: 200%; } -body.compact .newtab-thumbnail.placeholder { - font-size: 45px; -} - -.newtab-cell:not([ignorehover]) .newtab-site:hover .newtab-thumbnail.enhanced-content { - opacity: 0; -} - /* TITLES */ .newtab-title { + color: #5c5c5c; background-color: #F2F2F2; font-size: 13px; line-height: 30px; @@ -203,37 +171,13 @@ body.compact .newtab-thumbnail.placeholder { border-radius: 0 0 var(--cell-corner-radius) var(--cell-corner-radius); } -body.compact .newtab-title { - background-color: hsla(0,0%,100%,.85); - font-size: 12px; - line-height: 21px; - border: 1px solid hsla(0,0%,80%,.8); - border-top-color: hsla(0,0%,0%,.1); - background-clip: padding-box; -} - -.newtab-title { - color: #5c5c5c; -} - -body.compact .newtab-title { - color: black; -} - -body:not(.compact) .newtab-site:hover .newtab-title { +.newtab-site:hover .newtab-title { color: white; background-color: #333; border-color: #333; border-top-color: white; } -body.compact .newtab-site:hover .newtab-title { - color: white; - background-color: hsla(0,0%,20%,.85); - border-color: hsla(0,0%,0%,.8); - border-top-color: white; -} - .newtab-site[pinned] .newtab-title { padding-inline-start: 24px; } @@ -275,20 +219,6 @@ body.compact .newtab-site:hover .newtab-title { right: 4px; } -body.compact .newtab-control { - top: -8px; -} - -body.compact .newtab-control-pin:dir(ltr), -body.compact .newtab-control-block:dir(rtl) { - left: -8px; -} - -body.compact .newtab-control-block:dir(ltr), -body.compact .newtab-control-pin:dir(rtl) { - right: -8px; -} - .newtab-control-pin, .newtab-site[pinned] .newtab-control-pin:hover:active { background-image: -moz-image-rect(url(chrome://browser/skin/newtab/controls.svg), 0, 96, 32, 64); @@ -314,4 +244,4 @@ body.compact .newtab-control-pin:dir(rtl) { .newtab-control-block:hover:active { background-image: -moz-image-rect(url(chrome://browser/skin/newtab/controls.svg), 0, 256, 32, 224); -}
\ No newline at end of file +} |