repo: 373f1649c80dea9be7b5bc9c57e8395f94f93ab1
-node: ddb20953fcebb277dc5a68679d69f39873e3a866
+node: dd11a1a668d0ac31de134e00a8149fe044dad758
branch: default
latesttag: pentadactyl-1.0rc1
-latesttagdistance: 195
+latesttagdistance: 219
Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService)
.logStringMessage(stack);
}
-function debug() {
+function debug(...args) {
if (DEBUG)
- dump(name + ": " + Array.join(arguments, ", ") + "\n");
+ dump(name + ": " + args.join(", ") + "\n");
}
function httpGet(uri) {
return resourceProto.resolveURI(uri);
let chan = Services.io.newChannelFromURI(uri);
- try { chan.cancel(Cr.NS_BINDING_ABORTED) } catch (e) {}
+ try { chan.cancel(Cr.NS_BINDING_ABORTED); } catch (e) {}
return chan.name;
},
var NSGetModule = XPCOMUtils.generateNSGetModule([CommandLineHandler]);
var EXPORTED_SYMBOLS = ["NSGetFactory", "global"];
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
arguments: [abbr.lhs],
literalArg: abbr.rhs,
options: {
- "-javascript": abbr.rhs ? null : undefined
+ "-javascript": callable(abbr.rhs) ? null : undefined
}
}
for ([, abbr] in Iterator(abbreviations.user.merged))
}
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
["td", {}, item.filter.toJSONXML ? item.filter.toJSONXML(modules) : String(item.filter)],
["td", {}, String(item.command)]]),
["tr", { style: "height: .5ex;" }]]).toArray(),
- ["tr", { style: "height: .5ex;" }],
+ ["tr", { style: "height: .5ex;" }]
])]);
commandline.commandOutput(table);
},
return void dactyl.echomsg(_("autocmd.noMatching"));
let [event, url] = args;
- let defaultURL = url || buffer.uri.spec;
+ let uri = util.createURI(url) || buffer.uri;
let validEvents = Object.keys(config.autocommands);
// TODO: add command validators
_("autocmd.cantExecuteAll"));
dactyl.assert(validEvents.indexOf(event) >= 0,
_("autocmd.noGroup", args));
- dactyl.assert(autocommands.get(event).some(function (c) c.patterns.some(function (re) re.test(defaultURL) ^ !re.result)),
+ dactyl.assert(autocommands.get(event).some(function (c) c.filter(uri)),
_("autocmd.noMatching"));
if (this.name == "doautoall" && dactyl.has("tabs")) {
for (let i = 0; i < tabs.count; i++) {
tabs.select(i);
// if no url arg is specified use the current buffer's URL
- autocommands.trigger(event, { url: url || buffer.uri.spec });
+ autocommands.trigger(event, { url: uri.spec });
}
tabs.select(current);
}
else
- autocommands.trigger(event, { url: defaultURL });
+ autocommands.trigger(event, { url: uri.spec });
}, {
argCount: "*", // FIXME: kludged for proper error message should be "1".
completer: function (context) completion.autocmdEvent(context),
}
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
* @param {Element} elem A form element for which to add a keyword.
*/
addSearchKeyword: function addSearchKeyword(elem) {
- if (elem instanceof HTMLFormElement || elem.form)
+ if (elem instanceof Ci.nsIDOMHTMLFormElement || elem.form)
var { url, postData, charset } = DOM(elem).formData;
else
var [url, postData, charset] = [elem.href || elem.src, null, elem.ownerDocument.characterSet];
}
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
events: {
DOMContentLoaded: function onDOMContentLoaded(event) {
let doc = event.originalTarget;
- if (doc instanceof HTMLDocument)
+ if (doc instanceof Ci.nsIDOMHTMLDocument)
this._triggerLoadAutocmd("DOMLoad", doc);
},
if (doc instanceof Document)
dactyl.initDocument(doc);
- if (doc instanceof HTMLDocument) {
+ if (doc instanceof Ci.nsIDOMHTMLDocument) {
if (doc.defaultView.frameElement) {
// document is part of a frameset
if (dactyl.forceTarget in openModes)
mode = openModes[dactyl.forceTarget];
- CommandExMode().open(mode + "open " + (args || ""))
+ CommandExMode().open(mode + "open " + (args || ""));
}
function decode(uri) util.losslessDecodeURI(uri)
}
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
["vbox", { id: "dactyl-completions-" + s + "commandline-container", class: "dactyl-container", hidden: "false", collapsed: "true" },
["iframe", { class: "dactyl-completions", id: "dactyl-completions-" + s + "commandline", src: "dactyl://content/buffer.xhtml",
contextmenu: "dactyl-contextmenu", flex: "1", hidden: "false", collapsed: "false", highlight: "Events",
- events: "mowEvents" }]]]],
+ events: "mowEvents" }]]]]
});
this.elements = {};
function get(prefix, map, id) (obj.getElement || util.identity)(map[id] || document.getElementById(prefix + id));
- this.active.__defineGetter__(obj.name, function () self.activeGroup[obj.name][obj.name]);
- this.activeGroup.__defineGetter__(obj.name, function () self.getGroup(obj.name));
+ this.active.__defineGetter__(obj.name, () => this.activeGroup[obj.name][obj.name]);
+ this.activeGroup.__defineGetter__(obj.name, () => this.getGroup(obj.name));
- memoize(this.statusbar, obj.name, function () get("dactyl-statusline-field-", statusline.widgets, (obj.id || obj.name)));
- memoize(this.commandbar, obj.name, function () get("dactyl-", {}, (obj.id || obj.name)));
+ memoize(this.statusbar, obj.name, () => get("dactyl-statusline-field-", statusline.widgets, (obj.id || obj.name)));
+ memoize(this.commandbar, obj.name, () => get("dactyl-", {}, (obj.id || obj.name)));
if (!(obj.noValue || obj.getValue)) {
Object.defineProperty(this, obj.name, Modes.boundProperty({
init.supercall(this);
},
- complete: function CPM_complete(context) {
+ complete: function CPM_complete(context, ...args) {
if (this.completer)
- context.forkapply("prompt", 0, this, "completer", Array.slice(arguments, 1));
+ context.forkapply("prompt", 0, this, "completer", args);
},
get mode() modes.PROMPT
*/
var CommandLine = Module("commandline", {
init: function init() {
- const self = this;
-
this._callbacks = {};
memoize(this, "_store", function () storage.newMap("command-history", { store: true, privateData: true }));
node.completionList = ItemList(elem);
node.completionList.isAboveMow = node.id ==
- this.widgets.statusbar.commandline.id
+ this.widgets.statusbar.commandline.id;
}
return node.completionList;
},
if (val)
this.widgets["message-pre"] = _("commandline.moreMessages", val) + " ";
else
- this.widgets["message-pre"] = null
+ this.widgets["message-pre"] = null;
},
_lastEcho: null,
highlightGroup = highlightGroup || this.HL_NORMAL;
- let self = this;
- function appendToMessages(data) {
+ let appendToMessages = (data) => {
let message = isObject(data) && !DOM.isJSONXML(data) ? data : { message: data };
// Make sure the memoized message property is an instance property.
message.message;
- self._messageHistory.add(update({ highlight: highlightGroup }, message));
+ this._messageHistory.add(update({ highlight: highlightGroup }, message));
return message.message;
}
if ((flags & this.FORCE_MULTILINE) || (/\n/.test(data) || !isinstance(data, [_, "String"])) && !(flags & this.FORCE_SINGLELINE))
action = mow.closure.echo;
- let single = function () action == self._echoLine;
+ let checkSingleLine = () => action == this._echoLine;
if (forceSingle) {
this._lastEcho = null;
}
else {
// So complicated...
- if (single() && !this.widgets.mowContainer.collapsed) {
+ if (checkSingleLine() && !this.widgets.mowContainer.collapsed) {
highlightGroup += " Message";
action = mow.closure.echo;
}
- else if (!single() && this.widgets.mowContainer.collapsed) {
+ else if (!checkSingleLine() && this.widgets.mowContainer.collapsed) {
if (this._lastEcho && this.widgets.message && this.widgets.message[1] == this._lastEcho.msg) {
if (!(this._lastEcho.flags & this.APPEND_TO_MESSAGES))
appendToMessages(this._lastEcho.data);
else if (this._lastEcho && this.widgets.message && this.widgets.message[1] == this._lastEcho.msg) {
if (!(this._lastEcho.flags & this.APPEND_TO_MESSAGES))
appendToMessages(this._lastEcho.data);
- if (single() && !(flags & this.APPEND_TO_MESSAGES))
+ if (checkSingleLine() && !(flags & this.APPEND_TO_MESSAGES))
appendToMessages(data);
flags |= this.APPEND_TO_MESSAGES;
this.hiddenMessages++;
}
- this._lastEcho = single() && { flags: flags, msg: data, data: arguments[0] };
+ this._lastEcho = checkSingleLine() && { flags: flags, msg: data, data: arguments[0] };
}
this._lastClearable = action === this._echoLine && String(data);
this._lastEchoTime = (flags & this.FORCE_SINGLELINE) && Date.now();
if (action)
- action.call(this, data, highlightGroup, single);
+ action.call(this, data, highlightGroup, checkSingleLine());
},
_lastEchoTime: 0,
updateOutputHeight: deprecated("mow.resize", function updateOutputHeight(open, extra) mow.resize(open, extra)),
- withOutputToString: function withOutputToString(fn, self) {
+ withOutputToString: function withOutputToString(fn, self, ...args) {
dactyl.registerObserver("echoLine", observe, true);
dactyl.registerObserver("echoMultiline", observe, true);
}
this.savingOutput = true;
- dactyl.trapErrors.apply(dactyl, [fn, self].concat(Array.slice(arguments, 2)));
+ dactyl.trapErrors.apply(dactyl, [fn, self].concat(args));
this.savingOutput = false;
return output.map(function (elem) elem instanceof Node ? DOM.stringify(elem) : elem)
.join("\n");
this.store = this.store.filter(function (line) (line.value || line) != str);
dactyl.trapErrors(function () {
- this.store.push({ value: str, timestamp: Date.now()*1000, privateData: privateData });
+ this.store.push({ value: str, timestamp: Date.now() * 1000, privateData: privateData });
}, this);
this.store = this.store.slice(Math.max(0, this.store.length - options["history"]));
},
return Events.PASS;
});
- let bind = function bind()
- mappings.add.apply(mappings, [[modes.COMMAND_LINE]].concat(Array.slice(arguments)))
+ let bind = function bind(...args) mappings.add.apply(mappings, [[modes.COMMAND_LINE]].concat(args));
bind(["<Esc>", "<C-[>"], "Stop waiting for completions or exit Command Line mode",
function ({ self }) {
if (start < 0 || start >= this.itemCount)
return null;
- group = array.nth(groups, function (g) let (i = start - g.offsets.start) i >= 0 && i < g.itemCount, 0)
+ group = array.nth(groups, function (g) let (i = start - g.offsets.start) i >= 0 && i < g.itemCount, 0);
return [group.context, start - group.offsets.start];
},
container.scrollTop = scroll;
if (scrollY != null)
win.scrollTo(0, Math.max(scrollY, 0));
- }
+ };
},
/**
})
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
}
},
-
observers: {
"dactyl-cleanup": function dactyl_cleanup(subject, reason) {
let modules = dactyl.modules;
});
},
- triggerObserver: function triggerObserver(type) {
- return this.applyTriggerObserver(type, Array.slice(arguments, 1));
+ triggerObserver: function triggerObserver(type, ...args) {
+ return this.applyTriggerObserver(type, args);
},
addUsageCommand: function (params) {
* Acts like the Function builtin, but the code executes in the
* userContext global.
*/
- userFunc: function userFunc() {
+ userFunc: function userFunc(...args) {
return this.userEval(
- "(function userFunction(" + Array.slice(arguments, 0, -1).join(", ") + ")" +
- " { " + arguments[arguments.length - 1] + " })");
+ "(function userFunction(" + args.slice(0, -1).join(", ") + ")" +
+ " { " + args.pop() + " })");
},
/**
if (win.frameElement)
win.frameElement.blur();
// Grr.
- if (content.document.activeElement instanceof HTMLIFrameElement)
+ if (content.document.activeElement instanceof Ci.nsIDOMHTMLIFrameElement)
content.document.activeElement.blur();
});
}
tag = function (map) [
let (c = obj.modes[0].char) c ? c + "_" : "",
map
- ]
+ ];
link = function (map) {
let [, mode, name, extra] = /^(?:(.)_)?(?:<([^>]+)>)?(.*)$/.exec(map);
let k = ["k", {}, extra];
let description = ["description", {},
obj.description ? ["p", {}, template.linkifyHelp(obj.description.replace(/\.?$/, "."), true)] : "",
extraHelp ? extraHelp : "",
- !(extraHelp || obj.description) ? ["p", {}, /*L*/ "Sorry, no help available."] : ""]
+ !(extraHelp || obj.description) ? ["p", {}, /*L*/ "Sorry, no help available."] : ""];
res.push(
["item", {},
* @param {function} func The function to call
* @param {object} self The 'this' object for the function.
*/
- trapErrors: function trapErrors(func, self) {
+ trapErrors: function trapErrors(func, self, ...args) {
try {
if (isString(func))
func = self[func];
- return func.apply(self || this, Array.slice(arguments, 2));
+ return func.apply(self || this, args);
}
catch (e) {
try {
dactyl.reportError(e, true);
}
});
- }
+ };
},
/**
groups.every(function (g) !g.validator || g.validator(val))
});
- options.add(["helpfile", "hf"],
- "Name of the main help file",
- "string", "intro");
-
options.add(["loadplugins", "lpl"],
"A regexp list that defines which plugins are loaded at startup and via :loadplugins",
"regexplist", "'\\.(js|" + config.fileExtension + ")$'");
commandline.commandOutput([
["div", {}, [config.appName, " ", config.version, date, " running on: "].join("")],
["div", {}, [window.navigator.userAgent].join("")]
- ])
+ ]);
}
}, {
argCount: "0",
}
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
Ci.nsIDocShell.ENUMERATE_FORWARDS);
while (docShells.hasMoreElements())
try {
- yield docShells.getNext().QueryInterface(Ci.nsIDocShell).contentViewer.DOMDocument;
+ yield docShells.getNext().QueryInterface(Ci.nsIDocShell).contentViewer.DOMDocument;
}
catch (e) {}
}
var EXPORTED_SYMBOLS = ["cleanup", "init"];
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
}
try {
- var tmpfile = io.createTempFile();
+ var tmpfile = io.createTempFile("txt", "." + buffer.uri.host);
if (!tmpfile)
throw Error(_("io.cantCreateTempFile"));
function addBeginInsertModeMap(keys, commands, description) {
mappings.add([modes.TEXT_EDIT], keys, description || "",
function () {
- commands.forEach(function (cmd) { editor.executeCommand(cmd, 1) });
+ commands.forEach(function (cmd) { editor.executeCommand(cmd, 1); });
modes.push(modes.INSERT);
},
{ type: "editor" });
mappings.add([modes.TEXT_EDIT], names, description,
action, update({ type: "editor" }, params));
-
bind(["<C-a>"], "Increment the next number",
- function ({ count }) { editor.modifyNumber(count || 1) },
+ function ({ count }) { editor.modifyNumber(count || 1); },
{ count: true });
bind(["<C-x>"], "Decrement the next number",
- function ({ count }) { editor.modifyNumber(-(count || 1)) },
+ function ({ count }) { editor.modifyNumber(-(count || 1)); },
{ count: true });
// text edit mode
bind(["u"], "Undo changes",
- function (args) {
- editor.editor.undo(Math.max(args.count, 1));
+ function ({ count }) {
+ editor.editor.undo(Math.max(count, 1));
editor.deselect();
},
{ count: true, noTransaction: true });
bind(["<C-r>"], "Redo undone changes",
- function (args) {
- editor.editor.redo(Math.max(args.count, 1));
+ function ({ count }) {
+ editor.editor.redo(Math.max(count, 1));
editor.deselect();
},
{ count: true, noTransaction: true });
},
{ count: true });
- let bind = function bind() mappings.add.apply(mappings,
- [[modes.AUTOCOMPLETE]].concat(Array.slice(arguments)))
+ let bind = function bind(...args) mappings.add.apply(mappings, [[modes.AUTOCOMPLETE]].concat(args));
bind(["<Esc>"], "Return to Insert mode",
function () Events.PASS_THROUGH);
}
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
if (!(services.focus.getLastFocusMethod(win) & 0x3000)
&& events.isContentNode(elem)
&& !buffer.focusAllowed(elem)
- && isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement, Window])) {
+ && isinstance(elem, [Ci.nsIDOMHTMLInputElement,
+ Ci.nsIDOMHTMLSelectElement,
+ Ci.nsIDOMHTMLTextAreaElement,
+ Ci.nsIDOMWindow])) {
if (elem.frameElement)
dactyl.focusContent(true);
// Hack to deal with <BS> and so forth not dispatching input
// events
- if (key && event.originalTarget instanceof HTMLInputElement && !modes.main.passthrough) {
+ if (key && event.originalTarget instanceof Ci.nsIDOMHTMLInputElement && !modes.main.passthrough) {
let elem = event.originalTarget;
elem.dactylKeyPress = elem.value;
util.timeout(function () {
// access to the real focus target
// Huh? --djk
onFocusChange: util.wrapCallback(function onFocusChange(event) {
- function hasHTMLDocument(win) win && win.document && win.document instanceof HTMLDocument
+ function hasHTMLDocument(win) win && win.document && win.document instanceof Ci.nsIDOMHTMLDocument
if (dactyl.ignoreFocus)
return;
if (elem && elem.readOnly)
return;
- if (isinstance(elem, [HTMLEmbedElement, HTMLEmbedElement])) {
+ if (isinstance(elem, [Ci.nsIDOMHTMLEmbedElement, Ci.nsIDOMHTMLEmbedElement])) {
if (!modes.main.passthrough && modes.main != modes.EMBED)
modes.push(modes.EMBED);
return;
isInputElement: function isInputElement(elem) {
return DOM(elem).isEditable ||
- isinstance(elem, [HTMLEmbedElement, HTMLObjectElement,
- HTMLSelectElement])
+ isinstance(elem, [Ci.nsIDOMHTMLEmbedElement,
+ Ci.nsIDOMHTMLObjectElement,
+ Ci.nsIDOMHTMLSelectElement]);
},
kill: function kill(event) {
}
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
document.addEventListener("load", checkFragment, true);
document.addEventListener("hashChange", checkFragment, true);
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
if (elem.hasAttributeNS(NS, "hint"))
[hint.text, hint.showText] = [elem.getAttributeNS(NS, "hint"), true];
- else if (isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement]))
+ else if (isinstance(elem, [Ci.nsIDOMHTMLInputElement,
+ Ci.nsIDOMHTMLSelectElement,
+ Ci.nsIDOMHTMLTextAreaElement]))
[hint.text, hint.showText] = hints.getInputHint(elem, doc);
- else if (elem.firstElementChild instanceof HTMLImageElement && /^\s*$/.test(elem.textContent))
+ else if (elem.firstElementChild instanceof Ci.nsIDOMHTMLImageElement && /^\s*$/.test(elem.textContent))
[hint.text, hint.showText] = [elem.firstElementChild.alt || elem.firstElementChild.title, true];
else
hint.text = elem.textContent.toLowerCase();
let leftPos = Math.max((rect.left + offsetX), offsetX);
let topPos = Math.max((rect.top + offsetY), offsetY);
- if (elem instanceof HTMLAreaElement)
+ if (elem instanceof Ci.nsIDOMHTMLAreaElement)
[leftPos, topPos] = this.getAreaOffset(elem, leftPos, topPos);
hint.span.setAttribute("style", ["display: none; left:", leftPos, "px; top:", topPos, "px"].join(""));
if (!hint.valid)
continue inner;
- if (hint.text == "" && hint.elem.firstChild && hint.elem.firstChild instanceof HTMLImageElement) {
+ if (hint.text == "" && hint.elem.firstChild && hint.elem.firstChild instanceof Ci.nsIDOMHTMLImageElement) {
if (!hint.imgSpan) {
let rect = hint.elem.firstChild.getBoundingClientRect();
if (!rect)
let str = this.getHintString(hintnum);
let text = [];
- if (hint.elem instanceof HTMLInputElement)
+ if (hint.elem instanceof Ci.nsIDOMHTMLInputElement)
if (hint.elem.type === "radio")
text.push(UTF8(hint.elem.checked ? "⊙" : "○"));
else if (hint.elem.type === "checkbox")
this.addMode("i", "Show image", function (elem) dactyl.open(elem.src));
this.addMode("I", "Show image in a new tab", function (elem) dactyl.open(elem.src, dactyl.NEW_TAB));
- function isScrollable(elem) isinstance(elem, [HTMLFrameElement, HTMLIFrameElement]) ||
+ function isScrollable(elem) isinstance(elem, [Ci.nsIDOMHTMLFrameElement,
+ Ci.nsIDOMHTMLIFrameElement]) ||
Buffer.isScrollable(elem, 0, true) || Buffer.isScrollable(elem, 0, false);
},
else {
for (let [, option] in Iterator(options["hintinputs"])) {
if (option == "value") {
- if (elem instanceof HTMLSelectElement) {
+ if (elem instanceof Ci.nsIDOMHTMLSelectElement) {
if (elem.selectedIndex >= 0)
return [elem.item(elem.selectedIndex).text.toLowerCase(), false];
}
{
values: {
"0": "Follow the first hint as soon as typed text uniquely identifies it. Follow the selected hint on <Return>.",
- "1": "Follow the selected hint on <Return>.",
+ "1": "Follow the selected hint on <Return>."
}
});
}
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
},
get session() {
- let webNav = window.getWebNavigation()
+ let webNav = window.getWebNavigation();
let sh = webNav.sessionHistory;
let obj = [];
obj.__defineGetter__("index", function () sh.index);
- obj.__defineSetter__("index", function (val) { webNav.gotoIndex(val) });
+ obj.__defineSetter__("index", function (val) { webNav.gotoIndex(val); });
obj.__iterator__ = function () array.iterItems(this);
for (let item in iter(sh.SHistoryEnumerator, Ci.nsIHistoryEntry))
completion.addUrlCompleter("history", "History", completion.history);
},
mappings: function initMappings() {
- function bind() mappings.add.apply(mappings, [config.browserModes].concat(Array.slice(arguments)));
+ function bind(...args) mappings.add.apply(mappings, [config.browserModes].concat(args));
bind(["<C-o>"], "Go to an older position in the jump list",
function ({ count }) { history.stepTo(-Math.max(count, 1), true); },
{ count: true });
bind(["[d"], "Go back to the previous domain in the browser history",
- function ({ count }) { history.search("domain", -Math.max(count, 1)) },
+ function ({ count }) { history.search("domain", -Math.max(count, 1)); },
{ count: true });
bind(["]d"], "Go forward to the next domain in the browser history",
- function ({ count }) { history.search("domain", Math.max(count, 1)) },
+ function ({ count }) { history.search("domain", Math.max(count, 1)); },
{ count: true });
}
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
},
execute: function execute(map, args)
- let (self = this)
- function execute() {
- if (self.preExecute)
- self.preExecute.apply(self, args);
+ () => {
+ if (this.preExecute)
+ this.preExecute.apply(this, args);
- args.self = self.main.params.mappingSelf || self.main.mappingSelf || map;
- let res = map.execute.call(map, args);
+ args.self = this.main.params.mappingSelf || this.main.mappingSelf || map;
+ let res = map.execute.call(map, args);
- if (self.postExecute)
- self.postExecute.apply(self, args);
- return res;
- },
+ if (this.postExecute)
+ this.postExecute.apply(this, args);
+ return res;
+ },
onKeyPress: function onKeyPress(event) {
if (event.skipmap)
}
});
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
contexts.context,
args);
- let self = this;
- function repeat() self.action(args)
+ let repeat = () => this.action(args);
if (this.names[0] != ".") // FIXME: Kludge.
mappings.repeat = repeat;
["td", {}, modeSign],
["td", {}, name],
["td", {}, map.rhs || map.action.toSource()]])),
- ["tr", { style: "height: .5ex;" }]])]
+ ["tr", { style: "height: .5ex;" }]])];
// E4X-FIXME
// // TODO: Move this to an ItemList to show this automatically
options: [
{
names: ["-arg", "-a"],
- description: "Accept an argument after the requisite key press",
+ description: "Accept an argument after the requisite key press"
},
{
names: ["-builtin", "-b"],
mappings: function initMappings(dactyl, modules, window) {
mappings.add([modes.COMMAND],
["\\"], "Emits <Leader> pseudo-key",
- function () { events.feedkeys("<Leader>") });
+ function () { events.feedkeys("<Leader>"); });
}
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
_scrollTo: function _scrollTo(mark) {
if (!mark.path)
- var node = buffer.findScrollable(0, (mark.offset || mark.position).x)
+ var node = buffer.findScrollable(0, (mark.offset || mark.position).x);
else
for (node in DOM.XPath(mark.path, buffer.focusedFrame.document))
break;
Math.round(mark.position.y * 100) + "%)",
(tab && "tab: " + tabs.index(tab))
].filter(util.identity).join(", ");
-
},
isLocalMark: bind("test", /^[a-z`']$/),
}
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
},
setter: function (vals) {
- modes.all.forEach(function (m) { delete m.passUnknown });
+ modes.all.forEach(function (m) { delete m.passUnknown; });
vals = vals.map(function (v) update(new String(v.toLowerCase()), {
mode: v.replace(/^!/, "").toUpperCase(),
},
prefs: function initPrefs() {
prefs.watch("accessibility.browsewithcaret",
- function () { modes.onCaretChange.apply(modes, arguments) });
+ function () { modes.onCaretChange.apply(modes, arguments); });
}
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
dactyl.open(event.target.href, where);
};
- if (event.target instanceof HTMLAnchorElement)
+ if (event.target instanceof Ci.nsIDOMHTMLAnchorElement)
switch (DOM.Event.stringify(event)) {
case "<LeftMouse>":
openLink(dactyl.CURRENT_TAB);
popupshowing: function onPopupShowing(event) {
let menu = commandline.widgets.contextMenu;
let enabled = {
- link: window.document.popupNode instanceof HTMLAnchorElement,
+ link: window.document.popupNode instanceof Ci.nsIDOMHTMLAnchorElement,
path: window.document.popupNode.hasAttribute("path"),
selection: !window.document.commandDispatcher.focusedWindow.getSelection().isCollapsed
};
}
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
}
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
});
},
- updateUrl: deprecated("statusline.status", function updateUrl(url) { this.status = url || buffer.uri }),
+ updateUrl: deprecated("statusline.status", function updateUrl(url) { this.status = url || buffer.uri; }),
/**
* Set the contents of the status line's input buffer to the given
}
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
return this._groups;
if (func)
- func = bind(function (func) { func(this._groups) }, this, func);
+ func = bind(function (func) { func(this._groups); }, this, func);
if (window.TabView && window.TabView._initFrame)
window.TabView._initFrame(func);
completion.listCompleter("buffer", filter);
},
-
/**
* Return an iterator of tabs matching the given filter. If no
* *filter* or *count* is provided, returns the currently selected
}
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
</p>
<p>
- If the <em>-group</em>=<a>group</a> flag is given, add this autocmd
- to the named <t>group</t>. Any filters for <a>group</a> apply in
- addition to <oa>filter</oa>. When listing commands this limits the
- output to the specified group.
+ If the <em>-group</em>=<a>group</a> flag is given, add this
+ autocommand to the named <t>group</t>. Any filters for <a>group</a>
+ apply in addition to <oa>filter</oa>. When listing commands this
+ limits the output to the specified group.
</p>
<p>Available <oa>events</oa>:</p>
</description>
</item>
-<item>
- <tags>'noprivate' 'private'</tags>
- <spec>'private'</spec>
- <type>&option.private.type;</type>
- <default>&option.private.default;</default>
- <description>
- <p>
- Set the <str>private browsing</str> option. In private browsing mode
- history, cache files, cookies, form data, passwords, download list
- entries, local and URL <t>marks</t>, <t>command-line</t> history
- and macros are available only for the duration of the private
- browsing session and deleted when returning to normal browsing
- mode. See also <t>privacy</t>.
- </p>
- </description>
-</item>
-
<item>
<tags>$&dactyl.idName;_RUNTIME</tags>
<tags>'rtp' 'runtimepath'</tags>
When in private browsing mode, no data other than Bookmarks and QuickMarks
are written to disk. Further, upon exiting private mode, all newly
accumulated data, including <t>command-line</t> history, local and URL
- marks, and macros, are purged from memory. For more information, see
- <o>private</o>.
+ marks, and macros, are purged from memory.
</p>
<h2 tag="sanitizing clearing-data">Clearing private data</h2>
this.lazyRequire("completion", ["completion"]);
lazyRequire("template", ["template"]);
-var callResult = function callResult(method) {
- let args = Array.slice(arguments, 1);
+var callResult = function callResult(method, ...args) {
return function (result) { result[method].apply(result, args); };
}
this.dactyl[install.error ? "echoerr" : "echomsg"](
_("addon.error", action, event, (install.name || install.sourceURI.spec) +
(install.error ? ": " + addons.errors[install.error] : "")));
- }
+ };
var AddonListener = Class("AddonListener", {
init: function init(modules) {
},
get filter() {
return function (addon) !addon.userDisabled &&
- !(addon.operationsRequiringRestart & (AddonManager.OP_NEEDS_RESTART_ENABLE | AddonManager.OP_NEEDS_RESTART_DISABLE))
+ !(addon.operationsRequiringRestart & (AddonManager.OP_NEEDS_RESTART_ENABLE | AddonManager.OP_NEEDS_RESTART_DISABLE));
},
perm: "disable"
},
["span", { highlight: pending[0] }, pending[1]],
" on ",
["a", { href: "#", "dactyl:command": "dactyl.restart" }, "restart"],
- ")"]
+ ")"];
return info;
},
update: function callee() {
- let self = this;
- function update(key, xml) {
- let node = self.nodes[key];
+ let update = (key, xml) => {
+ let node = this.nodes[key];
while (node.firstChild)
node.removeChild(node.firstChild);
}
if (!file.exists())
- AddonManager.getInstallForURL(url, install, "application/x-xpinstall");
+ AddonManager.getInstallForURL(url, install, "application/x-xpinstall");
else if (file.isReadable() && file.isFile())
- AddonManager.getInstallForFile(file, install, "application/x-xpinstall");
+ AddonManager.getInstallForFile(file.file, install, "application/x-xpinstall");
else if (file.isDirectory())
dactyl.echoerr(_("addon.cantInstallDir", file.path.quote()));
else
} catch(e){ if (isString(e)) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
-// Copyright (c) 2009-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2009-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
}
});
defineModule.prefix = "";
-defineModule.dump = function dump_() {
- let msg = Array.map(arguments, function (msg) {
+defineModule.dump = function dump_(...args) {
+ let msg = args.map(function (msg) {
if (loaded.util && typeof msg == "object")
msg = util.objectToString(msg);
return msg;
.replace(/^./gm, JSMLoader.name + ": $&"));
}
defineModule.modules = [];
-defineModule.time = function time(major, minor, func, self) {
+defineModule.time = function time(major, minor, func, self, ...args) {
let time = Date.now();
if (typeof func !== "function")
func = self[func];
try {
- var res = func.apply(self, Array.slice(arguments, 4));
+ var res = func.apply(self, args);
}
catch (e) {
loaded.util && util.reportError(e);
return array.uniq([k for (k in obj)].concat(
Object.getOwnPropertyNames(
XPCNativeWrapper.unwrap(obj))
- .filter(filter)))
+ .filter(filter)));
}
else if (!e.stack) {
throw Error(e);
return fn;
// Close over function with 'this'
- function close(self, fn) function () fn.apply(self, Array.slice(arguments));
+ function close(self, fn) function () fn.apply(self, arguments);
if (acc == null)
acc = [];
- return function curried() {
- let args = acc.concat(Array.slice(arguments));
-
+ return function curried(...args) {
// The curried result should preserve 'this'
- if (arguments.length == 0)
+ if (args.length == 0)
return close(self || this, curried);
+ let args = acc.concat(args);
+
if (args.length >= length)
return fn.apply(self || this, args);
}
if (curry.bind)
- var bind = function bind(meth, self) let (func = callable(meth) ? meth : self[meth])
- func.bind.apply(func, Array.slice(arguments, 1));
+ var bind = function bind(meth, self, ...args) let (func = callable(meth) ? meth : self[meth])
+ func.bind.apply(func, [self].concat(args));
else
- var bind = function bind(func, self) {
+ var bind = function bind(func, self, ...args) {
if (!callable(func))
func = self[func];
- let args = Array.slice(arguments, bind.length);
- return function bound() func.apply(self, args.concat(Array.slice(arguments)));
+ return function bound(...args2) func.apply(self, args.concat(args2));
};
/**
*/
function callable(val) typeof val === "function" && !(val instanceof Ci.nsIDOMElement);
-function call(fn) {
- fn.apply(arguments[1], Array.slice(arguments, 2));
+function call(fn, self, ...args) {
+ fn.apply(self, args);
return fn;
}
func.superapply = function superapply(self, args)
let (meth = Object.getPrototypeOf(target)[k])
meth && meth.apply(self, args);
- func.supercall = function supercall(self)
- func.superapply(self, Array.slice(arguments, 1));
+ func.supercall = function supercall(self, ...args)
+ func.superapply(self, args);
}
}
Object.defineProperty(target, k, desc);
func.superapply = function super_apply(self, args)
let (meth = Object.getPrototypeOf(target)[k])
meth && meth.apply(self, args);
- func.supercall = function super_call(self)
- func.superapply(self, Array.slice(arguments, 1));
+ func.supercall = function super_call(self, ...args)
+ func.superapply(self, args);
}
}
Object.defineProperty(target, k, desc);
*
* @returns {function} The constructor for the resulting class.
*/
-function Class() {
+function Class(...args) {
- var args = Array.slice(arguments);
if (isString(args[0]))
var name = args.shift();
var superclass = Class;
* @returns {nsITimer} The timer which backs this timeout.
*/
timeout: function timeout(callback, timeout) {
- const self = this;
- function timeout_notify(timer) {
- if (self.stale ||
+ let timeout_notify = (timer) => {
+ if (this.stale ||
util.rehashing && !isinstance(Cu.getGlobalForObject(callback), ["BackstagePass"]))
return;
- self.timeouts.splice(self.timeouts.indexOf(timer), 1);
- util.trapErrors(callback, self);
- }
+ this.timeouts.splice(this.timeouts.indexOf(timer), 1);
+ util.trapErrors(callback, this);
+ };
let timer = services.Timer(timeout_notify, timeout || 0, services.Timer.TYPE_ONE_SHOT);
this.timeouts.push(timer);
return timer;
* localized properties.
*/
update: function update() {
- let self = this;
// XXX: Duplication.
for (let i = 0; i < arguments.length; i++) {
let src = arguments[i];
- Object.getOwnPropertyNames(src || {}).forEach(function (k) {
+ Object.getOwnPropertyNames(src || {}).forEach((k) => {
let desc = Object.getOwnPropertyDescriptor(src, k);
if (desc.value instanceof Class.Property)
desc = desc.value.init(k, this) || desc.value;
if (typeof desc.value === "function") {
let func = desc.value.wrapped || desc.value;
if (!func.superapply) {
- func.__defineGetter__("super", function () Object.getPrototypeOf(self)[k]);
- func.superapply = function superapply(self, args)
- let (meth = Object.getPrototypeOf(self)[k])
- meth && meth.apply(self, args);
- func.supercall = function supercall(self)
- func.superapply(self, Array.slice(arguments, 1));
+ func.__defineGetter__("super", () => Object.getPrototypeOf(this)[k]);
+
+ func.superapply = function superapply(self, args) {
+ let meth = Object.getPrototypeOf(self)[k];
+ return meth && meth.apply(self, args);
+ };
+
+ func.supercall = function supercall(self, ...args) {
+ return func.superapply(self, args);
+ }
}
}
getInterfaces: function (count) { count.value = 0; }
});
return (interfaces || []).reduce(function (shim, iface) shim.QueryInterface(Ci[iface]),
- ip.data)
+ ip.data);
};
let stub = Class.Property({
configurable: true,
init: function EB_init(message, level) {
level = level || 0;
let error = Error(message);
- update(this, error)
+ update(this, error);
this.stack = error.stack;
this.message = message;
* @param {Object} classProperties Properties to be applied to the class constructor.
* @returns {Class}
*/
-function Module(name, prototype) {
+function Module(name, prototype, ...args) {
try {
- let init = callable(prototype) ? 4 : 3;
- let proto = arguments[callable(prototype) ? 2 : 1];
+ let init = callable(prototype) ? 2 : 1;
+ let proto = callable(prototype) ? args[0] : prototype;
proto._metaInit_ = function () {
delete module.prototype._metaInit_;
currentModule[name.toLowerCase()] = this;
};
- const module = Class.apply(Class, Array.slice(arguments, 0, init));
+ const module = Class.apply(Class, [name, prototype, ...args.slice(0, init)]);
let instance = module();
module.className = name.toLowerCase();
instance.INIT = update(Object.create(Module.INIT),
- arguments[init] || {});
+ args[init] || {});
currentModule[module.className] = instance;
defineModule.modules.push(instance);
module.isLocalModule = true;
modules.jsmodules[this.constructor.className] = module;
- locals.reverse().forEach(function (fn, i) update(objs[i], fn.apply(module, args)))
+ locals.reverse().forEach(function (fn, i) update(objs[i], fn.apply(module, args)));
memoize(module, "closure", Class.makeClosure);
module.instance = module;
*
* @returns {function} The constructor for the new Struct.
*/
-function Struct() {
- if (!/^[A-Z]/.test(arguments[0]))
- var args = Array.slice(arguments, 0);
- else {
- var className = arguments[0];
- args = Array.slice(arguments, 1);
- }
+function Struct(...args) {
+ if (/^[A-Z]/.test(args[0]))
+ var className = args.shift();
const Struct = Class(className || "Struct", StructBase, {
length: args.length,
},
array: ary,
toString: function () this.array.toString(),
- concat: function () this.__noSuchMethod__("concat", Array.slice(arguments)),
- filter: function () this.__noSuchMethod__("filter", Array.slice(arguments)),
- map: function () this.__noSuchMethod__("map", Array.slice(arguments))
+ concat: function (...args) this.__noSuchMethod__("concat", args),
+ filter: function (...args) this.__noSuchMethod__("filter", args),
+ map: function (...args) this.__noSuchMethod__("map", args)
};
}
}, {
/* Make Minefield not explode, because Minefield exploding is not fun. */
let iterProto = Iter.prototype;
Object.keys(iter).forEach(function (k) {
- iterProto[k] = function () {
- let res = iter[k].apply(iter, [this].concat(Array.slice(arguments)));
+ iterProto[k] = function (...args) {
+ let res = iter[k].apply(iter, [this].concat(args));
if (isinstance(res, ["Iterator", "Generator"]))
return Iter(res);
return res;
Object.keys(array).forEach(function (k) {
if (!(k in iterProto))
- iterProto[k] = function () {
- let res = array[k].apply(array, [this.toArray()].concat(Array.slice(arguments)));
+ iterProto[k] = function (...args) {
+ let res = array[k].apply(array, [this.toArray()].concat(args));
if (isinstance(res, ["Iterator", "Generator"]))
return Iter(res);
if (isArray(res))
// catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);}
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
endModule();
-// vim: set fdm=marker sw=4 sts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
Components.utils.import("resource://gre/modules/Services.jsm");
function loadSubScript() Services.scriptloader.loadSubScript.apply(null, arguments);
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
let win = services.focus.focusedWindow;
if (!win || win == window || util.topWindow(win) != window)
- return window.content
+ return window.content;
if (win.top == window)
return win;
return win.top;
services.contentPrefs.getPref(this.uri, pref,
sanitizer.getContext(this.win), callback);
else
- services.contentPrefs.getPref(uri, pref, callback);
+ services.contentPrefs.getPref(this.uri, pref, callback);
},
/**
*/
get zoomLevel() {
let v = this.contentViewer;
- return v[v.textZoom == 1 ? "fullZoom" : "textZoom"] * 100
+ return v[v.textZoom == 1 ? "fullZoom" : "textZoom"] * 100;
},
set zoomLevel(value) { this.setZoom(value, this.fullZoom); },
* vertical percentages. See {@link Buffer.scrollToPercent} for
* parameters.
*/
- scrollToPercent: function scrollToPercent(horizontal, vertical)
- Buffer.scrollToPercent(this.findScrollable(0, vertical == null), horizontal, vertical),
+ scrollToPercent: function scrollToPercent(horizontal, vertical, dir)
+ Buffer.scrollToPercent(this.findScrollable(dir || 0, vertical == null), horizontal, vertical),
/**
* Scrolls the currently active element to the given horizontal and
let distance = reverse ? function (rect) -rect.top : function (rect) rect.top;
let elems = [[e, distance(e.getBoundingClientRect())] for (e in path.matcher(this.focusedFrame.document))]
.filter(function (e) e[1] > FUDGE)
- .sort(function (a, b) a[1] - b[1])
+ .sort(function (a, b) a[1] - b[1]);
if (offScreen && !reverse)
elems = elems.filter(function (e) e[1] > this, this.topWindow.innerHeight);
showPageInfo: function showPageInfo(verbose, sections) {
let { commandline, dactyl, options } = this.modules;
- let self = this;
-
// Ctrl-g single line output
if (!verbose) {
let file = this.win.location.pathname.split("/").pop() || _("buffer.noName");
let info = template.map(
(sections || options["pageinfo"])
- .map(function (opt) Buffer.pageInfo[opt].action.call(self)),
+ .map((opt) => Buffer.pageInfo[opt].action.call(this)),
function (res) res && iter(res).join(", ") || undefined,
", ").join("");
return;
}
- let list = template.map(sections || options["pageinfo"], function (option) {
+ let list = template.map(sections || options["pageinfo"], (option) => {
let { action, title } = Buffer.pageInfo[option];
- return template.table(title, action.call(self, true));
+ return template.table(title, action.call(this, true));
}, ["br"]);
commandline.commandOutput(list);
let ext = uri.fileExtension || "txt";
if (doc.contentType)
- ext = services.mime.getPrimaryExtension(doc.contentType, ext);
+ try {
+ ext = services.mime.getPrimaryExtension(doc.contentType, ext);
+ }
+ catch (e) {}
if (!isString(doc))
return io.withTempFiles(function (temp) {
* Updates the zoom level of this buffer from a content preference.
*/
updateZoom: util.wrapCallback(function updateZoom() {
- let self = this;
let uri = this.uri;
if (prefs.get("browser.zoom.siteSpecific")) {
- this.getPref("dactyl.content.full-zoom", function (val) {
- if (val != null && uri.equals(self.uri) && val != prefs.get("browser.zoom.full"))
- [self.contentViewer.textZoom, self.contentViewer.fullZoom] =
- [self.contentViewer.fullZoom, self.contentViewer.textZoom];
+ this.getPref("dactyl.content.full-zoom", (val) => {
+ if (val != null && uri.equals(this.uri) && val != prefs.get("browser.zoom.full"))
+ [this.contentViewer.textZoom, this.contentViewer.fullZoom] =
+ [this.contentViewer.fullZoom, this.contentViewer.textZoom];
});
}
}),
get scrollRightMax() this.win.scrollMaxY,
get scrollLeft() this.win.scrollX,
- set scrollLeft(val) { this.win.scrollTo(val, this.win.scrollY) },
+ 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) }
+ set scrollTop(val) { this.win.scrollTo(this.win.scrollX, val); }
};
return elem;
},
return elem[pos] > 0;
let max = pos + "Max";
- if (max in elem && pos > 0)
- return elem[pos] < elem[max];
+ if (max in elem) {
+ if (elem[pos] < elem[max])
+ return true;
+ if (dir > 0)
+ return false;
+ return elem[pos] > 0;
+ }
let style = DOM(elem).style;
let borderSize = Math.round(parseFloat(style[border1]) + parseFloat(style[border2]));
return {
x: elem.scrollLeft && elem.scrollLeft / this._exWidth(node),
y: elem.scrollTop / parseFloat(style.lineHeight)
- }
+ };
},
_exWidth: function _exWidth(elem) {
const BRANCH = "printer_" + PRINTER + ".";
const BRANCHES = ["print.", BRANCH, "print." + BRANCH];
function set(pref, value) {
- BRANCHES.forEach(function (branch) { prefs.set(branch + pref, value) });
+ BRANCHES.forEach(function (branch) { prefs.set(branch + pref, value); });
}
prefs.withContext(function () {
mappings.add([modes.NORMAL],
["<C-a>", "<increment-url-path>"], "Increment last number in URL",
- function (args) { buffer.incrementURL(Math.max(args.count, 1)); },
+ function ({ count }) { buffer.incrementURL(Math.max(count, 1)); },
{ count: true });
mappings.add([modes.NORMAL],
["<C-x>", "<decrement-url-path>"], "Decrement last number in URL",
- function (args) { buffer.incrementURL(-Math.max(args.count, 1)); },
+ function ({ count }) { buffer.incrementURL(-Math.max(count, 1)); },
{ count: true });
mappings.add([modes.NORMAL], ["gu", "<open-parent-path>"],
"Go to parent directory",
- function (args) { buffer.climbUrlPath(Math.max(args.count, 1)); },
+ function ({ count }) { buffer.climbUrlPath(Math.max(count, 1)); },
{ count: true });
mappings.add([modes.NORMAL], ["gU", "<open-root-path>"],
mappings.add([modes.COMMAND], [".", "<repeat-key>"],
"Repeat the last key event",
- function (args) {
+ function ({ count }) {
if (mappings.repeat) {
- for (let i in util.interruptibleRange(0, Math.max(args.count, 1), 100))
+ for (let i in util.interruptibleRange(0, Math.max(count, 1), 100))
mappings.repeat();
}
},
// scrolling
mappings.add([modes.NORMAL], ["j", "<Down>", "<C-e>", "<scroll-down-line>"],
"Scroll document down",
- function (args) { buffer.scrollVertical("lines", Math.max(args.count, 1)); },
+ function ({ count }) { buffer.scrollVertical("lines", Math.max(count, 1)); },
{ count: true });
mappings.add([modes.NORMAL], ["k", "<Up>", "<C-y>", "<scroll-up-line>"],
"Scroll document up",
- function (args) { buffer.scrollVertical("lines", -Math.max(args.count, 1)); },
+ function ({ count }) { buffer.scrollVertical("lines", -Math.max(count, 1)); },
{ count: true });
mappings.add([modes.NORMAL], dactyl.has("mail") ? ["h", "<scroll-left-column>"] : ["h", "<Left>", "<scroll-left-column>"],
"Scroll document to the left",
- function (args) { buffer.scrollHorizontal("columns", -Math.max(args.count, 1)); },
+ function ({ count }) { buffer.scrollHorizontal("columns", -Math.max(count, 1)); },
{ count: true });
mappings.add([modes.NORMAL], dactyl.has("mail") ? ["l", "<scroll-right-column>"] : ["l", "<Right>", "<scroll-right-column>"],
"Scroll document to the right",
- function (args) { buffer.scrollHorizontal("columns", Math.max(args.count, 1)); },
+ function ({ count }) { buffer.scrollHorizontal("columns", Math.max(count, 1)); },
{ count: true });
mappings.add([modes.NORMAL], ["0", "^", "<scroll-begin>"],
mappings.add([modes.NORMAL], ["gg", "<Home>", "<scroll-top>"],
"Go to the top of the document",
- function (args) { buffer.scrollToPercent(null, args.count != null ? args.count : 0); },
+ function ({ count }) { buffer.scrollToPercent(null, count != null ? count : 0,
+ count != null ? 0 : -1); },
{ count: true });
mappings.add([modes.NORMAL], ["G", "<End>", "<scroll-bottom>"],
"Go to the end of the document",
- function (args) {
- if (args.count)
+ function ({ count }) {
+ if (count)
var elem = options.get("linenumbers")
.getLine(buffer.focusedFrame.document,
- args.count);
+ count);
if (elem)
elem.scrollIntoView(true);
- else if (args.count)
- buffer.scrollToPosition(null, args.count);
+ else if (count)
+ buffer.scrollToPosition(null, count);
else
- buffer.scrollToPercent(null, 100);
+ buffer.scrollToPercent(null, 100, 1);
},
{ count: true });
mappings.add([modes.NORMAL], ["%", "<scroll-percent>"],
"Scroll to {count} percent of the document",
- function (args) {
- dactyl.assert(args.count > 0 && args.count <= 100);
- buffer.scrollToPercent(null, args.count);
+ function ({ count }) {
+ dactyl.assert(count > 0 && count <= 100);
+ buffer.scrollToPercent(null, count);
},
{ count: true });
mappings.add([modes.NORMAL], ["<C-d>", "<scroll-down>"],
"Scroll window downwards in the buffer",
- function (args) { buffer._scrollByScrollSize(args.count, true); },
+ function ({ count }) { buffer._scrollByScrollSize(count, true); },
{ count: true });
mappings.add([modes.NORMAL], ["<C-u>", "<scroll-up>"],
"Scroll window upwards in the buffer",
- function (args) { buffer._scrollByScrollSize(args.count, false); },
+ function ({ count }) { buffer._scrollByScrollSize(count, false); },
{ count: true });
mappings.add([modes.NORMAL], ["<C-b>", "<PageUp>", "<S-Space>", "<scroll-up-page>"],
"Scroll up a full page",
- function (args) { buffer.scrollVertical("pages", -Math.max(args.count, 1)); },
+ function ({ count }) { buffer.scrollVertical("pages", -Math.max(count, 1)); },
{ count: true });
mappings.add([modes.NORMAL], ["<Space>"],
"Scroll down a full page",
- function (args) {
+ function ({ count }) {
if (isinstance((services.focus.focusedWindow || buffer.win).document.activeElement,
[Ci.nsIDOMHTMLInputElement,
Ci.nsIDOMHTMLButtonElement,
Ci.nsIDOMXULButtonElement]))
return Events.PASS;
- buffer.scrollVertical("pages", Math.max(args.count, 1));
+ buffer.scrollVertical("pages", Math.max(count, 1));
},
{ count: true });
mappings.add([modes.NORMAL], ["<C-f>", "<PageDown>", "<scroll-down-page>"],
"Scroll down a full page",
- function (args) { buffer.scrollVertical("pages", Math.max(args.count, 1)); },
+ function ({ count }) { buffer.scrollVertical("pages", Math.max(count, 1)); },
{ count: true });
mappings.add([modes.NORMAL], ["]f", "<previous-frame>"],
"Focus next frame",
- function (args) { buffer.shiftFrameFocus(Math.max(args.count, 1)); },
+ function ({ count }) { buffer.shiftFrameFocus(Math.max(count, 1)); },
{ count: true });
mappings.add([modes.NORMAL], ["[f", "<next-frame>"],
"Focus previous frame",
- function (args) { buffer.shiftFrameFocus(-Math.max(args.count, 1)); },
+ function ({ count }) { buffer.shiftFrameFocus(-Math.max(count, 1)); },
{ count: true });
mappings.add([modes.NORMAL], ["["],
"Jump to the previous element as defined by 'jumptags'",
- function (args) { buffer.findJump(args.arg, args.count, true); },
+ function ({ arg, count }) { buffer.findJump(arg, count, true); },
{ arg: true, count: true });
mappings.add([modes.NORMAL], ["g]"],
"Jump to the next off-screen element as defined by 'jumptags'",
- function (args) { buffer.findJump(args.arg, args.count, false, true); },
+ function ({ arg, count }) { buffer.findJump(arg, count, false, true); },
{ arg: true, count: true });
mappings.add([modes.NORMAL], ["]"],
"Jump to the next element as defined by 'jumptags'",
- function (args) { buffer.findJump(args.arg, args.count, false); },
+ function ({ arg, count }) { buffer.findJump(arg, count, false); },
{ arg: true, count: true });
mappings.add([modes.NORMAL], ["{"],
"Jump to the previous paragraph",
- function (args) { buffer.findJump("p", args.count, true); },
+ function ({ count }) { buffer.findJump("p", count, true); },
{ count: true });
mappings.add([modes.NORMAL], ["}"],
"Jump to the next paragraph",
- function (args) { buffer.findJump("p", args.count, false); },
+ function ({ count }) { buffer.findJump("p", count, false); },
{ count: true });
mappings.add([modes.NORMAL], ["]]", "<next-page>"],
"Follow the link labeled 'next' or '>' if it exists",
- function (args) {
- buffer.findLink("next", options["nextpattern"], (args.count || 1) - 1, true);
+ function ({ count }) {
+ buffer.findLink("next", options["nextpattern"], (count || 1) - 1, true);
},
{ count: true });
mappings.add([modes.NORMAL], ["[[", "<previous-page>"],
"Follow the link labeled 'prev', 'previous' or '<' if it exists",
- function (args) {
- buffer.findLink("prev", options["previouspattern"], (args.count || 1) - 1, true);
+ function ({ count }) {
+ buffer.findLink("prev", options["previouspattern"], (count || 1) - 1, true);
},
{ count: true });
mappings.add([modes.NORMAL], ["gi", "<focus-input>"],
"Focus last used input field",
- function (args) {
+ function ({ count }) {
let elem = buffer.lastInputField;
- if (args.count >= 1 || !elem || !events.isContentNode(elem)) {
+ if (count >= 1 || !elem || !events.isContentNode(elem)) {
let xpath = ["frame", "iframe", "input", "xul:textbox", "textarea[not(@disabled) and not(@readonly)]"];
let frames = buffer.allFrames(null, true);
});
dactyl.assert(elements.length > 0);
- elem = elements[Math.constrain(args.count, 1, elements.length) - 1];
+ elem = elements[Math.constrain(count, 1, elements.length) - 1];
}
buffer.focusElement(elem);
DOM(elem).scrollIntoView();
// zooming
mappings.add([modes.NORMAL], ["zi", "+", "<text-zoom-in>"],
"Enlarge text zoom of current web page",
- function (args) { buffer.zoomIn(Math.max(args.count, 1), false); },
+ function ({ count }) { buffer.zoomIn(Math.max(count, 1), false); },
{ count: true });
mappings.add([modes.NORMAL], ["zm", "<text-zoom-more>"],
"Enlarge text zoom of current web page by a larger amount",
- function (args) { buffer.zoomIn(Math.max(args.count, 1) * 3, false); },
+ function ({ count }) { buffer.zoomIn(Math.max(count, 1) * 3, false); },
{ count: true });
mappings.add([modes.NORMAL], ["zo", "-", "<text-zoom-out>"],
"Reduce text zoom of current web page",
- function (args) { buffer.zoomOut(Math.max(args.count, 1), false); },
+ function ({ count }) { buffer.zoomOut(Math.max(count, 1), false); },
{ count: true });
mappings.add([modes.NORMAL], ["zr", "<text-zoom-reduce>"],
"Reduce text zoom of current web page by a larger amount",
- function (args) { buffer.zoomOut(Math.max(args.count, 1) * 3, false); },
+ function ({ count }) { buffer.zoomOut(Math.max(count, 1) * 3, false); },
{ count: true });
mappings.add([modes.NORMAL], ["zz", "<text-zoom>"],
"Set text zoom value of current web page",
- function (args) { buffer.setZoom(args.count > 1 ? args.count : 100, false); },
+ function ({ count }) { buffer.setZoom(count > 1 ? count : 100, false); },
{ count: true });
mappings.add([modes.NORMAL], ["ZI", "zI", "<full-zoom-in>"],
"Enlarge full zoom of current web page",
- function (args) { buffer.zoomIn(Math.max(args.count, 1), true); },
+ function ({ count }) { buffer.zoomIn(Math.max(count, 1), true); },
{ count: true });
mappings.add([modes.NORMAL], ["ZM", "zM", "<full-zoom-more>"],
"Enlarge full zoom of current web page by a larger amount",
- function (args) { buffer.zoomIn(Math.max(args.count, 1) * 3, true); },
+ function ({ count }) { buffer.zoomIn(Math.max(count, 1) * 3, true); },
{ count: true });
mappings.add([modes.NORMAL], ["ZO", "zO", "<full-zoom-out>"],
"Reduce full zoom of current web page",
- function (args) { buffer.zoomOut(Math.max(args.count, 1), true); },
+ function ({ count }) { buffer.zoomOut(Math.max(count, 1), true); },
{ count: true });
mappings.add([modes.NORMAL], ["ZR", "zR", "<full-zoom-reduce>"],
"Reduce full zoom of current web page by a larger amount",
- function (args) { buffer.zoomOut(Math.max(args.count, 1) * 3, true); },
+ function ({ count }) { buffer.zoomOut(Math.max(count, 1) * 3, true); },
{ count: true });
mappings.add([modes.NORMAL], ["zZ", "<full-zoom>"],
"Set full zoom value of current web page",
- function (args) { buffer.setZoom(args.count > 1 ? args.count : 100, true); },
+ function ({ count }) { buffer.setZoom(count > 1 ? count : 100, true); },
{ count: true });
// page info
});
Buffer.addPageInfoSection("s", "Security", function (verbose) {
- let { statusline } = this.modules
+ let { statusline } = this.modules;
let identity = this.topWindow.gIdentityHandler;
endModule();
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
"cache": function (uri, path) {
let contentType = "text/plain";
try {
- contentType = services.mime.getTypeFromURI(uri)
+ contentType = services.mime.getTypeFromURI(uri);
}
catch (e) {}
// catch(e){ if (typeof e === "string") e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
-// vim: set fdm=marker sw=4 sts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
{ configurable: true, enumerable: true, get: function () opt.default };
if (prop.get && !prop.set)
- prop.set = function (val) { Class.replaceProperty(this, opt.names[0], val) };
+ prop.set = function (val) { Class.replaceProperty(this, opt.names[0], val); };
Object.defineProperty(res, opt.names[0], prop);
}
});
if (this.cached)
this.modules.initDependencies("commands");
this.cached = false;
- return array.iterValues(this._list.sort(function (a, b) a.name > b.name))
+ return array.iterValues(this._list.sort(function (a, b) a.name > b.name));
},
/** @property {string} The last executed Ex command line. */
this.remove(name);
}
- let self = this;
- let closure = function () self._map[name];
+ let closure = () => this._map[name];
memoize(this._map, name, function () commands.Command(specs, description, action, extra));
if (!extra.hidden)
if (sub.substr(0, 2) === "<<" && hereDoc)
let ([count, arg] = getNextArg(sub)) {
sub = arg + sub.substr(count);
- }
+ };
args.push(sub);
args.quote = null;
return dactyl.userEval(completer);
});
if (callable(result))
- return result.apply(this, Array.slice(arguments));
+ return result.apply(this, arguments);
else
return context.completions = result;
};
mappings.add([modes.COMMAND],
["@:"], "Repeat the last Ex command",
- function (args) {
+ function ({ count }) {
if (commands.repeat) {
- for (let i in util.interruptibleRange(0, Math.max(args.count, 1), 100))
+ for (let i in util.interruptibleRange(0, Math.max(count, 1), 100))
dactyl.execute(commands.repeat);
}
else
Commands.quoteMap = {
"\n": "\\n",
- "\t": "\\t",
+ "\t": "\\t"
};
Commands.quoteArg = {
} catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
* {@link #filters} array.
*/
this.filterFunc = function filterFunc(items) {
- let self = this;
- return this.filters.
- reduce(function r(res, filter) res.filter(function f(item) filter.call(self, item)),
- items);
+ return this.filters
+ .reduce((res, filter)
+ => res.filter((item) => filter.call(this, item)),
+ items);
};
/**
* @property {Array} An array of predicates on which to filter the
},
getRows: function getRows(start, end, doc) {
- let self = this;
let items = this.items;
let cache = this.cache.rows;
let step = start > end ? -1 : 1;
* for the new context. If a string is provided, it is
* interpreted as a method to access on *self*.
*/
- fork: function fork(name, offset, self, completer) {
- return this.forkapply(name, offset, self, completer, Array.slice(arguments, fork.length));
+ fork: function fork(name, offset, self, completer, ...args) {
+ return this.forkapply(name, offset, self, completer, args);
},
forkapply: function forkapply(name, offset, self, completer, args) {
return context;
},
- split: function split(name, obj, fn) {
- const self = this;
-
+ split: function split(name, obj, fn, ...args) {
let context = this.fork(name);
- function alias(prop) {
- context.__defineGetter__(prop, function get_() self[prop]);
- context.__defineSetter__(prop, function set_(val) self[prop] = val);
+ let alias = (prop) => {
+ context.__defineGetter__(prop, () => this[prop]);
+ context.__defineSetter__(prop, (val) => this[prop] = val);
}
alias("_cache");
alias("_completions");
context.hasItems = true;
this.hasItems = false;
if (fn)
- return fn.apply(obj || this, [context].concat(Array.slice(arguments, split.length)));
+ return fn.apply(obj || this, [context].concat(args));
return context;
},
* context.
*/
reset: function reset() {
- let self = this;
if (this.parent)
throw Error();
this.value = this._value;
this._caret = this.value.length;
}
- //for (let key in (k for ([k, v] in Iterator(self.contexts)) if (v.offset > this.caret)))
+ //for (let key in (k for ([k, v] in Iterator(this.contexts)) if (v.offset > this.caret)))
// delete this.contexts[key];
for each (let context in this.contexts) {
context.hasItems = false;
get options() modules.options,
// FIXME
- _runCompleter: function _runCompleter(name, filter, maxItems) {
+ _runCompleter: function _runCompleter(name, filter, maxItems, ...args) {
let context = modules.CompletionContext(filter);
context.maxItems = maxItems;
- let res = context.fork.apply(context, ["run", 0, this, name].concat(Array.slice(arguments, 3)));
+ let res = context.fork.apply(context, ["run", 0, this, name].concat(args));
if (res) {
if (Components.stack.caller.name === "runCompleter") // FIXME
return { items: res.map(function m(i) ({ item: i })) };
},
runCompleter: function runCompleter(name, filter, maxItems) {
- return this._runCompleter.apply(this, Array.slice(arguments))
+ return this._runCompleter.apply(this, arguments)
.items.map(function m(i) i.item);
},
- listCompleter: function listCompleter(name, filter, maxItems) {
+ listCompleter: function listCompleter(name, filter, maxItems, ...args) {
let context = modules.CompletionContext(filter || "");
context.maxItems = maxItems;
- context.fork.apply(context, ["list", 0, this, name].concat(Array.slice(arguments, 3)));
+ context.fork.apply(context, ["list", 0, this, name].concat(args));
context = context.contexts["/list"];
context.wait(null, true);
template.map(contexts, function m(context)
[template.completionRow(context.title, "CompTitle"),
template.map(context.items, function m(item) context.createRow(item), null, 100)])]);
- },
+ }
}),
////////////////////////////////////////////////////////////////////////////////
}, this);
},
- addUrlCompleter: function addUrlCompleter(opt) {
- let completer = Completion.UrlCompleter.apply(null, Array.slice(arguments));
- completer.args = Array.slice(arguments, completer.length);
- this.urlCompleters[opt] = completer;
+ addUrlCompleter: function addUrlCompleter(name, description, completer, ...args) {
+ let completer = Completion.UrlCompleter(name, description, completer);
+ completer.args = args;
+ this.urlCompleters[name] = completer;
},
autocomplete: curry(function autocomplete(provider, context) {
let words = context.filter.toLowerCase().split(/\s+/g);
context.hasItems = true;
context.completions = context.completions.filter(function f({ url, title })
- words.every(function e(w) (url + " " + title).toLowerCase().indexOf(w) >= 0))
+ words.every(function e(w) (url + " " + title).toLowerCase().indexOf(w) >= 0));
context.format = this.modules.bookmarks.format;
context.keys.extra = function k_extra(item) {
// catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
return channel;
},
- getURIFlags: function (uri) Ci.nsIAboutModule.ALLOW_SCRIPT,
+ getURIFlags: function (uri) Ci.nsIAboutModule.ALLOW_SCRIPT
};
var ConfigBase = Class("ConfigBase", {
/**
"list.href": Class.Memoize(function () "http://groups.google.com/group/" + config.name),
"hg.latest": Class.Memoize(function () this.code + "source/browse/"), // XXX
- "irc": "irc://irc.oftc.net/#pentadactyl",
+ "irc": "irc://irc.oftc.net/#pentadactyl"
}),
dtdExtra: {
*/
get outputHeight() this.browser.mPanelContainer.boxObject.height,
- tabStrip: Class.Memoize(function () document.getElementById("TabsToolbar") || this.tabbrowser.mTabContainer),
+ tabStrip: Class.Memoize(function () document.getElementById("TabsToolbar") || this.tabbrowser.mTabContainer)
}),
/**
sidebars: {},
- /**
- * @property {string} The leaf name of any temp files created by
- * {@link io.createTempFile}.
- */
- get tempFile() this.name + ".txt",
-
/**
* @constant
* @property {string} The default highlighting rules.
// catch(e){ if (typeof e === "string") e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
-// vim: set fdm=marker sw=4 sts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
var Group = Class("Group", {
init: function init(name, description, filter, persist) {
- const self = this;
-
this.name = name;
this.description = description;
this.filter = filter || this.constructor.defaultFilter;
get builtin() this.modules.contexts.builtinGroups.indexOf(this) >= 0,
}, {
- compileFilter: function (patterns, default_) {
+ compileFilter: function (patterns, default_ = false) {
if (arguments.length < 2)
default_ = false;
Hives: Class("Hives", Class.Property, {
init: function init(name, constructor) {
const { contexts } = modules;
- const self = this;
if (this.Hive)
return {
enumerable: true,
- get: function () array(contexts.groups[self.name])
+ get: () => array(contexts.groups[this.name])
};
this.Hive = constructor;
if (callable(params))
action = dactyl.userEval("(function action() { with (action.makeParams(this, arguments)) {" + args.literalArg + "} })");
else
- action = dactyl.userFunc.apply(dactyl, params.concat(args.literalArg).array);
+ action = dactyl.userFunc.apply(dactyl, params.concat(args.literalArg));
process = function (param) isObject(param) && param.valueOf ? param.valueOf() : param;
action.params = params;
action.makeParams = makeParams;
// catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
}
}
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
href: { get: function (elem) elem.href || elem.getAttribute("href") },
src: { get: function (elem) elem.src || elem.getAttribute("src") },
checked: { get: function (elem) elem.hasAttribute("checked") ? elem.getAttribute("checked") == "true" : elem.checked,
- set: function (elem, val) { elem.setAttribute("checked", !!val); elem.checked = val } },
+ set: function (elem, val) { elem.setAttribute("checked", !!val); elem.checked = val; } },
collapsed: BooleanAttribute("collapsed"),
disabled: BooleanAttribute("disabled"),
hidden: BooleanAttribute("hidden"),
if (val instanceof Ci.nsIDOMNode)
return val;
- if (typeof val == "xml" || DOM.isJSONXML(val)) {
+ if (DOM.isJSONXML(val)) {
val = dom.constructor(val, dom.document);
if (container)
container[idx] = val[0];
return val;
}
+ if (DOM.isJSONXML(val))
+ val = (function () this).bind(val);
+
if (callable(val))
return this.each(function (elem, i) {
util.withProperErrors(fn, this, munge(val.call(this, elem, i)), elem, i);
let res = this.Empty();
this.each(function (elem) {
- while(true) {
- elem = fn.call(this, elem)
+ while (true) {
+ elem = fn.call(this, elem);
if (elem instanceof Ci.nsIDOMNode)
res[res.length++] = elem;
else if (elem && "length" in elem)
each: function each(meth, arg) {
return self.each(function (elem) {
elem.classList[meth](arg);
- })
+ });
},
add: function add(cls) this.each("add", cls),
let { highlight } = this;
let v = callable(val) ? val.call(thisObj || this, elem, i) : val;
- highlight[(v == null ? highlight.has(hl) : !v) ? "remove" : "add"](hl)
+ highlight[(v == null ? highlight.has(hl) : !v) ? "remove" : "add"](hl);
}),
}),
get bottom() this.top + this.height,
left: r.left + node.clientLeft,
get right() this.left + this.width
- }
+ };
},
scrollPos: function scrollPos(left, top) {
let res = [];
this.each(function (elem) {
try {
- let hasChildren = elem.firstChild && (!/^\s*$/.test(elem.firstChild) || elem.firstChild.nextSibling)
+ let hasChildren = elem.firstChild && (!/^\s*$/.test(elem.firstChild) || elem.firstChild.nextSibling);
if (color)
res.push(["span", { highlight: "HelpXML" },
["span", { highlight: "HelpXMLTagStart" },
],
!hasChildren ? "" :
["", "...",
- ["span", { highlight: "HtmlTagEnd" },"<", namespaced(elem), ">"]]
+ ["span", { highlight: "HtmlTagEnd" }, "<", namespaced(elem), ">"]]
]);
else {
let tag = "<" + [namespaced(elem)].concat(
html: function html(txt, self) {
return this.getSet(arguments,
function (elem) elem.innerHTML,
- util.wrapCallback(function (elem, val) { elem.innerHTML = val }));
+ util.wrapCallback(function (elem, val) { elem.innerHTML = val; }));
},
text: function text(txt, self) {
return this.getSet(arguments,
function (elem) elem.textContent,
- function (elem, val) { elem.textContent = val });
+ function (elem, val) { elem.textContent = val; });
},
val: function val(txt) {
return this.getSet(arguments,
function (elem) elem.value,
- function (elem, val) { elem.value = val == null ? "" : val });
+ function (elem, val) { elem.value = val == null ? "" : val; });
},
listen: function listen(event, listener, capture) {
return true;
if (rect.top > viewport.bottom)
return false;
- return Math.abs(rect.top) < Math.abs(viewport.bottom - rect.bottom)
+ return Math.abs(rect.top) < Math.abs(viewport.bottom - rect.bottom);
}
let rect;
return this;
},
-
code_key: Class.Memoize(function (prop) this.init()[prop]),
code_nativeKey: Class.Memoize(function (prop) this.init()[prop]),
keyTable: Class.Memoize(function (prop) this.init()[prop]),
return "<" + modifier + key + ">";
},
-
defaults: {
load: { bubbles: false },
submit: { cancelable: true }
else
elem.setAttributeNS(vals[0] || "", key, val);
}
- args.forEach(function(e) {
+ args.forEach(function (e) {
elem.appendChild(tag(e, namespaces));
});
else
namespaces = fromJSON.namespaces;
- return tag(xml, namespaces)
+ return tag(xml, namespaces);
}, {
namespaces: {
"": "http://www.w3.org/1999/xhtml",
function isFragment(args) !isString(args[0]) || args.length == 0 || args[0] === "";
function hasString(args) {
- return args.some(function (a) isString(a) || isFragment(a) && hasString(a))
+ return args.some(function (a) isString(a) || isFragment(a) && hasString(a));
}
function isStrings(args) {
if (!isArray(args))
return util.dump("ARGS: " + {}.toString.call(args) + " " + args), false;
- return args.every(function (a) isinstance(a, ["String", DOM.DOMString]) || isFragment(a) && isStrings(a))
+ return args.every(function (a) isinstance(a, ["String", DOM.DOMString]) || isFragment(a) && isStrings(a));
}
function tag(args, namespaces, indent) {
contents.push(string);
});
if (contents.length)
- res.push(contents.join("\n"), join)
+ res.push(contents.join("\n"), join);
});
if (res[res.length - 1] == join)
res.pop();
"</", name, ">");
else {
let contents = [];
- args.forEach(function(e) {
+ args.forEach(function (e) {
let string = tag(e, namespaces, indent + INDENT);
if (string)
contents.push(string);
else
namespaces = DOM.fromJSON.namespaces;
- return tag(xml, namespaces, "")
+ return tag(xml, namespaces, "");
},
parseNamespace: function parseNamespace(name, namespaces) {
// catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
-// vim: set sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
var Download = Class("Download", {
init: function init(id, list) {
- let self = this;
this.download = services.downloadManager.getDownload(id);
this.list = list;
this.nodes = {
- commandTarget: self
+ commandTarget: this
};
DOM.fromJSON(
["tr", { highlight: "Download", key: "row" },
["td", { highlight: "DownloadTitle" },
["span", { highlight: "Link" },
- ["a", { key: "launch", href: self.target.spec, path: self.targetFile.path },
- self.displayName],
+ ["a", { key: "launch", href: this.target.spec, path: this.targetFile.path },
+ this.displayName],
["span", { highlight: "LinkInfo" },
- self.targetFile.path]]],
+ this.targetFile.path]]],
["td", { highlight: "DownloadState", key: "state" }],
["td", { highlight: "DownloadButtons Buttons" },
["a", { highlight: "Button", href: "javascript:0", key: "pause" }, _("download.action.Pause")],
["td", { highlight: "DownloadSpeed", key: "speed" }],
["td", { highlight: "DownloadTime", key: "time" }],
["td", {},
- ["a", { highlight: "DownloadSource", key: "source", href: self.source.spec },
- self.source.spec]]],
+ ["a", { highlight: "DownloadSource", key: "source", href: this.source.spec },
+ this.source.spec]]],
this.list.document, this.nodes);
- this.nodes.launch.addEventListener("click", function (event) {
+ this.nodes.launch.addEventListener("click", (event) => {
if (event.button == 0) {
event.preventDefault();
- self.command("launch");
+ this.command("launch");
}
}, false);
- self.updateStatus();
- return self;
+ this.updateStatus();
+ return this;
},
get status() states[this.state],
this.updateStatus();
},
launch: function launch() {
- let self = this;
// Behavior mimics that of the builtin Download Manager.
function action() {
try {
let file = io.File(this.targetFile);
if (file.isExecutable() && prefs.get("browser.download.manager.alertOnEXEOpen", true))
this.list.modules.commandline.input(_("download.prompt.launchExecutable") + " ",
- function (resp) {
+ (resp) => {
if (/^a(lways)$/i.test(resp)) {
prefs.set("browser.download.manager.alertOnEXEOpen", false);
resp = "yes";
}
if (/^y(es)?$/i.test(resp))
- action.call(self);
+ action.call(this);
});
else
action.call(this);
let file = download.targetFile.path;
let size = download.size;
-
overlay.modules.forEach(function (modules) {
modules.dactyl.echomsg({ domains: [util.getHost(url)], message: _("io.downloadFinished", title, file) },
1, modules.commandline.ACTIVE_WINDOW);
// catch(e){ if (isString(e)) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
endModule();
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
let beta = array(betas.iterate(NEWS))
.map(function (m) m[1]).uniq().slice(-1)[0];
-
function rec(text, level, li) {
let res = [];
let list, space, i = 0;
-
for (let match in re.iterate(text)) {
if (match.comment)
continue;
// }
// }
-
return '<?xml version="1.0"?>\n' +
'<?xml-stylesheet type="text/xsl" href="dactyl://content/help.xsl"?>\n' +
DOM.toXML(["document", { xmlns: "dactyl", name: "versions",
javascript: function initJavascript(dactyl, modules, window) {
modules.JavaScript.setCompleter([modules.help.exportHelp],
[function (context, args) overlay.activeModules.completion.file(context)]);
+ },
+ options: function initOptions(dactyl, modules, window) {
+ const { options } = modules;
+
+ options.add(["helpfile", "hf"],
+ "Name of the main help file",
+ "string", "intro");
}
});
endModule();
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
* @param {string} class
*/
selector: function selector(class_)
- let (self = this)
- class_.replace(/(^|[>\s])([A-Z][\w-]+)\b/g,
- function (m, n1, hl) n1 +
- (self.highlight[hl] && self.highlight[hl].class != class_
- ? self.highlight[hl].selector : "[dactyl|highlight~=" + hl + "]")),
+ class_.replace(/(^|[>\s])([A-Z][\w-]+)\b/g,
+ (m, n1, hl) => {
+ if (this.highlight[hl] && this.highlight[hl].class != class_)
+ return n1 + this.highlight[hl].selector;
+ return n1 + "[dactyl|highlight~=" + hl + "]";
+ }),
groupRegexp: util.regexp(literal(/*
^
endModule();
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
let sourceJSM = function sourceJSM() {
context = contexts.Module(uri);
dactyl.triggerObserver("io.source", context, file, file.lastModifiedTime);
- }
+ };
if (/\.jsm$/.test(filename))
sourceJSM();
},
/**
- * Creates a temporary file.
+ * Returns a temporary file.
*
+ * @param {string} ext The filename extension.
+ * @default "txt"
+ * @param {string} label A metadata string appended to the filename. Useful
+ * for identifying the file, beyond its extension, to external
+ * applications.
+ * @default ""
* @returns {File}
*/
- createTempFile: function createTempFile(name, type) {
- if (name instanceof Ci.nsIFile) {
- var file = name.clone();
- if (!type || type == "file")
- file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, octal(666));
- else
- file.createUnique(Ci.nsIFile.DIRECTORY_TYPE, octal(777));
- }
- else {
- file = services.directory.get("TmpD", Ci.nsIFile);
- file.append(this.config.tempFile + (name ? "." + name : ""));
- file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, octal(666));
- }
+ createTempFile: function createTempFile(ext = "txt", label = "") {
+ let file = services.directory.get("TmpD", Ci.nsIFile);
+ file.append(config.name + label + "." + ext);
+ file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, octal(666));
services.externalApp.deleteTemporaryFileOnExit(file);
* @returns {boolean} false if temp files couldn't be created,
* otherwise, the return value of *func*.
*/
- withTempFiles: function withTempFiles(func, self, checked, ext) {
+ withTempFiles: function withTempFiles(func, self, checked, ext, label) {
let args = array(util.range(0, func.length))
- .map(bind("createTempFile", this, ext)).array;
+ .map(bind("createTempFile", this, ext, label)).array;
try {
if (!args.every(util.identity))
return false;
lines.push("\n\" vim: set ft=" + config.name + ":");
try {
- file.write(lines.join("\n"));
+ file.write(lines.join("\n").concat("\n"));
dactyl.echomsg(_("io.writing", file.path.quote()), 2);
}
catch (e) {
item.file = file;
}
- rtItems.ftdetect.template = // {{{
+ rtItems.ftdetect.template = //{{{
literal(/*" Vim filetype detection file
<header>
au BufNewFile,BufRead *<name>rc*,*.<fileext> set filetype=<name>
*/);//}}}
- rtItems.ftplugin.template = // {{{
+ rtItems.ftplugin.template = //{{{
literal(/*" Vim filetype plugin file
<header>
let &cpo = s:cpo_save
unlet s:cpo_save
*/);//}}}
- rtItems.syntax.template = // {{{
+ rtItems.syntax.template = //{{{
literal(/*" Vim syntax file
<header>
return lines.map(function (l) l.join("")).join("\n").replace(/\s+\n/gm, "\n");
}//}}}
- let params = { // {{{
+ let params = { //{{{
header: ['" Language: ' + config.appName + ' configuration file',
'" Maintainer: Doug Kearns <dougkearns@gmail.com>',
'" Version: ' + config.version].join("\n"),
array(o.realNames for (o in options) if (o.type == "boolean"))
.flatten().map(String.quote),
", ") + "]"
- }; // }}}
+ }; //}}}
for (let { file, template } in values(rtItems)) {
try {
} catch(e){ if (isString(e)) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
init: function init(context) {
init.supercall(this);
- let self = this;
let sandbox = true || isinstance(context, ["Sandbox"]);
this.context = modules.newContext(context, !sandbox, "Dactyl REPL Context");
this.js = modules.JavaScript();
this.js.replContext = this.context;
- this.js.newContext = function newContext() modules.newContext(self.context, !sandbox, "Dactyl REPL Temp Context");
+ this.js.newContext = () => modules.newContext(this.context, !sandbox, "Dactyl REPL Temp Context");
this.js.globals = [
[this.context, /*L*/"REPL Variables"],
mappings: function initMappings(dactyl, modules, window) {
const { mappings, modes } = modules;
- function bind() mappings.add.apply(mappings,
- [[modes.REPL]].concat(Array.slice(arguments)))
+ function bind(...args) mappings.add.apply(mappings, [[modes.REPL]].concat(args))
bind(["<Return>"], "Accept the current input",
function ({ self }) { self.accept(); });
} catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
-// Copyright (c) 2009-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2009-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
*
* @returns {function} The constructor for the resulting module.
*/
- function Module(name) {
- let args = Array.slice(arguments);
+ function Module(name, ...args) {
var base = ModuleBase;
- if (callable(args[1]))
- base = args.splice(1, 1)[0];
+ if (callable(args[0]))
+ base = args.shift();
- let [, prototype, classProperties, moduleInit] = args;
+ let [prototype, classProperties, moduleInit] = args;
prototype._metaInit_ = function () {
delete module.prototype._metaInit_;
Class.replaceProperty(modules, module.className, this);
const create = window.Object.create.bind(window.Object);
-
const BASES = [BASE, "resource://dactyl-local-content/"];
jsmodules = Cu.createObjectIn(window);
},
scanModules: function scanModules() {
- let self = this;
let { Module, modules } = this.modules;
- defineModule.modules.forEach(function defModule(mod) {
+ defineModule.modules.forEach((mod) => {
let names = Set(Object.keys(mod.INIT));
if ("init" in mod.INIT)
Set.add(names, "init");
- keys(names).forEach(function (name) { self.deferInit(name, mod.INIT, mod); });
+ keys(names).forEach((name) => { this.deferInit(name, mod.INIT, mod); });
});
- Module.list.forEach(function frobModule(mod) {
+ Module.list.forEach((mod) => {
if (!mod.frobbed) {
- modules.__defineGetter__(mod.className, function () {
+ modules.__defineGetter__(mod.className, () => {
delete modules[mod.className];
- return self.loadModule(mod.className, null, Components.stack.caller);
+ return this.loadModule(mod.className, null, Components.stack.caller);
});
Object.keys(mod.prototype.INIT)
- .forEach(function (name) { self.deferInit(name, mod.prototype.INIT, mod); });
+ .forEach((name) => { this.deferInit(name, mod.prototype.INIT, mod); });
}
mod.frobbed = true;
});
} catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
file = io.File(file);
function properties(base, iter_, prop) iter(function _properties() {
- function key() [base, obj.identifier || obj.name].concat(Array.slice(arguments)).join(".").replace(/[\\:=]/g, "\\$&");
+ function key(...args) [base, obj.identifier || obj.name].concat(args).join(".").replace(/[\\:=]/g, "\\$&");
prop = prop || "description";
for (var obj in iter_) {
obj[_prop] = this.default;
return {
get: function get() {
- let self = this;
let value = this[_prop];
function getter(key, default_) function getter() messages.get([name, key].join("."), default_);
// catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2011 by Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2013 by Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
return null;
},
- // Properties {{{2
+ // Properties {{{
/** @property {string} The option's canonical name. */
name: null,
hasChanged: false,
/**
- * Returns the timestamp when the option's value was last changed.
+ * @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() }); },
*/
setFrom: null
+ //}}}
}, {
/**
* @property {number} Global option scope.
* @optional
*/
add: function add(names, description, type, defaultValue, extraInfo) {
- const self = this;
-
if (!util.isDactyl(Components.stack.caller))
deprecated.warn(add, "options.add", "group.options.add");
this.remove(name);
}
- let closure = function () self._optionMap[name];
+ let closure = () => this._optionMap[name];
memoize(this._optionMap, name, function () Option.types[type](modules, names, description, defaultValue, extraInfo));
for (let alias in values(names.slice(1)))
} catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
elem.removeAttributeNS(ns, name);
else
elem.setAttributeNS(ns, name, val);
-}
+};
var Overlay = Class("Overlay", {
init: function init(window) {
}
});
-
var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), {
init: function init() {
util.addObserver(this);
let iterator = Iterator(obj[key]);
if (isArray(obj[key])) {
iterator = ([elem[1].id, elem.slice(2), elem[1]]
- for each (elem in obj[key]))
+ for each (elem in obj[key]));
}
for (let [elem, xml, attrs] in iterator) {
Object.defineProperty(object, k, desc);
if (callable(value)) {
- var sentinel = "(function DactylOverlay() {}())"
+ var sentinel = "(function DactylOverlay() {}())";
value.toString = function toString() toString.toString.call(this).replace(/\}?$/, sentinel + "; $&");
value.toSource = function toSource() toSource.toSource.call(this).replace(/\}?$/, sentinel + "; $&");
}
} catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
} catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
originalURI: orig,
- asyncOpen: function () { throw error || Cr.NS_ERROR_FILE_NOT_FOUND },
+ asyncOpen: function () { throw error || Cr.NS_ERROR_FILE_NOT_FOUND; },
- open: function () { throw error || Cr.NS_ERROR_FILE_NOT_FOUND }
+ open: function () { throw error || Cr.NS_ERROR_FILE_NOT_FOUND; }
}).data.QueryInterface(Ci.nsIChannel);
}
function RedirectChannel(to, orig, time, message) {
contentBase: contentBase,
- _xpcom_factory: JSMLoader.Factory(Protocol),
+ _xpcom_factory: JSMLoader.Factory(Protocol)
};
return Protocol;
}
endModule();
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
util.addObserver(this);
- services.add("contentPrefs", "@mozilla.org/content-pref/service;1", Ci.nsIContentPrefService);
services.add("cookies", "@mozilla.org/cookiemanager;1", [Ci.nsICookieManager, Ci.nsICookieManager2,
Ci.nsICookieService]);
services.add("loginManager", "@mozilla.org/login-manager;1", Ci.nsILoginManager);
template.map(util.range(0, Math.ceil(items.length / 2)), function (i)
["row", {},
template.map(items.slice(i * 2, i * 2 + 2), function (item)
- ["checkbox", { xmlns: XUL, label: item.description, preference: branch + item.name }])])]]],
+ ["checkbox", { xmlns: XUL, label: item.description, preference: branch + item.name }])])]]]
}
}));
}
template.map(ourItems(), function ([item, desc])
["listitem", { xmlns: "xul", preference: branch + item,
type: "checkbox", label: config.appName + ", " + desc,
- onsyncfrompreference: "return gSanitizePromptDialog.onReadGeneric();" }]),
+ onsyncfrompreference: "return gSanitizePromptDialog.onReadGeneric();" }])
]
},
ready: function ready(win) {
description: "Timespan for which to sanitize items",
completer: function (context) modules.options.get("sanitizetimespan").completer(context),
type: modules.CommandOption.STRING,
- validator: function (arg) modules.options.get("sanitizetimespan").validator(arg),
+ validator: function (arg) modules.options.get("sanitizetimespan").validator(arg)
}
],
privateData: true
},
options: function initOptions(dactyl, modules) {
const options = modules.options;
- if (services.has("privateBrowsing") && "privateBrowsingEnabled" in services.privateBrowsing)
- options.add(["private", "pornmode"],
- "Set the 'private browsing' option",
- "boolean", false,
- {
- initialValue: true,
- getter: function () services.privateBrowsing.privateBrowsingEnabled,
- setter: function (value) {
- if (services.privateBrowsing.privateBrowsingEnabled != value)
- services.privateBrowsing.privateBrowsingEnabled = value;
- },
- persist: false
- });
options.add(["sanitizeitems", "si"],
"The default list of private items to sanitize",
// catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);}
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
this.add("downloadManager", "@mozilla.org/download-manager;1", "nsIDownloadManager");
this.add("environment", "@mozilla.org/process/environment;1", "nsIEnvironment");
this.add("extensionManager", "@mozilla.org/extensions/manager;1", "nsIExtensionManager");
- this.add("externalApp", "@mozilla.org/uriloader/external-helper-app-service;1", "nsPIExternalAppLauncher")
+ this.add("externalApp", "@mozilla.org/uriloader/external-helper-app-service;1", "nsPIExternalAppLauncher");
this.add("externalProtocol", "@mozilla.org/uriloader/external-protocol-service;1", "nsIExternalProtocolService");
this.add("favicon", "@mozilla.org/browser/favicon-service;1", "nsIFaviconService");
this.add("file:", this.PROTOCOL + "file", "nsIFileProtocolHandler");
this.add("focus", "@mozilla.org/focus-manager;1", "nsIFocusManager");
- this.add("history", "@mozilla.org/browser/global-history;2",
- ["nsIBrowserHistory", "nsIGlobalHistory2", "nsINavHistoryService", "nsPIPlacesDatabase"]);
+ this.add("history", "@mozilla.org/browser/nav-history-service;1",
+ ["nsIBrowserHistory", "nsINavHistoryService", "nsPIPlacesDatabase"]);
this.add("io", "@mozilla.org/network/io-service;1", "nsIIOService");
this.add("json", "@mozilla.org/dom/json;1", "nsIJSON", "createInstance");
this.add("listeners", "@mozilla.org/eventlistenerservice;1", "nsIEventListenerService");
this.addClass("Persist", "@mozilla.org/embedding/browser/nsWebBrowserPersist;1", "nsIWebBrowserPersist");
this.addClass("Pipe", "@mozilla.org/pipe;1", "nsIPipe", "init");
this.addClass("Process", "@mozilla.org/process/util;1", "nsIProcess", "init");
- this.addClass("Pump", "@mozilla.org/network/input-stream-pump;1", "nsIInputStreamPump", "init")
+ this.addClass("Pump", "@mozilla.org/network/input-stream-pump;1", "nsIInputStreamPump", "init");
this.addClass("StreamChannel","@mozilla.org/network/input-stream-channel;1",
["nsIInputStreamChannel", "nsIChannel"], "setURI");
this.addClass("StreamCopier", "@mozilla.org/network/async-stream-copier;1","nsIAsyncStreamCopier", "init");
if (!service.interfaces.length)
return res.wrappedJSObject || res;
- service.interfaces.forEach(function (iface) res.QueryInterface(Ci[iface]));
+ service.interfaces.forEach(function (iface) res instanceof Ci[iface]);
if (service.init && args.length) {
if (service.callable)
res[service.init].apply(res, args);
if (service.quiet === false)
throw e.stack ? e : Error(e);
- if (typeof util !== "undefined")
+ if (typeof util !== "undefined" && util != null)
util.reportError(e);
else
dump("dactyl: Service creation failed for '" + service.class + "': " + e + "\n" + (e.stack || Error(e).stack));
* class.
*/
addClass: function addClass(name, class_, ifaces, init, quiet) {
- const self = this;
this.services[name] = { class: class_, interfaces: Array.concat(ifaces || []), method: "createInstance", init: init, quiet: quiet };
if (init)
memoize(this.services[name], "callable",
function () callable(XPCOMShim(this.interfaces)[this.init]));
- this[name] = function Create() self._create(name, arguments);
+ this[name] = (function Create() this._create(name, arguments)).bind(this);
update.apply(null, [this[name]].concat([Ci[i] for each (i in Array.concat(ifaces))]));
return this[name];
},
} catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);}
-// vim: set fdm=marker sw=4 sts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
}
});
-var sessionGlobal = Cu.import("resource://gre/modules/Services.jsm", {})
+var sessionGlobal = Cu.import("resource://gre/modules/Services.jsm", {});
var Storage = Module("Storage", {
Local: function Local(dactyl, modules, window) ({
},
newObject: function newObject(key, constructor, params) {
- let self = this;
if (params == null || !isObject(params))
throw Error("Invalid argument type");
if (key in this && !reload)
throw Error("Cannot add storage key with that name.");
- let load = function () self._loadData(key, params.store, params.type || myObject);
+ let load = () => this._loadData(key, params.store, params.type || myObject);
this.keys[key] = new constructor(key, params.store, load, params);
- this.keys[key].timer = new Timer(1000, 10000, function () self.save(key));
+ this.keys[key].timer = new Timer(1000, 10000, () => this.save(key));
this.__defineGetter__(key, function () this.keys[key]);
}
return this.keys[key];
}
},
-
isAbsolutePath: function isAbsolutePath(path) {
try {
services.File().initWithPath(path);
if (!(prop in File.prototype)) {
let isFunction;
try {
- isFunction = callable(file[prop])
+ isFunction = callable(file[prop]);
}
catch (e) {}
// catch(e){ dump(e + "\n" + (e.stack || Error().stack)); Components.utils.reportError(e) }
-// vim: set fdm=marker sw=4 sts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
this[i] = val;
this.enabled = this.enabled;
});
-}
+};
Sheet.liveProperty("agent");
Sheet.liveProperty("css");
Sheet.liveProperty("sites");
* @param {number} index
*/
remove: function remove(name, filter, css, index) {
- let self = this;
if (arguments.length == 1) {
var matches = [name];
name = null;
if (filter && filter.indexOf(",") > -1)
return filter.split(",").reduce(
- function (n, f) n + self.removeSheet(name, f, index), 0);
+ (n, f) => n + this.removeSheet(name, f, index), 0);
if (filter == undefined)
filter = "";
]);
}),
match.postSpace
- ]
- })
- }
+ ];
+ });
+ };
}
});
// catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);}
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
return res;
},
-
bookmarkDescription: function (item, text) [
!(item.extra && item.extra.length) ? [] :
["span", { highlight: "URLExtra" },
})(), this[help ? "HelpLink" : "helpLink"]);
},
-
// Fixes some strange stack rewinds on NS_ERROR_OUT_OF_MEMORY
// exceptions that we can't catch.
stringify: function stringify(arg) {
util.losslessDecodeURI(val.URI.spec)]]])];
},
-
options: function options(title, opts, verbose) {
return ["table", {},
["tr", { highlight: "Title", align: "left" },
},
tabular: function tabular(headings, style, iter) {
- let self = this;
// TODO: This might be mind-bogglingly slow. We'll see.
return ["table", {},
["tr", { highlight: "Title", align: "left" },
this.map(headings, function (h)
["th", {}, h])],
- this.map(iter, function (row)
+ this.map(iter, (row) =>
["tr", {},
- self.map(Iterator(row), function ([i, d])
+ this.map(Iterator(row), function ([i, d])
["td", { style: style[i] || "" }, d])])];
},
usage: function usage(iter, format) {
- let self = this;
format = format || {};
- let desc = format.description || function (item) self.linkifyHelp(item.description);
- let help = format.help || function (item) item.name;
- function sourceLink(frame) {
- let source = self.sourceLink(frame);
+ let desc = format.description || (item => this.linkifyHelp(item.description));
+ let help = format.help || (item => item.name);
+ let sourceLink = (frame) => {
+ let source = this.sourceLink(frame);
source[1]["dactyl:hint"] = source[2];
return source;
}
format.headings ?
["thead", { highlight: "UsageHead" },
["tr", { highlight: "Title", align: "left" },
- this.map(format.headings, function (h) ["th", {}, h])]] :
+ this.map(format.headings, (h) => ["th", {}, h])]] :
[],
format.columns ?
["colgroup", {},
- this.map(format.columns, function (c) ["col", { style: c }])] :
+ this.map(format.columns, (c) => ["col", { style: c }])] :
[],
["tbody", { highlight: "UsageBody" },
- this.map(iter, function (item)
+ this.map(iter, (item) =>
// Urgh.
let (name = item.name || item.names[0], frame = item.definedAt)
["tr", { highlight: "UsageItem" },
["td", { style: "padding-right: 2em;" },
["span", { highlight: "Usage Link" },
!frame ? name :
- [self.helpLink(help(item), name, "Title"),
+ [this.helpLink(help(item), name, "Title"),
["span", { highlight: "LinkInfo" },
_("io.definedAt"), " ",
sourceLink(frame)]]]],
- item.columns ? self.map(item.columns, function (c) ["td", {}, c]) : [],
- ["td", {}, desc(item)]])]]
+ item.columns ? this.map(item.columns, (c) => ["td", {}, c]) : [],
+ ["td", {}, desc(item)]])]];
}
});
endModule();
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
acc.push(vals);
if (acc.length == pattern.length)
- this.res.push(acc.join(""))
+ this.res.push(acc.join(""));
else
for (let val in values(vals))
this.rec(acc.concat(val));
}
res.push(pattern.substr(end));
return res.map(function (s) util.dequote(s, dequote));
- }
+ };
let patterns = [];
let substrings = split(pattern, /((?:[^\\{]|\\.)*)\{((?:[^\\}]|\\.)*)\}/gy,
else
for (let [, pattern] in Iterator(patterns[acc.length]))
rec(acc.concat(pattern));
- }
+ };
rec([]);
return res;
}
[hours, minutes] = div(minutes, 60);
[days, hours] = div(hours, 24);
if (days)
- return /*L*/days + " days " + hours + " hours"
+ return /*L*/days + " days " + hours + " hours";
if (hours)
return /*L*/hours + "h " + minutes + "m";
if (minutes)
let async = params.callback || params.onload || params.onerror;
if (async) {
- xmlhttp.addEventListener("load", function handler(event) { util.trapErrors(params.onload || params.callback, params, xmlhttp, event) }, false);
- xmlhttp.addEventListener("error", function handler(event) { util.trapErrors(params.onerror || params.callback, params, xmlhttp, event) }, false);
+ xmlhttp.addEventListener("load", function handler(event) { util.trapErrors(params.onload || params.callback, params, xmlhttp, event); }, false);
+ xmlhttp.addEventListener("error", function handler(event) { util.trapErrors(params.onerror || params.callback, params, xmlhttp, event); }, false);
}
-
if (isObject(params.params)) {
let data = [encodeURIComponent(k) + "=" + encodeURIComponent(v)
for ([k, v] in iter(params.params))];
let (viewer = docShells.getNext().QueryInterface(Ci.nsIDocShell).contentViewer) {
if (viewer)
yield viewer.DOMDocument;
- }
+ };
}
}
},
}
let keyIter = object;
if ("__iterator__" in object && !callable(object.__iterator__))
- keyIter = keys(object)
+ keyIter = keys(object);
for (let i in keyIter) {
let value = Magic("<no value>");
if (data.length == 0)
res.push("[]");
else {
- res.push("[\n")
+ res.push("[\n");
for (let [i, val] in Iterator(data)) {
if (i)
res.push(",\n");
- res.push(prefix)
+ res.push(prefix);
rec(val, prefix, seen);
}
res.push("\n", level, "]");
}
}
else if (isObject(data)) {
- res.push("{\n")
+ res.push("{\n");
let i = 0;
for (let [key, val] in Iterator(data)) {
if (i++)
res.push(",\n");
- res.push(prefix, JSON.stringify(key), ": ")
+ res.push(prefix, JSON.stringify(key), ": ");
rec(val, prefix, seen);
}
if (i > 0)
- res.push("\n", level, "}")
+ res.push("\n", level, "}");
else
res[res.length - 1] = "{}";
}
* @param {function} func The function to call
* @param {object} self The 'this' object for the function.
*/
- trapErrors: function trapErrors(func, self) {
+ trapErrors: function trapErrors(func, self, ...args) {
try {
if (!callable(func))
func = self[func];
- return func.apply(self || this, Array.slice(arguments, 2));
+ return func.apply(self || this, args);
}
catch (e) {
this.reportError(e);
* @param {object} self The 'this' object of the method.
* @param ... Arguments to pass to *meth*.
*/
- withProperErrors: function withProperErrors(meth, self) {
+ withProperErrors: function withProperErrors(meth, self, ...args) {
try {
- return (callable(meth) ? meth : self[meth]).apply(self, Array.slice(arguments, withProperErrors.length));
+ return (callable(meth) ? meth : self[meth]).apply(self, args);
}
catch (e) {
throw e.stack ? e : Error(e);
Array: array
});
-
/**
* Math utility methods.
* @singleton
} catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript:
* @param {MozMillController} controller The browser's MozMill controller.
*/
function Controller(controller) {
- var self = this;
this.controller = controller;
/**
this.errorCount = 0;
- this._countBeep = function countBeep() {
- self.beepCount++;
+ this._countBeep = () => {
+ this.beepCount++;
}
this.errors = [];
- this._countError = function countError(message, highlight) {
+ this._countError = (message, highlight) => {
if (/\b(Error|Warning)Msg\b/.test(highlight))
- self.errors.push(String(message));
+ this.errors.push(String(message));
}
this.modules.dactyl.registerObserver("beep", this._countBeep);
this.modules.dactyl.registerObserver("echoLine", this._countError);
* @param {string} message The message to display upon assertion failure. @optional
*/
wrapAssertNoErrors: function (func, message) {
- let self = this;
- return function wrapped() self.assertNoErrors(func, this, arguments, message);
+ return () => this.assertNoErrors(func, this, arguments, message);
},
/**
* @param {...} Extra arguments are passed to the completion
* function directly.
*/
- testCompleter: wrapAssertNoErrors(function testCompleter(self, func, string, message) {
+ testCompleter: wrapAssertNoErrors(function testCompleter(self, func, string, message, ...args) {
var context = this.modules.CompletionContext(string || "");
context.tabPressed = true;
- context.forkapply("completions", 0, self, func, Array.slice(arguments, testCompleter.length));
+ context.forkapply("completions", 0, self, func, args);
utils.assert("dactyl.runCompletions", context.wait(5000),
message || "Completion failed: " + self + "." + func);
});
}
-function runTest(message, test) {
+function runTest(message, test, ...args) {
if (test)
- var res = test.apply(null, Array.slice(arguments, runTest.length));
+ var res = test.apply(null, args);
if (res !== undefined)
jumlib.assert(res, message);
}
+dactyl (1.0+hg6948-1) UNRELEASED; urgency=low
+
+ * New upstream revision 6948 from the upstream Mercurial repository at
+ <https://code.google.com/p/dactyl/>.
+ - Supports Iceweasel/Firefox versions up to 24, closes: #720447.
+
+ -- Michael Schutte <michi@debian.org> Mon, 09 Sep 2013 10:23:40 +0200
+
dactyl (1.0+hg6924-1) unstable; urgency=low
* Upload to unstable.
done
UPSTREAM_REPO=../upstream
-UPSTREAM_REVISION=6924
+UPSTREAM_REVISION=6948
UPSTREAM_DEST=$(shell pwd)/dactyl.tar.gz
get-orig-source:
}
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
}, {
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
mappings.add([modes.PLAYER],
["z"], "Previous track",
- function (args) { ex.playerprev({ "#": args.count }); },
+ function ({ count }) { ex.playerprev({ "#": count }); },
{ count: true });
mappings.add([modes.PLAYER],
mappings.add([modes.PLAYER],
["b"], "Next track",
- function (args) { ex.playernext({ "#": args.count }); },
+ function ({ count }) { ex.playernext({ "#": count }); },
{ count: true });
mappings.add([modes.PLAYER],
mappings.add([modes.PLAYER],
["h", "<Left>"], "Seek -10s",
- function (args) { player.seekBackward(Math.max(1, args.count) * 10000); },
+ function ({ count} ) { player.seekBackward(Math.max(1, count) * 10000); },
{ count: true });
mappings.add([modes.PLAYER],
["l", "<Right>"], "Seek +10s",
- function (args) { player.seekForward(Math.max(1, args.count) * 10000); },
+ function ({ count} ) { player.seekForward(Math.max(1, count) * 10000); },
{ count: true });
mappings.add([modes.PLAYER],
["H", "<S-Left>"], "Seek -1m",
- function (args) { player.seekBackward(Math.max(1, args.count) * 60000); },
+ function ({ count }) { player.seekBackward(Math.max(1, count) * 60000); },
{ count: true });
mappings.add([modes.PLAYER],
["L", "<S-Right>"], "Seek +1m",
- function (args) { player.seekForward(Math.max(1, args.count) * 60000); },
+ function ({ count }) { player.seekForward(Math.max(1, count) * 60000); },
{ count: true });
mappings.add([modes.PLAYER],
}
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
else
dactyl.beep();
}
- },
-
- get tempFile() {
- let prefix = this.name;
- try {
- prefix += "-" + window.content.document.location.hostname;
- }
- catch (e) {}
-
- return prefix + ".txt";
}
})
completion.sidebar = function sidebar(context) {
let menu = document.getElementById("viewSidebarMenu");
context.title = ["Sidebar Panel"];
- context.completions = Array.map(menu.childNodes, function (n) [n.getAttribute("label"), ""]);
+ context.completions = Array.filter(menu.childNodes, function (n) n.hasAttribute("label"))
+ .map(function (n) [n.getAttribute("label"), ""]);
};
},
events: function initEvents(dactyl, modules, window) {
}
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
<em:targetApplication>
<Description
em:id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
- em:minVersion="8.0"
- em:maxVersion="22.0a1"/>
+ em:minVersion="22.0"
+ em:maxVersion="24.*"/>
</em:targetApplication>
</Description>
</RDF>
}
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
}
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
modes.main = modes.MESSAGE;
}
}
- },
-
- // to allow Vim to :set ft=mail automatically
- tempFile: "teledactyl.eml"
+ }
}, {
}, {
commands: function initCommands(dactyl, modules, window) {
}
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et:
mappings.add(myModes, ["j", "<Right>"],
"Select next message",
- function (args) { mail.selectMessage(function (msg) true, false, false, false, args.count); },
+ function ({ count }) { mail.selectMessage(function (msg) true, false, false, false, count); },
{ count: true });
mappings.add(myModes, ["gj"],
"Select next message, including closed threads",
- function (args) { mail.selectMessage(function (msg) true, false, true, false, args.count); },
+ function ({ count }) { mail.selectMessage(function (msg) true, false, true, false, count); },
{ count: true });
mappings.add(myModes, ["J", "<Tab>"],
"Select next unread message",
- function (args) { mail.selectMessage(function (msg) !msg.isRead, true, true, false, args.count); },
+ function ({ count }) { mail.selectMessage(function (msg) !msg.isRead, true, true, false, count); },
{ count: true });
mappings.add(myModes, ["k", "<Left>"],
"Select previous message",
- function (args) { mail.selectMessage(function (msg) true, false, false, true, args.count); },
+ function ({ count }) { mail.selectMessage(function (msg) true, false, false, true, count); },
{ count: true });
mappings.add(myModes, ["gk"],
"Select previous message",
- function (args) { mail.selectMessage(function (msg) true, false, true, true, args.count); },
+ function ({ count }) { mail.selectMessage(function (msg) true, false, true, true, count); },
{ count: true });
mappings.add(myModes, ["K"],
"Select previous unread message",
- function (args) { mail.selectMessage(function (msg) !msg.isRead, true, true, true, args.count); },
+ function ({ count }) { mail.selectMessage(function (msg) !msg.isRead, true, true, true, count); },
{ count: true });
mappings.add(myModes, ["*"],
"Select next message from the same sender",
- function (args) {
+ function ({ count }) {
let author = gDBView.hdrForFirstSelectedMessage.mime2DecodedAuthor.toLowerCase();
- mail.selectMessage(function (msg) msg.mime2DecodedAuthor.toLowerCase().indexOf(author) == 0, true, true, false, args.count);
+ mail.selectMessage(function (msg) msg.mime2DecodedAuthor.toLowerCase().indexOf(author) == 0, true, true, false, count);
},
{ count: true });
mappings.add(myModes, ["#"],
"Select previous message from the same sender",
- function (args) {
+ function ({ count }) {
let author = gDBView.hdrForFirstSelectedMessage.mime2DecodedAuthor.toLowerCase();
- mail.selectMessage(function (msg) msg.mime2DecodedAuthor.toLowerCase().indexOf(author) == 0, true, true, true, args.count);
+ mail.selectMessage(function (msg) msg.mime2DecodedAuthor.toLowerCase().indexOf(author) == 0, true, true, true, count);
},
{ count: true });
// SCROLLING
mappings.add(myModes, ["<Down>"],
"Scroll message down",
- function (args) { buffer.scrollLines(Math.max(args.count, 1)); },
+ function ({ count }) { buffer.scrollLines(Math.max(count, 1)); },
{ count: true });
mappings.add(myModes, ["<Up>"],
"Scroll message up",
- function (args) { buffer.scrollLines(-Math.max(args.count, 1)); },
+ function ({ count }) { buffer.scrollLines(-Math.max(count, 1)); },
{ count: true });
mappings.add([modes.MESSAGE], ["<Left>"],
"Select previous message",
- function (args) { mail.selectMessage(function (msg) true, false, false, true, args.count); },
+ function ({ count }) { mail.selectMessage(function (msg) true, false, false, true, count); },
{ count: true });
mappings.add([modes.MESSAGE], ["<Right>"],
"Select next message",
- function (args) { mail.selectMessage(function (msg) true, false, false, false, args.count); },
+ function ({ count }) { mail.selectMessage(function (msg) true, false, false, false, count); },
{ count: true });
// UNDO/REDO
mappings.add(myModes, ["]s"],
"Select next starred message",
- function (args) { mail.selectMessage(function (msg) msg.isFlagged, true, true, false, args.count); },
+ function ({ count }) { mail.selectMessage(function (msg) msg.isFlagged, true, true, false, count); },
{ count: true });
mappings.add(myModes, ["[s"],
"Select previous starred message",
- function (args) { mail.selectMessage(function (msg) msg.isFlagged, true, true, true, args.count); },
+ function ({ count }) { mail.selectMessage(function (msg) msg.isFlagged, true, true, true, count); },
{ count: true });
mappings.add(myModes, ["]a"],
"Select next message with an attachment",
- function (args) { mail.selectMessage(function (msg) gDBView.db.HasAttachments(msg.messageKey), true, true, false, args.count); },
+ function ({ count }) { mail.selectMessage(function (msg) gDBView.db.HasAttachments(msg.messageKey), true, true, false, count); },
{ count: true });
mappings.add(myModes, ["[a"],
"Select previous message with an attachment",
- function (args) { mail.selectMessage(function (msg) gDBView.db.HasAttachments(msg.messageKey), true, true, true, args.count); },
+ function ({ count }) { mail.selectMessage(function (msg) gDBView.db.HasAttachments(msg.messageKey), true, true, true, count); },
{ count: true });
// FOLDER SWITCHING
mappings.add(myModes, ["gi"],
"Go to inbox",
- function (args) {
- let folder = mail.getFolders("Inbox", false, true)[(args.count > 0) ? (args.count - 1) : 0];
+ function ({ count }) {
+ let folder = mail.getFolders("Inbox", false, true)[(count > 0) ? (count - 1) : 0];
if (folder)
SelectFolder(folder.URI);
else
mappings.add(myModes, ["<C-n>"],
"Select next folder",
- function (args) {
- let newPos = mail._getCurrentFolderIndex() + Math.max(1, args.count);
+ function ({ count }) {
+ let newPos = mail._getCurrentFolderIndex() + Math.max(1, count);
if (newPos >= gFolderTreeView.rowCount) {
newPos = newPos % gFolderTreeView.rowCount;
commandline.echo(_("finder.atBottom"), commandline.HL_WARNINGMSG, commandline.APPEND_TO_MESSAGES);
mappings.add(myModes, ["<C-N>"],
"Go to next mailbox with unread messages",
- function (args) {
- mail._selectUnreadFolder(false, args.count);
+ function ({ count }) {
+ mail._selectUnreadFolder(false, count);
},
{ count: true });
mappings.add(myModes, ["<C-p>"],
"Select previous folder",
- function (args) {
- let newPos = mail._getCurrentFolderIndex() - Math.max(1, args.count);
+ function ({ count }) {
+ let newPos = mail._getCurrentFolderIndex() - Math.max(1, count);
if (newPos < 0) {
newPos = (newPos % gFolderTreeView.rowCount) + gFolderTreeView.rowCount;
commandline.echo(_("finder.atTop"), commandline.HL_WARNINGMSG, commandline.APPEND_TO_MESSAGES);
mappings.add(myModes, ["<C-P>"],
"Go to previous mailbox with unread messages",
- function (args) {
- mail._selectUnreadFolder(true, args.count);
+ function ({ count }) {
+ mail._selectUnreadFolder(true, count);
},
{ count: true });
// tagging messages
mappings.add(myModes, ["l"],
"Label message",
- function (arg) {
+ function ({ arg }) {
if (!GetSelectedMessages())
return void dactyl.beep();
}
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et: