1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-21 21:30:08 +00:00

Make the .hideIcon for Info and Where messages a button

This implicitly fixes the cursor to properly show a pointer cursor.
This commit is contained in:
Tim Düsterhus 2024-01-13 20:35:22 +01:00
parent 03005a86c3
commit dd4ecbd4ba
Signed by: TimWolla
GPG Key ID: 8FF75566094168AF
3 changed files with 36 additions and 26 deletions

View File

@ -10,7 +10,7 @@ Additional Use Grant: You may use the Licensed Work when your application
uses the Licensed Work for a purpose that does neither
directly or indirectly generate revenue.
Change Date: 2027-02-22
Change Date: 2028-01-13
Change License: Version 2 or later of the GNU General Public License as
published by the Free Software Foundation.

View File

@ -1,10 +1,10 @@
/*
* Copyright (c) 2010-2021 Tim Düsterhus.
* Copyright (c) 2010-2024 Tim Düsterhus.
*
* Use of this software is governed by the Business Source License
* included in the LICENSE file.
*
* Change Date: 2027-02-22
* Change Date: 2028-01-13
*
* On the date above, in accordance with the Business Source
* License, use of this software will be governed by version 2
@ -12,11 +12,10 @@
*/
define([
'WoltLabSuite/Core/Dom/Traverse',
'WoltLabSuite/Core/Language',
'../Helper',
'../MessageType',
], function (DomTraverse, Language, Helper, MessageType) {
], function (Language, Helper, MessageType) {
'use strict'
const decorators = Symbol('decorators')
@ -80,17 +79,23 @@ define([
})
)
const icon = elCreate('span')
icon.classList.add('icon', 'icon16', 'fa-times', 'jsTooltip', 'hideIcon')
icon.setAttribute('title', Language.get('wcf.global.button.hide'))
icon.addEventListener('click', () =>
elHide(DomTraverse.parentBySel(icon, '.chatMessageBoundary'))
)
const button = document.createElement('button')
button.classList.add('button', 'small', 'jsTooltip', 'hideIcon')
button.setAttribute('title', Language.get('wcf.global.button.hide'))
button.addEventListener('click', () => {
button.closest('.chatMessageBoundary').hidden = true
})
const icon = document.createElement('span')
icon.classList.add('icon', 'icon16', 'fa-times')
button.append(icon)
const elem = fragment.querySelector(
'.chatMessage .containerList > li:first-child .containerHeadline'
)
elem.insertBefore(icon, elem.firstChild)
elem.insertBefore(button, elem.firstChild)
return fragment
}

View File

@ -1,36 +1,41 @@
/*
* Copyright (c) 2010-2021 Tim Düsterhus.
* Copyright (c) 2010-2024 Tim Düsterhus.
*
* Use of this software is governed by the Business Source License
* included in the LICENSE file.
*
* Change Date: 2027-02-22
* Change Date: 2028-01-13
*
* On the date above, in accordance with the Business Source
* License, use of this software will be governed by version 2
* or later of the General Public License.
*/
define([
'WoltLabSuite/Core/Dom/Traverse',
'WoltLabSuite/Core/Language',
'../MessageType',
], function (DomTraverse, Language, MessageType) {
define(['WoltLabSuite/Core/Language', '../MessageType'], function (
Language,
MessageType
) {
'use strict'
class Where extends MessageType {
render(message) {
const fragment = super.render(message)
const icon = elCreate('span')
icon.classList.add('icon', 'icon16', 'fa-times', 'jsTooltip', 'hideIcon')
icon.setAttribute('title', Language.get('wcf.global.button.hide'))
icon.addEventListener('click', () =>
elHide(DomTraverse.parentBySel(icon, '.chatMessageBoundary'))
)
const button = document.createElement('button')
button.classList.add('button', 'small', 'jsTooltip', 'hideIcon')
button.setAttribute('title', Language.get('wcf.global.button.hide'))
button.addEventListener('click', () => {
button.closest('.chatMessageBoundary').hidden = true
})
const icon = document.createElement('span')
icon.classList.add('icon', 'icon16', 'fa-times')
button.append(icon)
const elem = fragment.querySelector('.jsRoomInfo > .containerHeadline')
elem.insertBefore(icon, elem.firstChild)
elem.insertBefore(button, elem.firstChild)
return fragment
}