This commit is contained in:
partisan 2024-10-14 22:15:38 +02:00
parent 3d47c80446
commit 49f613ddeb
15 changed files with 98 additions and 234 deletions

View file

@ -78,9 +78,10 @@
src="/static/images/placeholder.svg"
data-id="{{ $result.ID }}"
alt="{{ .Title }}"
data-media="{{ .Media }}"
data-full="{{ .ProxyFull }}"
data-proxy-full="{{ .ProxyThumb }}"
class="clickable"
>
/>
<div class="resolution">{{ .Width }} × {{ .Height }}</div>
<div class="details">
<span class="img_title clickable">{{ .Title }}</span>
@ -159,12 +160,12 @@
if (!parentImageDiv) return;
const imgElement = parentImageDiv.querySelector('img.clickable');
const mediaUrl = imgElement.dataset.media; // Full-size image URL
const proxyMediaUrl = imgElement.dataset.proxyMedia || imgElement.src; // Proxied full-size image URL or thumbnail proxy
const fullImageUrl = imgElement.dataset.proxyFull; // Use data-proxy-full for ProxyFull
const thumbnailUrl = imgElement.src; // Use ProxyThumb for the thumbnail
const title = imgElement.alt;
const sourceUrl = parentImageDiv.querySelector('.img_source').href; // Source website URL
const sourceUrl = parentImageDiv.querySelector('.img_source').href; // Source webpage URL
if (!mediaUrl || viewerOpen) {
if (!fullImageUrl || viewerOpen) {
return; // Don't open if data is missing or viewer is already open
}
viewerOpen = true;
@ -175,11 +176,12 @@
const fullSizeLink = imageView.querySelector('.full-size');
const proxySizeLink = imageView.querySelector('.proxy-size');
viewerImage.src = mediaUrl;
// Set the viewer image to ProxyFull
viewerImage.src = fullImageUrl;
viewerTitle.textContent = title;
viewerSourceButton.href = sourceUrl;
fullSizeLink.href = sourceUrl; // Link to the source website
proxySizeLink.href = proxyMediaUrl; // Link to the proxied full-size image
fullSizeLink.href = sourceUrl; // Link to the source website
proxySizeLink.href = fullImageUrl; // Link to the proxied full-size image
viewerOverlay.style.display = 'flex';
imageView.classList.remove('image_hide');
@ -221,6 +223,7 @@
}
});
});
</script>
<!-- JavaScript to Load Images -->
<script>