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

@@ -81,23 +81,6 @@
</div> </div>
</div> </div>
<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/>
<br/> <br/>

View File

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

View File

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