diff options
author | thomascube <thomas@roundcube.net> | 2007-03-28 10:39:38 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2007-03-28 10:39:38 +0000 |
commit | 9bbb17c1c6b45616825e606044272fe080787441 (patch) | |
tree | c0cd75b420f5908fde76cd0fd087b7c157450ab9 /program/js/app.js | |
parent | b566ffd2276bf469fd0e850dade0da18a4f0835b (diff) |
Abstract event keycode detection
Diffstat (limited to 'program/js/app.js')
-rw-r--r-- | program/js/app.js | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/program/js/app.js b/program/js/app.js index e166d07da..7406df2ff 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -1638,14 +1638,13 @@ function rcube_webmail() // handler for keyboard events on the _user field this.login_user_keypress = function(e) { - if (!e) - e = window.event; - var key = e.keyCode ? e.keyCode : e.which; + var key = rcube_event.get_keycode(e); + var elm; // enter - if ((key==13) && (document.form._pass)) + if ((key==13) && (elm = rcube_find_object('_pass'))) { - rcube_find_object('_pass').focus(); + elm.focus(); return false; } }; @@ -1986,11 +1985,9 @@ function rcube_webmail() if (this.ksearch_timer) clearTimeout(this.ksearch_timer); - if (!e) - e = window.event; - var highlight; - var key = e.keyCode ? e.keyCode : e.which; + var key = rcube_event.get_keycode(e); + var mod = rcube_event.get_modifier(e); switch (key) { @@ -2022,7 +2019,7 @@ function rcube_webmail() return rcube_event.cancel(e); case 9: // tab - if(e.shiftKey) + if(mod == SHIFT_KEY) break; case 13: // enter @@ -2531,7 +2528,7 @@ function rcube_webmail() // handler for keyboard events on the input field this.name_input_keypress = function(e) { - var key = document.all ? event.keyCode : document.getElementById ? e.keyCode : 0; + var key = rcube_event.get_keycode(e); // enter if (key==13) |