aboutsummaryrefslogtreecommitdiff
path: root/main_background.js
diff options
context:
space:
mode:
authorhackademix <giorgio@maone.net>2019-01-22 00:15:25 +0100
committerhackademix <giorgio@maone.net>2019-01-28 12:38:04 +0100
commitc834adee1012322961d574e9212f8accd7b58414 (patch)
tree095f5b1f8b7e60c2709ce722a43ad591629cdcf4 /main_background.js
parent32ad13e05be94a1136b8218f5f74a09ea44ac7df (diff)
Android-compatible browserAction management.
Diffstat (limited to 'main_background.js')
-rw-r--r--main_background.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/main_background.js b/main_background.js
index 35daf4b..57017db 100644
--- a/main_background.js
+++ b/main_background.js
@@ -800,8 +800,14 @@ function updateBadge(tabId, report = null, forceRed = false) {
let blockedCount = report ? report.blocked.length + report.blacklisted.length : 0;
let [text, color] = blockedCount > 0 || forceRed
? [blockedCount && blockedCount.toString() || "!" , "red"] : ["✓", "green"]
- browser.browserAction.setBadgeText({text, tabId});
- browser.browserAction.setBadgeBackgroundColor({color, tabId});
+ let {browserAction} = browser;
+ if ("setBadgeText" in browserAction) {
+ browserAction.setBadgeText({text, tabId});
+ browserAction.setBadgeBackgroundColor({color, tabId});
+ } else {
+ // Mobile
+ browserAction.setTitle({title: `LibreJS (${text})`, tabId});
+ }
}
/**