From edb108bbcfb902921dbc069774da3c8dc2cd6a49 Mon Sep 17 00:00:00 2001 From: Lartza Date: Tue, 4 Feb 2020 22:36:22 +0000 Subject: [PATCH] Confirm shorter than minDuration submissions --- _locales/en/messages.json | 5 ++++- content.js | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) 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;