diff options
author | Ajay Ramachandran <[email protected]> | 2020-02-08 19:10:04 -0500 |
---|---|---|
committer | Ajay Ramachandran <[email protected]> | 2020-02-08 19:10:04 -0500 |
commit | 4e1eb82538e713a11055bf14f4d9fb4bdc260134 (patch) | |
tree | a0604bcc69698067e303da5922c794d403c7c572 | |
parent | 885fae175d6476372b242a4e353663e5a21c9791 (diff) | |
download | SponsorBlock-4e1eb82538e713a11055bf14f4d9fb4bdc260134.tar.gz SponsorBlock-4e1eb82538e713a11055bf14f4d9fb4bdc260134.zip |
Fixed typescript issues.
-rw-r--r-- | src/config.ts | 6 | ||||
-rw-r--r-- | src/content.ts | 4 | ||||
-rw-r--r-- | src/options.ts | 8 |
3 files changed, 10 insertions, 8 deletions
diff --git a/src/config.ts b/src/config.ts index a77a3807..2985d4c7 100644 --- a/src/config.ts +++ b/src/config.ts @@ -19,7 +19,8 @@ interface SBConfig { invidiousInstances: string[], invidiousUpdateInfoShowCount: number, autoUpvote: boolean, - supportInvidious: false + supportInvidious: false, + minDuration: number } interface SBObject { @@ -111,7 +112,8 @@ var Config: SBObject = { invidiousInstances: ["invidio.us", "invidiou.sh", "invidious.snopyta.org"], invidiousUpdateInfoShowCount: 0, autoUpvote: true, - supportInvidious: false + supportInvidious: false, + minDuration: 0 }, localConfig: null, config: null diff --git a/src/content.ts b/src/content.ts index c16981df..d6521667 100644 --- a/src/content.ts +++ b/src/content.ts @@ -367,7 +367,7 @@ function sponsorsLookup(id: string, channelIDPromise?) { UUIDs = JSON.parse(xmlhttp.responseText).UUIDs; for (let i = 0; i < sponsorTimes.length; i++) { - if (sponsorTimes[i][1] - sponsorTimes[i][0] < SB.config.minDuration) { + if (sponsorTimes[i][1] - sponsorTimes[i][0] < Config.config.minDuration) { sponsorTimes.splice(i, 1); UUIDs.splice(i, 1); } @@ -1014,7 +1014,7 @@ function submitSponsorTimes() { sponsorTimesSubmitting = sponsorTimes; for (let i = 0; i < sponsorTimes.length; i++) { - if (sponsorTimes[i][1] - sponsorTimes[i][0] < SB.config.minDuration) { + if (sponsorTimes[i][1] - sponsorTimes[i][0] < Config.config.minDuration) { let confirmShort = chrome.i18n.getMessage("shortCheck") + "\n\n" + getSponsorTimesMessage(sponsorTimes); if(!confirm(confirmShort)) return; break; diff --git a/src/options.ts b/src/options.ts index 3db23f33..a4b2cf18 100644 --- a/src/options.ts +++ b/src/options.ts @@ -77,19 +77,19 @@ async function init() { break; case "number-change": let numberChangeOption = optionsElements[i].getAttribute("sync-option"); - let configValue = SB.config[numberChangeOption]; + let configValue = Config.config[numberChangeOption]; let numberInput = optionsElements[i].querySelector("input"); if (isNaN(configValue) || configValue < 0) { - numberInput.value = SB.defaults[numberChangeOption]; + numberInput.value = Config.defaults[numberChangeOption]; } else { numberInput.value = configValue; } numberInput.addEventListener("input", () => { - SB.config[numberChangeOption] = numberInput.value; + Config.config[numberChangeOption] = numberInput.value; }); - + break; } } |