Fix-update Australia News Corp (amp)

This commit is contained in:
magnolia1234 2020-10-18 14:49:15 +02:00
parent a3931bac5f
commit 18699d1cc5
4 changed files with 90 additions and 78 deletions

View File

@ -18,11 +18,11 @@ In extension developer mode you can always install BPC by `Load unpacked` (no au
1. Download this repository as a [ZIP-file from BitBucket](https://bitbucket.org/magnolia1234/bypass-paywalls-chrome-clean/get/master.zip).
2. Unzip the file and you should have a folder named `magnolia1234-bypass-paywalls-chrome-clean-(commit-hash)`.
3. Move the folder to a permanent location on your computer (do not delete the folder after installation).
* by default BPC has limited permissions, but you can opt-in to enable custom sites (and also clear cookies for non-listed sites).
4. Go to the extensions page (`chrome://extensions` or `edge://extensions`).
5. Enable Developer Mode.
6. Click `Load unpacked` and select the extension folder.
* by default BPC has limited permissions, but you can opt-in to enable custom sites (and also clear cookies/block general paywall-scripts for non-listed sites).
* in Chrome/Opera/Brave disable the developer mode extensions popup by enabling the extensions toolbar menu under (experimental) chrome flags: chrome://flags/#extensions-toolbar-menu
If you're familiar with Git(Hub)-clients you can also clone this repo and update the extension that way (load unpacked folder used by Git(Hub)-client).
@ -34,6 +34,7 @@ If you're familiar with Git(Hub)-clients you can also clone this repo and update
4. Drag your crx-file anywhere on the page to import it.
5. If dragging crx-file does not work, try Chrome procedure (above).
* by default BPC has limited permissions, but you can opt-in to enable custom sites (and also clear cookies/block general paywall-scripts for non-listed sites).
* In Windows 'whitelist' BPC (run as administrator one of the reg-files in [whitelist-downloads](https://bitbucket.org/magnolia1234/bypass-paywalls-chrome-clean-whitelist/downloads)
If you already have 'whitelisted' extensions than you should change "1" to a new key (also change name of HLM-key for beta/developer versions of browsers).
Example Chrome-regfile:
@ -386,7 +387,7 @@ Remember to check the [previous requests](https://bitbucket.org/magnolia1234/byp
### 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/block general paywall-scripts for non-listed sites).
Make sure the (new) site is checked under Options (or check on/off-buton).
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.

View File

@ -322,6 +322,7 @@ ext_api.storage.sync.get({
for (let domain of au_news_corp_domains) {
allow_cookies.push(domain);
use_google_bot.push(domain);
blockedRegexes[domain] = /cdn\.ampproject\.org\/v\d\/amp-access-.+\.js/;
}
} else
disabledSites = disabledSites.concat(au_news_corp_domains);
@ -573,9 +574,10 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
let inkl_site = (matchUrlDomain('cdn.jsdelivr.net', details.url) && matchUrlDomain('inkl.com', header_referer) && isSiteEnabled({url: header_referer}));
let bloomberg_site = (matchUrlDomain('assets.bwbx.io', details.url) && matchUrlDomain('bloomberg.com', header_referer) && isSiteEnabled({url: header_referer}));
let au_nc_amp_site = (matchUrlDomain('cdn.ampproject.org', details.url) && matchUrlDomain(au_news_corp_domains, header_referer) && isSiteEnabled({url: header_referer}));
let au_apn_site = (header_referer && (urlHost(header_referer).endsWith('com.au') || urlHost(header_referer).endsWith('net.au')) && details.url.includes('https://media.apnarm.net.au/'));
let au_swm_site = (header_referer && urlHost(header_referer).endsWith('com.au') && details.url.includes('https://s.thewest.com.au/'));
if (!isSiteEnabled(details) && !(inkl_site) && !(bloomberg_site) && !(au_apn_site) && !(au_swm_site)) {
if (!isSiteEnabled(details) && !(inkl_site) && !(bloomberg_site) && !(au_nc_amp_site) && !(au_apn_site) && !(au_swm_site)) {
return;
}

View File

@ -5,6 +5,7 @@ Post-release
Add NYmag-sites Grub Street, The Cut & Vulture
Add Quotidiano.net (Italy)
Add The West Australian (+ regional)
Fix-update Australia News Corp (amp)
Fix-update Inkl (disable newsletter login)
Fix-update Toronto Star (external cookie-script)
Update opt-in tab (default settings)

View File

@ -65,9 +65,9 @@ else if (domain = matchDomain(["brisbanetimes.com.au", "smh.com.au", "theage.com
else if (window.location.hostname.endsWith(".com.au") || window.location.hostname.endsWith(".net.au")) {
// Australian Community Media newspapers
let au_sites = ['bendigoadvertiser.com.au', 'bordermail.com.au', 'canberratimes.com.au', 'centralwesterndaily.com.au', 'dailyadvertiser.com.au', 'dailyliberal.com.au', 'examiner.com.au', 'illawarramercury.com.au', 'newcastleherald.com.au', 'northerndailyleader.com.au', 'portnews.com.au', 'standard.net.au', 'theadvocate.com.au', 'thecourier.com.au', 'westernadvocate.com.au'];
let au_cm_sites = ['bendigoadvertiser.com.au', 'bordermail.com.au', 'canberratimes.com.au', 'centralwesterndaily.com.au', 'dailyadvertiser.com.au', 'dailyliberal.com.au', 'examiner.com.au', 'illawarramercury.com.au', 'newcastleherald.com.au', 'northerndailyleader.com.au', 'portnews.com.au', 'standard.net.au', 'theadvocate.com.au', 'thecourier.com.au', 'westernadvocate.com.au'];
let au_piano_script = document.querySelector('script[src="https://cdn-au.piano.io/api/tinypass.min.js"]');
if (matchDomain(au_sites) || au_piano_script) {
if (matchDomain(au_cm_sites) || au_piano_script) {
const subscribe_truncate = document.querySelector('.subscribe-truncate');
if (subscribe_truncate)
subscribe_truncate.classList.remove('subscribe-truncate');
@ -76,6 +76,13 @@ else if (window.location.hostname.endsWith(".com.au") || window.location.hostnam
subscriber_hider.classList.remove('subscriber-hider');
}
} 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'];
if (matchDomain(au_nc_sites) && window.location.hostname.startsWith('amp.')) {
let div_hidden_all = document.querySelectorAll('div[amp-access="access AND subscriber"]');
for (let div_hidden of div_hidden_all)
div_hidden.removeAttribute('amp-access-hide');
} else {
// Australian Seven West Media
let swm_script = document.querySelector('script[src^="https://s.thewest.com.au"]');
if (matchDomain("thewest.com.au") || swm_script) {
@ -158,6 +165,7 @@ else if (window.location.hostname.endsWith(".com.au") || window.location.hostnam
}
}
}
}
else if (matchDomain('rep.repubblica.it')) {
window.setTimeout(function () {