diff --git a/_locales/en/messages.json b/_locales/en/messages.json index ca9ce167..ddebaa27 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -392,5 +392,8 @@ }, "minDurationDescription": { "message": "Sponsor segments shorter than the set value will be ignored." - } + }, + "shortCheck": { + "message": "One of the segments is shorter than your minimum duration. Do you still want to submit?" + } } diff --git a/content.js b/content.js index 0ad119fc..aa400f4f 100644 --- a/content.js +++ b/content.js @@ -952,6 +952,14 @@ function submitSponsorTimes() { //update sponsorTimesSubmitting sponsorTimesSubmitting = sponsorTimes; + for (let i = 0; i < sponsorTimes.length; i++) { + if (sponsorTimes[i][1] - sponsorTimes[i][0] < SB.config.minDuration) { + let confirmShort = chrome.i18n.getMessage("shortCheck") + "\n\n" + getSponsorTimesMessage(sponsorTimes); + if(!confirm(confirmShort)) return; + break; + } + } + let confirmMessage = chrome.i18n.getMessage("submitCheck") + "\n\n" + getSponsorTimesMessage(sponsorTimes) + "\n\n" + chrome.i18n.getMessage("confirmMSG") + "\n\n" + chrome.i18n.getMessage("guildlinesSummary"); if(!confirm(confirmMessage)) return;