Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skipping fixes #307

Merged
merged 3 commits into from
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manifest/manifest.json
Original file line number Diff line number Diff line change
@@ -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": [{
Expand Down
15 changes: 10 additions & 5 deletions src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -588,26 +593,26 @@ 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) {
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;
}
}
}

if (startingSponsor !== -1) {
startSponsorSchedule(0);
startSponsorSchedule(startingSponsor);
} else {
startSponsorSchedule();
}
Expand Down