mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-09 21:17:20 +03:00
Added a check to make sure the time doesn't exceed the duration of the video.
This commit is contained in:
@@ -953,6 +953,13 @@ function submitSponsorTimes() {
|
||||
let sponsorTimes = result[sponsorTimeKey];
|
||||
|
||||
if (sponsorTimes != undefined && sponsorTimes.length > 0) {
|
||||
//check if a sponsor exceeds the duration of the video
|
||||
for (let i = 0; i < sponsorTimes.length; i++) {
|
||||
if (sponsorTimes[i][1] > v.duration) {
|
||||
sponsorTimes[i][1] = v.duration;
|
||||
}
|
||||
}
|
||||
|
||||
let confirmMessage = chrome.i18n.getMessage("submitCheck") + "\n\n" + getSponsorTimesMessage(sponsorTimes);
|
||||
confirmMessage += "\n\n" + chrome.i18n.getMessage("confirmMSG");
|
||||
if(!confirm(confirmMessage)) return;
|
||||
|
||||
Reference in New Issue
Block a user