diff --git a/src/components/Preferences.vue b/src/components/Preferences.vue index 6f17b9eb..c231620b 100644 --- a/src/components/Preferences.vue +++ b/src/components/Preferences.vue @@ -10,6 +10,60 @@ @change="onChange($event)" type="checkbox" /> +
+ Skip Sponsors +
+ +
+ Skip Intermission/Intro Animation +
+ +
+ Skip Endcards/Credits +
+ +
+ Skip Interaction Reminder (Subscribe) +
+ +
+ Skip Unpaid/Self Promotion +
+ +
+ Skip Music: Non-Music Section +
+

Instances List

@@ -58,7 +112,13 @@ export default { return { selectedInstance: null, instances: [], - sponsorBlock: true + sponsorBlock: true, + skipSponsor: true, + skipIntro: false, + skipOutro: false, + skipInteraction: true, + skipSelfPromo: true, + skipMusicOffTopic: true }; }, mounted() { @@ -92,6 +152,35 @@ export default { "https://pipedapi.kavin.rocks"; this.sponsorBlock = localStorage.getItem("sponsorblock") || true; + if (localStorage.getItem("selectedSkip")) { + var skipList = localStorage.getItem("selectedSkip").split(","); + this.skipSponsor = this.skipIntro = this.skipOutro = this.skipInteraction = this.skipSelfPromo = this.skipMusicOffTopic = false; + skipList.forEach(skip => { + switch (skip) { + case "sponsor": + this.skipSponsor = true; + break; + case "intro": + this.skipIntro = true; + break; + case "outro": + this.skipOutro = true; + break; + case "interaction": + this.skipInteraction = true; + break; + case "selfpromo": + this.skipSelfPromo = true; + break; + case "music_offtopic": + this.skipMusicOffTopic = true; + break; + default: + console.log("Unknown sponsor type: " + skip); + break; + } + }); + } } }, methods: { @@ -99,6 +188,16 @@ export default { if (localStorage) { localStorage.setItem("instance", this.selectedInstance); localStorage.setItem("sponsorblock", this.sponsorBlock); + + var sponsorSelected = []; + if (this.skipSponsor) sponsorSelected.push("sponsor"); + if (this.skipIntro) sponsorSelected.push("intro"); + if (this.skipOutro) sponsorSelected.push("outro"); + if (this.skipInteraction) sponsorSelected.push("interaction"); + if (this.skipSelfPromo) sponsorSelected.push("selfpromo"); + if (this.skipMusicOffTopic) + sponsorSelected.push("music_offtopic"); + localStorage.setItem("selectedSkip", sponsorSelected); } }, sslScore(url) { diff --git a/src/components/WatchVideo.vue b/src/components/WatchVideo.vue index 398d89d7..2068f0f2 100644 --- a/src/components/WatchVideo.vue +++ b/src/components/WatchVideo.vue @@ -129,7 +129,14 @@ export default { Constants.BASE_URL + "/sponsors/" + this.$route.query.v + - '?category=["sponsor","interaction","selfpromo","music_offtopic"]' + "?category=" + + (localStorage + ? encodeURIComponent( + "[" + localStorage.getItem("selectedSkip") + "]" + ) + : encodeURIComponent( + '["sponsor", "interaction", "selfpromo", "music_offtopic"]' + )) ); }, onChange() {