2021-01-04 05:48:18 +00:00
|
|
|
<template>
|
2021-06-06 18:47:43 +00:00
|
|
|
<ErrorHandler v-if="playlist && playlist.error" :message="playlist.message" :error="playlist.error" />
|
|
|
|
|
|
|
|
<div v-if="playlist" v-show="!playlist.error">
|
2021-01-04 05:48:18 +00:00
|
|
|
<h1 class="uk-text-center">
|
2021-09-01 11:36:00 +00:00
|
|
|
<img v-bind:src="playlist.avatarUrl" height="48" width="48" loading="lazy"/>
|
2021-02-24 09:35:41 +00:00
|
|
|
{{ 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-09-01 11:36:00 +00:00
|
|
|
<img v-bind:src="playlist.uploaderAvatar" loading="lazy" class="uk-border-circle" />
|
2021-01-04 05:48:18 +00:00
|
|
|
{{ playlist.uploader }}</router-link
|
|
|
|
></b
|
|
|
|
>
|
|
|
|
|
2021-07-04 18:57:57 +00:00
|
|
|
<div class="uk-align-right">
|
2021-09-05 13:08:26 +00:00
|
|
|
<b>{{ playlist.videos }} {{ $t("video.videos") }}</b>
|
2021-07-04 18:57:57 +00:00
|
|
|
<br />
|
|
|
|
<a :href="getRssUrl"><font-awesome-icon icon="rss"></font-awesome-icon></a>
|
|
|
|
</div>
|
2021-01-04 05:48:18 +00:00
|
|
|
|
|
|
|
<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-16 19:14:46 +00:00
|
|
|
v-bind:key="video.url"
|
|
|
|
v-for="video in this.playlist.relatedStreams"
|
2021-01-04 05:48:18 +00:00
|
|
|
>
|
2021-06-16 19:14:46 +00:00
|
|
|
<VideoItem :video="video" height="94" width="168" />
|
2021-01-04 05:48:18 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-06-06 18:47:43 +00:00
|
|
|
import ErrorHandler from "@/components/ErrorHandler.vue";
|
2021-06-16 19:14:46 +00:00
|
|
|
import VideoItem from "@/components/VideoItem.vue";
|
2021-01-04 05:48:18 +00:00
|
|
|
|
|
|
|
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();
|
2021-07-07 14:18:09 +00:00
|
|
|
},
|
|
|
|
activated() {
|
2021-01-04 05:48:18 +00:00
|
|
|
window.addEventListener("scroll", this.handleScroll);
|
|
|
|
},
|
2021-07-07 14:18:09 +00:00
|
|
|
deactivated() {
|
2021-01-04 05:48:18 +00:00
|
|
|
window.removeEventListener("scroll", this.handleScroll);
|
|
|
|
},
|
2021-07-04 18:57:57 +00:00
|
|
|
computed: {
|
|
|
|
getRssUrl: _this => {
|
|
|
|
return _this.apiUrl() + "/rss/playlists/" + _this.$route.query.list;
|
|
|
|
},
|
|
|
|
},
|
2021-01-04 05:48:18 +00:00
|
|
|
methods: {
|
|
|
|
async fetchPlaylist() {
|
2021-07-04 18:26:02 +00:00
|
|
|
return await await this.fetchJson(this.apiUrl() + "/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-06-05 19:35:14 +00:00
|
|
|
if (this.loading || !this.playlist || !this.playlist.nextpage) 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-07-04 18:26:02 +00:00
|
|
|
this.fetchJson(this.apiUrl() + "/nextpage/playlists/" + this.$route.query.list, {
|
2021-06-15 11:37:35 +00:00
|
|
|
nextpage: this.playlist.nextpage,
|
|
|
|
}).then(json => {
|
2021-02-24 09:35:41 +00:00
|
|
|
this.playlist.relatedStreams.concat(json.relatedStreams);
|
|
|
|
this.playlist.nextpage = json.nextpage;
|
|
|
|
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-06-06 18:47:43 +00:00
|
|
|
components: {
|
|
|
|
ErrorHandler,
|
2021-06-16 19:14:46 +00:00
|
|
|
VideoItem,
|
2021-06-06 18:47:43 +00:00
|
|
|
},
|
2021-01-04 05:48:18 +00:00
|
|
|
};
|
|
|
|
</script>
|