From 6970606c42bc5a3b8c5a349703d2a580836ba523 Mon Sep 17 00:00:00 2001 From: juanatsap Date: Tue, 2 Dec 2025 16:00:00 +0000 Subject: [PATCH] refactor: simplify contact form timestamp with hyperscript + minimal JS Replace 34-line IIFE/MutationObserver with: - Hyperscript: on toggle if me.open call resetContactForm() - 11-line resetContactForm() function Also dispatches 'show' event from openModal() for ninja-keys integration. All 7 contact form tests pass. --- static/js/ninja-keys-init.js | 2 ++ templates/partials/modals/contact-modal.html | 36 +++++++++----------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/static/js/ninja-keys-init.js b/static/js/ninja-keys-init.js index 11920fb..37059d5 100644 --- a/static/js/ninja-keys-init.js +++ b/static/js/ninja-keys-init.js @@ -48,6 +48,8 @@ const modal = document.getElementById(modalId); if (modal && modal.showModal) { modal.showModal(); + // Dispatch 'show' event for hyperscript handlers + modal.dispatchEvent(new CustomEvent('show')); } ninjaKeys.close(); } diff --git a/templates/partials/modals/contact-modal.html b/templates/partials/modals/contact-modal.html index 3c86521..0750467 100644 --- a/templates/partials/modals/contact-modal.html +++ b/templates/partials/modals/contact-modal.html @@ -2,23 +2,7 @@ + on toggle if me.open call resetContactForm()">
- - + +
@@ -161,4 +146,17 @@
+ {{end}}