From 22a2f3a1585db9199b99b035965821b571a088fb Mon Sep 17 00:00:00 2001 From: Heikki Hellgren Date: Fri, 4 Oct 2024 08:45:48 +0300 Subject: [PATCH] fix: check for active tab for disabled icon --- chrome/yt.js | 8 ++++++-- firefox/yt.js | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/chrome/yt.js b/chrome/yt.js index 5984472..eee3f79 100644 --- a/chrome/yt.js +++ b/chrome/yt.js @@ -218,11 +218,15 @@ chrome.tabs.onActivated.addListener(function (info) { // Tab update listener chrome.tabs.onUpdated.addListener(async function (tabId, changeInfo, tab) { if (!isEnabledForTab(tab)) { - changeIcon(true); + if (tab.active) { + changeIcon(true); + } return; } - changeIcon(false); + if (tab.active) { + changeIcon(false); + } await injectScript(tab); if ( diff --git a/firefox/yt.js b/firefox/yt.js index 3f869e3..aac0010 100644 --- a/firefox/yt.js +++ b/firefox/yt.js @@ -220,11 +220,15 @@ browser.tabs.onActivated.addListener(function (info) { // Tab update listener browser.tabs.onUpdated.addListener(async function (tabId, changeInfo, tab) { if (!isEnabledForTab(tab)) { - changeIcon(true); + if (tab.active) { + changeIcon(true); + } return; } - changeIcon(false); + if (tab.active) { + changeIcon(false); + } await injectScript(tab); if (