1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 17:57:58 +01:00

move remaining global constructor functions to the vimperator namespace

This commit is contained in:
Doug Kearns
2007-10-21 10:39:23 +00:00
parent 79577bea5f
commit e410df4439
13 changed files with 155 additions and 153 deletions

View File

@@ -27,7 +27,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
}}} ***** END LICENSE BLOCK *****/ }}} ***** END LICENSE BLOCK *****/
// also includes methods for dealing with keywords and search engines // also includes methods for dealing with keywords and search engines
function Bookmarks() //{{{ vimperator.Bookmarks = function() //{{{
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION ///////////////////////////////////////// ////////////////////// PRIVATE SECTION /////////////////////////////////////////
@@ -328,7 +328,7 @@ function Bookmarks() //{{{
//}}} //}}}
} //}}} } //}}}
function History() //{{{ vimperator.History = function() //{{{
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION ///////////////////////////////////////// ////////////////////// PRIVATE SECTION /////////////////////////////////////////
@@ -477,7 +477,7 @@ function History() //{{{
//}}} //}}}
} //}}} } //}}}
function Marks() //{{{ vimperator.Marks = function() //{{{
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION ///////////////////////////////////////// ////////////////////// PRIVATE SECTION /////////////////////////////////////////
@@ -732,7 +732,7 @@ function Marks() //{{{
//}}} //}}}
} //}}} } //}}}
function QuickMarks() //{{{ vimperator.QuickMarks = function() //{{{
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION ///////////////////////////////////////// ////////////////////// PRIVATE SECTION /////////////////////////////////////////

View File

@@ -26,7 +26,7 @@ the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL. the terms of any one of the MPL, the GPL or the LGPL.
}}} ***** END LICENSE BLOCK *****/ }}} ***** END LICENSE BLOCK *****/
function Buffer() //{{{ vimperator.Buffer = function() //{{{
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION ///////////////////////////////////////// ////////////////////// PRIVATE SECTION /////////////////////////////////////////

View File

