From 3bdb98e74771d3daa09b0af2553d65c00d6684d5 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Sun, 21 Dec 2014 00:08:01 -0500 Subject: [PATCH] closes #2530 --- public/src/app.js | 1 + public/src/modules/chat.js | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/public/src/app.js b/public/src/app.js index 0ee521a756..5e3b8ba76d 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -291,6 +291,7 @@ app.uid = null; function loadAndCenter(chatModal) { chat.load(chatModal.attr('UUID')); chat.center(chatModal); + chat.focusInput(chatModal); } if (!chat.modalExists(touid)) { diff --git a/public/src/modules/chat.js b/public/src/modules/chat.js index 47d914205a..02fcbba02e 100644 --- a/public/src/modules/chat.js +++ b/public/src/modules/chat.js @@ -293,6 +293,10 @@ define('chat', ['taskbar', 'string', 'sounds', 'forum/chats'], function(taskbar, }); }; + module.focusInput = function(chatModal) { + chatModal.find('#chat-message-input').focus(); + }; + module.close = function(chatModal) { clearInterval(chatModal.attr('intervalId')); chatModal.attr('intervalId', 0); @@ -310,7 +314,7 @@ define('chat', ['taskbar', 'string', 'sounds', 'forum/chats'], function(taskbar, } chatModal.css('left', Math.max(0, (($(window).width() - $(chatModal).outerWidth()) / 2) + $(window).scrollLeft()) + 'px'); chatModal.css('top', Math.max(0, $(window).height() / 2 - $(chatModal).outerHeight() / 2) + 'px'); - chatModal.find('#chat-message-input').focus(); + if (hideAfter) { chatModal.addClass('hide'); } @@ -324,6 +328,7 @@ define('chat', ['taskbar', 'string', 'sounds', 'forum/chats'], function(taskbar, taskbar.updateActive(uuid); Chats.scrollToBottom(chatModal.find('#chat-content')); module.bringModalToTop(chatModal); + module.focusInput(chatModal); socket.emit('modules.chats.markRead', chatModal.attr('touid')); };