mirror of
https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean.git
synced 2024-11-10 01:11:04 +00:00
Limit contentScript (to html, xhr & script)
Plus maintenance
This commit is contained in:
parent
312a8e39e2
commit
c15f3cd173
@ -17,7 +17,7 @@ By default BPC has limited permissions, but you can opt-in to enable custom site
|
||||
#### Android
|
||||
On Android this add-on only works with Firefox 68 (Fennec); Firefox 79+ (Fenix) only supports 9 'recommended' add-ons (for now).
|
||||
BPC add-on works fine in Firefox Nightly (or IceRaven) though (when you load BPC from a [custom add-on collection](https://blog.mozilla.org/addons/2020/09/29/expanded-extension-support-in-firefox-for-android-nightly)).
|
||||
You can either make your own custom add-on collection or use the one used by [Iceraven (Fenix fork)](https://github.com/fork-maintainers/iceraven-browser): [What I want on Fenix](https://addons.mozilla.org/en-US/firefox/collections/16201230/What-I-want-on-Fenix)
|
||||
You can either make your own custom add-on collection or take the one used by [Iceraven (Fenix fork)](https://github.com/fork-maintainers/iceraven-browser): [What I want on Fenix](https://addons.mozilla.org/en-US/firefox/collections/16201230/What-I-want-on-Fenix)
|
||||
Set custom add-ons account: 16201230 & collection: What-I-want-on-Fenix
|
||||
|
||||
#### Chrome/Chromium
|
||||
|
@ -4,6 +4,10 @@
|
||||
var ext_api = (typeof browser === 'object') ? browser : chrome;
|
||||
var ext_name = ext_api.runtime.getManifest().name;
|
||||
|
||||
const cs_limit_except = ['la-croix.com', 'lescienze.it'];
|
||||
var currentTabUrl = '';
|
||||
var csDone = false;
|
||||
|
||||
// Cookies from this list are blocked by default (obsolete)
|
||||
// defaultSites are loaded from sites.js at installation extension
|
||||
// var defaultSites = {};
|
||||
@ -13,6 +17,7 @@ const restrictions = {
|
||||
'bloombergquint.com': /^((?!\.bloombergquint\.com\/bq-blue-exclusive\/).)*$/,
|
||||
'elcomercio.pe': /.+\/elcomercio\.pe\/.+((\w)+(\-)+){3,}.+/,
|
||||
'faz.net': /^((?!\/zeitung\.faz\.net\/).)*$/,
|
||||
'ft.com': /.+\.ft.com\/content\//,
|
||||
'gestion.pe': /.+\/gestion\.pe\/.+((\w)+(\-)+){3,}.+/,
|
||||
'hs.fi': /^((?!\/.+\.hs\.fi\/paivanlehti\/).)*$/,
|
||||
'nknews.org': /^((?!\.nknews\.org\/pro\/).)*$/,
|
||||
@ -61,6 +66,7 @@ var allow_cookies_default = [
|
||||
'kurier.at',
|
||||
'la-croix.com',
|
||||
'lc.nl',
|
||||
'lejdd.fr',
|
||||
'lesechos.fr',
|
||||
'lesoir.be',
|
||||
'limesonline.com',
|
||||
@ -816,6 +822,11 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
|
||||
if (tabId !== -1) {
|
||||
ext_api.tabs.get(tabId, function (currentTab) {
|
||||
if ((currentTab && isSiteEnabled(currentTab)) || medium_custom_domain || au_apn_site || au_swm_site) {
|
||||
if (currentTab.url !== currentTabUrl) {
|
||||
csDone = false;
|
||||
currentTabUrl = currentTab.url;
|
||||
}
|
||||
if ((['main_frame', 'script', 'other', 'xmlhttprequest'].includes(details.type) || matchUrlDomain(cs_limit_except, currentTabUrl)) && !csDone) {
|
||||
ext_api.tabs.executeScript(tabId, {
|
||||
file: 'contentScript.js',
|
||||
runAt: 'document_start'
|
||||
@ -825,6 +836,7 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {//mercuriovalpo.cl
|
||||
ext_api.tabs.query({
|
||||
@ -1033,6 +1045,10 @@ ext_api.runtime.onMessage.addListener(function (message, sender) {
|
||||
ext_api.browserAction.setIcon(icon_path);
|
||||
chrome_scheme = message.scheme;
|
||||
}
|
||||
if (message.csDone) {
|
||||
csDone = true;
|
||||
//console.log('msg.csDone: ' + csDone);
|
||||
}
|
||||
});
|
||||
|
||||
// show the tab if we haven't registered the user reacting to the prompt.
|
||||
|
@ -10,6 +10,7 @@ Fix-update El Mercurio & La Segunda (mobile)
|
||||
Fix-update Mexico News Daily
|
||||
Fix-update Telegraph.co.uk (amp pages)
|
||||
Fix-update The New Yorker (embed)
|
||||
Limit contentScript (to html, xhr & script)
|
||||
Update popup (Twitter)
|
||||
|
||||
* v1.9.7.0 (2020-11-27)
|
||||
|
@ -1,6 +1,7 @@
|
||||
//"use strict";
|
||||
var ext_api = (typeof browser === 'object') ? browser : chrome;
|
||||
var domain;
|
||||
var csDone = false;
|
||||
|
||||
// clean local storage of sites (with an exemption for hold-list)
|
||||
var arr_localstorage_hold = ['elmundo.es', 'kurier.at', 'nknews.org', 'nrz.de', 'seekingalpha.com', 'sfchronicle.com', 'thehindu.com', 'thetimes.co.uk', 'waz.de', 'wp.de', 'wr.de'];
|
||||
@ -73,6 +74,8 @@ else if (window.location.hostname.endsWith(".com.au") || window.location.hostnam
|
||||
for (let subscriber_hider of subscriber_hiders) {
|
||||
subscriber_hider.classList.remove('subscriber-hider');
|
||||
}
|
||||
let story_generic_iframe = document.querySelector('.story-generic__iframe');
|
||||
removeDOMElement(story_generic_iframe);
|
||||
} else if (window.location.hostname.endsWith(".com.au")) {
|
||||
// Australia News Corp
|
||||
let au_nc_sites = ['adelaidenow.com.au', 'cairnspost.com.au', 'couriermail.com.au', 'dailytelegraph.com.au', 'geelongadvertiser.com.au', 'goldcoastbulletin.com.au', 'heraldsun.com.au', 'ntnews.com.au', 'theaustralian.com.au', 'themercury.com.au', 'townsvillebulletin.com.au', 'weeklytimesnow.com.au'];
|
||||
@ -104,7 +107,11 @@ else if (window.location.hostname.endsWith(".com.au") || window.location.hostnam
|
||||
json_pub = json_article[key].data.result.resolution.publication;
|
||||
continue;
|
||||
}
|
||||
let json_content = json_pub.content.blocks;
|
||||
let json_content
|
||||
if (json_pub)
|
||||
json_content = json_pub.content.blocks;
|
||||
else
|
||||
window.location.reload(true);
|
||||
//let json_video = json_pub.mainVideo;
|
||||
let url = window.location.href;
|
||||
let url_loaded = json_pub._self;
|
||||
@ -182,6 +189,7 @@ else if (matchDomain('rep.repubblica.it')) {
|
||||
paywall.removeAttribute('subscriptions-section');
|
||||
const preview = document.querySelector('div[subscriptions-section="content-not-granted"]');
|
||||
removeDOMElement(preview);
|
||||
csDone = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -230,6 +238,7 @@ else if (matchDomain('telegraaf.nl')) {
|
||||
});
|
||||
div_main.appendChild(div_elem);
|
||||
article_body.appendChild(div_main);
|
||||
csDone = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -258,6 +267,8 @@ else if (matchDomain("washingtonpost.com")) {
|
||||
}
|
||||
}, 300); // Delay (in milliseconds)
|
||||
}
|
||||
else if (adverts || leaderboard)
|
||||
csDone = true;
|
||||
}
|
||||
|
||||
else if (matchDomain("wsj.com") && !matchDomain("cn.wsj.com")) {
|
||||
@ -273,20 +284,16 @@ else if (matchDomain("wsj.com") && !matchDomain("cn.wsj.com")) {
|
||||
let snippet = document.querySelector('.snippet-promotion');
|
||||
let wsj_pro = document.querySelector('meta[name="page.site"][content="wsjpro"]');
|
||||
if (snippet || wsj_pro) {
|
||||
window.location.href = window.location.href.replace('wsj.com', 'wsj.com/amp').replace('#refreshed', '');
|
||||
window.location.href = window.location.href.replace('wsj.com', 'wsj.com/amp');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
else if (matchDomain("sloanreview.mit.edu")) {
|
||||
const read_more = document.querySelector('.btn-read-more');
|
||||
if (read_more)
|
||||
read_more.click();
|
||||
}
|
||||
|
||||
else if (matchDomain("mexiconewsdaily.com")) {
|
||||
window.setTimeout(function () {
|
||||
let cpro_overlay = document.querySelector('.cpro-overlay');
|
||||
removeDOMElement(cpro_overlay);
|
||||
}, 500); // Delay (in milliseconds)
|
||||
}
|
||||
|
||||
else if (matchDomain("the-american-interest.com")) {
|
||||
@ -317,6 +324,7 @@ else if (matchDomain("nzherald.co.nz")) {
|
||||
if (first_span)
|
||||
first_span.removeAttribute('class');
|
||||
removeDOMElement(article_offer);
|
||||
csDone = true;
|
||||
}
|
||||
}
|
||||
let premium_toaster = document.querySelector('#premium-toaster');
|
||||
@ -354,6 +362,8 @@ else if (matchDomain("bloomberg.com")) {
|
||||
let paywall_overlay = document.querySelector('div#graphics-paywall-overlay');
|
||||
let banner = document.getElementById('paywall-banner');
|
||||
removeDOMElement(banner, paywall_overlay);
|
||||
if (banner)
|
||||
csDone = true;
|
||||
}
|
||||
|
||||
else if (matchDomain("bloombergquint.com")) {
|
||||
@ -409,6 +419,7 @@ else if (matchDomain("nytimes.com")) {
|
||||
let preview_button = document.querySelector('.css-3s1ce0');
|
||||
if (preview_button)
|
||||
preview_button.click();
|
||||
csDone = true;
|
||||
}
|
||||
|
||||
else if (matchDomain("economist.com")) {
|
||||
@ -447,17 +458,17 @@ else if (matchDomain("the-tls.co.uk")) {
|
||||
}
|
||||
|
||||
else if (matchDomain("caixinglobal.com")) {
|
||||
window.setTimeout(function () {
|
||||
let pay_tips = document.querySelectorAll('.cons-pay-tip');
|
||||
for (let pay_tip of pay_tips) {
|
||||
for (let pay_tip of pay_tips)
|
||||
pay_tip.removeAttribute('style');
|
||||
}
|
||||
let appContent = document.getElementById('appContent');
|
||||
if (appContent) {
|
||||
let hidden_pars = document.querySelectorAll('p:not([style="display:block;"])');
|
||||
for (let hidden_par of hidden_pars) {
|
||||
for (let hidden_par of hidden_pars)
|
||||
hidden_par.setAttribute('style', 'display:block;');
|
||||
}
|
||||
}
|
||||
}, 500); // Delay (in milliseconds)
|
||||
}
|
||||
|
||||
else if (matchDomain("nrc.nl")) {
|
||||
@ -524,6 +535,7 @@ else if (matchDomain("techinasia.com")) {
|
||||
const paywall = document.querySelector('.paywall-content');
|
||||
if (paywall){
|
||||
paywall.classList.remove('paywall-content');
|
||||
csDone = true;
|
||||
}
|
||||
const splash_subscribe = document.querySelector('.splash-subscribe');
|
||||
const paywall_hard = document.querySelector('.paywall-hard');
|
||||
@ -531,6 +543,7 @@ else if (matchDomain("techinasia.com")) {
|
||||
}
|
||||
|
||||
else if (matchDomain("thestar.com")) {
|
||||
window.setTimeout(function () {
|
||||
let meter_banner = document.querySelector('.c-article-meter-banner');
|
||||
removeDOMElement(meter_banner);
|
||||
let rightrail = document.querySelector('.c-article-body__rightrail');
|
||||
@ -601,18 +614,18 @@ else if (matchDomain("thestar.com")) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
|
||||
else if (matchDomain("afr.com")) {
|
||||
let hidden_images = document.querySelectorAll('img');
|
||||
let hidden_images = document.querySelectorAll('img[src*=".gif"]');
|
||||
for (let hidden_image of hidden_images) {
|
||||
var src = hidden_image.src;
|
||||
if (src.includes(".gif")) {
|
||||
var data_src = hidden_image.getAttribute("data-src");
|
||||
if (data_src)
|
||||
hidden_image.setAttribute('src', data_src);
|
||||
}
|
||||
}
|
||||
if (hidden_images)
|
||||
csDone = true;
|
||||
let plista = document.querySelector('div[data-plista-placement="underArticle_Group"]');
|
||||
removeDOMElement(plista);
|
||||
}
|
||||
@ -621,6 +634,7 @@ else if (matchDomain("theglobeandmail.com")) {
|
||||
let article_body_subscribed = document.querySelector('.c-article-body--subscribed');
|
||||
if (article_body_subscribed) {
|
||||
article_body_subscribed.removeAttribute('class');
|
||||
csDone = true;
|
||||
}
|
||||
function tgam_main() {
|
||||
document.addEventListener('bpc_event', function (e) {
|
||||
@ -799,15 +813,17 @@ else if (matchDomain('barrons.com')) {
|
||||
}
|
||||
|
||||
else if (matchDomain('lescienze.it')) {
|
||||
const paywall = document.querySelector('.paywall-adagio');
|
||||
const body_paywall = document.getElementById('detail-body-paywall');
|
||||
const shade = document.querySelector('.shade');
|
||||
window.setTimeout(function () {
|
||||
let paywall = document.querySelector('.paywall-adagio');
|
||||
let body_paywall = document.getElementById('detail-body-paywall');
|
||||
let shade = document.querySelector('.shade');
|
||||
removeDOMElement(paywall, body_paywall, shade);
|
||||
const hidden_bodies = document.querySelectorAll('.detail_body');
|
||||
let hidden_bodies = document.querySelectorAll('.detail_body');
|
||||
for (let hidden_body of hidden_bodies) {
|
||||
hidden_body.removeAttribute('hidden');
|
||||
hidden_body.setAttribute('style', 'display:block; max-height:auto; overflow:visible');
|
||||
}
|
||||
}, 1000); // Delay (in milliseconds)
|
||||
}
|
||||
|
||||
else if (matchDomain('faz.net')) {
|
||||
@ -874,6 +890,7 @@ else if (matchDomain('faz.net')) {
|
||||
elem.innerText = p_text;
|
||||
article_text.appendChild(elem);
|
||||
});
|
||||
ext_api.runtime.sendMessage({csDone: true});
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -950,6 +967,8 @@ else if (matchDomain('historyextra.com')) {
|
||||
}
|
||||
let ad_banner = document.querySelector('.ad-banner-container');
|
||||
removeDOMElement(ad_banner);
|
||||
if (ad_banner)
|
||||
csDone = true;
|
||||
}
|
||||
|
||||
else if (matchDomain('republic.ru')) {
|
||||
@ -984,7 +1003,7 @@ else if (matchDomain('inkl.com')) {
|
||||
removeDOMElement(shared_banner);
|
||||
let dive_deeper_summary_bodies = document.querySelectorAll('div.dive-deeper-container div.summary-body');
|
||||
if (dive_deeper_summary_bodies) {
|
||||
for (summary_body of dive_deeper_summary_bodies) {
|
||||
for (let summary_body of dive_deeper_summary_bodies) {
|
||||
if (!summary_body.querySelector('a')) {
|
||||
var ng_click = summary_body.getAttribute('ng-click').replace("showArticle('", '').replace("')", '');
|
||||
var weblink = document.createElement('a');
|
||||
@ -1407,7 +1426,8 @@ else if (matchDomain("elpais.com")) {
|
||||
|
||||
else if (matchDomain("slate.com")) {
|
||||
let slate_roadblock = document.querySelector('.slate-roadblock');
|
||||
removeDOMElement(slate_roadblock);
|
||||
let ads = document.querySelectorAll('section[class*="-ad"]');
|
||||
removeDOMElement(slate_roadblock, ...ads);
|
||||
}
|
||||
|
||||
else if (matchDomain(["ilrestodelcarlino.it", "quotidiano.net"])) {
|
||||
@ -1509,7 +1529,8 @@ else if (matchDomain("gva.be")) {
|
||||
bullet_link.innerText = bullet_link.href;
|
||||
par_elem.appendChild(par_li);
|
||||
}
|
||||
} else if (key === 'streamone') {
|
||||
}
|
||||
else if (key === 'streamone') {
|
||||
if (!streamone) {
|
||||
let streamone_script = document.createElement('script');
|
||||
streamone_script.setAttribute('src', "https://shared.mediahuis.be/videoplayers/mediahuis/video-theoplayer.js?v=20201111T131002");
|
||||
@ -1581,6 +1602,7 @@ else if (matchDomain("hs.fi")) {
|
||||
window.location.href = iframe.src;
|
||||
}, 500); // Delay (in milliseconds)
|
||||
}
|
||||
csDone = true;
|
||||
} else {
|
||||
let paywall = document.querySelector('.paywall-container');
|
||||
if (paywall) {
|
||||
@ -1653,6 +1675,7 @@ else if (matchDomain("hs.fi")) {
|
||||
main.appendChild(document.createElement('br'));
|
||||
}
|
||||
removeDOMElement(paywall);
|
||||
csDone = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1716,6 +1739,7 @@ else if (matchDomain("elperiodico.com")) {
|
||||
let subscr_section = document.querySelector('div[amp-access="logged"]');
|
||||
if (subscr_section)
|
||||
subscr_section.removeAttribute('amp-access-hide');
|
||||
csDone = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1725,6 +1749,8 @@ else if (matchDomain('la-croix.com')) {
|
||||
if (!url.includes('la-croix.com/amp/')) {
|
||||
let paywall_host_param = document.querySelector('#paywall-host-param');
|
||||
removeDOMElement(paywall_host_param);
|
||||
if (paywall_host_param)
|
||||
csDone = true;
|
||||
} else {
|
||||
let paywall_block = document.querySelector('#paywall_block');
|
||||
removeDOMElement(paywall_block);
|
||||
@ -1761,6 +1787,12 @@ else if (matchDomain('esprit.presse.fr')) {
|
||||
removeDOMElement(paywall);
|
||||
}
|
||||
|
||||
else
|
||||
csDone = true;
|
||||
|
||||
if (csDone)
|
||||
ext_api.runtime.sendMessage({csDone: true});
|
||||
|
||||
// General Functions
|
||||
function removeDOMElement(...elements) {
|
||||
for (let element of elements) {
|
||||
|
Loading…
Reference in New Issue
Block a user