@@ -26,7 +26,7 @@ the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL. the terms of any one of the MPL, the GPL or the LGPL.
}}} ***** END LICENSE BLOCK *****/ }}} ***** END LICENSE BLOCK *****/
function Command(specs, action, extra_info) //{{{ vimperator.Command = function(specs, action, extra_info) //{{{
{ {
if (!specs || !action) if (!specs || !action)
return null; return null;
@@ -90,14 +90,14 @@ function Command(specs, action, extra_info) //{{{
} }
Command.prototype.execute = function(args, special, count, modifiers) vimperator.Command.prototype.execute = function(args, special, count, modifiers)
{ {
this.action.call(this, args, special, count, modifiers); this.action.call(this, args, special, count, modifiers);
} }
// return true if the candidate name matches one of the command's aliases // return true if the candidate name matches one of the command's aliases
// (including all acceptable abbreviations) // (including all acceptable abbreviations)
Command.prototype.hasName = function(name) vimperator.Command.prototype.hasName = function(name)
{ {
// match a candidate name against a command name abbreviation spec - returning // match a candidate name against a command name abbreviation spec - returning
// true if the candidate matches unambiguously // true if the candidate matches unambiguously
@@ -123,7 +123,7 @@ Command.prototype.hasName = function(name)
} }
//}}} //}}}
function Commands() //{{{ vimperator.Commands = function() //{{{
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION ///////////////////////////////////////// ////////////////////// PRIVATE SECTION /////////////////////////////////////////
@@ -143,7 +143,7 @@ function Commands() //{{{
function addDefaultCommand(command) function addDefaultCommand(command)
{ {
ex_commands.push(command); ex_commands.push(command);
Commands.prototype[command.name] = function(args, special, count, modifiers) vimperator.Commands.prototype[command.name] = function(args, special, count, modifiers)
{ {
command.execute(args, special, count, modifiers); command.execute(args, special, count, modifiers);
} }
@@ -522,14 +522,14 @@ function Commands() //{{{
////////////////////// DEFAULT COMMANDS //////////////////////////////////////// ////////////////////// DEFAULT COMMANDS ////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{ /////////////////////////////////////////////////////////////////////////////{{{
addDefaultCommand(new Command(["addo[ns]"], addDefaultCommand(new vimperator.Command(["addo[ns]"],
function() { vimperator.open("chrome://mozapps/content/extensions/extensions.xul", vimperator.NEW_TAB); }, function() { vimperator.open("chrome://mozapps/content/extensions/extensions.xul", vimperator.NEW_TAB); },
{ {
short_help: "Show available Browser Extensions and Themes", short_help: "Show available Browser Extensions and Themes",
help: "You can add/remove/disable browser extensions from this dialog.<br/>Be aware that not all Firefox extensions work, because Vimperator overrides some keybindings and changes Firefox's GUI." help: "You can add/remove/disable browser extensions from this dialog.<br/>Be aware that not all Firefox extensions work, because Vimperator overrides some keybindings and changes Firefox's GUI."
} }
)); ));
addDefaultCommand(new Command(["ba[ck]"], addDefaultCommand(new vimperator.Command(["ba[ck]"],
function(args, special, count) function(args, special, count)
{ {
if (special) if (special)
@@ -572,7 +572,7 @@ function Commands() //{{{
} }
} }
)); ));
addDefaultCommand(new Command(["bd[elete]", "bw[ipeout]", "bun[load]", "tabc[lose]"], addDefaultCommand(new vimperator.Command(["bd[elete]", "bw[ipeout]", "bun[load]", "tabc[lose]"],
function(args, special, count) { vimperator.tabs.remove(getBrowser().mCurrentTab, count, special, 0); }, function(args, special, count) { vimperator.tabs.remove(getBrowser().mCurrentTab, count, special, 0); },
{ {
usage: ["[count]bd[elete][!]"], usage: ["[count]bd[elete][!]"],
@@ -581,13 +581,13 @@ function Commands() //{{{
"Do <code class=\"command\">:bdelete!</code> to select the tab to the left after removing the current tab." "Do <code class=\"command\">:bdelete!</code> to select the tab to the left after removing the current tab."
} }
)); ));
addDefaultCommand(new Command(["beep"], addDefaultCommand(new vimperator.Command(["beep"],
function() { vimperator.beep(); }, function() { vimperator.beep(); },
{ {
short_help: "Play a system beep" short_help: "Play a system beep"
} }
)); ));
addDefaultCommand(new Command(["bma[rk]"], addDefaultCommand(new vimperator.Command(["bma[rk]"],
function(args) function(args)
{ {
var res = parseArgs(args, this.args); var res = parseArgs(args, this.args);
@@ -620,7 +620,7 @@ function Commands() //{{{
[["-keyword", "-k"], OPTION_STRING, function(arg) { return /\w/.test(arg); } ]] [["-keyword", "-k"], OPTION_STRING, function(arg) { return /\w/.test(arg); } ]]
} }
)); ));
addDefaultCommand(new Command(["bmarks"], addDefaultCommand(new vimperator.Command(["bmarks"],
function(args, special) function(args, special)
{ {
var res = parseArgs(args, this.args); var res = parseArgs(args, this.args);
@@ -641,7 +641,7 @@ function Commands() //{{{
args: [[["-tags", "-T"], OPTION_LIST]] args: [[["-tags", "-T"], OPTION_LIST]]
} }
)); ));
addDefaultCommand(new Command(["b[uffer]"], addDefaultCommand(new vimperator.Command(["b[uffer]"],
function(args, special) { vimperator.buffer.switchTo(args, special); }, function(args, special) { vimperator.buffer.switchTo(args, special); },
{ {
usage: ["b[uffer][!] {url|index}"], usage: ["b[uffer][!] {url|index}"],
@@ -654,7 +654,7 @@ function Commands() //{{{
completer: function(filter) { return vimperator.completion.get_buffer_completions(filter); } completer: function(filter) { return vimperator.completion.get_buffer_completions(filter); }
} }
)); ));
addDefaultCommand(new Command(["buffers", "files", "ls", "tabs"], addDefaultCommand(new vimperator.Command(["buffers", "files", "ls", "tabs"],
function(args, special) function(args, special)
{ {
if (args) if (args)
@@ -672,7 +672,7 @@ function Commands() //{{{
"Call the special version of this command again to close the window." "Call the special version of this command again to close the window."
} }
)); ));
addDefaultCommand(new Command(["delbm[arks]"], addDefaultCommand(new vimperator.Command(["delbm[arks]"],
function(args, special) function(args, special)
{ {
var url = args; var url = args;
@@ -693,7 +693,7 @@ function Commands() //{{{
completer: function(filter) { return vimperator.bookmarks.get(filter); } completer: function(filter) { return vimperator.bookmarks.get(filter); }
} }
)); ));
addDefaultCommand(new Command(["com[mand]"], addDefaultCommand(new vimperator.Command(["com[mand]"],
function(args) function(args)
{ {
var res = parseArgs(args, this.args); var res = parseArgs(args, this.args);
@@ -711,7 +711,7 @@ function Commands() //{{{
[["-bar"], OPTION_NOARG]] [["-bar"], OPTION_NOARG]]
} }
)); ));
addDefaultCommand(new Command(["delm[arks]"], addDefaultCommand(new vimperator.Command(["delm[arks]"],
function(args, special) function(args, special)
{ {
if (!special && !args) if (!special && !args)
@@ -764,7 +764,7 @@ function Commands() //{{{
} }
)); ));
addDefaultCommand(new Command(["delqm[arks]"], addDefaultCommand(new vimperator.Command(["delqm[arks]"],
function(args, special) function(args, special)
{ {
// TODO: finish arg parsing - we really need a proper way to do this. :) // TODO: finish arg parsing - we really need a proper way to do this. :)
@@ -793,7 +793,7 @@ function Commands() //{{{
"<code class=\"command\">:delqmarks!</code> deletes all QuickMarks" "<code class=\"command\">:delqmarks!</code> deletes all QuickMarks"
} }
)); ));
addDefaultCommand(new Command(["downl[oads]", "dl"], addDefaultCommand(new vimperator.Command(["downl[oads]", "dl"],
function() { vimperator.open("chrome://mozapps/content/downloads/downloads.xul", vimperator.NEW_TAB); }, function() { vimperator.open("chrome://mozapps/content/downloads/downloads.xul", vimperator.NEW_TAB); },
{ {
short_help: "Show progress of current downloads", short_help: "Show progress of current downloads",
@@ -829,7 +829,7 @@ function Commands() //{{{
return arg; return arg;
} }
addDefaultCommand(new Command(["ec[ho]"], addDefaultCommand(new vimperator.Command(["ec[ho]"],
function(args) function(args)
{ {
var res = argToString(args, true); var res = argToString(args, true);
@@ -845,7 +845,7 @@ function Commands() //{{{
completer: function(filter) { return vimperator.completion.javascript(filter); } completer: function(filter) { return vimperator.completion.javascript(filter); }
} }
)); ));
addDefaultCommand(new Command(["echoe[rr]"], addDefaultCommand(new vimperator.Command(["echoe[rr]"],
function(args) function(args)
{ {
var res = argToString(args, false); var res = argToString(args, false);
@@ -859,7 +859,7 @@ function Commands() //{{{
completer: function(filter) { return vimperator.completion.javascript(filter); } completer: function(filter) { return vimperator.completion.javascript(filter); }
} }
)); ));
addDefaultCommand(new Command(["exe[cute]"], addDefaultCommand(new vimperator.Command(["exe[cute]"],
function(args) function(args)
{ {
// TODO: :exec has some difficult semantics -> later // TODO: :exec has some difficult semantics -> later
@@ -877,13 +877,13 @@ function Commands() //{{{
help: "Example: <code class=\"command\">:execute echo test</code> shows a message with the text &#34;test&#34;.<br/>" help: "Example: <code class=\"command\">:execute echo test</code> shows a message with the text &#34;test&#34;.<br/>"
} }
)); ));
addDefaultCommand(new Command(["exu[sage]"], addDefaultCommand(new vimperator.Command(["exu[sage]"],
function(args, special, count, modifiers) { vimperator.help("commands", special, null, modifiers); }, function(args, special, count, modifiers) { vimperator.help("commands", special, null, modifiers); },
{ {
short_help: "Show help for Ex commands" short_help: "Show help for Ex commands"
} }
)); ));
addDefaultCommand(new Command(["fo[rward]", "fw"], addDefaultCommand(new vimperator.Command(["fo[rward]", "fw"],
function(args, special, count) function(args, special, count)
{ {
if (special) if (special)
@@ -926,14 +926,14 @@ function Commands() //{{{
} }
} }
)); ));
addDefaultCommand(new Command(["ha[rdcopy]"], addDefaultCommand(new vimperator.Command(["ha[rdcopy]"],
function() { getBrowser().contentWindow.print(); }, function() { getBrowser().contentWindow.print(); },
{ {
short_help: "Print current document", short_help: "Print current document",
help: "Open a GUI dialog where you can select the printer, number of copies, orientation, etc." help: "Open a GUI dialog where you can select the printer, number of copies, orientation, etc."
} }
)); ));
addDefaultCommand(new Command(["h[elp]"], addDefaultCommand(new vimperator.Command(["h[elp]"],
function(args, special, count, modifiers) { vimperator.help(args, special, null, modifiers); }, function(args, special, count, modifiers) { vimperator.help(args, special, null, modifiers); },
{ {
usage: ["h[elp] {subject}"], usage: ["h[elp] {subject}"],
@@ -949,7 +949,7 @@ function Commands() //{{{
completer: function(filter) { return vimperator.completion.get_help_completions(filter); } completer: function(filter) { return vimperator.completion.get_help_completions(filter); }
} }
)); ));
addDefaultCommand(new Command(["hist[ory]", "hs"], addDefaultCommand(new vimperator.Command(["hist[ory]", "hs"],
function(args, special) { vimperator.history.list(args, special); }, function(args, special) { vimperator.history.list(args, special); },
{ {
usage: ["hist[ory] [filter]", "history!"], usage: ["hist[ory] [filter]", "history!"],
@@ -959,7 +959,7 @@ function Commands() //{{{
completer: function(filter) { return vimperator.history.get(filter); } completer: function(filter) { return vimperator.history.get(filter); }
} }
)); ));
addDefaultCommand(new Command(["javas[cript]", "js"], addDefaultCommand(new vimperator.Command(["javas[cript]", "js"],
function(args, special) function(args, special)
{ {
if (special) // open javascript console if (special) // open javascript console
@@ -1008,7 +1008,7 @@ function Commands() //{{{
completer: function(filter) { return vimperator.completion.javascript(filter); } completer: function(filter) { return vimperator.completion.javascript(filter); }
} }
)); ));
addDefaultCommand(new Command(["let"], addDefaultCommand(new vimperator.Command(["let"],
function(args) function(args)
{ {
if (!args) if (!args)
@@ -1095,7 +1095,7 @@ function Commands() //{{{
"Without arguments, displays a list of all variables." "Without arguments, displays a list of all variables."
} }
)); ));
addDefaultCommand(new Command(["map"], addDefaultCommand(new vimperator.Command(["map"],
// 0 args -> list all maps // 0 args -> list all maps
// 1 arg -> list the maps starting with args // 1 arg -> list the maps starting with args
// 2 args -> map arg1 to arg* // 2 args -> map arg1 to arg*
@@ -1138,7 +1138,7 @@ function Commands() //{{{
"Mappings are NOT saved during sessions, make sure you put them in your vimperatorrc file!" "Mappings are NOT saved during sessions, make sure you put them in your vimperatorrc file!"
} }
)); ));
addDefaultCommand(new Command(["mapc[lear]"], addDefaultCommand(new vimperator.Command(["mapc[lear]"],
function(args) function(args)
{ {
if (args) if (args)
@@ -1155,7 +1155,7 @@ function Commands() //{{{
"<code class=\"command\">:map</code> or <code class=\"command\">:noremap</code> are cleared." "<code class=\"command\">:map</code> or <code class=\"command\">:noremap</code> are cleared."
} }
)); ));
addDefaultCommand(new Command(["ma[rk]"], addDefaultCommand(new vimperator.Command(["ma[rk]"],
function(args) function(args)
{ {
if (!args) if (!args)
@@ -1181,7 +1181,7 @@ function Commands() //{{{
short_help: "Mark current location within the web page" short_help: "Mark current location within the web page"
} }
)); ));
addDefaultCommand(new Command(["marks"], addDefaultCommand(new vimperator.Command(["marks"],
function(args) function(args)
{ {
// ignore invalid mark characters unless there are no valid mark chars // ignore invalid mark characters unless there are no valid mark chars
@@ -1200,7 +1200,7 @@ function Commands() //{{{
help: "If <code class=\"argument\">[arg]</code> is specified then limit the list to those marks mentioned." help: "If <code class=\"argument\">[arg]</code> is specified then limit the list to those marks mentioned."
} }
)); ));
addDefaultCommand(new Command(["mkv[imperatorrc]"], addDefaultCommand(new vimperator.Command(["mkv[imperatorrc]"],
function(args, special) function(args, special)
{ {
var filename; var filename;
@@ -1251,7 +1251,7 @@ function Commands() //{{{
"WARNING: this differs from Vim's behaviour which defaults to writing the file in the current directory." "WARNING: this differs from Vim's behaviour which defaults to writing the file in the current directory."
} }
)); ));
addDefaultCommand(new Command(["noh[lsearch]"], addDefaultCommand(new vimperator.Command(["noh[lsearch]"],
function(args) function(args)
{ {
vimperator.search.clear(); vimperator.search.clear();
@@ -1262,7 +1262,7 @@ function Commands() //{{{
"<code class=\"option\">'hlsearch'</code> option is set." "<code class=\"option\">'hlsearch'</code> option is set."
} }
)); ));
addDefaultCommand(new Command(["norm[al]"], addDefaultCommand(new vimperator.Command(["norm[al]"],
function(args) function(args)
{ {
if (!args) if (!args)
@@ -1280,7 +1280,7 @@ function Commands() //{{{
} }
)); ));
// TODO: remove duplication in :map // TODO: remove duplication in :map
addDefaultCommand(new Command(["no[remap]"], addDefaultCommand(new vimperator.Command(["no[remap]"],
// 0 args -> list all maps // 0 args -> list all maps
// 1 arg -> list the maps starting with args // 1 arg -> list the maps starting with args
// 2 args -> map arg1 to arg* // 2 args -> map arg1 to arg*
@@ -1333,7 +1333,7 @@ function Commands() //{{{
help: "No remapping of the <code class=\"argument\">{rhs}</code> is performed.<br/>NOTE: :noremap does not yet work as reliably as :map." help: "No remapping of the <code class=\"argument\">{rhs}</code> is performed.<br/>NOTE: :noremap does not yet work as reliably as :map."
} }
)); ));
addDefaultCommand(new Command(["o[pen]", "e[dit]"], addDefaultCommand(new vimperator.Command(["o[pen]", "e[dit]"],
function(args, special) function(args, special)
{ {
if (args) if (args)
@@ -1376,13 +1376,13 @@ function Commands() //{{{
completer: function(filter) { return vimperator.completion.get_url_completions(filter); } completer: function(filter) { return vimperator.completion.get_url_completions(filter); }
} }
)); ));
addDefaultCommand(new Command(["pc[lose]"], addDefaultCommand(new vimperator.Command(["pc[lose]"],
function() { vimperator.previewwindow.hide(); }, function() { vimperator.previewwindow.hide(); },
{ {
short_help: "Close preview window on bottom of screen" short_help: "Close preview window on bottom of screen"
} }
)); ));
addDefaultCommand(new Command(["pref[erences]", "prefs"], addDefaultCommand(new vimperator.Command(["pref[erences]", "prefs"],
function(args, special, count, modifiers) function(args, special, count, modifiers)
{ {
if (!args) if (!args)
@@ -1414,7 +1414,7 @@ function Commands() //{{{
"<code class=\"command\">:prefs!</code> opens about:config in the current tab where you can change advanced Firefox preferences." "<code class=\"command\">:prefs!</code> opens about:config in the current tab where you can change advanced Firefox preferences."
} }
)); ));
addDefaultCommand(new Command(["qma[rk]"], addDefaultCommand(new vimperator.Command(["qma[rk]"],
function(args) function(args)
{ {
if (!args) if (!args)
@@ -1440,7 +1440,7 @@ function Commands() //{{{
"<code class=\"command\">:qmark f http://forum1.com, http://forum2.com, imdb some artist</code>" "<code class=\"command\">:qmark f http://forum1.com, http://forum2.com, imdb some artist</code>"
} }
)); ));
addDefaultCommand(new Command(["qmarks"], addDefaultCommand(new vimperator.Command(["qmarks"],
function(args) function(args)
{ {
// ignore invalid mark characters unless there are no valid mark chars // ignore invalid mark characters unless there are no valid mark chars
@@ -1459,7 +1459,7 @@ function Commands() //{{{
help: "If <code class=\"argument\">[arg]</code> is specified then limit the list to those QuickMarks mentioned." help: "If <code class=\"argument\">[arg]</code> is specified then limit the list to those QuickMarks mentioned."
} }
)); ));
addDefaultCommand(new Command(["q[uit]"], addDefaultCommand(new vimperator.Command(["q[uit]"],
function() { vimperator.tabs.remove(getBrowser().mCurrentTab, 1, false, 1); }, function() { vimperator.tabs.remove(getBrowser().mCurrentTab, 1, false, 1); },
{ {
short_help: "Quit current tab", short_help: "Quit current tab",
@@ -1467,14 +1467,14 @@ function Commands() //{{{
"last window, close Vimperator. When quitting Vimperator, the session is not stored." "last window, close Vimperator. When quitting Vimperator, the session is not stored."
} }
)); ));
addDefaultCommand(new Command(["quita[ll]", "qa[ll]"], addDefaultCommand(new vimperator.Command(["quita[ll]", "qa[ll]"],
function() { vimperator.quit(false); }, function() { vimperator.quit(false); },
{ {
short_help: "Quit Vimperator", short_help: "Quit Vimperator",
help: "Quit Vimperator, no matter how many tabs/windows are open. The session is not stored." help: "Quit Vimperator, no matter how many tabs/windows are open. The session is not stored."
} }
)); ));
addDefaultCommand(new Command(["redr[aw]"], addDefaultCommand(new vimperator.Command(["redr[aw]"],
function() function()
{ {
var wu = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor). var wu = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
@@ -1486,7 +1486,7 @@ function Commands() //{{{
help: "Useful to update the screen halfway executing a script or function." help: "Useful to update the screen halfway executing a script or function."
} }
)); ));
addDefaultCommand(new Command(["re[load]"], addDefaultCommand(new vimperator.Command(["re[load]"],
function(args, special) { vimperator.tabs.reload(getBrowser().mCurrentTab, special); }, function(args, special) { vimperator.tabs.reload(getBrowser().mCurrentTab, special); },
{ {
usage: ["re[load][!]"], usage: ["re[load][!]"],
@@ -1494,7 +1494,7 @@ function Commands() //{{{
help: "Forces reloading of the current page. If <code class=\"command\">!</code> is given, skip the cache." help: "Forces reloading of the current page. If <code class=\"command\">!</code> is given, skip the cache."
} }
)); ));
addDefaultCommand(new Command(["reloada[ll]"], addDefaultCommand(new vimperator.Command(["reloada[ll]"],
function(args, special) { vimperator.tabs.reloadAll(special); }, function(args, special) { vimperator.tabs.reloadAll(special); },
{ {
usage: ["reloada[ll][!]"], usage: ["reloada[ll][!]"],
@@ -1502,14 +1502,14 @@ function Commands() //{{{
help: "Forces reloading of all pages. If <code class=\"command\">!</code> is given, skip the cache." help: "Forces reloading of all pages. If <code class=\"command\">!</code> is given, skip the cache."
} }
)); ));
addDefaultCommand(new Command(["res[tart]"], addDefaultCommand(new vimperator.Command(["res[tart]"],
function() { vimperator.restart(); }, function() { vimperator.restart(); },
{ {
short_help: "Force the browser to restart", short_help: "Force the browser to restart",
help: "Useful when installing extensions." help: "Useful when installing extensions."
} }
)); ));
addDefaultCommand(new Command(["sav[eas]", "w[rite]"], addDefaultCommand(new vimperator.Command(["sav[eas]", "w[rite]"],
function() { saveDocument(window.content.document); }, function() { saveDocument(window.content.document); },
{ {
short_help: "Save current web page to disk", short_help: "Save current web page to disk",
@@ -1517,7 +1517,7 @@ function Commands() //{{{
"There, you can save the current web page to disk with various options." "There, you can save the current web page to disk with various options."
} }
)); ));
addDefaultCommand(new Command(["se[t]"], addDefaultCommand(new vimperator.Command(["se[t]"],
function(args, special, count, modifiers) function(args, special, count, modifiers)
{ {
if (special) if (special)
@@ -1682,7 +1682,7 @@ function Commands() //{{{
} }
)); ));
// TODO: sclose instead? // TODO: sclose instead?
addDefaultCommand(new Command(["sbcl[ose]"], addDefaultCommand(new vimperator.Command(["sbcl[ose]"],
function(args) function(args)
{ {
if (args) if (args)
@@ -1700,7 +1700,7 @@ function Commands() //{{{
)); ));
// TODO: sopen instead? Separate :sidebar from :sbopen and make them behave // TODO: sopen instead? Separate :sidebar from :sbopen and make them behave
// more like :cw, :cope etc // more like :cw, :cope etc
addDefaultCommand(new Command(["sideb[ar]", "sb[ar]", "sbope[n]"], addDefaultCommand(new vimperator.Command(["sideb[ar]", "sb[ar]", "sbope[n]"],
function(args) function(args)
{ {
if (!args) if (!args)
@@ -1735,7 +1735,7 @@ function Commands() //{{{
completer: function(filter) { return vimperator.completion.get_sidebar_completions(filter); } completer: function(filter) { return vimperator.completion.get_sidebar_completions(filter); }
} }
)); ));
addDefaultCommand(new Command(["so[urce]"], addDefaultCommand(new vimperator.Command(["so[urce]"],
function(args) function(args)
{ {
// FIXME: implement proper filename quoting // FIXME: implement proper filename quoting
@@ -1762,14 +1762,14 @@ function Commands() //{{{
completer: function(filter) { return vimperator.completion.get_file_completions(filter); } completer: function(filter) { return vimperator.completion.get_file_completions(filter); }
} }
)); ));
addDefaultCommand(new Command(["st[op]"], addDefaultCommand(new vimperator.Command(["st[op]"],
BrowserStop, BrowserStop,
{ {
short_help: "Stop loading", short_help: "Stop loading",
help: "Stop loading current web page." help: "Stop loading current web page."
} }
)); ));
addDefaultCommand(new Command(["tab"], addDefaultCommand(new vimperator.Command(["tab"],
function(args) { vimperator.execute(args, { inTab: true }); }, function(args) { vimperator.execute(args, { inTab: true }); },
{ {
usage: ["tab {cmd}"], usage: ["tab {cmd}"],
@@ -1780,13 +1780,13 @@ function Commands() //{{{
completer: function(filter) { return vimperator.completion.get_command_completions(filter); } completer: function(filter) { return vimperator.completion.get_command_completions(filter); }
} }
)); ));
addDefaultCommand(new Command(["tabl[ast]"], addDefaultCommand(new vimperator.Command(["tabl[ast]"],
function() { vimperator.tabs.select("$", false); }, function() { vimperator.tabs.select("$", false); },
{ {
short_help: "Switch to the last tab" short_help: "Switch to the last tab"
} }
)); ));
addDefaultCommand(new Command(["tabm[ove]"], addDefaultCommand(new vimperator.Command(["tabm[ove]"],
function(args, special) { vimperator.tabs.move(getBrowser().mCurrentTab, args, special); }, function(args, special) { vimperator.tabs.move(getBrowser().mCurrentTab, args, special); },
{ {
usage: ["tabm[ove] [N]", "tabm[ove][!] +N | -N"], usage: ["tabm[ove] [N]", "tabm[ove][!] +N | -N"],
@@ -1795,20 +1795,20 @@ function Commands() //{{{
"N can also be prefixed with '+' or '-' to indicate a relative movement. If <code class=\"command\">!</code> is specified the movement wraps around the start or end of the tab list." "N can also be prefixed with '+' or '-' to indicate a relative movement. If <code class=\"command\">!</code> is specified the movement wraps around the start or end of the tab list."
} }
)); ));
addDefaultCommand(new Command(["tabn[ext]", "tn[ext]"], addDefaultCommand(new vimperator.Command(["tabn[ext]", "tn[ext]"],
function() { vimperator.tabs.select("+1", true); }, function() { vimperator.tabs.select("+1", true); },
{ {
short_help: "Switch to the next tab", short_help: "Switch to the next tab",
help: "Cycles to the first tab, when the last is selected." help: "Cycles to the first tab, when the last is selected."
} }
)); ));
addDefaultCommand(new Command(["tabo[nly]"], addDefaultCommand(new vimperator.Command(["tabo[nly]"],
function() { vimperator.tabs.keepOnly(getBrowser().mCurrentTab); }, function() { vimperator.tabs.keepOnly(getBrowser().mCurrentTab); },
{ {
short_help: "Close all other tabs" short_help: "Close all other tabs"
} }
)); ));
addDefaultCommand(new Command(["tabopen", "t[open]", "tabnew", "tabe[dit]"], addDefaultCommand(new vimperator.Command(["tabopen", "t[open]", "tabnew", "tabe[dit]"],
function(args, special) function(args, special)
{ {
var where = special ? vimperator.NEW_TAB : vimperator.NEW_BACKGROUND_TAB; var where = special ? vimperator.NEW_TAB : vimperator.NEW_BACKGROUND_TAB;
@@ -1828,7 +1828,7 @@ function Commands() //{{{
completer: function(filter) { return vimperator.completion.get_url_completions(filter); } completer: function(filter) { return vimperator.completion.get_url_completions(filter); }
} }
)); ));
addDefaultCommand(new Command(["tabp[revious]", "tp[revious]", "tabN[ext]", "tN[ext]"], addDefaultCommand(new vimperator.Command(["tabp[revious]", "tp[revious]", "tabN[ext]", "tN[ext]"],
function() { vimperator.tabs.select("-1", true); }, function() { vimperator.tabs.select("-1", true); },
{ {
usage: ["tabp[revious]", "tabN[ext]"], usage: ["tabp[revious]", "tabN[ext]"],
@@ -1836,14 +1836,14 @@ function Commands() //{{{
help: "Cycles to the last tab, when the first is selected." help: "Cycles to the last tab, when the first is selected."
} }
)); ));
addDefaultCommand(new Command(["tabr[ewind]", "tabfir[st]"], addDefaultCommand(new vimperator.Command(["tabr[ewind]", "tabfir[st]"],
function() { vimperator.tabs.select(0, false); }, function() { vimperator.tabs.select(0, false); },
{ {
usage: ["tabr[ewind]", "tabfir[st]"], usage: ["tabr[ewind]", "tabfir[st]"],
short_help: "Switch to the first tab" short_help: "Switch to the first tab"
} }
)); ));
addDefaultCommand(new Command(["time"], addDefaultCommand(new vimperator.Command(["time"],
function(args, special, count) function(args, special, count)
{ {
if (!count || count < 1) if (!count || count < 1)
@@ -1928,7 +1928,7 @@ function Commands() //{{{
"Use the special version with [!] if you just want to run any command multiple times without showing profiling statistics." "Use the special version with [!] if you just want to run any command multiple times without showing profiling statistics."
} }
)); ));
addDefaultCommand(new Command(["u[ndo]"], addDefaultCommand(new vimperator.Command(["u[ndo]"],
function(args, special, count) function(args, special, count)
{ {
if (count < 1) if (count < 1)
@@ -1972,7 +1972,7 @@ function Commands() //{{{
} }
} }
)); ));
addDefaultCommand(new Command(["undoa[ll]"], addDefaultCommand(new vimperator.Command(["undoa[ll]"],
function(args, special, count) function(args, special, count)
{ {
if (count || special) if (count || special)
@@ -1988,7 +1988,7 @@ function Commands() //{{{
help: "Firefox stores up to 10 closed tabs, even after a browser restart." help: "Firefox stores up to 10 closed tabs, even after a browser restart."
} }
)), )),
addDefaultCommand(new Command(["unl[et]"], addDefaultCommand(new vimperator.Command(["unl[et]"],
function(args, special) function(args, special)
{ {
if (!args) if (!args)
@@ -2017,7 +2017,7 @@ function Commands() //{{{
"Several variable names can be given." "Several variable names can be given."
} }
)); ));
addDefaultCommand(new Command(["unm[ap]"], addDefaultCommand(new vimperator.Command(["unm[ap]"],
function(args) function(args)
{ {
if (!args) if (!args)
@@ -2039,7 +2039,7 @@ function Commands() //{{{
help: "" help: ""
} }
)); ));
addDefaultCommand(new Command(["ve[rsion]"], addDefaultCommand(new vimperator.Command(["ve[rsion]"],
function(args, special) function(args, special)
{ {
if (special) if (special)
@@ -2054,13 +2054,13 @@ function Commands() //{{{
help: "You can show the Firefox version page with <code class=\"command\">:version!</code>." help: "You can show the Firefox version page with <code class=\"command\">:version!</code>."
} }
)); ));
addDefaultCommand(new Command(["viu[sage]"], addDefaultCommand(new vimperator.Command(["viu[sage]"],
function(args, special, count, modifiers) { vimperator.help("mappings", special, null, modifiers); }, function(args, special, count, modifiers) { vimperator.help("mappings", special, null, modifiers); },
{ {
short_help: "Show help for normal mode commands" short_help: "Show help for normal mode commands"
} }
)); ));
addDefaultCommand(new Command(["winc[lose]", "wc[lose]"], addDefaultCommand(new vimperator.Command(["winc[lose]", "wc[lose]"],
function(args) function(args)
{ {
window.close(); window.close();
@@ -2070,7 +2070,7 @@ function Commands() //{{{
short_help: "Close window", short_help: "Close window",
} }
)); ));
addDefaultCommand(new Command(["wino[pen]", "wo[pen]", "wine[dit]"], addDefaultCommand(new vimperator.Command(["wino[pen]", "wo[pen]", "wine[dit]"],
function(args) function(args)
{ {
if (args) if (args)
@@ -2084,7 +2084,7 @@ function Commands() //{{{
help: "Like <code class=\"command\">:open</code> but open URLs in a new window.<br/>" help: "Like <code class=\"command\">:open</code> but open URLs in a new window.<br/>"
} }
)); ));
addDefaultCommand(new Command(["wqa[ll]", "wq", "xa[ll]"], addDefaultCommand(new vimperator.Command(["wqa[ll]", "wq", "xa[ll]"],
function() { vimperator.quit(true); }, function() { vimperator.quit(true); },
{ {
usage: ["wqa[ll]", "xa[ll]"], usage: ["wqa[ll]", "xa[ll]"],
@@ -2093,7 +2093,7 @@ function Commands() //{{{
"<code class=\"command\">:wq</code> is different as in Vim, as it closes the window instead of just one tab by popular demand. Complain on the mailing list, if you want to change that." "<code class=\"command\">:wq</code> is different as in Vim, as it closes the window instead of just one tab by popular demand. Complain on the mailing list, if you want to change that."
} }
)); ));
addDefaultCommand(new Command(["zo[om]"], addDefaultCommand(new vimperator.Command(["zo[om]"],
function(args, special) function(args, special)
{ {
var level; var level;
@@ -2138,7 +2138,7 @@ function Commands() //{{{
"Normally this command operates on the text zoom, if used with <code class=\"argument\">[!]</code> it operates on full zoom." "Normally this command operates on the text zoom, if used with <code class=\"argument\">[!]</code> it operates on full zoom."
} }
)); ));
addDefaultCommand(new Command(["!", "run"], addDefaultCommand(new vimperator.Command(["!", "run"],
function(args, special) function(args, special)
{ {
// :!! needs to be treated specially as the command parser sets the special flag but removes the ! from args // :!! needs to be treated specially as the command parser sets the special flag but removes the ! from args

View File

@@ -26,7 +26,7 @@ the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL. the terms of any one of the MPL, the GPL or the LGPL.
}}} ***** END LICENSE BLOCK *****/ }}} ***** END LICENSE BLOCK *****/
vimperator.completion = (function() // {{{ vimperator.Completion = function() // {{{
{ {
// The completion substrings, used for showing the longest common match // The completion substrings, used for showing the longest common match
var g_substrings = []; var g_substrings = [];
@@ -612,6 +612,6 @@ vimperator.completion = (function() // {{{
} //}}} } //}}}
} }
})(); // }}} } // }}}
// vim: set fdm=marker sw=4 ts=4 et: // vim: set fdm=marker sw=4 ts=4 et:

