Beta-2.1 - The clearer, the faster #22
@@ -4,6 +4,24 @@ let heroImages = [];
 | 
				
			|||||||
let allTags = []; // global tag list
 | 
					let allTags = []; // global tag list
 | 
				
			||||||
let showOnlyUntagged = false;
 | 
					let showOnlyUntagged = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// --- Fade-in helper ---
 | 
				
			||||||
 | 
					function applyFadeInImages(container) {
 | 
				
			||||||
 | 
					  const fadeImages = container.querySelectorAll("img.fade-in-img");
 | 
				
			||||||
 | 
					  fadeImages.forEach(img => {
 | 
				
			||||||
 | 
					    const onLoad = () => {
 | 
				
			||||||
 | 
					      img.classList.add("loaded");
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					    if (img.complete && img.naturalHeight !== 0) {
 | 
				
			||||||
 | 
					      onLoad();
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      img.addEventListener("load", onLoad, { once: true });
 | 
				
			||||||
 | 
					      img.addEventListener("error", () => {
 | 
				
			||||||
 | 
					        console.warn("Image failed to load:", img.dataset?.src || img.src);
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// --- Load images from server on page load ---
 | 
					// --- Load images from server on page load ---
 | 
				
			||||||
async function loadData() {
 | 
					async function loadData() {
 | 
				
			||||||
  try {
 | 
					  try {
 | 
				
			||||||
@@ -94,20 +112,7 @@ function renderGallery() {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Fade-in effect for loaded images
 | 
					  // Fade-in effect for loaded images
 | 
				
			||||||
  const fadeImages = document.querySelectorAll("img.fade-in-img");
 | 
					  applyFadeInImages(container);
 | 
				
			||||||
  fadeImages.forEach(img => {
 | 
					 | 
				
			||||||
    const onLoad = () => {
 | 
					 | 
				
			||||||
      img.classList.add("loaded");
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
    if (img.complete && img.naturalHeight !== 0) {
 | 
					 | 
				
			||||||
      onLoad();
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
      img.addEventListener("load", onLoad, { once: true });
 | 
					 | 
				
			||||||
      img.addEventListener("error", () => {
 | 
					 | 
				
			||||||
        console.warn("Image failed to load:", img.dataset.src || img.src);
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// --- Render tags for a single image ---
 | 
					// --- Render tags for a single image ---
 | 
				
			||||||
@@ -322,6 +327,9 @@ function renderHero() {
 | 
				
			|||||||
  if (removeAllBtnBottom) {
 | 
					  if (removeAllBtnBottom) {
 | 
				
			||||||
    removeAllBtnBottom.style.display = heroImages.length > 0 ? 'inline-block' : 'none';
 | 
					    removeAllBtnBottom.style.display = heroImages.length > 0 ? 'inline-block' : 'none';
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Fade-in effect for loaded images
 | 
				
			||||||
 | 
					  applyFadeInImages(container);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// --- Save gallery to server ---
 | 
					// --- Save gallery to server ---
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user