Moved configuration dialog scripts to its own file.

This commit is contained in:
Benjamin A. Shelton 2026-11-24 15:16:54 -07:00
commit 26a730c149
Signed by: zancarius
GPG key ID: 8BD42DBD6C337E01

17
src/utils/config.js Normal file
View file

@ -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');
}
});
});
});
};