mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 00:38:39 +09:00
[Basilisk] Issue MoonchildProductions/UXP#516 - Remove named function syntax from basilisk/modules.
This commit is contained in:
parent
b31901aa3f
commit
ecfee37414
3 changed files with 38 additions and 38 deletions
|
|
@ -70,7 +70,7 @@ function _handleEvent(aEvent) {
|
|||
|
||||
// Methods that impact a browser. Put into single object for organization.
|
||||
var BrowserHelper = {
|
||||
onOpen: function NP_BH_onOpen(aBrowser) {
|
||||
onOpen: function(aBrowser) {
|
||||
_priorityBackup.set(aBrowser.permanentKey, Ci.nsISupportsPriority.PRIORITY_NORMAL);
|
||||
|
||||
// If the tab is in the focused window, leave priority as it is
|
||||
|
|
@ -78,7 +78,7 @@ var BrowserHelper = {
|
|||
this.decreasePriority(aBrowser);
|
||||
},
|
||||
|
||||
onSelect: function NP_BH_onSelect(aBrowser) {
|
||||
onSelect: function(aBrowser) {
|
||||
let windowEntry = WindowHelper.getEntry(aBrowser.ownerGlobal);
|
||||
if (windowEntry.lastSelectedBrowser)
|
||||
this.decreasePriority(windowEntry.lastSelectedBrowser);
|
||||
|
|
@ -91,13 +91,13 @@ var BrowserHelper = {
|
|||
aBrowser.setPriority(_priorityBackup.get(aBrowser.permanentKey));
|
||||
},
|
||||
|
||||
increasePriority: function NP_BH_increasePriority(aBrowser) {
|
||||
increasePriority: function(aBrowser) {
|
||||
aBrowser.adjustPriority(PRIORITY_DELTA);
|
||||
_priorityBackup.set(aBrowser.permanentKey,
|
||||
_priorityBackup.get(aBrowser.permanentKey) + PRIORITY_DELTA);
|
||||
},
|
||||
|
||||
decreasePriority: function NP_BH_decreasePriority(aBrowser) {
|
||||
decreasePriority: function(aBrowser) {
|
||||
aBrowser.adjustPriority(PRIORITY_DELTA * -1);
|
||||
_priorityBackup.set(aBrowser.permanentKey,
|
||||
_priorityBackup.get(aBrowser.permanentKey) - PRIORITY_DELTA);
|
||||
|
|
@ -107,7 +107,7 @@ var BrowserHelper = {
|
|||
|
||||
// Methods that impact a window. Put into single object for organization.
|
||||
var WindowHelper = {
|
||||
addWindow: function NP_WH_addWindow(aWindow) {
|
||||
addWindow: function(aWindow) {
|
||||
// Build internal data object
|
||||
_windows.push({ window: aWindow, lastSelectedBrowser: null });
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ var WindowHelper = {
|
|||
BrowserHelper.onSelect(aWindow.gBrowser.selectedBrowser);
|
||||
},
|
||||
|
||||
removeWindow: function NP_WH_removeWindow(aWindow) {
|
||||
removeWindow: function(aWindow) {
|
||||
if (aWindow == _lastFocusedWindow)
|
||||
_lastFocusedWindow = null;
|
||||
|
||||
|
|
@ -146,7 +146,7 @@ var WindowHelper = {
|
|||
});
|
||||
},
|
||||
|
||||
onActivate: function NP_WH_onActivate(aWindow, aHasFocus) {
|
||||
onActivate: function(aWindow, aHasFocus) {
|
||||
// If this window was the last focused window, we don't need to do anything
|
||||
if (aWindow == _lastFocusedWindow)
|
||||
return;
|
||||
|
|
@ -158,7 +158,7 @@ var WindowHelper = {
|
|||
this.increasePriority(aWindow);
|
||||
},
|
||||
|
||||
handleFocusedWindow: function NP_WH_handleFocusedWindow(aWindow) {
|
||||
handleFocusedWindow: function(aWindow) {
|
||||
// If we have a last focused window, we need to deprioritize it first
|
||||
if (_lastFocusedWindow)
|
||||
this.decreasePriority(_lastFocusedWindow);
|
||||
|
|
@ -168,23 +168,23 @@ var WindowHelper = {
|
|||
},
|
||||
|
||||
// Auxiliary methods
|
||||
increasePriority: function NP_WH_increasePriority(aWindow) {
|
||||
increasePriority: function(aWindow) {
|
||||
aWindow.gBrowser.browsers.forEach(function(aBrowser) {
|
||||
BrowserHelper.increasePriority(aBrowser);
|
||||
});
|
||||
},
|
||||
|
||||
decreasePriority: function NP_WH_decreasePriority(aWindow) {
|
||||
decreasePriority: function(aWindow) {
|
||||
aWindow.gBrowser.browsers.forEach(function(aBrowser) {
|
||||
BrowserHelper.decreasePriority(aBrowser);
|
||||
});
|
||||
},
|
||||
|
||||
getEntry: function NP_WH_getEntry(aWindow) {
|
||||
getEntry: function(aWindow) {
|
||||
return _windows[this.getEntryIndex(aWindow)];
|
||||
},
|
||||
|
||||
getEntryIndex: function NP_WH_getEntryAtIndex(aWindow) {
|
||||
getEntryIndex: function(aWindow) {
|
||||
// Assumes that every object has a unique window & it's in the array
|
||||
for (let i = 0; i < _windows.length; i++)
|
||||
if (_windows[i].window == aWindow)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ this.RecentWindow = {
|
|||
* Omit the property to search in both groups.
|
||||
* * allowPopups: true if popup windows are permissable.
|
||||
*/
|
||||
getMostRecentBrowserWindow: function RW_getMostRecentBrowserWindow(aOptions) {
|
||||
getMostRecentBrowserWindow: function(aOptions) {
|
||||
let checkPrivacy = typeof aOptions == "object" &&
|
||||
"private" in aOptions;
|
||||
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ this.WinTaskbarJumpList =
|
|||
* Startup, shutdown, and update
|
||||
*/
|
||||
|
||||
startup: function WTBJL_startup() {
|
||||
startup: function() {
|
||||
// exit if this isn't win7 or higher.
|
||||
if (!this._initTaskbar())
|
||||
return;
|
||||
|
|
@ -173,7 +173,7 @@ this.WinTaskbarJumpList =
|
|||
this._updateTimer();
|
||||
},
|
||||
|
||||
update: function WTBJL_update() {
|
||||
update: function() {
|
||||
// are we disabled via prefs? don't do anything!
|
||||
if (!this._enabled)
|
||||
return;
|
||||
|
|
@ -182,7 +182,7 @@ this.WinTaskbarJumpList =
|
|||
this._buildList();
|
||||
},
|
||||
|
||||
_shutdown: function WTBJL__shutdown() {
|
||||
_shutdown: function() {
|
||||
this._shuttingDown = true;
|
||||
|
||||
// Correctly handle a clear history on shutdown. If there are no
|
||||
|
|
@ -195,7 +195,7 @@ this.WinTaskbarJumpList =
|
|||
this._free();
|
||||
},
|
||||
|
||||
_shortcutMaintenance: function WTBJL__maintenace() {
|
||||
_shortcutMaintenance: function() {
|
||||
_winShellService.shortcutMaintenance();
|
||||
},
|
||||
|
||||
|
|
@ -210,11 +210,11 @@ this.WinTaskbarJumpList =
|
|||
*/
|
||||
|
||||
_pendingStatements: {},
|
||||
_hasPendingStatements: function WTBJL__hasPendingStatements() {
|
||||
_hasPendingStatements: function() {
|
||||
return Object.keys(this._pendingStatements).length > 0;
|
||||
},
|
||||
|
||||
_buildList: function WTBJL__buildList() {
|
||||
_buildList: function() {
|
||||
if (this._hasPendingStatements()) {
|
||||
// We were requested to update the list while another update was in
|
||||
// progress, this could happen at shutdown, idle or privatebrowsing.
|
||||
|
|
@ -253,7 +253,7 @@ this.WinTaskbarJumpList =
|
|||
* Taskbar api wrappers
|
||||
*/
|
||||
|
||||
_startBuild: function WTBJL__startBuild() {
|
||||
_startBuild: function() {
|
||||
var removedItems = Cc["@mozilla.org/array;1"].
|
||||
createInstance(Ci.nsIMutableArray);
|
||||
this._builder.abortListBuild();
|
||||
|
|
@ -265,13 +265,13 @@ this.WinTaskbarJumpList =
|
|||
return false;
|
||||
},
|
||||
|
||||
_commitBuild: function WTBJL__commitBuild() {
|
||||
_commitBuild: function() {
|
||||
if (!this._hasPendingStatements() && !this._builder.commitListBuild()) {
|
||||
this._builder.abortListBuild();
|
||||
}
|
||||
},
|
||||
|
||||
_buildTasks: function WTBJL__buildTasks() {
|
||||
_buildTasks: function() {
|
||||
var items = Cc["@mozilla.org/array;1"].
|
||||
createInstance(Ci.nsIMutableArray);
|
||||
this._tasks.forEach(function (task) {
|
||||
|
|
@ -286,12 +286,12 @@ this.WinTaskbarJumpList =
|
|||
this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_TASKS, items);
|
||||
},
|
||||
|
||||
_buildCustom: function WTBJL__buildCustom(title, items) {
|
||||
_buildCustom: function(title, items) {
|
||||
if (items.length > 0)
|
||||
this._builder.addListToBuild(this._builder.JUMPLIST_CATEGORY_CUSTOMLIST, items, title);
|
||||
},
|
||||
|
||||
_buildFrequent: function WTBJL__buildFrequent() {
|
||||
_buildFrequent: function() {
|
||||
// If history is empty, just bail out.
|
||||
if (!PlacesUtils.history.hasHistoryEntries) {
|
||||
return;
|
||||
|
|
@ -331,7 +331,7 @@ this.WinTaskbarJumpList =
|
|||
);
|
||||
},
|
||||
|
||||
_buildRecent: function WTBJL__buildRecent() {
|
||||
_buildRecent: function() {
|
||||
// If history is empty, just bail out.
|
||||
if (!PlacesUtils.history.hasHistoryEntries) {
|
||||
return;
|
||||
|
|
@ -376,7 +376,7 @@ this.WinTaskbarJumpList =
|
|||
);
|
||||
},
|
||||
|
||||
_deleteActiveJumpList: function WTBJL__deleteAJL() {
|
||||
_deleteActiveJumpList:() {
|
||||
this._builder.deleteActiveList();
|
||||
},
|
||||
|
||||
|
|
@ -384,7 +384,7 @@ this.WinTaskbarJumpList =
|
|||
* Jump list item creation helpers
|
||||
*/
|
||||
|
||||
_getHandlerAppItem: function WTBJL__getHandlerAppItem(name, description,
|
||||
_getHandlerAppItem: function(name, description,
|
||||
args, iconIndex,
|
||||
faviconPageUri) {
|
||||
var file = Services.dirsvc.get("XREExeF", Ci.nsILocalFile);
|
||||
|
|
@ -406,7 +406,7 @@ this.WinTaskbarJumpList =
|
|||
return item;
|
||||
},
|
||||
|
||||
_getSeparatorItem: function WTBJL__getSeparatorItem() {
|
||||
_getSeparatorItem: function() {
|
||||
var item = Cc["@mozilla.org/windows-jumplistseparator;1"].
|
||||
createInstance(Ci.nsIJumpListSeparator);
|
||||
return item;
|
||||
|
|
@ -446,7 +446,7 @@ this.WinTaskbarJumpList =
|
|||
});
|
||||
},
|
||||
|
||||
_clearHistory: function WTBJL__clearHistory(items) {
|
||||
_clearHistory: function(items) {
|
||||
if (!items)
|
||||
return;
|
||||
var URIsToRemove = [];
|
||||
|
|
@ -469,7 +469,7 @@ this.WinTaskbarJumpList =
|
|||
* Prefs utilities
|
||||
*/
|
||||
|
||||
_refreshPrefs: function WTBJL__refreshPrefs() {
|
||||
_refreshPrefs: function() {
|
||||
this._enabled = _prefs.getBoolPref(PREF_TASKBAR_ENABLED);
|
||||
this._showFrequent = _prefs.getBoolPref(PREF_TASKBAR_FREQUENT);
|
||||
this._showRecent = _prefs.getBoolPref(PREF_TASKBAR_RECENT);
|
||||
|
|
@ -481,7 +481,7 @@ this.WinTaskbarJumpList =
|
|||
* Init and shutdown utilities
|
||||
*/
|
||||
|
||||
_initTaskbar: function WTBJL__initTaskbar() {
|
||||
_initTaskbar: function() {
|
||||
this._builder = _taskbarService.createJumpListBuilder();
|
||||
if (!this._builder || !this._builder.available)
|
||||
return false;
|
||||
|
|
@ -489,7 +489,7 @@ this.WinTaskbarJumpList =
|
|||
return true;
|
||||
},
|
||||
|
||||
_initObs: function WTBJL__initObs() {
|
||||
_initObs: function() {
|
||||
// If the browser is closed while in private browsing mode, the "exit"
|
||||
// notification is fired on quit-application-granted.
|
||||
// History cleanup can happen at profile-change-teardown.
|
||||
|
|
@ -498,13 +498,13 @@ this.WinTaskbarJumpList =
|
|||
_prefs.addObserver("", this, false);
|
||||
},
|
||||
|
||||
_freeObs: function WTBJL__freeObs() {
|
||||
_freeObs: function() {
|
||||
Services.obs.removeObserver(this, "profile-before-change");
|
||||
Services.obs.removeObserver(this, "browser:purge-session-history");
|
||||
_prefs.removeObserver("", this);
|
||||
},
|
||||
|
||||
_updateTimer: function WTBJL__updateTimer() {
|
||||
_updateTimer: function() {
|
||||
if (this._enabled && !this._shuttingDown && !this._timer) {
|
||||
this._timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
this._timer.initWithCallback(this,
|
||||
|
|
@ -518,7 +518,7 @@ this.WinTaskbarJumpList =
|
|||
},
|
||||
|
||||
_hasIdleObserver: false,
|
||||
_updateIdleObserver: function WTBJL__updateIdleObserver() {
|
||||
_updateIdleObserver: function() {
|
||||
if (this._enabled && !this._shuttingDown && !this._hasIdleObserver) {
|
||||
_idle.addIdleObserver(this, IDLE_TIMEOUT_SECONDS);
|
||||
this._hasIdleObserver = true;
|
||||
|
|
@ -529,7 +529,7 @@ this.WinTaskbarJumpList =
|
|||
}
|
||||
},
|
||||
|
||||
_free: function WTBJL__free() {
|
||||
_free: function() {
|
||||
this._freeObs();
|
||||
this._updateTimer();
|
||||
this._updateIdleObserver();
|
||||
|
|
@ -540,13 +540,13 @@ this.WinTaskbarJumpList =
|
|||
* Notification handlers
|
||||
*/
|
||||
|
||||
notify: function WTBJL_notify(aTimer) {
|
||||
notify: function(aTimer) {
|
||||
// Add idle observer on the first notification so it doesn't hit startup.
|
||||
this._updateIdleObserver();
|
||||
this.update();
|
||||
},
|
||||
|
||||
observe: function WTBJL_observe(aSubject, aTopic, aData) {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
switch (aTopic) {
|
||||
case "nsPref:changed":
|
||||
if (this._enabled == true && !_prefs.getBoolPref(PREF_TASKBAR_ENABLED))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue