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

make help.js a seperate file, small indention fixes

This commit is contained in:
Martin Stubenschrott
2007-04-23 11:14:33 +00:00
parent 33418f2473
commit 1ae53ecbf8
5 changed files with 310 additions and 259 deletions

View File

@@ -164,7 +164,7 @@ var g_commands = [/*{{{*/
["help", "h"], ["help", "h"],
["h[elp] {subject}"], ["h[elp] {subject}"],
"Open the help window in the current tab. It can jump to the specified {subject} with <code class=command>:help {subject}</code>.", "Open the help window in the current tab. It can jump to the specified {subject} with <code class=command>:help {subject}</code>.",
help, null,//help,
function(filter) { return get_help_completions(filter); } function(filter) { return get_help_completions(filter); }
], ],
[ [
@@ -325,7 +325,7 @@ var g_commands = [/*{{{*/
"Executes {cmd} and tells it to output in a new tab. Works for commands that support it.<br/>" + "Executes {cmd} and tells it to output in a new tab. Works for commands that support it.<br/>" +
"Example: <code class=command>:tab help tab</code> Opens the help in a new tab.", "Example: <code class=command>:tab help tab</code> Opens the help in a new tab.",
tab, tab,
null, null
], ],
[ [
["tabnext", "tabn", "tn", "tnext"], ["tabnext", "tabn", "tn", "tnext"],
@@ -1822,238 +1822,6 @@ function source(filename, silent)
} }
} }
function help(section, easter)
{
if (easter)
{
echoerr("E478: Don't panic!");
return;
}
if (arguments[3].inTab)
openURLsInNewTab("", true);
var doc = window.content.document;
var style = "<style type='text/css'>\
table.vimperator {\
border-width: 1px 1px 1px 1px;\
border-spacing: 5px;\
border-style: dotted dotted dotted dotted;\
border-color: gray gray gray gray;\
border-collapse: separate;\
background-color: white;\
}\
table.vimperator th {\
border-width: 1px 1px 1px 1px;\
padding: 3px 3px 3px 3px;\
border-style: hidden hidden hidden hidden;\
border-color: gray gray gray gray;\
}\
table.vimperator td {\
border-width: 1px 1px 1px 1px;\
padding: 3px 3px 3px 3px;\
border-style: hidden hidden hidden hidden;\
border-color: gray gray gray gray;\
background-color: rgb(250, 240, 230);\
}\
tr.tag {\
text-align: right;\
}\
tr.tag td {\
width: 100%;\
}\
tr.tag code, td.usage code {\
margin: 0px 2px;\
}\
tr.tag code {\
font-weight: bold;\
font-size: 1opx;\
margin-left: 2em;\
}\
tr.desciption {\
margin-bottom: 4px;\
}\
table.commands td {\
background-color: rgb(250, 240, 230);\
}\
table.commands th {\
background-color: rgb(250, 240, 230);\
}\
table.mappings td {\
background-color: rgb(230, 240, 250);\
}\
table.mappings th {\
background-color: rgb(230, 240, 250);\
}\
table.settings td {\
background-color: rgb(240, 250, 230);\
}\
table.settings th {\
background-color: rgb(240, 250, 230);\
}\
.command { font-weight: bold; color: #632610; }\
.mapping { font-weight: bold; color: #102663; }\
.setting { font-weight: bold; color: #106326; }\
</style>";
var header = '<h1 align=center>Vimperator</h1>' +
'<p align=center bgcolor=blue borderwidth=1><b>First there was a Navigator, then there was an Explorer. Later it was time for a Konqueror. Now it\'s time for an Imperator, the VIMperator :)</b></p>'
var introduction = '<h2>Introduction</h2>' +
'<p><a href="http://vimperator.mozdev.org">Vimperator</a> is a free browser add-on for Firefox, which makes it look and behave like the <a href="http://www.vim.org">Vim</a> text editor. ' +
'It has similar key bindings, and you could call it a modal webbrowser, as key bindings differ according to which mode you are in.</p>' +
'<p><font color=red><b>Warning:</b></font> To provide the most authentic Vim experience, the Firefox menubar and toolbar were hidden. If you really need them, type: <code class=command>:set guioptions=mT</code> to get it back. ' +
'If you don\'t like Vimperator at all, you can uninstall it by typing <code class=command>:addons</code> and remove/disable it. ' +
'If you like it, but can\'t remember the shortcuts, press <code class=mapping>F1</code> or <code class=command>:help</code> to get this help window back.</p>' +
'<p>Since Vimperator\'s GUI is embedded into a toolbar, it may look too 3D-like with the default theme. For best experience, I therefore recommend the <a href=\"https://addons.mozilla.org/firefox/364/\">Whitehart</a> theme.</p>' +
'<p> Vimperator was written by <a href="mailto:stubenschrott@gmx.net">Martin Stubenschrott</a>. If you appreciate my work on Vimperator, you can either send me greetings, patches ' +
'or make a donation: ' +
'<form action="https://www.paypal.com/cgi-bin/webscr" method="post">' +
'<input type="hidden" name="cmd" value="_s-xclick">' +
'<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but21.gif" border="0" name="submit" alt="Make payments with PayPal - it\'s fast, free and secure!">' +
'<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">' +
'<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHPwYJKoZIhvcNAQcEoIIHMDCCBywCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYBDDJfc+lXLBSAM9XSWv/ebzG/L7PTqYiIXaWVg8pfinDsfYaAcifcgCTuApg4v/VaZIQ/hLODzQu2EvmjGXP0twErA/Q8G5gx0l197PJSyVXb1sLwd1mgOdLF4t0HmDCdEI9z3H6CMhsb3xVwlfpzllSfCIqzlSpx4QtdzEZGzLDELMAkGBSsOAwIaBQAwgbwGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQI8ZOwn5QkHgaAgZjjtPQxB7Vw2rS7Voap9y+xdVLoczUQ97hw+bOdZLcGykBtfoVjdn76MS51QKjGp1fEmxkqTuQ+Fxv8+OVtHu0QF/qlrhmC3fJBRJ0IFWxKdXS+Wod4615BDaG2X1hzvCL443ffka8XlLSiFTuW43BumQs/O+6Jqsk2hcReP3FIQOvtWMSgGTALnZx7x5c60u/3NSKW5qvyWKCCA4cwggODMIIC7KADAgECAgEAMA0GCSqGSIb3DQEBBQUAMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYD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CBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTA3MDMyMTIyMzI1OFowIwYJKoZIhvcNAQkEMRYEFCirrvlwYVHQiNEEbM6ikfx9+Dm5MA0GCSqGSIb3DQEBAQUABIGAtbsR8GdCdURLziozXLSdtY+zJZUPPeQFXXy2V1S/3ldiN+pRvd4HI7xz8mOY1UaKJZpwZnOosy9MflL1/hbiEtEyQ2Dm/s4jnTcJng/NjLIZu+0NYxXRJhB+zMJubnMMMjzNrGlqI4F2HAB/bCA1eOJ5B83Of3dA4rk/T/8GoSQ=-----END PKCS7-----">' +
'</form>' +
'Of course as a believer in free open source software, only make a donation if you really like Vimperator, and the money doesn\'t hurt - otherwise just use it, recommend it and like it :)'
// xxx: for firebug: :exec Firebug.toggleBar(true)
/* commands = array where help information is located
* color = used for background of the table
* beg = string which is printed before the commmand/setting/mapping name
* end = string which is printed after the commmand/setting/mapping name
* func = called with 'commands' array and result which is a sring is prepended to the help text
*/
function makeHelpString(commands, color, beg, end, func)
{
var ret = "";
for (var i=0; i < commands.length; i++)
{
ret += '<tr class="tag"><td colspan="2">';
for (var j=0; j < commands[i][0].length; j++)
{
var cmd_name = commands[i][0][j];
cmd_name = cmd_name.replace(/</g, "&lt;");
cmd_name = cmd_name.replace(/>/g, "&gt;");
ret += "<code id='" + commands[i][0][j] + "'>" +beg+ cmd_name +end+ '</code>';
}
ret += '</td></tr><tr class="description"><td class="usage">';
for (var j=0; j < commands[i][1].length; j++)
{
var usage = commands[i][1][j];
usage = usage.replace(/<(?!br\/>)/g, "&lt;");
usage = usage.replace(/[^b][^r][^\/]>/g, "&gt;");
ret += "<code>" +beg+ usage +end+ '</code><br/>';
}
ret += '</td><td>';
if (func)
ret += func.call(this, commands[i]);
if (commands[i][2])
{
if(func)
ret += "<br/>"
ret += commands[i][2]; // the help description
}
ret += '</td></tr>';
}
return ret;
}
function makeSettingsHelpString(command)
{
var ret = "";
ret = command[5] + " (default: <code>";
if (command[5] == "boolean")
{
if(command[6] == true)
ret += "on";
else
ret += "off";
}
else
{
if (typeof command[6] == 'string' && command[6].length == 0)
ret += "''";
else
ret += command[6];
}
ret += "</code>)<br/>";
return ret;
}
var mappings = '<h2>Mappings</h2>'+
'<p>The denotion of modifier keys is like in Vim, so C- means the Control key, M- the Meta key, A- the Alt key and S- the Shift key.</p>'+
'<p><table class="vimperator mappings">'
mappings += makeHelpString(g_mappings, "#102663", "", "", null);
mappings += '</table></p>';
if (section && section == 'holy-grail')
mappings += '<span id="holy-grail">You found it, Arthur!</span>';
var commands = '<h2>Commands</h2><p><table class="vimperator commands">'
commands += makeHelpString(g_commands, "#632610", ":", "", null);
commands += '</table></p>';
if (section && section == '42')
commands += '<p id="42">What is the meaning of life, the universe and everything?<br/>' +
'Douglas Adams, the only person who knew what this question really was about is<br/>' +
'now dead, unfortunately. So now you might wonder what the meaning of death<br/>' +
'is...</p>';
var settings = '<h2>Settings</h2><p><table class="vimperator settings">'
settings += makeHelpString(g_settings, "#106326", "'", "'", makeSettingsHelpString);
settings += '</table></p>';
var fulldoc = '<html><head><title>Vimperator help</title>' +
style +
'</head><body>' +
header +
introduction +
mappings +
commands +
settings +
'</body></html>'
doc.open();
doc.write(fulldoc);
doc.close();
if (section)
{
var element = doc.getElementById(section);
if (!element)
{
echoerr("E149: Sorry, no help for " + section);
return;
}
var pos = cumulativeOffset(element);
// horizontal offset is annyoing, set it to 0 (use pos[0] if you want horizontal offset)
window.content.scrollTo(0, pos[1]);
}
}
function cumulativeOffset(element)
{
var valueT = 0, valueL = 0;
if (!element)
return [0, 0];
do
{
valueT += element.offsetTop || 0;
valueL += element.offsetLeft || 0;
element = element.offsetParent;
}
while (element);
return [valueL, valueT];
}

