mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-08 08: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
|
|
@ -81,7 +81,7 @@ Cell.prototype = {
|
|||
* Checks 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;
|
||||
return site && site.isPinned();
|
||||
},
|
||||
|
|
@ -90,14 +90,14 @@ Cell.prototype = {
|
|||
* Checks whether the cell contains a site (is empty).
|
||||
* @return Whether the cell is empty.
|
||||
*/
|
||||
isEmpty: function Cell_isEmpty() {
|
||||
isEmpty: function() {
|
||||
return !this.site;
|
||||
},
|
||||
|
||||
/**
|
||||
* Handles all cell events.
|
||||
*/
|
||||
handleEvent: function Cell_handleEvent(aEvent) {
|
||||
handleEvent: function(aEvent) {
|
||||
// We're not responding to external drag/drop events
|
||||
// when our parent window is in private browsing mode.
|
||||
if (inPrivateBrowsingMode() && !gDrag.draggedSite)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ var gDrag = {
|
|||
* @param aSite The site that's being dragged.
|
||||
* @param aEvent The 'dragstart' event.
|
||||
*/
|
||||
start: function Drag_start(aSite, aEvent) {
|
||||
start: function(aSite, aEvent) {
|
||||
this._draggedSite = aSite;
|
||||
|
||||
// Mark nodes as being dragged.
|
||||
|
|
@ -66,7 +66,7 @@ var gDrag = {
|
|||
* @param aSite The site that's being dragged.
|
||||
* @param aEvent The 'drag' event.
|
||||
*/
|
||||
drag: function Drag_drag(aSite, aEvent) {
|
||||
drag: function(aSite, aEvent) {
|
||||
// Get the viewport size.
|
||||
let {clientWidth, clientHeight} = document.documentElement;
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ var gDrag = {
|
|||
* @param aSite The site that's being dragged.
|
||||
* @param aEvent The 'dragend' event.
|
||||
*/
|
||||
end: function Drag_end(aSite, aEvent) {
|
||||
end: function(aSite, aEvent) {
|
||||
let nodes = gGrid.node.querySelectorAll("[dragged]")
|
||||
for (let i = 0; i < nodes.length; i++)
|
||||
nodes[i].removeAttribute("dragged");
|
||||
|
|
@ -106,7 +106,7 @@ var gDrag = {
|
|||
* @param aEvent The drag event to check.
|
||||
* @return Whether we should handle this drag and drop operation.
|
||||
*/
|
||||
isValid: function Drag_isValid(aEvent) {
|
||||
isValid: function(aEvent) {
|
||||
let link = gDragDataHelper.getLinkFromDragEvent(aEvent);
|
||||
|
||||
// Check that the drag data is non-empty.
|
||||
|
|
@ -125,7 +125,7 @@ var gDrag = {
|
|||
* @param aSite The site that's being dragged.
|
||||
* @param aEvent The 'dragstart' event.
|
||||
*/
|
||||
_setDragData: function Drag_setDragData(aSite, aEvent) {
|
||||
_setDragData: function(aSite, aEvent) {
|
||||
let {url, title} = aSite;
|
||||
|
||||
let dt = aEvent.dataTransfer;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ var gDragDataHelper = {
|
|||
return "text/x-moz-url";
|
||||
},
|
||||
|
||||
getLinkFromDragEvent: function DragDataHelper_getLinkFromDragEvent(aEvent) {
|
||||
getLinkFromDragEvent: function(aEvent) {
|
||||
let dt = aEvent.dataTransfer;
|
||||
if (!dt || !dt.types.includes(this.mimeType)) {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ var gDrop = {
|
|||
* Handles the 'dragenter' event.
|
||||
* @param aCell The drop target cell.
|
||||
*/
|
||||
enter: function Drop_enter(aCell) {
|
||||
enter: function(aCell) {
|
||||
this._delayedRearrange(aCell);
|
||||
},
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ var gDrop = {
|
|||
* @param aCell The drop target cell.
|
||||
* @param aEvent The 'dragexit' event.
|
||||
*/
|
||||
exit: function Drop_exit(aCell, aEvent) {
|
||||
exit: function(aCell, aEvent) {
|
||||
if (aEvent.dataTransfer && !aEvent.dataTransfer.mozUserCancelled) {
|
||||
this._delayedRearrange();
|
||||
} else {
|
||||
|
|
@ -45,7 +45,7 @@ var gDrop = {
|
|||
* @param aCell The drop target cell.
|
||||
* @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
|
||||
// to find out where that site has gone and re-pin it there.
|
||||
if (aCell.containsPinnedSite())
|
||||
|
|
@ -64,7 +64,7 @@ var gDrop = {
|
|||
* Re-pins all pinned sites in their (new) positions.
|
||||
* @param aCell The drop target cell.
|
||||
*/
|
||||
_repinSitesAfterDrop: function Drop_repinSitesAfterDrop(aCell) {
|
||||
_repinSitesAfterDrop: function(aCell) {
|
||||
let sites = gDropPreview.rearrange(aCell);
|
||||
|
||||
// Filter out pinned sites.
|
||||
|
|
@ -81,7 +81,7 @@ var gDrop = {
|
|||
* @param aCell The drop target cell.
|
||||
* @param aEvent The 'dragexit' event.
|
||||
*/
|
||||
_pinDraggedSite: function Drop_pinDraggedSite(aCell, aEvent) {
|
||||
_pinDraggedSite: function(aCell, aEvent) {
|
||||
let index = aCell.index;
|
||||
let draggedSite = gDrag.draggedSite;
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ var gDrop = {
|
|||
* Time a rearrange with a little delay.
|
||||
* @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.
|
||||
if (this._lastDropTarget == aCell)
|
||||
return;
|
||||
|
|
@ -127,7 +127,7 @@ var gDrop = {
|
|||
/**
|
||||
* Cancels a timed rearrange, if any.
|
||||
*/
|
||||
_cancelDelayedArrange: function Drop_cancelDelayedArrange() {
|
||||
_cancelDelayedArrange: function() {
|
||||
if (this._rearrangeTimeout) {
|
||||
clearTimeout(this._rearrangeTimeout);
|
||||
this._rearrangeTimeout = null;
|
||||
|
|
@ -138,7 +138,7 @@ var gDrop = {
|
|||
* Rearrange all sites in the grid depending on the current drop target.
|
||||
* @param aCell The drop target cell.
|
||||
*/
|
||||
_rearrange: function Drop_rearrange(aCell) {
|
||||
_rearrange: function(aCell) {
|
||||
let sites = gGrid.sites;
|
||||
|
||||
// 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.
|
||||
* @return The re-arranged array of sites.
|
||||
*/
|
||||
rearrange: function DropPreview_rearrange(aCell) {
|
||||
rearrange: function(aCell) {
|
||||
let sites = gGrid.sites;
|
||||
|
||||
// Insert the dragged site into the current grid.
|
||||
|
|
@ -34,7 +34,7 @@ var gDropPreview = {
|
|||
* @param aSites The array of sites to insert into.
|
||||
* @param aCell The drop target cell.
|
||||
*/
|
||||
_insertDraggedSite: function DropPreview_insertDraggedSite(aSites, aCell) {
|
||||
_insertDraggedSite: function(aSites, aCell) {
|
||||
let dropIndex = aCell.index;
|
||||
let draggedSite = gDrag.draggedSite;
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ var gDropPreview = {
|
|||
* @param aCell The drop target cell.
|
||||
* @return The filtered array of sites.
|
||||
*/
|
||||
_filterPinnedSites: function DropPreview_filterPinnedSites(aSites, aCell) {
|
||||
_filterPinnedSites: function(aSites, aCell) {
|
||||
let draggedSite = gDrag.draggedSite;
|
||||
|
||||
// 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.
|
||||
* @return The range of pinned cells.
|
||||
*/
|
||||
_getPinnedRange: function DropPreview_getPinnedRange(aCell) {
|
||||
_getPinnedRange: function(aCell) {
|
||||
let dropIndex = aCell.index;
|
||||
let range = {start: dropIndex, end: dropIndex};
|
||||
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ var gDropTargetShim = {
|
|||
* Gets the positions of all cell nodes.
|
||||
* @return The (cached) cell positions.
|
||||
*/
|
||||
_getCellPositions: function DropTargetShim_getCellPositions() {
|
||||
_getCellPositions: function() {
|
||||
if (this._cellPositions)
|
||||
return this._cellPositions;
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ var gGrid = {
|
|||
* Initializes the grid.
|
||||
* @param aSelector The query selector of the grid.
|
||||
*/
|
||||
init: function Grid_init() {
|
||||
init: function() {
|
||||
this._node = document.getElementById("newtab-grid");
|
||||
this._gridDefaultContent = this._node.lastChild;
|
||||
this._createSiteFragment();
|
||||
|
|
@ -77,7 +77,7 @@ var gGrid = {
|
|||
* @param aCell The cell that will contain the new site.
|
||||
* @return The newly created site.
|
||||
*/
|
||||
createSite: function Grid_createSite(aLink, aCell) {
|
||||
createSite: function(aLink, aCell) {
|
||||
let node = aCell.node;
|
||||
node.appendChild(this._siteFragment.cloneNode(true));
|
||||
return new Site(node.firstElementChild, aLink);
|
||||
|
|
@ -86,7 +86,7 @@ var gGrid = {
|
|||
/**
|
||||
* Handles all grid events.
|
||||
*/
|
||||
handleEvent: function Grid_handleEvent(aEvent) {
|
||||
handleEvent: function(aEvent) {
|
||||
switch (aEvent.type) {
|
||||
case "load":
|
||||
case "resize":
|
||||
|
|
@ -98,14 +98,14 @@ var gGrid = {
|
|||
/**
|
||||
* Locks the grid to block all pointer events.
|
||||
*/
|
||||
lock: function Grid_lock() {
|
||||
lock: function() {
|
||||
this.node.setAttribute("locked", "true");
|
||||
},
|
||||
|
||||
/**
|
||||
* Unlocks the grid to allow all pointer events.
|
||||
*/
|
||||
unlock: function Grid_unlock() {
|
||||
unlock: function() {
|
||||
this.node.removeAttribute("locked");
|
||||
},
|
||||
|
||||
|
|
@ -158,7 +158,7 @@ var gGrid = {
|
|||
* Calculate the height for a number of rows up to the maximum rows
|
||||
* @param rows Number of rows defaulting to the max
|
||||
*/
|
||||
_computeHeight: function Grid_computeHeight(aRows) {
|
||||
_computeHeight: function(aRows) {
|
||||
let {gridRows} = gGridPrefs;
|
||||
aRows = aRows === undefined ? gridRows : Math.min(gridRows, aRows);
|
||||
return aRows * this._cellHeight + GRID_BOTTOM_EXTRA;
|
||||
|
|
@ -167,7 +167,7 @@ var gGrid = {
|
|||
/**
|
||||
* Creates the DOM fragment that is re-used when creating sites.
|
||||
*/
|
||||
_createSiteFragment: function Grid_createSiteFragment() {
|
||||
_createSiteFragment: function() {
|
||||
let site = document.createElementNS(HTML_NAMESPACE, "div");
|
||||
site.classList.add("newtab-site");
|
||||
site.setAttribute("draggable", "true");
|
||||
|
|
@ -192,7 +192,7 @@ var gGrid = {
|
|||
* Test a tile at a given position for being pinned or history
|
||||
* @param position Position in sites array
|
||||
*/
|
||||
_isHistoricalTile: function Grid_isHistoricalTile(aPos) {
|
||||
_isHistoricalTile: function(aPos) {
|
||||
let site = this.sites[aPos];
|
||||
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
|
||||
*/
|
||||
_resizeGrid: function Grid_resizeGrid() {
|
||||
_resizeGrid: function() {
|
||||
// If we're somehow called before the page has finished loading,
|
||||
// let's bail out to avoid caching zero heights and widths.
|
||||
// We'll be called again when DOMContentLoaded fires.
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ var gPage = {
|
|||
/**
|
||||
* Initializes the page.
|
||||
*/
|
||||
init: function Page_init() {
|
||||
init: function() {
|
||||
// Add ourselves to the list of pages to receive notifications.
|
||||
gAllPages.register(this);
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ var gPage = {
|
|||
/**
|
||||
* Listens for notifications specific to this page.
|
||||
*/
|
||||
observe: function Page_observe(aSubject, aTopic, aData) {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
if (aTopic == "nsPref:changed") {
|
||||
gCustomize.updateSelected();
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ var gPage = {
|
|||
* Internally initializes the page. This runs only when/if the feature
|
||||
* is/gets enabled.
|
||||
*/
|
||||
_init: function Page_init() {
|
||||
_init: function() {
|
||||
if (this._initialized)
|
||||
return;
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ var gPage = {
|
|||
* Updates the 'page-disabled' attributes of the respective DOM nodes.
|
||||
* @param aValue Whether the New Tab Page is enabled or not.
|
||||
*/
|
||||
_updateAttributes: function Page_updateAttributes(aValue) {
|
||||
_updateAttributes: function(aValue) {
|
||||
// Set the nodes' states.
|
||||
let nodeSelector = "#newtab-grid, #newtab-search-container";
|
||||
for (let node of document.querySelectorAll(nodeSelector)) {
|
||||
|
|
@ -160,14 +160,14 @@ var gPage = {
|
|||
/**
|
||||
* Handles unload event
|
||||
*/
|
||||
_handleUnloadEvent: function Page_handleUnloadEvent() {
|
||||
_handleUnloadEvent: function() {
|
||||
gAllPages.unregister(this);
|
||||
},
|
||||
|
||||
/**
|
||||
* Handles all page events.
|
||||
*/
|
||||
handleEvent: function Page_handleEvent(aEvent) {
|
||||
handleEvent: function(aEvent) {
|
||||
switch (aEvent.type) {
|
||||
case "load":
|
||||
this.onPageVisibleAndLoaded();
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ Site.prototype = {
|
|||
* @param aIndex The pinned index (optional).
|
||||
* @return true if link changed type after pin
|
||||
*/
|
||||
pin: function Site_pin(aIndex) {
|
||||
pin: function(aIndex) {
|
||||
if (typeof aIndex == "undefined")
|
||||
aIndex = this.cell.index;
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ Site.prototype = {
|
|||
/**
|
||||
* Unpins the site and calls the given callback when done.
|
||||
*/
|
||||
unpin: function Site_unpin() {
|
||||
unpin: function() {
|
||||
if (this.isPinned()) {
|
||||
this._updateAttributes(false);
|
||||
gPinnedLinks.unpin(this._link);
|
||||
|
|
@ -83,7 +83,7 @@ Site.prototype = {
|
|||
* Checks whether this site is pinned.
|
||||
* @return Whether this site is pinned.
|
||||
*/
|
||||
isPinned: function Site_isPinned() {
|
||||
isPinned: function() {
|
||||
return gPinnedLinks.isPinned(this._link);
|
||||
},
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ Site.prototype = {
|
|||
* Blocks the site (removes it from the grid) and calls the given callback
|
||||
* when done.
|
||||
*/
|
||||
block: function Site_block() {
|
||||
block: function() {
|
||||
if (!gBlockedLinks.isBlocked(this._link)) {
|
||||
gUndoDialog.show(this);
|
||||
gBlockedLinks.block(this._link);
|
||||
|
|
@ -104,7 +104,7 @@ Site.prototype = {
|
|||
* @param aSelector The query selector.
|
||||
* @return The DOM node we found.
|
||||
*/
|
||||
_querySelector: function Site_querySelector(aSelector) {
|
||||
_querySelector: function(aSelector) {
|
||||
return this.node.querySelector(aSelector);
|
||||
},
|
||||
|
||||
|
|
@ -139,7 +139,7 @@ Site.prototype = {
|
|||
/**
|
||||
* Checks for and modifies link at campaign end time
|
||||
*/
|
||||
_checkLinkEndTime: function Site_checkLinkEndTime() {
|
||||
_checkLinkEndTime: function() {
|
||||
if (this.link.endTime && this.link.endTime < Date.now()) {
|
||||
let oldUrl = this.url;
|
||||
// chop off the path part from url
|
||||
|
|
@ -155,7 +155,7 @@ Site.prototype = {
|
|||
/**
|
||||
* 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
|
||||
this._checkLinkEndTime();
|
||||
// setup display variables
|
||||
|
|
@ -188,7 +188,7 @@ Site.prototype = {
|
|||
* Since the newtab may be preloaded long before it's displayed,
|
||||
* check for changed conditions and re-render if needed
|
||||
*/
|
||||
onFirstVisible: function Site_onFirstVisible() {
|
||||
onFirstVisible: function() {
|
||||
if (this.link.endTime && this.link.endTime < Date.now()) {
|
||||
// site needs to change landing url and background image
|
||||
this._render();
|
||||
|
|
@ -202,7 +202,7 @@ Site.prototype = {
|
|||
* Captures the site's thumbnail in the background, but only if there's no
|
||||
* existing thumbnail and the page allows background captures.
|
||||
*/
|
||||
captureIfMissing: function Site_captureIfMissing() {
|
||||
captureIfMissing: function() {
|
||||
if (!document.hidden && !this.link.imageURI) {
|
||||
BackgroundPageThumbs.captureIfMissing(this.url);
|
||||
}
|
||||
|
|
@ -211,7 +211,7 @@ Site.prototype = {
|
|||
/**
|
||||
* Refreshes the thumbnail for the site.
|
||||
*/
|
||||
refreshThumbnail: function Site_refreshThumbnail() {
|
||||
refreshThumbnail: function() {
|
||||
// Only enhance tiles if that feature is turned on
|
||||
let link = this.link;
|
||||
|
||||
|
|
@ -249,7 +249,7 @@ Site.prototype = {
|
|||
/**
|
||||
* Adds event handlers for the site and its buttons.
|
||||
*/
|
||||
_addEventHandlers: function Site_addEventHandlers() {
|
||||
_addEventHandlers: function() {
|
||||
// Register drag-and-drop event handlers.
|
||||
this._node.addEventListener("dragstart", this, false);
|
||||
this._node.addEventListener("dragend", this, false);
|
||||
|
|
@ -259,7 +259,7 @@ Site.prototype = {
|
|||
/**
|
||||
* Speculatively opens a connection to the current site.
|
||||
*/
|
||||
_speculativeConnect: function Site_speculativeConnect() {
|
||||
_speculativeConnect: function() {
|
||||
let sc = Services.io.QueryInterface(Ci.nsISpeculativeConnect);
|
||||
let uri = Services.io.newURI(this.url, null, null);
|
||||
try {
|
||||
|
|
@ -272,7 +272,7 @@ Site.prototype = {
|
|||
/**
|
||||
* Record interaction with site using telemetry.
|
||||
*/
|
||||
_recordSiteClicked: function Site_recordSiteClicked(aIndex) {
|
||||
_recordSiteClicked: function(aIndex) {
|
||||
if (Services.prefs.prefHasUserValue("browser.newtabpage.rows") ||
|
||||
Services.prefs.prefHasUserValue("browser.newtabpage.columns") ||
|
||||
aIndex > 8) {
|
||||
|
|
@ -287,7 +287,7 @@ Site.prototype = {
|
|||
/**
|
||||
* Handles site click events.
|
||||
*/
|
||||
onClick: function Site_onClick(aEvent) {
|
||||
onClick: function(aEvent) {
|
||||
let action;
|
||||
let pinned = this.isPinned();
|
||||
let tileIndex = this.cell.index;
|
||||
|
|
@ -326,7 +326,7 @@ Site.prototype = {
|
|||
/**
|
||||
* Handles all site events.
|
||||
*/
|
||||
handleEvent: function Site_handleEvent(aEvent) {
|
||||
handleEvent: function(aEvent) {
|
||||
switch (aEvent.type) {
|
||||
case "mouseover":
|
||||
this._node.removeEventListener("mouseover", this, false);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ var gTransformation = {
|
|||
* @param aNode The DOM node.
|
||||
* @return A Rect instance with the position.
|
||||
*/
|
||||
getNodePosition: function Transformation_getNodePosition(aNode) {
|
||||
getNodePosition: function(aNode) {
|
||||
let {left, top, width, height} = aNode.getBoundingClientRect();
|
||||
return new Rect(left + scrollX, top + scrollY, width, height);
|
||||
},
|
||||
|
|
@ -43,7 +43,7 @@ var gTransformation = {
|
|||
* @param aNode The node to fade.
|
||||
* @param aCallback The callback to call when finished.
|
||||
*/
|
||||
fadeNodeIn: function Transformation_fadeNodeIn(aNode, aCallback) {
|
||||
fadeNodeIn: function(aNode, aCallback) {
|
||||
this._setNodeOpacity(aNode, 1, function () {
|
||||
// Clear the style property.
|
||||
aNode.style.opacity = "";
|
||||
|
|
@ -58,7 +58,7 @@ var gTransformation = {
|
|||
* @param aNode The node to fade.
|
||||
* @param aCallback The callback to call when finished.
|
||||
*/
|
||||
fadeNodeOut: function Transformation_fadeNodeOut(aNode, aCallback) {
|
||||
fadeNodeOut: function(aNode, aCallback) {
|
||||
this._setNodeOpacity(aNode, 0, aCallback);
|
||||
},
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ var gTransformation = {
|
|||
* @param aSite The site to fade.
|
||||
* @param aCallback The callback to call when finished.
|
||||
*/
|
||||
showSite: function Transformation_showSite(aSite, aCallback) {
|
||||
showSite: function(aSite, aCallback) {
|
||||
this.fadeNodeIn(aSite.node, aCallback);
|
||||
},
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ var gTransformation = {
|
|||
* @param aSite The site to fade.
|
||||
* @param aCallback The callback to call when finished.
|
||||
*/
|
||||
hideSite: function Transformation_hideSite(aSite, aCallback) {
|
||||
hideSite: function(aSite, aCallback) {
|
||||
this.fadeNodeOut(aSite.node, aCallback);
|
||||
},
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ var gTransformation = {
|
|||
* @param aSite The site to re-position.
|
||||
* @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 {top, left} = aPosition;
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ var gTransformation = {
|
|||
* Freezes a site in its current position by positioning it absolute.
|
||||
* @param aSite The site to freeze.
|
||||
*/
|
||||
freezeSitePosition: function Transformation_freezeSitePosition(aSite) {
|
||||
freezeSitePosition: function(aSite) {
|
||||
if (this._isFrozen(aSite))
|
||||
return;
|
||||
|
||||
|
|
@ -114,7 +114,7 @@ var gTransformation = {
|
|||
* Unfreezes a site by removing its absolute positioning.
|
||||
* @param aSite The site to unfreeze.
|
||||
*/
|
||||
unfreezeSitePosition: function Transformation_unfreezeSitePosition(aSite) {
|
||||
unfreezeSitePosition: function(aSite) {
|
||||
if (!this._isFrozen(aSite))
|
||||
return;
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ var gTransformation = {
|
|||
* unfreeze - unfreeze the site after sliding
|
||||
* 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 targetPosition = this.getNodePosition(aTarget.node)
|
||||
let callback = aOptions && aOptions.callback;
|
||||
|
|
@ -168,7 +168,7 @@ var gTransformation = {
|
|||
* unfreeze - unfreeze the site after rearranging
|
||||
* callback - the callback to call when finished
|
||||
*/
|
||||
rearrangeSites: function Transformation_rearrangeSites(aSites, aOptions) {
|
||||
rearrangeSites: function(aSites, aOptions) {
|
||||
let batch = [];
|
||||
let cells = gGrid.cells;
|
||||
let callback = aOptions && aOptions.callback;
|
||||
|
|
@ -222,7 +222,7 @@ var gTransformation = {
|
|||
* @param aNode The node to get the opacity value from.
|
||||
* @return The node's opacity value.
|
||||
*/
|
||||
_getNodeOpacity: function Transformation_getNodeOpacity(aNode) {
|
||||
_getNodeOpacity: function(aNode) {
|
||||
let cstyle = window.getComputedStyle(aNode, null);
|
||||
return cstyle.getPropertyValue("opacity");
|
||||
},
|
||||
|
|
@ -254,7 +254,7 @@ var gTransformation = {
|
|||
* @param aIndex The target cell's index.
|
||||
* @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.slideSiteTo(aSite, gGrid.cells[aIndex], aOptions);
|
||||
},
|
||||
|
|
@ -264,7 +264,7 @@ var gTransformation = {
|
|||
* @param aSite The site to check.
|
||||
* @return Whether the given site is frozen.
|
||||
*/
|
||||
_isFrozen: function Transformation_isFrozen(aSite) {
|
||||
_isFrozen: function(aSite) {
|
||||
return aSite.node.hasAttribute("frozen");
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ var gUndoDialog = {
|
|||
/**
|
||||
* Initializes the undo dialog.
|
||||
*/
|
||||
init: function UndoDialog_init() {
|
||||
init: function() {
|
||||
this._undoContainer = document.getElementById("newtab-undo-container");
|
||||
this._undoContainer.addEventListener("click", this, false);
|
||||
this._undoButton = document.getElementById("newtab-undo-button");
|
||||
|
|
@ -34,7 +34,7 @@ var gUndoDialog = {
|
|||
* Shows the undo dialog.
|
||||
* @param aSite The site that just got removed.
|
||||
*/
|
||||
show: function UndoDialog_show(aSite) {
|
||||
show: function(aSite) {
|
||||
if (this._undoData)
|
||||
clearTimeout(this._undoData.timeout);
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ var gUndoDialog = {
|
|||
/**
|
||||
* Hides the undo dialog.
|
||||
*/
|
||||
hide: function UndoDialog_hide() {
|
||||
hide: function() {
|
||||
if (!this._undoData)
|
||||
return;
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ var gUndoDialog = {
|
|||
* The undo dialog event handler.
|
||||
* @param aEvent The event to handle.
|
||||
*/
|
||||
handleEvent: function UndoDialog_handleEvent(aEvent) {
|
||||
handleEvent: function(aEvent) {
|
||||
switch (aEvent.target.id) {
|
||||
case "newtab-undo-button":
|
||||
this._undo();
|
||||
|
|
@ -87,7 +87,7 @@ var gUndoDialog = {
|
|||
/**
|
||||
* Undo the last blocked site.
|
||||
*/
|
||||
_undo: function UndoDialog_undo() {
|
||||
_undo: function() {
|
||||
if (!this._undoData)
|
||||
return;
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ var gUndoDialog = {
|
|||
/**
|
||||
* Undo all blocked sites.
|
||||
*/
|
||||
_undoAll: function UndoDialog_undoAll() {
|
||||
_undoAll: function() {
|
||||
NewTabUtils.undoAll(function() {
|
||||
gUpdater.updateGrid();
|
||||
this.hide();
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ var gUpdater = {
|
|||
* This removes old, moves existing and creates new sites to fill gaps.
|
||||
* @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);
|
||||
|
||||
// Find all sites that remain in the grid.
|
||||
|
|
@ -50,7 +50,7 @@ var gUpdater = {
|
|||
* @param aLinks The array of links to find sites for.
|
||||
* @return Array of sites mapped to the given links (can contain null values).
|
||||
*/
|
||||
_findRemainingSites: function Updater_findRemainingSites(aLinks) {
|
||||
_findRemainingSites: function(aLinks) {
|
||||
let map = {};
|
||||
|
||||
// Create a map to easily retrieve the site for a given URL.
|
||||
|
|
@ -69,7 +69,7 @@ var gUpdater = {
|
|||
* Freezes the given sites' positions.
|
||||
* @param aSites The array of sites to freeze.
|
||||
*/
|
||||
_freezeSitePositions: function Updater_freezeSitePositions(aSites) {
|
||||
_freezeSitePositions: function(aSites) {
|
||||
aSites.forEach(function (aSite) {
|
||||
if (aSite)
|
||||
gTransformation.freezeSitePosition(aSite);
|
||||
|
|
@ -80,7 +80,7 @@ var gUpdater = {
|
|||
* Moves the given sites' DOM nodes to their new positions.
|
||||
* @param aSites The array of sites to move.
|
||||
*/
|
||||
_moveSiteNodes: function Updater_moveSiteNodes(aSites) {
|
||||
_moveSiteNodes: function(aSites) {
|
||||
let cells = gGrid.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 aCallback The callback to call when finished.
|
||||
*/
|
||||
_rearrangeSites: function Updater_rearrangeSites(aSites, aCallback) {
|
||||
_rearrangeSites: function(aSites, aCallback) {
|
||||
let options = {callback: aCallback, unfreeze: true};
|
||||
gTransformation.rearrangeSites(aSites, options);
|
||||
},
|
||||
|
|
@ -123,7 +123,7 @@ var gUpdater = {
|
|||
* @param aSites The array of sites remaining in the grid.
|
||||
* @param aCallback The callback to call when finished.
|
||||
*/
|
||||
_removeLegacySites: function Updater_removeLegacySites(aSites, aCallback) {
|
||||
_removeLegacySites: function(aSites, aCallback) {
|
||||
let batch = [];
|
||||
|
||||
// Delete sites that were removed from the grid.
|
||||
|
|
@ -152,7 +152,7 @@ var gUpdater = {
|
|||
* @param aLinks The array of links.
|
||||
* @param aCallback The callback to call when finished.
|
||||
*/
|
||||
_fillEmptyCells: function Updater_fillEmptyCells(aLinks, aCallback) {
|
||||
_fillEmptyCells: function(aLinks, aCallback) {
|
||||
let {cells, sites} = gGrid;
|
||||
|
||||
// Find empty cells and fill them.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue