From afe16e6623a2d5937f51765175b0ca17ebe94e9f Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sat, 8 Feb 2020 19:27:38 -0500 Subject: [PATCH] Improved confirm message. --- public/_locales/en/messages.json | 2 +- src/content.ts | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index a7ad101d..0900962e 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -394,6 +394,6 @@ "message": "Sponsor segments shorter than the set value will not be skipeed or show in the player." }, "shortCheck": { - "message": "One of the segments is shorter than your minimum duration. Do you still want to submit?" + "message": "The following submission is shorter than your minimum duration option. This could mean that this is already submitted, and just being ignored due to this option. Are you sure you would like to submit?" } } diff --git a/src/content.ts b/src/content.ts index ab75c270..d88f8be4 100644 --- a/src/content.ts +++ b/src/content.ts @@ -1022,11 +1022,14 @@ function submitSponsorTimes() { //update sponsorTimesSubmitting sponsorTimesSubmitting = sponsorTimes; - for (let i = 0; i < sponsorTimes.length; i++) { - 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; + // Check to see if any of the submissions are below the minimum duration set + if (Config.config.minDuration > 0) { + for (let i = 0; i < sponsorTimes.length; i++) { + if (sponsorTimes[i][1] - sponsorTimes[i][0] < Config.config.minDuration) { + let confirmShort = chrome.i18n.getMessage("shortCheck") + "\n\n" + getSponsorTimesMessage(sponsorTimes); + + if(!confirm(confirmShort)) return; + } } }