From 0813aa4ba3443c0993dc05aadf41860a9890b162 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 9 Mar 2020 18:30:57 -0400 Subject: [PATCH 1/5] Prevent release workflow from running multiple times --- .github/workflows/release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b3aaacaf..dae30ed1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,8 @@ name: Upload Release Build -on: release +on: + release: + types: [published] jobs: From e6ea9f77e90703128e5d443565e9325f4ff0e67c Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 9 Mar 2020 18:34:33 -0400 Subject: [PATCH 2/5] Fixed skip scheduling for auto skip --- src/content.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/content.ts b/src/content.ts index 7017fadc..e53e059b 100644 --- a/src/content.ts +++ b/src/content.ts @@ -463,7 +463,12 @@ function startSponsorSchedule(currentTime?: number): void { skipToTime(video, skipInfo.index, skipInfo.array, skipInfo.openNotice); } - startSponsorSchedule(skipTime[0] + 0.001); + if (Config.config.disableAutoSkip) { + startSponsorSchedule(skipTime[0] + 0.001); + } else { + startSponsorSchedule(skipTime[1]); + } + }; if (timeUntilSponsor <= 0) { From efec8b320cdb36e493714dd4143e49442115c09b Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 9 Mar 2020 18:38:02 -0400 Subject: [PATCH 3/5] Increase version num --- manifest/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest/manifest.json b/manifest/manifest.json index 409c78fa..022929c3 100644 --- a/manifest/manifest.json +++ b/manifest/manifest.json @@ -1,7 +1,7 @@ { "name": "__MSG_fullName__", "short_name": "__MSG_Name__", - "version": "1.2.20", + "version": "1.2.21", "default_locale": "en", "description": "__MSG_Description__", "content_scripts": [{ From 09f244150c85c76994a46de862fe2c5879fd358e Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 9 Mar 2020 23:00:39 -0400 Subject: [PATCH 4/5] Fixed skipping for non zero second sponsors. Also now using the playing event to fix issues with mobile YouTube skipping. --- src/content.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/content.ts b/src/content.ts index e53e059b..37212201 100644 --- a/src/content.ts +++ b/src/content.ts @@ -449,7 +449,7 @@ function startSponsorSchedule(currentTime?: number): void { return; } - if (currentTime === undefined) currentTime = video.currentTime; + if (currentTime === undefined || currentTime === null) currentTime = video.currentTime; let skipInfo = getNextSkipIndex(currentTime); @@ -459,16 +459,19 @@ function startSponsorSchedule(currentTime?: number): void { let timeUntilSponsor = skipTime[0] - currentTime; let skippingFunction = () => { + let forcedSkipTime: number = null; + if (video.currentTime >= skipTime[0] && video.currentTime < skipTime[1]) { skipToTime(video, skipInfo.index, skipInfo.array, skipInfo.openNotice); + + if (Config.config.disableAutoSkip) { + forcedSkipTime = skipTime[0] + 0.001; + } else { + forcedSkipTime = skipTime[1]; + } } - if (Config.config.disableAutoSkip) { - startSponsorSchedule(skipTime[0] + 0.001); - } else { - startSponsorSchedule(skipTime[1]); - } - + startSponsorSchedule(forcedSkipTime); }; if (timeUntilSponsor <= 0) { @@ -500,6 +503,7 @@ function sponsorsLookup(id: string, channelIDPromise?) { switchingVideos = false; startSponsorSchedule(); }); + video.addEventListener('playing', () => startSponsorSchedule()); video.addEventListener('seeked', () => { if (!video.paused) startSponsorSchedule(); }); From c0894afff98478a7b98b68c69281a7386948fb24 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 9 Mar 2020 23:03:24 -0400 Subject: [PATCH 5/5] Prevent manual skipping votes from affecting to UI and happening when auto vote is off --- src/js-components/skipNotice.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/js-components/skipNotice.ts b/src/js-components/skipNotice.ts index 3e981851..ec55f9b7 100644 --- a/src/js-components/skipNotice.ts +++ b/src/js-components/skipNotice.ts @@ -1,5 +1,7 @@ 'use strict'; +import Config from "../config"; + /** * The notice that tells the user that a sponsor was just skipped */ @@ -305,7 +307,7 @@ class SkipNotice { if (this.manualSkip) { this.changeNoticeTitle(chrome.i18n.getMessage("noticeTitle")); - this.contentContainer().vote(1, this.UUID, this); + if (Config.config.autoUpvote) this.contentContainer().vote(1, this.UUID); } }