Commit af3439b8 authored by Renato Alves's avatar Renato Alves 🌱
Browse files

Clear chat textbox after sending message

parent 8c0a2948
......@@ -319,12 +319,15 @@ define(['jquery', 'app'], function($, App) {
var key = e.which,
chat_el = $('#chatinput');
// Enter/Return key
if(key === 13) {
if(chat_el.val().replace(/\s/g, '').length) {
if(game.player) {
game.say(chat_el.val());
}
app.hideChat();
// Clear the chat box after sending
chat_el.val('');
$('#foreground').focus();
return false;
} else {
......@@ -334,6 +337,7 @@ define(['jquery', 'app'], function($, App) {
chat_el.val("");
}
// Escape key
if(key === 27) {
app.hideChat();
return false;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment