From 0d51e045a0a14a48cfaff5c023aaa47f4abcb7cc Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Wed, 10 Apr 2013 04:07:20 +0100 Subject: [PATCH] disable input "keydown" on smartphones - it's redundant there (no tab key), breaks input editing, and has some impact on performance fix #138 --- code/chat.js | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/code/chat.js b/code/chat.js index ccdb0fbd..73d11862 100644 --- a/code/chat.js +++ b/code/chat.js @@ -606,21 +606,23 @@ window.chat.setupTime = function() { window.chat.setupPosting = function() { - $('#chatinput input').keydown(function(event) { - try { - var kc = (event.keyCode ? event.keyCode : event.which); - if(kc === 13) { // enter - chat.postMsg(); - event.preventDefault(); - } else if (kc === 9) { // tab - event.preventDefault(); - window.chat.handleTabCompletion(); + if (!isSmartphone()) { + $('#chatinput input').keydown(function(event) { + try { + var kc = (event.keyCode ? event.keyCode : event.which); + if(kc === 13) { // enter + chat.postMsg(); + event.preventDefault(); + } else if (kc === 9) { // tab + event.preventDefault(); + window.chat.handleTabCompletion(); + } + } catch(error) { + console.log(error); + debug.printStackTrace(); } - } catch(error) { - console.log(error); - debug.printStackTrace(); - } - }); + }); + } $('#chatinput').submit(function(event) { event.preventDefault();