From e62d46f2dd504d589d1ce14692ce16dd20ff42f6 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 30 Mar 2020 14:07:35 -0400 Subject: [PATCH 1/3] Improved zero second skipping for directly loaded videos --- src/content.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/content.ts b/src/content.ts index ac2770c8..fc2e6078 100644 --- a/src/content.ts +++ b/src/content.ts @@ -259,7 +259,12 @@ function resetValues() { //reset sponsor data found check sponsorDataFound = false; - switchingVideos = true; + if (switchingVideos === null) { + // When first loading a video, it is not switching videos + switchingVideos = false; + } else { + switchingVideos = true; + } } async function videoIDChange(id) { @@ -588,7 +593,7 @@ function sponsorsLookup(id: string, channelIDPromise?) { UUIDs = smallUUIDs; } - if (!video.paused && !switchingVideos) { + if (!switchingVideos) { // See if there are any starting sponsors let startingSponsor: number = -1; for (const time of sponsorTimes) { From 0d33794636a80a5ffd7db824a026f8fa951372e9 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 30 Mar 2020 14:11:46 -0400 Subject: [PATCH 2/3] Fixed almost zero second sponsors skipping a little too late. --- src/content.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/content.ts b/src/content.ts index fc2e6078..410b1989 100644 --- a/src/content.ts +++ b/src/content.ts @@ -597,14 +597,14 @@ function sponsorsLookup(id: string, channelIDPromise?) { // See if there are any starting sponsors let startingSponsor: number = -1; for (const time of sponsorTimes) { - if (time[0] <= video.currentTime && time[0] > startingSponsor) { + if (time[0] <= video.currentTime && time[0] > startingSponsor && time[1] > video.currentTime) { startingSponsor = time[0]; break; } } if (!startingSponsor) { for (const time of sponsorTimesSubmitting) { - if (time[0] <= video.currentTime && time[0] > startingSponsor) { + if (time[0] <= video.currentTime && time[0] > startingSponsor && time[1] > video.currentTime) { startingSponsor = time[0]; break; } @@ -612,7 +612,7 @@ function sponsorsLookup(id: string, channelIDPromise?) { } if (startingSponsor !== -1) { - startSponsorSchedule(0); + startSponsorSchedule(startingSponsor); } else { startSponsorSchedule(); } From 6d60a90533077a8a54e453b65de88c5f14b6f049 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 30 Mar 2020 14:18:11 -0400 Subject: [PATCH 3/3] Increased version number. --- manifest/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest/manifest.json b/manifest/manifest.json index ea2cee9d..4ae39362 100644 --- a/manifest/manifest.json +++ b/manifest/manifest.json @@ -1,7 +1,7 @@ { "name": "__MSG_fullName__", "short_name": "__MSG_Name__", - "version": "1.2.22", + "version": "1.2.23", "default_locale": "en", "description": "__MSG_Description__", "content_scripts": [{