Add support for Sponsorblock's Preview/Recap sections.

Closes #276
This commit is contained in:
FireMasterK 2021-07-19 01:23:17 +05:30
parent 604c4abae7
commit 18eb12688a
No known key found for this signature in database
GPG key ID: 49451E4482CC5BCD

View file

@ -19,6 +19,10 @@
<br /> <br />
<input class="uk-checkbox" v-model="skipOutro" @change="onChange($event)" type="checkbox" /> <input class="uk-checkbox" v-model="skipOutro" @change="onChange($event)" type="checkbox" />
<br /> <br />
<b>Skip Preview/Recap</b>
<br />
<input class="uk-checkbox" v-model="skipPreview" @change="onChange($event)" type="checkbox" />
<br />
<b>Skip Interaction Reminder (Subscribe)</b> <b>Skip Interaction Reminder (Subscribe)</b>
<br /> <br />
<input class="uk-checkbox" v-model="skipInteraction" @change="onChange($event)" type="checkbox" /> <input class="uk-checkbox" v-model="skipInteraction" @change="onChange($event)" type="checkbox" />
@ -107,6 +111,7 @@ export default {
skipSponsor: true, skipSponsor: true,
skipIntro: false, skipIntro: false,
skipOutro: false, skipOutro: false,
skipPreview: false,
skipInteraction: true, skipInteraction: true,
skipSelfPromo: true, skipSelfPromo: true,
skipMusicOffTopic: true, skipMusicOffTopic: true,
@ -151,7 +156,7 @@ export default {
this.sponsorBlock = this.getPreferenceBoolean("sponsorblock", true); this.sponsorBlock = this.getPreferenceBoolean("sponsorblock", true);
if (localStorage.getItem("selectedSkip") !== null) { if (localStorage.getItem("selectedSkip") !== null) {
var skipList = localStorage.getItem("selectedSkip").split(","); var skipList = localStorage.getItem("selectedSkip").split(",");
this.skipSponsor = this.skipIntro = this.skipOutro = this.skipInteraction = this.skipSelfPromo = this.skipMusicOffTopic = false; this.skipSponsor = this.skipIntro = this.skipOutro = this.skipPreview = this.skipInteraction = this.skipSelfPromo = this.skipMusicOffTopic = false;
skipList.forEach(skip => { skipList.forEach(skip => {
switch (skip) { switch (skip) {
case "sponsor": case "sponsor":
@ -163,6 +168,9 @@ export default {
case "outro": case "outro":
this.skipOutro = true; this.skipOutro = true;
break; break;
case "preview":
this.skipPreview = true;
break;
case "interaction": case "interaction":
this.skipInteraction = true; this.skipInteraction = true;
break; break;
@ -201,6 +209,7 @@ export default {
if (this.skipSponsor) sponsorSelected.push("sponsor"); if (this.skipSponsor) sponsorSelected.push("sponsor");
if (this.skipIntro) sponsorSelected.push("intro"); if (this.skipIntro) sponsorSelected.push("intro");
if (this.skipOutro) sponsorSelected.push("outro"); if (this.skipOutro) sponsorSelected.push("outro");
if (this.skipPreview) sponsorSelected.push("preview");
if (this.skipInteraction) sponsorSelected.push("interaction"); if (this.skipInteraction) sponsorSelected.push("interaction");
if (this.skipSelfPromo) sponsorSelected.push("selfpromo"); if (this.skipSelfPromo) sponsorSelected.push("selfpromo");
if (this.skipMusicOffTopic) sponsorSelected.push("music_offtopic"); if (this.skipMusicOffTopic) sponsorSelected.push("music_offtopic");