From 78dd44c502a02788b2f6133c754308ba244109b7 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 30 Mar 2020 14:44:26 -0400 Subject: [PATCH 1/6] Fixed missing name in release workflow --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 21a2fe2a..48365c37 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -67,10 +67,12 @@ jobs: uses: Shopify/upload-to-release@master with: args: builds/ChromeExtension.zip + name: ChromeExtension.zip repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Upload to release uses: Shopify/upload-to-release@master with: args: builds/FirefoxExtension.zip + name: FirefoxExtension.zip repo-token: ${{ secrets.GITHUB_TOKEN }} From b21a59f4e5c8b074ea24391c2a65afd297c220ed Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 30 Mar 2020 15:33:03 -0400 Subject: [PATCH 2/6] Fixed looping sometimes not skipping beginning sponsors. Resolves https://github.com/ajayyy/SponsorBlock/issues/306 --- src/content.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/content.ts b/src/content.ts index 410b1989..84699a53 100644 --- a/src/content.ts +++ b/src/content.ts @@ -533,11 +533,10 @@ function sponsorsLookup(id: string, channelIDPromise?) { startSponsorSchedule(); } }); - video.addEventListener('seeked', () => { + video.addEventListener('seeking', () => { if (!video.paused) startSponsorSchedule(); }); video.addEventListener('ratechange', () => startSponsorSchedule()); - video.addEventListener('seeking', cancelSponsorSchedule); video.addEventListener('pause', cancelSponsorSchedule); startSponsorSchedule(); From b6172c6d9bbd58c966f1a7c56529a16dc5601818 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 30 Mar 2020 19:07:59 -0400 Subject: [PATCH 3/6] Fixed sponsor skipping after quickly playing and pausing. --- src/content.ts | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/content.ts b/src/content.ts index 84699a53..d6a3f805 100644 --- a/src/content.ts +++ b/src/content.ts @@ -21,7 +21,7 @@ var UUIDs = []; var sponsorVideoID = null; // Skips are scheduled to ensure precision. -// Skips are rescheduled every seeked event. +// Skips are rescheduled every seeking event. // Skips are canceled every seeking event var currentSkipSchedule: NodeJS.Timeout = null; var seekListenerSetUp = false @@ -35,6 +35,9 @@ var sponsorSkipped = []; //the video var video: HTMLVideoElement; +/** The last time this video was seeking to */ +var lastVideoTime: number = null; + var onInvidious; var onMobileYouTube; @@ -534,10 +537,26 @@ function sponsorsLookup(id: string, channelIDPromise?) { } }); video.addEventListener('seeking', () => { - if (!video.paused) startSponsorSchedule(); + // Reset lastCheckVideoTime + lastCheckVideoTime = -1 + lastCheckTime = 0; + + lastVideoTime = video.currentTime; + + if (!video.paused){ + startSponsorSchedule(); + } }); video.addEventListener('ratechange', () => startSponsorSchedule()); - video.addEventListener('pause', cancelSponsorSchedule); + video.addEventListener('pause', () => { + // Reset lastCheckVideoTime + lastCheckVideoTime = -1; + lastCheckTime = 0; + + lastVideoTime = video.currentTime; + + cancelSponsorSchedule(); + }); startSponsorSchedule(); } From 4a6ddf677423eb5a92d784f8986a6a46227af476 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 30 Mar 2020 19:15:25 -0400 Subject: [PATCH 4/6] Remove mobile support announcement --- src/background.ts | 4 ---- src/content.ts | 7 ------- 2 files changed, 11 deletions(-) diff --git a/src/background.ts b/src/background.ts index 330481e7..5b49c7d2 100644 --- a/src/background.ts +++ b/src/background.ts @@ -88,10 +88,6 @@ chrome.runtime.onInstalled.addListener(function (object) { const newUserID = utils.generateUserID(); //save this UUID Config.config.userID = newUserID; - - //TODO: Remove when mobile support is old - // Don't show this to new users - // Config.config.mobileUpdateShowCount = 1; } }, 1500); }); diff --git a/src/content.ts b/src/content.ts index d6a3f805..2ab873e0 100644 --- a/src/content.ts +++ b/src/content.ts @@ -890,13 +890,6 @@ function skipToTime(v, index, sponsorTimes, openNotice) { let skipNotice = new SkipNotice(this, currentUUID, Config.config.disableAutoSkip, skipNoticeContentContainer); - //TODO: Remove this when Mobile support is old - if (Config.config.mobileUpdateShowCount < 1) { - skipNotice.addNoticeInfoMessage(chrome.i18n.getMessage("mobileUpdateInfo")); - - Config.config.mobileUpdateShowCount += 1; - } - //auto-upvote this sponsor if (Config.config.trackViewCount && !Config.config.disableAutoSkip && Config.config.autoUpvote) { vote(1, currentUUID, null); From a9993d5d807b35bbf3515c1f2213d7295001f8d7 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 30 Mar 2020 20:08:00 -0400 Subject: [PATCH 5/6] Added check for videoID change not being called --- src/content.ts | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/content.ts b/src/content.ts index 2ab873e0..36137809 100644 --- a/src/content.ts +++ b/src/content.ts @@ -479,12 +479,24 @@ function startSponsorSchedule(currentTime?: number): void { let forcedSkipTime: number = null; if (video.currentTime >= skipTime[0] && video.currentTime < skipTime[1]) { - skipToTime(video, skipInfo.index, skipInfo.array, skipInfo.openNotice); + // Double check that the videoID is correct + // TODO: Remove this bug catching if statement when the bug is found + let currentVideoID = getYouTubeVideoID(document.URL); + if (currentVideoID == sponsorVideoID) { + skipToTime(video, skipInfo.index, skipInfo.array, skipInfo.openNotice); - if (Config.config.disableAutoSkip) { - forcedSkipTime = skipTime[0] + 0.001; + if (Config.config.disableAutoSkip) { + forcedSkipTime = skipTime[0] + 0.001; + } else { + forcedSkipTime = skipTime[1]; + } } else { - forcedSkipTime = skipTime[1]; + // Something has really gone wrong + console.error("[SponsorBlock] The videoID recorded when trying to skip is different than what it should be."); + console.error("[SponsorBlock] VideoID recorded: " + sponsorVideoID + ". Actual VideoID: " + currentVideoID); + + // Video ID change occured + videoIDChange(currentVideoID); } } From 36d79313de6241dc18f4aa36bc89200a6f47feba Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 30 Mar 2020 20:10:32 -0400 Subject: [PATCH 6/6] Increase version number --- manifest/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest/manifest.json b/manifest/manifest.json index 4ae39362..fcfd4bc0 100644 --- a/manifest/manifest.json +++ b/manifest/manifest.json @@ -1,7 +1,7 @@ { "name": "__MSG_fullName__", "short_name": "__MSG_Name__", - "version": "1.2.23", + "version": "1.2.24", "default_locale": "en", "description": "__MSG_Description__", "content_scripts": [{