From ad84e36d43517dbcad840b0c486d5106a4a0b76d Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Mon, 29 Dec 2025 22:08:04 +0100 Subject: [PATCH] Suppression timestamp doublon --- changelog.md | 4 ++++ module/chat-utility.js | 27 ++++----------------------- module/chat/dialog-flush-by-date.mjs | 2 -- templates/common/date-heure.hbs | 2 +- 4 files changed, 9 insertions(+), 26 deletions(-) diff --git a/changelog.md b/changelog.md index c4b74a62..8810392c 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # 13.0 +## 13.0.27 - Les lunettes d'Illysis + +- Les heures ne sont plus affichées en doublon sur les messages + ## 13.0.26 - La ménagerie d'Illysis - Correction: on peut de nouveau modifier les caractéristiques des créatures diff --git a/module/chat-utility.js b/module/chat-utility.js index 94b65dbf..8e5bf61b 100644 --- a/module/chat-utility.js +++ b/module/chat-utility.js @@ -215,11 +215,13 @@ export class ChatUtility { static async onRenderChatMessage(chatMessage, html, data) { const rddTimestamp = chatMessage.getFlag(SYSTEM_RDD, 'rdd-timestamp') - if (rddTimestamp) { + const heureRdD = $(html).find('header.message-header .heure-rdd') + if (rddTimestamp && heureRdD.length==0) { + const messageTimestamp = $(html).find('header.message-header .message-timestamp'); const timestamp = new RdDTimestamp(rddTimestamp); const timestampData = timestamp.toCalendrier(); const dateHeure = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/common/date-heure.hbs', timestampData); - $(html).find('header.message-header .message-timestamp').after(dateHeure) + messageTimestamp.after(dateHeure) } } @@ -238,25 +240,4 @@ export class ChatUtility { const date = new Date(chatMessage.timestamp); return date?.toISOString().substring(0, 10) } - - - // async flush() { - // const question = game.i18n.localize("AreYouSure"); - // const warning = game.i18n.localize("CHAT.FlushWarning"); - // return foundry.applications.api.DialogV2.confirm({ - // window: {title: "CHAT.FlushTitle"}, - // content: `

${question} ${warning}

`, - // position: { - // top: window.innerHeight - 150, - // left: window.innerWidth - 720 - // }, - // yes: { - // callback: async () => { - // await this.documentClass.deleteDocuments([], {deleteAll: true}); - // const jumpToBottomElement = document.querySelector(".jump-to-bottom"); - // jumpToBottomElement.hidden = true; - // } - // } - // }); - // } } diff --git a/module/chat/dialog-flush-by-date.mjs b/module/chat/dialog-flush-by-date.mjs index 90732c1a..55c8923c 100644 --- a/module/chat/dialog-flush-by-date.mjs +++ b/module/chat/dialog-flush-by-date.mjs @@ -7,8 +7,6 @@ const fields = foundry.applications.fields export class DialogFlushByDate { static async init() { - Hooks.on("renderChatMessageHTML", async (app, html, msg) => await ChatUtility.onRenderChatMessage(app, html, msg)) - Hooks.on("createChatMessage", async (chatMessage, options, id) => await ChatUtility.onCreateChatMessage(chatMessage, options, id)) Hooks.once("renderChatLog", async () => await DialogFlushByDate.onFirstRenderChatLog()) } diff --git a/templates/common/date-heure.hbs b/templates/common/date-heure.hbs index f5eb6cb2..e3e84b0c 100644 --- a/templates/common/date-heure.hbs +++ b/templates/common/date-heure.hbs @@ -1,3 +1,3 @@ - + {{this.jourDuMois}} {{this.mois.label}} {{timestamp-imgSigne this.heure}} \ No newline at end of file