disable input "keydown" on smartphones - it's redundant there (no tab key), breaks input editing, and has some impact on performance

fix #138
This commit is contained in:
Jon Atkins 2013-04-10 04:07:20 +01:00
parent b97b2fc418
commit 0d51e045a0

View File

@ -606,21 +606,23 @@ window.chat.setupTime = function() {
window.chat.setupPosting = function() { window.chat.setupPosting = function() {
$('#chatinput input').keydown(function(event) { if (!isSmartphone()) {
try { $('#chatinput input').keydown(function(event) {
var kc = (event.keyCode ? event.keyCode : event.which); try {
if(kc === 13) { // enter var kc = (event.keyCode ? event.keyCode : event.which);
chat.postMsg(); if(kc === 13) { // enter
event.preventDefault(); chat.postMsg();
} else if (kc === 9) { // tab event.preventDefault();
event.preventDefault(); } else if (kc === 9) { // tab
window.chat.handleTabCompletion(); event.preventDefault();
window.chat.handleTabCompletion();
}
} catch(error) {
console.log(error);
debug.printStackTrace();
} }
} catch(error) { });
console.log(error); }
debug.printStackTrace();
}
});
$('#chatinput').submit(function(event) { $('#chatinput').submit(function(event) {
event.preventDefault(); event.preventDefault();