diff --git a/content/completion.js b/content/completion.js index c46595d7..2a0277ce 100644 --- a/content/completion.js +++ b/content/completion.js @@ -289,36 +289,6 @@ liberator.Completion = function () //{{{ return [0, buildLongestStartingSubstring(mapped, filter)]; }, - help: function (filter) - { - var res = []; - // they are sorted by relevance, not alphabetically - var files = ["intro.html", "starting.html", "browsing.html", "buffer.html", - "options.html", "tabs.html", "marks.html", "repeat.html", - "autocommands.html", "developer.html", "various.html"]; - - for (var file in files) - { - try - { - var xmlhttp = new XMLHttpRequest(); - xmlhttp.open("GET", "chrome://" + liberator.config.name.toLowerCase() + "/locale/" + files[file], false); - xmlhttp.send(null); - } - catch (e) - { - liberator.log("Error opening chrome://" + liberator.config.name.toLowerCase() + "/locale/" + files[file], 1); - continue; - } - var doc = xmlhttp.responseXML; - var elems = doc.getElementsByClassName("tag"); - for (var i = 0; i < elems.length; i++) - res.push([elems[i].textContent, files[file]]); - } - - return [0, this.filter(res, filter)]; - }, - command: function (filter) { var completions = []; diff --git a/content/liberator.js b/content/liberator.js index e42d7659..38cab7be 100644 --- a/content/liberator.js +++ b/content/liberator.js @@ -191,7 +191,7 @@ const liberator = (function () //{{{ "Display help", function (args) { liberator.help(args); }, { - completer: function (filter) { return liberator.completion.help(filter); } + completer: function (filter) { return getHelpCompletions(filter); } }); liberator.commands.add(["javas[cript]", "js"], @@ -390,6 +390,36 @@ const liberator = (function () //{{{ }); } + function getHelpCompletions(filter) + { + var res = []; + // they are sorted by relevance, not alphabetically + var files = ["intro.html", "tutorial.html", "starting.html", "browsing.html", "buffer.html", + "options.html", "tabs.html", "marks.html", "repeat.html", + "autocommands.html", "developer.html", "various.html"]; + + for (var file in files) + { + try + { + var xmlhttp = new XMLHttpRequest(); + xmlhttp.open("GET", "chrome://" + liberator.config.name.toLowerCase() + "/locale/" + files[file], false); + xmlhttp.send(null); + } + catch (e) + { + liberator.log("Error opening chrome://" + liberator.config.name.toLowerCase() + "/locale/" + files[file], 1); + continue; + } + var doc = xmlhttp.responseXML; + var elems = doc.getElementsByClassName("tag"); + for (var i = 0; i < elems.length; i++) + res.push([elems[i].textContent, files[file]]); + } + + return [0, liberator.completion.filter(res, filter)]; + } + // initially hide all GUI, it is later restored unless the user has :set go= or something // similar in his config function hideGUI() @@ -636,6 +666,7 @@ const liberator = (function () //{{{ function jumpToTag(file, tag) { liberator.open("chrome://" + liberator.config.name.toLowerCase() + "/locale/" + file, where); + // TODO: it would be better wo wait for pageLoad setTimeout(function () { var elem = liberator.buffer.getElement('@class="tag" and text()="' + tag + '"'); if (elem) @@ -651,7 +682,7 @@ const liberator = (function () //{{{ return; } - var [, items] = liberator.completion.help(topic); + var [, items] = getHelpCompletions(topic); var partialMatch = -1; for (var i = 0; i < items.length; i++) { diff --git a/locale/en-US/autocommands.txt b/locale/en-US/autocommands.txt index 06404cf3..1c9d56c2 100644 --- a/locale/en-US/autocommands.txt +++ b/locale/en-US/autocommands.txt @@ -18,16 +18,14 @@ Add {cmd} to the list of commands Vimperator will execute on {event}: * [c]:autocmd[!][c] * {pat}: list/remove autocommands matching {pat} * [c]:autocmd[!][c]: list/remove all autocommands +Available {events}: + +* Startup +* Quit +* PageLoad + +{pat} is a regular expression, use .* if you want to match all events. ________________________________________________________________________________ -____ -Available events: - -* BrowserExit -* BrowserRestart -* PageLoad - -____ - // vim: set syntax=asciidoc: diff --git a/locale/en-US/tutorial.txt b/locale/en-US/tutorial.txt index 20318ebe..05e58181 100644 --- a/locale/en-US/tutorial.txt +++ b/locale/en-US/tutorial.txt @@ -80,7 +80,6 @@ how Vimperator challenges this preconception. section:Scrolling[keyboard_scrolling] -____ Scrolling the browser window is done with simple keystrokes: * [m]j[m]/[m]k[m] -- @@ -94,12 +93,10 @@ Scrolling the browser window is done with simple keystrokes: Your standard buttons ([m][m]/[m][m]/[m][m]/[m][m]) will also work as expected. -____ section:History{nbsp}and{nbsp}Tabs[history_navigation,tab_navigation] -____ History navigation (e.g., ``Back'', ``Forward'') are done similarly to scrolling. @@ -127,12 +124,10 @@ following pairs sequences are equivalent: :tabopen vimperator.mozdev.org tvimperator.mozdev.org -____ section:Common{nbsp}Issues[common_issues] -____ Say you get half-way down typing in a new URL, only to remember that you've already got that page open in the previous tab. Your command-line might look something like this: @@ -144,12 +139,10 @@ following: gT -____ section:Find{nbsp}the{nbsp}Exit{nbsp}Nearest{nbsp}You[quitting_without_menus] -____ Vimperator supports all of Vim's classing methods of exitting. * [c]:xall[c] -- command to quit and save the current browsing @@ -158,12 +151,10 @@ Vimperator supports all of Vim's classing methods of exitting. * [m]ZZ[m] -- normal mode mapping equivalent to [c]:xall[c] * [m]ZQ[m] -- normal mode mapping equivalent to [c]:qall[c] -____ section:Where{nbsp}did{nbsp}Firefox{nbsp}go?[whither_firefox] -____ You might feel pretty disoriented now. Don't worry. This is still Firefox underneath. Here are some ways Vimperator allows Firefox to shine through. See the [c]:help[c] for these commands and mappings for more information on @@ -183,8 +174,6 @@ how to make the best use of them. Finally, in addition to the help system itself, [c]:exusage[c] and [c]:viusage[c] are useful quick-reference commands. -____ - Feel free to explore at this point. If you use the [c]:tabopen[c] command, remember to use the [m]gt[m]/[m]gT[m] mappings to get back to this page. If @@ -198,7 +187,7 @@ If you get hopelessly lost, just type [c]:help[c] and click the section:Get{nbsp}me{nbsp}out{nbsp}of{nbsp}here![removal] -If you've given it a fair shot and determined +If you've given it a fair shot and determined ... TODO The Vimperator way to do this is with the command [c]:addons[c]. Issuing this command brings up the Firefox Add-ons dialog window; you can then remove it as @@ -223,5 +212,4 @@ we are neither infinite nor omnipotent; please bear with us. If you can't wait for us to get around to it, rest assured patches are welcome! See the help:Developer[developer.html] page for more information. - // vim: set syntax=asciidoc: