From b84f1277dd022ae797aa24c8126fdcca4ddf8406 Mon Sep 17 00:00:00 2001 From: Mitchdev Date: Wed, 31 Jul 2024 15:30:59 +1200 Subject: [PATCH 1/3] Remove user actions in userlist --- assets/chat/css/style.scss | 31 ---------------------------- assets/chat/js/menus/ChatUserMenu.js | 18 +--------------- 2 files changed, 1 insertion(+), 48 deletions(-) diff --git a/assets/chat/css/style.scss b/assets/chat/css/style.scss index b6b8447b..a45be050 100644 --- a/assets/chat/css/style.scss +++ b/assets/chat/css/style.scss @@ -1433,37 +1433,6 @@ hr { visibility: visible; align-items: center; display: flex; - .user-actions { - position: absolute; - right: $gutter-md; - .mention-nick { - background: transparent url('../img/icon-share.svg') no-repeat center - center; - background-size: contain; - } - .whisper-nick { - background: transparent url('../img/icon-whisper.svg') no-repeat - center center; - background-size: contain; - } - .mention-nick, - .whisper-nick { - visibility: hidden; - margin-right: $gutter-xs; - margin-top: 0.45em; - display: inline-block; - opacity: 0.25; - width: 1em; - height: 1em; - &:hover { - opacity: 1; - } - } - } - &:hover .mention-nick, - &:hover .whisper-nick { - visibility: visible; - } &:hover { background: #282828; } diff --git a/assets/chat/js/menus/ChatUserMenu.js b/assets/chat/js/menus/ChatUserMenu.js index 788c6bef..1d421bad 100644 --- a/assets/chat/js/menus/ChatUserMenu.js +++ b/assets/chat/js/menus/ChatUserMenu.js @@ -52,22 +52,6 @@ export default class ChatUserMenu extends ChatMenu { true, ), ); - this.container.on('click', '.mention-nick', (e) => { - ChatMenu.closeMenus(this.chat); - const value = this.chat.input.val().toString().trim(); - const username = $(e.target).parent().parent().data('username'); - this.chat.input - .val(`${value + (value === '' ? '' : ' ') + username} `) - .focus(); - return false; - }); - this.container.on('click', '.whisper-nick', (e) => { - ChatMenu.closeMenus(this.chat); - const value = this.chat.input.val().toString().trim(); - const username = $(e.target).parent().parent().data('username'); - this.chat.input.val(`/whisper ${username} ${value}`).focus(); - return false; - }); this.container.on('contextmenu', '.users .user-entry', (e) => { const userinfo = this.chat.menus.get('user-info'); if (userinfo) { @@ -244,7 +228,7 @@ export default class ChatUserMenu extends ChatMenu { const features = user.features.length === 0 ? 'nofeature' : user.features.join(' '); const usr = $( - `
${label}
`, + `
${label}
`, ); const section = this.sections.get(this.highestSection(user)); From f55a4ed58f0ea903c6939a9c28a9256b0eb51981 Mon Sep 17 00:00:00 2001 From: Mitchdev Date: Sat, 16 Nov 2024 14:40:21 +1300 Subject: [PATCH 2/3] Add back whisper button and add/remove on hover --- assets/chat/css/menus/_user-list.scss | 15 ++------------- assets/chat/img/icon-share.svg | 2 -- assets/chat/js/menus/ChatUserMenu.js | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 15 deletions(-) delete mode 100644 assets/chat/img/icon-share.svg diff --git a/assets/chat/css/menus/_user-list.scss b/assets/chat/css/menus/_user-list.scss index 10e45d14..12fde4d5 100644 --- a/assets/chat/css/menus/_user-list.scss +++ b/assets/chat/css/menus/_user-list.scss @@ -61,15 +61,13 @@ display: flex; .user-actions { + display: flex; position: absolute; right: a.$gutter-md; - .mention-nick, .whisper-nick { + @include a.icon-background('../img/icon-whisper.svg'); visibility: hidden; - margin-right: a.$gutter-xs; - margin-top: 0.45em; - display: inline-block; opacity: 0.25; width: 1em; height: 1em; @@ -77,20 +75,11 @@ opacity: 1; } } - - .mention-nick { - @include a.icon-background('../img/icon-share.svg'); - } - - .whisper-nick { - @include a.icon-background('../img/icon-whisper.svg'); - } } &:hover { background: #282828; - .mention-nick, .whisper-nick { visibility: visible; } diff --git a/assets/chat/img/icon-share.svg b/assets/chat/img/icon-share.svg deleted file mode 100644 index af15296d..00000000 --- a/assets/chat/img/icon-share.svg +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/assets/chat/js/menus/ChatUserMenu.js b/assets/chat/js/menus/ChatUserMenu.js index 1d421bad..6ffe88a1 100644 --- a/assets/chat/js/menus/ChatUserMenu.js +++ b/assets/chat/js/menus/ChatUserMenu.js @@ -52,6 +52,20 @@ export default class ChatUserMenu extends ChatMenu { true, ), ); + this.userActionsNode = this.createUserActionNode(); + this.container.on('mouseenter', '.user-entry', (e) => { + e.currentTarget.appendChild(this.userActionsNode); + }); + this.container.on('mouseleave', '.user-entry', (e) => { + e.currentTarget.removeChild(this.userActionsNode); + }); + this.container.on('click', '.whisper-nick', (e) => { + ChatMenu.closeMenus(this.chat); + const value = this.chat.input.val().toString().trim(); + const username = $(e.target).parent().parent().data('username'); + this.chat.input.val(`/whisper ${username} ${value}`).focus(); + return false; + }); this.container.on('contextmenu', '.users .user-entry', (e) => { const userinfo = this.chat.menus.get('user-info'); if (userinfo) { @@ -78,6 +92,16 @@ export default class ChatUserMenu extends ChatMenu { ); } + createUserActionNode() { + const userActions = document.createElement('div'); + userActions.classList.add('user-actions'); + const whisperButton = document.createElement('i'); + whisperButton.classList.add('whisper-nick'); + whisperButton.title = 'Whisper'; + userActions.append(whisperButton); + return userActions; + } + show() { super.show(); this.searchinput.focus(); From 2614819fd8fb875c5cfb019e83a218b081420781 Mon Sep 17 00:00:00 2001 From: Mitchdev Date: Sun, 24 Nov 2024 17:28:30 +1300 Subject: [PATCH 3/3] Revert some changes --- assets/chat/js/menus/ChatUserMenu.js | 36 +++++++++------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/assets/chat/js/menus/ChatUserMenu.js b/assets/chat/js/menus/ChatUserMenu.js index 4df4cf15..58edd9ae 100644 --- a/assets/chat/js/menus/ChatUserMenu.js +++ b/assets/chat/js/menus/ChatUserMenu.js @@ -53,13 +53,6 @@ export default class ChatUserMenu extends ChatMenu { true, ), ); - this.userActionsNode = this.createUserActionNode(); - this.container.on('mouseenter', '.user-entry', (e) => { - e.currentTarget.appendChild(this.userActionsNode); - }); - this.container.on('mouseleave', '.user-entry', (e) => { - e.currentTarget.removeChild(this.userActionsNode); - }); this.container.on('click', '.whisper-nick', (e) => { ChatMenu.closeMenus(this.chat); const value = this.chat.input.val().toString().trim(); @@ -93,23 +86,6 @@ export default class ChatUserMenu extends ChatMenu { ); } - createUserActionNode() { - const userActions = document.createElement('div'); - userActions.classList.add('user-actions'); - const whisperButton = document.createElement('i'); - whisperButton.classList.add('whisper-nick'); - userActions.append(whisperButton); - tippy(whisperButton, { - content: 'Whisper', - arrow: roundArrow, - duration: 0, - maxWidth: 250, - hideOnClick: false, - theme: 'dgg', - }); - return userActions; - } - show() { super.show(); this.searchinput.focus(); @@ -260,8 +236,18 @@ export default class ChatUserMenu extends ChatMenu { const features = user.features.length === 0 ? 'nofeature' : user.features.join(' '); const usr = $( - `
${label}
`, + `
${label}
`, ); + usr.find('[data-tippy-content]').each(function registerTippy() { + tippy(this, { + content: this.getAttribute('data-tippy-content'), + arrow: roundArrow, + duration: 0, + maxWidth: 250, + hideOnClick: false, + theme: 'dgg', + }); + }); const section = this.sections.get(this.highestSection(user)); if (sort && section.users.children.length > 0) {