mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-24 00:18:27 +03:00
Discard short segments instead of ignoring them later
This commit is contained in:
@@ -391,7 +391,7 @@
|
|||||||
"message": "Minimum duration (seconds)"
|
"message": "Minimum duration (seconds)"
|
||||||
},
|
},
|
||||||
"minDurationDescription": {
|
"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": {
|
"shortCheck": {
|
||||||
"message": "One of the segments is shorter than your minimum duration. Do you still want to submit?"
|
"message": "One of the segments is shorter than your minimum duration. Do you still want to submit?"
|
||||||
|
|||||||
11
content.js
11
content.js
@@ -341,6 +341,13 @@ function sponsorsLookup(id, channelIDPromise) {
|
|||||||
sponsorTimes = JSON.parse(xmlhttp.responseText).sponsorTimes;
|
sponsorTimes = JSON.parse(xmlhttp.responseText).sponsorTimes;
|
||||||
UUIDs = JSON.parse(xmlhttp.responseText).UUIDs;
|
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
|
// Reset skip save
|
||||||
sponsorSkipped = [];
|
sponsorSkipped = [];
|
||||||
|
|
||||||
@@ -521,10 +528,6 @@ function checkSponsorTime(sponsorTimes, index, openNotice) {
|
|||||||
lastTime = v.currentTime - 0.0001;
|
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)) {
|
if (checkIfTimeToSkip(v.currentTime, sponsorTimes[index][0], sponsorTimes[index][1]) && !hiddenSponsorTimes.includes(index)) {
|
||||||
//skip it
|
//skip it
|
||||||
skipToTime(v, index, sponsorTimes, openNotice);
|
skipToTime(v, index, sponsorTimes, openNotice);
|
||||||
|
|||||||
Reference in New Issue
Block a user