forked from public/foundryvtt-reve-de-dragon
Suppression des messages pour les objets payés
This commit is contained in:
@ -543,11 +543,29 @@ export class RdDUtility {
|
||||
// TODO: diminuer la quantité ou supprimer le message
|
||||
// message: => document.querySelector("#chat-log > li:nth-child(61) > div > div > span > a")
|
||||
// => ../../../..[@data-message-id]
|
||||
|
||||
let chatMessageId = RdDUtility.findChatMessageId(event.currentTarget);
|
||||
if (chatMessageId) {
|
||||
ChatUtility.removeChatMessageId(chatMessageId);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static findChatMessageId(current) {
|
||||
const isChatMessageWithId = it => it.classList.contains('chat-message') && it.attributes.getNamedItem('data-message-id');
|
||||
return RdDUtility.findNodeMatching(current, isChatMessageWithId)?.attributes.getNamedItem('data-message-id').value;
|
||||
}
|
||||
|
||||
static findNodeMatching(current, predicate) {
|
||||
if (current) {
|
||||
if (predicate(current)) {
|
||||
return current;
|
||||
}
|
||||
return RdDUtility.findNodeMatching(current.parentElement, predicate);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
static getSelectedActor(msgPlayer = '') {
|
||||
if (canvas.tokens.controlled.length == 1) {
|
||||
let token = canvas.tokens.controlled[0];
|
||||
|
Reference in New Issue
Block a user