mirror of
https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean.git
synced 2024-11-10 05:57:48 +01:00
Fix updateBadge (custom sites disabled)
This commit is contained in:
parent
fdf269880c
commit
b5f813b0ca
3 changed files with 26 additions and 4 deletions
|
@ -731,7 +731,7 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
|
||||||
currentWindow: true
|
currentWindow: true
|
||||||
}, function (tabs) {
|
}, function (tabs) {
|
||||||
if (tabs.length > 0 && tabs[0].url && tabs[0].url.indexOf("http") !== -1) {
|
if (tabs.length > 0 && tabs[0].url && tabs[0].url.indexOf("http") !== -1) {
|
||||||
if (isSiteEnabled({url: tabs[0].url}) || medium_custom_domain) {
|
if (isSiteEnabled({url: tabs[0].url})) {
|
||||||
ext_api.tabs.executeScript({
|
ext_api.tabs.executeScript({
|
||||||
file: 'contentScript.js',
|
file: 'contentScript.js',
|
||||||
runAt: 'document_start'
|
runAt: 'document_start'
|
||||||
|
@ -761,6 +761,7 @@ function updateBadge (activeTab) {
|
||||||
let currentUrl = activeTab.url;
|
let currentUrl = activeTab.url;
|
||||||
if (currentUrl) {
|
if (currentUrl) {
|
||||||
let isDefaultSite = matchUrlDomain(defaultSites_domains, currentUrl);
|
let isDefaultSite = matchUrlDomain(defaultSites_domains, currentUrl);
|
||||||
|
let isCustomSite = matchUrlDomain(customSites_domains, currentUrl);
|
||||||
if (isSiteEnabled({url: currentUrl})) {
|
if (isSiteEnabled({url: currentUrl})) {
|
||||||
badgeText = 'ON';
|
badgeText = 'ON';
|
||||||
color = 'red';
|
color = 'red';
|
||||||
|
@ -771,11 +772,28 @@ function updateBadge (activeTab) {
|
||||||
badgeText = 'OFF';
|
badgeText = 'OFF';
|
||||||
color = 'blue';
|
color = 'blue';
|
||||||
}
|
}
|
||||||
|
if (!isDefaultSite) {
|
||||||
|
if (isCustomSite) {
|
||||||
|
ext_api.permissions.contains({
|
||||||
|
origins: ["<all_urls>"]
|
||||||
|
}, function (result) {
|
||||||
|
if (!result)
|
||||||
|
badgeText = '';
|
||||||
|
if (color && badgeText)
|
||||||
|
ext_api.browserAction.setBadgeBackgroundColor({color: color});
|
||||||
|
ext_api.browserAction.setBadgeText({text: badgeText});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
ext_api.browserAction.setBadgeText({text: ''});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ext_api.browserAction.setBadgeBackgroundColor({color: color});
|
||||||
|
ext_api.browserAction.setBadgeText({text: badgeText});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ext_api.browserAction.setBadgeBackgroundColor({color: color});
|
|
||||||
ext_api.browserAction.setBadgeText({text: badgeText});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function site_switch() {
|
function site_switch() {
|
||||||
ext_api.tabs.query({
|
ext_api.tabs.query({
|
||||||
active: true,
|
active: true,
|
||||||
|
|
|
@ -6,6 +6,7 @@ Add Deutsche Wirtschafts Nachrichten
|
||||||
Add WirtschaftsWoche (Germany)
|
Add WirtschaftsWoche (Germany)
|
||||||
Fix-update Quartz (newsletter)
|
Fix-update Quartz (newsletter)
|
||||||
Fix-update Sueddeutsche Zeitung (+ magazine)
|
Fix-update Sueddeutsche Zeitung (+ magazine)
|
||||||
|
Fix updateBadge (custom sites disabled)
|
||||||
Icon for dark/incognito mode (Chrome)
|
Icon for dark/incognito mode (Chrome)
|
||||||
Save options to storage.local (quota exceeded)
|
Save options to storage.local (quota exceeded)
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,10 @@ fetch(manifest_new)
|
||||||
versionString_new.appendChild(document.createTextNode(' * '));
|
versionString_new.appendChild(document.createTextNode(' * '));
|
||||||
var anchorEl = document.createElement('a');
|
var anchorEl = document.createElement('a');
|
||||||
anchorEl.text = 'New release v' + version_new;
|
anchorEl.text = 'New release v' + version_new;
|
||||||
anchorEl.href = 'https://bitbucket.org/magnolia1234/bypass-paywalls-firefox-clean/downloads';
|
if (manifestData.applications.gecko.id.includes('magnolia'))
|
||||||
|
anchorEl.href = 'https://bitbucket.org/magnolia1234/bypass-paywalls-firefox-clean/downloads';
|
||||||
|
else
|
||||||
|
anchorEl.href = 'https://addons.mozilla.org/en-US/firefox/addon/bypass-paywalls-clean';
|
||||||
anchorEl.target = '_blank';
|
anchorEl.target = '_blank';
|
||||||
versionString_new.appendChild(anchorEl);
|
versionString_new.appendChild(anchorEl);
|
||||||
if (manifestData.name.includes('(lp')) {
|
if (manifestData.name.includes('(lp')) {
|
||||||
|
|
Loading…
Reference in a new issue