From 7b6dba8132222a016b9b111a16d2620a570c644e Mon Sep 17 00:00:00 2001 From: Sebastien Hut Date: Tue, 18 Nov 2014 00:40:08 +0100 Subject: [PATCH] Add contact/room with enter --- clientapp/views/main.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/clientapp/views/main.js b/clientapp/views/main.js index 640042b..7f730f5 100644 --- a/clientapp/views/main.js +++ b/clientapp/views/main.js @@ -25,7 +25,9 @@ module.exports = HumanView.extend({ 'click .reconnect': 'handleReconnect', 'click .logout': 'handleLogout', 'click .addContact': 'handleAddContact', + 'keydown #addcontact': 'keyDownAddContact', 'click .joinMUC': 'handleJoinMUC', + 'keydown #joinmuc': 'keyDownJoinMUC', 'blur #me .status': 'handleStatusChange' }, classBindings: { @@ -101,6 +103,12 @@ module.exports = HumanView.extend({ return false; }, + keyDownAddContact: function (e) { + if (e.which === 13 && !e.shiftKey) { + this.handleAddContact(e); + return false; + } + }, handleJoinMUC: function (e) { e.preventDefault(); @@ -117,5 +125,11 @@ module.exports = HumanView.extend({ }); me.mucs.save(); me.mucs.get(mucjid).join(); + }, + keyDownJoinMUC: function (e) { + if (e.which === 13 && !e.shiftKey) { + this.handleJoinMUC(e); + return false; + } } });