mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-04-27 03:41:26 +02:00
Convert expression closures to arrow syntax.
This commit is contained in:
Vendored
+2
-2
@@ -15,7 +15,7 @@ function module(uri) Cu.import(uri, {});
|
||||
|
||||
const DEBUG = true;
|
||||
|
||||
__defineGetter__("BOOTSTRAP", function () "resource://" + moduleName + "/bootstrap.jsm");
|
||||
__defineGetter__("BOOTSTRAP", () => "resource://" + moduleName + "/bootstrap.jsm");
|
||||
|
||||
var { AddonManager } = module("resource://gre/modules/AddonManager.jsm");
|
||||
var { XPCOMUtils } = module("resource://gre/modules/XPCOMUtils.jsm");
|
||||
@@ -125,7 +125,7 @@ let JSMLoader = {
|
||||
_load: function _load(name, target) {
|
||||
let urls = [name];
|
||||
if (name.indexOf(":") === -1)
|
||||
urls = this.config["module-paths"].map(function (path) path + name + ".jsm");
|
||||
urls = this.config["module-paths"].map(path => path + name + ".jsm");
|
||||
|
||||
for each (let url in urls)
|
||||
try {
|
||||
|
||||
@@ -64,7 +64,7 @@ var Abbreviation = Class("Abbreviation", {
|
||||
* @param {Mode} mode The mode to test.
|
||||
* @returns {boolean} The result of the comparison.
|
||||
*/
|
||||
inMode: function (mode) this.modes.some(function (_mode) _mode == mode),
|
||||
inMode: function (mode) this.modes.some(m => m == mode),
|
||||
|
||||
/**
|
||||
* Returns true if this abbreviation is defined in any of *modes*.
|
||||
@@ -72,7 +72,7 @@ var Abbreviation = Class("Abbreviation", {
|
||||
* @param {[Modes]} modes The modes to test.
|
||||
* @returns {boolean} The result of the comparison.
|
||||
*/
|
||||
inModes: function (modes) modes.some(function (mode) this.inMode(mode), this),
|
||||
inModes: function (modes) modes.some(mode => this.inMode(mode)),
|
||||
|
||||
/**
|
||||
* Remove *mode* from the list of supported modes for this abbreviation.
|
||||
@@ -80,7 +80,7 @@ var Abbreviation = Class("Abbreviation", {
|
||||
* @param {Mode} mode The mode to remove.
|
||||
*/
|
||||
removeMode: function (mode) {
|
||||
this.modes = this.modes.filter(function (m) m != mode).sort();
|
||||
this.modes = this.modes.filter(m => m != mode).sort();
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -90,7 +90,7 @@ var Abbreviation = Class("Abbreviation", {
|
||||
get modeChar() Abbreviation.modeChar(this.modes)
|
||||
}, {
|
||||
modeChar: function (_modes) {
|
||||
let result = array.uniq(_modes.map(function (m) m.char)).join("");
|
||||
let result = array.uniq(_modes.map(m => m.char)).join("");
|
||||
if (result == "ci")
|
||||
result = "!";
|
||||
return result;
|
||||
@@ -142,7 +142,7 @@ var AbbrevHive = Class("AbbrevHive", Contexts.Hive, {
|
||||
// Wth? --Kris;
|
||||
let map = values(this._store).map(Iterator).map(iter.toArray)
|
||||
.flatten().toObject();
|
||||
return Object.keys(map).sort().map(function (k) map[k]);
|
||||
return Object.keys(map).sort().map(k => map[k]);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -244,7 +244,7 @@ var Abbreviations = Module("abbreviations", {
|
||||
match: function (mode, text) {
|
||||
let match = this._match.exec(text);
|
||||
if (match)
|
||||
return this.hives.map(function (h) h.get(mode, match[2] || match[4] || match[6])).nth(util.identity, 0);
|
||||
return this.hives.map(h => h.get(mode, match[2] || match[4] || match[6])).nth(util.identity, 0);
|
||||
return null;
|
||||
},
|
||||
|
||||
@@ -257,10 +257,10 @@ var Abbreviations = Module("abbreviations", {
|
||||
* @optional
|
||||
*/
|
||||
list: function (modes, lhs, hives) {
|
||||
let hives = hives || contexts.allGroups.abbrevs.filter(function (h) !h.empty);
|
||||
let hives = hives || contexts.allGroups.abbrevs.filter(h => !h.empty);
|
||||
|
||||
function abbrevs(hive)
|
||||
hive.merged.filter(function (abbr) (abbr.inModes(modes) && abbr.lhs.indexOf(lhs) == 0));
|
||||
hive.merged.filter(ab => (ab.inModes(modes) && ab.lhs.indexOf(lhs) == 0));
|
||||
|
||||
let list = ["table", {},
|
||||
["tr", { highlight: "Title" },
|
||||
@@ -269,9 +269,9 @@ var Abbreviations = Module("abbreviations", {
|
||||
["td", { style: "padding-right: 1em;" }, _("title.Abbrev")],
|
||||
["td", { style: "padding-right: 1em;" }, _("title.Replacement")]],
|
||||
["col", { style: "min-width: 6em; padding-right: 1em;" }],
|
||||
hives.map(function (hive) let (i = 0) [
|
||||
hives.map(hive => let (i = 0) [
|
||||
["tr", { style: "height: .5ex;" }],
|
||||
abbrevs(hive).map(function (abbrev)
|
||||
abbrevs(hive).map(abbrev =>
|
||||
["tr", {},
|
||||
["td", { highlight: "Title" }, !i++ ? String(hive.name) : ""],
|
||||
["td", {}, abbrev.modeChar],
|
||||
@@ -298,7 +298,7 @@ var Abbreviations = Module("abbreviations", {
|
||||
completion: function initCompletion() {
|
||||
completion.abbreviation = function abbreviation(context, modes, group) {
|
||||
group = group || abbreviations.user;
|
||||
let fn = modes ? function (abbr) abbr.inModes(modes) : util.identity;
|
||||
let fn = modes ? ab => ab.inModes(modes) : util.identity;
|
||||
context.keys = { text: "lhs" , description: "rhs" };
|
||||
context.completions = group.merged.filter(fn);
|
||||
};
|
||||
|
||||
@@ -51,7 +51,7 @@ var AutoCmdHive = Class("AutoCmdHive", Contexts.Hive, {
|
||||
*/
|
||||
get: function (event, filter) {
|
||||
filter = filter && String(Group.compileFilter(filter));
|
||||
return this._store.filter(function (autoCmd) autoCmd.match(event, filter));
|
||||
return this._store.filter(cmd => cmd.match(event, filter));
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -62,7 +62,7 @@ var AutoCmdHive = Class("AutoCmdHive", Contexts.Hive, {
|
||||
*/
|
||||
remove: function (event, filter) {
|
||||
filter = filter && String(Group.compileFilter(filter));
|
||||
this._store = this._store.filter(function (autoCmd) !autoCmd.match(event, filter));
|
||||
this._store = this._store.filter(cmd => !cmd.match(event, filter));
|
||||
},
|
||||
});
|
||||
|
||||
@@ -73,7 +73,7 @@ var AutoCommands = Module("autocommands", {
|
||||
init: function () {
|
||||
},
|
||||
|
||||
get activeHives() contexts.allGroups.autocmd.filter(function (h) h._store.length),
|
||||
get activeHives() contexts.allGroups.autocmd.filter(h => h._store.length),
|
||||
|
||||
add: deprecated("group.autocmd.add", { get: function add() autocommands.user.closure.add }),
|
||||
get: deprecated("group.autocmd.get", { get: function get() autocommands.user.closure.get }),
|
||||
@@ -107,15 +107,15 @@ var AutoCommands = Module("autocommands", {
|
||||
["table", {},
|
||||
["tr", { highlight: "Title" },
|
||||
["td", { colspan: "3" }, "----- Auto Commands -----"]],
|
||||
hives.map(function (hive) [
|
||||
hives.map(hive => [
|
||||
["tr", {},
|
||||
["td", { colspan: "3" },
|
||||
["span", { highlight: "Title" }, hive.name],
|
||||
" ", hive.filter.toJSONXML(modules)]],
|
||||
["tr", { style: "height: .5ex;" }],
|
||||
iter(cmds(hive)).map(function ([event, items]) [
|
||||
iter(cmds(hive)).map(([event, items]) => [
|
||||
["tr", { style: "height: .5ex;" }],
|
||||
items.map(function (item, i)
|
||||
items.map((item, i) =>
|
||||
["tr", {},
|
||||
["td", { highlight: "Title", style: "padding-left: 1em; padding-right: 1em;" },
|
||||
i == 0 ? event : ""],
|
||||
@@ -186,14 +186,14 @@ var AutoCommands = Module("autocommands", {
|
||||
validEvents.push("*");
|
||||
|
||||
events = Option.parse.stringlist(event);
|
||||
dactyl.assert(events.every(function (event) validEvents.indexOf(event.toLowerCase()) >= 0),
|
||||
dactyl.assert(events.every(e => validEvents.indexOf(e.toLowerCase()) >= 0),
|
||||
_("autocmd.noGroup", event));
|
||||
}
|
||||
|
||||
if (args.length > 2) { // add new command, possibly removing all others with the same event/pattern
|
||||
if (args.bang)
|
||||
args["-group"].remove(event, filter);
|
||||
cmd = contexts.bindMacro(args, "-ex", function (params) params);
|
||||
cmd = contexts.bindMacro(args, "-ex", params => params);
|
||||
args["-group"].add(events, filter, cmd);
|
||||
}
|
||||
else {
|
||||
@@ -254,7 +254,7 @@ var AutoCommands = Module("autocommands", {
|
||||
_("autocmd.cantExecuteAll"));
|
||||
dactyl.assert(validEvents.indexOf(event) >= 0,
|
||||
_("autocmd.noGroup", args));
|
||||
dactyl.assert(autocommands.get(event).some(function (c) c.filter(uri)),
|
||||
dactyl.assert(autocommands.get(event).some(c => c.filter(uri)),
|
||||
_("autocmd.noMatching"));
|
||||
|
||||
if (this.name == "doautoall" && dactyl.has("tabs")) {
|
||||
@@ -283,7 +283,7 @@ var AutoCommands = Module("autocommands", {
|
||||
};
|
||||
},
|
||||
javascript: function initJavascript() {
|
||||
JavaScript.setCompleter(AutoCmdHive.prototype.get, [function () Iterator(config.autocommands)]);
|
||||
JavaScript.setCompleter(AutoCmdHive.prototype.get, [() => Iterator(config.autocommands)]);
|
||||
},
|
||||
options: function initOptions() {
|
||||
options.add(["eventignore", "ei"],
|
||||
|
||||
+10
-10
@@ -349,8 +349,8 @@ var Bookmarks = Module("bookmarks", {
|
||||
else
|
||||
encodedParam = bookmarkcache.keywords[keyword.toLowerCase()].encodeURIComponent(param);
|
||||
|
||||
url = url.replace(/%s/g, function () encodedParam)
|
||||
.replace(/%S/g, function () param);
|
||||
url = url.replace(/%s/g, () => encodedParam)
|
||||
.replace(/%S/g, () => param);
|
||||
if (/%s/i.test(data))
|
||||
postData = window.getPostDataStream(data, param, encodedParam, "application/x-www-form-urlencoded");
|
||||
}
|
||||
@@ -388,7 +388,7 @@ var Bookmarks = Module("bookmarks", {
|
||||
let items = completion.runCompleter("bookmark", filter, maxItems, tags, extra);
|
||||
|
||||
if (items.length)
|
||||
return dactyl.open(items.map(function (i) i.url), dactyl.NEW_TAB);
|
||||
return dactyl.open(items.map(i => i.url), dactyl.NEW_TAB);
|
||||
|
||||
if (filter.length > 0 && tags.length > 0)
|
||||
dactyl.echoerr(_("bookmark.noMatching", tags.map(String.quote), filter.quote()));
|
||||
@@ -408,7 +408,7 @@ var Bookmarks = Module("bookmarks", {
|
||||
names: ["-tags", "-T"],
|
||||
description: "A comma-separated list of tags",
|
||||
completer: function tags(context, args) {
|
||||
context.generate = function () array(b.tags for (b in bookmarkcache) if (b.tags)).flatten().uniq().array;
|
||||
context.generate = () => array(b.tags for (b in bookmarkcache) if (b.tags)).flatten().uniq().array;
|
||||
context.keys = { text: util.identity, description: util.identity };
|
||||
},
|
||||
type: CommandOption.LIST
|
||||
@@ -547,7 +547,7 @@ var Bookmarks = Module("bookmarks", {
|
||||
let context = CompletionContext(args.join(" "));
|
||||
context.fork("bookmark", 0, completion, "bookmark",
|
||||
args["-tags"], { keyword: args["-keyword"], title: args["-title"] });
|
||||
deletedCount = bookmarks.remove(context.allItems.items.map(function (item) item.item.id));
|
||||
deletedCount = bookmarks.remove(context.allItems.items.map(item => item.item.id));
|
||||
}
|
||||
|
||||
dactyl.echomsg({ message: _("bookmark.deleted", deletedCount) });
|
||||
@@ -574,7 +574,7 @@ var Bookmarks = Module("bookmarks", {
|
||||
let options = {};
|
||||
|
||||
let url = buffer.uri.spec;
|
||||
let bmarks = bookmarks.get(url).filter(function (bmark) bmark.url == url);
|
||||
let bmarks = bookmarks.get(url).filter(bmark => bmark.url == url);
|
||||
|
||||
if (bmarks.length == 1) {
|
||||
let bmark = bmarks[0];
|
||||
@@ -630,7 +630,7 @@ var Bookmarks = Module("bookmarks", {
|
||||
if (v != null)
|
||||
context.filters.push(function (item) item.item[k] != null && this.matchString(v, item.item[k]));
|
||||
});
|
||||
context.generate = function () values(bookmarkcache.bookmarks);
|
||||
context.generate = () => values(bookmarkcache.bookmarks);
|
||||
completion.urls(context, tags);
|
||||
};
|
||||
|
||||
@@ -680,7 +680,7 @@ var Bookmarks = Module("bookmarks", {
|
||||
context.keys = { text: "keyword", description: "title", icon: "icon" };
|
||||
context.completions = values(bookmarks.searchEngines);
|
||||
if (suggest)
|
||||
context.filters.push(function ({ item }) item.supportsResponseType("application/x-suggestions+json"));
|
||||
context.filters.push(({ item }) => item.supportsResponseType("application/x-suggestions+json"));
|
||||
|
||||
};
|
||||
|
||||
@@ -712,13 +712,13 @@ var Bookmarks = Module("bookmarks", {
|
||||
return;
|
||||
|
||||
let words = ctxt.filter.toLowerCase().split(/\s+/g);
|
||||
ctxt.completions = ctxt.completions.filter(function (i) words.every(function (w) i.toLowerCase().indexOf(w) >= 0));
|
||||
ctxt.completions = ctxt.completions.filter(i => words.every(w => i.toLowerCase().indexOf(w) >= 0));
|
||||
|
||||
ctxt.hasItems = ctxt.completions.length;
|
||||
ctxt.incomplete = true;
|
||||
ctxt.cache.request = bookmarks.getSuggestions(name, ctxt.filter, function (compl) {
|
||||
ctxt.incomplete = false;
|
||||
ctxt.completions = array.uniq(ctxt.completions.filter(function (c) compl.indexOf(c) >= 0)
|
||||
ctxt.completions = array.uniq(ctxt.completions.filter(c => compl.indexOf(c) >= 0)
|
||||
.concat(compl), true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -194,7 +194,7 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
||||
{
|
||||
completer: function (context) completion.url(context),
|
||||
domains: function (args) array.compact(dactyl.parseURLs(args[0] || "").map(
|
||||
function (url) util.getHost(url))),
|
||||
url => util.getHost(url))),
|
||||
literal: 0,
|
||||
privateData: true
|
||||
});
|
||||
|
||||
@@ -199,7 +199,7 @@ var CommandWidgets = Class("CommandWidgets", {
|
||||
highlight.highlightNode(elem,
|
||||
(val[0] != null ? val[0] : obj.defaultGroup)
|
||||
.split(/\s/).filter(util.identity)
|
||||
.map(function (g) g + " " + nodeSet.group + g)
|
||||
.map(g => g + " " + nodeSet.group + g)
|
||||
.join(" "));
|
||||
elem.value = val[1];
|
||||
if (obj.onChange)
|
||||
@@ -217,7 +217,7 @@ var CommandWidgets = Class("CommandWidgets", {
|
||||
let elem = nodeSet[obj.name];
|
||||
if (elem)
|
||||
highlight.highlightNode(elem, obj.defaultGroup.split(/\s/)
|
||||
.map(function (g) g + " " + nodeSet.group + g).join(" "));
|
||||
.map(g => g + " " + nodeSet.group + g).join(" "));
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -253,7 +253,7 @@ var CommandWidgets = Class("CommandWidgets", {
|
||||
// choose which element to select.
|
||||
function check(node) {
|
||||
if (DOM(node).style.display === "-moz-stack") {
|
||||
let nodes = Array.filter(node.children, function (n) !n.collapsed && n.boxObject.height);
|
||||
let nodes = Array.filter(node.children, n => !n.collapsed && n.boxObject.height);
|
||||
nodes.forEach(function (node, i) { node.style.opacity = (i == nodes.length - 1) ? "" : "0" });
|
||||
}
|
||||
Array.forEach(node.children, check);
|
||||
@@ -313,9 +313,9 @@ var CommandWidgets = Class("CommandWidgets", {
|
||||
highlight.highlightNode(elem.contentDocument.body, "MOW");
|
||||
}), true),
|
||||
|
||||
multilineInput: Class.Memoize(function () document.getElementById("dactyl-multiline-input")),
|
||||
multilineInput: Class.Memoize(() => document.getElementById("dactyl-multiline-input")),
|
||||
|
||||
mowContainer: Class.Memoize(function () document.getElementById("dactyl-multiline-output-container"))
|
||||
mowContainer: Class.Memoize(() => document.getElementById("dactyl-multiline-output-container"))
|
||||
}, {
|
||||
getEditor: function getEditor(elem) {
|
||||
elem.inputField.QueryInterface(Ci.nsIDOMNSEditableElement);
|
||||
@@ -612,7 +612,7 @@ var CommandLine = Module("commandline", {
|
||||
}, this);
|
||||
},
|
||||
|
||||
widgets: Class.Memoize(function () CommandWidgets()),
|
||||
widgets: Class.Memoize(() => CommandWidgets()),
|
||||
|
||||
runSilently: function runSilently(func, self) {
|
||||
this.withSavedValues(["silent"], function () {
|
||||
@@ -871,7 +871,7 @@ var CommandLine = Module("commandline", {
|
||||
readHeredoc: function readHeredoc(end) {
|
||||
let args;
|
||||
commandline.inputMultiline(end, function (res) { args = res; });
|
||||
util.waitFor(function () args !== undefined);
|
||||
util.waitFor(() => args !== undefined);
|
||||
return args;
|
||||
},
|
||||
|
||||
@@ -916,7 +916,7 @@ var CommandLine = Module("commandline", {
|
||||
|
||||
events: update(
|
||||
iter(CommandMode.prototype.events).map(
|
||||
function ([event, handler]) [
|
||||
([event, handler]) => [
|
||||
event, function (event) {
|
||||
if (this.commandMode)
|
||||
handler.call(this.commandSession, event);
|
||||
@@ -967,7 +967,7 @@ var CommandLine = Module("commandline", {
|
||||
this.savingOutput = true;
|
||||
dactyl.trapErrors.apply(dactyl, [fn, self].concat(args));
|
||||
this.savingOutput = false;
|
||||
return output.map(function (elem) elem instanceof Node ? DOM.stringify(elem) : elem)
|
||||
return output.map(elem => elem instanceof Node ? DOM.stringify(elem) : elem)
|
||||
.join("\n");
|
||||
}
|
||||
}, {
|
||||
@@ -1008,7 +1008,7 @@ var CommandLine = Module("commandline", {
|
||||
if (privateData == "never-save")
|
||||
return;
|
||||
|
||||
this.store = this.store.filter(function (line) (line.value || line) != str);
|
||||
this.store = this.store.filter(line => (line.value || line) != str);
|
||||
dactyl.trapErrors(function () {
|
||||
this.store.push({ value: str, timestamp: Date.now() * 1000, privateData: privateData });
|
||||
}, this);
|
||||
@@ -1162,7 +1162,7 @@ var CommandLine = Module("commandline", {
|
||||
},
|
||||
|
||||
get activeContexts() this.context.contextList
|
||||
.filter(function (c) c.items.length || c.incomplete),
|
||||
.filter(c => c.items.length || c.incomplete),
|
||||
|
||||
/**
|
||||
* Returns the current completion string relative to the
|
||||
@@ -1693,7 +1693,7 @@ var CommandLine = Module("commandline", {
|
||||
}
|
||||
else if (commandline._messageHistory.length > 1) {
|
||||
commandline.commandOutput(
|
||||
template.map(commandline._messageHistory.messages, function (message)
|
||||
template.map(commandline._messageHistory.messages, message =>
|
||||
["div", { highlight: message.highlight + " Message" },
|
||||
message.message]));
|
||||
}
|
||||
@@ -1708,7 +1708,7 @@ var CommandLine = Module("commandline", {
|
||||
commands.add(["sil[ent]"],
|
||||
"Run a command silently",
|
||||
function (args) {
|
||||
commandline.runSilently(function () commands.execute(args[0] || "", null, true));
|
||||
commandline.runSilently(() => commands.execute(args[0] || "", null, true));
|
||||
}, {
|
||||
completer: function (context) completion.ex(context),
|
||||
literal: 0,
|
||||
@@ -1759,7 +1759,7 @@ var CommandLine = Module("commandline", {
|
||||
text = text.substring(1, index);
|
||||
modes.pop();
|
||||
|
||||
return function () self.callback.call(commandline, text);
|
||||
return () => self.callback.call(commandline, text);
|
||||
}
|
||||
return Events.PASS;
|
||||
});
|
||||
@@ -1893,10 +1893,10 @@ var CommandLine = Module("commandline", {
|
||||
let store = commandline._store;
|
||||
for (let [k, v] in store) {
|
||||
if (k == "command")
|
||||
store.set(k, v.filter(function (item)
|
||||
store.set(k, v.filter(item =>
|
||||
!(timespan.contains(item.timestamp) && (!host || commands.hasDomain(item.value, host)))));
|
||||
else if (!host)
|
||||
store.set(k, v.filter(function (item) !timespan.contains(item.timestamp)));
|
||||
store.set(k, v.filter(item => !timespan.contains(item.timestamp)));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1904,20 +1904,20 @@ var CommandLine = Module("commandline", {
|
||||
sanitizer.addItem("history", {
|
||||
action: function (timespan, host) {
|
||||
commandline._store.set("command",
|
||||
commandline._store.get("command", []).filter(function (item)
|
||||
commandline._store.get("command", []).filter(item =>
|
||||
!(timespan.contains(item.timestamp) && (host ? commands.hasDomain(item.value, host)
|
||||
: item.privateData))));
|
||||
|
||||
commandline._messageHistory.filter(function (item) !timespan.contains(item.timestamp * 1000) ||
|
||||
commandline._messageHistory.filter(item => !timespan.contains(item.timestamp * 1000) ||
|
||||
!item.domains && !item.privateData ||
|
||||
host && (!item.domains || !item.domains.some(function (d) util.isSubdomain(d, host))));
|
||||
host && (!item.domains || !item.domains.some(d => util.isSubdomain(d, host))));
|
||||
}
|
||||
});
|
||||
sanitizer.addItem("messages", {
|
||||
description: "Saved :messages",
|
||||
action: function (timespan, host) {
|
||||
commandline._messageHistory.filter(function (item) !timespan.contains(item.timestamp * 1000) ||
|
||||
host && (!item.domains || !item.domains.some(function (d) util.isSubdomain(d, host))));
|
||||
commandline._messageHistory.filter(item => !timespan.contains(item.timestamp * 1000) ||
|
||||
host && (!item.domains || !item.domains.some(d => util.isSubdomain(d, host))));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1965,18 +1965,18 @@ var ItemList = Class("ItemList", {
|
||||
["div", { key: "completions" }]],
|
||||
|
||||
["div", { highlight: "Completions" },
|
||||
template.map(util.range(0, options["maxitems"] * 2), function (i)
|
||||
template.map(util.range(0, options["maxitems"] * 2), i =>
|
||||
["div", { highlight: "CompItem NonText" },
|
||||
"~"])]],
|
||||
|
||||
get itemCount() this.context.contextList
|
||||
.reduce(function (acc, ctxt) acc + ctxt.items.length, 0),
|
||||
.reduce((acc, ctxt) => acc + ctxt.items.length, 0),
|
||||
|
||||
get visible() !this.container.collapsed,
|
||||
set visible(val) this.container.collapsed = !val,
|
||||
|
||||
get activeGroups() this.context.contextList
|
||||
.filter(function (c) c.items.length || c.message || c.incomplete)
|
||||
.filter(c => c.items.length || c.message || c.incomplete)
|
||||
.map(this.getGroup, this),
|
||||
|
||||
get selected() let (g = this.selectedGroup) g && g.selectedIdx != null
|
||||
@@ -2026,7 +2026,7 @@ var ItemList = Class("ItemList", {
|
||||
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, g => let (i = start - g.offsets.start) i >= 0 && i < g.itemCount, 0);
|
||||
return [group.context, start - group.offsets.start];
|
||||
},
|
||||
|
||||
@@ -2144,8 +2144,8 @@ var ItemList = Class("ItemList", {
|
||||
// We need to collect all of the rescrolling functions in
|
||||
// one go, as the height calculation that they need to do
|
||||
// would force a reflow after each DOM modification.
|
||||
this.activeGroups.filter(function (g) !g.collapsed)
|
||||
.map(function (g) g.rescrollFunc)
|
||||
this.activeGroups.filter(g => !g.collapsed)
|
||||
.map(g => g.rescrollFunc)
|
||||
.forEach(call);
|
||||
|
||||
if (!this.selected)
|
||||
|
||||
+49
-50
@@ -211,7 +211,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
|
||||
unregisterObserver: function unregisterObserver(type, callback) {
|
||||
if (type in this._observers)
|
||||
this._observers[type] = this._observers[type].filter(function (c) c.get() != callback);
|
||||
this._observers[type] = this._observers[type].filter(c => c.get() != callback);
|
||||
},
|
||||
|
||||
applyTriggerObserver: function triggerObserver(type, args) {
|
||||
@@ -245,12 +245,12 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
let name = commands.add(params.name, params.description,
|
||||
function (args) {
|
||||
let results = array(params.iterate(args))
|
||||
.sort(function (a, b) String.localeCompare(a.name, b.name));
|
||||
.sort((a, b) => String.localeCompare(a.name, b.name));
|
||||
|
||||
let filters = args.map(function (arg) let (re = util.regexp.escape(arg))
|
||||
let filters = args.map(arg => let (re = util.regexp.escape(arg))
|
||||
util.regexp("\\b" + re + "\\b|(?:^|[()\\s])" + re + "(?:$|[()\\s])", "i"));
|
||||
if (filters.length)
|
||||
results = results.filter(function (item) filters.every(function (re) keys(item).some(re.closure.test)));
|
||||
results = results.filter(item => filters.every(re => keys(item).some(re.closure.test)));
|
||||
|
||||
commandline.commandOutput(
|
||||
template.usage(results, params.format));
|
||||
@@ -276,7 +276,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
if (params.index)
|
||||
this.indices[params.index] = function () {
|
||||
let results = array((params.iterateIndex || params.iterate).call(params, commands.get(name).newArgs()))
|
||||
.array.sort(function (a, b) String.localeCompare(a.name, b.name));
|
||||
.array.sort((a, b) => String.localeCompare(a.name, b.name));
|
||||
|
||||
let haveTag = Set.has(help.tags);
|
||||
for (let obj in values(results)) {
|
||||
@@ -667,22 +667,22 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
let args = null;
|
||||
|
||||
if (obj instanceof Command) {
|
||||
link = function (cmd) ["ex", {}, cmd];
|
||||
link = cmd => ["ex", {}, cmd];
|
||||
args = obj.parseArgs("", CompletionContext(str || ""));
|
||||
tag = function (cmd) DOM.DOMString(":" + cmd);
|
||||
spec = function (cmd) [
|
||||
tag = cmd => DOM.DOMString(":" + cmd);
|
||||
spec = cmd => [
|
||||
obj.count ? ["oa", {}, "count"] : [],
|
||||
cmd,
|
||||
obj.bang ? ["oa", {}, "!"] : []
|
||||
];
|
||||
}
|
||||
else if (obj instanceof Map) {
|
||||
spec = function (map) obj.count ? [["oa", {}, "count"], map] : DOM.DOMString(map);
|
||||
tag = function (map) [
|
||||
spec = map => obj.count ? [["oa", {}, "count"], map] : DOM.DOMString(map);
|
||||
tag = map => [
|
||||
let (c = obj.modes[0].char) c ? c + "_" : "",
|
||||
map
|
||||
];
|
||||
link = function (map) {
|
||||
link = map => {
|
||||
let [, mode, name, extra] = /^(?:(.)_)?(?:<([^>]+)>)?(.*)$/.exec(map);
|
||||
let k = ["k", {}, extra];
|
||||
if (name)
|
||||
@@ -693,9 +693,9 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
};
|
||||
}
|
||||
else if (obj instanceof Option) {
|
||||
spec = function () template.map(obj.names, tag, " ");
|
||||
tag = function (name) DOM.DOMString("'" + name + "'");
|
||||
link = function (opt, name) ["o", {}, name];
|
||||
spec = () => template.map(obj.names, tag, " ");
|
||||
tag = name => DOM.DOMString("'" + name + "'");
|
||||
link = (opt, name) => ["o", {}, name];
|
||||
args = { value: "", values: [] };
|
||||
}
|
||||
|
||||
@@ -736,16 +736,16 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
|
||||
if (obj.completer && false)
|
||||
add(completion._runCompleter(obj.closure.completer, "", null, args).items
|
||||
.map(function (i) [i.text, i.description]));
|
||||
.map(i => [i.text, i.description]));
|
||||
|
||||
if (obj.options && obj.options.some(function (o) o.description) && false)
|
||||
add(obj.options.filter(function (o) o.description)
|
||||
.map(function (o) [
|
||||
if (obj.options && obj.options.some(o => o.description) && false)
|
||||
add(obj.options.filter(o => o.description)
|
||||
.map(o => [
|
||||
o.names[0],
|
||||
[o.description,
|
||||
o.names.length == 1 ? "" :
|
||||
["", " (short name: ",
|
||||
template.map(o.names.slice(1), function (n) ["em", {}, n], ", "),
|
||||
template.map(o.names.slice(1), n => ["em", {}, n], ", "),
|
||||
")"]]
|
||||
]));
|
||||
|
||||
@@ -960,7 +960,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
options.push("private");
|
||||
|
||||
let win = window.openDialog(document.documentURI, "_blank", options.join(","));
|
||||
util.waitFor(function () win.document.readyState === "complete");
|
||||
util.waitFor(() => win.document.readyState === "complete");
|
||||
browser = win.dactyl && win.dactyl.modules.config.tabbrowser || win.getBrowser();
|
||||
// FALLTHROUGH
|
||||
case dactyl.CURRENT_TAB:
|
||||
@@ -1037,7 +1037,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
}, this);
|
||||
},
|
||||
stringToURLArray: deprecated("dactyl.parseURLs", "parseURLs"),
|
||||
urlish: Class.Memoize(function () util.regexp(literal(/*
|
||||
urlish: Class.Memoize(() => util.regexp(literal(/*
|
||||
^ (
|
||||
<domain>+ (:\d+)? (/ .*) |
|
||||
<domain>+ (:\d+) |
|
||||
@@ -1187,11 +1187,11 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
wrapCallback: function wrapCallback(callback, self) {
|
||||
self = self || this;
|
||||
let save = ["forceOpen"];
|
||||
let saved = save.map(function (p) dactyl[p]);
|
||||
let saved = save.map(p => dactyl[p]);
|
||||
return function wrappedCallback() {
|
||||
let args = arguments;
|
||||
return dactyl.withSavedValues(save, function () {
|
||||
saved.forEach(function (p, i) dactyl[save[i]] = p);
|
||||
saved.forEach((p, i) => dactyl[save[i]] = p);
|
||||
try {
|
||||
return callback.apply(self, args);
|
||||
}
|
||||
@@ -1220,15 +1220,15 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
try {
|
||||
let info = contexts.getDocs(context);
|
||||
if (DOM.isJSONXML(info)) {
|
||||
let langs = info.slice(2).filter(function (e) isArray(e) && isObject(e[1]) && e[1].lang);
|
||||
let langs = info.slice(2).filter(e => isArray(e) && isObject(e[1]) && e[1].lang);
|
||||
if (langs) {
|
||||
let lang = config.bestLocale(l[1].lang for each (l in langs));
|
||||
|
||||
info = info.slice(0, 2).concat(
|
||||
info.slice(2).filter(function (e) !isArray(e) || !isObject(e[1])
|
||||
info.slice(2).filter(e => !isArray(e) || !isObject(e[1])
|
||||
|| e[1].lang == lang));
|
||||
|
||||
for each (let elem in info.slice(2).filter(function (e) isArray(e) && e[0] == "info" && isObject(e[1])))
|
||||
for each (let elem in info.slice(2).filter(e => isArray(e) && e[0] == "info" && isObject(e[1])))
|
||||
for (let attr in values(["name", "summary", "href"]))
|
||||
if (attr in elem[1])
|
||||
info[attr] = elem[1][attr];
|
||||
@@ -1256,7 +1256,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
cache.register("help/index.xml", function () {
|
||||
return '<?xml version="1.0"?>\n' +
|
||||
DOM.toXML(["overlay", { xmlns: "dactyl" },
|
||||
template.map(dactyl.indices, function ([name, iter])
|
||||
template.map(dactyl.indices, ([name, iter]) =>
|
||||
["dl", { insertafter: name + "-index" },
|
||||
template.map(iter(), util.identity)],
|
||||
"\n\n")]);
|
||||
@@ -1266,7 +1266,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
return '<?xml version="1.0"?>\n' +
|
||||
DOM.toXML(["overlay", { xmlns: "dactyl" },
|
||||
["dl", { insertafter: "dialog-list" },
|
||||
template.map(config.dialogs, function ([name, val])
|
||||
template.map(config.dialogs, ([name, val]) =>
|
||||
(!val[2] || val[2]())
|
||||
? [["dt", {}, name],
|
||||
["dd", {}, val[0]]]
|
||||
@@ -1279,9 +1279,9 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
DOM.toXML(["overlay", { xmlns: "dactyl" },
|
||||
["dl", { insertafter: "sanitize-items" },
|
||||
template.map(options.get("sanitizeitems").values
|
||||
.sort(function (a, b) String.localeCompare(a.name,
|
||||
.sort((a, b) => String.localeCompare(a.name,
|
||||
b.name)),
|
||||
function ({ name, description })
|
||||
({ name, description }) =>
|
||||
[["dt", {}, name],
|
||||
["dd", {}, template.linkifyHelp(description, true)]],
|
||||
"\n")]]);
|
||||
@@ -1325,7 +1325,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
}, config.guioptions),
|
||||
setter: function (opts) {
|
||||
for (let [opt, [, ids]] in Iterator(this.opts)) {
|
||||
ids.map(function (id) document.getElementById(id))
|
||||
ids.map(id => document.getElementById(id))
|
||||
.forEach(function (elem) {
|
||||
if (elem)
|
||||
dactyl.setNodeVisible(elem, opts.indexOf(opt) >= 0);
|
||||
@@ -1341,10 +1341,10 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
},
|
||||
setter: function (opts) {
|
||||
let dir = ["horizontal", "vertical"].filter(
|
||||
function (dir) !Array.some(opts,
|
||||
function (o) this.opts[o] && this.opts[o][1] == dir, this),
|
||||
this);
|
||||
let class_ = dir.map(function (dir) "html|html > xul|scrollbar[orient=" + dir + "]");
|
||||
dir => !Array.some(opts,
|
||||
o => this.opts[o] && this.opts[o][1] == dir)
|
||||
);
|
||||
let class_ = dir.map(dir => "html|html > xul|scrollbar[orient=" + dir + "]");
|
||||
|
||||
styles.system.add("scrollbar", "*",
|
||||
class_.length ? class_.join(", ") + " { visibility: collapse !important; }" : "",
|
||||
@@ -1369,7 +1369,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
classes.length ? classes.join(",") + "{ display: none; }" : "");
|
||||
|
||||
if (!dactyl.has("Gecko2")) {
|
||||
tabs.tabBinding.enabled = Array.some(opts, function (k) k in this.opts, this);
|
||||
tabs.tabBinding.enabled = Array.some(opts, k => k in this.opts);
|
||||
tabs.updateTabCount();
|
||||
}
|
||||
if (config.tabbrowser.tabContainer._positionPinnedTabs)
|
||||
@@ -1380,7 +1380,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
Option.validIf(!/[nN]/.test(opts), "Tab numbering not available in this " + config.host + " version")
|
||||
*/
|
||||
}
|
||||
].filter(function (group) !group.feature || dactyl.has(group.feature));
|
||||
].filter(group => !group.feature || dactyl.has(group.feature));
|
||||
|
||||
options.add(["guioptions", "go"],
|
||||
"Show or hide certain GUI elements like the menu or toolbar",
|
||||
@@ -1391,7 +1391,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
"rb" + [k for ([k, v] in iter(groups[1].opts))
|
||||
if (!Dactyl.toolbarHidden(document.getElementById(v[1][0])))].join(""),
|
||||
|
||||
values: array(groups).map(function (g) [[k, v[0]] for ([k, v] in Iterator(g.opts))]).flatten(),
|
||||
values: array(groups).map(g => [[k, v[0]] for ([k, v] in Iterator(g.opts))]).flatten(),
|
||||
|
||||
setter: function (value) {
|
||||
for (let group in values(groups))
|
||||
@@ -1400,7 +1400,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
return value;
|
||||
},
|
||||
validator: function (val) Option.validateCompleter.call(this, val) &&
|
||||
groups.every(function (g) !g.validator || g.validator(val))
|
||||
groups.every(g => !g.validator || g.validator(val))
|
||||
});
|
||||
|
||||
options.add(["loadplugins", "lpl"],
|
||||
@@ -1504,7 +1504,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
let arg = args[0] || "";
|
||||
let items = dactyl.getMenuItems(arg);
|
||||
|
||||
dactyl.assert(items.some(function (i) i.dactylPath == arg),
|
||||
dactyl.assert(items.some(i => i.dactylPath == arg),
|
||||
_("emenu.notFound", arg));
|
||||
|
||||
for (let [, item] in Iterator(items)) {
|
||||
@@ -1684,13 +1684,13 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
};
|
||||
|
||||
toolbarCommand(["toolbars[how]", "tbs[how]"], "Show the named toolbar",
|
||||
function (toolbar) dactyl.setNodeVisible(toolbar, true),
|
||||
function ({ item }) Dactyl.toolbarHidden(item));
|
||||
toolbar => dactyl.setNodeVisible(toolbar, true),
|
||||
({ item }) => Dactyl.toolbarHidden(item));
|
||||
toolbarCommand(["toolbarh[ide]", "tbh[ide]"], "Hide the named toolbar",
|
||||
function (toolbar) dactyl.setNodeVisible(toolbar, false),
|
||||
function ({ item }) !Dactyl.toolbarHidden(item));
|
||||
toolbar => dactyl.setNodeVisible(toolbar, false),
|
||||
({ item }) => !Dactyl.toolbarHidden(item));
|
||||
toolbarCommand(["toolbart[oggle]", "tbt[oggle]"], "Toggle the named toolbar",
|
||||
function (toolbar) dactyl.setNodeVisible(toolbar, Dactyl.toolbarHidden(toolbar)));
|
||||
toolbar => dactyl.setNodeVisible(toolbar, Dactyl.toolbarHidden(toolbar)));
|
||||
}
|
||||
|
||||
commands.add(["time"],
|
||||
@@ -1701,7 +1701,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
args = args[0] || "";
|
||||
|
||||
if (args[0] == ":")
|
||||
var func = function () commands.execute(args, null, false);
|
||||
var func = () => commands.execute(args, null, false);
|
||||
else
|
||||
func = dactyl.userFunc(args);
|
||||
|
||||
@@ -1836,7 +1836,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
completion: function initCompletion() {
|
||||
completion.dialog = function dialog(context) {
|
||||
context.title = ["Dialog"];
|
||||
context.filters.push(function ({ item }) !item[2] || item[2]());
|
||||
context.filters.push(({ item }) => !item[2] || item[2]());
|
||||
context.completions = [[k, v[0], v[2]] for ([k, v] in Iterator(config.dialogs))];
|
||||
};
|
||||
|
||||
@@ -1848,7 +1848,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
description: function (item) item.getAttribute("label"),
|
||||
highlight: function (item) item.disabled ? "Disabled" : ""
|
||||
};
|
||||
context.generate = function () dactyl.menuItems;
|
||||
context.generate = () => dactyl.menuItems;
|
||||
};
|
||||
|
||||
var toolbox = document.getElementById("navigator-toolbox");
|
||||
@@ -1881,8 +1881,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
|
||||
dactyl.withSavedValues.call(PrivateBrowsingUtils,
|
||||
["isWindowPrivate"], function () {
|
||||
PrivateBrowsingUtils.isWindowPrivate = function () false;
|
||||
|
||||
PrivateBrowsingUtils.isWindowPrivate = () => false;
|
||||
Cu.import("resource://gre/modules/LightweightThemeConsumer.jsm", {})
|
||||
.LightweightThemeConsumer.call(root._lightweightTheme, document);
|
||||
});
|
||||
|
||||
@@ -381,7 +381,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
|
||||
textBox = null;
|
||||
|
||||
let line, column;
|
||||
let keepFocus = modes.stack.some(function (m) isinstance(m.main, modes.COMMAND_LINE));
|
||||
let keepFocus = modes.stack.some(m => isinstance(m.main, modes.COMMAND_LINE));
|
||||
|
||||
if (!forceEditing && textBox && textBox.type == "password") {
|
||||
commandline.input(_("editor.prompt.editPassword") + " ",
|
||||
@@ -400,7 +400,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
|
||||
var editor_ = window.GetCurrentEditor ? GetCurrentEditor()
|
||||
: Editor.getEditor(document.commandDispatcher.focusedWindow);
|
||||
dactyl.assert(editor_);
|
||||
text = Array.map(editor_.rootElement.childNodes, function (e) DOM.stringify(e, true)).join("");
|
||||
text = Array.map(editor_.rootElement.childNodes, e => DOM.stringify(e, true)).join("");
|
||||
|
||||
if (!editor_.selection.rangeCount)
|
||||
var sel = "";
|
||||
@@ -1131,7 +1131,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
|
||||
"<*-Home>", "<*-End>", "<*-PageUp>", "<*-PageDown>",
|
||||
"<M-c>", "<M-v>", "<*-Tab>"],
|
||||
"Handled by " + config.host,
|
||||
function () Events.PASS_THROUGH);
|
||||
() => Events.PASS_THROUGH);
|
||||
|
||||
mappings.add([modes.INSERT],
|
||||
["<Space>", "<Return>"], "Expand Insert mode abbreviation",
|
||||
@@ -1327,19 +1327,19 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
|
||||
let bind = function bind(...args) mappings.add.apply(mappings, [[modes.AUTOCOMPLETE]].concat(args));
|
||||
|
||||
bind(["<Esc>"], "Return to Insert mode",
|
||||
function () Events.PASS_THROUGH);
|
||||
() => Events.PASS_THROUGH);
|
||||
|
||||
bind(["<C-[>"], "Return to Insert mode",
|
||||
function () { events.feedkeys("<Esc>", { skipmap: true }); });
|
||||
|
||||
bind(["<Up>"], "Select the previous autocomplete result",
|
||||
function () Events.PASS_THROUGH);
|
||||
() => Events.PASS_THROUGH);
|
||||
|
||||
bind(["<C-p>"], "Select the previous autocomplete result",
|
||||
function () { events.feedkeys("<Up>", { skipmap: true }); });
|
||||
|
||||
bind(["<Down>"], "Select the next autocomplete result",
|
||||
function () Events.PASS_THROUGH);
|
||||
() => Events.PASS_THROUGH);
|
||||
|
||||
bind(["<C-n>"], "Select the next autocomplete result",
|
||||
function () { events.feedkeys("<Down>", { skipmap: true }); });
|
||||
@@ -1350,8 +1350,8 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
|
||||
"string", 'gvim -f +<line> +"sil! call cursor(0, <column>)" <file>', {
|
||||
format: function (obj, value) {
|
||||
let args = commands.parseArgs(value || this.value, { argCount: "*", allowUnknownOptions: true })
|
||||
.map(util.compileMacro).filter(function (fmt) fmt.valid(obj))
|
||||
.map(function (fmt) fmt(obj));
|
||||
.map(util.compileMacro).filter(fmt => fmt.valid(obj))
|
||||
.map(fmt => fmt(obj));
|
||||
if (obj["file"] && !this.has("file"))
|
||||
args.push(obj["file"]);
|
||||
return args;
|
||||
@@ -1359,7 +1359,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
|
||||
has: function (key) Set.has(util.compileMacro(this.value).seen, key),
|
||||
validator: function (value) {
|
||||
this.format({}, value);
|
||||
return Object.keys(util.compileMacro(value).seen).every(function (k) ["column", "file", "line"].indexOf(k) >= 0);
|
||||
return Object.keys(util.compileMacro(value).seen).every(k => ["column", "file", "line"].indexOf(k) >= 0);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ var Events = Module("events", {
|
||||
this.active.push(elem);
|
||||
}
|
||||
|
||||
this.active = this.active.filter(function (e) e.popupBoxObject && e.popupBoxObject.popupState != "closed");
|
||||
this.active = this.active.filter(e => e.popupBoxObject && e.popupBoxObject.popupState != "closed");
|
||||
|
||||
if (!this.active.length && !this.activeMenubar)
|
||||
modes.remove(modes.MENU, true);
|
||||
@@ -466,12 +466,12 @@ var Events = Module("events", {
|
||||
|
||||
let access = iter({ 1: "shiftKey", 2: "ctrlKey", 4: "altKey", 8: "metaKey" })
|
||||
.filter(function ([k, v]) this & k, prefs.get("ui.key.chromeAccess"))
|
||||
.map(function ([k, v]) [v, true])
|
||||
.map(([k, v]) => [v, true])
|
||||
.toObject();
|
||||
|
||||
outer:
|
||||
for (let [, key] in iter(elements))
|
||||
if (filters.some(function ([k, v]) key.getAttribute(k) == v)) {
|
||||
if (filters.some(([k, v]) => key.getAttribute(k) == v)) {
|
||||
let keys = { ctrlKey: false, altKey: false, shiftKey: false, metaKey: false };
|
||||
let needed = { ctrlKey: event.ctrlKey, altKey: event.altKey, shiftKey: event.shiftKey, metaKey: event.metaKey };
|
||||
|
||||
@@ -482,7 +482,7 @@ var Events = Module("events", {
|
||||
case "accel": keys[accel] = true; break;
|
||||
default: keys[modifier + "Key"] = true; break;
|
||||
case "any":
|
||||
if (!iter.some(keys, function ([k, v]) v && needed[k]))
|
||||
if (!iter.some(keys, ([k, v]) => v && needed[k]))
|
||||
continue outer;
|
||||
for (let [k, v] in iter(keys)) {
|
||||
if (v)
|
||||
@@ -492,7 +492,7 @@ var Events = Module("events", {
|
||||
break;
|
||||
}
|
||||
|
||||
if (iter(needed).every(function ([k, v]) v == keys[k]))
|
||||
if (iter(needed).every(([k, v]) => v == keys[k]))
|
||||
return key;
|
||||
}
|
||||
|
||||
@@ -797,8 +797,8 @@ var Events = Module("events", {
|
||||
&& let (key = DOM.Event.stringify(event))
|
||||
!(modes.main.count && /^\d$/.test(key) ||
|
||||
modes.main.allBases.some(
|
||||
function (mode) mappings.hives.some(
|
||||
function (hive) hive.get(mode, key) || hive.getCandidates(mode, key))));
|
||||
mode => mappings.hives.some(
|
||||
hive => hive.get(mode, key) || hive.getCandidates(mode, key))));
|
||||
|
||||
events.dbg("ON " + event.type.toUpperCase() + " " + DOM.Event.stringify(event) +
|
||||
" passing: " + this.passing + " " +
|
||||
@@ -870,7 +870,7 @@ var Events = Module("events", {
|
||||
return;
|
||||
}
|
||||
|
||||
let haveInput = modes.stack.some(function (m) m.main.input);
|
||||
let haveInput = modes.stack.some(m => m.main.input);
|
||||
|
||||
if (DOM(elem || win).isEditable) {
|
||||
if (!haveInput)
|
||||
@@ -1104,7 +1104,7 @@ var Events = Module("events", {
|
||||
const Hive = Class("Hive", {
|
||||
init: function init(values, map) {
|
||||
this.name = "passkeys:" + map;
|
||||
this.stack = MapHive.Stack(values.map(function (v) Map(v[map + "Keys"])));
|
||||
this.stack = MapHive.Stack(values.map(v => Map(v[map + "Keys"])));
|
||||
function Map(keys) ({
|
||||
execute: function () Events.PASS_THROUGH,
|
||||
keys: keys
|
||||
|
||||
+31
-31
@@ -281,7 +281,7 @@ var HintSession = Class("HintSession", CommandMode, {
|
||||
|
||||
let doc = win.document;
|
||||
|
||||
memoize(doc, "dactylLabels", function ()
|
||||
memoize(doc, "dactylLabels", () =>
|
||||
iter([l.getAttribute("for"), l]
|
||||
for (l in array.iterValues(doc.querySelectorAll("label[for]"))))
|
||||
.toObject());
|
||||
@@ -300,7 +300,7 @@ var HintSession = Class("HintSession", CommandMode, {
|
||||
return false;
|
||||
|
||||
if (!rect.width || !rect.height)
|
||||
if (!Array.some(elem.childNodes, function (elem) elem instanceof Element && DOM(elem).style.float != "none" && isVisible(elem)))
|
||||
if (!Array.some(elem.childNodes, elem => elem instanceof Element && DOM(elem).style.float != "none" && isVisible(elem)))
|
||||
if (elem.textContent || !elem.name)
|
||||
return false;
|
||||
|
||||
@@ -473,7 +473,7 @@ var HintSession = Class("HintSession", CommandMode, {
|
||||
if (!followFirst) {
|
||||
let firstHref = this.validHints[0].elem.getAttribute("href") || null;
|
||||
if (firstHref) {
|
||||
if (this.validHints.some(function (h) h.elem.getAttribute("href") != firstHref))
|
||||
if (this.validHints.some(h => h.elem.getAttribute("href") != firstHref))
|
||||
return;
|
||||
}
|
||||
else if (this.validHints.length > 1)
|
||||
@@ -496,7 +496,7 @@ var HintSession = Class("HintSession", CommandMode, {
|
||||
// Hint document has been unloaded.
|
||||
return;
|
||||
|
||||
let hinted = n || this.validHints.some(function (h) h.elem === elem);
|
||||
let hinted = n || this.validHints.some(h => h.elem === elem);
|
||||
if (!hinted)
|
||||
hints.setClass(elem, null);
|
||||
else if (n)
|
||||
@@ -756,32 +756,32 @@ var Hints = Module("hints", {
|
||||
|
||||
this.modes = {};
|
||||
this.addMode(";", "Focus hint", buffer.closure.focusElement);
|
||||
this.addMode("?", "Show information for hint", function (elem) buffer.showElementInfo(elem));
|
||||
this.addMode("?", "Show information for hint", elem => buffer.showElementInfo(elem));
|
||||
// TODO: allow for ! override to overwrite existing paths -- where? --djk
|
||||
this.addMode("s", "Save hint", function (elem) buffer.saveLink(elem, false));
|
||||
this.addMode("f", "Focus frame", function (elem) dactyl.focus(elem.ownerDocument.defaultView));
|
||||
this.addMode("s", "Save hint", elem => buffer.saveLink(elem, false));
|
||||
this.addMode("f", "Focus frame", elem => dactyl.focus(elem.ownerDocument.defaultView));
|
||||
this.addMode("F", "Focus frame or pseudo-frame", buffer.closure.focusElement, isScrollable);
|
||||
this.addMode("o", "Follow hint", function (elem) buffer.followLink(elem, dactyl.CURRENT_TAB));
|
||||
this.addMode("t", "Follow hint in a new tab", function (elem) buffer.followLink(elem, dactyl.NEW_TAB));
|
||||
this.addMode("b", "Follow hint in a background tab", function (elem) buffer.followLink(elem, dactyl.NEW_BACKGROUND_TAB));
|
||||
this.addMode("w", "Follow hint in a new window", function (elem) buffer.followLink(elem, dactyl.NEW_WINDOW));
|
||||
this.addMode("O", "Generate an ‘:open URL’ prompt", function (elem, loc) CommandExMode().open("open " + loc));
|
||||
this.addMode("T", "Generate a ‘:tabopen URL’ prompt", function (elem, loc) CommandExMode().open("tabopen " + loc));
|
||||
this.addMode("W", "Generate a ‘:winopen URL’ prompt", function (elem, loc) CommandExMode().open("winopen " + loc));
|
||||
this.addMode("a", "Add a bookmark", function (elem) bookmarks.addSearchKeyword(elem));
|
||||
this.addMode("S", "Add a search keyword", function (elem) bookmarks.addSearchKeyword(elem));
|
||||
this.addMode("v", "View hint source", function (elem, loc) buffer.viewSource(loc, false));
|
||||
this.addMode("V", "View hint source in external editor", function (elem, loc) buffer.viewSource(loc, true));
|
||||
this.addMode("y", "Yank hint location", function (elem, loc) editor.setRegister(null, loc, true));
|
||||
this.addMode("Y", "Yank hint description", function (elem) editor.setRegister(null, elem.textContent || "", true));
|
||||
this.addMode("o", "Follow hint", elem => buffer.followLink(elem, dactyl.CURRENT_TAB));
|
||||
this.addMode("t", "Follow hint in a new tab", elem => buffer.followLink(elem, dactyl.NEW_TAB));
|
||||
this.addMode("b", "Follow hint in a background tab", elem => buffer.followLink(elem, dactyl.NEW_BACKGROUND_TAB));
|
||||
this.addMode("w", "Follow hint in a new window", elem => buffer.followLink(elem, dactyl.NEW_WINDOW));
|
||||
this.addMode("O", "Generate an ‘:open URL’ prompt", (elem, loc) => CommandExMode().open("open " + loc));
|
||||
this.addMode("T", "Generate a ‘:tabopen URL’ prompt", (elem, loc) => CommandExMode().open("tabopen " + loc));
|
||||
this.addMode("W", "Generate a ‘:winopen URL’ prompt", (elem, loc) => CommandExMode().open("winopen " + loc));
|
||||
this.addMode("a", "Add a bookmark", elem => bookmarks.addSearchKeyword(elem));
|
||||
this.addMode("S", "Add a search keyword", elem => bookmarks.addSearchKeyword(elem));
|
||||
this.addMode("v", "View hint source", (elem, loc) => buffer.viewSource(loc, false));
|
||||
this.addMode("V", "View hint source in external editor", (elem, loc) => buffer.viewSource(loc, true));
|
||||
this.addMode("y", "Yank hint location", (elem, loc) => editor.setRegister(null, loc, true));
|
||||
this.addMode("Y", "Yank hint description", elem => editor.setRegister(null, elem.textContent || "", true));
|
||||
this.addMode("A", "Yank hint anchor url", function (elem) {
|
||||
let uri = elem.ownerDocument.documentURIObject.clone();
|
||||
uri.ref = elem.id || elem.name;
|
||||
dactyl.clipboardWrite(uri.spec, true);
|
||||
});
|
||||
this.addMode("c", "Open context menu", function (elem) DOM(elem).contextmenu());
|
||||
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));
|
||||
this.addMode("c", "Open context menu", elem => DOM(elem).contextmenu());
|
||||
this.addMode("i", "Show image", elem => dactyl.open(elem.src));
|
||||
this.addMode("I", "Show image in a new tab", elem => dactyl.open(elem.src, dactyl.NEW_TAB));
|
||||
|
||||
function isScrollable(elem) isinstance(elem, [Ci.nsIDOMHTMLFrameElement,
|
||||
Ci.nsIDOMHTMLIFrameElement]) ||
|
||||
@@ -812,7 +812,7 @@ var Hints = Module("hints", {
|
||||
let update = eht.isDefault;
|
||||
|
||||
let value = eht.parse(Option.quote(util.regexp.escape(mode)) + ":" + tags.map(Option.quote))[0];
|
||||
eht.defaultValue = eht.defaultValue.filter(function (re) toString(re) != toString(value))
|
||||
eht.defaultValue = eht.defaultValue.filter(re => toString(re) != toString(value))
|
||||
.concat(value);
|
||||
|
||||
if (update)
|
||||
@@ -915,7 +915,7 @@ var Hints = Module("hints", {
|
||||
let tokens = tokenize(/\s+/, hintString);
|
||||
return function (linkText) {
|
||||
linkText = linkText.toLowerCase();
|
||||
return tokens.every(function (token) indexOf(linkText, token) >= 0);
|
||||
return tokens.every(token => indexOf(linkText, token) >= 0);
|
||||
};
|
||||
} //}}}
|
||||
|
||||
@@ -1063,7 +1063,7 @@ var Hints = Module("hints", {
|
||||
commandline.input(["Normal", mode], null, {
|
||||
autocomplete: false,
|
||||
completer: function (context) {
|
||||
context.compare = function () 0;
|
||||
context.compare = () => 0;
|
||||
context.completions = [[k, v.prompt] for ([k, v] in Iterator(hints.modes))];
|
||||
},
|
||||
onCancel: mappings.closure.popCommand,
|
||||
@@ -1073,7 +1073,7 @@ var Hints = Module("hints", {
|
||||
mappings.popCommand();
|
||||
},
|
||||
onChange: function (arg) {
|
||||
if (Object.keys(hints.modes).some(function (m) m != arg && m.indexOf(arg) == 0))
|
||||
if (Object.keys(hints.modes).some(m => m != arg && m.indexOf(arg) == 0))
|
||||
return;
|
||||
|
||||
this.accepted = true;
|
||||
@@ -1111,7 +1111,7 @@ var Hints = Module("hints", {
|
||||
isVisible: function isVisible(elem, offScreen) {
|
||||
let rect = elem.getBoundingClientRect();
|
||||
if (!rect.width || !rect.height)
|
||||
if (!Array.some(elem.childNodes, function (elem) elem instanceof Element && DOM(elem).style.float != "none" && isVisible(elem)))
|
||||
if (!Array.some(elem.childNodes, elem => elem instanceof Element && DOM(elem).style.float != "none" && isVisible(elem)))
|
||||
return false;
|
||||
|
||||
let win = elem.ownerDocument.defaultView;
|
||||
@@ -1300,7 +1300,7 @@ var Hints = Module("hints", {
|
||||
{
|
||||
keepQuotes: true,
|
||||
getKey: function (val, default_)
|
||||
let (res = array.nth(this.value, function (re) let (match = re.exec(val)) match && match[0] == val, 0))
|
||||
let (res = array.nth(this.value, re => let (match = re.exec(val)) match && match[0] == val, 0))
|
||||
res ? res.matcher : default_,
|
||||
parse: function parse(val) {
|
||||
let vals = parse.supercall(this, val);
|
||||
@@ -1308,7 +1308,7 @@ var Hints = Module("hints", {
|
||||
value.matcher = DOM.compileMatcher(Option.splitList(value.result));
|
||||
return vals;
|
||||
},
|
||||
testValues: function testValues(vals, validator) vals.every(function (re) Option.splitList(re).every(validator)),
|
||||
testValues: function testValues(vals, validator) vals.every(re => Option.splitList(re).every(validator)),
|
||||
validator: DOM.validateMatcher
|
||||
});
|
||||
|
||||
@@ -1368,7 +1368,7 @@ var Hints = Module("hints", {
|
||||
"transliterated": UTF8("When true, special latin characters are translated to their ASCII equivalents (e.g., é ⇒ e)")
|
||||
},
|
||||
validator: function (values) Option.validateCompleter.call(this, values) &&
|
||||
1 === values.reduce(function (acc, v) acc + (["contains", "custom", "firstletters", "wordstartswith"].indexOf(v) >= 0), 0)
|
||||
1 === values.reduce((acc, v) => acc + (["contains", "custom", "firstletters", "wordstartswith"].indexOf(v) >= 0), 0)
|
||||
});
|
||||
|
||||
options.add(["wordseparators", "wsp"],
|
||||
|
||||
@@ -65,7 +65,7 @@ var History = Module("history", {
|
||||
let sh = webNav.sessionHistory;
|
||||
|
||||
let obj = [];
|
||||
obj.__defineGetter__("index", function () sh.index);
|
||||
obj.__defineGetter__("index", () => sh.index);
|
||||
obj.__defineSetter__("index", function (val) { webNav.gotoIndex(val); });
|
||||
obj.__iterator__ = function () array.iterItems(this);
|
||||
|
||||
@@ -111,7 +111,7 @@ var History = Module("history", {
|
||||
*/
|
||||
search: function search(item, steps) {
|
||||
var ctxt;
|
||||
var filter = function (item) true;
|
||||
var filter = item => true;
|
||||
if (item == "domain")
|
||||
var filter = function (item) {
|
||||
let res = item.URI.hostPort != ctxt;
|
||||
@@ -165,7 +165,7 @@ var History = Module("history", {
|
||||
let items = completion.runCompleter("history", filter, maxItems, maxItems, sort);
|
||||
|
||||
if (items.length)
|
||||
return dactyl.open(items.map(function (i) i.url), dactyl.NEW_TAB);
|
||||
return dactyl.open(items.map(i => i.url), dactyl.NEW_TAB);
|
||||
|
||||
if (filter.length > 0)
|
||||
dactyl.echoerr(_("history.noMatching", filter.quote()));
|
||||
@@ -284,7 +284,7 @@ var History = Module("history", {
|
||||
"title",
|
||||
"uri",
|
||||
"visitcount"
|
||||
].map(function (order) [
|
||||
].map(order => [
|
||||
["+" + order.replace(" ", ""), /*L*/"Sort by " + order + " ascending"],
|
||||
["-" + order.replace(" ", ""), /*L*/"Sort by " + order + " descending"]
|
||||
]));
|
||||
@@ -324,12 +324,12 @@ var History = Module("history", {
|
||||
completion: function initCompletion() {
|
||||
completion.domain = function (context) {
|
||||
context.anchored = false;
|
||||
context.compare = function (a, b) String.localeCompare(a.key, b.key);
|
||||
context.compare = (a, b) => String.localeCompare(a.key, b.key);
|
||||
context.keys = { text: util.identity, description: util.identity,
|
||||
key: function (host) host.split(".").reverse().join(".") };
|
||||
|
||||
// FIXME: Schema-specific
|
||||
context.generate = function () [
|
||||
context.generate = () => [
|
||||
Array.slice(row.rev_host).reverse().join("").slice(1)
|
||||
for (row in iter(services.history.DBConnection
|
||||
.createStatement("SELECT DISTINCT rev_host FROM moz_places WHERE rev_host IS NOT NULL;")))
|
||||
|
||||
@@ -20,11 +20,11 @@ var ProcessorStack = Class("ProcessorStack", {
|
||||
this.modes = array([mode.params.keyModes, main, mode.main.allBases.slice(1)]).flatten().compact();
|
||||
|
||||
if (builtin)
|
||||
hives = hives.filter(function (h) h.name === "builtin");
|
||||
hives = hives.filter(h => h.name === "builtin");
|
||||
|
||||
this.processors = this.modes.map(function (m) hives.map(function (h) KeyProcessor(m, h)))
|
||||
this.processors = this.modes.map(m => hives.map(h => KeyProcessor(m, h)))
|
||||
.flatten().array;
|
||||
this.ownsBuffer = !this.processors.some(function (p) p.main.ownsBuffer);
|
||||
this.ownsBuffer = !this.processors.some(p => p.main.ownsBuffer);
|
||||
|
||||
for (let [i, input] in Iterator(this.processors)) {
|
||||
let params = input.main.params;
|
||||
@@ -134,17 +134,17 @@ var ProcessorStack = Class("ProcessorStack", {
|
||||
events.passing = true;
|
||||
|
||||
if (result === Events.PASS_THROUGH && this.keyEvents.length)
|
||||
events.dbg("PASS_THROUGH:\n\t" + this.keyEvents.map(function (e) [e.type, DOM.Event.stringify(e)]).join("\n\t"));
|
||||
events.dbg("PASS_THROUGH:\n\t" + this.keyEvents.map(e => [e.type, DOM.Event.stringify(e)]).join("\n\t"));
|
||||
|
||||
if (result === Events.PASS_THROUGH)
|
||||
events.feedevents(null, this.keyEvents, { skipmap: true, isMacro: true, isReplay: true });
|
||||
else {
|
||||
let list = this.events.filter(function (e) e.getPreventDefault() && !e.dactylDefaultPrevented);
|
||||
let list = this.events.filter(e => e.getPreventDefault() && !e.dactylDefaultPrevented);
|
||||
|
||||
if (result === Events.PASS)
|
||||
events.dbg("PASS THROUGH: " + list.slice(0, length).filter(function (e) e.type === "keypress").map(DOM.Event.closure.stringify));
|
||||
events.dbg("PASS THROUGH: " + list.slice(0, length).filter(e => e.type === "keypress").map(DOM.Event.closure.stringify));
|
||||
if (list.length > length)
|
||||
events.dbg("REFEED: " + list.slice(length).filter(function (e) e.type === "keypress").map(DOM.Event.closure.stringify));
|
||||
events.dbg("REFEED: " + list.slice(length).filter(e => e.type === "keypress").map(DOM.Event.closure.stringify));
|
||||
|
||||
if (result === Events.PASS)
|
||||
events.feedevents(null, list.slice(0, length), { skipmap: true, isMacro: true, isReplay: true });
|
||||
|
||||
+29
-29
@@ -50,7 +50,7 @@ var Map = Class("Map", {
|
||||
/** @property {[string]} All of this mapping's names (key sequences). */
|
||||
names: Class.Memoize(function () this._keys.map(function (k) DOM.Event.canonicalKeys(k))),
|
||||
|
||||
get toStringParams() [this.modes.map(function (m) m.name), this.names.map(String.quote)],
|
||||
get toStringParams() [this.modes.map(m => m.name), this.names.map(String.quote)],
|
||||
|
||||
get identifier() [this.modes[0].name, this.hive.prefix + this.names[0]].join("."),
|
||||
|
||||
@@ -171,9 +171,9 @@ var MapHive = Class("MapHive", Contexts.Hive, {
|
||||
*/
|
||||
iterate: function (modes) {
|
||||
let stacks = Array.concat(modes).map(this.closure.getStack);
|
||||
return values(stacks.shift().sort(function (m1, m2) String.localeCompare(m1.name, m2.name))
|
||||
.filter(function (map) map.rhs &&
|
||||
stacks.every(function (stack) stack.some(function (m) m.rhs && m.rhs === map.rhs && m.name === map.name))));
|
||||
return values(stacks.shift().sort((m1, m2) => String.localeCompare(m1.name, m2.name))
|
||||
.filter(map => map.rhs &&
|
||||
stacks.every(stack => stack.some(m => m.rhs && m.rhs === map.rhs && m.name === map.name))));
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -263,7 +263,7 @@ var MapHive = Class("MapHive", Contexts.Hive, {
|
||||
map.names.splice(j, 1);
|
||||
if (map.names.length == 0) // FIX ME.
|
||||
for (let [mode, stack] in Iterator(this.stacks))
|
||||
this.stacks[mode] = MapHive.Stack(stack.filter(function (m) m != map));
|
||||
this.stacks[mode] = MapHive.Stack(stack.filter(m => m != map));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -352,15 +352,15 @@ var Mappings = Module("mappings", {
|
||||
|
||||
get allHives() contexts.allGroups.mappings,
|
||||
|
||||
get userHives() this.allHives.filter(function (h) h !== this.builtin, this),
|
||||
get userHives() this.allHives.filter(h => h !== this.builtin),
|
||||
|
||||
expandLeader: deprecated("your brain", function expandLeader(keyString) keyString),
|
||||
|
||||
prefixes: Class.Memoize(function () {
|
||||
let list = Array.map("CASM", function (s) s + "-");
|
||||
let list = Array.map("CASM", s => s + "-");
|
||||
|
||||
return iter(util.range(0, 1 << list.length)).map(function (mask)
|
||||
list.filter(function (p, i) mask & (1 << i)).join("")).toArray().concat("*-");
|
||||
return iter(util.range(0, 1 << list.length)).map(mask =>
|
||||
list.filter((p, i) => mask & (1 << i)).join("")).toArray().concat("*-");
|
||||
}),
|
||||
|
||||
expand: function expand(keys) {
|
||||
@@ -371,7 +371,7 @@ var Mappings = Module("mappings", {
|
||||
if (/^<\*-/.test(key))
|
||||
return ["<", this.prefixes, key.slice(3)];
|
||||
return key;
|
||||
}, this).flatten().array).map(function (k) DOM.Event.canonicalKeys(k));
|
||||
}, this).flatten().array).map(k => DOM.Event.canonicalKeys(k));
|
||||
|
||||
if (keys != arguments[0])
|
||||
return [arguments[0]].concat(keys);
|
||||
@@ -442,7 +442,7 @@ var Mappings = Module("mappings", {
|
||||
* @param {string} cmd The map name to match.
|
||||
* @returns {Map}
|
||||
*/
|
||||
get: function get(mode, cmd) this.hives.map(function (h) h.get(mode, cmd)).compact()[0] || null,
|
||||
get: function get(mode, cmd) this.hives.map(h => h.get(mode, cmd)).compact()[0] || null,
|
||||
|
||||
/**
|
||||
* Returns a count of maps with names starting with but not equal to
|
||||
@@ -453,8 +453,8 @@ var Mappings = Module("mappings", {
|
||||
* @returns {[Map]}
|
||||
*/
|
||||
getCandidates: function (mode, prefix)
|
||||
this.hives.map(function (h) h.getCandidates(mode, prefix))
|
||||
.reduce(function (a, b) a + b, 0),
|
||||
this.hives.map(h => h.getCandidates(mode, prefix))
|
||||
.reduce((a, b) => a + b, 0),
|
||||
|
||||
/**
|
||||
* Lists all user-defined mappings matching *filter* for the specified
|
||||
@@ -465,17 +465,17 @@ var Mappings = Module("mappings", {
|
||||
* @param {[MapHive]} hives The map hives to list. @optional
|
||||
*/
|
||||
list: function (modes, filter, hives) {
|
||||
let modeSign = modes.map(function (m) m.char || "").join("")
|
||||
+ modes.map(function (m) !m.char ? " " + m.name : "").join("");
|
||||
let modeSign = modes.map(m => m.char || "").join("")
|
||||
+ modes.map(m => !m.char ? " " + m.name : "").join("");
|
||||
modeSign = modeSign.replace(/^ /, "");
|
||||
|
||||
hives = (hives || mappings.userHives).map(function (h) [h, maps(h)])
|
||||
.filter(function ([h, m]) m.length);
|
||||
hives = (hives || mappings.userHives).map(h => [h, maps(h)])
|
||||
.filter(([h, m]) => m.length);
|
||||
|
||||
function maps(hive) {
|
||||
let maps = iter.toArray(hive.iterate(modes));
|
||||
if (filter)
|
||||
maps = maps.filter(function (m) m.names[0] === filter);
|
||||
maps = maps.filter(m => m.names[0] === filter);
|
||||
return maps;
|
||||
}
|
||||
|
||||
@@ -486,10 +486,10 @@ var Mappings = Module("mappings", {
|
||||
["td", { style: "padding-right: 1em;" }, _("title.Command")],
|
||||
["td", { style: "padding-right: 1em;" }, _("title.Action")]],
|
||||
["col", { style: "min-width: 6em; padding-right: 1em;" }],
|
||||
hives.map(function ([hive, maps]) let (i = 0) [
|
||||
hives.map(([hive, maps]) => let (i = 0) [
|
||||
["tr", { style: "height: .5ex;" }],
|
||||
maps.map(function (map)
|
||||
map.names.map(function (name)
|
||||
maps.map(map =>
|
||||
map.names.map(name =>
|
||||
["tr", {},
|
||||
["td", { highlight: "Title" }, !i++ ? hive.name : ""],
|
||||
["td", {}, modeSign],
|
||||
@@ -526,7 +526,7 @@ var Mappings = Module("mappings", {
|
||||
|
||||
if (args[1] && !/^<nop>$/i.test(args[1])
|
||||
&& !args["-count"] && !args["-ex"] && !args["-javascript"]
|
||||
&& mapmodes.every(function (m) m.count))
|
||||
&& mapmodes.every(m => m.count))
|
||||
args[1] = "<count>" + args[1];
|
||||
|
||||
let [lhs, rhs] = args;
|
||||
@@ -541,7 +541,7 @@ var Mappings = Module("mappings", {
|
||||
|
||||
args["-group"].add(mapmodes, [lhs],
|
||||
args["-description"],
|
||||
contexts.bindMacro(args, "-keys", function (params) params),
|
||||
contexts.bindMacro(args, "-keys", params => params),
|
||||
{
|
||||
arg: args["-arg"],
|
||||
count: args["-count"] || !(args["-ex"] || args["-javascript"]),
|
||||
@@ -614,8 +614,8 @@ var Mappings = Module("mappings", {
|
||||
serialize: function () {
|
||||
return this.name != "map" ? [] :
|
||||
array(mappings.userHives)
|
||||
.filter(function (h) h.persist)
|
||||
.map(function (hive) [
|
||||
.filter(h => h.persist)
|
||||
.map(hive => [
|
||||
{
|
||||
command: "map",
|
||||
options: {
|
||||
@@ -711,9 +711,9 @@ var Mappings = Module("mappings", {
|
||||
}
|
||||
function uniqueModes(modes) {
|
||||
let chars = [k for ([k, v] in Iterator(modules.modes.modeChars))
|
||||
if (v.every(function (mode) modes.indexOf(mode) >= 0))];
|
||||
return array.uniq(modes.filter(function (m) chars.indexOf(m.char) < 0)
|
||||
.map(function (m) m.name.toLowerCase())
|
||||
if (v.every(mode => modes.indexOf(mode) >= 0))];
|
||||
return array.uniq(modes.filter(m => chars.indexOf(m.char) < 0)
|
||||
.map(m => m.name.toLowerCase())
|
||||
.concat(chars));
|
||||
}
|
||||
|
||||
@@ -773,7 +773,7 @@ var Mappings = Module("mappings", {
|
||||
: [],
|
||||
template.linkifyHelp(map.description + (map.rhs ? ": " + map.rhs : ""))
|
||||
],
|
||||
help: function (map) let (char = array.compact(map.modes.map(function (m) m.char))[0])
|
||||
help: function (map) let (char = array.compact(map.modes.map(m => m.char))[0])
|
||||
char === "n" ? map.name : char ? char + "_" + map.name : "",
|
||||
headings: ["Command", "Mode", "Group", "Description"]
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ var Marks = Module("marks", {
|
||||
*/
|
||||
get all() iter(this._localMarks.get(this.localURI) || {},
|
||||
this._urlMarks
|
||||
).sort(function (a, b) String.localeCompare(a[0], b[0])),
|
||||
).sort((a, b) => String.localeCompare(a[0], b[0])),
|
||||
|
||||
get localURI() buffer.focusedFrame.document.documentURI.replace(/#.*/, ""),
|
||||
|
||||
@@ -137,7 +137,7 @@ var Marks = Module("marks", {
|
||||
let store = buffer.localStore;
|
||||
return {
|
||||
index: store.jumpsIndex,
|
||||
locations: store.jumps.map(function (j) j.mark)
|
||||
locations: store.jumps.map(j => j.mark)
|
||||
};
|
||||
},
|
||||
|
||||
@@ -260,7 +260,7 @@ var Marks = Module("marks", {
|
||||
|
||||
if (filter.length > 0) {
|
||||
let pattern = util.charListToRegexp(filter, "a-zA-Z");
|
||||
marks = marks.filter(function ([k, ]) pattern.test(k));
|
||||
marks = marks.filter(([k, ]) => pattern.test(k));
|
||||
dactyl.assert(marks.length > 0, _("mark.noMatching", filter.quote()));
|
||||
}
|
||||
|
||||
@@ -376,7 +376,7 @@ var Marks = Module("marks", {
|
||||
function percent(i) Math.round(i * 100);
|
||||
|
||||
context.title = ["Mark", "HPos VPos File"];
|
||||
context.keys.description = function ([, m]) (m.offset ? Math.round(m.offset.x) + " " + Math.round(m.offset.y)
|
||||
context.keys.description = ([, m]) => (m.offset ? Math.round(m.offset.x) + " " + Math.round(m.offset.y)
|
||||
: percent(m.position.x) + "% " + percent(m.position.y) + "%"
|
||||
) + " " + m.location;
|
||||
context.completions = marks.all;
|
||||
|
||||
+16
-16
@@ -237,7 +237,7 @@ var Modes = Module("modes", {
|
||||
if (this._modeMap[mode.mode] == mode)
|
||||
delete this._modeMap[mode.mode];
|
||||
|
||||
this._mainModes = this._mainModes.filter(function (m) m != mode);
|
||||
this._mainModes = this._mainModes.filter(m => m != mode);
|
||||
},
|
||||
|
||||
dumpStack: function dumpStack() {
|
||||
@@ -254,11 +254,11 @@ var Modes = Module("modes", {
|
||||
|
||||
getCharModes: function getCharModes(chr) (this.modeChars[chr] || []).slice(),
|
||||
|
||||
have: function have(mode) this._modeStack.some(function (m) isinstance(m.main, mode)),
|
||||
have: function have(mode) this._modeStack.some(m => isinstance(m.main, mode)),
|
||||
|
||||
matchModes: function matchModes(obj)
|
||||
this._modes.filter(function (mode) Object.keys(obj)
|
||||
.every(function (k) obj[k] == (mode[k] || false))),
|
||||
this._modes.filter(mode => Object.keys(obj)
|
||||
.every(k => obj[k] == (mode[k] || false))),
|
||||
|
||||
// show the current mode string in the command line
|
||||
show: function show() {
|
||||
@@ -274,7 +274,7 @@ var Modes = Module("modes", {
|
||||
remove: function remove(mode, covert) {
|
||||
if (covert && this.topOfStack.main != mode) {
|
||||
util.assert(mode != this.NORMAL);
|
||||
for (let m; m = array.nth(this.modeStack, function (m) m.main == mode, 0);)
|
||||
for (let m; m = array.nth(this.modeStack, m => m.main == mode, 0);)
|
||||
this._modeStack.splice(this._modeStack.indexOf(m));
|
||||
}
|
||||
else if (this.stack.some(function (m) m.main == mode)) {
|
||||
@@ -361,7 +361,7 @@ var Modes = Module("modes", {
|
||||
push ? { push: push } : stack || {},
|
||||
prev);
|
||||
|
||||
delayed.forEach(function ([fn, self]) dactyl.trapErrors(fn, self));
|
||||
delayed.forEach(([fn, self]) => dactyl.trapErrors(fn, self));
|
||||
|
||||
dactyl.triggerObserver("modes.change", [oldMain, oldExtended], [this._main, this._extended], stack);
|
||||
this.show();
|
||||
@@ -465,11 +465,11 @@ var Modes = Module("modes", {
|
||||
|
||||
hidden: false,
|
||||
|
||||
input: Class.Memoize(function input() this.insert || this.bases.length && this.bases.some(function (b) b.input)),
|
||||
input: Class.Memoize(function input() this.insert || this.bases.length && this.bases.some(b => b.input)),
|
||||
|
||||
insert: Class.Memoize(function insert() this.bases.length && this.bases.some(function (b) b.insert)),
|
||||
insert: Class.Memoize(function insert() this.bases.length && this.bases.some(b => b.insert)),
|
||||
|
||||
ownsFocus: Class.Memoize(function ownsFocus() this.bases.length && this.bases.some(function (b) b.ownsFocus)),
|
||||
ownsFocus: Class.Memoize(function ownsFocus() this.bases.length && this.bases.some(b => b.ownsFocus)),
|
||||
|
||||
passEvent: function passEvent(event) this.input && event.charCode && !(event.ctrlKey || event.altKey || event.metaKey),
|
||||
|
||||
@@ -491,8 +491,8 @@ var Modes = Module("modes", {
|
||||
update(StackElement.prototype, {
|
||||
get toStringParams() !loaded.modes ? this.main.name : [
|
||||
this.main.name,
|
||||
["(", modes.all.filter(function (m) this.extended & m, this)
|
||||
.map(function (m) m.name).join("|"),
|
||||
["(", modes.all.filter(m => this.extended & m)
|
||||
.map(m => m.name).join("|"),
|
||||
")"].join("")
|
||||
]
|
||||
});
|
||||
@@ -525,7 +525,7 @@ var Modes = Module("modes", {
|
||||
}, {
|
||||
cache: function initCache() {
|
||||
function makeTree() {
|
||||
let list = modes.all.filter(function (m) m.name !== m.description);
|
||||
let list = modes.all.filter(m => m.name !== m.description);
|
||||
|
||||
let tree = {};
|
||||
|
||||
@@ -558,7 +558,7 @@ var Modes = Module("modes", {
|
||||
return rec(roots);
|
||||
}
|
||||
|
||||
cache.register("modes.dtd", function ()
|
||||
cache.register("modes.dtd", () =>
|
||||
util.makeDTD(iter({ "modes.tree": makeTree() },
|
||||
config.dtd)));
|
||||
},
|
||||
@@ -599,7 +599,7 @@ var Modes = Module("modes", {
|
||||
|
||||
getKey: function getKey(val, default_) {
|
||||
if (isArray(val))
|
||||
return (array.nth(this.value, function (v) val.some(function (m) m.name === v.mode), 0)
|
||||
return (array.nth(this.value, v => val.some(m => m.name === v.mode), 0)
|
||||
|| { result: default_ }).result;
|
||||
|
||||
return Set.has(this.valueMap, val) ? this.valueMap[val] : default_;
|
||||
@@ -613,11 +613,11 @@ var Modes = Module("modes", {
|
||||
result: v[0] !== "!"
|
||||
}));
|
||||
|
||||
this.valueMap = values(vals).map(function (v) [v.mode, v.result]).toObject();
|
||||
this.valueMap = values(vals).map(v => [v.mode, v.result]).toObject();
|
||||
return vals;
|
||||
},
|
||||
|
||||
validator: function validator(vals) vals.map(function (v) v.replace(/^!/, "")).every(Set.has(this.values)),
|
||||
validator: function validator(vals) vals.map(v => v.replace(/^!/, "")).every(Set.has(this.values)),
|
||||
|
||||
get values() array.toObject([[m.name.toLowerCase(), m.description] for (m in values(modes._modes)) if (!m.hidden)])
|
||||
};
|
||||
|
||||
+10
-10
@@ -199,7 +199,7 @@ var MOW = Module("mow", {
|
||||
|
||||
for (let node in array.iterValues(menu.children)) {
|
||||
let group = node.getAttributeNS(NS, "group");
|
||||
node.hidden = group && !group.split(/\s+/).every(function (g) enabled[g]);
|
||||
node.hidden = group && !group.split(/\s+/).every(g => enabled[g]);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -346,36 +346,36 @@ var MOW = Module("mow", {
|
||||
|
||||
bind(["j", "<C-e>", "<Down>"], "Scroll down one line",
|
||||
function ({ count }) { mow.scrollVertical("lines", 1 * (count || 1)); },
|
||||
function () mow.canScroll(1), BEEP);
|
||||
() => mow.canScroll(1), BEEP);
|
||||
|
||||
bind(["k", "<C-y>", "<Up>"], "Scroll up one line",
|
||||
function ({ count }) { mow.scrollVertical("lines", -1 * (count || 1)); },
|
||||
function () mow.canScroll(-1), BEEP);
|
||||
() => mow.canScroll(-1), BEEP);
|
||||
|
||||
bind(["<C-j>", "<C-m>", "<Return>"], "Scroll down one line, exit on last line",
|
||||
function ({ count }) { mow.scrollVertical("lines", 1 * (count || 1)); },
|
||||
function () mow.canScroll(1), DROP);
|
||||
() => mow.canScroll(1), DROP);
|
||||
|
||||
// half page down
|
||||
bind(["<C-d>"], "Scroll down half a page",
|
||||
function ({ count }) { mow.scrollVertical("pages", .5 * (count || 1)); },
|
||||
function () mow.canScroll(1), BEEP);
|
||||
() => mow.canScroll(1), BEEP);
|
||||
|
||||
bind(["<C-f>", "<PageDown>"], "Scroll down one page",
|
||||
function ({ count }) { mow.scrollVertical("pages", 1 * (count || 1)); },
|
||||
function () mow.canScroll(1), BEEP);
|
||||
() => mow.canScroll(1), BEEP);
|
||||
|
||||
bind(["<Space>"], "Scroll down one page",
|
||||
function ({ count }) { mow.scrollVertical("pages", 1 * (count || 1)); },
|
||||
function () mow.canScroll(1), DROP);
|
||||
() => mow.canScroll(1), DROP);
|
||||
|
||||
bind(["<C-u>"], "Scroll up half a page",
|
||||
function ({ count }) { mow.scrollVertical("pages", -.5 * (count || 1)); },
|
||||
function () mow.canScroll(-1), BEEP);
|
||||
() => mow.canScroll(-1), BEEP);
|
||||
|
||||
bind(["<C-b>", "<PageUp>"], "Scroll up half a page",
|
||||
function ({ count }) { mow.scrollVertical("pages", -1 * (count || 1)); },
|
||||
function () mow.canScroll(-1), BEEP);
|
||||
() => mow.canScroll(-1), BEEP);
|
||||
|
||||
bind(["gg"], "Scroll to the beginning of output",
|
||||
function () { mow.scrollToPercent(null, 0); });
|
||||
@@ -390,7 +390,7 @@ var MOW = Module("mow", {
|
||||
// close the window
|
||||
bind(["q"], "Close the output window",
|
||||
function () {},
|
||||
function () false, DROP);
|
||||
() => false, DROP);
|
||||
},
|
||||
options: function initOptions() {
|
||||
options.add(["more"],
|
||||
|
||||
@@ -40,7 +40,7 @@ var QuickMarks = Module("quickmarks", {
|
||||
find: function find(url) {
|
||||
let res = [];
|
||||
for (let [k, v] in this._qmarks)
|
||||
if (dactyl.parseURLs(v).some(function (u) String.replace(u, /#.*/, "") == url))
|
||||
if (dactyl.parseURLs(v).some(u => String.replace(u, /#.*/, "") == url))
|
||||
res.push(k);
|
||||
return res;
|
||||
},
|
||||
@@ -109,7 +109,7 @@ var QuickMarks = Module("quickmarks", {
|
||||
|
||||
if (filter.length > 0) {
|
||||
let pattern = util.charListToRegexp(filter, "a-zA-Z0-9");
|
||||
marks = marks.filter(function (qmark) pattern.test(qmark));
|
||||
marks = marks.filter(qmark => pattern.test(qmark));
|
||||
dactyl.assert(marks.length >= 0, _("quickmark.noMatching", filter.quote()));
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ var QuickMarks = Module("quickmarks", {
|
||||
context.title = ["Extra Completions"];
|
||||
context.completions = [
|
||||
[quickmarks.get(args[0]), _("option.currentValue")]
|
||||
].filter(function ([k, v]) k);
|
||||
].filter(([k, v]) => k);
|
||||
});
|
||||
context.fork("url", 0, completion, "url");
|
||||
}
|
||||
@@ -178,7 +178,7 @@ var QuickMarks = Module("quickmarks", {
|
||||
completion: function initCompletion() {
|
||||
completion.quickmark = function (context) {
|
||||
context.title = ["QuickMark", "URL"];
|
||||
context.generate = function () Iterator(quickmarks._qmarks);
|
||||
context.generate = () => Iterator(quickmarks._qmarks);
|
||||
};
|
||||
},
|
||||
mappings: function initMappings() {
|
||||
|
||||
@@ -245,7 +245,7 @@ var StatusLine = Module("statusline", {
|
||||
url = _("buffer.noName");
|
||||
}
|
||||
else {
|
||||
url = url.replace(RegExp("^dactyl://help/(\\S+)#(.*)"), function (m, n1, n2) n1 + " " + decodeURIComponent(n2) + " " + _("buffer.help"))
|
||||
url = url.replace(RegExp("^dactyl://help/(\\S+)#(.*)"), (m, n1, n2) => n1 + " " + decodeURIComponent(n2) + " " + _("buffer.help"))
|
||||
.replace(RegExp("^dactyl://help/(\\S+)"), "$1 " + _("buffer.help"));
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -37,7 +37,7 @@ var Tabs = Module("tabs", {
|
||||
|
||||
this.tabBinding = styles.system.add("tab-binding", "chrome://browser/content/browser.xul", literal(/*
|
||||
xul|tab { -moz-binding: url(chrome://dactyl/content/bindings.xml#tab) !important; }
|
||||
*/).replace(/tab-./g, function (m) config.OS.isMacOSX ? "tab-mac" : m),
|
||||
*/).replace(/tab-./g, m => config.OS.isMacOSX ? "tab-mac" : m),
|
||||
false, true);
|
||||
|
||||
this.timeout(function () {
|
||||
@@ -57,7 +57,7 @@ var Tabs = Module("tabs", {
|
||||
}
|
||||
},
|
||||
|
||||
_alternates: Class.Memoize(function () [config.tabbrowser.mCurrentTab, null]),
|
||||
_alternates: Class.Memoize(() => [config.tabbrowser.mCurrentTab, null]),
|
||||
|
||||
cleanup: function cleanup() {
|
||||
for (let [i, tab] in Iterator(this.allTabs)) {
|
||||
@@ -139,7 +139,7 @@ var Tabs = Module("tabs", {
|
||||
*/
|
||||
get options() this.localStore.options,
|
||||
|
||||
get visibleTabs() config.tabbrowser.visibleTabs || this.allTabs.filter(function (tab) !tab.hidden),
|
||||
get visibleTabs() config.tabbrowser.visibleTabs || this.allTabs.filter(tab => !tab.hidden),
|
||||
|
||||
/**
|
||||
* Returns the local state store for the tab at the specified *tabIndex*.
|
||||
@@ -552,7 +552,7 @@ var Tabs = Module("tabs", {
|
||||
if (matches)
|
||||
return tabs.select(matches, false);
|
||||
|
||||
matches = completion.runCompleter("buffer", buffer).map(function (obj) obj.tab);
|
||||
matches = completion.runCompleter("buffer", buffer).map(obj => obj.tab);
|
||||
|
||||
if (matches.length == 0)
|
||||
dactyl.echoerr(_("buffer.noMatching", buffer));
|
||||
@@ -650,7 +650,7 @@ var Tabs = Module("tabs", {
|
||||
count: true,
|
||||
completer: function (context, args) {
|
||||
if (!args.bang)
|
||||
context.filters.push(function ({ item }) !item.tab.pinned);
|
||||
context.filters.push(({ item }) => !item.tab.pinned);
|
||||
completion.buffer(context);
|
||||
}
|
||||
});
|
||||
@@ -665,7 +665,7 @@ var Tabs = Module("tabs", {
|
||||
argCount: "?",
|
||||
count: true,
|
||||
completer: function (context, args) {
|
||||
context.filters.push(function ({ item }) item.tab.pinned);
|
||||
context.filters.push(({ item }) => item.tab.pinned);
|
||||
completion.buffer(context);
|
||||
}
|
||||
});
|
||||
@@ -730,7 +730,7 @@ var Tabs = Module("tabs", {
|
||||
|
||||
commands.add(["tabl[ast]", "bl[ast]"],
|
||||
"Switch to the last tab",
|
||||
function () tabs.select("$", false),
|
||||
function () { tabs.select("$", false); },
|
||||
{ argCount: "0" });
|
||||
|
||||
// TODO: "Zero count" if 0 specified as arg
|
||||
@@ -893,10 +893,10 @@ var Tabs = Module("tabs", {
|
||||
commands.add(["taba[ttach]"],
|
||||
"Attach the current tab to another window",
|
||||
function (args) {
|
||||
dactyl.assert(args.length <= 2 && !args.some(function (i) !/^\d+(?:$|:)/.test(i)),
|
||||
dactyl.assert(args.length <= 2 && !args.some(i => !/^\d+(?:$|:)/.test(i)),
|
||||
_("error.trailingCharacters"));
|
||||
|
||||
let [winIndex, tabIndex] = args.map(function (arg) parseInt(arg));
|
||||
let [winIndex, tabIndex] = args.map(arg => parseInt(arg));
|
||||
if (args["-group"]) {
|
||||
util.assert(args.length == 1);
|
||||
window.TabView.moveTabTo(tabs.getTab(), winIndex);
|
||||
@@ -940,7 +940,7 @@ var Tabs = Module("tabs", {
|
||||
if (args["-group"])
|
||||
completion.tabGroup(context);
|
||||
else {
|
||||
context.filters.push(function ({ item }) item != window);
|
||||
context.filters.push(({ item }) => item != window);
|
||||
completion.window(context);
|
||||
}
|
||||
break;
|
||||
@@ -1061,7 +1061,7 @@ var Tabs = Module("tabs", {
|
||||
for (let [id, vals] in Iterator(tabGroups))
|
||||
context.fork(id, 0, this, function (context, [name, browsers]) {
|
||||
context.title = [name || "Buffers"];
|
||||
context.generate = function ()
|
||||
context.generate = () =>
|
||||
Array.map(browsers, function ([i, browser]) {
|
||||
let indicator = " ";
|
||||
if (i == tabs.index())
|
||||
@@ -1089,7 +1089,7 @@ var Tabs = Module("tabs", {
|
||||
context.keys = {
|
||||
text: "id",
|
||||
description: function (group) group.getTitle() ||
|
||||
group.getChildren().map(function (t) t.tab.label).join(", ")
|
||||
group.getChildren().map(t => t.tab.label).join(", ")
|
||||
};
|
||||
context.generate = function () {
|
||||
context.incomplete = true;
|
||||
|
||||
+14
-14
@@ -53,7 +53,7 @@ var updateAddons = Class("UpgradeListener", AddonListener, {
|
||||
|
||||
this.remaining = addons;
|
||||
this.upgrade = [];
|
||||
this.dactyl.echomsg(_("addon.check", addons.map(function (a) a.name).join(", ")));
|
||||
this.dactyl.echomsg(_("addon.check", addons.map(a => a.name).join(", ")));
|
||||
for (let addon in values(addons))
|
||||
addon.findUpdates(this, AddonManager.UPDATE_WHEN_USER_REQUESTED, null, null);
|
||||
|
||||
@@ -64,11 +64,11 @@ var updateAddons = Class("UpgradeListener", AddonListener, {
|
||||
install.install();
|
||||
},
|
||||
onUpdateFinished: function (addon, error) {
|
||||
this.remaining = this.remaining.filter(function (a) a.type != addon.type || a.id != addon.id);
|
||||
this.remaining = this.remaining.filter(a => a.type != addon.type || a.id != addon.id);
|
||||
if (!this.remaining.length)
|
||||
this.dactyl.echomsg(
|
||||
this.upgrade.length
|
||||
? _("addon.installingUpdates", this.upgrade.map(function (i) i.name).join(", "))
|
||||
? _("addon.installingUpdates", this.upgrade.map(i => i.name).join(", "))
|
||||
: _("addon.noUpdates"));
|
||||
}
|
||||
});
|
||||
@@ -118,7 +118,7 @@ var actions = {
|
||||
});
|
||||
},
|
||||
get filter() {
|
||||
return function (addon) !addon.userDisabled &&
|
||||
return addon => !addon.userDisabled &&
|
||||
!(addon.operationsRequiringRestart & (AddonManager.OP_NEEDS_RESTART_ENABLE | AddonManager.OP_NEEDS_RESTART_DISABLE));
|
||||
},
|
||||
perm: "disable"
|
||||
@@ -302,7 +302,7 @@ var AddonList = Class("AddonList", {
|
||||
addon = Addon(addon, this);
|
||||
this.addons[addon.id] = addon;
|
||||
|
||||
let index = values(this.addons).sort(function (a, b) a.compare(b))
|
||||
let index = values(this.addons).sort((a, b) => a.compare(b))
|
||||
.indexOf(addon);
|
||||
|
||||
this.nodes.list.insertBefore(addon.nodes.row,
|
||||
@@ -343,10 +343,10 @@ var AddonList = Class("AddonList", {
|
||||
});
|
||||
|
||||
var Addons = Module("addons", {
|
||||
errors: Class.Memoize(function ()
|
||||
errors: Class.Memoize(() =>
|
||||
array(["ERROR_NETWORK_FAILURE", "ERROR_INCORRECT_HASH",
|
||||
"ERROR_CORRUPT_FILE", "ERROR_FILE_ACCESS"])
|
||||
.map(function (e) [AddonManager[e], _("AddonManager." + e)])
|
||||
.map(e => [AddonManager[e], _("AddonManager." + e)])
|
||||
.toObject())
|
||||
}, {
|
||||
}, {
|
||||
@@ -360,7 +360,7 @@ var Addons = Module("addons", {
|
||||
modules.commandline.echo(addons);
|
||||
|
||||
if (modules.commandline.savingOutput)
|
||||
util.waitFor(function () addons.ready);
|
||||
util.waitFor(() => addons.ready);
|
||||
},
|
||||
{
|
||||
argCount: "?",
|
||||
@@ -398,7 +398,7 @@ var Addons = Module("addons", {
|
||||
}, {
|
||||
argCount: "1",
|
||||
completer: function (context) {
|
||||
context.filters.push(function ({ isdir, text }) isdir || /\.xpi$/.test(text));
|
||||
context.filters.push(({ isdir, text }) => isdir || /\.xpi$/.test(text));
|
||||
completion.file(context);
|
||||
},
|
||||
literal: 0
|
||||
@@ -420,7 +420,7 @@ var Addons = Module("addons", {
|
||||
|
||||
AddonManager.getAddonsByTypes(args["-types"], dactyl.wrapCallback(function (list) {
|
||||
if (!args.bang || command.bang) {
|
||||
list = list.filter(function (addon) addon.id == name || addon.name == name);
|
||||
list = list.filter(addon => addon.id == name || addon.name == name);
|
||||
dactyl.assert(list.length, _("error.invalidArgument", name));
|
||||
dactyl.assert(list.some(ok), _("error.invalidOperation"));
|
||||
list = list.filter(ok);
|
||||
@@ -429,14 +429,14 @@ var Addons = Module("addons", {
|
||||
if (command.actions)
|
||||
command.actions(list, this.modules);
|
||||
else
|
||||
list.forEach(function (addon) command.action.call(this.modules, addon, args.bang), this);
|
||||
list.forEach(addon => command.action.call(this.modules, addon, args.bang));
|
||||
}));
|
||||
}, {
|
||||
argCount: "?", // FIXME: should be "1"
|
||||
bang: true,
|
||||
completer: function (context, args) {
|
||||
completion.addon(context, args["-types"]);
|
||||
context.filters.push(function ({ item }) ok(item));
|
||||
context.filters.push(({ item }) => ok(item));
|
||||
},
|
||||
literal: 0,
|
||||
options: [
|
||||
@@ -455,7 +455,7 @@ var Addons = Module("addons", {
|
||||
completion.addonType = function addonType(context) {
|
||||
let base = ["extension", "theme"];
|
||||
function update(types) {
|
||||
context.completions = types.map(function (t) [t, util.capitalize(t)]);
|
||||
context.completions = types.map(t => [t, util.capitalize(t)]);
|
||||
}
|
||||
|
||||
context.generate = function generate() {
|
||||
@@ -464,7 +464,7 @@ var Addons = Module("addons", {
|
||||
context.incomplete = true;
|
||||
AddonManager.getAllAddons(function (addons) {
|
||||
context.incomplete = false;
|
||||
update(array.uniq(base.concat(addons.map(function (a) a.type)),
|
||||
update(array.uniq(base.concat(addons.map(a => a.type)),
|
||||
true));
|
||||
});
|
||||
}
|
||||
|
||||
+16
-16
@@ -20,13 +20,13 @@ let { __lookupGetter__, __lookupSetter__, __defineGetter__, __defineSetter__,
|
||||
if (typeof XPCSafeJSObjectWrapper === "undefined")
|
||||
this.XPCSafeJSObjectWrapper = XPCNativeWrapper;
|
||||
|
||||
let getGlobalForObject = Cu.getGlobalForObject || function (obj) obj.__parent__;
|
||||
let getGlobalForObject = Cu.getGlobalForObject || (obj => obj.__parent__);
|
||||
|
||||
function require(module, target) JSMLoader.load(module, target);
|
||||
|
||||
function lazyRequire(module, names, target) {
|
||||
for each (let name in names)
|
||||
memoize(target || this, name, function (name) require(module)[name]);
|
||||
memoize(target || this, name, name => require(module)[name]);
|
||||
}
|
||||
|
||||
let jsmodules = { lazyRequire: lazyRequire };
|
||||
@@ -167,7 +167,7 @@ function literal(/* comment */) {
|
||||
// Later...
|
||||
return cache.get(key, function () {
|
||||
let source = cache.get("literal:" + file,
|
||||
function () util.httpGet(file).responseText);
|
||||
() => util.httpGet(file).responseText);
|
||||
|
||||
let match = RegExp("(?:.*\\n){" + (caller.lineNumber - 1) + "}" +
|
||||
".*literal\\(/\\*([^]*?)\\*/\\)").exec(source);
|
||||
@@ -271,7 +271,7 @@ function iterOwnProperties(obj) {
|
||||
|
||||
function deprecated(alternative, fn) {
|
||||
if (isObject(fn))
|
||||
return Class.Property(iter(fn).map(function ([k, v]) [k, callable(v) ? deprecated(alternative, v) : v])
|
||||
return Class.Property(iter(fn).map(([k, v]) => [k, callable(v) ? deprecated(alternative, v) : v])
|
||||
.toObject());
|
||||
|
||||
let name, func = callable(fn) ? fn : function () this[fn].apply(this, arguments);
|
||||
@@ -441,7 +441,7 @@ function curry(fn, length, self, acc) {
|
||||
return fn;
|
||||
|
||||
// Close over function with 'this'
|
||||
function close(self, fn) function () fn.apply(self, arguments);
|
||||
function close(self, fn) () => fn.apply(self, arguments);
|
||||
|
||||
if (acc == null)
|
||||
acc = [];
|
||||
@@ -858,7 +858,7 @@ Class.Memoize = function Memoize(getter, wait)
|
||||
Object.defineProperty(obj, key, {
|
||||
configurable: true, enumerable: false,
|
||||
get: function get() {
|
||||
util.waitFor(function () done);
|
||||
util.waitFor(() => done);
|
||||
return this[key];
|
||||
}
|
||||
});
|
||||
@@ -924,18 +924,18 @@ Class.prototype = {
|
||||
set instance(val) Class.replaceProperty(this, "instance", val),
|
||||
|
||||
withSavedValues: function withSavedValues(names, callback, self) {
|
||||
let vals = names.map(function (name) this[name], this);
|
||||
let vals = names.map(name => this[name]);
|
||||
try {
|
||||
return callback.call(self || this);
|
||||
}
|
||||
finally {
|
||||
names.forEach(function (name, i) this[name] = vals[i], this);
|
||||
names.forEach((name, i) => this[name] = vals[i]);
|
||||
}
|
||||
},
|
||||
|
||||
toString: function C_toString() {
|
||||
if (this.toStringParams)
|
||||
var params = "(" + this.toStringParams.map(function (m) isArray(m) ? "[" + m + "]" :
|
||||
var params = "(" + this.toStringParams.map(m => isArray(m) ? "[" + m + "]" :
|
||||
isString(m) ? m.quote() : String(m))
|
||||
.join(", ") + ")";
|
||||
return "[instance " + this.constructor.className + (params || "") + "]";
|
||||
@@ -1079,7 +1079,7 @@ function XPCOMShim(interfaces) {
|
||||
getHelperForLanguage: function () null,
|
||||
getInterfaces: function (count) { count.value = 0; }
|
||||
});
|
||||
return (interfaces || []).reduce(function (shim, iface) shim.QueryInterface(Ci[iface]),
|
||||
return (interfaces || []).reduce((shim, iface) => shim.QueryInterface(Ci[iface]),
|
||||
ip.data);
|
||||
};
|
||||
let stub = Class.Property({
|
||||
@@ -1172,7 +1172,7 @@ Module.INIT = {
|
||||
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((fn, i) => update(objs[i], fn.apply(module, args)));
|
||||
|
||||
memoize(module, "closure", Class.makeClosure);
|
||||
module.instance = module;
|
||||
@@ -1205,7 +1205,7 @@ function Struct(...args) {
|
||||
|
||||
const Struct = Class(className || "Struct", StructBase, {
|
||||
length: args.length,
|
||||
members: array.toObject(args.map(function (v, k) [v, k]))
|
||||
members: array.toObject(args.map((v, k) => [v, k]))
|
||||
});
|
||||
args.forEach(function (name, i) {
|
||||
Struct.prototype.__defineGetter__(name, function () this[i]);
|
||||
@@ -1384,7 +1384,7 @@ function octal(decimal) parseInt(decimal, 8);
|
||||
*/
|
||||
function iter(obj, iface) {
|
||||
if (arguments.length == 2 && iface instanceof Ci.nsIJSIID)
|
||||
return iter(obj).map(function (item) item.QueryInterface(iface));
|
||||
return iter(obj).map(item => item.QueryInterface(iface));
|
||||
|
||||
let args = arguments;
|
||||
let res = Iterator(obj);
|
||||
@@ -1521,7 +1521,7 @@ update(iter, {
|
||||
*/
|
||||
nth: function nth(iter, pred, n, self) {
|
||||
if (typeof pred === "number")
|
||||
[pred, n] = [function () true, pred]; // Hack.
|
||||
[pred, n] = [() => true, pred]; // Hack.
|
||||
|
||||
for (let elem in iter)
|
||||
if (pred.call(self, elem) && n-- === 0)
|
||||
@@ -1629,7 +1629,7 @@ var array = Class("array", Array, {
|
||||
* @param {Array} ary
|
||||
* @returns {Array}
|
||||
*/
|
||||
compact: function compact(ary) ary.filter(function (item) item != null),
|
||||
compact: function compact(ary) ary.filter(item => item != null),
|
||||
|
||||
/**
|
||||
* Returns true if each element of ary1 is equal to the
|
||||
@@ -1640,7 +1640,7 @@ var array = Class("array", Array, {
|
||||
* @returns {boolean}
|
||||
*/
|
||||
equals: function (ary1, ary2)
|
||||
ary1.length === ary2.length && Array.every(ary1, function (e, i) e === ary2[i]),
|
||||
ary1.length === ary2.length && Array.every(ary1, (e, i) => e === ary2[i]),
|
||||
|
||||
/**
|
||||
* Flattens an array, such that all elements of the array are
|
||||
|
||||
@@ -27,7 +27,7 @@ update(Bookmark.prototype, {
|
||||
get extra() [
|
||||
["keyword", this.keyword, "Keyword"],
|
||||
["tags", this.tags.join(", "), "Tag"]
|
||||
].filter(function (item) item[1]),
|
||||
].filter(item => item[1]),
|
||||
|
||||
get uri() newURI(this.url),
|
||||
set uri(uri) {
|
||||
@@ -90,7 +90,7 @@ var BookmarkCache = Module("BookmarkCache", XPCOM(Ci.nsINavBookmarkObserver), {
|
||||
keywords: Class.Memoize(function () array.toObject([[b.keyword, b] for (b in this) if (b.keyword)])),
|
||||
|
||||
rootFolders: ["toolbarFolder", "bookmarksMenuFolder", "unfiledBookmarksFolder"]
|
||||
.map(function (s) services.bookmarks[s]),
|
||||
.map(s => services.bookmarks[s]),
|
||||
|
||||
_deleteBookmark: function deleteBookmark(id) {
|
||||
let result = this.bookmarks[id] || null;
|
||||
|
||||
+23
-23
@@ -61,10 +61,10 @@ var Buffer = Module("Buffer", {
|
||||
*/
|
||||
get alternateStyleSheets() {
|
||||
let stylesheets = array.flatten(
|
||||
this.allFrames().map(function (w) Array.slice(w.document.styleSheets)));
|
||||
this.allFrames().map(w => Array.slice(w.document.styleSheets)));
|
||||
|
||||
return stylesheets.filter(
|
||||
function (stylesheet) /^(screen|all|)$/i.test(stylesheet.media.mediaText) && !/^\s*$/.test(stylesheet.title)
|
||||
s => /^(screen|all|)$/i.test(s.media.mediaText) && !/^\s*$/.test(s.title)
|
||||
);
|
||||
},
|
||||
|
||||
@@ -142,7 +142,7 @@ var Buffer = Module("Buffer", {
|
||||
*/
|
||||
get loaded() Math.min.apply(null,
|
||||
this.allFrames()
|
||||
.map(function (frame) ["loading", "interactive", "complete"]
|
||||
.map(frame => ["loading", "interactive", "complete"]
|
||||
.indexOf(frame.document.readyState))),
|
||||
|
||||
/**
|
||||
@@ -275,8 +275,8 @@ var Buffer = Module("Buffer", {
|
||||
})(win || this.win);
|
||||
|
||||
if (focusedFirst)
|
||||
return frames.filter(function (f) f === this.focusedFrame, this).concat(
|
||||
frames.filter(function (f) f !== this.focusedFrame, this));
|
||||
return frames.filter(f => f === this.focusedFrame).concat(
|
||||
frames.filter(f => f !== this.focusedFrame));
|
||||
return frames;
|
||||
},
|
||||
|
||||
@@ -435,7 +435,7 @@ var Buffer = Module("Buffer", {
|
||||
yield elem;
|
||||
|
||||
function a(regexp, elem) regexp.test(elem.textContent) === regexp.result ||
|
||||
Array.some(elem.childNodes, function (child) regexp.test(child.alt) === regexp.result);
|
||||
Array.some(elem.childNodes, child => regexp.test(child.alt) === regexp.result);
|
||||
function b(regexp, elem) regexp.test(elem.title) === regexp.result;
|
||||
|
||||
let res = Array.filter(frame.document.querySelectorAll(selector), Hints.isVisible);
|
||||
@@ -541,7 +541,7 @@ var Buffer = Module("Buffer", {
|
||||
function getRanges(rect) {
|
||||
let nodes = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils)
|
||||
.nodesFromRect(rect.x, rect.y, 0, rect.width, rect.height, 0, false, false);
|
||||
return Array.filter(nodes, function (n) n instanceof Ci.nsIDOMText)
|
||||
return Array.filter(nodes, n => n instanceof Ci.nsIDOMText)
|
||||
.map(RangeFind.nodeContents);
|
||||
}
|
||||
|
||||
@@ -565,11 +565,11 @@ var Buffer = Module("Buffer", {
|
||||
rect = { x: w / 3, y: 0, width: w / 3, height: win.innerHeight };
|
||||
}
|
||||
|
||||
var reduce = function (a, b) DOM(a).rect.top < DOM(b).rect.top ? a : b;
|
||||
var reduce = (a, b) => DOM(a).rect.top < DOM(b).rect.top ? a : b;
|
||||
var dir = "forward";
|
||||
var y = 0;
|
||||
if (reverse) {
|
||||
reduce = function (a, b) DOM(b).rect.bottom > DOM(a).rect.bottom ? b : a;
|
||||
reduce = (a, b) => DOM(b).rect.bottom > DOM(a).rect.bottom ? b : a;
|
||||
dir = "backward";
|
||||
y = win.innerHeight - 1;
|
||||
}
|
||||
@@ -904,10 +904,10 @@ var Buffer = Module("Buffer", {
|
||||
let path = options["jumptags"][arg];
|
||||
util.assert(path, _("error.invalidArgument", arg));
|
||||
|
||||
let distance = reverse ? function (rect) -rect.top : function (rect) rect.top;
|
||||
let distance = reverse ? rect => -rect.top : 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]);
|
||||
.filter(e => e[1] > FUDGE)
|
||||
.sort((a, b) => a[1] - b[1]);
|
||||
|
||||
if (offScreen && !reverse)
|
||||
elems = elems.filter(function (e) e[1] > this, this.topWindow.innerHeight);
|
||||
@@ -941,8 +941,8 @@ var Buffer = Module("Buffer", {
|
||||
return;
|
||||
|
||||
// remove all hidden frames
|
||||
frames = frames.filter(function (frame) !(frame.document.body instanceof Ci.nsIDOMHTMLFrameSetElement))
|
||||
.filter(function (frame) !frame.frameElement ||
|
||||
frames = frames.filter(frame => !(frame.document.body instanceof Ci.nsIDOMHTMLFrameSetElement))
|
||||
.filter(frame => !frame.frameElement ||
|
||||
let (rect = frame.frameElement.getBoundingClientRect())
|
||||
rect.width && rect.height);
|
||||
|
||||
@@ -1003,7 +1003,7 @@ var Buffer = Module("Buffer", {
|
||||
let info = template.map(
|
||||
(sections || options["pageinfo"])
|
||||
.map((opt) => Buffer.pageInfo[opt].action.call(this)),
|
||||
function (res) res && iter(res).join(", ") || undefined,
|
||||
res => res && iter(res).join(", ") || undefined,
|
||||
", ").join("");
|
||||
|
||||
if (bookmarkcache.isBookmarked(this.URL))
|
||||
@@ -1443,8 +1443,8 @@ var Buffer = Module("Buffer", {
|
||||
names.push([decodeURIComponent(url.replace(/.*?([^\/]*)\/*$/, "$1")),
|
||||
_("buffer.save.filename")]);
|
||||
|
||||
return names.filter(function ([leaf, title]) leaf)
|
||||
.map(function ([leaf, title]) [leaf.replace(config.OS.illegalCharacters, encodeURIComponent)
|
||||
return names.filter(([leaf, title]) => leaf)
|
||||
.map(([leaf, title]) => [leaf.replace(config.OS.illegalCharacters, encodeURIComponent)
|
||||
.replace(re, ext), title]);
|
||||
},
|
||||
|
||||
@@ -1801,7 +1801,7 @@ var Buffer = Module("Buffer", {
|
||||
function (args) {
|
||||
let arg = args[0] || "";
|
||||
|
||||
let titles = buffer.alternateStyleSheets.map(function (stylesheet) stylesheet.title);
|
||||
let titles = buffer.alternateStyleSheets.map(sheet => sheet.title);
|
||||
|
||||
dactyl.assert(!arg || titles.indexOf(arg) >= 0,
|
||||
_("error.invalidArgument", arg));
|
||||
@@ -2206,7 +2206,7 @@ var Buffer = Module("Buffer", {
|
||||
|
||||
let frames = buffer.allFrames(null, true);
|
||||
|
||||
let elements = array.flatten(frames.map(function (win) [m for (m in DOM.XPath(xpath, win.document))]))
|
||||
let elements = array.flatten(frames.map(win => [m for (m in DOM.XPath(xpath, win.document))]))
|
||||
.filter(function (elem) {
|
||||
if (isinstance(elem, [Ci.nsIDOMHTMLFrameElement,
|
||||
Ci.nsIDOMHTMLIFrameElement]))
|
||||
@@ -2388,7 +2388,7 @@ var Buffer = Module("Buffer", {
|
||||
return vals;
|
||||
},
|
||||
validator: function (value) DOM.validateMatcher.call(this, value)
|
||||
&& Object.keys(value).every(function (v) v.length == 1)
|
||||
&& Object.keys(value).every(v => v.length == 1)
|
||||
});
|
||||
|
||||
options.add(["linenumbers", "ln"],
|
||||
@@ -2413,7 +2413,7 @@ var Buffer = Module("Buffer", {
|
||||
var res = dactyl.userEval("(" + Option.dequote(filter.result.substr(5)) + ")")(doc, line);
|
||||
else
|
||||
res = iter.nth(filter.matcher(doc),
|
||||
function (elem) (elem.nodeValue || elem.textContent).trim() == line && DOM(elem).display != "none",
|
||||
elem => (elem.nodeValue || elem.textContent).trim() == line && DOM(elem).display != "none",
|
||||
0)
|
||||
|| iter.nth(filter.matcher(doc), util.identity, line - 1);
|
||||
if (res)
|
||||
@@ -2656,9 +2656,9 @@ Buffer.addPageInfoSection("m", "Meta Tags", function (verbose) {
|
||||
// get meta tag data, sort and put into pageMeta[]
|
||||
let metaNodes = this.focusedFrame.document.getElementsByTagName("meta");
|
||||
|
||||
return Array.map(metaNodes, function (node) [(node.name || node.httpEquiv),
|
||||
return Array.map(metaNodes, node => [(node.name || node.httpEquiv),
|
||||
template.highlightURL(node.content)])
|
||||
.sort(function (a, b) util.compareIgnoreCase(a[0], b[0]));
|
||||
.sort((a, b) => util.compareIgnoreCase(a[0], b[0]));
|
||||
});
|
||||
|
||||
Buffer.addPageInfoSection("s", "Security", function (verbose) {
|
||||
|
||||
@@ -219,7 +219,7 @@ var Cache = Module("Cache", XPCOM(Ci.nsIRequestObserver), {
|
||||
_has: function _has(name) Set.has(this.providers, name) || set.has(this.cache, name),
|
||||
|
||||
has: function has(name) [this.globalProviders, this.cache, this.localProviders]
|
||||
.some(function (obj) Set.has(obj, name)),
|
||||
.some(obj => Set.has(obj, name)),
|
||||
|
||||
register: function register(name, callback, self) {
|
||||
if (this.isLocal)
|
||||
|
||||
+37
-37
@@ -46,9 +46,9 @@ lazyRequire("template", ["template"]);
|
||||
*/
|
||||
|
||||
var CommandOption = Struct("names", "type", "validator", "completer", "multiple", "description", "default");
|
||||
CommandOption.defaultValue("description", function () "");
|
||||
CommandOption.defaultValue("type", function () CommandOption.NOARG);
|
||||
CommandOption.defaultValue("multiple", function () false);
|
||||
CommandOption.defaultValue("description", () => "");
|
||||
CommandOption.defaultValue("type", () => CommandOption.NOARG);
|
||||
CommandOption.defaultValue("multiple", () => false);
|
||||
|
||||
var ArgType = Struct("description", "parse");
|
||||
update(CommandOption, {
|
||||
@@ -64,7 +64,7 @@ update(CommandOption, {
|
||||
* @property {object} The option doesn't accept an argument.
|
||||
* @final
|
||||
*/
|
||||
NOARG: ArgType("no arg", function (arg) !arg || null),
|
||||
NOARG: ArgType("no arg", arg => !arg || null),
|
||||
/**
|
||||
* @property {object} The option accepts a boolean argument.
|
||||
* @final
|
||||
@@ -74,12 +74,12 @@ update(CommandOption, {
|
||||
* @property {object} The option accepts a string argument.
|
||||
* @final
|
||||
*/
|
||||
STRING: ArgType("string", function (val) val),
|
||||
STRING: ArgType("string", val => val),
|
||||
/**
|
||||
* @property {object} The option accepts a stringmap argument.
|
||||
* @final
|
||||
*/
|
||||
STRINGMAP: ArgType("stringmap", function (val, quoted) Option.parse.stringmap(quoted)),
|
||||
STRINGMAP: ArgType("stringmap", (val, quoted) => Option.parse.stringmap(quoted)),
|
||||
/**
|
||||
* @property {object} The option accepts an integer argument.
|
||||
* @final
|
||||
@@ -221,12 +221,12 @@ var Command = Class("Command", {
|
||||
parsedSpecs: Class.Memoize(function () Command.parseSpecs(this.specs)),
|
||||
|
||||
/** @property {[string]} All of this command's short names, e.g., "com" */
|
||||
shortNames: Class.Memoize(function () array.compact(this.parsedSpecs.map(function (n) n[1]))),
|
||||
shortNames: Class.Memoize(function () array.compact(this.parsedSpecs.map(n => n[1]))),
|
||||
|
||||
/**
|
||||
* @property {[string]} All of this command's long names, e.g., "command"
|
||||
*/
|
||||
longNames: Class.Memoize(function () this.parsedSpecs.map(function (n) n[0])),
|
||||
longNames: Class.Memoize(function () this.parsedSpecs.map(n => n[0])),
|
||||
|
||||
/** @property {string} The command's canonical name. */
|
||||
name: Class.Memoize(function () this.longNames[0]),
|
||||
@@ -309,7 +309,7 @@ var Command = Class("Command", {
|
||||
_options: [],
|
||||
|
||||
optionMap: Class.Memoize(function () array(this.options)
|
||||
.map(function (opt) opt.names.map(function (name) [name, opt]))
|
||||
.map(opt => opt.names.map(name => [name, opt]))
|
||||
.flatten().toObject()),
|
||||
|
||||
newArgs: function newArgs(base) {
|
||||
@@ -409,7 +409,7 @@ var Command = Class("Command", {
|
||||
}
|
||||
}, {
|
||||
hasName: function hasName(specs, name)
|
||||
specs.some(function ([long, short])
|
||||
specs.some(([long, short]) =>
|
||||
name.indexOf(short) == 0 && long.indexOf(name) == 0),
|
||||
|
||||
// TODO: do we really need more than longNames as a convenience anyway?
|
||||
@@ -536,7 +536,7 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
|
||||
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((a, b) => a.name > b.name));
|
||||
},
|
||||
|
||||
/** @property {string} The last executed Ex command line. */
|
||||
@@ -570,10 +570,10 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
|
||||
let name = names[0];
|
||||
|
||||
if (this.name != "builtin") {
|
||||
util.assert(!names.some(function (name) name in commands.builtin._map),
|
||||
util.assert(!names.some(name => name in commands.builtin._map),
|
||||
_("command.cantReplace", name));
|
||||
|
||||
util.assert(replace || names.every(function (name) !(name in this._map), this),
|
||||
util.assert(replace || names.every(name => !(name in this._map)),
|
||||
_("command.wontReplace", name));
|
||||
}
|
||||
|
||||
@@ -585,7 +585,7 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
|
||||
|
||||
let closure = () => this._map[name];
|
||||
|
||||
memoize(this._map, name, function () commands.Command(specs, description, action, extra));
|
||||
memoize(this._map, name, () => commands.Command(specs, description, action, extra));
|
||||
if (!extra.hidden)
|
||||
memoize(this._list, this._list.length, closure);
|
||||
for (let alias in values(names.slice(1)))
|
||||
@@ -623,11 +623,11 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
|
||||
*/
|
||||
get: function get(name, full) {
|
||||
let cmd = this._map[name]
|
||||
|| !full && array.nth(this._list, function (cmd) cmd.hasName(name), 0)
|
||||
|| !full && array.nth(this._list, cmd => cmd.hasName(name), 0)
|
||||
|| null;
|
||||
|
||||
if (!cmd && full) {
|
||||
let name = array.nth(this.specs, function (spec) Command.hasName(spec, name), 0);
|
||||
let name = array.nth(this.specs, spec => Command.hasName(spec, name), 0);
|
||||
return name && this.get(name);
|
||||
}
|
||||
|
||||
@@ -648,7 +648,7 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
|
||||
util.assert(this.group.modifiable, _("command.cantDelete"));
|
||||
|
||||
let cmd = this.get(name);
|
||||
this._list = this._list.filter(function (c) c !== cmd);
|
||||
this._list = this._list.filter(c => c !== cmd);
|
||||
for (let name in values(cmd.names))
|
||||
delete this._map[name];
|
||||
}
|
||||
@@ -684,7 +684,7 @@ var Commands = Module("commands", {
|
||||
|
||||
get allHives() contexts.allGroups.commands,
|
||||
|
||||
get userHives() this.allHives.filter(function (h) h !== this.builtin, this),
|
||||
get userHives() this.allHives.filter(h => h !== this.builtin),
|
||||
|
||||
/**
|
||||
* Executes an Ex command script.
|
||||
@@ -764,9 +764,9 @@ var Commands = Module("commands", {
|
||||
return "";
|
||||
}
|
||||
// TODO: allow matching of aliases?
|
||||
function cmds(hive) hive._list.filter(function (cmd) cmd.name.indexOf(filter || "") == 0)
|
||||
function cmds(hive) hive._list.filter(cmd => cmd.name.indexOf(filter || "") == 0)
|
||||
|
||||
let hives = (hives || this.userHives).map(function (h) [h, cmds(h)]).filter(function ([h, c]) c.length);
|
||||
let hives = (hives || this.userHives).map(h => [h, cmds(h)]).filter(([h, c]) => c.length);
|
||||
|
||||
let list = ["table", {},
|
||||
["tr", { highlight: "Title" },
|
||||
@@ -778,9 +778,9 @@ var Commands = Module("commands", {
|
||||
["td", { style: "padding-right: 1ex;" }, _("title.Complete")],
|
||||
["td", { style: "padding-right: 1ex;" }, _("title.Definition")]],
|
||||
["col", { style: "min-width: 6em; padding-right: 1em;" }],
|
||||
hives.map(function ([hive, cmds]) let (i = 0) [
|
||||
hives.map(([hive, cmds]) => let (i = 0) [
|
||||
["tr", { style: "height: .5ex;" }],
|
||||
cmds.map(function (cmd)
|
||||
cmds.map(cmd =>
|
||||
["tr", {},
|
||||
["td", { highlight: "Title" }, !i++ ? hive.name : ""],
|
||||
["td", {}, cmd.bang ? "!" : " "],
|
||||
@@ -815,7 +815,7 @@ var Commands = Module("commands", {
|
||||
|
||||
/** @property {Iterator(Command)} @private */
|
||||
iterator: function iterator() iter.apply(null, this.hives.array)
|
||||
.sort(function (a, b) a.serialGroup - b.serialGroup || a.name > b.name)
|
||||
.sort((a, b) => a.serialGroup - b.serialGroup || a.name > b.name)
|
||||
.iterValues(),
|
||||
|
||||
/** @property {string} The last executed Ex command line. */
|
||||
@@ -846,7 +846,7 @@ var Commands = Module("commands", {
|
||||
|
||||
let defaults = {};
|
||||
if (args.ignoreDefaults)
|
||||
defaults = array(this.options).map(function (opt) [opt.names[0], opt.default])
|
||||
defaults = array(this.options).map(opt => [opt.names[0], opt.default])
|
||||
.toObject();
|
||||
|
||||
for (let [opt, val] in Iterator(args.options || {})) {
|
||||
@@ -881,7 +881,7 @@ var Commands = Module("commands", {
|
||||
* any of the command's names.
|
||||
* @returns {Command}
|
||||
*/
|
||||
get: function get(name, full) iter(this.hives).map(function ([i, hive]) hive.get(name, full))
|
||||
get: function get(name, full) iter(this.hives).map(([i, hive]) => hive.get(name, full))
|
||||
.nth(util.identity, 0),
|
||||
|
||||
/**
|
||||
@@ -895,7 +895,7 @@ var Commands = Module("commands", {
|
||||
hasDomain: function hasDomain(command, host) {
|
||||
try {
|
||||
for (let [cmd, args] in this.subCommands(command))
|
||||
if (Array.concat(cmd.domains(args)).some(function (domain) util.isSubdomain(domain, host)))
|
||||
if (Array.concat(cmd.domains(args)).some(domain => util.isSubdomain(domain, host)))
|
||||
return true;
|
||||
}
|
||||
catch (e) {
|
||||
@@ -1016,7 +1016,7 @@ var Commands = Module("commands", {
|
||||
let matchOpts = function matchOpts(arg) {
|
||||
// Push possible option matches into completions
|
||||
if (complete && !onlyArgumentsRemaining)
|
||||
completeOpts = options.filter(function (opt) opt.multiple || !Set.has(args, opt.names[0]));
|
||||
completeOpts = options.filter(opt => opt.multiple || !Set.has(args, opt.names[0]));
|
||||
};
|
||||
let resetCompletions = function resetCompletions() {
|
||||
completeOpts = null;
|
||||
@@ -1208,7 +1208,7 @@ var Commands = Module("commands", {
|
||||
context.filter = args.completeFilter;
|
||||
|
||||
if (isArray(arg))
|
||||
context.filters.push(function (item) arg.indexOf(item.text) === -1);
|
||||
context.filters.push(item => arg.indexOf(item.text) === -1);
|
||||
|
||||
if (typeof opt.completer == "function")
|
||||
var compl = opt.completer(context, args);
|
||||
@@ -1394,7 +1394,7 @@ var Commands = Module("commands", {
|
||||
let quote = null;
|
||||
let len = str.length;
|
||||
|
||||
function fixEscapes(str) str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4}|(.))/g, function (m, n1) n1 || m);
|
||||
function fixEscapes(str) str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4}|(.))/g, (m, n1) => n1 || m);
|
||||
|
||||
// Fix me.
|
||||
if (isString(sep))
|
||||
@@ -1436,9 +1436,9 @@ var Commands = Module("commands", {
|
||||
context.title = ["Command"];
|
||||
context.keys = { text: "longNames", description: "description" };
|
||||
if (group)
|
||||
context.generate = function () group._list;
|
||||
context.generate = () => group._list;
|
||||
else
|
||||
context.generate = function () modules.commands.hives.map(function (h) h._list).flatten();
|
||||
context.generate = () => modules.commands.hives.map(h => h._list).flatten();
|
||||
};
|
||||
|
||||
// provides completions for ex commands, including their arguments
|
||||
@@ -1577,7 +1577,7 @@ var Commands = Module("commands", {
|
||||
};
|
||||
}
|
||||
else
|
||||
completerFunc = function (context) modules.completion.closure[config.completers[completer]](context);
|
||||
completerFunc = context => modules.completion.closure[config.completers[completer]](context);
|
||||
}
|
||||
|
||||
let added = args["-group"].add(cmd.split(","),
|
||||
@@ -1662,8 +1662,8 @@ var Commands = Module("commands", {
|
||||
literal: 1,
|
||||
|
||||
serialize: function () array(commands.userHives)
|
||||
.filter(function (h) h.persist)
|
||||
.map(function (hive) [
|
||||
.filter(h => h.persist)
|
||||
.map(hive => [
|
||||
{
|
||||
command: this.name,
|
||||
bang: true,
|
||||
@@ -1681,7 +1681,7 @@ var Commands = Module("commands", {
|
||||
ignoreDefaults: true
|
||||
}
|
||||
for (cmd in hive) if (cmd.persist)
|
||||
], this)
|
||||
])
|
||||
.flatten().array
|
||||
});
|
||||
|
||||
@@ -1725,7 +1725,7 @@ var Commands = Module("commands", {
|
||||
]
|
||||
})),
|
||||
iterateIndex: function (args) let (tags = help.tags)
|
||||
this.iterate(args).filter(function (cmd) cmd.hive === commands.builtin || Set.has(tags, cmd.helpTag)),
|
||||
this.iterate(args).filter(cmd => cmd.hive === commands.builtin || Set.has(tags, cmd.helpTag)),
|
||||
format: {
|
||||
headings: ["Command", "Group", "Description"],
|
||||
description: function (cmd) template.linkifyHelp(cmd.description + (cmd.replacementText ? ": " + cmd.action : "")),
|
||||
@@ -1779,7 +1779,7 @@ var Commands = Module("commands", {
|
||||
let quote = function quote(q, list, map) {
|
||||
map = map || Commands.quoteMap;
|
||||
let re = RegExp("[" + list + "]", "g");
|
||||
function quote(str) q + String.replace(str, re, function ($0) $0 in map ? map[$0] : ("\\" + $0)) + q;
|
||||
function quote(str) q + String.replace(str, re, $0 => $0 in map ? map[$0] : ("\\" + $0)) + q;
|
||||
quote.list = list;
|
||||
return quote;
|
||||
};
|
||||
|
||||
@@ -60,10 +60,10 @@ var CompletionContext = Class("CompletionContext", {
|
||||
*/
|
||||
self.parent = parent;
|
||||
|
||||
["filters", "keys", "process", "title", "quote"].forEach(function fe(key)
|
||||
self[key] = parent[key] && util.cloneObject(parent[key]));
|
||||
["anchored", "compare", "editor", "_filter", "filterFunc", "forceAnchored", "top"].forEach(function (key)
|
||||
self[key] = parent[key]);
|
||||
["filters", "keys", "process", "title", "quote"]
|
||||
.forEach(key => self[key] = parent[key] && util.cloneObject(parent[key]));
|
||||
["anchored", "compare", "editor", "_filter", "filterFunc", "forceAnchored", "top"]
|
||||
.forEach(key => self[key] = parent[key]);
|
||||
|
||||
self.__defineGetter__("value", function get_value() this.top.value);
|
||||
|
||||
@@ -171,9 +171,9 @@ var CompletionContext = Class("CompletionContext", {
|
||||
*/
|
||||
this.top = this;
|
||||
this.__defineGetter__("incomplete", function get_incomplete() this._incomplete
|
||||
|| this.contextList.some(function (c) c.parent && c.incomplete));
|
||||
|| this.contextList.some(c => c.parent && c.incomplete));
|
||||
this.__defineGetter__("waitingForTab", function get_waitingForTab() this._waitingForTab
|
||||
|| this.contextList.some(function (c) c.parent && c.waitingForTab));
|
||||
|| this.contextList.some(c => c.parent && c.waitingForTab));
|
||||
this.__defineSetter__("incomplete", function get_incomplete(val) { this._incomplete = val; });
|
||||
this.__defineSetter__("waitingForTab", function get_waitingForTab(val) { this._waitingForTab = val; });
|
||||
this.reset();
|
||||
@@ -214,7 +214,7 @@ var CompletionContext = Class("CompletionContext", {
|
||||
return this;
|
||||
},
|
||||
|
||||
__title: Class.Memoize(function __title() this._title.map(function (s)
|
||||
__title: Class.Memoize(function __title() this._title.map(s =>
|
||||
typeof s == "string" ? messages.get("completion.title." + s, s)
|
||||
: s)),
|
||||
|
||||
|
||||
+15
-15
@@ -57,10 +57,10 @@ var ConfigBase = Class("ConfigBase", {
|
||||
"resource://dactyl-content/")));
|
||||
|
||||
this.timeout(function () {
|
||||
cache.register("config.dtd", function () util.makeDTD(config.dtd));
|
||||
cache.register("config.dtd", () => util.makeDTD(config.dtd));
|
||||
});
|
||||
|
||||
services["dactyl:"].pages["dtd"] = function () [null, cache.get("config.dtd")];
|
||||
services["dactyl:"].pages["dtd"] = () => [null, cache.get("config.dtd")];
|
||||
|
||||
update(services["dactyl:"].providers, {
|
||||
"locale": function (uri, path) LocaleChannel("dactyl-locale", config.locale, path, uri),
|
||||
@@ -77,7 +77,7 @@ var ConfigBase = Class("ConfigBase", {
|
||||
"resource://dactyl-local/config.json"
|
||||
],
|
||||
|
||||
configs: Class.Memoize(function () this.configFiles.map(function (url) JSON.parse(File.readURL(url)))),
|
||||
configs: Class.Memoize(function () this.configFiles.map(url => JSON.parse(File.readURL(url)))),
|
||||
|
||||
loadConfig: function loadConfig(documentURL) {
|
||||
|
||||
@@ -152,8 +152,8 @@ var ConfigBase = Class("ConfigBase", {
|
||||
loadStyles: function loadStyles(force) {
|
||||
highlight.styleableChrome = this.styleableChrome;
|
||||
|
||||
highlight.loadCSS(this.CSS.replace(/__MSG_(.*?)__/g, function (m0, m1) _(m1)));
|
||||
highlight.loadCSS(this.helpCSS.replace(/__MSG_(.*?)__/g, function (m0, m1) _(m1)));
|
||||
highlight.loadCSS(this.CSS.replace(/__MSG_(.*?)__/g, (m0, m1) => _(m1)));
|
||||
highlight.loadCSS(this.helpCSS.replace(/__MSG_(.*?)__/g, (m0, m1) => _(m1)));
|
||||
|
||||
if (!this.haveGecko("2b"))
|
||||
highlight.loadCSS(literal(/*
|
||||
@@ -169,14 +169,14 @@ var ConfigBase = Class("ConfigBase", {
|
||||
let hl = highlight.set("Find", "");
|
||||
hl.onChange = function () {
|
||||
function hex(val) ("#" + util.regexp.iterate(/\d+/g, val)
|
||||
.map(function (num) ("0" + Number(num).toString(16)).slice(-2))
|
||||
.map(num => ("0" + Number(num).toString(16)).slice(-2))
|
||||
.join("")
|
||||
).slice(0, 7);
|
||||
|
||||
let elem = services.appShell.hiddenDOMWindow.document.createElement("div");
|
||||
elem.style.cssText = this.cssText;
|
||||
|
||||
let keys = iter(Styles.propertyIter(this.cssText)).map(function (p) p.name).toArray();
|
||||
let keys = iter(Styles.propertyIter(this.cssText)).map(p => p.name).toArray();
|
||||
let bg = keys.some(bind("test", /^background/));
|
||||
let fg = keys.indexOf("color") >= 0;
|
||||
|
||||
@@ -198,7 +198,7 @@ var ConfigBase = Class("ConfigBase", {
|
||||
/**
|
||||
* The current application locale.
|
||||
*/
|
||||
appLocale: Class.Memoize(function () services.chromeRegistry.getSelectedLocale("global")),
|
||||
appLocale: Class.Memoize(() => services.chromeRegistry.getSelectedLocale("global")),
|
||||
|
||||
/**
|
||||
* The current dactyl locale.
|
||||
@@ -411,8 +411,8 @@ var ConfigBase = Class("ConfigBase", {
|
||||
get plugins() "http://5digits.org/" + this.name + "/plugins",
|
||||
get faq() this.home + this.name + "/faq",
|
||||
|
||||
"list.mailto": Class.Memoize(function () config.name + "@googlegroups.com"),
|
||||
"list.href": Class.Memoize(function () "http://groups.google.com/group/" + config.name),
|
||||
"list.mailto": Class.Memoize(() => config.name + "@googlegroups.com"),
|
||||
"list.href": Class.Memoize(() => "http://groups.google.com/group/" + config.name),
|
||||
|
||||
"hg.latest": Class.Memoize(function () this.code + "source/browse/"), // XXX
|
||||
"irc": "irc://irc.oftc.net/#pentadactyl"
|
||||
@@ -478,8 +478,8 @@ var ConfigBase = Class("ConfigBase", {
|
||||
get commandContainer() document.documentElement.id
|
||||
}),
|
||||
|
||||
browser: Class.Memoize(function () window.gBrowser),
|
||||
tabbrowser: Class.Memoize(function () window.gBrowser),
|
||||
browser: Class.Memoize(() => window.gBrowser),
|
||||
tabbrowser: Class.Memoize(() => window.gBrowser),
|
||||
|
||||
get browserModes() [modules.modes.NORMAL],
|
||||
|
||||
@@ -573,9 +573,9 @@ var ConfigBase = Class("ConfigBase", {
|
||||
* @property {string} The default highlighting rules.
|
||||
* See {@link Highlights#loadCSS} for details.
|
||||
*/
|
||||
CSS: Class.Memoize(function () File.readURL("resource://dactyl-skin/global-styles.css")),
|
||||
CSS: Class.Memoize(() => File.readURL("resource://dactyl-skin/global-styles.css")),
|
||||
|
||||
helpCSS: Class.Memoize(function () File.readURL("resource://dactyl-skin/help-styles.css"))
|
||||
helpCSS: Class.Memoize(() => File.readURL("resource://dactyl-skin/help-styles.css"))
|
||||
}, {
|
||||
});
|
||||
JSMLoader.loadSubScript("resource://dactyl-local-content/config.js", this);
|
||||
@@ -594,7 +594,7 @@ config.INIT = update(Object.create(config.INIT), config.INIT, {
|
||||
width: {width}px;
|
||||
height: {height}px;
|
||||
}
|
||||
*/).replace(/\{(.*?)\}/g, function (m, m1) img[m1]));
|
||||
*/).replace(/\{(.*?)\}/g, (m, m1) => img[m1]));
|
||||
img = null;
|
||||
});
|
||||
},
|
||||
|
||||
+13
-13
@@ -70,7 +70,7 @@ var Group = Class("Group", {
|
||||
default_ = false;
|
||||
|
||||
function siteFilter(uri)
|
||||
let (match = array.nth(siteFilter.filters, function (f) f(uri), 0))
|
||||
let (match = array.nth(siteFilter.filters, f => f(uri), 0))
|
||||
match ? match.result : default_;
|
||||
|
||||
return update(siteFilter, {
|
||||
@@ -140,8 +140,8 @@ var Contexts = Module("contexts", {
|
||||
completer: function (context) modules.completion.group(context)
|
||||
});
|
||||
|
||||
memoize(modules, "userContext", function () contexts.Context(modules.io.getRCFile("~", true), contexts.user, [modules, true]));
|
||||
memoize(modules, "_userContext", function () contexts.Context(modules.io.getRCFile("~", true), contexts.user, [modules.userContext]));
|
||||
memoize(modules, "userContext", () => contexts.Context(modules.io.getRCFile("~", true), contexts.user, [modules, true]));
|
||||
memoize(modules, "_userContext", () => contexts.Context(modules.io.getRCFile("~", true), contexts.user, [modules.userContext]));
|
||||
},
|
||||
|
||||
cleanup: function () {
|
||||
@@ -187,7 +187,7 @@ var Contexts = Module("contexts", {
|
||||
});
|
||||
|
||||
memoize(contexts.hives, name,
|
||||
function () Object.create(Object.create(contexts.hiveProto,
|
||||
() => Object.create(Object.create(contexts.hiveProto,
|
||||
{ _hive: { value: name } })));
|
||||
|
||||
memoize(contexts.groupsProto, name,
|
||||
@@ -202,10 +202,10 @@ var Contexts = Module("contexts", {
|
||||
const { contexts, io, newContext, plugins, userContext } = this.modules;
|
||||
|
||||
let isPlugin = array.nth(io.getRuntimeDirectories("plugins"),
|
||||
function (dir) dir.contains(file, true),
|
||||
dir => dir.contains(file, true),
|
||||
0);
|
||||
let isRuntime = array.nth(io.getRuntimeDirectories(""),
|
||||
function (dir) dir.contains(file, true),
|
||||
dir => dir.contains(file, true),
|
||||
0);
|
||||
|
||||
let name = isPlugin ? file.getRelativeDescriptor(isPlugin).replace(File.PATH_SEP, "-")
|
||||
@@ -305,7 +305,7 @@ var Contexts = Module("contexts", {
|
||||
var file = File(uri.file);
|
||||
|
||||
let isPlugin = array.nth(io.getRuntimeDirectories("plugins"),
|
||||
function (dir) dir.contains(file, true),
|
||||
dir => dir.contains(file, true),
|
||||
0);
|
||||
|
||||
let name = isPlugin && file && file.getRelativeDescriptor(isPlugin)
|
||||
@@ -413,7 +413,7 @@ var Contexts = Module("contexts", {
|
||||
|
||||
initializedGroups: function (hive)
|
||||
let (need = hive ? [hive] : Object.keys(this.hives))
|
||||
this.groupList.filter(function (group) need.some(Set.has(group))),
|
||||
this.groupList.filter(group => need.some(Set.has(group))),
|
||||
|
||||
addGroup: function addGroup(name, description, filter, persist, replace) {
|
||||
let group = this.getGroup(name);
|
||||
@@ -515,7 +515,7 @@ var Contexts = Module("contexts", {
|
||||
for ([i, name] in Iterator(params)));
|
||||
|
||||
let rhs = args.literalArg;
|
||||
let type = ["-builtin", "-ex", "-javascript", "-keys"].reduce(function (a, b) args[b] ? b : a, default_);
|
||||
let type = ["-builtin", "-ex", "-javascript", "-keys"].reduce((a, b) => args[b] ? b : a, default_);
|
||||
|
||||
switch (type) {
|
||||
case "-builtin":
|
||||
@@ -544,7 +544,7 @@ var Contexts = Module("contexts", {
|
||||
action = dactyl.userEval("(function action() { with (action.makeParams(this, arguments)) {" + args.literalArg + "} })");
|
||||
else
|
||||
action = dactyl.userFunc.apply(dactyl, params.concat(args.literalArg));
|
||||
process = function (param) isObject(param) && param.valueOf ? param.valueOf() : param;
|
||||
process = param => isObject(param) && param.valueOf ? param.valueOf() : param;
|
||||
action.params = params;
|
||||
action.makeParams = makeParams;
|
||||
break;
|
||||
@@ -707,7 +707,7 @@ var Contexts = Module("contexts", {
|
||||
util.assert(args.bang ^ !!args[0], _("error.argumentOrBang"));
|
||||
|
||||
if (args.bang)
|
||||
contexts.groupList = contexts.groupList.filter(function (g) g.builtin);
|
||||
contexts.groupList = contexts.groupList.filter(g => g.builtin);
|
||||
else {
|
||||
util.assert(contexts.getGroup(args[0]), _("group.noSuch", args[0]));
|
||||
contexts.removeGroup(args[0]);
|
||||
@@ -719,7 +719,7 @@ var Contexts = Module("contexts", {
|
||||
completer: function (context, args) {
|
||||
if (args.bang)
|
||||
return;
|
||||
context.filters.push(function ({ item }) !item.builtin);
|
||||
context.filters.push(({ item }) => !item.builtin);
|
||||
modules.completion.group(context);
|
||||
}
|
||||
});
|
||||
@@ -805,7 +805,7 @@ var Contexts = Module("contexts", {
|
||||
iter({ Active: true, Inactive: false }).forEach(function ([name, active]) {
|
||||
context.split(name, null, function (context) {
|
||||
context.title[0] = name + " Groups";
|
||||
context.filters.push(function ({ item }) !!item.filter(modules.buffer.uri) == active);
|
||||
context.filters.push(({ item }) => !!item.filter(modules.buffer.uri) == active);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
+44
-44
@@ -108,7 +108,7 @@ var DOM = Class("DOM", {
|
||||
}]
|
||||
]),
|
||||
|
||||
matcher: function matcher(sel) function (elem) elem.mozMatchesSelector && elem.mozMatchesSelector(sel),
|
||||
matcher: function matcher(sel) elem => elem.mozMatchesSelector && elem.mozMatchesSelector(sel),
|
||||
|
||||
each: function each(fn, self) {
|
||||
let obj = self || this.Empty();
|
||||
@@ -158,11 +158,11 @@ var DOM = Class("DOM", {
|
||||
},
|
||||
|
||||
find: function find(val) {
|
||||
return this.map(function (elem) elem.querySelectorAll(val));
|
||||
return this.map(elem => elem.querySelectorAll(val));
|
||||
},
|
||||
|
||||
findAnon: function findAnon(attr, val) {
|
||||
return this.map(function (elem) elem.ownerDocument.getAnonymousElementByAttribute(elem, attr, val));
|
||||
return this.map(elem => elem.ownerDocument.getAnonymousElementByAttribute(elem, attr, val));
|
||||
},
|
||||
|
||||
filter: function filter(val, self) {
|
||||
@@ -234,7 +234,7 @@ var DOM = Class("DOM", {
|
||||
return false;
|
||||
},
|
||||
|
||||
get parent() this.map(function (elem) elem.parentNode, this),
|
||||
get parent() this.map(elem => elem.parentNode, this),
|
||||
|
||||
get offsetParent() this.map(function (elem) {
|
||||
do {
|
||||
@@ -245,23 +245,23 @@ var DOM = Class("DOM", {
|
||||
while (parent);
|
||||
}, this),
|
||||
|
||||
get ancestors() this.all(function (elem) elem.parentNode),
|
||||
get ancestors() this.all(elem => elem.parentNode),
|
||||
|
||||
get children() this.map(function (elem) Array.filter(elem.childNodes,
|
||||
function (e) e instanceof Ci.nsIDOMElement),
|
||||
get children() this.map(elem => Array.filter(elem.childNodes,
|
||||
e => e instanceof Ci.nsIDOMElement),
|
||||
this),
|
||||
|
||||
get contents() this.map(function (elem) elem.childNodes, this),
|
||||
get contents() this.map(elem => elem.childNodes, this),
|
||||
|
||||
get siblings() this.map(function (elem) Array.filter(elem.parentNode.childNodes,
|
||||
function (e) e != elem && e instanceof Ci.nsIDOMElement),
|
||||
get siblings() this.map(elem => Array.filter(elem.parentNode.childNodes,
|
||||
e => e != elem && e instanceof Ci.nsIDOMElement),
|
||||
this),
|
||||
|
||||
get siblingsBefore() this.all(function (elem) elem.previousElementSibling),
|
||||
get siblingsAfter() this.all(function (elem) elem.nextElementSibling),
|
||||
get siblingsBefore() this.all(elem => elem.previousElementSibling),
|
||||
get siblingsAfter() this.all(elem => elem.nextElementSibling),
|
||||
|
||||
get allSiblingsBefore() this.all(function (elem) elem.previousSibling),
|
||||
get allSiblingsAfter() this.all(function (elem) elem.nextSibling),
|
||||
get allSiblingsBefore() this.all(elem => elem.previousSibling),
|
||||
get allSiblingsAfter() this.all(elem => elem.nextSibling),
|
||||
|
||||
get class() let (self = this) ({
|
||||
toString: function () self[0].className,
|
||||
@@ -305,7 +305,7 @@ var DOM = Class("DOM", {
|
||||
}),
|
||||
|
||||
remove: function remove(hl) self.each(function () {
|
||||
this.highlight.list = this.highlight.list.filter(function (h) h != hl);
|
||||
this.highlight.list = this.highlight.list.filter(h => h != hl);
|
||||
}),
|
||||
|
||||
toggle: function toggle(hl, val, thisObj) self.each(function (elem, i) {
|
||||
@@ -584,7 +584,7 @@ var DOM = Class("DOM", {
|
||||
["span", { highlight: "HelpXMLTagStart" },
|
||||
"<", namespaced(elem), " ",
|
||||
template.map(array.iterValues(elem.attributes),
|
||||
function (attr) [
|
||||
attr => [
|
||||
["span", { highlight: "HelpXMLAttribute" }, namespaced(attr)],
|
||||
["span", { highlight: "HelpXMLString" }, attr.value]
|
||||
],
|
||||
@@ -660,9 +660,9 @@ var DOM = Class("DOM", {
|
||||
|
||||
return this[0].style[css.property(key)];
|
||||
}, {
|
||||
name: function (property) property.replace(/[A-Z]/g, function (m0) "-" + m0.toLowerCase()),
|
||||
name: function (property) property.replace(/[A-Z]/g, m0 => "-" + m0.toLowerCase()),
|
||||
|
||||
property: function (name) name.replace(/-(.)/g, function (m0, m1) m1.toUpperCase())
|
||||
property: function (name) name.replace(/-(.)/g, (m0, m1) => m1.toUpperCase())
|
||||
}),
|
||||
|
||||
append: function append(val) {
|
||||
@@ -738,7 +738,7 @@ var DOM = Class("DOM", {
|
||||
},
|
||||
|
||||
clone: function clone(deep)
|
||||
this.map(function (elem) elem.cloneNode(deep)),
|
||||
this.map(elem => elem.cloneNode(deep)),
|
||||
|
||||
toggle: function toggle(val, self) {
|
||||
if (callable(val))
|
||||
@@ -749,7 +749,7 @@ var DOM = Class("DOM", {
|
||||
if (arguments.length)
|
||||
return this[val ? "show" : "hide"]();
|
||||
|
||||
let hidden = this.map(function (elem) elem.style.display == "none");
|
||||
let hidden = this.map(elem => elem.style.display == "none");
|
||||
return this.each(function (elem, i) {
|
||||
this[hidden[i] ? "show" : "hide"]();
|
||||
});
|
||||
@@ -784,7 +784,7 @@ var DOM = Class("DOM", {
|
||||
|
||||
let [fn, self] = args;
|
||||
if (!callable(fn))
|
||||
fn = function () args[0];
|
||||
fn = () => args[0];
|
||||
|
||||
return this.each(function (elem, i) {
|
||||
set.call(this, elem, fn.call(self || this, elem, i));
|
||||
@@ -793,19 +793,19 @@ var DOM = Class("DOM", {
|
||||
|
||||
html: function html(txt, self) {
|
||||
return this.getSet(arguments,
|
||||
function (elem) elem.innerHTML,
|
||||
elem => elem.innerHTML,
|
||||
util.wrapCallback(function (elem, val) { elem.innerHTML = val; }));
|
||||
},
|
||||
|
||||
text: function text(txt, self) {
|
||||
return this.getSet(arguments,
|
||||
function (elem) elem.textContent,
|
||||
elem => elem.textContent,
|
||||
function (elem, val) { elem.textContent = val; });
|
||||
},
|
||||
|
||||
val: function val(txt) {
|
||||
return this.getSet(arguments,
|
||||
function (elem) elem.value,
|
||||
elem => elem.value,
|
||||
function (elem, val) { elem.value = val == null ? "" : val; });
|
||||
},
|
||||
|
||||
@@ -985,7 +985,7 @@ var DOM = Class("DOM", {
|
||||
update(params, this.constructor.defaults[type],
|
||||
iter.toObject([k, opts[k]] for (k in opts) if (k in params)));
|
||||
|
||||
evt["init" + t + "Event"].apply(evt, args.map(function (k) params[k]));
|
||||
evt["init" + t + "Event"].apply(evt, args.map(k => params[k]));
|
||||
return evt;
|
||||
}
|
||||
}, {
|
||||
@@ -1040,7 +1040,7 @@ var DOM = Class("DOM", {
|
||||
this.code_nativeKey[v] = k.substr(4);
|
||||
|
||||
k = k.substr(7).toLowerCase();
|
||||
let names = [k.replace(/(^|_)(.)/g, function (m, n1, n2) n2.toUpperCase())
|
||||
let names = [k.replace(/(^|_)(.)/g, (m, n1, n2) => n2.toUpperCase())
|
||||
.replace(/^NUMPAD/, "k")];
|
||||
|
||||
if (names[0].length == 1)
|
||||
@@ -1127,7 +1127,7 @@ var DOM = Class("DOM", {
|
||||
*/
|
||||
parse: function parse(input, unknownOk) {
|
||||
if (isArray(input))
|
||||
return array.flatten(input.map(function (k) this.parse(k, unknownOk), this));
|
||||
return array.flatten(input.map(k => this.parse(k, unknownOk)));
|
||||
|
||||
if (arguments.length === 1)
|
||||
unknownOk = true;
|
||||
@@ -1214,7 +1214,7 @@ var DOM = Class("DOM", {
|
||||
*/
|
||||
stringify: function stringify(event) {
|
||||
if (isArray(event))
|
||||
return event.map(function (e) this.stringify(e), this).join("");
|
||||
return event.map(e => this.stringify(e)).join("");
|
||||
|
||||
if (event.dactylString)
|
||||
return event.dactylString;
|
||||
@@ -1338,7 +1338,7 @@ var DOM = Class("DOM", {
|
||||
submit: { cancelable: true }
|
||||
},
|
||||
|
||||
types: Class.Memoize(function () iter(
|
||||
types: Class.Memoize(() => iter(
|
||||
{
|
||||
Mouse: "click mousedown mouseout mouseover mouseup dblclick " +
|
||||
"hover " +
|
||||
@@ -1349,7 +1349,7 @@ var DOM = Class("DOM", {
|
||||
"load unload pageshow pagehide DOMContentLoaded " +
|
||||
"resize scroll"
|
||||
}
|
||||
).map(function ([k, v]) v.split(" ").map(function (v) [v, k]))
|
||||
).map(([k, v]) => v.split(" ").map(v => [v, k]))
|
||||
.flatten()
|
||||
.toObject()),
|
||||
|
||||
@@ -1393,12 +1393,12 @@ var DOM = Class("DOM", {
|
||||
})
|
||||
}),
|
||||
|
||||
createContents: Class.Memoize(function () services.has("dactyl") && services.dactyl.createContents
|
||||
|| function (elem) {}),
|
||||
createContents: Class.Memoize(() => services.has("dactyl") && services.dactyl.createContents
|
||||
|| (elem => {})),
|
||||
|
||||
isScrollable: Class.Memoize(function () services.has("dactyl") && services.dactyl.getScrollable
|
||||
? function (elem, dir) services.dactyl.getScrollable(elem) & (dir ? services.dactyl["DIRECTION_" + dir.toUpperCase()] : ~0)
|
||||
: function (elem, dir) true),
|
||||
isScrollable: Class.Memoize(() => services.has("dactyl") && services.dactyl.getScrollable
|
||||
? (elem, dir) => services.dactyl.getScrollable(elem) & (dir ? services.dactyl["DIRECTION_" + dir.toUpperCase()] : ~0)
|
||||
: (elem, dir) => true),
|
||||
|
||||
isJSONXML: function isJSONXML(val) isArray(val) && isinstance(val[0], ["String", "Array", "XML", DOM.DOMString])
|
||||
|| isObject(val) && "toDOM" in val,
|
||||
@@ -1524,7 +1524,7 @@ var DOM = Class("DOM", {
|
||||
escapeHTML: function escapeHTML(str, simple) {
|
||||
let map = { "'": "'", '"': """, "%": "%", "&": "&", "<": "<", ">": ">" };
|
||||
let regexp = simple ? /[<>]/g : /['"&<>]/g;
|
||||
return str.replace(regexp, function (m) map[m]);
|
||||
return str.replace(regexp, m => map[m]);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -1664,13 +1664,13 @@ var DOM = Class("DOM", {
|
||||
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(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(a => isinstance(a, ["String", DOM.DOMString]) || isFragment(a) && isStrings(a));
|
||||
}
|
||||
|
||||
function tag(args, namespaces, indent) {
|
||||
@@ -1782,7 +1782,7 @@ var DOM = Class("DOM", {
|
||||
res.push(">");
|
||||
|
||||
if (isStrings(args))
|
||||
res.push(args.map(function (e) tag(e, namespaces, "")).join(""),
|
||||
res.push(args.map(e => tag(e, namespaces, "")).join(""),
|
||||
"</", name, ">");
|
||||
else {
|
||||
let contents = [];
|
||||
@@ -1840,7 +1840,7 @@ var DOM = Class("DOM", {
|
||||
let resolver = XPath.resolver;
|
||||
if (namespaces) {
|
||||
namespaces = update({}, DOM.namespaces, namespaces);
|
||||
resolver = function (prefix) namespaces[prefix] || null;
|
||||
resolver = prefix => namespaces[prefix] || null;
|
||||
}
|
||||
|
||||
let result = doc.evaluate(expression, elem,
|
||||
@@ -1878,8 +1878,8 @@ var DOM = Class("DOM", {
|
||||
*/
|
||||
makeXPath: function makeXPath(nodes) {
|
||||
return array(nodes).map(util.debrace).flatten()
|
||||
.map(function (node) /^[a-z]+:/.test(node) ? node : [node, "xhtml:" + node]).flatten()
|
||||
.map(function (node) "//" + node).join(" | ");
|
||||
.map(node => /^[a-z]+:/.test(node) ? node : [node, "xhtml:" + node]).flatten()
|
||||
.map(node => "//" + node).join(" | ");
|
||||
},
|
||||
|
||||
namespaces: {
|
||||
@@ -1891,11 +1891,11 @@ var DOM = Class("DOM", {
|
||||
},
|
||||
|
||||
namespaceNames: Class.Memoize(function ()
|
||||
iter(this.namespaces).map(function ([k, v]) [v, k]).toObject()),
|
||||
iter(this.namespaces).map(([k, v]) => [v, k]).toObject()),
|
||||
});
|
||||
|
||||
Object.keys(DOM.Event.types).forEach(function (event) {
|
||||
let name = event.replace(/-(.)/g, function (m, m1) m1.toUpperCase());
|
||||
let name = event.replace(/-(.)/g, (m, m1) => m1.toUpperCase());
|
||||
if (!Set.has(DOM.prototype, name))
|
||||
DOM.prototype[name] =
|
||||
function _event(arg, extra) {
|
||||
|
||||
@@ -281,7 +281,7 @@ var DownloadList = Class("DownloadList",
|
||||
return;
|
||||
|
||||
this.downloads[id] = download;
|
||||
let index = values(this.downloads).sort(function (a, b) a.compare(b))
|
||||
let index = values(this.downloads).sort((a, b) => a.compare(b))
|
||||
.indexOf(download);
|
||||
|
||||
this.nodes.list.insertBefore(download.nodes.row,
|
||||
@@ -301,7 +301,7 @@ var DownloadList = Class("DownloadList",
|
||||
},
|
||||
|
||||
allowedCommands: Class.Memoize(function () let (self = this) ({
|
||||
get clear() values(self.downloads).some(function (dl) dl.allowedCommands.remove)
|
||||
get clear() values(self.downloads).some(dl => dl.allowedCommands.remove)
|
||||
})),
|
||||
|
||||
commands: {
|
||||
@@ -311,7 +311,7 @@ var DownloadList = Class("DownloadList",
|
||||
},
|
||||
|
||||
sort: function sort() {
|
||||
let list = values(this.downloads).sort(function (a, b) a.compare(b));
|
||||
let list = values(this.downloads).sort((a, b) => a.compare(b));
|
||||
|
||||
for (let [i, download] in iter(list))
|
||||
if (this.nodes.list.childNodes[i + 1] != download.nodes.row)
|
||||
@@ -319,7 +319,7 @@ var DownloadList = Class("DownloadList",
|
||||
this.nodes.list.childNodes[i + 1]);
|
||||
},
|
||||
|
||||
shouldSort: function shouldSort() Array.some(arguments, function (val) this.sortOrder.some(function (v) v.substr(1) == val), this),
|
||||
shouldSort: function shouldSort() Array.some(arguments, val => this.sortOrder.some(v => v.substr(1) == val)),
|
||||
|
||||
update: function update() {
|
||||
for (let node in values(this.nodes))
|
||||
@@ -336,11 +336,11 @@ var DownloadList = Class("DownloadList",
|
||||
|
||||
updateProgress: function updateProgress() {
|
||||
let downloads = values(this.downloads).toArray();
|
||||
let active = downloads.filter(function (d) d.alive);
|
||||
let active = downloads.filter(d => d.alive);
|
||||
|
||||
let self = Object.create(this);
|
||||
for (let prop in values(["amountTransferred", "size", "speed", "timeRemaining"]))
|
||||
this[prop] = active.reduce(function (acc, dl) dl[prop] + acc, 0);
|
||||
this[prop] = active.reduce((acc, dl) => dl[prop] + acc, 0);
|
||||
|
||||
Download.prototype.updateProgress.call(self);
|
||||
|
||||
@@ -489,21 +489,21 @@ var Downloads = Module("downloads", XPCOM(Ci.nsIDownloadProgressListener), {
|
||||
},
|
||||
|
||||
completer: function (context, extra) {
|
||||
let seen = Set.has(Set(extra.values.map(function (val) val.substr(1))));
|
||||
let seen = Set.has(Set(extra.values.map(val => val.substr(1))));
|
||||
|
||||
context.completions = iter(this.values).filter(function ([k, v]) !seen(k))
|
||||
.map(function ([k, v]) [["+" + k, [v, " (", _("sort.ascending"), ")"].join("")],
|
||||
context.completions = iter(this.values).filter(([k, v]) => !seen(k))
|
||||
.map(([k, v]) => [["+" + k, [v, " (", _("sort.ascending"), ")"].join("")],
|
||||
["-" + k, [v, " (", _("sort.descending"), ")"].join("")]])
|
||||
.flatten().array;
|
||||
},
|
||||
|
||||
has: function () Array.some(arguments, function (val) this.value.some(function (v) v.substr(1) == val)),
|
||||
has: function () Array.some(arguments, function (val) this.value.some(v => v.substr(1) == val)),
|
||||
|
||||
validator: function (value) {
|
||||
let seen = {};
|
||||
return value.every(function (val) /^[+-]/.test(val) && Set.has(this.values, val.substr(1))
|
||||
&& !Set.add(seen, val.substr(1)),
|
||||
this) && value.length;
|
||||
return value.every(val => /^[+-]/.test(val) && Set.has(this.values, val.substr(1))
|
||||
&& !Set.add(seen, val.substr(1))
|
||||
) && value.length;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ var RangeFinder = Module("rangefinder", {
|
||||
return "";
|
||||
}
|
||||
|
||||
this.options["findflags"].forEach(function (f) replacer(f, f));
|
||||
this.options["findflags"].forEach(function (f) { replacer(f, f); });
|
||||
|
||||
let pattern = str.replace(/\\(.|$)/g, replacer);
|
||||
|
||||
@@ -430,7 +430,7 @@ var RangeFind = Class("RangeFind", {
|
||||
findRange: function findRange(range) {
|
||||
let doc = range.startContainer.ownerDocument;
|
||||
let win = doc.defaultView;
|
||||
let ranges = this.ranges.filter(function (r)
|
||||
let ranges = this.ranges.filter(r =>
|
||||
r.window === win && RangeFind.sameDocument(r.range, range) && RangeFind.contains(r.range, range));
|
||||
|
||||
if (this.backward)
|
||||
@@ -516,7 +516,7 @@ var RangeFind = Class("RangeFind", {
|
||||
},
|
||||
|
||||
iter: function iter(word) {
|
||||
let saved = ["lastRange", "lastString", "range", "regexp"].map(function (s) [s, this[s]], this);
|
||||
let saved = ["lastRange", "lastString", "range", "regexp"].map(s => [s, this[s]]);
|
||||
let res;
|
||||
try {
|
||||
let regexp = this.regexp && word != util.regexp.escape(word);
|
||||
@@ -542,7 +542,7 @@ var RangeFind = Class("RangeFind", {
|
||||
}
|
||||
}
|
||||
finally {
|
||||
saved.forEach(function ([k, v]) this[k] = v, this);
|
||||
saved.forEach(function ([k, v]) { this[k] = v; }, this);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -611,7 +611,7 @@ var RangeFind = Class("RangeFind", {
|
||||
this.range = this.findRange(this.startRange) || this.ranges[0];
|
||||
util.assert(this.range, "Null range", false);
|
||||
this.ranges.first = this.range;
|
||||
this.ranges.forEach(function (range) range.save());
|
||||
this.ranges.forEach(function (range) { range.save(); });
|
||||
this.forward = null;
|
||||
this.found = false;
|
||||
},
|
||||
@@ -837,7 +837,7 @@ var RangeFind = Class("RangeFind", {
|
||||
}
|
||||
return true;
|
||||
},
|
||||
selectNodePath: ["a", "xhtml:a", "*[@onclick]"].map(function (p) "ancestor-or-self::" + p).join(" | "),
|
||||
selectNodePath: ["a", "xhtml:a", "*[@onclick]"].map(p => "ancestor-or-self::" + p).join(" | "),
|
||||
union: function union(a, b) {
|
||||
let start = a.compareBoundaryPoints(a.START_TO_START, b) < 0 ? a : b;
|
||||
let end = a.compareBoundaryPoints(a.END_TO_END, b) > 0 ? a : b;
|
||||
|
||||
@@ -27,7 +27,7 @@ var HelpBuilder = Class("HelpBuilder", {
|
||||
|
||||
// Scrape the list of help files from all.xml
|
||||
this.tags["all"] = this.tags["all.xml"] = "all";
|
||||
let files = this.findHelpFile("all").map(function (doc)
|
||||
let files = this.findHelpFile("all").map(doc =>
|
||||
[f.value for (f in DOM.XPath("//dactyl:include/@href", doc))]);
|
||||
|
||||
// Scrape the tags from the rest of the help files.
|
||||
@@ -90,8 +90,8 @@ var Help = Module("Help", {
|
||||
}
|
||||
|
||||
update(services["dactyl:"].providers, {
|
||||
"help": Loop(function (uri, path) help.files[path]),
|
||||
"help-overlay": Loop(function (uri, path) help.overlays[path]),
|
||||
"help": Loop((uri, path) => help.files[path]),
|
||||
"help-overlay": Loop((uri, path) => help.overlays[path]),
|
||||
"help-tag": Loop(function (uri, path) {
|
||||
let tag = decodeURIComponent(path);
|
||||
if (tag in help.files)
|
||||
@@ -129,7 +129,7 @@ var Help = Module("Help", {
|
||||
let betas = util.regexp(/\[((?:b|rc)\d)\]/, "gx");
|
||||
|
||||
let beta = array(betas.iterate(NEWS))
|
||||
.map(function (m) m[1]).uniq().slice(-1)[0];
|
||||
.map(m => m[1]).uniq().slice(-1)[0];
|
||||
|
||||
function rec(text, level, li) {
|
||||
let res = [];
|
||||
@@ -151,10 +151,10 @@ var Help = Module("Help", {
|
||||
else if (match.par) {
|
||||
let [, par, tags] = /([^]*?)\s*((?:\[[^\]]+\])*)\n*$/.exec(match.par);
|
||||
let t = tags;
|
||||
tags = array(betas.iterate(tags)).map(function (m) m[1]);
|
||||
tags = array(betas.iterate(tags)).map(m => m[1]);
|
||||
|
||||
let group = !tags.length ? "" :
|
||||
!tags.some(function (t) t == beta) ? "HelpNewsOld" : "HelpNewsNew";
|
||||
!tags.some(t => t == beta) ? "HelpNewsOld" : "HelpNewsNew";
|
||||
if (i === 0 && li) {
|
||||
li[1]["dactyl:highlight"] = group;
|
||||
group = "";
|
||||
@@ -367,7 +367,7 @@ var Help = Module("Help", {
|
||||
for (let [file, ] in Iterator(help.files)) {
|
||||
let url = "dactyl://help/" + file;
|
||||
dactyl.open(url);
|
||||
util.waitFor(function () content.location.href == url && buffer.loaded
|
||||
util.waitFor(() => content.location.href == url && buffer.loaded
|
||||
&& content.document.documentElement instanceof Ci.nsIDOMHTMLHtmlElement,
|
||||
15000);
|
||||
events.waitForPageLoad();
|
||||
@@ -381,7 +381,7 @@ var Help = Module("Help", {
|
||||
}
|
||||
|
||||
let data = [h for (h in highlight) if (Set.has(styles, h.class) || /^Help/.test(h.class))]
|
||||
.map(function (h) h.selector
|
||||
.map(h => h.selector
|
||||
.replace(/^\[.*?=(.*?)\]/, ".hl-$1")
|
||||
.replace(/html\|/g, "") + "\t" + "{" + h.cssText + "}")
|
||||
.join("\n");
|
||||
@@ -444,7 +444,7 @@ var Help = Module("Help", {
|
||||
},
|
||||
javascript: function initJavascript(dactyl, modules, window) {
|
||||
modules.JavaScript.setCompleter([modules.help.exportHelp],
|
||||
[function (context, args) overlay.activeModules.completion.file(context)]);
|
||||
[(context, args) => overlay.activeModules.completion.file(context)]);
|
||||
},
|
||||
options: function initOptions(dactyl, modules, window) {
|
||||
const { options } = modules;
|
||||
|
||||
@@ -57,22 +57,22 @@ Highlight.defaultValue("sites", function ()
|
||||
Highlight.defaultValue("style", function ()
|
||||
styles.system.add("highlight:" + this.class, this.sites, this.css, this.agent, true));
|
||||
|
||||
Highlight.defaultValue("defaultExtends", function () []);
|
||||
Highlight.defaultValue("defaultValue", function () "");
|
||||
Highlight.defaultValue("defaultExtends", () => []);
|
||||
Highlight.defaultValue("defaultValue", () => "");
|
||||
Highlight.defaultValue("extends", function () this.defaultExtends);
|
||||
Highlight.defaultValue("value", function () this.defaultValue);
|
||||
|
||||
update(Highlight.prototype, {
|
||||
get base() this.baseClass != this.class && highlight.highlight[this.baseClass] || null,
|
||||
|
||||
get bases() array.compact(this.extends.map(function (name) highlight.get(name))),
|
||||
get bases() array.compact(this.extends.map(name => highlight.get(name))),
|
||||
|
||||
get inheritedCSS() {
|
||||
if (this.gettingCSS)
|
||||
return "";
|
||||
try {
|
||||
this.gettingCSS = true;
|
||||
return this.bases.map(function (b) b.cssText.replace(/;?\s*$/, "; ")).join("");
|
||||
return this.bases.map(b => b.cssText.replace(/;?\s*$/, "; ")).join("");
|
||||
}
|
||||
finally {
|
||||
this.gettingCSS = false;
|
||||
@@ -100,7 +100,7 @@ var Highlights = Module("Highlight", {
|
||||
|
||||
keys: function keys() Object.keys(this.highlight).sort(),
|
||||
|
||||
__iterator__: function () values(this.highlight).sort(function (a, b) String.localeCompare(a.class, b.class))
|
||||
__iterator__: function () values(this.highlight).sort((a, b) => String.localeCompare(a.class, b.class))
|
||||
.iterValues(),
|
||||
|
||||
_create: function _create(agent, args) {
|
||||
@@ -282,8 +282,8 @@ var Highlights = Module("Highlight", {
|
||||
*/
|
||||
loadCSS: function loadCSS(css, eager) {
|
||||
String.replace(css, /\\\n/g, "")
|
||||
.replace(this.groupRegexp, function (m, m1, m2) m1 + " " + m2.replace(/\n\s*/g, " "))
|
||||
.split("\n").filter(function (s) /\S/.test(s) && !/^\s*\/\//.test(s))
|
||||
.replace(this.groupRegexp, (m, m1, m2) => m1 + " " + m2.replace(/\n\s*/g, " "))
|
||||
.split("\n").filter(s => /\S/.test(s) && !/^\s*\/\//.test(s))
|
||||
.forEach(function (highlight) {
|
||||
|
||||
let bang = eager || /^\s*!/.test(highlight);
|
||||
@@ -352,7 +352,7 @@ var Highlights = Module("Highlight", {
|
||||
"text-align: center"],
|
||||
([h.class,
|
||||
["span", { style: "text-align: center; line-height: 1em;" + h.value + style }, "XXX"],
|
||||
template.map(h.extends, function (s) template.highlight(s), ","),
|
||||
template.map(h.extends, s => template.highlight(s), ","),
|
||||
template.highlightRegexp(h.value, /\b[-\w]+(?=:)|\/\*.*?\*\//g,
|
||||
function (match) ["span", { highlight: match[0] == "/" ? "Comment" : "Key" }, match])
|
||||
]
|
||||
@@ -395,7 +395,7 @@ var Highlights = Module("Highlight", {
|
||||
completer: function (context, args) {
|
||||
let group = args[0] && highlight.get(args[0]);
|
||||
if (group)
|
||||
context.fork("extra", 0, this, function (context) [
|
||||
context.fork("extra", 0, this, context => [
|
||||
[String(group.extends), _("option.currentValue")],
|
||||
[String(group.defaultExtends) || "", _("option.defaultValue")]
|
||||
]);
|
||||
@@ -428,8 +428,8 @@ var Highlights = Module("Highlight", {
|
||||
context.completions =
|
||||
array.flatten(
|
||||
io.getRuntimeDirectories("colors").map(
|
||||
function (dir) dir.readDirectory().filter(
|
||||
function (file) extRe.test(file.leafName))))
|
||||
dir => dir.readDirectory().filter(
|
||||
file => extRe.test(file.leafName))))
|
||||
.concat([
|
||||
{ leafName: "default", parent: { path: /*L*/"Revert to builtin colorscheme" } }
|
||||
]);
|
||||
@@ -442,10 +442,10 @@ var Highlights = Module("Highlight", {
|
||||
};
|
||||
},
|
||||
javascript: function initJavascript(dactyl, modules, window) {
|
||||
modules.JavaScript.setCompleter(["get", "set"].map(function (m) highlight[m]),
|
||||
[ function (context, obj, args) Iterator(highlight.highlight) ]);
|
||||
modules.JavaScript.setCompleter(["highlightNode"].map(function (m) highlight[m]),
|
||||
[ null, function (context, obj, args) Iterator(highlight.highlight) ]);
|
||||
modules.JavaScript.setCompleter(["get", "set"].map(m => highlight[m]),
|
||||
[ (context, obj, args) => Iterator(highlight.highlight) ]);
|
||||
modules.JavaScript.setCompleter(["highlightNode"].map(m => highlight[m]),
|
||||
[ null, (context, obj, args) => Iterator(highlight.highlight) ]);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+18
-18
@@ -74,8 +74,8 @@ var IO = Module("io", {
|
||||
*/
|
||||
getRuntimeDirectories: function getRuntimeDirectories(name) {
|
||||
return modules.options.get("runtimepath").files
|
||||
.map(function (dir) dir.child(name))
|
||||
.filter(function (dir) dir.exists() && dir.isDirectory() && dir.isReadable());
|
||||
.map(dir => dir.child(name))
|
||||
.filter(dir => dir.exists() && dir.isDirectory() && dir.isReadable());
|
||||
},
|
||||
|
||||
// FIXME: multiple paths?
|
||||
@@ -502,7 +502,7 @@ var IO = Module("io", {
|
||||
|
||||
function async(status) {
|
||||
let output = stdout.read();
|
||||
[stdin, stdout, cmd].forEach(function (f) f.exists() && f.remove(false));
|
||||
[stdin, stdout, cmd].forEach(f => f.exists() && f.remove(false));
|
||||
callback(result(status, output));
|
||||
}
|
||||
|
||||
@@ -550,7 +550,7 @@ var IO = Module("io", {
|
||||
}
|
||||
finally {
|
||||
if (!checked || res !== true)
|
||||
args.forEach(function (f) f.remove(false));
|
||||
args.forEach(f => f.remove(false));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -806,7 +806,7 @@ unlet s:cpo_save
|
||||
lines.last.push(item, sep);
|
||||
}
|
||||
lines.last.pop();
|
||||
return lines.map(function (l) l.join("")).join("\n").replace(/\s+\n/gm, "\n");
|
||||
return lines.map(l => l.join("")).join("\n").replace(/\s+\n/gm, "\n");
|
||||
}//}}}
|
||||
|
||||
let params = { //{{{
|
||||
@@ -904,7 +904,7 @@ unlet s:cpo_save
|
||||
_("command.run.noPrevious"));
|
||||
|
||||
arg = arg.replace(/(\\)*!/g,
|
||||
function (m) /^\\(\\\\)*!$/.test(m) ? m.replace("\\!", "!") : m.replace("!", io._lastRunCommand)
|
||||
m => /^\\(\\\\)*!$/.test(m) ? m.replace("\\!", "!") : m.replace("!", io._lastRunCommand)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -942,21 +942,21 @@ unlet s:cpo_save
|
||||
}
|
||||
}
|
||||
};
|
||||
context.generate = function () iter(services.charset.getDecoderList());
|
||||
context.generate = () => iter(services.charset.getDecoderList());
|
||||
};
|
||||
|
||||
completion.directory = function directory(context, full) {
|
||||
this.file(context, full);
|
||||
context.filters.push(function (item) item.isdir);
|
||||
context.filters.push(item => item.isdir);
|
||||
};
|
||||
|
||||
completion.environment = function environment(context) {
|
||||
context.title = ["Environment Variable", "Value"];
|
||||
context.generate = function ()
|
||||
context.generate = () =>
|
||||
io.system(config.OS.isWindows ? "set" : "env")
|
||||
.output.split("\n")
|
||||
.filter(function (line) line.indexOf("=") > 0)
|
||||
.map(function (line) line.match(/([^=]+)=(.*)/).slice(1));
|
||||
.filter(line => line.indexOf("=") > 0)
|
||||
.map(line => line.match(/([^=]+)=(.*)/).slice(1));
|
||||
};
|
||||
|
||||
completion.file = function file(context, full, dir) {
|
||||
@@ -983,10 +983,10 @@ unlet s:cpo_save
|
||||
icon: function (f) this.isdir ? "resource://gre/res/html/folder.png"
|
||||
: "moz-icon://" + f.leafName
|
||||
};
|
||||
context.compare = function (a, b) b.isdir - a.isdir || String.localeCompare(a.text, b.text);
|
||||
context.compare = (a, b) => b.isdir - a.isdir || String.localeCompare(a.text, b.text);
|
||||
|
||||
if (modules.options["wildignore"])
|
||||
context.filters.push(function (item) !modules.options.get("wildignore").getKey(item.path));
|
||||
context.filters.push(item => !modules.options.get("wildignore").getKey(item.path));
|
||||
|
||||
// context.background = true;
|
||||
context.key = dir;
|
||||
@@ -1054,7 +1054,7 @@ unlet s:cpo_save
|
||||
if (!match.path) {
|
||||
context.key = match.proto;
|
||||
context.advance(match.proto.length);
|
||||
context.generate = function () config.chromePackages.map(function (p) [p, match.proto + p + "/"]);
|
||||
context.generate = () => config.chromePackages.map(p => [p, match.proto + p + "/"]);
|
||||
}
|
||||
else if (match.scheme === "chrome") {
|
||||
context.key = match.prefix;
|
||||
@@ -1121,8 +1121,8 @@ unlet s:cpo_save
|
||||
"List of directories searched when executing :cd",
|
||||
"stringlist", ["."].concat(services.environment.get("CDPATH").split(/[:;]/).filter(util.identity)).join(","),
|
||||
{
|
||||
get files() this.value.map(function (path) File(path, modules.io.cwd))
|
||||
.filter(function (dir) dir.exists()),
|
||||
get files() this.value.map(path => File(path, modules.io.cwd))
|
||||
.filter(dir => dir.exists()),
|
||||
setter: function (value) File.expandPathList(value)
|
||||
});
|
||||
|
||||
@@ -1130,8 +1130,8 @@ unlet s:cpo_save
|
||||
"List of directories searched for runtime files",
|
||||
"stringlist", IO.runtimePath,
|
||||
{
|
||||
get files() this.value.map(function (path) File(path, modules.io.cwd))
|
||||
.filter(function (dir) dir.exists())
|
||||
get files() this.value.map(path => File(path, modules.io.cwd))
|
||||
.filter(dir => dir.exists())
|
||||
});
|
||||
|
||||
options.add(["shell", "sh"],
|
||||
|
||||
@@ -57,7 +57,7 @@ var JavaScript = Module("javascript", {
|
||||
|
||||
newContext: function () this.modules.newContext(this.modules.userContext, true, "Dactyl JS Temp Context"),
|
||||
|
||||
completers: Class.Memoize(function () Object.create(JavaScript.completers)),
|
||||
completers: Class.Memoize(() => Object.create(JavaScript.completers)),
|
||||
|
||||
// Some object members are only accessible as function calls
|
||||
getKey: function (obj, key) {
|
||||
@@ -273,7 +273,7 @@ var JavaScript = Module("javascript", {
|
||||
|
||||
// Don't eval any function calls unless the user presses tab.
|
||||
_checkFunction: function (start, end, key) {
|
||||
let res = this._functions.some(function (idx) idx >= start && idx < end);
|
||||
let res = this._functions.some(idx => idx >= start && idx < end);
|
||||
if (!res || this.context.tabPressed || key in this.cache.evalled)
|
||||
return false;
|
||||
this.context.waitingForTab = true;
|
||||
@@ -345,11 +345,11 @@ var JavaScript = Module("javascript", {
|
||||
let prefix = last != null ? key : "";
|
||||
|
||||
if (last == null) // We're not looking for a quoted string, so filter out anything that's not a valid identifier
|
||||
base.filters.push(function (item) /^[a-zA-Z_$][\w$]*$/.test(item.text));
|
||||
base.filters.push(item => /^[a-zA-Z_$][\w$]*$/.test(item.text));
|
||||
else {
|
||||
base.quote = [last, function (text) util.escapeString(text, ""), last];
|
||||
base.quote = [last, text => util.escapeString(text, ""), last];
|
||||
if (prefix)
|
||||
base.filters.push(function (item) item.item.indexOf(prefix) === 0);
|
||||
base.filters.push(item => item.item.indexOf(prefix) === 0);
|
||||
}
|
||||
|
||||
if (!compl) {
|
||||
@@ -371,7 +371,7 @@ var JavaScript = Module("javascript", {
|
||||
};
|
||||
|
||||
base.keys = {
|
||||
text: prefix ? function (text) text.substr(prefix.length) : util.identity,
|
||||
text: prefix ? text => text.substr(prefix.length) : util.identity,
|
||||
description: function (item) self.getKey(this.obj, item),
|
||||
key: function (item) {
|
||||
if (!isNaN(key))
|
||||
@@ -389,7 +389,7 @@ var JavaScript = Module("javascript", {
|
||||
objects.forEach(function (obj) {
|
||||
let context = base.fork(obj[1]);
|
||||
context.title = [obj[1]];
|
||||
context.keys.obj = function () obj[0];
|
||||
context.keys.obj = () => obj[0];
|
||||
context.key = obj[1] + last;
|
||||
if (obj[0] == this.cache.evalContext)
|
||||
context.regenerate = true;
|
||||
@@ -397,8 +397,8 @@ var JavaScript = Module("javascript", {
|
||||
obj.ctxt_t = context.fork("toplevel");
|
||||
if (!compl) {
|
||||
obj.ctxt_p = context.fork("prototypes");
|
||||
obj.ctxt_t.generate = function () self.objectKeys(obj[0], true);
|
||||
obj.ctxt_p.generate = function () self.objectKeys(obj[0], false);
|
||||
obj.ctxt_t.generate = () => self.objectKeys(obj[0], true);
|
||||
obj.ctxt_p.generate = () => self.objectKeys(obj[0], false);
|
||||
}
|
||||
}, this);
|
||||
|
||||
@@ -563,7 +563,7 @@ var JavaScript = Module("javascript", {
|
||||
for (let [i, idx] in Iterator(this._get(-2).comma)) {
|
||||
let arg = this._str.substring(prev + 1, idx);
|
||||
prev = idx;
|
||||
memoize(args, i, function () self.evalled(arg));
|
||||
memoize(args, i, () => self.evalled(arg));
|
||||
}
|
||||
let key = this._getKey();
|
||||
args.push(key + string);
|
||||
@@ -641,7 +641,7 @@ var JavaScript = Module("javascript", {
|
||||
].concat([k.substr(6) for (k in keys(Ci)) if (/^nsIDOM/.test(k))])
|
||||
.concat([k.substr(3) for (k in keys(Ci)) if (/^nsI/.test(k))])
|
||||
.concat(this.magicalNames)
|
||||
.filter(function (k) k in self.window))),
|
||||
.filter(k => k in self.window))),
|
||||
|
||||
}, {
|
||||
EVAL_TMP: "__dactyl_eval_tmp",
|
||||
@@ -775,7 +775,7 @@ var JavaScript = Module("javascript", {
|
||||
this.js.globals = [
|
||||
[this.context, /*L*/"REPL Variables"],
|
||||
[context, /*L*/"REPL Global"]
|
||||
].concat(this.js.globals.filter(function ([global]) isPrototypeOf.call(global, context)));
|
||||
].concat(this.js.globals.filter(([global]) => isPrototypeOf.call(global, context)));
|
||||
|
||||
if (!isPrototypeOf.call(modules.jsmodules, context))
|
||||
this.js.toplevel = context;
|
||||
@@ -783,7 +783,7 @@ var JavaScript = Module("javascript", {
|
||||
if (!isPrototypeOf.call(window, context))
|
||||
this.js.window = context;
|
||||
|
||||
if (this.js.globals.slice(2).some(function ([global]) global === context))
|
||||
if (this.js.globals.slice(2).some(([global]) => global === context))
|
||||
this.js.globals.splice(1);
|
||||
|
||||
this.repl = REPL(this.context);
|
||||
|
||||
@@ -149,9 +149,9 @@ var Modules = function Modules(window) {
|
||||
|
||||
get ownPropertyValues() array.compact(
|
||||
Object.getOwnPropertyNames(this)
|
||||
.map(function (name) Object.getOwnPropertyDescriptor(this, name).value, this)),
|
||||
.map(name => Object.getOwnPropertyDescriptor(this, name).value)),
|
||||
|
||||
get moduleList() this.ownPropertyValues.filter(function (mod) mod instanceof this.ModuleBase || mod.isLocalModule, this)
|
||||
get moduleList() this.ownPropertyValues.filter(mod => mod instanceof this.ModuleBase || mod.isLocalModule)
|
||||
});
|
||||
|
||||
modules.plugins = create(modules);
|
||||
@@ -179,7 +179,7 @@ overlay.overlayWindow(Object.keys(config.overlays), function _overlay(window) ({
|
||||
});
|
||||
|
||||
config.modules.window
|
||||
.forEach(function (name) defineModule.time("load", name, modules.load, modules, name));
|
||||
.forEach(name => defineModule.time("load", name, modules.load, modules, name));
|
||||
}, this);
|
||||
},
|
||||
|
||||
@@ -224,7 +224,7 @@ overlay.overlayWindow(Object.keys(config.overlays), function _overlay(window) ({
|
||||
},
|
||||
|
||||
cleanup: function cleanup(window) {
|
||||
overlay.windows = overlay.windows.filter(function (w) w != window);
|
||||
overlay.windows = overlay.windows.filter(w => w != window);
|
||||
},
|
||||
|
||||
unload: function unload(window) {
|
||||
|
||||
@@ -119,11 +119,11 @@ var Messages = Module("messages", {
|
||||
}()).toArray();
|
||||
|
||||
file.write(
|
||||
array(commands.allHives.map(function (h) properties("command", h)))
|
||||
.concat(modes.all.map(function (m)
|
||||
array(commands.allHives.map(h => properties("command", h)))
|
||||
.concat(modes.all.map(m =>
|
||||
properties("map", values(mappings.builtin.getStack(m)
|
||||
.filter(function (map) map.modes[0] == m)))))
|
||||
.concat(properties("mode", values(modes.all.filter(function (m) !m.hidden))))
|
||||
.filter(map => map.modes[0] == m)))))
|
||||
.concat(properties("mode", values(modes.all.filter(m => !m.hidden))))
|
||||
.concat(properties("option", options))
|
||||
.concat(properties("hintmode", values(hints.modes), "prompt"))
|
||||
.concat(properties("pageinfo", values(Buffer.pageInfo), "title"))
|
||||
@@ -168,7 +168,7 @@ var Messages = Module("messages", {
|
||||
});
|
||||
else
|
||||
iter(value).forEach(function ([k, v]) {
|
||||
memoize(value, k, function () messages.get([name, k].join("."), v));
|
||||
memoize(value, k, () => messages.get([name, k].join("."), v));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ var Messages = Module("messages", {
|
||||
let { JavaScript } = modules;
|
||||
|
||||
JavaScript.setCompleter([this._, this.get, this.format], [
|
||||
function (context) messages.iterate()
|
||||
context => messages.iterate()
|
||||
]);
|
||||
|
||||
JavaScript.setCompleter([this.export],
|
||||
|
||||
+39
-39
@@ -75,7 +75,7 @@ var Option = Class("Option", {
|
||||
get helpTag() "'" + this.name + "'",
|
||||
|
||||
initValue: function initValue() {
|
||||
util.trapErrors(function () this.value = this.value, this);
|
||||
util.trapErrors(() => this.value = this.value, this);
|
||||
},
|
||||
|
||||
get isDefault() this.stringValue === this.stringDefaultValue,
|
||||
@@ -203,7 +203,7 @@ var Option = Class("Option", {
|
||||
*
|
||||
* @returns {boolean}
|
||||
*/
|
||||
has: function has() Array.some(arguments, function (val) this.value.indexOf(val) >= 0, this),
|
||||
has: function has() Array.some(arguments, val => this.value.indexOf(val) >= 0),
|
||||
|
||||
/**
|
||||
* Returns whether this option is identified by *name*.
|
||||
@@ -318,7 +318,7 @@ var Option = Class("Option", {
|
||||
* references to a given domain from the given values.
|
||||
*/
|
||||
filterDomain: function filterDomain(host, values)
|
||||
Array.filter(values, function (val) !this.domains([val]).some(function (val) util.isSubdomain(val, host)), this),
|
||||
Array.filter(values, val => !this.domains([val]).some(val => util.isSubdomain(val, host))),
|
||||
|
||||
/**
|
||||
* @property {value} The option's default value. This value will be used
|
||||
@@ -344,7 +344,7 @@ var Option = Class("Option", {
|
||||
if (isArray(defaultValue))
|
||||
defaultValue = defaultValue.map(Option.quote).join(",");
|
||||
else if (isObject(defaultValue))
|
||||
defaultValue = iter(defaultValue).map(function (val) val.map(function (v) Option.quote(v, /:/))
|
||||
defaultValue = iter(defaultValue).map(val => val.map(v => Option.quote(v, /:/))
|
||||
.join(":"))
|
||||
.join(",");
|
||||
|
||||
@@ -491,7 +491,7 @@ var Option = Class("Option", {
|
||||
},
|
||||
|
||||
domains: {
|
||||
sitelist: function (vals) array.compact(vals.map(function (site) util.getHost(site.filter))),
|
||||
sitelist: function (vals) array.compact(vals.map(site => util.getHost(site.filter))),
|
||||
get sitemap() this.sitelist
|
||||
},
|
||||
|
||||
@@ -520,7 +520,7 @@ var Option = Class("Option", {
|
||||
|
||||
regexplist: function regexplist(value) (value === "") ? [] :
|
||||
Option.splitList(value, true)
|
||||
.map(function (re) Option.parseRegexp(re, undefined, this.regexpFlags), this),
|
||||
.map(re => Option.parseRegexp(re, undefined, this.regexpFlags)),
|
||||
|
||||
sitelist: function sitelist(value) {
|
||||
if (value === "")
|
||||
@@ -558,7 +558,7 @@ var Option = Class("Option", {
|
||||
},
|
||||
|
||||
testValues: {
|
||||
regexpmap: function regexpmap(vals, validator) vals.every(function (re) validator(re.result)),
|
||||
regexpmap: function regexpmap(vals, validator) vals.every(re => validator(re.result)),
|
||||
get sitemap() this.regexpmap,
|
||||
stringlist: function stringlist(vals, validator) vals.every(validator, this),
|
||||
stringmap: function stringmap(vals, validator) values(vals).every(validator, this)
|
||||
@@ -587,7 +587,7 @@ var Option = Class("Option", {
|
||||
return res;
|
||||
},
|
||||
|
||||
quote: function quote(str, re) isArray(str) ? str.map(function (s) quote(s, re)).join(",") :
|
||||
quote: function quote(str, re) isArray(str) ? str.map(s => quote(s, re)).join(",") :
|
||||
Commands.quoteArg[/[\s|"'\\,]|^$/.test(str) || re && re.test && re.test(str)
|
||||
? (/[\b\f\n\r\t]/.test(str) ? '"' : "'")
|
||||
: ""](str, re),
|
||||
@@ -671,7 +671,7 @@ var Option = Class("Option", {
|
||||
|
||||
function uniq(ary) {
|
||||
let seen = {};
|
||||
return ary.filter(function (elem) !Set.add(seen, elem));
|
||||
return ary.filter(elem => !Set.add(seen, elem));
|
||||
}
|
||||
|
||||
switch (operator) {
|
||||
@@ -716,7 +716,7 @@ var Option = Class("Option", {
|
||||
function completions(extra) {
|
||||
let context = CompletionContext("");
|
||||
return context.fork("", 0, this, this.completer, extra) ||
|
||||
context.allItems.items.map(function (item) [item.text]);
|
||||
context.allItems.items.map(item => [item.text]);
|
||||
};
|
||||
|
||||
if (isObject(vals) && !isArray(vals)) {
|
||||
@@ -731,10 +731,10 @@ var Option = Class("Option", {
|
||||
acceptable = completions.call(this);
|
||||
|
||||
if (isArray(acceptable))
|
||||
acceptable = Set(acceptable.map(function ([k]) k));
|
||||
acceptable = Set(acceptable.map(([k]) => k));
|
||||
|
||||
if (this.type === "regexpmap" || this.type === "sitemap")
|
||||
return Array.concat(vals).every(function (re) Set.has(acceptable, re.result));
|
||||
return Array.concat(vals).every(re => Set.has(acceptable, re.result));
|
||||
|
||||
return Array.concat(vals).every(Set.has(acceptable));
|
||||
},
|
||||
@@ -821,7 +821,7 @@ var Options = Module("options", {
|
||||
opt.set(opt.globalValue, Option.SCOPE_GLOBAL, true);
|
||||
}, window);
|
||||
|
||||
modules.cache.register("options.dtd", function ()
|
||||
modules.cache.register("options.dtd", () =>
|
||||
util.makeDTD(
|
||||
iter(([["option", o.name, "default"].join("."),
|
||||
o.type === "string" ? o.defaultValue.replace(/'/g, "''") :
|
||||
@@ -877,7 +877,7 @@ var Options = Module("options", {
|
||||
else if (isArray(opt.value) && opt.type != "charlist")
|
||||
option.value = ["", "=",
|
||||
template.map(opt.value,
|
||||
function (v) template.highlight(String(v)),
|
||||
v => template.highlight(String(v)),
|
||||
["", ",",
|
||||
["span", { style: "width: 0; display: inline-block" }, " "]])];
|
||||
else
|
||||
@@ -927,7 +927,7 @@ var Options = Module("options", {
|
||||
|
||||
let closure = () => this._optionMap[name];
|
||||
|
||||
memoize(this._optionMap, name, function () Option.types[type](modules, names, description, defaultValue, extraInfo));
|
||||
memoize(this._optionMap, name, () => Option.types[type](modules, names, description, defaultValue, extraInfo));
|
||||
for (let alias in values(names.slice(1)))
|
||||
memoize(this._optionMap, alias, closure);
|
||||
|
||||
@@ -948,7 +948,7 @@ var Options = Module("options", {
|
||||
|
||||
/** @property {Iterator(Option)} @private */
|
||||
__iterator__: function __iterator__()
|
||||
values(this._options.sort(function (a, b) String.localeCompare(a.name, b.name))),
|
||||
values(this._options.sort((a, b) => String.localeCompare(a.name, b.name))),
|
||||
|
||||
allPrefs: deprecated("prefs.getNames", function allPrefs() prefs.getNames.apply(prefs, arguments)),
|
||||
getPref: deprecated("prefs.get", function getPref() prefs.get.apply(prefs, arguments)),
|
||||
@@ -963,7 +963,7 @@ var Options = Module("options", {
|
||||
setPref: deprecated("prefs.set", function setPref() prefs.set.apply(prefs, arguments)),
|
||||
withContext: deprecated("prefs.withContext", function withContext() prefs.withContext.apply(prefs, arguments)),
|
||||
|
||||
cleanupPrefs: Class.Memoize(function () config.prefs.Branch("cleanup.option.")),
|
||||
cleanupPrefs: Class.Memoize(() => config.prefs.Branch("cleanup.option.")),
|
||||
|
||||
cleanup: function cleanup(reason) {
|
||||
if (~["disable", "uninstall"].indexOf(reason))
|
||||
@@ -1059,7 +1059,7 @@ var Options = Module("options", {
|
||||
*/
|
||||
remove: function remove(name) {
|
||||
let opt = this.get(name);
|
||||
this._options = this._options.filter(function (o) o != opt);
|
||||
this._options = this._options.filter(o => o != opt);
|
||||
for (let name in values(opt.names))
|
||||
delete this._optionMap[name];
|
||||
},
|
||||
@@ -1095,12 +1095,12 @@ var Options = Module("options", {
|
||||
|
||||
let list = [];
|
||||
function flushList() {
|
||||
let names = Set(list.map(function (opt) opt.option ? opt.option.name : ""));
|
||||
let names = Set(list.map(opt => opt.option ? opt.option.name : ""));
|
||||
if (list.length)
|
||||
if (list.some(function (opt) opt.all))
|
||||
options.list(function (opt) !(list[0].onlyNonDefault && opt.isDefault), list[0].scope);
|
||||
if (list.some(opt => opt.all))
|
||||
options.list(opt => !(list[0].onlyNonDefault && opt.isDefault), list[0].scope);
|
||||
else
|
||||
options.list(function (opt) Set.has(names, opt.name), list[0].scope);
|
||||
options.list(opt => Set.has(names, opt.name), list[0].scope);
|
||||
list = [];
|
||||
}
|
||||
|
||||
@@ -1212,11 +1212,11 @@ var Options = Module("options", {
|
||||
context.advance(filter.length);
|
||||
filter = filter.substr(0, filter.length - 1);
|
||||
|
||||
context.pushProcessor(0, function (item, text, next) next(item, text.substr(0, 100)));
|
||||
context.pushProcessor(0, (item, text, next) => next(item, text.substr(0, 100)));
|
||||
context.completions = [
|
||||
[prefs.get(filter), _("option.currentValue")],
|
||||
[prefs.defaults.get(filter), _("option.defaultValue")]
|
||||
].filter(function (k) k[0] != null);
|
||||
].filter(k => k[0] != null);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1229,7 +1229,7 @@ var Options = Module("options", {
|
||||
context.highlight();
|
||||
if (context.filter.indexOf("=") == -1) {
|
||||
if (false && prefix)
|
||||
context.filters.push(function ({ item }) item.type == "boolean" || prefix == "inv" && isArray(item.values));
|
||||
context.filters.push(({ item }) => item.type == "boolean" || prefix == "inv" && isArray(item.values));
|
||||
return completion.option(context, opt.scope, opt.name == "inv" ? opt.name : prefix);
|
||||
}
|
||||
|
||||
@@ -1256,11 +1256,11 @@ var Options = Module("options", {
|
||||
if (!opt.value && !opt.operator && !opt.invert) {
|
||||
context.fork("default", 0, this, function (context) {
|
||||
context.title = ["Extra Completions"];
|
||||
context.pushProcessor(0, function (item, text, next) next(item, text.substr(0, 100)));
|
||||
context.pushProcessor(0, (item, text, next) => next(item, text.substr(0, 100)));
|
||||
context.completions = [
|
||||
[option.stringValue, _("option.currentValue")],
|
||||
[option.stringDefaultValue, _("option.defaultValue")]
|
||||
].filter(function (f) f[0] !== "");
|
||||
].filter(f => f[0] !== "");
|
||||
context.quote = ["", util.identity, ""];
|
||||
});
|
||||
}
|
||||
@@ -1275,10 +1275,10 @@ var Options = Module("options", {
|
||||
context.anchored = optcontext.anchored;
|
||||
context.maxItems = optcontext.maxItems;
|
||||
|
||||
context.filters.push(function (i) !Set.has(have, i.text));
|
||||
context.filters.push(i => !Set.has(have, i.text));
|
||||
modules.completion.optionValue(context, opt.name, opt.operator, null,
|
||||
function (context) {
|
||||
context.generate = function () option.value.map(function (o) [o, ""]);
|
||||
context.generate = () => option.value.map(o => [o, ""]);
|
||||
});
|
||||
context.title = ["Current values"];
|
||||
}
|
||||
@@ -1426,11 +1426,11 @@ var Options = Module("options", {
|
||||
context.anchored = false;
|
||||
context.completions = modules.options;
|
||||
if (prefix == "inv")
|
||||
context.keys.text = function (opt)
|
||||
opt.type == "boolean" || isArray(opt.value) ? opt.names.map(function (n) "inv" + n)
|
||||
context.keys.text = opt =>
|
||||
opt.type == "boolean" || isArray(opt.value) ? opt.names.map(n => "inv" + n)
|
||||
: opt.names;
|
||||
if (scope)
|
||||
context.filters.push(function ({ item }) item.scope & scope);
|
||||
context.filters.push(({ item }) => item.scope & scope);
|
||||
};
|
||||
|
||||
completion.optionValue = function (context, name, op, curValue, completer) {
|
||||
@@ -1484,7 +1484,7 @@ var Options = Module("options", {
|
||||
|
||||
function val(obj) {
|
||||
if (isArray(opt.defaultValue)) {
|
||||
let val = array.nth(obj, function (re) re.key == extra.key, 0);
|
||||
let val = array.nth(obj, re => re.key == extra.key, 0);
|
||||
return val && val.result;
|
||||
}
|
||||
if (Set.has(opt.defaultValue, extra.key))
|
||||
@@ -1496,7 +1496,7 @@ var Options = Module("options", {
|
||||
context.completions = [
|
||||
[val(opt.value), _("option.currentValue")],
|
||||
[val(opt.defaultValue), _("option.defaultValue")]
|
||||
].filter(function (f) f[0] !== "" && f[0] != null);
|
||||
].filter(f => f[0] !== "" && f[0] != null);
|
||||
});
|
||||
context = context.fork("stuff", 0);
|
||||
}
|
||||
@@ -1506,17 +1506,17 @@ var Options = Module("options", {
|
||||
// Not Vim compatible, but is a significant enough improvement
|
||||
// that it's worth breaking compatibility.
|
||||
if (isArray(newValues)) {
|
||||
context.filters.push(function (i) newValues.indexOf(i.text) == -1);
|
||||
context.filters.push(i => newValues.indexOf(i.text) == -1);
|
||||
if (op == "+")
|
||||
context.filters.push(function (i) curValues.indexOf(i.text) == -1);
|
||||
context.filters.push(i => curValues.indexOf(i.text) == -1);
|
||||
if (op == "-")
|
||||
context.filters.push(function (i) curValues.indexOf(i.text) > -1);
|
||||
context.filters.push(i => curValues.indexOf(i.text) > -1);
|
||||
|
||||
memoize(extra, "values", function () {
|
||||
if (op == "+")
|
||||
return curValues.concat(newValues);
|
||||
if (op == "-")
|
||||
return curValues.filter(function (v) newValues.indexOf(val) == -1);
|
||||
return curValues.filter(v => newValues.indexOf(val) == -1);
|
||||
return newValues;
|
||||
});
|
||||
}
|
||||
@@ -1528,7 +1528,7 @@ var Options = Module("options", {
|
||||
},
|
||||
javascript: function initJavascript(dactyl, modules, window) {
|
||||
const { options, JavaScript } = modules;
|
||||
JavaScript.setCompleter(Options.prototype.get, [function () ([o.name, o.description] for (o in options))]);
|
||||
JavaScript.setCompleter(Options.prototype.get, [() => ([o.name, o.description] for (o in options))]);
|
||||
},
|
||||
sanitizer: function initSanitizer(dactyl, modules, window) {
|
||||
const { sanitizer } = modules;
|
||||
|
||||
+11
-11
@@ -27,8 +27,8 @@ var Overlay = Class("Overlay", {
|
||||
this.window = window;
|
||||
},
|
||||
|
||||
cleanups: Class.Memoize(function () []),
|
||||
objects: Class.Memoize(function () ({})),
|
||||
cleanups: Class.Memoize(() => []),
|
||||
objects: Class.Memoize(() => ({})),
|
||||
|
||||
get doc() this.window.document,
|
||||
|
||||
@@ -52,7 +52,7 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
|
||||
this.onWindowVisible = [];
|
||||
},
|
||||
|
||||
id: Class.Memoize(function () config.addon.id),
|
||||
id: Class.Memoize(() => config.addon.id),
|
||||
|
||||
/**
|
||||
* Adds an event listener for this session and removes it on
|
||||
@@ -148,7 +148,7 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
|
||||
"content-document-global-created": function (window, uri) { this.observe(window, "toplevel-window-ready", null); },
|
||||
"xul-window-visible": function () {
|
||||
if (this.onWindowVisible)
|
||||
this.onWindowVisible.forEach(function (f) f.call(this), this);
|
||||
this.onWindowVisible.forEach(function (f) { f.call(this); }, this);
|
||||
this.onWindowVisible = null;
|
||||
}
|
||||
},
|
||||
@@ -281,10 +281,10 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
|
||||
}
|
||||
}
|
||||
|
||||
insert("before", function (elem, dom) elem.parentNode.insertBefore(dom, elem));
|
||||
insert("after", function (elem, dom) elem.parentNode.insertBefore(dom, elem.nextSibling));
|
||||
insert("append", function (elem, dom) elem.appendChild(dom));
|
||||
insert("prepend", function (elem, dom) elem.insertBefore(dom, elem.firstChild));
|
||||
insert("before", (elem, dom) => elem.parentNode.insertBefore(dom, elem));
|
||||
insert("after", (elem, dom) => elem.parentNode.insertBefore(dom, elem.nextSibling));
|
||||
insert("append", (elem, dom) => elem.appendChild(dom));
|
||||
insert("prepend", (elem, dom) => elem.insertBefore(dom, elem.firstChild));
|
||||
if (obj.ready)
|
||||
util.trapErrors("ready", obj, window);
|
||||
|
||||
@@ -412,19 +412,19 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
|
||||
|
||||
get activeModules() this.activeWindow && this.activeWindow.dactyl.modules,
|
||||
|
||||
get modules() this.windows.map(function (w) w.dactyl.modules),
|
||||
get modules() this.windows.map(w => w.dactyl.modules),
|
||||
|
||||
/**
|
||||
* The most recently active dactyl window.
|
||||
*/
|
||||
get activeWindow() this.windows[0],
|
||||
|
||||
set activeWindow(win) this.windows = [win].concat(this.windows.filter(function (w) w != win)),
|
||||
set activeWindow(win) this.windows = [win].concat(this.windows.filter(w => w != win)),
|
||||
|
||||
/**
|
||||
* A list of extant dactyl windows.
|
||||
*/
|
||||
windows: Class.Memoize(function () [])
|
||||
windows: Class.Memoize(() => [])
|
||||
});
|
||||
|
||||
endModule();
|
||||
|
||||
@@ -428,7 +428,7 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
|
||||
},
|
||||
javascript: function init_javascript(dactyl, modules) {
|
||||
modules.JavaScript.setCompleter([this.get, this.safeSet, this.set, this.reset, this.toggle],
|
||||
[function (context) (context.anchored=false, this.getNames().map(function (pref) [pref, ""]))]);
|
||||
[function (context) (context.anchored=false, this.getNames().map(pref => [pref, ""]))]);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
before: [
|
||||
["preferences", { id: branch.substr(Item.PREFIX.length) + "history",
|
||||
xmlns: "xul" },
|
||||
template.map(ourItems(persistent), function (item)
|
||||
template.map(ourItems(persistent), item =>
|
||||
["preference", { type: "bool", id: branch + item.name, name: branch + item.name }])]
|
||||
],
|
||||
init: function init(win) {
|
||||
@@ -197,9 +197,9 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
["column", { flex: "1" }]],
|
||||
["rows", {},
|
||||
let (items = ourItems(true))
|
||||
template.map(util.range(0, Math.ceil(items.length / 2)), function (i)
|
||||
template.map(util.range(0, Math.ceil(items.length / 2)), i =>
|
||||
["row", {},
|
||||
template.map(items.slice(i * 2, i * 2 + 2), function (item)
|
||||
template.map(items.slice(i * 2, i * 2 + 2), item =>
|
||||
["checkbox", { xmlns: XUL, label: item.description, preference: branch + item.name }])])]]]
|
||||
}
|
||||
}));
|
||||
@@ -211,7 +211,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
itemList: [
|
||||
["listitem", { xmlns: "xul", label: /*L*/"See :help privacy for the following:",
|
||||
disabled: "true", style: "font-style: italic; font-weight: bold;" }],
|
||||
template.map(ourItems(), function ([item, desc])
|
||||
template.map(ourItems(), ([item, desc]) =>
|
||||
["listitem", { xmlns: "xul", preference: branch + item,
|
||||
type: "checkbox", label: config.appName + ", " + desc,
|
||||
onsyncfrompreference: "return gSanitizePromptDialog.onReadGeneric();" }])
|
||||
@@ -247,7 +247,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
if (!("value" in prop) || !callable(prop.value) && !(k in item))
|
||||
Object.defineProperty(item, k, prop);
|
||||
|
||||
let names = Set([name].concat(params.contains || []).map(function (e) "clear-" + e));
|
||||
let names = Set([name].concat(params.contains || []).map(e => "clear-" + e));
|
||||
if (params.action)
|
||||
storage.addObserver("sanitizer",
|
||||
function (key, event, arg) {
|
||||
@@ -466,7 +466,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
sanitizer.sanitize(items, range);
|
||||
}
|
||||
|
||||
if (array.nth(opt.value, function (i) i == "all" || /^!/.test(i), 0) == "all" && !args["-host"])
|
||||
if (array.nth(opt.value, i => i == "all" || /^!/.test(i), 0) == "all" && !args["-host"])
|
||||
modules.commandline.input(_("sanitize.prompt.deleteAll") + " ",
|
||||
function (resp) {
|
||||
if (resp.match(/^y(es)?$/i)) {
|
||||
@@ -493,8 +493,8 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
names: ["-host", "-h"],
|
||||
description: "Only sanitize items referring to listed host or hosts",
|
||||
completer: function (context, args) {
|
||||
context.filters.push(function (item)
|
||||
!args["-host"].some(function (host) util.isSubdomain(item.text, host)));
|
||||
context.filters.push(item =>
|
||||
!args["-host"].some(host => util.isSubdomain(item.text, host)));
|
||||
modules.completion.domain(context);
|
||||
},
|
||||
type: modules.CommandOption.LIST
|
||||
@@ -586,7 +586,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
completion: function initCompletion(dactyl, modules, window) {
|
||||
modules.completion.visibleHosts = function completeHosts(context) {
|
||||
let res = util.visibleHosts(window.content);
|
||||
if (context.filter && !res.some(function (host) host.indexOf(context.filter) >= 0))
|
||||
if (context.filter && !res.some(host => host.indexOf(context.filter) >= 0))
|
||||
res.push(context.filter);
|
||||
|
||||
context.title = ["Domain"];
|
||||
@@ -612,11 +612,11 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
},
|
||||
|
||||
has: function has(val)
|
||||
let (res = array.nth(this.value, function (v) v == "all" || v.replace(/^!/, "") == val, 0))
|
||||
let (res = array.nth(this.value, v => v == "all" || v.replace(/^!/, "") == val, 0))
|
||||
res && !/^!/.test(res),
|
||||
|
||||
validator: function (values) values.length &&
|
||||
values.every(function (val) val === "all" || Set.has(sanitizer.itemMap, val.replace(/^!/, "")))
|
||||
values.every(val => val === "all" || Set.has(sanitizer.itemMap, val.replace(/^!/, "")))
|
||||
});
|
||||
|
||||
options.add(["sanitizeshutdown", "ss"],
|
||||
@@ -679,7 +679,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
],
|
||||
getter: function () (this.values[prefs.get(this.PREF)] || ["all"])[0],
|
||||
setter: function (val) {
|
||||
prefs.set(this.PREF, this.values.map(function (i) i[0]).indexOf(val));
|
||||
prefs.set(this.PREF, this.values.map(i => i[0]).indexOf(val));
|
||||
return val;
|
||||
},
|
||||
initialValue: true,
|
||||
@@ -698,7 +698,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
],
|
||||
getter: function () (this.values[prefs.get(this.PREF)] || [prefs.get(this.PREF_DAYS)])[0],
|
||||
setter: function (value) {
|
||||
let val = this.values.map(function (i) i[0]).indexOf(value);
|
||||
let val = this.values.map(i => i[0]).indexOf(value);
|
||||
if (val > -1)
|
||||
prefs.set(this.PREF, val);
|
||||
else {
|
||||
|
||||
@@ -126,7 +126,7 @@ var Services = Module("Services", {
|
||||
if (!service.interfaces.length)
|
||||
return res.wrappedJSObject || res;
|
||||
|
||||
service.interfaces.forEach(function (iface) res instanceof Ci[iface]);
|
||||
service.interfaces.forEach(iface => res instanceof Ci[iface]);
|
||||
if (service.init && args.length) {
|
||||
if (service.callable)
|
||||
res[service.init].apply(res, args);
|
||||
@@ -162,7 +162,7 @@ var Services = Module("Services", {
|
||||
this.services[name] = { method: meth, class: class_, interfaces: Array.concat(ifaces || []) };
|
||||
if (name in this && ifaces && !this.__lookupGetter__(name) && !(this[name] instanceof Ci.nsISupports))
|
||||
throw TypeError();
|
||||
memoize(this, name, function () self._create(name));
|
||||
memoize(this, name, () => self._create(name));
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -206,7 +206,7 @@ var Services = Module("Services", {
|
||||
* @param {string} name The service's cache key.
|
||||
*/
|
||||
has: function has(name) Set.has(this.services, name) && this.services[name].class in Cc &&
|
||||
this.services[name].interfaces.every(function (iface) iface in Ci)
|
||||
this.services[name].interfaces.every(iface => iface in Ci)
|
||||
});
|
||||
|
||||
endModule();
|
||||
|
||||
@@ -27,8 +27,8 @@ var StoreBase = Class("StoreBase", {
|
||||
this._load = load;
|
||||
this._options = options;
|
||||
|
||||
this.__defineGetter__("store", function () store);
|
||||
this.__defineGetter__("name", function () name);
|
||||
this.__defineGetter__("store", () => store);
|
||||
this.__defineGetter__("name", () => name);
|
||||
for (let [k, v] in Iterator(options))
|
||||
if (this.OPTIONS.indexOf(k) >= 0)
|
||||
this[k] = v;
|
||||
@@ -224,7 +224,7 @@ var Storage = Module("Storage", {
|
||||
delete this.dactylSession[key];
|
||||
},
|
||||
|
||||
infoPath: Class.Memoize(function ()
|
||||
infoPath: Class.Memoize(() =>
|
||||
File(IO.runtimePath.replace(/,.*/, ""))
|
||||
.child("info").child(config.profileName)),
|
||||
|
||||
@@ -292,7 +292,7 @@ var Storage = Module("Storage", {
|
||||
if (!(key in this.observers))
|
||||
this.observers[key] = [];
|
||||
|
||||
if (!this.observers[key].some(function (o) o.callback.get() == callback))
|
||||
if (!this.observers[key].some(o => o.callback.get() == callback))
|
||||
this.observers[key].push({ ref: ref && Cu.getWeakReference(ref), callback: callbackRef });
|
||||
},
|
||||
|
||||
@@ -302,7 +302,7 @@ var Storage = Module("Storage", {
|
||||
if (!(key in this.observers))
|
||||
return;
|
||||
|
||||
this.observers[key] = this.observers[key].filter(function (elem) elem.callback.get() != callback);
|
||||
this.observers[key] = this.observers[key].filter(elem => elem.callback.get() != callback);
|
||||
if (this.observers[key].length == 0)
|
||||
delete obsevers[key];
|
||||
},
|
||||
@@ -427,7 +427,7 @@ var File = Class("File", {
|
||||
return this;
|
||||
},
|
||||
|
||||
charset: Class.Memoize(function () File.defaultEncoding),
|
||||
charset: Class.Memoize(() => File.defaultEncoding),
|
||||
|
||||
/**
|
||||
* @property {nsIFileURL} Returns the nsIFileURL object for this file.
|
||||
@@ -495,7 +495,7 @@ var File = Class("File", {
|
||||
|
||||
let array = [e for (e in this.iterDirectory())];
|
||||
if (sort)
|
||||
array.sort(function (a, b) b.isDirectory() - a.isDirectory() || String.localeCompare(a.path, b.path));
|
||||
array.sort((a, b) => b.isDirectory() - a.isDirectory() || String.localeCompare(a.path, b.path));
|
||||
return array;
|
||||
},
|
||||
|
||||
@@ -695,7 +695,7 @@ var File = Class("File", {
|
||||
function expand(path) path.replace(
|
||||
!win32 ? /\$(\w+)\b|\${(\w+)}/g
|
||||
: /\$(\w+)\b|\${(\w+)}|%(\w+)%/g,
|
||||
function (m, n1, n2, n3) getenv(n1 || n2 || n3) || m
|
||||
(m, n1, n2, n3) => getenv(n1 || n2 || n3) || m
|
||||
);
|
||||
path = expand(path);
|
||||
|
||||
|
||||
+41
-41
@@ -63,7 +63,7 @@ update(Sheet.prototype, {
|
||||
match: function (uri) {
|
||||
if (isString(uri))
|
||||
uri = util.newURI(uri);
|
||||
return this.sites.some(function (site) Styles.matchFilter(site, uri));
|
||||
return this.sites.some(site => Styles.matchFilter(site, uri));
|
||||
},
|
||||
|
||||
get fullCSS() {
|
||||
@@ -74,7 +74,7 @@ update(Sheet.prototype, {
|
||||
if (filter[0] == "*")
|
||||
return preamble + css;
|
||||
|
||||
let selectors = filter.map(function (part)
|
||||
let selectors = filter.map(part =>
|
||||
!/^(?:[a-z-]+[:*]|[a-z-.]+$)/i.test(part) ? "regexp(" + Styles.quote(".*(?:" + part + ").*") + ")" :
|
||||
(/[*]$/.test(part) ? "url-prefix" :
|
||||
/[\/:]/.test(part) ? "url"
|
||||
@@ -102,10 +102,10 @@ var Hive = Class("Hive", {
|
||||
this.dropRef(null);
|
||||
},
|
||||
dropRef: function (obj) {
|
||||
this.refs = this.refs.filter(function (ref) ref.get() && ref.get() !== obj);
|
||||
this.refs = this.refs.filter(ref => ref.get() && ref.get() !== obj);
|
||||
if (!this.refs.length) {
|
||||
this.cleanup();
|
||||
styles.hives = styles.hives.filter(function (h) h !== this, this);
|
||||
styles.hives = styles.hives.filter(h => h !== this);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -116,7 +116,7 @@ var Hive = Class("Hive", {
|
||||
|
||||
__iterator__: function () Iterator(this.sheets),
|
||||
|
||||
get sites() array(this.sheets).map(function (s) s.sites).flatten().uniq().array,
|
||||
get sites() array(this.sheets).map(s => s.sites).flatten().uniq().array,
|
||||
|
||||
/**
|
||||
* Add a new style sheet.
|
||||
@@ -182,14 +182,14 @@ var Hive = Class("Hive", {
|
||||
// Grossly inefficient.
|
||||
let matches = [k for ([k, v] in Iterator(this.sheets))];
|
||||
if (index)
|
||||
matches = String(index).split(",").filter(function (i) i in this.sheets, this);
|
||||
matches = String(index).split(",").filter(i => i in this.sheets);
|
||||
if (name)
|
||||
matches = matches.filter(function (i) this.sheets[i].name == name, this);
|
||||
matches = matches.filter(i => this.sheets[i].name == name);
|
||||
if (css)
|
||||
matches = matches.filter(function (i) this.sheets[i].css == css, this);
|
||||
matches = matches.filter(i => this.sheets[i].css == css);
|
||||
if (filter)
|
||||
matches = matches.filter(function (i) this.sheets[i].sites.indexOf(filter) >= 0, this);
|
||||
return matches.map(function (i) this.sheets[i], this);
|
||||
matches = matches.filter(i => this.sheets[i].sites.indexOf(filter) >= 0);
|
||||
return matches.map(i => this.sheets[i]);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -222,7 +222,7 @@ var Hive = Class("Hive", {
|
||||
|
||||
for (let [, sheet] in Iterator(matches.reverse())) {
|
||||
if (filter) {
|
||||
let sites = sheet.sites.filter(function (f) f != filter);
|
||||
let sites = sheet.sites.filter(f => f != filter);
|
||||
if (sites.length) {
|
||||
sheet.sites = sites;
|
||||
continue;
|
||||
@@ -233,7 +233,7 @@ var Hive = Class("Hive", {
|
||||
delete this.names[sheet.name];
|
||||
delete styles.allSheets[sheet.id];
|
||||
}
|
||||
this.sheets = this.sheets.filter(function (s) matches.indexOf(s) == -1);
|
||||
this.sheets = this.sheets.filter(s => matches.indexOf(s) == -1);
|
||||
return matches.length;
|
||||
},
|
||||
});
|
||||
@@ -273,7 +273,7 @@ var Styles = Module("Styles", {
|
||||
},
|
||||
|
||||
addHive: function addHive(name, ref, persist) {
|
||||
let hive = array.nth(this.hives, function (h) h.name === name, 0);
|
||||
let hive = array.nth(this.hives, h => h.name === name, 0);
|
||||
if (!hive) {
|
||||
hive = Hive(name, persist);
|
||||
this.hives.push(hive);
|
||||
@@ -304,13 +304,13 @@ var Styles = Module("Styles", {
|
||||
list: function list(content, sites, name, hives) {
|
||||
const { commandline, dactyl } = this.modules;
|
||||
|
||||
hives = hives || styles.hives.filter(function (h) h.modifiable && h.sheets.length);
|
||||
hives = hives || styles.hives.filter(h => h.modifiable && h.sheets.length);
|
||||
|
||||
function sheets(group)
|
||||
group.sheets.slice()
|
||||
.filter(function (sheet) (!name || sheet.name === name) &&
|
||||
(!sites || sites.every(function (s) sheet.sites.indexOf(s) >= 0)))
|
||||
.sort(function (a, b) a.name && b.name ? String.localeCompare(a.name, b.name)
|
||||
.filter(sheet => (!name || sheet.name === name) &&
|
||||
(!sites || sites.every(s => sheet.sites.indexOf(s) >= 0)))
|
||||
.sort((a, b) => a.name && b.name ? String.localeCompare(a.name, b.name)
|
||||
: !!b.name - !!a.name || a.id - b.id);
|
||||
|
||||
let uris = util.visibleURIs(content);
|
||||
@@ -326,9 +326,9 @@ var Styles = Module("Styles", {
|
||||
["col", { style: "min-width: 1em; text-align: center; color: red; font-weight: bold;" }],
|
||||
["col", { style: "padding: 0 1em 0 1ex; vertical-align: top;" }],
|
||||
["col", { style: "padding: 0 1em 0 0; vertical-align: top;" }],
|
||||
template.map(hives, function (hive) let (i = 0) [
|
||||
template.map(hives, hive => let (i = 0) [
|
||||
["tr", { style: "height: .5ex;" }],
|
||||
template.map(sheets(hive), function (sheet)
|
||||
template.map(sheets(hive), sheet =>
|
||||
["tr", {},
|
||||
["td", { highlight: "Title" }, !i++ ? hive.name : ""],
|
||||
["td", {}, sheet.enabled ? "" : UTF8("×")],
|
||||
@@ -369,7 +369,7 @@ var Styles = Module("Styles", {
|
||||
props[prop.name] = prop.value;
|
||||
|
||||
let val = Object.keys(props)[sort ? "sort" : "slice"]()
|
||||
.map(function (prop) prop + ": " + props[prop] + ";")
|
||||
.map(prop => prop + ": " + props[prop] + ";")
|
||||
.join(" ");
|
||||
|
||||
if (/^\s*(\/\*.*?\*\/)/.exec(src))
|
||||
@@ -393,13 +393,13 @@ var Styles = Module("Styles", {
|
||||
|
||||
let uris = util.visibleURIs(content);
|
||||
|
||||
context.generate = function () values(group.sites);
|
||||
context.generate = () => values(group.sites);
|
||||
|
||||
context.keys.text = util.identity;
|
||||
context.keys.description = function (site) this.sheets.length + /*L*/" sheet" + (this.sheets.length == 1 ? "" : "s") + ": " +
|
||||
array.compact(this.sheets.map(function (s) s.name)).join(", ");
|
||||
context.keys.sheets = function (site) group.sheets.filter(function (s) s.sites.indexOf(site) >= 0);
|
||||
context.keys.active = function (site) uris.some(Styles.matchFilter(site));
|
||||
array.compact(this.sheets.map(s => s.name)).join(", ");
|
||||
context.keys.sheets = site => group.sheets.filter(s => s.sites.indexOf(site) >= 0);
|
||||
context.keys.active = site => uris.some(Styles.matchFilter(site));
|
||||
|
||||
Styles.splitContext(context, "Sites");
|
||||
},
|
||||
@@ -445,7 +445,7 @@ var Styles = Module("Styles", {
|
||||
let [name, active] = item;
|
||||
context.split(name, null, function (context) {
|
||||
context.title[0] = /*L*/name + " " + (title || "Sheets");
|
||||
context.filters.push(function (item) !!item.active == active);
|
||||
context.filters.push(item => !!item.active == active);
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -548,11 +548,11 @@ var Styles = Module("Styles", {
|
||||
function sheets(context, args, filter) {
|
||||
let uris = util.visibleURIs(window.content);
|
||||
context.compare = modules.CompletionContext.Sort.number;
|
||||
context.generate = function () args["-group"].sheets;
|
||||
context.keys.active = function (sheet) uris.some(sheet.closure.match);
|
||||
context.keys.description = function (sheet) [sheet.formatSites(uris), ": ", sheet.css.replace("\n", "\\n")];
|
||||
context.generate = () => args["-group"].sheets;
|
||||
context.keys.active = sheet => uris.some(sheet.closure.match);
|
||||
context.keys.description = sheet => [sheet.formatSites(uris), ": ", sheet.css.replace("\n", "\\n")];
|
||||
if (filter)
|
||||
context.filters.push(function ({ item }) filter(item));
|
||||
context.filters.push(({ item }) => filter(item));
|
||||
Styles.splitContext(context);
|
||||
}
|
||||
|
||||
@@ -561,8 +561,8 @@ var Styles = Module("Styles", {
|
||||
description: "The name of this stylesheet",
|
||||
type: modules.CommandOption.STRING,
|
||||
completer: function (context, args) {
|
||||
context.keys.text = function (sheet) sheet.name;
|
||||
context.filters.unshift(function ({ item }) item.name);
|
||||
context.keys.text = sheet => sheet.name;
|
||||
context.filters.unshift(({ item }) => item.name);
|
||||
sheets(context, args, filter);
|
||||
}
|
||||
});
|
||||
@@ -619,11 +619,11 @@ var Styles = Module("Styles", {
|
||||
],
|
||||
serialize: function ()
|
||||
array(styles.hives)
|
||||
.filter(function (hive) hive.persist)
|
||||
.map(function (hive)
|
||||
hive.sheets.filter(function (style) style.persist)
|
||||
.sort(function (a, b) String.localeCompare(a.name || "", b.name || ""))
|
||||
.map(function (style) ({
|
||||
.filter(hive => hive.persist)
|
||||
.map(hive =>
|
||||
hive.sheets.filter(style => style.persist)
|
||||
.sort((a, b) => String.localeCompare(a.name || "", b.name || ""))
|
||||
.map(style => ({
|
||||
command: "style",
|
||||
arguments: [style.sites.join(",")],
|
||||
literalArg: style.css,
|
||||
@@ -673,7 +673,7 @@ var Styles = Module("Styles", {
|
||||
|
||||
Styles.completeSite(context, window.content, args["-group"]);
|
||||
if (cmd.filter)
|
||||
context.filters.push(function ({ sheets }) sheets.some(cmd.filter));
|
||||
context.filters.push(({ sheets }) => sheets.some(cmd.filter));
|
||||
},
|
||||
literal: 1,
|
||||
options: [
|
||||
@@ -682,7 +682,7 @@ var Styles = Module("Styles", {
|
||||
names: ["-index", "-i"],
|
||||
type: modules.CommandOption.INT,
|
||||
completer: function (context, args) {
|
||||
context.keys.text = function (sheet) args["-group"].sheets.indexOf(sheet);
|
||||
context.keys.text = sheet => args["-group"].sheets.indexOf(sheet);
|
||||
sheets(context, args, cmd.filter);
|
||||
}
|
||||
},
|
||||
@@ -728,10 +728,10 @@ var Styles = Module("Styles", {
|
||||
};
|
||||
},
|
||||
javascript: function initJavascript(dactyl, modules, window) {
|
||||
modules.JavaScript.setCompleter(["get", "add", "remove", "find"].map(function (m) Hive.prototype[m]),
|
||||
modules.JavaScript.setCompleter(["get", "add", "remove", "find"].map(m => Hive.prototype[m]),
|
||||
[ // Prototype: (name, filter, css, index)
|
||||
function (context, obj, args) this.names,
|
||||
function (context, obj, args) Styles.completeSite(context, window.content),
|
||||
(context, obj, args) => Styles.completeSite(context, window.content),
|
||||
null,
|
||||
function (context, obj, args) this.sheets
|
||||
]);
|
||||
@@ -756,7 +756,7 @@ var Styles = Module("Styles", {
|
||||
if (match.string)
|
||||
return ["span", { highlight: "String" }, match.string];
|
||||
return template._highlightRegexp(match.wholeMatch, /^(\d+)(em|ex|px|in|cm|mm|pt|pc)?/g,
|
||||
function (m, n, u) [
|
||||
(m, n, u) => [
|
||||
["span", { highlight: "Number" }, n],
|
||||
["span", { highlight: "Object" }, u || ""]
|
||||
]);
|
||||
|
||||
@@ -172,7 +172,7 @@ var Template = Module("Template", {
|
||||
!(item.extra && item.extra.length) ? [] :
|
||||
["span", { highlight: "URLExtra" },
|
||||
" (",
|
||||
template.map(item.extra, function (e)
|
||||
template.map(item.extra, e =>
|
||||
["", e[0], ": ",
|
||||
["span", { highlight: e[2] }, e[1]]],
|
||||
"\u00a0"),
|
||||
@@ -278,7 +278,7 @@ var Template = Module("Template", {
|
||||
}
|
||||
},
|
||||
|
||||
_sandbox: Class.Memoize(function () Cu.Sandbox(Cu.getGlobalForObject(global),
|
||||
_sandbox: Class.Memoize(() => Cu.Sandbox(Cu.getGlobalForObject(global),
|
||||
{ wantXrays: false })),
|
||||
|
||||
// if "processStrings" is true, any passed strings will be surrounded by " and
|
||||
@@ -403,7 +403,7 @@ var Template = Module("Template", {
|
||||
["th", {}, _("title.VPos")],
|
||||
["th", {}, _("title.Title")],
|
||||
["th", {}, _("title.URI")]],
|
||||
this.map(Iterator(elems), function ([idx, val])
|
||||
this.map(Iterator(elems), ([idx, val]) =>
|
||||
["tr", {},
|
||||
["td", { class: "indicator" }, idx == index ? ">" : ""],
|
||||
["td", {}, Math.abs(idx - index)],
|
||||
@@ -419,7 +419,7 @@ var Template = Module("Template", {
|
||||
return ["table", {},
|
||||
["tr", { highlight: "Title", align: "left" },
|
||||
["th", {}, "--- " + title + " ---"]],
|
||||
this.map(opts, function (opt)
|
||||
this.map(opts, opt =>
|
||||
["tr", {},
|
||||
["td", {},
|
||||
["div", { highlight: "Message" },
|
||||
@@ -446,7 +446,7 @@ var Template = Module("Template", {
|
||||
let table = ["table", {},
|
||||
["tr", { highlight: "Title", align: "left" },
|
||||
["th", { colspan: "2" }, title]],
|
||||
this.map(data, function (datum)
|
||||
this.map(data, datum =>
|
||||
["tr", {},
|
||||
["td", { style: "font-weight: bold; min-width: 150px; padding-left: " + (indent || "2ex") }, datum[0]],
|
||||
["td", {}, datum[1]]])];
|
||||
@@ -463,7 +463,7 @@ var Template = Module("Template", {
|
||||
["th", {}, h])],
|
||||
this.map(iter, (row) =>
|
||||
["tr", {},
|
||||
this.map(Iterator(row), function ([i, d])
|
||||
this.map(Iterator(row), ([i, d]) =>
|
||||
["td", { style: style[i] || "" }, d])])];
|
||||
},
|
||||
|
||||
|
||||
+25
-25
@@ -161,7 +161,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
}
|
||||
});
|
||||
|
||||
obj.observe.unregister = function () register("removeObserver");
|
||||
obj.observe.unregister = () => register("removeObserver");
|
||||
register("addObserver");
|
||||
}, { dump: dump, Error: Error }),
|
||||
|
||||
@@ -185,7 +185,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
* @param {string} name The name to mangle.
|
||||
* @returns {string} The mangled name.
|
||||
*/
|
||||
camelCase: function camelCase(name) String.replace(name, /-(.)/g, function (m, m1) m1.toUpperCase()),
|
||||
camelCase: function camelCase(name) String.replace(name, /-(.)/g, (m, m1) => m1.toUpperCase()),
|
||||
|
||||
/**
|
||||
* Capitalizes the first character of the given string.
|
||||
@@ -262,11 +262,11 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
function frame() update(
|
||||
function _frame(obj)
|
||||
_frame === stack.top || _frame.valid(obj) ?
|
||||
_frame.elements.map(function (e) callable(e) ? e(obj) : e).join("") : "",
|
||||
_frame.elements.map(e => callable(e) ? e(obj) : e).join("") : "",
|
||||
{
|
||||
elements: [],
|
||||
seen: {},
|
||||
valid: function valid(obj) this.elements.every(function (e) !e.test || e.test(obj))
|
||||
valid: function valid(obj) this.elements.every(e => !e.test || e.test(obj))
|
||||
});
|
||||
|
||||
let end = 0;
|
||||
@@ -295,7 +295,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
char = char.toLowerCase();
|
||||
|
||||
stack.top.elements.push(update(
|
||||
function (obj) obj[char] != null ? quote(obj, char) : "",
|
||||
obj => obj[char] != null ? quote(obj, char) : "",
|
||||
{ test: function test(obj) obj[char] != null }));
|
||||
|
||||
for (let elem in array.iterValues(stack))
|
||||
@@ -340,16 +340,16 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
|
||||
let unknown = util.identity;
|
||||
if (!keepUnknown)
|
||||
unknown = function () "";
|
||||
unknown = () => "";
|
||||
|
||||
function frame() update(
|
||||
function _frame(obj)
|
||||
_frame === stack.top || _frame.valid(obj) ?
|
||||
_frame.elements.map(function (e) callable(e) ? e(obj) : e).join("") : "",
|
||||
_frame.elements.map(e => callable(e) ? e(obj) : e).join("") : "",
|
||||
{
|
||||
elements: [],
|
||||
seen: {},
|
||||
valid: function valid(obj) this.elements.every(function (e) !e.test || e.test(obj))
|
||||
valid: function valid(obj) this.elements.every(e => !e.test || e.test(obj))
|
||||
});
|
||||
|
||||
let defaults = { lt: "<", gt: ">" };
|
||||
@@ -396,7 +396,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
if (idx) {
|
||||
idx = Number(idx) - 1;
|
||||
stack.top.elements.push(update(
|
||||
function (obj) obj[name] != null && idx in obj[name] ? quote(obj[name][idx])
|
||||
obj => obj[name] != null && idx in obj[name] ? quote(obj[name][idx])
|
||||
: Set.has(obj, name) ? "" : unknown(full),
|
||||
{
|
||||
test: function test(obj) obj[name] != null && idx in obj[name]
|
||||
@@ -406,7 +406,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
}
|
||||
else {
|
||||
stack.top.elements.push(update(
|
||||
function (obj) obj[name] != null ? quote(obj[name])
|
||||
obj => obj[name] != null ? quote(obj[name])
|
||||
: Set.has(obj, name) ? "" : unknown(full),
|
||||
{
|
||||
test: function test(obj) obj[name] != null
|
||||
@@ -491,7 +491,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
fn(match);
|
||||
}
|
||||
res.push(pattern.substr(end));
|
||||
return res.map(function (s) util.dequote(s, dequote));
|
||||
return res.map(s => util.dequote(s, dequote));
|
||||
};
|
||||
|
||||
let patterns = [];
|
||||
@@ -539,7 +539,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
* @returns {string}
|
||||
*/
|
||||
dequote: function dequote(pattern, chars)
|
||||
pattern.replace(/\\(.)/, function (m0, m1) chars.indexOf(m1) >= 0 ? m1 : m0),
|
||||
pattern.replace(/\\(.)/, (m0, m1) => chars.indexOf(m1) >= 0 ? m1 : m0),
|
||||
|
||||
/**
|
||||
* Returns the nsIDocShell for the given window.
|
||||
@@ -747,7 +747,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
httpGet: function httpGet(url, callback, self) {
|
||||
let params = callback;
|
||||
if (!isObject(params))
|
||||
params = { callback: params && function () callback.apply(self, arguments) };
|
||||
params = { callback: params && (() => callback.apply(self, arguments)) };
|
||||
|
||||
try {
|
||||
let xmlhttp = services.Xmlhttp();
|
||||
@@ -868,7 +868,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
* top-level window and sub-frames thereof.
|
||||
*/
|
||||
iterDocuments: function iterDocuments(types) {
|
||||
types = types ? types.map(function (s) "type" + util.capitalize(s))
|
||||
types = types ? types.map(s => "type" + util.capitalize(s))
|
||||
: ["typeChrome", "typeContent"];
|
||||
|
||||
let windows = services.windowMediator.getXULWindowEnumerator(null);
|
||||
@@ -887,7 +887,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
},
|
||||
|
||||
// ripped from Firefox; modified
|
||||
unsafeURI: Class.Memoize(function () util.regexp(String.replace(literal(/*
|
||||
unsafeURI: Class.Memoize(() => util.regexp(String.replace(literal(/*
|
||||
[
|
||||
\s
|
||||
// Invisible characters (bug 452979)
|
||||
@@ -933,10 +933,10 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
: val,
|
||||
isDOM ? /['%]/g
|
||||
: /['"%&<>]/g,
|
||||
function (m) map[m]);
|
||||
m => map[m]);
|
||||
}
|
||||
|
||||
return iter(obj).map(function ([k, v])
|
||||
return iter(obj).map(([k, v]) =>
|
||||
["<!ENTITY ", k, " '", escape(v), "'>"].join(""))
|
||||
.join("\n");
|
||||
},
|
||||
@@ -1066,7 +1066,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
return String.localeCompare(a[0], b[0]);
|
||||
}
|
||||
|
||||
let vals = template.map(keys.sort(compare), function (f) f[1], "\n");
|
||||
let vals = template.map(keys.sort(compare), f => f[1], "\n");
|
||||
if (color) {
|
||||
return ["div", { style: "white-space: pre-wrap" }, head, vals];
|
||||
}
|
||||
@@ -1245,14 +1245,14 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
// Replace replacement <tokens>.
|
||||
if (tokens)
|
||||
expr = String.replace(expr, /(\(?P)?<(\w+)>/g,
|
||||
function (m, n1, n2) !n1 && Set.has(tokens, n2) ? tokens[n2].dactylSource
|
||||
(m, n1, n2) => !n1 && Set.has(tokens, n2) ? tokens[n2].dactylSource
|
||||
|| tokens[n2].source
|
||||
|| tokens[n2]
|
||||
: m);
|
||||
|
||||
// Strip comments and white space.
|
||||
if (/x/.test(flags))
|
||||
expr = String.replace(expr, /(\\.)|\/\/[^\n]*|\/\*[^]*?\*\/|\s+/gm, function (m, m1) m1 || "");
|
||||
expr = String.replace(expr, /(\\.)|\/\/[^\n]*|\/\*[^]*?\*\/|\s+/gm, (m, m1) => m1 || "");
|
||||
|
||||
// Replace (?P<named> parameters)
|
||||
if (/\(\?P</.test(expr)) {
|
||||
@@ -1296,7 +1296,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
* @param {RegExp} re The regexp showable source of which is to be returned.
|
||||
* @returns {string}
|
||||
*/
|
||||
getSource: function regexp_getSource(re) re.source.replace(/\\(.)/g, function (m0, m1) m1 === "/" ? "/" : m0),
|
||||
getSource: function regexp_getSource(re) re.source.replace(/\\(.)/g, (m0, m1) => m1 === "/" ? "/" : m0),
|
||||
|
||||
/**
|
||||
* Iterates over all matches of the given regexp in the given
|
||||
@@ -1345,7 +1345,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
},
|
||||
|
||||
errorCount: 0,
|
||||
errors: Class.Memoize(function () []),
|
||||
errors: Class.Memoize(() => []),
|
||||
maxErrors: 15,
|
||||
/**
|
||||
* Reports an error to the Error Console and the standard output,
|
||||
@@ -1411,7 +1411,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
|
||||
let ary = host.split(".");
|
||||
ary = [ary.slice(i).join(".") for (i in util.range(ary.length, 0, -1))];
|
||||
return ary.filter(function (h) h.length >= base.length);
|
||||
return ary.filter(h => h.length >= base.length);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -1669,7 +1669,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
catch (e) {}
|
||||
Array.forEach(frame.frames, rec);
|
||||
})(win);
|
||||
return res.filter(function (h) !Set.add(seen, h));
|
||||
return res.filter(h => !Set.add(seen, h));
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -1688,7 +1688,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
catch (e) {}
|
||||
Array.forEach(frame.frames, rec);
|
||||
})(win);
|
||||
return res.filter(function (h) !Set.add(seen, h.spec));
|
||||
return res.filter(h => !Set.add(seen, h.spec));
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,7 +47,7 @@ const Config = Module("config", ConfigBase, {
|
||||
function () { window.toJavaScriptConsole(); }],
|
||||
dominspector: ["DOM Inspector",
|
||||
function () { window.inspectDOMDocument(window.content.document); },
|
||||
function () "inspectDOMDocument" in window],
|
||||
() => "inspectDOMDocument" in window],
|
||||
downloads: ["Manage Downloads",
|
||||
function () { window.toOpenWindowByType("Download:Manager", "chrome://mozapps/content/downloads/downloads.xul", "chrome,dialog=no,resizable"); }],
|
||||
newsmartplaylist: ["Open the file selector dialog",
|
||||
|
||||
@@ -36,7 +36,7 @@ const Library = Module("library", {
|
||||
*/
|
||||
getAlbums: function getAlbums(artist) {
|
||||
let albums = this._toJSArray(this.MAIN_LIBRARY.getItemsByProperty(SBProperties.artistName, artist))
|
||||
.map(function (track) track.getProperty(SBProperties.albumName));
|
||||
.map(track => track.getProperty(SBProperties.albumName));
|
||||
return array.uniq(albums);
|
||||
},
|
||||
|
||||
@@ -55,7 +55,7 @@ const Library = Module("library", {
|
||||
properties.appendProperty(SBProperties.albumName, album);
|
||||
|
||||
return this._toJSArray(this.MAIN_LIBRARY.getItemsByProperties(properties))
|
||||
.map(function (track) track.getProperty(SBProperties.trackName));
|
||||
.map(track => track.getProperty(SBProperties.trackName));
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
|
||||
@@ -343,7 +343,7 @@ const Player = Module("player", {
|
||||
onEnumerationEnd: function () { },
|
||||
onEnumeratedItem: function (list, item) {
|
||||
// FIXME: why are there null items and duplicates?
|
||||
if (!playlists.some(function (list) list.name == item.name) && item.name != null)
|
||||
if (!playlists.some(list => list.name == item.name) && item.name != null)
|
||||
playlists.push(item);
|
||||
return Ci.sbIMediaListEnumerationListener.CONTINUE;
|
||||
}
|
||||
@@ -372,7 +372,7 @@ const Player = Module("player", {
|
||||
getMediaPages: function getMediaPages() {
|
||||
let list = SBGetBrowser().currentMediaPage.mediaListView.mediaList;
|
||||
let pages = services.mediaPageManager.getAvailablePages(list);
|
||||
return ArrayConverter.JSArray(pages).map(function (page) page.QueryInterface(Ci.sbIMediaPageInfo));
|
||||
return ArrayConverter.JSArray(pages).map(page => page.QueryInterface(Ci.sbIMediaPageInfo));
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,7 +21,7 @@ var Config = Module("config", ConfigBase, {
|
||||
function () { window.openDialog("chrome://browser/content/bookmarks/bookmarksPanel.xul", "Bookmarks", "dialog,centerscreen,width=600,height=600"); }],
|
||||
checkupdates: ["Check for updates",
|
||||
function () { window.checkForUpdates(); },
|
||||
function () "checkForUpdates" in window],
|
||||
() => "checkForUpdates" in window],
|
||||
cookies: ["List your cookies",
|
||||
function () { window.toOpenWindowByType("Browser:Cookies", "chrome://browser/content/preferences/cookies.xul", "chrome,dialog=no,resizable"); }],
|
||||
console: ["JavaScript console",
|
||||
@@ -30,7 +30,7 @@ var Config = Module("config", ConfigBase, {
|
||||
function () { window.BrowserCustomizeToolbar(); }],
|
||||
dominspector: ["DOM Inspector",
|
||||
function () { window.inspectDOMDocument(window.content.document); },
|
||||
function () "inspectDOMDocument" in window],
|
||||
() => "inspectDOMDocument" in window],
|
||||
downloads: ["Manage Downloads",
|
||||
function () { window.BrowserDownloadsUI(); }],
|
||||
history: ["List your history",
|
||||
@@ -63,7 +63,7 @@ var Config = Module("config", ConfigBase, {
|
||||
function () { modules.buffer.viewSelectionSource(); }],
|
||||
venkman: ["The JavaScript debugger",
|
||||
function () { dactyl.assert("start_venkman" in window, "Venkman is not installed"); window.start_venkman() },
|
||||
function () "start_venkman" in window]
|
||||
() => "start_venkman" in window]
|
||||
},
|
||||
|
||||
removeTab: function removeTab(tab) {
|
||||
@@ -211,8 +211,8 @@ var Config = Module("config", ConfigBase, {
|
||||
completion.sidebar = function sidebar(context) {
|
||||
let menu = document.getElementById("viewSidebarMenu");
|
||||
context.title = ["Sidebar Panel"];
|
||||
context.completions = Array.filter(menu.childNodes, function (n) n.hasAttribute("label"))
|
||||
.map(function (n) [n.getAttribute("label"), ""]);
|
||||
context.completions = Array.filter(menu.childNodes, n => n.hasAttribute("label"))
|
||||
.map(n => [n.getAttribute("label"), ""]);
|
||||
};
|
||||
},
|
||||
events: function initEvents(dactyl, modules, window) {
|
||||
@@ -226,7 +226,7 @@ var Config = Module("config", ConfigBase, {
|
||||
mappings.add([modes.NORMAL],
|
||||
["<Return>", "<Up>", "<Down>"],
|
||||
"Handled by " + config.host,
|
||||
function () Events.PASS_THROUGH);
|
||||
() => Events.PASS_THROUGH);
|
||||
},
|
||||
options: function initOptions(dactyl, modules, window) {
|
||||
modules.options.add(["online"],
|
||||
|
||||
@@ -73,7 +73,7 @@ var Addressbook = Module("addressbook", {
|
||||
// Now we have to create a new message
|
||||
let args = {};
|
||||
args.to = addresses.map(
|
||||
function (address) "\"" + address[0].replace(/"/g, "") + " <" + address[1] + ">\""
|
||||
address => "\"" + address[0].replace(/"/g, "") + " <" + address[1] + ">\""
|
||||
).join(", ");
|
||||
|
||||
mail.composeNewMail(args);
|
||||
|
||||
@@ -11,7 +11,7 @@ var Config = Module("config", ConfigBase, {
|
||||
init.superapply(this, arguments);
|
||||
|
||||
if (!("content" in modules))
|
||||
modules.__defineGetter__("content", function () window.content);
|
||||
modules.__defineGetter__("content", () => window.content);
|
||||
|
||||
util.overlayWindow(window, { append: <><hbox id="statusTextBox" flex=""/></> });
|
||||
},
|
||||
|
||||
+19
-19
@@ -431,7 +431,7 @@ var Mail = Module("mail", {
|
||||
addresses = addresses.concat(mailargs.cc);
|
||||
|
||||
// TODO: is there a better way to check for validity?
|
||||
if (addresses.some(function (recipient) !(/\S@\S+\.\S/.test(recipient))))
|
||||
if (addresses.some(recipient => !(/\S@\S+\.\S/.test(recipient))))
|
||||
return void dactyl.echoerr(_("command.mail.invalidEmailAddress"));
|
||||
|
||||
mail.composeNewMail(mailargs);
|
||||
@@ -472,7 +472,7 @@ var Mail = Module("mail", {
|
||||
|
||||
commands.add(["get[messages]"],
|
||||
"Check for new messages",
|
||||
function (args) mail.getNewMessages(!args.bang),
|
||||
function (args) { mail.getNewMessages(!args.bang); },
|
||||
{
|
||||
argCount: "0",
|
||||
bang: true,
|
||||
@@ -483,7 +483,7 @@ var Mail = Module("mail", {
|
||||
let folders = mail.getFolders(context.filter);
|
||||
context.anchored = false;
|
||||
context.quote = false;
|
||||
context.completions = folders.map(function (folder)
|
||||
context.completions = folders.map(folder =>
|
||||
[folder.server.prettyName + ": " + folder.name,
|
||||
"Unread: " + folder.getNumUnread(false)]);
|
||||
};
|
||||
@@ -506,7 +506,7 @@ var Mail = Module("mail", {
|
||||
|
||||
mappings.add(myModes, ["<Space>"],
|
||||
"Scroll message or select next unread one",
|
||||
function () Events.PASS);
|
||||
() => Events.PASS);
|
||||
|
||||
mappings.add(myModes, ["t"],
|
||||
"Select thread",
|
||||
@@ -518,39 +518,39 @@ var Mail = Module("mail", {
|
||||
|
||||
mappings.add(myModes, ["j", "<Right>"],
|
||||
"Select next message",
|
||||
function ({ count }) { mail.selectMessage(function (msg) true, false, false, false, count); },
|
||||
function ({ count }) { mail.selectMessage(msg => true, false, false, false, count); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["gj"],
|
||||
"Select next message, including closed threads",
|
||||
function ({ count }) { mail.selectMessage(function (msg) true, false, true, false, count); },
|
||||
function ({ count }) { mail.selectMessage(msg => true, false, true, false, count); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["J", "<Tab>"],
|
||||
"Select next unread message",
|
||||
function ({ count }) { mail.selectMessage(function (msg) !msg.isRead, true, true, false, count); },
|
||||
function ({ count }) { mail.selectMessage(msg => !msg.isRead, true, true, false, count); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["k", "<Left>"],
|
||||
"Select previous message",
|
||||
function ({ count }) { mail.selectMessage(function (msg) true, false, false, true, count); },
|
||||
function ({ count }) { mail.selectMessage(msg => true, false, false, true, count); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["gk"],
|
||||
"Select previous message",
|
||||
function ({ count }) { mail.selectMessage(function (msg) true, false, true, true, count); },
|
||||
function ({ count }) { mail.selectMessage(msg => true, false, true, true, count); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["K"],
|
||||
"Select previous unread message",
|
||||
function ({ count }) { mail.selectMessage(function (msg) !msg.isRead, true, true, true, count); },
|
||||
function ({ count }) { mail.selectMessage(msg => !msg.isRead, true, true, true, count); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["*"],
|
||||
"Select next message from the same sender",
|
||||
function ({ count }) {
|
||||
let author = gDBView.hdrForFirstSelectedMessage.mime2DecodedAuthor.toLowerCase();
|
||||
mail.selectMessage(function (msg) msg.mime2DecodedAuthor.toLowerCase().indexOf(author) == 0, true, true, false, count);
|
||||
mail.selectMessage(msg => msg.mime2DecodedAuthor.toLowerCase().indexOf(author) == 0, true, true, false, count);
|
||||
},
|
||||
{ count: true });
|
||||
|
||||
@@ -558,7 +558,7 @@ var Mail = Module("mail", {
|
||||
"Select previous message from the same sender",
|
||||
function ({ count }) {
|
||||
let author = gDBView.hdrForFirstSelectedMessage.mime2DecodedAuthor.toLowerCase();
|
||||
mail.selectMessage(function (msg) msg.mime2DecodedAuthor.toLowerCase().indexOf(author) == 0, true, true, true, count);
|
||||
mail.selectMessage(msg => msg.mime2DecodedAuthor.toLowerCase().indexOf(author) == 0, true, true, true, count);
|
||||
},
|
||||
{ count: true });
|
||||
|
||||
@@ -603,12 +603,12 @@ var Mail = Module("mail", {
|
||||
|
||||
mappings.add([modes.MESSAGE], ["<Left>"],
|
||||
"Select previous message",
|
||||
function ({ count }) { mail.selectMessage(function (msg) true, false, false, true, count); },
|
||||
function ({ count }) { mail.selectMessage(msg => true, false, false, true, count); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add([modes.MESSAGE], ["<Right>"],
|
||||
"Select next message",
|
||||
function ({ count }) { mail.selectMessage(function (msg) true, false, false, false, count); },
|
||||
function ({ count }) { mail.selectMessage(msg => true, false, false, false, count); },
|
||||
{ count: true });
|
||||
|
||||
// UNDO/REDO
|
||||
@@ -657,22 +657,22 @@ var Mail = Module("mail", {
|
||||
|
||||
mappings.add(myModes, ["]s"],
|
||||
"Select next starred message",
|
||||
function ({ count }) { mail.selectMessage(function (msg) msg.isFlagged, true, true, false, count); },
|
||||
function ({ count }) { mail.selectMessage(msg => msg.isFlagged, true, true, false, count); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["[s"],
|
||||
"Select previous starred message",
|
||||
function ({ count }) { mail.selectMessage(function (msg) msg.isFlagged, true, true, true, count); },
|
||||
function ({ count }) { mail.selectMessage(msg => msg.isFlagged, true, true, true, count); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["]a"],
|
||||
"Select next message with an attachment",
|
||||
function ({ count }) { mail.selectMessage(function (msg) gDBView.db.HasAttachments(msg.messageKey), true, true, false, count); },
|
||||
function ({ count }) { mail.selectMessage(msg => gDBView.db.HasAttachments(msg.messageKey), true, true, false, count); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(myModes, ["[a"],
|
||||
"Select previous message with an attachment",
|
||||
function ({ count }) { mail.selectMessage(function (msg) gDBView.db.HasAttachments(msg.messageKey), true, true, true, count); },
|
||||
function ({ count }) { mail.selectMessage(msg => gDBView.db.HasAttachments(msg.messageKey), true, true, true, count); },
|
||||
{ count: true });
|
||||
|
||||
// FOLDER SWITCHING
|
||||
@@ -907,7 +907,7 @@ var Mail = Module("mail", {
|
||||
{
|
||||
getter: function () services.smtp.defaultServer.key,
|
||||
setter: function (value) {
|
||||
let server = mail.smtpServers.filter(function (s) s.key == value)[0];
|
||||
let server = mail.smtpServers.filter(s => s.key == value)[0];
|
||||
services.smtp.defaultServer = server;
|
||||
return value;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user