diff options
Diffstat (limited to 'application/palemoon/base/content')
31 files changed, 120 insertions, 241 deletions
diff --git a/application/palemoon/base/content/abouthome/aboutHome.js b/application/palemoon/base/content/abouthome/aboutHome.js index 9e826b69e..6a970acd6 100644 --- a/application/palemoon/base/content/abouthome/aboutHome.js +++ b/application/palemoon/base/content/abouthome/aboutHome.js @@ -234,8 +234,8 @@ const SEARCH_ENGINES = { }; // This global tracks if the page has been set up before, to prevent double inits -let gInitialized = false; -let gObserver = new MutationObserver(function (mutations) { +var gInitialized = false; +var gObserver = new MutationObserver(function (mutations) { for (let mutation of mutations) { if (mutation.attributeName == "searchEngineURL") { setupSearchEngine(); diff --git a/application/palemoon/base/content/browser-addons.js b/application/palemoon/base/content/browser-addons.js index 7993a0c9c..f5c398f33 100644 --- a/application/palemoon/base/content/browser-addons.js +++ b/application/palemoon/base/content/browser-addons.js @@ -226,7 +226,7 @@ const gXPInstallObserver = { * - If an add-on was installed, incrementing the count, show the bar. * - If an add-on was uninstalled, and no more items are left, hide the bar. */ -let AddonsMgrListener = { +var AddonsMgrListener = { get addonBar() document.getElementById("addon-bar"), get statusBar() document.getElementById("status-bar"), getAddonBarItemCount: function() { @@ -461,7 +461,7 @@ var LightWeightThemeWebInstaller = { /* * Listen for Lightweight Theme styling changes and update the browser's theme accordingly. */ -let LightweightThemeListener = { +var LightweightThemeListener = { _modifiedStyles: [], init: function () { diff --git a/application/palemoon/base/content/browser-gestureSupport.js b/application/palemoon/base/content/browser-gestureSupport.js index d88f47c79..13eb71b99 100644 --- a/application/palemoon/base/content/browser-gestureSupport.js +++ b/application/palemoon/base/content/browser-gestureSupport.js @@ -13,7 +13,7 @@ // chrome-only, we must listen for the simple gesture events during // the capturing phase and call stopPropagation on every event. -let gGestureSupport = { +var gGestureSupport = { _currentRotation: 0, _lastRotateDelta: 0, _rotateMomentumThreshold: .75, @@ -532,7 +532,7 @@ let gGestureSupport = { }; // History Swipe Animation Support (bug 678392) -let gHistorySwipeAnimation = { +var gHistorySwipeAnimation = { active: false, isLTR: false, diff --git a/application/palemoon/base/content/browser-places.js b/application/palemoon/base/content/browser-places.js index cf9c28597..5c13a43f9 100644 --- a/application/palemoon/base/content/browser-places.js +++ b/application/palemoon/base/content/browser-places.js @@ -959,7 +959,7 @@ var PlacesMenuDNDHandler = { * This object handles the initialization and uninitialization of the bookmarks * toolbar. */ -let PlacesToolbarHelper = { +var PlacesToolbarHelper = { _place: "place:folder=TOOLBAR", get _viewElt() { @@ -1006,7 +1006,7 @@ let PlacesToolbarHelper = { * menu button. */ -let BookmarkingUI = { +var BookmarkingUI = { get button() { if (!this._button) { this._button = document.getElementById("bookmarks-menu-button"); diff --git a/application/palemoon/base/content/browser-syncui.js b/application/palemoon/base/content/browser-syncui.js index fc8c7f016..67056e221 100644 --- a/application/palemoon/base/content/browser-syncui.js +++ b/application/palemoon/base/content/browser-syncui.js @@ -3,7 +3,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. // gSyncUI handles updating the tools menu -let gSyncUI = { +var gSyncUI = { _obs: ["weave:service:sync:start", "weave:service:sync:delayed", "weave:service:quota:remaining", diff --git a/application/palemoon/base/content/browser-thumbnails.js b/application/palemoon/base/content/browser-thumbnails.js index b06dfd503..079b0ac1b 100644 --- a/application/palemoon/base/content/browser-thumbnails.js +++ b/application/palemoon/base/content/browser-thumbnails.js @@ -7,7 +7,7 @@ /** * Keeps thumbnails of open web pages up-to-date. */ -let gBrowserThumbnails = { +var gBrowserThumbnails = { /** * Pref that controls whether we can store SSL content on disk */ diff --git a/application/palemoon/base/content/browser-uacompat.js b/application/palemoon/base/content/browser-uacompat.js new file mode 100644 index 000000000..933aa55d1 --- /dev/null +++ b/application/palemoon/base/content/browser-uacompat.js @@ -0,0 +1,45 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +var UserAgentCompatibility = { + PREF_UA_COMPAT: "general.useragent.compatMode", + PREF_UA_COMPAT_GECKO: "general.useragent.compatMode.gecko", + PREF_UA_COMPAT_FIREFOX: "general.useragent.compatMode.firefox", + + init: function() { + this.checkPreferences(); + Services.prefs.addObserver(this.PREF_UA_COMPAT, this, false); + Services.prefs.addObserver(this.PREF_UA_COMPAT_GECKO, this, false); + Services.prefs.addObserver(this.PREF_UA_COMPAT_FIREFOX, this, false); + }, + + uninit: function() { + Services.prefs.removeObserver(this.PREF_UA_COMPAT, this, false); + Services.prefs.removeObserver(this.PREF_UA_COMPAT_GECKO, this, false); + Services.prefs.removeObserver(this.PREF_UA_COMPAT_FIREFOX, this, false); + }, + + observe: function() { + this.checkPreferences(); + }, + + checkPreferences: function() { + var compatMode = Services.prefs.getIntPref(this.PREF_UA_COMPAT); + + switch(compatMode) { + case 0: + Services.prefs.setBoolPref(this.PREF_UA_COMPAT_GECKO, false); + Services.prefs.setBoolPref(this.PREF_UA_COMPAT_FIREFOX, false); + break; + case 1: + Services.prefs.setBoolPref(this.PREF_UA_COMPAT_GECKO, true); + Services.prefs.setBoolPref(this.PREF_UA_COMPAT_FIREFOX, false); + break; + case 2: + Services.prefs.setBoolPref(this.PREF_UA_COMPAT_GECKO, true); + Services.prefs.setBoolPref(this.PREF_UA_COMPAT_FIREFOX, true); + break; + } + } +}; diff --git a/application/palemoon/base/content/browser-webrtcUI.js b/application/palemoon/base/content/browser-webrtcUI.js index a6c9008ca..d59134ce5 100644 --- a/application/palemoon/base/content/browser-webrtcUI.js +++ b/application/palemoon/base/content/browser-webrtcUI.js @@ -3,7 +3,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -let WebrtcIndicator = { +var WebrtcIndicator = { init: function () { let temp = {}; Cu.import("resource:///modules/webrtcUI.jsm", temp); diff --git a/application/palemoon/base/content/browser.css b/application/palemoon/base/content/browser.css index e6a84421b..4865cfee7 100644 --- a/application/palemoon/base/content/browser.css +++ b/application/palemoon/base/content/browser.css @@ -280,6 +280,10 @@ panel[noactions] > richlistbox > richlistitem[type~="action"] > .ac-url-box > .a -moz-binding: url("chrome://browser/content/urlbarBindings.xml#urlbar-rich-result-popup"); } +#DateTimePickerPanel[active="true"] { + -moz-binding: url("chrome://global/content/bindings/datetimepopup.xml#datetime-popup"); +} + /* Pale Moon: Address bar: Feeds */ #ub-feed-button > .button-box > .box-inherit > .button-text, #ub-feed-button > .button-box > .button-menu-dropmarker { @@ -542,11 +546,11 @@ window[chromehidden~="toolbar"] toolbar:not(.toolbar-primary):not(#nav-bar):not( max-width: 280px; } -.form-validation-anchor { +.popup-anchor { /* should occupy space but not be visible */ opacity: 0; - visibility: hidden; pointer-events: none; + -moz-stack-sizing: ignore; } #addon-progress-notification { @@ -627,10 +631,6 @@ statuspanel[inactive][previoustype=overLink] { -moz-box-align: end; } -.panel-inner-arrowcontentfooter[footertype="promobox"] { - -moz-binding: url("chrome://browser/content/urlbarBindings.xml#promobox"); -} - /* highlighter */ %include highlighter.css diff --git a/application/palemoon/base/content/browser.js b/application/palemoon/base/content/browser.js index 3f294d82b..5fe475338 100644 --- a/application/palemoon/base/content/browser.js +++ b/application/palemoon/base/content/browser.js @@ -7,6 +7,7 @@ var Ci = Components.interfaces; var Cu = Components.utils; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); +Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource:///modules/RecentWindow.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Task", @@ -144,6 +145,7 @@ let gInitialPages = [ #include browser-plugins.js #include browser-tabPreviews.js #include browser-thumbnails.js +#include browser-uacompat.js #ifdef MOZ_WEBRTC #include browser-webrtcUI.js @@ -920,6 +922,7 @@ var gBrowserInit = { TabsInTitlebar.init(); retrieveToolbarIconsizesFromTheme(); ToolbarIconColor.init(); + UserAgentCompatibility.init(); #ifdef XP_WIN if (window.matchMedia("(-moz-os-version: windows-win8)").matches && @@ -1296,6 +1299,8 @@ var gBrowserInit = { DevToolsTheme.uninit(); #endif + UserAgentCompatibility.uninit(); + var enumerator = Services.wm.getEnumerator(null); enumerator.getNext(); if (!enumerator.hasMoreElements()) { @@ -2370,7 +2375,7 @@ function BrowserOnAboutPageLoad(doc) { /** * Handle command events bubbling up from error page content */ -let BrowserOnClick = { +var BrowserOnClick = { handleEvent: function BrowserOnClick_handleEvent(aEvent) { if (!aEvent.isTrusted || // Don't trust synthetic events aEvent.button == 2 || aEvent.target.localName != "button") { @@ -7096,7 +7101,8 @@ function focusNextFrame(event) { if (element.ownerDocument == document) focusAndSelectUrlBar(); } -let BrowserChromeTest = { + +var BrowserChromeTest = { _cb: null, _ready: false, markAsReady: function () { @@ -7114,7 +7120,7 @@ let BrowserChromeTest = { } }; -let ToolbarIconColor = { +var ToolbarIconColor = { init: function () { this._initialized = true; diff --git a/application/palemoon/base/content/browser.xul b/application/palemoon/base/content/browser.xul index df152bbaa..ea9c3f969 100644 --- a/application/palemoon/base/content/browser.xul +++ b/application/palemoon/base/content/browser.xul @@ -132,6 +132,20 @@ <!-- for url bar autocomplete --> <panel type="autocomplete-richlistbox" id="PopupAutoCompleteRichResult" noautofocus="true" hidden="true"/> + <!-- for date/time picker. consumeoutsideclicks is set to never, so that + clicks on the anchored input box are never consumed. --> + <panel id="DateTimePickerPanel" + type="arrow" + hidden="true" + orient="vertical" + noautofocus="true" + norolluponanchor="true" + consumeoutsideclicks="never" + level="parent" + tabspecific="true"> + <iframe id="dateTimePopupFrame"/> + </panel> + <!-- for invalid form error message --> <panel id="invalid-form-popup" type="arrow" orient="vertical" noautofocus="true" hidden="true" level="parent"> <description/> @@ -139,7 +153,6 @@ <panel id="editBookmarkPanel" type="arrow" - footertype="promobox" orient="vertical" ignorekeys="true" consumeoutsideclicks="true" @@ -946,7 +959,8 @@ flex="1" contenttooltip="aHTMLTooltip" tabcontainer="tabbrowser-tabs" contentcontextmenu="contentAreaContextMenu" - autocompletepopup="PopupAutoComplete"/> + autocompletepopup="PopupAutoComplete" + datetimepicker="DateTimePickerPanel"/> <chatbar id="pinnedchats" layer="true" mousethrough="always" hidden="true"/> <statuspanel id="statusbar-display" inactive="true"/> </vbox> diff --git a/application/palemoon/base/content/newtab/drag.js b/application/palemoon/base/content/newtab/drag.js index 8f0bf674e..fbd688faa 100644 --- a/application/palemoon/base/content/newtab/drag.js +++ b/application/palemoon/base/content/newtab/drag.js @@ -7,7 +7,7 @@ /** * This singleton implements site dragging functionality. */ -let gDrag = { +var gDrag = { /** * The site offset to the drag start point. */ diff --git a/application/palemoon/base/content/newtab/dragDataHelper.js b/application/palemoon/base/content/newtab/dragDataHelper.js index a66e4e87e..54348ab14 100644 --- a/application/palemoon/base/content/newtab/dragDataHelper.js +++ b/application/palemoon/base/content/newtab/dragDataHelper.js @@ -4,7 +4,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ #endif -let gDragDataHelper = { +var gDragDataHelper = { get mimeType() { return "text/x-moz-url"; }, diff --git a/application/palemoon/base/content/newtab/drop.js b/application/palemoon/base/content/newtab/drop.js index d7bf30506..748652455 100644 --- a/application/palemoon/base/content/newtab/drop.js +++ b/application/palemoon/base/content/newtab/drop.js @@ -11,7 +11,7 @@ const DELAY_REARRANGE_MS = 100; /** * This singleton implements site dropping functionality. */ -let gDrop = { +var gDrop = { /** * The last drop target. */ diff --git a/application/palemoon/base/content/newtab/dropPreview.js b/application/palemoon/base/content/newtab/dropPreview.js index 903762345..fd7587a35 100644 --- a/application/palemoon/base/content/newtab/dropPreview.js +++ b/application/palemoon/base/content/newtab/dropPreview.js @@ -9,7 +9,7 @@ * indicate the transformation that results from dropping a cell at a certain * position. */ -let gDropPreview = { +var gDropPreview = { /** * Rearranges the sites currently contained in the grid when a site would be * dropped onto the given cell. diff --git a/application/palemoon/base/content/newtab/dropTargetShim.js b/application/palemoon/base/content/newtab/dropTargetShim.js index a85a6ccd6..046dbea1e 100644 --- a/application/palemoon/base/content/newtab/dropTargetShim.js +++ b/application/palemoon/base/content/newtab/dropTargetShim.js @@ -9,7 +9,7 @@ * the default DnD target detection relies on the cursor's position. We want * to pick a drop target based on the dragged site's position. */ -let gDropTargetShim = { +var gDropTargetShim = { /** * Cache for the position of all cells, cleaned after drag finished. */ diff --git a/application/palemoon/base/content/newtab/grid.js b/application/palemoon/base/content/newtab/grid.js index 3b7dfc35f..46e0b804b 100644 --- a/application/palemoon/base/content/newtab/grid.js +++ b/application/palemoon/base/content/newtab/grid.js @@ -7,7 +7,7 @@ /** * This singleton represents the grid that contains all sites. */ -let gGrid = { +var gGrid = { /** * The DOM node of the grid. */ diff --git a/application/palemoon/base/content/newtab/newTab.js b/application/palemoon/base/content/newtab/newTab.js index 6d8647ab6..bba73fd7a 100644 --- a/application/palemoon/base/content/newtab/newTab.js +++ b/application/palemoon/base/content/newtab/newTab.js @@ -18,7 +18,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "Rect", XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils", "resource://gre/modules/PrivateBrowsingUtils.jsm"); -let { +var { links: gLinks, allPages: gAllPages, linkChecker: gLinkChecker, diff --git a/application/palemoon/base/content/newtab/page.js b/application/palemoon/base/content/newtab/page.js index afe5bfba8..fc836a55e 100644 --- a/application/palemoon/base/content/newtab/page.js +++ b/application/palemoon/base/content/newtab/page.js @@ -8,7 +8,7 @@ * This singleton represents the whole 'New Tab Page' and takes care of * initializing all its components. */ -let gPage = { +var gPage = { /** * Initializes the page. */ diff --git a/application/palemoon/base/content/newtab/transformations.js b/application/palemoon/base/content/newtab/transformations.js index 6d1554f5f..0711d7d0a 100644 --- a/application/palemoon/base/content/newtab/transformations.js +++ b/application/palemoon/base/content/newtab/transformations.js @@ -9,7 +9,7 @@ * in the DOM and by showing or hiding the node. It additionally provides * convenience methods to work with a site's DOM node. */ -let gTransformation = { +var gTransformation = { /** * Returns the width of the left and top border of a cell. We need to take it * into account when measuring and comparing site and cell positions. diff --git a/application/palemoon/base/content/newtab/undo.js b/application/palemoon/base/content/newtab/undo.js index 5f619e980..b856914d2 100644 --- a/application/palemoon/base/content/newtab/undo.js +++ b/application/palemoon/base/content/newtab/undo.js @@ -8,7 +8,7 @@ * Dialog allowing to undo the removal of single site or to completely restore * the grid's original state. */ -let gUndoDialog = { +var gUndoDialog = { /** * The undo dialog's timeout in miliseconds. */ diff --git a/application/palemoon/base/content/newtab/updater.js b/application/palemoon/base/content/newtab/updater.js index 7b483e037..e6da37f87 100644 --- a/application/palemoon/base/content/newtab/updater.js +++ b/application/palemoon/base/content/newtab/updater.js @@ -8,7 +8,7 @@ * This singleton provides functionality to update the current grid to a new * set of pinned and blocked sites. It adds, moves and removes sites. */ -let gUpdater = { +var gUpdater = { /** * Updates the current grid according to its pinned and blocked sites. * This removes old, moves existing and creates new sites to fill gaps. diff --git a/application/palemoon/base/content/popup-notifications.inc b/application/palemoon/base/content/popup-notifications.inc index 7be975b7f..31a72b489 100644 --- a/application/palemoon/base/content/popup-notifications.inc +++ b/application/palemoon/base/content/popup-notifications.inc @@ -2,7 +2,6 @@ <panel id="notification-popup" type="arrow" - footertype="promobox" position="after_start" hidden="true" orient="vertical" diff --git a/application/palemoon/base/content/sync/aboutSyncTabs.js b/application/palemoon/base/content/sync/aboutSyncTabs.js index 535c43e56..bc624a459 100644 --- a/application/palemoon/base/content/sync/aboutSyncTabs.js +++ b/application/palemoon/base/content/sync/aboutSyncTabs.js @@ -11,7 +11,7 @@ Cu.import("resource://gre/modules/PlacesUtils.jsm", this); Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); -let RemoteTabViewer = { +var RemoteTabViewer = { _tabsList: null, init: function () { diff --git a/application/palemoon/base/content/sync/addDevice.js b/application/palemoon/base/content/sync/addDevice.js index 556e75768..40862a791 100644 --- a/application/palemoon/base/content/sync/addDevice.js +++ b/application/palemoon/base/content/sync/addDevice.js @@ -15,7 +15,7 @@ const ADD_DEVICE_PAGE = 0; const SYNC_KEY_PAGE = 1; const DEVICE_CONNECTED_PAGE = 2; -let gSyncAddDevice = { +var gSyncAddDevice = { init: function init() { this.pin1.setAttribute("maxlength", PIN_PART_LENGTH); diff --git a/application/palemoon/base/content/sync/genericChange.js b/application/palemoon/base/content/sync/genericChange.js index 6d1ce9485..0c6dc145e 100644 --- a/application/palemoon/base/content/sync/genericChange.js +++ b/application/palemoon/base/content/sync/genericChange.js @@ -8,7 +8,7 @@ const Cc = Components.classes; Components.utils.import("resource://services-sync/main.js"); Components.utils.import("resource://gre/modules/Services.jsm"); -let Change = { +var Change = { _dialog: null, _dialogType: null, _status: null, diff --git a/application/palemoon/base/content/sync/progress.js b/application/palemoon/base/content/sync/progress.js index 2063f612a..101160fa8 100644 --- a/application/palemoon/base/content/sync/progress.js +++ b/application/palemoon/base/content/sync/progress.js @@ -6,8 +6,8 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://services-sync/main.js"); -let gProgressBar; -let gCounter = 0; +var gProgressBar; +var gCounter = 0; function onLoad(event) { Services.obs.addObserver(onEngineSync, "weave:engine:sync:finish", false); diff --git a/application/palemoon/base/content/sync/quota.js b/application/palemoon/base/content/sync/quota.js index 7117a2ddf..454052754 100644 --- a/application/palemoon/base/content/sync/quota.js +++ b/application/palemoon/base/content/sync/quota.js @@ -10,7 +10,7 @@ const Cu = Components.utils; Cu.import("resource://services-sync/main.js"); Cu.import("resource://gre/modules/DownloadUtils.jsm"); -let gSyncQuota = { +var gSyncQuota = { init: function init() { this.bundle = document.getElementById("quotaStrings"); @@ -86,7 +86,7 @@ let gSyncQuota = { }; -let gUsageTreeView = { +var gUsageTreeView = { _ignored: {keys: true, meta: true, diff --git a/application/palemoon/base/content/sync/utils.js b/application/palemoon/base/content/sync/utils.js index 0c02b5bc0..d41ecf18a 100644 --- a/application/palemoon/base/content/sync/utils.js +++ b/application/palemoon/base/content/sync/utils.js @@ -8,7 +8,7 @@ const PERMISSIONS_RWUSR = 0x180; // Weave should always exist before before this file gets included. -let gSyncUtils = { +var gSyncUtils = { get bundle() { delete this.bundle; return this.bundle = Services.strings.createBundle("chrome://browser/locale/syncSetup.properties"); diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml index 69d824fd5..49db93377 100644 --- a/application/palemoon/base/content/tabbrowser.xml +++ b/application/palemoon/base/content/tabbrowser.xml @@ -30,7 +30,7 @@ <xul:vbox flex="1" class="browserContainer"> <xul:stack flex="1" class="browserStack" anonid="browserStack"> <xul:browser anonid="initialBrowser" type="content-primary" message="true" disablehistory="true" - xbl:inherits="tooltip=contenttooltip,contextmenu=contentcontextmenu,autocompletepopup"/> + xbl:inherits="tooltip=contenttooltip,contextmenu=contentcontextmenu,autocompletepopup,datetimepicker"/> </xul:stack> </xul:vbox> </xul:hbox> @@ -138,19 +138,19 @@ ]]></getter> </property> - <property name="formValidationAnchor" readonly="true"> + <property name="popupAnchor" readonly="true"> <getter><![CDATA[ - if (this.mCurrentTab._formValidationAnchor) { - return this.mCurrentTab._formValidationAnchor; + if (this.mCurrentTab._popupAnchor) { + return this.mCurrentTab._popupAnchor; } let stack = this.mCurrentBrowser.parentNode; - // Create an anchor for the form validation popup + // Create an anchor for the popup const NS_XUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; - let formValidationAnchor = document.createElementNS(NS_XUL, "hbox"); - formValidationAnchor.className = "form-validation-anchor"; - formValidationAnchor.hidden = true; - stack.appendChild(formValidationAnchor); - return this.mCurrentTab._formValidationAnchor = formValidationAnchor; + let popupAnchor = document.createElementNS(NS_XUL, "hbox"); + popupAnchor.className = "popup-anchor"; + popupAnchor.hidden = true; + stack.appendChild(popupAnchor); + return this.mCurrentTab._popupAnchor = popupAnchor; ]]></getter> </property> @@ -1502,6 +1502,10 @@ b.setAttribute("autocompletepopup", this.getAttribute("autocompletepopup")); b.setAttribute("autoscrollpopup", this._autoScrollPopup.id); + if (this.hasAttribute("datetimepicker")) { + b.setAttribute("datetimepicker", this.getAttribute("datetimepicker")); + } + // Create the browserStack container var stack = document.createElementNS(NS_XUL, "stack"); stack.className = "browserStack"; diff --git a/application/palemoon/base/content/urlbarBindings.xml b/application/palemoon/base/content/urlbarBindings.xml index bdb7a6a12..07cd5380d 100644 --- a/application/palemoon/base/content/urlbarBindings.xml +++ b/application/palemoon/base/content/urlbarBindings.xml @@ -1778,195 +1778,6 @@ </implementation> </binding> - <binding id="promobox"> - <content> - <xul:hbox class="panel-promo-box" align="start" flex="1"> - <xul:hbox align="center" flex="1"> - <xul:image class="panel-promo-icon"/> - <xul:description anonid="promo-message" class="panel-promo-message" flex="1"> - <xul:description anonid="promo-link" - class="plain text-link inline-link" - onclick="document.getBindingParent(this).onLinkClick();"/> - </xul:description> - </xul:hbox> - <xul:toolbarbutton class="panel-promo-closebutton close-icon" - oncommand="document.getBindingParent(this).onCloseButtonCommand();" - tooltiptext="&closeNotification.tooltip;"/> - </xul:hbox> - </content> - - <implementation implements="nsIDOMEventListener"> - <constructor><![CDATA[ - this._panel.addEventListener("popupshowing", this, false); - ]]></constructor> - - <destructor><![CDATA[ - this._panel.removeEventListener("popupshowing", this, false); - ]]></destructor> - - <field name="_panel" readonly="true"><![CDATA[ - let node = this.parentNode; - while(node && node.localName != "panel") { - node = node.parentNode; - } - node; - ]]></field> - <field name="_promomessage" readonly="true"> - document.getAnonymousElementByAttribute(this, "anonid", "promo-message"); - </field> - <field name="_promolink" readonly="true"> - document.getAnonymousElementByAttribute(this, "anonid", "promo-link"); - </field> - <field name="_brandBundle" readonly="true"> - Services.strings.createBundle("chrome://branding/locale/brand.properties"); - </field> - <property name="_viewsLeftMap"> - <getter><![CDATA[ - let viewsLeftMap = {}; - try { - viewsLeftMap = JSON.parse(Services.prefs.getCharPref("browser.syncPromoViewsLeftMap")); - } catch (ex) { - // If the old preference exists, migrate it to the new one. - try { - let oldPref = Services.prefs.getIntPref("browser.syncPromoViewsLeft"); - Services.prefs.clearUserPref("browser.syncPromoViewsLeft"); - viewsLeftMap.bookmarks = oldPref; - viewsLeftMap.passwords = oldPref; - Services.prefs.setCharPref("browser.syncPromoViewsLeftMap", - JSON.stringify(viewsLeftMap)); - } catch (ex2) {} - } - return viewsLeftMap; - ]]></getter> - </property> - <property name="_viewsLeft"> - <getter><![CDATA[ - let views = 5; - let map = this._viewsLeftMap; - if (this._notificationType in map) { - views = map[this._notificationType]; - } - return views; - ]]></getter> - <setter><![CDATA[ - let map = this._viewsLeftMap; - map[this._notificationType] = val; - Services.prefs.setCharPref("browser.syncPromoViewsLeftMap", - JSON.stringify(map)); - return val; - ]]></setter> - </property> - <property name="_notificationType"> - <getter><![CDATA[ - // Use the popupid attribute to identify the notification type, - // otherwise just rely on the panel id for common arrowpanels. - let type = this._panel.firstChild.getAttribute("popupid") || - this._panel.id; - if (type.startsWith("password-")) - return "passwords"; - if (type == "editBookmarkPanel") - return "bookmarks"; - if (type == "addon-install-complete") { - if (!Services.prefs.prefHasUserValue("services.sync.username")) - return "addons"; - if (!Services.prefs.getBoolPref("services.sync.engine.addons")) - return "addons-sync-disabled"; - } - return null; - ]]></getter> - </property> - <property name="_notificationMessage"> - <getter><![CDATA[ - return gNavigatorBundle.getFormattedString( - "syncPromoNotification." + this._notificationType + ".description", - [this._brandBundle.GetStringFromName("syncBrandShortName")] - ); - ]]></getter> - </property> - <property name="_notificationLink"> - <getter><![CDATA[ - if (this._notificationType == "addons-sync-disabled") { - return "https://forum.palemoon.org/viewforum.php?f=52"; - } - return "http://www.palemoon.org/sync/"; - ]]></getter> - </property> - <method name="onCloseButtonCommand"> - <body><![CDATA[ - this._viewsLeft = 0; - this.hidden = true; - ]]></body> - </method> - <method name="onLinkClick"> - <body><![CDATA[ - // Open a new selected tab and close the current panel. - gBrowser.loadOneTab(this._promolink.getAttribute("href"), - { inBackground: false }); - this._panel.hidePopup(); - ]]></body> - </method> - <method name="handleEvent"> - <parameter name="event"/> - <body><![CDATA[ - if (event.type != "popupshowing" || event.target != this._panel) - return; - - // A previous notification may have unhidden this. - this.hidden = true; - - // Only handle supported notification panels. - if (!this._notificationType) { - return; - } - - let viewsLeft = this._viewsLeft; - if (viewsLeft) { - // XXX: Short-circuit this for now. - // TO-DO: Clean up this code for sync promotion - this._viewsLeft = 0; - viewsLeft = 0; - return; - // XXX - - if (Services.prefs.prefHasUserValue("services.sync.username") && - this._notificationType != "addons-sync-disabled") { - // If the user has already setup Sync, don't show the notification. - this._viewsLeft = 0; - // Be sure to hide the panel, in case it was visible and the user - // decided to setup Sync after noticing it. - viewsLeft = 0; - // The panel is still hidden, just bail out. - return; - } - else { - this._viewsLeft = viewsLeft - 1; - } - - this._promolink.setAttribute("href", this._notificationLink); - this._promolink.value = gNavigatorBundle.getString("syncPromoNotification.learnMoreLinkText"); - - this.hidden = false; - - // HACK: The description element doesn't wrap correctly in panels, - // thus set a width on it, based on the available space, before - // setting its textContent. Then set its height as well, to - // fix wrong height calculation on Linux (bug 659578). - this._panel.addEventListener("popupshown", function panelShown() { - this._panel.removeEventListener("popupshown", panelShown, true); - // Previous popupShown events may close the panel or change - // its contents, so ensure this is still valid. - if (this._panel.state != "open" || !this._notificationType) - return; - this._promomessage.width = this._promomessage.getBoundingClientRect().width; - this._promomessage.firstChild.textContent = this._notificationMessage; - this._promomessage.height = this._promomessage.getBoundingClientRect().height; - }.bind(this), true); - } - ]]></body> - </method> - </implementation> - </binding> - <binding id="toolbarbutton-badged" display="xul:button" extends="chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton"> <content> |