mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-04-20 12:01:32 +02:00
Replace expression closures (getters).
Expression closures are to be axed. See https://bugzil.la/1083458.
This commit is contained in:
Vendored
+4
-4
@@ -69,15 +69,15 @@ let JSMLoader = {
|
||||
|
||||
SANDBOX: Cu.nukeSandbox,
|
||||
|
||||
get addon() addon,
|
||||
get addon() { return addon; },
|
||||
|
||||
currentModule: null,
|
||||
|
||||
factories: [],
|
||||
|
||||
get name() name,
|
||||
get name() { return name; },
|
||||
|
||||
get module() moduleName,
|
||||
get module() { return moduleName; },
|
||||
|
||||
globals: {},
|
||||
modules: {},
|
||||
@@ -192,7 +192,7 @@ let JSMLoader = {
|
||||
},
|
||||
|
||||
// Cuts down on stupid, fscking url mangling.
|
||||
get loadSubScript() bootstrap_jsm.loadSubScript,
|
||||
get loadSubScript() { return bootstrap_jsm.loadSubScript; },
|
||||
|
||||
cleanup: function cleanup() {
|
||||
for (let factory of this.factories.splice(0))
|
||||
|
||||
@@ -82,7 +82,11 @@ CommandLineHandler.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
get helpInfo() " -" + config.name + " <opts>" + " Additional options for " + config.appName + " startup\n".substr(config.name.length)
|
||||
get helpInfo() {
|
||||
return " -" + config.name + " <opts>" +
|
||||
" Additional options for " +
|
||||
config.appName + " startup\n".substr(config.name.length);
|
||||
}
|
||||
};
|
||||
|
||||
if (XPCOMUtils.generateNSGetFactory)
|
||||
|
||||
@@ -88,7 +88,7 @@ var Abbreviation = Class("Abbreviation", {
|
||||
* @property {string} The mode display characters associated with the
|
||||
* supported mode combination.
|
||||
*/
|
||||
get modeChar() Abbreviation.modeChar(this.modes)
|
||||
get modeChar() { return Abbreviation.modeChar(this.modes); }
|
||||
}, {
|
||||
modeChar: function (_modes) {
|
||||
let result = Ary.uniq(_modes.map(m => m.char)).join("");
|
||||
@@ -105,7 +105,7 @@ var AbbrevHive = Class("AbbrevHive", Contexts.Hive, {
|
||||
},
|
||||
|
||||
/** @property {boolean} True if there are no abbreviations. */
|
||||
get empty() !values(this._store).find(util.identity),
|
||||
get empty() { return !values(this._store).find(util.identity); },
|
||||
|
||||
/**
|
||||
* Adds a new abbreviation.
|
||||
@@ -229,9 +229,9 @@ var Abbreviations = Module("abbreviations", {
|
||||
*/$), "x", params);
|
||||
},
|
||||
|
||||
get allHives() contexts.allGroups.abbrevs,
|
||||
get allHives() { return contexts.allGroups.abbrevs; },
|
||||
|
||||
get userHives() this.allHives.filter(h => h !== this.builtin),
|
||||
get userHives() { return this.allHives.filter(h => h !== this.builtin); },
|
||||
|
||||
get: deprecated("group.abbrevs.get", { get: function get() this.user.bound.get }),
|
||||
set: deprecated("group.abbrevs.set", { get: function set() this.user.bound.set }),
|
||||
|
||||
@@ -70,7 +70,9 @@ var AutoCmdHive = Class("AutoCmdHive", Contexts.Hive, {
|
||||
* @instance autocommands
|
||||
*/
|
||||
var AutoCommands = Module("autocommands", {
|
||||
get activeHives() contexts.allGroups.autocmd.filter(h => h._store.length),
|
||||
get activeHives() {
|
||||
return contexts.allGroups.autocmd.filter(h => h._store.length);
|
||||
},
|
||||
|
||||
add: deprecated("group.autocmd.add", { get: function add() autocommands.user.bound.add }),
|
||||
get: deprecated("group.autocmd.get", { get: function get() autocommands.user.bound.get }),
|
||||
|
||||
@@ -33,12 +33,14 @@ var Bookmarks = Module("bookmarks", {
|
||||
}
|
||||
},
|
||||
|
||||
get format() ({
|
||||
get format() {
|
||||
return {
|
||||
anchored: false,
|
||||
title: ["URL", "Info"],
|
||||
keys: { text: "url", description: "title", icon: "icon", extra: "extra", tags: "tags", isURI: function () true },
|
||||
process: [template.icon, template.bookmarkDescription]
|
||||
}),
|
||||
};
|
||||
},
|
||||
|
||||
// TODO: why is this a filter? --djk
|
||||
get: function get(filter, tags, maxItems, extra) {
|
||||
|
||||
@@ -18,7 +18,7 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
||||
util.addObserver(this);
|
||||
|
||||
this._unoverlay = overlay.overlayObject(FullZoom, {
|
||||
get siteSpecific() false,
|
||||
get siteSpecific() { return false; },
|
||||
set siteSpecific(val) {}
|
||||
});
|
||||
|
||||
|
||||
@@ -324,12 +324,12 @@ var CommandMode = Class("CommandMode", {
|
||||
this.keepCommand = userContext.hidden_option_command_afterimage;
|
||||
},
|
||||
|
||||
get autocomplete() options["autocomplete"].length,
|
||||
get autocomplete() { return options["autocomplete"].length; },
|
||||
|
||||
get command() this.widgets.command[1],
|
||||
set command(val) this.widgets.command = val,
|
||||
get command() { return this.widgets.command[1]; },
|
||||
set command(val) { this.widgets.command = val; },
|
||||
|
||||
get prompt() this._open ? this.widgets.prompt : this._prompt,
|
||||
get prompt() { return this._open ? this.widgets.prompt : this._prompt; },
|
||||
set prompt(val) {
|
||||
if (this._open)
|
||||
this.widgets.prompt = val;
|
||||
@@ -362,13 +362,13 @@ var CommandMode = Class("CommandMode", {
|
||||
this.completions.autocompleteTimer.flush(true);
|
||||
},
|
||||
|
||||
get active() this === commandline.commandSession,
|
||||
get active() { return this === commandline.commandSession; },
|
||||
|
||||
get holdFocus() this.widgets.active.command.inputField,
|
||||
get holdFocus() { return this.widgets.active.command.inputField; },
|
||||
|
||||
get mappingSelf() this,
|
||||
get mappingSelf() { return this; },
|
||||
|
||||
get widgets() commandline.widgets,
|
||||
get widgets() { return commandline.widgets; },
|
||||
|
||||
enter: function CM_enter(stack) {
|
||||
commandline.commandSession = this;
|
||||
@@ -453,7 +453,7 @@ var CommandMode = Class("CommandMode", {
|
||||
|
||||
var CommandExMode = Class("CommandExMode", CommandMode, {
|
||||
|
||||
get mode() modes.EX,
|
||||
get mode() { return modes.EX; },
|
||||
|
||||
historyKey: "command",
|
||||
|
||||
@@ -492,7 +492,7 @@ var CommandPromptMode = Class("CommandPromptMode", CommandMode, {
|
||||
context.forkapply("prompt", 0, this, "completer", args);
|
||||
},
|
||||
|
||||
get mode() modes.PROMPT
|
||||
get mode() { return modes.PROMPT; }
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -528,7 +528,7 @@ var CommandLine = Module("commandline", {
|
||||
return this._messages;
|
||||
},
|
||||
|
||||
get length() this._messages.length,
|
||||
get length() { return this._messages.length; },
|
||||
|
||||
clear: function clear() {
|
||||
this._messages = [];
|
||||
@@ -563,7 +563,7 @@ var CommandLine = Module("commandline", {
|
||||
*
|
||||
* @returns {boolean}
|
||||
*/
|
||||
get commandVisible() !!this.commandSession,
|
||||
get commandVisible() { return !!this.commandSession; },
|
||||
|
||||
/**
|
||||
* Ensure that the multiline input widget is the correct size.
|
||||
@@ -591,17 +591,17 @@ var CommandLine = Module("commandline", {
|
||||
APPEND_TO_MESSAGES : 1 << 3, // Add the string to the message history.
|
||||
ACTIVE_WINDOW : 1 << 4, // Only echo in active window.
|
||||
|
||||
get completionContext() this._completions.context,
|
||||
get completionContext() { return this._completions.context; },
|
||||
|
||||
_silent: false,
|
||||
get silent() this._silent,
|
||||
get silent() { return this._silent; },
|
||||
set silent(val) {
|
||||
this._silent = val;
|
||||
this.quiet = this.quiet;
|
||||
},
|
||||
|
||||
_quite: false,
|
||||
get quiet() this._quiet,
|
||||
get quiet() { return this._quiet; },
|
||||
set quiet(val) {
|
||||
this._quiet = val;
|
||||
["commandbar", "statusbar"].forEach(function (nodeSet) {
|
||||
@@ -736,7 +736,7 @@ var CommandLine = Module("commandline", {
|
||||
},
|
||||
|
||||
_hiddenMessages: 0,
|
||||
get hiddenMessages() this._hiddenMessages,
|
||||
get hiddenMessages() { return this._hiddenMessages; },
|
||||
set hiddenMessages(val) {
|
||||
this._hiddenMessages = val;
|
||||
if (val)
|
||||
@@ -917,7 +917,10 @@ var CommandLine = Module("commandline", {
|
||||
});
|
||||
},
|
||||
|
||||
get commandMode() this.commandSession && isinstance(modes.main, modes.COMMAND_LINE),
|
||||
get commandMode() {
|
||||
return this.commandSession &&
|
||||
isinstance(modes.main, modes.COMMAND_LINE);
|
||||
},
|
||||
|
||||
events: update(
|
||||
iter(CommandMode.prototype.events).map(
|
||||
@@ -938,7 +941,7 @@ var CommandLine = Module("commandline", {
|
||||
}
|
||||
),
|
||||
|
||||
get mowEvents() mow.events,
|
||||
get mowEvents() { return mow.events; },
|
||||
|
||||
/**
|
||||
* Multiline input events, they will come straight from
|
||||
@@ -989,7 +992,7 @@ var CommandLine = Module("commandline", {
|
||||
this.reset();
|
||||
this.session = session;
|
||||
},
|
||||
get store() commandline._store.get(this.mode, []),
|
||||
get store() { return commandline._store.get(this.mode, []); },
|
||||
set store(ary) { commandline._store.set(this.mode, ary); },
|
||||
/**
|
||||
* Reset the history index to the first entry.
|
||||
@@ -1165,8 +1168,10 @@ var CommandLine = Module("commandline", {
|
||||
this.tabTimer.tell(event);
|
||||
},
|
||||
|
||||
get activeContexts() this.context.contextList
|
||||
.filter(c => c.items.length || c.incomplete),
|
||||
get activeContexts() {
|
||||
return this.context.contextList
|
||||
.filter(c => c.items.length || c.incomplete);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the current completion string relative to the
|
||||
@@ -1226,7 +1231,7 @@ var CommandLine = Module("commandline", {
|
||||
+ this.originalValue.substr(this.originalCaret);
|
||||
},
|
||||
|
||||
get selected() this.itemList.selected,
|
||||
get selected() { return this.itemList.selected; },
|
||||
set selected(tuple) {
|
||||
if (!Ary.equals(tuple || [],
|
||||
this.itemList.selected || []))
|
||||
@@ -1240,18 +1245,20 @@ var CommandLine = Module("commandline", {
|
||||
}
|
||||
},
|
||||
|
||||
get caret() this.editor.selection.getRangeAt(0).startOffset,
|
||||
get caret() {
|
||||
return this.editor.selection.getRangeAt(0).startOffset;
|
||||
},
|
||||
set caret(offset) {
|
||||
this.editor.selection.collapse(this.editor.rootElement.firstChild, offset);
|
||||
},
|
||||
|
||||
get start() this.context.allItems.start,
|
||||
get start() { return this.context.allItems.start; },
|
||||
|
||||
get items() this.context.allItems.items,
|
||||
get items() { return this.context.allItems.items; },
|
||||
|
||||
get substring() this.context.longestAllSubstring,
|
||||
get substring() { return this.context.longestAllSubstring; },
|
||||
|
||||
get wildtype() this.wildtypes[this.wildIndex] || "",
|
||||
get wildtype() { return this.wildtypes[this.wildIndex] || ""; },
|
||||
|
||||
/**
|
||||
* Cleanup resources used by this completion session. This
|
||||
@@ -1726,7 +1733,7 @@ var CommandLine = Module("commandline", {
|
||||
description: "Active when the command line is focused",
|
||||
insert: true,
|
||||
ownsFocus: true,
|
||||
get mappingSelf() commandline.commandSession
|
||||
get mappingSelf() { return commandline.commandSession; }
|
||||
});
|
||||
// this._extended modes, can include multiple modes, and even main modes
|
||||
modes.addMode("EX", {
|
||||
@@ -1961,8 +1968,8 @@ var ItemList = Class("ItemList", {
|
||||
DOM(this.win).resize(this._onResize.bound.tell);
|
||||
},
|
||||
|
||||
get rootXML()
|
||||
["div", { highlight: "Normal", style: "white-space: nowrap", key: "root" },
|
||||
get rootXML() {
|
||||
return ["div", { highlight: "Normal", style: "white-space: nowrap", key: "root" },
|
||||
["div", { key: "wrapper" },
|
||||
["div", { highlight: "Completions", key: "noCompletions" },
|
||||
["span", { highlight: "Title" },
|
||||
@@ -1972,17 +1979,22 @@ var ItemList = Class("ItemList", {
|
||||
["div", { highlight: "Completions" },
|
||||
template.map(util.range(0, options["maxitems"] * 2), i =>
|
||||
["div", { highlight: "CompItem NonText" },
|
||||
"~"])]],
|
||||
"~"])]];
|
||||
},
|
||||
|
||||
get itemCount() this.context.contextList
|
||||
.reduce((acc, ctxt) => acc + ctxt.items.length, 0),
|
||||
get itemCount() {
|
||||
return this.context.contextList
|
||||
.reduce((acc, ctxt) => acc + ctxt.items.length, 0);
|
||||
},
|
||||
|
||||
get visible() !this.container.collapsed,
|
||||
set visible(val) this.container.collapsed = !val,
|
||||
get visible() { return !this.container.collapsed; },
|
||||
set visible(val) { this.container.collapsed = !val; },
|
||||
|
||||
get activeGroups() this.context.contextList
|
||||
get activeGroups() {
|
||||
return this.context.contextList
|
||||
.filter(c => c.items.length || c.message || c.incomplete)
|
||||
.map(this.getGroup, this),
|
||||
.map(this.getGroup, this);
|
||||
},
|
||||
|
||||
get selected() {
|
||||
let g = this.selectedGroup;
|
||||
@@ -2307,8 +2319,8 @@ var ItemList = Class("ItemList", {
|
||||
this.range = ItemList.Range(0, 0);
|
||||
},
|
||||
|
||||
get rootXML()
|
||||
["div", { key: "root", highlight: "CompGroup" },
|
||||
get rootXML() {
|
||||
return ["div", { key: "root", highlight: "CompGroup" },
|
||||
["div", { highlight: "Completions" },
|
||||
this.context.createRow(this.context.title || [], "CompTitle")],
|
||||
["div", { highlight: "CompTitleSep" }],
|
||||
@@ -2320,13 +2332,14 @@ var ItemList = Class("ItemList", {
|
||||
["div", { key: "items", highlight: "Completions" }]],
|
||||
["div", { key: "waiting", highlight: "CompMsg" },
|
||||
ItemList.WAITING_MESSAGE],
|
||||
["div", { key: "down", highlight: "CompMore" }]]],
|
||||
["div", { key: "down", highlight: "CompMore" }]]];
|
||||
},
|
||||
|
||||
get doc() this.parent.doc,
|
||||
get win() this.parent.win,
|
||||
get maxItems() this.parent.maxItems,
|
||||
get doc() { return this.parent.doc; },
|
||||
get win() { return this.parent.win; },
|
||||
get maxItems() { return this.parent.maxItems; },
|
||||
|
||||
get itemCount() this.context.items.length,
|
||||
get itemCount() { return this.context.items.length; },
|
||||
|
||||
/**
|
||||
* Returns a function which will update the scroll offsets
|
||||
@@ -2440,9 +2453,9 @@ var ItemList = Class("ItemList", {
|
||||
|
||||
getOffset: function getOffset(idx) this.offsets.start + (idx || 0),
|
||||
|
||||
get selectedRow() this.getRow(this._selectedIdx),
|
||||
get selectedRow() { return this.getRow(this._selectedIdx); },
|
||||
|
||||
get selectedIdx() this._selectedIdx,
|
||||
get selectedIdx() { return this._selectedIdx; },
|
||||
set selectedIdx(idx) {
|
||||
if (this.selectedRow && this._selectedIdx != idx)
|
||||
DOM(this.selectedRow).attr("selected", null);
|
||||
|
||||
@@ -152,7 +152,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
return items;
|
||||
},
|
||||
|
||||
get menuItems() this.getMenuItems(),
|
||||
get menuItems() { return this.getMenuItems(); },
|
||||
|
||||
// Global constants
|
||||
CURRENT_TAB: "here",
|
||||
@@ -164,8 +164,10 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
forcePrivate: null,
|
||||
forceTarget: null,
|
||||
|
||||
get forceOpen() ({ background: this.forceBackground,
|
||||
target: this.forceTarget }),
|
||||
get forceOpen() {
|
||||
return { background: this.forceBackground,
|
||||
target: this.forceTarget };
|
||||
},
|
||||
set forceOpen(val) {
|
||||
for (let [k, v] of iter({ background: "forceBackground", target: "forceTarget" }))
|
||||
if (k in val)
|
||||
@@ -604,8 +606,10 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
},
|
||||
|
||||
/** @property {Element} The currently focused element. */
|
||||
get focusedElement() services.focus.getFocusedElementForWindow(window, true, {}),
|
||||
set focusedElement(elem) dactyl.focus(elem),
|
||||
get focusedElement() {
|
||||
return services.focus.getFocusedElementForWindow(window, true, {});
|
||||
},
|
||||
set focusedElement(elem) { dactyl.focus(elem); },
|
||||
|
||||
/**
|
||||
* Returns whether this Dactyl extension supports *feature*.
|
||||
@@ -1067,7 +1071,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
|
||||
pluginFiles: {},
|
||||
|
||||
get plugins() plugins,
|
||||
get plugins() { return plugins; },
|
||||
|
||||
setNodeVisible: function setNodeVisible(node, visible) {
|
||||
if (window.setToolbarVisibility && node.localName == "toolbar")
|
||||
@@ -1116,7 +1120,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
services.appStartup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
|
||||
},
|
||||
|
||||
get assert() util.assert,
|
||||
get assert() { return util.assert; },
|
||||
|
||||
/**
|
||||
* Traps errors in the called function, possibly reporting them.
|
||||
@@ -1213,7 +1217,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
* @property {[Window]} Returns an array of all the host application's
|
||||
* open windows.
|
||||
*/
|
||||
get windows() [w for (w of overlay.windows)]
|
||||
get windows() { return [w for (w of overlay.windows)]; }
|
||||
|
||||
}, {
|
||||
toolbarHidden: function toolbarHidden(elem) "true" == (elem.getAttribute("autohide") ||
|
||||
|
||||
@@ -26,8 +26,14 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
|
||||
});
|
||||
},
|
||||
|
||||
get registers() storage.newMap("registers", { privateData: true, store: true }),
|
||||
get registerRing() storage.newArray("register-ring", { privateData: true, store: true }),
|
||||
get registers() {
|
||||
return storage.newMap("registers",
|
||||
{ privateData: true, store: true });
|
||||
},
|
||||
get registerRing() {
|
||||
return storage.newArray("register-ring",
|
||||
{ privateData: true, store: true });
|
||||
},
|
||||
|
||||
skipSave: false,
|
||||
|
||||
@@ -118,10 +124,10 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
|
||||
}
|
||||
},
|
||||
|
||||
get isCaret() modes.getStack(1).main == modes.CARET,
|
||||
get isTextEdit() modes.getStack(1).main == modes.TEXT_EDIT,
|
||||
get isCaret() { return modes.getStack(1).main == modes.CARET; },
|
||||
get isTextEdit() { return modes.getStack(1).main == modes.TEXT_EDIT; },
|
||||
|
||||
get editor() DOM(this.element).editor,
|
||||
get editor() { return DOM(this.element).editor; },
|
||||
|
||||
getController: function getController(cmd) {
|
||||
let controllers = this.element && this.element.controllers;
|
||||
@@ -130,8 +136,10 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
|
||||
return controllers.getControllerForCommand(cmd || "cmd_beginLine");
|
||||
},
|
||||
|
||||
get selection() this.editor && this.editor.selection || null,
|
||||
get selectionController() this.editor && this.editor.selectionController || null,
|
||||
get selection() { return this.editor && this.editor.selection || null; },
|
||||
get selectionController() {
|
||||
return this.editor && this.editor.selectionController || null;
|
||||
},
|
||||
|
||||
deselect: function () {
|
||||
if (this.selection && this.selection.focusNode)
|
||||
@@ -156,9 +164,11 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
|
||||
this.selection.addRange(range);
|
||||
},
|
||||
|
||||
get selectedText() String(this.selection),
|
||||
get selectedText() { return String(this.selection); },
|
||||
|
||||
get preserveSelection() this.editor && !this.editor.shouldTxnSetSelection,
|
||||
get preserveSelection() {
|
||||
return this.editor && !this.editor.shouldTxnSetSelection;
|
||||
},
|
||||
set preserveSelection(val) {
|
||||
if (this.editor)
|
||||
this.editor.setShouldTxnSetSelection(!val);
|
||||
|
||||
@@ -90,7 +90,7 @@ var EventHive = Class("EventHive", Contexts.Hive, {
|
||||
});
|
||||
},
|
||||
|
||||
get wrapListener() events.bound.wrapListener
|
||||
get wrapListener() { return events.bound.wrapListener; }
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -211,7 +211,7 @@ var Events = Module("events", {
|
||||
}
|
||||
},
|
||||
|
||||
get listen() this.builtin.bound.listen,
|
||||
get listen() { return this.builtin.bound.listen; },
|
||||
addSessionListener: deprecated("events.listen", { get: function addSessionListener() this.listen }),
|
||||
|
||||
/**
|
||||
@@ -248,7 +248,7 @@ var Events = Module("events", {
|
||||
* @param {string} macro The name for the macro.
|
||||
*/
|
||||
_recording: null,
|
||||
get recording() this._recording,
|
||||
get recording() { return this._recording; },
|
||||
|
||||
set recording(macro) {
|
||||
dactyl.assert(macro == null || /[a-zA-Z0-9]/.test(macro),
|
||||
@@ -437,7 +437,11 @@ var Events = Module("events", {
|
||||
return apply(DOM.Event, "stringify", arguments);
|
||||
},
|
||||
|
||||
get defaultTarget() dactyl.focusedElement || content.document.body || document.documentElement,
|
||||
get defaultTarget() {
|
||||
return dactyl.focusedElement ||
|
||||
content.document.body ||
|
||||
document.documentElement;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if there's a known native key handler for the given
|
||||
@@ -1097,7 +1101,7 @@ var Events = Module("events", {
|
||||
events._macroKeys.pop();
|
||||
events.recording = arg;
|
||||
},
|
||||
{ get arg() !modes.recording });
|
||||
{ get arg() { return !modes.recording; }});
|
||||
|
||||
mappings.add([modes.COMMAND],
|
||||
["@", "<play-macro>"], "Play a macro",
|
||||
@@ -1140,7 +1144,7 @@ var Events = Module("events", {
|
||||
}
|
||||
},
|
||||
|
||||
get active() this.stack.length,
|
||||
get active() { return this.stack.length; },
|
||||
|
||||
get: function get(mode, key) this.stack.mappings[key],
|
||||
|
||||
@@ -1158,7 +1162,7 @@ var Events = Module("events", {
|
||||
|
||||
has: function (key) this.pass.has(key) || hasOwnProperty(this.commandHive.stack.mappings, key),
|
||||
|
||||
get pass() (this.flush(), this.pass),
|
||||
get pass() { this.flush(); return this.pass; },
|
||||
|
||||
parse: function parse() {
|
||||
let value = parse.superapply(this, arguments);
|
||||
|
||||
+11
-8
@@ -10,7 +10,7 @@
|
||||
/** @instance hints */
|
||||
|
||||
var HintSession = Class("HintSession", CommandMode, {
|
||||
get extendedMode() modes.HINTS,
|
||||
get extendedMode() { return modes.HINTS; },
|
||||
|
||||
init: function init(mode, opts={}) {
|
||||
init.supercall(this);
|
||||
@@ -54,13 +54,16 @@ var HintSession = Class("HintSession", CommandMode, {
|
||||
this.checkUnique();
|
||||
},
|
||||
|
||||
get docs() this._docs = this._docs.filter(({ doc }) => !Cu.isDeadWrapper(doc)),
|
||||
get docs() {
|
||||
return this._docs = this._docs.filter(({ doc }) =>
|
||||
!Cu.isDeadWrapper(doc));
|
||||
},
|
||||
set docs(docs) {
|
||||
this._docs = docs;
|
||||
},
|
||||
|
||||
Hint: {
|
||||
get active() this._active,
|
||||
get active() { return this._active; },
|
||||
set active(val) {
|
||||
this._active = val;
|
||||
if (val)
|
||||
@@ -73,7 +76,7 @@ var HintSession = Class("HintSession", CommandMode, {
|
||||
hints.setClass(this.imgSpan, this.valid ? val : null);
|
||||
},
|
||||
|
||||
get ambiguous() this.span.hasAttribute("ambiguous"),
|
||||
get ambiguous() { return this.span.hasAttribute("ambiguous"); },
|
||||
set ambiguous(val) {
|
||||
let meth = val ? "setAttribute" : "removeAttribute";
|
||||
this.elem[meth]("ambiguous", "true");
|
||||
@@ -82,7 +85,7 @@ var HintSession = Class("HintSession", CommandMode, {
|
||||
this.imgSpan[meth]("ambiguous", "true");
|
||||
},
|
||||
|
||||
get valid() this._valid,
|
||||
get valid() { return this._valid; },
|
||||
set valid(val) {
|
||||
this._valid = val,
|
||||
|
||||
@@ -93,9 +96,9 @@ var HintSession = Class("HintSession", CommandMode, {
|
||||
}
|
||||
},
|
||||
|
||||
get mode() modes.HINTS,
|
||||
get mode() { return modes.HINTS; },
|
||||
|
||||
get prompt() ["Question", UTF8(this.hintMode.prompt) + ": "],
|
||||
get prompt() { return ["Question", UTF8(this.hintMode.prompt) + ": "]; },
|
||||
|
||||
leave: function leave(stack) {
|
||||
leave.superapply(this, arguments);
|
||||
@@ -142,7 +145,7 @@ var HintSession = Class("HintSession", CommandMode, {
|
||||
},
|
||||
|
||||
_escapeNumbers: false,
|
||||
get escapeNumbers() this._escapeNumbers,
|
||||
get escapeNumbers() { return this._escapeNumbers; },
|
||||
set escapeNumbers(val) {
|
||||
this.clearTimeout();
|
||||
this._escapeNumbers = !!val;
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
var History = Module("history", {
|
||||
SORT_DEFAULT: "-date",
|
||||
|
||||
get format() bookmarks.format,
|
||||
get format() { return bookmarks.format; },
|
||||
|
||||
get service() services.history,
|
||||
get service() { return services.history; },
|
||||
|
||||
get: function get(filter, maxItems, sort=this.SORT_DEFAULT) {
|
||||
if (isString(filter))
|
||||
@@ -310,7 +310,7 @@ var History = Module("history", {
|
||||
jumps = jumps.locations.map(l => ({
|
||||
__proto__: l,
|
||||
title: buffer.title,
|
||||
get URI() util.newURI(this.location)
|
||||
get URI() { return util.newURI(this.location); }
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -224,11 +224,14 @@ var KeyProcessor = Class("KeyProcessor", {
|
||||
this.wantCount = this.main.count;
|
||||
},
|
||||
|
||||
get toStringParams() [this.main.name, this.hive.name],
|
||||
get toStringParams() { return [this.main.name, this.hive.name]; },
|
||||
|
||||
countStr: "",
|
||||
command: "",
|
||||
get count() this.countStr ? Number(this.countStr) : this.main.params.count || null,
|
||||
get count() {
|
||||
return this.countStr ? Number(this.countStr)
|
||||
: this.main.params.count || null;
|
||||
},
|
||||
|
||||
append: function append(event) {
|
||||
this.events.push(event);
|
||||
|
||||
@@ -50,10 +50,15 @@ var Map = Class("Map", {
|
||||
/** @property {[string]} All of this mapping's names (key sequences). */
|
||||
names: Class.Memoize(function () this._keys.map(k => DOM.Event.canonicalKeys(k))),
|
||||
|
||||
get toStringParams() [this.modes.map(m => m.name),
|
||||
this.names.map(JSON.stringify)],
|
||||
get toStringParams() {
|
||||
return [this.modes.map(m => m.name),
|
||||
this.names.map(JSON.stringify)];
|
||||
},
|
||||
|
||||
get identifier() [this.modes[0].name, this.hive.prefix + this.names[0]].join("."),
|
||||
get identifier() {
|
||||
return [this.modes[0].name, this.hive.prefix + this.names[0]]
|
||||
.join(".");
|
||||
},
|
||||
|
||||
/** @property {number} A unique ID for this mapping. */
|
||||
id: null,
|
||||
@@ -107,7 +112,7 @@ var Map = Class("Map", {
|
||||
*/
|
||||
hasName: function (name) this.keys.indexOf(name) >= 0,
|
||||
|
||||
get keys() Ary.flatten(this.names.map(mappings.bound.expand)),
|
||||
get keys() { return Ary.flatten(this.names.map(mappings.bound.expand)); },
|
||||
|
||||
/**
|
||||
* Execute the action for this mapping.
|
||||
@@ -286,8 +291,8 @@ var MapHive = Class("MapHive", Contexts.Hive, {
|
||||
|
||||
"@@iterator": function () Ary.iterValues(this),
|
||||
|
||||
get candidates() this.states.candidates,
|
||||
get mappings() this.states.mappings,
|
||||
get candidates() { return this.states.candidates; },
|
||||
get mappings() { return this.states.mappings; },
|
||||
|
||||
add: function (map) {
|
||||
this.push(map);
|
||||
@@ -349,9 +354,9 @@ var Mappings = Module("mappings", {
|
||||
|
||||
repeat: Modes.boundProperty(),
|
||||
|
||||
get allHives() contexts.allGroups.mappings,
|
||||
get allHives() { return contexts.allGroups.mappings; },
|
||||
|
||||
get userHives() this.allHives.filter(h => h !== this.builtin),
|
||||
get userHives() { return this.allHives.filter(h => h !== this.builtin); },
|
||||
|
||||
expandLeader: deprecated("your brain", function expandLeader(keyString) keyString),
|
||||
|
||||
@@ -557,7 +562,7 @@ var Mappings = Module("mappings", {
|
||||
count: args["-count"] || !(args["-ex"] || args["-javascript"]),
|
||||
noremap: args["-builtin"],
|
||||
persist: !args["-nopersist"],
|
||||
get rhs() String(this.action),
|
||||
get rhs() { return String(this.action); },
|
||||
silent: args["-silent"]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -28,12 +28,16 @@ var Marks = Module("marks", {
|
||||
* @property {Array} Returns all marks, both local and URL, in a sorted
|
||||
* array.
|
||||
*/
|
||||
get all() iter(this._localMarks.get(this.localURI) || {},
|
||||
get all() {
|
||||
return iter(this._localMarks.get(this.localURI) || {},
|
||||
this._urlMarks
|
||||
).sort((a, b) => String.localeCompare(a[0], b[0]))
|
||||
.toArray(),
|
||||
.toArray();
|
||||
},
|
||||
|
||||
get localURI() buffer.focusedFrame.document.documentURI.replace(/#.*/, ""),
|
||||
get localURI() {
|
||||
return buffer.focusedFrame.document.documentURI.replace(/#.*/, "");
|
||||
},
|
||||
|
||||
Mark: function Mark(params={}) {
|
||||
let win = buffer.focusedFrame;
|
||||
|
||||
+34
-21
@@ -57,8 +57,12 @@ var Modes = Module("modes", {
|
||||
bases: [this.NORMAL]
|
||||
}, {
|
||||
|
||||
get pref() prefs.get("accessibility.browsewithcaret"),
|
||||
set pref(val) prefs.set("accessibility.browsewithcaret", val),
|
||||
get pref() {
|
||||
return prefs.get("accessibility.browsewithcaret");
|
||||
},
|
||||
set pref(val) {
|
||||
prefs.set("accessibility.browsewithcaret", val);
|
||||
},
|
||||
|
||||
enter: function (stack) {
|
||||
if (stack.pop && !this.pref)
|
||||
@@ -196,17 +200,22 @@ var Modes = Module("modes", {
|
||||
|
||||
"@@iterator": function __iterator__() Ary.iterValues(this.all),
|
||||
|
||||
get all() this._modes.slice(),
|
||||
get all() { return this._modes.slice(); },
|
||||
|
||||
get mainModes() (mode
|
||||
get mainModes() {
|
||||
return (mode
|
||||
for ([k, mode] of iter(modes._modeMap))
|
||||
if (!mode.extended && mode.name == k)),
|
||||
if (!mode.extended && mode.name == k));
|
||||
},
|
||||
|
||||
get mainMode() this._modeMap[this._main],
|
||||
get mainMode() { return this._modeMap[this._main]; },
|
||||
|
||||
get passThrough() !!(this.main & (this.PASS_THROUGH|this.QUOTE)) ^ (this.getStack(1).main === this.PASS_THROUGH),
|
||||
get passThrough() {
|
||||
return !!(this.main & (this.PASS_THROUGH|this.QUOTE)) ^
|
||||
(this.getStack(1).main === this.PASS_THROUGH);
|
||||
},
|
||||
|
||||
get topOfStack() this._modeStack[this._modeStack.length - 1],
|
||||
get topOfStack() { return this._modeStack[this._modeStack.length - 1]; },
|
||||
|
||||
addMode: function addMode(name, options, params) {
|
||||
let mode = Modes.Mode(name, options, params);
|
||||
@@ -246,7 +255,7 @@ var Modes = Module("modes", {
|
||||
|
||||
getStack: function getStack(idx) this._modeStack[this._modeStack.length - idx - 1] || this._modeStack[0],
|
||||
|
||||
get stack() this._modeStack.slice(),
|
||||
get stack() { return this._modeStack.slice(); },
|
||||
|
||||
getCharModes: function getCharModes(chr) (this.modeChars[chr] || []).slice(),
|
||||
|
||||
@@ -410,16 +419,16 @@ var Modes = Module("modes", {
|
||||
this.pop();
|
||||
},
|
||||
|
||||
get recording() this._recording,
|
||||
get recording() { return this._recording; },
|
||||
set recording(value) { this._recording = value; this.show(); },
|
||||
|
||||
get replaying() this._replaying,
|
||||
get replaying() { return this._replaying; },
|
||||
set replaying(value) { this._replaying = value; this.show(); },
|
||||
|
||||
get main() this._main,
|
||||
get main() { return this._main; },
|
||||
set main(value) { this.set(value); },
|
||||
|
||||
get extended() this._extended,
|
||||
get extended() { return this._extended; },
|
||||
set extended(value) { this.set(null, value); }
|
||||
}, {
|
||||
Mode: Class("Mode", {
|
||||
@@ -455,9 +464,9 @@ var Modes = Module("modes", {
|
||||
return res;
|
||||
}),
|
||||
|
||||
get bases() this.input ? [modes.INPUT] : [modes.MAIN],
|
||||
get bases() { return this.input ? [modes.INPUT] : [modes.MAIN]; },
|
||||
|
||||
get count() !this.insert,
|
||||
get count() { return !this.insert; },
|
||||
|
||||
_display: Class.Memoize(function _display() this.name.replace(/_/g, " ")),
|
||||
|
||||
@@ -477,9 +486,9 @@ var Modes = Module("modes", {
|
||||
|
||||
passUnknown: Class.Memoize(function () options.get("passunknown").getKey(this.name)),
|
||||
|
||||
get mask() this,
|
||||
get mask() { return this; },
|
||||
|
||||
get toStringParams() [this.name],
|
||||
get toStringParams() { return [this.name]; },
|
||||
|
||||
valueOf: function valueOf() this.id
|
||||
}, {
|
||||
@@ -499,13 +508,15 @@ var Modes = Module("modes", {
|
||||
StackElement.defaultValue("params", function () this.main.params);
|
||||
|
||||
update(StackElement.prototype, {
|
||||
get toStringParams() !loaded.has("modes") ? [this.main.name] : [
|
||||
get toStringParams() {
|
||||
return !loaded.has("modes") ? [this.main.name] : [
|
||||
this.main.name,
|
||||
["(", modes.all.filter(m => this.extended & m)
|
||||
.map(m => m.name)
|
||||
.join("|"),
|
||||
")"].join("")
|
||||
]
|
||||
];
|
||||
}
|
||||
});
|
||||
return StackElement;
|
||||
})(),
|
||||
@@ -633,8 +644,10 @@ var Modes = Module("modes", {
|
||||
validator: function validator(vals) vals.map(v => v.replace(/^!/, ""))
|
||||
.every(k => hasOwnProperty(this.values, k)),
|
||||
|
||||
get values() Ary.toObject([[m.name.toLowerCase(), m.description]
|
||||
for (m of modes._modes) if (!m.hidden)])
|
||||
get values() {
|
||||
return Ary.toObject([[m.name.toLowerCase(), m.description]
|
||||
for (m of modes._modes) if (!m.hidden)]);
|
||||
}
|
||||
};
|
||||
|
||||
options.add(["passunknown", "pu"],
|
||||
|
||||
@@ -68,13 +68,13 @@ var MOW = Module("mow", {
|
||||
|
||||
__noSuchMethod__: function (meth, args) apply(Buffer, meth, [this.body].concat(args)),
|
||||
|
||||
get widget() this.widgets.multilineOutput,
|
||||
get widget() { return this.widgets.multilineOutput; },
|
||||
|
||||
widgets: Class.Memoize(function widgets() commandline.widgets),
|
||||
|
||||
body: Class.Memoize(function body() this.widget.contentDocument.documentElement),
|
||||
get document() this.widget.contentDocument,
|
||||
get window() this.widget.contentWindow,
|
||||
get document() { return this.widget.contentDocument; },
|
||||
get window() { return this.widget.contentWindow; },
|
||||
|
||||
/**
|
||||
* Display a multi-line message.
|
||||
|
||||
@@ -110,7 +110,9 @@ var StatusLine = Module("statusline", {
|
||||
})(prepend);
|
||||
|
||||
overlay.overlayWindow(window, {
|
||||
objects: this.widgets = { get status() this.container },
|
||||
objects: this.widgets = {
|
||||
get status() { return this.container; }
|
||||
},
|
||||
prepend: prepend
|
||||
});
|
||||
|
||||
@@ -125,7 +127,9 @@ var StatusLine = Module("statusline", {
|
||||
CustomizableUI.unregisterArea(this.statusBar.id, false);
|
||||
},
|
||||
|
||||
get visible() !this.statusBar.collapsed && !this.statusBar.hidden,
|
||||
get visible() {
|
||||
return !this.statusBar.collapsed && !this.statusBar.hidden;
|
||||
},
|
||||
|
||||
signals: {
|
||||
"browser.locationChange": function (webProgress, request, uri) {
|
||||
@@ -223,7 +227,7 @@ var StatusLine = Module("statusline", {
|
||||
|
||||
highlight.highlightNode(this.statusBar, this.baseGroup + highlightGroup[type]);
|
||||
},
|
||||
get security() this._security,
|
||||
get security() { return this._security; },
|
||||
|
||||
// update all fields of the statusline
|
||||
update: function update() {
|
||||
@@ -246,7 +250,7 @@ var StatusLine = Module("statusline", {
|
||||
*
|
||||
* @param {string} url The URL to display.
|
||||
*/
|
||||
get status() this._uri,
|
||||
get status() { return this._uri; },
|
||||
set status(uri) {
|
||||
let modified = "";
|
||||
let url = uri;
|
||||
@@ -285,7 +289,7 @@ var StatusLine = Module("statusline", {
|
||||
this._status = uri;
|
||||
},
|
||||
|
||||
get bookmarked() this._bookmarked,
|
||||
get bookmarked() { return this._bookmarked; },
|
||||
set bookmarked(val) {
|
||||
this._bookmarked = val;
|
||||
if (this.status)
|
||||
@@ -309,8 +313,10 @@ var StatusLine = Module("statusline", {
|
||||
* @param {string} buffer
|
||||
* @optional
|
||||
*/
|
||||
get inputBuffer() this.widgets.inputbuffer.value,
|
||||
set inputBuffer(val) this.widgets.inputbuffer.value = val == null ? "" : val,
|
||||
get inputBuffer() { return this.widgets.inputbuffer.value; },
|
||||
set inputBuffer(val) {
|
||||
this.widgets.inputbuffer.value = val == null ? "" : val;
|
||||
},
|
||||
updateInputBuffer: deprecated("statusline.inputBuffer", function updateInputBuffer(val) { this.inputBuffer = val; }),
|
||||
|
||||
/**
|
||||
|
||||
+21
-9
@@ -88,7 +88,9 @@ var Tabs = Module("tabs", {
|
||||
document).appendTo(img.parentNode);
|
||||
|
||||
update(tab, {
|
||||
get dactylOrdinal() Number(dom.nodes.icon.value),
|
||||
get dactylOrdinal() {
|
||||
return Number(dom.nodes.icon.value);
|
||||
},
|
||||
set dactylOrdinal(i) {
|
||||
dom.nodes.icon.value = dom.nodes.label.textContent = i;
|
||||
this.setAttribute("dactylOrdinal", i);
|
||||
@@ -109,13 +111,18 @@ var Tabs = Module("tabs", {
|
||||
this.updateSelectionHistory();
|
||||
},
|
||||
|
||||
get allTabs() Array.slice(config.tabbrowser.tabContainer.childNodes),
|
||||
get allTabs() {
|
||||
return Array.slice(config.tabbrowser.tabContainer.childNodes);
|
||||
},
|
||||
|
||||
/**
|
||||
* @property {Object} The previously accessed tab or null if no tab
|
||||
* other than the current one has been accessed.
|
||||
*/
|
||||
get alternate() this.allTabs.indexOf(this._alternates[1]) > -1 ? this._alternates[1] : null,
|
||||
get alternate() {
|
||||
let alt = this._alternates[1];
|
||||
return this.allTabs.indexOf(alt) > -1 ? alt : null;
|
||||
},
|
||||
|
||||
/**
|
||||
* @property {Iterator(Object)} A genenerator that returns all browsers
|
||||
@@ -131,14 +138,17 @@ var Tabs = Module("tabs", {
|
||||
/**
|
||||
* @property {number} The number of tabs in the current window.
|
||||
*/
|
||||
get count() config.tabbrowser.mTabs.length,
|
||||
get count() { return config.tabbrowser.mTabs.length; },
|
||||
|
||||
/**
|
||||
* @property {Object} The local options store for the current tab.
|
||||
*/
|
||||
get options() this.localStore.options,
|
||||
get options() { return this.localStore.options; },
|
||||
|
||||
get visibleTabs() config.tabbrowser.visibleTabs || this.allTabs.filter(tab => !tab.hidden),
|
||||
get visibleTabs() {
|
||||
return config.tabbrowser.visibleTabs ||
|
||||
this.allTabs.filter(tab => !tab.hidden);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the local state store for the tab at the specified *tabIndex*.
|
||||
@@ -163,18 +173,20 @@ var Tabs = Module("tabs", {
|
||||
* @property {Object} The local state store for the currently selected
|
||||
* tab.
|
||||
*/
|
||||
get localStore() this.getLocalStore(),
|
||||
get localStore() { return this.getLocalStore(); },
|
||||
|
||||
localStorePrototype: memoize({
|
||||
instance: {},
|
||||
get options() ({})
|
||||
get options() { return {}; }
|
||||
}),
|
||||
|
||||
/**
|
||||
* @property {[Object]} The array of closed tabs for the current
|
||||
* session.
|
||||
*/
|
||||
get closedTabs() JSON.parse(services.sessionStore.getClosedTabData(window)),
|
||||
get closedTabs() {
|
||||
return JSON.parse(services.sessionStore.getClosedTabData(window));
|
||||
},
|
||||
|
||||
/**
|
||||
* Clones the specified *tab* and append it to the tab list.
|
||||
|
||||
@@ -1028,8 +1028,8 @@ Class.prototype = {
|
||||
*/
|
||||
init: function c_init() {},
|
||||
|
||||
get instance() ({}),
|
||||
set instance(val) Class.replaceProperty(this, "instance", val),
|
||||
get instance() { return {}; },
|
||||
set instance(val) { Class.replaceProperty(this, "instance", val); },
|
||||
|
||||
withSavedValues: function withSavedValues(names, callback, self) {
|
||||
let vals = names.map(name => this[name]);
|
||||
@@ -1173,7 +1173,7 @@ var closureHooks = {
|
||||
return {
|
||||
configurable: false,
|
||||
writable: false,
|
||||
get value() self.get(target, prop)
|
||||
get value() { return self.get(target, prop); }
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1365,7 +1365,7 @@ var StructBase = Class("StructBase", Array, {
|
||||
this[i] = arguments[i];
|
||||
},
|
||||
|
||||
get toStringParams() this,
|
||||
get toStringParams() { return this; },
|
||||
|
||||
clone: function struct_clone() this.constructor.apply(null, this.slice()),
|
||||
|
||||
|
||||
@@ -24,12 +24,14 @@ var Bookmark = Struct("url", "title", "icon", "post", "keyword", "tags", "charse
|
||||
var Keyword = Struct("keyword", "title", "icon", "url");
|
||||
Bookmark.defaultValue("icon", function () BookmarkCache.getFavicon(this.url));
|
||||
update(Bookmark.prototype, {
|
||||
get extra() [
|
||||
get extra() {
|
||||
return [
|
||||
["keyword", this.keyword, "Keyword"],
|
||||
["tags", this.tags.join(", "), "Tag"]
|
||||
].filter(item => item[1]),
|
||||
].filter(item => item[1]);
|
||||
},
|
||||
|
||||
get uri() newURI(this.url),
|
||||
get uri() { return newURI(this.url); },
|
||||
set uri(uri) {
|
||||
let tags = this.tags;
|
||||
this.tags = null;
|
||||
|
||||
+58
-35
@@ -47,9 +47,9 @@ var Buffer = Module("Buffer", {
|
||||
this.win = win;
|
||||
},
|
||||
|
||||
get addPageInfoSection() Buffer.bound.addPageInfoSection,
|
||||
get addPageInfoSection() { return Buffer.bound.addPageInfoSection; },
|
||||
|
||||
get pageInfo() Buffer.pageInfo,
|
||||
get pageInfo() { return Buffer.pageInfo; },
|
||||
|
||||
// called when the active document is scrolled
|
||||
_updateBufferPosition: function _updateBufferPosition() {
|
||||
@@ -73,7 +73,7 @@ var Buffer = Module("Buffer", {
|
||||
/**
|
||||
* The load context of the window bound to this buffer.
|
||||
*/
|
||||
get loadContext() sanitizer.getContext(this.win),
|
||||
get loadContext() { return sanitizer.getContext(this.win); },
|
||||
|
||||
/**
|
||||
* Content preference methods.
|
||||
@@ -211,10 +211,12 @@ var Buffer = Module("Buffer", {
|
||||
/**
|
||||
* @property {number} True when the buffer is fully loaded.
|
||||
*/
|
||||
get loaded() apply(Math, "min",
|
||||
get loaded() {
|
||||
return apply(Math, "min",
|
||||
this.allFrames()
|
||||
.map(frame => ["loading", "interactive", "complete"]
|
||||
.indexOf(frame.document.readyState))),
|
||||
.indexOf(frame.document.readyState)));
|
||||
},
|
||||
|
||||
/**
|
||||
* @property {Object} The local state store for the currently selected
|
||||
@@ -231,7 +233,7 @@ var Buffer = Module("Buffer", {
|
||||
|
||||
localStorePrototype: memoize({
|
||||
instance: {},
|
||||
get jumps() [],
|
||||
get jumps() { return []; },
|
||||
jumpsIndex: -1
|
||||
}),
|
||||
|
||||
@@ -251,11 +253,11 @@ var Buffer = Module("Buffer", {
|
||||
/**
|
||||
* @property {nsIURI} The current top-level document.
|
||||
*/
|
||||
get doc() this.win.document,
|
||||
get doc() { return this.win.document; },
|
||||
|
||||
get docShell() util.docShell(this.win),
|
||||
get docShell() { return util.docShell(this.win); },
|
||||
|
||||
get modules() this.topWindow.dactyl.modules,
|
||||
get modules() { return this.topWindow.dactyl.modules; },
|
||||
set modules(val) {},
|
||||
|
||||
topWindow: Class.Memoize(function () util.topWindow(this.win)),
|
||||
@@ -263,7 +265,7 @@ var Buffer = Module("Buffer", {
|
||||
/**
|
||||
* @property {nsIURI} The current top-level document's URI.
|
||||
*/
|
||||
get uri() util.newURI(this.win.location.href),
|
||||
get uri() { return util.newURI(this.win.location.href); },
|
||||
|
||||
/**
|
||||
* @property {nsIURI} The current top-level document's URI, sans
|
||||
@@ -280,20 +282,29 @@ var Buffer = Module("Buffer", {
|
||||
* @property {nsIURI} The current top-level document's URI, sans any
|
||||
* fragment identifier.
|
||||
*/
|
||||
get documentURI() this.doc.documentURIObject || util.newURI(this.doc.documentURI),
|
||||
get documentURI() {
|
||||
return this.doc.documentURIObject ||
|
||||
util.newURI(this.doc.documentURI);
|
||||
},
|
||||
|
||||
/**
|
||||
* @property {string} The current top-level document's URL.
|
||||
*/
|
||||
get URL() update(new String(this.win.location.href), util.newURI(this.win.location.href)),
|
||||
get URL() {
|
||||
return update(new String(this.win.location.href),
|
||||
util.newURI(this.win.location.href));
|
||||
},
|
||||
|
||||
/**
|
||||
* @property {number} The buffer's height in pixels.
|
||||
*/
|
||||
get pageHeight() this.win.innerHeight,
|
||||
get pageHeight() { return this.win.innerHeight; },
|
||||
|
||||
get contentViewer() this.docShell.contentViewer
|
||||
.QueryInterface(Ci.nsIMarkupDocumentViewer || Ci.nsIContentViewer),
|
||||
get contentViewer() {
|
||||
return this.docShell.contentViewer
|
||||
.QueryInterface(Ci.nsIMarkupDocumentViewer ||
|
||||
Ci.nsIContentViewer);
|
||||
},
|
||||
|
||||
/**
|
||||
* @property {number} The current browser's zoom level, as a
|
||||
@@ -309,15 +320,15 @@ var Buffer = Module("Buffer", {
|
||||
* @property {boolean} Whether the current browser is using full
|
||||
* zoom, as opposed to text zoom.
|
||||
*/
|
||||
get fullZoom() this.ZoomManager.useFullZoom,
|
||||
get fullZoom() { return this.ZoomManager.useFullZoom; },
|
||||
set fullZoom(value) { this.setZoom(this.zoomLevel, value); },
|
||||
|
||||
get ZoomManager() this.topWindow.ZoomManager,
|
||||
get ZoomManager() { return this.topWindow.ZoomManager; },
|
||||
|
||||
/**
|
||||
* @property {string} The current document's title.
|
||||
*/
|
||||
get title() this.doc.title,
|
||||
get title() { return this.doc.title; },
|
||||
|
||||
/**
|
||||
* @property {number} The buffer's horizontal scroll percentile.
|
||||
@@ -343,7 +354,9 @@ var Buffer = Module("Buffer", {
|
||||
* @property {{ x: number, y: number }} The buffer's current scroll position
|
||||
* as reported by {@link Buffer.getScrollPosition}.
|
||||
*/
|
||||
get scrollPosition() Buffer.getScrollPosition(this.findScrollable(0, false)),
|
||||
get scrollPosition() {
|
||||
return Buffer.getScrollPosition(this.findScrollable(0, false));
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a list of all frames in the given window or current buffer.
|
||||
@@ -380,7 +393,7 @@ var Buffer = Module("Buffer", {
|
||||
*
|
||||
* @returns {string}
|
||||
*/
|
||||
get currentWord() Buffer.currentWord(this.focusedFrame),
|
||||
get currentWord() { return Buffer.currentWord(this.focusedFrame); },
|
||||
getCurrentWord: deprecated("buffer.currentWord", function getCurrentWord() Buffer.currentWord(this.focusedFrame, true)),
|
||||
|
||||
/**
|
||||
@@ -694,13 +707,15 @@ var Buffer = Module("Buffer", {
|
||||
/**
|
||||
* @property {nsISelection} The current document's normal selection.
|
||||
*/
|
||||
get selection() this.win.getSelection(),
|
||||
get selection() { return this.win.getSelection(); },
|
||||
|
||||
/**
|
||||
* @property {nsISelectionController} The current document's selection
|
||||
* controller.
|
||||
*/
|
||||
get selectionController() util.selectionController(this.focusedFrame),
|
||||
get selectionController() {
|
||||
return util.selectionController(this.focusedFrame);
|
||||
},
|
||||
|
||||
/**
|
||||
* @property {string|null} The canonical short URL for the current
|
||||
@@ -1458,26 +1473,34 @@ var Buffer = Module("Buffer", {
|
||||
|
||||
win: elem.defaultView || elem.ownerDocument.defaultView,
|
||||
|
||||
get clientWidth() this.win.innerWidth,
|
||||
get clientHeight() this.win.innerHeight,
|
||||
get clientWidth() { return this.win.innerWidth; },
|
||||
get clientHeight() { return this.win.innerHeight; },
|
||||
|
||||
get scrollWidth() this.win.scrollMaxX + this.win.innerWidth,
|
||||
get scrollHeight() this.win.scrollMaxY + this.win.innerHeight,
|
||||
get scrollWidth() {
|
||||
return this.win.scrollMaxX + this.win.innerWidth;
|
||||
},
|
||||
get scrollHeight() {
|
||||
return this.win.scrollMaxY + this.win.innerHeight;
|
||||
},
|
||||
|
||||
get scrollLeftMax() this.win.scrollMaxX,
|
||||
get scrollRightMax() this.win.scrollMaxY,
|
||||
get scrollLeftMax() { return this.win.scrollMaxX; },
|
||||
get scrollRightMax() { return this.win.scrollMaxY; },
|
||||
|
||||
get scrollLeft() this.win.scrollX,
|
||||
set scrollLeft(val) { this.win.scrollTo(val, this.win.scrollY); },
|
||||
get scrollLeft() { return this.win.scrollX; },
|
||||
set scrollLeft(val) {
|
||||
this.win.scrollTo(val, this.win.scrollY);
|
||||
},
|
||||
|
||||
get scrollTop() this.win.scrollY,
|
||||
set scrollTop(val) { this.win.scrollTo(this.win.scrollX, val); }
|
||||
get scrollTop() { return this.win.scrollY; },
|
||||
set scrollTop(val) {
|
||||
this.win.scrollTo(this.win.scrollX, val);
|
||||
}
|
||||
};
|
||||
return elem;
|
||||
},
|
||||
|
||||
get ZOOM_MIN() prefs.get("zoom.minPercent"),
|
||||
get ZOOM_MAX() prefs.get("zoom.maxPercent"),
|
||||
get ZOOM_MIN() { return prefs.get("zoom.minPercent"); },
|
||||
get ZOOM_MAX() { return prefs.get("zoom.maxPercent"); },
|
||||
|
||||
setZoom: deprecated("buffer.setZoom",
|
||||
function setZoom(...args) apply(overlay.activeModules.buffer, "setZoom", args)),
|
||||
@@ -2565,7 +2588,7 @@ var Buffer = Module("Buffer", {
|
||||
options.add(["pageinfo", "pa"],
|
||||
"Define which sections are shown by the :pageinfo command",
|
||||
"charlist", "gesfm",
|
||||
{ get values() values(Buffer.pageInfo).toObject() });
|
||||
{ get values() { return values(Buffer.pageInfo).toObject(); }});
|
||||
|
||||
options.add(["scroll", "scr"],
|
||||
"Number of lines to scroll with <C-u> and <C-d> commands",
|
||||
|
||||
@@ -97,7 +97,7 @@ var Cache = Module("Cache", XPCOM(Ci.nsIRequestObserver), {
|
||||
return this._cacheReader;
|
||||
},
|
||||
|
||||
get inQueue() this._cacheWriter && this._cacheWriter.inQueue,
|
||||
get inQueue() { return this._cacheWriter && this._cacheWriter.inQueue; },
|
||||
|
||||
getCacheWriter: function () {
|
||||
if (!this._cacheWriter)
|
||||
|
||||
+21
-14
@@ -140,13 +140,15 @@ var Command = Class("Command", {
|
||||
this.update(extraInfo);
|
||||
},
|
||||
|
||||
get toStringParams() [this.name, this.hive.name],
|
||||
get toStringParams() { return [this.name, this.hive.name]; },
|
||||
|
||||
get identifier() this.hive.prefix + this.name,
|
||||
get identifier() { return this.hive.prefix + this.name; },
|
||||
|
||||
get helpTag() ":" + this.name,
|
||||
get helpTag() { return ":" + this.name; },
|
||||
|
||||
get lastCommand() this._lastCommand || this.modules.commandline.command,
|
||||
get lastCommand() {
|
||||
return this._lastCommand || this.modules.commandline.command;
|
||||
},
|
||||
set lastCommand(val) { this._lastCommand = val; },
|
||||
|
||||
/**
|
||||
@@ -326,7 +328,10 @@ var Command = Class("Command", {
|
||||
has: function AP_has(opt) hasOwnProperty(this.explicitOpts, opt)
|
||||
|| typeof opt === "number" && hasOwnProperty(this, opt),
|
||||
|
||||
get literalArg() this.command.literal != null && this[this.command.literal] || "",
|
||||
get literalArg() {
|
||||
let { literal } = this.command;
|
||||
return literal != null && this[literal] || "";
|
||||
},
|
||||
|
||||
// TODO: string: Class.Memoize(function () { ... }),
|
||||
|
||||
@@ -431,8 +436,8 @@ var Command = Class("Command", {
|
||||
// Prototype.
|
||||
var Ex = Module("Ex", {
|
||||
Local: function Local(dactyl, modules, window) ({
|
||||
get commands() modules.commands,
|
||||
get context() modules.contexts.context
|
||||
get commands() { return modules.commands; },
|
||||
get context() { return modules.contexts.context; }
|
||||
}),
|
||||
|
||||
_args: function E_args(cmd, args) {
|
||||
@@ -528,7 +533,7 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
|
||||
}
|
||||
},
|
||||
|
||||
get cacheKey() "commands/hives/" + this.name + ".json",
|
||||
get cacheKey() { return "commands/hives/" + this.name + ".json"; },
|
||||
|
||||
/** @property {Iterator(Command)} @private */
|
||||
"@@iterator": function __iterator__() {
|
||||
@@ -678,13 +683,15 @@ var Commands = Module("commands", {
|
||||
this.modules.moduleManager.initDependencies("commands");
|
||||
},
|
||||
|
||||
get context() contexts.context,
|
||||
get context() { return contexts.context; },
|
||||
|
||||
get readHeredoc() modules.io.readHeredoc,
|
||||
get readHeredoc() { return modules.io.readHeredoc; },
|
||||
|
||||
get allHives() contexts.allGroups.commands,
|
||||
get allHives() { return contexts.allGroups.commands; },
|
||||
|
||||
get userHives() this.allHives.filter(h => h !== this.builtin),
|
||||
get userHives() {
|
||||
return this.allHives.filter(h => h !== this.builtin);
|
||||
},
|
||||
|
||||
/**
|
||||
* Executes an Ex command script.
|
||||
@@ -1391,10 +1398,10 @@ var Commands = Module("commands", {
|
||||
},
|
||||
|
||||
/** @property */
|
||||
get complQuote() Commands.complQuote,
|
||||
get complQuote() { return Commands.complQuote; },
|
||||
|
||||
/** @property */
|
||||
get quoteArg() Commands.quoteArg // XXX: better somewhere else?
|
||||
get quoteArg() { return Commands.quoteArg; } // XXX: better somewhere else?
|
||||
|
||||
}, {
|
||||
// returns [count, parsed_argument]
|
||||
|
||||
@@ -219,9 +219,11 @@ var CompletionContext = Class("CompletionContext", {
|
||||
delete this.__title;
|
||||
return this._title = val;
|
||||
},
|
||||
get title() this.__title,
|
||||
get title() { return this.__title; },
|
||||
|
||||
get activeContexts() this.contextList.filter(function f(c) c.items.length),
|
||||
get activeContexts() {
|
||||
return this.contextList.filter(function f(c) c.items.length);
|
||||
},
|
||||
|
||||
// Temporary
|
||||
/**
|
||||
@@ -248,9 +250,10 @@ var CompletionContext = Class("CompletionContext", {
|
||||
this.cache.allItemsResult = memoize({
|
||||
start: minStart,
|
||||
|
||||
get longestSubstring() self.longestAllSubstring,
|
||||
get longestSubstring() { return self.longestAllSubstring; },
|
||||
|
||||
get items() Ary.flatten(self.activeContexts.map(function m(context) {
|
||||
get items() {
|
||||
return Ary.flatten(self.activeContexts.map(function m(context) {
|
||||
let prefix = self.value.substring(minStart, context.offset);
|
||||
|
||||
return context.items.map(function m(item) ({
|
||||
@@ -258,7 +261,8 @@ var CompletionContext = Class("CompletionContext", {
|
||||
result: prefix + item.result,
|
||||
__proto__: item
|
||||
}));
|
||||
}))
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
||||
return this.cache.allItemsResult;
|
||||
@@ -292,13 +296,13 @@ var CompletionContext = Class("CompletionContext", {
|
||||
return this.allSubstrings.reduce(function r(a, b) a.length > b.length ? a : b, "");
|
||||
},
|
||||
|
||||
get caret() this._caret - this.offset,
|
||||
set caret(val) this._caret = val + this.offset,
|
||||
get caret() { return this._caret - this.offset; },
|
||||
set caret(val) { this._caret = val + this.offset; },
|
||||
|
||||
get compare() this._compare || function compare() 0,
|
||||
set compare(val) this._compare = val,
|
||||
get compare() { return this._compare || function compare() 0; },
|
||||
set compare(val) { this._compare = val; },
|
||||
|
||||
get completions() this._completions || [],
|
||||
get completions() { return this._completions || []; },
|
||||
set completions(items) {
|
||||
if (items && isArray(items.array))
|
||||
items = items.array;
|
||||
@@ -320,24 +324,29 @@ var CompletionContext = Class("CompletionContext", {
|
||||
util.trapErrors("onUpdate", this);
|
||||
},
|
||||
|
||||
get createRow() this._createRow || template.completionRow, // XXX
|
||||
set createRow(createRow) this._createRow = createRow,
|
||||
get createRow() { return this._createRow || template.completionRow; }, // XXX
|
||||
set createRow(createRow) { return this._createRow = createRow; },
|
||||
|
||||
get filterFunc() this._filterFunc || util.identity,
|
||||
set filterFunc(val) this._filterFunc = val,
|
||||
get filterFunc() { return this._filterFunc || util.identity; },
|
||||
set filterFunc(val) { this._filterFunc = val; },
|
||||
|
||||
get filter() this._filter != null ? this._filter : this.value.substr(this.offset, this.caret),
|
||||
get filter() {
|
||||
return this._filter != null ? this._filter
|
||||
: this.value.substr(this.offset, this.caret);
|
||||
},
|
||||
set filter(val) {
|
||||
delete this.ignoreCase;
|
||||
return this._filter = val;
|
||||
},
|
||||
|
||||
get format() ({
|
||||
get format() {
|
||||
return {
|
||||
anchored: this.anchored,
|
||||
title: this.title,
|
||||
keys: this.keys,
|
||||
process: this.process
|
||||
}),
|
||||
};
|
||||
},
|
||||
set format(format) {
|
||||
this.anchored = format.anchored,
|
||||
this.title = format.title || this.title;
|
||||
@@ -350,8 +359,8 @@ var CompletionContext = Class("CompletionContext", {
|
||||
* The message displayed at the head of the completions for the
|
||||
* current context.
|
||||
*/
|
||||
get message() this._message || (this.waitingForTab && this.hasItems !== false ? _("completion.waitingFor", "<Tab>") : null),
|
||||
set message(val) this._message = val,
|
||||
get message() { return this._message || (this.waitingForTab && this.hasItems !== false ? _("completion.waitingFor", "<Tab>") : null); },
|
||||
set message(val) { this._message = val; },
|
||||
|
||||
/**
|
||||
* The prototype object for items returned by {@link items}.
|
||||
@@ -387,7 +396,7 @@ var CompletionContext = Class("CompletionContext", {
|
||||
* must be regenerated. May be set to true to invalidate the current
|
||||
* completions.
|
||||
*/
|
||||
get regenerate() this._generate && (!this.completions || !this.itemCache[this.key] || this._cache.offset != this.offset),
|
||||
get regenerate() { return this._generate && (!this.completions || !this.itemCache[this.key] || this._cache.offset != this.offset); },
|
||||
set regenerate(val) { if (val) delete this.itemCache[this.key]; },
|
||||
|
||||
/**
|
||||
@@ -396,7 +405,7 @@ var CompletionContext = Class("CompletionContext", {
|
||||
* completions are linked to the value in {@link #key} and may be
|
||||
* invalidated by setting the {@link #regenerate} property.
|
||||
*/
|
||||
get generate() this._generate || null,
|
||||
get generate() { return this._generate || null; },
|
||||
set generate(arg) {
|
||||
this.hasItems = true;
|
||||
this._generate = arg;
|
||||
@@ -900,13 +909,13 @@ var Completion = Module("completion", {
|
||||
init: function init() {
|
||||
},
|
||||
|
||||
get setFunctionCompleter() JavaScript.setCompleter, // Backward compatibility
|
||||
get setFunctionCompleter() { return JavaScript.setCompleter; }, // Backward compatibility
|
||||
|
||||
Local: function Local(dactyl, modules, window) ({
|
||||
urlCompleters: {},
|
||||
|
||||
get modules() modules,
|
||||
get options() modules.options,
|
||||
get modules() { return modules; },
|
||||
get options() { return modules.options; },
|
||||
|
||||
// FIXME
|
||||
_runCompleter: function _runCompleter(name, filter, maxItems, ...args) {
|
||||
@@ -1054,7 +1063,7 @@ var Completion = Module("completion", {
|
||||
for (i of util.range(0, result.matchCount))
|
||||
];
|
||||
}),
|
||||
get onUpdateSearchResult() this.onSearchResult
|
||||
get onUpdateSearchResult() { return this.onSearchResult; }
|
||||
});
|
||||
running[provider] = true;
|
||||
}
|
||||
@@ -1118,7 +1127,7 @@ var Completion = Module("completion", {
|
||||
return init.superapply(this, arguments);
|
||||
},
|
||||
|
||||
get options() this.modules.options
|
||||
get options() { return this.modules.options; }
|
||||
});
|
||||
},
|
||||
commands: function initCommands(dactyl, modules, window) {
|
||||
|
||||
+34
-24
@@ -25,11 +25,11 @@ lazyRequire("util", ["util"]);
|
||||
|
||||
function AboutHandler() {}
|
||||
AboutHandler.prototype = {
|
||||
get classDescription() "About " + config.appName + " Page",
|
||||
get classDescription() { return "About " + config.appName + " Page"; },
|
||||
|
||||
classID: Components.ID("81495d80-89ee-4c36-a88d-ea7c4e5ac63f"),
|
||||
|
||||
get contractID() services.ABOUT + config.name,
|
||||
get contractID() { return services.ABOUT + config.name; },
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
|
||||
|
||||
@@ -79,7 +79,7 @@ var ConfigBase = Class("ConfigBase", {
|
||||
});
|
||||
},
|
||||
|
||||
get prefs() localPrefs,
|
||||
get prefs() { return localPrefs; },
|
||||
|
||||
has: function (feature) this.features.has(feature),
|
||||
|
||||
@@ -194,14 +194,14 @@ var ConfigBase = Class("ConfigBase", {
|
||||
};
|
||||
},
|
||||
|
||||
get addonID() this.name + "@dactyl.googlecode.com",
|
||||
get addonID() { return this.name + "@dactyl.googlecode.com"; },
|
||||
|
||||
addon: Class.Memoize(function () {
|
||||
return (JSMLoader.bootstrap || {}).addon ||
|
||||
AddonManager.getAddonByID(this.addonID);
|
||||
}),
|
||||
|
||||
get styleableChrome() Object.keys(this.overlays),
|
||||
get styleableChrome() { return Object.keys(this.overlays); },
|
||||
|
||||
/**
|
||||
* The current application locale.
|
||||
@@ -335,17 +335,23 @@ var ConfigBase = Class("ConfigBase", {
|
||||
* @property {string} The normalised name of the OS. This is one of
|
||||
* "Windows", "Mac OS X" or "Unix".
|
||||
*/
|
||||
get name() this.isWindows ? "Windows" : this.isMacOSX ? "Mac OS X" : "Unix",
|
||||
get name() {
|
||||
return this.isWindows ? "Windows"
|
||||
: this.isMacOSX ? "Mac OS X"
|
||||
: "Unix";
|
||||
},
|
||||
/** @property {boolean} True if the OS is Windows. */
|
||||
get isWindows() this._arch == "WINNT",
|
||||
get isWindows() { return this._arch == "WINNT"; },
|
||||
/** @property {boolean} True if the OS is Mac OS X. */
|
||||
get isMacOSX() this._arch == "Darwin",
|
||||
get isMacOSX() { return this._arch == "Darwin"; },
|
||||
/** @property {boolean} True if the OS is some other *nix variant. */
|
||||
get isUnix() !this.isWindows,
|
||||
get isUnix() { return !this.isWindows; },
|
||||
/** @property {RegExp} A RegExp which matches illegal characters in path components. */
|
||||
get illegalCharacters() this.isWindows ? /[<>:"/\\|?*\x00-\x1f]/g : /[\/\x00]/g,
|
||||
get illegalCharacters() {
|
||||
return this.isWindows ? /[<>:"/\\|?*\x00-\x1f]/g : /[\/\x00]/g;
|
||||
},
|
||||
|
||||
get pathListSep() this.isWindows ? ";" : ":"
|
||||
get pathListSep() { return this.isWindows ? ";" : ":"; }
|
||||
}),
|
||||
|
||||
/**
|
||||
@@ -407,7 +413,7 @@ var ConfigBase = Class("ConfigBase", {
|
||||
return _("dactyl.created", "@DATE@");
|
||||
}),
|
||||
|
||||
get fileExt() this.name.slice(0, -6),
|
||||
get fileExt() { return this.name.slice(0, -6); },
|
||||
|
||||
dtd: Class.Memoize(function ()
|
||||
iter(this.dtdExtra,
|
||||
@@ -416,13 +422,15 @@ var ConfigBase = Class("ConfigBase", {
|
||||
.toObject()),
|
||||
|
||||
dtdDactyl: memoize({
|
||||
get name() config.name,
|
||||
get home() "http://5digits.org/",
|
||||
get apphome() this.home + this.name,
|
||||
get name() { return config.name; },
|
||||
get home() { return "http://5digits.org/"; },
|
||||
get apphome() { return this.home + this.name; },
|
||||
code: "http://code.google.com/p/dactyl/",
|
||||
get issues() this.home + "bug/" + this.name,
|
||||
get plugins() "http://5digits.org/" + this.name + "/plugins",
|
||||
get faq() this.home + this.name + "/faq",
|
||||
get issues() { return this.home + "bug/" + this.name; },
|
||||
get plugins() {
|
||||
return "http://5digits.org/" + this.name + "/plugins";
|
||||
},
|
||||
get faq() { return this.home + this.name + "/faq"; },
|
||||
|
||||
"list.mailto": Class.Memoize(() => config.name + "@googlegroups.com"),
|
||||
"list.href": Class.Memoize(() => "http://groups.google.com/group/" + config.name),
|
||||
@@ -483,18 +491,18 @@ var ConfigBase = Class("ConfigBase", {
|
||||
util.overlayWindow(window, { append: append });
|
||||
},
|
||||
|
||||
get window() window,
|
||||
get window() { return window; },
|
||||
|
||||
get document() document,
|
||||
get document() { return document; },
|
||||
|
||||
ids: Class.Update({
|
||||
get commandContainer() document.documentElement.id
|
||||
get commandContainer() { return document.documentElement.id; }
|
||||
}),
|
||||
|
||||
browser: Class.Memoize(() => window.gBrowser),
|
||||
tabbrowser: Class.Memoize(() => window.gBrowser),
|
||||
|
||||
get browserModes() [modules.modes.NORMAL],
|
||||
get browserModes() { return [modules.modes.NORMAL]; },
|
||||
|
||||
/**
|
||||
* @property {string} The ID of the application's main XUL window.
|
||||
@@ -505,7 +513,9 @@ var ConfigBase = Class("ConfigBase", {
|
||||
* @property {number} The height (px) that is available to the output
|
||||
* window.
|
||||
*/
|
||||
get outputHeight() this.browser.mPanelContainer.boxObject.height,
|
||||
get outputHeight() {
|
||||
return this.browser.mPanelContainer.boxObject.height;
|
||||
},
|
||||
|
||||
tabStrip: Class.Memoize(function () document.getElementById("TabsToolbar") || this.tabbrowser.mTabContainer)
|
||||
}),
|
||||
@@ -556,7 +566,7 @@ var ConfigBase = Class("ConfigBase", {
|
||||
* @property {string} The file extension used for command script files.
|
||||
* This is the name string sans "dactyl".
|
||||
*/
|
||||
get fileExtension() this.name.slice(0, -6),
|
||||
get fileExtension() { return this.name.slice(0, -6); },
|
||||
|
||||
guioptions: {},
|
||||
|
||||
|
||||
+32
-22
@@ -27,10 +27,12 @@ var Group = Class("Group", {
|
||||
this.children = [];
|
||||
},
|
||||
|
||||
get contexts() this.modules.contexts,
|
||||
get contexts() { return this.modules.contexts; },
|
||||
|
||||
set lastDocument(val) { this._lastDocument = util.weakReference(val); },
|
||||
get lastDocument() this._lastDocument && this._lastDocument.get(),
|
||||
get lastDocument() {
|
||||
return this._lastDocument && this._lastDocument.get();
|
||||
},
|
||||
|
||||
modifiable: true,
|
||||
|
||||
@@ -60,9 +62,11 @@ var Group = Class("Group", {
|
||||
return update(res, this.argsExtra(res), args);
|
||||
},
|
||||
|
||||
get toStringParams() [this.name],
|
||||
get toStringParams() { return [this.name]; },
|
||||
|
||||
get builtin() this.modules.contexts.builtinGroups.indexOf(this) >= 0
|
||||
get builtin() {
|
||||
return this.modules.contexts.builtinGroups.indexOf(this) >= 0;
|
||||
}
|
||||
}, {
|
||||
compileFilter: function (patterns, default_=false) {
|
||||
function siteFilter(uri) {
|
||||
@@ -132,13 +136,17 @@ var Contexts = Module("contexts", {
|
||||
});
|
||||
},
|
||||
|
||||
get toStringParams() [this.name],
|
||||
get toStringParams() { return [this.name]; },
|
||||
|
||||
names: ["-group", "-g"],
|
||||
|
||||
description: "Group to which to add",
|
||||
|
||||
get default() (contexts.context && contexts.context.group || contexts.user)[this.name],
|
||||
get default() {
|
||||
return (contexts.context &&
|
||||
contexts.context.group ||
|
||||
contexts.user)[this.name];
|
||||
},
|
||||
|
||||
completer: function (context) modules.completion.group(context)
|
||||
});
|
||||
@@ -171,7 +179,9 @@ var Contexts = Module("contexts", {
|
||||
}
|
||||
},
|
||||
|
||||
Group: Class("Group", Group, { modules: modules, get hiveMap() modules.contexts.hives }),
|
||||
Group: Class("Group", Group,
|
||||
{ modules: modules,
|
||||
get hiveMap() { return modules.contexts.hives; }}),
|
||||
|
||||
Hives: Class("Hives", Class.Property, {
|
||||
init: function init(name, constructor) {
|
||||
@@ -203,7 +213,7 @@ var Contexts = Module("contexts", {
|
||||
if (hasOwnProperty(group, name))]);
|
||||
},
|
||||
|
||||
get toStringParams() [this.name, this.Hive]
|
||||
get toStringParams() { return [this.name, this.Hive]; }
|
||||
})
|
||||
}),
|
||||
|
||||
@@ -330,7 +340,7 @@ var Contexts = Module("contexts", {
|
||||
|
||||
CONTEXT: Const(self),
|
||||
|
||||
get isGlobalModule() true,
|
||||
get isGlobalModule() { return true; },
|
||||
set isGlobalModule(val) {
|
||||
util.assert(val, "Loading non-global module as global",
|
||||
false);
|
||||
@@ -580,27 +590,27 @@ var Contexts = Module("contexts", {
|
||||
cleanup: function cleanup() {},
|
||||
destroy: function destroy() {},
|
||||
|
||||
get modifiable() this.group.modifiable,
|
||||
get modifiable() { return this.group.modifiable; },
|
||||
|
||||
get argsExtra() this.group.argsExtra,
|
||||
get makeArgs() this.group.makeArgs,
|
||||
get builtin() this.group.builtin,
|
||||
get argsExtra() { return this.group.argsExtra; },
|
||||
get makeArgs() { return this.group.makeArgs; },
|
||||
get builtin() { return this.group.builtin; },
|
||||
|
||||
get name() this.group.name,
|
||||
set name(val) this.group.name = val,
|
||||
get name() { return this.group.name; },
|
||||
set name(val) { this.group.name = val; },
|
||||
|
||||
get description() this.group.description,
|
||||
set description(val) this.group.description = val,
|
||||
get description() { return this.group.description; },
|
||||
set description(val) { this.group.description = val; },
|
||||
|
||||
get filter() this.group.filter,
|
||||
set filter(val) this.group.filter = val,
|
||||
get filter() { return this.group.filter; },
|
||||
set filter(val) { this.group.filter = val; },
|
||||
|
||||
get persist() this.group.persist,
|
||||
set persist(val) this.group.persist = val,
|
||||
get persist() { return this.group.persist; },
|
||||
set persist(val) { this.group.persist = val; },
|
||||
|
||||
prefix: Class.Memoize(function () this.name === "builtin" ? "" : this.name + ":"),
|
||||
|
||||
get toStringParams() [this.name]
|
||||
get toStringParams() { return [this.name]; }
|
||||
})
|
||||
}, {
|
||||
commands: function initCommands(dactyl, modules, window) {
|
||||
|
||||
+63
-32
@@ -98,8 +98,11 @@ var DOM = Class("DOM", {
|
||||
}.call(this);
|
||||
},
|
||||
|
||||
get document() this._document || this[0] && (this[0].ownerDocument || this[0].document || this[0]),
|
||||
set document(val) this._document = val,
|
||||
get document() {
|
||||
return this._document || this[0] &&
|
||||
(this[0].ownerDocument || this[0].document || this[0]);
|
||||
},
|
||||
set document(val) { this._document = val; },
|
||||
|
||||
attrHooks: {
|
||||
"": {
|
||||
@@ -240,34 +243,50 @@ var DOM = Class("DOM", {
|
||||
return false;
|
||||
},
|
||||
|
||||
get parent() this.map(elem => elem.parentNode, this),
|
||||
get parent() { return this.map(elem => elem.parentNode, this); },
|
||||
|
||||
get offsetParent() this.map(function (elem) {
|
||||
get offsetParent() {
|
||||
return this.map(function (elem) {
|
||||
do {
|
||||
var parent = elem.offsetParent;
|
||||
if (parent instanceof Ci.nsIDOMElement && DOM(parent).position != "static")
|
||||
return parent;
|
||||
}
|
||||
while (parent);
|
||||
}, this),
|
||||
}, this);
|
||||
},
|
||||
|
||||
get ancestors() this.all(elem => elem.parentNode),
|
||||
get ancestors() { return this.all(elem => elem.parentNode); },
|
||||
|
||||
get children() this.map(elem => Array.filter(elem.childNodes,
|
||||
get children() {
|
||||
return this.map(
|
||||
elem => Array.filter(elem.childNodes,
|
||||
e => e instanceof Ci.nsIDOMElement),
|
||||
this),
|
||||
this);
|
||||
},
|
||||
|
||||
get contents() this.map(elem => elem.childNodes, this),
|
||||
get contents() { return this.map(elem => elem.childNodes, this); },
|
||||
|
||||
get siblings() this.map(elem => Array.filter(elem.parentNode.childNodes,
|
||||
get siblings() {
|
||||
return this.map(
|
||||
elem => Array.filter(elem.parentNode.childNodes,
|
||||
e => e != elem && e instanceof Ci.nsIDOMElement),
|
||||
this),
|
||||
this);
|
||||
},
|
||||
|
||||
get siblingsBefore() this.all(elem => elem.previousElementSibling),
|
||||
get siblingsAfter() this.all(elem => elem.nextElementSibling),
|
||||
get siblingsBefore() {
|
||||
return this.all(elem => elem.previousElementSibling);
|
||||
},
|
||||
get siblingsAfter() {
|
||||
return this.all(elem => elem.nextElementSibling);
|
||||
},
|
||||
|
||||
get allSiblingsBefore() this.all(elem => elem.previousSibling),
|
||||
get allSiblingsAfter() this.all(elem => elem.nextSibling),
|
||||
get allSiblingsBefore() {
|
||||
return this.all(elem => elem.previousSibling);
|
||||
},
|
||||
get allSiblingsAfter() {
|
||||
return this.all(elem => elem.nextSibling);
|
||||
},
|
||||
|
||||
get class() {
|
||||
let self = this;
|
||||
@@ -275,8 +294,8 @@ var DOM = Class("DOM", {
|
||||
return {
|
||||
toString: function () self[0].className,
|
||||
|
||||
get list() Array.slice(self[0].classList),
|
||||
set list(val) self.attr("class", val.join(" ")),
|
||||
get list() { return Array.slice(self[0].classList); },
|
||||
set list(val) { self.attr("class", val.join(" ")); },
|
||||
|
||||
each: function each(meth, arg) {
|
||||
return self.each(function (elem) {
|
||||
@@ -335,13 +354,15 @@ var DOM = Class("DOM", {
|
||||
};
|
||||
},
|
||||
|
||||
get rect() this[0] instanceof Ci.nsIDOMWindow ? { width: this[0].scrollMaxX + this[0].innerWidth,
|
||||
get rect() {
|
||||
return this[0] instanceof Ci.nsIDOMWindow ? { width: this[0].scrollMaxX + this[0].innerWidth,
|
||||
height: this[0].scrollMaxY + this[0].innerHeight,
|
||||
get right() this.width + this.left,
|
||||
get bottom() this.height + this.top,
|
||||
top: -this[0].scrollY,
|
||||
left: -this[0].scrollX } :
|
||||
this[0] ? this[0].getBoundingClientRect() : {},
|
||||
this[0] ? this[0].getBoundingClientRect() : {};
|
||||
},
|
||||
|
||||
get viewport() {
|
||||
let node = this[0];
|
||||
@@ -350,8 +371,8 @@ var DOM = Class("DOM", {
|
||||
|
||||
if (node instanceof Ci.nsIDOMWindow)
|
||||
return {
|
||||
get width() this.right - this.left,
|
||||
get height() this.bottom - this.top,
|
||||
get width() { return this.right - this.left; },
|
||||
get height() { return this.bottom - this.top; },
|
||||
bottom: node.innerHeight,
|
||||
right: node.innerWidth,
|
||||
top: 0, left: 0
|
||||
@@ -362,9 +383,9 @@ var DOM = Class("DOM", {
|
||||
width: node.clientWidth,
|
||||
height: node.clientHeight,
|
||||
top: r.top + node.clientTop,
|
||||
get bottom() this.top + this.height,
|
||||
get bottom() { return this.top + this.height; },
|
||||
left: r.left + node.clientLeft,
|
||||
get right() this.left + this.width
|
||||
get right() { return this.left + this.width; }
|
||||
};
|
||||
},
|
||||
|
||||
@@ -436,12 +457,18 @@ var DOM = Class("DOM", {
|
||||
return editor;
|
||||
},
|
||||
|
||||
get isEditable() !!this.editor || this[0] instanceof Ci.nsIDOMElement && this.style.MozUserModify == "read-write",
|
||||
get isEditable() {
|
||||
return !!this.editor ||
|
||||
this[0] instanceof Ci.nsIDOMElement &&
|
||||
this.style.MozUserModify == "read-write";
|
||||
},
|
||||
|
||||
get isInput() isinstance(this[0], [Ci.nsIDOMHTMLInputElement,
|
||||
get isInput() {
|
||||
return isinstance(this[0], [Ci.nsIDOMHTMLInputElement,
|
||||
Ci.nsIDOMHTMLTextAreaElement,
|
||||
Ci.nsIDOMXULTextBoxElement])
|
||||
&& this.isEditable,
|
||||
&& this.isEditable;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns an object representing a Node's computed CSS style.
|
||||
@@ -987,10 +1014,14 @@ var DOM = Class("DOM", {
|
||||
bubbles: true, cancelable: true,
|
||||
view: doc.defaultView,
|
||||
detail: 1,
|
||||
get screenX() this.view.mozInnerScreenX
|
||||
+ Math.max(0, this.clientX + (DOM(target || opts.target).rect.left || 0)),
|
||||
get screenY() this.view.mozInnerScreenY
|
||||
+ Math.max(0, this.clientY + (DOM(target || opts.target).rect.top || 0)),
|
||||
get screenX() {
|
||||
return this.view.mozInnerScreenX
|
||||
+ Math.max(0, this.clientX + (DOM(target || opts.target).rect.left || 0));
|
||||
},
|
||||
get screenY() {
|
||||
return this.view.mozInnerScreenY
|
||||
+ Math.max(0, this.clientY + (DOM(target || opts.target).rect.top || 0));
|
||||
},
|
||||
clientX: 0,
|
||||
clientY: 0,
|
||||
ctrlKey: false, altKey: false, shiftKey: false, metaKey: false,
|
||||
@@ -1847,8 +1878,8 @@ var DOM = Class("DOM", {
|
||||
|
||||
let res = {
|
||||
iterateNext: function () result.iterateNext(),
|
||||
get resultType() result.resultType,
|
||||
get snapshotLength() result.snapshotLength,
|
||||
get resultType() { return result.resultType; },
|
||||
get snapshotLength() { return result.snapshotLength; },
|
||||
snapshotItem: function (i) result.snapshotItem(i)
|
||||
};
|
||||
if (asIterator)
|
||||
|
||||
@@ -68,24 +68,29 @@ var Download = Class("Download", {
|
||||
return this;
|
||||
},
|
||||
|
||||
get active() !this.stopped,
|
||||
get active() { return !this.stopped; },
|
||||
|
||||
get targetFile() File(this.download.target.path),
|
||||
get targetFile() { return File(this.download.target.path); },
|
||||
|
||||
get displayName() this.targetFile.leafName,
|
||||
get displayName() { return this.targetFile.leafName; },
|
||||
|
||||
get status() states[this.state],
|
||||
get status() { return states[this.state]; },
|
||||
|
||||
inState: function inState(states) states.indexOf(this.status) >= 0,
|
||||
|
||||
allowedCommands: Class.Memoize(function () {
|
||||
let self = this;
|
||||
return {
|
||||
get delete() !self.active && (self.targetFile.exists() || self.hasPartialData),
|
||||
get launch() self.targetFile.exists() && self.succeeded,
|
||||
get stop() self.active,
|
||||
get remove() !self.active,
|
||||
get resume() self.canceled
|
||||
get delete() {
|
||||
return !self.active &&
|
||||
(self.targetFile.exists() || self.hasPartialData);
|
||||
},
|
||||
get launch() {
|
||||
return self.targetFile.exists() && self.succeeded;
|
||||
},
|
||||
get stop() { return self.active; },
|
||||
get remove() { return !self.active; },
|
||||
get resume() { return self.canceled; }
|
||||
};
|
||||
}),
|
||||
|
||||
@@ -318,7 +323,9 @@ var DownloadList = Class("DownloadList",
|
||||
allowedCommands: Class.Memoize(function () {
|
||||
let self = this;
|
||||
return {
|
||||
get clear() iter(self.downloads.values()).some(dl => dl.allowedCommands.remove)
|
||||
get clear() {
|
||||
return iter(self.downloads.values()).some(dl => dl.allowedCommands.remove);
|
||||
}
|
||||
};
|
||||
}),
|
||||
|
||||
@@ -482,7 +489,9 @@ var Downloads_ = Module("downloads", XPCOM(Ci.nsIDownloadProgressListener), {
|
||||
names: ["-sort", "-s"],
|
||||
description: "Sort order (see 'downloadsort')",
|
||||
type: CommandOption.LIST,
|
||||
get default() modules.options["downloadsort"],
|
||||
get default() {
|
||||
return modules.options["downloadsort"];
|
||||
},
|
||||
completer: function (context, args) modules.options.get("downloadsort").completer(context, { values: args["-sort"] }),
|
||||
validator: function (value) modules.options.get("downloadsort").validator(value)
|
||||
}
|
||||
|
||||
+33
-22
@@ -44,8 +44,10 @@ var RangeFinder = Module("rangefinder", {
|
||||
return this.rangeFind = null;
|
||||
return find;
|
||||
},
|
||||
set rangeFind(val) overlay.setData(this.content.document,
|
||||
"range-find", val)
|
||||
set rangeFind(val) {
|
||||
overlay.setData(this.content.document,
|
||||
"range-find", val);
|
||||
}
|
||||
}),
|
||||
|
||||
init: function init() {
|
||||
@@ -64,9 +66,9 @@ var RangeFinder = Module("rangefinder", {
|
||||
}
|
||||
},
|
||||
|
||||
get commandline() this.modules.commandline,
|
||||
get modes() this.modules.modes,
|
||||
get options() this.modules.options,
|
||||
get commandline() { return this.modules.commandline; },
|
||||
get modes() { return this.modules.modes; },
|
||||
get options() { return this.modules.options; },
|
||||
|
||||
openPrompt: function openPrompt(mode) {
|
||||
this.modules.marks.push();
|
||||
@@ -256,12 +258,14 @@ var RangeFinder = Module("rangefinder", {
|
||||
|
||||
historyKey: "find",
|
||||
|
||||
get prompt() this.mode === modules.modes.FIND_BACKWARD ? "?" : "/",
|
||||
get prompt() {
|
||||
return this.mode === modules.modes.FIND_BACKWARD ? "?" : "/";
|
||||
},
|
||||
|
||||
get onCancel() modules.rangefinder.bound.onCancel,
|
||||
get onChange() modules.rangefinder.bound.onChange,
|
||||
get onHistory() modules.rangefinder.bound.onHistory,
|
||||
get onSubmit() modules.rangefinder.bound.onSubmit
|
||||
get onCancel() { return modules.rangefinder.bound.onCancel; },
|
||||
get onChange() { return modules.rangefinder.bound.onChange; },
|
||||
get onHistory() { return modules.rangefinder.bound.onHistory; },
|
||||
get onSubmit() { return modules.rangefinder.bound.onSubmit; }
|
||||
});
|
||||
},
|
||||
mappings: function initMappings(dactyl, modules, window) {
|
||||
@@ -384,17 +388,19 @@ var RangeFind = Class("RangeFind", {
|
||||
this.lastString = "";
|
||||
},
|
||||
|
||||
get store() overlay.getData(this.content.document, "buffer", Object),
|
||||
get store() {
|
||||
return overlay.getData(this.content.document, "buffer", Object);
|
||||
},
|
||||
|
||||
get backward() this.finder.findBackwards,
|
||||
set backward(val) this.finder.findBackwards = val,
|
||||
get backward() { return this.finder.findBackwards; },
|
||||
set backward(val) { this.finder.findBackwards = val; },
|
||||
|
||||
get matchCase() this.finder.caseSensitive,
|
||||
set matchCase(val) this.finder.caseSensitive = Boolean(val),
|
||||
get matchCase() { return this.finder.caseSensitive; },
|
||||
set matchCase(val) { this.finder.caseSensitive = Boolean(val); },
|
||||
|
||||
get findString() this.lastString,
|
||||
get findString() { return this.lastString; },
|
||||
|
||||
get flags() this.matchCase ? "" : "i",
|
||||
get flags() { return this.matchCase ? "" : "i"; },
|
||||
|
||||
get selectedRange() {
|
||||
let win = this.store.focusedFrame && this.store.focusedFrame.get() || this.content;
|
||||
@@ -707,8 +713,10 @@ var RangeFind = Class("RangeFind", {
|
||||
return range;
|
||||
},
|
||||
|
||||
get stale() this._stale || this.baseDocument.get() != this.content.document,
|
||||
set stale(val) this._stale = val,
|
||||
get stale() {
|
||||
return this._stale || this.baseDocument.get() != this.content.document;
|
||||
},
|
||||
set stale(val) { this._stale = val; },
|
||||
|
||||
addListeners: function addListeners() {
|
||||
for (let range of this.ranges)
|
||||
@@ -766,9 +774,12 @@ var RangeFind = Class("RangeFind", {
|
||||
}
|
||||
},
|
||||
|
||||
get selectionController() this.docShell
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsISelectionDisplay)
|
||||
.QueryInterface(Ci.nsISelectionController),
|
||||
get selectionController() {
|
||||
return this.docShell
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsISelectionDisplay)
|
||||
.QueryInterface(Ci.nsISelectionController);
|
||||
},
|
||||
get selection() {
|
||||
try {
|
||||
return this.selectionController.getSelection(Ci.nsISelectionController.SELECTION_NORMAL);
|
||||
|
||||
@@ -215,11 +215,11 @@ var Help = Module("Help", {
|
||||
cache.flushEntry(entry, time);
|
||||
},
|
||||
|
||||
get data() this._data || cache.get("help.json"),
|
||||
get data() { return this._data || cache.get("help.json"); },
|
||||
|
||||
get files() this.data.files,
|
||||
get overlays() this.data.overlays,
|
||||
get tags() this.data.tags,
|
||||
get files() { return this.data.files; },
|
||||
get overlays() { return this.data.overlays; },
|
||||
get tags() { return this.data.tags; },
|
||||
|
||||
Local: function Local(dactyl, modules, window) ({
|
||||
init: function init() {
|
||||
|
||||
@@ -63,9 +63,15 @@ Highlight.defaultValue("extends", function () this.defaultExtends);
|
||||
Highlight.defaultValue("value", function () this.defaultValue);
|
||||
|
||||
update(Highlight.prototype, {
|
||||
get base() this.baseClass != this.class && highlight.highlight[this.baseClass] || null,
|
||||
get base() {
|
||||
return this.baseClass != this.class &&
|
||||
highlight.highlight[this.baseClass] ||
|
||||
null;
|
||||
},
|
||||
|
||||
get bases() Ary.compact(this.extends.map(name => highlight.get(name))),
|
||||
get bases() {
|
||||
return Ary.compact(this.extends.map(name => highlight.get(name)));
|
||||
},
|
||||
|
||||
get inheritedCSS() {
|
||||
if (this.gettingCSS)
|
||||
@@ -79,9 +85,9 @@ update(Highlight.prototype, {
|
||||
}
|
||||
},
|
||||
|
||||
get css() this.selector + "{" + this.cssText + "}",
|
||||
get css() { return this.selector + "{" + this.cssText + "}"; },
|
||||
|
||||
get cssText() this.inheritedCSS + this.value,
|
||||
get cssText() { return this.inheritedCSS + this.value; },
|
||||
|
||||
toString: function () "Highlight(" + this.class + ")\n\t" +
|
||||
[k + ": " + JSON.stringify(String(v))
|
||||
|
||||
@@ -56,7 +56,7 @@ var IO = Module("io", {
|
||||
|
||||
historyKey: "file",
|
||||
|
||||
get mode() modules.modes.FILE_INPUT,
|
||||
get mode() { return modules.modes.FILE_INPUT; },
|
||||
|
||||
complete: function (context) {
|
||||
if (this.completer)
|
||||
@@ -1161,8 +1161,10 @@ unlet s:cpo_save
|
||||
"List of directories searched when executing :cd",
|
||||
"stringlist", ["."].concat(services.environment.get("CDPATH").split(/[:;]/).filter(util.identity)).join(","),
|
||||
{
|
||||
get files() this.value.map(path => File(path, modules.io.cwd))
|
||||
.filter(dir => dir.exists()),
|
||||
get files() {
|
||||
return this.value.map(path => File(path, modules.io.cwd))
|
||||
.filter(dir => dir.exists());
|
||||
},
|
||||
setter: function (value) File.expandPathList(value)
|
||||
});
|
||||
|
||||
@@ -1170,8 +1172,10 @@ unlet s:cpo_save
|
||||
"List of directories searched for runtime files",
|
||||
"stringlist", IO.runtimePath,
|
||||
{
|
||||
get files() this.value.map(path => File(path, modules.io.cwd))
|
||||
.filter(dir => dir.exists())
|
||||
get files() {
|
||||
return this.value.map(path => File(path, modules.io.cwd))
|
||||
.filter(dir => dir.exists());
|
||||
}
|
||||
});
|
||||
|
||||
options.add(["shell", "sh"],
|
||||
|
||||
@@ -448,7 +448,7 @@ var JavaScript = Module("javascript", {
|
||||
return this.evalled(key);
|
||||
},
|
||||
|
||||
get cache() this.context.cache,
|
||||
get cache() { return this.context.cache; },
|
||||
|
||||
complete: function _complete(context) {
|
||||
const self = this;
|
||||
@@ -695,7 +695,7 @@ var JavaScript = Module("javascript", {
|
||||
},
|
||||
completion: function (dactyl, modules, window) {
|
||||
update(modules.completion, {
|
||||
get javascript() modules.javascript.bound.complete,
|
||||
get javascript() { return modules.javascript.bound.complete; },
|
||||
javascriptCompleter: JavaScript // Backwards compatibility
|
||||
});
|
||||
},
|
||||
@@ -808,7 +808,7 @@ var JavaScript = Module("javascript", {
|
||||
|
||||
mode: modes.REPL,
|
||||
|
||||
get completionList() this.widgets.statusbar.commandline.id,
|
||||
get completionList() { return this.widgets.statusbar.commandline.id; },
|
||||
|
||||
accept: function accept() {
|
||||
dactyl.trapErrors(function () { this.repl.addOutput(this.command); }, this);
|
||||
|
||||
@@ -176,11 +176,15 @@ var Modules = function Modules(window) {
|
||||
|
||||
newContext: newContext,
|
||||
|
||||
get ownPropertyValues() Ary.compact(
|
||||
get ownPropertyValues() {
|
||||
return Ary.compact(
|
||||
Object.getOwnPropertyNames(this)
|
||||
.map(name => Object.getOwnPropertyDescriptor(this, name).value)),
|
||||
.map(name => Object.getOwnPropertyDescriptor(this, name).value));
|
||||
},
|
||||
|
||||
get moduleList() this.ownPropertyValues.filter(mod => (mod instanceof this.ModuleBase || mod.isLocalModule))
|
||||
get moduleList() {
|
||||
return this.ownPropertyValues.filter(mod => (mod instanceof this.ModuleBase || mod.isLocalModule));
|
||||
}
|
||||
});
|
||||
|
||||
modules.plugins = create(modules);
|
||||
|
||||
+29
-26
@@ -72,16 +72,16 @@ var Option = Class("Option", {
|
||||
*/
|
||||
description: Messages.Localized(""),
|
||||
|
||||
get helpTag() "'" + this.name + "'",
|
||||
get helpTag() { return "'" + this.name + "'"; },
|
||||
|
||||
initValue: function initValue() {
|
||||
util.trapErrors(() => { this.value = this.value; });
|
||||
},
|
||||
|
||||
get isDefault() this.stringValue === this.stringDefaultValue,
|
||||
get isDefault() { return this.stringValue === this.stringDefaultValue; },
|
||||
|
||||
/** @property {value} The value to reset this option to at cleanup time. */
|
||||
get cleanupValue() options.cleanupPrefs.get(this.name),
|
||||
get cleanupValue() { return options.cleanupPrefs.get(this.name); },
|
||||
set cleanupValue(value) {
|
||||
if (options.cleanupPrefs.get(this.name) == null)
|
||||
options.cleanupPrefs.set(this.name, value);
|
||||
@@ -194,14 +194,14 @@ var Option = Class("Option", {
|
||||
* or if no local value is set, this is equal to the
|
||||
* (@link #globalValue).
|
||||
*/
|
||||
get value() this.get(),
|
||||
set value(val) this.set(val),
|
||||
get value() { return this.get(); },
|
||||
set value(val) { this.set(val); },
|
||||
|
||||
get stringValue() this.stringify(this.value),
|
||||
set stringValue(value) this.value = this.parse(value),
|
||||
get stringValue() { return this.stringify(this.value); },
|
||||
set stringValue(value) { this.value = this.parse(value); },
|
||||
|
||||
get stringDefaultValue() this.stringify(this.defaultValue),
|
||||
set stringDefaultValue(val) this.defaultValue = this.parse(val),
|
||||
get stringDefaultValue() { return this.stringify(this.defaultValue); },
|
||||
set stringDefaultValue(val) { this.defaultValue = this.parse(val); },
|
||||
|
||||
getKey: function getKey(key) undefined,
|
||||
|
||||
@@ -411,8 +411,11 @@ var Option = Class("Option", {
|
||||
* @property {number} Returns the timestamp when the option's value was
|
||||
* last changed.
|
||||
*/
|
||||
get lastSet() options.store.get(this.name).time,
|
||||
set lastSet(val) { options.store.set(this.name, { value: this.globalValue, time: Date.now() }); },
|
||||
get lastSet() { return options.store.get(this.name).time; },
|
||||
set lastSet(val) {
|
||||
options.store.set(this.name,
|
||||
{ value: this.globalValue, time: Date.now() });
|
||||
},
|
||||
|
||||
/**
|
||||
* @property {nsIFile} The script in which this option was last set. null
|
||||
@@ -486,7 +489,7 @@ var Option = Class("Option", {
|
||||
|
||||
getKey: {
|
||||
stringlist: function stringlist(k) this.value.indexOf(k) >= 0,
|
||||
get charlist() this.stringlist,
|
||||
get charlist() { return this.stringlist; },
|
||||
|
||||
regexplist: function regexplist(k, default_=null) {
|
||||
for (let re of this.value)
|
||||
@@ -494,14 +497,14 @@ var Option = Class("Option", {
|
||||
return re.result;
|
||||
return default_;
|
||||
},
|
||||
get regexpmap() this.regexplist,
|
||||
get sitelist() this.regexplist,
|
||||
get sitemap() this.regexplist
|
||||
get regexpmap() { return this.regexplist; },
|
||||
get sitelist() { return this.regexplist; },
|
||||
get sitemap() { return this.regexplist; }
|
||||
},
|
||||
|
||||
domains: {
|
||||
sitelist: function (vals) Ary.compact(vals.map(site => util.getHost(site.filter))),
|
||||
get sitemap() this.sitelist
|
||||
get sitemap() { return this.sitelist; }
|
||||
},
|
||||
|
||||
stringify: {
|
||||
@@ -512,9 +515,9 @@ var Option = Class("Option", {
|
||||
stringmap: function (vals) [Option.quote(k, /:/) + ":" + Option.quote(v, /:/) for ([k, v] of iter(vals))].join(","),
|
||||
|
||||
regexplist: function (vals) vals.join(","),
|
||||
get regexpmap() this.regexplist,
|
||||
get sitelist() this.regexplist,
|
||||
get sitemap() this.regexplist
|
||||
get regexpmap() { return this.regexplist; },
|
||||
get sitelist() { return this.regexplist; },
|
||||
get sitemap() { return this.regexplist; }
|
||||
},
|
||||
|
||||
parse: {
|
||||
@@ -580,7 +583,7 @@ var Option = Class("Option", {
|
||||
|
||||
testValues: {
|
||||
regexpmap: function regexpmap(vals, validator) vals.every(re => validator(re.result)),
|
||||
get sitemap() this.regexpmap,
|
||||
get sitemap() { return this.regexpmap; },
|
||||
stringlist: function stringlist(vals, validator) vals.every(validator, this),
|
||||
stringmap: function stringmap(vals, validator) values(vals).every(validator, this)
|
||||
},
|
||||
@@ -717,11 +720,11 @@ var Option = Class("Option", {
|
||||
}
|
||||
return null;
|
||||
},
|
||||
get charlist() this.stringlist,
|
||||
get regexplist() this.stringlist,
|
||||
get regexpmap() this.stringlist,
|
||||
get sitelist() this.stringlist,
|
||||
get sitemap() this.stringlist
|
||||
get charlist() { return this.stringlist; },
|
||||
get regexplist() { return this.stringlist; },
|
||||
get regexpmap() { return this.stringlist; },
|
||||
get sitelist() { return this.stringlist; },
|
||||
get sitemap() { return this.stringlist; }
|
||||
},
|
||||
|
||||
validIf: function validIf(test, error) {
|
||||
@@ -1104,7 +1107,7 @@ var Options = Module("options", {
|
||||
},
|
||||
|
||||
/** @property {Object} The options store. */
|
||||
get store() storage.options
|
||||
get store() { return storage.options; }
|
||||
}, {
|
||||
}, {
|
||||
commands: function initCommands(dactyl, modules, window) {
|
||||
|
||||
@@ -30,9 +30,9 @@ var Overlay = Class("Overlay", {
|
||||
cleanups: Class.Memoize(() => []),
|
||||
objects: Class.Memoize(() => ({})),
|
||||
|
||||
get doc() this.window.document,
|
||||
get doc() { return this.window.document; },
|
||||
|
||||
get win() this.window,
|
||||
get win() { return this.window; },
|
||||
|
||||
$: function $(sel, node) DOM(sel, node || this.doc),
|
||||
|
||||
@@ -463,9 +463,11 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
|
||||
};
|
||||
},
|
||||
|
||||
get activeModules() this.activeWindow && this.activeWindow.dactyl.modules,
|
||||
get activeModules() {
|
||||
return this.activeWindow && this.activeWindow.dactyl.modules;
|
||||
},
|
||||
|
||||
get modules() [w.dactyl.modules for (w of this.windows)],
|
||||
get modules() { return [w.dactyl.modules for (w of this.windows)]; },
|
||||
|
||||
/**
|
||||
* The most recently active dactyl window.
|
||||
@@ -475,7 +477,7 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
|
||||
return this.windows.has(win) && win;
|
||||
},
|
||||
|
||||
set activeWindow(win) this._activeWindow = util.weakReference(win),
|
||||
set activeWindow(win) { this._activeWindow = util.weakReference(win); },
|
||||
|
||||
/**
|
||||
* A list of extant dactyl windows.
|
||||
|
||||
@@ -33,9 +33,13 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
|
||||
|
||||
this.branches = memoize({
|
||||
__proto__: this,
|
||||
get original() this.constructor(this.ORIGINAL + this.root),
|
||||
get restore() this.constructor(this.RESTORE + this.root),
|
||||
get saved() this.constructor(this.SAVED + this.root)
|
||||
get original() {
|
||||
return this.constructor(this.ORIGINAL + this.root);
|
||||
},
|
||||
get restore() {
|
||||
return this.constructor(this.RESTORE + this.root);
|
||||
},
|
||||
get saved() { return this.constructor(this.SAVED + this.root); }
|
||||
});
|
||||
|
||||
if (!defaults)
|
||||
@@ -90,7 +94,7 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
|
||||
/**
|
||||
* Returns the full name of this object's preference branch.
|
||||
*/
|
||||
get root() this.branch.root,
|
||||
get root() { return this.branch.root; },
|
||||
|
||||
/**
|
||||
* Returns the value of the preference *name*, or *defaultValue* if
|
||||
|
||||
@@ -100,8 +100,8 @@ function ProtocolBase() {
|
||||
};
|
||||
}
|
||||
ProtocolBase.prototype = {
|
||||
get contractID() services.PROTOCOL + this.scheme,
|
||||
get classDescription() this.scheme + " utility protocol",
|
||||
get contractID() { return services.PROTOCOL + this.scheme; },
|
||||
get classDescription() { return this.scheme + " utility protocol"; },
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler]),
|
||||
|
||||
purge: function purge() {
|
||||
|
||||
@@ -31,10 +31,18 @@ update(Range.prototype, {
|
||||
contains: function (date) date == null ||
|
||||
(this.min == null || date >= this.min) && (this.max == null || date <= this.max),
|
||||
|
||||
get isEternity() this.max == null && this.min == null,
|
||||
get isSession() this.max == null && this.min == sanitizer.sessionStart,
|
||||
get isEternity() {
|
||||
return this.max == null && this.min == null;
|
||||
},
|
||||
get isSession() {
|
||||
return this.max == null && this.min == sanitizer.sessionStart;
|
||||
},
|
||||
|
||||
get native() this.isEternity ? null : [this.min || 0, this.max == null ? Number.MAX_VALUE : this.max]
|
||||
get native() {
|
||||
return this.isEternity ? null
|
||||
: [this.min || 0, this.max == null ? Number.MAX_VALUE
|
||||
: this.max];
|
||||
}
|
||||
});
|
||||
|
||||
var Item = Class("SanitizeItem", {
|
||||
@@ -49,10 +57,14 @@ var Item = Class("SanitizeItem", {
|
||||
|
||||
description: Messages.Localized(""),
|
||||
|
||||
get cpdPref() (this.builtin ? "" : Item.PREFIX) + Item.BRANCH + Sanitizer.argToPref(this.name),
|
||||
get shutdownPref() (this.builtin ? "" : Item.PREFIX) + Item.SHUTDOWN_BRANCH + Sanitizer.argToPref(this.name),
|
||||
get cpd() prefs.get(this.cpdPref),
|
||||
get shutdown() prefs.get(this.shutdownPref),
|
||||
get cpdPref() {
|
||||
return (this.builtin ? "" : Item.PREFIX) + Item.BRANCH + Sanitizer.argToPref(this.name);
|
||||
},
|
||||
get shutdownPref() {
|
||||
return (this.builtin ? "" : Item.PREFIX) + Item.SHUTDOWN_BRANCH + Sanitizer.argToPref(this.name);
|
||||
},
|
||||
get cpd() { return prefs.get(this.cpdPref); },
|
||||
get shutdown() { return prefs.get(this.shutdownPref); },
|
||||
|
||||
shouldSanitize: function (shutdown) (!shutdown || this.builtin || this.persistent) &&
|
||||
prefs.get(shutdown ? this.shutdownPref : this.pref)
|
||||
@@ -317,10 +329,18 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
return thing.QueryInterface(Ci.nsILoadContext);
|
||||
},
|
||||
|
||||
get ranAtShutdown() config.prefs.get("didSanitizeOnShutdown"),
|
||||
set ranAtShutdown(val) config.prefs.set("didSanitizeOnShutdown", Boolean(val)),
|
||||
get runAtShutdown() prefs.get("privacy.sanitize.sanitizeOnShutdown"),
|
||||
set runAtShutdown(val) prefs.set("privacy.sanitize.sanitizeOnShutdown", Boolean(val)),
|
||||
get ranAtShutdown() {
|
||||
return config.prefs.get("didSanitizeOnShutdown");
|
||||
},
|
||||
set ranAtShutdown(val) {
|
||||
config.prefs.set("didSanitizeOnShutdown", Boolean(val));
|
||||
},
|
||||
get runAtShutdown() {
|
||||
return prefs.get("privacy.sanitize.sanitizeOnShutdown");
|
||||
},
|
||||
set runAtShutdown(val) {
|
||||
prefs.set("privacy.sanitize.sanitizeOnShutdown", Boolean(val));
|
||||
},
|
||||
|
||||
sanitize: function sanitize(items, range)
|
||||
this.withSavedValues(["sanitizing"], function () {
|
||||
@@ -607,7 +627,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
"The default list of private items to sanitize",
|
||||
"stringlist", "all",
|
||||
{
|
||||
get values() values(sanitizer.itemMap).toArray(),
|
||||
get values() { return values(sanitizer.itemMap).toArray(); },
|
||||
|
||||
completer: function completer(context, extra) {
|
||||
if (context.filter[0] == "!")
|
||||
@@ -630,7 +650,11 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
"stringlist", "",
|
||||
{
|
||||
initialValue: true,
|
||||
get values() [i for (i of values(sanitizer.itemMap)) if (i.persistent || i.builtin)],
|
||||
get values() {
|
||||
return [i
|
||||
for (i of values(sanitizer.itemMap))
|
||||
if (i.persistent || i.builtin)];
|
||||
},
|
||||
getter: function () !sanitizer.runAtShutdown ? [] : [
|
||||
item.name for (item of values(sanitizer.itemMap))
|
||||
if (item.shouldSanitize(true))
|
||||
@@ -671,7 +695,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
options.add(["cookies", "ck"],
|
||||
"The default mode for newly added cookie permissions",
|
||||
"stringlist", "session",
|
||||
{ get values() Sanitizer.COMMANDS });
|
||||
{ get values() { return Sanitizer.COMMANDS; }});
|
||||
|
||||
options.add(["cookieaccept", "ca"],
|
||||
"When to accept cookies",
|
||||
|
||||
@@ -25,7 +25,7 @@ var StoreBase = Class("StoreBase", {
|
||||
|
||||
fireEvent: function (event, arg) { storage.fireEvent(this.name, event, arg); },
|
||||
|
||||
get serial() JSON.stringify(this._object, this.replacer),
|
||||
get serial() { return JSON.stringify(this._object, this.replacer); },
|
||||
|
||||
init: function init(name, store, load, options) {
|
||||
this._load = load;
|
||||
@@ -76,7 +76,7 @@ var StoreBase = Class("StoreBase", {
|
||||
var ArrayStore = Class("ArrayStore", StoreBase, {
|
||||
_constructor: Array,
|
||||
|
||||
get length() this._object.length,
|
||||
get length() { return this._object.length; },
|
||||
|
||||
set: function set(index, value, quiet) {
|
||||
var orig = this._object[index];
|
||||
@@ -353,7 +353,7 @@ var Storage = Module("Storage", {
|
||||
},
|
||||
|
||||
_privateMode: false,
|
||||
get privateMode() this._privateMode,
|
||||
get privateMode() { return this._privateMode; },
|
||||
set privateMode(enabled) {
|
||||
this._privateMode = Boolean(enabled);
|
||||
|
||||
@@ -452,7 +452,7 @@ var File = Class("File", {
|
||||
return file.QueryInterface(Ci.nsILocalFile);
|
||||
}),
|
||||
|
||||
get async() AsyncFile(this),
|
||||
get async() { return AsyncFile(this); },
|
||||
|
||||
charset: Class.Memoize(() => File.defaultEncoding),
|
||||
|
||||
@@ -493,15 +493,21 @@ var File = Class("File", {
|
||||
return this.constructor(newPath, null, this.charset);
|
||||
},
|
||||
|
||||
get fileName() OS.Path.basename(this.path),
|
||||
get fileName() { return OS.Path.basename(this.path); },
|
||||
|
||||
get parent() this.constructor(OS.Path.dirname(this.path), null, this.charset),
|
||||
get parent() {
|
||||
return this.constructor(OS.Path.dirname(this.path),
|
||||
null,
|
||||
this.charset);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns an iterator for all lines in a file.
|
||||
*/
|
||||
get lines() File.readLines(services.FileInStream(this.file, -1, 0, 0),
|
||||
this.charset),
|
||||
get lines() {
|
||||
return File.readLines(services.FileInStream(this.file, -1, 0, 0),
|
||||
this.charset);
|
||||
},
|
||||
|
||||
/**
|
||||
* Reads this file's entire contents in "text" mode and returns the
|
||||
@@ -834,7 +840,7 @@ var File = Class("File", {
|
||||
}
|
||||
|
||||
var AsyncFile = Class("AsyncFile", File, {
|
||||
get async() this,
|
||||
get async() { return this; },
|
||||
|
||||
/*
|
||||
* Creates a new directory, along with any parent directories which
|
||||
|
||||
+29
-16
@@ -40,9 +40,12 @@ update(Sheet.prototype, {
|
||||
|
||||
remove: function () { this.hive.remove(this); },
|
||||
|
||||
get uri() "dactyl://style/" + this.id + "/" + this.hive.name + "/" + (this.name || ""),
|
||||
get uri() {
|
||||
return "dactyl://style/" + this.id + "/" +
|
||||
this.hive.name + "/" + (this.name || "");
|
||||
},
|
||||
|
||||
get enabled() this._enabled,
|
||||
get enabled() { return this._enabled; },
|
||||
set enabled(on) {
|
||||
if (on != this._enabled || this.fullCSS != this._fullCSS) {
|
||||
if (on)
|
||||
@@ -94,7 +97,7 @@ var Hive = Class("Hive", {
|
||||
this.persist = persist;
|
||||
},
|
||||
|
||||
get modifiable() this.name !== "system",
|
||||
get modifiable() { return this.name !== "system"; },
|
||||
|
||||
addRef: function (obj) {
|
||||
this.refs.push(util.weakReference(obj));
|
||||
@@ -118,9 +121,11 @@ var Hive = Class("Hive", {
|
||||
|
||||
"@@iterator": function () iter(this.sheets),
|
||||
|
||||
get sites() Ary(this.sheets).map(s => s.sites)
|
||||
get sites() {
|
||||
return Ary(this.sheets).map(s => s.sites)
|
||||
.flatten()
|
||||
.uniq().array,
|
||||
.uniq().array;
|
||||
},
|
||||
|
||||
/**
|
||||
* Add a new style sheet.
|
||||
@@ -503,7 +508,8 @@ var Styles = Module("Styles", {
|
||||
}),
|
||||
|
||||
patterns: memoize({
|
||||
get property() util.regexp(literal(function () /*
|
||||
get property() {
|
||||
return util.regexp(literal(function () /*
|
||||
(?:
|
||||
(?P<preSpace> <space>*)
|
||||
(?P<name> [-a-z]*)
|
||||
@@ -514,26 +520,32 @@ var Styles = Module("Styles", {
|
||||
)?
|
||||
)
|
||||
(?P<postSpace> <space>* (?: ; | $) )
|
||||
*/$), "gix", this),
|
||||
*/$), "gix", this);
|
||||
},
|
||||
|
||||
get function() util.regexp(literal(function () /*
|
||||
get function() {
|
||||
return util.regexp(literal(function () /*
|
||||
(?P<function>
|
||||
\s* \( \s*
|
||||
(?: <string> | [^)]* )
|
||||
\s* (?: \) | $)
|
||||
)
|
||||
*/$), "gx", this),
|
||||
*/$), "gx", this);
|
||||
},
|
||||
|
||||
space: /(?: \s | \/\* .*? \*\/ )/,
|
||||
|
||||
get string() util.regexp(literal(function () /*
|
||||
get string() {
|
||||
return util.regexp(literal(function () /*
|
||||
(?P<string>
|
||||
" (?:[^\\"]|\\.)* (?:"|$) |
|
||||
' (?:[^\\']|\\.)* (?:'|$)
|
||||
)
|
||||
*/$), "gx", this),
|
||||
*/$), "gx", this);
|
||||
},
|
||||
|
||||
get token() util.regexp(literal(function () /*
|
||||
get token() {
|
||||
return util.regexp(literal(function () /*
|
||||
(?P<token>
|
||||
(?P<word> [-\w]+)
|
||||
<function>?
|
||||
@@ -543,7 +555,8 @@ var Styles = Module("Styles", {
|
||||
| <space>+
|
||||
| [^;}\s]+
|
||||
)
|
||||
*/$), "gix", this)
|
||||
*/$), "gix", this);
|
||||
}
|
||||
}),
|
||||
|
||||
/**
|
||||
@@ -713,9 +726,9 @@ var Styles = Module("Styles", {
|
||||
this.hive = styles.addHive(group.name, this, this.persist);
|
||||
},
|
||||
|
||||
get names() this.hive.names,
|
||||
get sheets() this.hive.sheets,
|
||||
get sites() this.hive.sites,
|
||||
get names() { return this.hive.names; },
|
||||
get sheets() { return this.hive.sheets; },
|
||||
get sites() { return this.hive.sites; },
|
||||
|
||||
__noSuchMethod__: function __noSuchMethod__(meth, args) {
|
||||
return apply(this.hive, meth, args);
|
||||
|
||||
@@ -30,7 +30,7 @@ var Binding = Class("Binding", {
|
||||
else
|
||||
this.removeAttribute("collapsed");
|
||||
},
|
||||
get collapsed() !!this.getAttribute("collapsed"),
|
||||
get collapsed() { return !!this.getAttribute("collapsed"); },
|
||||
|
||||
__noSuchMethod__: Class.Property({
|
||||
configurable: true,
|
||||
@@ -103,7 +103,10 @@ var Template = Module("Template", {
|
||||
this.target = params.commandTarget;
|
||||
},
|
||||
|
||||
get command() this.getAttribute("command") || this.getAttribute("key"),
|
||||
get command() {
|
||||
return this.getAttribute("command") ||
|
||||
this.getAttribute("key");
|
||||
},
|
||||
|
||||
events: {
|
||||
"click": function onClick(event) {
|
||||
|
||||
@@ -22,7 +22,7 @@ var Magic = Class("Magic", {
|
||||
this.str = str;
|
||||
},
|
||||
|
||||
get message() this.str,
|
||||
get message() { return this.str; },
|
||||
|
||||
toString: function () this.str
|
||||
});
|
||||
@@ -862,8 +862,8 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
* @returns {Object}
|
||||
*/
|
||||
intersection: function intersection(r1, r2) ({
|
||||
get width() this.right - this.left,
|
||||
get height() this.bottom - this.top,
|
||||
get width() { return this.right - this.left; },
|
||||
get height() { return this.bottom - this.top; },
|
||||
left: Math.max(r1.left, r2.left),
|
||||
right: Math.min(r1.right, r2.right),
|
||||
top: Math.max(r1.top, r2.top),
|
||||
|
||||
@@ -31,8 +31,8 @@ const Config = Module("config", ConfigBase, {
|
||||
|
||||
// FIXME: unless I'm seeing double in in the wee small hours gBrowser is
|
||||
// first set from getBrowser which they've deprecated in FF.
|
||||
get browser() window.getBrowser(),
|
||||
get tabbrowser() window.getBrowser(),
|
||||
get browser() { return window.getBrowser(); },
|
||||
get tabbrowser() { return window.getBrowser(); },
|
||||
|
||||
dialogs: {
|
||||
about: ["About Songbird",
|
||||
@@ -86,7 +86,10 @@ const Config = Module("config", ConfigBase, {
|
||||
modes.pop();
|
||||
},
|
||||
|
||||
get isPlayerWindow() window.SBGetBrowser().mCurrentTab == window.SBGetBrowser().mediaTab,
|
||||
get isPlayerWindow() {
|
||||
let browser = window.SBGetBrowser();
|
||||
return browser.mCurrentTab == browser.mediaTab;
|
||||
},
|
||||
|
||||
/**
|
||||
* Shows or hides the main service pane.
|
||||
@@ -138,7 +141,7 @@ const Config = Module("config", ConfigBase, {
|
||||
defaults: {
|
||||
guioptions: "bCmprs",
|
||||
showtabline: 2,
|
||||
get titlestring() config.name
|
||||
get titlestring() { return config.name; }
|
||||
},
|
||||
|
||||
guioptions: {
|
||||
|
||||
@@ -80,12 +80,12 @@ const Player = Module("player", {
|
||||
},
|
||||
|
||||
/** @property {sbIMediaListView} The current media list view. @private */
|
||||
get _currentView() SBGetBrowser().currentMediaListView,
|
||||
get _currentView() { return SBGetBrowser().currentMediaListView; },
|
||||
|
||||
/**
|
||||
* @property {number} The player volume in the range 0.0-1.0.
|
||||
*/
|
||||
get volume() gMM.volumeControl.volume,
|
||||
get volume() { return gMM.volumeControl.volume; },
|
||||
set volume(value) {
|
||||
gMM.volumeControl.volume = value;
|
||||
},
|
||||
@@ -465,11 +465,13 @@ const Player = Module("player", {
|
||||
|
||||
historyKey: "search-view",
|
||||
|
||||
get prompt() this.mode === modules.modes.SEARCH_VIEW_BACKWARD ? "?" : "/",
|
||||
get prompt() {
|
||||
return this.mode === modules.modes.SEARCH_VIEW_BACKWARD ? "?" : "/";
|
||||
},
|
||||
|
||||
get onCancel() player.closure.onSearchCancel,
|
||||
get onChange() player.closure.onSearchKeyPress,
|
||||
get onSubmit() player.closure.onSearchSubmit
|
||||
get onCancel() { return player.closure.onSearchCancel; },
|
||||
get onChange() { return player.closure.onSearchKeyPress; },
|
||||
get onSubmit() { return player.closure.onSearchSubmit; }
|
||||
});
|
||||
},
|
||||
commands: function initCommands() {
|
||||
|
||||
@@ -16,18 +16,21 @@ var Config = Module("config", ConfigBase, {
|
||||
util.overlayWindow(window, { append: <><hbox id="statusTextBox" flex=""/></> });
|
||||
},
|
||||
|
||||
get browser()
|
||||
let (tabmail = document.getElementById('tabmail'))
|
||||
get browser() {
|
||||
return let (tabmail = document.getElementById('tabmail'))
|
||||
tabmail && tabmail.tabInfo.length ? tabmail.getBrowserForSelectedTab()
|
||||
: document.getElementById("messagepane"),
|
||||
: document.getElementById("messagepane");
|
||||
},
|
||||
|
||||
tabbrowser: {
|
||||
__proto__: Class.makeClosure.call(window.document.getElementById("tabmail")),
|
||||
get mTabContainer() this.tabContainer,
|
||||
get mTabs() this.tabContainer.childNodes,
|
||||
get mCurrentTab() this.tabContainer.selectedItem,
|
||||
get mStrip() this.tabStrip,
|
||||
get browsers() [browser for (browser in Iterator(this.mTabs))],
|
||||
get mTabContainer() { return this.tabContainer; },
|
||||
get mTabs() { return this.tabContainer.childNodes; },
|
||||
get mCurrentTab() { return this.tabContainer.selectedItem; },
|
||||
get mStrip() { return this.tabStrip; },
|
||||
get browsers() {
|
||||
return [browser for (browser in Iterator(this.mTabs))];
|
||||
},
|
||||
|
||||
removeTab: function removeTab(tab) this.closeTab(tab),
|
||||
|
||||
@@ -39,13 +42,15 @@ var Config = Module("config", ConfigBase, {
|
||||
}
|
||||
},
|
||||
|
||||
get tabStip() this.tabbrowser.tabContainer,
|
||||
get tabStip() { return this.tabbrowser.tabContainer; },
|
||||
|
||||
get mainWidget() this.isComposeWindow ? document.getElementById("content-frame") : window.GetThreadTree(),
|
||||
get mainWidget() {
|
||||
return this.isComposeWindow ? document.getElementById("content-frame") : window.GetThreadTree();
|
||||
},
|
||||
|
||||
get browserModes() [modules.modes.MESSAGE],
|
||||
get browserModes() { return [modules.modes.MESSAGE]; },
|
||||
|
||||
get mailModes() [modules.modes.NORMAL],
|
||||
get mailModes() { return [modules.modes.NORMAL]; },
|
||||
|
||||
// NOTE: as I don't use TB I have no idea how robust this is. --djk
|
||||
get outputHeight() {
|
||||
|
||||
@@ -125,9 +125,9 @@ var Mail = Module("mail", {
|
||||
return "\"" + recipient + "\"";
|
||||
},
|
||||
|
||||
get currentAccount() this.currentFolder.rootFolder,
|
||||
get currentAccount() { return this.currentFolder.rootFolder; },
|
||||
|
||||
get currentFolder() gFolderTreeView.getSelectedFolders()[0],
|
||||
get currentFolder() { return gFolderTreeView.getSelectedFolders()[0]; },
|
||||
|
||||
/** @property {[nsISmtpServer]} The list of configured SMTP servers. */
|
||||
get smtpServers() {
|
||||
|
||||
Reference in New Issue
Block a user