mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 00:17:58 +01:00
pass <enter> <space> <tab> etc. to vimperator now, so that they can perform their default action without beeping.
Quite hacky so far, should be cleaned up.
This commit is contained in:
@@ -78,4 +78,4 @@ table.settings {
|
|||||||
.mapping { font-weight: bold; color: #102663; }
|
.mapping { font-weight: bold; color: #102663; }
|
||||||
.setting { font-weight: bold; color: #106326; }
|
.setting { font-weight: bold; color: #106326; }
|
||||||
.argument { color: #6A97D4; }
|
.argument { color: #6A97D4; }
|
||||||
.version { position:absolute; top:10px; right:2%; color:#B0B0B0; text-align:right; }
|
.version { position:absolute; top:10px; right:2%; color:#C0C0C0; text-align:right; }
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ function help(section, easter)
|
|||||||
|
|
||||||
// add more space between entries
|
// add more space between entries
|
||||||
if (i < commands.length-1)
|
if (i < commands.length-1)
|
||||||
ret += '<tr class="separator"><td colspan=3><hr></td></tr>';
|
ret += '<tr class="separator"><td colspan=3><hr></td></tr>\\n';
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -131,24 +131,24 @@ function help(section, easter)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
var header = '<h1 align=center>Vimperator</h1>' +
|
var header = '<h1 align=center>Vimperator</h1>\\n' +
|
||||||
'<p align=center><b>First there was a Navigator, then there was an Explorer.<br/>'+
|
'<p align=center><b>First there was a Navigator, then there was an Explorer.<br/>\\n'+
|
||||||
'Later it was time for a Konqueror. Now it\'s time for an Imperator, the VIMperator :)</b></p>';
|
'Later it was time for a Konqueror. Now it\'s time for an Imperator, the VIMperator :)</b></p>\\n';
|
||||||
|
|
||||||
var introduction = '<h2>Introduction</h2>' +
|
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.<br/>' +
|
'<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.<br/>' +
|
||||||
'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>' +
|
'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>\\n' +
|
||||||
|
|
||||||
'<p><font color=red><b>Warning:</b></font> To provide the most authentic Vim experience, the Firefox menubar and toolbar were hidden.<br/>'+
|
'<p><font color=red><b>Warning:</b></font> To provide the most authentic Vim experience, the Firefox menubar and toolbar were hidden.<br/>'+
|
||||||
'If you really need them, type: <code class=command>:set guioptions=mT</code> to get it back.<br>' +
|
'If you really need them, type: <code class=command>:set guioptions=mT</code> to get it back.<br>\\n' +
|
||||||
'If you don\'t like Vimperator at all, you can uninstall it by typing <code class=command>:addons</code> and remove/disable it.<br/>' +
|
'If you don\'t like Vimperator at all, you can uninstall it by typing <code class=command>:addons</code> and remove/disable it.<br/>' +
|
||||||
'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>' +
|
'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>\\n' +
|
||||||
|
|
||||||
'<p>Since Vimperator\'s GUI is embedded into a toolbar, it may look too 3D-like with the default theme.<br/>'+
|
'<p>Since Vimperator\'s GUI is embedded into a toolbar, it may look too 3D-like with the default theme.<br/>'+
|
||||||
'For best experience, I therefore recommend the <a href=\"https://addons.mozilla.org/firefox/364/\">Whitehart</a> theme.</p>' +
|
'For best experience, I therefore recommend the <a href=\"https://addons.mozilla.org/firefox/364/\">Whitehart</a> theme.</p>\\n' +
|
||||||
|
|
||||||
'<p>Vimperator was written by <a href="mailto:stubenschrott@gmx.net">Martin Stubenschrott</a>. If you appreciate my work on Vimperator, you can either<br/>'+
|
'<p>Vimperator was written by <a href="mailto:stubenschrott@gmx.net">Martin Stubenschrott</a>. If you appreciate my work on Vimperator, you can either<br/>'+
|
||||||
'send me greetings, patches or make a donation: ' +
|
'send me greetings, patches or make a donation: \\n' +
|
||||||
|
|
||||||
'<form action="https://www.paypal.com/cgi-bin/webscr" method="post">' +
|
'<form action="https://www.paypal.com/cgi-bin/webscr" method="post">' +
|
||||||
'<input type="hidden" name="cmd" value="_s-xclick">' +
|
'<input type="hidden" name="cmd" value="_s-xclick">' +
|
||||||
@@ -156,42 +156,42 @@ function help(section, easter)
|
|||||||
|
|
||||||
'<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">' +
|
'<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+Wod4615BDaG2X1h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y9MflL1/hbiEtEyQ2Dm/s4jnTcJng/NjLIZu+0NYxXRJhB+zMJubnMMMjzNrGlqI4F2HAB/bCA1eOJ5B83Of3dA4rk/T/8GoSQ=-----END PKCS7-----">' +
|
||||||
'</form>' +
|
'</form>\\n' +
|
||||||
|
|
||||||
'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 :)</p>'
|
'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 :)</p>\\n'
|
||||||
|
|
||||||
var mappings = '<h2>Mappings</h2>'+
|
var mappings = '<h2>Mappings</h2>\\n'+
|
||||||
'<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>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">'
|
'<p><table class="vimperator mappings">'
|
||||||
mappings += makeHelpString(g_mappings, "#102663", "", "", null);
|
mappings += makeHelpString(g_mappings, "#102663", "", "", null);
|
||||||
mappings += '</table></p>';
|
mappings += '</table></p>';
|
||||||
if (section && section == 'holy-grail')
|
if (section && section == 'holy-grail')
|
||||||
mappings += '<span id="holy-grail">You found it, Arthur!</span>';
|
mappings += '<span id="holy-grail">You found it, Arthur!</span>\\n';
|
||||||
|
|
||||||
var commands = '<h2>Commands</h2><p><table class="vimperator commands">'
|
var commands = '<h2>Commands</h2><p><table class="vimperator commands">\\n';
|
||||||
commands += makeHelpString(g_commands, "#632610", ":", "", null);
|
commands += makeHelpString(g_commands, "#632610", ":", "", null);
|
||||||
commands += '</table></p>';
|
commands += '</table></p>';
|
||||||
if (section && section == '42')
|
if (section && section == '42')
|
||||||
commands += '<p id="42">What is the meaning of life, the universe and everything?<br/>' +
|
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/>' +
|
'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/>' +
|
'now dead, unfortunately. So now you might wonder what the meaning of death<br/>' +
|
||||||
'is...</p>';
|
'is...</p>\\n';
|
||||||
|
|
||||||
var settings = '<h2>Settings</h2><p><table class="vimperator settings">'
|
var settings = '<h2>Settings</h2><p><table class="vimperator settings">\\n';
|
||||||
settings += makeHelpString(g_settings, "#106326", "'", "'", makeSettingsHelpString);
|
settings += makeHelpString(g_settings, "#106326", "'", "'", makeSettingsHelpString);
|
||||||
settings += '</table></p>';
|
settings += '</table></p>';
|
||||||
|
|
||||||
var fulldoc = '<html><head><title>Vimperator help</title>' +
|
var fulldoc = '<html>\\n<head>\\n<title>Vimperator help</title>\\n' +
|
||||||
// XXX: stylesheet broken here? Have to add it in the vimperator.xul file
|
// XXX: stylesheet broken here? Have to add it in the vimperator.xul file
|
||||||
'<link rel="stylesheet" href="chrome://vimperator/content/default.css" type="text/css">'+
|
'<link rel="stylesheet" href="chrome://vimperator/content/default.css" type="text/css">\\n'+
|
||||||
'</head><body><pre style="white-space: -moz-pre-wrap !important;"><table class="main"><tr><td>' + // should change that to: white-space: pre-wrap; once CSS3 hits firefox
|
'</head>\\n<body><pre style="white-space: -moz-pre-wrap !important;">\\n<table class="main"><tr><td>\\n' + // should change that to: white-space: pre-wrap; once CSS3 hits firefox
|
||||||
'<span class="version">version ' + g_vimperator_version + '</span>'+
|
'<span class="version">version ' + g_vimperator_version + '</span>\\n'+
|
||||||
header +
|
header +
|
||||||
introduction +
|
introduction +
|
||||||
mappings +
|
mappings +
|
||||||
commands +
|
commands +
|
||||||
settings +
|
settings +
|
||||||
'</td></tr></table></pre></body></html>'
|
'\\n</td></tr></table>\\n</pre></body>\\n</html>'
|
||||||
|
|
||||||
|
|
||||||
doc.open();
|
doc.open();
|
||||||
|
|||||||
@@ -283,6 +283,11 @@ function onVimperatorKeypress(event)/*{{{*/
|
|||||||
if (key == null)
|
if (key == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// XXX: ugly hack for now pass certain keys to firefox as they are without beeping
|
||||||
|
// also fixes key navigation in menus, etc.
|
||||||
|
if (key == "<Tab>" || key == "<Return>" || key == "<Space>" || key == "<Up>" || key == "<Down>")
|
||||||
|
return false;
|
||||||
|
|
||||||
// XXX: for now only, later: input mappings if form element focused
|
// XXX: for now only, later: input mappings if form element focused
|
||||||
if (isFormElemFocused())
|
if (isFormElemFocused())
|
||||||
return false;
|
return false;
|
||||||
@@ -968,15 +973,17 @@ function createCursorPositionString()
|
|||||||
function isFormElemFocused()
|
function isFormElemFocused()
|
||||||
{
|
{
|
||||||
var elt = document.commandDispatcher.focusedElement;
|
var elt = document.commandDispatcher.focusedElement;
|
||||||
if (elt == null) return false;
|
if (elt == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
var tagName = elt.localName.toUpperCase();
|
var tagname = elt.localName.toLowerCase();
|
||||||
|
var type = elt.type.toLowerCase();
|
||||||
|
|
||||||
if (tagName == "INPUT" ||
|
if ( (tagname == "input" && (type != "image")) ||
|
||||||
tagName == "TEXTAREA" ||
|
tagname == "textarea" ||
|
||||||
tagName == "SELECT" ||
|
// tagName == "SELECT" ||
|
||||||
tagName == "BUTTON" ||
|
// tagName == "BUTTON" ||
|
||||||
tagName == "ISINDEX")
|
tagname == "isindex") // isindex is deprecated one-line input box
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user