mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-26 17:17:31 +09:00
[Basilisk] Issue MoonchildProductions/UXP#516 - Remove named function syntax from basilisk/base.
This commit is contained in:
parent
4bf8981093
commit
b31901aa3f
24 changed files with 294 additions and 294 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
* Tab previews utility, produces thumbnails
|
* Tab previews utility, produces thumbnails
|
||||||
*/
|
*/
|
||||||
var tabPreviews = {
|
var tabPreviews = {
|
||||||
init: function tabPreviews_init() {
|
init: function() {
|
||||||
if (this._selectedTab)
|
if (this._selectedTab)
|
||||||
return;
|
return;
|
||||||
this._selectedTab = gBrowser.selectedTab;
|
this._selectedTab = gBrowser.selectedTab;
|
||||||
|
|
@ -21,7 +21,7 @@ var tabPreviews = {
|
||||||
this.aspectRatio = height.value / width.value;
|
this.aspectRatio = height.value / width.value;
|
||||||
},
|
},
|
||||||
|
|
||||||
get: function tabPreviews_get(aTab) {
|
get: function(aTab) {
|
||||||
let uri = aTab.linkedBrowser.currentURI.spec;
|
let uri = aTab.linkedBrowser.currentURI.spec;
|
||||||
|
|
||||||
if (aTab.__thumbnail_lastURI &&
|
if (aTab.__thumbnail_lastURI &&
|
||||||
|
|
@ -42,7 +42,7 @@ var tabPreviews = {
|
||||||
return this.capture(aTab, !aTab.hasAttribute("busy"));
|
return this.capture(aTab, !aTab.hasAttribute("busy"));
|
||||||
},
|
},
|
||||||
|
|
||||||
capture: function tabPreviews_capture(aTab, aShouldCache) {
|
capture: function(aTab, aShouldCache) {
|
||||||
let browser = aTab.linkedBrowser;
|
let browser = aTab.linkedBrowser;
|
||||||
let uri = browser.currentURI.spec;
|
let uri = browser.currentURI.spec;
|
||||||
let canvas = PageThumbs.createCanvas(window);
|
let canvas = PageThumbs.createCanvas(window);
|
||||||
|
|
@ -67,7 +67,7 @@ var tabPreviews = {
|
||||||
return canvas;
|
return canvas;
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function tabPreviews_handleEvent(event) {
|
handleEvent: function(event) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case "TabSelect":
|
case "TabSelect":
|
||||||
if (this._selectedTab &&
|
if (this._selectedTab &&
|
||||||
|
|
@ -193,7 +193,7 @@ var ctrlTab = {
|
||||||
return this._recentlyUsedTabs;
|
return this._recentlyUsedTabs;
|
||||||
},
|
},
|
||||||
|
|
||||||
init: function ctrlTab_init() {
|
init: function() {
|
||||||
if (!this._recentlyUsedTabs) {
|
if (!this._recentlyUsedTabs) {
|
||||||
tabPreviews.init();
|
tabPreviews.init();
|
||||||
|
|
||||||
|
|
@ -202,13 +202,13 @@ var ctrlTab = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function ctrlTab_uninit() {
|
uninit: function() {
|
||||||
this._recentlyUsedTabs = null;
|
this._recentlyUsedTabs = null;
|
||||||
this._init(false);
|
this._init(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
prefName: "browser.ctrlTab.previews",
|
prefName: "browser.ctrlTab.previews",
|
||||||
readPref: function ctrlTab_readPref() {
|
readPref: function() {
|
||||||
var enable =
|
var enable =
|
||||||
gPrefService.getBoolPref(this.prefName) &&
|
gPrefService.getBoolPref(this.prefName) &&
|
||||||
(!gPrefService.prefHasUserValue("browser.ctrlTab.disallowForScreenReaders") ||
|
(!gPrefService.prefHasUserValue("browser.ctrlTab.disallowForScreenReaders") ||
|
||||||
|
|
@ -223,7 +223,7 @@ var ctrlTab = {
|
||||||
this.readPref();
|
this.readPref();
|
||||||
},
|
},
|
||||||
|
|
||||||
updatePreviews: function ctrlTab_updatePreviews() {
|
updatePreviews: function() {
|
||||||
for (let i = 0; i < this.previews.length; i++)
|
for (let i = 0; i < this.previews.length; i++)
|
||||||
this.updatePreview(this.previews[i], this.tabList[i]);
|
this.updatePreview(this.previews[i], this.tabList[i]);
|
||||||
|
|
||||||
|
|
@ -233,7 +233,7 @@ var ctrlTab = {
|
||||||
this.showAllButton.hidden = !allTabs.canOpen;
|
this.showAllButton.hidden = !allTabs.canOpen;
|
||||||
},
|
},
|
||||||
|
|
||||||
updatePreview: function ctrlTab_updatePreview(aPreview, aTab) {
|
updatePreview: function(aPreview, aTab) {
|
||||||
if (aPreview == this.showAllButton)
|
if (aPreview == this.showAllButton)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -267,7 +267,7 @@ var ctrlTab = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
advanceFocus: function ctrlTab_advanceFocus(aForward) {
|
advanceFocus: function(aForward) {
|
||||||
let selectedIndex = Array.indexOf(this.previews, this.selected);
|
let selectedIndex = Array.indexOf(this.previews, this.selected);
|
||||||
do {
|
do {
|
||||||
selectedIndex += aForward ? 1 : -1;
|
selectedIndex += aForward ? 1 : -1;
|
||||||
|
|
@ -291,12 +291,12 @@ var ctrlTab = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_mouseOverFocus: function ctrlTab_mouseOverFocus(aPreview) {
|
_mouseOverFocus: function(aPreview) {
|
||||||
if (this._trackMouseOver)
|
if (this._trackMouseOver)
|
||||||
aPreview.focus();
|
aPreview.focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
pick: function ctrlTab_pick(aPreview) {
|
pick: function(aPreview) {
|
||||||
if (!this.tabCount)
|
if (!this.tabCount)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -308,17 +308,17 @@ var ctrlTab = {
|
||||||
this.close(select._tab);
|
this.close(select._tab);
|
||||||
},
|
},
|
||||||
|
|
||||||
showAllTabs: function ctrlTab_showAllTabs(aPreview) {
|
showAllTabs: function(aPreview) {
|
||||||
this.close();
|
this.close();
|
||||||
document.getElementById("Browser:ShowAllTabs").doCommand();
|
document.getElementById("Browser:ShowAllTabs").doCommand();
|
||||||
},
|
},
|
||||||
|
|
||||||
remove: function ctrlTab_remove(aPreview) {
|
remove: function(aPreview) {
|
||||||
if (aPreview._tab)
|
if (aPreview._tab)
|
||||||
gBrowser.removeTab(aPreview._tab);
|
gBrowser.removeTab(aPreview._tab);
|
||||||
},
|
},
|
||||||
|
|
||||||
attachTab: function ctrlTab_attachTab(aTab, aPos) {
|
attachTab: function(aTab, aPos) {
|
||||||
if (aTab.closing)
|
if (aTab.closing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -330,13 +330,13 @@ var ctrlTab = {
|
||||||
this._recentlyUsedTabs.push(aTab);
|
this._recentlyUsedTabs.push(aTab);
|
||||||
},
|
},
|
||||||
|
|
||||||
detachTab: function ctrlTab_detachTab(aTab) {
|
detachTab: function(aTab) {
|
||||||
var i = this._recentlyUsedTabs.indexOf(aTab);
|
var i = this._recentlyUsedTabs.indexOf(aTab);
|
||||||
if (i >= 0)
|
if (i >= 0)
|
||||||
this._recentlyUsedTabs.splice(i, 1);
|
this._recentlyUsedTabs.splice(i, 1);
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function ctrlTab_open() {
|
open: function() {
|
||||||
if (this.isOpen)
|
if (this.isOpen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -353,7 +353,7 @@ var ctrlTab = {
|
||||||
}, 200, this);
|
}, 200, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
_openPanel: function ctrlTab_openPanel() {
|
_openPanel: function() {
|
||||||
tabPreviewPanelHelper.opening(this);
|
tabPreviewPanelHelper.opening(this);
|
||||||
|
|
||||||
this.panel.width = Math.min(screen.availWidth * .99,
|
this.panel.width = Math.min(screen.availWidth * .99,
|
||||||
|
|
@ -364,7 +364,7 @@ var ctrlTab = {
|
||||||
false);
|
false);
|
||||||
},
|
},
|
||||||
|
|
||||||
close: function ctrlTab_close(aTabToSelect) {
|
close: function(aTabToSelect) {
|
||||||
if (!this.isOpen)
|
if (!this.isOpen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -381,7 +381,7 @@ var ctrlTab = {
|
||||||
this.panel.hidePopup();
|
this.panel.hidePopup();
|
||||||
},
|
},
|
||||||
|
|
||||||
setupGUI: function ctrlTab_setupGUI() {
|
setupGUI: function() {
|
||||||
this.selected.focus();
|
this.selected.focus();
|
||||||
this._selectedIndex = -1;
|
this._selectedIndex = -1;
|
||||||
|
|
||||||
|
|
@ -394,7 +394,7 @@ var ctrlTab = {
|
||||||
}, 0, this);
|
}, 0, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
suspendGUI: function ctrlTab_suspendGUI() {
|
suspendGUI: function() {
|
||||||
document.removeEventListener("keyup", this, true);
|
document.removeEventListener("keyup", this, true);
|
||||||
|
|
||||||
for (let preview of this.previews) {
|
for (let preview of this.previews) {
|
||||||
|
|
@ -447,7 +447,7 @@ var ctrlTab = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
removeClosingTabFromUI: function ctrlTab_removeClosingTabFromUI(aTab) {
|
removeClosingTabFromUI: function(aTab) {
|
||||||
if (this.tabCount == 2) {
|
if (this.tabCount == 2) {
|
||||||
this.close();
|
this.close();
|
||||||
return;
|
return;
|
||||||
|
|
@ -468,7 +468,7 @@ var ctrlTab = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function ctrlTab_handleEvent(event) {
|
handleEvent: function(event) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case "SSWindowRestored":
|
case "SSWindowRestored":
|
||||||
this._initRecentlyUsedTabs();
|
this._initRecentlyUsedTabs();
|
||||||
|
|
@ -528,7 +528,7 @@ var ctrlTab = {
|
||||||
.sort((tab1, tab2) => tab2.lastAccessed - tab1.lastAccessed);
|
.sort((tab1, tab2) => tab2.lastAccessed - tab1.lastAccessed);
|
||||||
},
|
},
|
||||||
|
|
||||||
_init: function ctrlTab__init(enable) {
|
_init: function(enable) {
|
||||||
var toggleEventListener = enable ? "addEventListener" : "removeEventListener";
|
var toggleEventListener = enable ? "addEventListener" : "removeEventListener";
|
||||||
|
|
||||||
window[toggleEventListener]("SSWindowRestored", this, false);
|
window[toggleEventListener]("SSWindowRestored", this, false);
|
||||||
|
|
@ -575,7 +575,7 @@ var allTabs = {
|
||||||
return isElementVisible(this.toolbarButton);
|
return isElementVisible(this.toolbarButton);
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function allTabs_open() {
|
open: function() {
|
||||||
if (this.canOpen) {
|
if (this.canOpen) {
|
||||||
// Without setTimeout, the menupopup won't stay open when invoking
|
// Without setTimeout, the menupopup won't stay open when invoking
|
||||||
// "View > Show All Tabs" and the menu bar auto-hides.
|
// "View > Show All Tabs" and the menu bar auto-hides.
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ var FullZoom = {
|
||||||
|
|
||||||
// Initialization & Destruction
|
// Initialization & Destruction
|
||||||
|
|
||||||
init: function FullZoom_init() {
|
init: function() {
|
||||||
gBrowser.addEventListener("ZoomChangeUsingMouseWheel", this);
|
gBrowser.addEventListener("ZoomChangeUsingMouseWheel", this);
|
||||||
|
|
||||||
// Register ourselves with the service so we know when our pref changes.
|
// Register ourselves with the service so we know when our pref changes.
|
||||||
|
|
@ -66,7 +66,7 @@ var FullZoom = {
|
||||||
this._initialLocations = null;
|
this._initialLocations = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function FullZoom_destroy() {
|
destroy: function() {
|
||||||
gPrefService.removeObserver("browser.zoom.", this);
|
gPrefService.removeObserver("browser.zoom.", this);
|
||||||
this._cps2.removeObserverForName(this.name, this);
|
this._cps2.removeObserverForName(this.name, this);
|
||||||
gBrowser.removeEventListener("ZoomChangeUsingMouseWheel", this);
|
gBrowser.removeEventListener("ZoomChangeUsingMouseWheel", this);
|
||||||
|
|
@ -77,7 +77,7 @@ var FullZoom = {
|
||||||
|
|
||||||
// nsIDOMEventListener
|
// nsIDOMEventListener
|
||||||
|
|
||||||
handleEvent: function FullZoom_handleEvent(event) {
|
handleEvent: function(event) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case "ZoomChangeUsingMouseWheel":
|
case "ZoomChangeUsingMouseWheel":
|
||||||
let browser = this._getTargetedBrowser(event);
|
let browser = this._getTargetedBrowser(event);
|
||||||
|
|
@ -108,11 +108,11 @@ var FullZoom = {
|
||||||
|
|
||||||
// nsIContentPrefObserver
|
// nsIContentPrefObserver
|
||||||
|
|
||||||
onContentPrefSet: function FullZoom_onContentPrefSet(aGroup, aName, aValue, aIsPrivate) {
|
onContentPrefSet: function(aGroup, aName, aValue, aIsPrivate) {
|
||||||
this._onContentPrefChanged(aGroup, aValue, aIsPrivate);
|
this._onContentPrefChanged(aGroup, aValue, aIsPrivate);
|
||||||
},
|
},
|
||||||
|
|
||||||
onContentPrefRemoved: function FullZoom_onContentPrefRemoved(aGroup, aName, aIsPrivate) {
|
onContentPrefRemoved: function(aGroup, aName, aIsPrivate) {
|
||||||
this._onContentPrefChanged(aGroup, undefined, aIsPrivate);
|
this._onContentPrefChanged(aGroup, undefined, aIsPrivate);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -124,7 +124,7 @@ var FullZoom = {
|
||||||
* @param aValue The new value of the changed preference. Pass undefined to
|
* @param aValue The new value of the changed preference. Pass undefined to
|
||||||
* indicate the preference's removal.
|
* indicate the preference's removal.
|
||||||
*/
|
*/
|
||||||
_onContentPrefChanged: function FullZoom__onContentPrefChanged(aGroup, aValue, aIsPrivate) {
|
_onContentPrefChanged: function(aGroup, aValue, aIsPrivate) {
|
||||||
if (this._isNextContentPrefChangeInternal) {
|
if (this._isNextContentPrefChangeInternal) {
|
||||||
// Ignore changes that FullZoom itself makes. This works because the
|
// Ignore changes that FullZoom itself makes. This works because the
|
||||||
// content pref service calls callbacks before notifying observers, and it
|
// content pref service calls callbacks before notifying observers, and it
|
||||||
|
|
@ -175,7 +175,7 @@ var FullZoom = {
|
||||||
* @param aBrowser
|
* @param aBrowser
|
||||||
* (optional) browser object displaying the document
|
* (optional) browser object displaying the document
|
||||||
*/
|
*/
|
||||||
onLocationChange: function FullZoom_onLocationChange(aURI, aIsTabSwitch, aBrowser) {
|
onLocationChange: function(aURI, aIsTabSwitch, aBrowser) {
|
||||||
let browser = aBrowser || gBrowser.selectedBrowser;
|
let browser = aBrowser || gBrowser.selectedBrowser;
|
||||||
|
|
||||||
// If we haven't been initialized yet but receive an onLocationChange
|
// If we haven't been initialized yet but receive an onLocationChange
|
||||||
|
|
@ -237,7 +237,7 @@ var FullZoom = {
|
||||||
|
|
||||||
// update state of zoom type menu item
|
// update state of zoom type menu item
|
||||||
|
|
||||||
updateMenu: function FullZoom_updateMenu() {
|
updateMenu: function() {
|
||||||
var menuItem = document.getElementById("toggle_zoom");
|
var menuItem = document.getElementById("toggle_zoom");
|
||||||
|
|
||||||
menuItem.setAttribute("checked", !ZoomManager.useFullZoom);
|
menuItem.setAttribute("checked", !ZoomManager.useFullZoom);
|
||||||
|
|
@ -248,7 +248,7 @@ var FullZoom = {
|
||||||
/**
|
/**
|
||||||
* Reduces the zoom level of the page in the current browser.
|
* Reduces the zoom level of the page in the current browser.
|
||||||
*/
|
*/
|
||||||
reduce: function FullZoom_reduce() {
|
reduce: function() {
|
||||||
ZoomManager.reduce();
|
ZoomManager.reduce();
|
||||||
let browser = gBrowser.selectedBrowser;
|
let browser = gBrowser.selectedBrowser;
|
||||||
this._ignorePendingZoomAccesses(browser);
|
this._ignorePendingZoomAccesses(browser);
|
||||||
|
|
@ -258,7 +258,7 @@ var FullZoom = {
|
||||||
/**
|
/**
|
||||||
* Enlarges the zoom level of the page in the current browser.
|
* Enlarges the zoom level of the page in the current browser.
|
||||||
*/
|
*/
|
||||||
enlarge: function FullZoom_enlarge() {
|
enlarge: function() {
|
||||||
ZoomManager.enlarge();
|
ZoomManager.enlarge();
|
||||||
let browser = gBrowser.selectedBrowser;
|
let browser = gBrowser.selectedBrowser;
|
||||||
this._ignorePendingZoomAccesses(browser);
|
this._ignorePendingZoomAccesses(browser);
|
||||||
|
|
@ -281,7 +281,7 @@ var FullZoom = {
|
||||||
*
|
*
|
||||||
* @return A promise which resolves when the zoom reset has been applied.
|
* @return A promise which resolves when the zoom reset has been applied.
|
||||||
*/
|
*/
|
||||||
reset: function FullZoom_reset(browser = gBrowser.selectedBrowser) {
|
reset: function(browser = gBrowser.selectedBrowser) {
|
||||||
let token = this._getBrowserToken(browser);
|
let token = this._getBrowserToken(browser);
|
||||||
let result = this._getGlobalValue(browser).then(value => {
|
let result = this._getGlobalValue(browser).then(value => {
|
||||||
if (token.isCurrent) {
|
if (token.isCurrent) {
|
||||||
|
|
@ -317,7 +317,7 @@ var FullZoom = {
|
||||||
* @param aBrowser The zoom is set in this browser. Required.
|
* @param aBrowser The zoom is set in this browser. Required.
|
||||||
* @param aCallback If given, it's asynchronously called when complete.
|
* @param aCallback If given, it's asynchronously called when complete.
|
||||||
*/
|
*/
|
||||||
_applyPrefToZoom: function FullZoom__applyPrefToZoom(aValue, aBrowser, aCallback) {
|
_applyPrefToZoom: function(aValue, aBrowser, aCallback) {
|
||||||
if (!this.siteSpecific || gInPrintPreviewMode) {
|
if (!this.siteSpecific || gInPrintPreviewMode) {
|
||||||
this._executeSoon(aCallback);
|
this._executeSoon(aCallback);
|
||||||
return;
|
return;
|
||||||
|
|
@ -354,7 +354,7 @@ var FullZoom = {
|
||||||
*
|
*
|
||||||
* @param browser The zoom of this browser will be saved. Required.
|
* @param browser The zoom of this browser will be saved. Required.
|
||||||
*/
|
*/
|
||||||
_applyZoomToPref: function FullZoom__applyZoomToPref(browser) {
|
_applyZoomToPref: function(browser) {
|
||||||
Services.obs.notifyObservers(browser, "browser-fullZoom:zoomChange", "");
|
Services.obs.notifyObservers(browser, "browser-fullZoom:zoomChange", "");
|
||||||
if (!this.siteSpecific ||
|
if (!this.siteSpecific ||
|
||||||
gInPrintPreviewMode ||
|
gInPrintPreviewMode ||
|
||||||
|
|
@ -375,7 +375,7 @@ var FullZoom = {
|
||||||
*
|
*
|
||||||
* @param browser The zoom of this browser will be removed. Required.
|
* @param browser The zoom of this browser will be removed. Required.
|
||||||
*/
|
*/
|
||||||
_removePref: function FullZoom__removePref(browser) {
|
_removePref: function(browser) {
|
||||||
Services.obs.notifyObservers(browser, "browser-fullZoom:zoomReset", "");
|
Services.obs.notifyObservers(browser, "browser-fullZoom:zoomReset", "");
|
||||||
if (browser.isSyntheticDocument)
|
if (browser.isSyntheticDocument)
|
||||||
return;
|
return;
|
||||||
|
|
@ -401,7 +401,7 @@ var FullZoom = {
|
||||||
* @param browser The token of this browser will be returned.
|
* @param browser The token of this browser will be returned.
|
||||||
* @return An object with an "isCurrent" getter.
|
* @return An object with an "isCurrent" getter.
|
||||||
*/
|
*/
|
||||||
_getBrowserToken: function FullZoom__getBrowserToken(browser) {
|
_getBrowserToken: function(browser) {
|
||||||
let map = this._browserTokenMap;
|
let map = this._browserTokenMap;
|
||||||
if (!map.has(browser))
|
if (!map.has(browser))
|
||||||
map.set(browser, 0);
|
map.set(browser, 0);
|
||||||
|
|
@ -423,7 +423,7 @@ var FullZoom = {
|
||||||
* @param event The ZoomChangeUsingMouseWheel event.
|
* @param event The ZoomChangeUsingMouseWheel event.
|
||||||
* @return The associated browser element, if one exists, otherwise null.
|
* @return The associated browser element, if one exists, otherwise null.
|
||||||
*/
|
*/
|
||||||
_getTargetedBrowser: function FullZoom__getTargetedBrowser(event) {
|
_getTargetedBrowser: function(event) {
|
||||||
let target = event.originalTarget;
|
let target = event.originalTarget;
|
||||||
|
|
||||||
// With remote content browsers, the event's target is the browser
|
// With remote content browsers, the event's target is the browser
|
||||||
|
|
@ -449,12 +449,12 @@ var FullZoom = {
|
||||||
*
|
*
|
||||||
* @param browser Pending accesses in this browser will be ignored.
|
* @param browser Pending accesses in this browser will be ignored.
|
||||||
*/
|
*/
|
||||||
_ignorePendingZoomAccesses: function FullZoom__ignorePendingZoomAccesses(browser) {
|
_ignorePendingZoomAccesses: function(browser) {
|
||||||
let map = this._browserTokenMap;
|
let map = this._browserTokenMap;
|
||||||
map.set(browser, (map.get(browser) || 0) + 1);
|
map.set(browser, (map.get(browser) || 0) + 1);
|
||||||
},
|
},
|
||||||
|
|
||||||
_ensureValid: function FullZoom__ensureValid(aValue) {
|
_ensureValid: function(aValue) {
|
||||||
// Note that undefined is a valid value for aValue that indicates a known-
|
// Note that undefined is a valid value for aValue that indicates a known-
|
||||||
// not-to-exist value.
|
// not-to-exist value.
|
||||||
if (isNaN(aValue))
|
if (isNaN(aValue))
|
||||||
|
|
@ -476,7 +476,7 @@ var FullZoom = {
|
||||||
* @returns Promise<prefValue>
|
* @returns Promise<prefValue>
|
||||||
* Resolves to the preference value when done.
|
* Resolves to the preference value when done.
|
||||||
*/
|
*/
|
||||||
_getGlobalValue: function FullZoom__getGlobalValue(browser) {
|
_getGlobalValue: function(browser) {
|
||||||
// * !("_globalValue" in this) => global value not yet cached.
|
// * !("_globalValue" in this) => global value not yet cached.
|
||||||
// * this._globalValue === undefined => global value known not to exist.
|
// * this._globalValue === undefined => global value known not to exist.
|
||||||
// * Otherwise, this._globalValue is a number, the global value.
|
// * Otherwise, this._globalValue is a number, the global value.
|
||||||
|
|
@ -502,7 +502,7 @@ var FullZoom = {
|
||||||
* @param Browser The Browser whose load context will be returned.
|
* @param Browser The Browser whose load context will be returned.
|
||||||
* @return The nsILoadContext of the given Browser.
|
* @return The nsILoadContext of the given Browser.
|
||||||
*/
|
*/
|
||||||
_loadContextFromBrowser: function FullZoom__loadContextFromBrowser(browser) {
|
_loadContextFromBrowser: function(browser) {
|
||||||
return browser.loadContext;
|
return browser.loadContext;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -512,13 +512,13 @@ var FullZoom = {
|
||||||
* The notification is always asynchronous so that observers are guaranteed a
|
* The notification is always asynchronous so that observers are guaranteed a
|
||||||
* consistent behavior.
|
* consistent behavior.
|
||||||
*/
|
*/
|
||||||
_notifyOnLocationChange: function FullZoom__notifyOnLocationChange(browser) {
|
_notifyOnLocationChange: function(browser) {
|
||||||
this._executeSoon(function () {
|
this._executeSoon(function () {
|
||||||
Services.obs.notifyObservers(browser, "browser-fullZoom:location-change", "");
|
Services.obs.notifyObservers(browser, "browser-fullZoom:location-change", "");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_executeSoon: function FullZoom__executeSoon(callback) {
|
_executeSoon: function(callback) {
|
||||||
if (!callback)
|
if (!callback)
|
||||||
return;
|
return;
|
||||||
Services.tm.mainThread.dispatch(callback, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.mainThread.dispatch(callback, Ci.nsIThread.DISPATCH_NORMAL);
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ var gGestureSupport = {
|
||||||
* @param aAddListener
|
* @param aAddListener
|
||||||
* True to add/init listeners and false to remove/uninit
|
* True to add/init listeners and false to remove/uninit
|
||||||
*/
|
*/
|
||||||
init: function GS_init(aAddListener) {
|
init: function(aAddListener) {
|
||||||
const gestureEvents = ["SwipeGestureMayStart", "SwipeGestureStart",
|
const gestureEvents = ["SwipeGestureMayStart", "SwipeGestureStart",
|
||||||
"SwipeGestureUpdate", "SwipeGestureEnd", "SwipeGesture",
|
"SwipeGestureUpdate", "SwipeGestureEnd", "SwipeGesture",
|
||||||
"MagnifyGestureStart", "MagnifyGestureUpdate", "MagnifyGesture",
|
"MagnifyGestureStart", "MagnifyGestureUpdate", "MagnifyGesture",
|
||||||
|
|
@ -47,7 +47,7 @@ var gGestureSupport = {
|
||||||
* @param aEvent
|
* @param aEvent
|
||||||
* The gesture event to handle
|
* The gesture event to handle
|
||||||
*/
|
*/
|
||||||
handleEvent: function GS_handleEvent(aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
if (!Services.prefs.getBoolPref(
|
if (!Services.prefs.getBoolPref(
|
||||||
"dom.debug.propagate_gesture_events_through_content")) {
|
"dom.debug.propagate_gesture_events_through_content")) {
|
||||||
aEvent.stopPropagation();
|
aEvent.stopPropagation();
|
||||||
|
|
@ -123,7 +123,7 @@ var gGestureSupport = {
|
||||||
* @param aDec
|
* @param aDec
|
||||||
* Command to trigger for decreasing motion (without gesture name)
|
* Command to trigger for decreasing motion (without gesture name)
|
||||||
*/
|
*/
|
||||||
_setupGesture: function GS__setupGesture(aEvent, aGesture, aPref, aInc, aDec) {
|
_setupGesture: function(aEvent, aGesture, aPref, aInc, aDec) {
|
||||||
// Try to load user-set values from preferences
|
// Try to load user-set values from preferences
|
||||||
for (let [pref, def] of Object.entries(aPref))
|
for (let [pref, def] of Object.entries(aPref))
|
||||||
aPref[pref] = this._getPref(aGesture + "." + pref, def);
|
aPref[pref] = this._getPref(aGesture + "." + pref, def);
|
||||||
|
|
@ -168,7 +168,7 @@ var gGestureSupport = {
|
||||||
* The swipe gesture event.
|
* The swipe gesture event.
|
||||||
* @return true if the swipe event may navigate the history, false othwerwise.
|
* @return true if the swipe event may navigate the history, false othwerwise.
|
||||||
*/
|
*/
|
||||||
_swipeNavigatesHistory: function GS__swipeNavigatesHistory(aEvent) {
|
_swipeNavigatesHistory: function(aEvent) {
|
||||||
return this._getCommand(aEvent, ["swipe", "left"])
|
return this._getCommand(aEvent, ["swipe", "left"])
|
||||||
== "Browser:BackOrBackDuplicate" &&
|
== "Browser:BackOrBackDuplicate" &&
|
||||||
this._getCommand(aEvent, ["swipe", "right"])
|
this._getCommand(aEvent, ["swipe", "right"])
|
||||||
|
|
@ -184,7 +184,7 @@ var gGestureSupport = {
|
||||||
* @return true if we're willing to start a swipe for this event, false
|
* @return true if we're willing to start a swipe for this event, false
|
||||||
* otherwise.
|
* otherwise.
|
||||||
*/
|
*/
|
||||||
_shouldDoSwipeGesture: function GS__shouldDoSwipeGesture(aEvent) {
|
_shouldDoSwipeGesture: function(aEvent) {
|
||||||
if (!this._swipeNavigatesHistory(aEvent)) {
|
if (!this._swipeNavigatesHistory(aEvent)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -232,14 +232,14 @@ var gGestureSupport = {
|
||||||
* @return true if swipe gestures could successfully be set up, false
|
* @return true if swipe gestures could successfully be set up, false
|
||||||
* othwerwise.
|
* othwerwise.
|
||||||
*/
|
*/
|
||||||
_setupSwipeGesture: function GS__setupSwipeGesture() {
|
_setupSwipeGesture: function() {
|
||||||
gHistorySwipeAnimation.startAnimation(false);
|
gHistorySwipeAnimation.startAnimation(false);
|
||||||
|
|
||||||
this._doUpdate = function GS__doUpdate(aEvent) {
|
this._doUpdate = function(aEvent) {
|
||||||
gHistorySwipeAnimation.updateAnimation(aEvent.delta);
|
gHistorySwipeAnimation.updateAnimation(aEvent.delta);
|
||||||
};
|
};
|
||||||
|
|
||||||
this._doEnd = function GS__doEnd(aEvent) {
|
this._doEnd = function(aEvent) {
|
||||||
gHistorySwipeAnimation.swipeEndEventReceived();
|
gHistorySwipeAnimation.swipeEndEventReceived();
|
||||||
|
|
||||||
this._doUpdate = function (aEvent) {};
|
this._doUpdate = function (aEvent) {};
|
||||||
|
|
@ -255,7 +255,7 @@ var gGestureSupport = {
|
||||||
* Source array containing any number of elements
|
* Source array containing any number of elements
|
||||||
* @yield Array that is a subset of the input array from full set to empty
|
* @yield Array that is a subset of the input array from full set to empty
|
||||||
*/
|
*/
|
||||||
_power: function* GS__power(aArray) {
|
_power: function* (aArray) {
|
||||||
// Create a bitmask based on the length of the array
|
// Create a bitmask based on the length of the array
|
||||||
let num = 1 << aArray.length;
|
let num = 1 << aArray.length;
|
||||||
while (--num >= 0) {
|
while (--num >= 0) {
|
||||||
|
|
@ -279,7 +279,7 @@ var gGestureSupport = {
|
||||||
* @return Name of the executed command. Returns null if no command is
|
* @return Name of the executed command. Returns null if no command is
|
||||||
* found.
|
* found.
|
||||||
*/
|
*/
|
||||||
_doAction: function GS__doAction(aEvent, aGesture) {
|
_doAction: function(aEvent, aGesture) {
|
||||||
let command = this._getCommand(aEvent, aGesture);
|
let command = this._getCommand(aEvent, aGesture);
|
||||||
return command && this._doCommand(aEvent, command);
|
return command && this._doCommand(aEvent, command);
|
||||||
},
|
},
|
||||||
|
|
@ -293,7 +293,7 @@ var gGestureSupport = {
|
||||||
* @param aGesture
|
* @param aGesture
|
||||||
* Array of gesture name parts (to be joined by periods)
|
* Array of gesture name parts (to be joined by periods)
|
||||||
*/
|
*/
|
||||||
_getCommand: function GS__getCommand(aEvent, aGesture) {
|
_getCommand: function(aEvent, aGesture) {
|
||||||
// Create an array of pressed keys in a fixed order so that a command for
|
// Create an array of pressed keys in a fixed order so that a command for
|
||||||
// "meta" is preferred over "ctrl" when both buttons are pressed (and a
|
// "meta" is preferred over "ctrl" when both buttons are pressed (and a
|
||||||
// command for both don't exist)
|
// command for both don't exist)
|
||||||
|
|
@ -327,7 +327,7 @@ var gGestureSupport = {
|
||||||
* @param aCommand
|
* @param aCommand
|
||||||
* Name of the command found for the event's keys and gesture.
|
* Name of the command found for the event's keys and gesture.
|
||||||
*/
|
*/
|
||||||
_doCommand: function GS__doCommand(aEvent, aCommand) {
|
_doCommand: function(aEvent, aCommand) {
|
||||||
let node = document.getElementById(aCommand);
|
let node = document.getElementById(aCommand);
|
||||||
if (node) {
|
if (node) {
|
||||||
if (node.getAttribute("disabled") != "true") {
|
if (node.getAttribute("disabled") != "true") {
|
||||||
|
|
@ -367,7 +367,7 @@ var gGestureSupport = {
|
||||||
* @param aEvent
|
* @param aEvent
|
||||||
* The swipe event to handle
|
* The swipe event to handle
|
||||||
*/
|
*/
|
||||||
onSwipe: function GS_onSwipe(aEvent) {
|
onSwipe: function(aEvent) {
|
||||||
// Figure out which one (and only one) direction was triggered
|
// Figure out which one (and only one) direction was triggered
|
||||||
for (let dir of ["UP", "RIGHT", "DOWN", "LEFT"]) {
|
for (let dir of ["UP", "RIGHT", "DOWN", "LEFT"]) {
|
||||||
if (aEvent.direction == aEvent["DIRECTION_" + dir]) {
|
if (aEvent.direction == aEvent["DIRECTION_" + dir]) {
|
||||||
|
|
@ -385,7 +385,7 @@ var gGestureSupport = {
|
||||||
* @param aDir
|
* @param aDir
|
||||||
* The direction for the swipe event
|
* The direction for the swipe event
|
||||||
*/
|
*/
|
||||||
processSwipeEvent: function GS_processSwipeEvent(aEvent, aDir) {
|
processSwipeEvent: function(aEvent, aDir) {
|
||||||
this._doAction(aEvent, ["swipe", aDir.toLowerCase()]);
|
this._doAction(aEvent, ["swipe", aDir.toLowerCase()]);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -419,7 +419,7 @@ var gGestureSupport = {
|
||||||
* @param aDef
|
* @param aDef
|
||||||
* Default value if the preference doesn't exist
|
* Default value if the preference doesn't exist
|
||||||
*/
|
*/
|
||||||
_getPref: function GS__getPref(aPref, aDef) {
|
_getPref: function(aPref, aDef) {
|
||||||
// Preferences branch under which all gestures preferences are stored
|
// Preferences branch under which all gestures preferences are stored
|
||||||
const branch = "browser.gesture.";
|
const branch = "browser.gesture.";
|
||||||
|
|
||||||
|
|
@ -582,7 +582,7 @@ var gHistorySwipeAnimation = {
|
||||||
* Initializes the support for history swipe animations, if it is supported
|
* Initializes the support for history swipe animations, if it is supported
|
||||||
* by the platform/configuration.
|
* by the platform/configuration.
|
||||||
*/
|
*/
|
||||||
init: function HSA_init() {
|
init: function() {
|
||||||
if (!this._isSupported())
|
if (!this._isSupported())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -612,7 +612,7 @@ var gHistorySwipeAnimation = {
|
||||||
/**
|
/**
|
||||||
* Uninitializes the support for history swipe animations.
|
* Uninitializes the support for history swipe animations.
|
||||||
*/
|
*/
|
||||||
uninit: function HSA_uninit() {
|
uninit: function() {
|
||||||
gBrowser.removeEventListener("pagehide", this, false);
|
gBrowser.removeEventListener("pagehide", this, false);
|
||||||
gBrowser.removeEventListener("pageshow", this, false);
|
gBrowser.removeEventListener("pageshow", this, false);
|
||||||
gBrowser.removeEventListener("popstate", this, false);
|
gBrowser.removeEventListener("popstate", this, false);
|
||||||
|
|
@ -630,7 +630,7 @@ var gHistorySwipeAnimation = {
|
||||||
* @param aIsVerticalSwipe
|
* @param aIsVerticalSwipe
|
||||||
* Whether we're dealing with a vertical swipe or not.
|
* Whether we're dealing with a vertical swipe or not.
|
||||||
*/
|
*/
|
||||||
startAnimation: function HSA_startAnimation(aIsVerticalSwipe) {
|
startAnimation: function(aIsVerticalSwipe) {
|
||||||
this._direction = aIsVerticalSwipe ? "vertical" : "horizontal";
|
this._direction = aIsVerticalSwipe ? "vertical" : "horizontal";
|
||||||
|
|
||||||
if (this.isAnimationRunning()) {
|
if (this.isAnimationRunning()) {
|
||||||
|
|
@ -672,7 +672,7 @@ var gHistorySwipeAnimation = {
|
||||||
/**
|
/**
|
||||||
* Stops the swipe animation.
|
* Stops the swipe animation.
|
||||||
*/
|
*/
|
||||||
stopAnimation: function HSA_stopAnimation() {
|
stopAnimation: function() {
|
||||||
gHistorySwipeAnimation._removeBoxes();
|
gHistorySwipeAnimation._removeBoxes();
|
||||||
this._historyIndex = this._getCurrentHistoryIndex();
|
this._historyIndex = this._getCurrentHistoryIndex();
|
||||||
},
|
},
|
||||||
|
|
@ -684,7 +684,7 @@ var gHistorySwipeAnimation = {
|
||||||
* A floating point value that represents the progress of the
|
* A floating point value that represents the progress of the
|
||||||
* swipe gesture.
|
* swipe gesture.
|
||||||
*/
|
*/
|
||||||
updateAnimation: function HSA_updateAnimation(aVal) {
|
updateAnimation: function(aVal) {
|
||||||
if (!this.isAnimationRunning()) {
|
if (!this.isAnimationRunning()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -741,7 +741,7 @@ var gHistorySwipeAnimation = {
|
||||||
* @param aEvent
|
* @param aEvent
|
||||||
* An event to process.
|
* An event to process.
|
||||||
*/
|
*/
|
||||||
handleEvent: function HSA_handleEvent(aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
let browser = gBrowser.selectedBrowser;
|
let browser = gBrowser.selectedBrowser;
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
case "TabClose":
|
case "TabClose":
|
||||||
|
|
@ -780,7 +780,7 @@ var gHistorySwipeAnimation = {
|
||||||
*
|
*
|
||||||
* @return true if the animation is currently running, false otherwise.
|
* @return true if the animation is currently running, false otherwise.
|
||||||
*/
|
*/
|
||||||
isAnimationRunning: function HSA_isAnimationRunning() {
|
isAnimationRunning: function() {
|
||||||
return !!this._container;
|
return !!this._container;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -792,7 +792,7 @@ var gHistorySwipeAnimation = {
|
||||||
* @param aDir
|
* @param aDir
|
||||||
* The direction for the swipe event
|
* The direction for the swipe event
|
||||||
*/
|
*/
|
||||||
processSwipeEvent: function HSA_processSwipeEvent(aEvent, aDir) {
|
processSwipeEvent: function(aEvent, aDir) {
|
||||||
if (aDir == "RIGHT")
|
if (aDir == "RIGHT")
|
||||||
this._historyIndex += this.isLTR ? 1 : -1;
|
this._historyIndex += this.isLTR ? 1 : -1;
|
||||||
else if (aDir == "LEFT")
|
else if (aDir == "LEFT")
|
||||||
|
|
@ -807,7 +807,7 @@ var gHistorySwipeAnimation = {
|
||||||
*
|
*
|
||||||
* @return true if there is a previous page in history, false otherwise.
|
* @return true if there is a previous page in history, false otherwise.
|
||||||
*/
|
*/
|
||||||
canGoBack: function HSA_canGoBack() {
|
canGoBack: function() {
|
||||||
if (this.isAnimationRunning())
|
if (this.isAnimationRunning())
|
||||||
return this._doesIndexExistInHistory(this._historyIndex - 1);
|
return this._doesIndexExistInHistory(this._historyIndex - 1);
|
||||||
return gBrowser.webNavigation.canGoBack;
|
return gBrowser.webNavigation.canGoBack;
|
||||||
|
|
@ -818,7 +818,7 @@ var gHistorySwipeAnimation = {
|
||||||
*
|
*
|
||||||
* @return true if there is a next page in history, false otherwise.
|
* @return true if there is a next page in history, false otherwise.
|
||||||
*/
|
*/
|
||||||
canGoForward: function HSA_canGoForward() {
|
canGoForward: function() {
|
||||||
if (this.isAnimationRunning())
|
if (this.isAnimationRunning())
|
||||||
return this._doesIndexExistInHistory(this._historyIndex + 1);
|
return this._doesIndexExistInHistory(this._historyIndex + 1);
|
||||||
return gBrowser.webNavigation.canGoForward;
|
return gBrowser.webNavigation.canGoForward;
|
||||||
|
|
@ -829,7 +829,7 @@ var gHistorySwipeAnimation = {
|
||||||
* event and that we should navigate to the page that the user swiped to, if
|
* event and that we should navigate to the page that the user swiped to, if
|
||||||
* any. This will also result in the animation overlay to be torn down.
|
* any. This will also result in the animation overlay to be torn down.
|
||||||
*/
|
*/
|
||||||
swipeEndEventReceived: function HSA_swipeEndEventReceived() {
|
swipeEndEventReceived: function() {
|
||||||
// Update the session history before continuing.
|
// Update the session history before continuing.
|
||||||
let updateSessionHistory = sessionHistory => {
|
let updateSessionHistory = sessionHistory => {
|
||||||
if (this._lastSwipeDir != "" && this._historyIndex != this._startingIndex)
|
if (this._lastSwipeDir != "" && this._historyIndex != this._startingIndex)
|
||||||
|
|
@ -847,7 +847,7 @@ var gHistorySwipeAnimation = {
|
||||||
* The index to check for availability for in the history.
|
* The index to check for availability for in the history.
|
||||||
* @return true if the index exists in the browser history, false otherwise.
|
* @return true if the index exists in the browser history, false otherwise.
|
||||||
*/
|
*/
|
||||||
_doesIndexExistInHistory: function HSA__doesIndexExistInHistory(aIndex) {
|
_doesIndexExistInHistory: function(aIndex) {
|
||||||
try {
|
try {
|
||||||
return SessionStore.getSessionHistory(gBrowser.selectedTab).entries[aIndex] != null;
|
return SessionStore.getSessionHistory(gBrowser.selectedTab).entries[aIndex] != null;
|
||||||
}
|
}
|
||||||
|
|
@ -860,7 +860,7 @@ var gHistorySwipeAnimation = {
|
||||||
* Navigates to the index in history that is currently being tracked by
|
* Navigates to the index in history that is currently being tracked by
|
||||||
* |this|.
|
* |this|.
|
||||||
*/
|
*/
|
||||||
_navigateToHistoryIndex: function HSA__navigateToHistoryIndex() {
|
_navigateToHistoryIndex: function() {
|
||||||
if (this._doesIndexExistInHistory(this._historyIndex))
|
if (this._doesIndexExistInHistory(this._historyIndex))
|
||||||
gBrowser.webNavigation.gotoIndex(this._historyIndex);
|
gBrowser.webNavigation.gotoIndex(this._historyIndex);
|
||||||
else
|
else
|
||||||
|
|
@ -873,7 +873,7 @@ var gHistorySwipeAnimation = {
|
||||||
*
|
*
|
||||||
* return true if supported, false otherwise.
|
* return true if supported, false otherwise.
|
||||||
*/
|
*/
|
||||||
_isSupported: function HSA__isSupported() {
|
_isSupported: function() {
|
||||||
return window.matchMedia("(-moz-swipe-animation-enabled)").matches;
|
return window.matchMedia("(-moz-swipe-animation-enabled)").matches;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -882,7 +882,7 @@ var gHistorySwipeAnimation = {
|
||||||
* progress when a new one is initiated). This will swap out the snapshots
|
* progress when a new one is initiated). This will swap out the snapshots
|
||||||
* used in the previous animation with the appropriate new ones.
|
* used in the previous animation with the appropriate new ones.
|
||||||
*/
|
*/
|
||||||
_handleFastSwiping: function HSA__handleFastSwiping() {
|
_handleFastSwiping: function() {
|
||||||
this._installCurrentPageSnapshot(null);
|
this._installCurrentPageSnapshot(null);
|
||||||
this._installPrevAndNextSnapshots();
|
this._installPrevAndNextSnapshots();
|
||||||
},
|
},
|
||||||
|
|
@ -890,7 +890,7 @@ var gHistorySwipeAnimation = {
|
||||||
/**
|
/**
|
||||||
* Adds the boxes that contain the snapshots used during the swipe animation.
|
* Adds the boxes that contain the snapshots used during the swipe animation.
|
||||||
*/
|
*/
|
||||||
_addBoxes: function HSA__addBoxes() {
|
_addBoxes: function() {
|
||||||
let browserStack =
|
let browserStack =
|
||||||
document.getAnonymousElementByAttribute(gBrowser.getNotificationBox(),
|
document.getAnonymousElementByAttribute(gBrowser.getNotificationBox(),
|
||||||
"class", "browserStack");
|
"class", "browserStack");
|
||||||
|
|
@ -918,7 +918,7 @@ var gHistorySwipeAnimation = {
|
||||||
/**
|
/**
|
||||||
* Removes the boxes.
|
* Removes the boxes.
|
||||||
*/
|
*/
|
||||||
_removeBoxes: function HSA__removeBoxes() {
|
_removeBoxes: function() {
|
||||||
this._curBox = null;
|
this._curBox = null;
|
||||||
this._prevBox = null;
|
this._prevBox = null;
|
||||||
this._nextBox = null;
|
this._nextBox = null;
|
||||||
|
|
@ -938,7 +938,7 @@ var gHistorySwipeAnimation = {
|
||||||
* The name of the tag to create the element for.
|
* The name of the tag to create the element for.
|
||||||
* @return the newly created element.
|
* @return the newly created element.
|
||||||
*/
|
*/
|
||||||
_createElement: function HSA__createElement(aID, aTagName) {
|
_createElement: function(aID, aTagName) {
|
||||||
let XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
let XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||||
let element = document.createElementNS(XULNS, aTagName);
|
let element = document.createElementNS(XULNS, aTagName);
|
||||||
element.id = aID;
|
element.id = aID;
|
||||||
|
|
@ -953,7 +953,7 @@ var gHistorySwipeAnimation = {
|
||||||
* @param aPosition
|
* @param aPosition
|
||||||
* The position (in X coordinates) to move the box element to.
|
* The position (in X coordinates) to move the box element to.
|
||||||
*/
|
*/
|
||||||
_positionBox: function HSA__positionBox(aBox, aPosition) {
|
_positionBox: function(aBox, aPosition) {
|
||||||
let transform = "";
|
let transform = "";
|
||||||
|
|
||||||
if (this._direction == "vertical")
|
if (this._direction == "vertical")
|
||||||
|
|
@ -970,14 +970,14 @@ var gHistorySwipeAnimation = {
|
||||||
*
|
*
|
||||||
* @return true if we're ready to take snapshots, false otherwise.
|
* @return true if we're ready to take snapshots, false otherwise.
|
||||||
*/
|
*/
|
||||||
_readyToTakeSnapshots: function HSA__readyToTakeSnapshots() {
|
_readyToTakeSnapshots: function() {
|
||||||
return (this._maxSnapshots >= 1 && this._getCurrentHistoryIndex() >= 0);
|
return (this._maxSnapshots >= 1 && this._getCurrentHistoryIndex() >= 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Takes a snapshot of the page the browser is currently on.
|
* Takes a snapshot of the page the browser is currently on.
|
||||||
*/
|
*/
|
||||||
_takeSnapshot: function HSA__takeSnapshot() {
|
_takeSnapshot: function() {
|
||||||
if (!this._readyToTakeSnapshots()) {
|
if (!this._readyToTakeSnapshots()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1011,7 +1011,7 @@ var gHistorySwipeAnimation = {
|
||||||
* Retrieves the maximum number of snapshots that should be kept in memory.
|
* Retrieves the maximum number of snapshots that should be kept in memory.
|
||||||
* This limit is a global limit and is valid across all open tabs.
|
* This limit is a global limit and is valid across all open tabs.
|
||||||
*/
|
*/
|
||||||
_getMaxSnapshots: function HSA__getMaxSnapshots() {
|
_getMaxSnapshots: function() {
|
||||||
return gPrefService.getIntPref("browser.snapshots.limit");
|
return gPrefService.getIntPref("browser.snapshots.limit");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1083,7 +1083,7 @@ var gHistorySwipeAnimation = {
|
||||||
* @param aBrowser
|
* @param aBrowser
|
||||||
* The browser the new snapshot was taken in.
|
* The browser the new snapshot was taken in.
|
||||||
*/
|
*/
|
||||||
_removeTrackedSnapshot: function HSA__removeTrackedSnapshot(aIndex, aBrowser) {
|
_removeTrackedSnapshot: function(aIndex, aBrowser) {
|
||||||
let arr = this._trackedSnapshots;
|
let arr = this._trackedSnapshots;
|
||||||
let requiresExactIndexMatch = aIndex >= 0;
|
let requiresExactIndexMatch = aIndex >= 0;
|
||||||
for (let i = 0; i < arr.length; i++) {
|
for (let i = 0; i < arr.length; i++) {
|
||||||
|
|
@ -1133,7 +1133,7 @@ var gHistorySwipeAnimation = {
|
||||||
* couldn't complete before this method was called.
|
* couldn't complete before this method was called.
|
||||||
* @return A new Image object representing the converted blob.
|
* @return A new Image object representing the converted blob.
|
||||||
*/
|
*/
|
||||||
_convertToImg: function HSA__convertToImg(aBlob) {
|
_convertToImg: function(aBlob) {
|
||||||
if (!aBlob)
|
if (!aBlob)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|
@ -1165,7 +1165,7 @@ var gHistorySwipeAnimation = {
|
||||||
* @param aBox
|
* @param aBox
|
||||||
* The box element that uses aSnapshot as background.
|
* The box element that uses aSnapshot as background.
|
||||||
*/
|
*/
|
||||||
_scaleSnapshot: function HSA__scaleSnapshot(aSnapshot, aScale, aBox) {
|
_scaleSnapshot: function(aSnapshot, aScale, aBox) {
|
||||||
if (aSnapshot && aScale != 1 && aBox) {
|
if (aSnapshot && aScale != 1 && aBox) {
|
||||||
if (aSnapshot instanceof HTMLCanvasElement) {
|
if (aSnapshot instanceof HTMLCanvasElement) {
|
||||||
aBox.style.backgroundSize =
|
aBox.style.backgroundSize =
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ var StarUI = {
|
||||||
["cmd_close", "cmd_closeWindow"].map(id => this._element(id));
|
["cmd_close", "cmd_closeWindow"].map(id => this._element(id));
|
||||||
},
|
},
|
||||||
|
|
||||||
_blockCommands: function SU__blockCommands() {
|
_blockCommands: function() {
|
||||||
this._blockedCommands.forEach(function (elt) {
|
this._blockedCommands.forEach(function (elt) {
|
||||||
// make sure not to permanently disable this item (see bug 409155)
|
// make sure not to permanently disable this item (see bug 409155)
|
||||||
if (elt.hasAttribute("wasDisabled"))
|
if (elt.hasAttribute("wasDisabled"))
|
||||||
|
|
@ -58,7 +58,7 @@ var StarUI = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_restoreCommandsState: function SU__restoreCommandsState() {
|
_restoreCommandsState: function() {
|
||||||
this._blockedCommands.forEach(function (elt) {
|
this._blockedCommands.forEach(function (elt) {
|
||||||
if (elt.getAttribute("wasDisabled") != "true")
|
if (elt.getAttribute("wasDisabled") != "true")
|
||||||
elt.removeAttribute("disabled");
|
elt.removeAttribute("disabled");
|
||||||
|
|
@ -331,13 +331,13 @@ var StarUI = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
quitEditMode: function SU_quitEditMode() {
|
quitEditMode: function() {
|
||||||
this._element("editBookmarkPanelContent").hidden = true;
|
this._element("editBookmarkPanelContent").hidden = true;
|
||||||
this._element("editBookmarkPanelBottomButtons").hidden = true;
|
this._element("editBookmarkPanelBottomButtons").hidden = true;
|
||||||
gEditItemOverlay.uninitPanel(true);
|
gEditItemOverlay.uninitPanel(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeBookmarkButtonCommand: function SU_removeBookmarkButtonCommand() {
|
removeBookmarkButtonCommand: function() {
|
||||||
this._uriForRemoval = PlacesUtils.bookmarks.getBookmarkURI(this._itemId);
|
this._uriForRemoval = PlacesUtils.bookmarks.getBookmarkURI(this._itemId);
|
||||||
this.panel.hidePopup();
|
this.panel.hidePopup();
|
||||||
},
|
},
|
||||||
|
|
@ -558,7 +558,7 @@ var PlacesCommandHook = {
|
||||||
/**
|
/**
|
||||||
* Adds a bookmark to the page loaded in the current tab.
|
* Adds a bookmark to the page loaded in the current tab.
|
||||||
*/
|
*/
|
||||||
bookmarkCurrentPage: function PCH_bookmarkCurrentPage(aShowEditUI, aParent) {
|
bookmarkCurrentPage: function(aShowEditUI, aParent) {
|
||||||
this.bookmarkPage(gBrowser.selectedBrowser, aParent, aShowEditUI);
|
this.bookmarkPage(gBrowser.selectedBrowser, aParent, aShowEditUI);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -625,7 +625,7 @@ var PlacesCommandHook = {
|
||||||
* Adds a folder with bookmarks to all of the currently open tabs in this
|
* Adds a folder with bookmarks to all of the currently open tabs in this
|
||||||
* window.
|
* window.
|
||||||
*/
|
*/
|
||||||
bookmarkCurrentPages: function PCH_bookmarkCurrentPages() {
|
bookmarkCurrentPages: function() {
|
||||||
let pages = this.uniqueCurrentPages;
|
let pages = this.uniqueCurrentPages;
|
||||||
if (pages.length > 1) {
|
if (pages.length > 1) {
|
||||||
PlacesUIUtils.showBookmarkDialog({ action: "add"
|
PlacesUIUtils.showBookmarkDialog({ action: "add"
|
||||||
|
|
@ -692,7 +692,7 @@ var PlacesCommandHook = {
|
||||||
* are: History, AllBookmarks, BookmarksMenu, BookmarksToolbar,
|
* are: History, AllBookmarks, BookmarksMenu, BookmarksToolbar,
|
||||||
* UnfiledBookmarks, Tags and Downloads.
|
* UnfiledBookmarks, Tags and Downloads.
|
||||||
*/
|
*/
|
||||||
showPlacesOrganizer: function PCH_showPlacesOrganizer(aLeftPaneRoot) {
|
showPlacesOrganizer: function(aLeftPaneRoot) {
|
||||||
var organizer = Services.wm.getMostRecentWindow("Places:Organizer");
|
var organizer = Services.wm.getMostRecentWindow("Places:Organizer");
|
||||||
// Due to bug 528706, getMostRecentWindow can return closed windows.
|
// Due to bug 528706, getMostRecentWindow can return closed windows.
|
||||||
if (!organizer || organizer.closed) {
|
if (!organizer || organizer.closed) {
|
||||||
|
|
@ -731,7 +731,7 @@ HistoryMenu.prototype = {
|
||||||
return SessionStore.getClosedTabCount(window);
|
return SessionStore.getClosedTabCount(window);
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleRecentlyClosedTabs: function HM_toggleRecentlyClosedTabs() {
|
toggleRecentlyClosedTabs: function() {
|
||||||
// enable/disable the Recently Closed Tabs sub menu
|
// enable/disable the Recently Closed Tabs sub menu
|
||||||
var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedTabsMenu")[0];
|
var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedTabsMenu")[0];
|
||||||
|
|
||||||
|
|
@ -745,7 +745,7 @@ HistoryMenu.prototype = {
|
||||||
/**
|
/**
|
||||||
* Populate when the history menu is opened
|
* Populate when the history menu is opened
|
||||||
*/
|
*/
|
||||||
populateUndoSubmenu: function PHM_populateUndoSubmenu() {
|
populateUndoSubmenu: function() {
|
||||||
var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedTabsMenu")[0];
|
var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedTabsMenu")[0];
|
||||||
var undoPopup = undoMenu.firstChild;
|
var undoPopup = undoMenu.firstChild;
|
||||||
|
|
||||||
|
|
@ -767,7 +767,7 @@ HistoryMenu.prototype = {
|
||||||
undoPopup.appendChild(tabsFragment);
|
undoPopup.appendChild(tabsFragment);
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleRecentlyClosedWindows: function PHM_toggleRecentlyClosedWindows() {
|
toggleRecentlyClosedWindows: function() {
|
||||||
// enable/disable the Recently Closed Windows sub menu
|
// enable/disable the Recently Closed Windows sub menu
|
||||||
var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedWindowsMenu")[0];
|
var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedWindowsMenu")[0];
|
||||||
|
|
||||||
|
|
@ -781,7 +781,7 @@ HistoryMenu.prototype = {
|
||||||
/**
|
/**
|
||||||
* Populate when the history menu is opened
|
* Populate when the history menu is opened
|
||||||
*/
|
*/
|
||||||
populateUndoWindowSubmenu: function PHM_populateUndoWindowSubmenu() {
|
populateUndoWindowSubmenu: function() {
|
||||||
let undoMenu = this._rootElt.getElementsByClassName("recentlyClosedWindowsMenu")[0];
|
let undoMenu = this._rootElt.getElementsByClassName("recentlyClosedWindowsMenu")[0];
|
||||||
let undoPopup = undoMenu.firstChild;
|
let undoPopup = undoMenu.firstChild;
|
||||||
|
|
||||||
|
|
@ -803,7 +803,7 @@ HistoryMenu.prototype = {
|
||||||
undoPopup.appendChild(windowsFragment);
|
undoPopup.appendChild(windowsFragment);
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleTabsFromOtherComputers: function PHM_toggleTabsFromOtherComputers() {
|
toggleTabsFromOtherComputers: function() {
|
||||||
// This is a no-op if MOZ_SERVICES_SYNC isn't defined
|
// This is a no-op if MOZ_SERVICES_SYNC isn't defined
|
||||||
#ifdef MOZ_SERVICES_SYNC
|
#ifdef MOZ_SERVICES_SYNC
|
||||||
// Enable/disable the Tabs From Other Computers menu. Some of the menus handled
|
// Enable/disable the Tabs From Other Computers menu. Some of the menus handled
|
||||||
|
|
@ -829,7 +829,7 @@ HistoryMenu.prototype = {
|
||||||
#endif
|
#endif
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPopupShowing: function HM__onPopupShowing(aEvent) {
|
_onPopupShowing: function(aEvent) {
|
||||||
PlacesMenu.prototype._onPopupShowing.apply(this, arguments);
|
PlacesMenu.prototype._onPopupShowing.apply(this, arguments);
|
||||||
|
|
||||||
// Don't handle events for submenus.
|
// Don't handle events for submenus.
|
||||||
|
|
@ -841,7 +841,7 @@ HistoryMenu.prototype = {
|
||||||
this.toggleTabsFromOtherComputers();
|
this.toggleTabsFromOtherComputers();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onCommand: function HM__onCommand(aEvent) {
|
_onCommand: function(aEvent) {
|
||||||
let placesNode = aEvent.target._placesNode;
|
let placesNode = aEvent.target._placesNode;
|
||||||
if (placesNode) {
|
if (placesNode) {
|
||||||
if (!PrivateBrowsingUtils.isWindowPrivate(window))
|
if (!PrivateBrowsingUtils.isWindowPrivate(window))
|
||||||
|
|
@ -866,7 +866,7 @@ var BookmarksEventHandler = {
|
||||||
* @param aView
|
* @param aView
|
||||||
* The places view which aEvent should be associated with.
|
* The places view which aEvent should be associated with.
|
||||||
*/
|
*/
|
||||||
onClick: function BEH_onClick(aEvent, aView) {
|
onClick: function(aEvent, aView) {
|
||||||
// Only handle middle-click or left-click with modifiers.
|
// Only handle middle-click or left-click with modifiers.
|
||||||
let modifKey;
|
let modifKey;
|
||||||
if (AppConstants.platform == "macosx") {
|
if (AppConstants.platform == "macosx") {
|
||||||
|
|
@ -915,13 +915,13 @@ var BookmarksEventHandler = {
|
||||||
* @param aView
|
* @param aView
|
||||||
* The places view which aEvent should be associated with.
|
* The places view which aEvent should be associated with.
|
||||||
*/
|
*/
|
||||||
onCommand: function BEH_onCommand(aEvent, aView) {
|
onCommand: function(aEvent, aView) {
|
||||||
var target = aEvent.originalTarget;
|
var target = aEvent.originalTarget;
|
||||||
if (target._placesNode)
|
if (target._placesNode)
|
||||||
PlacesUIUtils.openNodeWithEvent(target._placesNode, aEvent, aView);
|
PlacesUIUtils.openNodeWithEvent(target._placesNode, aEvent, aView);
|
||||||
},
|
},
|
||||||
|
|
||||||
fillInBHTooltip: function BEH_fillInBHTooltip(aDocument, aEvent) {
|
fillInBHTooltip: function(aDocument, aEvent) {
|
||||||
var node;
|
var node;
|
||||||
var cropped = false;
|
var cropped = false;
|
||||||
var targetURI;
|
var targetURI;
|
||||||
|
|
@ -991,7 +991,7 @@ var PlacesMenuDNDHandler = {
|
||||||
* @param event
|
* @param event
|
||||||
* The DragEnter event that spawned the opening.
|
* The DragEnter event that spawned the opening.
|
||||||
*/
|
*/
|
||||||
onDragEnter: function PMDH_onDragEnter(event) {
|
onDragEnter: function(event) {
|
||||||
// Opening menus in a Places popup is handled by the view itself.
|
// Opening menus in a Places popup is handled by the view itself.
|
||||||
if (!this._isStaticContainer(event.target))
|
if (!this._isStaticContainer(event.target))
|
||||||
return;
|
return;
|
||||||
|
|
@ -1022,7 +1022,7 @@ var PlacesMenuDNDHandler = {
|
||||||
/**
|
/**
|
||||||
* Handles dragleave on the <menu> element.
|
* Handles dragleave on the <menu> element.
|
||||||
*/
|
*/
|
||||||
onDragLeave: function PMDH_onDragLeave(event) {
|
onDragLeave: function(event) {
|
||||||
// Handle menu-button separate targets.
|
// Handle menu-button separate targets.
|
||||||
if (event.relatedTarget === event.currentTarget ||
|
if (event.relatedTarget === event.currentTarget ||
|
||||||
(event.relatedTarget &&
|
(event.relatedTarget &&
|
||||||
|
|
@ -1063,7 +1063,7 @@ var PlacesMenuDNDHandler = {
|
||||||
* @returns true if the element is a container element (menu or
|
* @returns true if the element is a container element (menu or
|
||||||
*` menu-toolbarbutton), false otherwise.
|
*` menu-toolbarbutton), false otherwise.
|
||||||
*/
|
*/
|
||||||
_isStaticContainer: function PMDH__isContainer(node) {
|
_isStaticContainer: function(node) {
|
||||||
let isMenu = node.localName == "menu" ||
|
let isMenu = node.localName == "menu" ||
|
||||||
(node.localName == "toolbarbutton" &&
|
(node.localName == "toolbarbutton" &&
|
||||||
(node.getAttribute("type") == "menu" ||
|
(node.getAttribute("type") == "menu" ||
|
||||||
|
|
@ -1079,7 +1079,7 @@ var PlacesMenuDNDHandler = {
|
||||||
* @param event
|
* @param event
|
||||||
* The DragOver event.
|
* The DragOver event.
|
||||||
*/
|
*/
|
||||||
onDragOver: function PMDH_onDragOver(event) {
|
onDragOver: function(event) {
|
||||||
let ip = new InsertionPoint(PlacesUtils.bookmarksMenuFolderId,
|
let ip = new InsertionPoint(PlacesUtils.bookmarksMenuFolderId,
|
||||||
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
||||||
Components.interfaces.nsITreeView.DROP_ON);
|
Components.interfaces.nsITreeView.DROP_ON);
|
||||||
|
|
@ -1094,7 +1094,7 @@ var PlacesMenuDNDHandler = {
|
||||||
* @param event
|
* @param event
|
||||||
* The Drop event.
|
* The Drop event.
|
||||||
*/
|
*/
|
||||||
onDrop: function PMDH_onDrop(event) {
|
onDrop: function(event) {
|
||||||
// Put the item at the end of bookmark menu.
|
// Put the item at the end of bookmark menu.
|
||||||
let ip = new InsertionPoint(PlacesUtils.bookmarksMenuFolderId,
|
let ip = new InsertionPoint(PlacesUtils.bookmarksMenuFolderId,
|
||||||
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
||||||
|
|
@ -1120,7 +1120,7 @@ var PlacesToolbarHelper = {
|
||||||
return document.getElementById("bookmarks-toolbar-placeholder");
|
return document.getElementById("bookmarks-toolbar-placeholder");
|
||||||
},
|
},
|
||||||
|
|
||||||
init: function PTH_init(forceToolbarOverflowCheck) {
|
init: function(forceToolbarOverflowCheck) {
|
||||||
let viewElt = this._viewElt;
|
let viewElt = this._viewElt;
|
||||||
if (!viewElt || viewElt._placesView)
|
if (!viewElt || viewElt._placesView)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1148,11 +1148,11 @@ var PlacesToolbarHelper = {
|
||||||
this._setupPlaceholder();
|
this._setupPlaceholder();
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function PTH_uninit() {
|
uninit: function() {
|
||||||
CustomizableUI.removeListener(this);
|
CustomizableUI.removeListener(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
customizeStart: function PTH_customizeStart() {
|
customizeStart: function() {
|
||||||
try {
|
try {
|
||||||
let viewElt = this._viewElt;
|
let viewElt = this._viewElt;
|
||||||
if (viewElt && viewElt._placesView)
|
if (viewElt && viewElt._placesView)
|
||||||
|
|
@ -1163,11 +1163,11 @@ var PlacesToolbarHelper = {
|
||||||
this._shouldWrap = this._getShouldWrap();
|
this._shouldWrap = this._getShouldWrap();
|
||||||
},
|
},
|
||||||
|
|
||||||
customizeChange: function PTH_customizeChange() {
|
customizeChange: function() {
|
||||||
this._setupPlaceholder();
|
this._setupPlaceholder();
|
||||||
},
|
},
|
||||||
|
|
||||||
_setupPlaceholder: function PTH_setupPlaceholder() {
|
_setupPlaceholder: function() {
|
||||||
let placeholder = this._placeholder;
|
let placeholder = this._placeholder;
|
||||||
if (!placeholder) {
|
if (!placeholder) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -1184,12 +1184,12 @@ var PlacesToolbarHelper = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
customizeDone: function PTH_customizeDone() {
|
customizeDone: function() {
|
||||||
this._isCustomizing = false;
|
this._isCustomizing = false;
|
||||||
this.init(true);
|
this.init(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getShouldWrap: function PTH_getShouldWrap() {
|
_getShouldWrap: function() {
|
||||||
let placement = CustomizableUI.getPlacementOfWidget("personal-bookmarks");
|
let placement = CustomizableUI.getPlacementOfWidget("personal-bookmarks");
|
||||||
let area = placement && placement.area;
|
let area = placement && placement.area;
|
||||||
let areaType = area && CustomizableUI.getAreaType(area);
|
let areaType = area && CustomizableUI.getAreaType(area);
|
||||||
|
|
@ -1351,11 +1351,11 @@ var BookmarkingUI = {
|
||||||
* reasons.
|
* reasons.
|
||||||
*/
|
*/
|
||||||
_popupNeedsUpdate: true,
|
_popupNeedsUpdate: true,
|
||||||
onToolbarVisibilityChange: function BUI_onToolbarVisibilityChange() {
|
onToolbarVisibilityChange: function() {
|
||||||
this._popupNeedsUpdate = true;
|
this._popupNeedsUpdate = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
onPopupShowing: function BUI_onPopupShowing(event) {
|
onPopupShowing: function(event) {
|
||||||
// Don't handle events for submenus.
|
// Don't handle events for submenus.
|
||||||
if (event.target != event.currentTarget)
|
if (event.target != event.currentTarget)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1554,12 +1554,12 @@ var BookmarkingUI = {
|
||||||
Services.prefs.setBoolPref(this.RECENTLY_BOOKMARKED_PREF, false);
|
Services.prefs.setBoolPref(this.RECENTLY_BOOKMARKED_PREF, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateCustomizationState: function BUI__updateCustomizationState() {
|
_updateCustomizationState: function() {
|
||||||
let placement = CustomizableUI.getPlacementOfWidget(this.BOOKMARK_BUTTON_ID);
|
let placement = CustomizableUI.getPlacementOfWidget(this.BOOKMARK_BUTTON_ID);
|
||||||
this._currentAreaType = placement && CustomizableUI.getAreaType(placement.area);
|
this._currentAreaType = placement && CustomizableUI.getAreaType(placement.area);
|
||||||
},
|
},
|
||||||
|
|
||||||
_uninitView: function BUI__uninitView() {
|
_uninitView: function() {
|
||||||
// When an element with a placesView attached is removed and re-inserted,
|
// When an element with a placesView attached is removed and re-inserted,
|
||||||
// XBL reapplies the binding causing any kind of issues and possible leaks,
|
// XBL reapplies the binding causing any kind of issues and possible leaks,
|
||||||
// so kill current view and let popupshowing generate a new one.
|
// so kill current view and let popupshowing generate a new one.
|
||||||
|
|
@ -1581,38 +1581,38 @@ var BookmarkingUI = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onCustomizeStart: function BUI_customizeStart(aWindow) {
|
onCustomizeStart: function(aWindow) {
|
||||||
if (aWindow == window) {
|
if (aWindow == window) {
|
||||||
this._uninitView();
|
this._uninitView();
|
||||||
this._isCustomizing = true;
|
this._isCustomizing = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onWidgetAdded: function BUI_widgetAdded(aWidgetId) {
|
onWidgetAdded: function(aWidgetId) {
|
||||||
if (aWidgetId == this.BOOKMARK_BUTTON_ID) {
|
if (aWidgetId == this.BOOKMARK_BUTTON_ID) {
|
||||||
this._onWidgetWasMoved();
|
this._onWidgetWasMoved();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onWidgetRemoved: function BUI_widgetRemoved(aWidgetId) {
|
onWidgetRemoved: function(aWidgetId) {
|
||||||
if (aWidgetId == this.BOOKMARK_BUTTON_ID) {
|
if (aWidgetId == this.BOOKMARK_BUTTON_ID) {
|
||||||
this._onWidgetWasMoved();
|
this._onWidgetWasMoved();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onWidgetReset: function BUI_widgetReset(aNode, aContainer) {
|
onWidgetReset: function(aNode, aContainer) {
|
||||||
if (aNode == this.button) {
|
if (aNode == this.button) {
|
||||||
this._onWidgetWasMoved();
|
this._onWidgetWasMoved();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onWidgetUndoMove: function BUI_undoWidgetUndoMove(aNode, aContainer) {
|
onWidgetUndoMove: function(aNode, aContainer) {
|
||||||
if (aNode == this.button) {
|
if (aNode == this.button) {
|
||||||
this._onWidgetWasMoved();
|
this._onWidgetWasMoved();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onWidgetWasMoved: function BUI_widgetWasMoved() {
|
_onWidgetWasMoved: function() {
|
||||||
let usedToUpdateStarState = this._shouldUpdateStarState();
|
let usedToUpdateStarState = this._shouldUpdateStarState();
|
||||||
this._updateCustomizationState();
|
this._updateCustomizationState();
|
||||||
if (!usedToUpdateStarState && this._shouldUpdateStarState()) {
|
if (!usedToUpdateStarState && this._shouldUpdateStarState()) {
|
||||||
|
|
@ -1627,7 +1627,7 @@ var BookmarkingUI = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onCustomizeEnd: function BUI_customizeEnd(aWindow) {
|
onCustomizeEnd: function(aWindow) {
|
||||||
if (aWindow == window) {
|
if (aWindow == window) {
|
||||||
this._isCustomizing = false;
|
this._isCustomizing = false;
|
||||||
this.onToolbarVisibilityChange();
|
this.onToolbarVisibilityChange();
|
||||||
|
|
@ -1641,7 +1641,7 @@ var BookmarkingUI = {
|
||||||
|
|
||||||
_hasBookmarksObserver: false,
|
_hasBookmarksObserver: false,
|
||||||
_itemIds: [],
|
_itemIds: [],
|
||||||
uninit: function BUI_uninit() {
|
uninit: function() {
|
||||||
this._updateBookmarkPageMenuItem(true);
|
this._updateBookmarkPageMenuItem(true);
|
||||||
CustomizableUI.removeListener(this);
|
CustomizableUI.removeListener(this);
|
||||||
|
|
||||||
|
|
@ -1657,14 +1657,14 @@ var BookmarkingUI = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onLocationChange: function BUI_onLocationChange() {
|
onLocationChange: function() {
|
||||||
if (this._uri && gBrowser.currentURI.equals(this._uri)) {
|
if (this._uri && gBrowser.currentURI.equals(this._uri)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.updateStarState();
|
this.updateStarState();
|
||||||
},
|
},
|
||||||
|
|
||||||
updateStarState: function BUI_updateStarState() {
|
updateStarState: function() {
|
||||||
// Reset tracked values.
|
// Reset tracked values.
|
||||||
this._uri = gBrowser.currentURI;
|
this._uri = gBrowser.currentURI;
|
||||||
this._itemIds = [];
|
this._itemIds = [];
|
||||||
|
|
@ -1704,7 +1704,7 @@ var BookmarkingUI = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateStar: function BUI__updateStar() {
|
_updateStar: function() {
|
||||||
if (!this._shouldUpdateStarState()) {
|
if (!this._shouldUpdateStarState()) {
|
||||||
if (this.broadcaster.hasAttribute("starred")) {
|
if (this.broadcaster.hasAttribute("starred")) {
|
||||||
this.broadcaster.removeAttribute("starred");
|
this.broadcaster.removeAttribute("starred");
|
||||||
|
|
@ -1733,7 +1733,7 @@ var BookmarkingUI = {
|
||||||
* forceReset is passed when we're destroyed and the label should go back
|
* forceReset is passed when we're destroyed and the label should go back
|
||||||
* to the default (Bookmark This Page) for OS X.
|
* to the default (Bookmark This Page) for OS X.
|
||||||
*/
|
*/
|
||||||
_updateBookmarkPageMenuItem: function BUI__updateBookmarkPageMenuItem(forceReset) {
|
_updateBookmarkPageMenuItem: function(forceReset) {
|
||||||
let isStarred = !forceReset && this._itemIds.length > 0;
|
let isStarred = !forceReset && this._itemIds.length > 0;
|
||||||
let label = isStarred ? "editlabel" : "bookmarklabel";
|
let label = isStarred ? "editlabel" : "bookmarklabel";
|
||||||
if (this.broadcaster) {
|
if (this.broadcaster) {
|
||||||
|
|
@ -1741,7 +1741,7 @@ var BookmarkingUI = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onMainMenuPopupShowing: function BUI_onMainMenuPopupShowing(event) {
|
onMainMenuPopupShowing: function(event) {
|
||||||
// Don't handle events for submenus.
|
// Don't handle events for submenus.
|
||||||
if (event.target != event.currentTarget)
|
if (event.target != event.currentTarget)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1751,7 +1751,7 @@ var BookmarkingUI = {
|
||||||
this._initRecentBookmarks(document.getElementById("menu_recentBookmarks"));
|
this._initRecentBookmarks(document.getElementById("menu_recentBookmarks"));
|
||||||
},
|
},
|
||||||
|
|
||||||
_showBookmarkedNotification: function BUI_showBookmarkedNotification() {
|
_showBookmarkedNotification: function() {
|
||||||
function getCenteringTransformForRects(rectToPosition, referenceRect) {
|
function getCenteringTransformForRects(rectToPosition, referenceRect) {
|
||||||
let topDiff = referenceRect.top - rectToPosition.top;
|
let topDiff = referenceRect.top - rectToPosition.top;
|
||||||
let leftDiff = referenceRect.left - rectToPosition.left;
|
let leftDiff = referenceRect.left - rectToPosition.left;
|
||||||
|
|
@ -1824,7 +1824,7 @@ var BookmarkingUI = {
|
||||||
CustomizableUI.AREA_PANEL);
|
CustomizableUI.AREA_PANEL);
|
||||||
},
|
},
|
||||||
|
|
||||||
onCommand: function BUI_onCommand(aEvent) {
|
onCommand: function(aEvent) {
|
||||||
if (aEvent.target != aEvent.currentTarget) {
|
if (aEvent.target != aEvent.currentTarget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1855,7 +1855,7 @@ var BookmarkingUI = {
|
||||||
this._updateBookmarkPageMenuItem();
|
this._updateBookmarkPageMenuItem();
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function BUI_handleEvent(aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
case "ViewShowing":
|
case "ViewShowing":
|
||||||
this.onPanelMenuViewShowing(aEvent);
|
this.onPanelMenuViewShowing(aEvent);
|
||||||
|
|
@ -1866,7 +1866,7 @@ var BookmarkingUI = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onPanelMenuViewShowing: function BUI_onViewShowing(aEvent) {
|
onPanelMenuViewShowing: function(aEvent) {
|
||||||
this._updateBookmarkPageMenuItem();
|
this._updateBookmarkPageMenuItem();
|
||||||
// Update checked status of the toolbar toggle.
|
// Update checked status of the toolbar toggle.
|
||||||
let viewToolbar = document.getElementById("panelMenu_viewBookmarksToolbar");
|
let viewToolbar = document.getElementById("panelMenu_viewBookmarksToolbar");
|
||||||
|
|
@ -1891,13 +1891,13 @@ var BookmarkingUI = {
|
||||||
aEvent.target.removeEventListener("ViewShowing", this);
|
aEvent.target.removeEventListener("ViewShowing", this);
|
||||||
},
|
},
|
||||||
|
|
||||||
onPanelMenuViewHiding: function BUI_onViewHiding(aEvent) {
|
onPanelMenuViewHiding: function(aEvent) {
|
||||||
this._panelMenuView.uninit();
|
this._panelMenuView.uninit();
|
||||||
delete this._panelMenuView;
|
delete this._panelMenuView;
|
||||||
aEvent.target.removeEventListener("ViewHiding", this);
|
aEvent.target.removeEventListener("ViewHiding", this);
|
||||||
},
|
},
|
||||||
|
|
||||||
onPanelMenuViewCommand: function BUI_onPanelMenuViewCommand(aEvent, aView) {
|
onPanelMenuViewCommand: function(aEvent, aView) {
|
||||||
let target = aEvent.originalTarget;
|
let target = aEvent.originalTarget;
|
||||||
if (!target._placesNode)
|
if (!target._placesNode)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1909,7 +1909,7 @@ var BookmarkingUI = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// nsINavBookmarkObserver
|
// nsINavBookmarkObserver
|
||||||
onItemAdded: function BUI_onItemAdded(aItemId, aParentId, aIndex, aItemType,
|
onItemAdded: function(aItemId, aParentId, aIndex, aItemType,
|
||||||
aURI) {
|
aURI) {
|
||||||
if (aURI && aURI.equals(this._uri)) {
|
if (aURI && aURI.equals(this._uri)) {
|
||||||
// If a new bookmark has been added to the tracked uri, register it.
|
// If a new bookmark has been added to the tracked uri, register it.
|
||||||
|
|
@ -1923,7 +1923,7 @@ var BookmarkingUI = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onItemRemoved: function BUI_onItemRemoved(aItemId) {
|
onItemRemoved: function(aItemId) {
|
||||||
let index = this._itemIds.indexOf(aItemId);
|
let index = this._itemIds.indexOf(aItemId);
|
||||||
// If one of the tracked bookmarks has been removed, unregister it.
|
// If one of the tracked bookmarks has been removed, unregister it.
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
|
|
@ -1935,7 +1935,7 @@ var BookmarkingUI = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onItemChanged: function BUI_onItemChanged(aItemId, aProperty,
|
onItemChanged: function(aItemId, aProperty,
|
||||||
aIsAnnotationProperty, aNewValue) {
|
aIsAnnotationProperty, aNewValue) {
|
||||||
if (aProperty == "uri") {
|
if (aProperty == "uri") {
|
||||||
let index = this._itemIds.indexOf(aItemId);
|
let index = this._itemIds.indexOf(aItemId);
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ var gPluginHandler = {
|
||||||
openUILinkIn(url, "tab");
|
openUILinkIn(url, "tab");
|
||||||
},
|
},
|
||||||
|
|
||||||
submitReport: function submitReport(runID, keyVals, submitURLOptIn) {
|
submitReport: function(runID, keyVals, submitURLOptIn) {
|
||||||
/*** STUB ***/
|
/*** STUB ***/
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
|
|
@ -110,7 +110,7 @@ var gPluginHandler = {
|
||||||
openHelpLink("plugin-crashed", false);
|
openHelpLink("plugin-crashed", false);
|
||||||
},
|
},
|
||||||
|
|
||||||
_clickToPlayNotificationEventCallback: function PH_ctpEventCallback(event) {
|
_clickToPlayNotificationEventCallback: function(event) {
|
||||||
if (event == "showing") {
|
if (event == "showing") {
|
||||||
Services.telemetry.getHistogramById("PLUGINS_NOTIFICATION_SHOWN")
|
Services.telemetry.getHistogramById("PLUGINS_NOTIFICATION_SHOWN")
|
||||||
.add(!this.options.primaryPlugin);
|
.add(!this.options.primaryPlugin);
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ var gSyncUI = {
|
||||||
|
|
||||||
_unloaded: false,
|
_unloaded: false,
|
||||||
|
|
||||||
init: function SUI_init() {
|
init: function() {
|
||||||
// Proceed to set up the UI if Sync has already started up.
|
// Proceed to set up the UI if Sync has already started up.
|
||||||
// Otherwise we'll do it when Sync is firing up.
|
// Otherwise we'll do it when Sync is firing up.
|
||||||
let xps = Components.classes["@mozilla.org/weave/service;1"]
|
let xps = Components.classes["@mozilla.org/weave/service;1"]
|
||||||
|
|
@ -48,7 +48,7 @@ var gSyncUI = {
|
||||||
}, false);
|
}, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
initUI: function SUI_initUI() {
|
initUI: function() {
|
||||||
// If this is a browser window?
|
// If this is a browser window?
|
||||||
if (gBrowser) {
|
if (gBrowser) {
|
||||||
this._obs.push("weave:notification:added");
|
this._obs.push("weave:notification:added");
|
||||||
|
|
@ -64,7 +64,7 @@ var gSyncUI = {
|
||||||
this.updateUI();
|
this.updateUI();
|
||||||
},
|
},
|
||||||
|
|
||||||
initNotifications: function SUI_initNotifications() {
|
initNotifications: function() {
|
||||||
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||||
let notificationbox = document.createElementNS(XULNS, "notificationbox");
|
let notificationbox = document.createElementNS(XULNS, "notificationbox");
|
||||||
notificationbox.id = "sync-notifications";
|
notificationbox.id = "sync-notifications";
|
||||||
|
|
@ -82,7 +82,7 @@ var gSyncUI = {
|
||||||
|
|
||||||
_wasDelayed: false,
|
_wasDelayed: false,
|
||||||
|
|
||||||
_needsSetup: function SUI__needsSetup() {
|
_needsSetup: function() {
|
||||||
let firstSync = "";
|
let firstSync = "";
|
||||||
try {
|
try {
|
||||||
firstSync = Services.prefs.getCharPref("services.sync.firstSync");
|
firstSync = Services.prefs.getCharPref("services.sync.firstSync");
|
||||||
|
|
@ -91,7 +91,7 @@ var gSyncUI = {
|
||||||
firstSync == "notReady";
|
firstSync == "notReady";
|
||||||
},
|
},
|
||||||
|
|
||||||
updateUI: function SUI_updateUI() {
|
updateUI: function() {
|
||||||
let needsSetup = this._needsSetup();
|
let needsSetup = this._needsSetup();
|
||||||
document.getElementById("sync-setup-state").hidden = !needsSetup;
|
document.getElementById("sync-setup-state").hidden = !needsSetup;
|
||||||
document.getElementById("sync-syncnow-state").hidden = needsSetup;
|
document.getElementById("sync-syncnow-state").hidden = needsSetup;
|
||||||
|
|
@ -111,7 +111,7 @@ var gSyncUI = {
|
||||||
|
|
||||||
|
|
||||||
// Functions called by observers
|
// Functions called by observers
|
||||||
onActivityStart: function SUI_onActivityStart() {
|
onActivityStart: function() {
|
||||||
if (!gBrowser)
|
if (!gBrowser)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -122,7 +122,7 @@ var gSyncUI = {
|
||||||
button.setAttribute("status", "active");
|
button.setAttribute("status", "active");
|
||||||
},
|
},
|
||||||
|
|
||||||
onSyncDelay: function SUI_onSyncDelay() {
|
onSyncDelay: function() {
|
||||||
// basically, we want to just inform users that stuff is going to take a while
|
// basically, we want to just inform users that stuff is going to take a while
|
||||||
let title = this._stringBundle.GetStringFromName("error.sync.no_node_found.title");
|
let title = this._stringBundle.GetStringFromName("error.sync.no_node_found.title");
|
||||||
let description = this._stringBundle.GetStringFromName("error.sync.no_node_found");
|
let description = this._stringBundle.GetStringFromName("error.sync.no_node_found");
|
||||||
|
|
@ -137,17 +137,17 @@ var gSyncUI = {
|
||||||
this._wasDelayed = true;
|
this._wasDelayed = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoginFinish: function SUI_onLoginFinish() {
|
onLoginFinish: function() {
|
||||||
// Clear out any login failure notifications
|
// Clear out any login failure notifications
|
||||||
let title = this._stringBundle.GetStringFromName("error.login.title");
|
let title = this._stringBundle.GetStringFromName("error.login.title");
|
||||||
this.clearError(title);
|
this.clearError(title);
|
||||||
},
|
},
|
||||||
|
|
||||||
onSetupComplete: function SUI_onSetupComplete() {
|
onSetupComplete: function() {
|
||||||
this.onLoginFinish();
|
this.onLoginFinish();
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoginError: function SUI_onLoginError() {
|
onLoginError: function() {
|
||||||
// if login fails, any other notifications are essentially moot
|
// if login fails, any other notifications are essentially moot
|
||||||
Weave.Notifications.removeAll();
|
Weave.Notifications.removeAll();
|
||||||
|
|
||||||
|
|
@ -185,15 +185,15 @@ var gSyncUI = {
|
||||||
this.updateUI();
|
this.updateUI();
|
||||||
},
|
},
|
||||||
|
|
||||||
onLogout: function SUI_onLogout() {
|
onLogout: function() {
|
||||||
this.updateUI();
|
this.updateUI();
|
||||||
},
|
},
|
||||||
|
|
||||||
onStartOver: function SUI_onStartOver() {
|
onStartOver: function() {
|
||||||
this.clearError();
|
this.clearError();
|
||||||
},
|
},
|
||||||
|
|
||||||
onQuotaNotice: function onQuotaNotice(subject, data) {
|
onQuotaNotice: function(subject, data) {
|
||||||
let title = this._stringBundle.GetStringFromName("warning.sync.quota.label");
|
let title = this._stringBundle.GetStringFromName("warning.sync.quota.label");
|
||||||
let description = this._stringBundle.GetStringFromName("warning.sync.quota.description");
|
let description = this._stringBundle.GetStringFromName("warning.sync.quota.description");
|
||||||
let buttons = [];
|
let buttons = [];
|
||||||
|
|
@ -214,11 +214,11 @@ var gSyncUI = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Commands
|
// Commands
|
||||||
doSync: function SUI_doSync() {
|
doSync: function() {
|
||||||
setTimeout(function() Weave.Service.errorHandler.syncAndReportErrors(), 0);
|
setTimeout(function() Weave.Service.errorHandler.syncAndReportErrors(), 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleToolbarButton: function SUI_handleStatusbarButton() {
|
handleToolbarButton: function() {
|
||||||
if (this._needsSetup())
|
if (this._needsSetup())
|
||||||
this.openSetup();
|
this.openSetup();
|
||||||
else
|
else
|
||||||
|
|
@ -238,7 +238,7 @@ var gSyncUI = {
|
||||||
* "reset" -- reset sync
|
* "reset" -- reset sync
|
||||||
*/
|
*/
|
||||||
|
|
||||||
openSetup: function SUI_openSetup(wizardType) {
|
openSetup: function(wizardType) {
|
||||||
let win = Services.wm.getMostRecentWindow("Weave:AccountSetup");
|
let win = Services.wm.getMostRecentWindow("Weave:AccountSetup");
|
||||||
if (win)
|
if (win)
|
||||||
win.focus();
|
win.focus();
|
||||||
|
|
@ -261,7 +261,7 @@ var gSyncUI = {
|
||||||
"syncAddDevice", "centerscreen,chrome,resizable=no");
|
"syncAddDevice", "centerscreen,chrome,resizable=no");
|
||||||
},
|
},
|
||||||
|
|
||||||
openQuotaDialog: function SUI_openQuotaDialog() {
|
openQuotaDialog: function() {
|
||||||
let win = Services.wm.getMostRecentWindow("Sync:ViewQuota");
|
let win = Services.wm.getMostRecentWindow("Sync:ViewQuota");
|
||||||
if (win)
|
if (win)
|
||||||
win.focus();
|
win.focus();
|
||||||
|
|
@ -271,12 +271,12 @@ var gSyncUI = {
|
||||||
"centerscreen,chrome,dialog,modal");
|
"centerscreen,chrome,dialog,modal");
|
||||||
},
|
},
|
||||||
|
|
||||||
openPrefs: function SUI_openPrefs() {
|
openPrefs: function() {
|
||||||
openPreferences("paneSync");
|
openPreferences("paneSync");
|
||||||
},
|
},
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
_updateLastSyncTime: function SUI__updateLastSyncTime() {
|
_updateLastSyncTime: function() {
|
||||||
if (!gBrowser)
|
if (!gBrowser)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -302,12 +302,12 @@ var gSyncUI = {
|
||||||
syncButton.setAttribute("tooltiptext", lastSyncLabel);
|
syncButton.setAttribute("tooltiptext", lastSyncLabel);
|
||||||
},
|
},
|
||||||
|
|
||||||
clearError: function SUI_clearError(errorString) {
|
clearError: function(errorString) {
|
||||||
Weave.Notifications.removeAll(errorString);
|
Weave.Notifications.removeAll(errorString);
|
||||||
this.updateUI();
|
this.updateUI();
|
||||||
},
|
},
|
||||||
|
|
||||||
onSyncFinish: function SUI_onSyncFinish() {
|
onSyncFinish: function() {
|
||||||
let title = this._stringBundle.GetStringFromName("error.sync.title");
|
let title = this._stringBundle.GetStringFromName("error.sync.title");
|
||||||
|
|
||||||
// Clear out sync failures on a successful sync
|
// Clear out sync failures on a successful sync
|
||||||
|
|
@ -320,7 +320,7 @@ var gSyncUI = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onSyncError: function SUI_onSyncError() {
|
onSyncError: function() {
|
||||||
let title = this._stringBundle.GetStringFromName("error.sync.title");
|
let title = this._stringBundle.GetStringFromName("error.sync.title");
|
||||||
|
|
||||||
if (Weave.Status.login != Weave.LOGIN_SUCCEEDED) {
|
if (Weave.Status.login != Weave.LOGIN_SUCCEEDED) {
|
||||||
|
|
@ -401,7 +401,7 @@ var gSyncUI = {
|
||||||
this.updateUI();
|
this.updateUI();
|
||||||
},
|
},
|
||||||
|
|
||||||
observe: function SUI_observe(subject, topic, data) {
|
observe: function(subject, topic, data) {
|
||||||
if (this._unloaded) {
|
if (this._unloaded) {
|
||||||
Cu.reportError("SyncUI observer called after unload: " + topic);
|
Cu.reportError("SyncUI observer called after unload: " + topic);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ var TabsInTitlebar = {
|
||||||
init: function () {},
|
init: function () {},
|
||||||
uninit: function () {},
|
uninit: function () {},
|
||||||
allowedBy: function (condition, allow) {},
|
allowedBy: function (condition, allow) {},
|
||||||
updateAppearance: function updateAppearance(aForce) {},
|
updateAppearance: function(aForce) {},
|
||||||
get enabled() {
|
get enabled() {
|
||||||
return document.documentElement.getAttribute("tabsintitlebar") == "true";
|
return document.documentElement.getAttribute("tabsintitlebar") == "true";
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ var TabsInTitlebar = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
updateAppearance: function updateAppearance(aForce) {
|
updateAppearance: function(aForce) {
|
||||||
this._update(aForce);
|
this._update(aForce);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ var gBrowserThumbnails = {
|
||||||
*/
|
*/
|
||||||
_tabEvents: ["TabClose", "TabSelect"],
|
_tabEvents: ["TabClose", "TabSelect"],
|
||||||
|
|
||||||
init: function Thumbnails_init() {
|
init: function() {
|
||||||
PageThumbs.addExpirationFilter(this);
|
PageThumbs.addExpirationFilter(this);
|
||||||
gBrowser.addTabsProgressListener(this);
|
gBrowser.addTabsProgressListener(this);
|
||||||
Services.prefs.addObserver(this.PREF_DISK_CACHE_SSL, this, false);
|
Services.prefs.addObserver(this.PREF_DISK_CACHE_SSL, this, false);
|
||||||
|
|
@ -43,7 +43,7 @@ var gBrowserThumbnails = {
|
||||||
this._timeouts = new WeakMap();
|
this._timeouts = new WeakMap();
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function Thumbnails_uninit() {
|
uninit: function() {
|
||||||
PageThumbs.removeExpirationFilter(this);
|
PageThumbs.removeExpirationFilter(this);
|
||||||
gBrowser.removeTabsProgressListener(this);
|
gBrowser.removeTabsProgressListener(this);
|
||||||
Services.prefs.removeObserver(this.PREF_DISK_CACHE_SSL, this);
|
Services.prefs.removeObserver(this.PREF_DISK_CACHE_SSL, this);
|
||||||
|
|
@ -53,7 +53,7 @@ var gBrowserThumbnails = {
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function Thumbnails_handleEvent(aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
case "scroll":
|
case "scroll":
|
||||||
let browser = aEvent.currentTarget;
|
let browser = aEvent.currentTarget;
|
||||||
|
|
@ -70,7 +70,7 @@ var gBrowserThumbnails = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
observe: function Thumbnails_observe() {
|
observe: function() {
|
||||||
this._sslDiskCacheEnabled =
|
this._sslDiskCacheEnabled =
|
||||||
Services.prefs.getBoolPref(this.PREF_DISK_CACHE_SSL);
|
Services.prefs.getBoolPref(this.PREF_DISK_CACHE_SSL);
|
||||||
},
|
},
|
||||||
|
|
@ -83,14 +83,14 @@ var gBrowserThumbnails = {
|
||||||
/**
|
/**
|
||||||
* State change progress listener for all tabs.
|
* State change progress listener for all tabs.
|
||||||
*/
|
*/
|
||||||
onStateChange: function Thumbnails_onStateChange(aBrowser, aWebProgress,
|
onStateChange: function(aBrowser, aWebProgress,
|
||||||
aRequest, aStateFlags, aStatus) {
|
aRequest, aStateFlags, aStatus) {
|
||||||
if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
|
if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
|
||||||
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK)
|
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK)
|
||||||
this._delayedCapture(aBrowser);
|
this._delayedCapture(aBrowser);
|
||||||
},
|
},
|
||||||
|
|
||||||
_capture: function Thumbnails_capture(aBrowser) {
|
_capture: function(aBrowser) {
|
||||||
// Only capture about:newtab top sites.
|
// Only capture about:newtab top sites.
|
||||||
if (this._topSiteURLs.indexOf(aBrowser.currentURI.spec) == -1)
|
if (this._topSiteURLs.indexOf(aBrowser.currentURI.spec) == -1)
|
||||||
return;
|
return;
|
||||||
|
|
@ -101,7 +101,7 @@ var gBrowserThumbnails = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_delayedCapture: function Thumbnails_delayedCapture(aBrowser) {
|
_delayedCapture: function(aBrowser) {
|
||||||
if (this._timeouts.has(aBrowser))
|
if (this._timeouts.has(aBrowser))
|
||||||
clearTimeout(this._timeouts.get(aBrowser));
|
clearTimeout(this._timeouts.get(aBrowser));
|
||||||
else
|
else
|
||||||
|
|
@ -115,7 +115,7 @@ var gBrowserThumbnails = {
|
||||||
this._timeouts.set(aBrowser, timeout);
|
this._timeouts.set(aBrowser, timeout);
|
||||||
},
|
},
|
||||||
|
|
||||||
_shouldCapture: function Thumbnails_shouldCapture(aBrowser, aCallback) {
|
_shouldCapture: function(aBrowser, aCallback) {
|
||||||
// Capture only if it's the currently selected tab.
|
// Capture only if it's the currently selected tab.
|
||||||
if (aBrowser != gBrowser.selectedBrowser) {
|
if (aBrowser != gBrowser.selectedBrowser) {
|
||||||
aCallback(false);
|
aCallback(false);
|
||||||
|
|
@ -132,7 +132,7 @@ var gBrowserThumbnails = {
|
||||||
}, []);
|
}, []);
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearTimeout: function Thumbnails_clearTimeout(aBrowser) {
|
_clearTimeout: function(aBrowser) {
|
||||||
if (this._timeouts.has(aBrowser)) {
|
if (this._timeouts.has(aBrowser)) {
|
||||||
aBrowser.removeEventListener("scroll", this, false);
|
aBrowser.removeEventListener("scroll", this, false);
|
||||||
clearTimeout(this._timeouts.get(aBrowser));
|
clearTimeout(this._timeouts.get(aBrowser));
|
||||||
|
|
|
||||||
|
|
@ -3359,7 +3359,7 @@ const BrowserSearch = {
|
||||||
* the default engine's search form otherwise. For Mac, opens a new window
|
* the default engine's search form otherwise. For Mac, opens a new window
|
||||||
* or focuses an existing window, if necessary.
|
* or focuses an existing window, if necessary.
|
||||||
*/
|
*/
|
||||||
webSearch: function BrowserSearch_webSearch() {
|
webSearch: function() {
|
||||||
if (window.location.href != getBrowserURL()) {
|
if (window.location.href != getBrowserURL()) {
|
||||||
var win = getTopWin();
|
var win = getTopWin();
|
||||||
if (win) {
|
if (win) {
|
||||||
|
|
@ -3470,7 +3470,7 @@ const BrowserSearch = {
|
||||||
* @return string Name of the search engine used to perform a search or null
|
* @return string Name of the search engine used to perform a search or null
|
||||||
* if a search was not performed.
|
* if a search was not performed.
|
||||||
*/
|
*/
|
||||||
loadSearch: function BrowserSearch_search(searchText, useNewTab, purpose) {
|
loadSearch: function(searchText, useNewTab, purpose) {
|
||||||
let engine = BrowserSearch._loadSearch(searchText, useNewTab, purpose);
|
let engine = BrowserSearch._loadSearch(searchText, useNewTab, purpose);
|
||||||
if (!engine) {
|
if (!engine) {
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -3508,7 +3508,7 @@ const BrowserSearch = {
|
||||||
return formatURL("browser.search.searchEnginesURL", true);
|
return formatURL("browser.search.searchEnginesURL", true);
|
||||||
},
|
},
|
||||||
|
|
||||||
loadAddEngines: function BrowserSearch_loadAddEngines() {
|
loadAddEngines: function() {
|
||||||
var newWindowPref = gPrefService.getIntPref("browser.link.open_newwindow");
|
var newWindowPref = gPrefService.getIntPref("browser.link.open_newwindow");
|
||||||
var where = newWindowPref == 3 ? "tab" : "window";
|
var where = newWindowPref == 3 ? "tab" : "window";
|
||||||
openUILinkIn(this.searchEnginesURL, where);
|
openUILinkIn(this.searchEnginesURL, where);
|
||||||
|
|
@ -4303,7 +4303,7 @@ var XULBrowserWindow = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// simulate all change notifications after switching tabs
|
// simulate all change notifications after switching tabs
|
||||||
onUpdateCurrentBrowser: function XWB_onUpdateCurrentBrowser(aStateFlags, aStatus, aMessage, aTotalProgress) {
|
onUpdateCurrentBrowser: function(aStateFlags, aStatus, aMessage, aTotalProgress) {
|
||||||
if (FullZoom.updateBackgroundTabs)
|
if (FullZoom.updateBackgroundTabs)
|
||||||
FullZoom.onLocationChange(gBrowser.currentURI, true);
|
FullZoom.onLocationChange(gBrowser.currentURI, true);
|
||||||
var nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
|
var nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
|
||||||
|
|
@ -4666,7 +4666,7 @@ nsBrowserAccess.prototype = {
|
||||||
return newWindow;
|
return newWindow;
|
||||||
},
|
},
|
||||||
|
|
||||||
openURIInFrame: function browser_openURIInFrame(aURI, aParams, aWhere, aFlags) {
|
openURIInFrame: function(aURI, aParams, aWhere, aFlags) {
|
||||||
if (aWhere != Ci.nsIBrowserDOMWindow.OPEN_NEWTAB) {
|
if (aWhere != Ci.nsIBrowserDOMWindow.OPEN_NEWTAB) {
|
||||||
dump("Error: openURIInFrame can only open in new tabs");
|
dump("Error: openURIInFrame can only open in new tabs");
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -7191,7 +7191,7 @@ function getNavToolbox() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var gPrivateBrowsingUI = {
|
var gPrivateBrowsingUI = {
|
||||||
init: function PBUI_init() {
|
init: function() {
|
||||||
// Do nothing for normal windows
|
// Do nothing for normal windows
|
||||||
if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
|
if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -7429,7 +7429,7 @@ var TabContextMenu = {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
updateContextMenu: function updateContextMenu(aPopupMenu) {
|
updateContextMenu: function(aPopupMenu) {
|
||||||
this.contextTab = aPopupMenu.triggerNode.localName == "tab" ?
|
this.contextTab = aPopupMenu.triggerNode.localName == "tab" ?
|
||||||
aPopupMenu.triggerNode : gBrowser.selectedTab;
|
aPopupMenu.triggerNode : gBrowser.selectedTab;
|
||||||
let disabled = gBrowser.tabs.length == 1;
|
let disabled = gBrowser.tabs.length == 1;
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ Cell.prototype = {
|
||||||
* Checks whether the cell contains a pinned site.
|
* Checks whether the cell contains a pinned site.
|
||||||
* @return Whether the cell contains a pinned site.
|
* @return Whether the cell contains a pinned site.
|
||||||
*/
|
*/
|
||||||
containsPinnedSite: function Cell_containsPinnedSite() {
|
containsPinnedSite: function() {
|
||||||
let site = this.site;
|
let site = this.site;
|
||||||
return site && site.isPinned();
|
return site && site.isPinned();
|
||||||
},
|
},
|
||||||
|
|
@ -90,14 +90,14 @@ Cell.prototype = {
|
||||||
* Checks whether the cell contains a site (is empty).
|
* Checks whether the cell contains a site (is empty).
|
||||||
* @return Whether the cell is empty.
|
* @return Whether the cell is empty.
|
||||||
*/
|
*/
|
||||||
isEmpty: function Cell_isEmpty() {
|
isEmpty: function() {
|
||||||
return !this.site;
|
return !this.site;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles all cell events.
|
* Handles all cell events.
|
||||||
*/
|
*/
|
||||||
handleEvent: function Cell_handleEvent(aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
// We're not responding to external drag/drop events
|
// We're not responding to external drag/drop events
|
||||||
// when our parent window is in private browsing mode.
|
// when our parent window is in private browsing mode.
|
||||||
if (inPrivateBrowsingMode() && !gDrag.draggedSite)
|
if (inPrivateBrowsingMode() && !gDrag.draggedSite)
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ var gDrag = {
|
||||||
* @param aSite The site that's being dragged.
|
* @param aSite The site that's being dragged.
|
||||||
* @param aEvent The 'dragstart' event.
|
* @param aEvent The 'dragstart' event.
|
||||||
*/
|
*/
|
||||||
start: function Drag_start(aSite, aEvent) {
|
start: function(aSite, aEvent) {
|
||||||
this._draggedSite = aSite;
|
this._draggedSite = aSite;
|
||||||
|
|
||||||
// Mark nodes as being dragged.
|
// Mark nodes as being dragged.
|
||||||
|
|
@ -66,7 +66,7 @@ var gDrag = {
|
||||||
* @param aSite The site that's being dragged.
|
* @param aSite The site that's being dragged.
|
||||||
* @param aEvent The 'drag' event.
|
* @param aEvent The 'drag' event.
|
||||||
*/
|
*/
|
||||||
drag: function Drag_drag(aSite, aEvent) {
|
drag: function(aSite, aEvent) {
|
||||||
// Get the viewport size.
|
// Get the viewport size.
|
||||||
let {clientWidth, clientHeight} = document.documentElement;
|
let {clientWidth, clientHeight} = document.documentElement;
|
||||||
|
|
||||||
|
|
@ -90,7 +90,7 @@ var gDrag = {
|
||||||
* @param aSite The site that's being dragged.
|
* @param aSite The site that's being dragged.
|
||||||
* @param aEvent The 'dragend' event.
|
* @param aEvent The 'dragend' event.
|
||||||
*/
|
*/
|
||||||
end: function Drag_end(aSite, aEvent) {
|
end: function(aSite, aEvent) {
|
||||||
let nodes = gGrid.node.querySelectorAll("[dragged]")
|
let nodes = gGrid.node.querySelectorAll("[dragged]")
|
||||||
for (let i = 0; i < nodes.length; i++)
|
for (let i = 0; i < nodes.length; i++)
|
||||||
nodes[i].removeAttribute("dragged");
|
nodes[i].removeAttribute("dragged");
|
||||||
|
|
@ -106,7 +106,7 @@ var gDrag = {
|
||||||
* @param aEvent The drag event to check.
|
* @param aEvent The drag event to check.
|
||||||
* @return Whether we should handle this drag and drop operation.
|
* @return Whether we should handle this drag and drop operation.
|
||||||
*/
|
*/
|
||||||
isValid: function Drag_isValid(aEvent) {
|
isValid: function(aEvent) {
|
||||||
let link = gDragDataHelper.getLinkFromDragEvent(aEvent);
|
let link = gDragDataHelper.getLinkFromDragEvent(aEvent);
|
||||||
|
|
||||||
// Check that the drag data is non-empty.
|
// Check that the drag data is non-empty.
|
||||||
|
|
@ -125,7 +125,7 @@ var gDrag = {
|
||||||
* @param aSite The site that's being dragged.
|
* @param aSite The site that's being dragged.
|
||||||
* @param aEvent The 'dragstart' event.
|
* @param aEvent The 'dragstart' event.
|
||||||
*/
|
*/
|
||||||
_setDragData: function Drag_setDragData(aSite, aEvent) {
|
_setDragData: function(aSite, aEvent) {
|
||||||
let {url, title} = aSite;
|
let {url, title} = aSite;
|
||||||
|
|
||||||
let dt = aEvent.dataTransfer;
|
let dt = aEvent.dataTransfer;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ var gDragDataHelper = {
|
||||||
return "text/x-moz-url";
|
return "text/x-moz-url";
|
||||||
},
|
},
|
||||||
|
|
||||||
getLinkFromDragEvent: function DragDataHelper_getLinkFromDragEvent(aEvent) {
|
getLinkFromDragEvent: function(aEvent) {
|
||||||
let dt = aEvent.dataTransfer;
|
let dt = aEvent.dataTransfer;
|
||||||
if (!dt || !dt.types.includes(this.mimeType)) {
|
if (!dt || !dt.types.includes(this.mimeType)) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ var gDrop = {
|
||||||
* Handles the 'dragenter' event.
|
* Handles the 'dragenter' event.
|
||||||
* @param aCell The drop target cell.
|
* @param aCell The drop target cell.
|
||||||
*/
|
*/
|
||||||
enter: function Drop_enter(aCell) {
|
enter: function(aCell) {
|
||||||
this._delayedRearrange(aCell);
|
this._delayedRearrange(aCell);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ var gDrop = {
|
||||||
* @param aCell The drop target cell.
|
* @param aCell The drop target cell.
|
||||||
* @param aEvent The 'dragexit' event.
|
* @param aEvent The 'dragexit' event.
|
||||||
*/
|
*/
|
||||||
exit: function Drop_exit(aCell, aEvent) {
|
exit: function(aCell, aEvent) {
|
||||||
if (aEvent.dataTransfer && !aEvent.dataTransfer.mozUserCancelled) {
|
if (aEvent.dataTransfer && !aEvent.dataTransfer.mozUserCancelled) {
|
||||||
this._delayedRearrange();
|
this._delayedRearrange();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -45,7 +45,7 @@ var gDrop = {
|
||||||
* @param aCell The drop target cell.
|
* @param aCell The drop target cell.
|
||||||
* @param aEvent The 'dragexit' event.
|
* @param aEvent The 'dragexit' event.
|
||||||
*/
|
*/
|
||||||
drop: function Drop_drop(aCell, aEvent) {
|
drop: function(aCell, aEvent) {
|
||||||
// The cell that is the drop target could contain a pinned site. We need
|
// The cell that is the drop target could contain a pinned site. We need
|
||||||
// to find out where that site has gone and re-pin it there.
|
// to find out where that site has gone and re-pin it there.
|
||||||
if (aCell.containsPinnedSite())
|
if (aCell.containsPinnedSite())
|
||||||
|
|
@ -64,7 +64,7 @@ var gDrop = {
|
||||||
* Re-pins all pinned sites in their (new) positions.
|
* Re-pins all pinned sites in their (new) positions.
|
||||||
* @param aCell The drop target cell.
|
* @param aCell The drop target cell.
|
||||||
*/
|
*/
|
||||||
_repinSitesAfterDrop: function Drop_repinSitesAfterDrop(aCell) {
|
_repinSitesAfterDrop: function(aCell) {
|
||||||
let sites = gDropPreview.rearrange(aCell);
|
let sites = gDropPreview.rearrange(aCell);
|
||||||
|
|
||||||
// Filter out pinned sites.
|
// Filter out pinned sites.
|
||||||
|
|
@ -81,7 +81,7 @@ var gDrop = {
|
||||||
* @param aCell The drop target cell.
|
* @param aCell The drop target cell.
|
||||||
* @param aEvent The 'dragexit' event.
|
* @param aEvent The 'dragexit' event.
|
||||||
*/
|
*/
|
||||||
_pinDraggedSite: function Drop_pinDraggedSite(aCell, aEvent) {
|
_pinDraggedSite: function(aCell, aEvent) {
|
||||||
let index = aCell.index;
|
let index = aCell.index;
|
||||||
let draggedSite = gDrag.draggedSite;
|
let draggedSite = gDrag.draggedSite;
|
||||||
|
|
||||||
|
|
@ -105,7 +105,7 @@ var gDrop = {
|
||||||
* Time a rearrange with a little delay.
|
* Time a rearrange with a little delay.
|
||||||
* @param aCell The drop target cell.
|
* @param aCell The drop target cell.
|
||||||
*/
|
*/
|
||||||
_delayedRearrange: function Drop_delayedRearrange(aCell) {
|
_delayedRearrange: function(aCell) {
|
||||||
// The last drop target didn't change so there's no need to re-arrange.
|
// The last drop target didn't change so there's no need to re-arrange.
|
||||||
if (this._lastDropTarget == aCell)
|
if (this._lastDropTarget == aCell)
|
||||||
return;
|
return;
|
||||||
|
|
@ -127,7 +127,7 @@ var gDrop = {
|
||||||
/**
|
/**
|
||||||
* Cancels a timed rearrange, if any.
|
* Cancels a timed rearrange, if any.
|
||||||
*/
|
*/
|
||||||
_cancelDelayedArrange: function Drop_cancelDelayedArrange() {
|
_cancelDelayedArrange: function() {
|
||||||
if (this._rearrangeTimeout) {
|
if (this._rearrangeTimeout) {
|
||||||
clearTimeout(this._rearrangeTimeout);
|
clearTimeout(this._rearrangeTimeout);
|
||||||
this._rearrangeTimeout = null;
|
this._rearrangeTimeout = null;
|
||||||
|
|
@ -138,7 +138,7 @@ var gDrop = {
|
||||||
* Rearrange all sites in the grid depending on the current drop target.
|
* Rearrange all sites in the grid depending on the current drop target.
|
||||||
* @param aCell The drop target cell.
|
* @param aCell The drop target cell.
|
||||||
*/
|
*/
|
||||||
_rearrange: function Drop_rearrange(aCell) {
|
_rearrange: function(aCell) {
|
||||||
let sites = gGrid.sites;
|
let sites = gGrid.sites;
|
||||||
|
|
||||||
// We need to rearrange the grid only if there's a current drop target.
|
// We need to rearrange the grid only if there's a current drop target.
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ var gDropPreview = {
|
||||||
* @param aCell The drop target cell.
|
* @param aCell The drop target cell.
|
||||||
* @return The re-arranged array of sites.
|
* @return The re-arranged array of sites.
|
||||||
*/
|
*/
|
||||||
rearrange: function DropPreview_rearrange(aCell) {
|
rearrange: function(aCell) {
|
||||||
let sites = gGrid.sites;
|
let sites = gGrid.sites;
|
||||||
|
|
||||||
// Insert the dragged site into the current grid.
|
// Insert the dragged site into the current grid.
|
||||||
|
|
@ -34,7 +34,7 @@ var gDropPreview = {
|
||||||
* @param aSites The array of sites to insert into.
|
* @param aSites The array of sites to insert into.
|
||||||
* @param aCell The drop target cell.
|
* @param aCell The drop target cell.
|
||||||
*/
|
*/
|
||||||
_insertDraggedSite: function DropPreview_insertDraggedSite(aSites, aCell) {
|
_insertDraggedSite: function(aSites, aCell) {
|
||||||
let dropIndex = aCell.index;
|
let dropIndex = aCell.index;
|
||||||
let draggedSite = gDrag.draggedSite;
|
let draggedSite = gDrag.draggedSite;
|
||||||
|
|
||||||
|
|
@ -85,7 +85,7 @@ var gDropPreview = {
|
||||||
* @param aCell The drop target cell.
|
* @param aCell The drop target cell.
|
||||||
* @return The filtered array of sites.
|
* @return The filtered array of sites.
|
||||||
*/
|
*/
|
||||||
_filterPinnedSites: function DropPreview_filterPinnedSites(aSites, aCell) {
|
_filterPinnedSites: function(aSites, aCell) {
|
||||||
let draggedSite = gDrag.draggedSite;
|
let draggedSite = gDrag.draggedSite;
|
||||||
|
|
||||||
// When dropping on a cell that contains a pinned site make sure that all
|
// When dropping on a cell that contains a pinned site make sure that all
|
||||||
|
|
@ -109,7 +109,7 @@ var gDropPreview = {
|
||||||
* @param aCell The drop target cell.
|
* @param aCell The drop target cell.
|
||||||
* @return The range of pinned cells.
|
* @return The range of pinned cells.
|
||||||
*/
|
*/
|
||||||
_getPinnedRange: function DropPreview_getPinnedRange(aCell) {
|
_getPinnedRange: function(aCell) {
|
||||||
let dropIndex = aCell.index;
|
let dropIndex = aCell.index;
|
||||||
let range = {start: dropIndex, end: dropIndex};
|
let range = {start: dropIndex, end: dropIndex};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ var gDropTargetShim = {
|
||||||
* Gets the positions of all cell nodes.
|
* Gets the positions of all cell nodes.
|
||||||
* @return The (cached) cell positions.
|
* @return The (cached) cell positions.
|
||||||
*/
|
*/
|
||||||
_getCellPositions: function DropTargetShim_getCellPositions() {
|
_getCellPositions: function() {
|
||||||
if (this._cellPositions)
|
if (this._cellPositions)
|
||||||
return this._cellPositions;
|
return this._cellPositions;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ var gGrid = {
|
||||||
* Initializes the grid.
|
* Initializes the grid.
|
||||||
* @param aSelector The query selector of the grid.
|
* @param aSelector The query selector of the grid.
|
||||||
*/
|
*/
|
||||||
init: function Grid_init() {
|
init: function() {
|
||||||
this._node = document.getElementById("newtab-grid");
|
this._node = document.getElementById("newtab-grid");
|
||||||
this._gridDefaultContent = this._node.lastChild;
|
this._gridDefaultContent = this._node.lastChild;
|
||||||
this._createSiteFragment();
|
this._createSiteFragment();
|
||||||
|
|
@ -77,7 +77,7 @@ var gGrid = {
|
||||||
* @param aCell The cell that will contain the new site.
|
* @param aCell The cell that will contain the new site.
|
||||||
* @return The newly created site.
|
* @return The newly created site.
|
||||||
*/
|
*/
|
||||||
createSite: function Grid_createSite(aLink, aCell) {
|
createSite: function(aLink, aCell) {
|
||||||
let node = aCell.node;
|
let node = aCell.node;
|
||||||
node.appendChild(this._siteFragment.cloneNode(true));
|
node.appendChild(this._siteFragment.cloneNode(true));
|
||||||
return new Site(node.firstElementChild, aLink);
|
return new Site(node.firstElementChild, aLink);
|
||||||
|
|
@ -86,7 +86,7 @@ var gGrid = {
|
||||||
/**
|
/**
|
||||||
* Handles all grid events.
|
* Handles all grid events.
|
||||||
*/
|
*/
|
||||||
handleEvent: function Grid_handleEvent(aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
case "load":
|
case "load":
|
||||||
case "resize":
|
case "resize":
|
||||||
|
|
@ -98,14 +98,14 @@ var gGrid = {
|
||||||
/**
|
/**
|
||||||
* Locks the grid to block all pointer events.
|
* Locks the grid to block all pointer events.
|
||||||
*/
|
*/
|
||||||
lock: function Grid_lock() {
|
lock: function() {
|
||||||
this.node.setAttribute("locked", "true");
|
this.node.setAttribute("locked", "true");
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unlocks the grid to allow all pointer events.
|
* Unlocks the grid to allow all pointer events.
|
||||||
*/
|
*/
|
||||||
unlock: function Grid_unlock() {
|
unlock: function() {
|
||||||
this.node.removeAttribute("locked");
|
this.node.removeAttribute("locked");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -158,7 +158,7 @@ var gGrid = {
|
||||||
* Calculate the height for a number of rows up to the maximum rows
|
* Calculate the height for a number of rows up to the maximum rows
|
||||||
* @param rows Number of rows defaulting to the max
|
* @param rows Number of rows defaulting to the max
|
||||||
*/
|
*/
|
||||||
_computeHeight: function Grid_computeHeight(aRows) {
|
_computeHeight: function(aRows) {
|
||||||
let {gridRows} = gGridPrefs;
|
let {gridRows} = gGridPrefs;
|
||||||
aRows = aRows === undefined ? gridRows : Math.min(gridRows, aRows);
|
aRows = aRows === undefined ? gridRows : Math.min(gridRows, aRows);
|
||||||
return aRows * this._cellHeight + GRID_BOTTOM_EXTRA;
|
return aRows * this._cellHeight + GRID_BOTTOM_EXTRA;
|
||||||
|
|
@ -167,7 +167,7 @@ var gGrid = {
|
||||||
/**
|
/**
|
||||||
* Creates the DOM fragment that is re-used when creating sites.
|
* Creates the DOM fragment that is re-used when creating sites.
|
||||||
*/
|
*/
|
||||||
_createSiteFragment: function Grid_createSiteFragment() {
|
_createSiteFragment: function() {
|
||||||
let site = document.createElementNS(HTML_NAMESPACE, "div");
|
let site = document.createElementNS(HTML_NAMESPACE, "div");
|
||||||
site.classList.add("newtab-site");
|
site.classList.add("newtab-site");
|
||||||
site.setAttribute("draggable", "true");
|
site.setAttribute("draggable", "true");
|
||||||
|
|
@ -192,7 +192,7 @@ var gGrid = {
|
||||||
* Test a tile at a given position for being pinned or history
|
* Test a tile at a given position for being pinned or history
|
||||||
* @param position Position in sites array
|
* @param position Position in sites array
|
||||||
*/
|
*/
|
||||||
_isHistoricalTile: function Grid_isHistoricalTile(aPos) {
|
_isHistoricalTile: function(aPos) {
|
||||||
let site = this.sites[aPos];
|
let site = this.sites[aPos];
|
||||||
return site && (site.isPinned() || site.link && site.link.type == "history");
|
return site && (site.isPinned() || site.link && site.link.type == "history");
|
||||||
},
|
},
|
||||||
|
|
@ -200,7 +200,7 @@ var gGrid = {
|
||||||
/**
|
/**
|
||||||
* Make sure the correct number of rows and columns are visible
|
* Make sure the correct number of rows and columns are visible
|
||||||
*/
|
*/
|
||||||
_resizeGrid: function Grid_resizeGrid() {
|
_resizeGrid: function() {
|
||||||
// If we're somehow called before the page has finished loading,
|
// If we're somehow called before the page has finished loading,
|
||||||
// let's bail out to avoid caching zero heights and widths.
|
// let's bail out to avoid caching zero heights and widths.
|
||||||
// We'll be called again when DOMContentLoaded fires.
|
// We'll be called again when DOMContentLoaded fires.
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ var gPage = {
|
||||||
/**
|
/**
|
||||||
* Initializes the page.
|
* Initializes the page.
|
||||||
*/
|
*/
|
||||||
init: function Page_init() {
|
init: function() {
|
||||||
// Add ourselves to the list of pages to receive notifications.
|
// Add ourselves to the list of pages to receive notifications.
|
||||||
gAllPages.register(this);
|
gAllPages.register(this);
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@ var gPage = {
|
||||||
/**
|
/**
|
||||||
* Listens for notifications specific to this page.
|
* Listens for notifications specific to this page.
|
||||||
*/
|
*/
|
||||||
observe: function Page_observe(aSubject, aTopic, aData) {
|
observe: function(aSubject, aTopic, aData) {
|
||||||
if (aTopic == "nsPref:changed") {
|
if (aTopic == "nsPref:changed") {
|
||||||
gCustomize.updateSelected();
|
gCustomize.updateSelected();
|
||||||
|
|
||||||
|
|
@ -100,7 +100,7 @@ var gPage = {
|
||||||
* Internally initializes the page. This runs only when/if the feature
|
* Internally initializes the page. This runs only when/if the feature
|
||||||
* is/gets enabled.
|
* is/gets enabled.
|
||||||
*/
|
*/
|
||||||
_init: function Page_init() {
|
_init: function() {
|
||||||
if (this._initialized)
|
if (this._initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -137,7 +137,7 @@ var gPage = {
|
||||||
* Updates the 'page-disabled' attributes of the respective DOM nodes.
|
* Updates the 'page-disabled' attributes of the respective DOM nodes.
|
||||||
* @param aValue Whether the New Tab Page is enabled or not.
|
* @param aValue Whether the New Tab Page is enabled or not.
|
||||||
*/
|
*/
|
||||||
_updateAttributes: function Page_updateAttributes(aValue) {
|
_updateAttributes: function(aValue) {
|
||||||
// Set the nodes' states.
|
// Set the nodes' states.
|
||||||
let nodeSelector = "#newtab-grid, #newtab-search-container";
|
let nodeSelector = "#newtab-grid, #newtab-search-container";
|
||||||
for (let node of document.querySelectorAll(nodeSelector)) {
|
for (let node of document.querySelectorAll(nodeSelector)) {
|
||||||
|
|
@ -160,14 +160,14 @@ var gPage = {
|
||||||
/**
|
/**
|
||||||
* Handles unload event
|
* Handles unload event
|
||||||
*/
|
*/
|
||||||
_handleUnloadEvent: function Page_handleUnloadEvent() {
|
_handleUnloadEvent: function() {
|
||||||
gAllPages.unregister(this);
|
gAllPages.unregister(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles all page events.
|
* Handles all page events.
|
||||||
*/
|
*/
|
||||||
handleEvent: function Page_handleEvent(aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
case "load":
|
case "load":
|
||||||
this.onPageVisibleAndLoaded();
|
this.onPageVisibleAndLoaded();
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ Site.prototype = {
|
||||||
* @param aIndex The pinned index (optional).
|
* @param aIndex The pinned index (optional).
|
||||||
* @return true if link changed type after pin
|
* @return true if link changed type after pin
|
||||||
*/
|
*/
|
||||||
pin: function Site_pin(aIndex) {
|
pin: function(aIndex) {
|
||||||
if (typeof aIndex == "undefined")
|
if (typeof aIndex == "undefined")
|
||||||
aIndex = this.cell.index;
|
aIndex = this.cell.index;
|
||||||
|
|
||||||
|
|
@ -71,7 +71,7 @@ Site.prototype = {
|
||||||
/**
|
/**
|
||||||
* Unpins the site and calls the given callback when done.
|
* Unpins the site and calls the given callback when done.
|
||||||
*/
|
*/
|
||||||
unpin: function Site_unpin() {
|
unpin: function() {
|
||||||
if (this.isPinned()) {
|
if (this.isPinned()) {
|
||||||
this._updateAttributes(false);
|
this._updateAttributes(false);
|
||||||
gPinnedLinks.unpin(this._link);
|
gPinnedLinks.unpin(this._link);
|
||||||
|
|
@ -83,7 +83,7 @@ Site.prototype = {
|
||||||
* Checks whether this site is pinned.
|
* Checks whether this site is pinned.
|
||||||
* @return Whether this site is pinned.
|
* @return Whether this site is pinned.
|
||||||
*/
|
*/
|
||||||
isPinned: function Site_isPinned() {
|
isPinned: function() {
|
||||||
return gPinnedLinks.isPinned(this._link);
|
return gPinnedLinks.isPinned(this._link);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -91,7 +91,7 @@ Site.prototype = {
|
||||||
* Blocks the site (removes it from the grid) and calls the given callback
|
* Blocks the site (removes it from the grid) and calls the given callback
|
||||||
* when done.
|
* when done.
|
||||||
*/
|
*/
|
||||||
block: function Site_block() {
|
block: function() {
|
||||||
if (!gBlockedLinks.isBlocked(this._link)) {
|
if (!gBlockedLinks.isBlocked(this._link)) {
|
||||||
gUndoDialog.show(this);
|
gUndoDialog.show(this);
|
||||||
gBlockedLinks.block(this._link);
|
gBlockedLinks.block(this._link);
|
||||||
|
|
@ -104,7 +104,7 @@ Site.prototype = {
|
||||||
* @param aSelector The query selector.
|
* @param aSelector The query selector.
|
||||||
* @return The DOM node we found.
|
* @return The DOM node we found.
|
||||||
*/
|
*/
|
||||||
_querySelector: function Site_querySelector(aSelector) {
|
_querySelector: function(aSelector) {
|
||||||
return this.node.querySelector(aSelector);
|
return this.node.querySelector(aSelector);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -139,7 +139,7 @@ Site.prototype = {
|
||||||
/**
|
/**
|
||||||
* Checks for and modifies link at campaign end time
|
* Checks for and modifies link at campaign end time
|
||||||
*/
|
*/
|
||||||
_checkLinkEndTime: function Site_checkLinkEndTime() {
|
_checkLinkEndTime: function() {
|
||||||
if (this.link.endTime && this.link.endTime < Date.now()) {
|
if (this.link.endTime && this.link.endTime < Date.now()) {
|
||||||
let oldUrl = this.url;
|
let oldUrl = this.url;
|
||||||
// chop off the path part from url
|
// chop off the path part from url
|
||||||
|
|
@ -155,7 +155,7 @@ Site.prototype = {
|
||||||
/**
|
/**
|
||||||
* Renders the site's data (fills the HTML fragment).
|
* Renders the site's data (fills the HTML fragment).
|
||||||
*/
|
*/
|
||||||
_render: function Site_render() {
|
_render: function() {
|
||||||
// first check for end time, as it may modify the link
|
// first check for end time, as it may modify the link
|
||||||
this._checkLinkEndTime();
|
this._checkLinkEndTime();
|
||||||
// setup display variables
|
// setup display variables
|
||||||
|
|
@ -188,7 +188,7 @@ Site.prototype = {
|
||||||
* Since the newtab may be preloaded long before it's displayed,
|
* Since the newtab may be preloaded long before it's displayed,
|
||||||
* check for changed conditions and re-render if needed
|
* check for changed conditions and re-render if needed
|
||||||
*/
|
*/
|
||||||
onFirstVisible: function Site_onFirstVisible() {
|
onFirstVisible: function() {
|
||||||
if (this.link.endTime && this.link.endTime < Date.now()) {
|
if (this.link.endTime && this.link.endTime < Date.now()) {
|
||||||
// site needs to change landing url and background image
|
// site needs to change landing url and background image
|
||||||
this._render();
|
this._render();
|
||||||
|
|
@ -202,7 +202,7 @@ Site.prototype = {
|
||||||
* Captures the site's thumbnail in the background, but only if there's no
|
* Captures the site's thumbnail in the background, but only if there's no
|
||||||
* existing thumbnail and the page allows background captures.
|
* existing thumbnail and the page allows background captures.
|
||||||
*/
|
*/
|
||||||
captureIfMissing: function Site_captureIfMissing() {
|
captureIfMissing: function() {
|
||||||
if (!document.hidden && !this.link.imageURI) {
|
if (!document.hidden && !this.link.imageURI) {
|
||||||
BackgroundPageThumbs.captureIfMissing(this.url);
|
BackgroundPageThumbs.captureIfMissing(this.url);
|
||||||
}
|
}
|
||||||
|
|
@ -211,7 +211,7 @@ Site.prototype = {
|
||||||
/**
|
/**
|
||||||
* Refreshes the thumbnail for the site.
|
* Refreshes the thumbnail for the site.
|
||||||
*/
|
*/
|
||||||
refreshThumbnail: function Site_refreshThumbnail() {
|
refreshThumbnail: function() {
|
||||||
// Only enhance tiles if that feature is turned on
|
// Only enhance tiles if that feature is turned on
|
||||||
let link = this.link;
|
let link = this.link;
|
||||||
|
|
||||||
|
|
@ -249,7 +249,7 @@ Site.prototype = {
|
||||||
/**
|
/**
|
||||||
* Adds event handlers for the site and its buttons.
|
* Adds event handlers for the site and its buttons.
|
||||||
*/
|
*/
|
||||||
_addEventHandlers: function Site_addEventHandlers() {
|
_addEventHandlers: function() {
|
||||||
// Register drag-and-drop event handlers.
|
// Register drag-and-drop event handlers.
|
||||||
this._node.addEventListener("dragstart", this, false);
|
this._node.addEventListener("dragstart", this, false);
|
||||||
this._node.addEventListener("dragend", this, false);
|
this._node.addEventListener("dragend", this, false);
|
||||||
|
|
@ -259,7 +259,7 @@ Site.prototype = {
|
||||||
/**
|
/**
|
||||||
* Speculatively opens a connection to the current site.
|
* Speculatively opens a connection to the current site.
|
||||||
*/
|
*/
|
||||||
_speculativeConnect: function Site_speculativeConnect() {
|
_speculativeConnect: function() {
|
||||||
let sc = Services.io.QueryInterface(Ci.nsISpeculativeConnect);
|
let sc = Services.io.QueryInterface(Ci.nsISpeculativeConnect);
|
||||||
let uri = Services.io.newURI(this.url, null, null);
|
let uri = Services.io.newURI(this.url, null, null);
|
||||||
try {
|
try {
|
||||||
|
|
@ -272,7 +272,7 @@ Site.prototype = {
|
||||||
/**
|
/**
|
||||||
* Record interaction with site using telemetry.
|
* Record interaction with site using telemetry.
|
||||||
*/
|
*/
|
||||||
_recordSiteClicked: function Site_recordSiteClicked(aIndex) {
|
_recordSiteClicked: function(aIndex) {
|
||||||
if (Services.prefs.prefHasUserValue("browser.newtabpage.rows") ||
|
if (Services.prefs.prefHasUserValue("browser.newtabpage.rows") ||
|
||||||
Services.prefs.prefHasUserValue("browser.newtabpage.columns") ||
|
Services.prefs.prefHasUserValue("browser.newtabpage.columns") ||
|
||||||
aIndex > 8) {
|
aIndex > 8) {
|
||||||
|
|
@ -287,7 +287,7 @@ Site.prototype = {
|
||||||
/**
|
/**
|
||||||
* Handles site click events.
|
* Handles site click events.
|
||||||
*/
|
*/
|
||||||
onClick: function Site_onClick(aEvent) {
|
onClick: function(aEvent) {
|
||||||
let action;
|
let action;
|
||||||
let pinned = this.isPinned();
|
let pinned = this.isPinned();
|
||||||
let tileIndex = this.cell.index;
|
let tileIndex = this.cell.index;
|
||||||
|
|
@ -326,7 +326,7 @@ Site.prototype = {
|
||||||
/**
|
/**
|
||||||
* Handles all site events.
|
* Handles all site events.
|
||||||
*/
|
*/
|
||||||
handleEvent: function Site_handleEvent(aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
case "mouseover":
|
case "mouseover":
|
||||||
this._node.removeEventListener("mouseover", this, false);
|
this._node.removeEventListener("mouseover", this, false);
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ var gTransformation = {
|
||||||
* @param aNode The DOM node.
|
* @param aNode The DOM node.
|
||||||
* @return A Rect instance with the position.
|
* @return A Rect instance with the position.
|
||||||
*/
|
*/
|
||||||
getNodePosition: function Transformation_getNodePosition(aNode) {
|
getNodePosition: function(aNode) {
|
||||||
let {left, top, width, height} = aNode.getBoundingClientRect();
|
let {left, top, width, height} = aNode.getBoundingClientRect();
|
||||||
return new Rect(left + scrollX, top + scrollY, width, height);
|
return new Rect(left + scrollX, top + scrollY, width, height);
|
||||||
},
|
},
|
||||||
|
|
@ -43,7 +43,7 @@ var gTransformation = {
|
||||||
* @param aNode The node to fade.
|
* @param aNode The node to fade.
|
||||||
* @param aCallback The callback to call when finished.
|
* @param aCallback The callback to call when finished.
|
||||||
*/
|
*/
|
||||||
fadeNodeIn: function Transformation_fadeNodeIn(aNode, aCallback) {
|
fadeNodeIn: function(aNode, aCallback) {
|
||||||
this._setNodeOpacity(aNode, 1, function () {
|
this._setNodeOpacity(aNode, 1, function () {
|
||||||
// Clear the style property.
|
// Clear the style property.
|
||||||
aNode.style.opacity = "";
|
aNode.style.opacity = "";
|
||||||
|
|
@ -58,7 +58,7 @@ var gTransformation = {
|
||||||
* @param aNode The node to fade.
|
* @param aNode The node to fade.
|
||||||
* @param aCallback The callback to call when finished.
|
* @param aCallback The callback to call when finished.
|
||||||
*/
|
*/
|
||||||
fadeNodeOut: function Transformation_fadeNodeOut(aNode, aCallback) {
|
fadeNodeOut: function(aNode, aCallback) {
|
||||||
this._setNodeOpacity(aNode, 0, aCallback);
|
this._setNodeOpacity(aNode, 0, aCallback);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -67,7 +67,7 @@ var gTransformation = {
|
||||||
* @param aSite The site to fade.
|
* @param aSite The site to fade.
|
||||||
* @param aCallback The callback to call when finished.
|
* @param aCallback The callback to call when finished.
|
||||||
*/
|
*/
|
||||||
showSite: function Transformation_showSite(aSite, aCallback) {
|
showSite: function(aSite, aCallback) {
|
||||||
this.fadeNodeIn(aSite.node, aCallback);
|
this.fadeNodeIn(aSite.node, aCallback);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -76,7 +76,7 @@ var gTransformation = {
|
||||||
* @param aSite The site to fade.
|
* @param aSite The site to fade.
|
||||||
* @param aCallback The callback to call when finished.
|
* @param aCallback The callback to call when finished.
|
||||||
*/
|
*/
|
||||||
hideSite: function Transformation_hideSite(aSite, aCallback) {
|
hideSite: function(aSite, aCallback) {
|
||||||
this.fadeNodeOut(aSite.node, aCallback);
|
this.fadeNodeOut(aSite.node, aCallback);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -85,7 +85,7 @@ var gTransformation = {
|
||||||
* @param aSite The site to re-position.
|
* @param aSite The site to re-position.
|
||||||
* @param aPosition The desired position for the given site.
|
* @param aPosition The desired position for the given site.
|
||||||
*/
|
*/
|
||||||
setSitePosition: function Transformation_setSitePosition(aSite, aPosition) {
|
setSitePosition: function(aSite, aPosition) {
|
||||||
let style = aSite.node.style;
|
let style = aSite.node.style;
|
||||||
let {top, left} = aPosition;
|
let {top, left} = aPosition;
|
||||||
|
|
||||||
|
|
@ -97,7 +97,7 @@ var gTransformation = {
|
||||||
* Freezes a site in its current position by positioning it absolute.
|
* Freezes a site in its current position by positioning it absolute.
|
||||||
* @param aSite The site to freeze.
|
* @param aSite The site to freeze.
|
||||||
*/
|
*/
|
||||||
freezeSitePosition: function Transformation_freezeSitePosition(aSite) {
|
freezeSitePosition: function(aSite) {
|
||||||
if (this._isFrozen(aSite))
|
if (this._isFrozen(aSite))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -114,7 +114,7 @@ var gTransformation = {
|
||||||
* Unfreezes a site by removing its absolute positioning.
|
* Unfreezes a site by removing its absolute positioning.
|
||||||
* @param aSite The site to unfreeze.
|
* @param aSite The site to unfreeze.
|
||||||
*/
|
*/
|
||||||
unfreezeSitePosition: function Transformation_unfreezeSitePosition(aSite) {
|
unfreezeSitePosition: function(aSite) {
|
||||||
if (!this._isFrozen(aSite))
|
if (!this._isFrozen(aSite))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -131,7 +131,7 @@ var gTransformation = {
|
||||||
* unfreeze - unfreeze the site after sliding
|
* unfreeze - unfreeze the site after sliding
|
||||||
* callback - the callback to call when finished
|
* callback - the callback to call when finished
|
||||||
*/
|
*/
|
||||||
slideSiteTo: function Transformation_slideSiteTo(aSite, aTarget, aOptions) {
|
slideSiteTo: function(aSite, aTarget, aOptions) {
|
||||||
let currentPosition = this.getNodePosition(aSite.node);
|
let currentPosition = this.getNodePosition(aSite.node);
|
||||||
let targetPosition = this.getNodePosition(aTarget.node)
|
let targetPosition = this.getNodePosition(aTarget.node)
|
||||||
let callback = aOptions && aOptions.callback;
|
let callback = aOptions && aOptions.callback;
|
||||||
|
|
@ -168,7 +168,7 @@ var gTransformation = {
|
||||||
* unfreeze - unfreeze the site after rearranging
|
* unfreeze - unfreeze the site after rearranging
|
||||||
* callback - the callback to call when finished
|
* callback - the callback to call when finished
|
||||||
*/
|
*/
|
||||||
rearrangeSites: function Transformation_rearrangeSites(aSites, aOptions) {
|
rearrangeSites: function(aSites, aOptions) {
|
||||||
let batch = [];
|
let batch = [];
|
||||||
let cells = gGrid.cells;
|
let cells = gGrid.cells;
|
||||||
let callback = aOptions && aOptions.callback;
|
let callback = aOptions && aOptions.callback;
|
||||||
|
|
@ -222,7 +222,7 @@ var gTransformation = {
|
||||||
* @param aNode The node to get the opacity value from.
|
* @param aNode The node to get the opacity value from.
|
||||||
* @return The node's opacity value.
|
* @return The node's opacity value.
|
||||||
*/
|
*/
|
||||||
_getNodeOpacity: function Transformation_getNodeOpacity(aNode) {
|
_getNodeOpacity: function(aNode) {
|
||||||
let cstyle = window.getComputedStyle(aNode, null);
|
let cstyle = window.getComputedStyle(aNode, null);
|
||||||
return cstyle.getPropertyValue("opacity");
|
return cstyle.getPropertyValue("opacity");
|
||||||
},
|
},
|
||||||
|
|
@ -254,7 +254,7 @@ var gTransformation = {
|
||||||
* @param aIndex The target cell's index.
|
* @param aIndex The target cell's index.
|
||||||
* @param aOptions Options that are directly passed to slideSiteTo().
|
* @param aOptions Options that are directly passed to slideSiteTo().
|
||||||
*/
|
*/
|
||||||
_moveSite: function Transformation_moveSite(aSite, aIndex, aOptions) {
|
_moveSite: function(aSite, aIndex, aOptions) {
|
||||||
this.freezeSitePosition(aSite);
|
this.freezeSitePosition(aSite);
|
||||||
this.slideSiteTo(aSite, gGrid.cells[aIndex], aOptions);
|
this.slideSiteTo(aSite, gGrid.cells[aIndex], aOptions);
|
||||||
},
|
},
|
||||||
|
|
@ -264,7 +264,7 @@ var gTransformation = {
|
||||||
* @param aSite The site to check.
|
* @param aSite The site to check.
|
||||||
* @return Whether the given site is frozen.
|
* @return Whether the given site is frozen.
|
||||||
*/
|
*/
|
||||||
_isFrozen: function Transformation_isFrozen(aSite) {
|
_isFrozen: function(aSite) {
|
||||||
return aSite.node.hasAttribute("frozen");
|
return aSite.node.hasAttribute("frozen");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ var gUndoDialog = {
|
||||||
/**
|
/**
|
||||||
* Initializes the undo dialog.
|
* Initializes the undo dialog.
|
||||||
*/
|
*/
|
||||||
init: function UndoDialog_init() {
|
init: function() {
|
||||||
this._undoContainer = document.getElementById("newtab-undo-container");
|
this._undoContainer = document.getElementById("newtab-undo-container");
|
||||||
this._undoContainer.addEventListener("click", this, false);
|
this._undoContainer.addEventListener("click", this, false);
|
||||||
this._undoButton = document.getElementById("newtab-undo-button");
|
this._undoButton = document.getElementById("newtab-undo-button");
|
||||||
|
|
@ -34,7 +34,7 @@ var gUndoDialog = {
|
||||||
* Shows the undo dialog.
|
* Shows the undo dialog.
|
||||||
* @param aSite The site that just got removed.
|
* @param aSite The site that just got removed.
|
||||||
*/
|
*/
|
||||||
show: function UndoDialog_show(aSite) {
|
show: function(aSite) {
|
||||||
if (this._undoData)
|
if (this._undoData)
|
||||||
clearTimeout(this._undoData.timeout);
|
clearTimeout(this._undoData.timeout);
|
||||||
|
|
||||||
|
|
@ -54,7 +54,7 @@ var gUndoDialog = {
|
||||||
/**
|
/**
|
||||||
* Hides the undo dialog.
|
* Hides the undo dialog.
|
||||||
*/
|
*/
|
||||||
hide: function UndoDialog_hide() {
|
hide: function() {
|
||||||
if (!this._undoData)
|
if (!this._undoData)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -70,7 +70,7 @@ var gUndoDialog = {
|
||||||
* The undo dialog event handler.
|
* The undo dialog event handler.
|
||||||
* @param aEvent The event to handle.
|
* @param aEvent The event to handle.
|
||||||
*/
|
*/
|
||||||
handleEvent: function UndoDialog_handleEvent(aEvent) {
|
handleEvent: function(aEvent) {
|
||||||
switch (aEvent.target.id) {
|
switch (aEvent.target.id) {
|
||||||
case "newtab-undo-button":
|
case "newtab-undo-button":
|
||||||
this._undo();
|
this._undo();
|
||||||
|
|
@ -87,7 +87,7 @@ var gUndoDialog = {
|
||||||
/**
|
/**
|
||||||
* Undo the last blocked site.
|
* Undo the last blocked site.
|
||||||
*/
|
*/
|
||||||
_undo: function UndoDialog_undo() {
|
_undo: function() {
|
||||||
if (!this._undoData)
|
if (!this._undoData)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -105,7 +105,7 @@ var gUndoDialog = {
|
||||||
/**
|
/**
|
||||||
* Undo all blocked sites.
|
* Undo all blocked sites.
|
||||||
*/
|
*/
|
||||||
_undoAll: function UndoDialog_undoAll() {
|
_undoAll: function() {
|
||||||
NewTabUtils.undoAll(function() {
|
NewTabUtils.undoAll(function() {
|
||||||
gUpdater.updateGrid();
|
gUpdater.updateGrid();
|
||||||
this.hide();
|
this.hide();
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ var gUpdater = {
|
||||||
* This removes old, moves existing and creates new sites to fill gaps.
|
* This removes old, moves existing and creates new sites to fill gaps.
|
||||||
* @param aCallback The callback to call when finished.
|
* @param aCallback The callback to call when finished.
|
||||||
*/
|
*/
|
||||||
updateGrid: function Updater_updateGrid(aCallback) {
|
updateGrid: function(aCallback) {
|
||||||
let links = gLinks.getLinks().slice(0, gGrid.cells.length);
|
let links = gLinks.getLinks().slice(0, gGrid.cells.length);
|
||||||
|
|
||||||
// Find all sites that remain in the grid.
|
// Find all sites that remain in the grid.
|
||||||
|
|
@ -50,7 +50,7 @@ var gUpdater = {
|
||||||
* @param aLinks The array of links to find sites for.
|
* @param aLinks The array of links to find sites for.
|
||||||
* @return Array of sites mapped to the given links (can contain null values).
|
* @return Array of sites mapped to the given links (can contain null values).
|
||||||
*/
|
*/
|
||||||
_findRemainingSites: function Updater_findRemainingSites(aLinks) {
|
_findRemainingSites: function(aLinks) {
|
||||||
let map = {};
|
let map = {};
|
||||||
|
|
||||||
// Create a map to easily retrieve the site for a given URL.
|
// Create a map to easily retrieve the site for a given URL.
|
||||||
|
|
@ -69,7 +69,7 @@ var gUpdater = {
|
||||||
* Freezes the given sites' positions.
|
* Freezes the given sites' positions.
|
||||||
* @param aSites The array of sites to freeze.
|
* @param aSites The array of sites to freeze.
|
||||||
*/
|
*/
|
||||||
_freezeSitePositions: function Updater_freezeSitePositions(aSites) {
|
_freezeSitePositions: function(aSites) {
|
||||||
aSites.forEach(function (aSite) {
|
aSites.forEach(function (aSite) {
|
||||||
if (aSite)
|
if (aSite)
|
||||||
gTransformation.freezeSitePosition(aSite);
|
gTransformation.freezeSitePosition(aSite);
|
||||||
|
|
@ -80,7 +80,7 @@ var gUpdater = {
|
||||||
* Moves the given sites' DOM nodes to their new positions.
|
* Moves the given sites' DOM nodes to their new positions.
|
||||||
* @param aSites The array of sites to move.
|
* @param aSites The array of sites to move.
|
||||||
*/
|
*/
|
||||||
_moveSiteNodes: function Updater_moveSiteNodes(aSites) {
|
_moveSiteNodes: function(aSites) {
|
||||||
let cells = gGrid.cells;
|
let cells = gGrid.cells;
|
||||||
|
|
||||||
// Truncate the given array of sites to not have more sites than cells.
|
// Truncate the given array of sites to not have more sites than cells.
|
||||||
|
|
@ -112,7 +112,7 @@ var gUpdater = {
|
||||||
* @param aSites The array of sites to re-arrange.
|
* @param aSites The array of sites to re-arrange.
|
||||||
* @param aCallback The callback to call when finished.
|
* @param aCallback The callback to call when finished.
|
||||||
*/
|
*/
|
||||||
_rearrangeSites: function Updater_rearrangeSites(aSites, aCallback) {
|
_rearrangeSites: function(aSites, aCallback) {
|
||||||
let options = {callback: aCallback, unfreeze: true};
|
let options = {callback: aCallback, unfreeze: true};
|
||||||
gTransformation.rearrangeSites(aSites, options);
|
gTransformation.rearrangeSites(aSites, options);
|
||||||
},
|
},
|
||||||
|
|
@ -123,7 +123,7 @@ var gUpdater = {
|
||||||
* @param aSites The array of sites remaining in the grid.
|
* @param aSites The array of sites remaining in the grid.
|
||||||
* @param aCallback The callback to call when finished.
|
* @param aCallback The callback to call when finished.
|
||||||
*/
|
*/
|
||||||
_removeLegacySites: function Updater_removeLegacySites(aSites, aCallback) {
|
_removeLegacySites: function(aSites, aCallback) {
|
||||||
let batch = [];
|
let batch = [];
|
||||||
|
|
||||||
// Delete sites that were removed from the grid.
|
// Delete sites that were removed from the grid.
|
||||||
|
|
@ -152,7 +152,7 @@ var gUpdater = {
|
||||||
* @param aLinks The array of links.
|
* @param aLinks The array of links.
|
||||||
* @param aCallback The callback to call when finished.
|
* @param aCallback The callback to call when finished.
|
||||||
*/
|
*/
|
||||||
_fillEmptyCells: function Updater_fillEmptyCells(aLinks, aCallback) {
|
_fillEmptyCells: function(aLinks, aCallback) {
|
||||||
let {cells, sites} = gGrid;
|
let {cells, sites} = gGrid;
|
||||||
|
|
||||||
// Find empty cells and fill them.
|
// Find empty cells and fill them.
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ function nsContextMenu(aXulMenu, aIsShift) {
|
||||||
|
|
||||||
// Prototype for nsContextMenu "class."
|
// Prototype for nsContextMenu "class."
|
||||||
nsContextMenu.prototype = {
|
nsContextMenu.prototype = {
|
||||||
initMenu: function CM_initMenu(aXulMenu, aIsShift) {
|
initMenu: function(aXulMenu, aIsShift) {
|
||||||
// Get contextual info.
|
// Get contextual info.
|
||||||
this.setTarget(document.popupNode, document.popupRangeParent,
|
this.setTarget(document.popupNode, document.popupRangeParent,
|
||||||
document.popupRangeOffset);
|
document.popupRangeOffset);
|
||||||
|
|
@ -86,7 +86,7 @@ nsContextMenu.prototype = {
|
||||||
this.initItems();
|
this.initItems();
|
||||||
},
|
},
|
||||||
|
|
||||||
hiding: function CM_hiding() {
|
hiding: function() {
|
||||||
gContextMenuContentData = null;
|
gContextMenuContentData = null;
|
||||||
InlineSpellCheckerUI.clearSuggestionsFromMenu();
|
InlineSpellCheckerUI.clearSuggestionsFromMenu();
|
||||||
InlineSpellCheckerUI.clearDictionaryListFromMenu();
|
InlineSpellCheckerUI.clearDictionaryListFromMenu();
|
||||||
|
|
@ -99,7 +99,7 @@ nsContextMenu.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
initItems: function CM_initItems() {
|
initItems: function() {
|
||||||
this.initPageMenuSeparator();
|
this.initPageMenuSeparator();
|
||||||
this.initOpenItems();
|
this.initOpenItems();
|
||||||
this.initNavigationItems();
|
this.initNavigationItems();
|
||||||
|
|
@ -114,11 +114,11 @@ nsContextMenu.prototype = {
|
||||||
this.initPasswordManagerItems();
|
this.initPasswordManagerItems();
|
||||||
},
|
},
|
||||||
|
|
||||||
initPageMenuSeparator: function CM_initPageMenuSeparator() {
|
initPageMenuSeparator: function() {
|
||||||
this.showItem("page-menu-separator", this.hasPageMenu);
|
this.showItem("page-menu-separator", this.hasPageMenu);
|
||||||
},
|
},
|
||||||
|
|
||||||
initOpenItems: function CM_initOpenItems() {
|
initOpenItems: function() {
|
||||||
var isMailtoInternal = false;
|
var isMailtoInternal = false;
|
||||||
if (this.onMailtoLink) {
|
if (this.onMailtoLink) {
|
||||||
var mailtoHandler = Cc["@mozilla.org/uriloader/external-protocol-service;1"].
|
var mailtoHandler = Cc["@mozilla.org/uriloader/external-protocol-service;1"].
|
||||||
|
|
@ -149,7 +149,7 @@ nsContextMenu.prototype = {
|
||||||
this.showItem("context-sep-open", shouldShow);
|
this.showItem("context-sep-open", shouldShow);
|
||||||
},
|
},
|
||||||
|
|
||||||
initNavigationItems: function CM_initNavigationItems() {
|
initNavigationItems: function() {
|
||||||
var shouldShow = !(this.isContentSelected || this.onLink || this.onImage ||
|
var shouldShow = !(this.isContentSelected || this.onLink || this.onImage ||
|
||||||
this.onCanvas || this.onVideo || this.onAudio ||
|
this.onCanvas || this.onVideo || this.onAudio ||
|
||||||
this.onTextInput);
|
this.onTextInput);
|
||||||
|
|
@ -170,7 +170,7 @@ nsContextMenu.prototype = {
|
||||||
//this.setItemAttrFromNode( "context-stop", "disabled", "canStop" );
|
//this.setItemAttrFromNode( "context-stop", "disabled", "canStop" );
|
||||||
},
|
},
|
||||||
|
|
||||||
initLeaveDOMFullScreenItems: function CM_initLeaveFullScreenItem() {
|
initLeaveDOMFullScreenItems: function() {
|
||||||
// only show the option if the user is in DOM fullscreen
|
// only show the option if the user is in DOM fullscreen
|
||||||
var shouldShow = (this.target.ownerDocument.fullscreenElement != null);
|
var shouldShow = (this.target.ownerDocument.fullscreenElement != null);
|
||||||
this.showItem("context-leave-dom-fullscreen", shouldShow);
|
this.showItem("context-leave-dom-fullscreen", shouldShow);
|
||||||
|
|
@ -180,7 +180,7 @@ nsContextMenu.prototype = {
|
||||||
this.showItem("context-media-sep-commands", true);
|
this.showItem("context-media-sep-commands", true);
|
||||||
},
|
},
|
||||||
|
|
||||||
initSaveItems: function CM_initSaveItems() {
|
initSaveItems: function() {
|
||||||
var shouldShow = !(this.onTextInput || this.onLink ||
|
var shouldShow = !(this.onTextInput || this.onLink ||
|
||||||
this.isContentSelected || this.onImage ||
|
this.isContentSelected || this.onImage ||
|
||||||
this.onCanvas || this.onVideo || this.onAudio);
|
this.onCanvas || this.onVideo || this.onAudio);
|
||||||
|
|
@ -205,7 +205,7 @@ nsContextMenu.prototype = {
|
||||||
this.setItemAttr("context-sendaudio", "disabled", !this.mediaURL || mediaIsBlob);
|
this.setItemAttr("context-sendaudio", "disabled", !this.mediaURL || mediaIsBlob);
|
||||||
},
|
},
|
||||||
|
|
||||||
initViewItems: function CM_initViewItems() {
|
initViewItems: function() {
|
||||||
// View source is always OK, unless in directory listing.
|
// View source is always OK, unless in directory listing.
|
||||||
this.showItem("context-viewpartialsource-selection",
|
this.showItem("context-viewpartialsource-selection",
|
||||||
this.isContentSelected);
|
this.isContentSelected);
|
||||||
|
|
@ -268,7 +268,7 @@ nsContextMenu.prototype = {
|
||||||
this.showItem("context-viewimagedesc", this.onImage && this.imageDescURL !== "");
|
this.showItem("context-viewimagedesc", this.onImage && this.imageDescURL !== "");
|
||||||
},
|
},
|
||||||
|
|
||||||
initMiscItems: function CM_initMiscItems() {
|
initMiscItems: function() {
|
||||||
// Use "Bookmark This Link" if on a link.
|
// Use "Bookmark This Link" if on a link.
|
||||||
let bookmarkPage = document.getElementById("context-bookmarkpage");
|
let bookmarkPage = document.getElementById("context-bookmarkpage");
|
||||||
this.showItem(bookmarkPage,
|
this.showItem(bookmarkPage,
|
||||||
|
|
@ -1214,7 +1214,7 @@ nsContextMenu.prototype = {
|
||||||
saveAsListener.prototype = {
|
saveAsListener.prototype = {
|
||||||
extListener: null,
|
extListener: null,
|
||||||
|
|
||||||
onStartRequest: function saveLinkAs_onStartRequest(aRequest, aContext) {
|
onStartRequest: function(aRequest, aContext) {
|
||||||
|
|
||||||
// if the timer fired, the error status will have been caused by that,
|
// if the timer fired, the error status will have been caused by that,
|
||||||
// and we'll be restarting in onStopRequest, so no reason to notify
|
// and we'll be restarting in onStopRequest, so no reason to notify
|
||||||
|
|
@ -1255,7 +1255,7 @@ nsContextMenu.prototype = {
|
||||||
this.extListener.onStartRequest(aRequest, aContext);
|
this.extListener.onStartRequest(aRequest, aContext);
|
||||||
},
|
},
|
||||||
|
|
||||||
onStopRequest: function saveLinkAs_onStopRequest(aRequest, aContext,
|
onStopRequest: function(aRequest, aContext,
|
||||||
aStatusCode) {
|
aStatusCode) {
|
||||||
if (aStatusCode == NS_ERROR_SAVE_LINK_AS_TIMEOUT) {
|
if (aStatusCode == NS_ERROR_SAVE_LINK_AS_TIMEOUT) {
|
||||||
// do it the old fashioned way, which will pick the best filename
|
// do it the old fashioned way, which will pick the best filename
|
||||||
|
|
@ -1267,7 +1267,7 @@ nsContextMenu.prototype = {
|
||||||
this.extListener.onStopRequest(aRequest, aContext, aStatusCode);
|
this.extListener.onStopRequest(aRequest, aContext, aStatusCode);
|
||||||
},
|
},
|
||||||
|
|
||||||
onDataAvailable: function saveLinkAs_onDataAvailable(aRequest, aContext,
|
onDataAvailable: function(aRequest, aContext,
|
||||||
aInputStream,
|
aInputStream,
|
||||||
aOffset, aCount) {
|
aOffset, aCount) {
|
||||||
this.extListener.onDataAvailable(aRequest, aContext, aInputStream,
|
this.extListener.onDataAvailable(aRequest, aContext, aInputStream,
|
||||||
|
|
@ -1277,7 +1277,7 @@ nsContextMenu.prototype = {
|
||||||
|
|
||||||
function callbacks() {}
|
function callbacks() {}
|
||||||
callbacks.prototype = {
|
callbacks.prototype = {
|
||||||
getInterface: function sLA_callbacks_getInterface(aIID) {
|
getInterface: function(aIID) {
|
||||||
if (aIID.equals(Ci.nsIAuthPrompt) || aIID.equals(Ci.nsIAuthPrompt2)) {
|
if (aIID.equals(Ci.nsIAuthPrompt) || aIID.equals(Ci.nsIAuthPrompt2)) {
|
||||||
// If the channel demands authentication prompt, we must cancel it
|
// If the channel demands authentication prompt, we must cancel it
|
||||||
// because the save-as-timer would expire and cancel the channel
|
// because the save-as-timer would expire and cancel the channel
|
||||||
|
|
@ -1296,7 +1296,7 @@ nsContextMenu.prototype = {
|
||||||
// we give up waiting for the filename.
|
// we give up waiting for the filename.
|
||||||
function timerCallback() {}
|
function timerCallback() {}
|
||||||
timerCallback.prototype = {
|
timerCallback.prototype = {
|
||||||
notify: function sLA_timer_notify(aTimer) {
|
notify: function(aTimer) {
|
||||||
channel.cancel(NS_ERROR_SAVE_LINK_AS_TIMEOUT);
|
channel.cancel(NS_ERROR_SAVE_LINK_AS_TIMEOUT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1617,16 +1617,16 @@ nsContextMenu.prototype = {
|
||||||
openUILinkIn(uri, where);
|
openUILinkIn(uri, where);
|
||||||
},
|
},
|
||||||
|
|
||||||
bookmarkThisPage: function CM_bookmarkThisPage() {
|
bookmarkThisPage: function() {
|
||||||
window.top.PlacesCommandHook.bookmarkPage(this.browser, PlacesUtils.bookmarksMenuFolderId, true);
|
window.top.PlacesCommandHook.bookmarkPage(this.browser, PlacesUtils.bookmarksMenuFolderId, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
bookmarkLink: function CM_bookmarkLink() {
|
bookmarkLink: function() {
|
||||||
window.top.PlacesCommandHook.bookmarkLink(PlacesUtils.bookmarksMenuFolderId,
|
window.top.PlacesCommandHook.bookmarkLink(PlacesUtils.bookmarksMenuFolderId,
|
||||||
this.linkURL, this.linkTextStr);
|
this.linkURL, this.linkTextStr);
|
||||||
},
|
},
|
||||||
|
|
||||||
addBookmarkForFrame: function CM_addBookmarkForFrame() {
|
addBookmarkForFrame: function() {
|
||||||
let uri = gContextMenuContentData.documentURIObject;
|
let uri = gContextMenuContentData.documentURIObject;
|
||||||
let mm = this.browser.messageManager;
|
let mm = this.browser.messageManager;
|
||||||
|
|
||||||
|
|
@ -1644,19 +1644,19 @@ nsContextMenu.prototype = {
|
||||||
mm.sendAsyncMessage("ContextMenu:BookmarkFrame", null, { target: this.target });
|
mm.sendAsyncMessage("ContextMenu:BookmarkFrame", null, { target: this.target });
|
||||||
},
|
},
|
||||||
|
|
||||||
savePageAs: function CM_savePageAs() {
|
savePageAs: function() {
|
||||||
saveBrowser(this.browser);
|
saveBrowser(this.browser);
|
||||||
},
|
},
|
||||||
|
|
||||||
printFrame: function CM_printFrame() {
|
printFrame: function() {
|
||||||
PrintUtils.printWindow(this.frameOuterWindowID, this.browser);
|
PrintUtils.printWindow(this.frameOuterWindowID, this.browser);
|
||||||
},
|
},
|
||||||
|
|
||||||
switchPageDirection: function CM_switchPageDirection() {
|
switchPageDirection: function() {
|
||||||
this.browser.messageManager.sendAsyncMessage("SwitchDocumentDirection");
|
this.browser.messageManager.sendAsyncMessage("SwitchDocumentDirection");
|
||||||
},
|
},
|
||||||
|
|
||||||
mediaCommand : function CM_mediaCommand(command, data) {
|
mediaCommand : function(command, data) {
|
||||||
let mm = this.browser.messageManager;
|
let mm = this.browser.messageManager;
|
||||||
let win = this.browser.ownerGlobal;
|
let win = this.browser.ownerGlobal;
|
||||||
let windowUtils = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
let windowUtils = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
|
|
|
||||||
|
|
@ -568,7 +568,7 @@ var gContiguousSelectionTreeHelper = {
|
||||||
* view
|
* view
|
||||||
* @return The new view
|
* @return The new view
|
||||||
*/
|
*/
|
||||||
setTree: function CSTH_setTree(aTreeElement, aProtoTreeView)
|
setTree: function(aTreeElement, aProtoTreeView)
|
||||||
{
|
{
|
||||||
this._tree = aTreeElement;
|
this._tree = aTreeElement;
|
||||||
var newView = this._makeTreeView(aProtoTreeView || aTreeElement.view);
|
var newView = this._makeTreeView(aProtoTreeView || aTreeElement.view);
|
||||||
|
|
@ -583,7 +583,7 @@ var gContiguousSelectionTreeHelper = {
|
||||||
*
|
*
|
||||||
* @return The row index of the grippy
|
* @return The row index of the grippy
|
||||||
*/
|
*/
|
||||||
getGrippyRow: function CSTH_getGrippyRow()
|
getGrippyRow: function()
|
||||||
{
|
{
|
||||||
var sel = this.tree.view.selection;
|
var sel = this.tree.view.selection;
|
||||||
var rangeCount = sel.getRangeCount();
|
var rangeCount = sel.getRangeCount();
|
||||||
|
|
@ -605,7 +605,7 @@ var gContiguousSelectionTreeHelper = {
|
||||||
* @param aEvent
|
* @param aEvent
|
||||||
* The observed dragover event
|
* The observed dragover event
|
||||||
*/
|
*/
|
||||||
ondragover: function CSTH_ondragover(aEvent)
|
ondragover: function(aEvent)
|
||||||
{
|
{
|
||||||
// Without this when dragging on Windows the mouse cursor is a "no" sign.
|
// Without this when dragging on Windows the mouse cursor is a "no" sign.
|
||||||
// This makes it a drop symbol.
|
// This makes it a drop symbol.
|
||||||
|
|
@ -632,7 +632,7 @@ var gContiguousSelectionTreeHelper = {
|
||||||
* @param aEvent
|
* @param aEvent
|
||||||
* The observed dragstart event
|
* The observed dragstart event
|
||||||
*/
|
*/
|
||||||
ondragstart: function CSTH_ondragstart(aEvent)
|
ondragstart: function(aEvent)
|
||||||
{
|
{
|
||||||
var tbo = this.tree.treeBoxObject;
|
var tbo = this.tree.treeBoxObject;
|
||||||
var clickedRow = tbo.getRowAt(aEvent.clientX, aEvent.clientY);
|
var clickedRow = tbo.getRowAt(aEvent.clientX, aEvent.clientY);
|
||||||
|
|
@ -667,7 +667,7 @@ var gContiguousSelectionTreeHelper = {
|
||||||
* @param aEvent
|
* @param aEvent
|
||||||
* The observed keypress event
|
* The observed keypress event
|
||||||
*/
|
*/
|
||||||
onkeypress: function CSTH_onkeypress(aEvent)
|
onkeypress: function(aEvent)
|
||||||
{
|
{
|
||||||
var grippyRow = this.getGrippyRow();
|
var grippyRow = this.getGrippyRow();
|
||||||
var tbo = this.tree.treeBoxObject;
|
var tbo = this.tree.treeBoxObject;
|
||||||
|
|
@ -728,7 +728,7 @@ var gContiguousSelectionTreeHelper = {
|
||||||
* @param aEvent
|
* @param aEvent
|
||||||
* The observed mousedown event
|
* The observed mousedown event
|
||||||
*/
|
*/
|
||||||
onmousedown: function CSTH_onmousedown(aEvent)
|
onmousedown: function(aEvent)
|
||||||
{
|
{
|
||||||
var tbo = this.tree.treeBoxObject;
|
var tbo = this.tree.treeBoxObject;
|
||||||
var clickedRow = tbo.getRowAt(aEvent.clientX, aEvent.clientY);
|
var clickedRow = tbo.getRowAt(aEvent.clientX, aEvent.clientY);
|
||||||
|
|
@ -750,7 +750,7 @@ var gContiguousSelectionTreeHelper = {
|
||||||
* @param aEndRow
|
* @param aEndRow
|
||||||
* The range [0, aEndRow] will be selected.
|
* The range [0, aEndRow] will be selected.
|
||||||
*/
|
*/
|
||||||
rangedSelect: function CSTH_rangedSelect(aEndRow)
|
rangedSelect: function(aEndRow)
|
||||||
{
|
{
|
||||||
var tbo = this.tree.treeBoxObject;
|
var tbo = this.tree.treeBoxObject;
|
||||||
if (aEndRow < 0)
|
if (aEndRow < 0)
|
||||||
|
|
@ -763,7 +763,7 @@ var gContiguousSelectionTreeHelper = {
|
||||||
/**
|
/**
|
||||||
* Scrolls the tree so that the grippy row is in the center of the view.
|
* Scrolls the tree so that the grippy row is in the center of the view.
|
||||||
*/
|
*/
|
||||||
scrollToGrippy: function CSTH_scrollToGrippy()
|
scrollToGrippy: function()
|
||||||
{
|
{
|
||||||
var rowCount = this.tree.view.rowCount;
|
var rowCount = this.tree.view.rowCount;
|
||||||
var tbo = this.tree.treeBoxObject;
|
var tbo = this.tree.treeBoxObject;
|
||||||
|
|
@ -796,7 +796,7 @@ var gContiguousSelectionTreeHelper = {
|
||||||
* @param aProtoTreeView
|
* @param aProtoTreeView
|
||||||
* Used as the new view's prototype if specified
|
* Used as the new view's prototype if specified
|
||||||
*/
|
*/
|
||||||
_makeTreeView: function CSTH__makeTreeView(aProtoTreeView)
|
_makeTreeView: function(aProtoTreeView)
|
||||||
{
|
{
|
||||||
var view = aProtoTreeView;
|
var view = aProtoTreeView;
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue