Fix-update MarketWatch (premium)

This commit is contained in:
magnolia1234 2021-01-24 10:25:55 +01:00
parent c50eedb4f5
commit fb7d2068d0
6 changed files with 33 additions and 9 deletions

View file

@ -33,6 +33,8 @@ Visit the [Chrome repository](https://gitlab.com/magnolia1234/bypass-paywalls-ch
### List of supported websites
_* free articles only._
##### World news
[First Things](https://www.firstthings.com) -
[Foreign Affairs](https://www.foreignaffairs.com) -
@ -64,7 +66,7 @@ Visit the [Chrome repository](https://gitlab.com/magnolia1234/bypass-paywalls-ch
[Fortune](https://fortune.com) -
[Harvard Business Review](https://www.hbr.org) -
[Inc.com](https://www.inc.com) -
[MarketWatch](https://www.marketwatch.com)\* -
[MarketWatch](https://www.marketwatch.com)\ -
[MIT Sloan Management Review](https://sloanreview.mit.edu) -
[Modern Healthcare](https://www.modernhealthcare.com) -
[Quartz](https://qz.com)* -
@ -473,7 +475,7 @@ For example:
[El Comercio](https://elcomercio.pe) -
[Gestión](https://gestion.pe)
_*free articles only._
_* free articles only._
### Sites with limited number of free articles
The free article limit can normally be bypassed by removing cookies for the site.

View file

@ -4,7 +4,7 @@
var ext_api = (typeof browser === 'object') ? browser : chrome;
var ext_name = ext_api.runtime.getManifest().name;
const cs_limit_except = ['afr.com', 'discovermagazine.com', 'elcomercio.pe', 'elpais.com', 'faz.net', 'gestion.pe', 'harpers.org', 'inkl.com', 'la-croix.com', 'lescienze.it', 'lne.es', 'newleftreview.org', 'prospectmagazine.co.uk', 'techinasia.com', 'thepointmag.com'];
const cs_limit_except = ['afr.com', 'discovermagazine.com', 'elcomercio.pe', 'elpais.com', 'faz.net', 'gestion.pe', 'harpers.org', 'inkl.com', 'la-croix.com', 'lescienze.it', 'lne.es', 'marketwatch.com', 'newleftreview.org', 'prospectmagazine.co.uk', 'techinasia.com', 'thepointmag.com'];
var currentTabUrl = '';
var csDone = false;
@ -80,6 +80,7 @@ var allow_cookies_default = [
'limesonline.com',
'lne.es',
'lrb.co.uk',
'marketwatch.com',
'modernhealthcare.com',
'nationalgeographic.com',
'nationalpost.com',
@ -269,7 +270,7 @@ var blockedRegexes = {
'lne.es': /cdn\.ampproject\.org\/v\d\/amp-(access|consent)-.+\.js/,
'lopinion.fr': /.+\.poool\.fr\/.+/,
'lrb.co.uk': /\.tinypass\.com\/.+/,
'marketwatch.com': /cdn\.cxense\.com\/.+/,
'marketwatch.com': /(cdn\.cxense\.com\/|cdn\.ampproject\.org\/v\d\/amp-(access|ad)-.+\.js)/,
'mercuriovalpo.cl': /(.+\.mercuriovalpo\.cl\/impresa\/.+\/assets\/(vendor|\d)\.js|pram\.pasedigital\.cl\/API\/User\/Status\?)/,
'modernhealthcare.com': /\.tinypass\.com\/.+/,
'nationalgeographic.com': /.+\.blueconic\.net\/.+/,
@ -826,11 +827,12 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
let au_swm_site = (header_referer && urlHost(header_referer).endsWith('com.au') && details.url.includes('https://s.thewest.com.au/'));
let uk_nlr_site = (matchUrlDomain('stripe.com', details.url) && matchUrlDomain('newleftreview.org', header_referer) && isSiteEnabled({url: header_referer}));
let usa_discmag_site = (matchUrlDomain('ctfassets.net', details.url) && matchUrlDomain('discovermagazine.com', header_referer) && isSiteEnabled({url: header_referer}));
let usa_mw_site = (matchUrlDomain('wsj.net', details.url) && matchUrlDomain('marketwatch.com', 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', 'cicero.de', 'cmjornal.pt', 'elmundo.es', 'elpais.com', 'elperiodico.com', 'expansion.com', 'freiepresse.de', 'fresnobee.com', 'gelocal.it', 'independent.ie', 'irishtimes.com', 'la-croix.com', 'lne.es', 'nationalreview.com', 'sacbee.com', 'seekingalpha.com', 'sueddeutsche.de', 'svz.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', 'cicero.de', 'cmjornal.pt', 'elmundo.es', 'elpais.com', 'elperiodico.com', 'expansion.com', 'freiepresse.de', 'fresnobee.com', 'gelocal.it', 'independent.ie', 'irishtimes.com', 'la-croix.com', 'lne.es', 'marketwatch.com', 'nationalreview.com', 'sacbee.com', 'seekingalpha.com', 'sueddeutsche.de', 'svz.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 && !usa_discmag_site && !bpc_amp_site) {
if (!isSiteEnabled(details) && !inkl_site && !au_nc_amp_site && !au_apn_site && !au_swm_site && !uk_nlr_site && !usa_discmag_site && !usa_mw_site && !bpc_amp_site) {
return;
}

View file

@ -12,6 +12,7 @@ Add Ruhr Nachrichten (Germany)
Add The Point Magazine
Fix-update El Pais (Spain)
Fix-update Helsingin Sanomat (Finland)
Fix-update MarketWatch (premium)
Fix-update MIT Sloan Management Review
Update block TinyPass (all subdomains)
Update excluded sites (no general block paywall scripts)

View file

@ -1969,6 +1969,24 @@ else if (matchDomain('lne.es')) {
}
}
else if (matchDomain('marketwatch.com')) {
let premium = document.querySelector('div.article__exclusive');
let url = window.location.href;
window.setTimeout(function () {
if (premium && !url.includes('/amp/')) {
window.location.href = url.replace('.marketwatch.com/', '.marketwatch.com/amp/');
}
}, 500); // Delay (in milliseconds)
if (url.includes('/amp/')) {
let meter = document.querySelector('div.meter');
let container_sponsored = document.querySelector('div.container--sponsored');
let amp_ads = document.querySelectorAll('.display-ad');
removeDOMElement(meter, container_sponsored, ...amp_ads);
}
let ads = document.querySelectorAll('div.element--ad, div.j-ad');
removeDOMElement(...ads);
}
else if (!matchDomain(['belfasttelegraph.co.uk', 'independent.ie']))
csDone = true;

View file

@ -438,7 +438,8 @@
"*://*.rcsobjects.it/*",
"*://*.repstatic.it/*",
"*://*.stripe.com/*",
"*://*.userzoom.com/*"
"*://*.userzoom.com/*",
"*://*.wsj.net/*"
],
"version": "2.0.4.7"
"version": "2.0.4.8"
}

View file

@ -133,7 +133,7 @@ var defaultSites =
"Los Angeles Business Journal": "labusinessjournal.com",
"Los Angeles Times": "latimes.com",
"Madsack Mediengruppe (Germany)": "###_de_madsack",
"MarketWatch (free articles only)": "marketwatch.com",
"MarketWatch": "marketwatch.com",
"Medium (all sites)": "medium.com",
"Mexico News Daily": "mexiconewsdaily.com",
"Miami Herald": "miamiherald.com",