Merge pull request #307 from ajayyy/experimental

Skipping fixes
This commit is contained in:
Ajay Ramachandran
2020-03-30 14:34:31 -04:00
committed by GitHub
2 changed files with 11 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
{ {
"name": "__MSG_fullName__", "name": "__MSG_fullName__",
"short_name": "__MSG_Name__", "short_name": "__MSG_Name__",
"version": "1.2.22", "version": "1.2.23",
"default_locale": "en", "default_locale": "en",
"description": "__MSG_Description__", "description": "__MSG_Description__",
"content_scripts": [{ "content_scripts": [{

View File

@@ -259,7 +259,12 @@ function resetValues() {
//reset sponsor data found check //reset sponsor data found check
sponsorDataFound = false; 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) { async function videoIDChange(id) {
@@ -588,18 +593,18 @@ function sponsorsLookup(id: string, channelIDPromise?) {
UUIDs = smallUUIDs; UUIDs = smallUUIDs;
} }
if (!video.paused && !switchingVideos) { if (!switchingVideos) {
// See if there are any starting sponsors // See if there are any starting sponsors
let startingSponsor: number = -1; let startingSponsor: number = -1;
for (const time of sponsorTimes) { 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]; startingSponsor = time[0];
break; break;
} }
} }
if (!startingSponsor) { if (!startingSponsor) {
for (const time of sponsorTimesSubmitting) { 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]; startingSponsor = time[0];
break; break;
} }
@@ -607,7 +612,7 @@ function sponsorsLookup(id: string, channelIDPromise?) {
} }
if (startingSponsor !== -1) { if (startingSponsor !== -1) {
startSponsorSchedule(0); startSponsorSchedule(startingSponsor);
} else { } else {
startSponsorSchedule(); startSponsorSchedule();
} }