From 158b76c17e33bc78a169477257c6f4830abe5453 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Thu, 6 Feb 2020 20:10:35 -0500 Subject: [PATCH 1/9] Fixed incorrect type. --- src/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.ts b/src/config.ts index a77a3807..d9fbed7a 100644 --- a/src/config.ts +++ b/src/config.ts @@ -19,7 +19,7 @@ interface SBConfig { invidiousInstances: string[], invidiousUpdateInfoShowCount: number, autoUpvote: boolean, - supportInvidious: false + supportInvidious: boolean } interface SBObject { From 5f21d3f96fe84a3c9a4b36689a9bda362ad8c894 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sat, 8 Feb 2020 17:45:22 -0500 Subject: [PATCH 2/9] Default UUIDs to an empty list instead of null. Resolves https://github.com/ajayyy/SponsorBlock/issues/252. --- src/content.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/content.ts b/src/content.ts index 31e11f3d..48ab5afb 100644 --- a/src/content.ts +++ b/src/content.ts @@ -13,7 +13,7 @@ var sponsorDataFound = false; var previousVideoID = null; //the actual sponsorTimes if loaded and UUIDs associated with them var sponsorTimes = null; -var UUIDs = null; +var UUIDs = []; //what video id are these sponsors for var sponsorVideoID = null; @@ -215,7 +215,7 @@ function resetValues() { //reset sponsor times sponsorTimes = null; - UUIDs = null; + UUIDs = []; sponsorLookupRetries = 0; //empty the preview bar @@ -613,7 +613,7 @@ function skipToTime(v, index, sponsorTimes, openNotice) { } lastSponsorTimeSkipped = sponsorTimes[index][0]; - + let currentUUID = UUIDs[index]; lastSponsorTimeSkippedUUID = currentUUID; @@ -627,17 +627,17 @@ function skipToTime(v, index, sponsorTimes, openNotice) { vote(1, currentUUID, null); } } - } - //send telemetry that a this sponsor was skipped - if (Config.config.trackViewCount && !sponsorSkipped[index]) { - utils.sendRequestToServer("POST", "/api/viewedVideoSponsorTime?UUID=" + currentUUID); + //send telemetry that a this sponsor was skipped + if (Config.config.trackViewCount && !sponsorSkipped[index]) { + utils.sendRequestToServer("POST", "/api/viewedVideoSponsorTime?UUID=" + currentUUID); - if (!Config.config.disableAutoSkip) { - // Count this as a skip - Config.config.minutesSaved = Config.config.minutesSaved + (sponsorTimes[index][1] - sponsorTimes[index][0]) / 60; - Config.config.skipCount = Config.config.skipCount + 1; - sponsorSkipped[index] = true; + if (!Config.config.disableAutoSkip) { + // Count this as a skip + Config.config.minutesSaved = Config.config.minutesSaved + (sponsorTimes[index][1] - sponsorTimes[index][0]) / 60; + Config.config.skipCount = Config.config.skipCount + 1; + sponsorSkipped[index] = true; + } } } } From 08c7754f291650d5b6265eb0f75ed8387cd7ca64 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sat, 8 Feb 2020 17:50:06 -0500 Subject: [PATCH 3/9] Fixed skip count resetting. Resolves https://github.com/ajayyy/SponsorBlock/issues/256 --- src/content.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/content.ts b/src/content.ts index 48ab5afb..9bbf4477 100644 --- a/src/content.ts +++ b/src/content.ts @@ -636,6 +636,7 @@ function skipToTime(v, index, sponsorTimes, openNotice) { // Count this as a skip Config.config.minutesSaved = Config.config.minutesSaved + (sponsorTimes[index][1] - sponsorTimes[index][0]) / 60; Config.config.skipCount = Config.config.skipCount + 1; + sponsorSkipped[index] = true; } } @@ -921,12 +922,10 @@ function vote(type, UUID, skipNotice) { sponsorSkipped[sponsorIndex] = false; } - // Count this as a skip - Config.config.minutesSaved = Config.config.minutesSaved + factor * (sponsorTimes[sponsorIndex][1] - sponsorTimes[sponsorIndex][0]) / 60; - - Config.config.skipCount = 0; - - Config.config.skipCount = Config.config.skipCount + factor * 1; + // Count this as a skip + Config.config.minutesSaved = Config.config.minutesSaved + factor * (sponsorTimes[sponsorIndex][1] - sponsorTimes[sponsorIndex][0]) / 60; + + Config.config.skipCount = Config.config.skipCount + factor; } chrome.runtime.sendMessage({ From 0c891e0a0971add54a7d79315224530b2080735f Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sat, 8 Feb 2020 17:51:16 -0500 Subject: [PATCH 4/9] Changed time saved date to updated time. --- public/popup.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/popup.html b/public/popup.html index 81dcf62c..9132ec32 100644 --- a/public/popup.html +++ b/public/popup.html @@ -145,7 +145,7 @@ 0 - __MSG_Segments__ (since December). + __MSG_Segments__ (since February).