From d84ff782c249da15352a88923371e714b6bfb0e6 Mon Sep 17 00:00:00 2001 From: hackademix Date: Fri, 25 Oct 2019 22:42:54 +0100 Subject: [Mobile] Blocked scripts count displayed in the browser action menu item. --- src/bg/RequestGuard.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/bg/RequestGuard.js') diff --git a/src/bg/RequestGuard.js b/src/bg/RequestGuard.js index 8f4df67..ac952cd 100644 --- a/src/bg/RequestGuard.js +++ b/src/bg/RequestGuard.js @@ -111,6 +111,11 @@ var RequestGuard = (() => { : (numAllowed ? "sub" : "no"); let showBadge = ns.local.showCountBadge && numBlocked > 0; let browserAction = browser.browserAction; + if (!browserAction.setIcon) { // mobile + browserAction.setTitle({tabId, title: `NoScript (${numBlocked})`}); + return; + } + browserAction.setIcon({tabId, path: {64: `/img/ui-${icon}64.png`}}); browserAction.setBadgeText({tabId, text: showBadge ? numBlocked.toString() : ""}); browserAction.setBadgeBackgroundColor({tabId, color: [128, 0, 0, 160]}); @@ -165,9 +170,6 @@ var RequestGuard = (() => { } browser.tabs.onActivated.addListener(TabStatus.onActivatedTab); browser.tabs.onRemoved.addListener(TabStatus.onRemovedTab); - if (!("setIcon" in browser.browserAction)) { // unsupported on Android - TabStatus._updateTabNow = TabStatus.updateTab = () => {}; - } let messageHandler = { async pageshow(message, sender) { TabStatus.recordAll(sender.tab.id, message.seen); -- cgit v1.2.3