View File

@@ -17,7 +17,7 @@
// command names taken from: // command names taken from:
// http://developer.mozilla.org/en/docs/Editor_Embedding_Guide // http://developer.mozilla.org/en/docs/Editor_Embedding_Guide
function Editor() //{{{ vimperator.Editor = function() //{{{
{ {
// store our last search with f,F,t or T // store our last search with f,F,t or T
var last_findChar = null; var last_findChar = null;

View File

@@ -26,7 +26,7 @@ the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL. the terms of any one of the MPL, the GPL or the LGPL.
}}} ***** END LICENSE BLOCK *****/ }}} ***** END LICENSE BLOCK *****/
function Events() //{{{ vimperator.Events = function() //{{{
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION ///////////////////////////////////////// ////////////////////// PRIVATE SECTION /////////////////////////////////////////

View File

@@ -37,7 +37,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
// : incremental searches shouldn't permanently update search modifiers // : incremental searches shouldn't permanently update search modifiers
// make sure you only create this object when the "vimperator" object is ready // make sure you only create this object when the "vimperator" object is ready
function Search() //{{{ vimperator.Search = function() //{{{
{ {
var self = this; // needed for callbacks since "this" is the "vimperator" object in a callback var self = this; // needed for callbacks since "this" is the "vimperator" object in a callback
var found = false; // true if the last search was successful var found = false; // true if the last search was successful

View File

@@ -22,7 +22,7 @@
* *
}}} ***** END LICENSE BLOCK *****/ }}} ***** END LICENSE BLOCK *****/
function Hints() //{{{ vimperator.Hints = function() //{{{
{ {
const HINT_PREFIX = 'hah_hint_'; // prefix for the hint id const HINT_PREFIX = 'hah_hint_'; // prefix for the hint id

View File

@@ -27,13 +27,11 @@ the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL. the terms of any one of the MPL, the GPL or the LGPL.
}}} ***** END LICENSE BLOCK *****/ }}} ***** END LICENSE BLOCK *****/
vimperator.io = (function() vimperator.IO = function()
{ {
var environment_service = Components.classes["@mozilla.org/process/environment;1"] var environment_service = Components.classes["@mozilla.org/process/environment;1"]
.getService(Components.interfaces.nsIEnvironment); .getService(Components.interfaces.nsIEnvironment);
vimperator.log("Loading vimperator.io");
return { return {
MODE_RDONLY: 0x01, MODE_RDONLY: 0x01,
@@ -237,6 +235,6 @@ vimperator.io = (function()
ofstream.close(); ofstream.close();
} }
} }
})(); }
// vim: set fdm=marker sw=4 ts=4 et: // vim: set fdm=marker sw=4 ts=4 et:

