From eb6a27f13126f83bf86bedd69c7b758eb7d3179f Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Sun, 10 Jan 2021 20:21:18 +0100 Subject: [PATCH] Fix-update SeekingAlpha (amp) --- README.md | 7 ++++--- background.js | 4 ++-- changelog.txt | 1 + contentScript.js | 5 ++++- manifest.json | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 94cbfc0..33c8066 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ On Android this add-on only works with Firefox 68 (Fennec); Firefox 79+ (Fenix) 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)).\ For Firefox Nightly you have to make your own custom add-on collection (or use another that contains BPC). \ [Iceraven (Fenix fork)](https://github.com/fork-maintainers/iceraven-browser) uses: [What I want on Fenix](https://addons.mozilla.org/en-US/firefox/collections/16201230/What-I-want-on-Fenix)\ -It has custom add-ons account: 16201230 & collection: What-I-want-on-Fenix, but somehow it's not working in Firefox Nightly. +It has a custom add-ons account: 16201230 & collection: What-I-want-on-Fenix, but somehow it's not working in Firefox Nightly. #### Chrome/Chromium Visit the [Chrome repository](https://gitlab.com/magnolia1234/bypass-paywalls-chrome-clean) of Bypass Paywall Clean. @@ -479,10 +479,11 @@ Remember to check the [previous requests](https://gitlab.com/magnolia1234/bypass ### Add custom site Add your own custom site (also for testing). Check 'Options'-link in popup-menu and go to custom sites. -* by default BPC has limited permissions, but you can opt-in to enable custom sites (and also clear cookies for non-listed sites). +\* by default BPC has limited permissions, but you can opt-in to enable custom sites (and also clear cookies for non-listed sites). Make sure the (new) site is checked under Options (or check on/off-button). By default sites' cookies/local storage are removed after page loads (to bypass article limit). -Also you can enable Googlebot user-agent or disable Javascript for (sub)domain(s)/external sources. +Also you can enable Googlebot user-agent or disable Javascript for (sub)domain(s)/external sources.\ +PS enabling custom sites (optional permissions) isn't working on Android (Firefox Nightly or IceRaven). ### Add excluded site Add excluded sites/domains (for your subscriptions).\ diff --git a/background.js b/background.js index 7c353d7..49a92b2 100644 --- a/background.js +++ b/background.js @@ -23,7 +23,7 @@ const restrictions = { 'hs.fi': /^((?!\/.+\.hs\.fi\/paivanlehti\/).)*$/, 'globo.com': /^((?!\/valor\.globo\.com\/).)*$/, 'quora.com': /^((?!quora\.com\/search\?q=).)*$/, - 'seekingalpha.com': /.+\/seekingalpha\.com\/($|(amp\/)?article\/|samw\/)/, + 'seekingalpha.com': /.+\/seekingalpha\.com\/($|(amp\/)?(article|news)\/|samw\/)/, 'techinasia.com': /.+\.techinasia\.com\/.+((\w)+(\-)+){3,}.+/, 'wsj.com': /^((?!\/cn\.wsj\.com\/).)*$/ } @@ -779,7 +779,7 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) { let uk_nlr_site = (matchUrlDomain('stripe.com', details.url) && matchUrlDomain('newleftreview.org', header_referer) && isSiteEnabled({url: header_referer})); let bpc_amp_site = (matchUrlDomain('cdn.ampproject.org', details.url) && isSiteEnabled({url: header_referer}) && - matchUrlDomain(['barrons.com', 'belfasttelegraph.co.uk', 'elmundo.es', 'elperiodico.com', 'expansion.com', 'freiepresse.de', 'fresnobee.com', 'gelocal.it', 'independent.ie', 'irishtimes.com', 'la-croix.com', 'nationalreview.com', 'sacbee.com', 'seekingalpha', 'sueddeutsche.de', 'telegraph.co.uk'].concat(au_nine_domains, es_grupo_vocento_domains, fr_groupe_ebra_domains, fr_groupe_la_depeche_domains), header_referer)); + matchUrlDomain(['barrons.com', 'belfasttelegraph.co.uk', 'elmundo.es', 'elperiodico.com', 'expansion.com', 'freiepresse.de', 'fresnobee.com', 'gelocal.it', 'independent.ie', 'irishtimes.com', 'la-croix.com', 'nationalreview.com', 'sacbee.com', 'seekingalpha.com', 'sueddeutsche.de', 'telegraph.co.uk'].concat(au_nine_domains, es_grupo_vocento_domains, fr_groupe_ebra_domains, fr_groupe_la_depeche_domains), header_referer)); if (!isSiteEnabled(details) && !inkl_site && !au_nc_amp_site && !au_apn_site && !au_swm_site && !uk_nlr_site && !bpc_amp_site) { return; diff --git a/changelog.txt b/changelog.txt index 126bb65..76bb773 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,6 +5,7 @@ Post-release Add Curbed (New York Magazine) Add group TorStar (Canada) Add New Left Review (United Kingdom) +Fix-update SeekingAlpha (amp) Fix-update Toronto Star (overlay) Update options (excluded sites) diff --git a/contentScript.js b/contentScript.js index 6a44159..55b762a 100644 --- a/contentScript.js +++ b/contentScript.js @@ -1883,9 +1883,12 @@ else if (matchDomain('seekingalpha.com')) { window.location.href = url.replace('seekingalpha.com/', 'seekingalpha.com/amp/'); }, 500); // Delay (in milliseconds) } else if (url.includes('/amp/')) { - let div_hidden_all = document.querySelectorAll('div[amp-access="premium OR proplus"]'); + let div_hidden_all = document.querySelectorAll('[amp-access*="premium_access OR"]'); for (let div_hidden of div_hidden_all) div_hidden.removeAttribute('amp-access-hide'); + let paywall = document.querySelector('[class*="paywall-container"]'); + if (paywall) + paywall.setAttribute('style', 'display:none;'); let adverts = document.querySelectorAll('.ad-wrap'); removeDOMElement(...adverts); } diff --git a/manifest.json b/manifest.json index e2e2d2c..656d9ee 100644 --- a/manifest.json +++ b/manifest.json @@ -423,5 +423,5 @@ "*://*.stripe.com/*", "*://*.userzoom.com/*" ], - "version": "2.0.2.5" + "version": "2.0.2.6" } \ No newline at end of file