diff src/site.js @ 20:dade6a560494

add dialogs
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 04 Nov 2024 21:37:58 -0700
parents 2c63b10781e1
children 7b339b1ccd11
line wrap: on
line diff
--- a/src/site.js	Mon Nov 04 19:23:38 2024 -0700
+++ b/src/site.js	Mon Nov 04 21:37:58 2024 -0700
@@ -74,3 +74,19 @@
 	document.cookie = 'password=; Max-Age=0; path=/;';
 	location = '/';
 }
+
+function openModal(dialog) {
+	//dialog.close();
+	dialog.showModal();
+	//dialog.scrollTop = 0;
+}
+
+function getEnclosingDialog(el) {
+	while( el.nodeName !== 'DIALOG' )
+		el = el.parentNode;
+	return el;
+}
+
+function closeModal(el) {
+	getEnclosingDialog(el).close();
+}