mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-11 22:17:21 +03:00
Added another check to prevent scheduled skips from old videos
This commit is contained in:
@@ -478,6 +478,7 @@ function startSponsorSchedule(includeIntersectingSegments: boolean = false, curr
|
|||||||
let currentSkip = skipInfo.array[skipInfo.index];
|
let currentSkip = skipInfo.array[skipInfo.index];
|
||||||
let skipTime: number[] = [currentSkip.segment[0], skipInfo.array[skipInfo.endIndex].segment[1]];
|
let skipTime: number[] = [currentSkip.segment[0], skipInfo.array[skipInfo.endIndex].segment[1]];
|
||||||
let timeUntilSponsor = skipTime[0] - currentTime;
|
let timeUntilSponsor = skipTime[0] - currentTime;
|
||||||
|
let videoID = sponsorVideoID;
|
||||||
|
|
||||||
// Don't skip if this category should not be skipped
|
// Don't skip if this category should not be skipped
|
||||||
if (utils.getCategorySelection(currentSkip.category).option === CategorySkipOption.ShowOverlay) return;
|
if (utils.getCategorySelection(currentSkip.category).option === CategorySkipOption.ShowOverlay) return;
|
||||||
@@ -486,7 +487,7 @@ function startSponsorSchedule(includeIntersectingSegments: boolean = false, curr
|
|||||||
let forcedSkipTime: number = null;
|
let forcedSkipTime: number = null;
|
||||||
let forcedIncludeIntersectingSegments = false;
|
let forcedIncludeIntersectingSegments = false;
|
||||||
|
|
||||||
if (incorrectVideoIDCheck()) return;
|
if (incorrectVideoIDCheck(videoID)) return;
|
||||||
|
|
||||||
if (video.currentTime >= skipTime[0] && video.currentTime < skipTime[1]) {
|
if (video.currentTime >= skipTime[0] && video.currentTime < skipTime[1]) {
|
||||||
skipToTime(video, skipInfo.endIndex, skipInfo.array, skipInfo.openNotice);
|
skipToTime(video, skipInfo.endIndex, skipInfo.array, skipInfo.openNotice);
|
||||||
@@ -515,9 +516,9 @@ function startSponsorSchedule(includeIntersectingSegments: boolean = false, curr
|
|||||||
*
|
*
|
||||||
* TODO: Remove this bug catching if statement when the bug is found
|
* TODO: Remove this bug catching if statement when the bug is found
|
||||||
*/
|
*/
|
||||||
function incorrectVideoIDCheck(): boolean {
|
function incorrectVideoIDCheck(videoID?: string): boolean {
|
||||||
let currentVideoID = getYouTubeVideoID(document.URL);
|
let currentVideoID = getYouTubeVideoID(document.URL);
|
||||||
if (currentVideoID !== sponsorVideoID) {
|
if (currentVideoID !== (videoID || sponsorVideoID)) {
|
||||||
// Something has really gone wrong
|
// Something has really gone wrong
|
||||||
console.error("[SponsorBlock] The videoID recorded when trying to skip is different than what it should be.");
|
console.error("[SponsorBlock] The videoID recorded when trying to skip is different than what it should be.");
|
||||||
console.error("[SponsorBlock] VideoID recorded: " + sponsorVideoID + ". Actual VideoID: " + currentVideoID);
|
console.error("[SponsorBlock] VideoID recorded: " + sponsorVideoID + ". Actual VideoID: " + currentVideoID);
|
||||||
|
|||||||
Reference in New Issue
Block a user