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 uses the Licensed Work for a purpose that does neither
directly or indirectly generate revenue. 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 Change License: Version 2 or later of the GNU General Public License as
published by the Free Software Foundation. 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 * Use of this software is governed by the Business Source License
* included in the LICENSE file. * 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 * On the date above, in accordance with the Business Source
* License, use of this software will be governed by version 2 * License, use of this software will be governed by version 2
@ -12,11 +12,10 @@
*/ */
define([ define([
'WoltLabSuite/Core/Dom/Traverse',
'WoltLabSuite/Core/Language', 'WoltLabSuite/Core/Language',
'../Helper', '../Helper',
'../MessageType', '../MessageType',
], function (DomTraverse, Language, Helper, MessageType) { ], function (Language, Helper, MessageType) {
'use strict' 'use strict'
const decorators = Symbol('decorators') const decorators = Symbol('decorators')
@ -80,17 +79,23 @@ define([
}) })
) )
const icon = elCreate('span') const button = document.createElement('button')
icon.classList.add('icon', 'icon16', 'fa-times', 'jsTooltip', 'hideIcon') button.classList.add('button', 'small', 'jsTooltip', 'hideIcon')
icon.setAttribute('title', Language.get('wcf.global.button.hide')) button.setAttribute('title', Language.get('wcf.global.button.hide'))
icon.addEventListener('click', () =>
elHide(DomTraverse.parentBySel(icon, '.chatMessageBoundary')) 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( const elem = fragment.querySelector(
'.chatMessage .containerList > li:first-child .containerHeadline' '.chatMessage .containerList > li:first-child .containerHeadline'
) )
elem.insertBefore(icon, elem.firstChild) elem.insertBefore(button, elem.firstChild)
return fragment 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 * Use of this software is governed by the Business Source License
* included in the LICENSE file. * 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 * On the date above, in accordance with the Business Source
* License, use of this software will be governed by version 2 * License, use of this software will be governed by version 2
* or later of the General Public License. * or later of the General Public License.
*/ */
define([ define(['WoltLabSuite/Core/Language', '../MessageType'], function (
'WoltLabSuite/Core/Dom/Traverse', Language,
'WoltLabSuite/Core/Language', MessageType
'../MessageType', ) {
], function (DomTraverse, Language, MessageType) {
'use strict' 'use strict'
class Where extends MessageType { class Where extends MessageType {
render(message) { render(message) {
const fragment = super.render(message) const fragment = super.render(message)
const icon = elCreate('span') const button = document.createElement('button')
icon.classList.add('icon', 'icon16', 'fa-times', 'jsTooltip', 'hideIcon') button.classList.add('button', 'small', 'jsTooltip', 'hideIcon')
icon.setAttribute('title', Language.get('wcf.global.button.hide')) button.setAttribute('title', Language.get('wcf.global.button.hide'))
icon.addEventListener('click', () =>
elHide(DomTraverse.parentBySel(icon, '.chatMessageBoundary')) 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') const elem = fragment.querySelector('.jsRoomInfo > .containerHeadline')
elem.insertBefore(icon, elem.firstChild) elem.insertBefore(button, elem.firstChild)
return fragment return fragment
} }