diff --git a/_locales/en/messages.json b/_locales/en/messages.json index ddebaa27..27e53788 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -391,7 +391,7 @@ "message": "Minimum duration (seconds)" }, "minDurationDescription": { - "message": "Sponsor segments shorter than the set value will be ignored." + "message": "Sponsor segments shorter than the set value will be ignored and not show in the player or the YouTube page popup." }, "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 aa400f4f..72959036 100644 --- a/content.js +++ b/content.js @@ -341,6 +341,13 @@ function sponsorsLookup(id, channelIDPromise) { sponsorTimes = JSON.parse(xmlhttp.responseText).sponsorTimes; UUIDs = JSON.parse(xmlhttp.responseText).UUIDs; + for (let i = 0; i < sponsorTimes.length; i++) { + if (sponsorTimes[i][1] - sponsorTimes[i][0] < SB.config.minDuration) { + sponsorTimes.splice(i, 1); + UUIDs.splice(i, 1); + } + } + // Reset skip save sponsorSkipped = []; @@ -521,10 +528,6 @@ function checkSponsorTime(sponsorTimes, index, openNotice) { lastTime = v.currentTime - 0.0001; } - if (sponsorTimes[index][1] - sponsorTimes[index][0] < SB.config.minDuration) { - return false; - } - if (checkIfTimeToSkip(v.currentTime, sponsorTimes[index][0], sponsorTimes[index][1]) && !hiddenSponsorTimes.includes(index)) { //skip it skipToTime(v, index, sponsorTimes, openNotice);