diff options
author | Ajay Ramachandran <[email protected]> | 2020-02-08 17:45:22 -0500 |
---|---|---|
committer | Ajay Ramachandran <[email protected]> | 2020-02-08 17:45:22 -0500 |
commit | 5f21d3f96fe84a3c9a4b36689a9bda362ad8c894 (patch) | |
tree | 4e0a0f241aa161402dcdf6e8285c1cf49dda1ffd | |
parent | 158b76c17e33bc78a169477257c6f4830abe5453 (diff) | |
download | SponsorBlock-5f21d3f96fe84a3c9a4b36689a9bda362ad8c894.tar.gz SponsorBlock-5f21d3f96fe84a3c9a4b36689a9bda362ad8c894.zip |
Default UUIDs to an empty list instead of null.
Resolves https://github.com/ajayyy/SponsorBlock/issues/252.
-rw-r--r-- | src/content.ts | 24 |
1 files 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; + } } } } |