2021-06-16 19:14:46 +00:00
|
|
|
<template>
|
2021-12-28 00:04:20 +00:00
|
|
|
<div>
|
2022-04-08 21:29:50 +00:00
|
|
|
<router-link
|
|
|
|
:to="{
|
|
|
|
path: '/watch',
|
|
|
|
query: {
|
|
|
|
v: video.url.substr(-11),
|
|
|
|
...(playlistId && { list: playlistId }),
|
|
|
|
...(index >= 0 && { index: index + 1 }),
|
|
|
|
},
|
|
|
|
}"
|
|
|
|
>
|
2022-06-25 11:00:45 +00:00
|
|
|
<img
|
|
|
|
class="w-full"
|
|
|
|
:src="video.thumbnail"
|
|
|
|
:alt="video.title"
|
|
|
|
:class="{ 'shorts-img': short }"
|
|
|
|
loading="lazy"
|
|
|
|
/>
|
2021-12-27 14:46:33 +00:00
|
|
|
<div class="relative text-sm">
|
2021-12-27 16:29:25 +00:00
|
|
|
<span
|
2022-01-30 23:48:27 +00:00
|
|
|
class="thumbnail-overlay thumbnail-right"
|
|
|
|
v-if="video.duration > 0"
|
2021-12-27 16:29:25 +00:00
|
|
|
v-text="timeFormat(video.duration)"
|
|
|
|
/>
|
2022-06-25 11:00:45 +00:00
|
|
|
<!-- shorts thumbnail -->
|
|
|
|
<span class="thumbnail-overlay thumbnail-left" v-if="short" v-t="'video.shorts'" />
|
|
|
|
<span
|
|
|
|
class="thumbnail-overlay thumbnail-right"
|
|
|
|
v-else-if="video.duration >= 60"
|
|
|
|
v-text="timeFormat(video.duration)"
|
|
|
|
/>
|
2022-01-30 23:48:27 +00:00
|
|
|
<i18n-t v-else keypath="video.live" class="thumbnail-overlay thumbnail-right !bg-red-600" tag="div">
|
|
|
|
<font-awesome-icon class="!w-3" :icon="['fas', 'broadcast-tower']" />
|
|
|
|
</i18n-t>
|
|
|
|
<span v-if="video.watched" class="thumbnail-overlay bottom-5px left-5px" v-t="'video.watched'" />
|
2021-07-21 10:15:07 +00:00
|
|
|
</div>
|
2021-09-02 10:28:32 +00:00
|
|
|
|
|
|
|
<div>
|
2021-10-07 22:44:54 +00:00
|
|
|
<p
|
2021-12-28 14:39:20 +00:00
|
|
|
style="display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical"
|
2021-12-27 14:46:30 +00:00
|
|
|
class="my-2 overflow-hidden flex link"
|
2021-10-07 22:44:54 +00:00
|
|
|
:title="video.title"
|
2021-12-27 16:29:25 +00:00
|
|
|
v-text="video.title"
|
|
|
|
/>
|
2021-09-02 10:28:32 +00:00
|
|
|
</div>
|
2021-06-16 19:14:46 +00:00
|
|
|
</router-link>
|
|
|
|
|
2022-04-07 02:33:25 +00:00
|
|
|
<div class="float-right m-0 inline-block children:px-1">
|
2021-10-07 22:44:54 +00:00
|
|
|
<router-link
|
2022-04-08 21:29:50 +00:00
|
|
|
:to="{
|
|
|
|
path: '/watch',
|
|
|
|
query: {
|
|
|
|
v: video.url.substr(-11),
|
|
|
|
...(playlistId && { list: playlistId }),
|
|
|
|
...(index >= 0 && { index: index + 1 }),
|
|
|
|
listen: '1',
|
|
|
|
},
|
|
|
|
}"
|
2021-10-07 22:44:54 +00:00
|
|
|
:aria-label="'Listen to ' + video.title"
|
|
|
|
:title="'Listen to ' + video.title"
|
|
|
|
>
|
2021-12-27 22:33:55 +00:00
|
|
|
<font-awesome-icon icon="headphones" />
|
2021-09-02 10:28:32 +00:00
|
|
|
</router-link>
|
2022-04-07 02:33:25 +00:00
|
|
|
<button v-if="authenticated" :title="$t('actions.add_to_playlist')" @click="showModal = !showModal">
|
|
|
|
<font-awesome-icon icon="circle-plus" />
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
v-if="admin"
|
|
|
|
:title="$t('actions.remove_from_playlist')"
|
|
|
|
ref="removeButton"
|
|
|
|
@click="removeVideo(video.url.substr(-11))"
|
|
|
|
>
|
|
|
|
<font-awesome-icon icon="circle-minus" />
|
|
|
|
</button>
|
|
|
|
<PlaylistAddModal v-if="showModal" :video-id="video.url.substr(-11)" @close="showModal = !showModal" />
|
2021-09-02 10:28:32 +00:00
|
|
|
</div>
|
|
|
|
|
2022-01-12 11:59:50 +00:00
|
|
|
<div class="flex">
|
2021-12-28 00:04:20 +00:00
|
|
|
<router-link :to="video.uploaderUrl">
|
2021-10-07 22:44:54 +00:00
|
|
|
<img
|
|
|
|
v-if="video.uploaderAvatar"
|
|
|
|
:src="video.uploaderAvatar"
|
|
|
|
loading="lazy"
|
|
|
|
:alt="video.uploaderName"
|
2021-12-27 14:46:29 +00:00
|
|
|
class="rounded-full mr-0.5 mt-0.5 w-32px h-32px"
|
2021-12-27 14:46:31 +00:00
|
|
|
width="68"
|
|
|
|
height="68"
|
2021-10-07 22:44:54 +00:00
|
|
|
/>
|
2021-09-02 10:28:32 +00:00
|
|
|
</router-link>
|
|
|
|
|
2021-12-27 14:46:29 +00:00
|
|
|
<div class="w-[calc(100%-32px-1rem)]">
|
2021-10-07 22:44:54 +00:00
|
|
|
<router-link
|
2021-10-08 21:08:41 +00:00
|
|
|
v-if="video.uploaderUrl && video.uploaderName && !hideChannel"
|
2021-12-28 00:04:20 +00:00
|
|
|
class="link-secondary overflow-hidden block"
|
2021-10-07 22:44:54 +00:00
|
|
|
:to="video.uploaderUrl"
|
|
|
|
:title="video.uploaderName"
|
|
|
|
>
|
2021-12-27 16:29:25 +00:00
|
|
|
<span v-text="video.uploaderName" />
|
2021-12-27 22:33:55 +00:00
|
|
|
<font-awesome-icon class="ml-1.5" v-if="video.uploaderVerified" icon="check" />
|
2021-06-16 19:14:46 +00:00
|
|
|
</router-link>
|
|
|
|
|
2022-01-12 11:27:08 +00:00
|
|
|
<strong v-if="video.views >= 0 || video.uploadedDate" class="text-sm">
|
2021-09-02 10:28:32 +00:00
|
|
|
<span v-if="video.views >= 0">
|
2021-12-27 22:33:55 +00:00
|
|
|
<font-awesome-icon icon="eye" />
|
2022-01-12 11:27:08 +00:00
|
|
|
<span class="pl-0.5" v-text="`${numberFormat(video.views)} •`" />
|
2021-09-02 10:28:32 +00:00
|
|
|
</span>
|
2022-02-06 15:35:18 +00:00
|
|
|
<span v-if="video.uploaded > 0" class="pl-0.5" v-text="timeAgo(video.uploaded)" />
|
|
|
|
<span v-else-if="video.uploadedDate" class="pl-0.5" v-text="video.uploadedDate" />
|
2021-12-27 14:43:37 +00:00
|
|
|
</strong>
|
2021-06-16 19:14:46 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2021-12-27 14:46:29 +00:00
|
|
|
<style>
|
|
|
|
.thumbnail-overlay {
|
2022-01-30 23:48:27 +00:00
|
|
|
@apply rounded-md absolute bg-black text-white bg-opacity-75 px-5px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.thumbnail-right {
|
|
|
|
@apply bottom-5px right-5px;
|
2021-12-27 14:46:29 +00:00
|
|
|
}
|
2022-06-25 11:00:45 +00:00
|
|
|
.thumbnail-left {
|
|
|
|
@apply bottom-5px left-5px text-xs font-bold bg-red-600 uppercase;
|
|
|
|
}
|
|
|
|
|
|
|
|
.shorts-img {
|
|
|
|
@apply max-h-[17.5vh] w-full object-contain;
|
|
|
|
}
|
2021-12-27 14:46:29 +00:00
|
|
|
</style>
|
|
|
|
|
2021-06-16 19:14:46 +00:00
|
|
|
<script>
|
2022-04-07 02:33:25 +00:00
|
|
|
import PlaylistAddModal from "./PlaylistAddModal.vue";
|
|
|
|
|
2021-06-16 19:14:46 +00:00
|
|
|
export default {
|
|
|
|
props: {
|
2021-10-08 18:52:51 +00:00
|
|
|
video: {
|
|
|
|
type: Object,
|
|
|
|
default: () => {
|
|
|
|
return {};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
height: { type: String, default: "118" },
|
|
|
|
width: { type: String, default: "210" },
|
|
|
|
hideChannel: { type: Boolean, default: false },
|
2022-04-07 02:33:25 +00:00
|
|
|
index: { type: Number, default: -1 },
|
|
|
|
playlistId: { type: String, default: null },
|
|
|
|
admin: { type: Boolean, default: false },
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
showModal: false,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
removeVideo() {
|
|
|
|
if (confirm(this.$t("actions.delete_playlist_video_confirm"))) {
|
|
|
|
this.$refs.removeButton.disabled = true;
|
|
|
|
this.fetchJson(this.apiUrl() + "/user/playlists/remove", null, {
|
|
|
|
method: "POST",
|
|
|
|
body: JSON.stringify({
|
|
|
|
playlistId: this.playlistId,
|
|
|
|
index: this.index,
|
|
|
|
}),
|
|
|
|
headers: {
|
|
|
|
Authorization: this.getAuthToken(),
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
},
|
|
|
|
}).then(json => {
|
|
|
|
if (json.error) alert(json.error);
|
|
|
|
else this.$emit("remove");
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
2021-06-16 19:14:46 +00:00
|
|
|
},
|
2022-06-25 11:00:45 +00:00
|
|
|
computed: {
|
|
|
|
short() {
|
|
|
|
return this.video.duration > 0 && this.video.duration <= 60;
|
|
|
|
},
|
|
|
|
},
|
2022-04-07 02:33:25 +00:00
|
|
|
components: { PlaylistAddModal },
|
2021-06-16 19:14:46 +00:00
|
|
|
};
|
2021-07-21 12:32:17 +00:00
|
|
|
</script>
|