1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 07:08:00 +01:00

Normalise naming of module initializer functions.

This commit is contained in:
Doug Kearns
2012-10-11 01:08:36 +11:00
parent 50597cc80a
commit 53f3ea342c
22 changed files with 84 additions and 84 deletions

View File

@@ -299,7 +299,7 @@ var Abbreviations = Module("abbreviations", {
user: contexts.hives.abbrevs.user user: contexts.hives.abbrevs.user
}); });
}, },
completion: function () { completion: function initCompletion() {
completion.abbreviation = function abbreviation(context, modes, group) { completion.abbreviation = function abbreviation(context, modes, group) {
group = group || abbreviations.user; group = group || abbreviations.user;
let fn = modes ? function (abbr) abbr.inModes(modes) : util.identity; let fn = modes ? function (abbr) abbr.inModes(modes) : util.identity;
@@ -307,7 +307,7 @@ var Abbreviations = Module("abbreviations", {
context.completions = group.merged.filter(fn); context.completions = group.merged.filter(fn);
}; };
}, },
commands: function () { commands: function initCommands() {
function addAbbreviationCommands(modes, ch, modeDescription) { function addAbbreviationCommands(modes, ch, modeDescription) {
modes.sort(); modes.sort();
modeDescription = modeDescription ? " in " + modeDescription + " mode" : ""; modeDescription = modeDescription ? " in " + modeDescription + " mode" : "";

View File

@@ -168,7 +168,7 @@ var AutoCommands = Module("autocommands", {
} }
}, { }, {
}, { }, {
contexts: function () { contexts: function initContexts() {
update(AutoCommands.prototype, { update(AutoCommands.prototype, {
hives: contexts.Hives("autocmd", AutoCmdHive), hives: contexts.Hives("autocmd", AutoCmdHive),
user: contexts.hives.autocmd.user, user: contexts.hives.autocmd.user,
@@ -176,7 +176,7 @@ var AutoCommands = Module("autocommands", {
matchingHives: function matchingHives(uri, doc) contexts.matchingGroups(uri, doc).autocmd matchingHives: function matchingHives(uri, doc) contexts.matchingGroups(uri, doc).autocmd
}); });
}, },
commands: function () { commands: function initCommands() {
commands.add(["au[tocmd]"], commands.add(["au[tocmd]"],
"Execute commands automatically on events", "Execute commands automatically on events",
function (args) { function (args) {
@@ -280,15 +280,15 @@ var AutoCommands = Module("autocommands", {
}); });
}); });
}, },
completion: function () { completion: function initCompletion() {
completion.autocmdEvent = function autocmdEvent(context) { completion.autocmdEvent = function autocmdEvent(context) {
context.completions = Iterator(config.autocommands); context.completions = Iterator(config.autocommands);
}; };
}, },
javascript: function () { javascript: function initJavascript() {
JavaScript.setCompleter(AutoCmdHive.prototype.get, [function () Iterator(config.autocommands)]); JavaScript.setCompleter(AutoCmdHive.prototype.get, [function () Iterator(config.autocommands)]);
}, },
options: function () { options: function initOptions() {
options.add(["eventignore", "ei"], options.add(["eventignore", "ei"],
"List of autocommand event names which should be ignored", "List of autocommand event names which should be ignored",
"stringlist", "", "stringlist", "",

View File

@@ -402,7 +402,7 @@ var Bookmarks = Module("bookmarks", {
} }
}, { }, {
}, { }, {
commands: function () { commands: function initCommands() {
// TODO: Clean this up. // TODO: Clean this up.
const tags = { const tags = {
names: ["-tags", "-T"], names: ["-tags", "-T"],
@@ -565,7 +565,7 @@ var Bookmarks = Module("bookmarks", {
privateData: true privateData: true
}); });
}, },
mappings: function () { mappings: function initMappings() {
var myModes = config.browserModes; var myModes = config.browserModes;
mappings.add(myModes, ["a"], mappings.add(myModes, ["a"],
@@ -605,7 +605,7 @@ var Bookmarks = Module("bookmarks", {
"Toggle bookmarked state of current URL", "Toggle bookmarked state of current URL",
function () { bookmarks.toggle(buffer.uri.spec); }); function () { bookmarks.toggle(buffer.uri.spec); });
}, },
options: function () { options: function initOptions() {
options.add(["defsearch", "ds"], options.add(["defsearch", "ds"],
"The default search engine", "The default search engine",
"string", "google", "string", "google",
@@ -622,7 +622,7 @@ var Bookmarks = Module("bookmarks", {
{ completer: function completer(context) completion.searchEngine(context, true), }); { completer: function completer(context) completion.searchEngine(context, true), });
}, },
completion: function () { completion: function initCompletion() {
completion.bookmark = function bookmark(context, tags, extra) { completion.bookmark = function bookmark(context, tags, extra) {
context.title = ["Bookmark", "Title"]; context.title = ["Bookmark", "Title"];
context.format = bookmarks.format; context.format = bookmarks.format;

View File

@@ -1593,7 +1593,7 @@ var CommandLine = Module("commandline", {
return arg; return arg;
} }
}, { }, {
commands: function init_commands() { commands: function initCommands() {
[ [
{ {
name: "ec[ho]", name: "ec[ho]",
@@ -1679,7 +1679,7 @@ var CommandLine = Module("commandline", {
bases: [modes.INSERT] bases: [modes.INSERT]
}); });
}, },
mappings: function init_mappings() { mappings: function initMappings() {
mappings.add([modes.COMMAND], mappings.add([modes.COMMAND],
[":"], "Enter Command Line mode", [":"], "Enter Command Line mode",
@@ -1809,7 +1809,7 @@ var CommandLine = Module("commandline", {
bind(["<C-]>", "<C-5>"], "Expand command line abbreviation", bind(["<C-]>", "<C-5>"], "Expand command line abbreviation",
function () { editor.expandAbbreviation(modes.COMMAND_LINE); }); function () { editor.expandAbbreviation(modes.COMMAND_LINE); });
}, },
options: function init_options() { options: function initOptions() {
options.add(["history", "hi"], options.add(["history", "hi"],
"Number of Ex commands and search patterns to store in the command-line history", "Number of Ex commands and search patterns to store in the command-line history",
"number", 500, "number", 500,
@@ -1825,7 +1825,7 @@ var CommandLine = Module("commandline", {
"number", 100, "number", 100,
{ validator: function (value) value >= 0 }); { validator: function (value) value >= 0 });
}, },
sanitizer: function init_sanitizer() { sanitizer: function initSanitizer() {
sanitizer.addItem("commandline", { sanitizer.addItem("commandline", {
description: "Command-line and search history", description: "Command-line and search history",
persistent: true, persistent: true,

View File

@@ -1234,7 +1234,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
}, { }, {
toolbarHidden: function hidden(elem) (elem.getAttribute("autohide") || elem.getAttribute("collapsed")) == "true" toolbarHidden: function hidden(elem) (elem.getAttribute("autohide") || elem.getAttribute("collapsed")) == "true"
}, { }, {
cache: function () { cache: function initCache() {
cache.register("help/plugins.xml", function () { cache.register("help/plugins.xml", function () {
// Process plugin help entries. // Process plugin help entries.
XML.ignoreWhiteSpace = XML.prettyPrinting = false; XML.ignoreWhiteSpace = XML.prettyPrinting = false;
@@ -1315,11 +1315,11 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
</overlay>; </overlay>;
}); });
}, },
events: function () { events: function initEvents() {
events.listen(window, dactyl, "events", true); events.listen(window, dactyl, "events", true);
}, },
// Only general options are added here, which are valid for all Dactyl extensions // Only general options are added here, which are valid for all Dactyl extensions
options: function () { options: function initOptions() {
options.add(["errorbells", "eb"], options.add(["errorbells", "eb"],
"Ring the bell when an error message is displayed", "Ring the bell when an error message is displayed",
"boolean", false); "boolean", false);
@@ -1494,7 +1494,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
}); });
}, },
mappings: function () { mappings: function initMappings() {
if (dactyl.has("session")) if (dactyl.has("session"))
mappings.add([modes.NORMAL], ["ZQ"], mappings.add([modes.NORMAL], ["ZQ"],
"Quit and don't save the session", "Quit and don't save the session",
@@ -1505,7 +1505,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
function () { dactyl.quit(true); }); function () { dactyl.quit(true); });
}, },
commands: function () { commands: function initCommands() {
commands.add(["dia[log]"], commands.add(["dia[log]"],
"Open a " + config.appName + " dialog", "Open a " + config.appName + " dialog",
function (args) { function (args) {
@@ -1838,7 +1838,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
}, },
completion: function () { completion: function initCompletion() {
completion.dialog = function dialog(context) { completion.dialog = function dialog(context) {
context.title = ["Dialog"]; context.title = ["Dialog"];
context.filters.push(function ({ item }) !item[2] || item[2]()); context.filters.push(function ({ item }) !item[2] || item[2]());
@@ -1869,7 +1869,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
context.completions = dactyl.windows; context.completions = dactyl.windows;
}; };
}, },
load: function () { load: function initLoad() {
dactyl.triggerObserver("load"); dactyl.triggerObserver("load");
dactyl.log(_("dactyl.modulesLoaded"), 3); dactyl.log(_("dactyl.modulesLoaded"), 3);

View File

@@ -688,7 +688,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
return DOM(elem).editor; return DOM(elem).editor;
} }
}, { }, {
modes: function init_modes() { modes: function initModes() {
modes.addMode("OPERATOR", { modes.addMode("OPERATOR", {
char: "o", char: "o",
description: "Mappings which move the cursor", description: "Mappings which move the cursor",
@@ -745,7 +745,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
bases: [modes.INSERT] bases: [modes.INSERT]
}); });
}, },
commands: function init_commands() { commands: function initCommands() {
commands.add(["reg[isters]"], commands.add(["reg[isters]"],
"List the contents of known registers", "List the contents of known registers",
function (args) { function (args) {
@@ -753,7 +753,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
}, },
{ argCount: "*" }); { argCount: "*" });
}, },
completion: function init_completion() { completion: function initCompletion() {
completion.register = function complete_register(context) { completion.register = function complete_register(context) {
context = context.fork("registers"); context = context.fork("registers");
context.keys = { text: util.identity, description: editor.closure.getRegister }; context.keys = { text: util.identity, description: editor.closure.getRegister };
@@ -777,7 +777,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
}); });
}; };
}, },
mappings: function init_mappings() { mappings: function initMappings() {
Map.types["editor"] = { Map.types["editor"] = {
preExecute: function preExecute(args) { preExecute: function preExecute(args) {
@@ -1346,7 +1346,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
bind(["<C-n>"], "Select the next autocomplete result", bind(["<C-n>"], "Select the next autocomplete result",
function () { events.feedkeys("<Down>", { skipmap: true }); }); function () { events.feedkeys("<Down>", { skipmap: true }); });
}, },
options: function init_options() { options: function initOptions() {
options.add(["editor"], options.add(["editor"],
"The external text editor", "The external text editor",
"string", 'gvim -f +<line> +"sil! call cursor(0, <column>)" <file>', { "string", 'gvim -f +<line> +"sil! call cursor(0, <column>)" <file>', {
@@ -1391,7 +1391,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
} }
}); });
}, },
sanitizer: function () { sanitizer: function initSanitizer() {
sanitizer.addItem("registers", { sanitizer.addItem("registers", {
description: "Register values", description: "Register values",
persistent: true, persistent: true,

View File

@@ -983,7 +983,7 @@ var Events = Module("events", {
}); });
}, },
commands: function () { commands: function initCommands() {
commands.add(["delmac[ros]"], commands.add(["delmac[ros]"],
"Delete macros", "Delete macros",
function (args) { function (args) {
@@ -1009,13 +1009,13 @@ var Events = Module("events", {
completer: function (context) completion.macro(context) completer: function (context) completion.macro(context)
}); });
}, },
completion: function () { completion: function initCompletion() {
completion.macro = function macro(context) { completion.macro = function macro(context) {
context.title = ["Macro", "Keys"]; context.title = ["Macro", "Keys"];
context.completions = [item for (item in events.getMacros())]; context.completions = [item for (item in events.getMacros())];
}; };
}, },
mappings: function () { mappings: function initMappings() {
mappings.add([modes.MAIN], mappings.add([modes.MAIN],
["<A-b>", "<pass-next-key-builtin>"], "Process the next key as a builtin mapping", ["<A-b>", "<pass-next-key-builtin>"], "Process the next key as a builtin mapping",
@@ -1097,7 +1097,7 @@ var Events = Module("events", {
}, },
{ count: true }); { count: true });
}, },
options: function () { options: function initOptions() {
const Hive = Class("Hive", { const Hive = Class("Hive", {
init: function init(values, map) { init: function init(values, map) {
this.name = "passkeys:" + map; this.name = "passkeys:" + map;

View File

@@ -175,7 +175,7 @@ var History = Module("history", {
} }
}, { }, {
}, { }, {
commands: function () { commands: function initCommands() {
commands.add(["ba[ck]"], commands.add(["ba[ck]"],
"Go back in the browser history", "Go back in the browser history",
function (args) { function (args) {
@@ -321,7 +321,7 @@ var History = Module("history", {
{ argCount: "0" }); { argCount: "0" });
}, },
completion: function () { completion: function initCompletion() {
completion.domain = function (context) { completion.domain = function (context) {
context.anchored = false; context.anchored = false;
context.compare = function (a, b) String.localeCompare(a.key, b.key); context.compare = function (a, b) String.localeCompare(a.key, b.key);
@@ -351,7 +351,7 @@ var History = Module("history", {
completion.addUrlCompleter("history", "History", completion.history); completion.addUrlCompleter("history", "History", completion.history);
}, },
mappings: function () { mappings: function initMappings() {
function bind() mappings.add.apply(mappings, [config.browserModes].concat(Array.slice(arguments))); function bind() mappings.add.apply(mappings, [config.browserModes].concat(Array.slice(arguments)));
bind(["<C-o>"], "Go to an older position in the jump list", bind(["<C-o>"], "Go to an older position in the jump list",

View File

@@ -332,7 +332,7 @@ var Marks = Module("marks", {
{ arg: true }); { arg: true });
}, },
commands: function () { commands: function initCommands() {
commands.add(["delm[arks]"], commands.add(["delm[arks]"],
"Delete the specified marks", "Delete the specified marks",
function (args) { function (args) {
@@ -372,7 +372,7 @@ var Marks = Module("marks", {
}); });
}, },
completion: function () { completion: function initCompletion() {
completion.mark = function mark(context) { completion.mark = function mark(context) {
function percent(i) Math.round(i * 100); function percent(i) Math.round(i * 100);
@@ -383,7 +383,7 @@ var Marks = Module("marks", {
context.completions = marks.all; context.completions = marks.all;
}; };
}, },
sanitizer: function () { sanitizer: function initSanitizer() {
sanitizer.addItem("marks", { sanitizer.addItem("marks", {
description: "Local and URL marks", description: "Local and URL marks",
persistent: true, persistent: true,

View File

@@ -118,7 +118,7 @@ var QuickMarks = Module("quickmarks", {
} }
}, { }, {
}, { }, {
commands: function () { commands: function initCommands() {
commands.add(["delqm[arks]"], commands.add(["delqm[arks]"],
"Delete the specified QuickMarks", "Delete the specified QuickMarks",
function (args) { function (args) {
@@ -175,13 +175,13 @@ var QuickMarks = Module("quickmarks", {
completer: function (context) completion.quickmark(context), completer: function (context) completion.quickmark(context),
}); });
}, },
completion: function () { completion: function initCompletion() {
completion.quickmark = function (context) { completion.quickmark = function (context) {
context.title = ["QuickMark", "URL"]; context.title = ["QuickMark", "URL"];
context.generate = function () Iterator(quickmarks._qmarks); context.generate = function () Iterator(quickmarks._qmarks);
}; };
}, },
mappings: function () { mappings: function initMappings() {
var myModes = config.browserModes; var myModes = config.browserModes;
mappings.add(myModes, mappings.add(myModes,

View File

@@ -596,10 +596,10 @@ var Tabs = Module("tabs", {
services.sessionStore.setTabState(to, tabState); services.sessionStore.setTabState(to, tabState);
} }
}, { }, {
load: function init_load() { load: function initLoad() {
tabs.updateTabCount(); tabs.updateTabCount();
}, },
commands: function init_commands() { commands: function initCommands() {
[ [
{ {
name: ["bd[elete]"], name: ["bd[elete]"],
@@ -1015,7 +1015,7 @@ var Tabs = Module("tabs", {
{ argCount: "0" }); { argCount: "0" });
} }
}, },
completion: function init_completion() { completion: function initCompletion() {
completion.buffer = function buffer(context, visible) { completion.buffer = function buffer(context, visible) {
let { tabs } = modules; let { tabs } = modules;
@@ -1096,7 +1096,7 @@ var Tabs = Module("tabs", {
}; };
}; };
}, },
events: function init_events() { events: function initEvents() {
let tabContainer = config.tabbrowser.mTabContainer; let tabContainer = config.tabbrowser.mTabContainer;
function callback() { function callback() {
tabs.timeout(function () { this.updateTabCount(); }); tabs.timeout(function () { this.updateTabCount(); });
@@ -1105,7 +1105,7 @@ var Tabs = Module("tabs", {
events.listen(tabContainer, event, callback, false); events.listen(tabContainer, event, callback, false);
events.listen(tabContainer, "TabSelect", tabs.closure._onTabSelect, false); events.listen(tabContainer, "TabSelect", tabs.closure._onTabSelect, false);
}, },
mappings: function init_mappings() { mappings: function initMappings() {
mappings.add([modes.COMMAND], ["<C-t>", "<new-tab-next>"], mappings.add([modes.COMMAND], ["<C-t>", "<new-tab-next>"],
"Execute the next mapping in a new tab", "Execute the next mapping in a new tab",
@@ -1199,7 +1199,7 @@ var Tabs = Module("tabs", {
{ count: true }); { count: true });
} }
}, },
options: function init_options() { options: function initOptions() {
options.add(["showtabline", "stal"], options.add(["showtabline", "stal"],
"Define when the tab bar is visible", "Define when the tab bar is visible",
"string", true, "string", true,

View File

@@ -357,7 +357,7 @@ var Addons = Module("addons", {
.toObject()) .toObject())
}, { }, {
}, { }, {
commands: function (dactyl, modules, window) { commands: function initCommands(dactyl, modules, window) {
const { CommandOption, commands, completion, io } = modules; const { CommandOption, commands, completion, io } = modules;
commands.add(["addo[ns]", "ao"], commands.add(["addo[ns]", "ao"],
@@ -458,7 +458,7 @@ var Addons = Module("addons", {
}); });
}); });
}, },
completion: function (dactyl, modules, window) { completion: function initCompletion(dactyl, modules, window) {
completion.addonType = function addonType(context) { completion.addonType = function addonType(context) {
let base = ["extension", "theme"]; let base = ["extension", "theme"];
function update(types) { function update(types) {

View File

@@ -1114,7 +1114,7 @@ var Completion = Module("completion", {
get options() this.modules.options get options() this.modules.options
}); });
}, },
commands: function (dactyl, modules, window) { commands: function initCommands(dactyl, modules, window) {
const { commands, completion } = modules; const { commands, completion } = modules;
commands.add(["contexts"], commands.add(["contexts"],
"List the completion contexts used during completion of an Ex command", "List the completion contexts used during completion of an Ex command",
@@ -1135,7 +1135,7 @@ var Completion = Module("completion", {
literal: 0 literal: 0
}); });
}, },
options: function (dactyl, modules, window) { options: function initOptions(dactyl, modules, window) {
const { completion, options } = modules; const { completion, options } = modules;
let wildmode = { let wildmode = {
values: { values: {

View File

@@ -261,7 +261,7 @@ var RangeFinder = Module("rangefinder", {
get onSubmit() modules.rangefinder.closure.onSubmit get onSubmit() modules.rangefinder.closure.onSubmit
}); });
}, },
mappings: function (dactyl, modules, window) { mappings: function initMappings(dactyl, modules, window) {
const { Buffer, buffer, config, mappings, modes, rangefinder } = modules; const { Buffer, buffer, config, mappings, modes, rangefinder } = modules;
var myModes = config.browserModes.concat([modes.CARET]); var myModes = config.browserModes.concat([modes.CARET]);
@@ -296,7 +296,7 @@ var RangeFinder = Module("rangefinder", {
}); });
}, },
options: function (dactyl, modules, window) { options: function initOptions(dactyl, modules, window) {
const { options, rangefinder } = modules; const { options, rangefinder } = modules;
options.add(["hlfind", "hlf"], options.add(["hlfind", "hlf"],

View File

@@ -413,7 +413,7 @@ var Help = Module("Help", {
}) })
}, { }, {
}, { }, {
commands: function init_commands(dactyl, modules, window) { commands: function initCommands(dactyl, modules, window) {
const { commands, completion, help } = modules; const { commands, completion, help } = modules;
[ [
@@ -440,7 +440,7 @@ var Help = Module("Help", {
}); });
}); });
}, },
completion: function init_completion(dactyl, modules, window) { completion: function initCompletion(dactyl, modules, window) {
const { completion } = modules; const { completion } = modules;
completion.help = function completion_help(context, consolidated) { completion.help = function completion_help(context, consolidated) {
@@ -452,7 +452,7 @@ var Help = Module("Help", {
context.keys = { text: 0, description: function () "all" }; context.keys = { text: 0, description: function () "all" };
}; };
}, },
mappings: function init_mappings(dactyl, modules, window) { mappings: function initMappings(dactyl, modules, window) {
const { help, mappings, modes } = modules; const { help, mappings, modes } = modules;
mappings.add([modes.MAIN], ["<open-help>", "<F1>"], mappings.add([modes.MAIN], ["<open-help>", "<F1>"],
@@ -463,7 +463,7 @@ var Help = Module("Help", {
"Open the single, consolidated help page", "Open the single, consolidated help page",
function () { modules.ex.helpall(); }); function () { modules.ex.helpall(); });
}, },
javascript: function init_javascript(dactyl, modules, window) { javascript: function initJavascript(dactyl, modules, window) {
modules.JavaScript.setCompleter([modules.help.exportHelp], modules.JavaScript.setCompleter([modules.help.exportHelp],
[function (context, args) overlay.activeModules.completion.file(context)]); [function (context, args) overlay.activeModules.completion.file(context)]);
} }

View File

@@ -575,7 +575,7 @@ var IO = Module("io", {
*/ */
PATH_SEP: deprecated("File.PATH_SEP", { get: function PATH_SEP() File.PATH_SEP }) PATH_SEP: deprecated("File.PATH_SEP", { get: function PATH_SEP() File.PATH_SEP })
}, { }, {
commands: function init_commands(dactyl, modules, window) { commands: function initCommands(dactyl, modules, window) {
const { commands, completion, io } = modules; const { commands, completion, io } = modules;
commands.add(["cd", "chd[ir]"], commands.add(["cd", "chd[ir]"],
@@ -929,7 +929,7 @@ unlet s:cpo_save
literal: 0 literal: 0
}); });
}, },
completion: function init_completion(dactyl, modules, window) { completion: function initCompletion(dactyl, modules, window) {
const { completion, io } = modules; const { completion, io } = modules;
completion.charset = function (context) { completion.charset = function (context) {
@@ -1077,7 +1077,7 @@ unlet s:cpo_save
completion.file(context, full); completion.file(context, full);
}); });
}, },
javascript: function init_javascript(dactyl, modules, window) { javascript: function initJavascript(dactyl, modules, window) {
modules.JavaScript.setCompleter([File, File.expandPath], modules.JavaScript.setCompleter([File, File.expandPath],
[function (context, obj, args) { [function (context, obj, args) {
context.quote[2] = ""; context.quote[2] = "";
@@ -1096,7 +1096,7 @@ unlet s:cpo_save
input: true input: true
}); });
}, },
options: function init_options(dactyl, modules, window) { options: function initOptions(dactyl, modules, window) {
const { completion, options } = modules; const { completion, options } = modules;
var shell, shellcmdflag; var shell, shellcmdflag;

View File

@@ -879,7 +879,7 @@ var JavaScript = Module("javascript", {
bind(["<C-b>", "<PageUp>"], "Scroll up half a page", bind(["<C-b>", "<PageUp>"], "Scroll up half a page",
function ({ self }) { self.repl.scrollVertical("pages", -1); }); function ({ self }) { self.repl.scrollVertical("pages", -1); });
}, },
options: function (dactyl, modules, window) { options: function initOptions(dactyl, modules, window) {
modules.options.add(["jsdebugger", "jsd"], modules.options.add(["jsdebugger", "jsd"],
"Enable the JavaScript debugger service for use in JavaScript completion", "Enable the JavaScript debugger service for use in JavaScript completion",
"boolean", false, { "boolean", false, {

View File

@@ -386,12 +386,12 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
yield p; yield p;
} }
}, { }, {
load: function (dactyl, modules, window) { load: function initLoad(dactyl, modules, window) {
if (!sanitizer.firstRun++ && sanitizer.runAtShutdown && !sanitizer.ranAtShutdown) if (!sanitizer.firstRun++ && sanitizer.runAtShutdown && !sanitizer.ranAtShutdown)
sanitizer.sanitizeItems(null, Range(), null, "shutdown"); sanitizer.sanitizeItems(null, Range(), null, "shutdown");
sanitizer.ranAtShutdown = false; sanitizer.ranAtShutdown = false;
}, },
autocommands: function (dactyl, modules, window) { autocommands: function initAutocommands(dactyl, modules, window) {
const { autocommands } = modules; const { autocommands } = modules;
storage.addObserver("private-mode", storage.addObserver("private-mode",
@@ -406,7 +406,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
autocommands.trigger("Sanitize", { name: event.substr("clear-".length), domain: value[1] }); autocommands.trigger("Sanitize", { name: event.substr("clear-".length), domain: value[1] });
}, window); }, window);
}, },
commands: function (dactyl, modules, window) { commands: function initCommands(dactyl, modules, window) {
const { commands } = modules; const { commands } = modules;
commands.add(["sa[nitize]"], commands.add(["sa[nitize]"],
"Clear private data", "Clear private data",
@@ -565,7 +565,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
}, },
}); });
}, },
completion: function (dactyl, modules, window) { completion: function initCompletion(dactyl, modules, window) {
modules.completion.visibleHosts = function completeHosts(context) { modules.completion.visibleHosts = function completeHosts(context) {
let res = util.visibleHosts(window.content); let res = util.visibleHosts(window.content);
if (context.filter && !res.some(function (host) host.indexOf(context.filter) >= 0)) if (context.filter && !res.some(function (host) host.indexOf(context.filter) >= 0))
@@ -578,7 +578,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
context.completions = res; context.completions = res;
}; };
}, },
options: function (dactyl, modules) { options: function initOptions(dactyl, modules) {
const options = modules.options; const options = modules.options;
if (services.has("privateBrowsing")) if (services.has("privateBrowsing"))
options.add(["private", "pornmode"], options.add(["private", "pornmode"],

View File

@@ -547,7 +547,7 @@ var Styles = Module("Styles", {
return '"' + str.replace(/([\\"])/g, "\\$1").replace(/\n/g, "\\00000a") + '"'; return '"' + str.replace(/([\\"])/g, "\\$1").replace(/\n/g, "\\00000a") + '"';
}, },
}, { }, {
commands: function (dactyl, modules, window) { commands: function initCommands(dactyl, modules, window) {
const { commands, contexts, styles } = modules; const { commands, contexts, styles } = modules;
function sheets(context, args, filter) { function sheets(context, args, filter) {
@@ -696,7 +696,7 @@ var Styles = Module("Styles", {
}); });
}); });
}, },
contexts: function (dactyl, modules, window) { contexts: function initContexts(dactyl, modules, window) {
modules.contexts.Hives("styles", modules.contexts.Hives("styles",
Class("LocalHive", Contexts.Hive, { Class("LocalHive", Contexts.Hive, {
init: function init(group) { init: function init(group) {
@@ -717,7 +717,7 @@ var Styles = Module("Styles", {
} }
})); }));
}, },
completion: function (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 = function (context) {
context.title = ["CSS Property"]; context.title = ["CSS Property"];
@@ -732,7 +732,7 @@ var Styles = Module("Styles", {
} }
}; };
}, },
javascript: function (dactyl, modules, window) { javascript: function initJavascript(dactyl, modules, window) {
modules.JavaScript.setCompleter(["get", "add", "remove", "find"].map(function (m) Hive.prototype[m]), modules.JavaScript.setCompleter(["get", "add", "remove", "find"].map(function (m) Hive.prototype[m]),
[ // Prototype: (name, filter, css, index) [ // Prototype: (name, filter, css, index)
function (context, obj, args) this.names, function (context, obj, args) this.names,
@@ -741,7 +741,7 @@ var Styles = Module("Styles", {
function (context, obj, args) this.sheets function (context, obj, args) this.sheets
]); ]);
}, },
template: function () { template: function initTemplate() {
let patterns = Styles.patterns; let patterns = Styles.patterns;
template.highlightCSS = function highlightCSS(css) { template.highlightCSS = function highlightCSS(css) {
@@ -769,7 +769,7 @@ var Styles = Module("Styles", {
}{ match.postSpace }</> }{ match.postSpace }</>
}) })
} }
}, }
}); });
endModule(); endModule();

View File

@@ -456,7 +456,7 @@ const Player = Module("player", {
}); });
}, },
commandline: function () { commandline: function initCommandline() {
player.CommandMode = Class("CommandSearchViewMode", modules.CommandMode, { player.CommandMode = Class("CommandSearchViewMode", modules.CommandMode, {
init: function init(mode) { init: function init(mode) {
this.mode = mode; this.mode = mode;
@@ -472,7 +472,7 @@ const Player = Module("player", {
get onSubmit() player.closure.onSearchSubmit get onSubmit() player.closure.onSearchSubmit
}); });
}, },
commands: function () { commands: function initCommands() {
commands.add(["f[ilter]"], commands.add(["f[ilter]"],
"Filter tracks based on keywords {genre/artist/album/track}", "Filter tracks based on keywords {genre/artist/album/track}",
function (args) { function (args) {
@@ -672,7 +672,7 @@ const Player = Module("player", {
}, },
{ argCount: "1" }); { argCount: "1" });
}, },
completion: function () { completion: function initCompletion() {
completion.album = function album(context, artist) { completion.album = function album(context, artist) {
context.title = ["Album"]; context.title = ["Album"];
context.completions = [[v, ""] for ([, v] in Iterator(library.getAlbums(artist)))]; context.completions = [[v, ""] for ([, v] in Iterator(library.getAlbums(artist)))];
@@ -708,7 +708,7 @@ const Player = Module("player", {
context.completions = [[v, ""] for ([, v] in Iterator(library.getTracks(artist, album)))]; context.completions = [[v, ""] for ([, v] in Iterator(library.getTracks(artist, album)))];
}; };
}, },
mappings: function () { mappings: function initMappings() {
mappings.add([modes.PLAYER], mappings.add([modes.PLAYER],
["x"], "Play track", ["x"], "Play track",
function () { ex.playerplay(); }); function () { ex.playerplay(); });
@@ -806,7 +806,7 @@ const Player = Module("player", {
}; };
} }
}, },
options: function () { options: function initOptions() {
options.add(["repeat"], options.add(["repeat"],
"Set the playback repeat mode", "Set the playback repeat mode",
"number", 0, "number", 0,

View File

@@ -94,7 +94,7 @@ var Config = Module("config", ConfigBase, {
}, { }, {
}, { }, {
commands: function (dactyl, modules, window) { commands: function initCommands(dactyl, modules, window) {
const { commands, completion, config } = modules; const { commands, completion, config } = modules;
const { document } = window; const { document } = window;
@@ -205,7 +205,7 @@ var Config = Module("config", ConfigBase, {
privateData: true privateData: true
}); });
}, },
completion: function (dactyl, modules, window) { completion: function initCompletion(dactyl, modules, window) {
const { CompletionContext, bookmarkcache, completion } = modules; const { CompletionContext, bookmarkcache, completion } = modules;
const { document } = window; const { document } = window;
@@ -224,7 +224,7 @@ var Config = Module("config", ConfigBase, {
context.completions = Array.map(menu.childNodes, function (n) [n.getAttribute("label"), ""]); context.completions = Array.map(menu.childNodes, function (n) [n.getAttribute("label"), ""]);
}; };
}, },
events: function (dactyl, modules, window) { events: function initEvents(dactyl, modules, window) {
modules.events.listen(window, "SidebarFocused", function (event) { modules.events.listen(window, "SidebarFocused", function (event) {
modules.config.lastSidebar = window.document.getElementById("sidebar-box") modules.config.lastSidebar = window.document.getElementById("sidebar-box")
.getAttribute("sidebarcommand"); .getAttribute("sidebarcommand");
@@ -237,7 +237,7 @@ var Config = Module("config", ConfigBase, {
"Handled by " + config.host, "Handled by " + config.host,
function () Events.PASS_THROUGH); function () Events.PASS_THROUGH);
}, },
options: function (dactyl, modules, window) { options: function initOptions(dactyl, modules, window) {
modules.options.add(["online"], modules.options.add(["online"],
"Enables or disables offline mode", "Enables or disables offline mode",
"boolean", true, "boolean", true,

View File

@@ -88,7 +88,7 @@ var Addressbook = Module("addressbook", {
} }
}, { }, {
}, { }, {
commands: function () { commands: function initCommands() {
commands.add(["con[tact]"], commands.add(["con[tact]"],
"Add an address book entry", "Add an address book entry",
function (args) { function (args) {
@@ -117,7 +117,7 @@ var Addressbook = Module("addressbook", {
function (args) { addressbook.list(args.string, args.bang); }, function (args) { addressbook.list(args.string, args.bang); },
{ bang: true }); { bang: true });
}, },
mappings: function () { mappings: function initMappings() {
var myModes = config.mailModes; var myModes = config.mailModes;
mappings.add(myModes, ["a"], mappings.add(myModes, ["a"],