2016-10-29 03:08:03 +11:00
|
|
|
<template>
|
2021-06-17 23:29:46 +10:00
|
|
|
<button
|
2020-06-29 21:48:22 +10:00
|
|
|
v-if="usePlaceholder"
|
2021-06-17 23:29:46 +10:00
|
|
|
class="Attachment -placeholder button-unstyled"
|
|
|
|
:class="classNames"
|
2019-07-05 17:17:44 +10:00
|
|
|
@click="openModal"
|
|
|
|
>
|
|
|
|
<a
|
2019-01-27 02:45:03 +11:00
|
|
|
v-if="type !== 'html'"
|
2019-07-05 17:17:44 +10:00
|
|
|
class="placeholder"
|
|
|
|
target="_blank"
|
|
|
|
:href="attachment.url"
|
2020-06-29 21:48:22 +10:00
|
|
|
:alt="attachment.description"
|
|
|
|
:title="attachment.description"
|
2019-01-27 02:45:03 +11:00
|
|
|
>
|
2020-10-21 08:01:28 +11:00
|
|
|
<FAIcon :icon="placeholderIconClass" />
|
2020-06-29 21:48:22 +10:00
|
|
|
<b>{{ nsfw ? "NSFW / " : "" }}</b>{{ placeholderName }}
|
2019-01-27 02:45:03 +11:00
|
|
|
</a>
|
2021-06-17 23:29:46 +10:00
|
|
|
</button>
|
2019-01-15 04:23:13 +11:00
|
|
|
<div
|
2019-07-05 17:17:44 +10:00
|
|
|
v-else
|
2019-01-15 04:23:13 +11:00
|
|
|
v-show="!isEmpty"
|
2021-06-17 23:29:46 +10:00
|
|
|
class="Attachment"
|
|
|
|
:class="classNames"
|
2019-01-15 04:23:13 +11:00
|
|
|
>
|
2019-07-05 17:17:44 +10:00
|
|
|
<a
|
|
|
|
v-if="hidden"
|
2021-06-17 23:29:46 +10:00
|
|
|
class="image-container"
|
2019-07-05 17:17:44 +10:00
|
|
|
:href="attachment.url"
|
2020-06-29 21:48:22 +10:00
|
|
|
:alt="attachment.description"
|
|
|
|
:title="attachment.description"
|
2020-10-02 19:21:56 +10:00
|
|
|
@click.prevent.stop="toggleHidden"
|
2019-07-05 17:17:44 +10:00
|
|
|
>
|
|
|
|
<img
|
|
|
|
:key="nsfwImage"
|
|
|
|
class="nsfw"
|
|
|
|
:src="nsfwImage"
|
|
|
|
>
|
2020-10-21 08:01:28 +11:00
|
|
|
<FAIcon
|
2019-07-05 17:17:44 +10:00
|
|
|
v-if="type === 'video'"
|
2020-10-21 08:31:16 +11:00
|
|
|
class="play-icon"
|
|
|
|
icon="play-circle"
|
2019-07-05 17:17:44 +10:00
|
|
|
/>
|
2016-10-29 03:08:03 +11:00
|
|
|
</a>
|
2021-06-17 23:29:46 +10:00
|
|
|
<div
|
|
|
|
class="attachment-buttons"
|
|
|
|
v-if="!hidden"
|
|
|
|
>
|
|
|
|
<button
|
|
|
|
v-if="type === 'flash' && flashLoaded"
|
|
|
|
class="button-unstyled attachment-button"
|
|
|
|
@click.prevent="stopFlash"
|
|
|
|
>
|
|
|
|
<FAIcon icon="stop" />
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
v-if="!useModal"
|
|
|
|
class="button-unstyled attachment-button"
|
|
|
|
@click.prevent="openModalForce"
|
|
|
|
>
|
|
|
|
<FAIcon icon="search-plus" />
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
v-if="nsfw && hideNsfwLocal"
|
|
|
|
class="button-unstyled attachment-button"
|
|
|
|
@click.prevent="toggleHidden"
|
|
|
|
>
|
|
|
|
<FAIcon icon="times" />
|
|
|
|
</button>
|
|
|
|
</div>
|
2019-01-20 21:46:11 +11:00
|
|
|
|
2019-07-05 17:17:44 +10:00
|
|
|
<a
|
|
|
|
v-if="type === 'image' && (!hidden || preloadImage)"
|
2021-06-17 23:29:46 +10:00
|
|
|
class="image-container"
|
|
|
|
:class="{'-hidden': hidden && preloadImage }"
|
2019-07-05 17:17:44 +10:00
|
|
|
:href="attachment.url"
|
|
|
|
target="_blank"
|
2021-06-17 23:29:46 +10:00
|
|
|
@click.stop.prevent="openModal"
|
2019-01-15 04:23:13 +11:00
|
|
|
>
|
2019-07-05 17:17:44 +10:00
|
|
|
<StillImage
|
2020-08-19 06:57:42 +10:00
|
|
|
class="image"
|
2019-07-05 17:17:44 +10:00
|
|
|
:referrerpolicy="referrerpolicy"
|
|
|
|
:mimetype="attachment.mimetype"
|
|
|
|
:src="attachment.large_thumb_url || attachment.url"
|
2019-10-19 07:04:17 +11:00
|
|
|
:image-load-handler="onImageLoad"
|
2019-02-18 16:03:26 +11:00
|
|
|
:alt="attachment.description"
|
2019-07-05 17:17:44 +10:00
|
|
|
/>
|
2016-11-26 11:19:25 +11:00
|
|
|
</a>
|
2016-10-29 03:08:03 +11:00
|
|
|
|
2019-07-05 17:17:44 +10:00
|
|
|
<a
|
2019-01-20 21:46:11 +11:00
|
|
|
v-if="type === 'video' && !hidden"
|
2019-07-05 17:17:44 +10:00
|
|
|
class="video-container"
|
2021-06-17 23:29:46 +10:00
|
|
|
:href="attachment.url"
|
|
|
|
@click.stop.prevent="openModal"
|
2019-01-20 21:46:11 +11:00
|
|
|
>
|
2019-07-05 17:17:44 +10:00
|
|
|
<VideoAttachment
|
|
|
|
class="video"
|
|
|
|
:attachment="attachment"
|
2021-06-17 23:29:46 +10:00
|
|
|
:controls="!useModal"
|
2020-09-29 20:18:37 +10:00
|
|
|
@play="$emit('play')"
|
|
|
|
@pause="$emit('pause')"
|
2019-07-05 17:17:44 +10:00
|
|
|
/>
|
2020-10-21 08:01:28 +11:00
|
|
|
<FAIcon
|
2021-06-17 23:29:46 +10:00
|
|
|
v-if="useModal"
|
2020-10-21 08:31:16 +11:00
|
|
|
class="play-icon"
|
|
|
|
icon="play-circle"
|
2019-07-05 17:17:44 +10:00
|
|
|
/>
|
2019-01-20 21:46:11 +11:00
|
|
|
</a>
|
2016-10-29 03:08:03 +11:00
|
|
|
|
2021-06-17 23:29:46 +10:00
|
|
|
<a
|
|
|
|
v-if="type === 'audio' && !hidden"
|
|
|
|
class="audio-container"
|
|
|
|
:href="attachment.url"
|
|
|
|
@click.stop.prevent="openModal"
|
|
|
|
>
|
|
|
|
<audio
|
|
|
|
v-if="type === 'audio'"
|
|
|
|
:src="attachment.url"
|
|
|
|
:alt="attachment.description"
|
|
|
|
:title="attachment.description"
|
|
|
|
controls
|
|
|
|
@play="$emit('play')"
|
|
|
|
@pause="$emit('pause')"
|
|
|
|
/>
|
|
|
|
</a>
|
2016-11-23 05:45:18 +11:00
|
|
|
|
2019-07-05 17:17:44 +10:00
|
|
|
<div
|
|
|
|
v-if="type === 'html' && attachment.oembed"
|
2021-06-17 23:29:46 +10:00
|
|
|
class="oembed-container"
|
2019-07-05 17:17:44 +10:00
|
|
|
@click.prevent="linkClicked"
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
v-if="attachment.thumb_url"
|
|
|
|
class="image"
|
|
|
|
>
|
|
|
|
<img :src="attachment.thumb_url">
|
2016-10-29 10:38:41 +11:00
|
|
|
</div>
|
|
|
|
<div class="text">
|
2019-07-07 07:54:17 +10:00
|
|
|
<!-- eslint-disable vue/no-v-html -->
|
2019-07-05 17:17:44 +10:00
|
|
|
<h1><a :href="attachment.url">{{ attachment.oembed.title }}</a></h1>
|
|
|
|
<div v-html="attachment.oembed.oembedHTML" />
|
2019-07-13 05:11:54 +10:00
|
|
|
<!-- eslint-enable vue/no-v-html -->
|
2016-10-29 10:38:41 +11:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-04-10 02:09:22 +10:00
|
|
|
|
2021-06-17 23:29:46 +10:00
|
|
|
<a
|
|
|
|
v-if="type === 'flash' && !hidden"
|
|
|
|
class="flash-container"
|
|
|
|
:href="attachment.url"
|
|
|
|
@click.stop.prevent="openModal"
|
|
|
|
>
|
|
|
|
<Flash
|
|
|
|
class="flash"
|
|
|
|
ref="flash"
|
|
|
|
:src="attachment.large_thumb_url || attachment.url"
|
|
|
|
@playerOpened="setFlashLoaded(true)"
|
|
|
|
@playerClosed="setFlashLoaded(false)"
|
|
|
|
/>
|
|
|
|
</a>
|
2016-10-29 03:08:03 +11:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script src="./attachment.js"></script>
|
2016-10-29 10:38:41 +11:00
|
|
|
|
2021-06-17 23:29:46 +10:00
|
|
|
<style src="./attachment.scss" lang="scss"></style>
|