mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 08:13:16 +00:00
Update presenter components
This commit is contained in:
parent
f33061642a
commit
e12cc6311d
2 changed files with 25 additions and 5 deletions
|
@ -7,7 +7,7 @@
|
||||||
</summary>
|
</summary>
|
||||||
<carousel ref="carousel" :centerMode="true" :loop="false" :per-page="1" :paginationPosition="'bottom-overlay'" paginationActiveColor="#3897f0" paginationColor="#dbdbdb">
|
<carousel ref="carousel" :centerMode="true" :loop="false" :per-page="1" :paginationPosition="'bottom-overlay'" paginationActiveColor="#3897f0" paginationColor="#dbdbdb">
|
||||||
<slide v-for="(img, index) in status.media_attachments" :key="'px-carousel-'+img.id + '-' + index" class="w-100 h-100 d-block mx-auto text-center" :title="img.description">
|
<slide v-for="(img, index) in status.media_attachments" :key="'px-carousel-'+img.id + '-' + index" class="w-100 h-100 d-block mx-auto text-center" :title="img.description">
|
||||||
<img :class="img.filter_class + ' img-fluid'" :src="img.url" :alt="img.description" onerror="this.onerror=null;this.src='/storage/no-preview.png'">
|
<img :class="img.filter_class + ' img-fluid'" :src="img.url" :alt="altText(img)" onerror="this.onerror=null;this.src='/storage/no-preview.png'">
|
||||||
</slide>
|
</slide>
|
||||||
</carousel>
|
</carousel>
|
||||||
</details>
|
</details>
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
<div v-else class="w-100 h-100 p-0">
|
<div v-else class="w-100 h-100 p-0">
|
||||||
<carousel ref="carousel" :centerMode="true" :loop="false" :per-page="1" :paginationPosition="'bottom-overlay'" paginationActiveColor="#3897f0" paginationColor="#dbdbdb" class="p-0 m-0">
|
<carousel ref="carousel" :centerMode="true" :loop="false" :per-page="1" :paginationPosition="'bottom-overlay'" paginationActiveColor="#3897f0" paginationColor="#dbdbdb" class="p-0 m-0">
|
||||||
<slide v-for="(img, index) in status.media_attachments" :key="'px-carousel-'+img.id + '-' + index" class="" style="background: #000; display: flex;align-items: center;" :title="img.description">
|
<slide v-for="(img, index) in status.media_attachments" :key="'px-carousel-'+img.id + '-' + index" class="" style="background: #000; display: flex;align-items: center;" :title="img.description">
|
||||||
<img :class="img.filter_class + ' img-fluid w-100 p-0'" style="" :src="img.url" :alt="img.description" onerror="this.onerror=null;this.src='/storage/no-preview.png'">
|
<img :class="img.filter_class + ' img-fluid w-100 p-0'" style="" :src="img.url" :alt="altText(img)" onerror="this.onerror=null;this.src='/storage/no-preview.png'">
|
||||||
</slide>
|
</slide>
|
||||||
</carousel>
|
</carousel>
|
||||||
</div>
|
</div>
|
||||||
|
@ -52,6 +52,15 @@
|
||||||
this.$refs.carousel.goToPage(0);
|
this.$refs.carousel.goToPage(0);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
altText(img) {
|
||||||
|
let desc = img.description;
|
||||||
|
if(desc) {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'Photo was not tagged with any alt text.';
|
||||||
|
},
|
||||||
|
|
||||||
keypressNavigation(e) {
|
keypressNavigation(e) {
|
||||||
let ref = this.$refs.carousel;
|
let ref = this.$refs.carousel;
|
||||||
if (e.keyCode == "37") {
|
if (e.keyCode == "37") {
|
||||||
|
|
|
@ -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" :title="status.media_attachments[0].description">
|
<div class="max-hide-overflow" :title="status.media_attachments[0].description">
|
||||||
<img :class="status.media_attachments[0].filter_class + ' card-img-top'" :src="status.media_attachments[0].url" loading="lazy" :alt="status.media_attachments[0].description" onerror="this.onerror=null;this.src='/storage/no-preview.png'">
|
<img :class="status.media_attachments[0].filter_class + ' card-img-top'" :src="status.media_attachments[0].url" loading="lazy" :alt="altText(status)" onerror="this.onerror=null;this.src='/storage/no-preview.png'">
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<div :title="status.media_attachments[0].description">
|
<div :title="status.media_attachments[0].description">
|
||||||
<img :class="status.media_attachments[0].filter_class + ' card-img-top'" :src="status.media_attachments[0].url" loading="lazy" :alt="status.media_attachments[0].description" onerror="this.onerror=null;this.src='/storage/no-preview.png'">
|
<img :class="status.media_attachments[0].filter_class + ' card-img-top'" :src="status.media_attachments[0].url" loading="lazy" :alt="altText(status)" onerror="this.onerror=null;this.src='/storage/no-preview.png'">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -26,6 +26,17 @@
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
export default {
|
export default {
|
||||||
props: ['status']
|
props: ['status'],
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
altText(status) {
|
||||||
|
let desc = status.media_attachments[0].description;
|
||||||
|
if(desc) {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'Photo was not tagged with any alt text.';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
Loading…
Reference in a new issue