From f3776d1e08ef0ccea1ee9723977d57db3ee90f0b Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 29 May 2011 11:37:43 +0000 Subject: [PATCH] Fixed problem with some keys in web client (issue 143). --- src/web/media/javascript/evennia_webclient.js | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/web/media/javascript/evennia_webclient.js b/src/web/media/javascript/evennia_webclient.js index ef8bb0998d..67d015c37b 100644 --- a/src/web/media/javascript/evennia_webclient.js +++ b/src/web/media/javascript/evennia_webclient.js @@ -154,7 +154,7 @@ function webclient_close(){ function msg_display(type, msg){ // Add a div to the message window. - // type givews the class of div to use. + // type gives the class of div to use. $("#messagewindow").append( "
"+ msg +"
"); // scroll message window to bottom @@ -191,23 +191,22 @@ function history_add(input) { // Catching keyboard shortcuts -$(document).keypress( function(event) { +$(document).keydown( function(event) { + // Get the pressed key var code = event.keyCode ? event.keyCode : event.which; - wresult = event.which; - - // always focus input field + // always focus input field no matter which key is pressed $("#inputfield")[0].focus(); - if (code == 13) { // Enter key + + // Special keys recognized by client + + //msg_display("out", "key code pressed: " + code); // debug + + if (code == 13) { // Enter Key webclient_input(); event.preventDefault(); return false; } else { - if (wresult == 38 || wresult == 40) { - // this fixes a bug in firefox, those are on ASCII format - return false; - } - if (code == 38) { // arrow up 38 $("#inputfield").val(function(index, value){ return history_step_back();