mirror of
https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean.git
synced 2024-11-02 15:40:13 +00:00
Show badge-notification if active on tab
Tabs-permission needed for tab-url (manifest.json).
This commit is contained in:
parent
1bdc928d8f
commit
a419439bc9
@ -455,6 +455,27 @@ browser.webRequest.onBeforeSendHeaders.addListener(function(details) {
|
||||
urls: ['<all_urls>']
|
||||
}, ['blocking', 'requestHeaders']);
|
||||
|
||||
browser.tabs.onUpdated.addListener(updateBadge);
|
||||
browser.tabs.onActivated.addListener(updateBadge);
|
||||
|
||||
function updateBadge() {
|
||||
browser.tabs.query({
|
||||
active: true,
|
||||
currentWindow: true
|
||||
}, function (arrayOfTabs) {
|
||||
var activeTab = arrayOfTabs[0];
|
||||
if (!activeTab)
|
||||
return;
|
||||
var textB = getTextB(activeTab.url);
|
||||
browser.browserAction.setBadgeBackgroundColor({color: "red"});
|
||||
browser.browserAction.setBadgeText({text: textB});
|
||||
});
|
||||
}
|
||||
|
||||
function getTextB(currentUrl) {
|
||||
return currentUrl && isSiteEnabled({url: currentUrl}) ? 'ON' : '';
|
||||
}
|
||||
|
||||
// remove cookies after page load
|
||||
browser.webRequest.onCompleted.addListener(function(details) {
|
||||
for (var domainIndex in remove_cookies) {
|
||||
|
@ -36,6 +36,7 @@
|
||||
"cookies",
|
||||
"<all_urls>",
|
||||
"storage",
|
||||
"tabs",
|
||||
"webRequest",
|
||||
"webRequestBlocking"
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user