lightbox - lazy images when we know the width and height

This commit is contained in:
rimu 2024-03-17 16:35:26 +13:00
parent df522582fb
commit 61b7528328

View file

@ -15,7 +15,7 @@
{% if post.image.medium_url() %}
<a href="{{ post.url }}" rel="nofollow ugc" target="_blank" aria-label="{{ _('View image') }}"><img src="{{ post.image.medium_url() }}"
alt="{{ post.image.alt_text if post.image.alt_text else '' }}" title="{{ post.title }}"
loading="{{ 'lazy' if low_bandwidth else 'eager' }}" width="{{ post.image.width }}" height="{{ post.image.height }}" /></a>
loading="lazy" width="{{ post.image.width }}" height="{{ post.image.height }}" /></a>
{% elif post.image.source_url %}
<a href="{{ post.url }}" rel="nofollow ugc" target="_blank" aria-label="{{ _('View image') }}"><img src="{{ post.image.source_url }}"
alt="{{ post.title }}" title="{{ post.title }}" loading="{{ 'lazy' if low_bandwidth else 'eager' }}" /></a>
@ -27,7 +27,7 @@
{% elif post.type == POST_TYPE_IMAGE %}
<a href="{{ post.image.view_url() }}" rel="nofollow ugc" target="_blank"><img src="{{ post.image.medium_url() }}"
alt="{{ post.image.alt_text if post.image.alt_text else '' }}" title="{{ post.title }}"
loading="{{ 'lazy' if low_bandwidth else 'eager' }}" width="{{ post.image.width }}" height="{{ post.image.height }}" /></a>
loading="lazy" width="{{ post.image.width }}" height="{{ post.image.height }}" /></a>
{% else %}
<a href="{{ url_for('activitypub.post_ap', post_id=post.id) }}"><img src="{{ post.image.thumbnail_url() }}"
alt="{{ post.image.alt_text if post.image.alt_text else '' }}" loading="{{ 'lazy' if low_bandwidth else 'eager' }}" /></a>