From 5edb8aad46b6f394867ca8286105f84fc4012528 Mon Sep 17 00:00:00 2001 From: Eduardo Rosendo Date: Fri, 12 Jul 2024 09:55:22 -0400 Subject: [PATCH] feat(toolbar): Implements logic to display badge icon --- src/toolbar_button.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/toolbar_button.js b/src/toolbar_button.js index 80d98455..91c16d6d 100644 --- a/src/toolbar_button.js +++ b/src/toolbar_button.js @@ -28,6 +28,15 @@ function updateToolbarButton(tab) { }; chrome.storage.local.get('options', function(items){ + if ( + 'dismiss_news_badge' in items['options'] && + items['options']['dismiss_news_badge'] + ) { + chrome.browserAction.setBadgeText({ text: '' }); + } else { + chrome.browserAction.setBadgeText({ text: '📣' }); + } + if (tab === null || tab === undefined) { // There's code in Firefox that can be called before the defaults are set // and before the tab is even established. Catch that, and handle it or