Goondex/internal/web/static/css/gx/GX_Dialog.js
Stu Leak 16fb407a3c v0.1.0-dev4: Add web frontend with UI component library
- Implement full web interface with Go html/template server
- Add GX component library (buttons, dialogs, tables, forms, etc.)
- Create scene/performer/studio/movie detail and listing pages
- Add Adult Empire scraper for additional metadata sources
- Implement movie support with database schema
- Add import and sync services for data management
- Include comprehensive API and frontend documentation
- Add custom color scheme and responsive layout

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 10:47:30 -05:00

49 lines
1.4 KiB
JavaScript

<script>
const gxDialogOverlay = document.getElementById("gx-dialog-overlay");
const gxDialog = document.getElementById("gx-dialog");
const gxDialogTitle = gxDialog.querySelector(".gx-dialog-title");
const gxDialogBody = gxDialog.querySelector(".gx-dialog-body");
const gxDialogConfirm = document.getElementById("gx-dialog-confirm");
let gxDialogCallback = null;
/* ---- OPEN ---- */
function openDialog(title, body, onConfirm = null) {
gxDialogTitle.textContent = title;
gxDialogBody.innerHTML = body;
gxDialogCallback = onConfirm;
gxDialog.classList.add("show");
gxDialogOverlay.classList.add("show");
// Move focus to dialog for a11y
setTimeout(() => gxDialog.focus(), 10);
}
/* ---- CLOSE ---- */
function closeDialog() {
gxDialog.classList.remove("show");
gxDialogOverlay.classList.remove("show");
gxDialogCallback = null;
}
/* ---- Confirm ---- */
gxDialogConfirm.addEventListener("click", () => {
if (gxDialogCallback) gxDialogCallback();
closeDialog();
});
/* ---- Buttons with data-dialog-close ---- */
document.querySelectorAll("[data-dialog-close]").forEach(btn =>
btn.addEventListener("click", closeDialog)
);
/* ---- Click outside ---- */
gxDialogOverlay.addEventListener("click", closeDialog);
/* ---- ESC ---- */
document.addEventListener("keydown", e => {
if (e.key === "Escape") closeDialog();
});
</script>