Get ID from storage API

This commit is contained in:
Official Noob
2019-08-08 14:43:15 +01:00
committed by GitHub
parent 2067b1c787
commit a9ea22f505

View File

@@ -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();
}
}