1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 21:38:11 +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:
Martin Stubenschrott
2007-05-02 12:28:04 +00:00
parent ca2f10f25f
commit e52f7ffda8
3 changed files with 36 additions and 29 deletions

View File

@@ -283,6 +283,11 @@ function onVimperatorKeypress(event)/*{{{*/
if (key == null)
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
if (isFormElemFocused())
return false;
@@ -968,15 +973,17 @@ function createCursorPositionString()
function isFormElemFocused()
{
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" ||
tagName == "TEXTAREA" ||
tagName == "SELECT" ||
tagName == "BUTTON" ||
tagName == "ISINDEX")
if ( (tagname == "input" && (type != "image")) ||
tagname == "textarea" ||
// tagName == "SELECT" ||
// tagName == "BUTTON" ||
tagname == "isindex") // isindex is deprecated one-line input box
return true;
return false;