Microsoft has acquired GitHub. Decentraleyes has left GitHub. Welcome to its new home!

To participate, please register, or sign in with an existing GitLab.com, Bitbucket, or GitHub account.

Past contributions on GitHub? Be sure to reclaim your Comments, Issues, and Pull Requests.

Improve menu entry title injection count logic

parent d31d1a65
......@@ -33,9 +33,14 @@ stateManager.registerInjection = function (tabIdentifier, injection) {
registeredTab.injections[injectionIdentifier] = injection;
injectionCount = Object.keys(registeredTab.injections).length || 0;
if (stateManager.showIconBadge === true) {
if (injectionCount > 0) {
chrome.browserAction.setTitle({
'tabId': tabIdentifier,
'title': `Decentraleyes (${injectionCount})`
});
if (injectionCount > 0) {
if (stateManager.showIconBadge === true) {
wrappers.setBadgeText({
'tabId': tabIdentifier,
......@@ -44,14 +49,6 @@ stateManager.registerInjection = function (tabIdentifier, injection) {
}
}
if (injectionCount > 0) {
let title = 'Decentraleyes (' + injectionCount.toString() + ')';
wrappers.setTitle({
'title': title,
'tabId': tabIdentifier
});
}
if (isNaN(interceptor.amountInjected)) {
chrome.storage.local.get(Setting.AMOUNT_INJECTED, function (items) {
......
......@@ -36,13 +36,3 @@ wrappers.setBadgeText = function (details) {
chrome.browserAction.setBadgeText(details);
}
};
// In firefox android, browser action shows as a menu entry instead of icon.
// Use the below 'setTitle' to show injected count in menu entry.
wrappers.setTitle = function (details){
if (chrome.browserAction.setTitle !== undefined) {
chrome.browserAction.setTitle(details);
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment