From d16d01c943088299c1e1458ebe4310309826ac5f Mon Sep 17 00:00:00 2001 From: Psitacus Date: Wed, 7 Jan 2026 20:27:31 -0700 Subject: [PATCH] add fade in/out logic --- module/applications/ui/countdowns.mjs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/module/applications/ui/countdowns.mjs b/module/applications/ui/countdowns.mjs index 1ebec9b6..0ef5329e 100644 --- a/module/applications/ui/countdowns.mjs +++ b/module/applications/ui/countdowns.mjs @@ -91,7 +91,10 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application countdown, ownership: DhCountdowns.#getPlayerOwnership(game.user, setting, countdown) })); - return values.filter(v => v.ownership !== CONST.DOCUMENT_OWNERSHIP_LEVELS.NONE); + return values.filter(v => + v.ownership !== CONST.DOCUMENT_OWNERSHIP_LEVELS.NONE && + this.#shouldShowCountdown(v.countdown) + ); } /** @override */ @@ -247,6 +250,19 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application setupHooks() { Hooks.on(socketEvent.Refresh, this.cooldownRefresh.bind()); } + #onFocus() { + if (!this._isFocused){ + this._isFocused = true; + this.render() + } + } + + #onBlur() { + if (this._isFocused){ + this._isFocused = false; + this.render() + } + } async close(options) { /* Opt out of Foundry's standard behavior of closing all application windows marked as UI when Escape is pressed */ @@ -302,5 +318,10 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application if (options?.force) { document.getElementById('ui-right-column-1')?.appendChild(this.element); } + // Hover/focus listeners + this.element.addEventListener('mouseenter', this.#onFocus.bind(this)); + this.element.addEventListener('mouseleave', this.#onBlur.bind(this)); + this.element.addEventListener('focusin', this.#onFocus.bind(this)); + this.element.addEventListener('focusout', this.#onBlur.bind(this)); } }