2024-05-23 09:42:14 +00:00
|
|
|
// SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2024-03-27 15:26:32 +00:00
|
|
|
export const windowTitlePlugin = {
|
|
|
|
dependencies: ['converse-muc-views'],
|
|
|
|
overrides: {
|
|
|
|
ChatRoomView: {
|
|
|
|
requestUpdate: function (this: any): any {
|
|
|
|
console.log('[livechatWindowTitlePlugin] updating the document title.')
|
|
|
|
try {
|
|
|
|
if (this.model?.getDisplayName) {
|
|
|
|
const title = this.model.getDisplayName()
|
|
|
|
if (document.title !== title) {
|
|
|
|
document.title = title
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
console.error('[livechatWindowTitlePlugin] Failed updating the window title', err)
|
|
|
|
}
|
|
|
|
return this.__super__.requestUpdate.apply(this)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|