From 30c12e398371eda8c3496d87a3d8a063dbbf83ab Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sat, 10 Aug 2019 20:57:11 -0400 Subject: [PATCH] Reduced errors by getting if the channel is whitelisted after checking it is is a YouTube tab. --- popup.js | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/popup.js b/popup.js index d1186984..96302742 100644 --- a/popup.js +++ b/popup.js @@ -123,26 +123,6 @@ function runThePopup() { } }); - //see if whitelist button should be swapped - chrome.tabs.query({ - active: true, - currentWindow: true - }, tabs => { - chrome.tabs.sendMessage( - tabs[0].id, - {message: 'isChannelWhitelisted'}, - function(response) { - if (response.value) { - SB.whitelistChannel.style.display = "none"; - SB.unwhitelistChannel.style.display = "unset"; - - SB.downloadedSponsorMessageTimes.innerText = "Channel Whitelisted!"; - SB.downloadedSponsorMessageTimes.style.fontWeight = "bold"; - } - }); - } - ); - //if the don't show notice again letiable is true, an option to // disable should be available chrome.storage.sync.get(["dontShowNoticeAgain"], function(result) { @@ -292,6 +272,26 @@ function runThePopup() { SB.videoFound.innerHTML = "No sponsors found" } } + + //see if whitelist button should be swapped + chrome.tabs.query({ + active: true, + currentWindow: true + }, tabs => { + chrome.tabs.sendMessage( + tabs[0].id, + {message: 'isChannelWhitelisted'}, + function(response) { + if (response.value) { + SB.whitelistChannel.style.display = "none"; + SB.unwhitelistChannel.style.display = "unset"; + + SB.downloadedSponsorMessageTimes.innerText = "Channel Whitelisted!"; + SB.downloadedSponsorMessageTimes.style.fontWeight = "bold"; + } + }); + } + ); } function setVideoID(request) {