diff --git a/content/bookmarks.js b/content/bookmarks.js index 23eb7a06..20116991 100644 --- a/content/bookmarks.js +++ b/content/bookmarks.js @@ -27,7 +27,7 @@ the terms of any one of the MPL, the GPL or the LGPL. }}} ***** END LICENSE BLOCK *****/ // also includes methods for dealing with keywords and search engines -function Bookmarks() //{{{ +vimperator.Bookmarks = function() //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// @@ -290,7 +290,7 @@ function Bookmarks() //{{{ // res.title is the title or "" if no one was given // res.url is the url as a string // returns null, if parsing failed - Bookmarks.parseBookmarkString = function(str) + this.parseBookmarkString = function(str) { var res = {}; res.tags = []; @@ -356,7 +356,7 @@ function Bookmarks() //{{{ //}}} } //}}} -function History() //{{{ +vimperator.History = function() //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// @@ -519,7 +519,7 @@ function History() //{{{ //}}} } //}}} -function Marks() //{{{ +vimperator.Marks = function() //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// @@ -774,7 +774,7 @@ function Marks() //{{{ //}}} } //}}} -function QuickMarks() //{{{ +vimperator.QuickMarks = function() //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// diff --git a/content/buffers.js b/content/buffers.js index 3a51251c..8e7389a7 100644 --- a/content/buffers.js +++ b/content/buffers.js @@ -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. }}} ***** END LICENSE BLOCK *****/ -function Buffer() //{{{ +vimperator.Buffer = function() //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// diff --git a/content/commands.js b/content/commands.js index e6b2f7ab..adcd7ba2 100644 --- a/content/commands.js +++ b/content/commands.js @@ -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. }}} ***** END LICENSE BLOCK *****/ -function Command(specs, action, extra_info) //{{{ +vimperator.Command = function(specs, action, extra_info) //{{{ { if (!specs || !action) return null; @@ -89,14 +89,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); } // return true if the candidate name matches one of the command's aliases // (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 // true if the candidate matches unambiguously @@ -122,7 +122,7 @@ Command.prototype.hasName = function(name) } //}}} -function Commands() //{{{ +vimperator.Commands = function() //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// @@ -134,7 +134,7 @@ function Commands() //{{{ function addDefaultCommand(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); } @@ -227,14 +227,14 @@ function 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); }, { short_help: "Show available Browser Extensions and Themes", help: "You can add/remove/disable browser extensions from this dialog.
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) { if (special) @@ -277,7 +277,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); }, { usage: ["[count]bd[elete][!]"], @@ -286,18 +286,18 @@ function Commands() //{{{ "Do :bdelete! to select the tab to the left after removing the current tab." } )); - addDefaultCommand(new Command(["beep"], + addDefaultCommand(new vimperator.Command(["beep"], function() { vimperator.beep(); }, { short_help: "Play a system beep" } )); - addDefaultCommand(new Command(["bma[rk]"], + addDefaultCommand(new vimperator.Command(["bma[rk]"], // takes: -t "foo" myurl // converts that string to a useful url and title, and calls addBookmark function(args) { - var result = Bookmarks.parseBookmarkString(args); + var result = vimperator.bookmarks.parseBookmarkString(args); if (result) { @@ -333,7 +333,7 @@ function Commands() //{{{ "Tags WILL be some mechanism to classify bookmarks. Assume, you tag a URL with the tags \"linux\" and \"computer\" you'll be able to search for bookmarks containing these tags." } )); - addDefaultCommand(new Command(["bmarks"], + addDefaultCommand(new vimperator.Command(["bmarks"], function(args, special) { vimperator.bookmarks.list(args, special); }, { usage: ["bmarks [filter]", "bmarks!"], @@ -345,7 +345,7 @@ function Commands() //{{{ completer: function(filter) { return vimperator.completion.get_bookmark_completions(filter); } } )); - addDefaultCommand(new Command(["b[uffer]"], + addDefaultCommand(new vimperator.Command(["b[uffer]"], function(args, special) { vimperator.buffer.switchTo(args, special); }, { usage: ["b[uffer][!] {url|index}"], @@ -358,7 +358,7 @@ function Commands() //{{{ 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) { if (args) @@ -376,10 +376,10 @@ function Commands() //{{{ "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) { - var result = Bookmarks.parseBookmarkString(args); + var result = vimperator.bookmarks.parseBookmarkString(args); if (result) { @@ -404,7 +404,7 @@ function Commands() //{{{ completer: function(filter) { return vimperator.completion.get_bookmark_completions(filter); } } )); - addDefaultCommand(new Command(["delm[arks]"], + addDefaultCommand(new vimperator.Command(["delm[arks]"], function(args, special) { if (!special && !args) @@ -457,7 +457,7 @@ function Commands() //{{{ } )); - addDefaultCommand(new Command(["delqm[arks]"], + addDefaultCommand(new vimperator.Command(["delqm[arks]"], function(args, special) { // TODO: finish arg parsing - we really need a proper way to do this. :) @@ -486,7 +486,7 @@ function Commands() //{{{ ":delqmarks! 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); }, { short_help: "Show progress of current downloads", @@ -522,7 +522,7 @@ function Commands() //{{{ return arg; } - addDefaultCommand(new Command(["ec[ho]"], + addDefaultCommand(new vimperator.Command(["ec[ho]"], function(args) { var res = argToString(args, true); @@ -538,7 +538,7 @@ function Commands() //{{{ completer: function(filter) { return vimperator.completion.javascript(filter); } } )); - addDefaultCommand(new Command(["echoe[rr]"], + addDefaultCommand(new vimperator.Command(["echoe[rr]"], function(args) { var res = argToString(args, false); @@ -552,7 +552,7 @@ function Commands() //{{{ completer: function(filter) { return vimperator.completion.javascript(filter); } } )); - addDefaultCommand(new Command(["exe[cute]"], + addDefaultCommand(new vimperator.Command(["exe[cute]"], function(args) { vimperator.execute(args) }, { usage: ["exe[cute] {expr1} [ ... ]"], @@ -560,13 +560,13 @@ function Commands() //{{{ help: "Example: :execute echo test shows a message with the text "test".
" } )); - addDefaultCommand(new Command(["exu[sage]"], + addDefaultCommand(new vimperator.Command(["exu[sage]"], function(args, special, count, modifiers) { vimperator.help("commands", special, null, modifiers); }, { short_help: "Show help for Ex commands" } )); - addDefaultCommand(new Command(["fo[rward]", "fw"], + addDefaultCommand(new vimperator.Command(["fo[rward]", "fw"], function(args, special, count) { if (special) @@ -609,14 +609,14 @@ function Commands() //{{{ } } )); - addDefaultCommand(new Command(["ha[rdcopy]"], + addDefaultCommand(new vimperator.Command(["ha[rdcopy]"], function() { getBrowser().contentWindow.print(); }, { short_help: "Print current document", 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); }, { usage: ["h[elp] {subject}"], @@ -632,7 +632,7 @@ function Commands() //{{{ 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); }, { usage: ["hist[ory] [filter]", "history!"], @@ -642,7 +642,7 @@ function Commands() //{{{ completer: function(filter) { return vimperator.completion.get_history_completions(filter); } } )); - addDefaultCommand(new Command(["javas[cript]", "js"], + addDefaultCommand(new vimperator.Command(["javas[cript]", "js"], function(args, special) { if (special) // open javascript console @@ -691,7 +691,7 @@ function Commands() //{{{ completer: function(filter) { return vimperator.completion.javascript(filter); } } )); - addDefaultCommand(new Command(["let"], + addDefaultCommand(new vimperator.Command(["let"], function(args) { if (!args) @@ -778,7 +778,7 @@ function Commands() //{{{ "Without arguments, displays a list of all variables." } )); - addDefaultCommand(new Command(["map"], + addDefaultCommand(new vimperator.Command(["map"], // 0 args -> list all maps // 1 arg -> list the maps starting with args // 2 args -> map arg1 to arg* @@ -804,7 +804,7 @@ function Commands() //{{{ if (rhs) { - vimperator.mappings.add(new Map(vimperator.modes.NORMAL, [lhs], + vimperator.mappings.add(new vimperator.Map(vimperator.modes.NORMAL, [lhs], function() { vimperator.events.feedkeys(rhs); }, { rhs: rhs } )); } @@ -821,7 +821,7 @@ function Commands() //{{{ "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) { if (args) @@ -838,7 +838,7 @@ function Commands() //{{{ ":map or :noremap are cleared." } )); - addDefaultCommand(new Command(["ma[rk]"], + addDefaultCommand(new vimperator.Command(["ma[rk]"], function(args) { if (!args) @@ -864,7 +864,7 @@ function Commands() //{{{ short_help: "Mark current location within the web page" } )); - addDefaultCommand(new Command(["marks"], + addDefaultCommand(new vimperator.Command(["marks"], function(args) { // ignore invalid mark characters unless there are no valid mark chars @@ -883,7 +883,7 @@ function Commands() //{{{ help: "If [arg] is specified then limit the list to those marks mentioned." } )); - addDefaultCommand(new Command(["mkv[imperatorrc]"], + addDefaultCommand(new vimperator.Command(["mkv[imperatorrc]"], function(args, special) { var filename; @@ -934,7 +934,7 @@ function Commands() //{{{ "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) { vimperator.search.clear(); @@ -945,7 +945,7 @@ function Commands() //{{{ "'hlsearch' option is set." } )); - addDefaultCommand(new Command(["norm[al]"], + addDefaultCommand(new vimperator.Command(["norm[al]"], function(args) { if (!args) @@ -963,7 +963,7 @@ function Commands() //{{{ } )); // TODO: remove duplication in :map - addDefaultCommand(new Command(["no[remap]"], + addDefaultCommand(new vimperator.Command(["no[remap]"], // 0 args -> list all maps // 1 arg -> list the maps starting with args // 2 args -> map arg1 to arg* @@ -983,7 +983,7 @@ function Commands() //{{{ if (/^:/.test(rhs)) { vimperator.mappings.add( - new Map(vimperator.modes.NORMAL, [lhs], function() { vimperator.execute(rhs); }, { rhs: rhs }) + new vimperator.Map(vimperator.modes.NORMAL, [lhs], function() { vimperator.execute(rhs); }, { rhs: rhs }) ); } else @@ -991,14 +991,14 @@ function Commands() //{{{ // NOTE: we currently only allow one normal mode command in {rhs} var map = vimperator.mappings.getDefaultMap(vimperator.modes.NORMAL, rhs); - // create a new Map for {lhs} with the same action as + // create a Map for {lhs} with the same action as // {rhs}...until we have feedkeys(). // NOTE: Currently only really intended for static use (e.g. // from the RC file) since {rhs} is evaluated when the map // is created not at runtime if (map) vimperator.mappings.add( - new Map(vimperator.modes.NORMAL, [lhs], map.action, { flags: map.flags, rhs: rhs }) + new vimperator.Map(vimperator.modes.NORMAL, [lhs], map.action, { flags: map.flags, rhs: rhs }) ); else vimperator.echoerr("E475: Invalid argument: " + "{rhs} must be a existing singular mapping"); @@ -1016,7 +1016,7 @@ function Commands() //{{{ help: "No remapping of the {rhs} is performed.
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) { if (args) @@ -1059,13 +1059,13 @@ function Commands() //{{{ 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(); }, { 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) { if (!args) @@ -1097,7 +1097,7 @@ function Commands() //{{{ ":prefs! 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) { if (!args) @@ -1123,7 +1123,7 @@ function Commands() //{{{ ":qmark f http://forum1.com, http://forum2.com, imdb some artist" } )); - addDefaultCommand(new Command(["qmarks"], + addDefaultCommand(new vimperator.Command(["qmarks"], function(args) { // ignore invalid mark characters unless there are no valid mark chars @@ -1142,7 +1142,7 @@ function Commands() //{{{ help: "If [arg] 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); }, { short_help: "Quit current tab", @@ -1150,14 +1150,14 @@ function Commands() //{{{ "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); }, { short_help: "Quit Vimperator", help: "Quit Vimperator, no matter how many tabs/windows are open. The session is not stored." } )); - addDefaultCommand(new Command(["re[load]"], + addDefaultCommand(new vimperator.Command(["re[load]"], function(args, special) { vimperator.tabs.reload(getBrowser().mCurrentTab, special); }, { usage: ["re[load][!]"], @@ -1165,7 +1165,7 @@ function Commands() //{{{ help: "Forces reloading of the current page. If ! is given, skip the cache." } )); - addDefaultCommand(new Command(["reloada[ll]"], + addDefaultCommand(new vimperator.Command(["reloada[ll]"], function(args, special) { vimperator.tabs.reloadAll(special); }, { usage: ["reloada[ll][!]"], @@ -1173,14 +1173,14 @@ function Commands() //{{{ help: "Forces reloading of all pages. If ! is given, skip the cache." } )); - addDefaultCommand(new Command(["res[tart]"], + addDefaultCommand(new vimperator.Command(["res[tart]"], function() { vimperator.restart(); }, { short_help: "Force the browser to restart", 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); }, { short_help: "Save current web page to disk", @@ -1188,7 +1188,7 @@ function Commands() //{{{ "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) { if (special) @@ -1353,7 +1353,7 @@ function Commands() //{{{ } )); // TODO: sclose instead? - addDefaultCommand(new Command(["sbcl[ose]"], + addDefaultCommand(new vimperator.Command(["sbcl[ose]"], function(args) { if (args) @@ -1371,7 +1371,7 @@ function Commands() //{{{ )); // TODO: sopen instead? Separate :sidebar from :sbopen and make them behave // 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) { if (!args) @@ -1403,7 +1403,7 @@ function Commands() //{{{ completer: function(filter) { return vimperator.completion.get_sidebar_completions(filter); } } )); - addDefaultCommand(new Command(["so[urce]"], + addDefaultCommand(new vimperator.Command(["so[urce]"], function(args) { // FIXME: implement proper filename quoting @@ -1430,14 +1430,14 @@ function Commands() //{{{ completer: function(filter) { return vimperator.completion.get_file_completions(filter); } } )); - addDefaultCommand(new Command(["st[op]"], + addDefaultCommand(new vimperator.Command(["st[op]"], BrowserStop, { short_help: "Stop loading", help: "Stop loading current web page." } )); - addDefaultCommand(new Command(["tab"], + addDefaultCommand(new vimperator.Command(["tab"], function(args) { vimperator.execute(args, { inTab: true }); }, { usage: ["tab {cmd}"], @@ -1448,13 +1448,13 @@ function Commands() //{{{ 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); }, { 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); }, { usage: ["tabm[ove] [N]", "tabm[ove][!] +N | -N"], @@ -1463,20 +1463,20 @@ function Commands() //{{{ "N can also be prefixed with '+' or '-' to indicate a relative movement. If ! 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); }, { short_help: "Switch to the next tab", 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); }, { 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) { var where = special ? vimperator.NEW_TAB : vimperator.NEW_BACKGROUND_TAB; @@ -1496,7 +1496,7 @@ function Commands() //{{{ 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); }, { usage: ["tabp[revious]", "tabN[ext]"], @@ -1504,14 +1504,14 @@ function Commands() //{{{ 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); }, { usage: ["tabr[ewind]", "tabfir[st]"], short_help: "Switch to the first tab" } )); - addDefaultCommand(new Command(["time"], + addDefaultCommand(new vimperator.Command(["time"], function(args, special, count) { if (!count || count < 1) @@ -1596,7 +1596,7 @@ function Commands() //{{{ "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) { if (count < 1) @@ -1640,7 +1640,7 @@ function Commands() //{{{ } } )); - addDefaultCommand(new Command(["undoa[ll]"], + addDefaultCommand(new vimperator.Command(["undoa[ll]"], function(args, special, count) { if (count || special) @@ -1656,7 +1656,7 @@ function Commands() //{{{ 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) { if (!args) @@ -1685,7 +1685,7 @@ function Commands() //{{{ "Several variable names can be given." } )); - addDefaultCommand(new Command(["unm[ap]"], + addDefaultCommand(new vimperator.Command(["unm[ap]"], function(args) { if (!args) @@ -1707,7 +1707,7 @@ function Commands() //{{{ help: "" } )); - addDefaultCommand(new Command(["ve[rsion]"], + addDefaultCommand(new vimperator.Command(["ve[rsion]"], function(args, special) { if (special) @@ -1721,13 +1721,13 @@ function Commands() //{{{ help: "You can show the Firefox version page with :version!." } )); - addDefaultCommand(new Command(["viu[sage]"], + addDefaultCommand(new vimperator.Command(["viu[sage]"], function(args, special, count, modifiers) { vimperator.help("mappings", special, null, modifiers); }, { 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) { window.close(); @@ -1737,7 +1737,7 @@ function Commands() //{{{ 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) { if (args) @@ -1751,7 +1751,7 @@ function Commands() //{{{ help: "Like :open but open URLs in a new window.
" } )); - addDefaultCommand(new Command(["wqa[ll]", "wq", "xa[ll]"], + addDefaultCommand(new vimperator.Command(["wqa[ll]", "wq", "xa[ll]"], function() { vimperator.quit(true); }, { usage: ["wqa[ll]", "xa[ll]"], @@ -1760,7 +1760,7 @@ function Commands() //{{{ ":wq 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) { var level; @@ -1805,7 +1805,7 @@ function Commands() //{{{ "Normally this command operates on the text zoom, if used with [!] it operates on full zoom." } )); - addDefaultCommand(new Command(["!", "run"], + addDefaultCommand(new vimperator.Command(["!", "run"], function(args, special) { // :!! needs to be treated specially as the command parser sets the special flag but removes the ! from args diff --git a/content/completion.js b/content/completion.js index 2d64d8c8..5121594d 100644 --- a/content/completion.js +++ b/content/completion.js @@ -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. }}} ***** END LICENSE BLOCK *****/ -vimperator.completion = (function() // {{{ +vimperator.Completion = function() // {{{ { // The completion substrings, used for showing the longest common match var g_substrings = []; @@ -591,6 +591,6 @@ vimperator.completion = (function() // {{{ } //}}} } -})(); // }}} +} // }}} // vim: set fdm=marker sw=4 ts=4 et: diff --git a/content/events.js b/content/events.js index 92e8d70d..d41a379e 100644 --- a/content/events.js +++ b/content/events.js @@ -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. }}} ***** END LICENSE BLOCK *****/ -function Events() //{{{ +vimperator.Events = function() //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// diff --git a/content/find.js b/content/find.js index d99a4d27..fa51bd8a 100644 --- a/content/find.js +++ b/content/find.js @@ -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 // 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 found = false; // true if the last search was successful diff --git a/content/hints.js b/content/hints.js index 6d68e4d8..7b514107 100644 --- a/content/hints.js +++ b/content/hints.js @@ -22,7 +22,7 @@ * }}} ***** END LICENSE BLOCK *****/ -function Hints() //{{{ +vimperator.Hints = function() //{{{ { const HINT_PREFIX = 'hah_hint_'; // prefix for the hint id diff --git a/content/io.js b/content/io.js index 84fe8118..b861652a 100644 --- a/content/io.js +++ b/content/io.js @@ -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. }}} ***** END LICENSE BLOCK *****/ -vimperator.io = (function() +vimperator.IO = function() { var environment_service = Components.classes["@mozilla.org/process/environment;1"] .getService(Components.interfaces.nsIEnvironment); - vimperator.log("Loading vimperator.io"); - return { MODE_RDONLY: 0x01, @@ -237,6 +235,6 @@ vimperator.io = (function() ofstream.close(); } } -})(); +} // vim: set fdm=marker sw=4 ts=4 et: diff --git a/content/mappings.js b/content/mappings.js index dabb58de..14291b21 100644 --- a/content/mappings.js +++ b/content/mappings.js @@ -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. }}} ***** END LICENSE BLOCK *****/ -function Map(mode, cmds, action, extra_info) //{{{ +vimperator.Map = function(mode, cmds, action, extra_info) //{{{ { if (!mode || (!cmds || !cmds.length) || !action) return null; @@ -65,7 +65,7 @@ function Map(mode, cmds, action, extra_info) //{{{ } } -Map.prototype.hasName = function(name) +vimperator.Map.prototype.hasName = function(name) { for (var i = 0; i < this.names.length; i++) { @@ -78,7 +78,7 @@ Map.prototype.hasName = function(name) // Since we will add many Map-objects, we add some functions as prototypes // this will ensure we only have one copy of each function, not one for each object -Map.prototype.execute = function(motion, count, argument) +vimperator.Map.prototype.execute = function(motion, count, argument) { var args = []; if (this.flags & Mappings.flags.MOTION) @@ -301,21 +301,21 @@ function Mappings() //{{{ // Normal mode // {{{ // vimperator management - addDefaultMap(new Map(vimperator.modes.NORMAL, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, [""], function() { vimperator.help(null); }, { short_help: "Open help window", help: "The default section is shown, if you need help for a specific topic, try :help <F1>." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, [":"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, [":"], function() { vimperator.commandline.open(":", "", vimperator.modes.EX); }, { short_help: "Start command line mode", help: "In command line mode, you can perform extended commands, which may require arguments." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["I"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["I"], function() { vimperator.addMode(null, vimperator.modes.ESCAPE_ALL_KEYS); }, { short_help: "Disable Vimperator keys", @@ -325,7 +325,7 @@ function Mappings() //{{{ "in this mode to the web page, prepend it with <C-v>." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, [""], function() { vimperator.addMode(null, vimperator.modes.ESCAPE_ONE_KEY); }, { short_help: "Escape next key", @@ -334,14 +334,14 @@ function Mappings() //{{{ "When in 'ignorekeys' mode (activated by <I>), <C-v> will pass the next key to Vimperator instead of the web page." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, [""], BrowserStop, { short_help: "Stop loading", help: "Stops loading the current web page." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, [""], function() { return; }, { short_help: "Do nothing", @@ -349,7 +349,7 @@ function Mappings() //{{{ ":map <C-n> <Nop> will prevent <C-n> from doing anything." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["", ""], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["", ""], vimperator.events.onEscape, { short_help: "Focus content", @@ -358,7 +358,7 @@ function Mappings() //{{{ } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["]f"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["]f"], function(count) { vimperator.buffer.shiftFrameFocus(count > 1 ? count : 1, true); }, { short_help: "Focus next frame", @@ -366,7 +366,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["[f"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["[f"], function(count) { vimperator.buffer.shiftFrameFocus(count > 1 ? count : 1, false); }, { short_help: "Focus previous frame", @@ -374,14 +374,14 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["b"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["b"], function() { vimperator.commandline.open(":", "buffer! ", vimperator.modes.EX); }, { short_help: "Open a prompt to switch buffers", help: "Typing the corresponding number switches to this buffer." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["B"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["B"], function() { vimperator.buffer.list(true); }, { short_help: "Toggle buffer list", @@ -389,7 +389,7 @@ function Mappings() //{{{ "WARNING: This mapping may be removed/changed in future." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["gb"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["gb"], function(count) { vimperator.buffer.switchTo(null, null, count, false); }, { short_help: "Repeat last :buffer[!] command", @@ -397,7 +397,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["gB"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["gB"], function(count) { vimperator.buffer.switchTo(null, null, count, true); }, { short_help: "Repeat last :buffer[!] command in reverse direction", @@ -405,7 +405,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["d"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["d"], function(count) { vimperator.tabs.remove(getBrowser().mCurrentTab, count, false, 0); }, { short_help: "Delete current buffer (=tab)", @@ -414,7 +414,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["D"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["D"], function(count) { vimperator.tabs.remove(getBrowser().mCurrentTab, count, true, 0); }, { short_help: "Delete current buffer (=tab)", @@ -423,14 +423,14 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["gh"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["gh"], BrowserHome, { short_help: "Go home", help: "Opens the homepage in the current tab." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["gH"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["gH"], function() { var homepages = gHomeButton.getHomePage(); @@ -443,7 +443,7 @@ function Mappings() //{{{ "Whether the new tab is activated or not depends on the 'activate' option.
" } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["go"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["go"], function(arg) { vimperator.quickmarks.jumpTo(arg, vimperator.CURRENT_TAB) }, { short_help: "Jump to a QuickMark in the current tab", @@ -453,7 +453,7 @@ function Mappings() //{{{ flags: Mappings.flags.ARGUMENT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["gn"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["gn"], function(arg) { vimperator.quickmarks.jumpTo(arg, @@ -469,7 +469,7 @@ function Mappings() //{{{ flags: Mappings.flags.ARGUMENT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["gP"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["gP"], function() { vimperator.open(readFromClipboard(), @@ -481,7 +481,7 @@ function Mappings() //{{{ help: "Works like P, but inverts the 'activate' option." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["gt", "", ""], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["gt", "", ""], function(count) { vimperator.tabs.select(count > 0 ? count -1: "+1", count > 0 ? false : true); }, { short_help: "Go to the next tab", @@ -489,7 +489,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["gT", "", ""], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["gT", "", ""], function(count) { vimperator.tabs.select(count > 0 ? count -1: "-1", count > 0 ? false : true); }, { short_help: "Go to the previous tab", @@ -497,7 +497,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ['', ''], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ['', ''], function() { if (vimperator.tabs.getTab() == vimperator.tabs.alternate) @@ -524,7 +524,7 @@ function Mappings() //{{{ help: "The alternate tab is the last selected tab. This provides a quick method of toggling between two tabs." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["m"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["m"], function(arg) { if (/[^a-zA-Z]/.test(arg)) @@ -542,7 +542,7 @@ function Mappings() //{{{ flags: Mappings.flags.ARGUMENT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["'", "`"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["'", "`"], function(arg) { vimperator.marks.jumpTo(arg) }, { short_help: "Jump to the mark in the current buffer", @@ -551,7 +551,7 @@ function Mappings() //{{{ flags: Mappings.flags.ARGUMENT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["M"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["M"], function(arg) { if (/[^a-zA-Z0-9]/.test(arg)) @@ -570,28 +570,28 @@ function Mappings() //{{{ flags: Mappings.flags.ARGUMENT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["o"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["o"], function() { vimperator.commandline.open(":", "open ", vimperator.modes.EX); }, { short_help: "Open one or more URLs in the current tab", help: "See :open for more details." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["O"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["O"], function() { vimperator.commandline.open(":", "open " + vimperator.buffer.URL, vimperator.modes.EX); }, { short_help: "Open one or more URLs in the current tab, based on current location", help: "Works like o, but preselects current URL in the :open query." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["p", ""], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["p", ""], function() { vimperator.open(readFromClipboard()); }, { short_help: "Open (put) a URL based on the current clipboard contents in the current buffer", help: "You can also just select (for non-X11 users: copy) some non-URL text, and search for it with the default search engine or keyword (specified by the 'defsearch' option) with p." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["P"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["P"], function() { vimperator.open(readFromClipboard(), @@ -604,21 +604,21 @@ function Mappings() //{{{ "Whether the new buffer is activated, depends on the 'activate' option." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["r"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["r"], function() { vimperator.tabs.reload(getBrowser().mCurrentTab, false); }, { short_help: "Reload", help: "Forces reloading of the current page." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["R"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["R"], function() { vimperator.tabs.reload(getBrowser().mCurrentTab, true); }, { short_help: "Reload while skipping the cache", help: "Forces reloading of the current page skipping the cache." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["t"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["t"], function() { vimperator.commandline.open(":", "tabopen ", vimperator.modes.EX); }, { short_help: "Open one or more URLs in a new tab", @@ -626,14 +626,14 @@ function Mappings() //{{{ "See :tabopen for more details." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["T"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["T"], function() { vimperator.commandline.open(":", "tabopen " + vimperator.buffer.URL, vimperator.modes.EX); }, { short_help: "Open one or more URLs in a new tab, based on current location", help: "Works like t, but preselects current URL in the :tabopen query." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["u"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["u"], function(count) { vimperator.commands.undo("", false, count); }, { short_help: "Undo closing of a tab", @@ -641,7 +641,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["y"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["y"], function() { var url = vimperator.buffer.URL; @@ -653,7 +653,7 @@ function Mappings() //{{{ help: "When running in X11 the location is also put into the selection, which can be pasted with the middle mouse button." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["Y"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["Y"], function() { var sel = window.content.document.getSelection(); @@ -664,35 +664,35 @@ function Mappings() //{{{ help: "The currently selected text is copied to the system clipboard." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["zi", "+"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["zi", "+"], function(count) { vimperator.buffer.zoomIn(count > 1 ? count : 1); }, { short_help: "Zoom in current web page by 25%", flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["zI"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["zI"], function(count) { vimperator.buffer.zoomIn((count > 1 ? count : 1) * 4); }, { short_help: "Zoom in current web page by 100%", flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["zo", "-"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["zo", "-"], function(count) { vimperator.buffer.zoomOut(count > 1 ? count : 1); }, { short_help: "Zoom out current web page by 25%", flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["zO"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["zO"], function(count) { vimperator.buffer.zoomOut((count > 1 ? count : 1) * 4); }, { short_help: "Zoom out current web page by 100%", flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["zz"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["zz"], function(count) { vimperator.buffer.textZoom = count > 1 ? count : 100; }, { short_help: "Set zoom value of the web page", @@ -700,14 +700,14 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["ZQ"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["ZQ"], function() { vimperator.quit(false); }, { short_help: "Quit and don't save the session", help: "Works like :qall." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["ZZ"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["ZZ"], function() { vimperator.quit(true); }, { short_help: "Quit and save the session", @@ -717,20 +717,20 @@ function Mappings() //{{{ )); // scrolling commands - addDefaultMap(new Map(vimperator.modes.NORMAL, ["0", "^"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["0", "^"], function() { vimperator.buffer.scrollStart(); }, { short_help: "Scroll to the absolute left of the document", help: "Unlike in Vim, 0 and ^ work exactly the same way." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["$"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["$"], function() { vimperator.buffer.scrollEnd(); }, { short_help: "Scroll to the absolute right of the document" } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["gg", ""], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["gg", ""], function(count) { vimperator.buffer.scrollToPercentile(count > 0 ? count : 0); }, { short_help: "Goto the top of the document", @@ -738,7 +738,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["G", ""], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["G", ""], function(count) { vimperator.buffer.scrollToPercentile(count >= 0 ? count : 100); }, { short_help: "Goto the end of the document", @@ -746,7 +746,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["h", ""], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["h", ""], function(count) { vimperator.buffer.scrollColumns(-(count > 1 ? count : 1)); }, { short_help: "Scroll document to the left", @@ -755,7 +755,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["j", "", ""], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["j", "", ""], function(count) { vimperator.buffer.scrollLines(count > 1 ? count : 1); }, { short_help: "Scroll document down", @@ -764,7 +764,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["k", "", ""], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["k", "", ""], function(count) { vimperator.buffer.scrollLines(-(count > 1 ? count : 1)); }, { short_help: "Scroll document up", @@ -789,7 +789,7 @@ function Mappings() //{{{ win.scrollBy(0, vimperator.buffer.pageHeight / 2 * direction); } } - addDefaultMap(new Map(vimperator.modes.NORMAL, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, [""], function(count) { scrollByScrollSize(count, 1); }, { short_help: "Scroll window downwards in the buffer", @@ -798,7 +798,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, [""], function(count) { scrollByScrollSize(count, -1); }, { short_help: "Scroll window upwards in the buffer", @@ -807,7 +807,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["l", ""], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["l", ""], function(count) { vimperator.buffer.scrollColumns(count > 1 ? count : 1); }, { short_help: "Scroll document to the right", @@ -816,7 +816,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["", "", ""], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["", "", ""], function(count) { vimperator.buffer.scrollPages(-(count > 1 ? count : 1)); }, { short_help: "Scroll up a full page", @@ -824,7 +824,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["", "", ""], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["", "", ""], function(count) { vimperator.buffer.scrollPages(count > 1 ? count : 1); }, { short_help: "Scroll down a full page", @@ -834,7 +834,7 @@ function Mappings() //{{{ )); // history manipulation and jumplist - addDefaultMap(new Map(vimperator.modes.NORMAL, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, [""], function(count) { vimperator.history.stepTo(-(count > 1 ? count : 1)); }, { short_help: "Go to an older position in the jump list", @@ -842,7 +842,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, [""], function(count) { vimperator.history.stepTo(count > 1 ? count : 1); }, { short_help: "Go to a newer position in the jump list", @@ -850,7 +850,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["H", "", ""], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["H", "", ""], function(count) { vimperator.history.stepTo(-(count > 1 ? count : 1)); }, { short_help: "Go back in the browser history", @@ -858,7 +858,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["L", "", ""], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["L", "", ""], function(count) { vimperator.history.stepTo(count > 1 ? count : 1); }, { short_help: "Go forward in the browser history", @@ -883,7 +883,7 @@ function Mappings() //{{{ else return false; } - addDefaultMap(new Map(vimperator.modes.NORMAL, ["gu", ""], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["gu", ""], function(count) { var gocmd = ""; @@ -906,7 +906,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["gU", ""], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["gU", ""], function() { vimperator.open("..."); }, { short_help: "Go to the root of the website", @@ -916,7 +916,7 @@ function Mappings() //{{{ )); // hint managment - addDefaultMap(new Map(vimperator.modes.NORMAL, ["f"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["f"], function() { vimperator.hints.enableHahMode(vimperator.modes.QUICK_HINT); }, { short_help: "Start QuickHint mode", @@ -925,7 +925,7 @@ function Mappings() //{{{ "If you write the hint in ALLCAPS, the hint is followed in a background tab." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["F"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["F"], function() { vimperator.hints.enableHahMode(vimperator.modes.ALWAYS_HINT); }, { short_help: "Start AlwaysHint mode", @@ -935,7 +935,7 @@ function Mappings() //{{{ "Also, most Ctrl-prefixed shortcut keys are available in this mode for navigation." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, [";"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, [";"], function() { vimperator.hints.enableHahMode(vimperator.modes.EXTENDED_HINT); }, { short_help: "Start ExtendedHint mode", @@ -960,7 +960,7 @@ function Mappings() //{{{ )); // search management - addDefaultMap(new Map(vimperator.modes.NORMAL, ["/"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["/"], function() { vimperator.search.openSearchDialog(vimperator.modes.SEARCH_FORWARD); }, { short_help: "Search forward for a pattern", @@ -972,7 +972,7 @@ function Mappings() //{{{ "\"\\L\" forces the entire page to be searched for a match." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["?"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["?"], function() { vimperator.search.openSearchDialog(vimperator.modes.SEARCH_BACKWARD); }, { short_help: "Search backwards for a pattern", @@ -985,14 +985,14 @@ function Mappings() //{{{ "NOTE: incremental searching currently only works in the forward direction." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["n"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["n"], function() { vimperator.search.findAgain(false); }, { short_help: "Find next", help: "Repeat the last search 1 time (until count is supported)." } )); - addDefaultMap(new Map(vimperator.modes.NORMAL, ["N"], + addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["N"], function() { vimperator.search.findAgain(true); }, { short_help: "Find previous", @@ -1006,63 +1006,63 @@ function Mappings() //{{{ // {{{ // action keys - addDefaultMap(new Map(vimperator.modes.HINTS, ["o"], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, ["o"], function() { vimperator.hints.openHints(false, false); }, { cancel_mode: true, always_active: false } )); - addDefaultMap(new Map(vimperator.modes.HINTS, ["t"], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, ["t"], function() { vimperator.hints.openHints(true, false); }, { cancel_mode: true, always_active: false } )); - addDefaultMap(new Map(vimperator.modes.HINTS, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], function() { vimperator.hints.openHints(false, true ); }, { cancel_mode: true, always_active: false } )); - addDefaultMap(new Map(vimperator.modes.HINTS, ["s"], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, ["s"], function() { vimperator.hints.saveHints(true); }, { cancel_mode: true, always_active: false } )); - addDefaultMap(new Map([vimperator.modes.HINTS], ["a"], + addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], ["a"], function() { vimperator.hints.saveHints(false); }, { cancel_mode: true, always_active: false } )); - addDefaultMap(new Map(vimperator.modes.HINTS, ["y"], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, ["y"], function() { vimperator.hints.yankUrlHints(); }, { cancel_mode: true, always_active: false } )); - addDefaultMap(new Map(vimperator.modes.HINTS, ["Y"], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, ["Y"], function() { vimperator.hints.yankTextHints(); }, { cancel_mode: true, always_active: false } )); - addDefaultMap(new Map(vimperator.modes.HINTS, [","], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [","], function() { vimperator.input.buffer += ','; vimperator.hints.setCurrentState(0); }, { cancel_mode: false, always_active: true } )); - addDefaultMap(new Map(vimperator.modes.HINTS, [":"], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [":"], function() { vimperator.commandline.open(':', '', vimperator.modes.EX); }, { cancel_mode: false, @@ -1071,7 +1071,7 @@ function Mappings() //{{{ )); // movement keys - addDefaultMap(new Map(vimperator.modes.HINTS, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], function(count) { vimperator.buffer.scrollLines(count > 1 ? count : 1); }, { cancel_mode: false, @@ -1079,7 +1079,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.HINTS, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], function(count) { vimperator.buffer.scrollLines(-(count > 1 ? count : 1)); }, { cancel_mode: false, @@ -1087,21 +1087,21 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.HINTS, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], function() { vimperator.buffer.scrollTop(); }, { cancel_mode: false, always_active: true } )); - addDefaultMap(new Map(vimperator.modes.HINTS, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], function() { vimperator.buffer.scrollBottom(); }, { cancel_mode: false, always_active: true } )); - addDefaultMap(new Map(vimperator.modes.HINTS, ["", ""], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, ["", ""], function(count) { vimperator.buffer.scrollPages(-(count > 1 ? count : 1)); }, { cancel_mode: false, @@ -1109,7 +1109,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.HINTS, ["", ""], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, ["", ""], function(count) { vimperator.buffer.scrollPages(count > 1 ? count : 1); }, { cancel_mode: false, @@ -1117,7 +1117,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.HINTS, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], function() { vimperator.buffer.scrollColumns(-(count > 1 ? count : 1)); }, { cancel_mode: false, @@ -1125,7 +1125,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.HINTS, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], function() { vimperator.buffer.scrollLines(count > 1 ? count : 1); }, { cancel_mode: false, @@ -1133,7 +1133,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.HINTS, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], function() { vimperator.buffer.scrollLines(-(count > 1 ? count : 1)); }, { cancel_mode: false, @@ -1141,7 +1141,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.HINTS, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], function() { vimperator.buffer.scrollColumns(count > 1 ? count : 1); }, { cancel_mode: false, @@ -1151,14 +1151,14 @@ function Mappings() //{{{ )); // tab management - addDefaultMap(new Map(vimperator.modes.HINTS, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], function() { vimperator.tabs.select('+1', true); }, { cancel_mode: true, always_active: true } )); // same as gt, but no count supported - addDefaultMap(new Map(vimperator.modes.HINTS, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], function() { vimperator.tabs.select('-1', true); }, { cancel_mode: true, @@ -1167,7 +1167,7 @@ function Mappings() //{{{ )); // navigation - addDefaultMap(new Map(vimperator.modes.HINTS, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], function(count) { vimperator.history.stepTo(count > 0 ? -count : -1); }, { cancel_mode: false, @@ -1175,7 +1175,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.HINTS, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], function(count) { vimperator.history.stepTo(count > 1 ? count : 1); }, { cancel_mode: false, @@ -1183,7 +1183,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.HINTS, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], function(count) { vimperator.history.stepTo(count > 0 ? -count : -1); }, { cancel_mode: false, @@ -1191,7 +1191,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.HINTS, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], function(count) { vimperator.history.stepTo(count > 1 ? count : 1); }, { cancel_mode: false, @@ -1199,7 +1199,7 @@ function Mappings() //{{{ flags: Mappings.flags.COUNT } )); - addDefaultMap(new Map(vimperator.modes.HINTS, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], function() { vimperator.tabs.remove(getBrowser().mCurrentTab, vimperator.input.count, false, 0); }, { cancel_mode: true, @@ -1208,28 +1208,28 @@ function Mappings() //{{{ )); // cancel_mode hint mode keys - addDefaultMap(new Map(vimperator.modes.HINTS, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], function() { ; }, { cancel_mode: true, always_active: true } )); - addDefaultMap(new Map(vimperator.modes.HINTS, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], function() { ; }, { cancel_mode: true, always_active: true } )); - addDefaultMap(new Map(vimperator.modes.HINTS, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], function() { ; }, { cancel_mode: true, always_active: true } )); - addDefaultMap(new Map(vimperator.modes.HINTS, [""], + addDefaultMap(new vimperator.Map(vimperator.modes.HINTS, [""], function() { ; }, { cancel_mode: true, diff --git a/content/options.js b/content/options.js index 1e76fa63..042a62b8 100644 --- a/content/options.js +++ b/content/options.js @@ -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. }}} ***** END LICENSE BLOCK *****/ -function Option(names, type, extra_info) //{{{ +vimperator.Option = function(names, type, extra_info) //{{{ { if (!names || !type) return null; @@ -107,7 +107,7 @@ function Option(names, type, extra_info) //{{{ } } //}}} -function Options() //{{{ +vimperator.Options = function() //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// @@ -118,13 +118,6 @@ function Options() //{{{ var vimperator_prefs = firefox_prefs.getBranch("extensions.vimperator."); 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() { for (var i = 0; i < options.length; i++) @@ -206,8 +199,8 @@ function Options() //{{{ function setGuiOptions(value) { // hide menubar - document.getElementById("toolbar-menubar").collapsed = value.indexOf("m") > -1 ? false : true; - document.getElementById("toolbar-menubar").hidden = value.indexOf("m") > -1 ? false : true; + //document.getElementById("toolbar-menubar").collapsed = value.indexOf("m") > -1 ? false : true; + //document.getElementById("toolbar-menubar").hidden = value.indexOf("m") > -1 ? false : true; // and main toolbar document.getElementById("nav-bar").collapsed = value.indexOf("T") > -1 ? false : true; document.getElementById("nav-bar").hidden = value.indexOf("T") > -1 ? false : true; @@ -311,6 +304,13 @@ function Options() //{{{ 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() { // 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: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", help: "Available items:
" + @@ -405,7 +405,7 @@ function Options() //{{{ default_value: "homepage,quickmark,tabopen,paste" } )); - 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", help: "Available items:
" + @@ -421,7 +421,7 @@ function Options() //{{{ 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", help: "The default search engine is used in the :[tab]open [arg] command " + @@ -430,20 +430,20 @@ function Options() //{{{ default_value: "google" } )); - addOption(new Option(["extendedhinttags", "eht"], "string", + this.add(new vimperator.Option(["extendedhinttags", "eht"], "string", { short_help: "XPath string of hintable elements activated by ';'", 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", 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;" } )); - addOption(new Option(["fullscreen", "fs"], "boolean", + this.add(new vimperator.Option(["fullscreen", "fs"], "boolean", { short_help: "Show the current window fullscreen", setter: function(value) { window.fullScreen = value; }, @@ -451,7 +451,7 @@ function Options() //{{{ 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", help: "Supported characters:
" + @@ -465,52 +465,52 @@ function Options() //{{{ 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", default_value: "hjklasdfgyuiopqwertnmzxcvb" } )); - addOption(new Option(["hintstyle", "hs"], "string", + this.add(new vimperator.Option(["hintstyle", "hs"], "string", { short_help: "CSS specification of unfocused hints", 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;" } )); - addOption(new Option(["hinttags", "ht"], "string", + this.add(new vimperator.Option(["hinttags", "ht"], "string", { short_help: "XPath string of hintable elements activated by 'f' and 'F'", 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", setter: function(value) { if (value) vimperator.search.highlight(); else vimperator.search.clear(); }, 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", 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", 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", help: "NOTE: Incremental searching currently only works in the forward direction.", default_value: true } )); - addOption(new Option(["laststatus", "ls"], "number", + this.add(new vimperator.Option(["laststatus", "ls"], "number", { short_help: "Show the status line", help: "Determines when the last window will have a status line. " + @@ -526,20 +526,20 @@ function Options() //{{{ 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", help: "This includes (X)HTML elements with an \"href\" atrribute and XLink \"simple\" links.", 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", 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", help: "If you want to speed up display of hints, choose a smaller value", @@ -547,7 +547,7 @@ function Options() //{{{ 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", 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. " + @@ -564,7 +564,7 @@ function Options() //{{{ 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", help: "History access can be quite slow for a large history. Vimperator maintains a cache to speed it up significantly on subsequent access.
" + @@ -572,7 +572,7 @@ function Options() //{{{ default_value: true } )); - addOption(new Option(["previewheight", "pvh"], "number", + this.add(new vimperator.Option(["previewheight", "pvh"], "number", { 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. " + @@ -582,7 +582,7 @@ function Options() //{{{ 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 C-u and C-d commands", help: "The number of lines scrolled defaults to half the window size. " + @@ -592,13 +592,13 @@ function Options() //{{{ 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", 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", help: "Also links which are focused by keyboard commands like <Tab> are shown. " + @@ -612,7 +612,7 @@ function Options() //{{{ 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", help: "Possible values:
" + @@ -626,14 +626,14 @@ function Options() //{{{ 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", help: "This is only used if the 'ignorecase' option is set.", default_value: true } )); - addOption(new Option(["titlestring"], "string", + this.add(new vimperator.Option(["titlestring"], "string", { short_help: "Change the title of the browser window", help: "Vimperator changes the browser title from \"Title of web page - Mozilla Firefox\" to " + @@ -643,7 +643,7 @@ function Options() //{{{ 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", help: "Note that this is a local option for now, later it may be split into a global and :setlocal part", @@ -652,7 +652,7 @@ function Options() //{{{ 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", 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 :javascript!.
" + @@ -661,14 +661,14 @@ function Options() //{{{ 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", setter: function(value) { vimperator.options.setFirefoxPref("accessibility.typeaheadfind.enablesound", !value); }, default_value: false } )); - addOption(new Option(["visualbellstyle", "t_vb"], "string", + this.add(new vimperator.Option(["visualbellstyle", "t_vb"], "string", { short_help: "CSS specification of the visual bell", help: "To hide the visual bell use a value of \"display: none;\" or unset it with :set t_vb=", @@ -676,7 +676,7 @@ function Options() //{{{ default_value: "background-color: black; color: black;" } )); - addOption(new Option(["wildmode", "wim"], "stringlist", + this.add(new vimperator.Option(["wildmode", "wim"], "stringlist", { short_help: "Define how command line completion works", help: "It is a comma-separated list of parts, where each part specifies " + @@ -703,7 +703,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", help: "A list of words that change how command line completion is done.
" + diff --git a/content/tabs.js b/content/tabs.js index 95c84841..220523d3 100644 --- a/content/tabs.js +++ b/content/tabs.js @@ -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 * @deprecated */ -function Tabs() //{{{ +vimperator.Tabs = function() //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// diff --git a/content/ui.js b/content/ui.js index 346a24f7..864999ac 100644 --- a/content/ui.js +++ b/content/ui.js @@ -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 * be sure to only create objects of this class when the chrome is ready */ -function CommandLine() //{{{ +vimperator.CommandLine = function() //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// @@ -40,7 +40,7 @@ function CommandLine() //{{{ 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 = []; // TODO: clean this up when it's not 3am... @@ -852,7 +852,7 @@ function CommandLine() //{{{ * @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 */ -function InformationList(id, options) //{{{ +vimperator.InformationList = function(id, options) //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// @@ -1055,7 +1055,7 @@ function InformationList(id, options) //{{{ //}}} } //}}} -function StatusLine() //{{{ +vimperator.StatusLine = function() //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// diff --git a/content/vimperator.js b/content/vimperator.js index 282c7135..b2559661 100644 --- a/content/vimperator.js +++ b/content/vimperator.js @@ -684,37 +684,41 @@ const vimperator = (function() //{{{ // these objects are created here only after the chrome is ready vimperator.log("Loading module options...", 3); - vimperator.options = new Options(); + vimperator.options = new vimperator.Options(); vimperator.log("Loading module events...", 3); - vimperator.events = new Events(); + vimperator.events = new vimperator.Events(); vimperator.log("Loading module commands...", 3); - vimperator.commands = new Commands(); + vimperator.commands = new vimperator.Commands(); vimperator.log("Loading module bookmarks...", 3); - vimperator.bookmarks = new Bookmarks(); + vimperator.bookmarks = new vimperator.Bookmarks(); vimperator.log("Loading module history...", 3); - vimperator.history = new History(); + vimperator.history = new vimperator.History(); vimperator.log("Loading module commandline...", 3); - vimperator.commandline = new CommandLine(); + vimperator.commandline = new vimperator.CommandLine(); vimperator.log("Loading module search...", 3); - vimperator.search = new Search(); + vimperator.search = new vimperator.Search(); 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.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.mappings = new Mappings(); vimperator.log("Loading module statusline...", 3); - vimperator.statusline = new StatusLine(); + vimperator.statusline = new vimperator.StatusLine(); vimperator.log("Loading module buffer...", 3); - vimperator.buffer = new Buffer(); + vimperator.buffer = new vimperator.Buffer(); vimperator.log("Loading module tabs...", 3); - vimperator.tabs = new Tabs(); + vimperator.tabs = new vimperator.Tabs(); vimperator.log("Loading module marks...", 3); - vimperator.marks = new Marks(); + vimperator.marks = new vimperator.Marks(); vimperator.log("Loading module quickmarks...", 3); - vimperator.quickmarks = new QuickMarks(); + vimperator.quickmarks = new vimperator.QuickMarks(); 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.echo = function(str) { vimperator.commandline.echo(str); }