Add an option to skip sponsorblock segments manually

Fixes #894
This commit is contained in:
novenary
2023-02-01 17:37:43 +02:00
parent c1da96ebb1
commit e1b355e92a
4 changed files with 200 additions and 109 deletions

View File

@@ -367,14 +367,20 @@ export default {
return this.fetchJson(this.apiUrl() + "/streams/" + this.getVideoId());
},
async fetchSponsors() {
var selectedSkip = this.getPreferenceString(
"selectedSkip",
"sponsor,interaction,selfpromo,music_offtopic",
).split(",");
const skipOptionsJSON = localStorage.getItem("skipOptions");
if (skipOptionsJSON !== null) {
const skipOptions = JSON.parse(skipOptionsJSON);
selectedSkip = Object.keys(skipOptions).filter(
k => skipOptions[k] !== undefined && skipOptions[k] !== "no",
);
}
return await this.fetchJson(this.apiUrl() + "/sponsors/" + this.getVideoId(), {
category:
'["' +
this.getPreferenceString("selectedSkip", "sponsor,interaction,selfpromo,music_offtopic").replaceAll(
",",
'","',
) +
'"]',
category: JSON.stringify(selectedSkip),
});
},
toggleComments() {