Fixed typescript issues.

This commit is contained in:
Ajay Ramachandran 2020-02-08 19:10:04 -05:00
parent 885fae175d
commit 4e1eb82538
3 changed files with 10 additions and 8 deletions

View file

@ -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

View file

@ -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;

View file

@ -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;
}
}