View File

@@ -180,27 +180,6 @@ function completion_select_previous_item()/*{{{*/
}/*}}}*/ }/*}}}*/
function get_file_completions(filter)/*{{{*/
{
g_completions = [];
var match = filter.match(/^(.*[\/\\])(.*?)$/);
var dir;
if (!match || !(dir = match[1])) return [];
var compl = match[2] || '';
var fd = fopen(dir, "<");
if (!fd) return [];
var entries = fd.read();
var delim = fd.path.length == 1 ? '' : (fd.path.search(/\\/) != -1) ? "\\" : "/";
var reg = new RegExp("^" + fd.path + delim + compl);
entries.forEach(function(file) {
if (file.path.search(reg) != -1)
g_completions.push([file.path, '']);
});
return g_completions;
}/*}}}*/
/* /*
* filter a list of urls * filter a list of urls
@@ -288,6 +267,32 @@ outer:
return filtered.concat(additional_completions); return filtered.concat(additional_completions);
}/*}}}*/ }/*}}}*/
function get_file_completions(filter)/*{{{*/
{
g_completions = [];
var match = filter.match(/^(.*[\/\\])(.*?)$/);
var dir;
if (!match || !(dir = match[1]))
return [];
var compl = match[2] || '';
var fd = fopen(dir, "<");
if (!fd)
return [];
var entries = fd.read();
var delim = fd.path.length == 1 ? '' : (fd.path.search(/\\/) != -1) ? "\\" : "/";
var reg = new RegExp("^" + fd.path + delim + compl);
entries.forEach(function(file)
{
if (file.path.search(reg) != -1)
g_completions.push([file.path, '']);
});
return g_completions;
}/*}}}*/
function get_search_completions(filter)/*{{{*/ function get_search_completions(filter)/*{{{*/
{ {
var search_completions = []; var search_completions = [];

View File

@@ -0,0 +1,263 @@
/***** BEGIN LICENSE BLOCK ***** {{{
Version: MPL 1.1/GPL 2.0/LGPL 2.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
(c) 2006-2007: Martin Stubenschrott <stubenschrott@gmx.net>
Alternatively, the contents of this file may be used under the terms of
either the GNU General Public License Version 2 or later (the "GPL"), or
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
}}} ***** END LICENSE BLOCK *****/
function help(section, easter)
{
if (easter)
{
echoerr("E478: Don't panic!");
return;
}
if (arguments[3] && arguments[3].inTab)
openURLsInNewTab("", true);
var doc = window.content.document;
var style = "<style type='text/css'>\
table.vimperator {\
border-width: 1px 1px 1px 1px;\
border-spacing: 5px;\
border-style: dotted dotted dotted dotted;\
border-color: gray gray gray gray;\
border-collapse: separate;\
background-color: white;\
}\
table.vimperator th {\
border-width: 1px 1px 1px 1px;\
padding: 3px 3px 3px 3px;\
border-style: hidden hidden hidden hidden;\
border-color: gray gray gray gray;\
}\
table.vimperator td {\
border-width: 1px 1px 1px 1px;\
padding: 3px 3px 3px 3px;\
border-style: hidden hidden hidden hidden;\
border-color: gray gray gray gray;\
background-color: rgb(250, 240, 230);\
}\
tr.tag {\
text-align: right;\
}\
tr.tag td {\
width: 100%;\
padding: 3px 0px 3px 0px;\
}\
tr.tag code, td.usage code {\
margin: 0px 2px;\
}\
tr.tag code {\
font-weight: bold;\
font-size: 1opx;\
margin-left: 2em;\
}\
tr.desciption {\
margin-bottom: 4px;\
}\
table.commands td {\
background-color: rgb(250, 240, 230);\
}\
table.commands th {\
background-color: rgb(250, 240, 230);\
}\
table.mappings td {\
background-color: rgb(230, 240, 250);\
}\
table.mappings th {\
background-color: rgb(230, 240, 250);\
}\
table.settings td {\
background-color: rgb(240, 250, 230);\
}\
table.settings th {\
background-color: rgb(240, 250, 230);\
}\
.command { font-weight: bold; color: #632610; }\
.mapping { font-weight: bold; color: #102663; }\
.setting { font-weight: bold; color: #106326; }\
</style>";
var header = '<h1 align=center>Vimperator</h1>' +
'<p align=center bgcolor=blue borderwidth=1><b>First there was a Navigator, then there was an Explorer. Later it was time for a Konqueror. Now it\'s time for an Imperator, the VIMperator :)</b></p>'
var introduction = '<h2>Introduction</h2>' +
'<p><a href="http://vimperator.mozdev.org">Vimperator</a> is a free browser add-on for Firefox, which makes it look and behave like the <a href="http://www.vim.org">Vim</a> text editor. ' +
'It has similar key bindings, and you could call it a modal webbrowser, as key bindings differ according to which mode you are in.</p>' +
'<p><font color=red><b>Warning:</b></font> To provide the most authentic Vim experience, the Firefox menubar and toolbar were hidden. If you really need them, type: <code class=command>:set guioptions=mT</code> to get it back. ' +
'If you don\'t like Vimperator at all, you can uninstall it by typing <code class=command>:addons</code> and remove/disable it. ' +
'If you like it, but can\'t remember the shortcuts, press <code class=mapping>F1</code> or <code class=command>:help</code> to get this help window back.</p>' +
'<p>Since Vimperator\'s GUI is embedded into a toolbar, it may look too 3D-like with the default theme. For best experience, I therefore recommend the <a href=\"https://addons.mozilla.org/firefox/364/\">Whitehart</a> theme.</p>' +
'<p> Vimperator was written by <a href="mailto:stubenschrott@gmx.net">Martin Stubenschrott</a>. If you appreciate my work on Vimperator, you can either send me greetings, patches ' +
'or make a donation: ' +
'<form action="https://www.paypal.com/cgi-bin/webscr" method="post">' +
'<input type="hidden" name="cmd" value="_s-xclick">' +
'<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but21.gif" border="0" name="submit" alt="Make payments with PayPal - it\'s fast, free and secure!">' +
'<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">' +
'<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHPwYJKoZIhvcNAQcEoIIHMDCCBywCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMR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MzI1OFowIwYJKoZIhvcNAQkEMRYEFCirrvlwYVHQiNEEbM6ikfx9+Dm5MA0GCSqGSIb3DQEBAQUABIGAtbsR8GdCdURLziozXLSdtY+zJZUPPeQFXXy2V1S/3ldiN+pRvd4HI7xz8mOY1UaKJZpwZnOosy9MflL1/hbiEtEyQ2Dm/s4jnTcJng/NjLIZu+0NYxXRJhB+zMJubnMMMjzNrGlqI4F2HAB/bCA1eOJ5B83Of3dA4rk/T/8GoSQ=-----END PKCS7-----">' +
'</form>' +
'Of course as a believer in free open source software, only make a donation if you really like Vimperator, and the money doesn\'t hurt - otherwise just use it, recommend it and like it :)'
// xxx: for firebug: :exec Firebug.toggleBar(true)
/* commands = array where help information is located
* color = used for background of the table
* beg = string which is printed before the commmand/setting/mapping name
* end = string which is printed after the commmand/setting/mapping name
* func = called with 'commands' array and result which is a sring is prepended to the help text
*/
function makeHelpString(commands, color, beg, end, func)
{
var ret = "";
for (var i=0; i < commands.length; i++)
{
ret += '<tr class="tag"><td colspan="2">';
for (var j=0; j < commands[i][0].length; j++)
{
var cmd_name = commands[i][0][j];
cmd_name = cmd_name.replace(/</g, "&lt;");
cmd_name = cmd_name.replace(/>/g, "&gt;");
ret += "<code id='" + commands[i][0][j] + "'>" +beg+ cmd_name +end+ '</code>';
}
ret += '</td></tr><tr class="description"><td class="usage">';
for (var j=0; j < commands[i][1].length; j++)
{
var usage = commands[i][1][j];
usage = usage.replace(/<(?!br\/>)/g, "&lt;");
usage = usage.replace(/[^b][^r][^\/]>/g, "&gt;");
ret += "<code>" +beg+ usage +end+ '</code><br/>';
}
ret += '</td><td>';
if (func)
ret += func.call(this, commands[i]);
if (commands[i][2])
{
if(func)
ret += "<br/>"
ret += commands[i][2]; // the help description
}
ret += '</td></tr>';
}
return ret;
}
function makeSettingsHelpString(command)
{
var ret = "";
ret = command[5] + " (default: <code>";
if (command[5] == "boolean")
{
if(command[6] == true)
ret += "on";
else
ret += "off";
}
else
{
if (typeof command[6] == 'string' && command[6].length == 0)
ret += "''";
else
ret += command[6];
}
ret += "</code>)<br/>";
return ret;
}
var mappings = '<h2>Mappings</h2>'+
'<p>The denotion of modifier keys is like in Vim, so C- means the Control key, M- the Meta key, A- the Alt key and S- the Shift key.</p>'+
'<p><table class="vimperator mappings">'
mappings += makeHelpString(g_mappings, "#102663", "", "", null);
mappings += '</table></p>';
if (section && section == 'holy-grail')
mappings += '<span id="holy-grail">You found it, Arthur!</span>';
var commands = '<h2>Commands</h2><p><table class="vimperator commands">'
commands += makeHelpString(g_commands, "#632610", ":", "", null);
commands += '</table></p>';
if (section && section == '42')
commands += '<p id="42">What is the meaning of life, the universe and everything?<br/>' +
'Douglas Adams, the only person who knew what this question really was about is<br/>' +
'now dead, unfortunately. So now you might wonder what the meaning of death<br/>' +
'is...</p>';
var settings = '<h2>Settings</h2><p><table class="vimperator settings">'
settings += makeHelpString(g_settings, "#106326", "'", "'", makeSettingsHelpString);
settings += '</table></p>';
var fulldoc = '<html><head><title>Vimperator help</title>' +
style +
'</head><body>' +
header +
introduction +
mappings +
commands +
settings +
'</body></html>'
doc.open();
doc.write(fulldoc);
doc.close();
function cumulativeOffset(element)
{
var valueT = 0, valueL = 0;
if (!element)
return [0, 0];
do
{
valueT += element.offsetTop || 0;
valueL += element.offsetLeft || 0;
element = element.offsetParent;
}
while (element);
return [valueL, valueT];
}
if (section)
{
var element = doc.getElementById(section);
if (!element)
{
echoerr("E149: Sorry, no help for " + section);
return;
}
var pos = cumulativeOffset(element);
// horizontal offset is annyoing, set it to 0 (use pos[0] if you want horizontal offset)
window.content.scrollTo(0, pos[1]);
}
}
// vim: set fdm=marker sw=4 ts=4 et:

View File

@@ -24,15 +24,21 @@ copyToClipboard commands.js /^function copyToClipboard(str)$/;" f
createCursorPositionString vimperator.js /^function createCursorPositionString()$/;" f createCursorPositionString vimperator.js /^function createCursorPositionString()$/;" f
createHints hints.js /^ function createHints(win)$/;" f createHints hints.js /^ function createHints(win)$/;" f
createProgressBar vimperator.js /^function createProgressBar(aProgress)$/;" f createProgressBar vimperator.js /^function createProgressBar(aProgress)$/;" f
cumulativeOffset commands.js /^function cumulativeOffset(element)$/;" f
deleteBookmark bookmarks.js /^function deleteBookmark(url)$/;" f deleteBookmark bookmarks.js /^function deleteBookmark(url)$/;" f
del_url_mark commands.js /^function del_url_mark(mark)$/;" f del_url_mark commands.js /^function del_url_mark(mark)$/;" f
echo commands.js /^function echo(msg)$/;" f echo commands.js /^function echo(msg)$/;" f
echoerr commands.js /^function echoerr(msg)$/;" f echoerr commands.js /^function echoerr(msg)$/;" f
execute_command commands.js /^function execute_command(count, cmd, special, args) \/\/ {{{$/;" f execute commands.js /^function execute(string)$/;" f
execute_command commands.js /^function execute_command(count, cmd, special, args, modifiers) \/\/ {{{$/;" f
filter_url_array completion.js /^function filter_url_array(urls, filter, use_regex)\/*{{{*\/$/;" f filter_url_array completion.js /^function filter_url_array(urls, filter, use_regex)\/*{{{*\/$/;" f
focusContent vimperator.js /^function focusContent(clear_command_line, clear_statusline)$/;" f focusContent vimperator.js /^function focusContent(clear_command_line, clear_statusline)$/;" f
focusNextFrame commands.js /^function focusNextFrame()$/;" f focusNextFrame commands.js /^function focusNextFrame()$/;" f
fopen file.js /^function fopen (path, mode, perms, tmp)$/;" f
formatHint hints.js /^ function formatHint(hintNum)$/;" f formatHint hints.js /^ function formatHint(hintNum)$/;" f
fo_close file.js /^function fo_close()$/;" f
fo_read file.js /^function fo_read(max)$/;" f
fo_write file.js /^function fo_write(buf)$/;" f
genElemCoords hints.js /^ function genElemCoords(elem)$/;" f genElemCoords hints.js /^ function genElemCoords(elem)$/;" f
genHintContainer hints.js /^ function genHintContainer(doc)$/;" f genHintContainer hints.js /^ function genHintContainer(doc)$/;" f
getCurrentLinkLocation commands.js /^function getCurrentLinkLocation()$/;" f getCurrentLinkLocation commands.js /^function getCurrentLinkLocation()$/;" f
@@ -45,7 +51,9 @@ get_bookmark_completions completion.js /^function get_bookmark_completions(filte
get_buffer_completions completion.js /^function get_buffer_completions(filter)$/;" f get_buffer_completions completion.js /^function get_buffer_completions(filter)$/;" f
get_command commands.js /^function get_command(cmd) \/\/ {{{$/;" f get_command commands.js /^function get_command(cmd) \/\/ {{{$/;" f
get_command_completions completion.js /^function get_command_completions(filter)\/*{{{*\/$/;" f get_command_completions completion.js /^function get_command_completions(filter)\/*{{{*\/$/;" f
get_file_completions completion.js /^function get_file_completions(filter)\/*{{{*\/$/;" f
get_firefox_pref settings.js /^function get_firefox_pref(name, default_value)$/;" f get_firefox_pref settings.js /^function get_firefox_pref(name, default_value)$/;" f
get_help_completions completion.js /^function get_help_completions(filter)$/;" f
get_history_completions completion.js /^function get_history_completions(filter)\/*{{{*\/$/;" f get_history_completions completion.js /^function get_history_completions(filter)\/*{{{*\/$/;" f
get_pref settings.js /^function get_pref(name, forced_default)$/;" f get_pref settings.js /^function get_pref(name, forced_default)$/;" f
get_search_completions completion.js /^function get_search_completions(filter)\/*{{{*\/$/;" f get_search_completions completion.js /^function get_search_completions(filter)\/*{{{*\/$/;" f
@@ -53,9 +61,10 @@ get_setting settings.js /^function get_setting(cmd)$/;" f
get_settings_completions completion.js /^function get_settings_completions(filter)\/*{{{*\/$/;" f get_settings_completions completion.js /^function get_settings_completions(filter)\/*{{{*\/$/;" f
get_url_completions completion.js /^function get_url_completions(filter)\/*{{{*\/$/;" f get_url_completions completion.js /^function get_url_completions(filter)\/*{{{*\/$/;" f
get_url_mark commands.js /^function get_url_mark(mark)$/;" f get_url_mark commands.js /^function get_url_mark(mark)$/;" f
goUp commands.js /^function goUp() \/\/ FIXME$/;" f
hasMode commands.js /^function hasMode(mode)$/;" f hasMode commands.js /^function hasMode(mode)$/;" f
help commands.js /^function help(section, easter)$/;" f help commands.js /^function help(section, easter)$/;" f
historyGoToBeginning commands.js /^function historyGoToBeginning()$/;" f
historyGoToEnd commands.js /^function historyGoToEnd()$/;" f
hit_a_hint hints.js /^function hit_a_hint()$/;" f hit_a_hint hints.js /^function hit_a_hint()$/;" f
hsshow commands.js /^function hsshow(filter, fullmode)$/;" f hsshow commands.js /^function hsshow(filter, fullmode)$/;" f
init vimperator.js /^function init()$/;" f init vimperator.js /^function init()$/;" f
@@ -64,12 +73,15 @@ invalidateCoords hints.js /^ function invalidateCoords(doc)$/;" f
isFormElemFocused vimperator.js /^function isFormElemFocused()$/;" f isFormElemFocused vimperator.js /^function isFormElemFocused()$/;" f
keyToString vimperator.js /^function keyToString(event)$/;" f keyToString vimperator.js /^function keyToString(event)$/;" f
load_history completion.js /^function load_history()$/;" f load_history completion.js /^function load_history()$/;" f
LocalFile file.js /^function LocalFile(file, mode, perms, tmp)$/;" f
logMessage vimperator.js /^function logMessage(msg)$/;" f logMessage vimperator.js /^function logMessage(msg)$/;" f
makeHelpString commands.js /^ function makeHelpString(commands, color, beg, end, func)$/;" f makeHelpString commands.js /^ function makeHelpString(commands, color, beg, end, func)$/;" f
makeSettingsHelpString commands.js /^ function makeSettingsHelpString(command)$/;" f makeSettingsHelpString commands.js /^ function makeSettingsHelpString(command)$/;" f
multiliner commands.js /^function multiliner(line, prev_match, heredoc)$/;" f
nsBrowserStatusHandler vimperator.js /^function nsBrowserStatusHandler() \/*{{{*\/$/;" f nsBrowserStatusHandler vimperator.js /^function nsBrowserStatusHandler() \/*{{{*\/$/;" f
onCommandBarInput vimperator.js /^function onCommandBarInput(event)$/;" f onCommandBarInput vimperator.js /^function onCommandBarInput(event)$/;" f
onCommandBarKeypress vimperator.js /^function onCommandBarKeypress(evt)\/*{{{*\/$/;" f onCommandBarKeypress vimperator.js /^function onCommandBarKeypress(evt)\/*{{{*\/$/;" f
onCommandBarMouseDown vimperator.js /^function onCommandBarMouseDown(event)$/;" f
onEscape vimperator.js /^function onEscape()$/;" f onEscape vimperator.js /^function onEscape()$/;" f
onResize hints.js /^ function onResize(event)$/;" f onResize hints.js /^ function onResize(event)$/;" f
onVimperatorKeypress vimperator.js /^function onVimperatorKeypress(event)\/*{{{*\/$/;" f onVimperatorKeypress vimperator.js /^function onVimperatorKeypress(event)\/*{{{*\/$/;" f
@@ -106,15 +118,17 @@ showMode commands.js /^function showMode()$/;" f
showStatusbarMessage vimperator.js /^function showStatusbarMessage(msg, field)$/;" f showStatusbarMessage vimperator.js /^function showStatusbarMessage(msg, field)$/;" f
show_location_marks commands.js /^function show_location_marks(mark)$/;" f show_location_marks commands.js /^function show_location_marks(mark)$/;" f
show_url_marks commands.js /^function show_url_marks(mark)$/;" f show_url_marks commands.js /^function show_url_marks(mark)$/;" f
source commands.js /^function source(filename)$/;" f source commands.js /^function source(filename, silent)$/;" f
startCoordLoader hints.js /^ function startCoordLoader(doc)$/;" f startCoordLoader hints.js /^ function startCoordLoader(doc)$/;" f
stepInHistory commands.js /^function stepInHistory(steps)$/;" f stepInHistory commands.js /^function stepInHistory(steps)$/;" f
stringToURLs commands.js /^function stringToURLs(str)$/;" f stringToURLs commands.js /^function stringToURLs(str)$/;" f
tab commands.js /^function tab()$/;" f
tab_go commands.js /^function tab_go(index)$/;" f tab_go commands.js /^function tab_go(index)$/;" f
tab_remove commands.js /^function tab_remove(count, focus_left_tab, quit_on_last_tab)$/;" f tab_remove commands.js /^function tab_remove(count, focus_left_tab, quit_on_last_tab)$/;" f
toggle_images commands.js /^function toggle_images() {$/;" f toggle_images commands.js /^function toggle_images() {$/;" f
tokenize_ex commands.js /^function tokenize_ex(string, tag)$/;" f
unload vimperator.js /^function unload()$/;" f unload vimperator.js /^function unload()$/;" f
updateStatusbar vimperator.js /^function updateStatusbar()$/;" f updateStatusbar vimperator.js /^function updateStatusbar(message)$/;" f
yankCurrentLocation commands.js /^function yankCurrentLocation()$/;" f yankCurrentLocation commands.js /^function yankCurrentLocation()$/;" f
zoom_in commands.js /^function zoom_in(factor)$/;" f zoom_in commands.js /^function zoom_in(factor)$/;" f
zoom_to commands.js /^function zoom_to(value)$/;" f zoom_to commands.js /^function zoom_to(value)$/;" f

View File

@@ -41,6 +41,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
<script type="application/x-javascript" src="settings.js"/> <script type="application/x-javascript" src="settings.js"/>
<script type="application/x-javascript" src="completion.js"/> <script type="application/x-javascript" src="completion.js"/>
<script type="application/x-javascript" src="bookmarks.js"/> <script type="application/x-javascript" src="bookmarks.js"/>
<script type="application/x-javascript" src="help.js"/>
<script type="application/x-javascript" src="hints.js"/> <script type="application/x-javascript" src="hints.js"/>
<script type="application/x-javascript" src="file.js"/> <script type="application/x-javascript" src="file.js"/>