From 9814f078eb43a7d5d0db39dc4cceaac091d509b6 Mon Sep 17 00:00:00 2001 From: Florian Greistorfer Date: Fri, 6 Feb 2026 12:22:43 +0100 Subject: [PATCH] ah geh, gehts jetzt? --- templates/functionality.js | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/templates/functionality.js b/templates/functionality.js index 9d68085..6c241b1 100644 --- a/templates/functionality.js +++ b/templates/functionality.js @@ -4,7 +4,6 @@ class PhotoGallery { this.items = []; this.shown = []; this.subfolders = []; - this.controllers = {}; this.tagDropdownShown = false; this.debounce = this.debounce.bind(this); @@ -53,20 +52,10 @@ class PhotoGallery { const img = document.createElement("img"); img.src = this.shown[imgIndex]?.src || ""; console.log("Prefetching image:", img); + prefetchDiv.removeChild(prefetchDiv.firstChild); prefetchDiv.appendChild(img); } - cancel(imgIndex) { - const prefetchDiv = document.getElementById("img-prefetch"); - if (!prefetchDiv) return; - - const img = prefetchDiv.querySelector(`img[src="${this.shown[imgIndex]?.src || ""}"]`); - if (img) { - prefetchDiv.removeChild(img); - console.log("Cancelled prefetch for image:", img); - } - } - reset() { const content = document.documentElement.innerHTML; const title = document.title; @@ -394,19 +383,12 @@ class PhotoGallery { if (!isNaN(index)) this.openSwipe(index); }); - imagelist.addEventListener("mouseenter", (event) => { + imagelist.addEventListener("mousemove", (event) => { const img = event.target.closest("img"); if (!img || !img.dataset.index) return; const index = parseInt(img.dataset.index); if (!isNaN(index)) this.prefetch(index); }); - - imagelist.addEventListener("mouseleave", (event) => { - const img = event.target.closest("img"); - if (!img || !img.dataset.index) return; - const index = parseInt(img.dataset.index); - if (!isNaN(index)) this.cancel(index); - }); } }