Add loading="lazy" lazy loading to <img> presenters

pull/1136/head
Daniel Supernault 2019-04-07 22:01:05 -06:00
rodzic f72c0c8695
commit 7b68ebe298
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 0DEF1C662C9033F7
3 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -19,7 +19,7 @@
</video> </video>
<div v-else-if="media.type == 'Image'" slot="img" :class="media.filter_class" v-on:click="$emit('lightbox', media)"> <div v-else-if="media.type == 'Image'" slot="img" :class="media.filter_class" v-on:click="$emit('lightbox', media)">
<img class="d-block img-fluid w-100" :src="media.url" :alt="media.description" :title="media.description"> <img class="d-block img-fluid w-100" :src="media.url" :alt="media.description" :title="media.description" loading="lazy">
</div> </div>
<p v-else class="text-center p-0 font-weight-bold text-white">Error: Problem rendering preview.</p> <p v-else class="text-center p-0 font-weight-bold text-white">Error: Problem rendering preview.</p>
@ -43,7 +43,7 @@
</video> </video>
<div v-else-if="media.type == 'Image'" slot="img" :class="media.filter_class" v-on:click="$emit('lightbox', media)"> <div v-else-if="media.type == 'Image'" slot="img" :class="media.filter_class" v-on:click="$emit('lightbox', media)">
<img class="d-block img-fluid w-100" :src="media.url" :alt="media.description" :title="media.description"> <img class="d-block img-fluid w-100" :src="media.url" :alt="media.description" :title="media.description" loading="lazy">
</div> </div>
<p v-else class="text-center p-0 font-weight-bold text-white">Error: Problem rendering preview.</p> <p v-else class="text-center p-0 font-weight-bold text-white">Error: Problem rendering preview.</p>

Wyświetl plik

@ -14,7 +14,7 @@
> >
<b-carousel-slide v-for="(img, index) in status.media_attachments" :key="img.id"> <b-carousel-slide v-for="(img, index) in status.media_attachments" :key="img.id">
<div slot="img" :class="img.filter_class + ' d-block mx-auto text-center'" style="max-height: 600px;" v-on:click="$emit('lightbox', img)"> <div slot="img" :class="img.filter_class + ' d-block mx-auto text-center'" style="max-height: 600px;" v-on:click="$emit('lightbox', img)">
<img class="img-fluid" style="max-height: 600px;" :src="img.url" :alt="img.description" :title="img.description"> <img class="img-fluid" style="max-height: 600px;" :src="img.url" :alt="img.description" :title="img.description" loading="lazy">
</div> </div>
</b-carousel-slide> </b-carousel-slide>
<span class="badge badge-dark box-shadow" style="position: absolute;top:10px;right:10px;"> <span class="badge badge-dark box-shadow" style="position: absolute;top:10px;right:10px;">
@ -33,7 +33,7 @@
> >
<b-carousel-slide v-for="(img, index) in status.media_attachments" :key="img.id" :alt="img.description" :title="img.description"> <b-carousel-slide v-for="(img, index) in status.media_attachments" :key="img.id" :alt="img.description" :title="img.description">
<div slot="img" :class="img.filter_class + ' d-block mx-auto text-center'" style="max-height: 600px;" v-on:click="$emit('lightbox', img)"> <div slot="img" :class="img.filter_class + ' d-block mx-auto text-center'" style="max-height: 600px;" v-on:click="$emit('lightbox', img)">
<img class="img-fluid" style="max-height: 600px;" :src="img.url"> <img class="img-fluid" style="max-height: 600px;" :src="img.url" loading="lazy">
</div> </div>
</b-carousel-slide> </b-carousel-slide>
<span class="badge badge-dark box-shadow" style="position: absolute;top:10px;right:10px;"> <span class="badge badge-dark box-shadow" style="position: absolute;top:10px;right:10px;">

Wyświetl plik

@ -6,13 +6,13 @@
<p class="font-weight-light">(click to show)</p> <p class="font-weight-light">(click to show)</p>
</summary> </summary>
<div class="max-hide-overflow" v-on:click="$emit('lightbox', status.media_attachments[0])" :class="status.media_attachments[0].filter_class" :alt="status.media_attachments[0].description" :title="status.media_attachments[0].description"> <div class="max-hide-overflow" v-on:click="$emit('lightbox', status.media_attachments[0])" :class="status.media_attachments[0].filter_class" :alt="status.media_attachments[0].description" :title="status.media_attachments[0].description">
<img class="card-img-top" :src="status.media_attachments[0].url"> <img class="card-img-top" :src="status.media_attachments[0].url" loading="lazy">
</div> </div>
</details> </details>
</div> </div>
<div v-else> <div v-else>
<div :class="status.media_attachments[0].filter_class" v-on:click="$emit('lightbox', status.media_attachments[0])" :alt="status.media_attachments[0].description" :title="status.media_attachments[0].description"> <div :class="status.media_attachments[0].filter_class" v-on:click="$emit('lightbox', status.media_attachments[0])" :alt="status.media_attachments[0].description" :title="status.media_attachments[0].description">
<img class="card-img-top" :src="status.media_attachments[0].url"> <img class="card-img-top" :src="status.media_attachments[0].url" loading="lazy">
</div> </div>
</div> </div>
</template> </template>