PhotoPresenter.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <div v-if="status.sensitive == true">
  3. <div class="text-light content-label">
  4. <p class="text-center">
  5. <i class="far fa-eye-slash fa-2x"></i>
  6. </p>
  7. <p class="h4 font-weight-bold text-center">
  8. Sensitive Content
  9. </p>
  10. <p class="text-center py-2">
  11. This photo contains sensitive content which <br/>
  12. some people may find offsensive or disturbing.
  13. </p>
  14. <p class="mb-0">
  15. <button @click="status.sensitive = false" class="btn btn-outline-light btn-block btn-sm font-weight-bold">See Photo</button>
  16. </p>
  17. </div>
  18. <blur-hash-image
  19. width="32"
  20. height="32"
  21. punch="1"
  22. :hash="status.media_attachments[0].blurhash"
  23. :alt="altText(status)"/>
  24. </div>
  25. <div v-else>
  26. <div :title="status.media_attachments[0].description">
  27. <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'">
  28. </div>
  29. </div>
  30. </template>
  31. <style type="text/css" scoped>
  32. .card-img-top {
  33. border-top-left-radius: 0 !important;
  34. border-top-right-radius: 0 !important;
  35. }
  36. .content-label {
  37. margin: 0;
  38. position: absolute;
  39. top:45%;
  40. left:50%;
  41. z-index: 999;
  42. transform: translate(-50%, -50%);
  43. }
  44. </style>
  45. <script type="text/javascript">
  46. export default {
  47. props: ['status'],
  48. methods: {
  49. altText(status) {
  50. let desc = status.media_attachments[0].description;
  51. if(desc) {
  52. return desc;
  53. }
  54. return 'Photo was not tagged with any alt text.';
  55. }
  56. }
  57. }
  58. </script>