mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 18:37:58 +01:00
Replace expression closures (function expressions).
Expression closures are to be axed. See https://bugzil.la/1083458.
This commit is contained in:
2
common/bootstrap.js
vendored
2
common/bootstrap.js
vendored
@@ -357,7 +357,7 @@ function startup(data, reason) {
|
|||||||
addonData = data;
|
addonData = data;
|
||||||
addon = data;
|
addon = data;
|
||||||
name = data.id.replace(/@.*/, "");
|
name = data.id.replace(/@.*/, "");
|
||||||
AddonManager.getAddonByID(addon.id, function (a) {
|
AddonManager.getAddonByID(addon.id, a => {
|
||||||
addon = a;
|
addon = a;
|
||||||
|
|
||||||
updateVersion();
|
updateVersion();
|
||||||
|
|||||||
@@ -432,10 +432,10 @@ var Bookmarks = Module("bookmarks", {
|
|||||||
names: ["-tags", "-T"],
|
names: ["-tags", "-T"],
|
||||||
description: "A comma-separated list of tags",
|
description: "A comma-separated list of tags",
|
||||||
completer: function tags(context) {
|
completer: function tags(context) {
|
||||||
context.generate = function () Ary(b.tags
|
context.generate = () => Ary(b.tags
|
||||||
for (b of bookmarkcache)
|
for (b of bookmarkcache)
|
||||||
if (b.tags))
|
if (b.tags))
|
||||||
.flatten().uniq().array;
|
.flatten().uniq().array;
|
||||||
context.keys = { text: util.identity, description: util.identity };
|
context.keys = { text: util.identity, description: util.identity };
|
||||||
},
|
},
|
||||||
type: CommandOption.LIST
|
type: CommandOption.LIST
|
||||||
@@ -561,7 +561,7 @@ var Bookmarks = Module("bookmarks", {
|
|||||||
function (args) {
|
function (args) {
|
||||||
if (args.bang)
|
if (args.bang)
|
||||||
commandline.input(_("bookmark.prompt.deleteAll") + " ").then(
|
commandline.input(_("bookmark.prompt.deleteAll") + " ").then(
|
||||||
function (resp) {
|
resp => {
|
||||||
if (resp && resp.match(/^y(es)?$/i)) {
|
if (resp && resp.match(/^y(es)?$/i)) {
|
||||||
bookmarks.remove(Object.keys(bookmarkcache.bookmarks));
|
bookmarks.remove(Object.keys(bookmarkcache.bookmarks));
|
||||||
dactyl.echomsg(_("bookmark.allDeleted"));
|
dactyl.echomsg(_("bookmark.allDeleted"));
|
||||||
@@ -680,12 +680,12 @@ var Bookmarks = Module("bookmarks", {
|
|||||||
|
|
||||||
let item = keywords[keyword];
|
let item = keywords[keyword];
|
||||||
if (item && item.url.contains("%s"))
|
if (item && item.url.contains("%s"))
|
||||||
context.fork("keyword/" + keyword, keyword.length + space.length, null, function (context) {
|
context.fork("keyword/" + keyword, keyword.length + space.length, null, context => {
|
||||||
context.format = history.format;
|
context.format = history.format;
|
||||||
context.title = [/*L*/keyword + " Quick Search"];
|
context.title = [/*L*/keyword + " Quick Search"];
|
||||||
context.keys = { text: "url", description: "title", icon: "icon" };
|
context.keys = { text: "url", description: "title", icon: "icon" };
|
||||||
context.compare = CompletionContext.Sort.unsorted;
|
context.compare = CompletionContext.Sort.unsorted;
|
||||||
context.generate = function () {
|
context.generate = () => {
|
||||||
let [begin, end] = item.url.split("%s");
|
let [begin, end] = item.url.split("%s");
|
||||||
|
|
||||||
let seen = new RealSet;
|
let seen = new RealSet;
|
||||||
|
|||||||
@@ -271,8 +271,8 @@ var CommandWidgets = Class("CommandWidgets", {
|
|||||||
|
|
||||||
active: Class.Memoize(Object),
|
active: Class.Memoize(Object),
|
||||||
activeGroup: Class.Memoize(Object),
|
activeGroup: Class.Memoize(Object),
|
||||||
commandbar: Class.Memoize(function () ({ group: "Cmd" })),
|
commandbar: Class.Memoize(() => ({ group: "Cmd" })),
|
||||||
statusbar: Class.Memoize(function () ({ group: "Status" })),
|
statusbar: Class.Memoize(() => ({ group: "Status" })),
|
||||||
|
|
||||||
_ready: function _ready(elem) {
|
_ready: function _ready(elem) {
|
||||||
return elem.contentDocument.documentURI === elem.getAttribute("src") &&
|
return elem.contentDocument.documentURI === elem.getAttribute("src") &&
|
||||||
@@ -505,7 +505,7 @@ var CommandLine = Module("commandline", {
|
|||||||
init: function init() {
|
init: function init() {
|
||||||
this._callbacks = {};
|
this._callbacks = {};
|
||||||
|
|
||||||
memoize(this, "_store", function () storage.newMap("command-history", { store: true, privateData: true }));
|
memoize(this, "_store", () => storage.newMap("command-history", { store: true, privateData: true }));
|
||||||
|
|
||||||
for (let name of ["command", "search"])
|
for (let name of ["command", "search"])
|
||||||
if (storage.exists("history-" + name)) {
|
if (storage.exists("history-" + name)) {
|
||||||
@@ -778,7 +778,7 @@ var CommandLine = Module("commandline", {
|
|||||||
|
|
||||||
highlightGroup = highlightGroup || this.HL_NORMAL;
|
highlightGroup = highlightGroup || this.HL_NORMAL;
|
||||||
|
|
||||||
let appendToMessages = (data) => {
|
let appendToMessages = data => {
|
||||||
let message = isObject(data) && !DOM.isJSONXML(data) ? data : { message: data };
|
let message = isObject(data) && !DOM.isJSONXML(data) ? data : { message: data };
|
||||||
|
|
||||||
// Make sure the memoized message property is an instance property.
|
// Make sure the memoized message property is an instance property.
|
||||||
@@ -1797,7 +1797,7 @@ var CommandLine = Module("commandline", {
|
|||||||
self.completions.tabTimer.flush();
|
self.completions.tabTimer.flush();
|
||||||
|
|
||||||
self.accepted = true;
|
self.accepted = true;
|
||||||
return function () { modes.pop(); };
|
return () => { modes.pop(); };
|
||||||
});
|
});
|
||||||
|
|
||||||
[
|
[
|
||||||
@@ -2347,7 +2347,7 @@ var ItemList = Class("ItemList", {
|
|||||||
var scrollY = this.win.scrollY + rect.bottom - this.win.innerHeight;
|
var scrollY = this.win.scrollY + rect.bottom - this.win.innerHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
return function () {
|
return () => {
|
||||||
container.style.height = height + "px";
|
container.style.height = height + "px";
|
||||||
container.scrollTop = scroll;
|
container.scrollTop = scroll;
|
||||||
if (scrollY != null)
|
if (scrollY != null)
|
||||||
|
|||||||
@@ -26,9 +26,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
this._observers = {};
|
this._observers = {};
|
||||||
util.addObserver(this);
|
util.addObserver(this);
|
||||||
|
|
||||||
this.commands["dactyl.restart"] = function (event) {
|
this.commands["dactyl.restart"] = event => { dactyl.restart(); };
|
||||||
dactyl.restart();
|
|
||||||
};
|
|
||||||
|
|
||||||
styles.registerSheet("resource://dactyl-skin/dactyl.css");
|
styles.registerSheet("resource://dactyl-skin/dactyl.css");
|
||||||
|
|
||||||
@@ -852,7 +850,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
if (dactyl.commands[command])
|
if (dactyl.commands[command])
|
||||||
dactyl.withSavedValues(["forceTarget"], function () {
|
dactyl.withSavedValues(["forceTarget"], () => {
|
||||||
if (event.ctrlKey || event.shiftKey || event.button == 1)
|
if (event.ctrlKey || event.shiftKey || event.button == 1)
|
||||||
dactyl.forceTarget = dactyl.NEW_TAB;
|
dactyl.forceTarget = dactyl.NEW_TAB;
|
||||||
dactyl.commands[command](event);
|
dactyl.commands[command](event);
|
||||||
@@ -1199,7 +1197,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
let saved = save.map(p => dactyl[p]);
|
let saved = save.map(p => dactyl[p]);
|
||||||
return function wrappedCallback() {
|
return function wrappedCallback() {
|
||||||
let args = arguments;
|
let args = arguments;
|
||||||
return dactyl.withSavedValues(save, function () {
|
return dactyl.withSavedValues(save, () => {
|
||||||
saved.forEach((p, i) => { dactyl[save[i]] = p; });
|
saved.forEach((p, i) => { dactyl[save[i]] = p; });
|
||||||
try {
|
try {
|
||||||
return callback.apply(self, args);
|
return callback.apply(self, args);
|
||||||
@@ -1222,7 +1220,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
elem.getAttribute("collapsed"))
|
elem.getAttribute("collapsed"))
|
||||||
}, {
|
}, {
|
||||||
cache: function initCache() {
|
cache: function initCache() {
|
||||||
cache.register("help/plugins.xml", function () {
|
cache.register("help/plugins.xml", () => {
|
||||||
// Process plugin help entries.
|
// Process plugin help entries.
|
||||||
|
|
||||||
let body = [];
|
let body = [];
|
||||||
@@ -1268,7 +1266,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
body]);
|
body]);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
cache.register("help/index.xml", function () {
|
cache.register("help/index.xml", () => {
|
||||||
return '<?xml version="1.0"?>\n' +
|
return '<?xml version="1.0"?>\n' +
|
||||||
DOM.toXML(["overlay", { xmlns: "dactyl" },
|
DOM.toXML(["overlay", { xmlns: "dactyl" },
|
||||||
template.map(iter(dactyl.indices),
|
template.map(iter(dactyl.indices),
|
||||||
@@ -1278,7 +1276,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
"\n\n")]);
|
"\n\n")]);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
cache.register("help/gui.xml", function () {
|
cache.register("help/gui.xml", () => {
|
||||||
return '<?xml version="1.0"?>\n' +
|
return '<?xml version="1.0"?>\n' +
|
||||||
DOM.toXML(["overlay", { xmlns: "dactyl" },
|
DOM.toXML(["overlay", { xmlns: "dactyl" },
|
||||||
["dl", { insertafter: "dialog-list" },
|
["dl", { insertafter: "dialog-list" },
|
||||||
@@ -1291,7 +1289,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
"\n")]]);
|
"\n")]]);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
cache.register("help/privacy.xml", function () {
|
cache.register("help/privacy.xml", () => {
|
||||||
return '<?xml version="1.0"?>\n' +
|
return '<?xml version="1.0"?>\n' +
|
||||||
DOM.toXML(["overlay", { xmlns: "dactyl" },
|
DOM.toXML(["overlay", { xmlns: "dactyl" },
|
||||||
["dl", { insertafter: "sanitize-items" },
|
["dl", { insertafter: "sanitize-items" },
|
||||||
@@ -1894,7 +1892,8 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
&& root._lightweightTheme._lastScreenWidth == null) {
|
&& root._lightweightTheme._lastScreenWidth == null) {
|
||||||
|
|
||||||
dactyl.withSavedValues.call(PrivateBrowsingUtils,
|
dactyl.withSavedValues.call(PrivateBrowsingUtils,
|
||||||
["isWindowPrivate"], function () {
|
["isWindowPrivate"],
|
||||||
|
() => {
|
||||||
PrivateBrowsingUtils.isWindowPrivate = () => false;
|
PrivateBrowsingUtils.isWindowPrivate = () => false;
|
||||||
Cu.import("resource://gre/modules/LightweightThemeConsumer.jsm", {})
|
Cu.import("resource://gre/modules/LightweightThemeConsumer.jsm", {})
|
||||||
.LightweightThemeConsumer.call(root._lightweightTheme, document);
|
.LightweightThemeConsumer.call(root._lightweightTheme, document);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
|
|||||||
if (elem)
|
if (elem)
|
||||||
this.element = elem;
|
this.element = elem;
|
||||||
else
|
else
|
||||||
this.__defineGetter__("element", function () {
|
this.__defineGetter__("element", () => {
|
||||||
let elem = dactyl.focusedElement;
|
let elem = dactyl.focusedElement;
|
||||||
if (elem)
|
if (elem)
|
||||||
return elem.inputField || elem;
|
return elem.inputField || elem;
|
||||||
@@ -771,17 +771,17 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
|
|||||||
|
|
||||||
context.match = function (r) !this.filter || this.filter.contains(r);
|
context.match = function (r) !this.filter || this.filter.contains(r);
|
||||||
|
|
||||||
context.fork("clipboard", 0, this, function (ctxt) {
|
context.fork("clipboard", 0, this, ctxt => {
|
||||||
ctxt.match = context.match;
|
ctxt.match = context.match;
|
||||||
ctxt.title = ["Clipboard Registers"];
|
ctxt.title = ["Clipboard Registers"];
|
||||||
ctxt.completions = Object.keys(editor.selectionRegisters);
|
ctxt.completions = Object.keys(editor.selectionRegisters);
|
||||||
});
|
});
|
||||||
context.fork("kill-ring", 0, this, function (ctxt) {
|
context.fork("kill-ring", 0, this, ctxt => {
|
||||||
ctxt.match = context.match;
|
ctxt.match = context.match;
|
||||||
ctxt.title = ["Kill Ring Registers"];
|
ctxt.title = ["Kill Ring Registers"];
|
||||||
ctxt.completions = Array.slice("0123456789");
|
ctxt.completions = Array.slice("0123456789");
|
||||||
});
|
});
|
||||||
context.fork("user", 0, this, function (ctxt) {
|
context.fork("user", 0, this, ctxt => {
|
||||||
ctxt.match = context.match;
|
ctxt.match = context.match;
|
||||||
ctxt.title = ["User Defined Registers"];
|
ctxt.title = ["User Defined Registers"];
|
||||||
ctxt.completions = editor.registers.keys();
|
ctxt.completions = editor.registers.keys();
|
||||||
@@ -914,7 +914,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
|
|||||||
|
|
||||||
function clear(forward, re)
|
function clear(forward, re)
|
||||||
function _clear(editor) {
|
function _clear(editor) {
|
||||||
updateRange(editor, forward, re, function (range) {});
|
updateRange(editor, forward, re, range => {});
|
||||||
dactyl.assert(!editor.selection.isCollapsed);
|
dactyl.assert(!editor.selection.isCollapsed);
|
||||||
editor.selection.deleteFromDocument();
|
editor.selection.deleteFromDocument();
|
||||||
let parent = DOM(editor.rootElement.parentNode);
|
let parent = DOM(editor.rootElement.parentNode);
|
||||||
@@ -925,13 +925,12 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
|
|||||||
function move(forward, re, sameWord)
|
function move(forward, re, sameWord)
|
||||||
function _move(editor) {
|
function _move(editor) {
|
||||||
updateRange(editor, forward, re,
|
updateRange(editor, forward, re,
|
||||||
function (range) { range.collapse(!forward); },
|
range => { range.collapse(!forward); },
|
||||||
sameWord);
|
sameWord);
|
||||||
}
|
}
|
||||||
function select(forward, re)
|
function select(forward, re)
|
||||||
function _select(editor) {
|
function _select(editor) {
|
||||||
updateRange(editor, forward, re,
|
updateRange(editor, forward, re, range => {});
|
||||||
function (range) {});
|
|
||||||
}
|
}
|
||||||
function beginLine(editor_) {
|
function beginLine(editor_) {
|
||||||
editor.executeCommand("cmd_beginLine");
|
editor.executeCommand("cmd_beginLine");
|
||||||
@@ -1319,7 +1318,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
|
|||||||
["~"], "Switch case of the character under the cursor and move the cursor to the right",
|
["~"], "Switch case of the character under the cursor and move the cursor to the right",
|
||||||
function ({ count }) {
|
function ({ count }) {
|
||||||
function munger(range)
|
function munger(range)
|
||||||
String(range).replace(/./g, function (c) {
|
String(range).replace(/./g, c => {
|
||||||
let lc = c.toLocaleLowerCase();
|
let lc = c.toLocaleLowerCase();
|
||||||
return c == lc ? c.toLocaleUpperCase() : lc;
|
return c == lc ? c.toLocaleUpperCase() : lc;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1083,7 +1083,7 @@ var Events = Module("events", {
|
|||||||
function ({ keypressEvents: [event] }) {
|
function ({ keypressEvents: [event] }) {
|
||||||
dactyl.assert(event.dactylSavedEvents,
|
dactyl.assert(event.dactylSavedEvents,
|
||||||
_("event.nothingToPass"));
|
_("event.nothingToPass"));
|
||||||
return function () {
|
return () => {
|
||||||
events.feedevents(null, event.dactylSavedEvents,
|
events.feedevents(null, event.dactylSavedEvents,
|
||||||
{ skipmap: true, isMacro: true, isReplay: true });
|
{ skipmap: true, isMacro: true, isReplay: true });
|
||||||
};
|
};
|
||||||
@@ -1150,8 +1150,8 @@ var Events = Module("events", {
|
|||||||
"Pass certain keys through directly for the given URLs",
|
"Pass certain keys through directly for the given URLs",
|
||||||
"sitemap", "", {
|
"sitemap", "", {
|
||||||
flush: function flush() {
|
flush: function flush() {
|
||||||
memoize(this, "filters", function () this.value.filter(function (f) f(buffer.documentURI)));
|
memoize(this, "filters", function () this.value.filter(f => f(buffer.documentURI)));
|
||||||
memoize(this, "pass", function () new RealSet(Ary.flatten(this.filters.map(function (f) f.keys))));
|
memoize(this, "pass", function () new RealSet(Ary.flatten(this.filters.map(f => f.keys))));
|
||||||
memoize(this, "commandHive", function hive() Hive(this.filters, "command"));
|
memoize(this, "commandHive", function hive() Hive(this.filters, "command"));
|
||||||
memoize(this, "inputHive", function hive() Hive(this.filters, "input"));
|
memoize(this, "inputHive", function hive() Hive(this.filters, "input"));
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -746,7 +746,7 @@ var HintSession = Class("HintSession", CommandMode, {
|
|||||||
|
|
||||||
var Hints = Module("hints", {
|
var Hints = Module("hints", {
|
||||||
init: function init() {
|
init: function init() {
|
||||||
this.resizeTimer = Timer(100, 500, function () {
|
this.resizeTimer = Timer(100, 500, () => {
|
||||||
if (isinstance(modes.main, modes.HINTS))
|
if (isinstance(modes.main, modes.HINTS))
|
||||||
modes.getStack(0).params.onResize();
|
modes.getStack(0).params.onResize();
|
||||||
});
|
});
|
||||||
@@ -789,7 +789,7 @@ var Hints = Module("hints", {
|
|||||||
this.addMode("V", "View hint source in external editor", (elem, loc) => buffer.viewSource(loc, true));
|
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, cleanLoc(loc), true));
|
this.addMode("y", "Yank hint location", (elem, loc) => editor.setRegister(null, cleanLoc(loc), true));
|
||||||
this.addMode("Y", "Yank hint description", elem => editor.setRegister(null, elem.textContent || "", true));
|
this.addMode("Y", "Yank hint description", elem => editor.setRegister(null, elem.textContent || "", true));
|
||||||
this.addMode("A", "Yank hint anchor url", function (elem) {
|
this.addMode("A", "Yank hint anchor url", elem => {
|
||||||
let uri = elem.ownerDocument.documentURIObject.clone();
|
let uri = elem.ownerDocument.documentURIObject.clone();
|
||||||
uri.ref = elem.id || elem.name;
|
uri.ref = elem.id || elem.name;
|
||||||
dactyl.clipboardWrite(uri.spec, true);
|
dactyl.clipboardWrite(uri.spec, true);
|
||||||
@@ -934,7 +934,7 @@ var Hints = Module("hints", {
|
|||||||
*/
|
*/
|
||||||
function containsMatcher(hintString) { //{{{
|
function containsMatcher(hintString) { //{{{
|
||||||
let tokens = tokenize(/\s+/, hintString);
|
let tokens = tokenize(/\s+/, hintString);
|
||||||
return function (linkText) {
|
return linkText => {
|
||||||
linkText = linkText.toLowerCase();
|
linkText = linkText.toLowerCase();
|
||||||
return tokens.every(token => indexOf(linkText, token) >= 0);
|
return tokens.every(token => indexOf(linkText, token) >= 0);
|
||||||
};
|
};
|
||||||
@@ -1049,7 +1049,7 @@ var Hints = Module("hints", {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return function (linkText) {
|
return linkText => {
|
||||||
if (hintStrings.length == 1 && hintStrings[0].length == 0)
|
if (hintStrings.length == 1 && hintStrings[0].length == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ var History = Module("history", {
|
|||||||
|
|
||||||
let obj = [];
|
let obj = [];
|
||||||
obj.__defineGetter__("index", () => sh.index);
|
obj.__defineGetter__("index", () => sh.index);
|
||||||
obj.__defineSetter__("index", function (val) { webNav.gotoIndex(val); });
|
obj.__defineSetter__("index", val => { webNav.gotoIndex(val); });
|
||||||
obj[Symbol.iterator] = function () this.entries();
|
obj[Symbol.iterator] = function () this.entries();
|
||||||
|
|
||||||
for (let item of iter(sh.SHistoryEnumerator, Ci.nsISHEntry))
|
for (let item of iter(sh.SHistoryEnumerator, Ci.nsISHEntry))
|
||||||
@@ -111,7 +111,7 @@ var History = Module("history", {
|
|||||||
var ctxt;
|
var ctxt;
|
||||||
var filter = item => true;
|
var filter = item => true;
|
||||||
if (item == "domain")
|
if (item == "domain")
|
||||||
var filter = function (item) {
|
var filter = item => {
|
||||||
let res = item.URI.hostPort != ctxt;
|
let res = item.URI.hostPort != ctxt;
|
||||||
ctxt = item.URI.hostPort;
|
ctxt = item.URI.hostPort;
|
||||||
return res;
|
return res;
|
||||||
@@ -324,7 +324,7 @@ var History = Module("history", {
|
|||||||
|
|
||||||
},
|
},
|
||||||
completion: function initCompletion() {
|
completion: function initCompletion() {
|
||||||
completion.domain = function (context) {
|
completion.domain = context => {
|
||||||
context.anchored = false;
|
context.anchored = false;
|
||||||
context.compare = (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,
|
context.keys = { text: util.identity, description: util.identity,
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ var MapHive = Class("MapHive", Contexts.Hive, {
|
|||||||
iterate: function (modes) {
|
iterate: function (modes) {
|
||||||
let stacks = Array.concat(modes).map(this.bound.getStack);
|
let stacks = Array.concat(modes).map(this.bound.getStack);
|
||||||
return values(stacks.shift().sort((m1, m2) => String.localeCompare(m1.name, m2.name))
|
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))));
|
stacks.every(stack => stack.some(m => m.rhs && m.rhs === map.rhs && m.name === map.name))));
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -803,7 +803,7 @@ var Mappings = Module("mappings", {
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
iter.forEach(modes.mainModes, function (mode) {
|
iter.forEach(modes.mainModes, mode => {
|
||||||
if (mode.char && !commands.get(mode.char + "listkeys", true))
|
if (mode.char && !commands.get(mode.char + "listkeys", true))
|
||||||
dactyl.addUsageCommand({
|
dactyl.addUsageCommand({
|
||||||
__proto__: args,
|
__proto__: args,
|
||||||
|
|||||||
@@ -649,7 +649,7 @@ var Modes = Module("modes", {
|
|||||||
},
|
},
|
||||||
prefs: function initPrefs() {
|
prefs: function initPrefs() {
|
||||||
prefs.watch("accessibility.browsewithcaret",
|
prefs.watch("accessibility.browsewithcaret",
|
||||||
function () { apply(modes, "onCaretChange", arguments); });
|
() => { apply(modes, "onCaretChange", arguments); });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
var QuickMarks = Module("quickmarks", {
|
var QuickMarks = Module("quickmarks", {
|
||||||
init: function () {
|
init: function () {
|
||||||
this._qmarks = storage.newMap("quickmarks", { store: true });
|
this._qmarks = storage.newMap("quickmarks", { store: true });
|
||||||
storage.addObserver("quickmarks", function () {
|
storage.addObserver("quickmarks", () => {
|
||||||
statusline.updateStatus();
|
statusline.updateStatus();
|
||||||
}, window);
|
}, window);
|
||||||
},
|
},
|
||||||
@@ -154,7 +154,7 @@ var QuickMarks = Module("quickmarks", {
|
|||||||
if (args.length == 1)
|
if (args.length == 1)
|
||||||
return completion.quickmark(context);
|
return completion.quickmark(context);
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
context.fork("current", 0, this, function (context) {
|
context.fork("current", 0, this, context => {
|
||||||
context.title = ["Extra Completions"];
|
context.title = ["Extra Completions"];
|
||||||
context.completions = [
|
context.completions = [
|
||||||
[quickmarks.get(args[0]), _("option.currentValue")]
|
[quickmarks.get(args[0]), _("option.currentValue")]
|
||||||
@@ -176,7 +176,7 @@ var QuickMarks = Module("quickmarks", {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
completion: function initCompletion() {
|
completion: function initCompletion() {
|
||||||
completion.quickmark = function (context) {
|
completion.quickmark = context => {
|
||||||
context.title = ["QuickMark", "URL"];
|
context.title = ["QuickMark", "URL"];
|
||||||
context.generate = () => iter(quickmarks._qmarks);
|
context.generate = () => iter(quickmarks._qmarks);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ var Tabs = Module("tabs", {
|
|||||||
"{ visibility: collapse; }",
|
"{ visibility: collapse; }",
|
||||||
false, true);
|
false, true);
|
||||||
|
|
||||||
dactyl.commands["tabs.select"] = function (event) {
|
dactyl.commands["tabs.select"] = event => {
|
||||||
tabs.switchTo(event.originalTarget.getAttribute("identifier"));
|
tabs.switchTo(event.originalTarget.getAttribute("identifier"));
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1096,7 +1096,7 @@ var Tabs = Module("tabs", {
|
|||||||
description: function (group) group.getTitle() ||
|
description: function (group) group.getTitle() ||
|
||||||
group.getChildren().map(t => t.tab.label).join(", ")
|
group.getChildren().map(t => t.tab.label).join(", ")
|
||||||
};
|
};
|
||||||
context.generate = function () {
|
context.generate = () => {
|
||||||
context.incomplete = true;
|
context.incomplete = true;
|
||||||
tabs.getGroups(function ({ GroupItems }) {
|
tabs.getGroups(function ({ GroupItems }) {
|
||||||
context.incomplete = false;
|
context.incomplete = false;
|
||||||
@@ -1120,7 +1120,7 @@ var Tabs = Module("tabs", {
|
|||||||
"Execute the next mapping in a new tab",
|
"Execute the next mapping in a new tab",
|
||||||
function ({ count }) {
|
function ({ count }) {
|
||||||
dactyl.forceTarget = dactyl.NEW_TAB;
|
dactyl.forceTarget = dactyl.NEW_TAB;
|
||||||
mappings.afterCommands((count || 1) + 1, function () {
|
mappings.afterCommands((count || 1) + 1, () => {
|
||||||
dactyl.forceTarget = null;
|
dactyl.forceTarget = null;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -483,9 +483,9 @@ var Addons = Module("addons", {
|
|||||||
description: "description",
|
description: "description",
|
||||||
icon: "iconURL"
|
icon: "iconURL"
|
||||||
};
|
};
|
||||||
context.generate = function () {
|
context.generate = () => {
|
||||||
context.incomplete = true;
|
context.incomplete = true;
|
||||||
AddonManager.getAddonsByTypes(types || ["extension"], function (addons) {
|
AddonManager.getAddonsByTypes(types || ["extension"], addons => {
|
||||||
context.incomplete = false;
|
context.incomplete = false;
|
||||||
context.completions = addons;
|
context.completions = addons;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -899,7 +899,7 @@ function Class(...args) {
|
|||||||
return Constructor;
|
return Constructor;
|
||||||
}
|
}
|
||||||
|
|
||||||
Class.objectGlobal = function (object) {
|
Class.objectGlobal = object => {
|
||||||
try {
|
try {
|
||||||
return Cu.getGlobalForObject(object);
|
return Cu.getGlobalForObject(object);
|
||||||
}
|
}
|
||||||
@@ -920,7 +920,7 @@ Class.objectGlobal = function (object) {
|
|||||||
*/
|
*/
|
||||||
Class.Property = function Property(desc) update(
|
Class.Property = function Property(desc) update(
|
||||||
Object.create(Property.prototype), desc || { configurable: true, writable: true });
|
Object.create(Property.prototype), desc || { configurable: true, writable: true });
|
||||||
Class.Property.prototype.init = function () {};
|
Class.Property.prototype.init = () => {};
|
||||||
/**
|
/**
|
||||||
* Extends a subclass with a superclass. The subclass's
|
* Extends a subclass with a superclass. The subclass's
|
||||||
* prototype is replaced with a new object, which inherits
|
* prototype is replaced with a new object, which inherits
|
||||||
@@ -1059,7 +1059,7 @@ Class.prototype = {
|
|||||||
* @returns {nsITimer} The timer which backs this timeout.
|
* @returns {nsITimer} The timer which backs this timeout.
|
||||||
*/
|
*/
|
||||||
timeout: function timeout(callback, timeout) {
|
timeout: function timeout(callback, timeout) {
|
||||||
let timeout_notify = (timer) => {
|
let timeout_notify = timer => {
|
||||||
if (this.stale ||
|
if (this.stale ||
|
||||||
util.rehashing && !isinstance(Cu.getGlobalForObject(callback), ["BackstagePass"]))
|
util.rehashing && !isinstance(Cu.getGlobalForObject(callback), ["BackstagePass"]))
|
||||||
return;
|
return;
|
||||||
@@ -1095,7 +1095,7 @@ Class.prototype = {
|
|||||||
|
|
||||||
for (let i = 0; i < arguments.length; i++) {
|
for (let i = 0; i < arguments.length; i++) {
|
||||||
let src = arguments[i];
|
let src = arguments[i];
|
||||||
Object.getOwnPropertyNames(src || {}).forEach((k) => {
|
Object.getOwnPropertyNames(src || {}).forEach(k => {
|
||||||
if (k.startsWith("@@") && k.slice(2) in Symbol)
|
if (k.startsWith("@@") && k.slice(2) in Symbol)
|
||||||
k = Symbol[k.slice(2)];
|
k = Symbol[k.slice(2)];
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ var Buffer = Module("Buffer", {
|
|||||||
if (!found)
|
if (!found)
|
||||||
resolve(undefined);
|
resolve(undefined);
|
||||||
},
|
},
|
||||||
handleResult: (pref) => {
|
handleResult: pref => {
|
||||||
found = true;
|
found = true;
|
||||||
resolve(pref.value);
|
resolve(pref.value);
|
||||||
},
|
},
|
||||||
@@ -1122,7 +1122,7 @@ var Buffer = Module("Buffer", {
|
|||||||
|
|
||||||
let info = template.map(
|
let info = template.map(
|
||||||
(sections || options["pageinfo"])
|
(sections || options["pageinfo"])
|
||||||
.map((opt) => Buffer.pageInfo[opt].action.call(this)),
|
.map(opt => Buffer.pageInfo[opt].action.call(this)),
|
||||||
res => (res && iter(res).join(", ") || undefined),
|
res => (res && iter(res).join(", ") || undefined),
|
||||||
", ").join("");
|
", ").join("");
|
||||||
|
|
||||||
@@ -1134,7 +1134,7 @@ var Buffer = Module("Buffer", {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let list = template.map(sections || options["pageinfo"], (option) => {
|
let list = template.map(sections || options["pageinfo"], option => {
|
||||||
let { action, title } = Buffer.pageInfo[option];
|
let { action, title } = Buffer.pageInfo[option];
|
||||||
return template.table(title, action.call(this, true));
|
return template.table(title, action.call(this, true));
|
||||||
}, ["br"]);
|
}, ["br"]);
|
||||||
@@ -1824,7 +1824,7 @@ var Buffer = Module("Buffer", {
|
|||||||
init: function init(dactyl, modules, window) {
|
init: function init(dactyl, modules, window) {
|
||||||
init.superapply(this, arguments);
|
init.superapply(this, arguments);
|
||||||
|
|
||||||
dactyl.commands["buffer.viewSource"] = function (event) {
|
dactyl.commands["buffer.viewSource"] = event => {
|
||||||
let elem = event.originalTarget;
|
let elem = event.originalTarget;
|
||||||
let obj = { url: elem.getAttribute("href"), line: Number(elem.getAttribute("line")) };
|
let obj = { url: elem.getAttribute("href"), line: Number(elem.getAttribute("line")) };
|
||||||
if (elem.hasAttribute("column"))
|
if (elem.hasAttribute("column"))
|
||||||
@@ -2543,7 +2543,7 @@ var Buffer = Module("Buffer", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
validator: function validate(values) {
|
validator: function validate(values) {
|
||||||
return this.testValues(values, function (value) {
|
return this.testValues(values, value => {
|
||||||
if (/^func:/.test(value))
|
if (/^func:/.test(value))
|
||||||
return callable(dactyl.userEval("(" + Option.dequote(value.substr(5)) + ")"));
|
return callable(dactyl.userEval("(" + Option.dequote(value.substr(5)) + ")"));
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ var Command = Class("Command", {
|
|||||||
let res = update([], {
|
let res = update([], {
|
||||||
command: this,
|
command: this,
|
||||||
|
|
||||||
explicitOpts: Class.Memoize(function () ({})),
|
explicitOpts: Class.Memoize(() => ({})),
|
||||||
|
|
||||||
has: function AP_has(opt) hasOwnProperty(this.explicitOpts, opt)
|
has: function AP_has(opt) hasOwnProperty(this.explicitOpts, opt)
|
||||||
|| typeof opt === "number" && hasOwnProperty(this, opt),
|
|| typeof opt === "number" && hasOwnProperty(this, opt),
|
||||||
@@ -1738,7 +1738,7 @@ var Commands = Module("commands", {
|
|||||||
name: ["listc[ommands]", "lc"],
|
name: ["listc[ommands]", "lc"],
|
||||||
description: "List all Ex commands along with their short descriptions",
|
description: "List all Ex commands along with their short descriptions",
|
||||||
index: "ex-cmd",
|
index: "ex-cmd",
|
||||||
iterate: function (args) commands.iterator().map(function (cmd) ({
|
iterate: function (args) commands.iterator().map(cmd => ({
|
||||||
__proto__: cmd,
|
__proto__: cmd,
|
||||||
columns: [
|
columns: [
|
||||||
cmd.hive == commands.builtin ? "" : ["span", { highlight: "Object", style: "padding-right: 1em;" },
|
cmd.hive == commands.builtin ? "" : ["span", { highlight: "Object", style: "padding-right: 1em;" },
|
||||||
@@ -1826,7 +1826,7 @@ Commands.complQuote = {
|
|||||||
"": ["", Commands.quoteArg[""], ""]
|
"": ["", Commands.quoteArg[""], ""]
|
||||||
};
|
};
|
||||||
|
|
||||||
Commands.parseBool = function (arg) {
|
Commands.parseBool = arg => {
|
||||||
if (/^(true|1|on)$/i.test(arg))
|
if (/^(true|1|on)$/i.test(arg))
|
||||||
return true;
|
return true;
|
||||||
if (/^(false|0|off)$/i.test(arg))
|
if (/^(false|0|off)$/i.test(arg))
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ var CompletionContext = Class("CompletionContext", {
|
|||||||
this.filterFunc = function filterFunc(items) {
|
this.filterFunc = function filterFunc(items) {
|
||||||
return this.filters
|
return this.filters
|
||||||
.reduce((res, filter) =>
|
.reduce((res, filter) =>
|
||||||
res.filter((item) => filter.call(this, item)),
|
res.filter(item => filter.call(this, item)),
|
||||||
items);
|
items);
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
@@ -738,9 +738,9 @@ var CompletionContext = Class("CompletionContext", {
|
|||||||
|
|
||||||
split: function split(name, obj, fn, ...args) {
|
split: function split(name, obj, fn, ...args) {
|
||||||
let context = this.fork(name);
|
let context = this.fork(name);
|
||||||
let alias = (prop) => {
|
let alias = prop => {
|
||||||
context.__defineGetter__(prop, () => this[prop]);
|
context.__defineGetter__(prop, () => this[prop]);
|
||||||
context.__defineSetter__(prop, (val) => this[prop] = val);
|
context.__defineSetter__(prop, val => this[prop] = val);
|
||||||
};
|
};
|
||||||
alias("_cache");
|
alias("_cache");
|
||||||
alias("_completions");
|
alias("_completions");
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ var Contexts = Module("contexts", {
|
|||||||
init: function (name) {
|
init: function (name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
this.type = ArgType("group", function (group) {
|
this.type = ArgType("group", group => {
|
||||||
return isString(group) ? contexts.getGroup(group, name)
|
return isString(group) ? contexts.getGroup(group, name)
|
||||||
: group[name];
|
: group[name];
|
||||||
});
|
});
|
||||||
@@ -814,7 +814,7 @@ var Contexts = Module("contexts", {
|
|||||||
.slice(0, -1);
|
.slice(0, -1);
|
||||||
|
|
||||||
iter({ Active: true, Inactive: false }).forEach(function ([name, active]) {
|
iter({ Active: true, Inactive: false }).forEach(function ([name, active]) {
|
||||||
context.split(name, null, function (context) {
|
context.split(name, null, context => {
|
||||||
context.title[0] = name + " Groups";
|
context.title[0] = name + " Groups";
|
||||||
context.filters.push(({ item }) => !!item.filter(modules.buffer.uri) == active);
|
context.filters.push(({ item }) => !!item.filter(modules.buffer.uri) == active);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ var DOM = Class("DOM", {
|
|||||||
|
|
||||||
Empty: function Empty() this.constructor(null, this.document),
|
Empty: function Empty() this.constructor(null, this.document),
|
||||||
|
|
||||||
nodes: Class.Memoize(function () ({})),
|
nodes: Class.Memoize(() => ({})),
|
||||||
|
|
||||||
get items() {
|
get items() {
|
||||||
return function* () {
|
return function* () {
|
||||||
@@ -1567,10 +1567,10 @@ var DOM = Class("DOM", {
|
|||||||
|
|
||||||
if (!isString(name) || args.length == 0 || name === "") {
|
if (!isString(name) || args.length == 0 || name === "") {
|
||||||
var frag = doc.createDocumentFragment();
|
var frag = doc.createDocumentFragment();
|
||||||
Array.forEach(args, function (arg) {
|
Array.forEach(args, arg => {
|
||||||
if (!isArray(arg[0]))
|
if (!isArray(arg[0]))
|
||||||
arg = [arg];
|
arg = [arg];
|
||||||
arg.forEach(function (arg) {
|
arg.forEach(arg => {
|
||||||
frag.appendChild(tag(arg, namespaces));
|
frag.appendChild(tag(arg, namespaces));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -1710,12 +1710,12 @@ var DOM = Class("DOM", {
|
|||||||
if (isFragment(args)) {
|
if (isFragment(args)) {
|
||||||
let res = [];
|
let res = [];
|
||||||
let join = isArray(args) && isStrings(args) ? "" : "\n";
|
let join = isArray(args) && isStrings(args) ? "" : "\n";
|
||||||
Array.forEach(args, function (arg) {
|
Array.forEach(args, arg => {
|
||||||
if (!isArray(arg[0]))
|
if (!isArray(arg[0]))
|
||||||
arg = [arg];
|
arg = [arg];
|
||||||
|
|
||||||
let contents = [];
|
let contents = [];
|
||||||
arg.forEach(function (arg) {
|
arg.forEach(arg => {
|
||||||
let string = tag(arg, namespaces, indent);
|
let string = tag(arg, namespaces, indent);
|
||||||
if (string)
|
if (string)
|
||||||
contents.push(string);
|
contents.push(string);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ var Download = Class("Download", {
|
|||||||
this.source.url]]],
|
this.source.url]]],
|
||||||
this.list.document, this.nodes);
|
this.list.document, this.nodes);
|
||||||
|
|
||||||
this.nodes.launch.addEventListener("click", (event) => {
|
this.nodes.launch.addEventListener("click", event => {
|
||||||
if (event.button == 0) {
|
if (event.button == 0) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.command("launch");
|
this.command("launch");
|
||||||
@@ -122,7 +122,7 @@ var Download = Class("Download", {
|
|||||||
let file = io.File(this.targetFile);
|
let file = io.File(this.targetFile);
|
||||||
if (file.isExecutable() && prefs.get("browser.download.manager.alertOnEXEOpen", true))
|
if (file.isExecutable() && prefs.get("browser.download.manager.alertOnEXEOpen", true))
|
||||||
this.list.modules.commandline.input(_("download.prompt.launchExecutable") + " ",
|
this.list.modules.commandline.input(_("download.prompt.launchExecutable") + " ",
|
||||||
(resp) => {
|
resp => {
|
||||||
if (/^a(lways)$/i.test(resp)) {
|
if (/^a(lways)$/i.test(resp)) {
|
||||||
prefs.set("browser.download.manager.alertOnEXEOpen", false);
|
prefs.set("browser.download.manager.alertOnEXEOpen", false);
|
||||||
resp = "yes";
|
resp = "yes";
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ var Help = Module("Help", {
|
|||||||
|
|
||||||
cache.register("help.json", HelpBuilder);
|
cache.register("help.json", HelpBuilder);
|
||||||
|
|
||||||
cache.register("help/versions.xml", function () {
|
cache.register("help/versions.xml", () => {
|
||||||
let NEWS = util.httpGet(config.addon.getResourceURI("NEWS").spec,
|
let NEWS = util.httpGet(config.addon.getResourceURI("NEWS").spec,
|
||||||
{ mimeType: "text/plain;charset=UTF-8" })
|
{ mimeType: "text/plain;charset=UTF-8" })
|
||||||
.responseText;
|
.responseText;
|
||||||
@@ -223,7 +223,7 @@ var Help = Module("Help", {
|
|||||||
|
|
||||||
Local: function Local(dactyl, modules, window) ({
|
Local: function Local(dactyl, modules, window) ({
|
||||||
init: function init() {
|
init: function init() {
|
||||||
dactyl.commands["dactyl.help"] = function (event) {
|
dactyl.commands["dactyl.help"] = event => {
|
||||||
let elem = event.originalTarget;
|
let elem = event.originalTarget;
|
||||||
modules.help.help(elem.getAttribute("tag") || elem.textContent);
|
modules.help.help(elem.getAttribute("tag") || elem.textContent);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -494,7 +494,7 @@ var IO = Module("io", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let timer = services.Timer(
|
let timer = services.Timer(
|
||||||
function () {
|
() => {
|
||||||
if (!process.isRunning) {
|
if (!process.isRunning) {
|
||||||
timer.cancel();
|
timer.cancel();
|
||||||
deferred.resolve(process.exitValue);
|
deferred.resolve(process.exitValue);
|
||||||
@@ -974,7 +974,7 @@ unlet s:cpo_save
|
|||||||
completion: function initCompletion(dactyl, modules, window) {
|
completion: function initCompletion(dactyl, modules, window) {
|
||||||
const { completion, io } = modules;
|
const { completion, io } = modules;
|
||||||
|
|
||||||
completion.charset = function (context) {
|
completion.charset = context => {
|
||||||
context.anchored = false;
|
context.anchored = false;
|
||||||
context.keys = {
|
context.keys = {
|
||||||
text: util.identity,
|
text: util.identity,
|
||||||
@@ -1062,7 +1062,7 @@ unlet s:cpo_save
|
|||||||
|
|
||||||
completion.shellCommand = function shellCommand(context) {
|
completion.shellCommand = function shellCommand(context) {
|
||||||
context.title = ["Shell Command", "Path"];
|
context.title = ["Shell Command", "Path"];
|
||||||
context.generate = function () {
|
context.generate = () => {
|
||||||
let dirNames = services.environment.get("PATH").split(config.OS.pathListSep);
|
let dirNames = services.environment.get("PATH").split(config.OS.pathListSep);
|
||||||
let commands = [];
|
let commands = [];
|
||||||
|
|
||||||
@@ -1099,7 +1099,7 @@ unlet s:cpo_save
|
|||||||
else if (match.scheme === "chrome") {
|
else if (match.scheme === "chrome") {
|
||||||
context.key = match.prefix;
|
context.key = match.prefix;
|
||||||
context.advance(match.prefix.length + 1);
|
context.advance(match.prefix.length + 1);
|
||||||
context.generate = function () iter({
|
context.generate = () => iter({
|
||||||
content: /*L*/"Chrome content",
|
content: /*L*/"Chrome content",
|
||||||
locale: /*L*/"Locale-specific content",
|
locale: /*L*/"Locale-specific content",
|
||||||
skin: /*L*/"Theme-specific content"
|
skin: /*L*/"Theme-specific content"
|
||||||
|
|||||||
@@ -405,7 +405,7 @@ var JavaScript = Module("javascript", {
|
|||||||
|
|
||||||
// TODO: Make this a generic completion helper function.
|
// TODO: Make this a generic completion helper function.
|
||||||
objects.forEach(function (obj) {
|
objects.forEach(function (obj) {
|
||||||
obj.ctxt_t.split(obj[1] + "/anchored", this, function (context) {
|
obj.ctxt_t.split(obj[1] + "/anchored", this, context => {
|
||||||
context.anchored = true;
|
context.anchored = true;
|
||||||
if (compl)
|
if (compl)
|
||||||
compl(context, obj[0]);
|
compl(context, obj[0]);
|
||||||
@@ -416,14 +416,14 @@ var JavaScript = Module("javascript", {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
objects.forEach(function (obj) {
|
objects.forEach(function (obj) {
|
||||||
obj.ctxt_p.split(obj[1] + "/anchored", this, function (context) {
|
obj.ctxt_p.split(obj[1] + "/anchored", this, context => {
|
||||||
context.anchored = true;
|
context.anchored = true;
|
||||||
context.title[0] += /*L*/" (prototypes)";
|
context.title[0] += /*L*/" (prototypes)";
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
objects.forEach(function (obj) {
|
objects.forEach(function (obj) {
|
||||||
obj.ctxt_t.split(obj[1] + "/unanchored", this, function (context) {
|
obj.ctxt_t.split(obj[1] + "/unanchored", this, context => {
|
||||||
context.anchored = false;
|
context.anchored = false;
|
||||||
context.title[0] += /*L*/" (substrings)";
|
context.title[0] += /*L*/" (substrings)";
|
||||||
context.filters.push(unanchored);
|
context.filters.push(unanchored);
|
||||||
@@ -431,7 +431,7 @@ var JavaScript = Module("javascript", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
objects.forEach(function (obj) {
|
objects.forEach(function (obj) {
|
||||||
obj.ctxt_p.split(obj[1] + "/unanchored", this, function (context) {
|
obj.ctxt_p.split(obj[1] + "/unanchored", this, context => {
|
||||||
context.anchored = false;
|
context.anchored = false;
|
||||||
context.title[0] += /*L*/" (prototype substrings)";
|
context.title[0] += /*L*/" (prototype substrings)";
|
||||||
context.filters.push(unanchored);
|
context.filters.push(unanchored);
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ overlay.overlayWindow(Object.keys(config.overlays),
|
|||||||
this.initDependencies(className);
|
this.initDependencies(className);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
modules.__defineGetter__(className, function () {
|
modules.__defineGetter__(className, () => {
|
||||||
let module = modules.jsmodules[className];
|
let module = modules.jsmodules[className];
|
||||||
Class.replaceProperty(modules, className, module);
|
Class.replaceProperty(modules, className, module);
|
||||||
if (module.reallyInit)
|
if (module.reallyInit)
|
||||||
@@ -350,14 +350,14 @@ overlay.overlayWindow(Object.keys(config.overlays),
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
INIT[name].require = function (name) { init[name](); };
|
INIT[name].require = name => { init[name](); };
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
scanModules: function scanModules() {
|
scanModules: function scanModules() {
|
||||||
let { Module, modules } = this.modules;
|
let { Module, modules } = this.modules;
|
||||||
|
|
||||||
defineModule.modules.forEach((mod) => {
|
defineModule.modules.forEach(mod => {
|
||||||
let names = new RealSet(Object.keys(mod.INIT));
|
let names = new RealSet(Object.keys(mod.INIT));
|
||||||
if ("init" in mod.INIT)
|
if ("init" in mod.INIT)
|
||||||
names.add("init");
|
names.add("init");
|
||||||
@@ -366,14 +366,14 @@ overlay.overlayWindow(Object.keys(config.overlays),
|
|||||||
this.deferInit(name, mod.INIT, mod);
|
this.deferInit(name, mod.INIT, mod);
|
||||||
});
|
});
|
||||||
|
|
||||||
Module.list.forEach((mod) => {
|
Module.list.forEach(mod => {
|
||||||
if (!mod.frobbed) {
|
if (!mod.frobbed) {
|
||||||
modules.__defineGetter__(mod.className, () => {
|
modules.__defineGetter__(mod.className, () => {
|
||||||
delete modules[mod.className];
|
delete modules[mod.className];
|
||||||
return this.loadModule(mod.className, null, Components.stack.caller);
|
return this.loadModule(mod.className, null, Components.stack.caller);
|
||||||
});
|
});
|
||||||
Object.keys(mod.prototype.INIT)
|
Object.keys(mod.prototype.INIT)
|
||||||
.forEach((name) => { this.deferInit(name, mod.prototype.INIT, mod); });
|
.forEach(name => { this.deferInit(name, mod.prototype.INIT, mod); });
|
||||||
}
|
}
|
||||||
mod.frobbed = true;
|
mod.frobbed = true;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -204,9 +204,8 @@ var Messages = Module("messages", {
|
|||||||
javascript: function initJavascript(dactyl, modules, window) {
|
javascript: function initJavascript(dactyl, modules, window) {
|
||||||
let { JavaScript } = modules;
|
let { JavaScript } = modules;
|
||||||
|
|
||||||
JavaScript.setCompleter([this._, this.get, this.format], [
|
JavaScript.setCompleter([this._, this.get, this.format],
|
||||||
context => messages.iterate()
|
[context => messages.iterate()]);
|
||||||
]);
|
|
||||||
|
|
||||||
JavaScript.setCompleter([this.export],
|
JavaScript.setCompleter([this.export],
|
||||||
[function (context, obj, args) {
|
[function (context, obj, args) {
|
||||||
|
|||||||
@@ -758,7 +758,7 @@ var Option = Class("Option", {
|
|||||||
acceptable = completions.call(this);
|
acceptable = completions.call(this);
|
||||||
|
|
||||||
if (isArray(acceptable))
|
if (isArray(acceptable))
|
||||||
acceptable = new RealSet(acceptable.map((v) => v[0]));
|
acceptable = new RealSet(acceptable.map(v => v[0]));
|
||||||
else
|
else
|
||||||
acceptable = new RealSet(this.parseKey(k)
|
acceptable = new RealSet(this.parseKey(k)
|
||||||
for (k of Object.keys(acceptable)));
|
for (k of Object.keys(acceptable)));
|
||||||
@@ -964,7 +964,7 @@ var Options = Module("options", {
|
|||||||
let closure = () => this._optionMap[name];
|
let closure = () => this._optionMap[name];
|
||||||
|
|
||||||
memoize(this._optionMap, name,
|
memoize(this._optionMap, name,
|
||||||
function () Option.types[type](modules, names, description, defaultValue, extraInfo));
|
() => Option.types[type](modules, names, description, defaultValue, extraInfo));
|
||||||
|
|
||||||
for (let alias of names.slice(1))
|
for (let alias of names.slice(1))
|
||||||
memoize(this._optionMap, alias, closure);
|
memoize(this._optionMap, alias, closure);
|
||||||
@@ -1165,7 +1165,7 @@ var Options = Module("options", {
|
|||||||
name = Option.dequote(name);
|
name = Option.dequote(name);
|
||||||
if (name == "all" && reset)
|
if (name == "all" && reset)
|
||||||
modules.commandline.input(_("pref.prompt.resetAll", config.host) + " ",
|
modules.commandline.input(_("pref.prompt.resetAll", config.host) + " ",
|
||||||
function (resp) {
|
resp => {
|
||||||
if (resp == "yes")
|
if (resp == "yes")
|
||||||
for (let pref of prefs.getNames())
|
for (let pref of prefs.getNames())
|
||||||
prefs.reset(pref);
|
prefs.reset(pref);
|
||||||
@@ -1299,7 +1299,7 @@ var Options = Module("options", {
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (!opt.value && !opt.operator && !opt.invert) {
|
if (!opt.value && !opt.operator && !opt.invert) {
|
||||||
context.fork("default", 0, this, function (context) {
|
context.fork("default", 0, this, context => {
|
||||||
context.title = ["Extra Completions"];
|
context.title = ["Extra Completions"];
|
||||||
context.pushProcessor(0, (item, text, next) => next(item, text.substr(0, 100)));
|
context.pushProcessor(0, (item, text, next) => next(item, text.substr(0, 100)));
|
||||||
context.completions = [
|
context.completions = [
|
||||||
@@ -1322,7 +1322,7 @@ var Options = Module("options", {
|
|||||||
|
|
||||||
context.filters.push(i => !have.has(i.text));
|
context.filters.push(i => !have.has(i.text));
|
||||||
modules.completion.optionValue(context, opt.name, opt.operator, null,
|
modules.completion.optionValue(context, opt.name, opt.operator, null,
|
||||||
function (context) {
|
context => {
|
||||||
context.generate = () => option.value.map(o => [o, ""]);
|
context.generate = () => option.value.map(o => [o, ""]);
|
||||||
});
|
});
|
||||||
context.title = ["Current values"];
|
context.title = ["Current values"];
|
||||||
@@ -1539,7 +1539,7 @@ var Options = Module("options", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (extra.key && extra.value != null) {
|
if (extra.key && extra.value != null) {
|
||||||
context.fork("default", 0, this, function (context) {
|
context.fork("default", 0, this, context => {
|
||||||
context.completions = [
|
context.completions = [
|
||||||
[val(opt.value), _("option.currentValue")],
|
[val(opt.value), _("option.currentValue")],
|
||||||
[val(opt.defaultValue), _("option.defaultValue")]
|
[val(opt.defaultValue), _("option.defaultValue")]
|
||||||
@@ -1559,7 +1559,7 @@ var Options = Module("options", {
|
|||||||
if (op == "-")
|
if (op == "-")
|
||||||
context.filters.push(i => curValues.indexOf(i.text) > -1);
|
context.filters.push(i => curValues.indexOf(i.text) > -1);
|
||||||
|
|
||||||
memoize(extra, "values", function () {
|
memoize(extra, "values", () => {
|
||||||
if (op == "+")
|
if (op == "+")
|
||||||
return curValues.concat(newValues);
|
return curValues.concat(newValues);
|
||||||
if (op == "-")
|
if (op == "-")
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
|||||||
let branch = Item.PREFIX + Item.SHUTDOWN_BRANCH;
|
let branch = Item.PREFIX + Item.SHUTDOWN_BRANCH;
|
||||||
|
|
||||||
overlay.overlayWindow("chrome://browser/content/preferences/sanitize.xul",
|
overlay.overlayWindow("chrome://browser/content/preferences/sanitize.xul",
|
||||||
function (win) {
|
win => {
|
||||||
let items = ourItems(true);
|
let items = ourItems(true);
|
||||||
|
|
||||||
return prefOverlay(branch, true, {
|
return prefOverlay(branch, true, {
|
||||||
@@ -472,7 +472,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
|||||||
&& !args["-host"])
|
&& !args["-host"])
|
||||||
|
|
||||||
modules.commandline.input(_("sanitize.prompt.deleteAll") + " ",
|
modules.commandline.input(_("sanitize.prompt.deleteAll") + " ",
|
||||||
function (resp) {
|
resp => {
|
||||||
if (resp.match(/^y(es)?$/i)) {
|
if (resp.match(/^y(es)?$/i)) {
|
||||||
sanitize(items);
|
sanitize(items);
|
||||||
dactyl.echomsg(_("command.sanitize.allDeleted"));
|
dactyl.echomsg(_("command.sanitize.allDeleted"));
|
||||||
|
|||||||
@@ -690,7 +690,7 @@ var File = Class("File", {
|
|||||||
/**
|
/**
|
||||||
* @property {string} The current platform's path separator.
|
* @property {string} The current platform's path separator.
|
||||||
*/
|
*/
|
||||||
PATH_SEP: Class.Memoize(function () /foo(.)bar/.exec(OS.Path.join("foo", "bar"))[1]),
|
PATH_SEP: Class.Memoize(() => /foo(.)bar/.exec(OS.Path.join("foo", "bar"))[1]),
|
||||||
|
|
||||||
pathSplit: Class.Memoize(function () util.regexp("[/" + util.regexp.escape(this.PATH_SEP) + "]", "g")),
|
pathSplit: Class.Memoize(function () util.regexp("[/" + util.regexp.escape(this.PATH_SEP) + "]", "g")),
|
||||||
|
|
||||||
|
|||||||
@@ -394,7 +394,7 @@ var Styles = Module("Styles", {
|
|||||||
completeSite: function (context, content, group=styles.user) {
|
completeSite: function (context, content, group=styles.user) {
|
||||||
context.anchored = false;
|
context.anchored = false;
|
||||||
try {
|
try {
|
||||||
context.fork("current", 0, this, function (context) {
|
context.fork("current", 0, this, context => {
|
||||||
context.title = ["Current Site"];
|
context.title = ["Current Site"];
|
||||||
context.completions = [
|
context.completions = [
|
||||||
[content.location.host, /*L*/"Current Host"],
|
[content.location.host, /*L*/"Current Host"],
|
||||||
@@ -456,7 +456,7 @@ var Styles = Module("Styles", {
|
|||||||
splitContext: function splitContext(context, title) {
|
splitContext: function splitContext(context, title) {
|
||||||
for (let item of iter({ Active: true, Inactive: false })) {
|
for (let item of iter({ Active: true, Inactive: false })) {
|
||||||
let [name, active] = item;
|
let [name, active] = item;
|
||||||
context.split(name, null, function (context) {
|
context.split(name, null, context => {
|
||||||
context.title[0] = /*L*/name + " " + (title || "Sheets");
|
context.title[0] = /*L*/name + " " + (title || "Sheets");
|
||||||
context.filters.push(item => !!item.active == active);
|
context.filters.push(item => !!item.active == active);
|
||||||
});
|
});
|
||||||
@@ -728,7 +728,7 @@ var Styles = Module("Styles", {
|
|||||||
},
|
},
|
||||||
completion: function initCompletion(dactyl, modules, window) {
|
completion: function initCompletion(dactyl, modules, window) {
|
||||||
const names = Array.slice(DOM(["div"], window.document).style);
|
const names = Array.slice(DOM(["div"], window.document).style);
|
||||||
modules.completion.css = function (context) {
|
modules.completion.css = context => {
|
||||||
context.title = ["CSS Property"];
|
context.title = ["CSS Property"];
|
||||||
context.keys = { text: function (p) p + ":",
|
context.keys = { text: function (p) p + ":",
|
||||||
description: function () "" };
|
description: function () "" };
|
||||||
@@ -755,12 +755,12 @@ var Styles = Module("Styles", {
|
|||||||
let patterns = Styles.patterns;
|
let patterns = Styles.patterns;
|
||||||
|
|
||||||
template.highlightCSS = function highlightCSS(css) {
|
template.highlightCSS = function highlightCSS(css) {
|
||||||
return this.highlightRegexp(css, patterns.property, function (match) {
|
return this.highlightRegexp(css, patterns.property, match => {
|
||||||
if (!match.length)
|
if (!match.length)
|
||||||
return [];
|
return [];
|
||||||
return ["", match.preSpace, template.filter(match.name), ": ",
|
return ["", match.preSpace, template.filter(match.name), ": ",
|
||||||
|
|
||||||
template.highlightRegexp(match.value, patterns.token, function (match) {
|
template.highlightRegexp(match.value, patterns.token, match => {
|
||||||
if (match.function)
|
if (match.function)
|
||||||
return ["", template.filter(match.word),
|
return ["", template.filter(match.word),
|
||||||
template.highlightRegexp(match.function, patterns.string,
|
template.highlightRegexp(match.function, patterns.string,
|
||||||
|
|||||||
@@ -303,8 +303,9 @@ var Template = Module("Template", {
|
|||||||
|
|
||||||
if (processStrings && false)
|
if (processStrings && false)
|
||||||
str = template._highlightFilter(str, "\n",
|
str = template._highlightFilter(str, "\n",
|
||||||
function () ["span", { highlight: "NonText" },
|
() => ["span",
|
||||||
"^J"]);
|
{ highlight: "NonText" },
|
||||||
|
"^J"]);
|
||||||
return ["span", { highlight: "Object" }, str];
|
return ["span", { highlight: "Object" }, str];
|
||||||
case "xml":
|
case "xml":
|
||||||
return arg;
|
return arg;
|
||||||
@@ -446,7 +447,7 @@ var Template = Module("Template", {
|
|||||||
["tr", { highlight: "Title", align: "left" },
|
["tr", { highlight: "Title", align: "left" },
|
||||||
this.map(headings, function (h)
|
this.map(headings, function (h)
|
||||||
["th", {}, h])],
|
["th", {}, h])],
|
||||||
this.map(iter, (row) =>
|
this.map(iter, row =>
|
||||||
["tr", {},
|
["tr", {},
|
||||||
this.map(Iterator(row), ([i, d]) =>
|
this.map(Iterator(row), ([i, d]) =>
|
||||||
["td", { style: style[i] || "" }, d])])];
|
["td", { style: style[i] || "" }, d])])];
|
||||||
@@ -455,7 +456,7 @@ var Template = Module("Template", {
|
|||||||
usage: function usage(iter, format={}) {
|
usage: function usage(iter, format={}) {
|
||||||
let desc = format.description || (item => this.linkifyHelp(item.description));
|
let desc = format.description || (item => this.linkifyHelp(item.description));
|
||||||
let help = format.help || (item => item.name);
|
let help = format.help || (item => item.name);
|
||||||
let sourceLink = (frame) => {
|
let sourceLink = frame => {
|
||||||
let source = this.sourceLink(frame);
|
let source = this.sourceLink(frame);
|
||||||
source[1]["dactyl:hint"] = source[2];
|
source[1]["dactyl:hint"] = source[2];
|
||||||
return source;
|
return source;
|
||||||
@@ -464,14 +465,14 @@ var Template = Module("Template", {
|
|||||||
format.headings ?
|
format.headings ?
|
||||||
["thead", { highlight: "UsageHead" },
|
["thead", { highlight: "UsageHead" },
|
||||||
["tr", { highlight: "Title", align: "left" },
|
["tr", { highlight: "Title", align: "left" },
|
||||||
this.map(format.headings, (h) => ["th", {}, h])]] :
|
this.map(format.headings, h => ["th", {}, h])]] :
|
||||||
[],
|
[],
|
||||||
format.columns ?
|
format.columns ?
|
||||||
["colgroup", {},
|
["colgroup", {},
|
||||||
this.map(format.columns, (c) => ["col", { style: c }])] :
|
this.map(format.columns, c => ["col", { style: c }])] :
|
||||||
[],
|
[],
|
||||||
["tbody", { highlight: "UsageBody" },
|
["tbody", { highlight: "UsageBody" },
|
||||||
this.map(iter, (item) => {
|
this.map(iter, item => {
|
||||||
// Urgh.
|
// Urgh.
|
||||||
let name = item.name || item.names[0];
|
let name = item.name || item.names[0];
|
||||||
let frame = item.definedAt;
|
let frame = item.definedAt;
|
||||||
@@ -484,7 +485,7 @@ var Template = Module("Template", {
|
|||||||
["span", { highlight: "LinkInfo" },
|
["span", { highlight: "LinkInfo" },
|
||||||
_("io.definedAt"), " ",
|
_("io.definedAt"), " ",
|
||||||
sourceLink(frame)]]]],
|
sourceLink(frame)]]]],
|
||||||
item.columns ? this.map(item.columns, (c) => ["td", {}, c]) : [],
|
item.columns ? this.map(item.columns, c => ["td", {}, c]) : [],
|
||||||
["td", {}, desc(item)]];
|
["td", {}, desc(item)]];
|
||||||
})]];
|
})]];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -299,8 +299,8 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
char = char.toLowerCase();
|
char = char.toLowerCase();
|
||||||
|
|
||||||
stack.top.elements.push(update(
|
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 }));
|
{ test: function test(obj) obj[char] != null }));
|
||||||
|
|
||||||
for (let elem of stack)
|
for (let elem of stack)
|
||||||
@@ -505,7 +505,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
|
|
||||||
let patterns = [];
|
let patterns = [];
|
||||||
let substrings = split(pattern, /((?:[^\\{]|\\.)*)\{((?:[^\\}]|\\.)*)\}/gy,
|
let substrings = split(pattern, /((?:[^\\{]|\\.)*)\{((?:[^\\}]|\\.)*)\}/gy,
|
||||||
function (match) {
|
match => {
|
||||||
patterns.push(split(match[2], /((?:[^\\,]|\\.)*),/gy,
|
patterns.push(split(match[2], /((?:[^\\,]|\\.)*),/gy,
|
||||||
null, ",{}"));
|
null, ",{}"));
|
||||||
}, "{}");
|
}, "{}");
|
||||||
@@ -972,7 +972,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
return iter(obj)
|
return iter(obj)
|
||||||
.map(([k, v]) => ["<!ENTITY ", k, " '", String.replace(v == null ? "null" : typeof v == "xml" ? v.toXMLString() : v,
|
.map(([k, v]) => ["<!ENTITY ", k, " '", String.replace(v == null ? "null" : typeof v == "xml" ? v.toXMLString() : v,
|
||||||
typeof v == "xml" ? /['%]/g : /['"%&<>]/g,
|
typeof v == "xml" ? /['%]/g : /['"%&<>]/g,
|
||||||
function (m) map[m]),
|
m => map[m]),
|
||||||
"'>"].join(""))
|
"'>"].join(""))
|
||||||
.join("\n");
|
.join("\n");
|
||||||
},
|
},
|
||||||
@@ -1590,8 +1590,8 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
let done = false;
|
let done = false;
|
||||||
var promise = test,
|
var promise = test,
|
||||||
retVal;
|
retVal;
|
||||||
promise.then((arg) => { retVal = arg; done = true; },
|
promise.then(arg => { retVal = arg; done = true; },
|
||||||
(arg) => { retVal = arg; done = true; });
|
arg => { retVal = arg; done = true; });
|
||||||
test = () => done;
|
test = () => done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ const Config = Module("config", ConfigBase, {
|
|||||||
|
|
||||||
// TODO: mention this to SB devs, they seem keen to provide these
|
// TODO: mention this to SB devs, they seem keen to provide these
|
||||||
// functions to make porting from FF as simple as possible.
|
// functions to make porting from FF as simple as possible.
|
||||||
window.toJavaScriptConsole = function () {
|
window.toJavaScriptConsole = () => {
|
||||||
toOpenWindowByType("global:console", "chrome://global/content/console.xul");
|
toOpenWindowByType("global:console", "chrome://global/content/console.xul");
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -36,42 +36,42 @@ const Config = Module("config", ConfigBase, {
|
|||||||
|
|
||||||
dialogs: {
|
dialogs: {
|
||||||
about: ["About Songbird",
|
about: ["About Songbird",
|
||||||
function () { window.openDialog("chrome://songbird/content/xul/about.xul", "_blank", "chrome,dialog,modal,centerscreen"); }],
|
() => { window.openDialog("chrome://songbird/content/xul/about.xul", "_blank", "chrome,dialog,modal,centerscreen"); }],
|
||||||
addons: ["Manage Add-ons",
|
addons: ["Manage Add-ons",
|
||||||
function () { window.SBOpenPreferences("paneAddons"); }],
|
() => { window.SBOpenPreferences("paneAddons"); }],
|
||||||
checkupdates: ["Check for updates",
|
checkupdates: ["Check for updates",
|
||||||
function () { window.checkForUpdates(); }],
|
() => { window.checkForUpdates(); }],
|
||||||
cookies: ["List your cookies",
|
cookies: ["List your cookies",
|
||||||
function () { window.toOpenWindowByType("Browser:Cookies", "chrome://browser/content/preferences/cookies.xul", "chrome,dialog=no,resizable"); }],
|
() => { window.toOpenWindowByType("Browser:Cookies", "chrome://browser/content/preferences/cookies.xul", "chrome,dialog=no,resizable"); }],
|
||||||
console: ["JavaScript console",
|
console: ["JavaScript console",
|
||||||
function () { window.toJavaScriptConsole(); }],
|
() => { window.toJavaScriptConsole(); }],
|
||||||
dominspector: ["DOM Inspector",
|
dominspector: ["DOM Inspector",
|
||||||
function () { window.inspectDOMDocument(window.content.document); },
|
() => { window.inspectDOMDocument(window.content.document); },
|
||||||
() => "inspectDOMDocument" in window],
|
() => "inspectDOMDocument" in window],
|
||||||
downloads: ["Manage Downloads",
|
downloads: ["Manage Downloads",
|
||||||
function () { window.toOpenWindowByType("Download:Manager", "chrome://mozapps/content/downloads/downloads.xul", "chrome,dialog=no,resizable"); }],
|
() => { window.toOpenWindowByType("Download:Manager", "chrome://mozapps/content/downloads/downloads.xul", "chrome,dialog=no,resizable"); }],
|
||||||
newsmartplaylist: ["Open the file selector dialog",
|
newsmartplaylist: ["Open the file selector dialog",
|
||||||
function () { window.SBNewSmartPlaylist(); }],
|
() => { window.SBNewSmartPlaylist(); }],
|
||||||
openfile: ["Open the file selector dialog",
|
openfile: ["Open the file selector dialog",
|
||||||
function () { window.SBFileOpen(); }],
|
() => { window.SBFileOpen(); }],
|
||||||
pagesource: ["View page source",
|
pagesource: ["View page source",
|
||||||
function () { window.BrowserViewSourceOfDocument(window.content.document); }],
|
() => { window.BrowserViewSourceOfDocument(window.content.document); }],
|
||||||
preferences: ["Show Songbird preferences dialog",
|
preferences: ["Show Songbird preferences dialog",
|
||||||
function () { window.openPreferences(); }],
|
() => { window.openPreferences(); }],
|
||||||
printsetup: ["Setup the page size and orientation before printing",
|
printsetup: ["Setup the page size and orientation before printing",
|
||||||
function () { window.PrintUtils.showPageSetup(); }],
|
() => { window.PrintUtils.showPageSetup(); }],
|
||||||
print: ["Show print dialog",
|
print: ["Show print dialog",
|
||||||
function () { window.PrintUtils.print(); }],
|
() => { window.PrintUtils.print(); }],
|
||||||
saveframe: ["Save frame to disk",
|
saveframe: ["Save frame to disk",
|
||||||
function () { window.saveFrameDocument(); }],
|
() => { window.saveFrameDocument(); }],
|
||||||
savepage: ["Save page to disk",
|
savepage: ["Save page to disk",
|
||||||
function () { window.saveDocument(window.content.document); }],
|
() => { window.saveDocument(window.content.document); }],
|
||||||
searchengines: ["Manage installed search engines",
|
searchengines: ["Manage installed search engines",
|
||||||
function () { window.openDialog("chrome://browser/content/search/engineManager.xul", "_blank", "chrome,dialog,modal,centerscreen"); }],
|
() => { window.openDialog("chrome://browser/content/search/engineManager.xul", "_blank", "chrome,dialog,modal,centerscreen"); }],
|
||||||
selectionsource: ["View selection source",
|
selectionsource: ["View selection source",
|
||||||
function () { modules.buffer.viewSelectionSource(); }],
|
() => { modules.buffer.viewSelectionSource(); }],
|
||||||
subscribe: ["Add a new subscription",
|
subscribe: ["Add a new subscription",
|
||||||
function () { window.SBSubscribe(); }]
|
() => { window.SBSubscribe(); }]
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO: clean this up
|
// TODO: clean this up
|
||||||
@@ -278,7 +278,7 @@ const Config = Module("config", ConfigBase, {
|
|||||||
completion: function initCompletion(dactyl, modules, window) {
|
completion: function initCompletion(dactyl, modules, window) {
|
||||||
const completion = require("completion");
|
const completion = require("completion");
|
||||||
|
|
||||||
completion.displayPane = function (context) {
|
completion.displayPane = context => {
|
||||||
context.title = ["Display Pane"];
|
context.title = ["Display Pane"];
|
||||||
context.completions = Config.displayPanes; // FIXME: useful description etc
|
context.completions = Config.displayPanes; // FIXME: useful description etc
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,55 +12,55 @@ var Config = Module("config", ConfigBase, {
|
|||||||
|
|
||||||
dialogs: {
|
dialogs: {
|
||||||
about: ["About Firefox",
|
about: ["About Firefox",
|
||||||
function () { window.openDialog("chrome://browser/content/aboutDialog.xul", "_blank", "chrome,dialog,modal,centerscreen"); }],
|
() => { window.openDialog("chrome://browser/content/aboutDialog.xul", "_blank", "chrome,dialog,modal,centerscreen"); }],
|
||||||
addbookmark: ["Add bookmark for the current page",
|
addbookmark: ["Add bookmark for the current page",
|
||||||
function () { window.PlacesCommandHook.bookmarkCurrentPage(true, window.PlacesUtils.bookmarksRootId); }],
|
() => { window.PlacesCommandHook.bookmarkCurrentPage(true, window.PlacesUtils.bookmarksRootId); }],
|
||||||
addons: ["Manage Add-ons",
|
addons: ["Manage Add-ons",
|
||||||
function () { window.BrowserOpenAddonsMgr(); }],
|
() => { window.BrowserOpenAddonsMgr(); }],
|
||||||
bookmarks: ["List your bookmarks",
|
bookmarks: ["List your bookmarks",
|
||||||
function () { window.openDialog("chrome://browser/content/bookmarks/bookmarksPanel.xul", "Bookmarks", "dialog,centerscreen,width=600,height=600"); }],
|
() => { window.openDialog("chrome://browser/content/bookmarks/bookmarksPanel.xul", "Bookmarks", "dialog,centerscreen,width=600,height=600"); }],
|
||||||
checkupdates: ["Check for updates",
|
checkupdates: ["Check for updates",
|
||||||
function () { window.checkForUpdates(); },
|
() => { window.checkForUpdates(); },
|
||||||
() => "checkForUpdates" in window],
|
() => "checkForUpdates" in window],
|
||||||
cookies: ["List your cookies",
|
cookies: ["List your cookies",
|
||||||
function () { window.toOpenWindowByType("Browser:Cookies", "chrome://browser/content/preferences/cookies.xul", "chrome,dialog=no,resizable"); }],
|
() => { window.toOpenWindowByType("Browser:Cookies", "chrome://browser/content/preferences/cookies.xul", "chrome,dialog=no,resizable"); }],
|
||||||
console: ["Browser console",
|
console: ["Browser console",
|
||||||
function () { window.HUDService.toggleBrowserConsole(); }],
|
() => { window.HUDService.toggleBrowserConsole(); }],
|
||||||
customizetoolbar: ["Customize the Toolbar",
|
customizetoolbar: ["Customize the Toolbar",
|
||||||
function () { window.BrowserCustomizeToolbar(); }],
|
() => { window.BrowserCustomizeToolbar(); }],
|
||||||
dominspector: ["DOM Inspector",
|
dominspector: ["DOM Inspector",
|
||||||
function () { window.inspectDOMDocument(window.content.document); },
|
() => { window.inspectDOMDocument(window.content.document); },
|
||||||
() => "inspectDOMDocument" in window],
|
() => "inspectDOMDocument" in window],
|
||||||
downloads: ["Manage Downloads",
|
downloads: ["Manage Downloads",
|
||||||
function () { window.BrowserDownloadsUI(); }],
|
() => { window.BrowserDownloadsUI(); }],
|
||||||
history: ["List your history",
|
history: ["List your history",
|
||||||
function () { window.openDialog("chrome://browser/content/history/history-panel.xul", "History", "dialog,centerscreen,width=600,height=600"); }],
|
() => { window.openDialog("chrome://browser/content/history/history-panel.xul", "History", "dialog,centerscreen,width=600,height=600"); }],
|
||||||
openfile: ["Open the file selector dialog",
|
openfile: ["Open the file selector dialog",
|
||||||
function () { window.BrowserOpenFileWindow(); }],
|
() => { window.BrowserOpenFileWindow(); }],
|
||||||
pageinfo: ["Show information about the current page",
|
pageinfo: ["Show information about the current page",
|
||||||
function () { window.BrowserPageInfo(); }],
|
() => { window.BrowserPageInfo(); }],
|
||||||
pagesource: ["View page source",
|
pagesource: ["View page source",
|
||||||
function () { window.BrowserViewSourceOfDocument(window.content.document); }],
|
() => { window.BrowserViewSourceOfDocument(window.content.document); }],
|
||||||
passwords: ["Passwords dialog",
|
passwords: ["Passwords dialog",
|
||||||
function () { window.openDialog("chrome://passwordmgr/content/passwordManager.xul"); }],
|
() => { window.openDialog("chrome://passwordmgr/content/passwordManager.xul"); }],
|
||||||
places: ["Places Organizer: Manage your bookmarks and history",
|
places: ["Places Organizer: Manage your bookmarks and history",
|
||||||
function () { window.PlacesCommandHook.showPlacesOrganizer(window.ORGANIZER_ROOT_BOOKMARKS); }],
|
() => { window.PlacesCommandHook.showPlacesOrganizer(window.ORGANIZER_ROOT_BOOKMARKS); }],
|
||||||
preferences: ["Show Firefox preferences dialog",
|
preferences: ["Show Firefox preferences dialog",
|
||||||
function () { window.openPreferences(); }],
|
() => { window.openPreferences(); }],
|
||||||
printpreview: ["Preview the page before printing",
|
printpreview: ["Preview the page before printing",
|
||||||
function () { window.PrintUtils.printPreview(window.PrintPreviewListener || window.onEnterPrintPreview, window.onExitPrintPreview); }],
|
() => { window.PrintUtils.printPreview(window.PrintPreviewListener || window.onEnterPrintPreview, window.onExitPrintPreview); }],
|
||||||
printsetup: ["Setup the page size and orientation before printing",
|
printsetup: ["Setup the page size and orientation before printing",
|
||||||
function () { window.PrintUtils.showPageSetup(); }],
|
() => { window.PrintUtils.showPageSetup(); }],
|
||||||
print: ["Show print dialog",
|
print: ["Show print dialog",
|
||||||
function () { window.PrintUtils.print(); }],
|
() => { window.PrintUtils.print(); }],
|
||||||
saveframe: ["Save frame to disk",
|
saveframe: ["Save frame to disk",
|
||||||
function () { window.saveFrameDocument(); }],
|
() => { window.saveFrameDocument(); }],
|
||||||
savepage: ["Save page to disk",
|
savepage: ["Save page to disk",
|
||||||
function () { window.saveDocument(window.content.document); }],
|
() => { window.saveDocument(window.content.document); }],
|
||||||
searchengines: ["Manage installed search engines",
|
searchengines: ["Manage installed search engines",
|
||||||
function () { window.openDialog("chrome://browser/content/search/engineManager.xul", "_blank", "chrome,dialog,modal,centerscreen"); }],
|
() => { window.openDialog("chrome://browser/content/search/engineManager.xul", "_blank", "chrome,dialog,modal,centerscreen"); }],
|
||||||
selectionsource: ["View selection source",
|
selectionsource: ["View selection source",
|
||||||
function () { modules.buffer.viewSelectionSource(); }]
|
() => { modules.buffer.viewSelectionSource(); }]
|
||||||
},
|
},
|
||||||
|
|
||||||
removeTab: function removeTab(tab) {
|
removeTab: function removeTab(tab) {
|
||||||
@@ -215,7 +215,7 @@ var Config = Module("config", ConfigBase, {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
events: function initEvents(dactyl, modules, window) {
|
events: function initEvents(dactyl, modules, window) {
|
||||||
modules.events.listen(window, "SidebarFocused", function (event) {
|
modules.events.listen(window, "SidebarFocused", event => {
|
||||||
modules.config.lastSidebar = window.document.getElementById("sidebar-box")
|
modules.config.lastSidebar = window.document.getElementById("sidebar-box")
|
||||||
.getAttribute("sidebarcommand");
|
.getAttribute("sidebarcommand");
|
||||||
}, false);
|
}, false);
|
||||||
|
|||||||
@@ -26,14 +26,14 @@ var Compose = Module("compose", {
|
|||||||
NotifyDocumentWillBeDestroyed: function () {}
|
NotifyDocumentWillBeDestroyed: function () {}
|
||||||
};
|
};
|
||||||
|
|
||||||
events.listen(window.document, "load", function () {
|
events.listen(window.document, "load", () => {
|
||||||
if (window.messageWasEditedExternally === undefined) {
|
if (window.messageWasEditedExternally === undefined) {
|
||||||
window.messageWasEditedExternally = false;
|
window.messageWasEditedExternally = false;
|
||||||
GetCurrentEditor().addDocumentStateListener(stateListener);
|
GetCurrentEditor().addDocumentStateListener(stateListener);
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
events.listen(window, "compose-window-close", function () {
|
events.listen(window, "compose-window-close", () => {
|
||||||
window.messageWasEditedExternally = false;
|
window.messageWasEditedExternally = false;
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,29 +75,29 @@ var Config = Module("config", ConfigBase, {
|
|||||||
|
|
||||||
dialogs: {
|
dialogs: {
|
||||||
about: ["About Thunderbird",
|
about: ["About Thunderbird",
|
||||||
function () { window.openAboutDialog(); }],
|
() => { window.openAboutDialog(); }],
|
||||||
addons: ["Manage Add-ons",
|
addons: ["Manage Add-ons",
|
||||||
function () { window.openAddonsMgr(); }],
|
() => { window.openAddonsMgr(); }],
|
||||||
addressbook: ["Address book",
|
addressbook: ["Address book",
|
||||||
function () { window.toAddressBook(); }],
|
() => { window.toAddressBook(); }],
|
||||||
checkupdates: ["Check for updates",
|
checkupdates: ["Check for updates",
|
||||||
function () { window.checkForUpdates(); }],
|
() => { window.checkForUpdates(); }],
|
||||||
console: ["JavaScript console",
|
console: ["JavaScript console",
|
||||||
function () { window.toJavaScriptConsole(); }],
|
() => { window.toJavaScriptConsole(); }],
|
||||||
dominspector: ["DOM Inspector",
|
dominspector: ["DOM Inspector",
|
||||||
function () { window.inspectDOMDocument(content.document); }],
|
() => { window.inspectDOMDocument(content.document); }],
|
||||||
downloads: ["Manage Downloads",
|
downloads: ["Manage Downloads",
|
||||||
function () { window.toOpenWindowByType('Download:Manager', 'chrome://mozapps/content/downloads/downloads.xul', 'chrome,dialog=no,resizable'); }],
|
() => { window.toOpenWindowByType('Download:Manager', 'chrome://mozapps/content/downloads/downloads.xul', 'chrome,dialog=no,resizable'); }],
|
||||||
preferences: ["Show Thunderbird preferences dialog",
|
preferences: ["Show Thunderbird preferences dialog",
|
||||||
function () { window.openOptionsDialog(); }],
|
() => { window.openOptionsDialog(); }],
|
||||||
printsetup: ["Setup the page size and orientation before printing",
|
printsetup: ["Setup the page size and orientation before printing",
|
||||||
function () { window.PrintUtils.showPageSetup(); }],
|
() => { window.PrintUtils.showPageSetup(); }],
|
||||||
print: ["Show print dialog",
|
print: ["Show print dialog",
|
||||||
function () { window.PrintUtils.print(); }],
|
() => { window.PrintUtils.print(); }],
|
||||||
saveframe: ["Save frame to disk",
|
saveframe: ["Save frame to disk",
|
||||||
function () { window.saveFrameDocument(); }],
|
() => { window.saveFrameDocument(); }],
|
||||||
savepage: ["Save page to disk",
|
savepage: ["Save page to disk",
|
||||||
function () { window.saveDocument(window.content.document); }],
|
() => { window.saveDocument(window.content.document); }],
|
||||||
},
|
},
|
||||||
|
|
||||||
focusChange: function focusChange(win) {
|
focusChange: function focusChange(win) {
|
||||||
|
|||||||
Reference in New Issue
Block a user