add chats

This commit is contained in:
りき萌 2024-03-24 18:08:47 +01:00
parent 8f43531b47
commit 94328e0b93
12 changed files with 372 additions and 14 deletions

View file

@ -70,10 +70,12 @@ let mutationObserver = new MutationObserver(records => {
// NOTE: Added nodes may contain children which also need to be processed.
// Collect those that have [data-cast] on them and apply spells to them.
for (let addedNode of record.addedNodes) {
if (addedNode.getAttribute("data-cast") != null) {
mutatedNodes.add(addedNode);
if (!(addedNode instanceof Text)) {
if (addedNode.getAttribute("data-cast") != null) {
mutatedNodes.add(addedNode);
}
addedNode.querySelectorAll("[data-cast]").forEach(element => mutatedNodes.add(element));
}
addedNode.querySelectorAll("[data-cast]").forEach(element => mutatedNodes.add(element));
}
applySpells(mutatedNodes);
}