2021-01-04 11:18:18 +05:30
|
|
|
<template>
|
2021-06-07 00:17:43 +05:30
|
|
|
<ErrorHandler v-if="playlist && playlist.error" :message="playlist.message" :error="playlist.error" />
|
|
|
|
|
|
|
|
<div v-if="playlist" v-show="!playlist.error">
|
2021-01-04 11:18:18 +05:30
|
|
|
<h1 class="uk-text-center">
|
2021-04-24 00:41:51 +05:30
|
|
|
<img v-bind:src="playlist.avatarUrl" height="48" width="48" loading="lazy" />
|
2021-02-24 15:05:41 +05:30
|
|
|
{{ playlist.name }}
|
2021-01-04 11:18:18 +05:30
|
|
|
</h1>
|
|
|
|
|
|
|
|
<b
|
2021-04-07 17:15:40 +05:30
|
|
|
><router-link class="uk-text-justify" v-bind:to="playlist.uploaderUrl || '/'">
|
2021-02-24 15:05:41 +05:30
|
|
|
<img v-bind:src="playlist.uploaderAvatar" loading="lazy" />
|
2021-01-04 11:18:18 +05:30
|
|
|
{{ playlist.uploader }}</router-link
|
|
|
|
></b
|
|
|
|
>
|
|
|
|
|
|
|
|
<b class="uk-align-right">{{ playlist.videos }} Videos</b>
|
|
|
|
|
|
|
|
<hr />
|
|
|
|
|
|
|
|
<div class="uk-grid-xl" uk-grid="parallax: 0">
|
|
|
|
<div
|
|
|
|
class="uk-width-1-2 uk-width-1-3@m uk-width-1-4@l uk-width-1-5@xl"
|
2021-06-17 00:44:46 +05:30
|
|
|
v-bind:key="video.url"
|
|
|
|
v-for="video in this.playlist.relatedStreams"
|
2021-01-04 11:18:18 +05:30
|
|
|
>
|
2021-06-17 00:44:46 +05:30
|
|
|
<VideoItem :video="video" height="94" width="168" />
|
2021-01-04 11:18:18 +05:30
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-06-07 00:17:43 +05:30
|
|
|
import ErrorHandler from "@/components/ErrorHandler.vue";
|
2021-06-17 00:44:46 +05:30
|
|
|
import VideoItem from "@/components/VideoItem.vue";
|
2021-01-04 11:18:18 +05:30
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
2021-04-07 17:15:40 +05:30
|
|
|
playlist: null,
|
2021-01-04 11:18:18 +05:30
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.getPlaylistData();
|
|
|
|
window.addEventListener("scroll", this.handleScroll);
|
|
|
|
},
|
|
|
|
unmounted() {
|
|
|
|
window.removeEventListener("scroll", this.handleScroll);
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async fetchPlaylist() {
|
2021-07-04 23:56:02 +05:30
|
|
|
return await await this.fetchJson(this.apiUrl() + "/playlists/" + this.$route.query.list);
|
2021-01-04 11:18:18 +05:30
|
|
|
},
|
|
|
|
async getPlaylistData() {
|
|
|
|
this.fetchPlaylist()
|
|
|
|
.then(data => (this.playlist = data))
|
|
|
|
.then(() => (document.title = this.playlist.name + " - Piped"));
|
|
|
|
},
|
|
|
|
handleScroll() {
|
2021-06-06 01:05:14 +05:30
|
|
|
if (this.loading || !this.playlist || !this.playlist.nextpage) return;
|
2021-04-07 17:15:40 +05:30
|
|
|
if (window.innerHeight + window.scrollY >= document.body.offsetHeight - window.innerHeight) {
|
2021-01-04 11:18:18 +05:30
|
|
|
this.loading = true;
|
2021-07-04 23:56:02 +05:30
|
|
|
this.fetchJson(this.apiUrl() + "/nextpage/playlists/" + this.$route.query.list, {
|
2021-06-15 17:07:35 +05:30
|
|
|
nextpage: this.playlist.nextpage,
|
|
|
|
}).then(json => {
|
2021-02-24 15:05:41 +05:30
|
|
|
this.playlist.relatedStreams.concat(json.relatedStreams);
|
|
|
|
this.playlist.nextpage = json.nextpage;
|
|
|
|
this.loading = false;
|
2021-04-07 17:15:40 +05:30
|
|
|
json.relatedStreams.map(stream => this.playlist.relatedStreams.push(stream));
|
2021-02-24 15:05:41 +05:30
|
|
|
});
|
2021-01-04 11:18:18 +05:30
|
|
|
}
|
2021-04-07 17:15:40 +05:30
|
|
|
},
|
|
|
|
},
|
2021-06-07 00:17:43 +05:30
|
|
|
components: {
|
|
|
|
ErrorHandler,
|
2021-06-17 00:44:46 +05:30
|
|
|
VideoItem,
|
2021-06-07 00:17:43 +05:30
|
|
|
},
|
2021-01-04 11:18:18 +05:30
|
|
|
};
|
|
|
|
</script>
|