summaryrefslogtreecommitdiff
path: root/src/bg
diff options
context:
space:
mode:
authorhackademix2019-10-25 22:42:54 +0100
committerhackademix2019-10-25 23:19:48 +0100
commitd84ff782c249da15352a88923371e714b6bfb0e6 (patch)
treed5c9d25be4b3c824e92864c535de18d39eedc944 /src/bg
parent810c607e6b4b050147c49a3affe2d28ac4f8fa0f (diff)
downloadnoscript-d84ff782c249da15352a88923371e714b6bfb0e6.tar.gz
noscript-d84ff782c249da15352a88923371e714b6bfb0e6.tar.xz
noscript-d84ff782c249da15352a88923371e714b6bfb0e6.zip
[Mobile] Blocked scripts count displayed in the browser action menu item.
Diffstat (limited to 'src/bg')
-rw-r--r--src/bg/RequestGuard.js8
1 files changed, 5 insertions, 3 deletions
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);