diff --git a/content/buffers.js b/content/buffers.js index c3f85bb4..28de7a59 100644 --- a/content/buffers.js +++ b/content/buffers.js @@ -793,7 +793,7 @@ vimperator.Buffer = function () //{{{ relText = new RegExp(relationship, "i"); var elems = window.content.document.getElementsByTagName("link"); - // links have higher priority than normal hrefs + // links have higher priority than normal hrefs for (var i = 0; i < elems.length; i++) { if (relText.test(elems[i].rel)) @@ -815,7 +815,7 @@ vimperator.Buffer = function () //{{{ vimperator.buffer.followLink(elems[i], vimperator.CURRENT_TAB); return; } - else + else { // images with alt text being href var children = elems[i].childNodes; diff --git a/content/commands.js b/content/commands.js index 32c985d1..5773c4d2 100644 --- a/content/commands.js +++ b/content/commands.js @@ -673,7 +673,7 @@ vimperator.Commands = function () //{{{ case "import": BrowserImport(); break; case "openfile": BrowserOpenFileWindow(); break; case "pageinfo": BrowserPageInfo(); break; - case "pagesource": BrowserViewSourceOfDocument(content.document); break; + case "pagesource": BrowserViewSourceOfDocument(content.document); break; case "places": PlacesCommandHook.showPlacesOrganizer(ORGANIZER_ROOT_BOOKMARKS); break; case "preferences": openPreferences(); break; // XXX what are onEnter.. and onExit...? diff --git a/content/completion.js b/content/completion.js index eaa8815e..3b485019 100644 --- a/content/completion.js +++ b/content/completion.js @@ -26,14 +26,18 @@ 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 () //{{{ { + //////////////////////////////////////////////////////////////////////////////// + ////////////////////// PRIVATE SECTION ///////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////{{{ + // the completion substrings, used for showing the longest common match var substrings = []; // function uses smartcase // list = [ [['com1', 'com2'], 'text'], [['com3', 'com4'], 'text'] ] - function buildLongestCommonSubstring(list, filter) //{{{ + function buildLongestCommonSubstring(list, filter) { var filtered = []; var ignorecase = false; @@ -72,10 +76,10 @@ vimperator.Completion = function () // {{{ } } return filtered; - } //}}} + } // this function is case sensitive and should be documented about input and output ;) - function buildLongestStartingSubstring(list, filter) //{{{ + function buildLongestStartingSubstring(list, filter) { var filtered = []; for (var i = 0; i < list.length; i++) @@ -102,13 +106,17 @@ vimperator.Completion = function () // {{{ } } return filtered; - } //}}} + } + + /////////////////////////////////////////////////////////////////////////////}}} + ////////////////////// PUBLIC SECTION ////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////{{{ return { // returns the longest common substring // used for the 'longest' setting for wildmode - getLongestSubstring: function () //{{{ + getLongestSubstring: function () { if (substrings.length == 0) return ""; @@ -120,9 +128,9 @@ vimperator.Completion = function () // {{{ longest = substrings[i]; } return longest; - }, //}}} + }, - dialog: function (filter) //{{{ + dialog: function (filter) { substrings = []; var nodes = [ @@ -155,14 +163,14 @@ vimperator.Completion = function () // {{{ }); return buildLongestCommonSubstring(mapped, filter); - }, //}}} + }, // filter a list of urls // // may consist of searchengines, filenames, bookmarks and history, // depending on the 'complete' option // if the 'complete' argument is passed like "h", it temporarily overrides the complete option - url: function (filter, complete) //{{{ + url: function (filter, complete) { var completions = []; substrings = []; @@ -182,9 +190,9 @@ vimperator.Completion = function () // {{{ } return completions; - }, //}}} + }, - search: function (filter) //{{{ + search: function (filter) { var engines = vimperator.bookmarks.getSearchEngines().concat(vimperator.bookmarks.getKeywords()); @@ -195,7 +203,7 @@ vimperator.Completion = function () // {{{ return [[engine[0]], engine[1]]; }); return buildLongestCommonSubstring(mapped, filter); - }, //}}} + }, // TODO: support file:// and \ or / path separators on both platforms file: function (filter) @@ -230,7 +238,7 @@ vimperator.Completion = function () // {{{ return buildLongestStartingSubstring(mapped, filter); }, - help: function (filter) //{{{ + help: function (filter) { var helpArray = [[["introduction"], "Introductory text"], [["initialization"], "Initialization and startup"], @@ -255,9 +263,9 @@ vimperator.Completion = function () // {{{ }); return buildLongestCommonSubstring(helpArray, filter); - }, //}}} + }, - command: function (filter) //{{{ + command: function (filter) { substrings = []; var completions = []; @@ -271,9 +279,9 @@ vimperator.Completion = function () // {{{ for (var command in vimperator.commands) completions.push([command.longNames, command.shortHelp]); return buildLongestStartingSubstring(completions, filter); - }, //}}} + }, - option: function (filter, unfiltered) //{{{ + option: function (filter, unfiltered) { substrings = []; var optionCompletions = []; @@ -350,9 +358,9 @@ vimperator.Completion = function () // {{{ } return optionCompletions; - }, //}}} + }, - buffer: function (filter) //{{{ + buffer: function (filter) { substrings = []; var items = []; @@ -386,9 +394,9 @@ vimperator.Completion = function () // {{{ return [$_[0][0], $_[1]]; }); return buildLongestCommonSubstring(items, filter); - }, //}}} + }, - sidebar: function (filter) //{{{ + sidebar: function (filter) { substrings = []; var menu = document.getElementById("viewSidebarMenu"); @@ -405,9 +413,9 @@ vimperator.Completion = function () // {{{ }); return buildLongestCommonSubstring(mapped, filter); - }, //}}} + }, - javascript: function (str) // {{{ + javascript: function (str) { substrings = []; var matches = str.match(/^(.*?)(\s*\.\s*)?(\w*)$/); @@ -481,12 +489,12 @@ vimperator.Completion = function () // {{{ } return buildLongestStartingSubstring(completions, filter); - }, // }}} + }, // 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 @@ -578,7 +586,7 @@ vimperator.Completion = function () // {{{ } return filtered.concat(additionalCompletions); - }, //}}} + }, // generic helper function which checks if the given "items" array pass "filter" // items must be an array of strings @@ -601,7 +609,7 @@ vimperator.Completion = function () // {{{ }, // FIXME: rename - exTabCompletion: function (str) //{{{ + exTabCompletion: function (str) { var [count, cmd, special, args] = vimperator.commands.parseCommand(str); var completions = []; @@ -644,9 +652,10 @@ vimperator.Completion = function () // {{{ } } return [start, completions]; - } //}}} + } }; -}; // }}} + //}}} +}; //}}} // vim: set fdm=marker sw=4 ts=4 et: diff --git a/content/editor.js b/content/editor.js index 27872b0d..b7e68334 100644 --- a/content/editor.js +++ b/content/editor.js @@ -31,6 +31,10 @@ the terms of any one of the MPL, the GPL or the LGPL. vimperator.Editor = function () //{{{ { + //////////////////////////////////////////////////////////////////////////////// + ////////////////////// PRIVATE SECTION ///////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////{{{ + // store our last search with f, F, t or T var lastFindChar = null; var lastFindCharFunc = null; @@ -50,6 +54,10 @@ vimperator.Editor = function () //{{{ return ed.controllers.getControllerForCommand("cmd_beginLine"); } + /////////////////////////////////////////////////////////////////////////////}}} + ////////////////////// PUBLIC SECTION ////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////{{{ + return { line: function () @@ -248,7 +256,7 @@ vimperator.Editor = function () //{{{ { this.executeCommand("cmd_selectCharNext", 1); } - while ( editor().selectionEnd != pos ); + while (editor().selectionEnd != pos); } else { @@ -259,7 +267,7 @@ vimperator.Editor = function () //{{{ { this.executeCommand("cmd_selectCharPrevious", 1); } - while ( editor().selectionStart != pos ); + while (editor().selectionStart != pos); } }, @@ -589,8 +597,8 @@ vimperator.Editor = function () //{{{ } } - vimperator.echoerr("E24: No such abbreviation"); - return false; + vimperator.echoerr("E24: No such abbreviation"); + return false; }, removeAllAbbreviations: function (filter) @@ -640,9 +648,10 @@ vimperator.Editor = function () //{{{ } } return true; - } //}}} - + } + //}}} }; + //}}} }; //}}} // vim: set fdm=marker sw=4 ts=4 et: diff --git a/content/events.js b/content/events.js index 91944ff1..8eb9130b 100644 --- a/content/events.js +++ b/content/events.js @@ -186,7 +186,7 @@ vimperator.Events = function () //{{{ var tagname = elt.localName.toLowerCase(); var type = elt.type.toLowerCase(); - if ( (tagname == "input" && (type != "image")) || + if ((tagname == "input" && (type != "image")) || tagname == "textarea" || // tagName == "SELECT" || // tagName == "BUTTON" || diff --git a/content/find.js b/content/find.js index 06925712..d56d7944 100644 --- a/content/find.js +++ b/content/find.js @@ -39,6 +39,10 @@ the terms of any one of the MPL, the GPL or the LGPL. // make sure you only create this object when the "vimperator" object is ready vimperator.Search = function () //{{{ { + //////////////////////////////////////////////////////////////////////////////// + ////////////////////// PRIVATE SECTION ///////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////{{{ + // FIXME: //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 @@ -105,6 +109,10 @@ vimperator.Search = function () //{{{ searchString = pattern; } + /////////////////////////////////////////////////////////////////////////////}}} + ////////////////////// PUBLIC SECTION ////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////{{{ + return { // Called when the search dialog is asked for @@ -260,6 +268,7 @@ vimperator.Search = function () //{{{ } }; + //}}} }; //}}} // vim: set fdm=marker sw=4 ts=4 et: diff --git a/content/hints.js b/content/hints.js index e1cd0501..a032ea29 100644 --- a/content/hints.js +++ b/content/hints.js @@ -41,8 +41,8 @@ vimperator.Hints = function () //{{{ var hints = []; var validHints = []; // 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 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 @@ -69,7 +69,7 @@ vimperator.Hints = function () //{{{ function updateStatusline() { - vimperator.statusline.updateInputBuffer((escapeNumbers ? "\\ ": "" ) + // sign for escapeNumbers + vimperator.statusline.updateInputBuffer((escapeNumbers ? "\\ ": "") + // sign for escapeNumbers (hintString ? "\"" + hintString + "\"" : "") + (hintNumber > 0 ? " <" + hintNumber + ">" : "")); } diff --git a/content/io.js b/content/io.js index a0c400b1..dab6f4ca 100644 --- a/content/io.js +++ b/content/io.js @@ -27,11 +27,19 @@ 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 ()//{{{ { + //////////////////////////////////////////////////////////////////////////////// + ////////////////////// PRIVATE SECTION ///////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////{{{ + var environmentService = Components.classes["@mozilla.org/process/environment;1"] .getService(Components.interfaces.nsIEnvironment); + /////////////////////////////////////////////////////////////////////////////}}} + ////////////////////// PUBLIC SECTION ////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////{{{ + return { MODE_RDONLY: 0x01, @@ -235,6 +243,7 @@ vimperator.IO = function () ofstream.close(); } }; -}; + //}}} +};//}}} // vim: set fdm=marker sw=4 ts=4 et: diff --git a/content/modes.js b/content/modes.js index 1d149551..4df7856b 100644 --- a/content/modes.js +++ b/content/modes.js @@ -26,8 +26,12 @@ 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 ()//{{{ { + //////////////////////////////////////////////////////////////////////////////// + ////////////////////// PRIVATE SECTION ///////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////{{{ + var main = 1; // NORMAL var extended = 0; // NONE @@ -123,6 +127,10 @@ vimperator.modes = (function () } } + /////////////////////////////////////////////////////////////////////////////}}} + ////////////////////// PUBLIC SECTION ////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////{{{ + return { // main modes, only one should ever be active @@ -224,6 +232,7 @@ vimperator.modes = (function () } }; -})(); + //}}} +})();//}}} // vim: set fdm=marker sw=4 ts=4 et: diff --git a/content/util.js b/content/util.js index e55a7aa4..55343ec5 100644 --- a/content/util.js +++ b/content/util.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.util = { +vimperator.util = { //{{{ escapeHTML: function (str) { @@ -208,6 +208,6 @@ vimperator.util = { return strNum[0] + " " + unitVal[unitIndex]; } -}; +};//}}} // vim: set fdm=marker sw=4 ts=4 et: diff --git a/content/vimperator.js b/content/vimperator.js index 8e12aca6..58e0d484 100644 --- a/content/vimperator.js +++ b/content/vimperator.js @@ -627,8 +627,8 @@ const vimperator = (function () //{{{ vimperator.globalVariables = {}; // TODO: move elsewhere - vimperator.registerCallback("submit", vimperator.modes.EX, function (command) { vimperator.execute(command); } ); - vimperator.registerCallback("complete", vimperator.modes.EX, function (str) { return vimperator.completion.exTabCompletion(str); } ); + vimperator.registerCallback("submit", vimperator.modes.EX, function (command) { vimperator.execute(command); }); + vimperator.registerCallback("complete", vimperator.modes.EX, function (str) { return vimperator.completion.exTabCompletion(str); }); // first time intro message if (vimperator.options.getPref("firsttime", true))