mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-06 23:37:31 +09:00
[Pale-Moon] Issue MoonchildProductions/UXP#516 - Remove named function syntax from palemoon/components/search.
This commit is contained in:
parent
0764896876
commit
9e97918159
1 changed files with 26 additions and 26 deletions
|
|
@ -19,7 +19,7 @@ const BROWSER_SUGGEST_PREF = "browser.search.suggest.enabled";
|
||||||
var gEngineView = null;
|
var gEngineView = null;
|
||||||
|
|
||||||
var gEngineManagerDialog = {
|
var gEngineManagerDialog = {
|
||||||
init: function engineManager_init() {
|
init: function () {
|
||||||
gEngineView = new EngineView(new EngineStore());
|
gEngineView = new EngineView(new EngineStore());
|
||||||
|
|
||||||
var suggestEnabled = Services.prefs.getBoolPref(BROWSER_SUGGEST_PREF);
|
var suggestEnabled = Services.prefs.getBoolPref(BROWSER_SUGGEST_PREF);
|
||||||
|
|
@ -31,12 +31,12 @@ var gEngineManagerDialog = {
|
||||||
Services.obs.addObserver(this, "browser-search-engine-modified", false);
|
Services.obs.addObserver(this, "browser-search-engine-modified", false);
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function engineManager_destroy() {
|
destroy: function () {
|
||||||
// Remove the observer
|
// Remove the observer
|
||||||
Services.obs.removeObserver(this, "browser-search-engine-modified");
|
Services.obs.removeObserver(this, "browser-search-engine-modified");
|
||||||
},
|
},
|
||||||
|
|
||||||
observe: function engineManager_observe(aEngine, aTopic, aVerb) {
|
observe: function (aEngine, aTopic, aVerb) {
|
||||||
if (aTopic == "browser-search-engine-modified") {
|
if (aTopic == "browser-search-engine-modified") {
|
||||||
aEngine.QueryInterface(Ci.nsISearchEngine);
|
aEngine.QueryInterface(Ci.nsISearchEngine);
|
||||||
switch (aVerb) {
|
switch (aVerb) {
|
||||||
|
|
@ -57,7 +57,7 @@ var gEngineManagerDialog = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onOK: function engineManager_onOK() {
|
onOK: function () {
|
||||||
// Set the preference
|
// Set the preference
|
||||||
var newSuggestEnabled = document.getElementById("enableSuggest").checked;
|
var newSuggestEnabled = document.getElementById("enableSuggest").checked;
|
||||||
Services.prefs.setBoolPref(BROWSER_SUGGEST_PREF, newSuggestEnabled);
|
Services.prefs.setBoolPref(BROWSER_SUGGEST_PREF, newSuggestEnabled);
|
||||||
|
|
@ -66,23 +66,23 @@ var gEngineManagerDialog = {
|
||||||
gEngineView._engineStore.commit();
|
gEngineView._engineStore.commit();
|
||||||
},
|
},
|
||||||
|
|
||||||
onRestoreDefaults: function engineManager_onRestoreDefaults() {
|
onRestoreDefaults: function () {
|
||||||
var num = gEngineView._engineStore.restoreDefaultEngines();
|
var num = gEngineView._engineStore.restoreDefaultEngines();
|
||||||
gEngineView.rowCountChanged(0, num);
|
gEngineView.rowCountChanged(0, num);
|
||||||
gEngineView.invalidate();
|
gEngineView.invalidate();
|
||||||
},
|
},
|
||||||
|
|
||||||
showRestoreDefaults: function engineManager_showRestoreDefaults(val) {
|
showRestoreDefaults: function (val) {
|
||||||
document.documentElement.getButton("extra2").disabled = !val;
|
document.documentElement.getButton("extra2").disabled = !val;
|
||||||
},
|
},
|
||||||
|
|
||||||
loadAddEngines: function engineManager_loadAddEngines() {
|
loadAddEngines: function () {
|
||||||
this.onOK();
|
this.onOK();
|
||||||
window.opener.BrowserSearch.loadAddEngines();
|
window.opener.BrowserSearch.loadAddEngines();
|
||||||
window.close();
|
window.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
remove: function engineManager_remove() {
|
remove: function () {
|
||||||
gEngineView._engineStore.removeEngine(gEngineView.selectedEngine);
|
gEngineView._engineStore.removeEngine(gEngineView.selectedEngine);
|
||||||
var index = gEngineView.selectedIndex;
|
var index = gEngineView.selectedIndex;
|
||||||
gEngineView.rowCountChanged(index, -1);
|
gEngineView.rowCountChanged(index, -1);
|
||||||
|
|
@ -97,7 +97,7 @@ var gEngineManagerDialog = {
|
||||||
* @param aDir
|
* @param aDir
|
||||||
* -1 to move the selected engine down, +1 to move it up.
|
* -1 to move the selected engine down, +1 to move it up.
|
||||||
*/
|
*/
|
||||||
bump: function engineManager_move(aDir) {
|
bump: function (aDir) {
|
||||||
var selectedEngine = gEngineView.selectedEngine;
|
var selectedEngine = gEngineView.selectedEngine;
|
||||||
var newIndex = gEngineView.selectedIndex - aDir;
|
var newIndex = gEngineView.selectedIndex - aDir;
|
||||||
|
|
||||||
|
|
@ -110,7 +110,7 @@ var gEngineManagerDialog = {
|
||||||
document.getElementById("engineList").focus();
|
document.getElementById("engineList").focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
editKeyword: Task.async(function* engineManager_editKeyword() {
|
editKeyword: Task.async(function* () {
|
||||||
var selectedEngine = gEngineView.selectedEngine;
|
var selectedEngine = gEngineView.selectedEngine;
|
||||||
if (!selectedEngine)
|
if (!selectedEngine)
|
||||||
return;
|
return;
|
||||||
|
|
@ -157,7 +157,7 @@ var gEngineManagerDialog = {
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
onSelect: function engineManager_onSelect() {
|
onSelect: function () {
|
||||||
// Buttons only work if an engine is selected and it's not the last engine,
|
// Buttons only work if an engine is selected and it's not the last engine,
|
||||||
// the latter is true when the selected is first and last at the same time.
|
// the latter is true when the selected is first and last at the same time.
|
||||||
var lastSelected = (gEngineView.selectedIndex == gEngineView.lastIndex);
|
var lastSelected = (gEngineView.selectedIndex == gEngineView.lastIndex);
|
||||||
|
|
@ -197,7 +197,7 @@ function EngineMoveOp(aEngineClone, aNewIndex) {
|
||||||
EngineMoveOp.prototype = {
|
EngineMoveOp.prototype = {
|
||||||
_engine: null,
|
_engine: null,
|
||||||
_newIndex: null,
|
_newIndex: null,
|
||||||
commit: function EMO_commit() {
|
commit: function () {
|
||||||
Services.search.moveEngine(this._engine, this._newIndex);
|
Services.search.moveEngine(this._engine, this._newIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -209,7 +209,7 @@ function EngineRemoveOp(aEngineClone) {
|
||||||
}
|
}
|
||||||
EngineRemoveOp.prototype = {
|
EngineRemoveOp.prototype = {
|
||||||
_engine: null,
|
_engine: null,
|
||||||
commit: function ERO_commit() {
|
commit: function () {
|
||||||
Services.search.removeEngine(this._engine);
|
Services.search.removeEngine(this._engine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -223,7 +223,7 @@ function EngineUnhideOp(aEngineClone, aNewIndex) {
|
||||||
EngineUnhideOp.prototype = {
|
EngineUnhideOp.prototype = {
|
||||||
_engine: null,
|
_engine: null,
|
||||||
_newIndex: null,
|
_newIndex: null,
|
||||||
commit: function EUO_commit() {
|
commit: function () {
|
||||||
this._engine.hidden = false;
|
this._engine.hidden = false;
|
||||||
Services.search.moveEngine(this._engine, this._newIndex);
|
Services.search.moveEngine(this._engine, this._newIndex);
|
||||||
}
|
}
|
||||||
|
|
@ -241,7 +241,7 @@ EngineChangeOp.prototype = {
|
||||||
_engine: null,
|
_engine: null,
|
||||||
_prop: null,
|
_prop: null,
|
||||||
_newValue: null,
|
_newValue: null,
|
||||||
commit: function ECO_commit() {
|
commit: function () {
|
||||||
this._engine[this._prop] = this._newValue;
|
this._engine[this._prop] = this._newValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -269,11 +269,11 @@ EngineStore.prototype = {
|
||||||
return val;
|
return val;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getIndexForEngine: function ES_getIndexForEngine(aEngine) {
|
_getIndexForEngine: function (aEngine) {
|
||||||
return this._engines.indexOf(aEngine);
|
return this._engines.indexOf(aEngine);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getEngineByName: function ES_getEngineByName(aName) {
|
_getEngineByName: function (aName) {
|
||||||
for each (var engine in this._engines)
|
for each (var engine in this._engines)
|
||||||
if (engine.name == aName)
|
if (engine.name == aName)
|
||||||
return engine;
|
return engine;
|
||||||
|
|
@ -281,7 +281,7 @@ EngineStore.prototype = {
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_cloneEngine: function ES_cloneEngine(aEngine) {
|
_cloneEngine: function (aEngine) {
|
||||||
var clonedObj={};
|
var clonedObj={};
|
||||||
for (var i in aEngine)
|
for (var i in aEngine)
|
||||||
clonedObj[i] = aEngine[i];
|
clonedObj[i] = aEngine[i];
|
||||||
|
|
@ -290,11 +290,11 @@ EngineStore.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Callback for Array's some(). A thisObj must be passed to some()
|
// Callback for Array's some(). A thisObj must be passed to some()
|
||||||
_isSameEngine: function ES_isSameEngine(aEngineClone) {
|
_isSameEngine: function (aEngineClone) {
|
||||||
return aEngineClone.originalEngine == this.originalEngine;
|
return aEngineClone.originalEngine == this.originalEngine;
|
||||||
},
|
},
|
||||||
|
|
||||||
commit: function ES_commit() {
|
commit: function () {
|
||||||
var currentEngine = this._cloneEngine(Services.search.currentEngine);
|
var currentEngine = this._cloneEngine(Services.search.currentEngine);
|
||||||
for (var i = 0; i < this._ops.length; i++)
|
for (var i = 0; i < this._ops.length; i++)
|
||||||
this._ops[i].commit();
|
this._ops[i].commit();
|
||||||
|
|
@ -306,11 +306,11 @@ EngineStore.prototype = {
|
||||||
Services.search.currentEngine = currentEngine.originalEngine;
|
Services.search.currentEngine = currentEngine.originalEngine;
|
||||||
},
|
},
|
||||||
|
|
||||||
addEngine: function ES_addEngine(aEngine) {
|
addEngine: function (aEngine) {
|
||||||
this._engines.push(this._cloneEngine(aEngine));
|
this._engines.push(this._cloneEngine(aEngine));
|
||||||
},
|
},
|
||||||
|
|
||||||
moveEngine: function ES_moveEngine(aEngine, aNewIndex) {
|
moveEngine: function (aEngine, aNewIndex) {
|
||||||
if (aNewIndex < 0 || aNewIndex > this._engines.length - 1)
|
if (aNewIndex < 0 || aNewIndex > this._engines.length - 1)
|
||||||
throw new Error("ES_moveEngine: invalid aNewIndex!");
|
throw new Error("ES_moveEngine: invalid aNewIndex!");
|
||||||
var index = this._getIndexForEngine(aEngine);
|
var index = this._getIndexForEngine(aEngine);
|
||||||
|
|
@ -327,7 +327,7 @@ EngineStore.prototype = {
|
||||||
this._ops.push(new EngineMoveOp(aEngine, aNewIndex));
|
this._ops.push(new EngineMoveOp(aEngine, aNewIndex));
|
||||||
},
|
},
|
||||||
|
|
||||||
removeEngine: function ES_removeEngine(aEngine) {
|
removeEngine: function (aEngine) {
|
||||||
var index = this._getIndexForEngine(aEngine);
|
var index = this._getIndexForEngine(aEngine);
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
throw new Error("invalid engine?");
|
throw new Error("invalid engine?");
|
||||||
|
|
@ -338,7 +338,7 @@ EngineStore.prototype = {
|
||||||
gEngineManagerDialog.showRestoreDefaults(true);
|
gEngineManagerDialog.showRestoreDefaults(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
restoreDefaultEngines: function ES_restoreDefaultEngines() {
|
restoreDefaultEngines: function () {
|
||||||
var added = 0;
|
var added = 0;
|
||||||
|
|
||||||
for (var i = 0; i < this._defaultEngines.length; ++i) {
|
for (var i = 0; i < this._defaultEngines.length; ++i) {
|
||||||
|
|
@ -358,7 +358,7 @@ EngineStore.prototype = {
|
||||||
return added;
|
return added;
|
||||||
},
|
},
|
||||||
|
|
||||||
changeEngine: function ES_changeEngine(aEngine, aProp, aNewValue) {
|
changeEngine: function (aEngine, aProp, aNewValue) {
|
||||||
var index = this._getIndexForEngine(aEngine);
|
var index = this._getIndexForEngine(aEngine);
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
throw new Error("invalid engine?");
|
throw new Error("invalid engine?");
|
||||||
|
|
@ -367,7 +367,7 @@ EngineStore.prototype = {
|
||||||
this._ops.push(new EngineChangeOp(aEngine, aProp, aNewValue));
|
this._ops.push(new EngineChangeOp(aEngine, aProp, aNewValue));
|
||||||
},
|
},
|
||||||
|
|
||||||
reloadIcons: function ES_reloadIcons() {
|
reloadIcons: function () {
|
||||||
this._engines.forEach(function (e) {
|
this._engines.forEach(function (e) {
|
||||||
e.uri = e.originalEngine.uri;
|
e.uri = e.originalEngine.uri;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue