2020-11-27 12:16:36 +05:30
|
|
|
<template>
|
|
|
|
<div v-if="channel">
|
2021-04-24 00:41:51 +05:30
|
|
|
<h1 class="uk-text-center"><img height="48" width="48" v-bind:src="channel.avatarUrl" />{{ channel.name }}</h1>
|
2021-04-07 17:15:40 +05:30
|
|
|
<img v-if="channel.bannerUrl" v-bind:src="channel.bannerUrl" style="width: 100%" loading="lazy" />
|
2020-11-27 12:16:36 +05:30
|
|
|
<p v-html="this.channel.description.replaceAll('\n', '<br>')"></p>
|
|
|
|
|
|
|
|
<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.channel.relatedStreams"
|
|
|
|
>
|
2021-04-07 17:15:40 +05:30
|
|
|
<router-link class="uk-link-muted uk-text-justify" v-bind:to="item.url || '/'">
|
2021-04-23 18:56:08 +05:30
|
|
|
<img height="94" width="168" style="width: 100%" v-bind:src="item.thumbnail" loading="lazy" />
|
2020-11-27 12:16:36 +05:30
|
|
|
<a>{{ item.title }}</a>
|
|
|
|
</router-link>
|
|
|
|
<br />
|
|
|
|
<div>
|
|
|
|
<b class="uk-text-small uk-align-left">
|
|
|
|
<font-awesome-icon icon="eye"></font-awesome-icon>
|
|
|
|
{{ item.views }} views
|
2021-02-24 15:05:41 +05:30
|
|
|
<br />
|
|
|
|
{{ item.uploadedDate }}
|
|
|
|
</b>
|
|
|
|
<b class="uk-text-small uk-align-right">
|
|
|
|
{{ timeFormat(item.duration) }}
|
2020-11-27 12:16:36 +05:30
|
|
|
</b>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import Constants from "@/Constants.js";
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
2021-04-07 17:15:40 +05:30
|
|
|
channel: null,
|
2020-11-27 12:16:36 +05:30
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.getChannelData();
|
|
|
|
window.addEventListener("scroll", this.handleScroll);
|
|
|
|
},
|
|
|
|
unmounted() {
|
|
|
|
window.removeEventListener("scroll", this.handleScroll);
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async fetchChannel() {
|
2021-04-07 17:15:40 +05:30
|
|
|
return await this.fetchJson(Constants.BASE_URL + "/channels/" + this.$route.params.channelId);
|
2020-11-27 12:16:36 +05:30
|
|
|
},
|
|
|
|
async getChannelData() {
|
|
|
|
this.fetchChannel()
|
|
|
|
.then(data => (this.channel = data))
|
|
|
|
.then(() => (document.title = this.channel.name + " - Piped"));
|
|
|
|
},
|
|
|
|
handleScroll() {
|
2021-04-21 19:33:56 +05:30
|
|
|
if (this.loading || !this.channel || !this.channel.nextpage || !this.channel.nextbody) return;
|
2021-04-07 17:15:40 +05:30
|
|
|
if (window.innerHeight + window.scrollY >= document.body.offsetHeight - window.innerHeight) {
|
2020-11-27 12:16:36 +05:30
|
|
|
this.loading = true;
|
2021-02-24 15:05:41 +05:30
|
|
|
this.fetchJson(
|
2020-11-27 12:16:36 +05:30
|
|
|
Constants.BASE_URL +
|
|
|
|
"/nextpage/channels/" +
|
|
|
|
this.$route.params.channelId +
|
|
|
|
"?url=" +
|
2021-03-29 12:12:53 +05:30
|
|
|
encodeURIComponent(this.channel.nextpage) +
|
|
|
|
"&id=" +
|
2021-04-21 19:33:56 +05:30
|
|
|
encodeURIComponent(this.channel.nextbody),
|
2021-02-24 15:05:41 +05:30
|
|
|
).then(json => {
|
|
|
|
this.channel.relatedStreams.concat(json.relatedStreams);
|
|
|
|
this.channel.nextpage = json.nextpage;
|
2021-04-21 19:33:56 +05:30
|
|
|
this.channel.nextbody = json.nextbody;
|
2021-02-24 15:05:41 +05:30
|
|
|
this.loading = false;
|
2021-04-07 17:15:40 +05:30
|
|
|
json.relatedStreams.map(stream => this.channel.relatedStreams.push(stream));
|
2021-02-24 15:05:41 +05:30
|
|
|
});
|
2020-11-27 12:16:36 +05:30
|
|
|
}
|
2021-04-07 17:15:40 +05:30
|
|
|
},
|
|
|
|
},
|
2020-11-27 12:16:36 +05:30
|
|
|
};
|
|
|
|
</script>
|