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 ;
2021-07-04 08:43:45 +02:00
var csDoneOnce = false ;
2021-10-22 12:36:47 +02:00
var dompurify _loaded = ( typeof DOMPurify === 'function' ) ;
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-09-24 16:09:54 +02:00
var es _epiberica _domains = [ 'diariodeibiza.es' , 'diariodemallorca.es' , 'eldia.es' , 'elperiodicomediterraneo.com' , 'farodevigo.es' , 'informacion.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' ] ;
2021-07-30 19:20:35 +02:00
var es _unidad _domains = [ 'elmundo.es' , 'expansion.com' , 'marca.com' ] ;
2021-07-31 10:29:47 +02:00
var fi _alma _talent _domains = [ 'arvopaperi.fi' , 'iltalehti.fi' , 'kauppalehti.fi' , 'marmai.fi' , 'mediuutiset.fi' , 'mikrobitti.fi' , 'talouselama.fi' , 'tekniikkatalous.fi' , 'tivi.fi' , 'uusisuomi.fi' ] ;
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-07-30 08:52:20 +02:00
var it _quotidiano _domains = [ 'ilgiorno.it' , 'ilrestodelcarlino.it' , 'iltelegrafolivorno.it' , 'lanazione.it' , 'quotidiano.net' ] ;
2021-06-20 21:41:11 +02:00
var nl _mediahuis _region _domains = [ 'gooieneemlander.nl' , 'haarlemsdagblad.nl' , 'ijmuidercourant.nl' , 'leidschdagblad.nl' , 'noordhollandsdagblad.nl' ] ;
2021-07-23 16:12:10 +02:00
var no _nhst _media _domains = [ 'intrafish.com' , 'rechargenews.com' , 'tradewindsnews.com' , 'upstreamonline.com' ] ;
2021-07-23 17:47:39 +02:00
var timesofindia _domains = [ 'timesofindia.com' , 'timesofindia.indiatimes.com' ] ;
2021-08-17 22:45:11 +02:00
var usa _craincomm _domains = [ 'adage.com' , 'autonews.com' , 'chicagobusiness.com' , 'crainscleveland.com' , 'crainsdetroit.com' , 'crainsnewyork.com' , 'modernhealthcare.com' ] ;
2021-07-08 20:55:11 +02:00
var usa _mcc _domains = [ 'bnd.com' , 'charlotteobserver.com' , 'fresnobee.com' , 'kansas.com' , 'kansascity.com' , 'kentucky.com' , 'miamiherald.com' , 'newsobserver.com' , 'sacbee.com' , 'star-telegram.com' , 'thestate.com' , 'tri-cityherald.com' ] ;
2021-08-16 22:49:58 +02:00
var usa _mng _domains = [ 'denverpost.com' , 'eastbaytimes.com' , 'mercurynews.com' , 'ocregister.com' , 'pe.com' , 'twincities.com' ] ;
2021-06-20 20:32:12 +02:00
var usa _tribune _domains = [ 'baltimoresun.com' , 'chicagotribune.com' , 'courant.com' , 'dailypress.com' , 'mcall.com' , 'nydailynews.com' , 'orlandosentinel.com' , 'pilotonline.com' , 'sun-sentinel.com' ] ;
2020-12-10 20:23:12 +01:00
// clean local storage of sites (with an exemption for hold-list)
2021-10-22 20:55:17 +02:00
var arr _localstorage _hold = [ 'augsburger-allgemeine.de' , 'charliehebdo.fr' , 'cmjornal.pt' , 'houstonchronicle.com' , 'inc42.com' , 'kurier.at' , 'nknews.org' , 'seekingalpha.com' , 'sfchronicle.com' , 'thehindu.com' , 'thetimes.co.uk' ] . concat ( de _funke _media _domains , es _grupo _vocento _domains , es _unidad _domains , no _nhst _media _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 ) {
2021-10-17 21:15:00 +02:00
var bg2csData ;
2021-10-17 15:16:44 +02:00
// check for opt-in confirmation (from background.js)
2021-10-17 21:15:00 +02:00
if ( ( bg2csData !== undefined ) && bg2csData . optin _setcookie ) {
2021-10-17 15:16:44 +02:00
if ( domain = matchDomain ( [ 'belfasttelegraph.co.uk' , 'independent.ie' ] ) ) {
if ( ! cookieExists ( 'subscriber' ) )
setCookie ( 'subscriber' , '{"subscriptionStatus": true}' , domain , '/' , 14 ) ;
}
2021-01-01 12:23:29 +01:00
}
2020-09-08 16:38:18 +02:00
2021-10-17 21:15:00 +02:00
// custom sites: try to unhide text on amp-page
if ( ( bg2csData !== undefined ) && bg2csData . amp _unhide ) {
window . setTimeout ( function ( ) {
let amp _page = document . querySelector ( 'script[src^="https://cdn.ampproject.org/"]' ) ;
if ( amp _page ) {
let preview = document . querySelector ( '[subscriptions-section="content-not-granted"]' ) ;
removeDOMElement ( preview ) ;
let subscr _section = document . querySelectorAll ( '[subscriptions-section="content"]' ) ;
for ( let elem of subscr _section )
elem . removeAttribute ( 'subscriptions-section' ) ;
}
let content _hidden = document . querySelectorAll ( '[amp-access][amp-access-hide]' ) ;
for ( elem of content _hidden )
elem . removeAttribute ( 'amp-access-hide' ) ;
let amp _ads = document . querySelectorAll ( 'amp-ad' ) ;
removeDOMElement ( ... amp _ads ) ;
} , 500 ) ; // Delay (in milliseconds)
}
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 ) ;
2021-08-22 17:42:56 +02:00
if ( paywall ) {
2021-06-09 21:32:35 +02:00
ext _api . runtime . sendMessage ( { request : 'refreshCurrentTab' } ) ;
2021-08-22 17:42:56 +02:00
csDoneOnce = true ;
}
2021-04-10 08:46:50 +02:00
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-05-29 08:00:38 +02:00
else if ( window . location . hostname . match ( /\.(com|net)\.au$/ ) ) { //australia
2020-09-10 22:01:35 +02:00
2021-05-29 08:00:38 +02:00
if ( matchDomain ( 'thesaturdaypaper.com.au' ) ) {
2021-04-10 08:46:50 +02:00
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 ;
2021-07-31 14:11:20 +02:00
let for _subscribers = document . querySelector ( 'meta[content^="FOR SUBSCRIBERS"], #paywall_prompt' ) ;
2021-04-10 08:46:50 +02:00
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
2021-05-22 19:54:49 +02:00
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' , 'thechronicle.com.au' , 'themercury.com.au' , 'townsvillebulletin.com.au' , 'weeklytimesnow.com.au' ] ;
if ( domain = matchDomain ( au _nc _sites ) ) {
2021-04-10 08:46:50 +02:00
let header _ads = document . querySelector ( '.header_ads-container' ) ;
removeDOMElement ( header _ads ) ;
if ( window . location . hostname . startsWith ( 'amp.' ) ) {
2021-09-04 11:23:58 +02:00
let div _hidden = document . querySelectorAll ( 'div[amp-access="access AND subscriber"][amp-access-hide]' ) ;
for ( let elem of div _hidden )
elem . removeAttribute ( 'amp-access-hide' ) ;
2021-04-10 08:46:50 +02:00
} else if ( window . location . href . includes ( '?amp' ) ) {
2021-09-04 11:23:58 +02:00
let div _hidden = document . querySelector ( 'div[amp-access="subscriber AND status=\'logged-in\'"][amp-access-hide]' ) ;
2021-04-10 08:46:50 +02:00
if ( div _hidden )
div _hidden . removeAttribute ( 'amp-access-hide' ) ;
}
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 ) ;
2021-06-29 19:59:15 +02:00
let par _elem , par _sub1 , par _sub2 ;
let par _dom = document . createElement ( 'div' ) ;
let tweet _id = 1 ;
2021-04-10 08:46:50 +02:00
for ( let par of json _content ) {
2021-06-29 19:59:15 +02:00
par _elem = '' ;
2021-04-10 08:46:50 +02:00
if ( par . kind === 'text' ) {
2021-06-29 19:59:15 +02:00
par _elem = document . createElement ( 'p' ) ;
par _elem . innerText = par . text ;
2021-04-10 08:46:50 +02:00
} else if ( par . kind === 'subhead' ) {
2021-06-29 19:59:15 +02:00
par _elem = document . createElement ( 'h2' ) ;
par _elem . innerText = par . text ;
2021-04-10 08:46:50 +02:00
} else if ( par . kind === 'pull-quote' ) {
2021-06-29 19:59:15 +02:00
par _elem = document . createElement ( 'i' ) ;
par _elem . innerText = ( par . attribution ? par . attribution + ': ' : '' ) + par . text ;
2021-04-10 08:46:50 +02:00
} else if ( par . kind === 'embed' ) {
if ( par . reference . includes ( 'https://omny.fm/' ) || par . reference . includes ( 'https://docdro.id/' ) ) {
2021-06-29 19:59:15 +02:00
par _elem = document . createElement ( 'embed' ) ;
par _elem . src = par . reference ;
par _elem . style = 'height:500px; width:100%' ;
par _elem . frameborder = '0' ;
2021-04-10 08:46:50 +02:00
} else {
2021-06-29 19:59:15 +02:00
par _elem = document . createElement ( 'a' ) ;
par _elem . href = par . reference ;
par _elem . innerText = par . reference . split ( '?' ) [ 0 ] ;
2021-04-10 08:46:50 +02:00
console . log ( 'embed: ' + par . reference ) ;
}
} else if ( par . kind === 'unordered-list' ) {
if ( par . items ) {
2021-06-29 19:59:15 +02:00
par _elem = document . createElement ( 'ul' ) ;
2021-04-10 08:46:50 +02:00
for ( let item of par . items )
2021-07-10 19:02:46 +02:00
if ( item . text ) {
2021-06-29 19:59:15 +02:00
par _sub1 = document . createElement ( 'li' ) ;
2021-07-10 19:02:46 +02:00
if ( item . intentions [ 0 ] && item . intentions [ 0 ] . href ) {
par _sub2 = document . createElement ( 'a' ) ;
par _sub2 . href = item . intentions [ 0 ] . href ;
} else {
par _sub2 = document . createElement ( 'span' ) ;
}
2021-06-29 19:59:15 +02:00
par _sub2 . innerText = item . text ;
par _sub1 . appendChild ( par _sub2 ) ;
par _elem . appendChild ( par _sub1 ) ;
2021-04-10 08:46:50 +02:00
}
}
} else if ( par . kind === 'inline' ) {
if ( par . asset . kind === 'image' ) {
2021-06-29 19:59:15 +02:00
par _elem = document . createElement ( 'figure' ) ;
par _sub1 = document . createElement ( 'img' ) ;
par _sub1 . src = par . asset . original . reference ;
par _sub1 . style = 'width:100%' ;
par _elem . appendChild ( par _sub1 ) ;
if ( par . asset . captionText ) {
par _sub2 = document . createElement ( 'figcaption' ) ;
par _sub2 . innerText = par . asset . captionText + ' ' + par . asset . copyrightByline +
( ( par . asset . copyrightCredit && par . asset . captionText !== par . asset . copyrightByline ) ? '/' + par . asset . copyrightCredit : '' ) ;
par _elem . appendChild ( par _sub2 ) ;
}
2021-04-10 08:46:50 +02:00
}
} else {
2021-06-29 19:59:15 +02:00
par _elem = document . createElement ( 'p' ) ;
par _elem . innerText = par . text ;
2021-04-10 08:46:50 +02:00
console . log ( par . kind ) ;
}
2021-06-29 19:59:15 +02:00
if ( par _elem )
par _dom . appendChild ( par _elem ) ;
2021-04-10 08:46:50 +02:00
}
let content = document . querySelector ( 'div[class*="StyledArticleContent"]' ) ;
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-08-31 18:22:53 +02:00
} else if ( window . location . hostname . match ( /\.(de|at|ch)$/ ) || matchDomain ( [ 'faz.net' , 'handelsblatt.com' ] ) ) { //germany/austria/switzerland - ch
2021-04-10 08:46:50 +02:00
2021-09-25 09:35:48 +02:00
if ( matchDomain ( 'aachener-zeitung.de' ) ) {
let url = window . location . href ;
if ( url . includes ( '?output=amp' ) ) {
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 ( 'amp-ad, amp-embed' ) ;
removeDOMElement ( ... amp _ads ) ;
} else {
let paywall = document . querySelector ( '.park-article-paywall, .text-blurred' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
}
}
else if ( matchDomain ( 'augsburger-allgemeine.de' ) ) {
2021-04-10 08:46:50 +02:00
let url = window . location . href ;
2021-06-28 08:51:33 +02:00
if ( ! url . includes ( '-amp.html' ) ) {
let paywall = document . querySelector ( 'div.aa-visible-logged-out' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
window . location . href = url . replace ( '.html' , '-amp.html' ) ;
}
} else {
2021-04-10 08:46:50 +02:00
let subscr _sections = document . querySelectorAll ( 'div[subscriptions-section="content"]' ) ;
for ( let subscr _section of subscr _sections )
subscr _section . removeAttribute ( 'subscriptions-section' ) ;
2021-06-28 08:51:33 +02:00
let amp _iframes = document . querySelectorAll ( 'amp-iframe' ) ;
let elem ;
for ( let amp _iframe of amp _iframes ) {
elem = document . createElement ( 'iframe' ) ;
elem . src = amp _iframe . getAttribute ( 'src' ) ;
elem . setAttribute ( 'frameborder' , '0' ) ;
if ( amp _iframe . getAttribute ( 'height' ) && amp _iframe . getAttribute ( 'width' ) ) {
2021-06-30 18:20:20 +02:00
elem . setAttribute ( 'height' , amp _iframe . getAttribute ( 'height' ) ) ;
elem . setAttribute ( 'width' , amp _iframe . getAttribute ( 'width' ) ) ;
2021-06-28 08:51:33 +02:00
}
amp _iframe . parentElement . insertBefore ( elem , amp _iframe ) ;
removeDOMElement ( amp _iframe ) ;
}
2021-04-10 08:46:50 +02:00
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 => {
2021-08-17 18:37:06 +02:00
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( html , 'text/html' ) ;
2021-04-10 08:46:50 +02:00
let json = doc . querySelector ( 'script[id="schemaOrgJson"]' ) ;
if ( json ) {
2021-08-17 18:37:06 +02:00
let json _text = json . text . replace ( /(\r|\n)/g , '' ) ;
2021-04-10 08:46:50 +02:00
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-08-08 18:09:48 +02:00
let str _rep _arr = [ 'AstraZeneca' , 'BaFin' , 'BerlHG' , 'BfArM' , 'BilMoG' , 'BioNTech' , 'DiGA' , 'EuGH' , 'FinTechRat' , 'GlaxoSmithKline' , 'IfSG' , 'medRxiv' , 'mmHg' , '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-08-31 18:22:53 +02:00
else if ( matchDomain ( 'handelsblatt.com' ) ) {
let url = window . location . href ;
if ( url . match ( /\/amp(\d)?\./ ) ) {
let amp _ads = document . querySelectorAll ( 'amp-ad, amp-embed' ) ;
removeDOMElement ( ... amp _ads ) ;
} else {
let paywall = document . querySelector ( 'div.temp-paywall2' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( ! amphtml )
amphtml = { href : url . replace ( /\/(www|app)\./ , '/amp2.' ) } ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
}
}
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-11-04 19:28:07 +01:00
else if ( matchDomain ( 'mz.de' ) ) {
let url = window . location . href . split ( '?' ) [ 0 ] ;
let paywall = document . querySelector ( '.fp-paywall' ) ;
if ( url . includes ( '/amp/' ) ) {
let preview = document . querySelector ( 'section[subscriptions-section="content-not-granted"]' ) ;
removeDOMElement ( preview ) ;
let subscr _section = document . querySelector ( '[subscriptions-section="content"]' ) ;
if ( subscr _section ) {
subscr _section . removeAttribute ( 'subscriptions-section' ) ;
let amp _ads = document . querySelectorAll ( 'amp-ad, amp-embed' ) ;
removeDOMElement ( ... amp _ads ) ;
}
} else {
if ( paywall ) {
removeDOMElement ( paywall ) ;
window . location . href = window . location . href . replace ( '.de/' , '.de/amp/' ) ;
}
}
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( [ 'noz.de' , 'nwzonline.de' , 'shz.de' , 'svz.de' ] ) ) {
let url = window . location . href ;
if ( url . includes ( '?amp' ) || url . includes ( '-amp.html' ) ) {
2021-09-04 11:23:58 +02:00
let subscriber = document . querySelectorAll ( 'div[amp-access="NOT data.reduced"][amp-access-hide]' ) ;
for ( let elem of subscriber )
elem . removeAttribute ( 'amp-access-hide' ) ;
2021-04-10 08:46:50 +02:00
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 {
2021-09-04 11:23:58 +02:00
let paywall = document . querySelector ( '.paywall, .story--premium__container' ) ;
2021-04-10 08:46:50 +02:00
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' ] ) ) {
2021-10-13 20:33:22 +02:00
let url = window . location . href ;
if ( ! url . includes ( '?amp' ) ) {
let paywall = document . querySelector ( '.PianoContent' ) ;
if ( paywall )
paywall . classList . remove ( 'PianoContent' ) ;
} 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 ( 'amp-ad' ) ;
removeDOMElement ( ... amp _ads ) ;
}
2021-04-10 08:46:50 +02:00
}
2021-10-12 22:13:20 +02:00
else if ( matchDomain ( [ 'westfalen-blatt.de' , 'wn.de' ] ) ) {
2021-10-01 15:28:11 +02:00
let url = window . location . href ;
if ( url . includes ( '/amp/' ) ) {
let subscr _sections = document . querySelectorAll ( 'section[subscriptions-section="content"]' ) ;
for ( let subscr _section of subscr _sections )
subscr _section . removeAttribute ( 'subscriptions-section' ) ;
2021-10-29 08:48:52 +02:00
let amp _ads = document . querySelectorAll ( 'amp-ad, amp-embed, section[class^="fp-ad"]' ) ;
removeDOMElement ( ... amp _ads ) ;
} else {
let paywall = document . querySelector ( '.fp-article-paywall' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
window . location . href = url . replace ( '.de/' , '.de/amp/' ) ;
}
2021-10-01 15:28:11 +02:00
}
}
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-09-24 16:09:54 +02:00
} else if ( window . location . hostname . match ( /\.(es|pt)$/ ) || matchDomain ( [ 'diariovasco.com' , 'elconfidencial.com' , 'elcorreo.com' , 'elespanol.com' , 'elpais.com' , 'elperiodico.com' , 'elperiodicomediterraneo.com' , 'expansion.com' , 'larioja.com' , 'lavanguardia.com' , 'levante-emv.com' , 'marca.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 {
2021-09-04 11:23:58 +02:00
let section _hidden = document . querySelectorAll ( 'section[amp-access="subscriber"][amp-access-hide]' ) ;
2021-04-10 08:46:50 +02:00
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-07-30 19:20:35 +02:00
else if ( domain = matchDomain ( es _unidad _domains ) ) {
2021-04-10 08:46:50 +02:00
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 ) ;
2021-09-04 11:23:58 +02:00
let div _hidden = document . querySelector ( 'div[amp-access="authorized=true"][amp-access-hide]' ) ;
2021-04-10 08:46:50 +02:00
if ( div _hidden ) {
div _hidden . removeAttribute ( 'amp-access-hide' ) ;
}
2020-07-15 18:45:37 +02:00
}
2021-07-30 19:20:35 +02:00
let adverts = document . querySelectorAll ( '.advertising, amp-embed, amp-ad' ) ;
2021-04-10 08:46:50 +02:00
removeDOMElement ( ... adverts ) ;
}
}
else if ( matchDomain ( 'elpais.com' ) ) {
let url = window . location . href ;
2021-10-08 08:11:56 +02:00
let login _register = document . querySelector ( '.login_register' ) ;
2021-04-10 08:46:50 +02:00
if ( url . includes ( '.amp.html' ) || url . includes ( '?outputType=amp' ) ) {
2021-10-07 19:37:31 +02:00
let preview = document . querySelector ( 'div[amp-access="NOT success"]' ) ;
2021-09-04 11:23:58 +02:00
let paywall = document . querySelectorAll ( 'div[amp-access="success"][amp-access-hide]' ) ;
2021-04-10 08:46:50 +02:00
for ( let elem of paywall )
elem . removeAttribute ( 'amp-access-hide' ) ;
let amp _ads = document . querySelectorAll ( 'amp-ad' ) ;
2021-10-07 19:37:31 +02:00
removeDOMElement ( login _register , preview , ... amp _ads ) ;
2021-04-10 08:46:50 +02:00
} else {
2021-10-07 19:37:31 +02:00
let counter = document . querySelector ( '#counterLayerDiv' ) ;
removeDOMElement ( counter ) ;
2021-10-08 08:11:56 +02:00
let video = document . querySelector ( 'div.videoTop' )
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( ( login _register || video ) && amphtml ) {
removeDOMElement ( login _register , video ) ;
2021-04-10 08:46:50 +02:00
window . location . href = amphtml . href ;
}
}
let paywall _offer = document . querySelector ( '.paywallOffer' ) ;
2021-10-08 08:11:56 +02:00
let ctn _closed _article = document . querySelector ( '#ctn_closed_article' ) ;
removeDOMElement ( paywall _offer , ctn _closed _article ) ;
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 ) {
2021-09-28 21:18:08 +02:00
let non _subscr _section = document . querySelector ( 'div[amp-access^="NOT logged"]' ) ;
2021-04-10 08:46:50 +02:00
removeDOMElement ( not _logged , non _subscr _section ) ;
2021-09-28 21:18:08 +02:00
let subscr _section = document . querySelector ( 'div[amp-access^="logged"][amp-access-hide]' ) ;
2021-04-10 08:46:50 +02:00
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 ;
2021-07-30 09:14:26 +02:00
let content _exclusive _bg = document . querySelector ( '.content-exclusive-bg, #cierre_suscripcion, ev-engagement[group-name^="paywall-"]' ) ;
2021-04-10 08:46:50 +02:00
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( content _exclusive _bg && amphtml ) {
removeDOMElement ( content _exclusive _bg ) ;
2021-07-30 09:14:26 +02:00
window . location . href = url . split ( '?' ) [ 0 ] . replace ( '.html' , '_amp.html' ) ;
2021-04-10 08:46:50 +02:00
} 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 ) {
2021-08-17 18:37:06 +02:00
let json _text = JSON . parse ( json . text ) . description . replace ( /&nbsp;/g , '' ) ;
2021-04-10 08:46:50 +02:00
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-10-20 21:46:42 +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' , 'marianne.net' , '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' ) ) {
2021-06-16 21:39:14 +02:00
let paywall = document . querySelector ( 'div.markup[class*="Paywall"]' ) ;
2021-04-10 08:46:50 +02:00
if ( paywall )
2021-06-09 20:30:06 +02:00
paywall . setAttribute ( 'class' , 'markup' ) ;
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' ) ;
2021-09-24 11:54:43 +02:00
let content = document . querySelectorAll ( '.user-paying-content' ) ;
for ( let elem of content )
elem . classList . remove ( 'user-paying-content' ) ;
2021-04-30 17:25:41 +02:00
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
}
2021-10-24 19:01:46 +02:00
else if ( matchDomain ( 'elle.fr' ) ) {
let hidden _images = document . querySelectorAll ( 'img[src^="data:image/"][data-src]' ) ;
for ( let hidden _image of hidden _images )
hidden _image . setAttribute ( 'src' , hidden _image . getAttribute ( 'data-src' ) ) ;
let subscription _bar = document . querySelector ( '.tc-subscription-bar' ) ;
removeDOMElement ( subscription _bar ) ;
}
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 {
2021-10-17 21:15:00 +02:00
let amp _access _hide = document . querySelector ( '[amp-access][amp-access-hide]' ) ;
2021-04-10 08:46:50 +02:00
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/' ) ) {
2021-10-20 17:53:02 +02:00
let hidden _images = document . querySelectorAll ( 'source[srcset]' ) ;
for ( elem of hidden _images )
elem . removeAttribute ( 'srcset' ) ;
2021-04-10 08:46:50 +02:00
} 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 ( ) {
2021-09-24 11:54:43 +02:00
let abo _banner = document . querySelector ( 'div[class*="pgxf3b-2"]' ) ;
2021-04-10 08:46:50 +02:00
let ad _blocks = document . querySelectorAll ( '[class*="jzxvkd"' ) ;
for ( let ad _block of ad _blocks )
ad _block . setAttribute ( 'style' , 'display:none' ) ;
2021-10-22 12:36:47 +02:00
if ( abo _banner && dompurify _loaded ) {
2021-04-10 08:46:50 +02:00
removeDOMElement ( abo _banner ) ;
let url = window . location . href ;
let html = document . documentElement . outerHTML ;
let state ;
2021-11-03 12:29:46 +01:00
let split1 = html . split ( 'window.__CONFIG__=' ) [ 1 ] ;
2021-04-10 08:46:50 +02:00
let split2 = split1 . split ( '</script>' ) [ 0 ] . trim ( ) ;
2021-09-24 11:54:43 +02:00
if ( split2 . includes ( '; window.__DATA__=' ) ) {
2021-11-03 12:29:46 +01:00
state = split2 . split ( '; window.__DATA__=' ) [ 1 ] . split ( '; window.__' ) [ 0 ] . trim ( ) ;
2021-09-24 11:54:43 +02:00
} else
2021-04-10 08:46:50 +02:00
state = split2 . substr ( 0 , split2 . length - 1 ) ;
try {
let data = JSON . parse ( state ) ;
2021-09-24 11:54:43 +02:00
let data _article = data . article ? data . article : data . pageProps ;
let article = data _article . data . stripes [ 0 ] . mainContent [ 0 ] . data . description ;
let url _loaded = data _article . data . path ;
if ( url _loaded && ! url . replace ( /%20/g , '' ) . includes ( url _loaded ) )
2021-04-10 08:46:50 +02:00
window . location . reload ( true ) ;
let paywallNode = document . querySelector ( '.post-paywall' ) ;
if ( paywallNode ) {
let contentNode = document . createElement ( 'div' ) ;
let parser = new DOMParser ( ) ;
2021-06-29 19:59:15 +02:00
let article _html = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( article ) + '</div>' , 'text/html' ) ;
2021-04-10 08:46:50 +02:00
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-10-20 21:46:42 +02:00
else if ( matchDomain ( 'marianne.net' ) ) {
let paywall = document . querySelector ( 'div.paywall' ) ;
2021-10-22 12:36:47 +02:00
if ( paywall && dompurify _loaded ) {
2021-10-20 21:46:42 +02:00
let article _source = document . querySelector ( 'div.article-body[data-content-src]' ) ;
if ( article _source ) {
let article _text = decode _utf8 ( atob ( article _source . getAttribute ( 'data-content-src' ) ) ) ;
let parser = new DOMParser ( ) ;
let html = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( article _text ) + '</div>' , 'text/html' ) ;
let article = html . querySelector ( 'div' ) ;
article _source . innerHTML = '' ;
article _source . appendChild ( article ) ;
article _source . removeAttribute ( 'data-content-src' ) ;
}
removeDOMElement ( paywall ) ;
}
}
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' ) ) {
2021-09-03 12:35:25 +02:00
let url = window . location . href ;
if ( url . 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;' ) ;
let amp _ads = document . querySelectorAll ( 'amp-ad, div#_4sVideoContainer' ) ;
removeDOMElement ( ... amp _ads ) ;
2021-11-03 12:29:46 +01:00
} else if ( url . split ( '?' ) [ 0 ] . match ( /\/\d{4}\/\d{2}\/\d{2}\// ) ) {
2021-10-31 20:19:15 +01:00
let paywall = document . querySelector ( 'div.read-more' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
2021-09-03 12:35:25 +02:00
window . location . href = url . split ( '?' ) [ 0 ] + 'amp' ;
2021-01-11 18:49:09 +01:00
}
2021-09-03 12:35:25 +02:00
}
2020-04-25 17:18:12 +02:00
}
2021-07-30 08:52:20 +02:00
else if ( matchDomain ( it _quotidiano _domains ) ) {
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 ) ;
2021-07-04 08:43:45 +02:00
csDoneOnce = 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 ) ) {
2021-06-10 07:30:25 +02:00
let url = window . location . href . split ( '?' ) [ 0 ] ;
if ( ! url . match ( /\amp(\/)?$/ ) ) {
2021-10-19 08:39:03 +02:00
let premium = document . querySelector ( '#paywall, iframe#__limio_frame' ) ;
if ( premium ) {
removeDOMElement ( premium ) ;
if ( ! url . includes ( '/podcast/' ) ) {
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( ! amphtml )
amphtml = { href : ( url . split ( '?' ) [ 0 ] + '/amp' ) . replace ( '//amp' , '/amp' ) } ;
if ( amphtml )
window . location . href = amphtml . href ;
2021-09-05 08:48:23 +02:00
}
2021-10-19 08:39:03 +02:00
} else if ( matchDomain ( 'gelocal.it' ) ) {
premium = document . querySelector ( '.paywall-adagio' ) ;
2021-09-05 08:48:23 +02:00
if ( premium ) {
removeDOMElement ( premium ) ;
window . setTimeout ( function ( ) {
let article _body = document . querySelector ( 'div#article-body[style]' ) ;
if ( article _body )
article _body . removeAttribute ( 'style' ) ;
} , 1000 ) ; // Delay (in milliseconds)
}
2021-05-25 18:00:57 +02:00
}
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 {
2021-09-04 11:23:58 +02:00
paywall = document . querySelector ( 'div[amp-access="showContent"][amp-access-hide]' ) ;
2021-04-10 08:46:50 +02:00
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
}
2020-06-26 19:56:58 +02:00
else if ( matchDomain ( 'knack.be' ) ) {
2021-10-22 19:16:48 +02:00
let paywall = document . querySelector ( '[class$="Paywall"], #paywall-modal-below' ) ;
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 ) ;
}
2021-06-20 21:41:11 +02:00
else if ( matchDomain ( nl _mediahuis _region _domains ) ) {
2021-04-10 08:46:50 +02:00
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' ) ;
2021-10-22 12:36:47 +02:00
if ( premium && dompurify _loaded ) {
2021-04-10 08:46:50 +02:00
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"]' ) ;
2021-06-20 21:41:11 +02:00
if ( paywall && auth _body ) {
2021-04-10 08:46:50 +02:00
let auth _body _par _count = auth _body . querySelectorAll ( 'p' ) ;
if ( auth _body _par _count . length < 2 ) {
2021-08-18 18:15:00 +02:00
let json _script = document . querySelector ( 'script[data-fragment-type="PacoArticleContent"]' ) ;
let json _str = json _script . text . substring ( json _script . textContent . indexOf ( '{' ) ) ;
2021-04-10 08:46:50 +02:00
try {
2021-08-18 18:15:00 +02:00
let json = JSON . parse ( json _str ) ;
let article = Object . values ( json ) [ 0 ] [ 'data' ] [ 'article' ] [ 'body' ] ;
2021-04-10 08:46:50 +02:00
auth _body . innerHTML = '' ;
2021-06-20 21:41:11 +02:00
let par _html , par _dom , par _elem , par _div , par _key ;
2021-04-10 08:46:50 +02:00
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' ) {
2021-06-29 19:59:15 +02:00
par _html = parser . parseFromString ( '<div><strong>' + DOMPurify . sanitize ( par _key ) + '</strong></div>' , 'text/html' ) ;
2021-06-27 09:56:42 +02:00
par _elem = par _html . querySelector ( 'div' ) ;
2021-04-10 08:46:50 +02:00
} else if ( key === 'twitter' || key === 'instagram' ) {
par _elem = document . createElement ( 'a' ) ;
Object . assign ( par _elem , {
href : par _key ,
2021-06-27 09:56:42 +02:00
innerText : par _key . split ( '?' ) [ 0 ] ,
2021-04-10 08:46:50 +02:00
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 ;
2021-07-05 19:45:08 +02:00
par _elem . appendChild ( par _img ) ;
2021-04-10 08:46:50 +02:00
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 {
2021-08-18 18:15:00 +02:00
par _html = parser . parseFromString ( '<p style="font-size: 18px; line-height: 1.625;">' + DOMPurify . sanitize ( par _key ) + '</div>' , 'text/html' ) ;
par _elem = par _html . querySelector ( 'p' ) ;
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 ) {
2021-06-20 21:41:11 +02:00
console . warn ( 'unable to parse text' ) ;
2021-04-10 08:46:50 +02:00
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' ) ;
2021-08-04 19:57:08 +02:00
let paywall = document . querySelector ( '.MeteringNotification__backdrop' ) ;
2021-04-10 08:46:50 +02:00
removeDOMElement ( spotx _banner , paywall ) ;
2021-08-04 19:57:08 +02:00
let premium = document . querySelector ( '.PremiumLabelWithLine' ) ;
2021-04-10 08:46:50 +02:00
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 ) ;
2021-08-04 19:57:08 +02:00
let html = document . documentElement . outerHTML ;
2021-08-08 10:02:24 +02:00
let json = html . includes ( 'window.__APOLLO_STATE__=' ) ? html . split ( 'window.__APOLLO_STATE__=' ) [ 1 ] . split ( '};' ) [ 0 ] + '}' : '' ;
2021-04-10 08:46:50 +02:00
if ( json ) {
2021-08-04 19:57:08 +02:00
let json _article _id = json . split ( 'uid\":' ) [ 1 ] . split ( ',\"' ) [ 0 ] ;
2021-08-11 18:31:39 +02:00
if ( json _article _id && json _article _id !== article _id ) {
window . setTimeout ( function ( ) {
window . location . reload ( true ) ;
} , 500 ) ;
}
2021-08-06 13:25:43 +02:00
let json _text = json . includes ( '"body":"' ) ? json . split ( '"body":"' ) [ 1 ] . split ( '","__typename":' ) [ 0 ] : '' ;
2021-08-04 19:57:08 +02:00
if ( json _text ) {
let intro = document . querySelector ( 'span[id^="articleIntro"]' ) ;
if ( intro )
json _text = json _text . replace ( intro . innerText + '\n\n' , '' ) ;
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' ) ;
text _array . forEach ( p _text => {
let p _div = document . createElement ( 'p' ) ;
p _div . setAttribute ( 'class' , 'ArticleBodyBlocks__paragraph' ) ;
p _div . innerText = p _text ;
div _elem . appendChild ( p _div ) ;
} ) ;
div _main . appendChild ( div _elem ) ;
article _body . appendChild ( div _main ) ;
}
2021-04-10 08:46:50 +02:00
}
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-10-22 20:55:17 +02:00
} else if ( window . location . hostname . match ( /\.(ie|uk)$/ ) || matchDomain ( [ 'theathletic.com' ] ) ) { //united kingdom/ireland
2020-10-02 18:41:44 +02:00
2021-10-22 20:55:17 +02:00
if ( matchDomain ( 'prospectmagazine.co.uk' ) ) {
2021-04-10 08:46:50 +02:00
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' ) ) {
2021-06-15 21:24:05 +02:00
let url = window . location . href . split ( '?' ) [ 0 ] ;
if ( url . match ( /\/amp(\/)?$/ ) ) {
let paywall = document . querySelectorAll ( 'div[amp-access^="p.show"' ) ;
let not _logged _in = document . querySelector ( 'div[amp-access*="NOT loggedIn"]' ) ;
removeDOMElement ( ... paywall , not _logged _in )
} else {
let premium = document . querySelector ( '.HardPayWallContainer-module__overlay' ) ;
removeDOMElement ( premium ) ;
if ( premium )
window . location . href = url + '/amp' ;
}
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 ) ;
2021-09-04 11:23:58 +02:00
let subscr _section = document . querySelector ( '.notAccessibleForFree[amp-access-hide]' ) ;
2021-04-10 08:46:50 +02:00
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' ] ) ) {
2021-08-11 18:31:39 +02:00
if ( ! window . location . href . includes ( '?amp' ) ) {
2021-10-25 20:18:48 +02:00
let paywall = document . querySelectorAll ( 'div#paywall-container, div[subscriptions-action="subscribe"], a.headline-paywall' ) ;
2021-04-25 13:45:36 +02:00
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
2021-10-23 10:06:44 +02:00
removeDOMElement ( ... paywall ) ;
2021-10-25 20:18:48 +02:00
window . setTimeout ( function ( ) {
window . location . href = amphtml . href ;
} , 500 ) ; // Delay (in milliseconds)
2021-04-25 13:45:36 +02:00
}
} 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-08-01 09:33:07 +02:00
let podcast = document . querySelector ( 'div[id^="podcast-clip-"]' ) ;
if ( podcast ) {
let podcast _src = podcast . innerHTML . replace ( /<amp-/g , '<' ) . replace ( /<\/amp-/g , '</' ) ;
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( podcast _src , { ADD _TAGS : [ 'iframe' ] , ADD _ATTR : [ 'layout' , 'sandbox' ] } ) + '</div>' , 'text/html' ) ;
let podcast _new = doc . querySelector ( 'div' ) ;
if ( podcast _new )
podcast . parentNode . replaceChild ( podcast _new , podcast ) ;
}
2021-04-25 13:45:36 +02:00
}
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'thetimes.co.uk' ) ) {
let block = document . querySelector ( '.subscription-block' ) ;
2021-06-06 21:13:03 +02:00
let adverts = document . querySelectorAll ( '#ad-article-inline, #sticky-ad-header, div[class*="InlineAdWrapper"], div[class*="NativeAd"], div.responsiveweb-sc-1exejum-0' ) ;
removeDOMElement ( block , ... adverts ) ;
2021-06-19 19:04:34 +02:00
let url = window . location . href ;
2021-06-13 21:59:46 +02:00
let paywall = document . querySelector ( 'div#paywall-portal-article-footer' ) ;
2021-06-19 19:04:34 +02:00
if ( paywall && ! url . includes ( '?shareToken=' ) ) {
2021-06-13 21:59:46 +02:00
removeDOMElement ( paywall ) ;
let article = document . querySelector ( 'article[role="article"]' ) ;
if ( article )
2021-07-04 08:43:45 +02:00
article . insertBefore ( archiveLink ( url ) , article . firstChild ) ;
2021-06-13 21:59:46 +02:00
}
let paywall _page = document . querySelector ( 'div#paywall-portal-page-footer' ) ;
removeDOMElement ( paywall _page ) ;
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 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)
2021-07-26 20:02:44 +02:00
window . setTimeout ( function ( ) {
let cont _articlelight = document . querySelector ( 'div.cont_articlelight' ) ;
if ( cont _articlelight )
cont _articlelight . setAttribute ( 'style' , 'height: 100% !important; width: 90% !important' ) ;
} , 3000 ) ; // 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 ;
2021-07-07 18:30:24 +02:00
replaceDomElementExt ( url _cache , true , false , 'div.protected-content' , 'Failed to load from Google webcache: ' ) ;
2021-05-21 15:10:39 +02:00
}
2021-07-10 11:27:04 +02:00
let skeleton _box = document . querySelector ( 'div.glb-skeleton-box' ) ;
if ( skeleton _box ) {
skeleton _box . classList . remove ( 'glb-skeleton-box' ) ;
skeleton _box . removeAttribute ( 'style' ) ;
}
2021-05-21 15:10:39 +02:00
}
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' ) ) {
2021-10-30 10:29:59 +02:00
let url = window . location . href ;
if ( ! url . includes ( 'barrons.com/amp/' ) ) {
2021-04-10 08:46:50 +02:00
let body _continuous = document . querySelector ( 'body.is-continuous' ) ;
let snippet = document . querySelector ( 'meta[content="snippet"]' ) ;
if ( body _continuous && snippet ) {
2021-10-30 10:29:59 +02:00
removeDOMElement ( snippet ) ;
window . location . href = url . replace ( 'barrons.com' , 'barrons.com/amp' ) ;
2021-04-10 08:46:50 +02:00
}
2021-05-22 19:54:49 +02:00
let signin _links = document . querySelectorAll ( 'a.primary-button--link[href*="target="]' ) ;
2021-04-10 08:46:50 +02:00
for ( let signin _link of signin _links ) {
2021-05-22 19:54:49 +02:00
signin _link . href = decodeURIComponent ( signin _link . href . split ( 'target=' ) [ 1 ] ) . split ( '?' ) [ 0 ] ;
signin _link . text = 'Click' ;
2021-04-10 08:46:50 +02:00
}
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 {
2021-09-23 22:57:33 +02:00
let preview = document . querySelector ( 'section[subscriptions-section="content-not-granted"]' ) ;
removeDOMElement ( preview ) ;
let subscr _section = document . querySelector ( 'section[subscriptions-section="content"]' ) ;
if ( subscr _section )
subscr _section . removeAttribute ( 'subscriptions-section' ) ;
2021-10-30 10:29:59 +02:00
let wsj _ads = document . querySelectorAll ( '.wsj-ad, amp-ad' ) ;
2021-04-10 08:46:50 +02:00
removeDOMElement ( ... wsj _ads ) ;
}
}
else if ( matchDomain ( 'bloomberg.com' ) ) {
2021-08-06 13:25:43 +02:00
function bloomberg _noscroll ( node ) {
node . removeAttribute ( 'data-paywall-overlay-status' ) ;
}
waitDOMElement ( 'div#fortress-paywall-container-root' , 'DIV' , removeDOMElement , true ) ;
waitDOMAttribute ( 'body' , 'BODY' , 'data-paywall-overlay-status' , bloomberg _noscroll , true ) ;
2021-07-19 19:56:02 +02:00
sessionStorage . clear ( ) ;
2021-10-23 09:59:06 +02:00
let paywall = document . querySelector ( 'div#fortress-paywall-container-root' ) ;
2021-07-19 19:56:02 +02:00
let counter = document . querySelector ( 'div#fortress-preblocked-container-root' ) ;
2021-10-23 09:59:06 +02:00
let noscroll = document . querySelector ( 'body[data-paywall-overlay-status]' ) ;
if ( noscroll )
noscroll . removeAttribute ( 'data-paywall-overlay-status' ) ;
removeDOMElement ( paywall , counter ) ;
2021-08-06 13:25:43 +02:00
let url = window . location . href ;
2021-08-23 21:31:44 +02:00
if ( url . match ( /\/(articles|features)\// ) ) {
2021-08-06 13:25:43 +02:00
let leaderboard = document . querySelector ( 'div[id^="leaderboard"], div.leaderboard-wrapper' ) ;
let shimmering _content = document . querySelectorAll ( 'div[class^="shimmering-"]' ) ;
2021-08-13 15:29:59 +02:00
let page _ad = document . querySelectorAll ( 'div.page-ad, div[data-ad-placeholder]' ) ;
2021-08-23 21:31:44 +02:00
let reg _ui _client = document . querySelector ( 'div#reg-ui-client' ) ;
removeDOMElement ( leaderboard , ... shimmering _content , ... page _ad , reg _ui _client ) ;
2021-08-06 13:25:43 +02:00
let hidden _images = document . querySelectorAll ( 'img.lazy-img__image[src][data-native-src]' ) ;
for ( let hidden _image of hidden _images ) {
if ( hidden _image . src . match ( /\/60x-1\.(png|jpg)$/ ) )
hidden _image . setAttribute ( 'src' , hidden _image . getAttribute ( 'data-native-src' ) ) ;
hidden _image . style . filter = 'none' ;
}
2021-10-20 20:35:52 +02:00
let hidden _charts = document . querySelectorAll ( 'div[data-toaster-id][data-src]' ) ;
for ( let hidden _chart of hidden _charts ) {
let elem = document . createElement ( 'iframe' ) ;
Object . assign ( elem , {
src : hidden _chart . getAttribute ( 'data-src' ) ,
frameborder : 0 ,
height : hidden _chart . getAttribute ( 'style' ) . replace ( 'min-height: ' , '' ) ,
scrolling : 'no'
} ) ;
hidden _chart . parentNode . replaceChild ( elem , hidden _chart ) ;
}
2021-10-03 12:17:55 +02:00
let blur = document . querySelector ( 'div.blur[style]' ) ;
if ( blur ) {
blur . classList . remove ( 'blur' ) ;
blur . removeAttribute ( 'style' ) ;
}
2021-08-06 13:25:43 +02:00
let json _script = document . querySelector ( 'script[data-component-props="ArticleBody"], script[data-component-props="FeatureBody"]' ) ;
2021-10-22 12:36:47 +02:00
if ( json _script && dompurify _loaded ) {
2021-08-06 13:25:43 +02:00
let json = JSON . parse ( json _script . innerHTML ) ;
if ( json ) {
let json _text = json . body ? json . body : '' ;
if ( json _text ) {
removeDOMElement ( json _script ) ;
let article = document . querySelector ( 'div.body-copy-v2:not(.art_done)' ) ;
let article _class = 'body-copy-v2' ;
if ( ! article ) {
article = document . querySelector ( 'div.body-copy:not(.art_done)' ) ;
article _class = 'body-copy' ;
}
if ( article ) {
article _class += ' art_done' ;
let parser = new DOMParser ( ) ;
2021-08-23 21:31:44 +02:00
let doc = parser . parseFromString ( '<div class="' + article _class + '">' + DOMPurify . sanitize ( json _text , { ADD _TAGS : [ 'iframe' , 'script' ] } ) + '</div>' , 'text/html' ) ;
2021-08-06 13:25:43 +02:00
let article _new = doc . querySelector ( 'div' ) ;
if ( article _new )
article . parentNode . replaceChild ( article _new , article ) ;
}
2021-07-19 19:56:02 +02:00
}
}
2021-04-10 08:46:50 +02:00
}
2021-07-19 19:56:02 +02:00
}
2021-04-10 08:46:50 +02:00
}
else if ( matchDomain ( 'bloombergquint.com' ) ) {
let articlesLeftModal = document . querySelector ( '.paywall-meter-module__story-paywall-container__1UgCE' ) ;
let paywall = document . getElementById ( 'paywallDmp' ) ;
removeDOMElement ( articlesLeftModal , paywall ) ;
}
2021-06-14 21:45:26 +02:00
else if ( matchDomain ( 'bostonglobe.com' ) ) {
2021-10-29 08:48:52 +02:00
let paywall = document . querySelector ( 'div.meter-paywall, div.incognito-paywall' ) ;
2021-10-01 08:31:17 +02:00
let fade = document . querySelector ( 'div.fade' ) ;
if ( paywall || fade ) {
2021-06-14 21:45:26 +02:00
removeDOMElement ( paywall ) ;
let body _hidden = document . querySelector ( 'body[style]' ) ;
if ( body _hidden )
body _hidden . removeAttribute ( 'style' ) ;
let continue _button = document . querySelector ( 'button.continue_button' ) ;
if ( continue _button )
continue _button . click ( ) ;
}
2021-10-29 08:48:52 +02:00
let ads = document . querySelectorAll ( 'div.arc_ad' ) ;
for ( let ad of ads )
ad . style = 'display:none' ;
2021-06-14 21:45:26 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'business-standard.com' ) ) {
2021-10-18 21:08:58 +02:00
let skip _button = document . querySelector ( 'a.btn_skip' ) ;
if ( skip _button )
skip _button . click ( ) ;
let p _content = document . querySelector ( 'span.p-content.paywall' ) ;
if ( p _content ) {
p _content . classList . remove ( 'paywall' ) ;
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|\t)/gm , '' ) ) [ 0 ] . articleBody ;
json _text = parseHtmlEntities ( json _text ) ;
json _text = json _text . replace ( /(?:^|[\w\"\'\’ ])(\.|\?|!)(?=[A-Z\"\”\“\‘ \’ \'][A-Za-zÀ-ÿ\"\”\“\‘ \’ \']{1,})/gm , "$&\r\n\r\n" ) + '\r\n\r\n' ;
let article = document . createElement ( 'div' ) ;
article . innerText = json _text ;
if ( article ) {
let old _pars = p _content . querySelectorAll ( 'p' ) ;
for ( let old _par of old _pars ) {
if ( ! old _par . querySelector ( 'img' ) )
removeDOMElement ( old _par ) ;
2021-04-10 08:46:50 +02:00
}
2021-10-18 21:08:58 +02:00
p _content . appendChild ( article ) ;
2021-04-10 08:46:50 +02:00
}
2020-12-24 13:30:55 +01:00
}
2021-10-18 21:08:58 +02:00
}
2020-12-24 13:30:55 +01:00
}
2021-10-18 21:08:58 +02:00
2021-08-08 10:02:24 +02:00
else if ( matchDomain ( 'businessoffashion.com' ) ) {
let paywall = document . querySelector ( 'div.paywall' ) ;
if ( paywall ) {
let article _locked = document . querySelector ( 'div.article-locked' ) ;
if ( article _locked )
article _locked . removeAttribute ( 'class' ) ;
let article _locked _overlay = document . querySelector ( 'div.article-locked-overlay' ) ;
removeDOMElement ( paywall , article _locked _overlay ) ;
}
}
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 ) ;
2021-08-31 18:22:53 +02:00
} , 1000 ) ; // 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-10-07 19:56:23 +02:00
else if ( matchDomain ( 'chronicle.com' ) ) {
let preview = document . querySelector ( 'div[data-content-summary]' ) ;
removeDOMElement ( preview ) ;
let article _hidden = document . querySelector ( 'div[data-content-body]' ) ;
if ( article _hidden )
article _hidden . removeAttribute ( 'data-content-body' ) ;
}
2021-07-28 18:33:12 +02:00
else if ( matchDomain ( 'csmonitor.com' ) ) {
let paywall = document . querySelector ( 'div.paywall' ) ;
removeDOMElement ( paywall ) ;
}
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 ( ) ;
2021-07-11 18:44:45 +02:00
let banner = document . querySelector ( 'div.dPURIw' ) ;
2021-04-10 08:46:50 +02:00
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"]' ) ;
2021-10-22 12:36:47 +02:00
if ( ( paywall || data _prime ) && dompurify _loaded ) {
2021-05-21 08:04:59 +02:00
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 ( ) ;
2021-07-10 11:27:04 +02:00
html = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( full _text . innerHTML , { ADD _ATTR : [ 'frameborder' ] , ADD _TAGS : [ 'iframe' ] } ) + '</div>' , 'text/html' ) ;
2021-05-21 08:04:59 +02:00
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' ) ;
2021-08-17 18:37:06 +02:00
let href ;
2021-04-10 08:46:50 +02:00
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' ) ) ;
}
}
2021-07-23 15:28:22 +02:00
else if ( matchDomain ( fi _alma _talent _domains ) ) {
let ads = document . querySelectorAll ( 'div[class^="p2m385-"]' ) ;
removeDOMElement ( ... ads ) ;
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'firstthings.com' ) ) {
let paywall = document . querySelector ( '.paywall' ) ;
removeDOMElement ( paywall ) ;
}
else if ( matchDomain ( 'foreignaffairs.com' ) ) {
2021-09-28 20:42:02 +02:00
window . setTimeout ( function ( ) {
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' ) ;
2021-10-24 19:01:46 +02:00
let hidden _images = document . querySelectorAll ( 'img[src^="data:image/"][data-src]' ) ;
2021-09-28 20:42:02 +02:00
for ( let hidden _image of hidden _images ) {
2021-10-24 19:01:46 +02:00
hidden _image . setAttribute ( 'src' , hidden _image . getAttribute ( 'data-src' ) ) ;
hidden _image . removeAttribute ( 'class' ) ;
2021-04-10 08:46:50 +02:00
}
2021-09-28 20:42:02 +02:00
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-04-10 08:46:50 +02:00
}
2021-09-28 20:42:02 +02:00
} , 1000 ) ; // Delay (in milliseconds)
2021-01-09 17:45:21 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'foreignpolicy.com' ) ) {
2021-06-16 07:38:22 +02:00
let content _ungated = document . querySelector ( 'div.content-ungated' ) ;
removeDOMElement ( content _ungated ) ;
let content _gated = document . querySelector ( 'div.content-gated' ) ;
if ( content _gated )
content _gated . classList . remove ( 'content-gated' ) ;
2020-12-31 09:45:01 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'ft.com' ) ) {
2021-10-18 20:36:05 +02:00
if ( window . location . hostname . startsWith ( 'amp.' ) ) {
let subscr _section = document . querySelector ( '[subscriptions-section="content"]' ) ;
if ( subscr _section )
subscr _section . removeAttribute ( 'subscriptions-section' ) ;
2021-10-19 08:39:03 +02:00
let amp _ads = document . querySelectorAll ( '.ad-container, amp-ad' ) ;
removeDOMElement ( ... amp _ads ) ;
2021-10-18 20:36:05 +02:00
} else {
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-05-25 19:28:02 +02:00
else if ( matchDomain ( 'hindustantimes.com' ) ) {
let paywall = document . querySelector ( '.freemium-card' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let freemium _text = document . querySelector ( '.freemiumText' ) ;
if ( freemium _text )
freemium _text . classList . remove ( 'freemiumText' ) ;
}
let noscroll = document . querySelector ( 'body.open-popup' ) ;
if ( noscroll )
noscroll . classList . remove ( 'open-popup' ) ;
let close _story = document . querySelector ( '.closeStory' ) ;
let ads = document . querySelectorAll ( 'div[class^="adHeight"]' ) ;
removeDOMElement ( close _story , ... ads ) ;
}
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-06-27 09:56:42 +02:00
else if ( matchDomain ( [ 'houstonchronicle.com' , 'sfchronicle.com' ] ) ) {
let wrapper = document . querySelector ( '.belowMastheadWrapper' ) ;
removeDOMElement ( wrapper ) ;
}
2021-08-05 19:43:10 +02:00
else if ( matchDomain ( 'inc42.com' ) ) {
let url = window . location . href ;
if ( ! url . includes ( '/amp/' ) ) {
let premium = document . querySelector ( 'div.premium-container' ) ;
if ( premium ) {
removeDOMElement ( premium ) ;
window . location . href = url . split ( '?' ) [ 0 ] + 'amp/' ;
}
} else {
let plus _popup = document . querySelector ( 'div#plus-pop' ) ;
if ( plus _popup ) {
removeDOMElement ( plus _popup ) ;
let expired = document . querySelectorAll ( 'div[amp-access="p.showPageviewExpired"], div[amp-access="cm.maxViews AND NOT loggedIn"]' ) ;
removeDOMElement ( ... expired ) ;
let not _expired = document . querySelectorAll ( 'div[amp-access^="NOT p.showPageviewExpired"][amp-access-hide]' ) ;
for ( let elem of not _expired )
elem . removeAttribute ( 'amp-access-hide' ) ;
}
}
}
2021-07-19 17:54:59 +02:00
else if ( matchDomain ( 'infzm.com' ) ) {
let url = window . location . href ;
if ( url . includes ( '/wap/#/' ) ) {
let container = document . querySelector ( 'section.container' ) ;
if ( container )
container . classList . remove ( 'container' ) ;
let overlay = document . querySelector ( 'div.article-content[style]' ) ;
if ( overlay )
overlay . removeAttribute ( 'style' ) ;
}
}
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' ) ) {
2021-08-17 18:37:06 +02:00
let ng _click = summary _body . getAttribute ( 'ng-click' ) . replace ( "showArticle('" , '' ) . replace ( "')" , '' ) ;
let weblink = document . createElement ( 'a' ) ;
2021-04-10 08:46:50 +02:00
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 ) ;
}
2021-08-27 08:37:12 +02:00
else if ( matchDomain ( 'law360.com' ) ) {
window . setTimeout ( function ( ) {
let modal = document . querySelectorAll ( 'div#NewsletterModal, div.modal-backdrop' ) ;
removeDOMElement ( ... modal ) ;
} , 500 ) ; // Delay (in milliseconds)
}
2021-08-13 17:29:49 +02:00
else if ( matchDomain ( 'livelaw.in' ) ) {
let paywall = document . querySelectorAll ( 'div.restricted_message > div.story, div.restricted_message > div.row' ) ;
if ( paywall ) {
removeDOMElement ( ... paywall ) ;
let paywall _content = document . querySelector ( 'div.paywall-content.hide' ) ;
if ( paywall _content )
paywall _content . classList . remove ( 'hide' ) ;
}
}
2021-04-10 08:46:50 +02:00
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 ) ;
2021-10-09 20:24:37 +02:00
let preview = document . querySelector ( 'div[subscriptions-section="content-not-granted"]' ) ;
if ( preview ) {
removeDOMElement ( preview ) ;
let subscr _section = document . querySelector ( 'section[subscriptions-section="content"]' ) ;
if ( subscr _section )
subscr _section . removeAttribute ( 'subscriptions-section' ) ;
}
2021-04-10 08:46:50 +02:00
}
let ads = document . querySelectorAll ( 'div.element--ad, div.j-ad' ) ;
removeDOMElement ( ... ads ) ;
}
2021-08-10 17:24:03 +02:00
else if ( matchDomain ( 'medianama.com' ) ) {
window . setTimeout ( function ( ) {
let modal = document . querySelector ( 'div.modal' ) ;
removeDOMElement ( modal ) ;
} , 500 ) ; // Delay (in milliseconds)
}
2021-04-10 08:46:50 +02:00
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' ) ) {
2021-06-30 18:20:20 +02:00
// plus code in contentScript_once.js
let url = window . location . href ;
let subscribed = document . querySelector ( '.Article__Content--gated' ) ;
let overlay = document . querySelector ( '.Article__Content__Overlay--gated' ) ;
let msg = document . querySelector ( 'div#bpc_archive' ) ;
if ( subscribed && ! msg ) {
2021-07-04 08:43:45 +02:00
subscribed . appendChild ( archiveLink ( url ) ) ;
2021-06-30 18:20:20 +02:00
subscribed . setAttribute ( 'style' , 'overflow: visible !important;' ) ;
if ( overlay )
overlay . classList . remove ( 'Article__Content__Overlay--gated' ) ;
2021-04-10 08:46:50 +02:00
}
2021-01-26 21:27:43 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'nationalreview.com' ) ) {
2021-10-13 17:59:18 +02:00
let url = window . location . href . split ( '?' ) [ 0 ] ;
if ( ! url . includes ( '/amp/' ) ) {
let continue _reading = document . querySelector ( 'div.continue-reading' ) ;
if ( continue _reading ) {
removeDOMElement ( continue _reading ) ;
window . location . href = url + 'amp' ;
2021-04-10 08:46:50 +02:00
}
2021-10-13 17:59:18 +02:00
}
let adverts = document . querySelectorAll ( 'amp-ad, .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' ) ) {
2021-07-07 18:30:24 +02:00
window . setTimeout ( function ( ) {
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: ' ) ;
}
} , 500 ) ; // Delay (in milliseconds)
2021-04-10 08:46:50 +02:00
}
else if ( matchDomain ( 'newstatesman.com' ) ) {
let tns _modal _wrapper = document . querySelector ( '.tns-modal-wrapper' ) ;
removeDOMElement ( tns _modal _wrapper ) ;
}
2021-09-29 20:43:21 +02:00
else if ( matchDomain ( 'newrepublic.com' ) ) {
let pw _opups = document . querySelector ( 'div#pwPopups' ) ;
removeDOMElement ( pw _opups ) ;
}
2021-10-20 21:02:32 +02:00
else if ( matchDomain ( 'newyorker.com' ) && window . location . href . split ( '?' ) [ 0 ] . match ( /\.com\/.+\// ) ) {
2021-04-10 08:46:50 +02:00
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 parser = new DOMParser ( ) ;
for ( let overlay of overlays ) {
2021-05-23 20:42:28 +02:00
let noscript = overlay . querySelector ( 'noscript' ) ;
2021-10-22 12:36:47 +02:00
if ( noscript && noscript . innerHTML && dompurify _loaded ) {
2021-06-29 19:59:15 +02:00
let html = parser . parseFromString ( DOMPurify . sanitize ( noscript . innerHTML ) , 'text/html' ) ;
2021-04-10 08:46:50 +02:00
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' ) ;
2021-10-22 12:36:47 +02:00
if ( article _offer && dompurify _loaded ) {
2021-04-10 08:46:50 +02:00
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 ) ;
2021-08-31 18:22:53 +02:00
let par _html , par _dom ;
2021-04-10 08:46:50 +02:00
let parser = new DOMParser ( ) ;
for ( let hidden _par of hidden _pars ) {
2021-06-29 19:59:15 +02:00
let par _html = parser . parseFromString ( '<div style="margin: 10px 0px; font-size: 17px">' + DOMPurify . sanitize ( hidden _par . innerHTML ) + '</div>' , 'text/html' ) ;
2021-04-10 08:46:50 +02:00
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' ) ) {
2021-09-05 18:47:28 +02:00
// plus code in contentScript_once.js
2021-04-16 19:45:11 +02:00
let locked _article = document . querySelector ( 'div.locked-article' ) ;
if ( locked _article )
locked _article . classList . remove ( 'locked-article' ) ;
}
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-07-04 08:43:45 +02:00
csDoneOnce = 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' ) ) {
2021-06-29 21:13:53 +02:00
let url = window . location . href ;
2021-04-10 08:46:50 +02:00
window . setTimeout ( function ( ) {
if ( url . includes ( 'utm_source=' ) )
window . location . href = url . split ( '?' ) [ 0 ] ;
} , 500 ) ; // Delay (in milliseconds)
2021-06-29 21:13:53 +02:00
let paywall = document . querySelector ( 'div.KbD9m' ) ;
let overflow = document . querySelector ( 'div._7S-qA' ) ;
let msg = document . querySelector ( 'div#bpc_archive' ) ;
if ( paywall && ! msg ) {
if ( overflow )
overflow . classList . remove ( '_7S-qA' ) ;
let article = document . querySelector ( 'div#article-content' ) ;
if ( article )
2021-07-04 08:43:45 +02:00
article . appendChild ( archiveLink ( url ) ) ;
2021-06-29 21:13:53 +02:00
}
2021-01-30 19:18:00 +01:00
}
2021-08-08 18:09:48 +02:00
else if ( matchDomain ( 'sandiegouniontribune.com' ) ) {
2021-08-17 18:37:06 +02:00
window . setTimeout ( function ( ) {
let metering _bottompanel = document . querySelector ( 'metering-bottompanel' ) ;
removeDOMElement ( metering _bottompanel ) ;
} , 500 ) ; // Delay (in milliseconds)
2021-08-08 18:09:48 +02:00
}
2021-05-10 18:12:59 +02:00
else if ( matchDomain ( 'scmp.com' ) && window . location . href . includes ( '/amp.' ) ) {
2021-09-04 11:23:58 +02:00
let div _hidden = document . querySelectorAll ( 'div.article-body[amp-access][amp-access-hide]' ) ;
for ( let elem of div _hidden )
elem . removeAttribute ( 'amp-access-hide' ) ;
2021-05-10 18:12:59 +02:00
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/' ) ) {
2021-09-04 11:23:58 +02:00
let div _hidden = document . querySelectorAll ( '[amp-access*="premium_access OR"][amp-access-hide]' ) ;
for ( let elem of div _hidden )
elem . removeAttribute ( 'amp-access-hide' ) ;
2021-04-10 08:46:50 +02:00
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 ( '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-05-27 20:22:45 +02:00
else if ( matchDomain ( 'staradvertiser.com' ) ) {
let url = window . location . href . split ( '?' ) [ 0 ] ;
if ( url . endsWith ( '/amp/' ) ) {
let section _not _granted = document . querySelector ( 'section[subscriptions-section="content-not-granted"]' ) ;
if ( section _not _granted ) {
removeDOMElement ( section _not _granted ) ;
let hidden _content = document . querySelector ( 'section[subscriptions-section="content"]' ) ;
if ( hidden _content )
hidden _content . removeAttribute ( 'subscriptions-section' ) ;
}
} else {
let paywall = document . querySelector ( 'div#hsa-paywall-overlay' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let div _hidden = document . querySelector ( 'div#hsa-paywall-content[style]' ) ;
if ( div _hidden )
div _hidden . removeAttribute ( 'style' ) ;
}
}
}
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' ) ) {
2021-09-28 20:42:02 +02:00
let banner = document . querySelector ( '.free-cta-container, .paywall-banner' ) ;
2021-04-10 08:46:50 +02:00
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' ) ) ;
2021-10-25 19:05:57 +02:00
let url = window . location . href . split ( '?' ) [ 0 ] ;
if ( url . match ( /(\/(\d){4}-([a-z]|-)+-forecast(-([a-z]|-)+)?|-forecast-(\d){4}-([a-z]|[0-9]|-)+)$/ ) ) {
json _script = document . querySelector ( 'script#__NEXT_DATA__' ) ;
if ( json _script && dompurify _loaded ) {
let json = JSON . parse ( json _script . innerText ) ;
if ( json && json . props . pageProps . data ) {
let overview _div = document . querySelector ( 'div[class^="overview_overview__"] > div' ) ;
if ( overview _div ) {
let data = json . props . pageProps . data ;
let parser = new DOMParser ( ) ;
2021-10-26 18:29:26 +02:00
let data _overview = data . overview ;
if ( ! parseHtmlEntities ( data _overview ) . includes ( data . teaser _body ) )
data _overview = '<p>' + data . teaser _body + '</p>' + data _overview ;
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( data _overview + '<p><h2>Sections</h2></p>' ) + '</div>' , 'text/html' ) ;
2021-10-25 19:05:57 +02:00
let content _new = doc . querySelector ( 'div' ) ;
let sections = data . section ;
for ( let section of sections ) {
let section _link = document . createElement ( 'a' ) ;
section _link . innerText = section . title ;
section _link . href = 'https://' + window . location . hostname + '/' + section . path _alias ;
content _new . appendChild ( section _link ) ;
content _new . appendChild ( document . createElement ( 'br' ) ) ;
}
overview _div . parentNode . replaceChild ( content _new , overview _div ) ;
csDoneOnce = true ;
}
}
}
waitDOMElement ( 'div.paywall-banner' , 'DIV' , removeDOMElement , false ) ;
} else if ( url . match ( /\/article\/.+-forecast(-.+)?\// ) ) {
let next _section _buttons = document . querySelectorAll ( 'div[class^="nextSection_nextSection__"] > button' ) ;
for ( let elem of next _section _buttons ) {
let section _link = document . createElement ( 'a' ) ;
section _link . innerText = elem . innerText ;
section _link . href = url . replace ( /[^\/]+$/ , '' ) + elem . innerText . split ( ': ' ) [ 1 ] . toLowerCase ( ) . split ( ' ' ) . filter ( x => ! [ 'a' , 'an' , 'of' , 'the' ] . includes ( x ) ) . join ( '-' ) ;
elem . parentNode . replaceChild ( section _link , elem ) ;
}
}
2021-04-10 08:46:50 +02:00
}
2021-08-08 20:39:12 +02:00
else if ( matchDomain ( 'study.com' ) ) {
let faded _content = document . querySelector ( 'div.faded-content' ) ;
if ( faded _content )
faded _content . removeAttribute ( 'class' ) ;
let div _hidden = document . querySelector ( 'div.hidden[ng-non-bindable]' ) ;
if ( div _hidden )
div _hidden . removeAttribute ( 'class' ) ;
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'techinasia.com' ) ) {
let paywall = document . querySelector ( '.paywall-content' ) ;
2021-10-22 12:36:47 +02:00
if ( paywall && dompurify _loaded ) {
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 ;
2021-10-15 16:06:02 +02:00
let url _xhr = url . replace ( '.com/' , '.com/wp-json/techinasia/2.0/posts/' ) . replace ( '/visual-story/' , '/' ) ;
2021-05-02 16:14:45 +02:00
fetch ( url _xhr )
. then ( response => {
if ( response . ok ) {
response . json ( ) . then ( json => {
let json _text = json . posts [ 0 ] . content ;
2021-05-27 20:22:45 +02:00
json _text = json _text . replace ( /width\=\"(\d){3,}\"/g , 'width="100%"' ) . replace ( /height\=\"(\d){3,}\"/g , 'height="100%"' ) ;
2021-05-02 16:14:45 +02:00
let content = document . querySelector ( 'div.content' ) ;
if ( json _text && content ) {
let parser = new DOMParser ( ) ;
2021-06-29 19:59:15 +02:00
let doc = parser . parseFromString ( '<div class="jsx-1794864983 content">' + DOMPurify . sanitize ( json _text ) + '</div>' , 'text/html' ) ;
2021-05-02 16:14:45 +02:00
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-08-13 15:29:59 +02:00
else if ( matchDomain ( 'thedailybeast.com' ) ) {
let paywall = document . querySelector ( 'div.Body__paywall-container' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let json _script = document . querySelector ( 'script[displayName="initialState"]' ) ;
if ( json _script ) {
2021-08-19 09:03:09 +02:00
let json _str = json _script . text . substring ( json _script . textContent . indexOf ( '{' ) ) ;
try {
let json = JSON . parse ( json _str ) ;
if ( json . body ) {
let pars = json . body . sections ;
let cards = json . body . cards ;
if ( pars ) {
let mobile _doc = document . querySelector ( 'div.Mobiledoc' ) ;
if ( mobile _doc ) {
let mobile _doc _text = mobile _doc . innerText . replace ( /(\r|\n)/g , '' ) ;
for ( let elem of pars ) {
let par _elem = '' ;
if ( elem [ 0 ] === 1 ) {
if ( elem [ 1 ] === 'p' ) {
let par = '' ;
for ( let part of elem [ 2 ] )
par += part [ 3 ] ;
if ( par && ! mobile _doc _text . includes ( par ) ) {
par _elem = document . createElement ( 'p' ) ;
par _elem . innerText = par ;
}
}
} else if ( elem [ 0 ] === 10 ) {
if ( cards && cards [ elem [ 1 ] ] ) {
let card = cards [ elem [ 1 ] ] ;
if ( card [ 0 ] === 'pt-image' ) {
par _elem = document . createElement ( 'p' ) ;
let par _fig = document . createElement ( 'figure' ) ;
let par _img = document . createElement ( 'img' ) ;
par _img . src = card [ 1 ] . url ;
par _fig . appendChild ( par _img ) ;
par _elem . appendChild ( par _fig ) ;
let par _cap = document . createElement ( 'figcaption' ) ;
par _cap . innerText = card [ 1 ] . title + ' ' + card [ 1 ] . credit ;
par _elem . appendChild ( par _cap ) ;
} else if ( card [ 0 ] === 'pt-fancy-links-card' ) {
par _elem = document . createElement ( 'p' ) ;
let par _link = document . createElement ( 'a' ) ;
par _link . href = card [ 1 ] . links ;
par _link . innerText = card [ 1 ] . linksData [ 0 ] . long _headline ;
par _elem . appendChild ( par _link ) ;
}
}
}
if ( par _elem )
mobile _doc . appendChild ( par _elem ) ;
2021-08-13 15:29:59 +02:00
}
2021-08-19 09:03:09 +02:00
}
2021-08-13 15:29:59 +02:00
}
}
2021-08-19 09:03:09 +02:00
csDoneOnce = true ;
} catch ( err ) {
console . log ( err ) ;
2021-08-13 15:29:59 +02: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' ) ;
2021-10-22 12:36:47 +02:00
if ( article _body _subscribed )
2021-04-10 08:46:50 +02:00
article _body _subscribed . removeAttribute ( 'class' ) ;
}
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-06-12 18:19:48 +02:00
else if ( matchDomain ( 'thewrap.com' ) ) {
let paywall = document . querySelector ( '.wrappro-paywall' ) ;
if ( paywall )
paywall . classList . remove ( 'wrappro-paywall' ) ;
}
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-10-05 18:20:00 +02:00
let hidden _images = document . querySelectorAll ( 'img.b-lazy[src^="data:image/"][data-src]' ) ;
for ( let hidden _image of hidden _images ) {
hidden _image . setAttribute ( 'src' , hidden _image . getAttribute ( 'data-src' ) ) ;
hidden _image . classList . remove ( 'b-lazy' ) ;
hidden _image . parentElement . classList . remove ( 'media--loading' ) ;
}
let ads = document . querySelectorAll ( 'div[id^="div-gpt-in-article-ad-"], div[class^="the-dfp__in-article-ATD"]' ) ;
removeDOMElement ( ... ads ) ;
2021-03-20 17:16:30 +01:00
}
2021-07-23 17:47:39 +02:00
else if ( matchDomain ( timesofindia _domains ) ) {
let region _block = document . querySelector ( 'div.plan-popup.active' ) ;
if ( region _block ) {
removeDOMElement ( region _block ) ;
let overflow = document . querySelector ( 'html[style]' ) ;
if ( overflow )
overflow . removeAttribute ( 'style' ) ;
}
}
2021-07-23 16:12:10 +02:00
else if ( matchDomain ( no _nhst _media _domains ) ) {
2021-07-11 11:21:13 +02:00
let url = window . location . href ;
2021-07-23 16:12:10 +02:00
if ( url . includes ( '.tradewinds.com/markets/' ) ) {
2021-07-11 11:21:13 +02:00
let paywall = document . querySelector ( 'iframe[src]' ) ;
removeDOMElement ( paywall ) ;
let overflow = document . querySelector ( 'body[style]' ) ;
if ( overflow )
overflow . removeAttribute ( 'style' ) ;
let blurred = document . querySelector ( 'body > div[style]' ) ;
if ( blurred )
blurred . removeAttribute ( 'style' ) ;
} else {
window . setTimeout ( function ( ) {
let paywall = document . querySelector ( 'iframe#paywall-iframe' ) ;
2021-10-22 12:36:47 +02:00
if ( paywall && dompurify _loaded ) {
2021-07-11 11:21:13 +02:00
removeDOMElement ( paywall ) ;
fetch ( url )
. then ( response => {
if ( response . ok ) {
response . text ( ) . then ( html => {
let split1 = html . split ( 'window.__INITIAL_STATE__=' ) [ 1 ] ;
let state = split1 . split ( '};' ) [ 0 ] + '}' ;
if ( state ) {
let json = JSON . parse ( state ) ;
if ( json ) {
let json _text = json . article . body ;
let parser = new DOMParser ( ) ;
2021-07-23 17:47:39 +02:00
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( json _text , { ADD _ATTR : [ 'itemprop' ] , ADD _TAGS : [ 'link' ] } ) + '</div>' , 'text/html' ) ;
2021-07-11 11:21:13 +02:00
let article _new = doc . querySelector ( 'div' ) ;
let article = document . querySelector ( 'div.article-body-preview' ) ;
if ( article _new ) {
if ( article )
article . parentNode . replaceChild ( article _new , article ) ;
}
}
}
} )
}
} )
}
} , 500 ) ; // Delay (in milliseconds)
}
}
2021-08-17 22:45:11 +02:00
else if ( matchDomain ( usa _craincomm _domains ) ) {
2021-06-20 20:32:12 +02:00
let body _hidden = document . querySelector ( 'body[class]' ) ;
if ( body _hidden )
body _hidden . removeAttribute ( 'class' ) ;
2021-08-23 20:50:54 +02:00
let lazy _images = document . querySelectorAll ( 'img.lazy[data-src]' ) ;
for ( let lazy _image of lazy _images ) {
lazy _image . src = lazy _image . getAttribute ( 'data-src' ) ;
lazy _image . removeAttribute ( 'class' ) ;
}
let lazy _sources = document . querySelectorAll ( 'source[srcset^="data:image"]' ) ;
removeDOMElement ( ... lazy _sources ) ;
2021-06-20 20:32:12 +02:00
}
else if ( matchDomain ( usa _tribune _domains ) ) {
let overlay = document . querySelector ( 'div#zephr-overlay' ) ;
removeDOMElement ( overlay ) ;
}
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 ) {
2021-09-28 21:44:43 +02:00
let is _gated = document . querySelector ( '.is-gated' ) ;
if ( is _gated )
is _gated . classList . remove ( 'is-gated' ) ;
2021-04-10 09:49:45 +02:00
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' ) ) {
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)
2021-07-04 08:43:45 +02:00
} else {
2021-11-02 23:22:45 +01:00
let leaderboard = document . querySelector ( '#leaderboard-wrapper' ) ;
let adverts = document . querySelectorAll ( 'div[data-qa$="-ad"]' ) ;
removeDOMElement ( leaderboard , ... adverts ) ;
2021-07-04 08:43:45 +02:00
}
2021-04-05 19:56:50 +02:00
}
2021-10-23 09:59:06 +02:00
else if ( matchDomain ( 'wired.com' ) ) {
let url = window . location . href . split ( '?' ) [ 0 ] ;
if ( url . endsWith ( '/amp' ) ) {
let preview = document . querySelector ( 'section[subscriptions-section="content-not-granted"]' ) ;
removeDOMElement ( preview ) ;
let subscr _section = document . querySelector ( '[subscriptions-section="content"]' ) ;
if ( subscr _section )
subscr _section . removeAttribute ( 'subscriptions-section' ) ;
let amp _ads = document . querySelectorAll ( '.ad' ) ;
removeDOMElement ( ... amp _ads ) ;
}
}
2021-10-06 08:46:58 +02:00
else if ( matchDomain ( 'wsj.com' ) ) {
2021-08-01 10:30:10 +02:00
let url = window . location . href ;
2021-04-10 08:46:50 +02:00
if ( location . href . includes ( '/articles/' ) ) {
let close _button = document . querySelector ( 'div.close-btn[role="button"]' ) ;
if ( close _button )
close _button . click ( ) ;
}
2021-11-02 19:00:40 +01:00
let wsj _ads = document . querySelectorAll ( 'div[class*="wsj-ad"]' ) ;
2021-04-10 08:46:50 +02:00
removeDOMElement ( ... wsj _ads ) ;
2021-08-01 10:30:10 +02:00
if ( url . includes ( '/amp/' ) ) {
let masthead _link = document . querySelector ( 'div.masthead > a[href*="/articles/"]' ) ;
if ( masthead _link )
masthead _link . href = 'https://www.wsj.com' ;
2021-09-23 22:57:33 +02:00
let preview = document . querySelector ( 'section[subscriptions-section="content-not-granted"]' ) ;
removeDOMElement ( preview ) ;
let subscr _section = document . querySelector ( 'section[subscriptions-section="content"]' ) ;
if ( subscr _section )
subscr _section . removeAttribute ( 'subscriptions-section' ) ;
2021-08-01 10:30:10 +02:00
} else {
2021-11-02 19:00:40 +01:00
let snippet = document . querySelector ( '.snippet-promotion' ) ;
let wsj _pro = document . querySelector ( 'meta[name="page.site"][content="wsjpro"]' ) ;
if ( snippet || wsj _pro ) {
removeDOMElement ( snippet , wsj _pro ) ;
window . location . href = url . replace ( 'wsj.com' , 'wsj.com/amp' ) ;
}
2021-08-01 10:30:10 +02:00
}
2021-04-07 22:24:53 +02:00
}
2021-08-10 19:11:51 +02: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/ ) && document . querySelector ( 'a[href^="https://classifieds.mcclatchy.com/"]' ) ) ) {
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-08-16 22:49:58 +02:00
else if ( ( domain = matchDomain ( usa _mng _domains ) ) || ( window . location . href . match ( /\.com\/(\d){4}\/(\d){2}\/(\d){2}\/.+\/amp\// ) && document . querySelector ( 'amp-img#paywall[src*=".com/wp-content/plugins/dfm-amp-mods/"]' ) ) ) {
let url = window . location . href ;
if ( url . split ( '?' ) [ 0 ] . endsWith ( '/amp/' ) ) {
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, amp-embed' ) ;
removeDOMElement ( ... amp _ads ) ;
}
}
2021-04-10 08:46:50 +02:00
else
csDone = true ;
}
2021-10-17 21:15:00 +02:00
if ( ( csDone && ( bg2csData !== undefined ) ) || csDoneOnce ) {
2021-04-25 13:45:36 +02:00
addDivBpcDone ( ) ;
2021-10-17 21:15:00 +02:00
if ( csDone && ( bg2csData !== undefined ) && ! bg2csData . amp _unhide )
2021-07-04 08:43:45 +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
}
2021-07-10 19:02:46 +02:00
function waitDOMAttribute ( selector , tagName = '' , attributeName = '' , callback , multiple = false ) {
let targetNode = document . querySelector ( selector ) ;
if ( ! targetNode )
return ;
new window . MutationObserver ( function ( mutations ) {
for ( let mutation of mutations ) {
if ( mutation . target . attributes [ attributeName ] ) {
callback ( mutation . target ) ;
if ( ! multiple )
this . disconnect ( ) ;
}
}
} ) . observe ( targetNode , {
attributes : true ,
attributeFilter : [ attributeName ]
} ) ;
}
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-08-17 18:37:06 +02:00
let matched _domain = false ;
2021-04-10 08:46:50 +02:00
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 ( ) ;
2021-07-10 11:27:04 +02:00
let doc = parser . parseFromString ( DOMPurify . sanitize ( html , { ADD _ATTR : [ 'layout' ] , ADD _TAGS : [ 'amp-img' ] } ) , 'text/html' ) ;
//console.log(DOMPurify.removed);
2021-04-10 08:46:50 +02:00
let article _new = doc . querySelector ( selector ) ;
if ( article _new ) {
2021-08-15 23:01:29 +02:00
if ( article && article . parentNode )
2021-04-10 08:46:50 +02:00
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
}
2021-07-04 08:43:45 +02:00
function archiveLink ( url ) {
let archive _url = 'https://archive.today/newest/' + url ;
2021-06-29 21:13:53 +02:00
let text _fail _div = document . createElement ( 'div' ) ;
text _fail _div . id = 'bpc_archive' ;
text _fail _div . appendChild ( document . createTextNode ( 'BPC > Read full article text:\r\n' ) ) ;
let a _link = document . createElement ( 'a' ) ;
a _link . innerText = archive _url ;
a _link . href = archive _url ;
a _link . target = '_blank' ;
a _link . setAttribute ( 'style' , 'font-weight: bold;' ) ;
text _fail _div . appendChild ( a _link ) ;
return text _fail _div ;
}
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-08-17 18:37:06 +02:00
let max _age = days * 24 * 60 * 60 ;
2021-04-10 08:46:50 +02:00
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 = '' ;
2021-08-17 18:37:06 +02:00
let characters = '123456789' ;
let charactersLength = characters . length ;
for ( let i = 0 ; i < len ; i ++ )
2021-04-10 08:46:50 +02:00
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-08-17 18:37:06 +02:00
let translate _re = /&(nbsp|amp|quot|lt|gt|deg|hellip|laquo|raquo|ldquo|rdquo|lsquo|rsquo|mdash);/g ;
let translate = { "nbsp" : " " , "amp" : "&" , "quot" : "\"" , "lt" : "<" , "gt" : ">" , "deg" : "°" , "hellip" : "…" ,
2021-04-10 08:46:50 +02:00
"laquo" : "«" , "raquo" : "»" , "ldquo" : "“" , "rdquo" : "”" , "lsquo" : "‘ " , "rsquo" : "’ " , "mdash" : "—" } ;
return encodedString . replace ( translate _re , function ( match , entity ) {
return translate [ entity ] ;
} ) . replace ( /&#(\d+);/gi , function ( match , numStr ) {
2021-08-17 18:37:06 +02:00
let num = parseInt ( numStr , 10 ) ;
2021-04-10 08:46:50 +02:00
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
}