2019-12-13 04:04:04 +00:00
|
|
|
<template>
|
2021-01-23 22:26:56 +00:00
|
|
|
<div class="media-container">
|
2020-07-01 02:47:05 +00:00
|
|
|
<div
|
2021-01-23 22:26:56 +00:00
|
|
|
class="media"
|
|
|
|
:class="{ center: release.photos.length < 2 }"
|
2020-07-01 02:47:05 +00:00
|
|
|
>
|
2021-01-23 22:26:56 +00:00
|
|
|
<div
|
|
|
|
v-if="release.trailer || release.teaser"
|
|
|
|
class="trailer-container"
|
2020-05-21 22:55:11 +00:00
|
|
|
>
|
2021-02-04 02:06:19 +00:00
|
|
|
<Player
|
2021-01-23 22:26:56 +00:00
|
|
|
v-if="release.trailer"
|
2021-02-04 02:06:19 +00:00
|
|
|
:video="release.trailer"
|
2021-01-25 22:15:41 +00:00
|
|
|
:poster="poster"
|
2021-02-11 01:01:48 +00:00
|
|
|
class="item trailer"
|
2021-02-04 02:06:19 +00:00
|
|
|
@play="playing = true; paused = false;"
|
2021-01-23 22:26:56 +00:00
|
|
|
@pause="playing = false; paused = true;"
|
2021-02-04 02:06:19 +00:00
|
|
|
/>
|
|
|
|
|
|
|
|
<Player
|
2021-01-23 22:26:56 +00:00
|
|
|
v-else-if="release.teaser && /^video\//.test(release.teaser.mime)"
|
2021-02-04 02:06:19 +00:00
|
|
|
:video="release.teaser"
|
2021-01-25 22:15:41 +00:00
|
|
|
:poster="poster"
|
2021-01-23 22:26:56 +00:00
|
|
|
:alt="release.title"
|
|
|
|
:class="{ sfw: sfw && paused }"
|
2021-02-11 01:01:48 +00:00
|
|
|
class="item trailer"
|
2021-02-04 02:06:19 +00:00
|
|
|
@play="playing = true; paused = false;"
|
2021-01-23 22:26:56 +00:00
|
|
|
@pause="playing = false; paused = true;"
|
2021-02-04 02:06:19 +00:00
|
|
|
/>
|
2020-03-01 04:28:08 +00:00
|
|
|
|
2020-05-21 22:55:11 +00:00
|
|
|
<img
|
2021-01-23 22:26:56 +00:00
|
|
|
v-else-if="release.teaser && /^image\//.test(release.teaser.mime)"
|
2021-02-22 01:33:39 +00:00
|
|
|
:src="getPath(release.teaser, 'thumbnail', { original: true })"
|
2021-01-23 22:26:56 +00:00
|
|
|
:alt="release.title"
|
2021-03-20 02:33:29 +00:00
|
|
|
:width="release.teaser.thumbnailWidth"
|
|
|
|
:height="release.teaser.thumbnailHeight"
|
2020-12-26 22:51:27 +00:00
|
|
|
loading="lazy"
|
2021-01-23 22:26:56 +00:00
|
|
|
class="item trailer"
|
2020-05-21 22:55:11 +00:00
|
|
|
>
|
2020-03-09 01:02:29 +00:00
|
|
|
|
2021-01-23 22:26:56 +00:00
|
|
|
<a
|
|
|
|
v-if="release.poster"
|
|
|
|
v-tooltip="'View poster'"
|
2021-02-23 15:47:34 +00:00
|
|
|
:href="getPath(release.poster)"
|
2021-01-23 22:26:56 +00:00
|
|
|
:class="{ playing }"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
class="poster-link"
|
|
|
|
><Icon icon="image" /></a>
|
2020-04-02 00:02:03 +00:00
|
|
|
|
2020-07-06 00:40:10 +00:00
|
|
|
<span
|
2021-01-23 22:26:56 +00:00
|
|
|
v-if="sfw && !playing"
|
2020-07-06 00:40:10 +00:00
|
|
|
class="warning"
|
|
|
|
>
|
|
|
|
<Icon icon="warning2" />NSFW
|
|
|
|
</span>
|
2021-01-23 22:26:56 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<template v-if="release.covers && release.covers.length > 0">
|
|
|
|
<a
|
|
|
|
v-for="cover in release.covers"
|
|
|
|
:key="`cover-${cover.id}`"
|
2021-02-23 00:30:38 +00:00
|
|
|
:href="getPath(cover)"
|
2021-01-23 22:26:56 +00:00
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
>
|
|
|
|
<img
|
2021-02-22 01:33:39 +00:00
|
|
|
:src="getPath(cover, 'thumbnail')"
|
|
|
|
:style="{ 'background-image': getBgPath(cover, 'lazy') }"
|
2021-03-20 02:33:29 +00:00
|
|
|
:width="cover.thumbnailWidth"
|
|
|
|
:height="cover.thumbnailHeight"
|
2021-01-23 22:26:56 +00:00
|
|
|
class="item cover"
|
|
|
|
loading="lazy"
|
|
|
|
@load="$emit('load', $event)"
|
|
|
|
>
|
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<div
|
|
|
|
v-for="photo in photos"
|
|
|
|
:key="`media-${photo.id}`"
|
|
|
|
class="item-container"
|
|
|
|
>
|
|
|
|
<a
|
2021-02-22 01:33:39 +00:00
|
|
|
:href="getPath(photo)"
|
2021-01-23 22:26:56 +00:00
|
|
|
:class="{ sfw }"
|
|
|
|
class="item-link"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
>
|
|
|
|
<img
|
2021-02-22 01:33:39 +00:00
|
|
|
:src="getPath(photo, 'thumbnail')"
|
2021-03-16 02:55:20 +00:00
|
|
|
:style="{ 'background-image': `url('${getPath(photo, 'lazy')}` }"
|
2021-01-23 22:26:56 +00:00
|
|
|
:alt="`Photo ${photo.index + 1}`"
|
2021-03-20 02:33:29 +00:00
|
|
|
:width="photo.thumbnailWidth"
|
|
|
|
:height="photo.thumbnailHeight"
|
2021-01-23 22:26:56 +00:00
|
|
|
loading="lazy"
|
|
|
|
class="item"
|
|
|
|
@load="$emit('load', $event)"
|
|
|
|
>
|
|
|
|
|
|
|
|
<span
|
|
|
|
v-if="sfw"
|
|
|
|
class="warning"
|
|
|
|
>
|
|
|
|
<Icon icon="warning2" />NSFW
|
|
|
|
</span>
|
|
|
|
</a>
|
|
|
|
</div>
|
2021-05-15 00:51:52 +00:00
|
|
|
|
|
|
|
<div
|
|
|
|
v-if="!me"
|
|
|
|
class="item-container item-more"
|
|
|
|
><router-link
|
|
|
|
:to="{ name: 'signup', query: { ref: $route.path } }"
|
|
|
|
class="link"
|
|
|
|
>Sign up</router-link> for more photos, trailers and features!</div>
|
2020-07-06 00:40:10 +00:00
|
|
|
</div>
|
2020-05-21 22:55:11 +00:00
|
|
|
</div>
|
2019-12-13 04:04:04 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-02-04 02:06:19 +00:00
|
|
|
import Player from '../video/player.vue';
|
|
|
|
|
2020-04-02 00:02:03 +00:00
|
|
|
function sfw() {
|
2020-05-21 22:55:11 +00:00
|
|
|
return this.$store.state.ui.sfw;
|
2020-04-02 00:02:03 +00:00
|
|
|
}
|
|
|
|
|
2021-05-15 00:51:52 +00:00
|
|
|
function me() {
|
|
|
|
return this.$store.state.auth.user;
|
|
|
|
}
|
|
|
|
|
2021-01-25 22:15:41 +00:00
|
|
|
function poster() {
|
|
|
|
if (this.release.poster) {
|
2021-02-22 01:33:39 +00:00
|
|
|
return this.getPath(this.release.poster, 'thumbnail');
|
2021-01-25 22:15:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (this.release.covers?.length > 0) {
|
2021-02-22 01:33:39 +00:00
|
|
|
return this.getPath(this.release.covers[0], 'thumbnail');
|
2021-01-25 22:15:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (this.photos?.length > 0) {
|
2021-02-22 01:33:39 +00:00
|
|
|
return this.getPath(this.release.photos[0], 'thumbnail');
|
2021-01-25 22:15:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2019-12-13 04:04:04 +00:00
|
|
|
function photos() {
|
2020-09-08 00:20:15 +00:00
|
|
|
const clips = this.release.clips || [];
|
|
|
|
const clipPostersById = clips.reduce((acc, clip) => ({ ...acc, [clip.poster.id]: clip.poster }), {});
|
|
|
|
const uniqueClipPosters = Array.from(new Set(clips.map(clip => clip.poster.id) || [])).map(posterId => clipPostersById[posterId]);
|
2020-08-20 18:48:52 +00:00
|
|
|
const photosWithClipPosters = (this.release.photos || []).concat(uniqueClipPosters);
|
2020-08-20 02:57:38 +00:00
|
|
|
|
2021-01-15 03:04:32 +00:00
|
|
|
if (this.release.trailer || (this.release.teaser && this.release.teaser.mime !== 'image/gif')) {
|
2020-05-21 22:55:11 +00:00
|
|
|
// poster will be on trailer video
|
2020-08-20 17:52:02 +00:00
|
|
|
return photosWithClipPosters;
|
2020-05-21 22:55:11 +00:00
|
|
|
}
|
2019-12-13 04:04:04 +00:00
|
|
|
|
2020-05-21 22:55:11 +00:00
|
|
|
if (this.release.poster) {
|
2020-06-29 23:07:48 +00:00
|
|
|
// no trailer, add poster to photos
|
2020-09-03 21:30:42 +00:00
|
|
|
return [this.release.poster].concat(photosWithClipPosters);
|
2020-05-21 22:55:11 +00:00
|
|
|
}
|
2019-12-13 04:04:04 +00:00
|
|
|
|
2020-06-29 23:07:48 +00:00
|
|
|
// no poster available
|
2020-08-20 17:52:02 +00:00
|
|
|
return photosWithClipPosters;
|
2019-12-13 04:04:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
2021-02-04 02:06:19 +00:00
|
|
|
components: {
|
|
|
|
Player,
|
|
|
|
},
|
2020-05-21 22:55:11 +00:00
|
|
|
props: {
|
|
|
|
release: {
|
|
|
|
type: Object,
|
|
|
|
default: null,
|
|
|
|
},
|
2020-07-02 02:04:28 +00:00
|
|
|
expanded: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
2020-12-26 22:51:27 +00:00
|
|
|
test: {
|
|
|
|
type: String,
|
|
|
|
default: null,
|
|
|
|
},
|
2020-05-21 22:55:11 +00:00
|
|
|
},
|
2021-03-04 01:35:43 +00:00
|
|
|
emits: ['load'],
|
2020-05-21 22:55:11 +00:00
|
|
|
data() {
|
|
|
|
return {
|
2021-02-04 02:06:19 +00:00
|
|
|
player: null,
|
2020-05-21 22:55:11 +00:00
|
|
|
playing: false,
|
|
|
|
paused: false,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
2021-05-15 00:51:52 +00:00
|
|
|
me,
|
2020-05-21 22:55:11 +00:00
|
|
|
photos,
|
2021-01-25 22:15:41 +00:00
|
|
|
poster,
|
2020-05-21 22:55:11 +00:00
|
|
|
sfw,
|
|
|
|
},
|
2019-12-13 04:04:04 +00:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2021-01-22 21:55:20 +00:00
|
|
|
@import 'breakpoints';
|
2019-12-13 04:04:04 +00:00
|
|
|
|
2020-06-29 23:07:48 +00:00
|
|
|
.media {
|
2019-12-13 04:04:04 +00:00
|
|
|
flex-shrink: 0;
|
|
|
|
white-space: nowrap;
|
|
|
|
font-size: 0;
|
|
|
|
}
|
|
|
|
|
2021-01-23 22:03:21 +00:00
|
|
|
.media.center {
|
|
|
|
width: 1200px;
|
2021-01-23 22:26:56 +00:00
|
|
|
max-width: 100%;
|
2021-05-15 00:51:52 +00:00
|
|
|
display: flex;
|
2021-01-23 22:03:21 +00:00
|
|
|
margin: 0 auto;
|
|
|
|
}
|
|
|
|
|
2020-03-01 04:28:08 +00:00
|
|
|
.poster-link {
|
|
|
|
position: absolute;
|
|
|
|
top: .5rem;
|
|
|
|
right: .5rem;
|
|
|
|
transition: opacity .1s ease;
|
|
|
|
|
|
|
|
.icon {
|
|
|
|
width: 1.5rem;
|
|
|
|
height: 1.5rem;
|
2020-04-02 00:02:03 +00:00
|
|
|
fill: var(--lighten-strong);
|
|
|
|
filter: drop-shadow(0 0 1px var(--darken-weak));
|
2020-03-01 04:28:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
&.playing {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
cursor: pointer;
|
|
|
|
opacity: 1;
|
|
|
|
|
|
|
|
.icon {
|
2020-04-02 00:02:03 +00:00
|
|
|
fill: var(--text-light);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-06 00:40:10 +00:00
|
|
|
.item-container,
|
2020-06-29 23:07:48 +00:00
|
|
|
.trailer-container {
|
2021-01-21 23:26:06 +00:00
|
|
|
height: 100%;
|
2020-07-06 00:40:10 +00:00
|
|
|
max-width: 100%;
|
2020-04-02 00:02:03 +00:00
|
|
|
position: relative;
|
|
|
|
display: inline-flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
2020-07-06 00:40:10 +00:00
|
|
|
flex-shrink: 0;
|
2020-04-02 00:02:03 +00:00
|
|
|
|
|
|
|
.warning {
|
|
|
|
display: none;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
flex-direction: column;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
position: absolute;
|
|
|
|
background: var(--darken-weak);
|
|
|
|
color: var(--text-light);
|
|
|
|
font-size: 1.2rem;
|
|
|
|
font-weight: bold;
|
2020-04-02 02:05:55 +00:00
|
|
|
text-shadow: 0 0 3px var(--darken-strong);
|
2020-04-02 00:02:03 +00:00
|
|
|
pointer-events: none;
|
|
|
|
animation: alert .5s ease infinite .1s;
|
|
|
|
|
|
|
|
.icon {
|
|
|
|
display: block;
|
|
|
|
fill: var(--text-light);
|
|
|
|
width: 3rem;
|
|
|
|
height: 3rem;
|
|
|
|
margin: 0 0 .25rem 0;
|
2020-04-02 02:05:55 +00:00
|
|
|
filter: drop-shadow(0 0 3px var(--darken));
|
2020-04-02 00:02:03 +00:00
|
|
|
animation: alert .5s ease infinite .1s;
|
2020-03-01 04:28:08 +00:00
|
|
|
}
|
|
|
|
}
|
2020-04-02 00:02:03 +00:00
|
|
|
|
|
|
|
&:hover .warning {
|
|
|
|
display: inline-flex;
|
|
|
|
}
|
2020-03-01 04:28:08 +00:00
|
|
|
}
|
|
|
|
|
2019-12-13 04:04:04 +00:00
|
|
|
.item {
|
2020-07-06 00:40:10 +00:00
|
|
|
max-width: 100%;
|
2021-03-16 02:55:20 +00:00
|
|
|
width: auto;
|
2021-01-23 22:03:21 +00:00
|
|
|
height: 18rem;
|
2020-07-02 23:28:22 +00:00
|
|
|
box-shadow: 0 0 3px var(--shadow-weak);
|
2020-12-26 22:51:27 +00:00
|
|
|
background-size: cover;
|
2019-12-13 04:04:04 +00:00
|
|
|
}
|
2020-02-13 03:11:32 +00:00
|
|
|
|
2021-05-15 00:51:52 +00:00
|
|
|
.item-more {
|
|
|
|
height: auto;
|
|
|
|
flex-grow: 1;
|
|
|
|
align-items: center;
|
|
|
|
padding: .5rem 2rem;
|
|
|
|
color: var(--text-light);
|
|
|
|
text-shadow: 0 0 3px var(--darken);
|
|
|
|
font-weight: bold;
|
|
|
|
font-size: 1rem;
|
|
|
|
|
|
|
|
.link {
|
|
|
|
color: inherit;
|
|
|
|
text-decoration: underline;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-29 23:07:48 +00:00
|
|
|
.trailer-container {
|
|
|
|
width: 32rem;
|
|
|
|
max-width: 100%;
|
2020-04-02 00:02:03 +00:00
|
|
|
}
|
|
|
|
|
2020-07-01 02:47:05 +00:00
|
|
|
.trailer {
|
2020-07-02 02:04:28 +00:00
|
|
|
width: 100%;
|
2021-01-22 21:55:20 +00:00
|
|
|
max-width: 32rem;
|
2020-07-01 02:47:05 +00:00
|
|
|
max-height: 100%;
|
2020-04-02 00:23:54 +00:00
|
|
|
|
|
|
|
&.sfw {
|
|
|
|
filter: blur(2rem);
|
|
|
|
}
|
2020-04-02 00:02:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@keyframes alert {
|
|
|
|
0% {
|
|
|
|
color: var(--text-light);
|
|
|
|
fill: var(--text-light);
|
|
|
|
}
|
|
|
|
50% {
|
|
|
|
color: var(--alert);
|
|
|
|
fill: var(--alert);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-22 21:55:20 +00:00
|
|
|
@media(max-width: $breakpoint-micro) {
|
2021-05-15 00:51:52 +00:00
|
|
|
.media.center {
|
|
|
|
flex-direction: column;
|
|
|
|
}
|
|
|
|
|
|
|
|
.item-more {
|
|
|
|
font-size: .9rem;
|
|
|
|
}
|
|
|
|
|
2020-06-29 23:07:48 +00:00
|
|
|
.media:not(.expanded) .item,
|
|
|
|
.trailer-container {
|
|
|
|
height: 56vw; /* 16:9 ratio for full-width video */
|
2020-02-13 03:11:32 +00:00
|
|
|
}
|
|
|
|
}
|
2019-12-13 04:04:04 +00:00
|
|
|
</style>
|