mobile view issue
Some checks failed
ci / site (push) Has been cancelled
publish-image / publish (push) Has been cancelled

This commit is contained in:
2026-02-10 23:50:21 -05:00
parent 65b51d573a
commit 2b4c8a79e3

View File

@@ -68,6 +68,24 @@ import { LINKS } from "../lib/links";
let triggerElement = null; let triggerElement = null;
let currentTargetId = null; let currentTargetId = null;
function showDialog() {
if (typeof dialog.showModal === "function") {
dialog.showModal();
return;
}
dialog.setAttribute("open", "");
}
function hideDialog() {
if (typeof dialog.close === "function") {
dialog.close();
return;
}
dialog.removeAttribute("open");
}
// Extract video ID from YouTube URL // Extract video ID from YouTube URL
function extractYoutubeId(url) { function extractYoutubeId(url) {
try { try {
@@ -182,7 +200,7 @@ import { LINKS } from "../lib/links";
if (!dialog.open) return; if (!dialog.open) return;
stopPlayback(); stopPlayback();
dialog.close(); hideDialog();
// Emit media_preview_close event if Umami is available // Emit media_preview_close event if Umami is available
if (typeof window.umami !== "undefined" && currentTargetId) { if (typeof window.umami !== "undefined" && currentTargetId) {
@@ -370,12 +388,15 @@ import { LINKS } from "../lib/links";
ctasEl.appendChild(viewLink); ctasEl.appendChild(viewLink);
// Open the dialog // Open the dialog
dialog.showModal(); showDialog();
} }
// Listen for clicks on modal-trigger cards // Listen for clicks on modal-trigger cards
document.addEventListener("click", function(e) { document.addEventListener("click", function(e) {
const card = e.target.closest("button.card[data-item-id]"); const target = e.target instanceof Element ? e.target : null;
if (!target) return;
const card = target.closest("button.card[data-item-id]");
if (card) { if (card) {
e.preventDefault(); e.preventDefault();
openModal(card); openModal(card);