diff --git a/content/bookmarks.js b/content/bookmarks.js index 967fb989..16f3bb55 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 -vimperator.Bookmarks = function() //{{{ +vimperator.Bookmarks = function () //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// @@ -47,7 +47,7 @@ vimperator.Bookmarks = function() //{{{ var keywords = null; if (vimperator.options["preload"]) - setTimeout(function() { load(); } , 100); + setTimeout(function () { load(); } , 100); function load() { @@ -102,7 +102,7 @@ vimperator.Bookmarks = function() //{{{ // if "bypass_cache" is true, it will force a reload of the bookmarks database // on my PC, it takes about 1ms for each bookmark to load, so loading 1000 bookmarks // takes about 1 sec - this.get = function(filter, tags, bypass_cache) + this.get = function (filter, tags, bypass_cache) { if (!bookmarks || bypass_cache) load(); @@ -147,7 +147,7 @@ vimperator.Bookmarks = function() //{{{ } // returns number of deleted bookmarks - this.remove = function(url) + this.remove = function (url) { if (!url) return 0; @@ -178,7 +178,7 @@ vimperator.Bookmarks = function() //{{{ // TODO: add filtering // also ensures that each search engine has a Vimperator-friendly alias - this.getSearchEngines = function() + this.getSearchEngines = function () { var search_engines = []; var firefox_engines = search_service.getVisibleEngines({ }); @@ -194,7 +194,7 @@ vimperator.Bookmarks = function() //{{{ var newalias = alias; for (var j = 1; j <= 10; j++) // <=10 is intentional { - if (!search_engines.some(function(item) { return (item[0] == newalias); })) + if (!search_engines.some(function (item) { return (item[0] == newalias); })) break; newalias = alias + j; @@ -212,7 +212,7 @@ vimperator.Bookmarks = function() //{{{ // TODO: add filtering // format of returned array: // [keyword, helptext, url] - this.getKeywords = function() + this.getKeywords = function () { if (!keywords) load(); @@ -223,7 +223,7 @@ vimperator.Bookmarks = function() //{{{ // if @param engine_name is null, it uses the default search engine // @returns the url for the search string // if the search also requires a postdata, [url, postdata] is returned - this.getSearchURL = function(text, engine_name) + this.getSearchURL = function (text, engine_name) { var url = null; var postdata = null; @@ -271,7 +271,7 @@ vimperator.Bookmarks = function() //{{{ return url; // can be null } - this.list = function(filter, tags, fullmode) + this.list = function (filter, tags, fullmode) { if (fullmode) { @@ -328,7 +328,7 @@ vimperator.Bookmarks = function() //{{{ //}}} } //}}} -vimperator.History = function() //{{{ +vimperator.History = function () //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// @@ -339,7 +339,7 @@ vimperator.History = function() //{{{ var history = null; if (vimperator.options["preload"]) - setTimeout(function() { load(); } , 100); + setTimeout(function () { load(); } , 100); function load() { @@ -374,7 +374,7 @@ vimperator.History = function() //{{{ ////////////////////// PUBLIC SECTION ////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ - this.get = function(filter) + this.get = function (filter) { if (!history) load(); @@ -389,7 +389,7 @@ vimperator.History = function() //{{{ if (!history) load(); - history = history.filter(function(elem) { + history = history.filter(function (elem) { return elem[0] != url; }); @@ -399,7 +399,7 @@ vimperator.History = function() //{{{ // TODO: better names? // and move to vimperator.buffer.? - this.stepTo = function(steps) + this.stepTo = function (steps) { var index = getWebNavigation().sessionHistory.index + steps; @@ -413,7 +413,7 @@ vimperator.History = function() //{{{ } } - this.goToStart = function() + this.goToStart = function () { var index = getWebNavigation().sessionHistory.index; @@ -426,7 +426,7 @@ vimperator.History = function() //{{{ getWebNavigation().gotoIndex(0); } - this.goToEnd = function() + this.goToEnd = function () { var index = getWebNavigation().sessionHistory.index; var max = getWebNavigation().sessionHistory.count - 1; @@ -440,7 +440,7 @@ vimperator.History = function() //{{{ getWebNavigation().gotoIndex(max); } - this.list = function(filter, fullmode) + this.list = function (filter, fullmode) { if (fullmode) { @@ -477,7 +477,7 @@ vimperator.History = function() //{{{ //}}} } //}}} -vimperator.Marks = function() //{{{ +vimperator.Marks = function () //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// @@ -566,7 +566,7 @@ vimperator.Marks = function() //{{{ umarks.push([mark, url_marks[mark]]); // FIXME: why does umarks.sort() cause a "Component is not available = // NS_ERROR_NOT_AVAILABLE" exception when used here? - umarks.sort(function(a, b) { + umarks.sort(function (a, b) { if (a[0] < b[0]) return -1; else if (a[0] > b[0]) @@ -583,7 +583,7 @@ vimperator.Marks = function() //{{{ /////////////////////////////////////////////////////////////////////////////{{{ // TODO: add support for frameset pages - this.add = function(mark) + this.add = function (mark) { var win = window.content; @@ -613,7 +613,7 @@ vimperator.Marks = function() //{{{ } } - this.remove = function(filter, special) + this.remove = function (filter, special) { if (special) { @@ -637,7 +637,7 @@ vimperator.Marks = function() //{{{ } } - this.jumpTo = function(mark) + this.jumpTo = function (mark) { var ok = false; @@ -691,7 +691,7 @@ vimperator.Marks = function() //{{{ vimperator.echoerr("E20: Mark not set"); // FIXME: move up? } - this.list = function(filter) + this.list = function (filter) { var marks = getSortedMarks(); @@ -703,7 +703,7 @@ vimperator.Marks = function() //{{{ if (filter.length > 0) { - marks = marks.filter(function(mark) { + marks = marks.filter(function (mark) { if (filter.indexOf(mark[0]) > -1) return mark; }); @@ -732,7 +732,7 @@ vimperator.Marks = function() //{{{ //}}} } //}}} -vimperator.QuickMarks = function() //{{{ +vimperator.QuickMarks = function () //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// @@ -751,12 +751,12 @@ vimperator.QuickMarks = function() //{{{ ////////////////////// PUBLIC SECTION ////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ - this.add = function(qmark, location) + this.add = function (qmark, location) { qmarks[qmark] = location; } - this.remove = function(filter) + this.remove = function (filter) { var pattern = new RegExp("[" + filter.replace(/\s+/g, "") + "]"); @@ -767,12 +767,12 @@ vimperator.QuickMarks = function() //{{{ } } - this.removeAll = function() + this.removeAll = function () { qmarks = {}; } - this.jumpTo = function(qmark, where) + this.jumpTo = function (qmark, where) { var url = qmarks[qmark]; @@ -782,7 +782,7 @@ vimperator.QuickMarks = function() //{{{ vimperator.echoerr("E20: QuickMark not set"); } - this.list = function(filter) + this.list = function (filter) { var marks = []; @@ -799,7 +799,7 @@ vimperator.QuickMarks = function() //{{{ if (filter.length > 0) { - marks = marks.filter(function(mark) { + marks = marks.filter(function (mark) { if (filter.indexOf(mark[0]) > -1) return mark; }); @@ -822,7 +822,7 @@ vimperator.QuickMarks = function() //{{{ vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, vimperator.commandline.FORCE_MULTILINE); } - this.destroy = function() + this.destroy = function () { // save the quickmarks var saved_qmarks = ""; diff --git a/content/buffers.js b/content/buffers.js index 5205547d..c00591bd 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 *****/ -vimperator.Buffer = function() //{{{ +vimperator.Buffer = function () //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// @@ -129,43 +129,43 @@ vimperator.Buffer = function() //{{{ this.lastInputField = null; // used to keep track of the right field for "gi" - this.__defineGetter__("URL", function() + this.__defineGetter__("URL", function () { // TODO: .URL is not defined for XUL documents //return window.content.document.URL; return window.content.document.location.href; }); - this.__defineGetter__("pageHeight", function() + this.__defineGetter__("pageHeight", function () { return window.content.innerHeight; }); - this.__defineGetter__("textZoom", function() + this.__defineGetter__("textZoom", function () { return getBrowser().mCurrentBrowser.markupDocumentViewer.textZoom * 100; }); - this.__defineSetter__("textZoom", function(value) + this.__defineSetter__("textZoom", function (value) { setZoom(value, false); }); - this.__defineGetter__("fullZoom", function() + this.__defineGetter__("fullZoom", function () { return getBrowser().mCurrentBrowser.markupDocumentViewer.fullZoom * 100; }); - this.__defineSetter__("fullZoom", function(value) + this.__defineSetter__("fullZoom", function (value) { setZoom(value, true); }); - this.__defineGetter__("title", function() + this.__defineGetter__("title", function () { return window.content.document.title; }); // returns an XPathResult object - this.evaluateXPath = function(expression, doc, elem, asIterator) + this.evaluateXPath = function (expression, doc, elem, asIterator) { if (!doc) doc = window.content.document; @@ -191,7 +191,7 @@ vimperator.Buffer = function() //{{{ // in contrast to vim, returns the selection if one is made, // otherwise tries to guess the current word unter the text cursor // NOTE: might change the selection - this.getCurrentWord = function() + this.getCurrentWord = function () { var selection = window.content.getSelection().toString(); @@ -211,7 +211,7 @@ vimperator.Buffer = function() //{{{ return selection; } - this.list = function(fullmode) + this.list = function (fullmode) { if (fullmode) { @@ -258,12 +258,12 @@ vimperator.Buffer = function() //{{{ } } - this.scrollBottom = function() + this.scrollBottom = function () { scrollToPercentiles(-1, 100); } - this.scrollColumns = function(cols) + this.scrollColumns = function (cols) { var win = window.document.commandDispatcher.focusedWindow; const COL_WIDTH = 20; @@ -274,42 +274,42 @@ vimperator.Buffer = function() //{{{ win.scrollBy(COL_WIDTH * cols, 0); } - this.scrollEnd = function() + this.scrollEnd = function () { scrollToPercentiles(100, -1); } - this.scrollLines = function(lines) + this.scrollLines = function (lines) { var win = window.document.commandDispatcher.focusedWindow; checkScrollYBounds(win, lines); win.scrollByLines(lines); } - this.scrollPages = function(pages) + this.scrollPages = function (pages) { var win = window.document.commandDispatcher.focusedWindow; checkScrollYBounds(win, pages); win.scrollByPages(pages); } - this.scrollToPercentile = function(percentage) + this.scrollToPercentile = function (percentage) { scrollToPercentiles(-1, percentage); } - this.scrollStart = function() + this.scrollStart = function () { scrollToPercentiles(0, -1); } - this.scrollTop = function() + this.scrollTop = function () { scrollToPercentiles(-1, 0); } // TODO: allow callback for filtering out unwanted frames? User defined? - this.shiftFrameFocus = function(count, forward) + this.shiftFrameFocus = function (count, forward) { if (!window.content.document instanceof HTMLDocument) return; @@ -317,7 +317,7 @@ vimperator.Buffer = function() //{{{ var frames = []; // find all frames - depth-first search - (function(frame) + (function (frame) { if (frame.document.body.localName.toLowerCase() == "body") frames.push(frame); @@ -331,7 +331,7 @@ vimperator.Buffer = function() //{{{ // remove all unfocusable frames // TODO: find a better way to do this - walking the tree is too slow var start = document.commandDispatcher.focusedWindow; - frames = frames.filter(function(frame) { + frames = frames.filter(function (frame) { frame.focus(); if (document.commandDispatcher.focusedWindow == frame) return frame; @@ -404,11 +404,11 @@ vimperator.Buffer = function() //{{{ doc.body.appendChild(indicator); // remove the frame indicator - setTimeout(function() { doc.body.removeChild(indicator); }, 500); + setTimeout(function () { doc.body.removeChild(indicator); }, 500); } // updates the buffer preview in place only if list is visible - this.updateBufferList = function() + this.updateBufferList = function () { if (!vimperator.bufferwindow.visible()) return false; @@ -421,7 +421,7 @@ vimperator.Buffer = function() //{{{ // XXX: should this be in v.buffers. or v.tabs.? // "buffer" is a string which matches the URL or title of a buffer, if it // is null, the last used string is used again - this.switchTo = function(buffer, allowNonUnique, count, reverse) + this.switchTo = function (buffer, allowNonUnique, count, reverse) { if (buffer != null) { @@ -472,23 +472,23 @@ vimperator.Buffer = function() //{{{ index += matches.length; } else - index = (count-1) % matches.length; + index = (count - 1) % matches.length; vimperator.tabs.select(matches[index], false); } }; - this.zoomIn = function(steps, full_zoom) + this.zoomIn = function (steps, full_zoom) { bumpZoomLevel(steps, full_zoom); }; - this.zoomOut = function(steps, full_zoom) + this.zoomOut = function (steps, full_zoom) { bumpZoomLevel(-steps, full_zoom); }; - this.pageInfo = function(verbose) + this.pageInfo = function (verbose) { // TODO: copied from firefox. Needs some review/work... // const feedTypes = { diff --git a/content/commands.js b/content/commands.js index c9731373..cab6939d 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 *****/ -vimperator.Command = function(specs, action, extra_info) //{{{ +vimperator.Command = function (specs, action, extra_info) //{{{ { if (!specs || !action) return null; @@ -34,7 +34,7 @@ vimperator.Command = function(specs, action, extra_info) //{{{ // convert command name abbreviation specs of the form // 'shortname[optional-tail]' to short and long versions Eg. 'abc[def]' -> // 'abc', 'abcdef' - var parseSpecs = function(specs) + var parseSpecs = function (specs) { var short_names = []; var long_names = []; @@ -90,14 +90,14 @@ vimperator.Command = function(specs, action, extra_info) //{{{ } -vimperator.Command.prototype.execute = function(args, special, count, modifiers) +vimperator.Command.prototype.execute = function (args, special, count, modifiers) { return 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) -vimperator.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 @@ -127,7 +127,7 @@ vimperator.Command.prototype.hasName = function(name) } //}}} -vimperator.Commands = function() //{{{ +vimperator.Commands = function () //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// @@ -148,7 +148,7 @@ vimperator.Commands = function() //{{{ function addDefaultCommand(command) { ex_commands.push(command); - vimperator.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); } @@ -452,12 +452,12 @@ vimperator.Commands = function() //{{{ ////////////////////// PUBLIC SECTION ////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ - this.__iterator__ = function() + this.__iterator__ = function () { return commandsIterator(); } - this.add = function(command) + this.add = function (command) { if (!command) return false; @@ -467,7 +467,7 @@ vimperator.Commands = function() //{{{ return true; } - this.get = function(name) + this.get = function (name) { for (var i = 0; i < ex_commands.length; i++) { @@ -482,7 +482,7 @@ vimperator.Commands = function() //{{{ // FIXME: doesn't really belong here... // return [null, null, null, null, heredoc_tag || false]; // [count, cmd, special, args] = match; - this.parseCommand = function(str, tag) + this.parseCommand = function (str, tag) { // remove comments str.replace(/\s*".*$/, ""); @@ -526,14 +526,14 @@ vimperator.Commands = function() //{{{ /////////////////////////////////////////////////////////////////////////////{{{ 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", help: "You can add/remove/disable browser extensions from this dialog.
Be aware that not all Firefox extensions work, because Vimperator overrides some key bindings and changes Firefox's GUI." } )); addDefaultCommand(new vimperator.Command(["ba[ck]"], - function(args, special, count) + function (args, special, count) { if (special) vimperator.history.goToStart(); @@ -559,7 +559,7 @@ vimperator.Commands = function() //{{{ short_help: "Go back in the browser history", help: "Count is supported, :3back goes back 3 pages in the browser history.
" + "The special version :back! goes to the beginning of the browser history.", - completer: function(filter) + completer: function (filter) { var sh = getWebNavigation().sessionHistory; var completions = []; @@ -576,7 +576,7 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["bd[elete]", "bw[ipeout]", "bun[load]", "tabc[lose]"], - function(args, special, count) { vimperator.tabs.remove(getBrowser().mCurrentTab, count > 0 ? count : 1, special, 0); }, + function (args, special, count) { vimperator.tabs.remove(getBrowser().mCurrentTab, count > 0 ? count : 1, special, 0); }, { usage: ["[count]bd[elete][!]"], short_help: "Delete current buffer (=tab)", @@ -585,13 +585,13 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["beep"], - function() { vimperator.beep(); }, + function () { vimperator.beep(); }, { short_help: "Play a system beep" } )); addDefaultCommand(new vimperator.Command(["bma[rk]"], - function(args) + function (args) { var res = parseArgs(args, this.args); if (!res) @@ -620,11 +620,11 @@ vimperator.Commands = function() //{{{ " -keyword=keyword
", args: [[["-title", "-t"], OPTION_STRING], [["-tags", "-T"], OPTION_LIST], - [["-keyword", "-k"], OPTION_STRING, function(arg) { return /\w/.test(arg); } ]] + [["-keyword", "-k"], OPTION_STRING, function (arg) { return /\w/.test(arg); } ]] } )); addDefaultCommand(new vimperator.Command(["bmarks"], - function(args, special) + function (args, special) { var res = parseArgs(args, this.args); if (!res) @@ -640,12 +640,12 @@ vimperator.Commands = function() //{{{ "The special version :bmarks! opens the default Firefox bookmarks window.
" + "Filter can also contain the following options:
" + "-tags=comma,separated,tag,list
", - completer: function(filter) { return vimperator.bookmarks.get(filter); }, + completer: function (filter) { return vimperator.bookmarks.get(filter); }, args: [[["-tags", "-T"], OPTION_LIST]] } )); 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}"], short_help: "Go to buffer from buffer list", @@ -654,11 +654,11 @@ vimperator.Commands = function() //{{{ "it is selected. With [!] the next buffer matching the argument " + "is selected, even if it cannot be identified uniquely.
" + "Use b as a shortcut to open this prompt.", - completer: function(filter) { return vimperator.completion.get_buffer_completions(filter); } + completer: function (filter) { return vimperator.completion.get_buffer_completions(filter); } } )); addDefaultCommand(new vimperator.Command(["buffers", "files", "ls", "tabs"], - function(args, special) + function (args, special) { if (args) { @@ -676,7 +676,7 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["delbm[arks]"], - function(args, special) + function (args, special) { var url = args; if (!url) @@ -693,11 +693,11 @@ vimperator.Commands = function() //{{{ "Use <Tab> key on a string to complete the URL which you want to delete.
" + "The following options WILL be interpreted in the future:
" + " [!] a special version to delete ALL bookmarks
", - completer: function(filter) { return vimperator.bookmarks.get(filter); } + completer: function (filter) { return vimperator.bookmarks.get(filter); } } )); addDefaultCommand(new vimperator.Command(["com[mand]"], - function(args) + function (args) { var res = parseArgs(args, this.args); if (!res) @@ -709,13 +709,13 @@ vimperator.Commands = function() //{{{ usage: ["com[mand][!] [{attr}...] {cmd} {rep}"], short_help: "Temporarily used for testing args parser", help: "", - args: [[["-nargs"], OPTION_STRING, function(arg) { return /^(0|1|\*|\?|\+)$/.test(arg); } ], + args: [[["-nargs"], OPTION_STRING, function (arg) { return /^(0|1|\*|\?|\+)$/.test(arg); } ], [["-bang"], OPTION_NOARG], [["-bar"], OPTION_NOARG]] } )); addDefaultCommand(new vimperator.Command(["delm[arks]"], - function(args, special) + function (args, special) { if (!special && !args) { @@ -768,7 +768,7 @@ vimperator.Commands = function() //{{{ )); 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. :) if (!special && !args) @@ -797,7 +797,7 @@ vimperator.Commands = function() //{{{ } )); 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", help: "Open the original Firefox download dialog in a new tab.
" + @@ -833,7 +833,7 @@ vimperator.Commands = function() //{{{ return arg; } addDefaultCommand(new vimperator.Command(["ec[ho]"], - function(args) + function (args) { var res = argToString(args, true); if (res != null) @@ -845,11 +845,11 @@ vimperator.Commands = function() //{{{ help: "Useful for showing informational messages. Multiple lines can be separated by \\n.
" + "{expr} can either be a quoted string, or any expression which can be fed to eval() like 4+5. " + "You can also view the source code of objects and functions if the return value of {expr} is an object or function.", - completer: function(filter) { return vimperator.completion.javascript(filter); } + completer: function (filter) { return vimperator.completion.javascript(filter); } } )); addDefaultCommand(new vimperator.Command(["echoe[rr]"], - function(args) + function (args) { var res = argToString(args, false); if (res != null) @@ -859,11 +859,11 @@ vimperator.Commands = function() //{{{ usage: ["echoe[rr] {expr}"], short_help: "Display an error string at the bottom of the window", help: "Just like :ec[ho], but echoes the result highlighted in red. Useful for showing important messages.", - completer: function(filter) { return vimperator.completion.javascript(filter); } + completer: function (filter) { return vimperator.completion.javascript(filter); } } )); addDefaultCommand(new vimperator.Command(["exe[cute]"], - function(args) + function (args) { // TODO: :exec has some difficult semantics -> later // var res = parseArgs(args, this.args); @@ -881,13 +881,13 @@ vimperator.Commands = function() //{{{ } )); 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" } )); addDefaultCommand(new vimperator.Command(["fo[rward]", "fw"], - function(args, special, count) + function (args, special, count) { if (special) vimperator.history.goToEnd(); @@ -913,7 +913,7 @@ vimperator.Commands = function() //{{{ short_help: "Go forward in the browser history", help: "Count is supported, :3forward goes forward 3 pages in the browser history.
" + "The special version :forward! goes to the end of the browser history.", - completer: function(filter) + completer: function (filter) { var sh = getWebNavigation().sessionHistory; var completions = []; @@ -930,14 +930,14 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["ha[rdcopy]"], - function() { getBrowser().contentWindow.print(); }, + 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 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}"], short_help: "Open the help window", @@ -949,21 +949,21 @@ vimperator.Commands = function() //{{{ "
  • :help o for mappings (no pre- or postfix)
  • " + "" + "You can however use partial stings in the tab completion, so :help he<Tab> completes :help :help.", - completer: function(filter) { return vimperator.completion.get_help_completions(filter); } + completer: function (filter) { return vimperator.completion.get_help_completions(filter); } } )); 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!"], short_help: "Show recently visited URLs", help: "Open the message window at the bottom of the screen with all history items which match [filter] either in the title or URL.
    " + "The special version :history! opens the default Firefox history window.", - completer: function(filter) { return vimperator.history.get(filter); } + completer: function (filter) { return vimperator.history.get(filter); } } )); addDefaultCommand(new vimperator.Command(["javas[cript]", "js"], - function(args, special) + function (args, special) { if (special) // open javascript console vimperator.open("chrome://global/content/console.xul", vimperator.NEW_TAB); @@ -974,7 +974,7 @@ vimperator.Commands = function() //{{{ if (matches && matches[2]) { vimperator.commandline.inputMultiline(new RegExp("^" + matches[2] + "$", "m"), - function(code) { + function (code) { try { eval(matches[1] + "\n" + code); @@ -1008,11 +1008,11 @@ vimperator.Commands = function() //{{{ "Rudimentary <Tab> completion is available for :javascript {cmd}<Tab> (but not yet for the " + ":js <<EOF multiline widget). Be aware that Vimperator needs to run {cmd} through eval() " + "to get the completions, which could have unwanted side effects.", - completer: function(filter) { return vimperator.completion.javascript(filter); } + completer: function (filter) { return vimperator.completion.javascript(filter); } } )); addDefaultCommand(new vimperator.Command(["let"], - function(args) + function (args) { if (!args) { @@ -1100,7 +1100,7 @@ vimperator.Commands = function() //{{{ )); // code for abbreviations addDefaultCommand(new vimperator.Command(["ab[breviate]"], - function(args) + function (args) { if (!args) { @@ -1124,7 +1124,7 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["ca[bbrev]"], - function(args) + function (args) { if (!args) { @@ -1146,7 +1146,7 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["ia[bbrev]"], - function(args) + function (args) { if (!args) { @@ -1168,14 +1168,14 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["una[bbreviate]"], - function(args) { vimperator.editor.removeAbbreviation("!", args); }, + function (args) { vimperator.editor.removeAbbreviation("!", args); }, { usage: ["una[bbreviate] {lhs}"], short_help: "Remove an abbreviation" } )); addDefaultCommand(new vimperator.Command(["cuna[bbrev]"], - function(args) { vimperator.editor.removeAbbreviation("c", args); }, + function (args) { vimperator.editor.removeAbbreviation("c", args); }, { usage: ["cuna[bbrev] {lhs}"], short_help: "Remove an abbreviation for Command-line mode", @@ -1183,7 +1183,7 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["iuna[bbrev]"], - function(args) { vimperator.editor.removeAbbreviation("i", args); }, + function (args) { vimperator.editor.removeAbbreviation("i", args); }, { usage: ["iuna[bbrev] {lhs}"], short_help: "Remove an abbreviation for Insert mode", @@ -1191,15 +1191,15 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["ab[clear]"], - function(args) { vimperator.editor.removeAllAbbreviations("!"); }, + function (args) { vimperator.editor.removeAllAbbreviations("!"); }, { short_help: "Remove all abbreviations" } )); addDefaultCommand(new vimperator.Command(["cab[clear]"], - function(args) { vimperator.editor.removeAllAbbreviations("c"); }, + function (args) { vimperator.editor.removeAllAbbreviations("c"); }, { short_help: "Remove all abbreviations for Command-line mode" } )); addDefaultCommand(new vimperator.Command(["iab[clear]"], - function(args) { vimperator.editor.removeAllAbbreviations("i"); }, + function (args) { vimperator.editor.removeAllAbbreviations("i"); }, { short_help: "Remove all abbreviations for Insert mode" } )); // 0 args -> list all maps @@ -1228,7 +1228,7 @@ vimperator.Commands = function() //{{{ if (rhs) { vimperator.mappings.add(new vimperator.Map([vimperator.modes.NORMAL], [lhs], - function(count) { vimperator.events.feedkeys((count > 1 ? count : "") + rhs, noremap); }, + function (count) { vimperator.events.feedkeys((count > 1 ? count : "") + rhs, noremap); }, { flags: vimperator.Mappings.flags.COUNT, rhs: rhs } )); } @@ -1239,7 +1239,7 @@ vimperator.Commands = function() //{{{ } } addDefaultCommand(new vimperator.Command(["map"], - function(args) { map(args, false) }, + function (args) { map(args, false) }, { usage: ["map {lhs} {rhs}", "map {lhs}", "map"], short_help: "Map the key sequence {lhs} to {rhs}", @@ -1248,7 +1248,7 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["mapc[lear]"], - function(args) + function (args) { if (args) { @@ -1265,7 +1265,7 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["ma[rk]"], - function(args) + function (args) { if (!args) { @@ -1291,7 +1291,7 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["marks"], - function(args) + function (args) { // ignore invalid mark characters unless there are no valid mark chars if (args && !/[a-zA-Z]/.test(args)) @@ -1310,7 +1310,7 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["mkv[imperatorrc]"], - function(args, special) + function (args, special) { // TODO: "E172: Only one file name allowed" var filename; @@ -1369,7 +1369,7 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["noh[lsearch]"], - function(args) + function (args) { vimperator.search.clear(); }, @@ -1380,7 +1380,7 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["norm[al]"], - function(args) + function (args) { if (!args) { @@ -1398,7 +1398,7 @@ vimperator.Commands = function() //{{{ )); // TODO: remove duplication in :map addDefaultCommand(new vimperator.Command(["no[remap]"], - function(args) { map(args, true) }, + function (args) { map(args, true) }, { usage: ["no[remap] {lhs} {rhs}", "no[remap] {lhs}", "no[remap]"], short_help: "Map the key sequence {lhs} to {rhs}", @@ -1406,7 +1406,7 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["o[pen]", "e[dit]"], - function(args, special) + function (args, special) { if (args) { @@ -1445,7 +1445,7 @@ vimperator.Commands = function() //{{{ "The items which are completed on <Tab> are specified in the 'complete' option.
    " + "Without argument, reloads the current page.
    " + "Without argument but with !, reloads the current page skipping the cache.", - completer: function(filter) { return vimperator.completion.get_url_completions(filter); } + completer: function (filter) { return vimperator.completion.get_url_completions(filter); } } )); addDefaultCommand(new vimperator.Command(["pa[geinfo]"], @@ -1456,13 +1456,13 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["pc[lose]"], - function() { vimperator.previewwindow.hide(); }, + function () { vimperator.previewwindow.hide(); }, { short_help: "Close preview window on bottom of screen" } )); addDefaultCommand(new vimperator.Command(["pref[erences]", "prefs"], - function(args, special, count, modifiers) + function (args, special, count, modifiers) { if (!args) { @@ -1494,7 +1494,7 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["qma[rk]"], - function(args) + function (args) { if (!args) { @@ -1518,7 +1518,7 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["qmarks"], - function(args) + function (args) { // ignore invalid mark characters unless there are no valid mark chars if (args && !/[a-zA-Z0-9]/.test(args)) @@ -1537,7 +1537,7 @@ vimperator.Commands = function() //{{{ } )); 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", help: "If this is the last tab in the window, close the window. If this was the " + @@ -1545,14 +1545,14 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["quita[ll]", "qa[ll]"], - function() { vimperator.quit(false); }, + 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 vimperator.Command(["redr[aw]"], - function() + function () { var wu = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor). getInterface(Components.interfaces.nsIDOMWindowUtils); @@ -1564,7 +1564,7 @@ vimperator.Commands = function() //{{{ } )); 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][!]"], short_help: "Reload current page", @@ -1572,7 +1572,7 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["reloada[ll]"], - function(args, special) { vimperator.tabs.reloadAll(special); }, + function (args, special) { vimperator.tabs.reloadAll(special); }, { usage: ["reloada[ll][!]"], short_help: "Reload all pages", @@ -1580,14 +1580,14 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["res[tart]"], - function() { vimperator.restart(); }, + function () { vimperator.restart(); }, { short_help: "Force the browser to restart", help: "Useful when installing extensions." } )); 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", help: "Opens the original Firefox \"Save page as...\" dialog.
    " + @@ -1596,7 +1596,7 @@ vimperator.Commands = function() //{{{ )); addDefaultCommand(new vimperator.Command(["se[t]"], // TODO: support setting multiple options at once - function(args, special, count, modifiers) + function (args, special, count, modifiers) { if (special) { @@ -1805,12 +1805,12 @@ vimperator.Commands = function() //{{{ ":set option+={value}, :set option^={value} and :set option-={value} " + "adds/multiplies/subtracts {value} from a number option and appends/prepends/removes {value} from a string option.
    " + ":set all shows the current value of all options and :set all& resets all options to their default values.
    ", - completer: function(filter) { return vimperator.completion.get_options_completions(filter); } + completer: function (filter) { return vimperator.completion.get_options_completions(filter); } } )); // TODO: sclose instead? addDefaultCommand(new vimperator.Command(["sbcl[ose]"], - function(args) + function (args) { if (args) { @@ -1828,7 +1828,7 @@ vimperator.Commands = function() //{{{ // TODO: sopen instead? Separate :sidebar from :sbopen and make them behave // more like :cw, :cope etc addDefaultCommand(new vimperator.Command(["sideb[ar]", "sb[ar]", "sbope[n]"], - function(args) + function (args) { if (!args) { @@ -1859,11 +1859,11 @@ vimperator.Commands = function() //{{{ short_help: "Open the sidebar window", help: "{name} is any of the menu items listed under the standard Firefox View->Sidebar " + "menu. Add-ons, Preferences and Downloads are also available in the sidebar.", - completer: function(filter) { return vimperator.completion.get_sidebar_completions(filter); } + completer: function (filter) { return vimperator.completion.get_sidebar_completions(filter); } } )); addDefaultCommand(new vimperator.Command(["so[urce]"], - function(args, special) + function (args, special) { // FIXME: implement proper filename quoting //if (/[^\\]\s/.test(args)) @@ -1879,14 +1879,14 @@ vimperator.Commands = function() //{{{ short_help: "Read Ex commands from {file}", help: "You can either source files which mostly contain Ex commands like map < gt " + "and put JavaScript code within a:
    " + - "js <<EOF
    hello = function() {
      alert(\"Hello world\");
    }
    EOF
    section.
    " + + "js <<EOF
    hello = function () {
      alert(\"Hello world\");
    }
    EOF
    section.
    " + "Or you can alternatively source a file which ends in .js, these files are automatically sourced as pure JavaScript files.
    " + "NOTE: In both cases you must add functions to the global window object like shown above, functions written as:
    " + "function hello2() {
      alert(\"Hello world\");
    }
    are only available within the scope of the script.

    " + "The .vimperatorrc file in your home directory and any files in ~/.vimperator/plugin/ are always sourced at startup.
    " + "~ is supported as a shortcut for the $HOME directory.
    " + "If ! is specified, errors are not printed.", - completer: function(filter) { return vimperator.completion.get_file_completions(filter); } + completer: function (filter) { return vimperator.completion.get_file_completions(filter); } } )); addDefaultCommand(new vimperator.Command(["st[op]"], @@ -1897,24 +1897,24 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["tab"], - function(args) { vimperator.execute(args, { inTab: true }); }, + function (args) { vimperator.execute(args, { inTab: true }); }, { usage: ["tab {cmd}"], short_help: "Execute {cmd} and tell it to output in a new tab", help: "Works only for commands that support it, currently:" + "", - completer: function(filter) { return vimperator.completion.get_command_completions(filter); } + completer: function (filter) { return vimperator.completion.get_command_completions(filter); } } )); addDefaultCommand(new vimperator.Command(["tabl[ast]"], - function() { vimperator.tabs.select("$", false); }, + function () { vimperator.tabs.select("$", false); }, { short_help: "Switch to the last tab" } )); 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"], short_help: "Move the current tab after tab N", @@ -1924,7 +1924,7 @@ vimperator.Commands = function() //{{{ )); addDefaultCommand(new vimperator.Command(["tabn[ext]", "tn[ext]"], // TODO: count support - function(args) + function (args) { if (!args) { @@ -1950,13 +1950,13 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["tabo[nly]"], - function() { vimperator.tabs.keepOnly(getBrowser().mCurrentTab); }, + function () { vimperator.tabs.keepOnly(getBrowser().mCurrentTab); }, { short_help: "Close all other tabs" } )); 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; if (/\btabopen\b/.test(vimperator.options["activate"])) @@ -1972,12 +1972,12 @@ vimperator.Commands = function() //{{{ short_help: "Open one or more URLs in a new tab", help: "Like :open but open URLs in a new tab.
    " + "If used with !, the 'tabopen' value of the 'activate' option is negated.", - completer: function(filter) { return vimperator.completion.get_url_completions(filter); } + completer: function (filter) { return vimperator.completion.get_url_completions(filter); } } )); addDefaultCommand(new vimperator.Command(["tabp[revious]", "tp[revious]", "tabN[ext]", "tN[ext]"], // TODO: count support - function(args) + function (args) { if (!args) vimperator.tabs.select("-1", true); @@ -1993,14 +1993,14 @@ vimperator.Commands = function() //{{{ } )); 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]"], short_help: "Switch to the first tab" } )); addDefaultCommand(new vimperator.Command(["time"], - function(args, special, count) + function (args, special, count) { try { @@ -2091,7 +2091,7 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["u[ndo]"], - function(args, special, count) + function (args, special, count) { if (count < 1) count = 1; @@ -2116,7 +2116,7 @@ vimperator.Commands = function() //{{{ short_help: "Undo closing of a tab", help: "If a count is given, don't close the last but the [count]th last tab. " + "With [url] restores the tab matching the url.", - completer: function(filter) + completer: function (filter) { // get closed-tabs from nsSessionStore var ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore); @@ -2135,7 +2135,7 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["undoa[ll]"], - function(args, special, count) + function (args, special, count) { if (count > -1) { @@ -2159,7 +2159,7 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["unl[et]"], - function(args, special) + function (args, special) { if (!args) return vimperator.echoerr("E471: Argument required"); @@ -2188,7 +2188,7 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["unm[ap]"], - function(args) + function (args) { if (!args) { @@ -2210,7 +2210,7 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["ve[rsion]"], - function(args, special) + function (args, special) { if (special) vimperator.open("about:"); @@ -2225,13 +2225,13 @@ vimperator.Commands = function() //{{{ } )); 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" } )); addDefaultCommand(new vimperator.Command(["winc[lose]", "wc[lose]"], - function(args) + function (args) { window.close(); }, @@ -2241,7 +2241,7 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["wino[pen]", "wo[pen]", "wine[dit]"], - function(args) + function (args) { if (args) vimperator.open(args, vimperator.NEW_WINDOW); @@ -2255,7 +2255,7 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["wqa[ll]", "wq", "xa[ll]"], - function() { vimperator.quit(true); }, + function () { vimperator.quit(true); }, { usage: ["wqa[ll]", "xa[ll]"], short_help: "Save the session and quit", @@ -2264,7 +2264,7 @@ vimperator.Commands = function() //{{{ } )); addDefaultCommand(new vimperator.Command(["zo[om]"], - function(args, special) + function (args, special) { var level; @@ -2309,7 +2309,7 @@ vimperator.Commands = function() //{{{ } )); 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 if (special) diff --git a/content/completion.js b/content/completion.js index e6a037bf..8eeeca25 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 = []; @@ -63,7 +63,7 @@ vimperator.Completion = function() // {{{ } else { - g_substrings = g_substrings.filter(function($_) { + g_substrings = g_substrings.filter(function ($_) { return list[i][0][j].indexOf($_) >= 0; }); } @@ -93,7 +93,7 @@ vimperator.Completion = function() // {{{ } else { - g_substrings = g_substrings.filter(function($_) { + g_substrings = g_substrings.filter(function ($_) { return list[i][0][j].indexOf($_) == 0; }); } @@ -109,7 +109,7 @@ vimperator.Completion = function() // {{{ * returns the longest common substring * used for the 'longest' setting for wildmode */ - get_longest_substring: function() //{{{ + get_longest_substring: function () //{{{ { if (g_substrings.length == 0) return ""; @@ -130,7 +130,7 @@ vimperator.Completion = function() // {{{ * depending on the 'complete' option * if the 'complete' argument is passed like "h", it temporarily overrides the complete option */ - get_url_completions: function(filter, complete) //{{{ + get_url_completions: function (filter, complete) //{{{ { var completions = []; g_substrings = []; @@ -152,21 +152,21 @@ vimperator.Completion = function() // {{{ return completions; }, //}}} - get_search_completions: function(filter) //{{{ + get_search_completions: function (filter) //{{{ { var engines = vimperator.bookmarks.getSearchEngines().concat(vimperator.bookmarks.getKeywords()); - if (!filter) return engines.map(function(engine) { + if (!filter) return engines.map(function (engine) { return [engine[0], engine[1]]; }); - var mapped = engines.map(function(engine) { + var mapped = engines.map(function (engine) { return [[engine[0]], engine[1]]; }); return build_longest_common_substring(mapped, filter); }, //}}} // TODO: support file:// and \ or / path separators on both platforms - get_file_completions: function(filter) + get_file_completions: function (filter) { // this is now also used as part of the url completion, so the // substrings shouldn't be cleared for that case @@ -185,7 +185,7 @@ vimperator.Completion = function() // {{{ try { files = vimperator.io.readDirectory(dir); - mapped = files.map(function(file) { + mapped = files.map(function (file) { return [[file.path], file.isDirectory() ? "Directory" : "File"]; }); } @@ -198,7 +198,7 @@ vimperator.Completion = function() // {{{ return build_longest_starting_substring(mapped, filter); }, - get_help_completions: function(filter) //{{{ + get_help_completions: function (filter) //{{{ { var help_array = [[["introduction"], "Introductory text"], [["initialization"], "Initialization and startup"], @@ -207,25 +207,25 @@ vimperator.Completion = function() // {{{ [["options"], "Configuration options"]]; // TODO: hardcoded until we have proper 'pages' g_substrings = []; for (var command in vimperator.commands) - help_array.push([command.long_names.map(function($_) { return ":" + $_; }), command.short_help]); + help_array.push([command.long_names.map(function ($_) { return ":" + $_; }), command.short_help]); options = this.get_options_completions(filter, true); - help_array = help_array.concat(options.map(function($_) { + help_array = help_array.concat(options.map(function ($_) { return [ - $_[0].map(function($_) { return "'" + $_ + "'"; }), + $_[0].map(function ($_) { return "'" + $_ + "'"; }), $_[1] ]; })); for (var map in vimperator.mappings) help_array.push([map.names, map.short_help]); - if (!filter) return help_array.map(function($_) { + if (!filter) return help_array.map(function ($_) { return [$_[0][0], $_[1]]; // unfiltered, use the first command }); return build_longest_common_substring(help_array, filter); }, //}}} - get_command_completions: function(filter) //{{{ + get_command_completions: function (filter) //{{{ { g_substrings = []; var completions = []; @@ -241,7 +241,7 @@ vimperator.Completion = function() // {{{ return build_longest_starting_substring(completions, filter); }, //}}} - get_options_completions: function(filter, unfiltered) //{{{ + get_options_completions: function (filter, unfiltered) //{{{ { g_substrings = []; var options_completions = []; @@ -308,7 +308,7 @@ vimperator.Completion = function() // {{{ } else { - g_substrings = g_substrings.filter(function($_) { + g_substrings = g_substrings.filter(function ($_) { return option.names[j].indexOf($_) == 0; }); } @@ -320,7 +320,7 @@ vimperator.Completion = function() // {{{ return options_completions; }, //}}} - get_buffer_completions: function(filter) //{{{ + get_buffer_completions: function (filter) //{{{ { g_substrings = []; var items = []; @@ -350,13 +350,13 @@ vimperator.Completion = function() // {{{ items.push([[(i + 1) + ": " + title, (i + 1) + ": " + url], url]); } } - if (!filter) return items.map(function($_) { + if (!filter) return items.map(function ($_) { return [$_[0][0], $_[1]]; }); return build_longest_common_substring(items, filter); }, //}}} - get_sidebar_completions: function(filter) //{{{ + get_sidebar_completions: function (filter) //{{{ { g_substrings = []; var menu = document.getElementById("viewSidebarMenu") @@ -368,20 +368,20 @@ vimperator.Completion = function() // {{{ if (!filter) return nodes; - var mapped = nodes.map(function(node) { + var mapped = nodes.map(function (node) { return [[node[0]], node[1]]; }); - + return build_longest_common_substring(mapped, filter); }, //}}} - javascript: function(str) // {{{ + javascript: function (str) // {{{ { g_substrings = []; var matches = str.match(/^(.*?)(\s*\.\s*)?(\w*)$/); var object = "window"; var filter = matches[3] || ""; - var start = matches[1].length-1; + var start = matches[1].length - 1; if (matches[2]) { var brackets = 0, parentheses = 0; @@ -413,7 +413,7 @@ vimperator.Completion = function() // {{{ } object = matches[1].substr(start+1) || "window"; - var completions = []; + var completions = []; try { completions = eval( @@ -449,7 +449,7 @@ vimperator.Completion = function() // {{{ // discard all entries in the 'urls' array, which don't match 'filter // urls must be of type [["url", "title"], [...]] or optionally // [["url", "title", keyword, [tags]], [...]] - filterURLArray: function(urls, filter, tags) //{{{ + filterURLArray: function (urls, filter, tags) //{{{ { var filtered = []; // completions which don't match the url but just the description @@ -474,7 +474,7 @@ vimperator.Completion = function() // {{{ if (ignorecase) { filter = filter.toLowerCase(); - tags = tags.map(function(t) { return t.toLowerCase(); }); + tags = tags.map(function (t) { return t.toLowerCase(); }); } /* @@ -493,7 +493,7 @@ vimperator.Completion = function() // {{{ { url = url.toLowerCase(); title = title.toLowerCase(); - tag = tag.map(function(t) { return t.toLowerCase(); }); + tag = tag.map(function (t) { return t.toLowerCase(); }); } // filter on tags @@ -510,7 +510,7 @@ vimperator.Completion = function() // {{{ { // no direct match of filter in the url, but still accept this item // if _all_ tokens of filter match either the url or the title - if (filter.split(/\s+/).every(function(token) { + if (filter.split(/\s+/).every(function (token) { return (url.indexOf(token) > -1 || title.indexOf(token) > -1); })) additional_completions.push(urls[i]); @@ -534,7 +534,7 @@ vimperator.Completion = function() // {{{ } else { - g_substrings = g_substrings.filter(function($_) { + g_substrings = g_substrings.filter(function ($_) { return url.indexOf($_) >= 0; }); } @@ -547,7 +547,7 @@ vimperator.Completion = function() // {{{ // generic helper function which checks if the given "items" array pass "filter" // items must be an array of strings - match: function(items, filter, case_sensitive) + match: function (items, filter, case_sensitive) { if (typeof(filter) != "string" || !items) return false; @@ -559,13 +559,13 @@ vimperator.Completion = function() // {{{ items_str = items_str.toLowerCase(); } - if (filter.split(/\s+/).every(function(str) { return items_str.indexOf(str) > -1; })) + if (filter.split(/\s+/).every(function (str) { return items_str.indexOf(str) > -1; })) return true; return false; }, - exTabCompletion: function(str) //{{{ + exTabCompletion: function (str) //{{{ { var [count, cmd, special, args] = vimperator.commands.parseCommand(str); var completions = []; diff --git a/content/editor.js b/content/editor.js index 3f6aa338..0008e506 100644 --- a/content/editor.js +++ b/content/editor.js @@ -29,7 +29,7 @@ the terms of any one of the MPL, the GPL or the LGPL. // command names taken from: // http://developer.mozilla.org/en/docs/Editor_Embedding_Guide -vimperator.Editor = function() //{{{ +vimperator.Editor = function () //{{{ { // store our last search with f, F, t or T var last_findChar = null; @@ -50,7 +50,7 @@ vimperator.Editor = function() //{{{ return ed.controllers.getControllerForCommand("cmd_beginLine"); } - this.line = function() + this.line = function () { var line = 1; var text = editor().value; @@ -60,7 +60,7 @@ vimperator.Editor = function() //{{{ return line; } - this.col = function() + this.col = function () { var col = 1; var text = editor().value; @@ -73,20 +73,20 @@ vimperator.Editor = function() //{{{ return col; } - this.unselectText = function() + this.unselectText = function () { var elt = window.document.commandDispatcher.focusedElement; if (elt && elt.selectionEnd) elt.selectionEnd = elt.selectionStart; } - this.selectedText = function() + this.selectedText = function () { var text = editor().value; return text.substring(editor().selectionStart, editor().selectionEnd); } - this.pasteClipboard = function() + this.pasteClipboard = function () { var elt = window.document.commandDispatcher.focusedElement; @@ -106,7 +106,7 @@ vimperator.Editor = function() //{{{ } // count is optional, defaults to 1 - this.executeCommand = function(cmd, count) + this.executeCommand = function (cmd, count) { var controller = getController(); if (!controller || !controller.supportsCommand(cmd) || !controller.isCommandEnabled(cmd)) @@ -142,7 +142,7 @@ vimperator.Editor = function() //{{{ // cmd = y, d, c // motion = b, 0, gg, G, etc. - this.executeCommandWithMotion = function(cmd, motion, count) + this.executeCommandWithMotion = function (cmd, motion, count) { if (!typeof count == "number" || count < 1) count = 1; @@ -229,7 +229,7 @@ vimperator.Editor = function() //{{{ // Simple setSelectionRange() would be better, but we want to maintain the correct // order of selectionStart/End (a firefox bug always makes selectionStart <= selectionEnd) // Use only for small movements! - this.moveToPosition = function(pos, forward, select) + this.moveToPosition = function (pos, forward, select) { if (!select) { @@ -262,7 +262,7 @@ vimperator.Editor = function() //{{{ } // returns the position of char - this.findCharForward = function(char, count) + this.findCharForward = function (char, count) { if (!editor()) return -1; @@ -288,7 +288,7 @@ vimperator.Editor = function() //{{{ return -1; } // returns the position of char - this.findCharBackward = function(char, count) + this.findCharBackward = function (char, count) { if (!editor()) return -1; @@ -314,7 +314,7 @@ vimperator.Editor = function() //{{{ return -1; } - this.editWithExternalEditor = function() + this.editWithExternalEditor = function () { var textBox = document.commandDispatcher.focusedElement; var editor = vimperator.options["editor"]; @@ -380,11 +380,11 @@ vimperator.Editor = function() //{{{ // blink the textbox after returning var timeout = 100; textBox.style.backgroundColor = tmpBg; - setTimeout( function() { + setTimeout( function () { textBox.style.backgroundColor = oldBg; - setTimeout( function() { + setTimeout( function () { textBox.style.backgroundColor = tmpBg; - setTimeout( function() { + setTimeout( function () { textBox.style.backgroundColor = oldBg; }, timeout); }, timeout); @@ -397,9 +397,9 @@ vimperator.Editor = function() //{{{ this.abbreviations = {}; this.abbreviations.__iterator__ = function () - { + { var tmpCmd; - for (var lhs in abbrev) + for (var lhs in abbrev) { for (var i = 0; i < abbrev[lhs].length; i++) { @@ -410,7 +410,7 @@ vimperator.Editor = function() //{{{ } // filter is i, c or "!" (insert or command abbreviations or both) - this.listAbbreviations = function(filter, lhs) + this.listAbbreviations = function (filter, lhs) { if (lhs) // list only that one { @@ -425,7 +425,7 @@ vimperator.Editor = function() //{{{ } vimperator.echoerr("No abbreviations found"); return false; - } + } else // list all (for that filter {i,c,!}) { var flagFound = false; @@ -459,7 +459,7 @@ vimperator.Editor = function() //{{{ } } - this.addAbbreviation = function(filter, lhs, rhs) + this.addAbbreviation = function (filter, lhs, rhs) { if (!abbrev[lhs]) { @@ -523,8 +523,8 @@ vimperator.Editor = function() //{{{ // if filter == ! remove all and add it as only END // // variant 1: rhs matches anywere in loop - // - // 1 mod matches anywhere in loop + // + // 1 mod matches anywhere in loop // a) simple replace and // I) (maybe there's another rhs that matches? not possible) // (when there's another item, it's opposite mod with different rhs) @@ -533,7 +533,7 @@ vimperator.Editor = function() //{{{ // 2 mod does not match // a) the opposite is there -> make a ! and put it as only and END // (b) a ! is there. do nothing END) - // + // // variant 2: rhs matches *no*were in loop and filter is c or i // everykind of current combo is possible to 1 {c,i,!} or two {c and i} // @@ -543,7 +543,7 @@ vimperator.Editor = function() //{{{ // } - this.removeAbbreviation = function(filter, lhs) + this.removeAbbreviation = function (filter, lhs) { if (!lhs) { @@ -568,7 +568,7 @@ vimperator.Editor = function() //{{{ return true; } else if (abbrev[lhs][0][0] == filter) - { + { abbrev[lhs] = ""; return true; } @@ -578,7 +578,7 @@ vimperator.Editor = function() //{{{ if (abbrev[lhs][0][0] == "c" && filter == "c") abbrev[lhs][0] = abbrev[lhs][1]; - abbrev[lhs][1] = ""; + abbrev[lhs][1] = ""; return true; } @@ -589,7 +589,7 @@ vimperator.Editor = function() //{{{ return false; } - this.removeAllAbbreviations = function(filter) + this.removeAllAbbreviations = function (filter) { if (filter == "!") { @@ -608,7 +608,7 @@ vimperator.Editor = function() //{{{ } } - this.expandAbbreviation = function(filter) // try to find an candidate and replace accordingly + this.expandAbbreviation = function (filter) // try to find an candidate and replace accordingly { var textbox = editor(); var text = textbox.value; @@ -617,7 +617,7 @@ vimperator.Editor = function() //{{{ var foundWord = text.substring(0, currStart).replace(/^(.|\n)*?(\S+)$/m, "$2"); // get last word \b word boundary if (!foundWord) return true; - + for (var lhs in abbrev) { for (var i = 0; i < abbrev[lhs].length; i++) diff --git a/content/events.js b/content/events.js index bf3cde7c..7da34154 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 *****/ -vimperator.Events = function() //{{{ +vimperator.Events = function () //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// @@ -35,23 +35,23 @@ vimperator.Events = function() //{{{ // this handler is for middle click only in the content //window.addEventListener("mousedown", onVimperatorKeypress, true); //content.mPanelContainer.addEventListener("mousedown", onVimperatorKeypress, true); - //document.getElementById("content").onclick = function(event) { alert("foo"); }; + //document.getElementById("content").onclick = function (event) { alert("foo"); }; // any tab related events var tabcontainer = getBrowser().tabContainer; - tabcontainer.addEventListener("TabMove", function(event) { + tabcontainer.addEventListener("TabMove", function (event) { vimperator.statusline.updateTabCount(); vimperator.buffer.updateBufferList(); }, false); - tabcontainer.addEventListener("TabOpen", function(event) { + tabcontainer.addEventListener("TabOpen", function (event) { vimperator.statusline.updateTabCount(); vimperator.buffer.updateBufferList(); }, false); - tabcontainer.addEventListener("TabClose", function(event) { + tabcontainer.addEventListener("TabClose", function (event) { vimperator.statusline.updateTabCount(); vimperator.buffer.updateBufferList(); }, false); - tabcontainer.addEventListener("TabSelect", function(event) { + tabcontainer.addEventListener("TabSelect", function (event) { if (vimperator.mode == vimperator.modes.HINTS) vimperator.modes.reset(); @@ -61,7 +61,7 @@ vimperator.Events = function() //{{{ vimperator.buffer.updateBufferList(); vimperator.tabs.updateSelectionHistory(); - setTimeout(function() { vimperator.focusContent(true); }, 10); // just make sure, that no widget has focus + setTimeout(function () { vimperator.focusContent(true); }, 10); // just make sure, that no widget has focus }, false); // this adds an event which is is called on each page load, even if the @@ -107,7 +107,7 @@ vimperator.Events = function() //{{{ window.addEventListener("DOMMenuBarActive", enterMenuMode, true); window.addEventListener("DOMMenuBarInactive", exitMenuMode, true); - // window.document.addEventListener("DOMTitleChanged", function(event) + // window.document.addEventListener("DOMTitleChanged", function (event) // { // vimperator.log("titlechanged"); // }, null); @@ -231,7 +231,7 @@ vimperator.Events = function() //{{{ // // FIXME: this currently causes window map events which is _very_ annoying // // we want to stay in command mode after a page has loaded // //setTimeout(vimperator.focusContent, 10); - // // setTimeout(function() { + // // setTimeout(function () { // // if (doc.commandDispatcher.focusedElement) // // doc.commandDispatcher.focusedElement.blur(); // // alert(doc.commandDispatcher.focusedElement); @@ -246,7 +246,7 @@ vimperator.Events = function() //{{{ /////////////////////////////////////////////////////////////////////////////{{{ this.wantsModeReset = true; // used in onFocusChange since Firefox is so buggy here - this.destroy = function() + this.destroy = function () { // removeEventListeners() to avoid mem leaks window.dump("TODO: remove all eventlisteners\n"); @@ -268,7 +268,7 @@ vimperator.Events = function() //{{{ // // @param keys: a string like "2" to pass // if you want < to be taken literally, prepend it with a \\ - this.feedkeys = function(keys, noremap) + this.feedkeys = function (keys, noremap) { var doc = window.document; var view = window.document.defaultView; @@ -332,7 +332,7 @@ vimperator.Events = function() //{{{ // a keycode which can be used in mappings // e.g. pressing ctrl+n would result in the string "" // null if unknown key - this.toString = function(event) //{{{ + this.toString = function (event) //{{{ { if (!event) return; @@ -408,11 +408,11 @@ vimperator.Events = function() //{{{ } //}}} - this.isAcceptKey = function(key) + this.isAcceptKey = function (key) { return (key == "" || key == "" || key == ""); } - this.isCancelKey = function(key) + this.isCancelKey = function (key) { return (key == "" || key == "" || key == ""); } @@ -422,7 +422,7 @@ vimperator.Events = function() //{{{ // // the ugly wantsModeReset is needed, because firefox generates a massive // amount of focus changes for things like (focusing the search field) - this.onFocusChange = function(event) + this.onFocusChange = function (event) { // command line has it's own focus change handler if (vimperator.mode == vimperator.modes.COMMAND_LINE) @@ -455,14 +455,14 @@ vimperator.Events = function() //{{{ vimperator.mode == vimperator.modes.VISUAL) { this.wantsModeReset = true; - setTimeout(function() { + setTimeout(function () { if (vimperator.events.wantsModeReset) vimperator.modes.reset(); }, 10); } } - this.onSelectionChange = function(event) + this.onSelectionChange = function (event) { var could_copy = false; var controller = document.commandDispatcher.getControllerForCommand("cmd_copy"); @@ -488,7 +488,7 @@ vimperator.Events = function() //{{{ } // global escape handler, is called in ALL modes - this.onEscape = function() + this.onEscape = function () { if (!vimperator.modes.passNextKey) { @@ -549,7 +549,7 @@ vimperator.Events = function() //{{{ // this keypress handler gets always called first, even if e.g. // the commandline has focus - this.onKeyPress = function(event) + this.onKeyPress = function (event) { var key = vimperator.events.toString(event); if (!key) @@ -732,7 +732,7 @@ vimperator.Events = function() //{{{ window.addEventListener("keypress", this.onKeyPress, true); // this is need for sites like msn.com which focus the input field on keydown - this.onKeyUpOrDown = function(event) + this.onKeyUpOrDown = function (event) { if (vimperator.modes.passNextKey ^ vimperator.modes.passAllKeys || isFormElemFocused()) return true; @@ -745,7 +745,7 @@ vimperator.Events = function() //{{{ this.progressListener = { - QueryInterface: function(aIID) + QueryInterface: function (aIID) { if (aIID.equals(Components.interfaces.nsIWebProgressListener) || aIID.equals(Components.interfaces.nsIXULBrowserWindow) || // for setOverLink(); @@ -756,7 +756,7 @@ vimperator.Events = function() //{{{ }, // XXX: function may later be needed to detect a canceled synchronous openURL() - onStateChange: function(webProgress, aRequest, flags, aStatus) + onStateChange: function (webProgress, aRequest, flags, aStatus) { // STATE_IS_DOCUMENT | STATE_IS_WINDOW is important, because we also // receive statechange events for loading images and other parts of the web page @@ -783,29 +783,29 @@ vimperator.Events = function() //{{{ else if (aState & nsIWebProgressListener.STATE_IS_SECURE) vimperator.statusline.setClass("secure"); }, - onStatusChange: function(webProgress, request, status, message) + onStatusChange: function (webProgress, request, status, message) { vimperator.statusline.updateUrl(message); }, - onProgressChange: function(webProgress, request, curSelfProgress, maxSelfProgress, curTotalProgress, maxTotalProgress) + onProgressChange: function (webProgress, request, curSelfProgress, maxSelfProgress, curTotalProgress, maxTotalProgress) { vimperator.statusline.updateProgress(curTotalProgress/maxTotalProgress); }, // happens when the users switches tabs - onLocationChange: function() + onLocationChange: function () { vimperator.statusline.updateUrl(); vimperator.statusline.updateProgress(); // if this is not delayed we get the position of the old buffer - setTimeout(function() { vimperator.statusline.updateBufferPosition(); }, 100); + setTimeout(function () { vimperator.statusline.updateBufferPosition(); }, 100); }, // called at the very end of a page load - asyncUpdateUI: function() + asyncUpdateUI: function () { setTimeout(vimperator.statusline.updateUrl, 100); }, - setOverLink : function(link, b) + setOverLink : function (link, b) { var ssli = vimperator.options["showstatuslinks"]; if (link && ssli) @@ -826,10 +826,10 @@ vimperator.Events = function() //{{{ }, // stub functions for the interfaces - setJSStatus: function(status) { ; }, - setJSDefaultStatus: function(status) { ; }, - setDefaultStatus: function(status) { ; }, - onLinkIconAvailable: function() { ; } + setJSStatus: function (status) { ; }, + setJSDefaultStatus: function (status) { ; }, + setDefaultStatus: function (status) { ; }, + onLinkIconAvailable: function () { ; } }; window.XULBrowserWindow = this.progressListener; @@ -844,7 +844,7 @@ vimperator.Events = function() //{{{ this.prefObserver = { - register: function() + register: function () { var prefService = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefService); @@ -853,13 +853,13 @@ vimperator.Events = function() //{{{ this._branch.addObserver("", this, false); }, - unregister: function() + unregister: function () { if (!this._branch) return; this._branch.removeObserver("", this); }, - observe: function(aSubject, aTopic, aData) + observe: function (aSubject, aTopic, aData) { if (aTopic != "nsPref:changed") return; // aSubject is the nsIPrefBranch we're observing (after appropriate QI) diff --git a/content/find.js b/content/find.js index 115c598e..39a9a302 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 -vimperator.Search = function() //{{{ +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 @@ -51,13 +51,13 @@ vimperator.Search = function() //{{{ var links_only = false; // search is limited to link text only // Event handlers for search - closure is needed - vimperator.registerCallback("change", vimperator.modes.SEARCH_FORWARD, function(command) { self.searchKeyPressed(command); }); - vimperator.registerCallback("submit", vimperator.modes.SEARCH_FORWARD, function(command) { self.searchSubmitted(command); }); - vimperator.registerCallback("cancel", vimperator.modes.SEARCH_FORWARD, function() { self.searchCanceled(); }); + vimperator.registerCallback("change", vimperator.modes.SEARCH_FORWARD, function (command) { self.searchKeyPressed(command); }); + vimperator.registerCallback("submit", vimperator.modes.SEARCH_FORWARD, function (command) { self.searchSubmitted(command); }); + vimperator.registerCallback("cancel", vimperator.modes.SEARCH_FORWARD, function () { self.searchCanceled(); }); // TODO: allow advanced modes in register/triggerCallback - vimperator.registerCallback("change", vimperator.modes.SEARCH_BACKWARD, function(command) { self.searchKeyPressed(command); }); - vimperator.registerCallback("submit", vimperator.modes.SEARCH_BACKWARD, function(command) { self.searchSubmitted(command); }); - vimperator.registerCallback("cancel", vimperator.modes.SEARCH_BACKWARD, function() { self.searchCanceled(); }); + vimperator.registerCallback("change", vimperator.modes.SEARCH_BACKWARD, function (command) { self.searchKeyPressed(command); }); + vimperator.registerCallback("submit", vimperator.modes.SEARCH_BACKWARD, function (command) { self.searchSubmitted(command); }); + vimperator.registerCallback("cancel", vimperator.modes.SEARCH_BACKWARD, function () { self.searchCanceled(); }); // set search_string, search_pattern, case_sensitive, links_only function processUserPattern(pattern) @@ -81,7 +81,7 @@ vimperator.Search = function() //{{{ links_only = false; // strip links-only modifiers - pattern = pattern.replace(/(\\)?\\[uU]/g, function($0, $1) { return $1 ? $0 : ""; }); + pattern = pattern.replace(/(\\)?\\[uU]/g, function ($0, $1) { return $1 ? $0 : ""; }); // case sensitivity - \c wins if both modifiers specified if (/\c/.test(pattern)) @@ -96,7 +96,7 @@ vimperator.Search = function() //{{{ case_sensitive = true; // strip case-sensitive modifiers - pattern = pattern.replace(/(\\)?\\[cC]/g, function($0, $1) { return $1 ? $0 : ""; }); + pattern = pattern.replace(/(\\)?\\[cC]/g, function ($0, $1) { return $1 ? $0 : ""; }); // remove any modifer escape \ pattern = pattern.replace(/\\(\\[cCuU])/g, "$1"); @@ -106,7 +106,7 @@ vimperator.Search = function() //{{{ // Called when the search dialog is asked for // If you omit "mode", it will default to forward searching - this.openSearchDialog = function(mode) + this.openSearchDialog = function (mode) { if (mode == vimperator.modes.SEARCH_BACKWARD) { @@ -124,7 +124,7 @@ vimperator.Search = function() //{{{ // Finds text in a page // TODO: backwards seems impossible i fear :( - this.find = function(str, backwards) + this.find = function (str, backwards) { var fastFind = getBrowser().fastFind; @@ -140,7 +140,7 @@ vimperator.Search = function() //{{{ } // Called when the current search needs to be repeated - this.findAgain = function(reverse) + this.findAgain = function (reverse) { // this hack is needed to make n/N work with the correct string, if // we typed /foo after the original search. Since searchString is @@ -159,7 +159,7 @@ vimperator.Search = function() //{{{ { // hack needed, because wrapping causes a "scroll" event which clears // our command line - setTimeout(function() { + setTimeout(function () { if (up) vimperator.commandline.echo("search hit TOP, continuing at BOTTOM", vimperator.commandline.HL_WARNING); else @@ -176,7 +176,7 @@ vimperator.Search = function() //{{{ } // Called when the user types a key in the search dialog. Triggers a find attempt if 'incsearch' is set - this.searchKeyPressed = function(command) + this.searchKeyPressed = function (command) { if (vimperator.options["incsearch"]) this.find(command, backwards); @@ -184,7 +184,7 @@ vimperator.Search = function() //{{{ // Called when the enter key is pressed to trigger a search // use forced_direction if you call this function directly - this.searchSubmitted = function(command, forced_backward) + this.searchSubmitted = function (command, forced_backward) { if (typeof forced_backward === "boolean") backwards = forced_backward; @@ -203,7 +203,7 @@ vimperator.Search = function() //{{{ // TODO: move to find() when reverse incremental searching is kludged in // need to find again for reverse searching if (backwards) - setTimeout(function() { self.findAgain(false); }, 0); + setTimeout(function () { self.findAgain(false); }, 0); if (vimperator.options["hlsearch"]) this.highlight(search_string); @@ -213,14 +213,14 @@ vimperator.Search = function() //{{{ // Called when the search is canceled - for example if someone presses // escape while typing a search - this.searchCanceled = function() + this.searchCanceled = function () { this.clear(); // TODO: code to reposition the document to the place before search started } // this is not dependent on the value of 'hlsearch' - this.highlight = function(text) + this.highlight = function (text) { // already highlighted? if (window.content.document.getElementsByClassName("__mozilla-findbar-search").length > 0) @@ -233,7 +233,7 @@ vimperator.Search = function() //{{{ gFindBar._highlightDoc("white", "black", text); // TODO: seems fast enough for now...just - (function(win) + (function (win) { for (var i = 0; i < win.frames.length; i++) arguments.callee(win.frames[i]); @@ -248,7 +248,7 @@ vimperator.Search = function() //{{{ // TODO: remove highlighting from non-link matches (HTML - A/AREA with href attribute; XML - Xlink [type="simple"]) } - this.clear = function() + this.clear = function () { gFindBar._highlightDoc(); // need to manually collapse the selection if the document is not diff --git a/content/help.js b/content/help.js index 49ae08ca..51623825 100644 --- a/content/help.js +++ b/content/help.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.help = function(section, easter) //{{{ +vimperator.help = function (section, easter) //{{{ { if (easter) { @@ -131,7 +131,7 @@ vimperator.help = function(section, easter) //{{{ return ret; } - var header = '

    Vimperator

    ' + + var header = '

    Vimperator

    ' + '

    First there was a Navigator, then there was an Explorer.\n' + 'Later it was time for a Konqueror. Now it\'s time for an Imperator, the VIMperator :)

    '; @@ -255,7 +255,7 @@ vimperator.help = function(section, easter) //{{{ } // FIXME - setTimeout(function() { + setTimeout(function () { if (section) { function findSectionElement(section) diff --git a/content/hints.js b/content/hints.js index 1fa14487..be374b3e 100644 --- a/content/hints.js +++ b/content/hints.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.Hints = function() //{{{ +vimperator.Hints = function () //{{{ { var submode = ""; // used for extended mode, can be "o", "t", "y", etc. var hintString = ""; // the typed string part of the hint is in this string @@ -36,14 +36,14 @@ vimperator.Hints = function() //{{{ // hints[] = [elem, text, span, imgspan, elem.style.backgroundColor, elem.style.color] var hints = []; var valid_hints = []; // store the indices of the "hints" array with valid elements - + var escapeNumbers = false ; // escape mode for numbers. true -> treated as hint-text var activeTimeout = null; // needed for hinttimeout > 0 var canUpdate = false; // keep track of the documents which we generated the hints for // docs = { doc: document, start: start_index in hints[], end: end_index in hints[] } - var docs = []; + var docs = []; // reset all important variables function reset() @@ -173,7 +173,7 @@ vimperator.Hints = function() //{{{ vimperator.echoerr(e); } } - + function generate(win) { var startDate = Date.now(); @@ -383,13 +383,13 @@ vimperator.Hints = function() //{{{ // USE THIS FOR MAKING THE SELECTED ELEM RED // firstElem.style.backgroundColor = "red"; // firstElem.style.color = "white"; - // setTimeout(function() { + // setTimeout(function () { // firstElem.style.backgroundColor = firstElemBgColor; // firstElem.style.color = firstElemColor; // }, 200); // OR USE THIS FOR BLINKING: // var counter = 0; - // var id = setInterval(function() { + // var id = setInterval(function () { // firstElem.style.backgroundColor = "red"; // if (counter % 2 == 0) // firstElem.style.backgroundColor = "yellow"; @@ -403,7 +403,7 @@ vimperator.Hints = function() //{{{ // clearTimeout(id); // } // }, 100); - setTimeout(function() { + setTimeout(function () { firstElem.style.backgroundColor = firstElemBgColor; firstElem.style.color = firstElemColor; }, timeout); @@ -427,7 +427,7 @@ vimperator.Hints = function() //{{{ var first_href = valid_hints[0].getAttribute("href") || null; if (first_href) { - if (valid_hints.some( function(e) { return e.getAttribute("href") != first_href; } )) + if (valid_hints.some( function (e) { return e.getAttribute("href") != first_href; } )) return false; } else if (valid_hints.length > 1) @@ -458,7 +458,7 @@ vimperator.Hints = function() //{{{ if (vimperator.modes.extended & vimperator.modes.ALWAYS_HINT) { - setTimeout(function() { + setTimeout(function () { canUpdate = true; hintString = ""; hintNumber = 0; @@ -467,7 +467,7 @@ vimperator.Hints = function() //{{{ } else { - setTimeout( function() { + setTimeout( function () { if (vimperator.mode == vimperator.modes.HINTS) vimperator.modes.reset(false); }, timeout); @@ -481,7 +481,7 @@ vimperator.Hints = function() //{{{ //////////////////////////////////////////////////////////////////////////////// // TODO: implement framesets - this.show = function(mode, minor, filter) + this.show = function (mode, minor, filter) { if (mode == vimperator.modes.EXTENDED_HINT && !/^[;asoOtTwWyY]$/.test(minor)) { @@ -501,7 +501,7 @@ vimperator.Hints = function() //{{{ var mt = Components.classes["@mozilla.org/thread-manager;1"].getService().mainThread; while (mt.hasPendingEvents()) mt.processNextEvent(true); - + canUpdate = true; showHints(); @@ -520,12 +520,12 @@ vimperator.Hints = function() //{{{ return true; }; - this.hide = function() + this.hide = function () { removeHints(0); }; - this.onEvent = function(event) + this.onEvent = function (event) { var key = vimperator.events.toString(event); var followFirst = false; @@ -598,7 +598,7 @@ vimperator.Hints = function() //{{{ escapeNumbers = !escapeNumbers; if (escapeNumbers && usedTabKey) // hintNumber not used normally, but someone may wants to toggle hintNumber = 0; // s ? reset. Prevent to show numbers not entered. - + updateStatusline(); return; @@ -653,8 +653,8 @@ vimperator.Hints = function() //{{{ { var timeout = vimperator.options["hinttimeout"]; if (timeout > 0) - activeTimeout = setTimeout(function() { processHints(true); }, timeout); - + activeTimeout = setTimeout(function () { processHints(true); }, timeout); + return false; } // we have a unique hint diff --git a/content/io.js b/content/io.js index 490fbd7c..3c641a74 100644 --- a/content/io.js +++ b/content/io.js @@ -27,7 +27,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.IO = function() +vimperator.IO = function () { var environment_service = Components.classes["@mozilla.org/process/environment;1"] .getService(Components.interfaces.nsIEnvironment); @@ -43,7 +43,7 @@ vimperator.IO = function() MODE_SYNC: 0x40, MODE_EXCL: 0x80, - expandPath: function(path) + expandPath: function (path) { const WINDOWS = navigator.platform == "Win32"; @@ -84,7 +84,7 @@ vimperator.IO = function() return path; }, - getPluginDir: function() + getPluginDir: function () { var plugin_dir; @@ -98,7 +98,7 @@ vimperator.IO = function() return plugin_dir.exists() && plugin_dir.isDirectory() ? plugin_dir : null; }, - getRCFile: function() + getRCFile: function () { var rc_file1 = this.getFile(this.expandPath("~/.vimperatorrc")); var rc_file2 = this.getFile(this.expandPath("~/_vimperatorrc")); @@ -116,7 +116,7 @@ vimperator.IO = function() // return a nsILocalFile for path where you can call isDirectory(), etc. on // caller must check with .exists() if the returned file really exists - getFile: function(path) + getFile: function (path) { var file = Components.classes["@mozilla.org/file/local;1"]. createInstance(Components.interfaces.nsILocalFile); @@ -127,7 +127,7 @@ vimperator.IO = function() // TODO: make secure // returns a nsILocalFile or null if it could not be created - createTempFile: function() + createTempFile: function () { var file = Components.classes["@mozilla.org/file/local;1"]. createInstance(Components.interfaces.nsILocalFile); @@ -150,7 +150,7 @@ vimperator.IO = function() }, // file is either a full pathname or an instance of file instanceof nsILocalFile - readDirectory: function(file) + readDirectory: function (file) { if (typeof file == "string") file = this.getFile(file); @@ -175,7 +175,7 @@ vimperator.IO = function() // file is either a full pathname or an instance of file instanceof nsILocalFile // reads a file in "text" mode and returns the string - readFile: function(file) + readFile: function (file) { var ifstream = Components.classes["@mozilla.org/network/file-input-stream;1"] .createInstance(Components.interfaces.nsIFileInputStream); @@ -206,7 +206,7 @@ vimperator.IO = function() // file is either a full pathname or an instance of file instanceof nsILocalFile // default permission = 0644, only used when creating a new file, does not change permissions if the file exists // mode can be ">" or ">>" in addition to the normal MODE_* flags - writeFile: function(file, buf, mode, perms) + writeFile: function (file, buf, mode, perms) { var ofstream = Components.classes["@mozilla.org/network/file-output-stream;1"] .createInstance(Components.interfaces.nsIFileOutputStream); diff --git a/content/mappings.js b/content/mappings.js index 152ae8fc..c6818e60 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 *****/ -vimperator.Map = function(modes, cmds, action, extra_info) //{{{ +vimperator.Map = function (modes, cmds, action, extra_info) //{{{ { if (!modes || (!cmds || !cmds.length) || !action) return null; @@ -65,7 +65,7 @@ vimperator.Map = function(modes, cmds, action, extra_info) //{{{ } } -vimperator.Map.prototype.hasName = function(name) +vimperator.Map.prototype.hasName = function (name) { for (var i = 0; i < this.names.length; i++) { @@ -78,7 +78,7 @@ vimperator.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 -vimperator.Map.prototype.execute = function(motion, count, argument) +vimperator.Map.prototype.execute = function (motion, count, argument) { var args = []; if (this.flags & vimperator.Mappings.flags.MOTION) @@ -92,7 +92,7 @@ vimperator.Map.prototype.execute = function(motion, count, argument) } //}}} -vimperator.Mappings = function() //{{{ +vimperator.Mappings = function () //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// @@ -184,24 +184,24 @@ vimperator.Mappings = function() //{{{ }; // NOTE: just normal mode for now - this.__iterator__ = function() + this.__iterator__ = function () { return mappingsIterator(vimperator.modes.NORMAL, main); } // FIXME - this.getIterator = function(mode) + this.getIterator = function (mode) { return mappingsIterator(mode, main); } // FIXME - this.getUserIterator = function(mode) + this.getUserIterator = function (mode) { return mappingsIterator(mode, user); } - this.hasMap = function(mode, cmd) + this.hasMap = function (mode, cmd) { var user_maps = user[mode]; @@ -214,12 +214,12 @@ vimperator.Mappings = function() //{{{ return false; } - this.add = function(map) + this.add = function (map) { for (var i = 0; i < map.names.length; i++) { // only store keysyms with uppercase modifier strings - map.names[i] = map.names[i].replace(/[casm]-/g, function($0) { return $0.toUpperCase(); }); + map.names[i] = map.names[i].replace(/[casm]-/g, function ($0) { return $0.toUpperCase(); }); for (var j = 0; j < map.modes.length; j++) removeMap(map.modes[j], map.names[i]); } @@ -228,17 +228,17 @@ vimperator.Mappings = function() //{{{ user[map.modes[k]].push(map); } - this.remove = function(mode, cmd) + this.remove = function (mode, cmd) { removeMap(mode, cmd); } - this.removeAll = function(mode) + this.removeAll = function (mode) { user[mode] = []; } - this.get = function(mode, cmd) + this.get = function (mode, cmd) { var map = getMap(mode, cmd, user); @@ -249,13 +249,13 @@ vimperator.Mappings = function() //{{{ } // TODO: move default maps to their own v.normal namespace - this.getDefaultMap = function(mode, cmd) + this.getDefaultMap = function (mode, cmd) { return getMap(mode, cmd, main); } // returns an array of mappings with names which start with "cmd" - this.getCandidates = function(mode, cmd) + this.getCandidates = function (mode, cmd) { var mappings = []; var matches = []; @@ -279,7 +279,7 @@ vimperator.Mappings = function() //{{{ return matches; } - this.list = function(mode, filter) + this.list = function (mode, filter) { var maps = user[mode]; @@ -329,7 +329,7 @@ vimperator.Mappings = function() //{{{ // vimperator management addDefaultMap(new vimperator.Map(anymode, [""], - function() { vimperator.help(null); }, + 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>." @@ -344,14 +344,14 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map(any_non_insertmode, [":"], - function() { vimperator.commandline.open(":", "", vimperator.modes.EX); }, + 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 vimperator.Map([vimperator.modes.NORMAL], ["i", ""], - function() + function () { // setting this option triggers an observer // which takes care of the mode setting @@ -364,7 +364,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map(anymode, [""], - function() { vimperator.modes.passAllKeys = true; }, + function () { vimperator.modes.passAllKeys = true; }, { short_help: "Temporarily quit Vimperator mode", help: "Disable all Vimperator keys except <Esc> and pass them to the next event handler.
    " + @@ -374,7 +374,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map(anymode, [""], - function() { vimperator.modes.passNextKey = true; }, + function () { vimperator.modes.passNextKey = true; }, { short_help: "Pass through next key", help: "If you need to pass a certain key to a JavaScript form field or another extension prefix the key with <C-v>.
    " + @@ -390,7 +390,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map(anymode, [""], - function() { return; }, + function () { return; }, { short_help: "Do nothing", help: "This command is useful for disabling a specific mapping. " + @@ -399,7 +399,7 @@ vimperator.Mappings = function() //{{{ )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["]f"], - function(count) { vimperator.buffer.shiftFrameFocus(count > 1 ? count : 1, true); }, + function (count) { vimperator.buffer.shiftFrameFocus(count > 1 ? count : 1, true); }, { short_help: "Focus next frame", help: "Transfers keyboard focus to the [count]th next frame in order. The newly focused frame is briefly colored red. Does not wrap.", @@ -407,7 +407,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["[f"], - function(count) { vimperator.buffer.shiftFrameFocus(count > 1 ? count : 1, false); }, + function (count) { vimperator.buffer.shiftFrameFocus(count > 1 ? count : 1, false); }, { short_help: "Focus previous frame", help: "Transfers keyboard focus to the [count]th previous frame in order. The newly focused frame is briefly colored red. Does not wrap.", @@ -415,14 +415,14 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["b"], - function() { vimperator.commandline.open(":", "buffer! ", vimperator.modes.EX); }, + 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 vimperator.Map([vimperator.modes.NORMAL], ["B"], - function() { vimperator.buffer.list(true); }, + function () { vimperator.buffer.list(true); }, { short_help: "Toggle buffer list", help: "Toggles the display of the buffer list which shows all opened tabs.
    " + @@ -430,7 +430,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["gb"], - function(count) { vimperator.buffer.switchTo(null, null, count, false); }, + function (count) { vimperator.buffer.switchTo(null, null, count, false); }, { short_help: "Repeat last :buffer[!] command", help: "This is useful to quickly jump between buffers which have a similar URL or title.", @@ -438,7 +438,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["gB"], - function(count) { vimperator.buffer.switchTo(null, null, count, true); }, + function (count) { vimperator.buffer.switchTo(null, null, count, true); }, { short_help: "Repeat last :buffer[!] command in reverse direction", help: "Just like gb but in the other direction.", @@ -446,7 +446,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["d"], - function(count) { vimperator.tabs.remove(getBrowser().mCurrentTab, count, false, 0); }, + function (count) { vimperator.tabs.remove(getBrowser().mCurrentTab, count, false, 0); }, { short_help: "Delete current buffer (=tab)", help: "Count is supported, 2d removes the current and next tab and the one to the right is selected. " + @@ -455,7 +455,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["D"], - function(count) { vimperator.tabs.remove(getBrowser().mCurrentTab, count, true, 0); }, + function (count) { vimperator.tabs.remove(getBrowser().mCurrentTab, count, true, 0); }, { short_help: "Delete current buffer (=tab)", help: "Count is supported, 2D removes the current and previous tab and the one to the left is selected. " + @@ -471,7 +471,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["gH"], - function() + function () { var homepages = gHomeButton.getHomePage(); vimperator.open(homepages, /\bhomepage\b/.test(vimperator.options["activate"]) ? @@ -484,7 +484,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["gi"], - function() + function () { if (vimperator.buffer.lastInputField) vimperator.buffer.lastInputField.focus(); @@ -496,7 +496,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["go"], - function(arg) { vimperator.quickmarks.jumpTo(arg, vimperator.CURRENT_TAB); }, + function (arg) { vimperator.quickmarks.jumpTo(arg, vimperator.CURRENT_TAB); }, { short_help: "Jump to a QuickMark in the current tab", usage: ["go{a-zA-Z0-9}"], @@ -506,7 +506,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["gn"], - function(arg) + function (arg) { vimperator.quickmarks.jumpTo(arg, /\bquickmark\b/.test(vimperator.options["activate"]) ? @@ -522,7 +522,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["gP"], - function() + function () { vimperator.open(readFromClipboard(), /\bpaste\b/.test(vimperator.options["activate"]) ? @@ -534,7 +534,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["gt", "", "", ""], - function(count) { vimperator.tabs.select(count > 0 ? count - 1: "+1", count > 0 ? false : true); }, + function (count) { vimperator.tabs.select(count > 0 ? count - 1: "+1", count > 0 ? false : true); }, { short_help: "Go to the next tab", help: "Cycles to the first tab, when the last is selected.
    Count is supported: 3gt goes to the third tab.", @@ -542,7 +542,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["gT", "", "", ""], - function(count) { vimperator.tabs.select("-" + (count < 1 ? 1 : count), true); }, + function (count) { vimperator.tabs.select("-" + (count < 1 ? 1 : count), true); }, { short_help: "Go {count} pages back", help: "Wraps around from the first tab to the last tab.
    Count is supported: 3gT goes three tabs back.", @@ -550,7 +550,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["", ""], - function() + function () { if (vimperator.tabs.getTab() == vimperator.tabs.alternate) { @@ -577,7 +577,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["m"], - function(arg) + function (arg) { if (/[^a-zA-Z]/.test(arg)) { @@ -595,7 +595,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["'", "`"], - function(arg) { vimperator.marks.jumpTo(arg); }, + function (arg) { vimperator.marks.jumpTo(arg); }, { short_help: "Jump to the mark in the current buffer", usage: ["'{a-zA-Z}"], @@ -604,7 +604,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["M"], - function(arg) + function (arg) { if (/[^a-zA-Z0-9]/.test(arg)) { @@ -623,28 +623,28 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["o"], - function() { vimperator.commandline.open(":", "open ", vimperator.modes.EX); }, + 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 vimperator.Map([vimperator.modes.NORMAL], ["O"], - function() { vimperator.commandline.open(":", "open " + vimperator.buffer.URL, vimperator.modes.EX); }, + 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 vimperator.Map([vimperator.modes.NORMAL], ["p", ""], - function() { vimperator.open(readFromClipboard()); }, + 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 vimperator.Map([vimperator.modes.NORMAL], ["P"], - function() + function () { vimperator.open(readFromClipboard(), /\bpaste\b/.test(vimperator.options["activate"]) ? @@ -657,7 +657,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], [""], - function(count) { vimperator.commands.redraw(); }, + function (count) { vimperator.commands.redraw(); }, { short_help: "Redraw the screen", help: "Works like :redraw.", @@ -665,21 +665,21 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["r"], - function() { vimperator.tabs.reload(getBrowser().mCurrentTab, false); }, + function () { vimperator.tabs.reload(getBrowser().mCurrentTab, false); }, { short_help: "Reload", help: "Forces reloading of the current page." } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["R"], - function() { vimperator.tabs.reload(getBrowser().mCurrentTab, true); }, + 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 vimperator.Map([vimperator.modes.NORMAL], ["t"], - function() { vimperator.commandline.open(":", "tabopen ", vimperator.modes.EX); }, + function () { vimperator.commandline.open(":", "tabopen ", vimperator.modes.EX); }, { short_help: "Open one or more URLs in a new tab", help: "Like o but open URLs in a new tab.
    " + @@ -687,14 +687,14 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["T"], - function() { vimperator.commandline.open(":", "tabopen " + vimperator.buffer.URL, vimperator.modes.EX); }, + 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 vimperator.Map([vimperator.modes.NORMAL], ["u"], - function(count) { vimperator.commands.undo("", false, count); }, + function (count) { vimperator.commands.undo("", false, count); }, { short_help: "Undo closing of a tab", help: "If a count is given, don't close the last but the [count]th last tab.", @@ -702,7 +702,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["y"], - function() + function () { var url = vimperator.buffer.URL; vimperator.copyToClipboard(url); @@ -714,7 +714,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["Y"], - function() + function () { var sel = window.content.document.getSelection(); vimperator.copyToClipboard(sel); @@ -726,7 +726,7 @@ vimperator.Mappings = function() //{{{ )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["zi", "+"], - function(count) { vimperator.buffer.zoomIn(count > 1 ? count : 1, false); }, + function (count) { vimperator.buffer.zoomIn(count > 1 ? count : 1, false); }, { short_help: "Enlarge text zoom of current web page", help: "Mnemonic: zoom in", @@ -734,7 +734,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["zm"], - function(count) { vimperator.buffer.zoomIn((count > 1 ? count : 1) * 3, false); }, + function (count) { vimperator.buffer.zoomIn((count > 1 ? count : 1) * 3, false); }, { short_help: "Enlarge text zoom of current web page by a larger amount", help: "Mnemonic: zoom more", @@ -742,7 +742,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["zo", "-"], - function(count) { vimperator.buffer.zoomOut(count > 1 ? count : 1, false); }, + function (count) { vimperator.buffer.zoomOut(count > 1 ? count : 1, false); }, { short_help: "Reduce text zoom of current web page", help: "Mnemonic: zoom out", @@ -750,7 +750,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["zr"], - function(count) { vimperator.buffer.zoomOut((count > 1 ? count : 1) * 3, false); }, + function (count) { vimperator.buffer.zoomOut((count > 1 ? count : 1) * 3, false); }, { short_help: "Reduce text zoom of current web page by a larger amount", help: "Mnemonic: zoom reduce", @@ -758,7 +758,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["zz"], - function(count) { vimperator.buffer.textZoom = count > 1 ? count : 100; }, + function (count) { vimperator.buffer.textZoom = count > 1 ? count : 100; }, { short_help: "Set text zoom value of current web page", help: "Zoom value can be between 1 and 2000%. If it is omitted, text zoom is reset to 100%.", @@ -766,7 +766,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["zI"], - function(count) { vimperator.buffer.zoomIn(count > 1 ? count : 1, true); }, + function (count) { vimperator.buffer.zoomIn(count > 1 ? count : 1, true); }, { short_help: "Enlarge full zoom of current web page", help: "Mnemonic: zoom in", @@ -774,7 +774,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["zM"], - function(count) { vimperator.buffer.zoomIn((count > 1 ? count : 1) * 3, true); }, + function (count) { vimperator.buffer.zoomIn((count > 1 ? count : 1) * 3, true); }, { short_help: "Enlarge full zoom of current web page by a larger amount", help: "Mnemonic: zoom more", @@ -782,7 +782,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["zO"], - function(count) { vimperator.buffer.zoomOut(count > 1 ? count : 1, true); }, + function (count) { vimperator.buffer.zoomOut(count > 1 ? count : 1, true); }, { short_help: "Reduce full zoom of current web page", help: "Mnemonic: zoom out", @@ -790,7 +790,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["zR"], - function(count) { vimperator.buffer.zoomOut((count > 1 ? count : 1) * 3, true); }, + function (count) { vimperator.buffer.zoomOut((count > 1 ? count : 1) * 3, true); }, { short_help: "Reduce full zoom of current web page by a larger amount", help: "Mnemonic: zoom reduce", @@ -798,7 +798,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["zZ"], - function(count) { vimperator.buffer.fullZoom = count > 1 ? count : 100; }, + function (count) { vimperator.buffer.fullZoom = count > 1 ? count : 100; }, { short_help: "Set full zoom value of current web page", help: "Zoom value can be between 1 and 2000%. If it is omitted, full zoom is reset to 100%.", @@ -807,14 +807,14 @@ vimperator.Mappings = function() //{{{ )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["ZQ"], - function() { vimperator.quit(false); }, + function () { vimperator.quit(false); }, { short_help: "Quit and don't save the session", help: "Works like :qall." } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["ZZ"], - function() { vimperator.quit(true); }, + function () { vimperator.quit(true); }, { short_help: "Quit and save the session", help: "Quit Vimperator, no matter how many tabs/windows are open. The session is stored.
    " + @@ -824,20 +824,20 @@ vimperator.Mappings = function() //{{{ // scrolling commands addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["0", "^"], - function() { vimperator.buffer.scrollStart(); }, + 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 vimperator.Map([vimperator.modes.NORMAL], ["$"], - function() { vimperator.buffer.scrollEnd(); }, + function () { vimperator.buffer.scrollEnd(); }, { short_help: "Scroll to the absolute right of the document" } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["gg", ""], - function(count) { vimperator.buffer.scrollToPercentile(count > 0 ? count : 0); }, + function (count) { vimperator.buffer.scrollToPercentile(count > 0 ? count : 0); }, { short_help: "Goto the top of the document", help: "When used with [count] like in 35gg, it scrolls to 35% of the document.", @@ -845,7 +845,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["G", ""], - function(count) { vimperator.buffer.scrollToPercentile(count >= 0 ? count : 100); }, + function (count) { vimperator.buffer.scrollToPercentile(count >= 0 ? count : 100); }, { short_help: "Goto the end of the document", help: "When used with [count] like in 35G, it scrolls to 35% of the document.", @@ -853,7 +853,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["h", ""], - function(count) { vimperator.buffer.scrollColumns(-(count > 1 ? count : 1)); }, + function (count) { vimperator.buffer.scrollColumns(-(count > 1 ? count : 1)); }, { short_help: "Scroll document to the left", help: "Count is supported: 10h will move 10 times as much to the left.
    " + @@ -862,7 +862,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["j", "", ""], - function(count) { vimperator.buffer.scrollLines(count > 1 ? count : 1); }, + function (count) { vimperator.buffer.scrollLines(count > 1 ? count : 1); }, { short_help: "Scroll document down", help: "Count is supported: 10j will move 10 times as much down.
    " + @@ -871,7 +871,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["k", "", ""], - function(count) { vimperator.buffer.scrollLines(-(count > 1 ? count : 1)); }, + function (count) { vimperator.buffer.scrollLines(-(count > 1 ? count : 1)); }, { short_help: "Scroll document up", help: "Count is supported: 10k will move 10 times as much up.
    " + @@ -896,7 +896,7 @@ vimperator.Mappings = function() //{{{ } } addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], [""], - function(count) { scrollByScrollSize(count, 1); }, + function (count) { scrollByScrollSize(count, 1); }, { short_help: "Scroll window downwards in the buffer", help: "The number of lines is set by the 'scroll' option which defaults to half a page. " + @@ -905,7 +905,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], [""], - function(count) { scrollByScrollSize(count, -1); }, + function (count) { scrollByScrollSize(count, -1); }, { short_help: "Scroll window upwards in the buffer", help: "The number of lines is set by the 'scroll' option which defaults to half a page. " + @@ -914,7 +914,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["l", ""], - function(count) { vimperator.buffer.scrollColumns(count > 1 ? count : 1); }, + function (count) { vimperator.buffer.scrollColumns(count > 1 ? count : 1); }, { short_help: "Scroll document to the right", help: "Count is supported: 10l will move 10 times as much to the right.
    " + @@ -923,7 +923,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["", "", ""], - function(count) { vimperator.buffer.scrollPages(-(count > 1 ? count : 1)); }, + function (count) { vimperator.buffer.scrollPages(-(count > 1 ? count : 1)); }, { short_help: "Scroll up a full page", help: "Scroll window [count] pages Backwards (upwards) in the buffer.", @@ -931,7 +931,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["", "", ""], - function(count) { vimperator.buffer.scrollPages(count > 1 ? count : 1); }, + function (count) { vimperator.buffer.scrollPages(count > 1 ? count : 1); }, { short_help: "Scroll down a full page", help: "Scroll window [count] pages Forwards (downwards) in the buffer.", @@ -941,7 +941,7 @@ vimperator.Mappings = function() //{{{ // page info addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], [""], - function(count) { vimperator.buffer.pageInfo(false); }, + function (count) { vimperator.buffer.pageInfo(false); }, { short_help: "Print the current file name", help: "Also shows some additional file information like file size or the last modified date. " + @@ -950,7 +950,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["g"], - function(count) { vimperator.buffer.pageInfo(true); }, + function (count) { vimperator.buffer.pageInfo(true); }, { short_help: "Print file information", help: "Same as :pa[geinfo]." @@ -960,7 +960,7 @@ vimperator.Mappings = function() //{{{ // history manipulation and jumplist addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], [""], - function(count) { vimperator.history.stepTo(-(count > 1 ? count : 1)); }, + function (count) { vimperator.history.stepTo(-(count > 1 ? count : 1)); }, { short_help: "Go to an older position in the jump list", help: "The jump list is just the browser history for now.", @@ -968,7 +968,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], [""], - function(count) { vimperator.history.stepTo(count > 1 ? count : 1); }, + function (count) { vimperator.history.stepTo(count > 1 ? count : 1); }, { short_help: "Go to a newer position in the jump list", help: "The jump list is just the browser history for now.", @@ -976,7 +976,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["H", "", ""], - function(count) { vimperator.history.stepTo(-(count > 1 ? count : 1)); }, + function (count) { vimperator.history.stepTo(-(count > 1 ? count : 1)); }, { short_help: "Go back in the browser history", help: "Count is supported: 3H goes back 3 steps.", @@ -984,7 +984,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["L", "", ""], - function(count) { vimperator.history.stepTo(count > 1 ? count : 1); }, + function (count) { vimperator.history.stepTo(count > 1 ? count : 1); }, { short_help: "Go forward in the browser history", help: "Count is supported: 3L goes forward 3 steps.", @@ -1009,7 +1009,7 @@ vimperator.Mappings = function() //{{{ return false; } addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["gu", ""], - function(count) + function (count) { var gocmd = ""; if (isDirectory(vimperator.buffer.URL)) @@ -1032,7 +1032,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["gU", ""], - function() { vimperator.open("..."); }, + function () { vimperator.open("..."); }, { short_help: "Go to the root of the website", help: "gU on http://www.example.com/dir1/dir2/file.htm opens http://www.example.com/.
    " + @@ -1042,7 +1042,7 @@ vimperator.Mappings = function() //{{{ // hint managment addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["f"], - function() { vimperator.hints.show(vimperator.modes.QUICK_HINT); }, + function () { vimperator.hints.show(vimperator.modes.QUICK_HINT); }, { short_help: "Start QuickHint mode", usage: ["f{hint}"], @@ -1053,7 +1053,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["F"], - function() { vimperator.hints.show(vimperator.modes.QUICK_HINT, "t"); }, + function () { vimperator.hints.show(vimperator.modes.QUICK_HINT, "t"); }, { short_help: "Start QuickHint mode, but open link in a new tab", usage: ["F{hint}"], @@ -1061,7 +1061,7 @@ vimperator.Mappings = function() //{{{ } )); // addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["F"], -// function() { vimperator.echo("Always HINT mode not available anymore"); }, +// function () { vimperator.echo("Always HINT mode not available anymore"); }, // { // short_help: "Start AlwaysHint mode (CURRENTLY DISABLED)", // help: "In AlwaysHint mode, every hintable item (according to the 'hinttags' XPath query) is assigned a label.
    " + @@ -1071,7 +1071,7 @@ vimperator.Mappings = function() //{{{ // } // )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], [";"], - function(arg) + function (arg) { if (arg == "f") vimperator.hints.show(vimperator.modes.ALWAYS_HINT, "o"); @@ -1114,7 +1114,7 @@ vimperator.Mappings = function() //{{{ // search management addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["/"], - function() { vimperator.search.openSearchDialog(vimperator.modes.SEARCH_FORWARD); }, + function () { vimperator.search.openSearchDialog(vimperator.modes.SEARCH_FORWARD); }, { short_help: "Search forward for a pattern", usage: ["/{pattern}[/]"], @@ -1126,7 +1126,7 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["?"], - function() { vimperator.search.openSearchDialog(vimperator.modes.SEARCH_BACKWARD); }, + function () { vimperator.search.openSearchDialog(vimperator.modes.SEARCH_BACKWARD); }, { short_help: "Search backwards for a pattern", usage: ["?{pattern}[?]"], @@ -1139,14 +1139,14 @@ vimperator.Mappings = function() //{{{ } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["n"], - function() { vimperator.search.findAgain(false); }, + function () { vimperator.search.findAgain(false); }, { short_help: "Find next", help: "Repeat the last search 1 time (until count is supported)." } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["N"], - function() { vimperator.search.findAgain(true); }, + function () { vimperator.search.findAgain(true); }, { short_help: "Find previous", help: "Repeat the last search 1 time (until count is supported) in the opposite direction." @@ -1160,63 +1160,63 @@ vimperator.Mappings = function() //{{{ // // action keys // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], ["o"], -// function() { vimperator.hints.openHints(false, false); }, +// function () { vimperator.hints.openHints(false, false); }, // { // cancel_mode: true, // always_active: false // } // )); // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], ["t"], -// function() { vimperator.hints.openHints(true, false); }, +// function () { vimperator.hints.openHints(true, false); }, // { // cancel_mode: true, // always_active: false // } // )); // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], [""], -// function() { vimperator.hints.openHints(false, true ); }, +// function () { vimperator.hints.openHints(false, true ); }, // { // cancel_mode: true, // always_active: false // } // )); // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], ["s"], -// function() { vimperator.hints.saveHints(true); }, +// function () { vimperator.hints.saveHints(true); }, // { // cancel_mode: true, // always_active: false // } // )); // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], ["a"], -// function() { vimperator.hints.saveHints(false); }, +// function () { vimperator.hints.saveHints(false); }, // { // cancel_mode: true, // always_active: false // } // )); // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], ["y"], -// function() { vimperator.hints.yankUrlHints(); }, +// function () { vimperator.hints.yankUrlHints(); }, // { // cancel_mode: true, // always_active: false // } // )); // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], ["Y"], -// function() { vimperator.hints.yankTextHints(); }, +// function () { vimperator.hints.yankTextHints(); }, // { // cancel_mode: true, // always_active: false // } // )); // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], [","], -// function() { vimperator.input.buffer += ","; vimperator.hints.setCurrentState(0); }, +// function () { vimperator.input.buffer += ","; vimperator.hints.setCurrentState(0); }, // { // cancel_mode: false, // always_active: true // } // )); // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], [":"], -// function() { vimperator.commandline.open(":", "", vimperator.modes.EX); }, +// function () { vimperator.commandline.open(":", "", vimperator.modes.EX); }, // { // cancel_mode: false, // always_active: true @@ -1225,7 +1225,7 @@ vimperator.Mappings = function() //{{{ // // // movement keys // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], [""], -// function(count) { vimperator.buffer.scrollLines(count > 1 ? count : 1); }, +// function (count) { vimperator.buffer.scrollLines(count > 1 ? count : 1); }, // { // cancel_mode: false, // always_active: true, @@ -1233,7 +1233,7 @@ vimperator.Mappings = function() //{{{ // } // )); // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], [""], -// function(count) { vimperator.buffer.scrollLines(-(count > 1 ? count : 1)); }, +// function (count) { vimperator.buffer.scrollLines(-(count > 1 ? count : 1)); }, // { // cancel_mode: false, // always_active: true, @@ -1241,21 +1241,21 @@ vimperator.Mappings = function() //{{{ // } // )); // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], [""], -// function() { vimperator.buffer.scrollTop(); }, +// function () { vimperator.buffer.scrollTop(); }, // { // cancel_mode: false, // always_active: true // } // )); // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], [""], -// function() { vimperator.buffer.scrollBottom(); }, +// function () { vimperator.buffer.scrollBottom(); }, // { // cancel_mode: false, // always_active: true // } // )); // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], ["", ""], -// function(count) { vimperator.buffer.scrollPages(-(count > 1 ? count : 1)); }, +// function (count) { vimperator.buffer.scrollPages(-(count > 1 ? count : 1)); }, // { // cancel_mode: false, // always_active: true, @@ -1263,7 +1263,7 @@ vimperator.Mappings = function() //{{{ // } // )); // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], ["", ""], -// function(count) { vimperator.buffer.scrollPages(count > 1 ? count : 1); }, +// function (count) { vimperator.buffer.scrollPages(count > 1 ? count : 1); }, // { // cancel_mode: false, // always_active: true, @@ -1271,7 +1271,7 @@ vimperator.Mappings = function() //{{{ // } // )); // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], [""], -// function() { vimperator.buffer.scrollColumns(-(count > 1 ? count : 1)); }, +// function () { vimperator.buffer.scrollColumns(-(count > 1 ? count : 1)); }, // { // cancel_mode: false, // always_active: true, @@ -1279,7 +1279,7 @@ vimperator.Mappings = function() //{{{ // } // )); // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], [""], -// function() { vimperator.buffer.scrollLines(count > 1 ? count : 1); }, +// function () { vimperator.buffer.scrollLines(count > 1 ? count : 1); }, // { // cancel_mode: false, // always_active: true, @@ -1287,7 +1287,7 @@ vimperator.Mappings = function() //{{{ // } // )); // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], [""], -// function() { vimperator.buffer.scrollLines(-(count > 1 ? count : 1)); }, +// function () { vimperator.buffer.scrollLines(-(count > 1 ? count : 1)); }, // { // cancel_mode: false, // always_active: true, @@ -1295,7 +1295,7 @@ vimperator.Mappings = function() //{{{ // } // )); // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], [""], -// function() { vimperator.buffer.scrollColumns(count > 1 ? count : 1); }, +// function () { vimperator.buffer.scrollColumns(count > 1 ? count : 1); }, // { // cancel_mode: false, // always_active: true, @@ -1305,14 +1305,14 @@ vimperator.Mappings = function() //{{{ // // // tab management // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], [""], -// function() { vimperator.tabs.select("+1", true); }, +// function () { vimperator.tabs.select("+1", true); }, // { // cancel_mode: true, // always_active: true // } // )); // same as gt, but no count supported // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], [""], -// function() { vimperator.tabs.select("-1", true); }, +// function () { vimperator.tabs.select("-1", true); }, // { // cancel_mode: true, // always_active: true @@ -1321,7 +1321,7 @@ vimperator.Mappings = function() //{{{ // // // navigation // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], [""], -// function(count) { vimperator.history.stepTo(count > 0 ? -count : -1); }, +// function (count) { vimperator.history.stepTo(count > 0 ? -count : -1); }, // { // cancel_mode: false, // always_active: true, @@ -1329,7 +1329,7 @@ vimperator.Mappings = function() //{{{ // } // )); // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], [""], -// function(count) { vimperator.history.stepTo(count > 1 ? count : 1); }, +// function (count) { vimperator.history.stepTo(count > 1 ? count : 1); }, // { // cancel_mode: false, // always_active: true, @@ -1337,7 +1337,7 @@ vimperator.Mappings = function() //{{{ // } // )); // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], [""], -// function(count) { vimperator.history.stepTo(count > 0 ? -count : -1); }, +// function (count) { vimperator.history.stepTo(count > 0 ? -count : -1); }, // { // cancel_mode: false, // always_active: true, @@ -1345,7 +1345,7 @@ vimperator.Mappings = function() //{{{ // } // )); // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], [""], -// function(count) { vimperator.history.stepTo(count > 1 ? count : 1); }, +// function (count) { vimperator.history.stepTo(count > 1 ? count : 1); }, // { // cancel_mode: false, // always_active: true, @@ -1353,7 +1353,7 @@ vimperator.Mappings = function() //{{{ // } // )); // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], [""], -// function() { vimperator.tabs.remove(getBrowser().mCurrentTab, vimperator.input.count, false, 0); }, +// function () { vimperator.tabs.remove(getBrowser().mCurrentTab, vimperator.input.count, false, 0); }, // { // cancel_mode: true, // always_active: true @@ -1362,27 +1362,27 @@ vimperator.Mappings = function() //{{{ // // // cancel_mode hint mode keys // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], [""], -// function() { ; }, +// function () { ; }, // { // cancel_mode: true, // always_active: true // } // )); // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], [""], -// function() { ; }, +// function () { ; }, // { // cancel_mode: true, // always_active: true // } // )); // addDefaultMap(new vimperator.Map([vimperator.modes.HINTS], [""], -// function() { ; }, +// function () { ; }, // { // cancel_mode: true, // always_active: true // } // )); - + // }}} // Caret mode // {{{ @@ -1393,110 +1393,110 @@ vimperator.Mappings = function() //{{{ .QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsISelectionDisplay) .QueryInterface(Components.interfaces.nsISelectionController); - + } addDefaultMap(new vimperator.Map([vimperator.modes.CARET, vimperator.modes.TEXTAREA], ["v"], - function(count) { vimperator.modes.set(vimperator.modes.VISUAL, vimperator.mode); }, + function (count) { vimperator.modes.set(vimperator.modes.VISUAL, vimperator.mode); }, { short_help: "Start visual mode", help: "Works for caret mode and textarea mode." } )); addDefaultMap(new vimperator.Map([vimperator.modes.CARET], ["j", ""], - function(count) + function (count) { if (count < 1) count = 1; - while(count--) + while (count--) getSelectionController().lineMove(true, false); }, { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.CARET], ["k", ""], - function(count) + function (count) { if (count < 1) count = 1; - while(count--) + while (count--) getSelectionController().lineMove(false, false); }, { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.CARET], ["h", ""], - function(count) + function (count) { if (count < 1) count = 1; - while(count--) + while (count--) getSelectionController().characterMove(false, false); }, { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.CARET], ["l", ""], - function(count) + function (count) { if (count < 1) count = 1; - while(count--) + while (count--) getSelectionController().characterMove(true, false); }, { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.CARET], ["b", "B", ""], - function(count) + function (count) { if (count < 1) count = 1; - while(count--) + while (count--) getSelectionController().wordMove(false, false); }, { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.CARET], ["w", "W", "e", ""], - function(count) + function (count) { if (count < 1) count = 1; - while(count--) + while (count--) getSelectionController().wordMove(true, false); }, { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.CARET], ["", ""], - function(count) + function (count) { if (count < 1) count = 1; - while(count--) + while (count--) getSelectionController().pageMove(true, false); }, { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.CARET], ["", ""], - function(count) + function (count) { if (count < 1) count = 1; - while(count--) + while (count--) getSelectionController().pageMove(false, false); }, { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.CARET], ["gg", ""], - function(count) { getSelectionController().completeMove(false, false); }, + function (count) { getSelectionController().completeMove(false, false); }, { } )); addDefaultMap(new vimperator.Map([vimperator.modes.CARET], ["G", ""], - function(count) { getSelectionController().completeMove(true, false); }, + function (count) { getSelectionController().completeMove(true, false); }, { } )); addDefaultMap(new vimperator.Map([vimperator.modes.CARET], ["0", "^", ""], - function(count) { getSelectionController().intraLineMove(false, false); }, + function (count) { getSelectionController().intraLineMove(false, false); }, { } )); addDefaultMap(new vimperator.Map([vimperator.modes.CARET], ["$", ""], - function(count) { getSelectionController().intraLineMove(true, false); }, + function (count) { getSelectionController().intraLineMove(true, false); }, { } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL, vimperator.modes.CARET, vimperator.modes.TEXTAREA], ["*"], - function(count) + function (count) { vimperator.search.searchSubmitted(vimperator.buffer.getCurrentWord(), false); vimperator.search.findAgain(); @@ -1504,7 +1504,7 @@ vimperator.Mappings = function() //{{{ { } )); addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL, vimperator.modes.CARET, vimperator.modes.TEXTAREA], ["#"], - function(count) + function (count) { vimperator.search.searchSubmitted(vimperator.buffer.getCurrentWord(), true); vimperator.search.findAgain(); @@ -1517,10 +1517,10 @@ vimperator.Mappings = function() //{{{ // {{{ addDefaultMap(new vimperator.Map([vimperator.modes.VISUAL], ["j", ""], - function(count) + function (count) { if (count < 1) count = 1; - while(count--) + while (count--) { if (vimperator.modes.extended & vimperator.modes.TEXTAREA) { @@ -1535,10 +1535,10 @@ vimperator.Mappings = function() //{{{ { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.VISUAL], ["k", ""], - function(count) + function (count) { if (count < 1) count = 1; - while(count--) + while (count--) { if (vimperator.modes.extended & vimperator.modes.TEXTAREA) { @@ -1553,10 +1553,10 @@ vimperator.Mappings = function() //{{{ { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.VISUAL], ["h", ""], - function(count) + function (count) { if (count < 1) count = 1; - while(count--) + while (count--) { if (vimperator.modes.extended & vimperator.modes.TEXTAREA) vimperator.editor.executeCommand("cmd_selectCharPrevious"); @@ -1567,10 +1567,10 @@ vimperator.Mappings = function() //{{{ { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.VISUAL], ["l", ""], - function(count) + function (count) { if (count < 1) count = 1; - while(count--) + while (count--) { if (vimperator.modes.extended & vimperator.modes.TEXTAREA) vimperator.editor.executeCommand("cmd_selectCharNext"); @@ -1581,10 +1581,10 @@ vimperator.Mappings = function() //{{{ { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.VISUAL], ["b", "B"], - function(count) + function (count) { if (count < 1) count = 1; - while(count--) + while (count--) { if (vimperator.modes.extended & vimperator.modes.TEXTAREA) vimperator.editor.executeCommand("cmd_selectWordPrevious"); @@ -1595,10 +1595,10 @@ vimperator.Mappings = function() //{{{ { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.VISUAL], ["w", "W", "e"], - function(count) + function (count) { if (count < 1) count = 1; - while(count--) + while (count--) { if (vimperator.modes.extended & vimperator.modes.TEXTAREA) vimperator.editor.executeCommand("cmd_selectWordNext"); @@ -1609,10 +1609,10 @@ vimperator.Mappings = function() //{{{ { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.VISUAL], ["", ""], - function(count) + function (count) { if (count < 1) count = 1; - while(count--) + while (count--) { if (vimperator.modes.extended & vimperator.modes.TEXTAREA) ;//vimperator.editor.executeCommand("cmd_selectPageNext"); @@ -1623,10 +1623,10 @@ vimperator.Mappings = function() //{{{ { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.VISUAL], ["", ""], - function(count) + function (count) { if (count < 1) count = 1; - while(count--) + while (count--) { if (vimperator.modes.extended & vimperator.modes.TEXTAREA) ;//vimperator.editor.executeCommand("cmd_selectWordNext"); @@ -1637,7 +1637,7 @@ vimperator.Mappings = function() //{{{ { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.VISUAL], ["gg", ""], - function(count) + function (count) { if (vimperator.modes.extended & vimperator.modes.TEXTAREA) vimperator.editor.executeCommand("cmd_selectTop"); @@ -1647,7 +1647,7 @@ vimperator.Mappings = function() //{{{ { } )); addDefaultMap(new vimperator.Map([vimperator.modes.VISUAL], ["G", ""], - function(count) + function (count) { if (vimperator.modes.extended & vimperator.modes.TEXTAREA) vimperator.editor.executeCommand("cmd_selectBottom"); @@ -1657,7 +1657,7 @@ vimperator.Mappings = function() //{{{ { } )); addDefaultMap(new vimperator.Map([vimperator.modes.VISUAL], ["0", "^", ""], - function(count) + function (count) { if (vimperator.modes.extended & vimperator.modes.TEXTAREA) vimperator.editor.executeCommand("cmd_selectBeginLine"); @@ -1667,7 +1667,7 @@ vimperator.Mappings = function() //{{{ { } )); addDefaultMap(new vimperator.Map([vimperator.modes.VISUAL], ["$", ""], - function(count) + function (count) { if (vimperator.modes.extended & vimperator.modes.TEXTAREA) vimperator.editor.executeCommand("cmd_selectEndLine"); @@ -1677,7 +1677,7 @@ vimperator.Mappings = function() //{{{ { } )); addDefaultMap(new vimperator.Map([vimperator.modes.VISUAL], ["c", "s"], - function(count) + function (count) { if (vimperator.modes.extended & vimperator.modes.TEXTAREA) { @@ -1690,7 +1690,7 @@ vimperator.Mappings = function() //{{{ { } )); addDefaultMap(new vimperator.Map([vimperator.modes.VISUAL], ["d"], - function(count) + function (count) { if (vimperator.modes.extended & vimperator.modes.TEXTAREA) { @@ -1703,7 +1703,7 @@ vimperator.Mappings = function() //{{{ { } )); addDefaultMap(new vimperator.Map([vimperator.modes.VISUAL], ["y"], - function(count) + function (count) { if (vimperator.modes.extended & vimperator.modes.TEXTAREA) { @@ -1717,7 +1717,7 @@ vimperator.Mappings = function() //{{{ { } )); addDefaultMap(new vimperator.Map([vimperator.modes.VISUAL, vimperator.modes.TEXTAREA], ["p"], - function(count) + function (count) { if (!(vimperator.modes.extended & vimperator.modes.CARET)) { @@ -1738,11 +1738,11 @@ vimperator.Mappings = function() //{{{ // {{{ addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["i", ""], - function(count) { vimperator.modes.set(vimperator.modes.INSERT, vimperator.modes.TEXTAREA); }, + function (count) { vimperator.modes.set(vimperator.modes.INSERT, vimperator.modes.TEXTAREA); }, { } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["a"], - function(count) + function (count) { vimperator.editor.executeCommand("cmd_charNext", 1); vimperator.modes.set(vimperator.modes.INSERT, vimperator.modes.TEXTAREA); @@ -1750,7 +1750,7 @@ vimperator.Mappings = function() //{{{ { } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["I", "gI"], - function(count) + function (count) { vimperator.editor.executeCommand("cmd_beginLine", 1); vimperator.modes.set(vimperator.modes.INSERT, vimperator.modes.TEXTAREA); @@ -1758,7 +1758,7 @@ vimperator.Mappings = function() //{{{ { } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["A"], - function(count) + function (count) { vimperator.editor.executeCommand("cmd_endLine", 1); vimperator.modes.set(vimperator.modes.INSERT, vimperator.modes.TEXTAREA); @@ -1766,7 +1766,7 @@ vimperator.Mappings = function() //{{{ { } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["s"], - function(count) + function (count) { vimperator.editor.executeCommand("cmd_deleteCharForward", 1); vimperator.modes.set(vimperator.modes.INSERT, vimperator.modes.TEXTAREA); @@ -1774,7 +1774,7 @@ vimperator.Mappings = function() //{{{ { } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["S"], - function(count) + function (count) { vimperator.editor.executeCommand("cmd_deleteToEndOfLine", 1); vimperator.editor.executeCommand("cmd_deleteToBeginningOfLine", 1); @@ -1783,7 +1783,7 @@ vimperator.Mappings = function() //{{{ { } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["C"], - function(count) + function (count) { vimperator.editor.executeCommand("cmd_deleteToEndOfLine", 1); vimperator.modes.set(vimperator.modes.INSERT, vimperator.modes.TEXTAREA); @@ -1791,11 +1791,11 @@ vimperator.Mappings = function() //{{{ { } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["v"], - function(count) { vimperator.modes.set(vimperator.modes.VISUAL, vimperator.modes.TEXTAREA); }, + function (count) { vimperator.modes.set(vimperator.modes.VISUAL, vimperator.modes.TEXTAREA); }, { } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["V"], - function(count) + function (count) { vimperator.modes.set(vimperator.modes.VISUAL, vimperator.modes.TEXTAREA | vimperator.modes.LINE); vimperator.editor.executeCommand("cmd_beginLine", 1); @@ -1804,63 +1804,63 @@ vimperator.Mappings = function() //{{{ { } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["u"], - function(count) { vimperator.editor.executeCommand("cmd_undo", count); vimperator.mode = vimperator.modes.TEXTAREA; }, + function (count) { vimperator.editor.executeCommand("cmd_undo", count); vimperator.mode = vimperator.modes.TEXTAREA; }, { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], [""], - function(count) { vimperator.editor.executeCommand("cmd_redo", count); vimperator.mode = vimperator.modes.TEXTAREA; }, + function (count) { vimperator.editor.executeCommand("cmd_redo", count); vimperator.mode = vimperator.modes.TEXTAREA; }, { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["j", "", ""], - function(count) { vimperator.editor.executeCommand("cmd_lineNext", count); }, + function (count) { vimperator.editor.executeCommand("cmd_lineNext", count); }, { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["k", ""], - function(count) { vimperator.editor.executeCommand("cmd_linePrevious", count); }, + function (count) { vimperator.editor.executeCommand("cmd_linePrevious", count); }, { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["h", "", ""], - function(count) { vimperator.editor.executeCommand("cmd_charPrevious", count); }, + function (count) { vimperator.editor.executeCommand("cmd_charPrevious", count); }, { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["l", "", ""], - function(count) { vimperator.editor.executeCommand("cmd_charNext", count); }, + function (count) { vimperator.editor.executeCommand("cmd_charNext", count); }, { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["w", "W", "e", ""], - function(count) { vimperator.editor.executeCommand("cmd_wordNext", count); }, + function (count) { vimperator.editor.executeCommand("cmd_wordNext", count); }, { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["b", "B", ""], - function(count) { vimperator.editor.executeCommand("cmd_wordPrevious", 1); }, + function (count) { vimperator.editor.executeCommand("cmd_wordPrevious", 1); }, { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["gg", ""], - function(count) { vimperator.editor.executeCommand("cmd_moveTop", 1); }, + function (count) { vimperator.editor.executeCommand("cmd_moveTop", 1); }, { } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["G", ""], - function(count) { vimperator.editor.executeCommand("cmd_moveBottom", 1); }, + function (count) { vimperator.editor.executeCommand("cmd_moveBottom", 1); }, { } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["0", "^", ""], - function(count) { vimperator.editor.executeCommand("cmd_beginLine", 1); }, + function (count) { vimperator.editor.executeCommand("cmd_beginLine", 1); }, { } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["$", ""], - function(count) { vimperator.editor.executeCommand("cmd_endLine", 1); }, + function (count) { vimperator.editor.executeCommand("cmd_endLine", 1); }, { } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["", ""], - function(count) { vimperator.editor.executeCommand("cmd_movePageDown", count); }, + function (count) { vimperator.editor.executeCommand("cmd_movePageDown", count); }, { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["", ""], - function(count) { vimperator.editor.executeCommand("cmd_movePageUp", count); }, + function (count) { vimperator.editor.executeCommand("cmd_movePageUp", count); }, { flags: vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["o"], - function(count) + function (count) { vimperator.editor.executeCommand("cmd_endLine", 1); vimperator.modes.set(vimperator.modes.INSERT, vimperator.modes.TEXTAREA); @@ -1869,7 +1869,7 @@ vimperator.Mappings = function() //{{{ { } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["O"], - function(count) + function (count) { vimperator.editor.executeCommand("cmd_beginLine", 1); vimperator.modes.set(vimperator.modes.INSERT, vimperator.modes.TEXTAREA); @@ -1881,7 +1881,7 @@ vimperator.Mappings = function() //{{{ // no need to check if we are really in TEXTAREA mode, as findCharForward/Backward will return -1 otherwise addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA, vimperator.modes.VISUAL], ["f"], - function(count, arg) + function (count, arg) { var pos = vimperator.editor.findCharForward(arg, count); if (pos >= 0) @@ -1890,7 +1890,7 @@ vimperator.Mappings = function() //{{{ { flags: vimperator.Mappings.flags.ARGUMENT | vimperator.Mappings.flags.COUNT} )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA, vimperator.modes.VISUAL], ["F"], - function(count, arg) + function (count, arg) { var pos = vimperator.editor.findCharBackward(arg, count); if (pos >= 0) @@ -1899,7 +1899,7 @@ vimperator.Mappings = function() //{{{ { flags: vimperator.Mappings.flags.ARGUMENT | vimperator.Mappings.flags.COUNT} )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA, vimperator.modes.VISUAL], ["t"], - function(count, arg) + function (count, arg) { var pos = vimperator.editor.findCharForward(arg, count); if (pos >= 0) @@ -1908,7 +1908,7 @@ vimperator.Mappings = function() //{{{ { flags: vimperator.Mappings.flags.ARGUMENT | vimperator.Mappings.flags.COUNT} )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA, vimperator.modes.VISUAL], ["T"], - function(count, arg) + function (count, arg) { var pos = vimperator.editor.findCharBackward(arg, count); if (pos >= 0) @@ -1917,7 +1917,7 @@ vimperator.Mappings = function() //{{{ { flags: vimperator.Mappings.flags.ARGUMENT | vimperator.Mappings.flags.COUNT} )); // addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA, vimperator.modes.VISUAL], [";"], - // function(count, arg) + // function (count, arg) // { // var pos = vimperator.editor.findCharBackward(null, count); // if (pos >= 0) @@ -1925,18 +1925,18 @@ vimperator.Mappings = function() //{{{ // }, // { flags: vimperator.Mappings.flags.ARGUMENT | vimperator.Mappings.flags.COUNT} // )); - + // commands which require a motion addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["d"], - function(motion, count) { vimperator.editor.executeCommandWithMotion("d", motion, count); }, + function (motion, count) { vimperator.editor.executeCommandWithMotion("d", motion, count); }, { flags: vimperator.Mappings.flags.MOTION | vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["c"], - function(motion, count) { vimperator.editor.executeCommandWithMotion("c", motion, count); }, + function (motion, count) { vimperator.editor.executeCommandWithMotion("c", motion, count); }, { flags: vimperator.Mappings.flags.MOTION | vimperator.Mappings.flags.COUNT } )); addDefaultMap(new vimperator.Map([vimperator.modes.TEXTAREA], ["y"], - function(motion, count) { vimperator.editor.executeCommandWithMotion("y", motion, count); }, + function (motion, count) { vimperator.editor.executeCommandWithMotion("y", motion, count); }, { flags: vimperator.Mappings.flags.MOTION | vimperator.Mappings.flags.COUNT } )); @@ -1944,11 +1944,11 @@ vimperator.Mappings = function() //{{{ // INSERT mode // {{{ addDefaultMap(new vimperator.Map([vimperator.modes.INSERT, vimperator.modes.COMMAND_LINE], [""], - function() { vimperator.editor.executeCommand("cmd_deleteWordBackward", 1); }, + function () { vimperator.editor.executeCommand("cmd_deleteWordBackward", 1); }, { } )); addDefaultMap(new vimperator.Map([vimperator.modes.INSERT, vimperator.modes.COMMAND_LINE], [""], - function() + function () { // broken in FF3, deletes the whole line: // vimperator.editor.executeCommand("cmd_deleteToBeginningOfLine", 1); @@ -1958,58 +1958,58 @@ vimperator.Mappings = function() //{{{ { } )); addDefaultMap(new vimperator.Map([vimperator.modes.INSERT, vimperator.modes.COMMAND_LINE], [""], - function() { vimperator.editor.executeCommand("cmd_deleteToEndOfLine", 1); }, + function () { vimperator.editor.executeCommand("cmd_deleteToEndOfLine", 1); }, { } )); addDefaultMap(new vimperator.Map([vimperator.modes.INSERT, vimperator.modes.COMMAND_LINE], ["", ""], - function() { vimperator.editor.executeCommand("cmd_beginLine", 1); }, + function () { vimperator.editor.executeCommand("cmd_beginLine", 1); }, { } )); addDefaultMap(new vimperator.Map([vimperator.modes.INSERT, vimperator.modes.COMMAND_LINE], ["", ""], - function() { vimperator.editor.executeCommand("cmd_endLine", 1); }, + function () { vimperator.editor.executeCommand("cmd_endLine", 1); }, { } )); addDefaultMap(new vimperator.Map([vimperator.modes.INSERT, vimperator.modes.COMMAND_LINE], [""], // let firefox handle - function() { vimperator.editor.executeCommand("cmd_deleteCharBackward", 1); }, + function () { vimperator.editor.executeCommand("cmd_deleteCharBackward", 1); }, { } )); addDefaultMap(new vimperator.Map([vimperator.modes.INSERT, vimperator.modes.COMMAND_LINE], [""], - function() { vimperator.editor.executeCommand("cmd_deleteCharForward", 1); }, + function () { vimperator.editor.executeCommand("cmd_deleteCharForward", 1); }, { } )); // addDefaultMap(new vimperator.Map([vimperator.modes.INSERT, vimperator.modes.COMMAND_LINE], [""], -// function() { vimperator.editor.executeCommand("cmd_charPrevious", 1); }, +// function () { vimperator.editor.executeCommand("cmd_charPrevious", 1); }, // { } // )); // addDefaultMap(new vimperator.Map([vimperator.modes.INSERT, vimperator.modes.COMMAND_LINE], [""], -// function() { vimperator.editor.executeCommand("cmd_charNext", 1); }, +// function () { vimperator.editor.executeCommand("cmd_charNext", 1); }, // { } // )); addDefaultMap(new vimperator.Map([vimperator.modes.INSERT, vimperator.modes.COMMAND_LINE], [""], - function() { vimperator.editor.pasteClipboard(); }, + function () { vimperator.editor.pasteClipboard(); }, { } )); - addDefaultMap(new vimperator.Map([vimperator.modes.INSERT, vimperator.modes.TEXTAREA], [""], - function() { vimperator.editor.editWithExternalEditor(); }, + addDefaultMap(new vimperator.Map([vimperator.modes.INSERT, vimperator.modes.TEXTAREA], [""], + function () { vimperator.editor.editWithExternalEditor(); }, { } )); addDefaultMap(new vimperator.Map([vimperator.modes.INSERT, vimperator.modes.TEXTAREA], ["", "", ""], - function() { return vimperator.editor.expandAbbreviation("i"); }, + function () { return vimperator.editor.expandAbbreviation("i"); }, { flags: vimperator.Mappings.flags.ALLOW_EVENT_ROUTING } )); addDefaultMap(new vimperator.Map([vimperator.modes.INSERT, vimperator.modes.TEXTAREA], - ["", ""], function() { vimperator.editor.expandAbbreviation("i"); }, { } + ["", ""], function () { vimperator.editor.expandAbbreviation("i"); }, { } )); //}}} // COMMAND_LINE mode //{{{ addDefaultMap(new vimperator.Map([vimperator.modes.COMMAND_LINE], [""], - function() { return vimperator.editor.expandAbbreviation("c"); }, + function () { return vimperator.editor.expandAbbreviation("c"); }, { flags: vimperator.Mappings.flags.ALLOW_EVENT_ROUTING } )); addDefaultMap(new vimperator.Map([vimperator.modes.COMMAND_LINE], - ["", ""], function() { vimperator.editor.expandAbbreviation("c"); }, { } + ["", ""], function () { vimperator.editor.expandAbbreviation("c"); }, { } )); //}}} diff --git a/content/modes.js b/content/modes.js index e47cc4e4..3805ceb8 100644 --- a/content/modes.js +++ b/content/modes.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.modes = (function() +vimperator.modes = (function () { var main = 1; // NORMAL var extended = 0; // NONE @@ -143,12 +143,12 @@ vimperator.modes = (function() MENU: 1 << 18, // a popupmenu is active LINE: 1 << 19, // linewise visual mode - reset: function(silent) + reset: function (silent) { this.set(vimperator.modes.NORMAL, vimperator.modes.NONE, silent); }, - show: function() + show: function () { if (!vimperator.options["showmode"]) return; @@ -166,7 +166,7 @@ vimperator.modes = (function() // helper function to set both modes in one go // if silent == true, you also need to take care of the mode handling changes yourself - set: function(main_mode, extended_mode, silent) + set: function (main_mode, extended_mode, silent) { // if a main mode is set, the extended is always cleared if (typeof main_mode === "number") @@ -187,12 +187,12 @@ vimperator.modes = (function() }, // add/remove always work on the extended mode only - add: function(mode) + add: function (mode) { extended |= mode; this.show(); }, - remove: function(mode) + remove: function (mode) { extended = (extended | mode) ^ mode; this.show(); diff --git a/content/options.js b/content/options.js index 245663cc..775646af 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 *****/ -vimperator.Option = function(names, type, extra_info) //{{{ +vimperator.Option = function (names, type, extra_info) //{{{ { if (!names || !type) return null; @@ -77,7 +77,7 @@ vimperator.Option = function(names, type, extra_info) //{{{ // NOTE: forced defaults need to use vimperator.options.getPref this.__defineGetter__("value", - function() + function () { if (this.getter) this.getter.call(this); @@ -85,7 +85,7 @@ vimperator.Option = function(names, type, extra_info) //{{{ } ); this.__defineSetter__("value", - function(new_value) + function (new_value) { value = new_value; if (this.setter) @@ -96,7 +96,7 @@ vimperator.Option = function(names, type, extra_info) //{{{ // TODO: add is[Type]() queries for use in set()? // : add isValid() or just throw an exception? - this.hasName = function(name) + this.hasName = function (name) { for (var i = 0; i < this.names.length; i++) { @@ -106,7 +106,7 @@ vimperator.Option = function(names, type, extra_info) //{{{ return false; } - this.isValidValue = function(value) + this.isValidValue = function (value) { if (this.validator) return this.validator(value); @@ -114,13 +114,13 @@ vimperator.Option = function(names, type, extra_info) //{{{ return true; } - this.reset = function() + this.reset = function () { this.value = this.default_value; } } //}}} -vimperator.Options = function() //{{{ +vimperator.Options = function () //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// @@ -312,12 +312,12 @@ vimperator.Options = function() //{{{ ////////////////////// PUBLIC SECTION ////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ - this.__iterator__ = function() + this.__iterator__ = function () { return optionsIterator(); } - this.get = function(name) + this.get = function (name) { for (var i = 0; i < options.length; i++) { @@ -327,14 +327,14 @@ vimperator.Options = function() //{{{ return null; } - this.add = function(option) + this.add = function (option) { - this.__defineGetter__(option.name, function() { return option.value; }); - this.__defineSetter__(option.name, function(value) { option.value = value; }); + 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 if (loadPreference("dom.popup_allowed_events", "change click dblclick mouseup reset submit") @@ -342,7 +342,7 @@ vimperator.Options = function() //{{{ storePreference("dom.popup_allowed_events", popup_allowed_events); } - this.list = function(only_non_default) + this.list = function (only_non_default) { // TODO: columns like Vim? var list = ":" + vimperator.util.escapeHTML(vimperator.commandline.getCommand()) + "
    " + @@ -385,7 +385,7 @@ vimperator.Options = function() //{{{ } // this hack is only needed, because we need to do asynchronous loading of the .vimperatorrc - this.setInitialGUI = function() + this.setInitialGUI = function () { if (!guioptions_done) this.get("guioptions").reset(); @@ -397,22 +397,22 @@ vimperator.Options = function() //{{{ // TODO: separate Preferences from Options? Would these utility functions // be better placed in the 'core' vimperator namespace somewhere? - this.setPref = function(name, value) + this.setPref = function (name, value) { return storePreference(name, value, true); } - this.getPref = function(name, forced_default) + this.getPref = function (name, forced_default) { return loadPreference(name, forced_default, true); } - this.setFirefoxPref = function(name, value) + this.setFirefoxPref = function (name, value) { return storePreference(name, value); } - this.getFirefoxPref = function(name, forced_default) + this.getFirefoxPref = function (name, forced_default) { return loadPreference(name, forced_default); } @@ -437,9 +437,9 @@ vimperator.Options = function() //{{{ "
  • paste: P and gP mappings
  • " + "", default_value: "homepage,quickmark,tabopen,paste", - validator: function(value) + validator: function (value) { - return value.split(",").every(function(item) { return /^(homepage|quickmark|tabopen|paste|)$/.test(item); }); + return value.split(",").every(function (item) { return /^(homepage|quickmark|tabopen|paste|)$/.test(item); }); } } )); @@ -456,7 +456,7 @@ vimperator.Options = function() //{{{ "The order is important, so :set complete=bs would list bookmarks first, and then any available quick searches.
    " + "Add 'sort' to the 'wildoptions' option if you want all entries sorted.", default_value: "sfbh", - validator: function(value) { return !/[^sfbh]/.test(value); } + validator: function (value) { return !/[^sfbh]/.test(value); } } )); this.add(new vimperator.Option(["defsearch", "ds"], "string", @@ -464,7 +464,7 @@ vimperator.Options = function() //{{{ short_help: "Set the default search engine", help: "The default search engine is used in the :[tab]open [arg] command " + "if [arg] neither looks like a URL or like a specified search engine/keyword.", - completer: function() { return [["foo", "bar"], ["shit", "blub"]]; }, + completer: function () { return [["foo", "bar"], ["shit", "blub"]]; }, default_value: "google" } )); @@ -494,8 +494,8 @@ vimperator.Options = function() //{{{ this.add(new vimperator.Option(["fullscreen", "fs"], "boolean", { short_help: "Show the current window fullscreen", - setter: function(value) { window.fullScreen = value; }, - getter: function() { return window.fullScreen; }, + setter: function (value) { window.fullScreen = value; }, + getter: function () { return window.fullScreen; }, default_value: false } )); @@ -508,9 +508,9 @@ vimperator.Options = function() //{{{ "
  • T: toolbar
  • " + "
  • b: bookmark bar
  • " + "", - setter: function(value) { setGuiOptions(value); }, + setter: function (value) { setGuiOptions(value); }, default_value: "", - validator: function(value) { return !/[^mTb]/.test(value); } + validator: function (value) { return !/[^mTb]/.test(value); } } )); this.add(new vimperator.Option(["hinttimeout", "hto"], "number", @@ -518,7 +518,7 @@ vimperator.Options = function() //{{{ short_help: "Automatically follow non unique numerical hint after {arg} ms", help: "Set to 0 (the default) to only follow numeric hints after pressing <Return> or when the hint is unique.", default_value: 0, - validator: function(value) { return value >= 0; } + validator: function (value) { return value >= 0; } } )); this.add(new vimperator.Option(["hintstyle", "hs"], "string", @@ -537,7 +537,7 @@ vimperator.Options = function() //{{{ 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(); }, + setter: function (value) { if (value) vimperator.search.highlight(); else vimperator.search.clear(); }, default_value: false } )); @@ -580,8 +580,8 @@ vimperator.Options = function() //{{{ "" + "NOTE: laststatus=1 not implemented yet.", default_value: 2, - setter: function(value) { setLastStatus(value); }, - validator: function(value) { return (value >= 0 && value <= 2); } + setter: function (value) { setLastStatus(value); }, + validator: function (value) { return (value >= 0 && value <= 2); } } )); this.add(new vimperator.Option(["linksearch", "lks"], "boolean", @@ -624,8 +624,8 @@ vimperator.Options = function() //{{{ "" + "NOTE: This option does not change the popup blocker of Firefox in any way.", default_value: 1, - setter: function(value) { setPopups(value); }, - validator: function(value) { return (value >= 0 && value <= 3); } + setter: function (value) { setPopups(value); }, + validator: function (value) { return (value >= 0 && value <= 3); } } )); this.add(new vimperator.Option(["preload"], "boolean", @@ -643,7 +643,7 @@ vimperator.Options = function() //{{{ "Close the preview window with :pclose.
    " + "NOTE: Option currently disabled", default_value: 10, - validator: function(value) { return (value >= 1 && value <= 50); } + validator: function (value) { return (value >= 1 && value <= 50); } } )); this.add(new vimperator.Option(["scroll", "scr"], "number", @@ -653,7 +653,7 @@ vimperator.Options = function() //{{{ "When a {count} is specified to the <C-u> or <C-d> commands this is used to set the value of 'scroll' and also used for the current command. " + "The value can be reset to half the window height with :set scroll=0.", default_value: 0, - validator: function(value) { return value >= 0; } + validator: function (value) { return value >= 0; } } )); this.add(new vimperator.Option(["showmode", "smd"], "boolean", @@ -673,7 +673,7 @@ vimperator.Options = function() //{{{ "
  • 2: Show the link in the command line
  • " + "", default_value: 1, - validator: function(value) { return (value >= 0 && value <= 2); } + validator: function (value) { return (value >= 0 && value <= 2); } } )); this.add(new vimperator.Option(["showtabline", "stal"], "number", @@ -685,9 +685,9 @@ vimperator.Options = function() //{{{ "
  • 1: Show tab bar only if more than one tab is open
  • " + "
  • 2: Always show tab bar
  • " + "", - setter: function(value) { setShowTabline(value); }, + setter: function (value) { setShowTabline(value); }, default_value: 2, - validator: function(value) { return (value >= 0 && value <= 2); } + validator: function (value) { return (value >= 0 && value <= 2); } } )); this.add(new vimperator.Option(["smartcase", "scs"], "boolean", @@ -703,7 +703,7 @@ vimperator.Options = function() //{{{ help: "Vimperator changes the browser title from \"Title of web page - Mozilla Firefox\" to " + "\"Title of web page - Vimperator\".
    If you don't like that, you can restore it with: " + ":set titlestring=Mozilla Firefox.", - setter: function(value) { setTitleString(value); }, + setter: function (value) { setTitleString(value); }, default_value: "Vimperator" } )); @@ -711,8 +711,8 @@ vimperator.Options = function() //{{{ { 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", - setter: function(value) { getMarkupDocumentViewer().authorStyleDisabled = value; }, - getter: function() { return getMarkupDocumentViewer().authorStyleDisabled; }, + setter: function (value) { getMarkupDocumentViewer().authorStyleDisabled = value; }, + getter: function () { return getMarkupDocumentViewer().authorStyleDisabled; }, default_value: false } )); @@ -722,13 +722,13 @@ vimperator.Options = function() //{{{ 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!.
    " + "The highest value is 9, being the most verbose mode.", default_value: 0, - validator: function(value) { return (value >= 0 && value <= 9); } + validator: function (value) { return (value >= 0 && value <= 9); } } )); 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); }, + setter: function (value) { vimperator.options.setFirefoxPref("accessibility.typeaheadfind.enablesound", !value); }, default_value: false } )); @@ -750,9 +750,9 @@ vimperator.Options = function() //{{{ "" + "When there is only a single match, it is fully completed regardless of the case.", default_value: "list:full", - validator: function(value) + validator: function (value) { - return value.split(",").every(function(item) { return /^(full|longest|list|list:full|list:longest|)$/.test(item); }); + return value.split(",").every(function (item) { return /^(full|longest|list|list:full|list:longest|)$/.test(item); }); } } )); @@ -765,7 +765,7 @@ vimperator.Options = function() //{{{ "sortAlways sorts completion list, overriding the 'complete' option." + "", default_value: "", - validator: function(value) { return /^sort$/.test(value); } + validator: function (value) { return /^sort$/.test(value); } } )); //}}} diff --git a/content/tabs.js b/content/tabs.js index 8016fb8a..3e761fae 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 */ -vimperator.Tabs = function() //{{{ +vimperator.Tabs = function () //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// @@ -87,7 +87,7 @@ vimperator.Tabs = function() //{{{ /////////////////////////////////////////////////////////////////////////////{{{ // @returns the index of the currently selected tab starting with 0 - this.index = function(tab) + this.index = function (tab) { if (tab) { @@ -103,14 +103,14 @@ vimperator.Tabs = function() //{{{ return getBrowser().tabContainer.selectedIndex; } - this.count = function() + this.count = function () { return getBrowser().mTabs.length; } // TODO: implement filter // @returns an array of tabs which match filter - this.get = function(filter) + this.get = function (filter) { var buffers = []; var browsers = getBrowser().browsers; @@ -124,7 +124,7 @@ vimperator.Tabs = function() //{{{ return buffers; } - this.getTab = function(index) + this.getTab = function (index) { if (index) return getBrowser().mTabs[index]; @@ -137,7 +137,7 @@ vimperator.Tabs = function() //{{{ * NOTE: position is a 0 based index * FIXME: tabmove! N should probably produce an error */ - this.move = function(tab, spec, wrap) + this.move = function (tab, spec, wrap) { if (spec === "") spec = "$"; // if not specified, move to the last tab -> XXX: move to ex handling? @@ -149,7 +149,7 @@ vimperator.Tabs = function() //{{{ /* quit_on_last_tab = 1: quit without saving session * quit_on_last_tab = 2: quit and save session */ - this.remove = function(tab, count, focus_left_tab, quit_on_last_tab) + this.remove = function (tab, count, focus_left_tab, quit_on_last_tab) { function removeOrBlankTab (tab) { @@ -203,12 +203,12 @@ vimperator.Tabs = function() //{{{ } } - this.keepOnly = function(tab) + this.keepOnly = function (tab) { getBrowser().removeAllTabsBut(tab); } - this.select = function(spec, wrap) + this.select = function (spec, wrap) { var index = indexFromSpec(spec, wrap); if (index === false) @@ -223,7 +223,7 @@ vimperator.Tabs = function() //{{{ // tab that was selected when the session was created. As a result the // alternate after a restart is often incorrectly tab 1 when there // shouldn't be one yet. - this.updateSelectionHistory = function() + this.updateSelectionHistory = function () { alternates = [this.getTab(), alternates[0]]; this.alternate = alternates[1]; @@ -232,7 +232,7 @@ vimperator.Tabs = function() //{{{ // TODO: move to v.buffers this.alternate = this.getTab(); - this.reload = function(tab, bypass_cache) + this.reload = function (tab, bypass_cache) { if (bypass_cache) { @@ -246,7 +246,7 @@ vimperator.Tabs = function() //{{{ } } - this.reloadAll = function(bypass_cache) + this.reloadAll = function (bypass_cache) { if (bypass_cache) { diff --git a/content/ui.js b/content/ui.js index 9ded0416..f0e9b1b8 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 */ -vimperator.CommandLine = function() //{{{ +vimperator.CommandLine = function () //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// @@ -51,22 +51,22 @@ vimperator.CommandLine = function() //{{{ cmd: null, // ex command history search: null, // text search history - get: function() { return this[this._mode]; }, - set: function(lines) { this[this._mode] = lines; }, + get: function () { return this[this._mode]; }, + set: function (lines) { this[this._mode] = lines; }, - load: function() + load: function () { this.cmd = vimperator.options.getPref("commandline_cmd_history", "").split("\n"); this.search = vimperator.options.getPref("commandline_search_history", "").split("\n"); }, - save: function() + save: function () { vimperator.options.setPref("commandline_cmd_history", this.cmd.join("\n")); vimperator.options.setPref("commandline_search_history", this.search.join("\n")); }, - add: function(str) + add: function (str) { if (!str) return; @@ -74,7 +74,7 @@ vimperator.CommandLine = function() //{{{ var lines = this.get(); // remove all old history lines which have this string - lines = lines.filter(function(line) { + lines = lines.filter(function (line) { return line != str; }); @@ -251,12 +251,12 @@ vimperator.CommandLine = function() //{{{ // FORCE_MULTILINE is given, FORCE_MULTILINE takes precedence this.APPEND_TO_MESSAGES = 1 << 3; // will show the string in :messages - this.getCommand = function() + this.getCommand = function () { return command_widget.value; }; - this.open = function(prompt, cmd, ext_mode) + this.open = function (prompt, cmd, ext_mode) { // save the current prompts, we need it later if the command widget // receives focus without calling the this.open() method @@ -279,7 +279,7 @@ vimperator.CommandLine = function() //{{{ }; // normally used when pressing esc, does not execute a command - this.close = function() + this.close = function () { var res = vimperator.triggerCallback("cancel", cur_extended_mode); history.add(this.getCommand()); @@ -287,7 +287,7 @@ vimperator.CommandLine = function() //{{{ this.clear(); } - this.clear = function() + this.clear = function () { multiline_input_widget.collapsed = true; multiline_output_widget.collapsed = true; @@ -298,7 +298,7 @@ vimperator.CommandLine = function() //{{{ // TODO: add :messages entry // vimperator.echo uses different order of flags as it omits the hightlight group, change v.commandline.echo argument order? --mst - this.echo = function(str, highlight_group, flags) + this.echo = function (str, highlight_group, flags) { var focused = document.commandDispatcher.focusedElement; if (focused && focused == command_widget.inputField || focused == multiline_input_widget.inputField) @@ -331,7 +331,7 @@ vimperator.CommandLine = function() //{{{ // this will prompt the user for a string // vimperator.commandline.input("(s)ave or (o)pen the file?") - this.input = function(str) + this.input = function (str) { // TODO: unfinished, need to find out how/if we can block the execution of code // to make this code synchronous or at least use a callback @@ -342,7 +342,7 @@ vimperator.CommandLine = function() //{{{ // reads a multi line input and returns the string once the last line matches // @param until_regexp - this.inputMultiline = function(until_regexp, callback_func) + this.inputMultiline = function (until_regexp, callback_func) { // save the mode, because we need to restore it old_mode = vimperator.mode; @@ -357,19 +357,19 @@ vimperator.CommandLine = function() //{{{ multiline_input_widget.value = ""; autosizeMultilineInputWidget(); - setTimeout(function() { + setTimeout(function () { multiline_input_widget.focus(); }, 10); }; - this.onEvent = function(event) + this.onEvent = function (event) { var command = this.getCommand(); if (event.type == "blur") { // prevent losing focus, there should be a better way, but it just didn't work otherwise - setTimeout(function() { + setTimeout(function () { if (vimperator.mode == vimperator.modes.COMMAND_LINE && !(vimperator.modes.extended & vimperator.modes.INPUT_MULTILINE) && !(vimperator.modes.extended & vimperator.modes.OUTPUT_MULTILINE)) @@ -484,7 +484,7 @@ vimperator.CommandLine = function() //{{{ // sort the completion list if (vimperator.options["wildoptions"].search(/\bsort\b/) > -1) { - completions.sort(function(a, b) { + completions.sort(function (a, b) { if (a[0] < b[0]) return -1; else if (a[0] > b[0]) @@ -598,7 +598,7 @@ vimperator.CommandLine = function() //{{{ } } - this.onMultilineInputEvent = function(event) + this.onMultilineInputEvent = function (event) { if (event.type == "keypress") { @@ -623,7 +623,7 @@ vimperator.CommandLine = function() //{{{ else if (event.type == "blur") { if (vimperator.modes.extended & vimperator.modes.INPUT_MULTILINE) - setTimeout(function() { multiline_input_widget.inputField.focus(); }, 0); + setTimeout(function () { multiline_input_widget.inputField.focus(); }, 0); } else if (event.type == "input") { @@ -633,7 +633,7 @@ vimperator.CommandLine = function() //{{{ // FIXME: if 'more' is set and the MOW is not scrollable we should still // allow a down motion after an up rather than closing - this.onMultilineOutputEvent = function(event) + this.onMultilineOutputEvent = function (event) { var win = multiline_output_widget.contentWindow; @@ -829,7 +829,7 @@ vimperator.CommandLine = function() //{{{ } // it would be better if we had a destructor in javascript ... - this.destroy = function() + this.destroy = function () { history.save(); } @@ -842,7 +842,7 @@ vimperator.CommandLine = function() //{{{ * @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 */ -vimperator.InformationList = function(id, options) //{{{ +vimperator.InformationList = function (id, options) //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// @@ -942,7 +942,7 @@ vimperator.InformationList = function(id, options) //{{{ * use entries of 'compl' to fill the list. * Required format: [["left", "right"], ["another"], ["completion"]] */ - this.show = function(compl) + this.show = function (compl) { //max_items = vimperator.options["previewheight"]; @@ -968,12 +968,12 @@ vimperator.InformationList = function(id, options) //{{{ } } - this.hide = function() + this.hide = function () { widget.hidden = true; } - this.visible = function() + this.visible = function () { return !widget.hidden; } @@ -981,7 +981,7 @@ vimperator.InformationList = function(id, options) //{{{ /** * select index, refill list if necessary */ - this.selectItem = function(index) + this.selectItem = function (index) { if (widget.hidden) return; @@ -1029,7 +1029,7 @@ vimperator.InformationList = function(id, options) //{{{ widget.selectedIndex = index - list_offset; } - this.onEvent = function(event) + this.onEvent = function (event) { var listcells = document.getElementsByTagName("listcell"); // 2 columns for now, use the first column @@ -1045,7 +1045,7 @@ vimperator.InformationList = function(id, options) //{{{ //}}} } //}}} -vimperator.StatusLine = function() //{{{ +vimperator.StatusLine = function () //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// @@ -1065,7 +1065,7 @@ vimperator.StatusLine = function() //{{{ ////////////////////// PUBLIC SECTION ////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ - this.setClass = function(type) + this.setClass = function (type) { var highlight_group; @@ -1086,7 +1086,7 @@ vimperator.StatusLine = function() //{{{ }; // update all fields of the statusline - this.update = function() + this.update = function () { this.updateUrl(); this.updateInputBuffer(); @@ -1096,7 +1096,7 @@ vimperator.StatusLine = function() //{{{ } // if "url" is ommited, build a usable string for the URL - this.updateUrl = function(url) + this.updateUrl = function (url) { if (typeof url == "string") { @@ -1130,7 +1130,7 @@ vimperator.StatusLine = function() //{{{ url_widget.value = url; }; - this.updateInputBuffer = function(buffer) + this.updateInputBuffer = function (buffer) { if (!buffer || typeof buffer != "string") buffer = ""; @@ -1138,7 +1138,7 @@ vimperator.StatusLine = function() //{{{ inputbuffer_widget.value = buffer; }; - this.updateProgress = function(progress) + this.updateProgress = function (progress) { if (!progress) progress = ""; @@ -1169,7 +1169,7 @@ vimperator.StatusLine = function() //{{{ }; // you can omit either of the 2 arguments - this.updateTabCount = function(cur_index, total_tabs) + this.updateTabCount = function (cur_index, total_tabs) { if (!cur_index || typeof cur_index != "number") cur_index = vimperator.tabs.index() + 1; @@ -1180,7 +1180,7 @@ vimperator.StatusLine = function() //{{{ }; // percent is given between 0 and 1 - this.updateBufferPosition = function(percent) + this.updateBufferPosition = function (percent) { if (!percent || typeof percent != "number") { @@ -1189,7 +1189,7 @@ vimperator.StatusLine = function() //{{{ } var bufferposition_str = ""; - percent = Math.round(percent*100); + percent = Math.round(percent * 100); if (percent < 0) bufferposition_str = "All"; else if (percent == 0) bufferposition_str = "Top"; else if (percent < 10) bufferposition_str = " " + percent + "%"; diff --git a/content/util.js b/content/util.js index 11ccd6a6..5f4c9fb3 100644 --- a/content/util.js +++ b/content/util.js @@ -27,8 +27,8 @@ the terms of any one of the MPL, the GPL or the LGPL. }}} ***** END LICENSE BLOCK *****/ vimperator.util = { - escapeHTML: function(str) - { + escapeHTML: function (str) + { // XXX: the following code is _much_ slower than a simple .replace() // :history display went down from 2 to 1 second after changing // @@ -41,7 +41,7 @@ vimperator.util = { // TODO: use :highlight color groups // if "process_strings" is true, any passed strings will be surrounded by " and // any line breaks are displayed as \n - colorize: function(arg, process_strings) + colorize: function (arg, process_strings) { var type = typeof(arg); @@ -58,7 +58,7 @@ vimperator.util = { arg = '"' + vimperator.util.escapeHTML(arg.replace(/\n/, "\\n")) + '"'; return "" + arg + ""; - } + } else if (type == "boolean") { return "" + arg + ""; @@ -69,9 +69,9 @@ vimperator.util = { } else if (type == "object" || type == "function") { - // for java packages value.toString() would crash so badly + // for java packages value.toString() would crash so badly // that we cannot even try/catch it - if (/^\[JavaPackage.*\]$/.test(arg)) + if (/^\[JavaPackage.*\]$/.test(arg)) return "[JavaPackage]"; var str = arg.toString(); @@ -91,7 +91,7 @@ vimperator.util = { // takes a string like 'google bla, www.osnews.com' // and returns an array ['www.google.com/search?q=bla', 'www.osnews.com'] - stringToURLArray: function(str) + stringToURLArray: function (str) { var urls = str.split(/\s*\,\s+/); @@ -166,15 +166,15 @@ vimperator.util = { return urls; }, - highlightURL: function(str, force) + highlightURL: function (str, force) { if (force || /^[a-zA-Z]+:\/\/.*\//.test(str)) return "" + vimperator.util.escapeHTML(str) + ""; - else + else return str; }, - formatNumber: function(num) + formatNumber: function (num) { var strNum = (num + "").split(".", 2); diff --git a/content/vimperator.js b/content/vimperator.js index 90808978..1b5b1452 100644 --- a/content/vimperator.js +++ b/content/vimperator.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 *****/ -const vimperator = (function() //{{{ +const vimperator = (function () //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// @@ -72,13 +72,13 @@ const vimperator = (function() //{{{ // "cancel" // "complete" // TODO: "zoom": if the zoom value of the current buffer changed - registerCallback: function(type, mode, func) + registerCallback: function (type, mode, func) { // TODO: check if callback is already registered callbacks.push([type, mode, func]); }, - triggerCallback: function(type, mode, data) + triggerCallback: function (type, mode, data) { // dump("type: " + type + " mode: " + mode + "data: " + data + "\n"); for (var i in callbacks) @@ -90,7 +90,7 @@ const vimperator = (function() //{{{ return false; }, - beep: function() + beep: function () { if (vimperator.options["visualbell"]) { @@ -102,7 +102,7 @@ const vimperator = (function() //{{{ popup.height = box.height; popup.width = box.width; popup.openPopup(win, "overlap", 0, 0, false, false); - setTimeout(function() { popup.hidePopup(); }, 50); + setTimeout(function () { popup.hidePopup(); }, 50); } else { @@ -110,14 +110,14 @@ const vimperator = (function() //{{{ } }, - copyToClipboard: function(str) + copyToClipboard: function (str) { var clipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"] .getService(Components.interfaces.nsIClipboardHelper); clipboardHelper.copyString(str); }, - execute: function(str, modifiers) + execute: function (str, modifiers) { // skip comments and blank lines if (/^\s*("|$)/.test(str)) @@ -149,7 +149,7 @@ const vimperator = (function() //{{{ // after pressing Escape, put focus on a non-input field of the browser document // if clearFocusedElement, also blur a focused link - focusContent: function(clearFocusedElement) + focusContent: function (clearFocusedElement) { var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]. getService(Components.interfaces.nsIWindowWatcher); @@ -161,7 +161,7 @@ const vimperator = (function() //{{{ }, // partial sixth level expression evaluation - eval: function(string) + eval: function (string) { string = string.toString().replace(/^\s*/, "").replace(/\s*$/, ""); var match = string.match(/^&(\w+)/); @@ -207,7 +207,7 @@ const vimperator = (function() //{{{ return; }, - variableReference: function(string) + variableReference: function (string) { if (!string) return [null, null, null]; @@ -235,7 +235,7 @@ const vimperator = (function() //{{{ // TODO: move to vimp.util.? --mst // if color = true it uses HTML markup to color certain items - objectToString: function(object, color) + objectToString: function (object, color) { if (object === null) return "null"; @@ -286,7 +286,7 @@ const vimperator = (function() //{{{ // logs a message to the javascript error console // if msg is an object, it is beautified - log: function(msg, level) + log: function (msg, level) { //if (vimperator.options.getPref("verbose") >= level) // FIXME: hangs vimperator, probably timing issue --mst if (typeof msg == "object") @@ -305,7 +305,7 @@ const vimperator = (function() //{{{ // @param callback: not implemented, will be allowed to specify a callback function // which is called, when the page finished loading // @returns true when load was initiated, or false on error - open: function(urls, where, callback) + open: function (urls, where, callback) { // convert the string to an array of converted URLs // -> see vimperator.util.stringToURLArray for more details @@ -365,7 +365,7 @@ const vimperator = (function() //{{{ }, // quit vimperator, no matter how many tabs/windows are open - quit: function(save_session) + quit: function (save_session) { if (save_session) vimperator.options.setFirefoxPref("browser.startup.page", 3); // start with saved session @@ -375,7 +375,7 @@ const vimperator = (function() //{{{ goQuitApplication(); }, - restart: function() + restart: function () { const nsIAppStartup = Components.interfaces.nsIAppStartup; @@ -407,7 +407,7 @@ const vimperator = (function() //{{{ .quit(nsIAppStartup.eRestart | nsIAppStartup.eAttemptQuit); }, - run: function(program, args, blocking) + run: function (program, args, blocking) { var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile); const WINDOWS = navigator.platform == "Win32"; @@ -446,7 +446,7 @@ const vimperator = (function() //{{{ var process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess); process.init(file); - + var ec = process.run(blocking, args, args.length); return ec; }, @@ -487,15 +487,15 @@ const vimperator = (function() //{{{ filein.remove(false); // if there is only one \n at the end, chop it off - if (output && output.indexOf("\n") == output.length-1) - output = output.substr(0, output.length-1); + if (output && output.indexOf("\n") == output.length - 1) + output = output.substr(0, output.length - 1); return output; }, // files which end in .js are sourced as pure javascript files, // no need (actually forbidden) to add: js <