1
0
mirror of https://github.com/TeamPiped/Piped.git synced 2024-12-13 13:50:27 +05:30

Handle title on component activation.

Closes #294
This commit is contained in:
FireMasterK 2021-07-21 16:29:53 +05:30
parent e4b24043ee
commit 24e58722c9
No known key found for this signature in database
GPG Key ID: 49451E4482CC5BCD
8 changed files with 29 additions and 10 deletions

View File

@ -45,6 +45,7 @@ export default {
this.getChannelData(); this.getChannelData();
}, },
activated() { activated() {
if (this.channel && !this.channel.error) document.title = this.channel.name + " - Piped";
window.addEventListener("scroll", this.handleScroll); window.addEventListener("scroll", this.handleScroll);
}, },
deactivated() { deactivated() {

View File

@ -20,11 +20,12 @@
<router-link class="uk-text-emphasis" v-bind:to="'/watch?v=' + video.id"> <router-link class="uk-text-emphasis" v-bind:to="'/watch?v=' + video.id">
<div class="uk-position-relative"> <div class="uk-position-relative">
<img style="width: 100%" v-bind:src="video.thumbnail" alt="thumbnail" loading="lazy" /> <img style="width: 100%" v-bind:src="video.thumbnail" alt="thumbnail" loading="lazy" />
<span <span
v-if="video.duration" v-if="video.duration"
class="uk-label uk-border-rounded uk-position-absolute video-duration" class="uk-label uk-border-rounded uk-position-absolute video-duration"
style="bottom: 5px; right: 5px; background: rgba(0, 0, 0, .75); color: white; padding: 0 5px;" style="bottom: 5px; right: 5px; background: rgba(0, 0, 0, .75); color: white; padding: 0 5px;"
>{{ timeFormat(video.duration) }}</span> >{{ timeFormat(video.duration) }}</span
>
</div> </div>
<p>{{ video.title }}</p> <p>{{ video.title }}</p>
</router-link> </router-link>
@ -66,10 +67,11 @@ export default {
}; };
}, },
mounted() { mounted() {
document.title = "Feed - Piped";
this.fetchFeed().then(videos => (this.videos = videos)); this.fetchFeed().then(videos => (this.videos = videos));
}, },
activated() {
document.title = "Feed - Piped";
},
methods: { methods: {
async fetchFeed() { async fetchFeed() {
return await this.fetchJson(this.apiUrl() + "/feed", { return await this.fetchJson(this.apiUrl() + "/feed", {

View File

@ -71,6 +71,7 @@ export default {
}, },
activated() { activated() {
if (!this.authenticated) this.$router.push("/login"); if (!this.authenticated) this.$router.push("/login");
document.title = "Import - Piped";
}, },
methods: { methods: {
fileChange() { fileChange() {

View File

@ -45,6 +45,9 @@ export default {
this.$router.push("/"); this.$router.push("/");
} }
}, },
activated() {
document.title = "Login - Piped";
},
methods: { methods: {
login() { login() {
console.log("authToken" + this.hashCode(this.apiUrl())); console.log("authToken" + this.hashCode(this.apiUrl()));

View File

@ -1,6 +1,8 @@
<template> <template>
<div class="uk-flex uk-flex-between uk-flex-middle"> <div class="uk-flex uk-flex-between uk-flex-middle">
<router-link class="uk-button uk-button-text" to="/"><font-awesome-icon icon="chevron-left" /> &nbsp;Back</router-link> <router-link class="uk-button uk-button-text" to="/"
><font-awesome-icon icon="chevron-left" /> &nbsp;Back</router-link
>
<span><h1 class="uk-text-bold uk-text-center">Preferences</h1></span> <span><h1 class="uk-text-bold uk-text-center">Preferences</h1></span>
<span /> <span />
</div> </div>
@ -142,6 +144,9 @@ export default {
showComments: true, showComments: true,
}; };
}, },
activated() {
document.title = "Preferences - Piped";
},
mounted() { mounted() {
if (Object.keys(this.$route.query).length > 0) this.$router.replace({ query: {} }); if (Object.keys(this.$route.query).length > 0) this.$router.replace({ query: {} });

View File

@ -45,6 +45,9 @@ export default {
this.$router.push("/"); this.$router.push("/");
} }
}, },
activated() {
document.title = "Register - Piped";
},
methods: { methods: {
register() { register() {
console.log("authToken" + this.hashCode(this.apiUrl())); console.log("authToken" + this.hashCode(this.apiUrl()));

View File

@ -25,12 +25,13 @@ export default {
}; };
}, },
mounted() { mounted() {
document.title = "Trending - Piped";
let region = this.getPreferenceString("region", "US"); let region = this.getPreferenceString("region", "US");
this.fetchTrending(region).then(videos => (this.videos = videos)); this.fetchTrending(region).then(videos => (this.videos = videos));
}, },
activated() {
document.title = "Trending - Piped";
},
methods: { methods: {
async fetchTrending(region) { async fetchTrending(region) {
return await this.fetchJson(this.apiUrl() + "/trending", { return await this.fetchJson(this.apiUrl() + "/trending", {

View File

@ -131,7 +131,10 @@ export default {
activated() { activated() {
this.active = true; this.active = true;
this.selectedAutoPlay = this.getPreferenceBoolean("autoplay", true); this.selectedAutoPlay = this.getPreferenceBoolean("autoplay", true);
if (this.video.duration) this.$refs.videoPlayer.loadVideo(); if (this.video.duration) {
document.title = this.video.title + " - Piped";
this.$refs.videoPlayer.loadVideo();
}
window.addEventListener("scroll", this.handleScroll); window.addEventListener("scroll", this.handleScroll);
}, },
deactivated() { deactivated() {
@ -244,7 +247,7 @@ export default {
Player, Player,
VideoItem, VideoItem,
ErrorHandler, ErrorHandler,
Comment Comment,
}, },
}; };
</script> </script>