From 26d06d9bb0463fd97fba238ed22cd2bc833d3084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 23 Aug 2023 20:19:38 -0400 Subject: [PATCH] add some missing tooltips --- public/src/client/chats.js | 21 ++++++++++++++++----- public/src/modules/chat.js | 3 ++- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/public/src/client/chats.js b/public/src/client/chats.js index bbc9810226..b020d3ecb8 100644 --- a/public/src/client/chats.js +++ b/public/src/client/chats.js @@ -43,7 +43,7 @@ define('forum/chats', [ }); Chats.init = function () { - $('.chats-full [data-bs-toggle="tooltip"]').tooltip(); + $('.chats-full [data-bs-toggle="tooltip"]').tooltip({ trigger: 'hover', container: '#content' }); socket.emit('modules.chats.enterPublic', ajaxify.data.publicRooms.map(r => r.roomId)); const env = utils.findBootstrapEnvironment(); chatNavWrapper = $('[component="chat/nav-wrapper"]'); @@ -104,7 +104,7 @@ define('forum/chats', [ Chats.addNotificationSettingHandler(roomId, mainWrapper); messageSearch.init(roomId, mainWrapper); Chats.addPublicRoomSortHandler(); - Chats.addTooltipHandler(); + Chats.addTooltipHandler(mainWrapper); }; Chats.addPublicRoomSortHandler = function () { @@ -128,8 +128,12 @@ define('forum/chats', [ } }; - Chats.addTooltipHandler = function () { - $('[data-manual-tooltip]').tooltip({ + Chats.addTooltipHandler = function (containerEl) { + if (utils.isMobile()) { + return; + } + + containerEl.find('[data-manual-tooltip]').tooltip({ trigger: 'manual', animation: false, placement: 'bottom', @@ -142,6 +146,13 @@ define('forum/chats', [ }).on('click mouseleave', function () { $(this).tooltip('hide'); }); + + containerEl.tooltip({ + selector: '[component="chat/message/controls"] button', + placement: 'top', + container: '#content', + animation: false, + }); }; Chats.addNotificationSettingHandler = function (roomId, containerEl) { @@ -524,7 +535,7 @@ define('forum/chats', [ ajaxify.data = { ...ajaxify.data, ...payload, roomId: roomId }; ajaxify.updateTitle(ajaxify.data.title); $('body').toggleClass('chat-loaded', !!roomId); - mainWrapper.find('[data-bs-toggle="tooltip"]').tooltip(); + mainWrapper.find('[data-bs-toggle="tooltip"]').tooltip({ trigger: 'hover', container: '#content' }); Chats.setActive(roomId); Chats.addEventListeners(); hooks.fire('action:chat.loaded', $('.chats-full')); diff --git a/public/src/modules/chat.js b/public/src/modules/chat.js index 23e0b67f6b..ac8c830133 100644 --- a/public/src/modules/chat.js +++ b/public/src/modules/chat.js @@ -280,6 +280,7 @@ define('chat', [ chatModal.css('position', 'fixed'); chatModal.appendTo($('body')); chatModal.find('.timeago').timeago(); + chatModal.find('[data-bs-toggle="tooltip"]').tooltip({ trigger: 'hover', container: '#content' }); ChatsMessages.wrapImagesInLinks(chatModal.find('[component="chat/messages"] .chat-content')); module.center(chatModal); @@ -370,7 +371,7 @@ define('chat', [ Chats.addCharactersLeftHandler(chatModal); Chats.addTextareaResizeHandler(chatModal); Chats.addIPHandler(chatModal); - + Chats.addTooltipHandler(chatModal); Chats.addUploadHandler({ dragDropAreaEl: chatModal.find('.modal-content'), pasteEl: chatModal,