aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay Ramachandran <[email protected]>2020-05-04 16:39:01 -0400
committerAjay Ramachandran <[email protected]>2020-05-04 16:39:01 -0400
commit9a5cb5ae0f7523dbf00ea857e8e3dd97e2a50b86 (patch)
tree5c22e178ed3cf2ed746c23ddefe5d40825bad3e2
parent20e1a96a84df4dcf26b857892473b21c54e08a3a (diff)
downloadSponsorBlock-9a5cb5ae0f7523dbf00ea857e8e3dd97e2a50b86.tar.gz
SponsorBlock-9a5cb5ae0f7523dbf00ea857e8e3dd97e2a50b86.zip
Added another check to prevent scheduled skips from old videos
-rw-r--r--src/content.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/content.ts b/src/content.ts
index 758a5bb4..74325fd6 100644
--- a/src/content.ts
+++ b/src/content.ts
@@ -478,6 +478,7 @@ function startSponsorSchedule(includeIntersectingSegments: boolean = false, curr
let currentSkip = skipInfo.array[skipInfo.index];
let skipTime: number[] = [currentSkip.segment[0], skipInfo.array[skipInfo.endIndex].segment[1]];
let timeUntilSponsor = skipTime[0] - currentTime;
+ let videoID = sponsorVideoID;
// Don't skip if this category should not be skipped
if (utils.getCategorySelection(currentSkip.category).option === CategorySkipOption.ShowOverlay) return;
@@ -486,7 +487,7 @@ function startSponsorSchedule(includeIntersectingSegments: boolean = false, curr
let forcedSkipTime: number = null;
let forcedIncludeIntersectingSegments = false;
- if (incorrectVideoIDCheck()) return;
+ if (incorrectVideoIDCheck(videoID)) return;
if (video.currentTime >= skipTime[0] && video.currentTime < skipTime[1]) {
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
*/
-function incorrectVideoIDCheck(): boolean {
+function incorrectVideoIDCheck(videoID?: string): boolean {
let currentVideoID = getYouTubeVideoID(document.URL);
- if (currentVideoID !== sponsorVideoID) {
+ if (currentVideoID !== (videoID || sponsorVideoID)) {
// 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] VideoID recorded: " + sponsorVideoID + ". Actual VideoID: " + currentVideoID);