diff options
author | Ajay Ramachandran <[email protected]> | 2020-07-02 23:34:13 -0400 |
---|---|---|
committer | Ajay Ramachandran <[email protected]> | 2020-07-02 23:34:13 -0400 |
commit | 1265eeb94165727fe57176f885c43cbb8222b3ea (patch) | |
tree | c5623e836c21298e0f5bb68b4e88f1e13df4dd6a /src/background.ts | |
parent | b3a94142c357aea0fe161ab5ddc5f131ddf4e607 (diff) | |
download | SponsorBlock-1265eeb94165727fe57176f885c43cbb8222b3ea.tar.gz SponsorBlock-1265eeb94165727fe57176f885c43cbb8222b3ea.zip |
Save category with the preview submissions.
Diffstat (limited to 'src/background.ts')
-rw-r--r-- | src/background.ts | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/src/background.ts b/src/background.ts index 28a1051e..ec398d59 100644 --- a/src/background.ts +++ b/src/background.ts @@ -41,21 +41,6 @@ chrome.runtime.onMessage.addListener(function (request, sender, callback) { }); return true; - case "addSponsorTime": - addSponsorTime(request.time, request.videoID, callback); - - //this allows the callback to be called later - return true; - - case "getSponsorTimes": - getSponsorTimes(request.videoID, function(sponsorTimes) { - callback({ - sponsorTimes - }); - }); - - //this allows the callback to be called later - return true; case "submitVote": submitVote(request.type, request.UUID, request.category).then(callback); @@ -127,38 +112,6 @@ function unregisterFirefoxContentScript(id: string) { delete contentScriptRegistrations[id]; } -//gets the sponsor times from memory -function getSponsorTimes(videoID, callback) { - let sponsorTimes = []; - let sponsorTimesStorage = Config.config.sponsorTimes.get(videoID); - - if (sponsorTimesStorage != undefined && sponsorTimesStorage.length > 0) { - sponsorTimes = sponsorTimesStorage; - } - - callback(sponsorTimes); -} - -function addSponsorTime(time, videoID, callback) { - getSponsorTimes(videoID, function(sponsorTimes) { - //add to sponsorTimes - if (sponsorTimes.length > 0 && sponsorTimes[sponsorTimes.length - 1].length < 2) { - //it is an end time - sponsorTimes[sponsorTimes.length - 1][1] = time; - } else { - //it is a start time - let sponsorTimesIndex = sponsorTimes.length; - sponsorTimes[sponsorTimesIndex] = []; - - sponsorTimes[sponsorTimesIndex][0] = time; - } - - //save this info - Config.config.sponsorTimes.set(videoID, sponsorTimes); - callback(); - }); -} - async function submitVote(type: number, UUID: string, category: string) { let userID = Config.config.userID; |