From 2f5c239c826f45f08d198ef57348a632acf87563 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sun, 19 Apr 2020 20:59:36 -0400 Subject: [PATCH 01/21] Added path to release CI --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 48365c37..2437a778 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -68,11 +68,13 @@ jobs: with: args: builds/ChromeExtension.zip name: ChromeExtension.zip + path: ./builds/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 + path: ./builds/FirefoxExtension.zip repo-token: ${{ secrets.GITHUB_TOKEN }} From 89f72c185cbd448013f51cbd492f6e6ba9b6dd08 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 20 Apr 2020 00:33:41 -0400 Subject: [PATCH 02/21] Update submission UI whenever there is a config update. --- src/components/SponsorTimeEditComponent.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/SponsorTimeEditComponent.tsx b/src/components/SponsorTimeEditComponent.tsx index 42840405..aa3e482d 100644 --- a/src/components/SponsorTimeEditComponent.tsx +++ b/src/components/SponsorTimeEditComponent.tsx @@ -47,6 +47,9 @@ class SponsorTimeEditComponent extends React.Component Date: Mon, 20 Apr 2020 00:37:25 -0400 Subject: [PATCH 03/21] Added end button to submission notice --- public/_locales/en/messages.json | 3 +++ src/components/SponsorTimeEditComponent.tsx | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index fa721e16..d334e3c3 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -531,5 +531,8 @@ }, "moreCategories": { "message": "More Categories" + }, + "bracketEnd": { + "message": "(End)" } } diff --git a/src/components/SponsorTimeEditComponent.tsx b/src/components/SponsorTimeEditComponent.tsx index aa3e482d..07f20cba 100644 --- a/src/components/SponsorTimeEditComponent.tsx +++ b/src/components/SponsorTimeEditComponent.tsx @@ -133,6 +133,12 @@ class SponsorTimeEditComponent extends React.Component this.setTimeToNow(1)}> {chrome.i18n.getMessage("bracketNow")} + + this.setTimeToEnd()}> + {chrome.i18n.getMessage("bracketEnd")} + ); } else { @@ -230,10 +236,18 @@ class SponsorTimeEditComponent extends React.Component Date: Mon, 20 Apr 2020 15:48:47 -0400 Subject: [PATCH 04/21] Fix submission count not being counted --- src/background.ts | 62 ----------------------------------------------- src/content.ts | 3 +++ 2 files changed, 3 insertions(+), 62 deletions(-) diff --git a/src/background.ts b/src/background.ts index 1582327c..b204b64c 100644 --- a/src/background.ts +++ b/src/background.ts @@ -31,11 +31,6 @@ chrome.runtime.onMessage.addListener(function (request, sender, callback) { case "openConfig": chrome.runtime.openOptionsPage(); return - case "submitTimes": - submitTimes(request.videoID, callback); - - //this allows the callback to be called later by the submitTimes function - return true; case "addSponsorTime": addSponsorTime(request.time, request.videoID, callback); @@ -182,61 +177,4 @@ function submitVote(type, UUID, callback) { } }); -} - -async function submitTimes(videoID: string, callback) { - //get the video times from storage - let sponsorTimes = Config.config.sponsorTimes.get(videoID); - let userID = Config.config.userID; - - if (sponsorTimes != undefined && sponsorTimes.length > 0) { - let durationResult = await new Promise((resolve, reject) => { - chrome.tabs.query({ - active: true, - currentWindow: true - }, function(tabs) { - chrome.tabs.sendMessage(tabs[0].id, { - message: "getVideoDuration" - }, (response) => resolve(response)); - }); - }); - - //check if a sponsor exceeds the duration of the video - for (let i = 0; i < sponsorTimes.length; i++) { - if (sponsorTimes[i][1] > durationResult.duration) { - sponsorTimes[i][1] = durationResult.duration; - } - } - - //submit these times - for (let i = 0; i < sponsorTimes.length; i++) { - //to prevent it from happeneing twice - let increasedContributionAmount = false; - - //submit the sponsorTime - utils.sendRequestToServer("GET", "/api/postVideoSponsorTimes?videoID=" + videoID + "&startTime=" + sponsorTimes[i][0] + "&endTime=" + sponsorTimes[i][1] - + "&userID=" + userID, function(xmlhttp, error) { - if (xmlhttp.readyState == 4 && !error) { - callback({ - statusCode: xmlhttp.status, - responseText: xmlhttp.responseText - }); - - - - if (xmlhttp.status == 200) { - //save the amount contributed - if (!increasedContributionAmount) { - increasedContributionAmount = true; - Config.config.sponsorTimesContributed = Config.config.sponsorTimesContributed + sponsorTimes.length; - } - } - } else if (error) { - callback({ - statusCode: -1 - }); - } - }); - } - } } \ No newline at end of file diff --git a/src/content.ts b/src/content.ts index 09fca172..6c1e3755 100644 --- a/src/content.ts +++ b/src/content.ts @@ -1490,6 +1490,9 @@ async function sendSubmitMessage(){ sponsorTimes = sponsorTimes.concat(sponsorTimesSubmitting); + // Increase contribution count + Config.config.sponsorTimesContributed = Config.config.sponsorTimesContributed + sponsorTimesSubmitting.length; + // Empty the submitting times sponsorTimesSubmitting = []; From a7e2f83033536a4629500dc5d0de9d875c430ead Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 20 Apr 2020 15:57:07 -0400 Subject: [PATCH 05/21] Fix Firefox popup scrolling issues --- public/popup.css | 4 ++++ public/popup.html | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/public/popup.css b/public/popup.css index dccfd881..c78f6867 100644 --- a/public/popup.css +++ b/public/popup.css @@ -56,6 +56,10 @@ h1.popupElement { padding: 0px 5px; } +.outerPopupBody { + overflow-y: scroll; +} + .discreteLink.popupElement { color: black; } diff --git a/public/popup.html b/public/popup.html index aa8060a8..8a06eb68 100644 --- a/public/popup.html +++ b/public/popup.html @@ -5,7 +5,7 @@ - +

From 7eb6f1c482c2974ae1e2777acc2b850f3e3c5f0f Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 20 Apr 2020 16:56:12 -0400 Subject: [PATCH 06/21] Changed popup look --- public/popup.css | 59 ++++++++++++++++++++++++----------------------- public/popup.html | 4 ++-- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/public/popup.css b/public/popup.css index c78f6867..fab03e3d 100644 --- a/public/popup.css +++ b/public/popup.css @@ -39,10 +39,8 @@ sub.popupElement { vertical-align: text-bottom; } -.popupElement { - font-family: 'Source Sans Pro', sans-serif; - - color: black; +.logoText { + color: white; } h1.popupElement { @@ -52,16 +50,21 @@ h1.popupElement { .popupBody { font-size: 14px; - background-color: #ffd9d9; + background-color: #333; padding: 0px 5px; + + font-family: 'Source Sans Pro', sans-serif; + + color: #dddddd; } .outerPopupBody { + background-color: #222626; overflow-y: scroll; } .discreteLink.popupElement { - color: black; + color: #dddddd; } .recordingSubtitle.popupElement { @@ -106,7 +109,7 @@ h1.popupElement { } .whitelistButton.popupElement { - background-color:#3acc3a; + background-color:#27a52d; -moz-border-radius:28px; -webkit-border-radius:28px; border-radius:28px; @@ -118,13 +121,15 @@ h1.popupElement { padding:8px 37px; text-decoration:none; text-shadow:0px 0px 0px #27663c; - } + + transition: 0.01s background-color; +} .whitelistButton:hover.popupElement { - background-color:#218b26; + background-color:#3acc3a; } .whitelistButton:focus.popupElement { outline: none; - background-color:#218b26; + background-color:#3acc3a; } .whitelistButton:active.popupElement { position:relative; @@ -132,25 +137,27 @@ h1.popupElement { } .greenButton.popupElement { - background-color:#ec1c1c; + background-color:#cc1717; -moz-border-radius:28px; -webkit-border-radius:28px; border-radius:28px; - border:1px solid #d31919; + border: none; display:inline-block; cursor:pointer; color:#ffffff; font-size:16px; padding:8px 37px; text-decoration:none; - text-shadow:0px 0px 0px #662727; + text-shadow:0px 0px 0px #662727; + + transition: 0.01s background-color; } .greenButton:hover.popupElement { - background-color:#bf2a2a; + background-color:#ec1c1c; } .greenButton:focus.popupElement { outline: none; - background-color:#bf2a2a; + background-color:#ec1c1c; } .greenButton:active.popupElement { position:relative; @@ -158,14 +165,11 @@ h1.popupElement { } .dangerButton.popupElement { - -moz-box-shadow:inset 0px 1px 0px 0px #cf866c; - -webkit-box-shadow:inset 0px 1px 0px 0px #cf866c; - box-shadow:inset 0px 1px 0px 0px #cf866c; - background-color:#d0451b; + background-color:#bc3315; -moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; - border:1px solid #942911; + border: none; display:inline-block; cursor:pointer; color:#ffffff; @@ -175,11 +179,11 @@ h1.popupElement { text-shadow:0px 1px 0px #854629; } .dangerButton:hover.popupElement { - background-color:#bc3315; + background-color:#d0451b; } .dangerButton:focus.popupElement { outline: none; - background-color:#bc3315; + background-color:#d0451b; } .dangerButton:active.popupElement { position:relative; @@ -187,14 +191,11 @@ h1.popupElement { } .warningButton.popupElement { - -moz-box-shadow:inset 0px 1px 0px 0px #cfbd6c; - -webkit-box-shadow:inset 0px 1px 0px 0px #cfbd6c; - box-shadow:inset 0px 1px 0px 0px #cfbd6c; - background-color:#d0821b; + background-color:#bc8215; -moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; - border:1px solid #948b11; + border: none; display:inline-block; cursor:pointer; color:#ffffff; @@ -204,11 +205,11 @@ h1.popupElement { text-shadow:0px 1px 0px #856829; } .warningButton:hover.popupElement { - background-color:#bc8215; + background-color:#d0821b; } .warningButton:focus.popupElement { outline: none; - background-color:#bc8215; + background-color:#d0821b; } .warningButton:active.popupElement { position:relative; diff --git a/public/popup.html b/public/popup.html index 8a06eb68..05ace54f 100644 --- a/public/popup.html +++ b/public/popup.html @@ -5,10 +5,10 @@ - +
-

+

__MSG_Name__

From c31d30821b7b1d2dd078d38f3e0c08e6ffb5db39 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 21 Apr 2020 14:16:09 -0400 Subject: [PATCH 07/21] Call incorrect videoID check when scheduling a skip. --- src/content.ts | 49 +++++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/src/content.ts b/src/content.ts index 6c1e3755..090dbc71 100644 --- a/src/content.ts +++ b/src/content.ts @@ -464,6 +464,8 @@ function startSponsorSchedule(includeIntersectingSegments: boolean = false, curr return; } + if (incorrectVideoIDCheck()) return; + if (currentTime === undefined || currentTime === null) currentTime = video.currentTime; let skipInfo = getNextSkipIndex(currentTime, includeIntersectingSegments); @@ -481,27 +483,17 @@ function startSponsorSchedule(includeIntersectingSegments: boolean = false, curr let forcedSkipTime: number = null; let forcedIncludeIntersectingSegments = false; + if (incorrectVideoIDCheck()) return; + if (video.currentTime >= skipTime[0] && video.currentTime < skipTime[1]) { - // 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.endIndex, skipInfo.array, skipInfo.openNotice); + skipToTime(video, skipInfo.endIndex, skipInfo.array, skipInfo.openNotice); - // TODO: Know the autoSkip settings for ALL items being skipped - if (utils.getCategorySelection(currentSkip.category).option === CategorySkipOption.ManualSkip) { - forcedSkipTime = skipTime[0] + 0.001; - } else { - forcedSkipTime = skipTime[1]; - forcedIncludeIntersectingSegments = true; - } + // TODO: Know the autoSkip settings for ALL items being skipped + if (utils.getCategorySelection(currentSkip.category).option === CategorySkipOption.ManualSkip) { + forcedSkipTime = skipTime[0] + 0.001; } else { - // 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); + forcedSkipTime = skipTime[1]; + forcedIncludeIntersectingSegments = true; } } @@ -515,6 +507,27 @@ function startSponsorSchedule(includeIntersectingSegments: boolean = false, curr } } +/** + * This makes sure the videoID is still correct + * + * TODO: Remove this bug catching if statement when the bug is found + */ +function incorrectVideoIDCheck(): boolean { + let currentVideoID = getYouTubeVideoID(document.URL); + if (currentVideoID == sponsorVideoID) { + // 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); + + return false; + } else { + return true; + } +} + function sponsorsLookup(id: string, channelIDPromise?) { video = document.querySelector('video') // Youtube video player //there is no video here From 8912f88131df811f824676792cc28925819eb6c3 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 21 Apr 2020 16:01:41 -0400 Subject: [PATCH 08/21] Fixed show on seekbar categories appearing in list of start times to skip. --- src/content.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/content.ts b/src/content.ts index 090dbc71..79cb81ba 100644 --- a/src/content.ts +++ b/src/content.ts @@ -869,13 +869,13 @@ function getNextSkipIndex(currentTime: number, includeIntersectingSegments: bool {array: SponsorTime[], index: number, endIndex: number, openNotice: boolean} { let sponsorStartTimes = getStartTimes(sponsorTimes, includeIntersectingSegments); - let sponsorStartTimesAfterCurrentTime = getStartTimes(sponsorTimes, includeIntersectingSegments, currentTime, true); + let sponsorStartTimesAfterCurrentTime = getStartTimes(sponsorTimes, includeIntersectingSegments, currentTime, true, true); let minSponsorTimeIndex = sponsorStartTimes.indexOf(Math.min(...sponsorStartTimesAfterCurrentTime)); let endTimeIndex = getLatestEndTimeIndex(sponsorTimes, minSponsorTimeIndex); let previewSponsorStartTimes = getStartTimes(sponsorTimesSubmitting, includeIntersectingSegments); - let previewSponsorStartTimesAfterCurrentTime = getStartTimes(sponsorTimesSubmitting, includeIntersectingSegments, currentTime, false); + let previewSponsorStartTimesAfterCurrentTime = getStartTimes(sponsorTimesSubmitting, includeIntersectingSegments, currentTime, true, false); let minPreviewSponsorTimeIndex = previewSponsorStartTimes.indexOf(Math.min(...previewSponsorStartTimesAfterCurrentTime)); let previewEndTimeIndex = getLatestEndTimeIndex(sponsorTimesSubmitting, minPreviewSponsorTimeIndex); @@ -950,14 +950,16 @@ function getLatestEndTimeIndex(sponsorTimes: SponsorTime[], index: number, hideH * the current time, but end after */ function getStartTimes(sponsorTimes: SponsorTime[], includeIntersectingSegments: boolean, minimum?: number, - hideHiddenSponsors: boolean = false): number[] { + onlySkippableSponsors: boolean = false, hideHiddenSponsors: boolean = false): number[] { if (sponsorTimes === null) return []; let startTimes: number[] = []; for (let i = 0; i < sponsorTimes.length; i++) { if ((minimum === undefined || (sponsorTimes[i].segment[0] >= minimum || (includeIntersectingSegments && sponsorTimes[i].segment[1] > minimum))) + && (!onlySkippableSponsors || utils.getCategorySelection(sponsorTimes[i].category).option !== CategorySkipOption.ShowOverlay) && (!hideHiddenSponsors || !hiddenSponsorTimes.includes(i))) { + startTimes.push(sponsorTimes[i].segment[0]); } } From 41314420665e79065a53aaa2851f5bd24103348d Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Fri, 24 Apr 2020 21:27:45 -0400 Subject: [PATCH 09/21] Properly reset hiddenSponsorTimes. Maybe related to https://github.com/ajayyy/SponsorBlock/issues/325 --- src/content.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/content.ts b/src/content.ts index 79cb81ba..f18202c7 100644 --- a/src/content.ts +++ b/src/content.ts @@ -287,6 +287,9 @@ async function videoIDChange(id) { //if the id has not changed return if (sponsorVideoID === id) return; + // Reset hidden times (only do this when the ID has changed) + hiddenSponsorTimes = []; + //set the global videoID sponsorVideoID = id; From 0b9053937234574674da5cc2c7e01a9caf51b404 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Fri, 24 Apr 2020 21:28:08 -0400 Subject: [PATCH 10/21] Fixed incorrect videoID check being in reverse. --- src/content.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/content.ts b/src/content.ts index f18202c7..d9d018ab 100644 --- a/src/content.ts +++ b/src/content.ts @@ -517,7 +517,7 @@ function startSponsorSchedule(includeIntersectingSegments: boolean = false, curr */ function incorrectVideoIDCheck(): boolean { let currentVideoID = getYouTubeVideoID(document.URL); - if (currentVideoID == sponsorVideoID) { + if (currentVideoID !== sponsorVideoID) { // 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); @@ -525,9 +525,9 @@ function incorrectVideoIDCheck(): boolean { // Video ID change occured videoIDChange(currentVideoID); - return false; - } else { return true; + } else { + return false; } } From 1b8af9da11a3e90845b79ff5c4d31111662e4ee8 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sat, 25 Apr 2020 23:41:08 -0400 Subject: [PATCH 11/21] Redid hidden sponsor implementation + added info about being hid due to minimum duration Fixes https://github.com/ajayyy/SponsorBlock/issues/326 and https://github.com/ajayyy/SponsorBlock/issues/325 --- public/_locales/en/messages.json | 6 ++++++ src/components/SkipNoticeComponent.tsx | 4 ++-- src/content.ts | 28 ++++++++------------------ src/popup.ts | 23 +++++++++++++++------ src/types.ts | 12 +++++++++-- 5 files changed, 43 insertions(+), 30 deletions(-) diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index d334e3c3..11807407 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -534,5 +534,11 @@ }, "bracketEnd": { "message": "(End)" + }, + "hiddenDueToDownvote": { + "message": "hidden: downvote" + }, + "hiddenDueToDuration": { + "message": "hidden: too short" } } diff --git a/src/components/SkipNoticeComponent.tsx b/src/components/SkipNoticeComponent.tsx index 08d817e6..8d53efbb 100644 --- a/src/components/SkipNoticeComponent.tsx +++ b/src/components/SkipNoticeComponent.tsx @@ -1,6 +1,6 @@ import * as React from "react"; import Config from "../config" -import { ContentContainer } from "../types"; +import { ContentContainer, SponsorHideType } from "../types"; import Utils from "../utils"; var utils = new Utils(); @@ -269,7 +269,7 @@ class SkipNoticeComponent extends React.Component

diff --git a/src/config.ts b/src/config.ts index 9d69e681..70263d5a 100644 --- a/src/config.ts +++ b/src/config.ts @@ -8,6 +8,7 @@ interface SBConfig { userID: string, sponsorTimes: SBMap, whitelistedChannels: string[], + forceChannelCheck: boolean, startSponsorKeybind: string, submitKeybind: string, minutesSaved: number, @@ -107,6 +108,7 @@ var Config: SBObject = { userID: null, sponsorTimes: new SBMap("sponsorTimes"), whitelistedChannels: [], + forceChannelCheck: false, startSponsorKeybind: ";", submitKeybind: "'", minutesSaved: 0, diff --git a/src/content.ts b/src/content.ts index 83df8952..758a5bb4 100644 --- a/src/content.ts +++ b/src/content.ts @@ -463,7 +463,7 @@ function startSponsorSchedule(includeIntersectingSegments: boolean = false, curr cancelSponsorSchedule(); if (video.paused) return; - if (Config.config.disableSkipping || channelWhitelisted){ + if (Config.config.disableSkipping || channelWhitelisted || (channelID === null && Config.config.forceChannelCheck)){ return; } @@ -637,30 +637,7 @@ function sponsorsLookup(id: string) { } } - if (!switchingVideos) { - // See if there are any starting sponsors - let startingSponsor: number = -1; - for (const time of sponsorTimes) { - if (time.segment[0] <= video.currentTime && time.segment[0] > startingSponsor && time.segment[1] > video.currentTime) { - startingSponsor = time.segment[0]; - break; - } - } - if (startingSponsor === -1) { - for (const time of sponsorTimesSubmitting) { - if (time.segment[0] <= video.currentTime && time.segment[0] > startingSponsor && time.segment[1] > video.currentTime) { - startingSponsor = time.segment[0]; - break; - } - } - } - - if (startingSponsor !== -1) { - startSponsorSchedule(false, startingSponsor); - } else { - startSponsorSchedule(); - } - } + startSkipScheduleCheckingForStartSponsors(); // Reset skip save sponsorSkipped = []; @@ -701,6 +678,38 @@ function sponsorsLookup(id: string) { }); } +/** + * Only should be used when it is okay to skip a sponsor when in the middle of it + * + * Ex. When segments are first loaded + */ +function startSkipScheduleCheckingForStartSponsors() { + if (!switchingVideos) { + // See if there are any starting sponsors + let startingSponsor: number = -1; + for (const time of sponsorTimes) { + if (time.segment[0] <= video.currentTime && time.segment[0] > startingSponsor && time.segment[1] > video.currentTime) { + startingSponsor = time.segment[0]; + break; + } + } + if (startingSponsor === -1) { + for (const time of sponsorTimesSubmitting) { + if (time.segment[0] <= video.currentTime && time.segment[0] > startingSponsor && time.segment[1] > video.currentTime) { + startingSponsor = time.segment[0]; + break; + } + } + } + + if (startingSponsor !== -1) { + startSponsorSchedule(false, startingSponsor); + } else { + startSponsorSchedule(); + } + } +} + /** * Get the video info for the current tab from YouTube */ @@ -807,6 +816,9 @@ function whitelistCheck() { if (whitelistedChannels != undefined && whitelistedChannels.includes(channelID)) { channelWhitelisted = true; } + + // check if the start of segments were missed + if (sponsorTimes && sponsorTimes.length > 0) startSkipScheduleCheckingForStartSponsors(); } /** diff --git a/src/popup.ts b/src/popup.ts index 93ab75ca..914dddc5 100644 --- a/src/popup.ts +++ b/src/popup.ts @@ -51,6 +51,7 @@ async function runThePopup(messageListener?: MessageListener) { // Top toggles "whitelistChannel", "unwhitelistChannel", + "whitelistForceCheck", "disableSkipping", "enableSkipping", // Options @@ -102,6 +103,7 @@ async function runThePopup(messageListener?: MessageListener) { //setup click listeners PageElements.sponsorStart.addEventListener("click", sendSponsorStartMessage); PageElements.whitelistChannel.addEventListener("click", whitelistChannel); + PageElements.whitelistForceCheck.addEventListener("click", openOptions); PageElements.unwhitelistChannel.addEventListener("click", unwhitelistChannel); PageElements.disableSkipping.addEventListener("click", () => toggleSkipping(true)); PageElements.enableSkipping.addEventListener("click", () => toggleSkipping(false)); @@ -939,6 +941,7 @@ async function runThePopup(messageListener?: MessageListener) { //change button PageElements.whitelistChannel.style.display = "none"; PageElements.unwhitelistChannel.style.display = "unset"; + if (!Config.config.forceChannelCheck) PageElements.whitelistForceCheck.style.display = "unset"; PageElements.downloadedSponsorMessageTimes.innerText = chrome.i18n.getMessage("channelWhitelisted"); PageElements.downloadedSponsorMessageTimes.style.fontWeight = "bold"; @@ -971,7 +974,7 @@ async function runThePopup(messageListener?: MessageListener) { }, tabs => { messageHandler.sendMessage( tabs[0].id, - {message: 'getChannelURL'}, + {message: 'getChannelID'}, function(response) { //get whitelisted channels let whitelistedChannels = Config.config.whitelistedChannels; @@ -980,7 +983,7 @@ async function runThePopup(messageListener?: MessageListener) { } //remove this channel - let index = whitelistedChannels.indexOf(response.channelURL); + let index = whitelistedChannels.indexOf(response.channelID); whitelistedChannels.splice(index, 1); //change button From ad361cdf288f36a79cb1ea4708e8f21fde005500 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sun, 26 Apr 2020 23:14:47 -0400 Subject: [PATCH 21/21] 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 8830c74a..5b302f1f 100644 --- a/manifest/manifest.json +++ b/manifest/manifest.json @@ -1,7 +1,7 @@ { "name": "__MSG_fullName__", "short_name": "__MSG_Name__", - "version": "1.2.26", + "version": "1.2.27", "default_locale": "en", "description": "__MSG_Description__", "content_scripts": [{