From 8164a52fc41cd999cd9c04adf823ac4be7d5cfb1 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 30 May 2018 16:46:01 -0400 Subject: [PATCH] no longer using bringModalToTop, in favour of taskbar modal focused class re: #6532 --- public/src/modules/chat.js | 23 ++--------------------- public/src/modules/taskbar.js | 3 +++ 2 files changed, 5 insertions(+), 21 deletions(-) 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) {