Added migration for auto skip option

This commit is contained in:
Ajay Ramachandran
2020-04-06 00:40:30 -04:00
parent 5abc0bedd4
commit d1d4dcdc9c
3 changed files with 9 additions and 23 deletions

View File

@@ -84,23 +84,6 @@
<br/>
<br/>
<div option-type="toggle" toggle-type="reverse" sync-option="disableAutoSkip">
<label class="switch-container" label-name="__MSG_autoSkip__">
<label class="switch">
<input type="checkbox" checked>
<span class="slider round"></span>
</label>
</label>
<br/>
<br/>
<div class="small-description">__MSG_autoSkipDescription__</div>
</div>
<br/>
<br/>
<div option-type="keybind-change" sync-option="startSponsorKeybind">
<div class="option-button trigger-button">
__MSG_setStartSponsorShortcut__

View File

@@ -233,11 +233,14 @@ function fetchConfig() {
});
}
function migrateOldFormats() { // Convert sponsorTimes format
for (const key in Config.localConfig) {
if (key.startsWith("sponsorTimes") && key !== "sponsorTimes" && key !== "sponsorTimesContributed") {
Config.config.sponsorTimes.set(key.substr(12), Config.config[key]);
delete Config.config[key];
function migrateOldFormats() {
if (Config.config["disableAutoSkip"]) {
for (const selection of Config.config.categorySelections) {
if (selection.name === "sponsor") {
selection.option = CategorySkipOption.ManualSkip;
chrome.storage.sync.remove("disableAutoSkip");
}
}
}
}

View File

@@ -34,7 +34,7 @@ var seekListenerSetUp = false
var hiddenSponsorTimes: number[] = [];
/** @type {Array[boolean]} Has the sponsor been skipped */
var sponsorSkipped = [];
var sponsorSkipped: boolean[] = [];
//the video
var video: HTMLVideoElement;