Confirm shorter than minDuration submissions

This commit is contained in:
Lartza
2020-02-04 22:36:22 +00:00
parent a685950a66
commit edb108bbcf
2 changed files with 12 additions and 1 deletions

View File

@@ -392,5 +392,8 @@
}, },
"minDurationDescription": { "minDurationDescription": {
"message": "Sponsor segments shorter than the set value will be ignored." "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?"
}
} }

View File

@@ -952,6 +952,14 @@ function submitSponsorTimes() {
//update sponsorTimesSubmitting //update sponsorTimesSubmitting
sponsorTimesSubmitting = sponsorTimes; 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) let confirmMessage = chrome.i18n.getMessage("submitCheck") + "\n\n" + getSponsorTimesMessage(sponsorTimes)
+ "\n\n" + chrome.i18n.getMessage("confirmMSG") + "\n\n" + chrome.i18n.getMessage("guildlinesSummary"); + "\n\n" + chrome.i18n.getMessage("confirmMSG") + "\n\n" + chrome.i18n.getMessage("guildlinesSummary");
if(!confirm(confirmMessage)) return; if(!confirm(confirmMessage)) return;