Refine result modal and Gemini recovery
build-push / docker (push) Successful in 4m16s

This commit is contained in:
AI Assistant
2026-03-16 12:22:13 +09:00
parent 975bd99610
commit 82cead950e
5 changed files with 195 additions and 68 deletions
+18 -37
View File
@@ -42,26 +42,20 @@ const resultModalTitle = document.getElementById("resultModalTitle");
const resultModalSource = document.getElementById("resultModalSource");
const resultModalSnippet = document.getElementById("resultModalSnippet");
const resultModalReason = document.getElementById("resultModalReason");
const resultModalFrame = document.getElementById("resultModalFrame");
const resultModalOpenExternal = document.getElementById("resultModalOpenExternal");
const resultModalDownload = document.getElementById("resultModalDownload");
const closeResultModal = document.getElementById("closeResultModal");
const resultModalMediaFrame = document.getElementById("resultModalMediaFrame");
const resultModalVideo = document.getElementById("resultModalVideo");
const resultModalThumbnail = document.getElementById("resultModalThumbnail");
const resultModalEmbedNotice = document.getElementById("resultModalEmbedNotice");
const resultModalReady = Boolean(
resultModal &&
resultModalTitle &&
resultModalSource &&
resultModalSnippet &&
resultModalReason &&
resultModalFrame &&
resultModalOpenExternal &&
resultModalDownload &&
closeResultModal &&
resultModalMediaFrame &&
resultModalVideo &&
resultModalThumbnail &&
resultModalEmbedNotice,
closeResultModal,
);
let pendingDownload = null;
@@ -362,16 +356,24 @@ function hideModal(element) {
setHidden(element, true);
}
function buildResultModalEmbedURL(item) {
if (!item?.link) {
return "about:blank";
}
if (item.source === "Google Video") {
const videoId = extractYouTubeID(item.link);
if (videoId) {
return `https://www.youtube.com/embed/${videoId}?autoplay=1&rel=0`;
}
}
return item.link;
}
function resetResultModalMedia() {
if (!resultModalReady) {
return;
}
resultModalVideo.pause();
detachVideoSource(resultModalVideo);
resultModalMediaFrame.style.aspectRatio = "";
setHidden(resultModalVideo, true, "");
setHidden(resultModalThumbnail, true, "");
setHidden(resultModalEmbedNotice, false, "");
resultModalFrame.src = "about:blank";
}
function renderResults(results) {
@@ -450,16 +452,7 @@ function openResultModal(item) {
const canDirectDownload = item.source === "Google Video" && item.link;
resultModalDownload.classList.toggle("hidden", !canDirectDownload);
resetResultModalMedia();
if (item.previewVideoUrl) {
attachVideoSource(resultModalVideo, item.previewVideoUrl);
setHidden(resultModalVideo, false, "");
setHidden(resultModalEmbedNotice, true, "");
} else if (item.thumbnailUrl) {
resultModalThumbnail.src = item.thumbnailUrl;
resultModalThumbnail.alt = item.title || "";
setHidden(resultModalThumbnail, false, "");
setHidden(resultModalEmbedNotice, true, "");
}
resultModalFrame.src = buildResultModalEmbedURL(item);
showModal(resultModal);
logEvent("result:modal:open", { title: item.title, source: item.source, link: item.link });
}
@@ -690,18 +683,6 @@ previewThumbnail.addEventListener("load", () => {
previewMediaFrame.style.aspectRatio = `${previewThumbnail.naturalWidth} / ${previewThumbnail.naturalHeight}`;
}
});
if (resultModalReady) {
resultModalVideo.addEventListener("loadedmetadata", () => {
if (resultModalVideo.videoWidth > 0 && resultModalVideo.videoHeight > 0) {
resultModalMediaFrame.style.aspectRatio = `${resultModalVideo.videoWidth} / ${resultModalVideo.videoHeight}`;
}
});
resultModalThumbnail.addEventListener("load", () => {
if (!resultModalVideo.src && resultModalThumbnail.naturalWidth > 0 && resultModalThumbnail.naturalHeight > 0) {
resultModalMediaFrame.style.aspectRatio = `${resultModalThumbnail.naturalWidth} / ${resultModalThumbnail.naturalHeight}`;
}
});
}
for (const button of platformToggles) {
button.addEventListener("click", () => {
const platform = button.dataset.platformToggle;
+18 -24
View File
@@ -150,7 +150,7 @@
</div>
<div id="resultModal" class="fixed inset-0 z-50 hidden items-center justify-center bg-black/80 px-4">
<div class="flex h-[88vh] w-full max-w-7xl flex-col overflow-hidden rounded-3xl border border-white/10 bg-zinc-950 shadow-2xl">
<div class="flex w-full max-w-7xl flex-col overflow-hidden rounded-3xl border border-white/10 bg-zinc-950 shadow-2xl">
<div class="flex items-center justify-between border-b border-white/10 px-5 py-4">
<div class="min-w-0">
<p id="resultModalSource" class="text-xs uppercase tracking-[0.25em] text-zinc-500"></p>
@@ -161,29 +161,23 @@
<button id="closeResultModal" type="button" class="rounded-full border border-white/10 px-3 py-2 text-xs uppercase tracking-[0.2em] text-zinc-300">Close</button>
</div>
</div>
<div class="grid min-h-0 flex-1 gap-0 lg:grid-cols-[1.5fr_0.85fr]">
<div class="min-h-0 border-b border-white/10 lg:border-b-0 lg:border-r">
<div id="resultModalMediaFrame" class="flex h-full min-h-[320px] items-center justify-center overflow-hidden bg-black/40 p-4">
<video id="resultModalVideo" class="hidden max-h-full w-full rounded-2xl bg-black object-contain" controls playsinline></video>
<img id="resultModalThumbnail" class="hidden max-h-full w-full rounded-2xl object-contain" alt="" />
<div id="resultModalEmbedNotice" class="max-w-md rounded-3xl border border-white/10 bg-white/[0.03] p-6 text-center text-sm leading-7 text-zinc-300">
외부 사이트 임베딩 차단 문제를 피하기 위해 내부 미리보기만 표시합니다.
</div>
</div>
<div class="border-b border-white/10 bg-black/40 p-4">
<div class="aspect-video overflow-hidden rounded-2xl border border-white/10 bg-black">
<iframe id="resultModalFrame" class="h-full w-full bg-white" referrerpolicy="no-referrer" allow="autoplay; fullscreen; encrypted-media; picture-in-picture" allowfullscreen></iframe>
</div>
<div class="min-h-0 overflow-auto px-5 py-5">
<div class="space-y-5">
<div>
<p class="text-xs uppercase tracking-[0.25em] text-zinc-500">AI Note</p>
<p id="resultModalReason" class="mt-2 whitespace-pre-wrap text-sm leading-7 text-zinc-200"></p>
<button id="resultModalDownload" type="button" class="mt-4 hidden w-full rounded-2xl border border-white bg-white px-4 py-3 text-sm font-medium text-black transition hover:bg-zinc-200">
Direct Download
</button>
</div>
<div>
<p class="text-xs uppercase tracking-[0.25em] text-zinc-500">Source Summary</p>
<p id="resultModalSnippet" class="mt-2 text-sm leading-7 text-zinc-300"></p>
</div>
</div>
<div class="grid gap-5 px-5 py-5 lg:grid-cols-[1.6fr_0.8fr]">
<div class="rounded-2xl border border-white/10 bg-white/[0.03] p-5">
<p class="text-xs uppercase tracking-[0.25em] text-zinc-500">AI Note</p>
<p id="resultModalReason" class="mt-3 whitespace-pre-wrap text-sm leading-7 text-zinc-200"></p>
</div>
<div class="space-y-4 rounded-2xl border border-white/10 bg-white/[0.03] p-5">
<button id="resultModalDownload" type="button" class="hidden w-full rounded-2xl border border-white bg-white px-4 py-3 text-sm font-medium text-black transition hover:bg-zinc-200">
Direct Download
</button>
<div>
<p class="text-xs uppercase tracking-[0.25em] text-zinc-500">Source Summary</p>
<p id="resultModalSnippet" class="mt-3 text-sm leading-7 text-zinc-300"></p>
</div>
</div>
</div>
@@ -206,6 +200,6 @@
</button>
</template>
<script src="/app.js?v=20260316b" defer></script>
<script src="/app.js?v=20260316c" defer></script>
</body>
</html>