mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-10 13:37:04 +03:00
Fixed typescript issues.
This commit is contained in:
@@ -19,7 +19,8 @@ interface SBConfig {
|
|||||||
invidiousInstances: string[],
|
invidiousInstances: string[],
|
||||||
invidiousUpdateInfoShowCount: number,
|
invidiousUpdateInfoShowCount: number,
|
||||||
autoUpvote: boolean,
|
autoUpvote: boolean,
|
||||||
supportInvidious: false
|
supportInvidious: false,
|
||||||
|
minDuration: number
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SBObject {
|
interface SBObject {
|
||||||
@@ -111,7 +112,8 @@ var Config: SBObject = {
|
|||||||
invidiousInstances: ["invidio.us", "invidiou.sh", "invidious.snopyta.org"],
|
invidiousInstances: ["invidio.us", "invidiou.sh", "invidious.snopyta.org"],
|
||||||
invidiousUpdateInfoShowCount: 0,
|
invidiousUpdateInfoShowCount: 0,
|
||||||
autoUpvote: true,
|
autoUpvote: true,
|
||||||
supportInvidious: false
|
supportInvidious: false,
|
||||||
|
minDuration: 0
|
||||||
},
|
},
|
||||||
localConfig: null,
|
localConfig: null,
|
||||||
config: null
|
config: null
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ function sponsorsLookup(id: string, channelIDPromise?) {
|
|||||||
UUIDs = JSON.parse(xmlhttp.responseText).UUIDs;
|
UUIDs = JSON.parse(xmlhttp.responseText).UUIDs;
|
||||||
|
|
||||||
for (let i = 0; i < sponsorTimes.length; i++) {
|
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);
|
sponsorTimes.splice(i, 1);
|
||||||
UUIDs.splice(i, 1);
|
UUIDs.splice(i, 1);
|
||||||
}
|
}
|
||||||
@@ -1014,7 +1014,7 @@ function submitSponsorTimes() {
|
|||||||
sponsorTimesSubmitting = sponsorTimes;
|
sponsorTimesSubmitting = sponsorTimes;
|
||||||
|
|
||||||
for (let i = 0; i < sponsorTimes.length; i++) {
|
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);
|
let confirmShort = chrome.i18n.getMessage("shortCheck") + "\n\n" + getSponsorTimesMessage(sponsorTimes);
|
||||||
if(!confirm(confirmShort)) return;
|
if(!confirm(confirmShort)) return;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -77,19 +77,19 @@ async function init() {
|
|||||||
break;
|
break;
|
||||||
case "number-change":
|
case "number-change":
|
||||||
let numberChangeOption = optionsElements[i].getAttribute("sync-option");
|
let numberChangeOption = optionsElements[i].getAttribute("sync-option");
|
||||||
let configValue = SB.config[numberChangeOption];
|
let configValue = Config.config[numberChangeOption];
|
||||||
let numberInput = optionsElements[i].querySelector("input");
|
let numberInput = optionsElements[i].querySelector("input");
|
||||||
|
|
||||||
if (isNaN(configValue) || configValue < 0) {
|
if (isNaN(configValue) || configValue < 0) {
|
||||||
numberInput.value = SB.defaults[numberChangeOption];
|
numberInput.value = Config.defaults[numberChangeOption];
|
||||||
} else {
|
} else {
|
||||||
numberInput.value = configValue;
|
numberInput.value = configValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
numberInput.addEventListener("input", () => {
|
numberInput.addEventListener("input", () => {
|
||||||
SB.config[numberChangeOption] = numberInput.value;
|
Config.config[numberChangeOption] = numberInput.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user