Skip to content

Commit

Permalink
Merge pull request #132 from etiquettestartshere/4.0.11
Browse files Browse the repository at this point in the history
fixed don't close on apply for items with multiple effects
  • Loading branch information
etiquettestartshere authored Oct 31, 2024
2 parents 6b52366 + 4b68bd1 commit bf8aee5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "effectivetray",
"title": "Effective Tray",
"version": "4.0.10",
"version": "4.0.11",
"compatibility": {
"minimum": "12",
"verified": "12"
Expand Down
24 changes: 13 additions & 11 deletions scripts/effective-tray.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -159,19 +159,21 @@ export class EffectiveTray {
// Handle tray collapse behavior
const tray = html.querySelector('.card-tray');
if (!tray) return;
const button = tray.querySelector("button.apply-damage") || tray.querySelector("li.effect:has(.apply-effect)");
if (button) button.addEventListener('click', (event) => {
if (game.settings.get(MODULE, "dontCloseOnPress")) {
event.preventDefault();
tray.classList.remove("collapsed");
tray.classList.add("et-uncollapsed");
} else {
if (html.querySelector(".card-tray.et-uncollapsed")) tray.classList.toggle("et-uncollapsed");
};
});
const buttons = tray.querySelectorAll("button.apply-damage, li.effect:has(.apply-effect)");
if (buttons) for (const button of buttons) {
button.addEventListener('click', (event) => {
if (game.settings.get(MODULE, "dontCloseOnPress")) {
event.preventDefault();
tray.classList.remove("collapsed");
tray.classList.add("et-uncollapsed");
} else {
if (html.querySelector(".card-tray.et-uncollapsed")) tray.classList.toggle("et-uncollapsed");
};
});
};
const upper = tray?.querySelector(".roboto-upper");
const el = html.querySelector('effective-damage-application, damage-application, effective-effect-application, effect-application');
upper.addEventListener('click', () => {
if (upper) upper.addEventListener('click', () => {
if (html.querySelector(".et-uncollapsed")) {
tray.classList.toggle("et-uncollapsed");
tray.classList.remove("collapsed");
Expand Down

0 comments on commit bf8aee5

Please sign in to comment.