mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-11-26 07:27:22 +00:00
Merge pull request #1616 from alemoreau/feature-minimize_comments
Feature minimize comments
This commit is contained in:
commit
a8c51758b9
@ -66,11 +66,11 @@
|
|||||||
@change="onChange($event)"
|
@change="onChange($event)"
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<label class="pref" for="chkShowComments">
|
<label class="pref" for="chkMinimizeComments">
|
||||||
<strong v-t="'actions.show_comments'" />
|
<strong v-t="'actions.minimize_comments_default'" />
|
||||||
<input
|
<input
|
||||||
id="chkShowComments"
|
id="chkMinimizeComments"
|
||||||
v-model="showComments"
|
v-model="minimizeComments"
|
||||||
class="checkbox"
|
class="checkbox"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
@change="onChange($event)"
|
@change="onChange($event)"
|
||||||
@ -365,7 +365,7 @@ export default {
|
|||||||
countryMap: CountryMap,
|
countryMap: CountryMap,
|
||||||
countrySelected: "US",
|
countrySelected: "US",
|
||||||
defaultHomepage: "trending",
|
defaultHomepage: "trending",
|
||||||
showComments: true,
|
minimizeComments: false,
|
||||||
minimizeDescription: false,
|
minimizeDescription: false,
|
||||||
minimizeRecommendations: false,
|
minimizeRecommendations: false,
|
||||||
watchHistory: false,
|
watchHistory: false,
|
||||||
@ -501,7 +501,7 @@ export default {
|
|||||||
this.bufferingGoal = Math.max(Number(localStorage.getItem("bufferGoal")), 10);
|
this.bufferingGoal = Math.max(Number(localStorage.getItem("bufferGoal")), 10);
|
||||||
this.countrySelected = this.getPreferenceString("region", "US");
|
this.countrySelected = this.getPreferenceString("region", "US");
|
||||||
this.defaultHomepage = this.getPreferenceString("homepage", "trending");
|
this.defaultHomepage = this.getPreferenceString("homepage", "trending");
|
||||||
this.showComments = this.getPreferenceBoolean("comments", true);
|
this.minimizeComments = this.getPreferenceBoolean("minimizeComments", false);
|
||||||
this.minimizeDescription = this.getPreferenceBoolean("minimizeDescription", false);
|
this.minimizeDescription = this.getPreferenceBoolean("minimizeDescription", false);
|
||||||
this.minimizeRecommendations = this.getPreferenceBoolean("minimizeRecommendations", false);
|
this.minimizeRecommendations = this.getPreferenceBoolean("minimizeRecommendations", false);
|
||||||
this.watchHistory = this.getPreferenceBoolean("watchHistory", false);
|
this.watchHistory = this.getPreferenceBoolean("watchHistory", false);
|
||||||
@ -560,7 +560,7 @@ export default {
|
|||||||
localStorage.setItem("bufferGoal", this.bufferingGoal);
|
localStorage.setItem("bufferGoal", this.bufferingGoal);
|
||||||
localStorage.setItem("region", this.countrySelected);
|
localStorage.setItem("region", this.countrySelected);
|
||||||
localStorage.setItem("homepage", this.defaultHomepage);
|
localStorage.setItem("homepage", this.defaultHomepage);
|
||||||
localStorage.setItem("comments", this.showComments);
|
localStorage.setItem("minimizeComments", this.minimizeComments);
|
||||||
localStorage.setItem("minimizeDescription", this.minimizeDescription);
|
localStorage.setItem("minimizeDescription", this.minimizeDescription);
|
||||||
localStorage.setItem("minimizeRecommendations", this.minimizeRecommendations);
|
localStorage.setItem("minimizeRecommendations", this.minimizeRecommendations);
|
||||||
localStorage.setItem("watchHistory", this.watchHistory);
|
localStorage.setItem("watchHistory", this.watchHistory);
|
||||||
|
@ -162,9 +162,14 @@
|
|||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<div class="grid xl:grid-cols-5 sm:grid-cols-4 grid-cols-1">
|
<div class="grid xl:grid-cols-5 sm:grid-cols-4 grid-cols-1">
|
||||||
<div v-if="!commentsEnabled" class="xl:col-span-4 sm:col-span-3">
|
<div class="xl:col-span-4 sm:col-span-3">
|
||||||
<p class="text-center mt-8" v-t="'comment.user_disabled'"></p>
|
<button
|
||||||
|
class="btn mb-2"
|
||||||
|
@click="toggleComments"
|
||||||
|
v-t="`actions.${showComments ? 'minimize_comments' : 'show_comments'}`"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="!showComments" class="xl:col-span-4 sm:col-span-3"></div>
|
||||||
<div v-else-if="!comments" class="xl:col-span-4 sm:col-span-3">
|
<div v-else-if="!comments" class="xl:col-span-4 sm:col-span-3">
|
||||||
<p class="text-center mt-8" v-t="'comment.loading'"></p>
|
<p class="text-center mt-8" v-t="'comment.loading'"></p>
|
||||||
</div>
|
</div>
|
||||||
@ -243,6 +248,7 @@ export default {
|
|||||||
sponsors: null,
|
sponsors: null,
|
||||||
selectedAutoLoop: false,
|
selectedAutoLoop: false,
|
||||||
selectedAutoPlay: null,
|
selectedAutoPlay: null,
|
||||||
|
showComments: true,
|
||||||
showDesc: true,
|
showDesc: true,
|
||||||
showRecs: true,
|
showRecs: true,
|
||||||
showChapters: true,
|
showChapters: true,
|
||||||
@ -277,9 +283,6 @@ export default {
|
|||||||
year: "numeric",
|
year: "numeric",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
commentsEnabled() {
|
|
||||||
return this.getPreferenceBoolean("comments", true);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
// check screen size
|
// check screen size
|
||||||
@ -327,7 +330,7 @@ export default {
|
|||||||
this.index = Number(this.$route.query.index);
|
this.index = Number(this.$route.query.index);
|
||||||
this.getPlaylistData();
|
this.getPlaylistData();
|
||||||
this.getSponsors();
|
this.getSponsors();
|
||||||
if (!this.isEmbed && this.commentsEnabled) this.getComments();
|
if (!this.isEmbed && this.showComments) this.getComments();
|
||||||
window.addEventListener("resize", () => {
|
window.addEventListener("resize", () => {
|
||||||
this.smallView = this.smallViewQuery.matches;
|
this.smallView = this.smallViewQuery.matches;
|
||||||
});
|
});
|
||||||
@ -335,6 +338,7 @@ export default {
|
|||||||
activated() {
|
activated() {
|
||||||
this.active = true;
|
this.active = true;
|
||||||
this.selectedAutoPlay = this.getPreferenceBoolean("autoplay", false);
|
this.selectedAutoPlay = this.getPreferenceBoolean("autoplay", false);
|
||||||
|
this.showComments = !this.getPreferenceBoolean("minimizeComments", false);
|
||||||
this.showDesc = !this.getPreferenceBoolean("minimizeDescription", false);
|
this.showDesc = !this.getPreferenceBoolean("minimizeDescription", false);
|
||||||
this.showRecs = !this.getPreferenceBoolean("minimizeRecommendations", false);
|
this.showRecs = !this.getPreferenceBoolean("minimizeRecommendations", false);
|
||||||
if (this.video.duration) {
|
if (this.video.duration) {
|
||||||
@ -365,6 +369,12 @@ export default {
|
|||||||
'"]',
|
'"]',
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
toggleComments() {
|
||||||
|
this.showComments = !this.showComments;
|
||||||
|
if (this.showComments && this.comments === null) {
|
||||||
|
this.fetchComments();
|
||||||
|
}
|
||||||
|
},
|
||||||
fetchComments() {
|
fetchComments() {
|
||||||
return this.fetchJson(this.apiUrl() + "/comments/" + this.getVideoId());
|
return this.fetchJson(this.apiUrl() + "/comments/" + this.getVideoId());
|
||||||
},
|
},
|
||||||
@ -477,7 +487,7 @@ export default {
|
|||||||
},
|
},
|
||||||
handleScroll() {
|
handleScroll() {
|
||||||
if (this.loading || !this.comments || !this.comments.nextpage) return;
|
if (this.loading || !this.comments || !this.comments.nextpage) return;
|
||||||
if (window.innerHeight + window.scrollY >= this.$refs.comments.offsetHeight - window.innerHeight) {
|
if (window.innerHeight + window.scrollY >= this.$refs.comments?.offsetHeight - window.innerHeight) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.fetchJson(this.apiUrl() + "/nextpage/comments/" + this.getVideoId(), {
|
this.fetchJson(this.apiUrl() + "/nextpage/comments/" + this.getVideoId(), {
|
||||||
nextpage: this.comments.nextpage,
|
nextpage: this.comments.nextpage,
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
"buffering_goal": "Buffering Goal (in seconds)",
|
"buffering_goal": "Buffering Goal (in seconds)",
|
||||||
"country_selection": "Country Selection",
|
"country_selection": "Country Selection",
|
||||||
"default_homepage": "Default Homepage",
|
"default_homepage": "Default Homepage",
|
||||||
"show_comments": "Show Comments",
|
"minimize_comments_default": "Minimize Comments by default",
|
||||||
"minimize_description_default": "Minimize Description by default",
|
"minimize_description_default": "Minimize Description by default",
|
||||||
"store_watch_history": "Store Watch History",
|
"store_watch_history": "Store Watch History",
|
||||||
"language_selection": "Language Selection",
|
"language_selection": "Language Selection",
|
||||||
@ -62,6 +62,8 @@
|
|||||||
"loop_this_video": "Loop this Video",
|
"loop_this_video": "Loop this Video",
|
||||||
"auto_play_next_video": "Auto Play next Video",
|
"auto_play_next_video": "Auto Play next Video",
|
||||||
"donations": "Development donations",
|
"donations": "Development donations",
|
||||||
|
"minimize_comments": "Minimize Comments",
|
||||||
|
"show_comments": "Show Comments",
|
||||||
"minimize_description": "Minimize Description",
|
"minimize_description": "Minimize Description",
|
||||||
"show_description": "Show Description",
|
"show_description": "Show Description",
|
||||||
"minimize_recommendations": "Minimize Recommendations",
|
"minimize_recommendations": "Minimize Recommendations",
|
||||||
|
Loading…
Reference in New Issue
Block a user