From a9ea22f5050c205084685a586d91c800cfa11b93 Mon Sep 17 00:00:00 2001 From: Official Noob <31563761+OfficialNoob@users.noreply.github.com> Date: Thu, 8 Aug 2019 14:43:15 +0100 Subject: [PATCH] Get ID from storage API --- popup.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/popup.js b/popup.js index 8368f274..8da7330d 100644 --- a/popup.js +++ b/popup.js @@ -221,16 +221,18 @@ function runThePopup() { } }); - chrome.tabs.query({ active: true, currentWindow: true }, loadTabData); + function OnTabs(tabs) { + chrome.storage.sync.get(['videoid'], function(result) { + loadTabData(tabs, result.videoid); + }); + } - function loadTabData(tabs) { - //set current videoID - currentVideoID = getYouTubeVideoID(tabs[0].url); + function loadTabData(tabs, currentVideoID) { if (!currentVideoID) { //this isn't a YouTube video then @@ -1143,4 +1145,4 @@ if (chrome.tabs != undefined) { //this means it is actually opened in the popup runThePopup(); -} \ No newline at end of file +}