update preferences

This commit is contained in:
vr10t 2023-03-01 15:38:06 +00:00
parent d90e865e0d
commit fbe58aee7f
3 changed files with 67 additions and 28 deletions

View file

@ -45,26 +45,42 @@
@change="onChange($event)" @change="onChange($event)"
/> />
</label> </label>
<label v-if="autoPlayVideo" class="pref" for="chkAutoPlayPreferUnwatched"> <details v-bind:class="{ details: autoPlayNextVideo }" open>
<strong v-t="'actions.autoplay_prefer_unwatched'" /> <summary class="pref">
<input <label class="w-full flex items-center justify-between" for="chkAutoPlayNextVideo">
id="chkAutoPlayPreferUnwatched" <strong v-t="'actions.auto_play_next_video'" />
v-model="autoPlayPreferUnwatched" <input
class="checkbox" id="chkAutoPlayNextVideo"
type="checkbox" v-model="autoPlayNextVideo"
@change="onChange($event)" class="checkbox"
/> type="checkbox"
</label> @change="onChange($event)"
<label v-if="autoPlayVideo" class="pref" for="chkAutoPlayPreferSameAuthor"> />
<strong v-t="'actions.autoplay_prefer_same_author'" /> </label>
<input </summary>
id="chkAutoPlayPreferSameAuthor" <div class="pl-4">
v-model="autoPlayPreferSameAuthor" <label v-if="autoPlayNextVideo" class="pref" for="chkAutoPlayPreferUnwatched">
class="checkbox" <strong v-t="'actions.autoplay_prefer_unwatched'" />
type="checkbox" <input
@change="onChange($event)" id="chkAutoPlayPreferUnwatched"
/> v-model="autoPlayPreferUnwatched"
</label> class="checkbox"
type="checkbox"
@change="onChange($event)"
/>
</label>
<label v-if="autoPlayNextVideo" class="pref" for="chkAutoPlayPreferSameAuthor">
<strong v-t="'actions.autoplay_prefer_same_author'" />
<input
id="chkAutoPlayPreferSameAuthor"
v-model="autoPlayPreferSameAuthor"
class="checkbox"
type="checkbox"
@change="onChange($event)"
/>
</label>
</div>
</details>
<label class="pref" for="chkAudioOnly"> <label class="pref" for="chkAudioOnly">
<strong v-t="'actions.audio_only'" /> <strong v-t="'actions.audio_only'" />
<input id="chkAudioOnly" v-model="listen" class="checkbox" type="checkbox" @change="onChange($event)" /> <input id="chkAudioOnly" v-model="listen" class="checkbox" type="checkbox" @change="onChange($event)" />
@ -366,6 +382,7 @@ export default {
minSegmentLength: 0, minSegmentLength: 0,
selectedTheme: "dark", selectedTheme: "dark",
autoPlayVideo: true, autoPlayVideo: true,
autoPlayNextVideo: true,
autoPlayPreferUnwatched: true, autoPlayPreferUnwatched: true,
autoPlayPreferSameAuthor: false, autoPlayPreferSameAuthor: false,
listen: false, listen: false,
@ -483,8 +500,9 @@ export default {
this.minSegmentLength = Math.max(this.getPreferenceNumber("minSegmentLength", 0), 0); this.minSegmentLength = Math.max(this.getPreferenceNumber("minSegmentLength", 0), 0);
this.selectedTheme = this.getPreferenceString("theme", "dark"); this.selectedTheme = this.getPreferenceString("theme", "dark");
this.autoPlayVideo = this.getPreferenceBoolean("playerAutoPlay", true); this.autoPlayVideo = this.getPreferenceBoolean("playerAutoPlay", true);
this.autoPlayPreferUnwatched = this.getPreferenceBoolean("playerAutoPlayUnwatched", true); this.autoPlayNextVideo = this.getPreferenceBoolean("autoplay", true);
this.autoPlayPreferSameAuthor = this.getPreferenceBoolean("playerAutoPlaySameAuthor", false); this.autoPlayPreferUnwatched = this.getPreferenceBoolean("autoPlayUnwatched", true);
this.autoPlayPreferSameAuthor = this.getPreferenceBoolean("autoPlaySameAuthor", false);
this.listen = this.getPreferenceBoolean("listen", false); this.listen = this.getPreferenceBoolean("listen", false);
this.defaultQuality = Number(localStorage.getItem("quality")); this.defaultQuality = Number(localStorage.getItem("quality"));
this.bufferingGoal = Math.max(Number(localStorage.getItem("bufferGoal")), 10); this.bufferingGoal = Math.max(Number(localStorage.getItem("bufferGoal")), 10);
@ -539,8 +557,9 @@ export default {
localStorage.setItem("minSegmentLength", this.minSegmentLength); localStorage.setItem("minSegmentLength", this.minSegmentLength);
localStorage.setItem("theme", this.selectedTheme); localStorage.setItem("theme", this.selectedTheme);
localStorage.setItem("playerAutoPlay", this.autoPlayVideo); localStorage.setItem("playerAutoPlay", this.autoPlayVideo);
localStorage.setItem("playerAutoPlayUnwatched", this.autoPlayPreferUnwatched); localStorage.setItem("autoplay", this.autoPlayNextVideo);
localStorage.setItem("playerAutoPlaySameAuthor", this.autoPlayPreferSameAuthor); localStorage.setItem("autoPlayUnwatched", this.autoPlayPreferUnwatched);
localStorage.setItem("autoPlaySameAuthor", this.autoPlayPreferSameAuthor);
localStorage.setItem("listen", this.listen); localStorage.setItem("listen", this.listen);
localStorage.setItem("quality", this.defaultQuality); localStorage.setItem("quality", this.defaultQuality);
localStorage.setItem("bufferGoal", this.bufferingGoal); localStorage.setItem("bufferGoal", this.bufferingGoal);
@ -628,4 +647,23 @@ export default {
.pref { .pref {
@apply flex justify-between items-center my-2 mx-[15vw] lt-md:mx-[2vw]; @apply flex justify-between items-center my-2 mx-[15vw] lt-md:mx-[2vw];
} }
.details summary {
@apply pl-4 relative cursor-pointer;
}
.details summary:before {
content: "";
border-width: 0.4rem;
border-style: solid;
border-color: transparent transparent transparent #fff;
position: absolute;
top: 0.4rem;
left: 0;
margin-right: 1rem;
transform: rotate(0);
transform-origin: 0.2rem 50%;
transition: 0.25s transform ease;
}
details[open] > summary:before {
transform: rotate(90deg);
}
</style> </style>

View file

@ -208,7 +208,7 @@
<hr v-show="showRecs" /> <hr v-show="showRecs" />
<div v-show="showRecs"> <div v-show="showRecs">
<div v-if="nextVideo" class=""> <div v-if="nextVideo" class="">
<p>Next up:</p> <p v-t="'video.next_up'" />
<VideoItem :key="nextVideo.url" :item="nextVideo" height="94" width="168" /> <VideoItem :key="nextVideo.url" :item="nextVideo" height="94" width="168" />
</div> </div>
<ContentItem <ContentItem
@ -303,10 +303,10 @@ export default {
return _this.video.relatedStreams?.filter(video => video.url !== _this.nextVideo?.url); return _this.video.relatedStreams?.filter(video => video.url !== _this.nextVideo?.url);
}, },
preferUnwatched: _this => { preferUnwatched: _this => {
return _this.getPreferenceBoolean("playerAutoPlayUnwatched", true) && !_this.isEmbed; return _this.getPreferenceBoolean("autoPlayUnwatched", true) && !_this.isEmbed;
}, },
preferAuthor: _this => { preferAuthor: _this => {
return _this.getPreferenceBoolean("playerAutoPlaySameAuthor", false) && !_this.isEmbed; return _this.getPreferenceBoolean("autoPlaySameAuthor", false) && !_this.isEmbed;
}, },
}, },
mounted() { mounted() {

View file

@ -160,7 +160,8 @@
"live": "{0} Live", "live": "{0} Live",
"shorts": "Shorts", "shorts": "Shorts",
"all": "All", "all": "All",
"category": "Category" "category": "Category",
"next_up": "Next up:"
}, },
"search": { "search": {
"did_you_mean": "Did you mean: {0}?", "did_you_mean": "Did you mean: {0}?",