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();
},
activated() {
if (this.channel && !this.channel.error) document.title = this.channel.name + " - Piped";
window.addEventListener("scroll", this.handleScroll);
},
deactivated() {

View file

@ -20,11 +20,12 @@
<router-link class="uk-text-emphasis" v-bind:to="'/watch?v=' + video.id">
<div class="uk-position-relative">
<img style="width: 100%" v-bind:src="video.thumbnail" alt="thumbnail" loading="lazy" />
<span
<span
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;"
>{{ timeFormat(video.duration) }}</span>
>{{ timeFormat(video.duration) }}</span
>
</div>
<p>{{ video.title }}</p>
</router-link>
@ -66,10 +67,11 @@ export default {
};
},
mounted() {
document.title = "Feed - Piped";
this.fetchFeed().then(videos => (this.videos = videos));
},
activated() {
document.title = "Feed - Piped";
},
methods: {
async fetchFeed() {
return await this.fetchJson(this.apiUrl() + "/feed", {

View file

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

View file

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

View file

@ -1,6 +1,8 @@
<template>
<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 />
</div>
@ -142,6 +144,9 @@ export default {
showComments: true,
};
},
activated() {
document.title = "Preferences - Piped";
},
mounted() {
if (Object.keys(this.$route.query).length > 0) this.$router.replace({ query: {} });

View file

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

View file

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

View file

@ -131,7 +131,10 @@ export default {
activated() {
this.active = 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);
},
deactivated() {
@ -244,7 +247,7 @@ export default {
Player,
VideoItem,
ErrorHandler,
Comment
Comment,
},
};
</script>