organisation & minor fixes
This commit is contained in:
@@ -141,7 +141,7 @@ async function toggleFavorite(item) {
|
||||
}
|
||||
}
|
||||
|
||||
function createGalleryCard(item) {
|
||||
function createGalleryCard(item, isLoadMore = false) {
|
||||
const card = document.createElement('a');
|
||||
card.className = 'gallery-card grid-item';
|
||||
card.href = `/gallery/${item.provider || currentProvider || 'unknown'}/${encodeURIComponent(item.id)}`;
|
||||
@@ -151,9 +151,10 @@ function createGalleryCard(item) {
|
||||
img.className = 'gallery-card-img';
|
||||
|
||||
img.src = getProxiedImageUrl(item);
|
||||
|
||||
img.alt = getTagsArray(item).join(', ') || 'Image';
|
||||
img.loading = 'lazy';
|
||||
if (isLoadMore) {
|
||||
img.loading = 'lazy';
|
||||
}
|
||||
|
||||
const favBtn = document.createElement('button');
|
||||
favBtn.className = 'fav-btn';
|
||||
@@ -273,7 +274,7 @@ async function searchGallery(isLoadMore = false) {
|
||||
if (msnry) msnry.remove(toRemove);
|
||||
toRemove.forEach(el => el.remove());
|
||||
|
||||
const newCards = results.map(item => createGalleryCard(item));
|
||||
const newCards = results.map((item, index) => createGalleryCard(item, isLoadMore));
|
||||
newCards.forEach(card => resultsContainer.appendChild(card));
|
||||
if (msnry) msnry.appended(newCards);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user