From e281b90699bfa6e72fc052f9b1e902169511682c Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 12 Aug 2019 12:05:16 -0400 Subject: [PATCH] Fixed sponsor times not properly saving --- popup.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/popup.js b/popup.js index 8c6a5f16..71e1ef83 100644 --- a/popup.js +++ b/popup.js @@ -209,7 +209,9 @@ function runThePopup() { function onTabs(tabs) { chrome.tabs.sendMessage(tabs[0].id, {message: 'getVideoID'}, function(result) { if (result != undefined && result.videoID) { - loadTabData(tabs, result.videoID); + currentVideoID = result.videoID; + + loadTabData(tabs); } else if (result == undefined && chrome.runtime.lastError) { //this isn't a YouTube video then, or at least the content script is not loaded displayNoVideo(); @@ -217,15 +219,15 @@ function runThePopup() { }); } - function loadTabData(tabs, videoID) { - if (!videoID) { + function loadTabData(tabs) { + if (!currentVideoID) { //this isn't a YouTube video then displayNoVideo(); return; } //load video times for this video - let sponsorTimeKey = "sponsorTimes" + videoID; + let sponsorTimeKey = "sponsorTimes" + currentVideoID; chrome.storage.sync.get([sponsorTimeKey], function(result) { let sponsorTimesStorage = result[sponsorTimeKey]; if (sponsorTimesStorage != undefined && sponsorTimesStorage.length > 0) {