summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKris Maglione <maglione.k@gmail.com>2013-09-21 14:13:07 -0700
committerKris Maglione <maglione.k@gmail.com>2013-09-21 14:13:07 -0700
commit25aae2cc9963675f5570267a51fbac61305685f0 (patch)
treecfcb678016163a5b2a06bb009b7272db02c56f21
parent2d90804d5ff78b4362227c45768c11f7953a7ba2 (diff)
downloadpentadactyl-25aae2cc9963675f5570267a51fbac61305685f0.tar.gz
More pointification and general code cleanup. Also massive, crazy, conflict-ridden merge.
-rw-r--r--common/content/abbreviations.js11
-rw-r--r--common/content/autocommands.js2
-rw-r--r--common/content/bookmarks.js11
-rw-r--r--common/content/browser.js6
-rw-r--r--common/content/commandline.js28
-rw-r--r--common/content/dactyl.js32
-rw-r--r--common/content/editor.js22
-rw-r--r--common/content/events.js15
-rw-r--r--common/content/hints.js13
-rw-r--r--common/content/history.js12
-rw-r--r--common/content/key-processors.js4
-rw-r--r--common/content/mappings.js26
-rw-r--r--common/content/marks.js4
-rw-r--r--common/content/modes.js30
-rw-r--r--common/content/mow.js2
-rw-r--r--common/content/quickmarks.js2
-rw-r--r--common/content/statusline.js4
-rw-r--r--common/content/tabs.js18
-rw-r--r--common/modules/addons.jsm16
-rw-r--r--common/modules/base.jsm8
-rw-r--r--common/modules/bookmarkcache.jsm2
-rw-r--r--common/modules/buffer.jsm16
-rw-r--r--common/modules/cache.jsm4
-rw-r--r--common/modules/commands.jsm16
-rw-r--r--common/modules/completion.jsm2
-rw-r--r--common/modules/config.jsm8
-rw-r--r--common/modules/contexts.jsm15
-rw-r--r--common/modules/dom.jsm20
-rw-r--r--common/modules/downloads.jsm24
-rw-r--r--common/modules/finder.jsm8
-rw-r--r--common/modules/help.jsm6
-rw-r--r--common/modules/highlight.jsm15
-rw-r--r--common/modules/io.jsm18
-rw-r--r--common/modules/javascript.jsm9
-rw-r--r--common/modules/main.jsm7
-rw-r--r--common/modules/messages.jsm2
-rw-r--r--common/modules/options.jsm30
-rw-r--r--common/modules/overlay.jsm6
-rw-r--r--common/modules/prefs.jsm8
-rw-r--r--common/modules/sanitizer.jsm9
-rw-r--r--common/modules/services.jsm3
-rw-r--r--common/modules/storage.jsm15
-rw-r--r--common/modules/styles.jsm34
-rw-r--r--common/modules/util.jsm37
44 files changed, 350 insertions, 230 deletions
diff --git a/common/content/abbreviations.js b/common/content/abbreviations.js
index 0ddb625a..f0cd06d1 100644
--- a/common/content/abbreviations.js
+++ b/common/content/abbreviations.js
@@ -1,6 +1,6 @@
// Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2010 by anekos <anekos@snca.net>
-// Copyright (c) 2010-2012 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2010-2013 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -80,7 +80,8 @@ var Abbreviation = Class("Abbreviation", {
* @param {Mode} mode The mode to remove.
*/
removeMode: function (mode) {
- this.modes = this.modes.filter(m => m != mode).sort();
+ this.modes = this.modes.filter(m => m != mode)
+ .sort();
},
/**
@@ -248,7 +249,8 @@ var Abbreviations = Module("abbreviations", {
match: function (mode, text) {
let match = this._match.exec(text);
if (match)
- return this.hives.map(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;
},
@@ -302,7 +304,8 @@ var Abbreviations = Module("abbreviations", {
completion: function initCompletion() {
completion.abbreviation = function abbreviation(context, modes, group) {
group = group || abbreviations.user;
- let fn = modes ? ab => ab.inModes(modes) : util.identity;
+ let fn = modes ? abbr => abbr.inModes(modes)
+ : abbr => abbr;
context.keys = { text: "lhs" , description: "rhs" };
context.completions = group.merged.filter(fn);
};
diff --git a/common/content/autocommands.js b/common/content/autocommands.js
index 889f063f..582337ce 100644
--- a/common/content/autocommands.js
+++ b/common/content/autocommands.js
@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
diff --git a/common/content/bookmarks.js b/common/content/bookmarks.js
index f7fab5bd..a95cc23e 100644
--- a/common/content/bookmarks.js
+++ b/common/content/bookmarks.js
@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -408,7 +408,10 @@ var Bookmarks = Module("bookmarks", {
names: ["-tags", "-T"],
description: "A comma-separated list of tags",
completer: function tags(context, args) {
- context.generate = () => array(b.tags for (b in bookmarkcache) if (b.tags)).flatten().uniq().array;
+ context.generate = function () 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 +550,9 @@ 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(item => item.item.id));
+
+ deletedCount = bookmarks.remove(context.allItems.items
+ .map(item => item.item.id));
}
dactyl.echomsg({ message: _("bookmark.deleted", deletedCount) });
diff --git a/common/content/browser.js b/common/content/browser.js
index b1d7e02b..95c1fd4a 100644
--- a/common/content/browser.js
+++ b/common/content/browser.js
@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -193,8 +193,8 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
function (args) { dactyl.open(args[0] || "about:blank"); },
{
completer: function (context) completion.url(context),
- domains: function (args) array.compact(dactyl.parseURLs(args[0] || "").map(
- url => util.getHost(url))),
+ domains: function (args) array.compact(dactyl.parseURLs(args[0] || "")
+ .map(url => util.getHost(url))),
literal: 0,
privateData: true
});
diff --git a/common/content/commandline.js b/common/content/commandline.js
index 8269208c..e2252be2 100644
--- a/common/content/commandline.js
+++ b/common/content/commandline.js
@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -217,7 +217,8 @@ var CommandWidgets = Class("CommandWidgets", {
let elem = nodeSet[obj.name];
if (elem)
highlight.highlightNode(elem, obj.defaultGroup.split(/\s/)
- .map(g => g + " " + nodeSet.group + g).join(" "));
+ .map(g => g + " " + nodeSet.group + g)
+ .join(" "));
});
}
},
@@ -254,7 +255,9 @@ var CommandWidgets = Class("CommandWidgets", {
function check(node) {
if (DOM(node).style.display === "-moz-stack") {
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" });
+ nodes.forEach((node, i) => {
+ node.style.opacity = (i == nodes.length - 1) ? "" : "0";
+ });
}
Array.forEach(node.children, check);
}
@@ -309,7 +312,8 @@ var CommandWidgets = Class("CommandWidgets", {
return document.getElementById("dactyl-contextmenu");
}),
- multilineOutput: Class.Memoize(function () this._whenReady("dactyl-multiline-output", function (elem) {
+ multilineOutput: Class.Memoize(function () this._whenReady("dactyl-multiline-output",
+ elem => {
highlight.highlightNode(elem.contentDocument.body, "MOW");
}), true),
@@ -1708,7 +1712,7 @@ var CommandLine = Module("commandline", {
commands.add(["sil[ent]"],
"Run a command silently",
function (args) {
- commandline.runSilently(() => commands.execute(args[0] || "", null, true));
+ commandline.runSilently(() => { commands.execute(args[0] || "", null, true); });
}, {
completer: function (context) completion.ex(context),
literal: 0,
@@ -1908,16 +1912,20 @@ var CommandLine = Module("commandline", {
!(timespan.contains(item.timestamp) && (host ? commands.hasDomain(item.value, host)
: item.privateData))));
- commandline._messageHistory.filter(item => !timespan.contains(item.timestamp * 1000) ||
- !item.domains && !item.privateData ||
- host && (!item.domains || !item.domains.some(d => util.isSubdomain(d, host))));
+ commandline._messageHistory.filter(item =>
+ ( !timespan.contains(item.timestamp * 1000)
+ || !item.domains && !item.privateData
+ || host && ( !item.domains
+ || !item.domains.some(d => util.isSubdomain(d, host)))));
}
});
sanitizer.addItem("messages", {
description: "Saved :messages",
action: function (timespan, host) {
- commandline._messageHistory.filter(item => !timespan.contains(item.timestamp * 1000) ||
- host && (!item.domains || !item.domains.some(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)))));
}
});
}
diff --git a/common/content/dactyl.js b/common/content/dactyl.js
index 34ecfc31..d5938625 100644
--- a/common/content/dactyl.js
+++ b/common/content/dactyl.js
@@ -677,7 +677,8 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
];
}
else if (obj instanceof Map) {
- spec = map => obj.count ? [["oa", {}, "count"], map] : DOM.DOMString(map);
+ spec = map => (obj.count ? [["oa", {}, "count"], map]
+ : DOM.DOMString(map));
tag = map => [
let (c = obj.modes[0].char) c ? c + "_" : "",
map
@@ -720,7 +721,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
let (name = (obj.specs || obj.names)[0])
spec(template.highlightRegexp(tag(name),
/\[(.*?)\]/g,
- function (m, n0) ["oa", {}, n0]),
+ (m, n0) => ["oa", {}, n0]),
name)],
!obj.type ? "" : [
["type", {}, obj.type],
@@ -745,7 +746,9 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
[o.description,
o.names.length == 1 ? "" :
["", " (short name: ",
- template.map(o.names.slice(1), n => ["em", {}, n], ", "),
+ template.map(o.names.slice(1),
+ n => ["em", {}, n],
+ ", "),
")"]]
]));
@@ -1191,7 +1194,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
return function wrappedCallback() {
let args = arguments;
return dactyl.withSavedValues(save, function () {
- saved.forEach((p, i) => dactyl[save[i]] = p);
+ saved.forEach((p, i) => { dactyl[save[i]] = p; });
try {
return callback.apply(self, args);
}
@@ -1225,8 +1228,9 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
let lang = config.bestLocale(l[1].lang for each (l in langs));
info = info.slice(0, 2).concat(
- info.slice(2).filter(e => !isArray(e) || !isObject(e[1])
- || e[1].lang == lang));
+ info.slice(2).filter(e => !isArray(e)
+ || !isObject(e[1])
+ || e[1].lang == lang));
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"]))
@@ -1342,8 +1346,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
setter: function (opts) {
let dir = ["horizontal", "vertical"].filter(
dir => !Array.some(opts,
- o => this.opts[o] && this.opts[o][1] == dir)
- );
+ o => this.opts[o] && this.opts[o][1] == dir));
let class_ = dir.map(dir => "html|html > xul|scrollbar[orient=" + dir + "]");
styles.system.add("scrollbar", "*",
@@ -1391,7 +1394,8 @@ 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(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))
@@ -1399,8 +1403,8 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
events.checkFocus();
return value;
},
- validator: function (val) Option.validateCompleter.call(this, val) &&
- groups.every(g => !g.validator || g.validator(val))
+ validator: function (val) Option.validateCompleter.call(this, val)
+ && groups.every(g => !g.validator || g.validator(val))
});
options.add(["loadplugins", "lpl"],
@@ -1449,7 +1453,8 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
options.add(["verbose", "vbs"],
"Define which info messages are displayed",
"number", 1,
- { validator: function (value) Option.validIf(value >= 0 && value <= 15, "Value must be between 0 and 15") });
+ { validator: function (value) Option.validIf(value >= 0 && value <= 15,
+ "Value must be between 0 and 15") });
options.add(["visualbell", "vb"],
"Use visual bell instead of beeping on errors",
@@ -1860,7 +1865,8 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
completion.window = function window(context) {
context.title = ["Window", "Title"];
- context.keys = { text: function (win) dactyl.windows.indexOf(win) + 1, description: function (win) win.document.title };
+ context.keys = { text: win => dactyl.windows.indexOf(win) + 1,
+ description: win => win.document.title };
context.completions = dactyl.windows;
};
},
diff --git a/common/content/editor.js b/common/content/editor.js
index 8a36df01..d98fa950 100644
--- a/common/content/editor.js
+++ b/common/content/editor.js
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2011 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k at Gmail>
// Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
//
// This work is licensed for reuse under an MIT license. Details are
@@ -304,7 +304,9 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
// Skip to any requested offset.
count = Math.abs(offset);
- Editor.extendRange(range, offset > 0, { test: function (c) !!count-- }, true);
+ Editor.extendRange(range, offset > 0,
+ { test: c => !!count-- },
+ true);
range.collapse(offset < 0);
return range;
@@ -400,7 +402,9 @@ 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, e => DOM.stringify(e, true)).join("");
+ text = Array.map(editor_.rootElement.childNodes,
+ e => DOM.stringify(e, true))
+ .join("");
if (!editor_.selection.rangeCount)
var sel = "";
@@ -1316,7 +1320,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
var range = editor.selectedRange;
if (range.collapsed) {
count = count || 1;
- Editor.extendRange(range, true, { test: function (c) !!count-- }, true);
+ Editor.extendRange(range, true, { test: c => !!count-- }, true);
}
editor.mungeRange(range, munger, count != null);
@@ -1349,9 +1353,12 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
"The external text editor",
"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(fmt => fmt.valid(obj))
+ let args = commands.parseArgs(value || this.value,
+ { argCount: "*", allowUnknownOptions: true })
+ .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 +1366,8 @@ 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(k => ["column", "file", "line"].indexOf(k) >= 0);
+ return Object.keys(util.compileMacro(value).seen)
+ .every(k => ["column", "file", "line"].indexOf(k) >= 0);
}
});
diff --git a/common/content/events.js b/common/content/events.js
index e588894f..d86610ea 100644
--- a/common/content/events.js
+++ b/common/content/events.js
@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -465,7 +465,8 @@ var Events = Module("events", {
let accel = config.OS.isMacOSX ? "metaKey" : "ctrlKey";
let access = iter({ 1: "shiftKey", 2: "ctrlKey", 4: "altKey", 8: "metaKey" })
- .filter(function ([k, v]) this & k, prefs.get("ui.key.chromeAccess"))
+ .filter(function ([k, v]) this & k,
+ prefs.get("ui.key.chromeAccess"))
.map(([k, v]) => [v, true])
.toObject();
@@ -492,7 +493,7 @@ var Events = Module("events", {
break;
}
- if (iter(needed).every(([k, v]) => v == keys[k]))
+ if (iter(needed).every(([k, v]) => (v == keys[k])))
return key;
}
@@ -542,7 +543,8 @@ var Events = Module("events", {
dactyl.echo(_("macro.loadWaiting"), commandline.FORCE_SINGLELINE);
const maxWaitTime = (time || 25);
- util.waitFor(function () buffer.loaded, this, maxWaitTime * 1000, true);
+ util.waitFor(() => buffer.loaded, this,
+ maxWaitTime * 1000, true);
dactyl.echo("", commandline.FORCE_SINGLELINE);
if (!buffer.loaded)
@@ -797,8 +799,9 @@ var Events = Module("events", {
&& let (key = DOM.Event.stringify(event))
!(modes.main.count && /^\d$/.test(key) ||
modes.main.allBases.some(
- mode => mappings.hives.some(
- 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 + " " +
diff --git a/common/content/hints.js b/common/content/hints.js
index f510e856..f9ad6fbb 100644
--- a/common/content/hints.js
+++ b/common/content/hints.js
@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -300,7 +300,9 @@ var HintSession = Class("HintSession", CommandMode, {
return false;
if (!rect.width || !rect.height)
- if (!Array.some(elem.childNodes, 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;
@@ -1111,7 +1113,9 @@ var Hints = Module("hints", {
isVisible: function isVisible(elem, offScreen) {
let rect = elem.getBoundingClientRect();
if (!rect.width || !rect.height)
- if (!Array.some(elem.childNodes, 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;
@@ -1368,7 +1372,8 @@ 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((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"],
diff --git a/common/content/history.js b/common/content/history.js
index b3d62550..d17fd8bd 100644
--- a/common/content/history.js
+++ b/common/content/history.js
@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -209,7 +209,9 @@ var History = Module("history", {
context.compare = CompletionContext.Sort.unsorted;
context.filters = [CompletionContext.Filter.textDescription];
context.completions = sh.slice(0, sh.index).reverse();
- context.keys = { text: function (item) (sh.index - item.index) + ": " + item.URI.spec, description: "title", icon: "icon" };
+ context.keys = { text: function (item) (sh.index - item.index) + ": " + item.URI.spec,
+ description: "title",
+ icon: "icon" };
},
count: true,
literal: 0,
@@ -249,7 +251,9 @@ var History = Module("history", {
context.compare = CompletionContext.Sort.unsorted;
context.filters = [CompletionContext.Filter.textDescription];
context.completions = sh.slice(sh.index + 1);
- context.keys = { text: function (item) (item.index - sh.index) + ": " + item.URI.spec, description: "title", icon: "icon" };
+ context.keys = { text: function (item) (item.index - sh.index) + ": " + item.URI.spec,
+ description: "title",
+ icon: "icon" };
},
count: true,
literal: 0,
@@ -305,7 +309,7 @@ var History = Module("history", {
jumps = [sh[sh.index]];
else {
index += jumps.index;
- jumps = jumps.locations.map(function (l) ({
+ jumps = jumps.locations.map(l => ({
__proto__: l,
title: buffer.title,
get URI() util.newURI(this.location)
diff --git a/common/content/key-processors.js b/common/content/key-processors.js
index 2a34e668..21875f65 100644
--- a/common/content/key-processors.js
+++ b/common/content/key-processors.js
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -77,7 +77,7 @@ var ProcessorStack = Class("ProcessorStack", {
if (this.ownsBuffer)
statusline.inputBuffer = this.processors.length ? this.buffer : "";
- if (!this.processors.some(function (p) !p.extended) && this.actions.length) {
+ if (!this.processors.some(p => !p.extended) && this.actions.length) {
// We have matching actions and no processors other than
// those waiting on further arguments. Execute actions as
// long as they continue to return PASS.
diff --git a/common/content/mappings.js b/common/content/mappings.js
index d1c60f7b..a71e2865 100644
--- a/common/content/mappings.js
+++ b/common/content/mappings.js
@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -48,9 +48,10 @@ var Map = Class("Map", {
name: Class.Memoize(function () this.names[0]),
/** @property {[string]} All of this mapping's names (key sequences). */
- names: Class.Memoize(function () this._keys.map(function (k) DOM.Event.canonicalKeys(k))),
+ names: Class.Memoize(function () this._keys.map(k => DOM.Event.canonicalKeys(k))),
- get toStringParams() [this.modes.map(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("."),
@@ -116,7 +117,7 @@ var Map = Class("Map", {
execute: function (args) {
if (!isObject(args)) // Backwards compatibility :(
args = iter(["motion", "count", "arg", "command"])
- .map(function ([i, prop]) [prop, this[i]], arguments)
+ .map(([i, prop]) => [prop, this[i]], arguments)
.toObject();
args = this.hive.makeArgs(this.hive.group.lastDocument,
@@ -172,7 +173,7 @@ var MapHive = Class("MapHive", Contexts.Hive, {
iterate: function (modes) {
let stacks = Array.concat(modes).map(this.closure.getStack);
return values(stacks.shift().sort((m1, m2) => String.localeCompare(m1.name, m2.name))
- .filter(map => map.rhs &&
+ .filter((map) => map.rhs &&
stacks.every(stack => stack.some(m => m.rhs && m.rhs === map.rhs && m.name === map.name))));
},
@@ -360,7 +361,9 @@ var Mappings = Module("mappings", {
let list = Array.map("CASM", s => s + "-");
return iter(util.range(0, 1 << list.length)).map(mask =>
- list.filter((p, i) => mask & (1 << i)).join("")).toArray().concat("*-");
+ list.filter((p, i) => mask & (1 << i)).join(""))
+ .toArray()
+ .concat("*-");
}),
expand: function expand(keys) {
@@ -442,7 +445,8 @@ var Mappings = Module("mappings", {
* @param {string} cmd The map name to match.
* @returns {Map}
*/
- get: function get(mode, cmd) this.hives.map(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
@@ -454,7 +458,7 @@ var Mappings = Module("mappings", {
*/
getCandidates: function (mode, prefix)
this.hives.map(h => h.getCandidates(mode, prefix))
- .reduce((a, b) => a + b, 0),
+ .reduce((a, b) => (a + b), 0),
/**
* Lists all user-defined mappings matching *filter* for the specified
@@ -813,7 +817,8 @@ var Mappings = Module("mappings", {
completion.userMapping = function userMapping(context, modes_, hive) {
hive = hive || mappings.user;
modes_ = modes_ || [modes.NORMAL];
- context.keys = { text: function (m) m.names[0], description: function (m) m.description + ": " + m.action };
+ context.keys = { text: function (m) m.names[0],
+ description: function (m) m.description + ": " + m.action };
context.completions = hive.iterate(modes_);
};
},
@@ -821,7 +826,8 @@ var Mappings = Module("mappings", {
JavaScript.setCompleter([Mappings.prototype.get, MapHive.prototype.get],
[
null,
- function (context, obj, args) [[m.names, m.description] for (m in this.iterate(args[0]))]
+ function (context, obj, args) [[m.names, m.description]
+ for (m in this.iterate(args[0]))]
]);
},
mappings: function initMappings(dactyl, modules, window) {
diff --git a/common/content/marks.js b/common/content/marks.js
index c7329595..caae980b 100644
--- a/common/content/marks.js
+++ b/common/content/marks.js
@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -260,7 +260,7 @@ var Marks = Module("marks", {
if (filter.length > 0) {
let pattern = util.charListToRegexp(filter, "a-zA-Z");
- marks = marks.filter(([k, ]) => pattern.test(k));
+ marks = marks.filter(([k]) => (pattern.test(k)));
dactyl.assert(marks.length > 0, _("mark.noMatching", filter.quote()));
}
diff --git a/common/content/modes.js b/common/content/modes.js
index 401df031..e5d4a9d3 100644
--- a/common/content/modes.js
+++ b/common/content/modes.js
@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -277,7 +277,7 @@ var Modes = Module("modes", {
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)) {
+ else if (this.stack.some(m => m.main == mode)) {
this.pop(mode);
this.pop();
}
@@ -361,7 +361,9 @@ var Modes = Module("modes", {
push ? { push: push } : stack || {},
prev);
- delayed.forEach(([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();
@@ -425,8 +427,8 @@ var Modes = Module("modes", {
Mode: Class("Mode", {
init: function init(name, options, params) {
if (options.bases)
- util.assert(options.bases.every(function (m) m instanceof this, this.constructor),
- _("mode.invalidBases"), false);
+ util.assert(options.bases.every(m => m instanceof this.constructor),
+ _("mode.invalidBases"), false);
this.update({
id: 1 << Modes.Mode._id++,
@@ -492,7 +494,8 @@ var Modes = Module("modes", {
get toStringParams() !loaded.modes ? this.main.name : [
this.main.name,
["(", modes.all.filter(m => this.extended & m)
- .map(m => m.name).join("|"),
+ .map(m => m.name)
+ .join("|"),
")"].join("")
]
});
@@ -608,16 +611,19 @@ var Modes = Module("modes", {
setter: function (vals) {
modes.all.forEach(function (m) { delete m.passUnknown; });
- vals = vals.map(function (v) update(new String(v.toLowerCase()), {
- mode: v.replace(/^!/, "").toUpperCase(),
- result: v[0] !== "!"
- }));
+ vals = vals.map(v => update(new String(v.toLowerCase()),
+ {
+ mode: v.replace(/^!/, "").toUpperCase(),
+ result: v[0] !== "!"
+ }));
- this.valueMap = values(vals).map(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(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)])
};
diff --git a/common/content/mow.js b/common/content/mow.js
index 6945a4d2..ae67ab42 100644
--- a/common/content/mow.js
+++ b/common/content/mow.js
@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
diff --git a/common/content/quickmarks.js b/common/content/quickmarks.js
index 534d71cc..0fc4dc3d 100644
--- a/common/content/quickmarks.js
+++ b/common/content/quickmarks.js
@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
diff --git a/common/content/statusline.js b/common/content/statusline.js
index f5460b37..5a99f2c1 100644
--- a/common/content/statusline.js
+++ b/common/content/statusline.js
@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -330,7 +330,7 @@ var StatusLine = Module("statusline", {
updateTabCount: function updateTabCount(delayed) {
if (dactyl.has("tabs")) {
if (delayed) {
- this.timeout(function () this.updateTabCount(false), 0);
+ this.timeout(() => { this.updateTabCount(false); }, 0);
return;
}
diff --git a/common/content/tabs.js b/common/content/tabs.js
index 1a9b6c75..81c99c52 100644
--- a/common/content/tabs.js
+++ b/common/content/tabs.js
@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -244,7 +244,7 @@ var Tabs = Module("tabs", {
this._groups = iframe ? iframe.contentWindow : null;
if (this._groups && !func)
- util.waitFor(function () this._groups.TabItems, this);
+ util.waitFor(() => this._groups.TabItems);
return this._groups;
},
@@ -426,9 +426,13 @@ var Tabs = Module("tabs", {
}
if (focusLeftTab)
- tabs.slice(Math.max(0, index + 1 - count), index + 1).forEach(config.closure.removeTab);
+ tabs.slice(Math.max(0, index + 1 - count),
+ index + 1)
+ .forEach(config.closure.removeTab);
else
- tabs.slice(index, index + count).forEach(config.closure.removeTab);
+ tabs.slice(index,
+ index + count)
+ .forEach(config.closure.removeTab);
return res;
},
@@ -548,7 +552,7 @@ var Tabs = Module("tabs", {
if (matches)
return tabs.select(this.allTabs[parseInt(matches[1], 10) - 1], false);
- matches = array.nth(tabs.allTabs, function (t) (t.linkedBrowser.lastURI || {}).spec === buffer, 0);
+ matches = array.nth(tabs.allTabs, t => (t.linkedBrowser.lastURI || {}).spec === buffer, 0);
if (matches)
return tabs.select(matches, false);
@@ -992,7 +996,9 @@ var Tabs = Module("tabs", {
context.anchored = false;
context.compare = CompletionContext.Sort.unsorted;
context.filters = [CompletionContext.Filter.textDescription];
- context.keys = { text: function ([i, { state: s }]) (i + 1) + ": " + s.entries[s.index - 1].url, description: "[1].title", icon: "[1].image" };
+ context.keys = { text: function ([i, { state: s }]) (i + 1) + ": " + s.entries[s.index - 1].url,
+ description: "[1].title",
+ icon: "[1].image" };
context.completions = Iterator(tabs.closedTabs);
},
count: true,
diff --git a/common/modules/addons.jsm b/common/modules/addons.jsm
index e4acf203..fb1e5961 100644
--- a/common/modules/addons.jsm
+++ b/common/modules/addons.jsm
@@ -1,4 +1,4 @@
-// Copyright (c) 2009-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2009-2013 Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2009-2010 by Doug Kearns <dougkearns@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
@@ -64,7 +64,7 @@ var updateAddons = Class("UpgradeListener", AddonListener, {
install.install();
},
onUpdateFinished: function (addon, error) {
- this.remaining = this.remaining.filter(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
@@ -118,8 +118,10 @@ var actions = {
});
},
get filter() {
- return addon => !addon.userDisabled &&
- !(addon.operationsRequiringRestart & (AddonManager.OP_NEEDS_RESTART_ENABLE | AddonManager.OP_NEEDS_RESTART_DISABLE));
+ return addon => (
+ !addon.userDisabled &&
+ !(addon.operationsRequiringRestart & (AddonManager.OP_NEEDS_RESTART_ENABLE
+ | AddonManager.OP_NEEDS_RESTART_DISABLE)));
},
perm: "disable"
},
@@ -420,7 +422,7 @@ var Addons = Module("addons", {
AddonManager.getAddonsByTypes(args["-types"], dactyl.wrapCallback(function (list) {
if (!args.bang || command.bang) {
- list = list.filter(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,7 +431,7 @@ var Addons = Module("addons", {
if (command.actions)
command.actions(list, this.modules);
else
- list.forEach(addon => command.action.call(this.modules, addon, args.bang));
+ list.forEach(addon => { command.action.call(this.modules, addon, args.bang) });
}));
}, {
argCount: "?", // FIXME: should be "1"
@@ -475,7 +477,7 @@ var Addons = Module("addons", {
context.title = ["Add-on"];
context.anchored = false;
context.keys = {
- text: function (addon) [addon.name, addon.id],
+ text: addon => [addon.name, addon.id],
description: "description",
icon: "iconURL"
};
diff --git a/common/modules/base.jsm b/common/modules/base.jsm
index 57284e34..14805265 100644
--- a/common/modules/base.jsm
+++ b/common/modules/base.jsm
@@ -929,14 +929,14 @@ Class.prototype = {
return callback.call(self || this);
}
finally {
- names.forEach((name, i) => this[name] = vals[i]);
+ names.forEach((name, i) => { this[name] = vals[i]; });
}
},
toString: function C_toString() {
if (this.toStringParams)
- var params = "(" + this.toStringParams.map(m => isArray(m) ? "[" + m + "]" :
- isString(m) ? m.quote() : String(m))
+ var params = "(" + this.toStringParams.map(m => (isArray(m) ? "[" + m + "]" :
+ isString(m) ? m.quote() : String(m)))
.join(", ") + ")";
return "[instance " + this.constructor.className + (params || "") + "]";
},
@@ -1172,7 +1172,7 @@ Module.INIT = {
module.isLocalModule = true;
modules.jsmodules[this.constructor.className] = module;
- locals.reverse().forEach((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;
diff --git a/common/modules/bookmarkcache.jsm b/common/modules/bookmarkcache.jsm
index 2261b214..03161894 100644
--- a/common/modules/bookmarkcache.jsm
+++ b/common/modules/bookmarkcache.jsm
@@ -1,4 +1,4 @@
-// Copyright ©2008-2010 Kris Maglione <maglione.k at Gmail>
+// Copyright ©2008-2013 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
diff --git a/common/modules/buffer.jsm b/common/modules/buffer.jsm
index 43aaa885..c2087ab3 100644
--- a/common/modules/buffer.jsm
+++ b/common/modules/buffer.jsm
@@ -435,7 +435,9 @@ var Buffer = Module("Buffer", {
yield elem;
function a(regexp, elem) regexp.test(elem.textContent) === regexp.result ||
- Array.some(elem.childNodes, 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);
@@ -904,8 +906,11 @@ var Buffer = Module("Buffer", {
let path = options["jumptags"][arg];
util.assert(path, _("error.invalidArgument", arg));
- let distance = reverse ? rect => -rect.top : rect => rect.top;
- let elems = [[e, distance(e.getBoundingClientRect())] for (e in path.matcher(this.focusedFrame.document))]
+ let distance = reverse ? rect => -rect.top
+ : rect => rect.top;
+
+ let elems = [[e, distance(e.getBoundingClientRect())]
+ for (e in path.matcher(this.focusedFrame.document))]
.filter(e => e[1] > FUDGE)
.sort((a, b) => a[1] - b[1]);
@@ -1003,7 +1008,7 @@ var Buffer = Module("Buffer", {
let info = template.map(
(sections || options["pageinfo"])
.map((opt) => Buffer.pageInfo[opt].action.call(this)),
- res => res && iter(res).join(", ") || undefined,
+ res => (res && iter(res).join(", ") || undefined),
", ").join("");
if (bookmarkcache.isBookmarked(this.URL))
@@ -2413,7 +2418,8 @@ var Buffer = Module("Buffer", {
var res = dactyl.userEval("(" + Option.dequote(filter.result.substr(5)) + ")")(doc, line);
else
res = iter.nth(filter.matcher(doc),
- 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)
diff --git a/common/modules/cache.jsm b/common/modules/cache.jsm
index 907109a1..3f8e2f1c 100644
--- a/common/modules/cache.jsm
+++ b/common/modules/cache.jsm
@@ -1,4 +1,4 @@
-// Copyright (c) 2011-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2011-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -167,7 +167,7 @@ var Cache = Module("Cache", XPCOM(Ci.nsIRequestObserver), {
},
force: function force(name, localOnly) {
- util.waitFor(function () !this.inQueue, this);
+ util.waitFor(() => !this.inQueue);
if (this.cacheReader && this.cacheReader.hasEntry(name)) {
return this.parse(File.readStream(
diff --git a/common/modules/commands.jsm b/common/modules/commands.jsm
index 61c8700a..87a71ba7 100644
--- a/common/modules/commands.jsm
+++ b/common/modules/commands.jsm
@@ -766,7 +766,8 @@ var Commands = Module("commands", {
// TODO: allow matching of aliases?
function cmds(hive) hive._list.filter(cmd => cmd.name.indexOf(filter || "") == 0)
- let hives = (hives || this.userHives).map(h => [h, cmds(h)]).filter(([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" },
@@ -815,7 +816,8 @@ var Commands = Module("commands", {
/** @property {Iterator(Command)} @private */
iterator: function iterator() iter.apply(null, this.hives.array)
- .sort((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. */
@@ -1016,7 +1018,7 @@ var Commands = Module("commands", {
let matchOpts = function matchOpts(arg) {
// Push possible option matches into completions
if (complete && !onlyArgumentsRemaining)
- completeOpts = options.filter(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;
@@ -1394,7 +1396,8 @@ var Commands = Module("commands", {
let quote = null;
let len = str.length;
- function fixEscapes(str) str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4}|(.))/g, (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))
@@ -1725,7 +1728,7 @@ var Commands = Module("commands", {
]
})),
iterateIndex: function (args) let (tags = help.tags)
- this.iterate(args).filter(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 +1782,8 @@ 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, $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;
};
diff --git a/common/modules/completion.jsm b/common/modules/completion.jsm
index 6c41e8f8..1aa27c46 100644
--- a/common/modules/completion.jsm
+++ b/common/modules/completion.jsm
@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
diff --git a/common/modules/config.jsm b/common/modules/config.jsm
index 7ee08211..d009e1a4 100644
--- a/common/modules/config.jsm
+++ b/common/modules/config.jsm
@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -152,8 +152,10 @@ var ConfigBase = Class("ConfigBase", {
loadStyles: function loadStyles(force) {
highlight.styleableChrome = this.styleableChrome;
- highlight.loadCSS(this.CSS.replace(/__MSG_(.*?)__/g, (m0, m1) => _(m1)));
- highlight.loadCSS(this.helpCSS.replace(/__MSG_(.*?)__/g, (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(/*
diff --git a/common/modules/contexts.jsm b/common/modules/contexts.jsm
index 104fa199..fe71dea8 100644
--- a/common/modules/contexts.jsm
+++ b/common/modules/contexts.jsm
@@ -1,4 +1,4 @@
-// Copyright (c) 2010-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2010-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -78,8 +78,9 @@ var Group = Class("Group", {
toJSONXML: function (modules) let (uri = modules && modules.buffer.uri)
template.map(this.filters,
- function (f) ["span", { highlight: uri && f(uri) ? "Filter" : "" },
- "toJSONXML" in f ? f.toJSONXML() : String(f)],
+ f => ["span", { highlight: uri && f(uri) ? "Filter" : "" },
+ ("toJSONXML" in f ? f.toJSONXML()
+ : String(f))],
","),
filters: Option.parse.sitelist(patterns)
@@ -201,9 +202,9 @@ var Contexts = Module("contexts", {
Context: function Context(file, group, args) {
const { contexts, io, newContext, plugins, userContext } = this.modules;
- let isPlugin = array.nth(io.getRuntimeDirectories("plugins"),
- dir => dir.contains(file, true),
- 0);
+ let isPlugin = array.nth(io.getRuntimeDirectories("plugins"),
+ dir => dir.contains(file, true),
+ 0);
let isRuntime = array.nth(io.getRuntimeDirectories(""),
dir => dir.contains(file, true),
0);
@@ -795,7 +796,7 @@ var Contexts = Module("contexts", {
context.title = ["Group"];
let uri = modules.buffer.uri;
context.keys = {
- active: function (group) group.filter(uri),
+ active: group => group.filter(uri),
text: "name",
description: function (g) ["", g.filter.toJSONXML ? g.filter.toJSONXML(modules).concat("\u00a0") : "", g.description || ""]
};
diff --git a/common/modules/dom.jsm b/common/modules/dom.jsm
index 3fdbd77d..2d16c4ca 100644
--- a/common/modules/dom.jsm
+++ b/common/modules/dom.jsm
@@ -1,5 +1,5 @@
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -108,7 +108,7 @@ var DOM = Class("DOM", {
}]
]),
- matcher: function matcher(sel) 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();
@@ -794,19 +794,19 @@ var DOM = Class("DOM", {
html: function html(txt, self) {
return this.getSet(arguments,
elem => elem.innerHTML,
- util.wrapCallback(function (elem, val) { elem.innerHTML = val; }));
+ util.wrapCallback((elem, val) => { elem.innerHTML = val; }));
},
text: function text(txt, self) {
return this.getSet(arguments,
elem => elem.textContent,
- function (elem, val) { elem.textContent = val; });
+ (elem, val) => { elem.textContent = val; });
},
val: function val(txt) {
return this.getSet(arguments,
elem => elem.value,
- function (elem, val) { elem.value = val == null ? "" : val; });
+ (elem, val) => { elem.value = val == null ? "" : val; });
},
listen: function listen(event, listener, capture) {
@@ -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(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(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) {
@@ -1878,7 +1878,9 @@ var DOM = Class("DOM", {
*/
makeXPath: function makeXPath(nodes) {
return array(nodes).map(util.debrace).flatten()
- .map(node => /^[a-z]+:/.test(node) ? node : [node, "xhtml:" + node]).flatten()
+ .map(node => /^[a-z]+:/.test(node) ? node
+ : [node, "xhtml:" + node])
+ .flatten()
.map(node => "//" + node).join(" | ");
},
@@ -1891,7 +1893,7 @@ var DOM = Class("DOM", {
},
namespaceNames: Class.Memoize(function ()
- iter(this.namespaces).map(([k, v]) => [v, k]).toObject()),
+ iter(this.namespaces).map(([k, v]) => ([v, k])).toObject()),
});
Object.keys(DOM.Event.types).forEach(function (event) {
diff --git a/common/modules/downloads.jsm b/common/modules/downloads.jsm
index b742b566..cbcd9a6e 100644
--- a/common/modules/downloads.jsm
+++ b/common/modules/downloads.jsm
@@ -1,4 +1,4 @@
-// Copyright (c) 2011-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2011-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -131,14 +131,14 @@ var Download = Class("Download", {
},
_compare: {
- active: function (a, b) a.alive - b.alive,
- complete: function (a, b) a.percentComplete - b.percentComplete,
- date: function (a, b) a.startTime - b.startTime,
- filename: function (a, b) String.localeCompare(a.targetFile.leafName, b.targetFile.leafName),
- size: function (a, b) a.size - b.size,
- speed: function (a, b) a.speed - b.speed,
- time: function (a, b) a.timeRemaining - b.timeRemaining,
- url: function (a, b) String.localeCompare(a.source.spec, b.source.spec)
+ active: (a, b) => a.alive - b.alive,
+ complete: (a, b) => a.percentComplete - b.percentComplete,
+ date: (a, b) => a.startTime - b.startTime,
+ filename: (a, b) => String.localeCompare(a.targetFile.leafName, b.targetFile.leafName),
+ size: (a, b) => a.size - b.size,
+ speed: (a, b) => a.speed - b.speed,
+ time: (a, b) => a.timeRemaining - b.timeRemaining,
+ url: (a, b) => String.localeCompare(a.source.spec, b.source.spec)
},
compare: function compare(other) values(this.list.sortOrder).map(function (order) {
@@ -497,13 +497,13 @@ var Downloads = Module("downloads", XPCOM(Ci.nsIDownloadProgressListener), {
.flatten().array;
},
- has: function () Array.some(arguments, function (val) this.value.some(v => v.substr(1) == val)),
+ has: function () Array.some(arguments, val => this.value.some(v => v.substr(1) == val)),
validator: function (value) {
let seen = {};
return value.every(val => /^[+-]/.test(val) && Set.has(this.values, val.substr(1))
- && !Set.add(seen, val.substr(1))
- ) && value.length;
+ && !Set.add(seen, val.substr(1)))
+ && value.length;
}
});
}
diff --git a/common/modules/finder.jsm b/common/modules/finder.jsm
index 5631878e..3ae39696 100644
--- a/common/modules/finder.jsm
+++ b/common/modules/finder.jsm
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -104,7 +104,7 @@ var RangeFinder = Module("rangefinder", {
return "";
}
- this.options["findflags"].forEach(function (f) { replacer(f, f); });
+ this.options["findflags"].forEach(f => replacer(f, f));
let pattern = str.replace(/\\(.|$)/g, replacer);
@@ -542,7 +542,7 @@ var RangeFind = Class("RangeFind", {
}
}
finally {
- saved.forEach(function ([k, v]) { this[k] = v; }, this);
+ saved.forEach(([k, v]) => { this[k] = v; });
}
},
@@ -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(range => { range.save(); });
this.forward = null;
this.found = false;
},
diff --git a/common/modules/help.jsm b/common/modules/help.jsm
index abfe1ab9..ca85ecf1 100644
--- a/common/modules/help.jsm
+++ b/common/modules/help.jsm
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -367,8 +367,8 @@ var Help = Module("Help", {
for (let [file, ] in Iterator(help.files)) {
let url = "dactyl://help/" + file;
dactyl.open(url);
- util.waitFor(() => content.location.href == url && buffer.loaded
- && content.document.documentElement instanceof Ci.nsIDOMHTMLHtmlElement,
+ util.waitFor(() => (content.location.href == url && buffer.loaded &&
+ content.document.documentElement instanceof Ci.nsIDOMHTMLHtmlElement),
15000);
events.waitForPageLoad();
var data = [
diff --git a/common/modules/highlight.jsm b/common/modules/highlight.jsm
index 9316bf79..e25b7cc1 100644
--- a/common/modules/highlight.jsm
+++ b/common/modules/highlight.jsm
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -282,8 +282,8 @@ var Highlights = Module("Highlight", {
*/
loadCSS: function loadCSS(css, eager) {
String.replace(css, /\\\n/g, "")
- .replace(this.groupRegexp, (m, m1, m2) => m1 + " " + m2.replace(/\n\s*/g, " "))
- .split("\n").filter(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);
@@ -354,7 +354,7 @@ var Highlights = Module("Highlight", {
["span", { style: "text-align: center; line-height: 1em;" + h.value + style }, "XXX"],
template.map(h.extends, s => template.highlight(s), ","),
template.highlightRegexp(h.value, /\b[-\w]+(?=:)|\/\*.*?\*\//g,
- function (match) ["span", { highlight: match[0] == "/" ? "Comment" : "Key" }, match])
+ match => ["span", { highlight: match[0] == "/" ? "Comment" : "Key" }, match])
]
for (h in highlight)
if (!key || h.class.indexOf(key) > -1))));
@@ -424,12 +424,13 @@ var Highlights = Module("Highlight", {
let extRe = RegExp("\\." + config.fileExtension + "$");
context.title = ["Color Scheme", "Runtime Path"];
- context.keys = { text: function (f) f.leafName.replace(extRe, ""), description: ".parent.path" };
+ context.keys = { text: f => f.leafName.replace(extRe, ""),
+ description: ".parent.path" };
context.completions =
array.flatten(
io.getRuntimeDirectories("colors").map(
- dir => dir.readDirectory().filter(
- file => extRe.test(file.leafName))))
+ dir => dir.readDirectory()
+ .filter(file => extRe.test(file.leafName))))
.concat([
{ leafName: "default", parent: { path: /*L*/"Revert to builtin colorscheme" } }
]);
diff --git a/common/modules/io.jsm b/common/modules/io.jsm
index e3b67513..8aeb66b4 100644
--- a/common/modules/io.jsm
+++ b/common/modules/io.jsm
@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2012 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k@gmail.com>
// Some code based on Venkman
//
// This work is licensed for reuse under an MIT license. Details are
@@ -75,7 +75,7 @@ var IO = Module("io", {
getRuntimeDirectories: function getRuntimeDirectories(name) {
return modules.options.get("runtimepath").files
.map(dir => dir.child(name))
- .filter(dir => dir.exists() && dir.isDirectory() && dir.isReadable());
+ .filter(dir => (dir.exists() && dir.isDirectory() && dir.isReadable()));
},
// FIXME: multiple paths?
@@ -502,7 +502,9 @@ var IO = Module("io", {
function async(status) {
let output = stdout.read();
- [stdin, stdout, cmd].forEach(f => f.exists() && f.remove(false));
+ for (let f of [stdin, stdout, cmd])
+ if (f.exists())
+ f.remove(false);
callback(result(status, output));
}
@@ -550,7 +552,7 @@ var IO = Module("io", {
}
finally {
if (!checked || res !== true)
- args.forEach(f => f.remove(false));
+ args.forEach(f => { f.remove(false); });
}
return res;
}
@@ -806,7 +808,9 @@ unlet s:cpo_save
lines.last.push(item, sep);
}
lines.last.pop();
- return lines.map(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,8 +908,8 @@ unlet s:cpo_save
_("command.run.noPrevious"));
arg = arg.replace(/(\\)*!/g,
- m => /^\\(\\\\)*!$/.test(m) ? m.replace("\\!", "!") : m.replace("!", io._lastRunCommand)
- );
+ m => (/^\\(\\\\)*!$/.test(m) ? m.replace("\\!", "!")
+ : m.replace("!", io._lastRunCommand)));
}
io._lastRunCommand = arg;
diff --git a/common/modules/javascript.jsm b/common/modules/javascript.jsm
index 15c30b8b..3565efda 100644
--- a/common/modules/javascript.jsm
+++ b/common/modules/javascript.jsm
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -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(idx => idx >= start && idx < end);
+ let res = this._function(idx => (idx >= start && idx < end));
if (!res || this.context.tabPressed || key in this.cache.evalled)
return false;
this.context.waitingForTab = true;
@@ -371,7 +371,8 @@ var JavaScript = Module("javascript", {
};
base.keys = {
- text: prefix ? text => text.substr(prefix.length) : util.identity,
+ text: prefix ? text => text.substr(prefix.length)
+ : text => text,
description: function (item) self.getKey(this.obj, item),
key: function (item) {
if (!isNaN(key))
@@ -491,7 +492,7 @@ var JavaScript = Module("javascript", {
let [, prefix, args] = /^(function .*?)\((.*?)\)/.exec(Function.prototype.toString.call(func));
let n = this._get(i).comma.length;
args = template.map(Iterator(args.split(", ")),
- function ([i, arg]) ["span", { highlight: i == n ? "Filter" : "" }, arg],
+ ([i, arg]) => ["span", { highlight: i == n ? "Filter" : "" }, arg],
",\u00a0");
this.context.message = ["", prefix + "(", args, ")"];
}
diff --git a/common/modules/main.jsm b/common/modules/main.jsm
index 8e4dd011..19e36b46 100644
--- a/common/modules/main.jsm
+++ b/common/modules/main.jsm
@@ -151,7 +151,7 @@ var Modules = function Modules(window) {
Object.getOwnPropertyNames(this)
.map(name => Object.getOwnPropertyDescriptor(this, name).value)),
- get moduleList() this.ownPropertyValues.filter(mod => mod instanceof this.ModuleBase || mod.isLocalModule)
+ get moduleList() this.ownPropertyValues.filter(mod => (mod instanceof this.ModuleBase || mod.isLocalModule))
});
modules.plugins = create(modules);
@@ -161,7 +161,8 @@ var Modules = function Modules(window) {
config.loadStyles();
-overlay.overlayWindow(Object.keys(config.overlays), function _overlay(window) ({
+overlay.overlayWindow(Object.keys(config.overlays),
+ function _overlay(window) ({
ready: function onInit(document) {
const modules = Modules(window);
modules.moduleManager = this;
@@ -179,7 +180,7 @@ overlay.overlayWindow(Object.keys(config.overlays), function _overlay(window) ({
});
config.modules.window
- .forEach(name => defineModule.time("load", name, modules.load, modules, name));
+ .forEach(name => { defineModule.time("load", name, modules.load, modules, name); });
}, this);
},
diff --git a/common/modules/messages.jsm b/common/modules/messages.jsm
index c092a59a..5c9045a4 100644
--- a/common/modules/messages.jsm
+++ b/common/modules/messages.jsm
@@ -1,4 +1,4 @@
-// Copyright (c) 2011-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2011-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
diff --git a/common/modules/options.jsm b/common/modules/options.jsm
index 766e206d..03bb06ef 100644
--- a/common/modules/options.jsm
+++ b/common/modules/options.jsm
@@ -75,7 +75,7 @@ var Option = Class("Option", {
get helpTag() "'" + this.name + "'",
initValue: function initValue() {
- util.trapErrors(() => this.value = this.value, this);
+ util.trapErrors(() => { this.value = this.value; });
},
get isDefault() this.stringValue === this.stringDefaultValue,
@@ -464,7 +464,8 @@ var Option = Class("Option", {
let [, bang, filter] = /^(!?)(.*)/.exec(pattern);
filter = Option.dequote(filter).trim();
- let quote = this.keepQuotes ? util.identity : function (v) Option.quote(v, /:/);
+ let quote = this.keepQuotes ? v => v
+ : v => Option.quote(v, /:/);
return update(Styles.matchFilter(filter), {
bang: bang,
@@ -731,7 +732,7 @@ var Option = Class("Option", {
acceptable = completions.call(this);
if (isArray(acceptable))
- acceptable = Set(acceptable.map(([k]) => k));
+ acceptable = Set(acceptable.map(([k]) => (k)));
if (this.type === "regexpmap" || this.type === "sitemap")
return Array.concat(vals).every(re => Set.has(acceptable, re.result));
@@ -927,7 +928,9 @@ var Options = Module("options", {
let closure = () => this._optionMap[name];
- memoize(this._optionMap, name, () => Option.types[type](modules, names, description, defaultValue, extraInfo));
+ memoize(this._optionMap, name,
+ function () Option.types[type](modules, names, description, defaultValue, extraInfo));
+
for (let alias in values(names.slice(1)))
memoize(this._optionMap, alias, closure);
@@ -1098,9 +1101,11 @@ var Options = Module("options", {
let names = Set(list.map(opt => opt.option ? opt.option.name : ""));
if (list.length)
if (list.some(opt => opt.all))
- options.list(opt => !(list[0].onlyNonDefault && opt.isDefault), list[0].scope);
+ options.list(opt => !(list[0].onlyNonDefault && opt.isDefault),
+ list[0].scope);
else
- options.list(opt => Set.has(names, opt.name), list[0].scope);
+ options.list(opt => Set.has(names, opt.name),
+ list[0].scope);
list = [];
}
@@ -1229,8 +1234,12 @@ var Options = Module("options", {
context.highlight();
if (context.filter.indexOf("=") == -1) {
if (false && prefix)
- context.filters.push(({ item }) => item.type == "boolean" || prefix == "inv" && isArray(item.values));
- return completion.option(context, opt.scope, opt.name == "inv" ? opt.name : prefix);
+ context.filters.push(({ item }) => (item.type == "boolean" ||
+ prefix == "inv" && isArray(item.values)));
+
+ return completion.option(context, opt.scope,
+ opt.name == "inv" ? opt.name
+ : prefix);
}
function error(length, message) {
@@ -1484,7 +1493,8 @@ var Options = Module("options", {
function val(obj) {
if (isArray(opt.defaultValue)) {
- let val = array.nth(obj, 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 +1506,7 @@ var Options = Module("options", {
context.completions = [
[val(opt.value), _("option.currentValue")],
[val(opt.defaultValue), _("option.defaultValue")]
- ].filter(f => f[0] !== "" && f[0] != null);
+ ].filter(f => (f[0] !== "" && f[0] != null));
});
context = context.fork("stuff", 0);
}
diff --git a/common/modules/overlay.jsm b/common/modules/overlay.jsm
index fa8d598a..c52ba4ad 100644
--- a/common/modules/overlay.jsm
+++ b/common/modules/overlay.jsm
@@ -1,4 +1,4 @@
-// Copyright (c) 2009-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2009-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -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(f => { f.call(this); });
this.onWindowVisible = null;
}
},
@@ -189,7 +189,7 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
return data[key] = val;
},
- overlayWindow: function (url, fn) {
+ overlayWindow: function overlayWindow(url, fn) {
if (url instanceof Ci.nsIDOMWindow)
overlay._loadOverlay(url, fn);
else {
diff --git a/common/modules/prefs.jsm b/common/modules/prefs.jsm
index 68f3380b..47fec508 100644
--- a/common/modules/prefs.jsm
+++ b/common/modules/prefs.jsm
@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -375,7 +375,8 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
if (!this._observers[pref])
this._observers[pref] = [];
- this._observers[pref].push(!strong ? util.weakReference(callback) : { get: function () callback });
+ this._observers[pref].push(!strong ? util.weakReference(callback)
+ : { get: function () callback });
},
/**
@@ -422,7 +423,8 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
modules.completion.preference = function preference(context) {
context.anchored = false;
context.title = [config.host + " Preference", "Value"];
- context.keys = { text: function (item) item, description: function (item) prefs.get(item) };
+ context.keys = { text: function (item) item,
+ description: function (item) prefs.get(item) };
context.completions = prefs.getNames();
};
},
diff --git a/common/modules/sanitizer.jsm b/common/modules/sanitizer.jsm
index cbdaa600..2db1dfe5 100644
--- a/common/modules/sanitizer.jsm
+++ b/common/modules/sanitizer.jsm
@@ -1,5 +1,5 @@
// Copyright (c) 2009 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2009-2012 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2009-2013 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -186,7 +186,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
let (branch = Item.PREFIX + Item.SHUTDOWN_BRANCH) {
overlay.overlayWindow("chrome://browser/content/preferences/sanitize.xul",
- function (win) prefOverlay(branch, true, {
+ function (win) prefOverlay(branch, true, {
append: {
SanitizeDialogPane:
["groupbox", { orient: "horizontal", xmlns: "xul" },
@@ -612,11 +612,12 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
},
has: function has(val)
- let (res = array.nth(this.value, 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(val => val === "all" || Set.has(sanitizer.itemMap, val.replace(/^!/, "")))
+ values.every(val => (val === "all" || Set.has(sanitizer.itemMap, val.replace(/^!/, ""))))
});
options.add(["sanitizeshutdown", "ss"],
diff --git a/common/modules/services.jsm b/common/modules/services.jsm
index e7e1ae25..afc7c911 100644
--- a/common/modules/services.jsm
+++ b/common/modules/services.jsm
@@ -126,7 +126,8 @@ var Services = Module("Services", {
if (!service.interfaces.length)
return res.wrappedJSObject || res;
- service.interfaces.forEach(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);
diff --git a/common/modules/storage.jsm b/common/modules/storage.jsm
index cafcef0e..6cc704f0 100644
--- a/common/modules/storage.jsm
+++ b/common/modules/storage.jsm
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -293,7 +293,8 @@ var Storage = Module("Storage", {
this.observers[key] = [];
if (!this.observers[key].some(o => o.callback.get() == callback))
- this.observers[key].push({ ref: ref && Cu.getWeakReference(ref), callback: callbackRef });
+ this.observers[key].push({ ref: ref && Cu.getWeakReference(ref),
+ callback: callbackRef });
},
removeObserver: function (key, callback) {
@@ -495,7 +496,8 @@ var File = Class("File", {
let array = [e for (e in this.iterDirectory())];
if (sort)
- array.sort((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;
},
@@ -693,10 +695,9 @@ var File = Class("File", {
// Kris reckons we shouldn't replicate this 'bug'. --djk
// TODO: should we be doing this for all paths?
function expand(path) path.replace(
- !win32 ? /\$(\w+)\b|\${(\w+)}/g
- : /\$(\w+)\b|\${(\w+)}|%(\w+)%/g,
- (m, n1, n2, n3) => getenv(n1 || n2 || n3) || m
- );
+ win32 ? /\$(\w+)\b|\${(\w+)}|%(\w+)%/g
+ : /\$(\w+)\b|\${(\w+)}/g,
+ (m, n1, n2, n3) => (getenv(n1 || n2 || n3) || m));
path = expand(path);
// expand ~
diff --git a/common/modules/styles.jsm b/common/modules/styles.jsm
index 1ce745c5..fc466c7f 100644
--- a/common/modules/styles.jsm
+++ b/common/modules/styles.jsm
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -36,7 +36,7 @@ Sheet.liveProperty("sites");
update(Sheet.prototype, {
formatSites: function (uris)
template.map(this.sites,
- function (filter) ["span", { highlight: uris.some(Styles.matchFilter(filter)) ? "Filter" : "" }, filter],
+ filter => ["span", { highlight: uris.some(Styles.matchFilter(filter)) ? "Filter" : "" }, filter],
","),
remove: function () { this.hive.remove(this); },
@@ -102,7 +102,8 @@ var Hive = Class("Hive", {
this.dropRef(null);
},
dropRef: function (obj) {
- this.refs = this.refs.filter(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(h => h !== this);
@@ -116,7 +117,9 @@ var Hive = Class("Hive", {
__iterator__: function () Iterator(this.sheets),
- get sites() array(this.sheets).map(s => s.sites).flatten().uniq().array,
+ get sites() array(this.sheets).map(s => s.sites)
+ .flatten()
+ .uniq().array,
/**
* Add a new style sheet.
@@ -189,6 +192,7 @@ var Hive = Class("Hive", {
matches = matches.filter(i => this.sheets[i].css == css);
if (filter)
matches = matches.filter(i => this.sheets[i].sites.indexOf(filter) >= 0);
+
return matches.map(i => this.sheets[i]);
},
@@ -273,7 +277,8 @@ var Styles = Module("Styles", {
},
addHive: function addHive(name, ref, persist) {
- let hive = array.nth(this.hives, 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,14 +309,14 @@ var Styles = Module("Styles", {
list: function list(content, sites, name, hives) {
const { commandline, dactyl } = this.modules;
- hives = hives || styles.hives.filter(h => h.modifiable && h.sheets.length);
+ hives = hives || styles.hives.filter(h => (h.modifiable && h.sheets.length));
function sheets(group)
group.sheets.slice()
- .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);
+ .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);
@@ -622,7 +627,8 @@ var Styles = Module("Styles", {
.filter(hive => hive.persist)
.map(hive =>
hive.sheets.filter(style => style.persist)
- .sort((a, b) => String.localeCompare(a.name || "", b.name || ""))
+ .sort((a, b) => String.localeCompare(a.name || "",
+ b.name || ""))
.map(style => ({
command: "style",
arguments: [style.sites.join(",")],
@@ -716,7 +722,8 @@ var Styles = Module("Styles", {
const names = Array.slice(DOM(["div"], window.document).style);
modules.completion.css = function (context) {
context.title = ["CSS Property"];
- context.keys = { text: function (p) p + ":", description: function () "" };
+ context.keys = { text: function (p) p + ":",
+ description: function () "" };
for (let match in Styles.propertyIter(context.filter, true))
var lastMatch = match;
@@ -749,7 +756,8 @@ var Styles = Module("Styles", {
if (match.function)
return ["", template.filter(match.word),
template.highlightRegexp(match.function, patterns.string,
- function (match) ["span", { highlight: "String" }, match.string])
+ match => ["span", { highlight: "String" },
+ match.string])
];
if (match.important == "!important")
return ["span", { highlight: "String" }, match.important];
diff --git a/common/modules/util.jsm b/common/modules/util.jsm
index eeb77943..bf4396a7 100644
--- a/common/modules/util.jsm
+++ b/common/modules/util.jsm
@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -185,7 +185,8 @@ 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, (m, m1) => m1.toUpperCase()),
+ camelCase: function camelCase(name) String.replace(name, /-(.)/g,
+ (m, m1) => m1.toUpperCase()),
/**
* Capitalizes the first character of the given string.
@@ -261,8 +262,10 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
function frame() update(
function _frame(obj)
- _frame === stack.top || _frame.valid(obj) ?
- _frame.elements.map(e => callable(e) ? e(obj) : e).join("") : "",
+ _frame === stack.top || _frame.valid(obj)
+ ? _frame.elements.map(e => callable(e) ? e(obj) : e)
+ .join("")
+ : "",
{
elements: [],
seen: {},
@@ -295,7 +298,8 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
char = char.toLowerCase();
stack.top.elements.push(update(
- obj => obj[char] != null ? quote(obj, char) : "",
+ function (obj) obj[char] != null ? quote(obj, char)
+ : "",
{ test: function test(obj) obj[char] != null }));
for (let elem in array.iterValues(stack))
@@ -344,12 +348,14 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
function frame() update(
function _frame(obj)
- _frame === stack.top || _frame.valid(obj) ?
- _frame.elements.map(e => callable(e) ? e(obj) : e).join("") : "",
+ _frame === stack.top || _frame.valid(obj)
+ ? _frame.elements.map(e => callable(e) ? e(obj) : e)
+ .join("")
+ : "",
{
elements: [],
seen: {},
- valid: function valid(obj) this.elements.every(e => !e.test || e.test(obj))
+ valid: function valid(obj) this.elements.every(e => (!e.test || e.test(obj)))
});
let defaults = { lt: "<", gt: ">" };
@@ -999,7 +1005,9 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
if (color) {
obj = template.highlightFilter(util.clip(obj, 150), "\n",
- function () ["span", { highlight: "NonText" }, "^J"]);
+ () => ["span", { highlight: "NonText" },
+ "^J"]);
+
var head = ["span", { highlight: "Title Object" }, obj, "::\n"];
}
else
@@ -1066,7 +1074,9 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
return String.localeCompare(a[0], b[0]);
}
- let vals = template.map(keys.sort(compare), 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];
}
@@ -1252,7 +1262,8 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
// Strip comments and white space.
if (/x/.test(flags))
- expr = String.replace(expr, /(\\.)|\/\/[^\n]*|\/\*[^]*?\*\/|\s+/gm, (m, m1) => m1 || "");
+ expr = String.replace(expr, /(\\.)|\/\/[^\n]*|\/\*[^]*?\*\/|\s+/gm,
+ (m, m1) => m1 || "");
// Replace (?P<named> parameters)
if (/\(\?P</.test(expr)) {
@@ -1296,7 +1307,9 @@ 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, (m0, m1) => m1 === "/" ? "/" : m0),
+ getSource: function regexp_getSource(re) re.source.replace(/\\(.)/g,
+ (m0, m1) => m1 === "/" ? m1
+ : m0),
/**
* Iterates over all matches of the given regexp in the given