mirror of
https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean.git
synced 2024-11-10 03:41:57 +01:00
Fix The Atlantic (js)
This commit is contained in:
parent
2e3b9c5e46
commit
285c392e2e
8 changed files with 37 additions and 30 deletions
|
@ -793,11 +793,10 @@ if (typeof browser !== 'object') {
|
|||
}
|
||||
}
|
||||
|
||||
if (!kiwi_browser) {
|
||||
ext_api.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
|
||||
let tab_status = changeInfo.status;
|
||||
if ((tab_status && tab_status === 'complete') || (!tab_status && changeInfo.url)) {
|
||||
if (/^http/.test(tab.url) && matchUrlDomain(enabledSites, tab.url)) {
|
||||
if (/^http/.test(tab.url) && ((tab_status && tab_status === 'complete') || (!tab_status && changeInfo.url))) {
|
||||
if (matchUrlDomain(enabledSites, tab.url)) {
|
||||
runOnTab(tab);
|
||||
}
|
||||
// load toggleIcon.js (icon for dark or incognito mode in Chrome))
|
||||
|
@ -813,7 +812,6 @@ ext_api.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
|
|||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setInterval(function () {
|
||||
let current_date_str = currentDateStr();
|
||||
|
@ -1187,7 +1185,7 @@ if (matchUrlDomain(change_headers, details.url) && !ignore_types.includes(detail
|
|||
active: true,
|
||||
currentWindow: true
|
||||
}, function (tabs) {
|
||||
if (tabs && tabs[0] && tabs[0].url && tabs[0].url.startsWith('http')) {
|
||||
if (tabs && tabs[0] && /^http/.test(tabs[0].url)) {
|
||||
let tab = tabs[0];
|
||||
if (isSiteEnabled(tab)) {
|
||||
runOnTab(tab);
|
||||
|
@ -1298,7 +1296,7 @@ function site_switch() {
|
|||
active: true,
|
||||
currentWindow: true
|
||||
}, function (tabs) {
|
||||
if (tabs && tabs[0] && tabs[0].url && tabs[0].url.startsWith('http')) {
|
||||
if (tabs && tabs[0] && /^http/.test(tabs[0].url)) {
|
||||
let currentUrl = tabs[0].url;
|
||||
let isDefaultSite = matchUrlDomain(defaultSites_grouped_domains, currentUrl);
|
||||
if (!isDefaultSite) {
|
||||
|
@ -1351,7 +1349,7 @@ function remove_cookies_fn(domainVar, exclusions = false) {
|
|||
active: true,
|
||||
currentWindow: true
|
||||
}, function (tabs) {
|
||||
if (!ext_api.runtime.lastError && tabs && tabs[0] && tabs[0].url && tabs[0].url.startsWith('http')) {
|
||||
if (!ext_api.runtime.lastError && tabs && tabs[0] && /^http/.test(tabs[0].url)) {
|
||||
let tabId = tabs[0].id;
|
||||
let storeId = '0';
|
||||
for (let store of cookieStores) {
|
||||
|
@ -1404,7 +1402,7 @@ function clear_cookies() {
|
|||
active: true,
|
||||
currentWindow: true
|
||||
}, function (tabs) {
|
||||
if (tabs && tabs[0] && tabs[0].url && tabs[0].url.startsWith('http')) {
|
||||
if (tabs && tabs[0] && /^http/.test(tabs[0].url)) {
|
||||
ext_api.tabs.executeScript({
|
||||
file: 'options/clearCookies.js',
|
||||
runAt: 'document_start'
|
||||
|
@ -1426,8 +1424,8 @@ ext_api.runtime.onMessage.addListener(function (message, sender) {
|
|||
clear_cookies();
|
||||
}
|
||||
// clear cookies for domain
|
||||
if (message.domain) {
|
||||
remove_cookies_fn(message.domain);
|
||||
if (message.request === 'clear_cookies_domain' && message.data) {
|
||||
remove_cookies_fn(message.data.domain);
|
||||
}
|
||||
if (message.request === 'site_switch') {
|
||||
site_switch();
|
||||
|
@ -1440,23 +1438,23 @@ ext_api.runtime.onMessage.addListener(function (message, sender) {
|
|||
active: true,
|
||||
currentWindow: true
|
||||
}, function (tabs) {
|
||||
if (tabs && tabs[0] && tabs[0].url && tabs[0].url.startsWith('http')) {
|
||||
if (tabs && tabs[0] && /^http/.test(tabs[0].url)) {
|
||||
let currentUrl = tabs[0].url;
|
||||
let domain;
|
||||
let isExcludedSite = matchUrlDomain(excludedSites, currentUrl);
|
||||
if (!isExcludedSite) {
|
||||
let isDefaultSiteGrouped = matchUrlDomain(defaultSites_domains, currentUrl);
|
||||
let isDefaultSite = matchUrlDomain(defaultSites_domains, currentUrl);
|
||||
let isCustomSite = matchUrlDomain(Object.values(customSites_domains), currentUrl);
|
||||
domain = isDefaultSiteGrouped || (!isDefaultSite && isCustomSite);
|
||||
domain = isDefaultSite || isCustomSite;
|
||||
if (domain)
|
||||
ext_api.runtime.sendMessage({
|
||||
msg: "popup_show_toggle",
|
||||
data: {
|
||||
domain: domain,
|
||||
enabled: enabledSites.includes(domain)
|
||||
}
|
||||
});
|
||||
}
|
||||
ext_api.runtime.sendMessage({
|
||||
msg: "popup_show_toggle",
|
||||
data: {
|
||||
domain: domain,
|
||||
enabled: enabledSites.includes(domain)
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1484,7 +1482,7 @@ ext_api.runtime.onMessage.addListener(function (message, sender) {
|
|||
active: true,
|
||||
currentWindow: true
|
||||
}, function (tabs) {
|
||||
if (tabs && tabs[0] && tabs[0].url && tabs[0].url.startsWith('http')) {
|
||||
if (tabs && tabs[0] && /^http/.test(tabs[0].url)) {
|
||||
ext_api.tabs.sendMessage(sender.tab.id, {msg: "showExtSrc", data: message.data});
|
||||
}
|
||||
});
|
||||
|
@ -1496,7 +1494,7 @@ ext_api.runtime.onMessage.addListener(function (message, sender) {
|
|||
active: true,
|
||||
currentWindow: true
|
||||
}, function (tabs) {
|
||||
if (tabs && tabs[0] && tabs[0].url && tabs[0].url.startsWith('http')) {
|
||||
if (tabs && tabs[0] && /^http/.test(tabs[0].url)) {
|
||||
ext_api.tabs.sendMessage(sender.tab.id, {msg: "showExtSrc", data: message.data});
|
||||
}
|
||||
});
|
||||
|
@ -1576,7 +1574,7 @@ function matchDomain(domains, hostname = '') {
|
|||
}
|
||||
|
||||
function urlHost(url) {
|
||||
if (url && url.startsWith('http')) {
|
||||
if (/^http/.test(url)) {
|
||||
try {
|
||||
return new URL(url).hostname;
|
||||
} catch (e) {
|
||||
|
@ -1628,7 +1626,7 @@ function refreshCurrentTab() {
|
|||
active: true,
|
||||
currentWindow: true
|
||||
}, function (tabs) {
|
||||
if (tabs && tabs[0] && tabs[0].url && tabs[0].url.startsWith('http')) {
|
||||
if (tabs && tabs[0] && /^http/.test(tabs[0].url)) {
|
||||
if (ext_api.runtime.lastError)
|
||||
return;
|
||||
ext_api.tabs.update(tabs[0].id, {
|
||||
|
|
|
@ -10,6 +10,7 @@ Remove Philonomist (fix obsolete)
|
|||
Fix Australian Community Media (identify on url)
|
||||
Fix Groupe Centre France (text)
|
||||
Fix Quotidiano.net (no amp)
|
||||
Fix The Atlantic (js)
|
||||
Fix The Chronicle of Higher Education (css)
|
||||
|
||||
* v2.9.5.0 (2022-11-27)
|
||||
|
|
|
@ -3899,8 +3899,8 @@ else if (matchDomain('theathletic.com')) {
|
|||
}
|
||||
|
||||
else if (matchDomain('theatlantic.com')) {
|
||||
let banner = document.querySelector('.c-nudge__container,.c-non-metered-nudge');
|
||||
removeDOMElement(banner);
|
||||
let banners = document.querySelectorAll('.c-nudge__container, .c-non-metered-nudge, div[class^="ArticleInjector_"]');
|
||||
removeDOMElement(...banners);
|
||||
}
|
||||
|
||||
else if (matchDomain('thedailybeast.com')) {
|
||||
|
|
|
@ -732,5 +732,5 @@
|
|||
"*://gcm.omerlocdn.com/*",
|
||||
"*://webcache.googleusercontent.com/*"
|
||||
],
|
||||
"version": "2.9.5.6"
|
||||
"version": "2.9.5.7"
|
||||
}
|
||||
|
|
|
@ -7,7 +7,10 @@ var cookie_domain = getCookieDomain(document.domain);
|
|||
|
||||
// send domain to background.js (to clear cookies)
|
||||
ext_api.runtime.sendMessage({
|
||||
request: 'clear_cookies_domain',
|
||||
data: {
|
||||
domain: cookie_domain
|
||||
}
|
||||
});
|
||||
|
||||
function getCookieDomain(hostname) {
|
||||
|
|
|
@ -13,7 +13,7 @@ function popup_show_toggle(domain, enabled) {
|
|||
labelEl.appendChild(inputEl);
|
||||
let spanEl = document.createElement('span');
|
||||
spanEl.setAttribute('class', 'slider round');
|
||||
spanEl.setAttribute('title', 'en/disable current site in BPC');
|
||||
spanEl.setAttribute('title', 'en/disable current site/group in BPC');
|
||||
labelEl.appendChild(spanEl);
|
||||
site_switch_span.appendChild(labelEl);
|
||||
document.getElementById("site_switch").addEventListener('click', function () {
|
||||
|
|
4
sites.js
4
sites.js
|
@ -1767,7 +1767,7 @@ var defaultSites = {
|
|||
},
|
||||
"The Atlantic": {
|
||||
domain: "theatlantic.com",
|
||||
block_regex: /cdn\.ampproject\.org\/v\d\/amp-(access|subscriptions)-.+\.js/,
|
||||
block_regex: /cdn\.theatlantic\.com\/_next\/static\/chunks\/[567].+\.js/,
|
||||
remove_cookies_select_drop: ["articleViews"]
|
||||
},
|
||||
"The Australian Financial Review": {
|
||||
|
@ -2398,4 +2398,4 @@ init_custom_domains();
|
|||
// sites with no fix (background)
|
||||
var be_mediahuis_nofix_domains = ['gva.be', 'hbvl.be'];
|
||||
var it_gedi_nofix_domains = ['gelocal.it', 'huffingtonpost.it', 'ilsecoloxix.it', 'lastampa.it', 'limesonline.com'];
|
||||
var nofix_sites = ['africaintelligence.com', 'africaintelligence.fr', 'aftenposten.no', 'badische-zeitung.de', 'bild.de', 'borsen.dk', 'businesstimes.com.sg', 'caixin.com', 'caixinglobal.com', 'caravanmagazine.in', 'courrierinternational.com', 'dn.se', 'elordenmundial.com', 'epw.in', 'expresso.pt', 'ftchinese.com', 'handelsblatt.com', 'hs.fi', 'ilsole24ore.com', 'jacobinmag.com', 'jeuneafrique.com', 'kurier.at', 'lavie.fr', 'lavozdegalicia.es', 'leconomiste.com', 'lefigaro.fr', 'lemonde.fr', 'lepoint.fr', 'letemps.ch', 'liberation.fr', 'medianama.com', 'mediapart.fr', 'milanofinanza.it', 'mondediplo.com', 'moneycontrol.com', 'nature.com', 'nbr.co.nz', 'nn.de', 'ouest-france.fr', 'philonomist.com', 'politiken.dk', 'pressreader.com', 'publico.pt', 'republic.ru', 'saechsische.de', 'schwarzwaelder-bote.de', 'statnews.com', 'stern.de', 'straitstimes.com', 'stuttgarter-nachrichten.de', 'stuttgarter-zeitung.de', 'suedkurier.de', 'swp.de', 'tagesanzeiger.ch', 'the-ken.com', 'theinformation.com', 'themorningcontext.com', 'theparisreview.org', 'thewirechina.com', 'weser-kurier.de', 'worldpoliticsreview.com', 'ynet.co.il', 'zerohedge.com'].concat(be_mediahuis_nofix_domains, it_gedi_nofix_domains);
|
||||
var nofix_sites = ['africaintelligence.com', 'africaintelligence.fr', 'aftenposten.no', 'badische-zeitung.de', 'bild.de', 'borsen.dk', 'businesstimes.com.sg', 'caixin.com', 'caixinglobal.com', 'caravanmagazine.in', 'courrierinternational.com', 'dn.se', 'elordenmundial.com', 'epw.in', 'expresso.pt', 'ftchinese.com', 'handelsblatt.com', 'heise.de', 'hs.fi', 'ilsole24ore.com', 'jacobinmag.com', 'jeuneafrique.com', 'kurier.at', 'lavie.fr', 'lavozdegalicia.es', 'leconomiste.com', 'lefigaro.fr', 'lemonde.fr', 'lepoint.fr', 'letemps.ch', 'liberation.fr', 'medianama.com', 'mediapart.fr', 'milanofinanza.it', 'mondediplo.com', 'moneycontrol.com', 'nature.com', 'nbr.co.nz', 'nn.de', 'ouest-france.fr', 'philonomist.com', 'politiken.dk', 'pressreader.com', 'publico.pt', 'republic.ru', 'saechsische.de', 'schwarzwaelder-bote.de', 'statnews.com', 'stern.de', 'straitstimes.com', 'stuttgarter-nachrichten.de', 'stuttgarter-zeitung.de', 'suedkurier.de', 'swp.de', 'tagesanzeiger.ch', 'techcrunch.com', 'the-ken.com', 'theinformation.com', 'themorningcontext.com', 'theparisreview.org', 'thewirechina.com', 'weser-kurier.de', 'worldpoliticsreview.com', 'ynet.co.il', 'zerohedge.com'].concat(be_mediahuis_nofix_domains, it_gedi_nofix_domains);
|
||||
|
|
|
@ -13,6 +13,11 @@
|
|||
"allow_cookies": 1,
|
||||
"block_regex": "(\\.evolok\\.net\\/|\\.lavanguardia\\.com\\/js\\/godo-basex-)"
|
||||
},
|
||||
"The Atlantic": {
|
||||
"domain": "theatlantic.com",
|
||||
"block_regex": "cdn\\.theatlantic\\.com\\/_next\\/static\\/chunks\\/[567].+\\.js",
|
||||
"remove_cookies_select_drop": ["articleViews"]
|
||||
},
|
||||
"The Spectator (UK)": {
|
||||
"domain": "spectator.co.uk",
|
||||
"useragent": "googlebot"
|
||||
|
|
Loading…
Reference in a new issue