Fixed problem with some keys in web client (issue 143).
This commit is contained in:
parent
a8a70e9f5e
commit
f3776d1e08
1 changed files with 10 additions and 11 deletions
|
|
@ -154,7 +154,7 @@ function webclient_close(){
|
||||||
|
|
||||||
function msg_display(type, msg){
|
function msg_display(type, msg){
|
||||||
// Add a div to the message window.
|
// 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(
|
$("#messagewindow").append(
|
||||||
"<div class='msg "+ type +"'>"+ msg +"</div>");
|
"<div class='msg "+ type +"'>"+ msg +"</div>");
|
||||||
// scroll message window to bottom
|
// scroll message window to bottom
|
||||||
|
|
@ -191,23 +191,22 @@ function history_add(input) {
|
||||||
|
|
||||||
// Catching keyboard shortcuts
|
// Catching keyboard shortcuts
|
||||||
|
|
||||||
$(document).keypress( function(event) {
|
$(document).keydown( function(event) {
|
||||||
|
// Get the pressed key
|
||||||
var code = event.keyCode ? event.keyCode : event.which;
|
var code = event.keyCode ? event.keyCode : event.which;
|
||||||
wresult = event.which;
|
// always focus input field no matter which key is pressed
|
||||||
|
|
||||||
// always focus input field
|
|
||||||
$("#inputfield")[0].focus();
|
$("#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();
|
webclient_input();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
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
|
if (code == 38) { // arrow up 38
|
||||||
$("#inputfield").val(function(index, value){
|
$("#inputfield").val(function(index, value){
|
||||||
return history_step_back();
|
return history_step_back();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue