Load gallery thumbnails lazily instead of all at once
All checks were successful
Docker / build (release) Successful in 9s

This commit is contained in:
krek0 2026-09-24 13:50:18 +02:00
parent e8e27cf488
commit caa83ad318
2 changed files with 1 additions and 3 deletions

View file

@ -80,8 +80,6 @@
container.style.height = (top - SPACING + PADDING) + 'px'; container.style.height = (top - SPACING + PADDING) + 'px';
items.forEach(item => { items.forEach(item => {
item.style.visibility = 'visible'; item.style.visibility = 'visible';
const img = item.querySelector('img[data-lazy]');
if (img) img.src = img.dataset.lazy;
}); });
} }

View file

@ -112,7 +112,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
data-uncensor-url="{% url 'photologue:pl-media-uncensor' item.model_name item.id %}" data-uncensor-url="{% url 'photologue:pl-media-uncensor' item.model_name item.id %}"
data-width="{{ item.thumbnail_width|default:1 }}" data-width="{{ item.thumbnail_width|default:1 }}"
data-height="{{ item.thumbnail_height|default:1 }}"> data-height="{{ item.thumbnail_height|default:1 }}">
<img src="{{ item.get_thumbnail_url }}" data-lazy="{{ item.get_thumbnail_url }}" <img src="{{ item.get_thumbnail_url }}" loading="lazy" decoding="async"
class="{% if not item.is_public %}photo-private{% endif %}" class="{% if not item.is_public %}photo-private{% endif %}"
alt="{{ item.title }}{% if item.date_taken %} - {{ item.date_taken|date }} {{ item.date_taken|time }}{% endif %} - {{ item.owner.first_name|default:item.owner.username }}{% if not item.is_video and item.license %} - {{ item.license }}{% endif %}{% if not item.is_public %} - !PRIVATE!{% endif %}"> alt="{{ item.title }}{% if item.date_taken %} - {{ item.date_taken|date }} {{ item.date_taken|time }}{% endif %} - {{ item.owner.first_name|default:item.owner.username }}{% if not item.is_video and item.license %} - {{ item.license }}{% endif %}{% if not item.is_public %} - !PRIVATE!{% endif %}">
</a> </a>