View File

@@ -26,7 +26,7 @@ the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL. the terms of any one of the MPL, the GPL or the LGPL.
}}} ***** END LICENSE BLOCK *****/ }}} ***** END LICENSE BLOCK *****/
function Option(names, type, extra_info) //{{{ vimperator.Option = function(names, type, extra_info) //{{{
{ {
if (!names || !type) if (!names || !type)
return null; return null;
@@ -107,7 +107,7 @@ function Option(names, type, extra_info) //{{{
} }
} //}}} } //}}}
function Options() //{{{ vimperator.Options = function() //{{{
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION ///////////////////////////////////////// ////////////////////// PRIVATE SECTION /////////////////////////////////////////
@@ -118,13 +118,6 @@ function Options() //{{{
var vimperator_prefs = firefox_prefs.getBranch("extensions.vimperator."); var vimperator_prefs = firefox_prefs.getBranch("extensions.vimperator.");
var options = []; var options = [];
function addOption(option)
{
Options.prototype.__defineGetter__(option.name, function() { return option.value; });
Options.prototype.__defineSetter__(option.name, function(value) { option.value = value; });
options.push(option);
}
function optionsIterator() function optionsIterator()
{ {
for (var i = 0; i < options.length; i++) for (var i = 0; i < options.length; i++)
@@ -311,6 +304,13 @@ function Options() //{{{
return null; return null;
} }
this.add = function(option)
{
this.__defineGetter__(option.name, function() { return option.value; });
this.__defineSetter__(option.name, function(value) { option.value = value; });
options.push(option);
}
this.destroy = function() this.destroy = function()
{ {
// reset some modified firefox prefs // reset some modified firefox prefs
@@ -392,7 +392,7 @@ function Options() //{{{
"//xhtml:*[@onclick or @onmouseover or @onmousedown or @onmouseup or @oncommand or @class='lk' or @class='s'] | " + "//xhtml:*[@onclick or @onmouseover or @onmousedown or @onmouseup or @oncommand or @class='lk' or @class='s'] | " +
"//xhtml:input[not(@type='hidden')] | //xhtml:a | //xhtml:area | //xhtml:iframe | //xhtml:textarea | //xhtml:button | //xhtml:select" "//xhtml:input[not(@type='hidden')] | //xhtml:a | //xhtml:area | //xhtml:iframe | //xhtml:textarea | //xhtml:button | //xhtml:select"
addOption(new Option(["activate", "act"], "stringlist", this.add(new vimperator.Option(["activate", "act"], "stringlist",
{ {
short_help: "Define when tabs are automatically activated", short_help: "Define when tabs are automatically activated",
help: "Available items:<br/>" + help: "Available items:<br/>" +
@@ -405,13 +405,13 @@ function Options() //{{{
default_value: "homepage,quickmark,tabopen,paste" default_value: "homepage,quickmark,tabopen,paste"
} }
)); ));
addOption(new Option(["autohints", "ah"], "boolean", this.add(new vimperator.Option(["autohints", "ah"], "boolean",
{ {
short_help: "Automatically show hints on every web page", short_help: "Automatically show hints on every web page",
default_value: false default_value: false
} }
)); ));
addOption(new Option(["complete", "cpt"], "charlist", this.add(new vimperator.Option(["complete", "cpt"], "charlist",
{ {
short_help: "Items which are completed at the :[tab]open prompt", short_help: "Items which are completed at the :[tab]open prompt",
help: "Available items:<br/>" + help: "Available items:<br/>" +
@@ -427,7 +427,7 @@ function Options() //{{{
validator: function (value) { if (/[^sfbh]/.test(value)) return false; else return true; } validator: function (value) { if (/[^sfbh]/.test(value)) return false; else return true; }
} }
)); ));
addOption(new Option(["defsearch", "ds"], "string", this.add(new vimperator.Option(["defsearch", "ds"], "string",
{ {
short_help: "Set the default search engine", short_help: "Set the default search engine",
help: "The default search engine is used in the <code class=\"command\">:[tab]open [arg]</code> command " + help: "The default search engine is used in the <code class=\"command\">:[tab]open [arg]</code> command " +
@@ -436,7 +436,7 @@ function Options() //{{{
default_value: "google" default_value: "google"
} }
)); ));
addOption(new Option(["editor"], "string", this.add(new vimperator.Option(["editor"], "string",
{ {
short_help: "Set the external text editor", short_help: "Set the external text editor",
help: "Sets the editor to run when <code class=\"mapping\">&lt;C-i&gt;</code> " + help: "Sets the editor to run when <code class=\"mapping\">&lt;C-i&gt;</code> " +
@@ -446,20 +446,20 @@ function Options() //{{{
default_value: "gvim -f" default_value: "gvim -f"
} }
)); ));
addOption(new Option(["extendedhinttags", "eht"], "string", this.add(new vimperator.Option(["extendedhinttags", "eht"], "string",
{ {
short_help: "XPath string of hintable elements activated by ';'", short_help: "XPath string of hintable elements activated by ';'",
default_value: DEFAULT_HINTTAGS default_value: DEFAULT_HINTTAGS
} }
)); ));
addOption(new Option(["focusedhintstyle", "fhs"], "string", this.add(new vimperator.Option(["focusedhintstyle", "fhs"], "string",
{ {
short_help: "CSS specification of focused hints", short_help: "CSS specification of focused hints",
default_value: "z-index:5000; font-family:monospace; font-size:12px; color:ButtonText; background-color:ButtonShadow; " + default_value: "z-index:5000; font-family:monospace; font-size:12px; color:ButtonText; background-color:ButtonShadow; " +
"border-color:ButtonShadow; border-width:1px; border-style:solid; padding:0px 1px 0px 1px; position:absolute;" "border-color:ButtonShadow; border-width:1px; border-style:solid; padding:0px 1px 0px 1px; position:absolute;"
} }
)); ));
addOption(new Option(["fullscreen", "fs"], "boolean", this.add(new vimperator.Option(["fullscreen", "fs"], "boolean",
{ {
short_help: "Show the current window fullscreen", short_help: "Show the current window fullscreen",
setter: function(value) { window.fullScreen = value; }, setter: function(value) { window.fullScreen = value; },
@@ -467,7 +467,7 @@ function Options() //{{{
default_value: false default_value: false
} }
)); ));
addOption(new Option(["guioptions", "go"], "charlist", this.add(new vimperator.Option(["guioptions", "go"], "charlist",
{ {
short_help: "Show or hide the menu, toolbar and scrollbars", short_help: "Show or hide the menu, toolbar and scrollbars",
help: "Supported characters:<br/>" + help: "Supported characters:<br/>" +
@@ -481,52 +481,52 @@ function Options() //{{{
validator: function (value) { if (/[^mTb]/.test(value)) return false; else return true; } validator: function (value) { if (/[^mTb]/.test(value)) return false; else return true; }
} }
)); ));
addOption(new Option(["hintchars", "hc"], "charlist", this.add(new vimperator.Option(["hintchars", "hc"], "charlist",
{ {
short_help: "String of single characters which can be used to follow hints", short_help: "String of single characters which can be used to follow hints",
default_value: "hjklasdfgyuiopqwertnmzxcvb" default_value: "hjklasdfgyuiopqwertnmzxcvb"
} }
)); ));
addOption(new Option(["hintstyle", "hs"], "string", this.add(new vimperator.Option(["hintstyle", "hs"], "string",
{ {
short_help: "CSS specification of unfocused hints", short_help: "CSS specification of unfocused hints",
default_value: "z-index:5000; font-family:monospace; font-size:12px; color:white; background-color:red; " + default_value: "z-index:5000; font-family:monospace; font-size:12px; color:white; background-color:red; " +
"border-color:ButtonShadow; border-width:0px; border-style:solid; padding:0px 1px 0px 1px; position:absolute;" "border-color:ButtonShadow; border-width:0px; border-style:solid; padding:0px 1px 0px 1px; position:absolute;"
} }
)); ));
addOption(new Option(["hinttags", "ht"], "string", this.add(new vimperator.Option(["hinttags", "ht"], "string",
{ {
short_help: "XPath string of hintable elements activated by <code class=\"mapping\">'f'</code> and <code class=\"mapping\">'F'</code>", short_help: "XPath string of hintable elements activated by <code class=\"mapping\">'f'</code> and <code class=\"mapping\">'F'</code>",
default_value: DEFAULT_HINTTAGS default_value: DEFAULT_HINTTAGS
} }
)); ));
addOption(new Option(["hlsearch", "hls"], "boolean", this.add(new vimperator.Option(["hlsearch", "hls"], "boolean",
{ {
short_help: "Highlight previous search pattern matches", short_help: "Highlight previous search pattern matches",
setter: function(value) { if (value) vimperator.search.highlight(); else vimperator.search.clear(); }, setter: function(value) { if (value) vimperator.search.highlight(); else vimperator.search.clear(); },
default_value: false default_value: false
} }
)); ));
addOption(new Option(["hlsearchstyle", "hlss"], "string", this.add(new vimperator.Option(["hlsearchstyle", "hlss"], "string",
{ {
short_help: "CSS specification of highlighted search items", short_help: "CSS specification of highlighted search items",
default_value: "color: black; background-color: yellow; padding: 0; display: inline;" default_value: "color: black; background-color: yellow; padding: 0; display: inline;"
} }
)); ));
addOption(new Option(["ignorecase", "ic"], "boolean", this.add(new vimperator.Option(["ignorecase", "ic"], "boolean",
{ {
short_help: "Ignore case in search patterns", short_help: "Ignore case in search patterns",
default_value: true default_value: true
} }
)); ));
addOption(new Option(["incsearch", "is"], "boolean", this.add(new vimperator.Option(["incsearch", "is"], "boolean",
{ {
short_help: "Show where the search pattern matches as it is typed", short_help: "Show where the search pattern matches as it is typed",
help: "NOTE: Incremental searching currently only works in the forward direction.", help: "NOTE: Incremental searching currently only works in the forward direction.",
default_value: true default_value: true
} }
)); ));
addOption(new Option(["insertmode", "im"], "boolean", this.add(new vimperator.Option(["insertmode", "im"], "boolean",
{ {
short_help: "Use Insert mode as the default for text areas", short_help: "Use Insert mode as the default for text areas",
help: "Makes Vimperator work in a way that Insert mode is the default mode for text areas. " + help: "Makes Vimperator work in a way that Insert mode is the default mode for text areas. " +
@@ -534,7 +534,7 @@ function Options() //{{{
default_value: true default_value: true
} }
)); ));
addOption(new Option(["laststatus", "ls"], "number", this.add(new vimperator.Option(["laststatus", "ls"], "number",
{ {
short_help: "Show the status line", short_help: "Show the status line",
help: "Determines when the last window will have a status line. " + help: "Determines when the last window will have a status line. " +
@@ -550,20 +550,20 @@ function Options() //{{{
validator: function (value) { if (value >= 0 && value <= 2) return true; else return false; } validator: function (value) { if (value >= 0 && value <= 2) return true; else return false; }
} }
)); ));
addOption(new Option(["linksearch", "lks"], "boolean", this.add(new vimperator.Option(["linksearch", "lks"], "boolean",
{ {
short_help: "Limit the search to hyperlink text", short_help: "Limit the search to hyperlink text",
help: "This includes (X)HTML elements with an \"href\" atrribute and XLink \"simple\" links.", help: "This includes (X)HTML elements with an \"href\" atrribute and XLink \"simple\" links.",
default_value: false default_value: false
} }
)); ));
addOption(new Option(["more"], "boolean", this.add(new vimperator.Option(["more"], "boolean",
{ {
short_help: "Pause the message list window when more than one screen of listings is displayed", short_help: "Pause the message list window when more than one screen of listings is displayed",
default_value: true default_value: true
} }
)); ));
addOption(new Option(["maxhints", "mh"], "number", this.add(new vimperator.Option(["maxhints", "mh"], "number",
{ {
short_help: "Maximum number of simultaneously shown hints", short_help: "Maximum number of simultaneously shown hints",
help: "If you want to speed up display of hints, choose a smaller value", help: "If you want to speed up display of hints, choose a smaller value",
@@ -571,7 +571,7 @@ function Options() //{{{
validator: function (value) { if (value >= 1 && value <= 1000) return true; else return false; } validator: function (value) { if (value >= 1 && value <= 1000) return true; else return false; }
} }
)); ));
addOption(new Option(["popups", "pps"], "number", this.add(new vimperator.Option(["popups", "pps"], "number",
{ {
short_help: "Where to show requested popup windows", short_help: "Where to show requested popup windows",
help: "Define where to show requested popup windows. Does not apply to windows which are opened by middle clicking a link, they always open in a new tab. " + help: "Define where to show requested popup windows. Does not apply to windows which are opened by middle clicking a link, they always open in a new tab. " +
@@ -588,7 +588,7 @@ function Options() //{{{
validator: function (value) { if (value >= 0 && value <= 3) return true; else return false; } validator: function (value) { if (value >= 0 && value <= 3) return true; else return false; }
} }
)); ));
addOption(new Option(["preload"], "boolean", this.add(new vimperator.Option(["preload"], "boolean",
{ {
short_help: "Speed up first time history/bookmark completion", short_help: "Speed up first time history/bookmark completion",
help: "History access can be quite slow for a large history. Vimperator maintains a cache to speed it up significantly on subsequent access.<br/>" + help: "History access can be quite slow for a large history. Vimperator maintains a cache to speed it up significantly on subsequent access.<br/>" +
@@ -596,7 +596,7 @@ function Options() //{{{
default_value: true default_value: true
} }
)); ));
addOption(new Option(["previewheight", "pvh"], "number", this.add(new vimperator.Option(["previewheight", "pvh"], "number",
{ {
short_help: "Default height for preview window", short_help: "Default height for preview window",
help: "Value must be between 1 and 50. If the value is too high, completions may cover the command-line. " + help: "Value must be between 1 and 50. If the value is too high, completions may cover the command-line. " +
@@ -606,7 +606,7 @@ function Options() //{{{
validator: function (value) { if (value >= 1 && value <= 50) return true; else return false; } validator: function (value) { if (value >= 1 && value <= 50) return true; else return false; }
} }
)); ));
addOption(new Option(["scroll", "scr"], "number", this.add(new vimperator.Option(["scroll", "scr"], "number",
{ {
short_help: "Number of lines to scroll with <code class=\"mapping\">C-u</code> and <code class=\"mapping\">C-d</code> commands", short_help: "Number of lines to scroll with <code class=\"mapping\">C-u</code> and <code class=\"mapping\">C-d</code> commands",
help: "The number of lines scrolled defaults to half the window size. " + help: "The number of lines scrolled defaults to half the window size. " +
@@ -616,13 +616,13 @@ function Options() //{{{
validator: function (value) { if (value >= 0) return true; else return false; } validator: function (value) { if (value >= 0) return true; else return false; }
} }
)); ));
addOption(new Option(["showmode", "smd"], "boolean", this.add(new vimperator.Option(["showmode", "smd"], "boolean",
{ {
short_help: "Show the current mode in the command line", short_help: "Show the current mode in the command line",
default_value: true default_value: true
} }
)); ));
addOption(new Option(["showstatuslinks", "ssli"], "number", this.add(new vimperator.Option(["showstatuslinks", "ssli"], "number",
{ {
short_help: "Show the destination of the link under the cursor in the status bar", short_help: "Show the destination of the link under the cursor in the status bar",
help: "Also links which are focused by keyboard commands like <code class=\"mapping\">&lt;Tab&gt;</code> are shown. " + help: "Also links which are focused by keyboard commands like <code class=\"mapping\">&lt;Tab&gt;</code> are shown. " +
@@ -636,7 +636,7 @@ function Options() //{{{
validator: function (value) { if (value >= 0 && value <= 2) return true; else return false; } validator: function (value) { if (value >= 0 && value <= 2) return true; else return false; }
} }
)); ));
addOption(new Option(["showtabline", "stal"], "number", this.add(new vimperator.Option(["showtabline", "stal"], "number",
{ {
short_help: "Control when to show the tab bar of opened web pages", short_help: "Control when to show the tab bar of opened web pages",
help: "Possible values:<br/>" + help: "Possible values:<br/>" +
@@ -650,14 +650,14 @@ function Options() //{{{
validator: function (value) { if (value >= 0 && value <= 2) return true; else return false; } validator: function (value) { if (value >= 0 && value <= 2) return true; else return false; }
} }
)); ));
addOption(new Option(["smartcase", "scs"], "boolean", this.add(new vimperator.Option(["smartcase", "scs"], "boolean",
{ {
short_help: "Override the 'ignorecase' option if the pattern contains uppercase characters", short_help: "Override the 'ignorecase' option if the pattern contains uppercase characters",
help: "This is only used if the <code class=\"option\">'ignorecase'</code> option is set.", help: "This is only used if the <code class=\"option\">'ignorecase'</code> option is set.",
default_value: true default_value: true
} }
)); ));
addOption(new Option(["titlestring"], "string", this.add(new vimperator.Option(["titlestring"], "string",
{ {
short_help: "Change the title of the browser window", short_help: "Change the title of the browser window",
help: "Vimperator changes the browser title from \"Title of web page - Mozilla Firefox\" to " + help: "Vimperator changes the browser title from \"Title of web page - Mozilla Firefox\" to " +
@@ -667,7 +667,7 @@ function Options() //{{{
default_value: "Vimperator" default_value: "Vimperator"
} }
)); ));
addOption(new Option(["usermode", "um"], "boolean", this.add(new vimperator.Option(["usermode", "um"], "boolean",
{ {
short_help: "Show current website with a minimal style sheet to make it easily accessible", short_help: "Show current website with a minimal style sheet to make it easily accessible",
help: "Note that this is a local option for now, later it may be split into a global and <code class=\"command\">:setlocal</code> part", help: "Note that this is a local option for now, later it may be split into a global and <code class=\"command\">:setlocal</code> part",
@@ -676,7 +676,7 @@ function Options() //{{{
default_value: false default_value: false
} }
)); ));
addOption(new Option(["verbose", "vbs"], "number", this.add(new vimperator.Option(["verbose", "vbs"], "number",
{ {
short_help: "Define which type of messages are logged", short_help: "Define which type of messages are logged",
help: "When bigger than zero, Vimperator will give messages about what it is doing. They are printed to the error console which can be shown with <code class=\"command\">:javascript!</code>.<br/>" + help: "When bigger than zero, Vimperator will give messages about what it is doing. They are printed to the error console which can be shown with <code class=\"command\">:javascript!</code>.<br/>" +
@@ -685,14 +685,14 @@ function Options() //{{{
validator: function (value) { if (value >= 0 && value <= 9) return true; else return false; } validator: function (value) { if (value >= 0 && value <= 9) return true; else return false; }
} }
)); ));
addOption(new Option(["visualbell", "vb"], "boolean", this.add(new vimperator.Option(["visualbell", "vb"], "boolean",
{ {
short_help: "Use visual bell instead of beeping on errors", short_help: "Use visual bell instead of beeping on errors",
setter: function(value) { vimperator.options.setFirefoxPref("accessibility.typeaheadfind.enablesound", !value); }, setter: function(value) { vimperator.options.setFirefoxPref("accessibility.typeaheadfind.enablesound", !value); },
default_value: false default_value: false
} }
)); ));
addOption(new Option(["wildmode", "wim"], "stringlist", this.add(new vimperator.Option(["wildmode", "wim"], "stringlist",
{ {
short_help: "Define how command line completion works", short_help: "Define how command line completion works",
help: "It is a comma-separated list of parts, where each part specifies " + help: "It is a comma-separated list of parts, where each part specifies " +
@@ -719,7 +719,7 @@ function Options() //{{{
} }
} }
)); ));
addOption(new Option(["wildoptions", "wop"], "stringlist", this.add(new vimperator.Option(["wildoptions", "wop"], "stringlist",
{ {
short_help: "Change how command line completion is done", short_help: "Change how command line completion is done",
help: "A list of words that change how command line completion is done.<br/>" + help: "A list of words that change how command line completion is done.<br/>" +

View File

@@ -32,7 +32,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
* Firefox 3.0, then this class should go away and their tab methods should be used * Firefox 3.0, then this class should go away and their tab methods should be used
* @deprecated * @deprecated
*/ */
function Tabs() //{{{ vimperator.Tabs = function() //{{{
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION ///////////////////////////////////////// ////////////////////// PRIVATE SECTION /////////////////////////////////////////

View File

@@ -32,7 +32,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
* it consists of a prompt and command field * it consists of a prompt and command field
* be sure to only create objects of this class when the chrome is ready * be sure to only create objects of this class when the chrome is ready
*/ */
function CommandLine() //{{{ vimperator.CommandLine = function() //{{{
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION ///////////////////////////////////////// ////////////////////// PRIVATE SECTION /////////////////////////////////////////
@@ -40,7 +40,7 @@ function CommandLine() //{{{
const UNINITIALIZED = -2; // notifies us, if we need to start history/tab-completion from the beginning const UNINITIALIZED = -2; // notifies us, if we need to start history/tab-completion from the beginning
var completionlist = new InformationList("vimperator-completion", { min_items: 2, max_items: 10 }); var completionlist = new vimperator.InformationList("vimperator-completion", { min_items: 2, max_items: 10 });
var completions = []; var completions = [];
// TODO: clean this up when it's not 3am... // TODO: clean this up when it's not 3am...
@@ -840,7 +840,7 @@ function CommandLine() //{{{
* @param id: the id of the the XUL widget which we want to fill * @param id: the id of the the XUL widget which we want to fill
* @param options: an optional hash which modifies the behavior of the list * @param options: an optional hash which modifies the behavior of the list
*/ */
function InformationList(id, options) //{{{ vimperator.InformationList = function(id, options) //{{{
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION ///////////////////////////////////////// ////////////////////// PRIVATE SECTION /////////////////////////////////////////
@@ -1043,7 +1043,7 @@ function InformationList(id, options) //{{{
//}}} //}}}
} //}}} } //}}}
function StatusLine() //{{{ vimperator.StatusLine = function() //{{{
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION ///////////////////////////////////////// ////////////////////// PRIVATE SECTION /////////////////////////////////////////

View File

@@ -569,39 +569,43 @@ const vimperator = (function() //{{{
// these objects are created here only after the chrome is ready // these objects are created here only after the chrome is ready
vimperator.log("Loading module options...", 3); vimperator.log("Loading module options...", 3);
vimperator.options = new Options(); vimperator.options = new vimperator.Options();
vimperator.log("Loading module events...", 3); vimperator.log("Loading module events...", 3);
vimperator.events = new Events(); vimperator.events = new vimperator.Events();
vimperator.log("Loading module commands...", 3); vimperator.log("Loading module commands...", 3);
vimperator.commands = new Commands(); vimperator.commands = new vimperator.Commands();
vimperator.log("Loading module bookmarks...", 3); vimperator.log("Loading module bookmarks...", 3);
vimperator.bookmarks = new Bookmarks(); vimperator.bookmarks = new vimperator.Bookmarks();
vimperator.log("Loading module history...", 3); vimperator.log("Loading module history...", 3);
vimperator.history = new History(); vimperator.history = new vimperator.History();
vimperator.log("Loading module commandline...", 3); vimperator.log("Loading module commandline...", 3);
vimperator.commandline = new CommandLine(); vimperator.commandline = new vimperator.CommandLine();
vimperator.log("Loading module search...", 3); vimperator.log("Loading module search...", 3);
vimperator.search = new Search(); vimperator.search = new vimperator.Search();
vimperator.log("Loading module preview window...", 3); vimperator.log("Loading module preview window...", 3);
vimperator.previewwindow = new InformationList("vimperator-previewwindow", { incremental_fill: false, max_items: 10 }); vimperator.previewwindow = new vimperator.InformationList("vimperator-previewwindow", { incremental_fill: false, max_items: 10 });
vimperator.log("Loading module buffer window...", 3); vimperator.log("Loading module buffer window...", 3);
vimperator.bufferwindow = new InformationList("vimperator-bufferwindow", { incremental_fill: false, max_items: 10 }); vimperator.bufferwindow = new vimperator.InformationList("vimperator-bufferwindow", { incremental_fill: false, max_items: 10 });
vimperator.log("Loading module mappings...", 3); vimperator.log("Loading module mappings...", 3);
vimperator.mappings = new Mappings(); vimperator.mappings = new Mappings();
vimperator.log("Loading module statusline...", 3); vimperator.log("Loading module statusline...", 3);
vimperator.statusline = new StatusLine(); vimperator.statusline = new vimperator.StatusLine();
vimperator.log("Loading module buffer...", 3); vimperator.log("Loading module buffer...", 3);
vimperator.buffer = new Buffer(); vimperator.buffer = new vimperator.Buffer();
vimperator.log("Loading module editor...", 3); vimperator.log("Loading module editor...", 3);
vimperator.editor = new Editor(); vimperator.editor = new vimperator.Editor();
vimperator.log("Loading module tabs...", 3); vimperator.log("Loading module tabs...", 3);
vimperator.tabs = new Tabs(); vimperator.tabs = new vimperator.Tabs();
vimperator.log("Loading module marks...", 3); vimperator.log("Loading module marks...", 3);
vimperator.marks = new Marks(); vimperator.marks = new vimperator.Marks();
vimperator.log("Loading module quickmarks...", 3); vimperator.log("Loading module quickmarks...", 3);
vimperator.quickmarks = new QuickMarks(); vimperator.quickmarks = new vimperator.QuickMarks();
vimperator.log("Loading module hints...", 3); vimperator.log("Loading module hints...", 3);
vimperator.hints = new Hints(); vimperator.hints = new vimperator.Hints();
vimperator.log("Loading module io...", 3);
vimperator.io = new vimperator.IO();
vimperator.log("Loading module completion...", 3);
vimperator.completion = new vimperator.Completion();
vimperator.log("All modules loaded", 3); vimperator.log("All modules loaded", 3);
vimperator.echo = function(str, flags) { vimperator.commandline.echo(str, vimperator.commandline.HL_NORMAL, flags); } vimperator.echo = function(str, flags) { vimperator.commandline.echo(str, vimperator.commandline.HL_NORMAL, flags); }