2021-01-04 05:48:18 +00:00
|
|
|
<template>
|
|
|
|
<div v-if="playlist">
|
|
|
|
<h1 class="uk-text-center">
|
2021-02-24 09:35:41 +00:00
|
|
|
<img v-bind:src="playlist.avatarUrl" loading="lazy" />
|
|
|
|
{{ playlist.name }}
|
2021-01-04 05:48:18 +00:00
|
|
|
</h1>
|
|
|
|
|
|
|
|
<b
|
2021-04-07 11:45:40 +00:00
|
|
|
><router-link class="uk-text-justify" v-bind:to="playlist.uploaderUrl || '/'">
|
2021-02-24 09:35:41 +00:00
|
|
|
<img v-bind:src="playlist.uploaderAvatar" loading="lazy" />
|
2021-01-04 05:48:18 +00:00
|
|
|
{{ 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"
|
|
|
|
v-bind:key="item.url"
|
|
|
|
v-for="item in this.playlist.relatedStreams"
|
|
|
|
>
|
2021-04-07 11:45:40 +00:00
|
|
|
<router-link class="uk-link-muted uk-text-justify" v-bind:to="item.url || '/'">
|
|
|
|
<img style="width: 100%" v-bind:src="item.thumbnail" loading="lazy" />
|
2021-01-04 05:48:18 +00:00
|
|
|
<a>{{ item.title }}</a>
|
|
|
|
</router-link>
|
|
|
|
<br />
|
|
|
|
<div>
|
|
|
|
<b class="uk-text-small uk-align-left">
|
2021-04-07 11:45:40 +00:00
|
|
|
<router-link class="uk-text-justify" v-bind:to="item.uploaderUrl || '/'">{{
|
|
|
|
item.uploaderName
|
|
|
|
}}</router-link>
|
2021-01-04 05:48:18 +00:00
|
|
|
</b>
|
|
|
|
<b class="uk-text-small uk-align-right">
|
|
|
|
{{ timeFormat(item.duration) }}
|
|
|
|
</b>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import Constants from "@/Constants.js";
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
2021-04-07 11:45:40 +00:00
|
|
|
playlist: null,
|
2021-01-04 05:48:18 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.getPlaylistData();
|
|
|
|
window.addEventListener("scroll", this.handleScroll);
|
|
|
|
},
|
|
|
|
unmounted() {
|
|
|
|
window.removeEventListener("scroll", this.handleScroll);
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async fetchPlaylist() {
|
2021-04-07 11:45:40 +00:00
|
|
|
return await await this.fetchJson(Constants.BASE_URL + "/playlists/" + this.$route.query.list);
|
2021-01-04 05:48:18 +00:00
|
|
|
},
|
|
|
|
async getPlaylistData() {
|
|
|
|
this.fetchPlaylist()
|
|
|
|
.then(data => (this.playlist = data))
|
|
|
|
.then(() => (document.title = this.playlist.name + " - Piped"));
|
|
|
|
},
|
|
|
|
handleScroll() {
|
2021-04-21 14:03:56 +00:00
|
|
|
if (this.loading || !this.playlist || !this.playlist.nextpage || !this.playlist.nextbody) return;
|
2021-04-07 11:45:40 +00:00
|
|
|
if (window.innerHeight + window.scrollY >= document.body.offsetHeight - window.innerHeight) {
|
2021-01-04 05:48:18 +00:00
|
|
|
this.loading = true;
|
2021-02-24 09:35:41 +00:00
|
|
|
this.fetchJson(
|
2021-01-04 05:48:18 +00:00
|
|
|
Constants.BASE_URL +
|
|
|
|
"/nextpage/playlists/" +
|
|
|
|
this.$route.query.list +
|
|
|
|
"?url=" +
|
2021-03-30 09:39:23 +00:00
|
|
|
encodeURIComponent(this.playlist.nextpage) +
|
|
|
|
"&id=" +
|
2021-04-21 14:03:56 +00:00
|
|
|
encodeURIComponent(this.playlist.nextbody),
|
2021-02-24 09:35:41 +00:00
|
|
|
).then(json => {
|
|
|
|
this.playlist.relatedStreams.concat(json.relatedStreams);
|
|
|
|
this.playlist.nextpage = json.nextpage;
|
2021-04-21 14:03:56 +00:00
|
|
|
this.playlist.nextbody = json.nextbody;
|
2021-02-24 09:35:41 +00:00
|
|
|
this.loading = false;
|
2021-04-07 11:45:40 +00:00
|
|
|
json.relatedStreams.map(stream => this.playlist.relatedStreams.push(stream));
|
2021-02-24 09:35:41 +00:00
|
|
|
});
|
2021-01-04 05:48:18 +00:00
|
|
|
}
|
2021-04-07 11:45:40 +00:00
|
|
|
},
|
|
|
|
},
|
2021-01-04 05:48:18 +00:00
|
|
|
};
|
|
|
|
</script>
|