Merge pull request #304 from ajayyy/experimental

Scheduling fixes
This commit is contained in:
Ajay Ramachandran
2020-03-25 19:01:43 -04:00
committed by GitHub
2 changed files with 16 additions and 17 deletions

View File

@@ -67,12 +67,10 @@ jobs:
uses: Shopify/upload-to-release@master
with:
args: builds/ChromeExtension.zip
env:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload to release
uses: Shopify/upload-to-release@master
with:
args: builds/FirefoxExtension.zip
env:
repo-token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -452,6 +452,7 @@ function cancelSponsorSchedule(): void {
*/
function startSponsorSchedule(currentTime?: number): void {
cancelSponsorSchedule();
if (video.paused) return;
if (Config.config.disableSkipping || channelWhitelisted){
return;
@@ -587,25 +588,25 @@ function sponsorsLookup(id: string, channelIDPromise?) {
UUIDs = smallUUIDs;
}
// See if there are any zero second sponsors
let zeroSecondSponsor = false;
for (const time of sponsorTimes) {
if (time[0] <= 0) {
zeroSecondSponsor = true;
break;
}
}
if (!zeroSecondSponsor) {
for (const time of sponsorTimesSubmitting) {
if (time[0] <= 0) {
zeroSecondSponsor = true;
if (!video.paused && !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) {
startingSponsor = time[0];
break;
}
}
}
if (!startingSponsor) {
for (const time of sponsorTimesSubmitting) {
if (time[0] <= video.currentTime && time[0] > startingSponsor) {
startingSponsor = time[0];
break;
}
}
}
if (!video.paused && !switchingVideos) {
if (zeroSecondSponsor) {
if (startingSponsor !== -1) {
startSponsorSchedule(0);
} else {
startSponsorSchedule();