2020-10-01 16:11:57 +02:00
//"use strict";
2020-09-08 16:38:18 +02:00
var ext _api = ( typeof browser === 'object' ) ? browser : chrome ;
var domain ;
2020-12-04 16:14:23 +01:00
var csDone = false ;
2020-09-08 16:38:18 +02:00
2021-01-08 18:40:14 +01:00
var ca _torstar _domains = [ 'niagarafallsreview.ca' , 'stcatharinesstandard.ca' , 'thepeterboroughexaminer.com' , 'therecord.com' , 'thespec.com' , 'thestar.com' , 'wellandtribune.ca' ] ;
2021-03-12 17:03:22 +01:00
var de _funke _media _domains = [ 'abendblatt.de' , 'braunschweiger-zeitung.de' , 'morgenpost.de' , 'nrz.de' , 'otz.de' , 'thueringer-allgemeine.de' , 'tlz.de' , 'waz.de' , 'wp.de' , 'wr.de' ] ;
2020-12-08 20:13:27 +01:00
var de _madsack _domains = [ 'haz.de' , 'kn-online.de' , 'ln-online.de' , 'lvz.de' , 'maz-online.de' , 'neuepresse.de' , 'ostsee-zeitung.de' ] ;
2021-05-19 17:11:21 +02:00
var es _epiberica _domains = [ 'diariodeibiza.es' , 'diariodemallorca.es' , 'farodevigo.es' , 'laprovincia.es' , 'levante-emv.com' , 'lne.es' ] ;
2021-05-14 17:16:30 +02:00
var es _grupo _vocento _domains = [ 'diariosur.es' , 'diariovasco.com' , 'elcomercio.es' , 'elcorreo.com' , 'eldiariomontanes.es' , 'elnortedecastilla.es' , 'hoy.es' , 'ideal.es' , 'larioja.com' , 'lasprovincias.es' , 'laverdad.es' , 'lavozdigital.es' ] ;
2020-12-06 22:32:59 +01:00
var fr _groupe _ebra _domains = [ 'bienpublic.com' , 'dna.fr' , 'estrepublicain.fr' , 'lalsace.fr' , 'ledauphine.com' , 'lejsl.com' , 'leprogres.fr' , 'republicain-lorrain.fr' , 'vosgesmatin.fr' ] ;
2020-12-07 18:10:59 +01:00
var fr _groupe _la _depeche _domains = [ 'centrepresseaveyron.fr' , 'ladepeche.fr' , 'lindependant.fr' , 'midi-olympique.fr' , 'midilibre.fr' , 'nrpyrenees.fr' , 'petitbleu.fr' ] ;
2021-02-19 19:28:36 +01:00
var it _repubblica _domains = [ 'gelocal.it' , 'ilsecoloxix.it' , 'lanuovasardegna.it' , 'lastampa.it' , 'limesonline.com' , 'repubblica.it' ] ;
2021-02-12 19:22:15 +01:00
var usa _mcc _domains = [ 'bnd.com' , 'charlotteobserver.com' , 'fresnobee.com' , 'kansas.com' , 'kansascity.com' , 'kentucky.com' , 'newsobserver.com' , 'sacbee.com' , 'star-telegram.com' , 'thestate.com' , 'tri-cityherald.com' ] ;
2020-12-10 20:23:12 +01:00
// clean local storage of sites (with an exemption for hold-list)
2021-02-27 10:25:19 +01:00
var arr _localstorage _hold = [ 'augsburger-allgemeine.de' , 'charliehebdo.fr' , 'cmjornal.pt' , 'elmundo.es' , 'expansion.com' , 'houstonchronicle.com' , 'irishtimes.com' , 'kurier.at' , 'nknews.org' , 'seekingalpha.com' , 'sfchronicle.com' , 'thehindu.com' , 'thetimes.co.uk' ] ;
2020-12-10 20:23:12 +01:00
arr _localstorage _hold = arr _localstorage _hold . concat ( de _funke _media _domains , es _grupo _vocento _domains ) ;
2021-04-10 08:46:50 +02:00
if ( ! matchDomain ( arr _localstorage _hold ) ) {
window . localStorage . clear ( ) ;
2019-12-06 16:15:49 +01:00
}
2019-12-10 20:08:01 +01:00
2021-04-11 11:17:37 +02:00
var div _bpc _done = document . querySelector ( 'div#bpc_done' ) ;
if ( ! div _bpc _done ) {
2020-09-08 16:38:18 +02:00
// listen to responses from background script
2021-01-01 12:23:29 +01:00
if ( ext _api . runtime && ( matchDomain ( [ 'belfasttelegraph.co.uk' , 'bostonglobe.com' , 'independent.ie' ] ) || window . location . hostname . match ( /\.(com|net)\.au$/ ) ) ) {
2021-04-10 08:46:50 +02:00
ext _api . runtime . onMessage . addListener ( function ( message , sender ) {
2020-09-08 16:38:18 +02:00
// setCookie opt-in
if ( message . optIn ) {
2021-04-10 08:46:50 +02:00
let hostname = window . location . hostname ;
if ( hostname . match ( /\.(com|net)\.au$/ ) ) {
// Australian Provincial Newspapers
domain = window . location . hostname . replace ( 'www.' , '' ) ;
let au _apn _script = document . querySelector ( 'script[src^="https://media.apnarm.net.au/"]' ) ;
if ( au _apn _script || ( domain = matchDomain ( [ 'news-mail.com.au' , 'frasercoastchronicle.com.au' , 'gladstoneobserver.com.au' , 'dailyexaminer.com.au' , 'dailymercury.com.au' , 'themorningbulletin.com.au' , 'sunshinecoastdaily.com.au' , 'gympietimes.com.au' , 'northernstar.com.au' , 'qt.com.au' , 'thechronicle.com.au' , 'warwickdailynews.com.au' ] ) ) )
if ( ! cookieExists ( 'subscribed' ) )
setCookie ( 'subscribed' , 'true' , domain , '/' , 14 ) ;
} else {
if ( matchDomain ( 'bostonglobe.com' ) ) {
if ( ! cookieExists ( 's_fid' ) ) {
let s _fid = genHexString ( 16 ) + '-' + genHexString ( 16 ) ;
setCookie ( 's_fid' , s _fid , 'bostonglobe.com' , '/' , 14 ) ;
}
} else if ( domain = matchDomain ( [ 'belfasttelegraph.co.uk' , 'independent.ie' ] ) ) {
if ( ! cookieExists ( 'subscriber' ) )
setCookie ( 'subscriber' , '{"subscriptionStatus": true}' , domain , '/' , 14 ) ;
if ( hostname . includes ( 'amp.' ) ) {
let subscriber = document . querySelector ( 'section[amp-access="subscriber"]' ) ;
if ( subscriber )
subscriber . removeAttribute ( 'amp-access-hide' ) ;
let not _subscriber = document . querySelector ( 'section[amp-access="NOT subscriber"]' ) ;
let amp _ads = document . querySelectorAll ( 'amp-ad, amp-embed' ) ;
removeDOMElement ( not _subscriber , ... amp _ads ) ;
}
2020-09-08 16:38:18 +02:00
}
2021-04-10 08:46:50 +02:00
}
2020-09-08 16:38:18 +02:00
}
2021-04-10 08:46:50 +02:00
} ) ;
2020-09-08 16:38:18 +02:00
// ask for opt-in confirmation
2020-10-12 17:31:51 +02:00
ext _api . runtime . sendMessage ( { request : 'optin' } ) ;
2021-01-01 12:23:29 +01:00
}
2020-09-08 16:38:18 +02:00
2020-01-28 23:06:25 +01:00
// Content workarounds/domain
2020-03-27 21:13:28 +01:00
2021-04-10 08:46:50 +02:00
if ( matchDomain ( [ 'medium.com' , 'towardsdatascience.com' ] ) || document . querySelector ( 'script[src^="https://cdn-client.medium.com/"]' ) ) {
let paywall = document . querySelector ( 'div#paywall-background-color' ) ;
removeDOMElement ( paywall ) ;
if ( paywall )
window . location . reload ( true ) ;
window . setTimeout ( function ( ) {
let meter = document . querySelector ( '[id*="highlight-meter-"]' ) ;
if ( meter )
meter . hidden = true ;
} , 500 ) ; // Delay (in milliseconds)
2020-08-12 08:37:21 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( window . location . hostname . match ( /\.(com|net)\.au$/ ) || matchDomain ( [ 'afr.com' ] ) ) { //australia
2020-09-10 22:01:35 +02:00
2021-04-10 08:46:50 +02:00
if ( matchDomain ( 'afr.com' ) ) {
let hidden _images = document . querySelectorAll ( 'img[src*=".gif"]' ) ;
for ( let hidden _image of hidden _images ) {
var data _src = hidden _image . getAttribute ( 'data-src' ) ;
if ( data _src )
hidden _image . setAttribute ( 'src' , data _src ) ;
}
let plista = document . querySelector ( 'div[data-plista-placement="underArticle_Group"]' ) ;
removeDOMElement ( plista ) ;
2020-03-27 21:13:28 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'thesaturdaypaper.com.au' ) ) {
let paywall = document . querySelector ( 'div.paywall-hard-always-show' ) ;
removeDOMElement ( paywall ) ;
2021-02-20 10:18:12 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( domain = matchDomain ( [ "brisbanetimes.com.au" , "smh.com.au" , "theage.com.au" , "watoday.com.au" ] ) ) {
let url = window . location . href ;
let for _subscribers = document . querySelector ( 'meta[content^="FOR SUBSCRIBERS"]' ) ;
if ( for _subscribers ) {
2020-04-05 08:33:24 +02:00
window . setTimeout ( function ( ) {
2021-04-10 08:46:50 +02:00
window . location . href = url . replace ( 'www.' , 'amp.' ) ;
2020-03-03 18:15:21 +01:00
} , 500 ) ; // Delay (in milliseconds)
2021-04-10 08:46:50 +02:00
} else if ( url . includes ( 'amp.' + domain ) ) {
let subscr _sections = document . querySelectorAll ( 'div[subscriptions-section="content"]' ) ;
for ( let subscr _section of subscr _sections ) {
subscr _section . removeAttribute ( 'subscriptions-section' ) ;
}
let amp _ads = document . querySelectorAll ( 'amp-ad' ) ;
removeDOMElement ( ... amp _ads ) ;
}
}
else {
// Australian Community Media newspapers
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 _cm _sites ) || au _piano _script ) {
let subscribe _truncate = document . querySelector ( '.subscribe-truncate' ) ;
if ( subscribe _truncate )
subscribe _truncate . classList . remove ( 'subscribe-truncate' ) ;
let subscriber _hiders = document . querySelectorAll ( '.subscriber-hider' ) ;
for ( let subscriber _hider of subscriber _hiders )
subscriber _hider . classList . remove ( 'subscriber-hider' ) ;
let blocker = document . querySelector ( 'div.blocker' ) ;
let noscroll = document . querySelector ( 'body[style]' ) ;
if ( noscroll )
noscroll . removeAttribute ( 'style' ) ;
let story _generic _iframe = document . querySelector ( '.story-generic__iframe' ) ;
removeDOMElement ( story _generic _iframe , blocker ) ;
} 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 ) ) {
let header _ads = document . querySelector ( '.header_ads-container' ) ;
removeDOMElement ( header _ads ) ;
if ( 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 if ( window . location . href . includes ( '?amp' ) ) {
//window.setTimeout(function () {
let div _hidden = document . querySelector ( 'div[amp-access="subscriber AND status=\'logged-in\'"]' ) ;
if ( div _hidden )
div _hidden . removeAttribute ( 'amp-access-hide' ) ;
//}, 500); // Delay (in milliseconds)
}
let amp _iframes = document . querySelectorAll ( 'amp-iframe' ) ;
let elem ;
for ( let amp _iframe of amp _iframes ) {
elem = document . createElement ( 'a' ) ;
elem . innerText = 'Video-link' ;
elem . setAttribute ( 'href' , amp _iframe . getAttribute ( 'src' ) ) ;
elem . setAttribute ( 'target' , '_blank' ) ;
amp _iframe . parentElement . insertBefore ( elem , amp _iframe ) ;
removeDOMElement ( amp _iframe ) ;
}
let amp _ads = document . querySelectorAll ( '[id^="ad-mrec-"], amp-ad, amp-embed' ) ;
removeDOMElement ( ... amp _ads ) ;
} else {
// Australian Seven West Media
let swm _script = document . querySelector ( 'script[src^="https://s.thewest.com.au"]' ) ;
if ( matchDomain ( 'thewest.com.au' ) || swm _script ) {
window . setTimeout ( function ( ) {
let breach _screen = document . querySelector ( 'div[data-testid*="BreachScreen"]' ) ;
if ( breach _screen ) {
let scripts = document . querySelectorAll ( 'script:not([src], [type])' ) ;
let json _script ;
for ( let script of scripts ) {
if ( script . innerText . includes ( 'window.PAGE_DATA =' ) ) {
json _script = script ;
break ;
}
}
if ( json _script ) {
let json _text = json _script . innerHTML . split ( 'window.PAGE_DATA =' ) [ 1 ] . split ( '</script' ) [ 0 ] ;
json _text = json _text . replace ( /undefined/g , '"undefined"' ) ;
let json _article = JSON . parse ( json _text ) ;
let json _pub ;
for ( let key in json _article )
if ( json _article [ key ] . data . result . resolution && json _article [ key ] . data . result . resolution . publication ) {
json _pub = json _article [ key ] . data . result . resolution . publication ;
break ;
}
let json _content = [ ] ;
let url _loaded ;
if ( json _pub ) {
json _content = json _pub . content . blocks ;
url _loaded = json _pub . _self ;
} else
window . location . reload ( true ) ;
//let json_video = json_pub.mainVideo;
let url = window . location . href ;
if ( ! url _loaded || ! url . includes ( url _loaded . slice ( - 10 ) ) )
window . location . reload ( true ) ;
let article = '' ;
let div _content = document . createElement ( 'div' ) ;
for ( let par of json _content ) {
if ( par . kind === 'text' ) {
article = article + '<p>' + par . text + '</p>' ;
} else if ( par . kind === 'subhead' ) {
article = article + '<h2>' + par . text + '</h2>' ;
} else if ( par . kind === 'pull-quote' ) {
article = article + '<i>' + ( par . attribution ? par . attribution + ': ' : '' ) + par . text + '</i>' ;
} else if ( par . kind === 'embed' ) {
if ( par . reference . includes ( 'https://omny.fm/' ) || par . reference . includes ( 'https://docdro.id/' ) ) {
article = article + '<embed src="' + par . reference + '" style="height:500px; width:100%" frameborder="0"></embed>' ;
} else {
article = article + 'Embed: ' + '<a href="' + par . reference + '" target="_blank">' + par . reference + '</a>' ;
console . log ( 'embed: ' + par . reference ) ;
}
} else if ( par . kind === 'unordered-list' ) {
if ( par . items ) {
article = article + '<ul>' ;
for ( let item of par . items )
if ( item . text && item . intentions [ 0 ] . href ) {
article = article + '<li><a href="' + item . intentions [ 0 ] . href + '">' + item . text + '</a></li>' ;
}
article = article + '</ul>' ;
}
} else if ( par . kind === 'inline' ) {
if ( par . asset . kind === 'image' ) {
article = article + '<figure><img src="' + par . asset . original . reference + '" style="width:100%">' ;
article = article + '<figcaption>' +
par . asset . captionText + ' ' + par . asset . copyrightByline +
( ( par . asset . copyrightCredit && par . asset . captionText !== par . asset . copyrightByline ) ? '/' + par . asset . copyrightCredit : '' ) +
'<figcaption></figure>' ;
}
} else {
article = article + '<p>' + par . text + '</p>' ;
console . log ( par . kind ) ;
}
}
let content = document . querySelector ( 'div[class*="StyledArticleContent"]' ) ;
let parser = new DOMParser ( ) ;
let par _html = parser . parseFromString ( '<div>' + article + '</div>' , 'text/html' ) ;
let par _dom = par _html . querySelector ( 'div' ) ;
if ( content ) {
content . appendChild ( par _dom ) ;
} else {
par _dom . setAttribute ( 'style' , 'margin: 20px;' ) ;
breach _screen . parentElement . insertBefore ( par _dom , breach _screen ) ;
}
}
removeDOMElement ( breach _screen ) ;
}
} , 1500 ) ; // Delay (in milliseconds)
let header _advert = document . querySelector ( '.headerAdvertisement' ) ;
if ( header _advert )
header _advert . setAttribute ( 'style' , 'display: none;' ) ;
}
2019-11-22 05:17:21 +01:00
}
2021-04-10 08:46:50 +02:00
}
else
2021-04-25 13:45:36 +02:00
csDone = true ;
2020-01-28 23:06:25 +01:00
}
2021-04-10 08:46:50 +02:00
} else if ( window . location . hostname . match ( /\.(de|at|ch)$/ ) || matchDomain ( [ 'faz.net' ] ) ) { //germany/austria/switzerland - ch
if ( matchDomain ( 'augsburger-allgemeine.de' ) ) {
let url = window . location . href ;
if ( url . includes ( '-amp.html' ) ) {
let subscr _sections = document . querySelectorAll ( 'div[subscriptions-section="content"]' ) ;
for ( let subscr _section of subscr _sections )
subscr _section . removeAttribute ( 'subscriptions-section' ) ;
let amp _ads = document . querySelectorAll ( 'amp-ad' ) ;
removeDOMElement ( ... amp _ads ) ;
}
2021-02-19 19:28:36 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'berliner-zeitung.de' ) ) {
let url = window . location . href ;
let paywall = document . querySelector ( '.paywall-dialog-box' ) ;
if ( url . split ( '?' ) [ 0 ] . includes ( '.amp' ) ) {
if ( paywall ) {
let preview = document . querySelector ( 'section[subscriptions-section="content-not-granted"]' ) ;
removeDOMElement ( paywall , preview ) ;
let subscr _section = document . querySelector ( 'section[subscriptions-section="content"]' ) ;
if ( subscr _section ) {
subscr _section . removeAttribute ( 'subscriptions-section' ) ;
let amp _ads = document . querySelectorAll ( 'amp-ad' ) ;
2021-02-19 19:28:36 +01:00
removeDOMElement ( ... amp _ads ) ;
2021-04-10 08:46:50 +02:00
}
}
} else {
if ( paywall ) {
removeDOMElement ( paywall ) ;
window . location . href = url . split ( '?' ) [ 0 ] + '.amp' ;
2021-02-19 19:28:36 +01:00
}
2021-04-10 08:46:50 +02:00
}
2021-02-19 19:28:36 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'cicero.de' ) ) {
let url = window . location . href ;
if ( ! url . includes ( '?amp' ) ) {
let paywall = document . querySelector ( '.plenigo-paywall' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let url _amp = url + '?amp' ;
replaceDomElementExt ( url _amp , false , false , '.field-name-field-cc-body' ) ;
}
} else {
let teasered _content = document . querySelector ( '.teasered-content' ) ;
if ( teasered _content )
teasered _content . classList . remove ( 'teasered-content' ) ;
let teasered _content _fader = document . querySelector ( '.teasered-content-fader' ) ;
let btn _read _more = document . querySelector ( '.btn--read-more' ) ;
let amp _ads = document . querySelectorAll ( 'amp-ad' ) ;
removeDOMElement ( teasered _content _fader , btn _read _more , ... amp _ads ) ;
}
let urban _ad _sign = document . querySelectorAll ( '.urban-ad-sign' ) ;
removeDOMElement ( ... urban _ad _sign ) ;
2020-01-28 23:06:25 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( de _funke _media _domains ) ) {
sessionStorage . setItem ( 'deobfuscate' , 'true' ) ;
2020-01-28 23:06:25 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'deutsche-wirtschafts-nachrichten.de' ) ) {
window . setTimeout ( function ( ) {
let hardpay = document . querySelector ( '.hardpay' ) ;
if ( hardpay ) {
window . location . reload ( true ) ;
2020-01-28 23:06:25 +01:00
}
2021-04-10 08:46:50 +02:00
} , 500 ) ; // Delay (in milliseconds)
}
else if ( matchDomain ( 'faz.net' ) ) {
if ( matchDomain ( 'zeitung.faz.net' ) ) {
let paywall _z = document . querySelector ( '.c-red-carpet' ) ;
if ( paywall _z ) {
let og _url = document . querySelector ( 'meta[property="og:url"]' ) ;
if ( og _url )
window . setTimeout ( function ( ) {
window . location . href = og _url . content ;
} , 500 ) ; // Delay (in milliseconds)
}
let sticky _advt = document . querySelector ( '.sticky-advt' ) ;
removeDOMElement ( sticky _advt ) ;
} else {
let paywall = document . querySelector ( '#paywall-form-container-outer, .atc-ContainerPaywall' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let url = new URL ( window . location . href ) ;
let mUrl = new URL ( url . pathname , 'https://m.faz.net/' ) ;
fetch ( mUrl )
. then ( response => {
if ( response . ok ) {
response . text ( ) . then ( html => {
var parser = new DOMParser ( ) ;
var doc = parser . parseFromString ( html , 'text/html' ) ;
let json = doc . querySelector ( 'script[id="schemaOrgJson"]' ) ;
if ( json ) {
var json _text = json . text . replace ( /(\r|\n)/g , '' ) ;
let split1 = json _text . split ( '"ArticleBody": "' ) ;
let split2 = split1 [ 1 ] . split ( '","author":' ) ;
if ( split2 [ 0 ] . includes ( '"' ) )
json _text = split1 [ 0 ] + '"ArticleBody": "' + split2 [ 0 ] . replace ( /"/g , '“' ) + '","author":' + split2 [ 1 ] ;
try {
json _text = JSON . parse ( json _text ) . ArticleBody ;
} catch ( err ) {
console . log ( err ) ;
return ;
}
if ( ! json _text )
return ;
let article _text = document . querySelector ( '.art_txt.paywall,.atc-Text.js-atc-Text' ) ;
article _text . innerText = '' ;
const breakText = ( str ) => {
2021-05-06 19:50:12 +02:00
str = str . replace ( /(?:^|[A-Za-z\"\“])(\.|\?|!)(?=[A-ZÖÜ\„\d][A-Za-zÀ-ÿ\„\d]{1,})/gm , "$&\n\n" ) ;
str = str . replace ( /(([a-z]{2,}|[\"\“]))(?=[A-Z](?=[A-Za-zÀ-ÿ]+))/gm , "$&\n\n" ) ;
2021-04-10 08:46:50 +02:00
// exceptions: names with alternating lower/uppercase (no general fix)
2021-05-06 19:50:12 +02:00
let str _rep _arr = [ 'AstraZeneca' , 'BaFin' , 'BerlHG' , 'BfArM' , 'BilMoG' , 'DiGA' , 'EuGH' , 'FinTechRat' , 'GlaxoSmithKline' , 'IfSG' , 'medRxiv' , 'PlosOne' , 'StVO' ] ;
2021-04-10 08:46:50 +02:00
let str _rep _split ,
str _rep _src ;
for ( let str _rep of str _rep _arr ) {
str _rep _split = str _rep . split ( /([a-z]+)(?=[A-Z](?=[A-Za-z]+))/ ) ;
str _rep _src = str _rep _split . reduce ( function ( accumulator , currentValue ) {
return accumulator + currentValue + ( ( currentValue !== currentValue . toUpperCase ( ) ) ? '\n\n' : '' ) ;
} ) ;
if ( str _rep _src . endsWith ( '\n\n' ) )
str _rep _src = str _rep _src . slice ( 0 , - 2 ) ;
str = str . replace ( new RegExp ( str _rep _src , "g" ) , str _rep ) ;
}
str = str . replace ( /De\n\n([A-Z])/g , "De$1" ) ;
str = str . replace ( /La\n\n([A-Z])/g , "La$1" ) ;
str = str . replace ( /Le\n\n([A-Z])/g , "Le$1" ) ;
str = str . replace ( /Mc\n\n([A-Z])/g , "Mc$1" ) ;
return str ;
} ;
json _text = breakText ( json _text ) ;
json _text . split ( "\n\n" ) . forEach (
( p _text ) => {
let elem ;
if ( p _text . length < 80 ) {
elem = document . createElement ( "h2" ) ;
elem . setAttribute ( 'class' , 'atc-SubHeadline' ) ;
} else {
elem = document . createElement ( "p" ) ;
elem . setAttribute ( 'class' , 'atc-TextParagraph' ) ;
} ;
elem . innerText = p _text ;
article _text . appendChild ( elem ) ;
} ) ;
}
} )
2020-05-14 20:58:55 +02:00
}
2021-04-10 08:46:50 +02:00
} ) ;
}
let lay _paysocial = document . querySelector ( 'div.lay-PaySocial' ) ;
removeDOMElement ( lay _paysocial ) ;
}
2020-01-28 23:06:25 +01:00
}
2019-10-08 17:41:09 +02:00
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'freiepresse.de' ) ) {
let url = window . location . href ;
let article _teaser = document . querySelector ( 'div.article-teaser' ) ;
if ( article _teaser && url . match ( /(\-artikel)(\d){6,}/ ) ) {
2020-12-04 16:14:23 +01:00
window . setTimeout ( function ( ) {
2021-04-10 08:46:50 +02:00
window . location . href = url . replace ( '-artikel' , '-amp' ) ;
2020-12-04 16:14:23 +01:00
} , 500 ) ; // Delay (in milliseconds)
2021-04-10 08:46:50 +02:00
} else if ( url . match ( /(\-amp)(\d){6,}/ ) ) {
let amp _ads = document . querySelectorAll ( 'amp-fx-flying-carpet, amp-ad, amp-embed' ) ;
let pw _layer = document . querySelector ( '.pw-layer' ) ;
removeDOMElement ( ... amp _ads , pw _layer ) ;
}
2020-01-28 23:06:25 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'krautreporter.de' ) ) {
let paywall = document . querySelector ( '.article-paywall' ) ;
if ( paywall ) {
let paywall _divider = document . querySelector ( '.js-paywall-divider' ) ;
let steady _checkout = document . querySelector ( '#steady-checkout' ) ;
removeDOMElement ( paywall , paywall _divider , steady _checkout ) ;
let blurred = document . querySelectorAll ( '.blurred' ) ;
for ( let elem of blurred )
elem . classList . remove ( 'blurred' , 'json-ld-paywall-marker' , 'hidden@print' ) ;
}
2020-01-28 23:06:25 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'kurier.at' ) ) {
let view _offer = document . querySelector ( '.view-offer' ) ;
removeDOMElement ( view _offer ) ;
let plus _content = document . querySelector ( '.plusContent' ) ;
if ( plus _content )
plus _content . classList . remove ( 'plusContent' ) ;
2020-01-28 23:06:25 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( [ 'noz.de' , 'nwzonline.de' , 'shz.de' , 'svz.de' ] ) ) {
let url = window . location . href ;
let paywall = document . querySelector ( '.paywall, .story--premium__container' ) ;
if ( url . includes ( '?amp' ) || url . includes ( '-amp.html' ) ) {
let subscriber = document . querySelector ( 'div[amp-access="NOT data.reduced"]' ) ;
if ( subscriber )
subscriber . removeAttribute ( 'amp-access-hide' ) ;
let non _subscriber = document . querySelector ( 'div[amp-access="data.reduced"]' ) ;
let amp _ads = document . querySelectorAll ( 'amp-ad, amp-embed, #flying-carpet-wrapper' ) ;
removeDOMElement ( non _subscriber , ... amp _ads ) ;
} else {
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
}
2019-10-05 14:08:57 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'nzz.ch' ) ) {
let regwall = document . querySelector ( '.dynamic-regwall' ) ;
removeDOMElement ( regwall ) ;
2019-10-16 10:18:39 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'rheinpfalz.de' ) ) {
let url = window . location . href ;
if ( url . includes ( 'reduced=true' ) ) {
2020-09-24 20:50:29 +02:00
window . setTimeout ( function ( ) {
2021-04-10 08:46:50 +02:00
window . location . href = url . split ( '?' ) [ 0 ] ;
2020-09-24 20:50:29 +02:00
} , 500 ) ; // Delay (in milliseconds)
2021-04-10 08:46:50 +02:00
}
2019-10-14 14:52:27 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( [ 'ruhrnachrichten.de' , 'hellwegeranzeiger.de' ] ) ) {
let paywall = document . querySelector ( '.PianoContent' ) ;
if ( paywall )
paywall . classList . remove ( 'PianoContent' ) ;
}
else if ( matchDomain ( 'sueddeutsche.de' ) ) {
let url = window . location . href ;
document . addEventListener ( 'DOMContentLoaded' , ( ) => {
let offer _page = document . querySelector ( 'div.offer-page' ) ;
if ( url . startsWith ( 'https://www.sueddeutsche.de' ) && ( url . includes ( 'reduced=true' ) || offer _page ) )
window . location . href = url . split ( '?' ) [ 0 ] . split ( '!' ) [ 0 ] . replace ( 'www.' , 'amphtml.' ) ;
else if ( url . startsWith ( 'https://sz-magazin.sueddeutsche.de' ) ) {
if ( url . includes ( 'reduced=true' ) || offer _page )
window . location . href = new URL ( url ) . pathname + '!amp' ;
}
} ) ;
window . setTimeout ( function ( ) {
if ( url . includes ( '!amp' ) ) {
let paragraph _reduced = document . querySelector ( '.paragraph--reduced' ) ;
if ( paragraph _reduced )
paragraph _reduced . classList . remove ( 'paragraph--reduced' ) ;
let paragraph _hidden = document . querySelectorAll ( '.paragraph--hidden' ) ;
for ( let par _hidden of paragraph _hidden )
par _hidden . classList . remove ( 'paragraph--hidden' ) ;
let paragraph _dynamic = document . querySelector ( '.paragraph--dynamic' ) ;
if ( paragraph _dynamic )
paragraph _dynamic . classList . remove ( 'paragraph--dynamic' ) ;
let amp _offerpage = document . querySelector ( '.amp-offerpage' ) ;
removeDOMElement ( amp _offerpage ) ;
}
} , 500 ) ; // Delay (in milliseconds)
}
2021-04-24 09:37:20 +02:00
else if ( ( domain = matchDomain ( de _madsack _domains ) ) || document . querySelector ( 'link[rel="preload"][href="https://static.rndtech.de/cmp/1.x.x.js"]' ) ) {
let url = window . location . href ;
if ( ! url . includes ( domain + '/amp/' ) ) {
let paidcontent _intro = document . querySelector ( 'div.pdb-article-body-paidcontentintro' ) ;
if ( paidcontent _intro ) {
paidcontent _intro . classList . remove ( 'pdb-article-body-paidcontentintro' ) ;
let json _script = document . querySelector ( 'div.pdb-article > script[type="application/ld+json"]' ) ;
let json _text = JSON . parse ( json _script . text ) . articleBody ;
if ( json _text ) {
let pdb _richtext _field = document . querySelectorAll ( 'div.pdb-richtext-field' ) ;
if ( pdb _richtext _field [ 1 ] )
pdb _richtext _field [ 1 ] . innerText = json _text ;
}
let paidcontent _reg = document . querySelector ( 'div.pdb-article-paidcontent-registration' ) ;
removeDOMElement ( paidcontent _reg ) ;
}
} else {
let subscr _sections = document . querySelectorAll ( 'section[subscriptions-section="content"]' ) ;
for ( let subscr _section of subscr _sections )
subscr _section . removeAttribute ( 'subscriptions-section' ) ;
let amp _ads = document . querySelectorAll ( '.pdb-ad-container' ) ;
removeDOMElement ( ... amp _ads ) ;
}
}
2021-04-10 08:46:50 +02:00
else
2021-04-25 13:45:36 +02:00
csDone = true ;
2021-04-10 08:46:50 +02:00
2021-04-28 21:45:57 +02:00
} else if ( window . location . hostname . match ( /\.(es|pt)$/ ) || matchDomain ( [ 'diariovasco.com' , 'elconfidencial.com' , 'elcorreo.com' , 'elespanol.com' , 'elpais.com' , 'elperiodico.com' , 'expansion.com' , 'larioja.com' , 'lavanguardia.com' , 'levante-emv.com' , 'politicaexterior.com' ] ) ) { //spain/portugal
2021-04-10 08:46:50 +02:00
if ( matchDomain ( 'cmjornal.pt' ) ) {
let paywall = document . querySelector ( '.bloqueio_exclusivos' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
let url = window . location . href ;
if ( ! url . includes ( '/amp/' ) ) {
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
} else {
let section _hidden = document . querySelectorAll ( 'section[amp-access="subscriber"]' ) ;
for ( let elem of section _hidden )
elem . removeAttribute ( 'amp-access-hide' ) ;
let not _subscriber = document . querySelector ( 'section[amp-access="NOT subscriber"]' ) ;
removeDOMElement ( not _subscriber ) ;
let amp _ads = document . querySelectorAll ( 'amp-ad, amp-embed, .detalheAds' ) ;
removeDOMElement ( ... amp _ads ) ;
let amp _links = document . querySelectorAll ( 'a[href^="https://www-cmjornal-pt.cdn.ampproject.org/c/s/"]' ) ;
for ( let amp _link of amp _links )
amp _link . href = amp _link . href . replace ( 'www-cmjornal-pt.cdn.ampproject.org/c/s/' , '' ) ;
}
2020-01-28 23:06:25 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'elconfidencial.com' ) ) {
let premium = document . querySelector ( 'div.newsType__content--closed' ) ;
if ( premium )
premium . classList . remove ( 'newsType__content--closed' ) ;
2020-07-09 19:52:37 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'elespanol.com' ) ) {
let adverts = document . querySelectorAll ( '[id*="superior"], [class*="adv"]' ) ;
removeDOMElement ( ... adverts ) ;
2020-01-28 23:06:25 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( domain = matchDomain ( [ 'elmundo.es' , 'expansion.com' ] ) ) {
let premium = document . querySelector ( '.ue-c-article__premium' ) ;
let url = window . location . href ;
if ( ! url . includes ( '/amp.' + domain + '/' ) ) {
if ( premium ) {
removeDOMElement ( premium ) ;
window . location . href = window . location . href . replace ( '/www.' , '/amp.' ) ;
}
} else {
let paywall = document . querySelector ( 'div[amp-access="authorized!=true"]' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let div _hidden = document . querySelector ( 'div[amp-access="authorized=true"]' ) ;
if ( div _hidden ) {
div _hidden . removeAttribute ( 'amp-access-hide' ) ;
}
2020-07-15 18:45:37 +02:00
}
2021-04-10 08:46:50 +02:00
let adverts = document . querySelectorAll ( '.advertising, amp-embed' ) ;
removeDOMElement ( ... adverts ) ;
}
}
else if ( matchDomain ( 'elpais.com' ) ) {
let url = window . location . href ;
let login _register = document . querySelector ( '.login_register' ) ;
if ( url . includes ( '.amp.html' ) || url . includes ( '?outputType=amp' ) ) {
let paywall = document . querySelectorAll ( 'div[amp-access="success"]' ) ;
for ( let elem of paywall )
elem . removeAttribute ( 'amp-access-hide' ) ;
let amp _ads = document . querySelectorAll ( 'amp-ad' ) ;
removeDOMElement ( login _register , ... amp _ads ) ;
} else {
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( login _register && amphtml ) {
removeDOMElement ( login _register ) ;
window . location . href = amphtml . href ;
}
}
let paywall _offer = document . querySelector ( '.paywallOffer' ) ;
removeDOMElement ( paywall _offer ) ;
2019-12-05 21:32:20 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'elperiodico.com' ) ) {
let url = window . location . href ;
if ( ! url . includes ( 'amp.elperiodico.com' ) ) {
let div _hidden = document . querySelector ( 'div.closed' ) ;
if ( div _hidden )
div _hidden . classList . remove ( 'closed' ) ;
else {
let paywall = document . querySelector ( '.ep-masPeriodico-info-login' ) ;
removeDOMElement ( paywall ) ;
if ( paywall )
window . location . href = url . replace ( 'www.' , 'amp.' ) ;
}
} else {
let not _logged = document . querySelector ( '.ep-masPeriodico-info-login' ) ;
if ( not _logged ) {
let non _subscr _section = document . querySelector ( 'div[amp-access="NOT logged"]' ) ;
removeDOMElement ( not _logged , non _subscr _section ) ;
let subscr _section = document . querySelector ( 'div[amp-access="logged"]' ) ;
if ( subscr _section )
subscr _section . removeAttribute ( 'amp-access-hide' ) ;
}
2020-12-04 16:14:23 +01:00
window . setTimeout ( function ( ) {
2021-04-10 08:46:50 +02:00
let amp _img = document . querySelectorAll ( 'amp-img > img' ) ;
for ( let elem of amp _img ) {
if ( elem . src )
elem . src = elem . src . replace ( 'amp.elperiodico.com/clip/' , 'estaticos-cdn.elperiodico.com/clip/' ) ;
}
} , 3000 ) ; // Delay (in milliseconds)
}
2020-01-28 23:06:25 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( es _grupo _vocento _domains ) ) {
let url = window . location . href ;
let content _exclusive _bg = document . querySelector ( '.content-exclusive-bg, #cierre_suscripcion' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( content _exclusive _bg && amphtml ) {
removeDOMElement ( content _exclusive _bg ) ;
window . location . href = url . replace ( '.html' , '_amp.html' ) ;
} else if ( url . includes ( '_amp.html' ) ) {
let voc _advers = document . querySelectorAll ( '.voc-adver, amp-embed' ) ;
removeDOMElement ( ... voc _advers ) ;
let container _wall _exclusive = document . querySelector ( '.container-wall-exclusive' ) ;
if ( container _wall _exclusive ) {
let non _subscr _section = document . querySelector ( '[amp-access="result!=\'ALLOW_ACCESS\'"]' ) ;
removeDOMElement ( container _wall _exclusive , non _subscr _section ) ;
let subscr _section = document . querySelectorAll ( '[amp-access="result=\'ALLOW_ACCESS\'"][amp-access-hide]' ) ;
for ( let elem of subscr _section )
elem . removeAttribute ( 'amp-access-hide' ) ;
}
//lavozdigital.es
let paywall = document . querySelector ( 'span[subscriptions-section="content"]' ) ;
if ( paywall ) {
paywall . classList . remove ( 'paywall' ) ;
paywall . removeAttribute ( 'subscriptions-section' ) ;
2020-01-28 23:06:25 +01:00
}
2021-04-10 08:46:50 +02:00
}
2020-01-28 23:06:25 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( es _epiberica _domains ) ) {
2021-05-19 17:11:21 +02:00
let truncated = document . querySelector ( 'div.article-body--truncated' ) ;
if ( truncated )
truncated . classList . remove ( 'article-body--truncated' ) ;
window . setTimeout ( function ( ) {
let paywall = document . querySelector ( 'div.paywall' ) ;
removeDOMElement ( paywall ) ;
} , 500 ) ; // Delay (in milliseconds)
2021-04-28 21:45:57 +02:00
if ( window . location . href . includes ( '.amp.html' ) ) {
2021-05-19 17:11:21 +02:00
let div _access = document . querySelector ( 'div[amp-access="access"]' ) ;
removeDOMElement ( div _access ) ;
let div _hidden = document . querySelectorAll ( 'div[amp-access="NOT access"][amp-access-hide], div[amp-access="FALSE"][amp-access-hide]' ) ;
2021-04-28 21:45:57 +02:00
for ( let elem of div _hidden )
elem . removeAttribute ( 'amp-access-hide' ) ;
} else {
let div _hidden = document . querySelector ( 'div.baldomero' ) ;
if ( div _hidden )
div _hidden . classList . remove ( 'baldomero' ) ;
}
2020-01-28 23:06:25 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'lavanguardia.com' ) ) {
let paywall = document . querySelector ( '[class*="ev-open-modal-paywall"]' ) ;
let infinite _loading = document . querySelector ( '#infinite-loading' ) ;
removeDOMElement ( paywall , infinite _loading ) ;
2020-01-28 23:06:25 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'observador.pt' ) ) {
let paywall = document . querySelector ( '.premium-article' ) ;
if ( paywall )
paywall . classList . remove ( 'premium-article' ) ;
2020-01-05 13:02:44 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'politicaexterior.com' ) ) {
let paywall = document . querySelector ( 'div[class^="paywall-"]' ) ;
if ( paywall ) {
let article = document . querySelector ( 'div.entry-content-text' ) ;
let json = document . querySelector ( 'script[type="application/ld+json"]:not([class]' ) ;
if ( json ) {
var json _text = JSON . parse ( json . text ) . description . replace ( /&nbsp;/g , '' ) ;
let article _new = document . createElement ( 'div' ) ;
article _new . setAttribute ( 'class' , 'entry-content-text' ) ;
article _new . innerText = '\r\n' + json _text ;
article . parentNode . replaceChild ( article _new , article ) ;
}
removeDOMElement ( paywall ) ;
}
2020-01-05 16:31:22 +01:00
}
2021-04-10 08:46:50 +02:00
else
2021-04-25 13:45:36 +02:00
csDone = true ;
2020-01-05 17:08:07 +01:00
2021-04-30 17:25:41 +02:00
} else if ( window . location . hostname . endsWith ( '.fr' ) || matchDomain ( [ 'bienpublic.com' , 'journaldunet.com' , 'la-croix.com' , 'ledauphine.com' , 'ledevoir.com' , 'lejsl.com' , 'loeildelaphotographie.com' , 'nouvelobs.com' , 'parismatch.com' ] ) ) { //france
2021-04-10 08:46:50 +02:00
if ( matchDomain ( 'alternatives-economiques.fr' ) ) {
window . setTimeout ( function ( ) {
let paywall = document . querySelector ( '#temp-paywall' ) ;
removeDOMElement ( paywall ) ;
let data _ae _poool = document . querySelector ( 'div[data-ae-poool]' ) ;
if ( data _ae _poool )
data _ae _poool . removeAttribute ( 'style' ) ;
} , 500 ) ; // Delay (in milliseconds)
2020-01-05 17:16:32 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'atlantico.fr' ) ) {
let paywall = document . querySelector ( 'div.dpslvp' ) ;
if ( paywall )
paywall . classList . remove ( 'dpslvp' ) ;
2020-01-05 17:23:28 +01:00
}
2021-04-30 17:25:41 +02:00
else if ( matchDomain ( 'challenges.fr' ) ) {
let amorce = document . querySelector ( '.user-paying-amorce' ) ;
if ( amorce )
amorce . setAttribute ( 'style' , 'display:none !important' ) ;
let content = document . querySelector ( '.user-paying-content' ) ;
if ( content )
content . setAttribute ( 'style' , 'display: block !important' ) ;
let paywall = document . querySelector ( '.temp-paywall' ) ;
removeDOMElement ( paywall ) ;
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'charliehebdo.fr' ) ) {
window . setTimeout ( function ( ) {
let paywalled _content = document . querySelector ( 'div.ch-paywalled-content' ) ;
if ( paywalled _content )
paywalled _content . removeAttribute ( 'style' ) ;
let poool _widget = document . querySelector ( 'div#poool-widget' ) ;
removeDOMElement ( poool _widget ) ;
} , 500 ) ; // Delay (in milliseconds)
2021-04-12 18:03:12 +02:00
}
else if ( matchDomain ( 'esprit.presse.fr' ) ) {
2021-04-10 08:46:50 +02:00
let paywall = document . querySelector ( '.panel-popup-paywall' ) ;
removeDOMElement ( paywall ) ;
2020-01-05 17:50:56 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( ( domain = matchDomain ( fr _groupe _ebra _domains ) ) && window . location . href . match ( /\/\d{4}\/\d{2}\/\d{2}\// ) ) {
let url = window . location . href ;
let url _new = url . replace ( domain + '/' , domain + '/amp/' ) ;
if ( ! url . includes ( domain + '/amp/' ) ) {
let free = document . querySelector ( '[class^="paywall"]' ) ;
if ( ! free ) {
window . setTimeout ( function ( ) {
window . location . href = url _new ;
} , 500 ) ; // Delay (in milliseconds)
}
} else {
let amp _access _hide = document . querySelector ( '[amp-access-hide]' ) ;
if ( amp _access _hide ) {
let not _access _section = document . querySelector ( 'section[amp-access="NOT access"]' ) ;
removeDOMElement ( not _access _section ) ;
amp _access _hide . removeAttribute ( 'amp-access-hide' ) ;
}
let amp _ads = document . querySelectorAll ( 'amp-ad' ) ;
removeDOMElement ( ... amp _ads ) ;
}
2020-01-05 18:04:40 +01:00
}
2021-04-30 17:25:41 +02:00
else if ( domain = matchDomain ( fr _groupe _la _depeche _domains ) ) {
let url = window . location . href ;
let url _new = url . replace ( domain + '/' , domain + '/amp/' ) ;
if ( url . includes ( domain + '/amp/' ) ) {
let subscr _section = document . querySelectorAll ( '[subscriptions-section="content"]' ) ;
for ( let elem of subscr _section )
elem . removeAttribute ( 'subscriptions-section' ) ;
let amp _ads = document . querySelectorAll ( 'amp-ad, amp-embed' ) ;
removeDOMElement ( ... amp _ads ) ;
} else {
let paywall = document . querySelector ( 'div.paywall' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
window . location . href = url _new ;
}
}
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'journaldunet.com' ) ) {
let reg _wall = document . querySelector ( '.reg_wall' ) ;
removeDOMElement ( reg _wall ) ;
let entry _reg _wall = document . querySelector ( '.entry_reg_wall' ) ;
if ( entry _reg _wall ) {
entry _reg _wall . removeAttribute ( 'style' ) ;
}
2020-01-05 18:04:40 +01:00
}
2021-04-12 18:03:12 +02:00
else if ( matchDomain ( 'la-croix.com' ) ) {
2021-04-10 08:46:50 +02:00
let url = window . location . href ;
if ( ! url . includes ( 'la-croix.com/amp/' ) ) {
let paywall _host _param = document . querySelector ( '#paywall-host-param' ) ;
removeDOMElement ( paywall _host _param ) ;
let show _paywall = document . querySelector ( '#showPayWall' ) ;
if ( show _paywall )
window . setTimeout ( function ( ) {
window . location . reload ( true ) ;
} , 500 ) ;
} else {
let paywall _block = document . querySelector ( '#paywall_block' ) ;
let amp _ads = document . querySelectorAll ( 'amp-ad, amp-embed' ) ;
removeDOMElement ( paywall _block , ... amp _ads ) ;
}
2020-01-05 18:04:40 +01:00
}
2021-04-30 17:25:41 +02:00
else if ( matchDomain ( 'lanouvellerepublique.fr' ) ) {
let alert _didacticiel = document . querySelector ( 'div.alert-didacticiel' ) ;
let loading = document . querySelectorAll ( 'span.loading' ) ;
removeDOMElement ( alert _didacticiel , ... loading ) ;
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'ledevoir.com' ) ) {
let counter = document . querySelector ( '.popup-msg' ) ;
removeDOMElement ( counter ) ;
2020-01-28 23:06:25 +01:00
}
2021-04-30 17:25:41 +02:00
else if ( matchDomain ( [ 'lejdd.fr' , 'parismatch.com' ] ) ) {
let poool _banner = document . querySelector ( '#poool-container' ) ;
let forbidden = document . querySelector ( '.forbidden' ) ;
removeDOMElement ( poool _banner , forbidden ) ;
let bottom _hide = document . querySelector ( '.cnt[data-poool-mode="hide"]' ) ;
if ( bottom _hide ) {
bottom _hide . removeAttribute ( 'data-poool-mode' ) ;
bottom _hide . removeAttribute ( 'style' ) ;
2021-04-10 08:46:50 +02:00
}
2020-01-13 22:23:03 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'lesechos.fr' ) && window . location . href . match ( /-\d{6,}/ ) ) {
window . setTimeout ( function ( ) {
let abo _banner = document . querySelector ( '[class^="pgxf3b"]' ) ;
let ad _blocks = document . querySelectorAll ( '[class*="jzxvkd"' ) ;
for ( let ad _block of ad _blocks )
ad _block . setAttribute ( 'style' , 'display:none' ) ;
if ( abo _banner ) {
removeDOMElement ( abo _banner ) ;
let url = window . location . href ;
let html = document . documentElement . outerHTML ;
let state ;
let split1 = html . split ( 'window.__PRELOADED_STATE__=' ) [ 1 ] ;
let split2 = split1 . split ( '</script>' ) [ 0 ] . trim ( ) ;
if ( split2 . includes ( '; window.__DATA__=' ) )
state = split2 . split ( '; window.__DATA__=' ) [ 0 ] . trim ( ) ;
else
state = split2 . substr ( 0 , split2 . length - 1 ) ;
try {
let data = JSON . parse ( state ) ;
let article = data . article . data . stripes [ 0 ] . mainContent [ 0 ] . data . description ;
let url _loaded = data . article . data . path ;
if ( ! url . replace ( /%20/g , '' ) . includes ( url _loaded ) )
window . location . reload ( true ) ;
let paywallNode = document . querySelector ( '.post-paywall' ) ;
if ( paywallNode ) {
let contentNode = document . createElement ( 'div' ) ;
let parser = new DOMParser ( ) ;
let article _html = parser . parseFromString ( '<div>' + article + '</div>' , 'text/html' ) ;
let article _par = article _html . querySelector ( 'div' ) ;
if ( article _par ) {
contentNode . appendChild ( article _par ) ;
contentNode . className = paywallNode . className ;
paywallNode . parentNode . insertBefore ( contentNode , paywallNode ) ;
removeDOMElement ( paywallNode ) ;
let paywallLastChildNode = document . querySelector ( '.post-paywall > :last-child' ) ;
if ( paywallLastChildNode ) {
paywallLastChildNode . setAttribute ( 'style' , 'height: auto !important; overflow: hidden !important; max-height: none !important;' ) ;
2020-05-01 17:50:15 +02:00
}
2021-04-10 08:46:50 +02:00
}
2020-05-02 15:46:52 +02:00
}
2021-04-10 08:46:50 +02:00
let styleElem = document . head . appendChild ( document . createElement ( 'style' ) ) ;
styleElem . innerHTML = ".post-paywall::after {height: auto !important;}" ;
} catch ( err ) {
window . location . reload ( true ) ;
}
}
} , 500 ) ; // Delay (in milliseconds)
2020-01-28 23:06:25 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'liberation.fr' ) ) {
let close _button = document . querySelector ( '.pw-action-close' ) ;
if ( close _button )
close _button . click ( ) ;
2020-02-22 13:11:00 +01:00
}
2021-04-30 17:25:41 +02:00
else if ( matchDomain ( 'loeildelaphotographie.com' ) ) {
let paywall = document . querySelector ( '.paywall' ) ;
if ( paywall ) {
paywall . removeAttribute ( 'class' ) ;
}
let premium _pic _boxes = document . querySelectorAll ( '.premium-pic-box' ) ;
let banners = document . querySelectorAll ( '.membership-promo-container, .login_form_litle' ) ;
removeDOMElement ( ... premium _pic _boxes , ... banners ) ;
let blurred _images = document . querySelectorAll ( 'img[style*="blur"]' ) ;
for ( let blurred _image of blurred _images )
blurred _image . removeAttribute ( 'style' ) ;
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'nouvelobs.com' ) ) {
let paywall = document . querySelector ( '.paywall' ) ;
removeDOMElement ( paywall ) ;
2020-03-08 23:16:17 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'sudouest.fr' ) ) {
let url = window . location . href ;
let paywall = document . querySelector ( '.article-premium-footer' ) ;
if ( paywall ) {
let premium = document . querySelector ( 'meta[name="gsoi:premium-content"]' ) ;
if ( premium ) {
if ( premium . content ) {
let url _premium = window . location . origin + premium . content ;
replaceDomElementExt ( url _premium , false , true , 'div.full-content' ) ;
}
2020-12-07 18:10:59 +01:00
}
2021-04-10 08:46:50 +02:00
removeDOMElement ( paywall ) ;
}
window . setTimeout ( function ( ) {
let footer _premium = document . querySelector ( '.footer-premium' ) ;
removeDOMElement ( footer _premium ) ;
} , 500 ) ; // Delay (in milliseconds)
2020-03-21 15:48:04 +01:00
}
2021-04-10 08:46:50 +02:00
else
2021-04-25 13:45:36 +02:00
csDone = true ;
2020-03-30 19:59:29 +02:00
2021-04-10 08:46:50 +02:00
} else if ( window . location . hostname . endsWith ( '.it' ) || matchDomain ( [ 'limesonline.com' , 'quotidiano.net' ] ) ) { //italy
2020-03-30 20:50:55 +02:00
2021-04-10 08:46:50 +02:00
if ( matchDomain ( 'corriere.it' ) ) {
let url = window . location . href ;
if ( url . includes ( '_preview.shtml' ) ) {
2020-12-04 16:14:23 +01:00
window . setTimeout ( function ( ) {
2021-04-10 08:46:50 +02:00
window . location . href = url . replace ( '_preview.shtml' , '.shtml' ) . split ( '?' ) [ 0 ] ;
} , 500 ) ; // Delay (in milliseconds)
}
2020-04-04 19:42:04 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'ilfattoquotidiano.it' ) ) {
window . setTimeout ( function ( ) {
let paywall = document . querySelector ( '.read-more' ) ;
let subscribe = document . querySelector ( '.article-ifq-bottom-pro-sostenitore' ) ;
removeDOMElement ( paywall , subscribe ) ;
2020-04-25 17:18:12 +02:00
if ( paywall ) {
2021-04-10 08:46:50 +02:00
if ( window . location . href . includes ( '?' ) )
window . location . href = window . location . href . replace ( '?' , 'amp/?' ) ;
else
window . location . href = window . location . href + 'amp' ;
2020-04-25 17:18:12 +02:00
}
2021-04-10 08:46:50 +02:00
if ( window . location . href . includes ( '/amp/' ) ) {
let section _not _granted = document . querySelector ( 'section[subscriptions-section="content-not-granted"]' ) ;
let comments = document . querySelector ( 'div.content.comments' ) ;
removeDOMElement ( section _not _granted , comments ) ;
let hidden _content = document . querySelector ( 'section[subscriptions-section="content"]' ) ;
if ( hidden _content )
hidden _content . setAttribute ( 'style' , 'display:block !important;' ) ;
2021-01-11 18:49:09 +01:00
}
2021-04-10 08:46:50 +02:00
} , 500 ) ; // Delay (in milliseconds)
2020-04-25 17:18:12 +02:00
}
2021-04-23 17:00:47 +02:00
else if ( matchDomain ( [ 'ilgiorno.it' , 'ilrestodelcarlino.it' , 'lanazione.it' , 'quotidiano.net' ] ) ) {
2021-04-10 08:46:50 +02:00
let detail _text _truncated = document . querySelector ( 'div.detail-text--truncated' ) ;
let detail _page _paywall = document . querySelector ( 'body.detail-page--paywall' ) ;
if ( detail _page _paywall ) {
removeDOMElement ( detail _text _truncated ) ;
detail _page _paywall . classList . remove ( 'detail-page--paywall' ) ;
}
2020-04-25 20:41:55 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'lescienze.it' ) ) {
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 ) ;
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' ) ;
2020-05-02 09:16:41 +02:00
}
2021-04-10 08:46:50 +02:00
} , 1000 ) ; // Delay (in milliseconds)
2020-05-02 09:16:41 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'limesonline.com' ) ) {
window . setTimeout ( function ( ) {
let url = window . location . href ;
if ( url . includes ( 'prv=true' ) )
window . location . href = new URL ( url ) . pathname ;
} , 500 ) ; // Delay (in milliseconds)
2020-05-06 21:07:57 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'rep.repubblica.it' ) ) {
window . setTimeout ( function ( ) {
if ( window . location . href . includes ( '/pwa/' ) ) {
window . location . href = window . location . href . replace ( '/pwa/' , '/ws/detail/' ) ;
2020-05-20 17:02:34 +02:00
}
2021-04-10 08:46:50 +02:00
} , 500 ) ; // Delay (in milliseconds)
if ( window . location . href . includes ( '/ws/detail/' ) ) {
let paywall = document . querySelector ( '.paywall[subscriptions-section="content"]' ) ;
if ( paywall ) {
paywall . removeAttribute ( 'subscriptions-section' ) ;
let preview = document . querySelector ( 'div[subscriptions-section="content-not-granted"]' ) ;
removeDOMElement ( preview ) ;
csDone = true ;
2020-05-25 21:01:41 +02:00
}
2021-04-10 08:46:50 +02:00
}
2020-05-25 21:01:41 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( domain = matchDomain ( it _repubblica _domains ) ) {
let url = window . location . href ;
if ( ! url . includes ( '/amp/' ) ) {
2021-04-19 19:14:58 +02:00
let premium = document . querySelector ( '.paywall-adagio, #paywall' ) ;
2021-05-16 17:37:08 +02:00
if ( premium ) {
removeDOMElement ( premium ) ;
if ( [ 'lastampa.it' , 'repubblica.it' ] . includes ( domain ) ) {
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( ! amphtml )
2021-05-19 17:11:21 +02:00
amphtml = { href : ( url . split ( '?' ) [ 0 ] + '/amp' ) . replace ( '//amp' , '/amp' ) } ;
2021-05-16 17:37:08 +02:00
if ( amphtml )
window . location . href = amphtml . href ;
} else {
window . setTimeout ( function ( ) {
let article _body = document . querySelector ( 'div#article-body[style]' ) ;
if ( article _body )
article _body . removeAttribute ( 'style' ) ;
} , 1000 ) ; // Delay (in milliseconds)
}
}
2021-04-10 08:46:50 +02:00
} else {
let paywall ;
if ( [ 'lastampa.it' , 'repubblica.it' ] . includes ( domain ) ) {
paywall = document . querySelector ( 'div[id^="paywall-banner"]' ) ;
removeDOMElement ( paywall ) ;
let subscr _section = document . querySelector ( '[subscriptions-section="content"]' ) ;
if ( subscr _section ) {
subscr _section . removeAttribute ( 'subscriptions-section' ) ;
let preview = document . querySelector ( 'div[subscriptions-section="content-not-granted"]' ) ;
removeDOMElement ( preview ) ;
}
} else {
paywall = document . querySelector ( 'div[amp-access="showContent"]' ) ;
if ( paywall )
paywall . removeAttribute ( 'amp-access-hide' ) ;
}
let amp _ads = document . querySelectorAll ( 'amp-ad, amp-embed' ) ;
removeDOMElement ( ... amp _ads ) ;
}
2020-05-27 07:41:46 +02:00
}
2021-04-10 08:46:50 +02:00
else
2021-04-25 13:45:36 +02:00
csDone = true ;
2021-04-10 08:46:50 +02:00
} else if ( window . location . hostname . match ( /\.(be|nl)$/ ) ) { //belgium/netherlands
if ( matchDomain ( [ 'ad.nl' , 'bd.nl' , 'ed.nl' , 'tubantia.nl' , 'bndestem.nl' , 'pzc.nl' , 'destentor.nl' , 'gelderlander.nl' ] ) ) {
let paywall = document . querySelectorAll ( '.article__component--paywall-module-notification, .fjs-paywall-notification' ) ;
let modal _login = document . querySelector ( '.modal--login' ) ;
removeDOMElement ( ... paywall , modal _login ) ;
2020-06-06 16:46:56 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'fd.nl' ) ) {
document . addEventListener ( 'DOMContentLoaded' , ( ) => {
if ( window . location . href . includes ( '?' ) )
window . location . href = window . location . href . split ( '?' ) [ 0 ] ;
let reg _modal = document . querySelector ( 'div.modal.upsell' ) ;
if ( reg _modal )
window . location . reload ( true ) ;
} ) ;
2020-06-14 18:37:06 +02:00
}
2020-06-18 20:55:18 +02:00
else if ( matchDomain ( 'ftm.nl' ) ) {
2021-04-10 08:46:50 +02:00
let banner _pp = document . querySelector ( 'div.banner-pp' ) ;
removeDOMElement ( banner _pp ) ;
2020-06-18 20:55:18 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'gva.be' ) ) {
document . addEventListener ( 'DOMContentLoaded' , ( ) => {
let paywall = document . querySelector ( 'div[data-cj-root="subscription-wall"]' ) ;
removeDOMElement ( paywall ) ;
if ( paywall ) {
let main _content = document . querySelector ( 'div[data-mht-block="article-detail__article-main"]' ) ;
let json _script = main _content . querySelector ( 'script' ) ;
let json _str = json _script . text . substring ( json _script . textContent . indexOf ( '{' ) ) ;
let json = JSON . parse ( json _str ) ;
let premium = Object . values ( json ) [ 0 ] [ 'premium' ] ;
if ( json ) {
let json _text = Object . values ( json ) [ 0 ] [ 'data' ] [ 'article' ] [ 'body' ] ;
let parser = new DOMParser ( ) ;
let div _content = main _content . querySelector ( 'div' ) ;
div _content . setAttribute ( 'class' , 'gva-6c6ea21_marginbottom5 gva-28c280e9_contentwrapper' ) ;
let par _elem ,
par _key ,
par _li ,
par _html ;
let head = document . querySelector ( 'head' ) ;
let streamone = false ;
let flourish = false ;
for ( let par of json _text ) {
for ( let key in par ) {
par _elem = document . createElement ( 'p' ) ;
par _key = par [ key ] ;
if ( [ 'p' , 'subhead' ] . includes ( key ) ) {
if ( par _key . includes ( '<' ) ) {
par _html = parser . parseFromString ( '<p>' + par _key + '</p>' , 'text/html' ) ;
par _elem = par _html . querySelector ( 'p' ) ;
} else
par _elem . innerText = par _key ;
if ( key === 'subhead' )
par _elem . setAttribute ( 'style' , 'font-weight: bold;' ) ;
} else if ( key === 'image' ) {
par _elem = document . createElement ( 'img' ) ;
par _elem . src = par _key . url ;
} else if ( key === 'bullet_list' ) {
par _elem = document . createElement ( 'ul' ) ;
for ( let bullet of par _key ) {
par _html = parser . parseFromString ( '<li>' + bullet + '</li>' , 'text/html' ) ;
par _li = par _html . querySelector ( 'li' ) ;
let bullet _link = par _li . querySelector ( 'a' ) ;
if ( bullet _link && bullet _link . href && ! bullet _link . innerText )
bullet _link . innerText = bullet _link . href ;
par _elem . appendChild ( par _li ) ;
}
} 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' ) ;
streamone _script . setAttribute ( 'defer' , true ) ;
streamone _script . setAttribute ( 'crossorigin' , 'anonymous' ) ;
if ( head )
head . appendChild ( streamone _script ) ;
streamone = true ;
}
par _html = parser . parseFromString ( '<div id="json_id"><div class="gva-6c6ea21_marginbottom5 gva-28c280e9_contentwrapper"><div class="gva-6c6ea21_marginbottom4"><div class="gva-6c6ea21_marginbottom0"><div class="gva-e5b9f66a_root" data-testid="embed-video"><svg class="gva-e5b9f66a_placeholder" viewBox="0 0 16 9" aria-hidden="true"></svg><div><div id="video-player-' + par _key . id + '" style="width:100%;" data-video-embed-id="' + par _key . id + '" data-video-target-id="video-player-' + par _key . id + '" data-video-brand="gva" class="js-theoplayer-placeholder"></div></div></div></div></div>' , 'text/html' ) ;
par _elem = par _html . querySelector ( 'div' ) ;
} else if ( key === 'legacy-ml' ) {
par _html = parser . parseFromString ( par _key , 'text/html' ) ;
par _elem = par _html . querySelector ( 'div' ) ;
if ( ! flourish && par _key . includes ( 'flourish.studio' ) ) {
let flourish _script = document . createElement ( 'script' ) ;
flourish _script . setAttribute ( 'src' , 'https://public.flourish.studio/resources/embed.js' ) ;
if ( head )
head . appendChild ( flourish _script ) ;
flourish = true ;
}
} else {
console . log ( key + ': ' + par _key ) ;
par _html = parser . parseFromString ( '<p>' + par _key + '</p>' , 'text/html' ) ;
par _elem = par _html . querySelector ( 'p' ) ;
2020-06-21 23:03:07 +02:00
}
2021-04-10 08:46:50 +02:00
if ( ! [ 'streamone' , 'legacy-ml' ] . includes ( key ) )
par _elem . setAttribute ( 'class' , 'gva-3ee037ad_root gva-3ee037ad_paragraph gva-68d24f7d_none gva-ef7ba41a_system gva-6c6ea21_marginbottom5 gva-6c6ea21_margintop0 gva-21a3e72f_inherit' ) ;
div _content . appendChild ( par _elem ) ;
}
2020-06-21 23:03:07 +02:00
}
2021-04-10 08:46:50 +02:00
}
2020-06-21 23:03:07 +02:00
}
2021-04-10 08:46:50 +02:00
} ) ;
window . setTimeout ( function ( ) {
let overlay = document . querySelector ( 'div.cj-root' ) ;
removeDOMElement ( overlay ) ;
let noscroll = document . querySelector ( 'html.is-dialog-active' ) ;
if ( noscroll )
noscroll . classList . remove ( 'is-dialog-active' ) ;
} , 500 ) ; // Delay (in milliseconds)
2020-06-26 18:54:43 +02:00
}
2020-06-26 19:56:58 +02:00
else if ( matchDomain ( 'knack.be' ) ) {
2021-04-10 08:46:50 +02:00
let paywall = document . querySelector ( '.rmgPaywall' ) ;
2021-05-14 17:40:51 +02:00
if ( paywall ) {
removeDOMElement ( paywall ) ;
let hidden _body = document . querySelector ( 'div.rmgDetail-body div' ) ;
if ( hidden _body ) {
hidden _body . removeAttribute ( 'class' ) ;
let body _text = hidden _body . innerText . replace ( /(?:^|[\w\"\'])(\.|\?|!)(?=[A-Za-zÀ-ÿ\"\']{2,})/gm , "$&\n\n" ) ;
hidden _body . innerText = body _text ;
let intro _par = document . querySelector ( 'div.rmgDetail-body p' ) ;
if ( intro _par && intro _par . innerText . length > 200 )
removeDOMElement ( intro _par ) ;
}
2021-04-10 08:46:50 +02:00
}
2020-06-28 17:41:37 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( [ "lc.nl" , "dvhn.nl" ] ) ) {
document . addEventListener ( 'DOMContentLoaded' , ( ) => {
if ( window . location . href . includes ( '?' ) )
window . location . href = window . location . href . split ( '?' ) [ 0 ] ;
} ) ;
let top _ad = document . querySelector ( '.top__ad' ) ;
let plus = document . querySelector ( '.plusJustRead' ) ;
removeDOMElement ( top _ad , plus ) ;
}
else if ( matchDomain ( 'noordhollandsdagblad.nl' ) ) {
window . setTimeout ( function ( ) {
let close _button = document . querySelector ( 'button[data-testid="button-close"]' ) ;
if ( close _button )
close _button . click ( ) ;
let premium = document . querySelector ( 'div.common-components-plus_pluslabel--container' ) ;
if ( premium ) {
let hidden _article = document . querySelector ( 'div[data-auth-body="article"]' ) ;
if ( hidden _article )
hidden _article . removeAttribute ( 'style' ) ;
let paywall = document . querySelector ( 'div[data-auth-root="paywall"]' ) ;
removeDOMElement ( paywall ) ;
let auth _body = document . querySelector ( 'div[data-auth-body="article"]' ) ;
if ( auth _body ) {
let auth _body _par _count = auth _body . querySelectorAll ( 'p' ) ;
if ( auth _body _par _count . length < 2 ) {
let url = window . location . href ;
let html = document . documentElement . outerHTML ;
let split1 = html . split ( 'window["__PRELOADED_STATE_GRAPH__' ) [ 1 ] . split ( /=(.+)/ ) [ 1 ] ;
let split2 = split1 . split ( '</script>' ) [ 0 ] . trim ( ) ;
let split3 = split2 . split ( '"body":' ) [ 1 ] ;
let state = split3 . split ( '},"' ) [ 0 ] + '}' ;
try {
let data = JSON . parse ( state ) ;
let article = data . json ;
auth _body . innerHTML = '' ;
let par _html ,
par _dom ,
par _elem ,
par _div ,
par _key ;
let parser = new DOMParser ( ) ;
for ( let par of article ) {
for ( let key in par ) {
par _dom = document . createElement ( 'p' ) ;
par _elem = '' ;
par _key = par [ key ] ;
if ( key === 'subhead' ) {
par _elem = document . createElement ( 'strong' ) ;
par _elem . innerText = par _key ;
} else if ( key === 'twitter' || key === 'instagram' ) {
par _elem = document . createElement ( 'a' ) ;
Object . assign ( par _elem , {
href : par _key ,
innerText : par _key ,
target : '_blank'
} ) ;
} else if ( key === 'youtube' ) {
par _elem = document . createElement ( 'iframe' ) ;
Object . assign ( par _elem , {
src : 'https://www.youtube.com/embed/' + par _key . id ,
id : 'ytplayer' ,
type : 'text/html' ,
width : 640 ,
height : 360 ,
frameborder : 0
} ) ;
} else if ( key === 'streamone' ) {
par _elem = document . createElement ( 'iframe' ) ;
Object . assign ( par _elem , {
src : 'https://content.tmgvideo.nl/embed/item=' + par _key . id ,
type : 'text/html' ,
width : 640 ,
height : 360 ,
frameborder : 0
} ) ;
} else if ( key === 'image' ) {
par _elem = document . createElement ( 'div' ) ;
let par _img = document . createElement ( 'img' ) ;
par _img . src = par _key . url ;
par _elem . appendChild ( par _img )
par _div = document . createElement ( 'div' ) ;
par _div . innerText = par [ key ] . caption ? par [ key ] . caption : '' ;
par _div . innerText += par [ key ] . credit ? '\n' + par [ key ] . credit : '' ;
par _elem . appendChild ( par _div ) ;
} else {
par _html = parser . parseFromString ( '<div>' + par _key + '</div>' , 'text/html' ) ;
par _elem = par _html . querySelector ( 'div' ) ;
2020-07-04 13:33:25 +02:00
}
2021-04-10 08:46:50 +02:00
if ( par _elem )
par _dom . appendChild ( par _elem ) ;
auth _body . appendChild ( par _dom ) ;
}
2020-07-04 13:33:25 +02:00
}
2021-04-10 08:46:50 +02:00
} catch ( err ) {
console . warn ( 'unable to parse noordhollands dagblad text' ) ;
console . warn ( err ) ;
}
2020-07-04 13:33:25 +02:00
}
2021-04-10 08:46:50 +02:00
}
}
} , 500 ) ; // Delay (in milliseconds)
2020-07-22 19:38:49 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'nrc.nl' ) ) {
window . setTimeout ( function ( ) {
let mijnnrc _overlay = document . querySelector ( '#mijnnrc__modal__overlay' ) ;
let subscribe _bar = document . querySelector ( '.header__subscribe-bar' ) ;
removeDOMElement ( mijnnrc _overlay , subscribe _bar ) ;
let paywall = document . querySelector ( '.has-paywall' ) ;
if ( paywall )
paywall . classList . remove ( 'has-paywall' ) ;
let paywall _overlay = document . querySelector ( '.has-paywall-overlay' ) ;
if ( paywall _overlay )
paywall _overlay . classList . remove ( 'has-paywall-overlay' ) ;
} , 100 ) ;
2020-07-25 09:06:49 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( [ "parool.nl" , "trouw.nl" , "volkskrant.nl" , "humo.be" , "demorgen.be" ] ) ) {
let banners = document . querySelectorAll ( 'div[data-temptation-position^="PAGE_"], div[class^="ad--"]' ) ;
let paywall = document . querySelectorAll ( '[data-temptation-position^="ARTICLE_"]' ) ;
removeDOMElement ( ... banners , ... paywall ) ;
2020-07-25 15:05:27 +02:00
}
2020-07-25 09:06:49 +02:00
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'telegraaf.nl' ) ) {
if ( window . location . href . startsWith ( 'https://www.telegraaf.nl/error?ref=/' ) ) {
2020-08-02 12:35:09 +02:00
window . setTimeout ( function ( ) {
2021-04-10 08:46:50 +02:00
window . location . href = window . location . href . split ( '&' ) [ 0 ] . replace ( 'error?ref=/' , '' ) ;
} , 500 ) ;
}
let refresh = document . querySelector ( 'div[id="content"] > meta[http-equiv="refresh"]' ) ;
if ( refresh ) {
2020-12-04 16:56:48 +01:00
window . setTimeout ( function ( ) {
2021-04-10 08:46:50 +02:00
window . location . reload ( true ) ;
} , 500 ) ;
}
let article _wrapper = document . querySelector ( '.ArticlePageWrapper__uid' ) ;
let spotx _banner = document . querySelector ( '.ArticleBodyBlocks__inlineArticleSpotXBanner' ) ;
let paywall = document . querySelector ( '.PopupBackdrop__block' ) ;
removeDOMElement ( spotx _banner , paywall ) ;
let premium = document . querySelector ( '.PremiumLabelWithLine__body' ) ;
let article _id = article _wrapper ? article _wrapper . innerText : '123' ;
let article _body _done = document . querySelector ( '#articleBody' + article _id ) ;
if ( premium && ! article _body _done ) {
let article _body _old = document . querySelector ( '[id^="articleBody"]' ) ;
removeDOMElement ( article _body _old ) ;
let json = document . querySelector ( 'script[type="application/ld+json"][data-react-helmet="true"]' ) ;
if ( json ) {
var json _text = JSON . parse ( json . text ) . articleBody ;
let article _body = document . querySelector ( 'section.TextArticlePage__bodyText' ) ;
if ( article _body ) {
let div _main = document . createElement ( 'div' ) ;
div _main . setAttribute ( 'id' , 'articleBody' + article _id ) ;
let div _elem = document . createElement ( 'div' ) ;
div _elem . setAttribute ( 'data-element' , 'articleBodyBlocks' ) ;
let text _array = json _text . split ( '\n\n' ) ;
text _array . forEach ( p _text => {
let p _div = document . createElement ( 'p' ) ;
p _div . setAttribute ( 'class' , 'ArticleBodyBlocks__paragraph ArticleBodyBlocks__paragraph--nieuws' ) ;
p _div . innerText = p _text ;
div _elem . appendChild ( p _div ) ;
} ) ;
div _main . appendChild ( div _elem ) ;
article _body . appendChild ( div _main ) ;
}
2020-09-25 14:59:06 +02:00
}
2021-04-10 08:46:50 +02:00
}
2020-09-25 14:59:06 +02:00
}
2021-04-10 08:46:50 +02:00
else
2021-04-25 13:45:36 +02:00
csDone = true ;
2020-09-26 17:27:41 +02:00
2021-04-25 13:45:36 +02:00
} else if ( window . location . hostname . match ( /\.(ie|uk)$/ ) || matchDomain ( [ 'irishtimes.com' , 'theathletic.com' ] ) ) { //united kingdom/ireland
2020-10-02 18:41:44 +02:00
2021-04-10 08:46:50 +02:00
if ( matchDomain ( 'irishtimes.com' ) ) {
document . addEventListener ( 'DOMContentLoaded' , ( ) => {
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
let stub _article _msg = document . querySelector ( 'div.stub-article-msg' ) ;
2021-01-18 18:43:04 +01:00
let url = window . location . href ;
2021-04-10 08:46:50 +02:00
if ( ( url . includes ( 'mode=sample' ) || stub _article _msg ) && amphtml )
window . location . href = amphtml . href ;
let amp _ads = document . querySelectorAll ( '.amp-ad-container' ) ;
removeDOMElement ( ... amp _ads ) ;
} ) ;
2020-12-24 13:37:58 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'prospectmagazine.co.uk' ) ) {
let url = window . location . href ;
document . addEventListener ( 'DOMContentLoaded' , ( ) => {
let paywall = document . querySelector ( 'div.paywall_overlay_blend, div.paywall' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let url _cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url . split ( '//' ) [ 1 ] ;
replaceDomElementExt ( url _cache , true , false , 'main' , 'Failed to load from Google webcache: ' ) ;
}
} ) ;
2020-10-11 14:43:35 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'spectator.co.uk' ) ) {
let premium = document . querySelector ( '.HardPayWallContainer-module__overlay' ) ;
removeDOMElement ( premium ) ;
window . setTimeout ( function ( ) {
if ( premium && window . location . href . includes ( '/www.spectator.co.uk/' ) ) {
window . location . href = window . location . href + '/amp' ;
2020-10-16 18:41:41 +02:00
}
2021-04-10 08:46:50 +02:00
} , 500 ) ; // Delay (in milliseconds)
2020-10-16 18:41:41 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'telegraph.co.uk' ) ) {
let url = window . location . href ;
if ( new URL ( url ) . pathname . endsWith ( '/amp/' ) ) {
let paywall = document . querySelector ( '.premium-paywall' ) ;
if ( paywall ) {
let truncated _content = document . querySelector ( '.truncated-content' ) ;
removeDOMElement ( paywall , truncated _content ) ;
let subscr _section = document . querySelector ( '.notAccessibleForFree' ) ;
if ( subscr _section )
subscr _section . removeAttribute ( 'amp-access-hide' ) ;
2020-12-16 18:38:05 +01:00
}
2021-04-10 08:46:50 +02:00
}
2020-10-21 19:54:10 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'the-tls.co.uk' ) ) {
let paywall = document . querySelector ( '.tls-subscriptions-banner__closed-skin' ) ;
removeDOMElement ( paywall ) ;
2020-11-07 10:44:13 +01:00
}
2021-04-25 13:45:36 +02:00
else if ( matchDomain ( [ 'theathletic.com' , 'theathletic.co.uk' ] ) ) {
if ( ! window . location . href . includes ( '/?amp' ) ) {
let paywall = document . querySelector ( 'div#paywall-container' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
} else {
let subscr _sections = document . querySelectorAll ( '[subscriptions-section="content"]' ) ;
for ( let subscr _section of subscr _sections )
subscr _section . removeAttribute ( 'subscriptions-section' ) ;
let subscr _actions = document . querySelectorAll ( '[subscriptions-actions]' ) ;
removeDOMElement ( ... subscr _actions ) ;
}
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'thetimes.co.uk' ) ) {
let block = document . querySelector ( '.subscription-block' ) ;
2021-05-19 17:11:21 +02:00
let ad _block = document . getElementById ( 'ad-article-inline' ) ;
let ad _header = document . getElementById ( 'sticky-ad-header' ) ;
removeDOMElement ( block , ad _block , ad _header ) ;
2020-11-07 17:12:37 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( ! matchDomain ( [ 'belfasttelegraph.co.uk' , 'independent.ie' ] ) )
2021-04-25 13:45:36 +02:00
csDone = true ;
2021-04-10 08:46:50 +02:00
2021-05-21 15:10:39 +02:00
} else if ( window . location . hostname . match ( /\.(br|cl|pe)$/ ) || matchDomain ( [ 'elmercurio.com' , 'latercera.com' , 'lasegunda.com' , 'valor.globo.com' ] ) ) { //south america
2021-04-10 08:46:50 +02:00
if ( matchDomain ( [ 'elcomercio.pe' , 'gestion.pe' ] ) ) {
let paywall = document . querySelector ( '.story-content__nota-premium' ) ;
if ( paywall ) {
paywall . classList . remove ( 'story-content__nota-premium' ) ;
paywall . removeAttribute ( 'style' ) ;
}
2020-11-15 14:15:12 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'elmercurio.com' ) ) {
window . setTimeout ( function ( ) {
let elem _hidden = document . querySelectorAll ( '[style="visibility:hidden"]' ) ;
for ( let elem of elem _hidden )
elem . removeAttribute ( 'style' ) ;
2021-05-04 20:14:56 +02:00
let cont _articlelight = document . querySelector ( 'div.cont_articlelight:not([style])' ) ;
if ( cont _articlelight )
cont _articlelight . setAttribute ( 'style' , 'height: 100% !important; width: 90% !important' ) ;
let page _pdf _content = document . querySelector ( 'div.page_pdf_content' ) ;
let close _html = document . querySelector ( 'div.close_html' ) ;
removeDOMElement ( page _pdf _content , close _html )
2021-04-10 08:46:50 +02:00
} , 1000 ) ; // Delay (in milliseconds)
2020-11-17 17:39:31 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'estadao.com.br' ) ) {
let paywall = document . getElementById ( 'paywall-wrapper-iframe-estadao' ) ;
removeDOMElement ( paywall ) ;
2020-11-21 19:21:29 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'folha.uol.com.br' ) ) {
let signup = document . querySelector ( '.c-top-signup' ) ;
removeDOMElement ( signup ) ;
2020-11-22 15:25:28 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'latercera.com' ) ) {
let subscr _banner = document . querySelector ( '.empty' ) ;
removeDOMElement ( subscr _banner ) ;
2020-11-23 18:12:40 +01:00
}
2020-11-28 18:34:26 +01:00
else if ( matchDomain ( 'lasegunda.com' ) ) {
2021-04-10 08:46:50 +02:00
let url = window . location . href ;
if ( url . includes ( 'digital.lasegunda.com/mobile' ) ) {
let lessreadmore = document . querySelectorAll ( 'article.lessreadmore' ) ;
for ( let article of lessreadmore )
article . classList . remove ( 'lessreadmore' ) ;
let bt _readmore = document . querySelectorAll ( 'div[id*="bt_readmore_"]' ) ;
removeDOMElement ( ... bt _readmore ) ;
}
2020-11-28 18:34:26 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( [ "mercuriovalpo.cl" , "estrellavalpo.cl" ] ) ) {
let content = document . querySelector ( 'div.content' ) ;
if ( content )
content . setAttribute ( 'id' , 'content_new' ) ;
let modal _wrapper = document . querySelector ( 'div.modal-wrapper' ) ;
removeDOMElement ( modal _wrapper ) ;
let body _modal = document . querySelector ( 'body.modal-open' ) ;
if ( body _modal )
body _modal . classList . remove ( 'modal-open' ) ;
2020-11-30 20:39:13 +01:00
}
2021-05-21 15:10:39 +02:00
else if ( matchDomain ( 'valor.globo.com' ) ) {
let url = window . location . href ;
let paywall = document . querySelector ( 'div.paywall' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let url _cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url ;
replaceDomElementExt ( url _cache , true , false , 'div.mc-article-body' , 'Failed to load from Google webcache: ' ) ;
}
}
2021-04-10 08:46:50 +02:00
else
2021-04-25 13:45:36 +02:00
csDone = true ;
2020-12-03 16:52:33 +01:00
2021-04-10 08:46:50 +02:00
} else { //other (like com/org & not at/be/br/ch/cl/de/fr/es/ie/nl/pe/pt/uk))
if ( matchDomain ( 'adweek.com' ) ) {
let url = window . location . href ;
let body _single = document . querySelector ( 'body.single' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( body _single && amphtml ) {
body _single . classList . remove ( 'single' ) ;
window . location . href = amphtml . href ;
}
2020-12-06 22:32:59 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'americanbanker.com' ) ) {
2021-05-04 22:13:32 +02:00
let inline _gate = document . querySelector ( '.inline-gate' ) ;
if ( inline _gate ) {
inline _gate . classList . remove ( 'inline-gate' ) ;
let inline _gated = document . querySelectorAll ( '.inline-gated' ) ;
for ( let elem of inline _gated )
elem . classList . remove ( 'inline-gated' ) ;
}
2020-12-08 18:02:32 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'americanaffairsjournal.org' ) ) {
let paywall _bar = document . querySelector ( '.paywall-notification-bar-wrapper' ) ;
removeDOMElement ( paywall _bar ) ;
2020-12-19 16:59:52 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'asia.nikkei.com' ) ) {
let popup = document . querySelector ( '.pw-widget--popup' ) ;
removeDOMElement ( popup ) ;
2020-12-20 21:28:12 +01:00
}
2021-05-09 14:51:15 +02:00
else if ( matchDomain ( 'asiatimes.com' ) ) {
let paywall = document . querySelector ( 'div[amp-access="NOT story.ordered"]' ) ;
removeDOMElement ( paywall ) ;
let div _hidden = document . querySelector ( 'div[amp-access="story.ordered"][amp-access-hide]' ) ;
if ( div _hidden )
div _hidden . removeAttribute ( 'amp-access-hide' ) ;
let adverts = document . querySelectorAll ( 'amp-ad, amp-consent, amp-embed' ) ;
removeDOMElement ( ... adverts ) ;
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'barrons.com' ) ) {
document . addEventListener ( 'DOMContentLoaded' , ( ) => {
let body _continuous = document . querySelector ( 'body.is-continuous' ) ;
let snippet = document . querySelector ( 'meta[content="snippet"]' ) ;
if ( body _continuous && snippet ) {
window . location . href = window . location . href . replace ( 'barrons.com' , 'barrons.com/amp' ) ;
}
} ) ;
if ( ! window . location . href . includes ( 'barrons.com/amp/' ) ) {
var href = '' ;
let signin _links = document . querySelectorAll ( 'a.primary-button--link' ) ;
for ( let signin _link of signin _links ) {
href = signin _link . href ;
if ( href . includes ( 'target=' ) ) {
href = href . split ( 'target' ) [ 1 ] . split ( '%3F' ) [ 0 ] ;
href = href . replace ( '=' , '' ) . replace ( '%3A' , ':' ) . replace ( /%2F/g , '/' ) ;
signin _link . href = href ;
signin _link . text = 'Click' ;
}
}
2021-05-15 08:23:47 +02:00
let barrons _ads = document . querySelectorAll ( '.barrons-body-ad-placement' ) ;
removeDOMElement ( ... barrons _ads ) ;
2021-04-10 08:46:50 +02:00
} else {
let wsj _ads = document . querySelectorAll ( '.wsj-ad' ) ;
removeDOMElement ( ... wsj _ads ) ;
}
}
else if ( matchDomain ( 'bloomberg.com' ) ) {
document . addEventListener ( 'DOMContentLoaded' , ( ) => {
let fence = document . querySelector ( '.fence-body' ) ;
if ( fence ) {
fence . classList . remove ( 'fence-body' ) ;
}
} ) ;
let body _overlay = document . querySelector ( 'body[data-paywall-overlay-status="show"]' ) ;
if ( body _overlay )
body _overlay . removeAttribute ( 'data-paywall-overlay-status' ) ;
let noscroll = document . querySelector ( 'body[class*="noScroll"]' ) ;
if ( noscroll )
removeClassesByPrefix ( noscroll , 'noScroll' ) ;
let paywall _overlay = document . querySelector ( 'div#graphics-paywall-overlay' ) ;
let banner = document . getElementById ( 'paywall-banner' ) ;
removeDOMElement ( banner , paywall _overlay ) ;
}
else if ( matchDomain ( 'bloombergquint.com' ) ) {
let articlesLeftModal = document . querySelector ( '.paywall-meter-module__story-paywall-container__1UgCE' ) ;
let paywall = document . getElementById ( 'paywallDmp' ) ;
removeDOMElement ( articlesLeftModal , paywall ) ;
}
else if ( matchDomain ( 'business-standard.com' ) ) {
document . addEventListener ( 'DOMContentLoaded' , ( ) => {
let skip _button = document . querySelector ( 'a.btn_skip' ) ;
if ( skip _button )
skip _button . click ( ) ;
let paywall = document . querySelector ( 'div.sbc_panel' ) ;
if ( paywall ) {
removeDOMElement ( paywall . parentElement ) ;
let scripts = document . querySelectorAll ( 'script[type="application/ld+json"]' ) ;
let json ;
for ( let script of scripts ) {
if ( script . innerText . includes ( 'articleBody' ) )
json = script ;
}
if ( json ) {
let json _text = JSON . parse ( json . text . replace ( /(\r\n|\n|\r|\t)/gm , '' ) ) [ 0 ] . articleBody ;
json _text = parseHtmlEntities ( json _text ) ;
json _text = json _text . replace ( /(?:^|[\w\"\'\’ ])(\.|\?|!)(?=[A-Z\"\”\“\‘ \’ \'][A-Za-zÀ-ÿ\"\”\“\‘ \’ \']{1,})/gm , "$&</br></br>" ) + '</br></br>' ;
let parser = new DOMParser ( ) ;
let html = parser . parseFromString ( '<div>' + json _text + '</div>' , 'text/html' ) ;
let article = html . querySelector ( 'div' ) ;
if ( article ) {
let p _content = document . querySelector ( 'span.p-content.paywall' ) ;
if ( p _content ) {
let old _pars = p _content . querySelectorAll ( 'p' ) ;
for ( let old _par of old _pars ) {
if ( ! old _par . querySelector ( 'img' ) )
removeDOMElement ( old _par ) ;
}
p _content . appendChild ( article ) ;
}
}
}
2020-12-24 13:30:55 +01:00
}
2021-04-10 08:46:50 +02:00
} ) ;
2020-12-24 13:30:55 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'caixinglobal.com' ) ) {
window . setTimeout ( function ( ) {
let pay _tips = document . querySelectorAll ( '.cons-pay-tip' ) ;
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 )
hidden _par . setAttribute ( 'style' , 'display:block;' ) ;
2020-12-29 16:34:05 +01:00
}
2021-04-10 08:46:50 +02:00
let app _exclusive _tip = document . querySelector ( '.app-exclusive-tip' ) ;
removeDOMElement ( app _exclusive _tip ) ;
} , 500 ) ; // Delay (in milliseconds)
2020-12-29 16:34:05 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( ca _torstar _domains ) ) {
window . setTimeout ( function ( ) {
let meter _banner = document . querySelector ( '.c-article-meter-banner' ) ;
let ads = document . querySelectorAll ( '.seo-media-query, .c-googleadslot' ) ;
removeDOMElement ( meter _banner , ... ads ) ;
let end _of _article = document . querySelector ( '#end-of-article' ) ;
if ( end _of _article )
end _of _article . setAttribute ( 'style' , 'display:none;' ) ;
let rightrail = document . querySelector ( '.c-article-body__rightrail' ) ;
if ( rightrail )
rightrail . setAttribute ( 'style' , 'display:none;' ) ;
} , 500 ) ;
}
else if ( matchDomain ( 'cen.acs.org' ) ) {
document . addEventListener ( 'DOMContentLoaded' , ( ) => {
let meteredBar = document . querySelector ( '.meteredBar' ) ;
removeDOMElement ( meteredBar ) ;
} ) ;
}
2021-05-18 17:12:15 +02:00
else if ( matchDomain ( 'chicagobusiness.com' ) ) {
let body _hidden = document . querySelector ( 'body[class]' ) ;
if ( body _hidden )
body _hidden . removeAttribute ( 'class' ) ;
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'discovermagazine.com' ) ) {
window . setTimeout ( function ( ) {
let mammoth = document . querySelector ( '.iXVGnF' ) ;
if ( mammoth )
window . location . reload ( ) ;
let banner = document . querySelector ( 'div.hWOjDZ, div.qa7yll-1' ) ;
if ( banner )
banner . setAttribute ( 'style' , 'display:none;' ) ;
} , 1000 ) ; // Delay (in milliseconds)
}
2021-05-21 08:04:59 +02:00
else if ( matchDomain ( 'economictimes.com' ) ) {
window . setTimeout ( function ( ) {
let paywall = document . querySelector ( 'div#blocker_layer' ) ;
let data _prime = document . querySelector ( 'div[data-prime="1"]' ) ;
if ( paywall || data _prime ) {
removeDOMElement ( paywall ) ;
if ( data _prime )
data _prime . removeAttribute ( 'data-prime' ) ;
let content = document . querySelector ( 'div[id^="articlebody_"]' ) ;
if ( content && content . classList . contains ( 'paywall' ) ) {
content . classList . remove ( 'paywall' ) ;
window . location . reload ( true ) ;
}
let full _text = document . querySelector ( 'div.paywall:not([id])' ) ;
if ( content && full _text ) {
content . innerText = '' ;
let parser = new DOMParser ( ) ;
html = parser . parseFromString ( '<div>' + full _text . innerHTML + '</div>' , 'text/html' ) ;
let article = html . querySelector ( 'div' ) ;
content . appendChild ( article ) ;
removeDOMElement ( full _text ) ;
let data _adaptive = document . querySelector ( 'div[data-adaptive="1"]' ) ;
if ( data _adaptive )
data _adaptive . removeAttribute ( 'data-adaptive' ) ;
let prime _banner = document . querySelector ( 'div.q0AQz' ) ;
removeDOMElement ( prime _banner ) ;
}
}
} , 500 ) ; // Delay (in milliseconds)
}
2021-05-03 22:13:22 +02:00
else if ( matchDomain ( 'economictimes.indiatimes.com' ) ) {
let paywall = document . querySelector ( 'section.prime_paywall' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let content = document . querySelector ( 'div.content1, div.artText' ) ;
let full _text = document . querySelector ( 'div.paywall.p1' ) ;
if ( content && full _text )
content . innerText = full _text . innerText ;
2021-05-21 08:04:59 +02:00
let page _content = document . querySelector ( 'div.pageContent:not([style]' ) ;
if ( page _content )
page _content . setAttribute ( 'style' , 'height: auto !important;' ) ;
2021-05-03 22:13:22 +02:00
}
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'economist.com' ) ) {
document . addEventListener ( 'DOMContentLoaded' , ( ) => {
let subscribe = document . querySelector ( '.subscription-proposition' ) ;
let wrapper = document . getElementById ( 'bottom-page-wrapper' ) ;
removeDOMElement ( subscribe , wrapper ) ;
let adverts = document . querySelectorAll ( 'div.advert' ) ;
for ( let advert of adverts )
advert . setAttribute ( 'style' , 'display:none' ) ;
window . setTimeout ( function ( ) {
let paywall = document . querySelector ( '.layout-article-regwall' ) ; ;
if ( paywall ) {
window . location . reload ( true ) ;
}
} , 600 ) ; // Delay (in milliseconds)
let p _articles = document . querySelectorAll ( 'p.article__body-text' ) ;
var href ;
for ( let p _article of p _articles ) {
let e _anchors = document . querySelectorAll ( 'a' ) ;
href = '' ;
for ( let e _anchor of e _anchors ) {
if ( e _anchor . href ) {
href = e _anchor . href ;
} else {
e _anchor . href = href ;
2021-01-11 21:00:41 +01:00
}
2021-04-10 08:46:50 +02:00
}
2021-01-11 21:00:41 +01:00
}
2021-04-10 08:46:50 +02:00
} ) ;
2021-01-11 21:00:41 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'entrepreneur.com' ) ) {
let promo = document . querySelector ( '.paywall-promo' ) ;
if ( promo ) {
removeDOMElement ( promo ) ;
let gate _check = document . querySelector ( '.gate-check' ) ;
if ( gate _check )
gate _check . removeAttribute ( 'class' ) ;
let hidden _images = document . querySelectorAll ( 'img.lazy[src*="blur"][data-src]' ) ;
for ( let hidden _image of hidden _images )
hidden _image . setAttribute ( 'src' , hidden _image . getAttribute ( 'data-src' ) ) ;
}
}
else if ( matchDomain ( 'firstthings.com' ) ) {
let paywall = document . querySelector ( '.paywall' ) ;
removeDOMElement ( paywall ) ;
}
else if ( matchDomain ( 'foreignaffairs.com' ) ) {
let paywall = document . querySelector ( '.paywall' ) ;
let loading _indicator = document . querySelector ( '.loading-indicator' ) ;
let msg _bottom = document . querySelector ( '.messages--container--bottom' ) ;
removeDOMElement ( paywall , loading _indicator , msg _bottom ) ;
let article _dropcap = document . querySelectorAll ( '.article-dropcap' ) ;
for ( let elem of article _dropcap )
elem . classList . add ( 'loaded' ) ;
let hidden _images = document . querySelectorAll ( 'img[src^="data:image/"]' ) ;
for ( let hidden _image of hidden _images ) {
var data _src = hidden _image . getAttribute ( 'data-src' ) ;
if ( data _src ) {
hidden _image . setAttribute ( 'src' , data _src ) ;
hidden _image . removeAttribute ( 'class' ) ;
}
}
let img _list = document . querySelectorAll ( '.magazine-list-article img' ) ;
for ( let img _elem of img _list )
img _elem . setAttribute ( 'class' , 'mb-4' ) ;
if ( window . location . href . includes ( '/interviews/' ) ) {
let img _header = document . querySelector ( '.interview-header > div' ) ;
if ( img _header ) {
let img _src = img _header . getAttribute ( 'data-src' ) ;
let img _elem = document . createElement ( 'img' ) ;
img _elem . src = img _src ;
img _header . appendChild ( img _elem ) ;
}
}
2021-01-09 17:45:21 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'foreignpolicy.com' ) ) {
let placeholder = document . querySelector ( 'div.loading-placeholder-smaller' ) ;
removeDOMElement ( placeholder ) ;
let sub _content = document . querySelector ( 'div.sub_content:not(style)' ) ;
if ( sub _content )
sub _content . setAttribute ( 'style' , 'display:block !important;' ) ;
2020-12-31 09:45:01 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'ft.com' ) ) {
let cookie _banner = document . querySelector ( '.o-banner__outer' ) ;
let ribbon = document . querySelector ( '.js-article-ribbon' ) ;
let ads = document . querySelector ( '.o-ads' ) ;
removeDOMElement ( cookie _banner , ribbon , ads ) ;
2021-01-16 10:58:06 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'griffithreview.com' ) ) {
let body _single = document . querySelector ( 'body.single' ) ;
if ( body _single )
body _single . classList . remove ( 'single' ) ;
let subscribe = document . querySelector ( 'div.call-to-action' ) ;
removeDOMElement ( subscribe ) ;
2021-01-19 18:46:06 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'harpers.org' ) ) {
let overlay = document . querySelector ( 'div[id^="pum-"]' ) ;
removeDOMElement ( overlay ) ;
let entry _content = document . querySelectorAll ( '.entry-content' ) ;
for ( let elem of entry _content )
elem . setAttribute ( 'style' , 'display: block !important' ) ;
2021-01-18 20:12:02 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'hbr.org' ) ) {
let popup = document . querySelector ( '.persistent-banner' ) ;
removeDOMElement ( popup ) ;
2021-01-20 20:26:35 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'historyextra.com' ) ) {
let article _masked = document . querySelector ( '.template-article__masked' ) ;
if ( article _masked ) {
let extra _pars = document . querySelectorAll ( 'div.template-article__masked > p' ) ;
removeDOMElement ( ... extra _pars ) ;
article _masked . classList . remove ( 'template-article__masked' ) ;
}
let ad _banner = document . querySelector ( '.ad-banner-container' ) ;
removeDOMElement ( ad _banner ) ;
2021-01-22 13:58:54 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'inkl.com' ) ) {
document . addEventListener ( 'DOMContentLoaded' , ( ) => {
let menu _btn = document . querySelector ( 'div.left-buttons-container button.menu-btn' ) ;
if ( ! menu _btn ) {
let article _container = document . querySelector ( 'div.article-content-container' ) ;
if ( article _container )
article _container . setAttribute ( 'style' , 'overflow: visible; max-height: none;' ) ;
let gradient _container = document . querySelector ( 'div.gradient-container' ) ;
if ( gradient _container )
gradient _container . setAttribute ( 'style' , 'height:auto;' ) ;
}
let what _is _inkl = document . querySelector ( '.what-is-inkl-container' ) ;
let signup = document . querySelector ( '.article-signup-container' ) ;
removeDOMElement ( what _is _inkl , signup ) ;
} ) ;
let dismiss _button = document . querySelector ( 'div.dismiss-button-container button.btn' ) ;
if ( dismiss _button )
dismiss _button . click ( ) ;
let shared _banner = document . querySelector ( 'div.shared-article-inline-banner' ) ;
removeDOMElement ( shared _banner ) ;
let dive _deeper _summary _bodies = document . querySelectorAll ( 'div.dive-deeper-container div.summary-body' ) ;
if ( 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' ) ;
weblink . text = 'open' ;
weblink . href = 'https://www.inkl.com/news/' + ng _click ;
summary _body . appendChild ( weblink ) ;
}
}
}
2021-01-22 14:33:25 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'jpost.com' ) ) {
let premium _banners = document . querySelectorAll ( '.hide-for-premium, #hiddenPremiumForm, #hiddenLink' ) ;
removeDOMElement ( ... premium _banners ) ;
}
else if ( matchDomain ( 'magazine.atavist.com' ) ) {
let bottom _notification = document . querySelector ( 'div.bottom-notification' ) ;
let overlay = document . querySelector ( 'div.notification-overlay' ) ;
removeDOMElement ( bottom _notification , overlay ) ;
let paywall = document . querySelector ( 'body.paywall-notification-visible' ) ;
if ( paywall )
paywall . classList . remove ( 'paywall-notification-visible' ) ;
2021-01-23 18:13:24 +01:00
}
2021-01-24 10:25:55 +01:00
else if ( matchDomain ( 'marketwatch.com' ) ) {
2021-04-10 08:46:50 +02:00
let premium = document . querySelector ( 'html.is-paywall' ) ;
let url = window . location . href ;
if ( ! url . includes ( '/amp/' ) ) {
if ( premium ) {
premium . classList . remove ( 'is-paywall' ) ;
window . location . href = url . replace ( '.marketwatch.com/' , '.marketwatch.com/amp/' ) ;
}
} else {
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 ( 'mexiconewsdaily.com' ) ) {
window . setTimeout ( function ( ) {
let popup = document . querySelector ( 'div.pigeon-widget-prompt' ) ;
let cpro _overlay = document . querySelector ( '.cpro-overlay' ) ;
removeDOMElement ( popup , cpro _overlay ) ;
} , 500 ) ; // Delay (in milliseconds)
2021-01-24 10:25:55 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'nation.africa' ) ) {
let datawall _content = document . querySelector ( '.datawall-content' ) ;
if ( datawall _content )
datawall _content . classList . remove ( 'datawall-content' ) ;
let div _hidden = document . querySelectorAll ( '[data="datawall-content"]' ) ;
for ( let elem of div _hidden )
elem . removeAttribute ( 'style' ) ;
let hidden _images = document . querySelectorAll ( 'img.lazy-img:not([src])[data-srcset]' ) ;
for ( let hidden _image of hidden _images ) {
hidden _image . classList . remove ( 'lazy-img' ) ;
hidden _image . setAttribute ( 'src' , hidden _image . getAttribute ( 'data-srcset' ) . split ( ',' ) [ 1 ] . split ( ' ' ) [ 0 ] ) ;
}
2021-01-24 11:06:57 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'nationalgeographic.com' ) ) {
function natgeo _func ( node ) {
removeDOMElement ( node ) ;
let body = document . querySelector ( 'body[class]' ) ;
if ( body ) {
body . removeAttribute ( 'class' ) ;
body . removeAttribute ( 'style' ) ;
}
}
2021-05-04 20:14:56 +02:00
waitDOMElement ( 'div[id^="fittPortal"]' , 'DIV' , natgeo _func , false ) ;
csDone = true ;
2021-01-26 21:27:43 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'nationalreview.com' ) ) {
document . addEventListener ( 'DOMContentLoaded' , ( ) => {
2021-01-28 17:34:00 +01:00
let url = window . location . href ;
2021-04-10 08:46:50 +02:00
let article _truncated = document . querySelector ( 'div#article-content-truncate-wrap' ) ;
if ( article _truncated && ! url . includes ( '/amp/' ) ) {
article _truncated . removeAttribute ( 'id' ) ;
if ( url . includes ( '?' ) )
window . location . href = url . replace ( '?' , 'amp/?' ) ;
else
window . location . href = url + 'amp' ;
}
let adverts = document . querySelectorAll ( '.ad-unit--center' ) ;
removeDOMElement ( ... adverts ) ;
} ) ;
2021-01-28 17:34:00 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'newleftreview.org' ) ) {
let url = window . location . href ;
let paywall = document . querySelector ( 'div.promo-wrapper' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let url _cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url . split ( '//' ) [ 1 ] ;
replaceDomElementExt ( url _cache , true , false , 'div.article-page' , 'Failed to load from Google webcache: ' ) ;
}
}
else if ( matchDomain ( 'newstatesman.com' ) ) {
let tns _modal _wrapper = document . querySelector ( '.tns-modal-wrapper' ) ;
removeDOMElement ( tns _modal _wrapper ) ;
}
else if ( matchDomain ( 'newyorker.com' ) ) {
let paywall _bar = document . querySelector ( '.paywall-bar' ) ;
removeDOMElement ( paywall _bar ) ;
let invisible _assets = document . querySelectorAll ( '.responsive-asset--invisible' ) ;
for ( let asset _invisible of invisible _assets )
asset _invisible . classList . remove ( 'responsive-asset--invisible' ) ;
let overlays = document . querySelectorAll ( '.aspect-ratio--overlay-container, .asset-embed__asset-container' ) ;
let noscript ,
html ;
let parser = new DOMParser ( ) ;
for ( let overlay of overlays ) {
noscript = overlay . querySelector ( 'noscript' ) ;
if ( noscript ) {
html = parser . parseFromString ( noscript . innerHTML , 'text/html' ) ;
overlay . appendChild ( html . querySelector ( 'img' ) ) ;
removeDOMElement ( noscript ) ;
}
}
}
else if ( matchDomain ( 'nzherald.co.nz' ) ) {
let article _content = document . querySelector ( '.article__content' ) ;
if ( article _content ) {
let article _offer = document . querySelector ( '.article-offer' ) ;
if ( article _offer ) {
removeDOMElement ( article _offer ) ;
let css _selector = article _content . querySelectorAll ( 'p[style]' ) [ 1 ] . getAttribute ( 'class' ) ;
let hidden _not _pars = article _content . querySelectorAll ( '.' + css _selector + ':not(p)' ) ;
for ( let hidden _not _par of hidden _not _pars ) {
hidden _not _par . classList . remove ( css _selector ) ;
hidden _not _par . removeAttribute ( 'style' ) ;
}
let hidden _pars = article _content . querySelectorAll ( 'p.' + css _selector ) ;
let par _html ,
par _dom ;
let parser = new DOMParser ( ) ;
for ( let hidden _par of hidden _pars ) {
let par _html = parser . parseFromString ( '<div style="margin: 10px 0px; font-size: 17px">' + hidden _par . innerHTML + '</div>' , 'text/html' ) ;
let par _dom = par _html . querySelector ( 'div' ) ;
article _content . insertBefore ( par _dom , hidden _par ) ;
}
let first _span = document . querySelector ( 'p > span' ) ;
if ( first _span )
first _span . removeAttribute ( 'class' ) ;
}
}
let premium _toaster = document . querySelector ( '#premium-toaster' ) ;
removeDOMElement ( premium _toaster ) ;
}
else if ( matchDomain ( 'nybooks.com' ) ) {
let paywall _article = document . querySelector ( '.paywall-article' ) ;
if ( paywall _article )
paywall _article . classList . remove ( 'paywall-article' ) ;
let banner = document . querySelector ( 'div.toast-cta' ) ;
removeDOMElement ( banner ) ;
}
2021-04-16 19:45:11 +02:00
else if ( matchDomain ( 'nyteknik.se' ) ) {
let locked _article = document . querySelector ( 'div.locked-article' ) ;
if ( locked _article )
locked _article . classList . remove ( 'locked-article' ) ;
2021-04-19 18:27:36 +02:00
let hidden _images = document . querySelectorAll ( 'img[src=""][data-proxy-image]' ) ;
for ( let hidden _image of hidden _images )
hidden _image . setAttribute ( 'src' , hidden _image . getAttribute ( 'data-proxy-image' ) . replace ( '_320' , '_640' ) ) ;
2021-04-16 19:45:11 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'nytimes.com' ) ) {
function nyt _main ( ) {
navigator . storage . estimate = undefined ;
webkitRequestFileSystem = function ( ) { } ;
}
insert _script ( nyt _main ) ;
let preview _button = document . querySelector ( '.css-3s1ce0' ) ;
if ( preview _button )
preview _button . click ( ) ;
if ( window . location . hostname === 'cooking.nytimes.com' ) {
let no _scroll = document . querySelectorAll ( '.nytc---modal-window---noScroll' ) ;
for ( let elem of no _scroll )
elem . classList . remove ( 'nytc---modal-window---noScroll' ) ;
let login = document . querySelector ( '.nytc---modal-window---isShown' ) ;
if ( login ) {
let close _button = login . querySelector ( 'span[aria-label="close"]' ) ;
if ( ! close _button )
login . classList . remove ( 'nytc---modal-window---isShown' ) ;
}
2021-04-25 13:45:36 +02:00
} else {
waitDOMElement ( 'div[data-testid="inline-message"]' , 'DIV' , removeDOMElement , false ) ;
waitDOMElement ( 'div.expanded-dock' , 'DIV' , removeDOMElement , false ) ;
2021-04-10 08:46:50 +02:00
csDone = true ;
2021-04-25 13:45:36 +02:00
}
2021-01-30 12:55:39 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'qz.com' ) ) {
window . setTimeout ( function ( ) {
let url = window . location . href ;
if ( url . includes ( 'utm_source=' ) )
window . location . href = url . split ( '?' ) [ 0 ] ;
} , 500 ) ; // Delay (in milliseconds)
2021-01-30 19:18:00 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'republic.ru' ) ) {
let paywall = document . querySelector ( '.paywall-section' ) ;
removeDOMElement ( paywall ) ;
2021-02-02 19:17:45 +01:00
}
2021-05-10 18:12:59 +02:00
else if ( matchDomain ( 'scmp.com' ) && window . location . href . includes ( '/amp.' ) ) {
let div _hidden _all = document . querySelectorAll ( 'div.article-body[amp-access][amp-access-hide]' ) ;
for ( let div _hidden of div _hidden _all )
div _hidden . removeAttribute ( 'amp-access-hide' ) ;
let default _meters = document . querySelectorAll ( 'div.default-meter, div#archive-article-meter' ) ;
let adverts = document . querySelectorAll ( 'amp-ad, div.ad-banner, div.advert-fly-carpet-container, div.inline-advert' ) ;
removeDOMElement ( ... default _meters , ... adverts ) ;
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'scribd.com' ) ) {
let blurred _pages = document . querySelectorAll ( '.blurred_page' ) ;
for ( let blurred _page of blurred _pages ) {
blurred _page . classList . remove ( 'blurred_page' ) ;
}
let portal = document . querySelector ( '.between_page_portal_root' ) ;
let page _module = document . querySelector ( '.between_page_module' ) ;
let promo = document . querySelector ( '.auto__doc_page_webpack_doc_page_body_static_promo_study' ) ;
let ad = document . querySelector ( '.auto__explain_scribd_v2_advertisement' ) ;
removeDOMElement ( portal , page _module , promo , ad ) ;
2021-01-31 10:54:06 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'seekingalpha.com' ) ) {
let url = window . location . href ;
let locked = document . querySelector ( 'div[data-test-id="post-locked-banner"]' ) ;
if ( locked && ! url . includes ( '/amp/' ) ) {
window . setTimeout ( function ( ) {
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 ( '[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 ) ;
}
2021-02-05 14:57:27 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'slader.com' ) ) {
window . setTimeout ( function ( ) {
let paywall = document . querySelector ( '.Paywall' ) ;
let paywall _footer = document . querySelector ( '.Paywall__footer-counter' ) ;
removeDOMElement ( paywall , paywall _footer ) ;
let blur = document . querySelector ( 'section.Paywall__blur' ) ;
if ( blur )
blur . classList . remove ( 'Paywall__blur' ) ;
} , 500 ) ; // Delay (in milliseconds)
2021-02-10 19:18:29 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'slate.com' ) ) {
let slate _roadblock = document . querySelector ( '.slate-roadblock' ) ;
let ads = document . querySelectorAll ( 'section[class*="-ad"]' ) ;
removeDOMElement ( slate _roadblock , ... ads ) ;
2021-02-13 17:46:39 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'sofrep.com' ) ) {
let banners = document . querySelectorAll ( '#scrollerCTA, #botCta' ) ;
removeDOMElement ( ... banners ) ;
2021-02-13 18:11:58 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'startribune.com' ) ) {
document . addEventListener ( 'DOMContentLoaded' , ( ) => {
let react _modal _portal = document . querySelectorAll ( 'div.ReactModalPortal' ) ;
removeDOMElement ( ... react _modal _portal ) ;
let body _modal = document . querySelector ( 'body.ReactModal__Body--open' ) ;
if ( body _modal )
body _modal . classList . remove ( 'ReactModal__Body--open' ) ;
} ) ;
2021-02-18 19:47:12 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'stocknews.com' ) ) {
let hideme = document . querySelector ( 'div#hideme' ) ;
removeDOMElement ( hideme ) ;
let blurmes = document . querySelectorAll ( 'div[id^="blurme"]' ) ;
for ( let i = 0 ; i < blurmes . length ; i ++ )
blurmes [ i ] . setAttribute ( 'id' , 'blurmenot' + i ) ;
2021-02-27 14:20:30 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'stratfor.com' ) ) {
let banner = document . querySelector ( '.free-cta-container' ) ;
removeDOMElement ( banner ) ;
let hidden _images = document . querySelectorAll ( 'img[src^="data:image/gif"][data-src]' ) ;
for ( let hidden _image of hidden _images )
hidden _image . setAttribute ( 'src' , hidden _image . getAttribute ( 'data-src' ) ) ;
}
else if ( matchDomain ( 'techinasia.com' ) ) {
let paywall = document . querySelector ( '.paywall-content' ) ;
2021-05-02 16:14:45 +02:00
if ( paywall ) {
2021-04-10 08:46:50 +02:00
paywall . classList . remove ( 'paywall-content' ) ;
2021-05-02 16:14:45 +02:00
let url = window . location . href ;
let url _xhr = url . replace ( '.com/' , '.com/wp-json/techinasia/2.0/posts/' ) ;
fetch ( url _xhr )
. then ( response => {
if ( response . ok ) {
response . json ( ) . then ( json => {
let json _text = json . posts [ 0 ] . content ;
let content = document . querySelector ( 'div.content' ) ;
if ( json _text && content ) {
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( '<div class="jsx-1794864983 content">' + json _text + '</div>' , 'text/html' ) ;
let content _new = doc . querySelector ( 'div.content' ) ;
content . parentNode . replaceChild ( content _new , content ) ;
}
} ) ;
}
} ) ;
}
2021-04-10 08:46:50 +02:00
let splash _subscribe = document . querySelector ( '.splash-subscribe' ) ;
let paywall _hard = document . querySelector ( '.paywall-hard' ) ;
removeDOMElement ( splash _subscribe , paywall _hard ) ;
}
else if ( matchDomain ( 'technologyreview.com' ) ) {
window . setTimeout ( function ( ) {
let body _obscured = document . querySelector ( 'body[class*="body__obscureContent"]' ) ;
if ( body _obscured )
removeClassesByPrefix ( body _obscured , 'body__obscureContent' ) ;
let overlay = document . querySelector ( 'div[class*="overlayFooter__wrapper"]' ) ;
if ( overlay )
overlay . setAttribute ( 'style' , 'display:none' ) ;
let content _body _hidden = document . querySelector ( 'div[class*="contentBody__contentHidden"]' ) ;
if ( content _body _hidden )
removeClassesByPrefix ( content _body _hidden , 'contentBody__contentHidden' ) ;
let content _body _overlay = document . querySelector ( 'div[class*="contentBody__overlay"]' ) ;
if ( content _body _overlay )
content _body _overlay . removeAttribute ( 'class' ) ;
} , 500 ) ;
}
else if ( matchDomain ( 'the-american-interest.com' ) ) {
let counter = document . getElementById ( 'article-counter' ) ;
removeDOMElement ( counter ) ;
2021-03-01 18:04:43 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'theatlantic.com' ) ) {
let banner = document . querySelector ( '.c-nudge__container,.c-non-metered-nudge' ) ;
removeDOMElement ( banner ) ;
2021-03-07 14:03:22 +01:00
}
2021-04-14 18:43:07 +02:00
else if ( matchDomain ( 'thediplomat.com' ) ) {
let preview = document . querySelector ( '.dpl-preview' ) ;
if ( preview )
preview . classList . remove ( 'dpl-preview' ) ;
}
2021-04-10 08:46:50 +02:00
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 ) {
if ( window . tgam )
window . tgam . keytar . subscriberPaywallEnabled = false ;
} )
}
insert _script ( tgam _main ) ;
document . dispatchEvent ( new CustomEvent ( 'bpc_event' , { } ) ) ;
}
else if ( matchDomain ( [ 'thehindu.com' , 'thehindubusinessline.com' ] ) ) {
if ( ! localStorage . geo ) {
localStorage . setItem ( "geo" , '{"v":{"clientTcpRtt":20,"longitude":"' + makeRandomNumber ( 2 ) + '.' + makeRandomNumber ( 5 ) + '","httpProtocol":"HTTP/2","tlsCipher":"AEAD-AES128-GCM-SHA256","continent":"EU","asn":1234,"clientAcceptEncoding":"gzip, deflate,br","country":"UK","isEUCountry":"1","tlsClientAuth":{"certIssuerDNLegacy":"","certIssuerDN":"","certIssuerDNRFC2253":"","certSubjectDNLegacy":"","certVerified":"NONE","certNotAfter":"","certSubjectDN":"","certFingerprintSHA1":"","certNotBefore":"","certSerial":"","certPresented":"0","certSubjectDNRFC2253":""},"tlsVersion":"TLSv1.3","colo":"DUS","timezone":"Europe/London","edgeRequestKeepAliveStatus":1,"requestPriority":"weight=220;exclusive=1","botManagement":{"staticResource":false,"verifiedBot":false,"score":99},"clientTrustScore":99,"postalCode":"' + makeRandomNumber ( 4 ) + '","regionCode":"QR","region":"County","city":"London","latitude":"' + makeRandomNumber ( 2 ) + '.' + makeRandomNumber ( 5 ) + '"},"e":' + makeRandomNumber ( 13 ) + '}' ) ;
}
let counter = document . querySelector ( '#test' ) ;
removeDOMElement ( counter ) ;
function hindu _main ( ) {
document . addEventListener ( 'bpc_event' , function ( e ) {
if ( window ) {
window . Adblock = false ;
window . isNonSubcribed = false ;
}
} )
}
insert _script ( hindu _main ) ;
document . dispatchEvent ( new CustomEvent ( 'bpc_event' , { } ) ) ;
2021-03-13 15:58:27 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'thelogic.co' ) ) {
let article _subscribe = document . querySelector ( '.article-subscribe' ) ;
removeDOMElement ( article _subscribe ) ;
2021-03-13 16:49:58 +01:00
}
2021-04-28 09:14:47 +02:00
else if ( matchDomain ( 'thenewatlantis.com' ) ) {
let article _gated = document . querySelector ( '.article-gated' ) ;
if ( article _gated )
article _gated . classList . remove ( 'article-gated' ) ;
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'thepointmag.com' ) ) {
let overlay = document . querySelectorAll ( 'div.overlay, div#tpopup-' ) ;
for ( let elem of overlay )
removeDOMElement ( elem ) ;
2021-03-16 18:10:55 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'time.com' ) ) {
let body = document . querySelector ( 'body' ) ;
if ( body )
body . setAttribute ( 'style' , 'position:relative !important;' ) ;
2021-03-16 18:10:55 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'timeshighereducation.com' ) ) {
let paywall _cta = document . querySelector ( 'div.paywall-cta' ) ;
if ( paywall _cta ) {
paywall _cta . removeAttribute ( 'style' ) ;
let hidden _divs = document . querySelectorAll ( 'div[style="display: none;"]' ) ;
for ( let hidden _div of hidden _divs )
hidden _div . removeAttribute ( 'style' ) ;
let paywall _fade = document . querySelector ( 'div.paywall-fade' ) ;
if ( paywall _fade )
paywall _fade . classList . remove ( 'paywall-fade' ) ;
}
2021-03-20 17:16:30 +01:00
}
2021-05-06 19:50:12 +02:00
else if ( matchDomain ( 'usatoday.com' ) ) {
let roadblock = document . querySelector ( '.roadblock-container' ) ;
if ( roadblock ) {
removeDOMElement ( roadblock ) ;
article _next = document . querySelector ( 'article.next-in-depth-story > div.article-inner' ) ;
if ( article _next ) {
let url = article _next . getAttribute ( 'data-url' ) ;
let weblink = document . createElement ( 'a' ) ;
weblink . href = url ;
weblink . innerText = 'open next in-depth story' ;
article _next . appendChild ( weblink ) ;
}
}
}
2021-04-10 09:49:45 +02:00
else if ( matchDomain ( 'velonews.com' ) ) {
let paywall = document . querySelector ( 'div.o-membership-overlay' ) ;
if ( paywall ) {
let js _gated = document . querySelector ( 'div.js-gated' ) ;
if ( js _gated )
js _gated . classList . remove ( 'js-gated' ) ;
removeDOMElement ( paywall ) ;
}
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'venturebeat.com' ) ) {
window . setTimeout ( function ( ) {
let paywall = document . querySelector ( 'div.paywall' ) ;
if ( paywall )
paywall . classList . remove ( 'paywall' ) ;
} , 500 ) ; // Delay (in milliseconds)
}
else if ( matchDomain ( 'washingtonpost.com' ) ) {
let leaderboard = document . querySelector ( '#leaderboard-wrapper' ) ;
let adverts = document . querySelectorAll ( 'div[data-qa="article-body-ad"]' ) ;
removeDOMElement ( leaderboard , ... adverts ) ;
if ( location . href . includes ( '/gdpr-consent/' ) ) {
let free _button = document . querySelector ( '.gdpr-consent-container .continue-btn.button.free' ) ;
if ( free _button )
free _button . click ( ) ;
window . setTimeout ( function ( ) {
let gdprcheckbox = document . querySelector ( '.gdpr-consent-container .consent-page:not(.hide) #agree' ) ;
if ( gdprcheckbox ) {
gdprcheckbox . checked = true ;
gdprcheckbox . dispatchEvent ( new Event ( 'change' ) ) ;
document . querySelector ( '.gdpr-consent-container .consent-page:not(.hide) .continue-btn.button.accept-consent' ) . click ( ) ;
}
} , 300 ) ; // Delay (in milliseconds)
} else if ( adverts || leaderboard )
csDone = true ;
2021-04-05 19:56:50 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'wsj.com' ) && ! matchDomain ( 'cn.wsj.com' ) ) {
if ( location . href . includes ( '/articles/' ) ) {
let close _button = document . querySelector ( 'div.close-btn[role="button"]' ) ;
if ( close _button )
close _button . click ( ) ;
}
let wsj _ads = document . querySelectorAll ( 'div.wsj-ad' ) ;
removeDOMElement ( ... wsj _ads ) ;
document . addEventListener ( 'DOMContentLoaded' , ( ) => {
let url = window . location . href ;
let snippet = document . querySelector ( '.snippet-promotion' ) ;
let wsj _pro = document . querySelector ( 'meta[name="page.site"][content="wsjpro"]' ) ;
if ( snippet || wsj _pro ) {
window . location . href = url . replace ( 'wsj.com' , 'wsj.com/amp' ) ;
2021-04-07 22:24:53 +02:00
}
2021-04-10 08:46:50 +02:00
} ) ;
2021-04-07 22:24:53 +02:00
}
2021-03-27 11:53:38 +01:00
else if ( ( domain = matchDomain ( usa _mcc _domains ) ) || document . querySelector ( 'script[src^="https://media.mcclatchyinteractive.com/"]' ) || window . location . href . match ( /\/\/amp\..+\.com\/(.+\/)?article(\d){8,}\.html/ ) ) {
2021-04-10 08:46:50 +02:00
if ( ! domain )
domain = document . domain . replace ( /(account|amp)\./ , '' ) ;
let url = window . location . href ;
if ( url . includes ( 'account.' + domain + '/paywall/' ) ) {
window . setTimeout ( function ( ) {
window . location . href = 'https://amp.' + domain + '/article' + url . split ( 'resume=' ) [ 1 ] . split ( '#' ) [ 0 ] + '.html' ;
} , 500 ) ; // Delay (in milliseconds)
} else if ( url . includes ( 'amp.' + domain + '/' ) ) {
let subscr _sections = document . querySelectorAll ( 'div[subscriptions-section="content"]' ) ;
for ( let subscr _section of subscr _sections ) {
subscr _section . removeAttribute ( 'subscriptions-section' ) ;
2021-03-27 11:53:38 +01:00
}
2021-04-10 08:46:50 +02:00
let subscr _tag = document . querySelector ( 'div#subscriber-exclusive-tag' ) ;
let amp _players = document . querySelectorAll ( 'amp-connatix-player' ) ;
removeDOMElement ( subscr _tag , ... amp _players ) ;
}
let premium _svgs = document . querySelectorAll ( 'h3 > a > svg' ) ;
let premium _link ;
for ( let premium _svg of premium _svgs ) {
premium _link = premium _svg . parentElement ;
if ( premium _link . href . includes ( 'www.' ) )
premium _link . href = premium _link . href . replace ( 'www.' , 'amp.' ) ;
}
2021-03-27 11:53:38 +01:00
}
2021-04-10 08:46:50 +02:00
else
csDone = true ;
}
2021-04-25 13:45:36 +02:00
if ( csDone ) {
addDivBpcDone ( ) ;
2021-04-10 08:46:50 +02:00
ext _api . runtime . sendMessage ( { csDone : true } ) ;
2021-04-25 13:45:36 +02:00
}
2020-12-04 16:14:23 +01:00
2021-04-07 22:24:53 +02:00
} // end div_bpc_done
2020-01-28 23:06:25 +01:00
// General Functions
2019-11-23 05:53:56 +01:00
function removeDOMElement ( ... elements ) {
2021-04-10 08:46:50 +02:00
for ( let element of elements ) {
if ( element )
element . remove ( ) ;
}
2019-10-06 19:28:18 +02:00
}
2019-10-08 17:41:09 +02:00
2021-04-07 22:24:53 +02:00
function waitDOMElement ( selector , tagName = '' , callback , multiple = false ) {
2021-04-10 08:46:50 +02:00
new window . MutationObserver ( function ( mutations ) {
for ( let mutation of mutations ) {
for ( let node of mutation . addedNodes ) {
if ( ! tagName || ( node . tagName === tagName ) ) {
if ( node . matches ( selector ) ) {
callback ( node ) ;
if ( ! multiple )
this . disconnect ( ) ;
}
2021-04-07 22:24:53 +02:00
}
2021-04-10 08:46:50 +02:00
}
}
} ) . observe ( document , {
subtree : true ,
childList : true
} ) ;
2021-04-07 22:24:53 +02:00
}
function addDivBpcDone ( ) {
2021-04-10 08:46:50 +02:00
let div _bpc _new = document . createElement ( 'div' ) ;
div _bpc _new . setAttribute ( 'id' , 'bpc_done' ) ;
div _bpc _new . setAttribute ( 'style' , 'display: none;' ) ;
let insertAfter = ( document . body || document . head || document . documentElement ) ;
insertAfter . appendChild ( div _bpc _new ) ;
2021-04-07 22:24:53 +02:00
}
2020-05-01 12:58:36 +02:00
function matchDomain ( domains , hostname ) {
2021-04-10 08:46:50 +02:00
var matched _domain = false ;
if ( ! hostname )
hostname = window . location . hostname ;
if ( typeof domains === 'string' )
domains = [ domains ] ;
domains . some ( domain => ( hostname === domain || hostname . endsWith ( '.' + domain ) ) && ( matched _domain = domain ) ) ;
return matched _domain ;
2020-03-27 21:13:28 +01:00
}
2021-01-16 10:58:06 +01:00
function replaceDomElementExt ( url , proxy , base64 , selector , text _fail = '' ) {
2021-04-23 09:04:09 +02:00
let proxyurl = proxy ? 'https://bpc2-cors-anywhere.herokuapp.com/' : '' ;
2021-04-10 08:46:50 +02:00
fetch ( proxyurl + url , { headers : { "Content-Type" : "text/plain" , "X-Requested-With" : "XMLHttpRequest" } } )
. then ( response => {
let article = document . querySelector ( selector ) ;
if ( response . ok ) {
response . text ( ) . then ( html => {
if ( base64 ) {
html = decode _utf8 ( atob ( html ) ) ;
selector = 'body' ;
2021-01-22 13:58:54 +01:00
}
2021-04-10 08:46:50 +02:00
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( html , 'text/html' ) ;
let article _new = doc . querySelector ( selector ) ;
if ( article _new ) {
if ( article )
article . parentNode . replaceChild ( article _new , article ) ;
}
} ) ;
} else if ( text _fail ) {
if ( article ) {
let text _fail _div = document . createElement ( 'div' ) ;
text _fail _div . appendChild ( document . createTextNode ( text _fail ) ) ;
if ( proxy ) {
let a _link = document . createElement ( 'a' ) ;
a _link . innerText = url ;
a _link . href = url ;
a _link . target = '_blank' ;
text _fail _div . appendChild ( a _link ) ;
2021-01-11 21:00:41 +01:00
}
2021-04-10 08:46:50 +02:00
article . insertBefore ( text _fail _div , article . firstChild ) ;
}
}
} ) ;
2021-01-11 21:00:41 +01:00
}
2019-11-23 05:53:56 +01:00
function removeClassesByPrefix ( el , prefix ) {
2021-04-10 08:46:50 +02:00
let el _classes = el . classList ;
for ( let el _class of el _classes ) {
if ( el _class . startsWith ( prefix ) )
el _classes . remove ( el _class ) ;
}
2019-11-21 03:19:36 +01:00
}
2019-11-11 01:37:41 +01:00
2020-06-08 16:44:46 +02:00
function cookieExists ( name ) {
2021-04-10 08:46:50 +02:00
return document . cookie . split ( ';' ) . some ( function ( item ) {
return item . trim ( ) . indexOf ( name + '=' ) === 0
} )
2020-06-08 16:44:46 +02:00
}
function setCookie ( name , value , domain , path , days ) {
2021-04-10 08:46:50 +02:00
var max _age = days * 24 * 60 * 60 ;
document . cookie = name + "=" + ( value || "" ) + "; domain=" + domain + "; path=" + path + "; max-age=" + max _age ;
2020-06-08 16:44:46 +02:00
}
2020-09-12 15:40:50 +02:00
function insert _script ( func , insertAfterDom ) {
2021-04-10 08:46:50 +02:00
let bpc _script = document . querySelector ( 'script#bpc_script' ) ;
if ( ! bpc _script ) {
let script = document . createElement ( 'script' ) ;
script . setAttribute ( 'id' , 'bpc_script' ) ;
script . appendChild ( document . createTextNode ( '(' + func + ')();' ) ) ;
let insertAfter = insertAfterDom ? insertAfterDom : ( document . body || document . head || document . documentElement ) ;
insertAfter . appendChild ( script ) ;
}
2020-07-15 18:45:37 +02:00
}
2020-05-29 15:34:02 +02:00
function genHexString ( len ) {
2021-04-10 08:46:50 +02:00
let output = '' ;
for ( let i = 0 ; i < len ; i ++ )
output += ( Math . floor ( Math . random ( ) * 16 ) ) . toString ( 16 ) ;
return output ;
2020-05-29 15:34:02 +02:00
}
2020-10-04 19:08:36 +02:00
function makeRandomNumber ( len ) {
2021-04-10 08:46:50 +02:00
let result = '' ;
var characters = '123456789' ;
var charactersLength = characters . length ;
for ( var i = 0 ; i < len ; i ++ )
result += characters . charAt ( Math . floor ( Math . random ( ) * charactersLength ) ) ;
return result ;
2020-10-04 19:08:36 +02:00
}
2020-01-28 23:06:25 +01:00
function pageContains ( selector , text ) {
2021-04-10 08:46:50 +02:00
let elements = document . querySelectorAll ( selector ) ;
return Array . prototype . filter . call ( elements , function ( element ) {
return RegExp ( text ) . test ( element . textContent ) ;
} ) ;
2020-01-28 23:06:25 +01:00
}
2020-07-04 13:33:25 +02:00
2020-08-17 23:04:51 +02:00
function parseHtmlEntities ( encodedString ) {
2021-04-10 08:46:50 +02:00
var translate _re = /&(nbsp|amp|quot|lt|gt|deg|hellip|laquo|raquo|ldquo|rdquo|lsquo|rsquo|mdash);/g ;
var translate = { "nbsp" : " " , "amp" : "&" , "quot" : "\"" , "lt" : "<" , "gt" : ">" , "deg" : "°" , "hellip" : "…" ,
"laquo" : "«" , "raquo" : "»" , "ldquo" : "“" , "rdquo" : "”" , "lsquo" : "‘ " , "rsquo" : "’ " , "mdash" : "—" } ;
return encodedString . replace ( translate _re , function ( match , entity ) {
return translate [ entity ] ;
} ) . replace ( /&#(\d+);/gi , function ( match , numStr ) {
var num = parseInt ( numStr , 10 ) ;
return String . fromCharCode ( num ) ;
} ) ;
2020-07-04 13:33:25 +02:00
}
2021-02-05 19:07:38 +01:00
function encode _utf8 ( str ) {
2021-04-10 08:46:50 +02:00
return unescape ( encodeURIComponent ( str ) ) ;
2021-02-05 19:07:38 +01:00
}
function decode _utf8 ( str ) {
2021-04-10 08:46:50 +02:00
return decodeURIComponent ( escape ( str ) ) ;
2021-02-05 19:07:38 +01:00
}