lazy load streamable and redgifs

This commit is contained in:
rimu 2024-09-22 22:05:21 +12:00
parent 69ac4f2beb
commit 3fb7470f33

View file

@ -30,9 +30,9 @@
{% endif -%} {% endif -%}
</video></p> </video></p>
{% elif post.url.startswith('https://streamable.com') -%} {% elif post.url.startswith('https://streamable.com') -%}
<div style="padding-bottom: 56.25%; position: relative;"><iframe style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;" src="{{ post.url.replace('streamable.com/', 'streamable.com/e/') }}" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture; fullscreen" width="100%" height="100%" frameborder="0"></iframe></div> <div style="padding-bottom: 56.25%; position: relative;"><iframe loading="lazy" style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;" src="{{ post.url.replace('streamable.com/', 'streamable.com/e/') }}" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture; fullscreen" width="100%" height="100%" frameborder="0"></iframe></div>
{% elif post.url.startswith('https://www.redgifs.com/watch/') -%} {% elif post.url.startswith('https://www.redgifs.com/watch/') -%}
<div style="padding-bottom: 56.25%; position: relative;"><iframe style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;" src="{{ post.url.replace('redgifs.com/watch/', 'redgifs.com/ifr/') }}" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture; fullscreen" width="100%" height="100%" frameborder="0"></iframe></div> <div style="padding-bottom: 56.25%; position: relative;"><iframe loading="lazy" style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;" src="{{ post.url.replace('redgifs.com/watch/', 'redgifs.com/ifr/') }}" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture; fullscreen" width="100%" height="100%" frameborder="0"></iframe></div>
{% endif -%} {% endif -%}
{% if 'youtube.com' in post.url -%} {% if 'youtube.com' in post.url -%}
<div class="video-wrapper" data-src="https://www.youtube.com/embed/{{ post.youtube_embed() }}"> <div class="video-wrapper" data-src="https://www.youtube.com/embed/{{ post.youtube_embed() }}">
@ -42,7 +42,7 @@
</div> </div>
{% endif -%} {% endif -%}
{% if 'videos/watch' in post.url -%} {% if 'videos/watch' in post.url -%}
<div style="padding-bottom: 56.25%; position: relative;"><iframe style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;" src="{{ post.peertube_embed() }}" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture; fullscreen" width="100%" height="100%" frameborder="0"></iframe></div> <div style="padding-bottom: 56.25%; position: relative;"><iframe loading="lazy" style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;" src="{{ post.peertube_embed() }}" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture; fullscreen" width="100%" height="100%" frameborder="0"></iframe></div>
{% endif -%} {% endif -%}
</div> </div>
</div> </div>