From 26a730c149bd70a8c223dd5a14fa0357c5f68e83 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Shelton" Date: Tue, 24 Nov 2026 15:16:54 -0700 Subject: [PATCH] Moved configuration dialog scripts to its own file. --- src/utils/config.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/utils/config.js diff --git a/src/utils/config.js b/src/utils/config.js new file mode 100644 index 0000000..e97d368 --- /dev/null +++ b/src/utils/config.js @@ -0,0 +1,17 @@ +export const bindEvents = () => { + document.querySelectorAll('a[data-click]').forEach((e) => { + e.addEventListener('click', (evt) => { + evt.preventDefault(); + const dialog = document.querySelector('dialog.'+e.getAttribute('data-click')); + document.querySelector('#menu-toggle').checked = false; + dialog?.classList.remove('hidden'); + dialog?.showModal(); + dialog?.addEventListener('click', (evt) => { + if (evt.target === dialog) { + dialog?.close(); + dialog?.classList.add('hidden'); + } + }); + }); + }); +};