diff --git a/public/src/modules/chat.js b/public/src/modules/chat.js index c8f352ab2c..d06db2ce2e 100644 --- a/public/src/modules/chat.js +++ b/public/src/modules/chat.js @@ -142,24 +142,6 @@ define('chat', [ }); }; - module.bringModalToTop = function (chatModal) { - var topZ = 0; - - taskbar.updateActive(chatModal.attr('data-uuid')); - - if ($('.chat-modal').length === 1) { - return; - } - $('.chat-modal').each(function () { - var thisZ = parseInt($(this).css('zIndex'), 10); - if (thisZ > topZ) { - topZ = thisZ; - } - }); - - chatModal.css('zIndex', topZ + 1); - }; - module.getModal = function (roomId) { return $('#chat-modal-' + roomId); }; @@ -199,7 +181,7 @@ define('chat', [ chatModal.draggable({ start: function () { - module.bringModalToTop(chatModal); + taskbar.updateActive(uuid); }, stop: function () { chatModal.find('#chat-message-input').focus(); @@ -233,7 +215,7 @@ define('chat', [ }); chatModal.on('click', function () { - module.bringModalToTop(chatModal); + taskbar.updateActive(this.getAttribute('data-uuid')); if (dragged) { dragged = false; @@ -316,7 +298,6 @@ define('chat', [ chatModal.removeClass('hide'); taskbar.updateActive(uuid); ChatsMessages.scrollToBottom(chatModal.find('.chat-content')); - module.bringModalToTop(chatModal); module.focusInput(chatModal); socket.emit('modules.chats.markRead', chatModal.attr('data-roomid')); diff --git a/public/src/modules/taskbar.js b/public/src/modules/taskbar.js index 15769ced56..486111042b 100644 --- a/public/src/modules/taskbar.js +++ b/public/src/modules/taskbar.js @@ -86,6 +86,9 @@ define('taskbar', ['benchpress'], function (Benchpress) { var tasks = taskbar.tasklist.find('li'); tasks.removeClass('active'); tasks.filter('[data-uuid="' + uuid + '"]').addClass('active'); + + $('[data-uuid]:not([data-module])').toggleClass('modal-focused', false); + $('[data-uuid="' + uuid + '"]:not([data-module])').toggleClass('modal-focused', true); }; taskbar.isActive = function (uuid) {