2020-10-01 14:11:57 +00:00
//"use strict";
2020-09-08 14:38:18 +00:00
var ext _api = ( typeof browser === 'object' ) ? browser : chrome ;
var domain ;
2020-12-04 15:14:23 +00:00
var csDone = false ;
2021-07-04 06:43:45 +00:00
var csDoneOnce = false ;
2021-10-22 10:36:47 +00:00
var dompurify _loaded = ( typeof DOMPurify === 'function' ) ;
2020-09-08 14:38:18 +00:00
2022-07-31 06:31:05 +00:00
var ca _gcm _domains = [ 'lesoleil.com' ] . concat ( [ 'latribune.ca' , 'lavoixdelest.ca' , 'ledroit.com' , 'ledroitfranco.com' , 'lenouvelliste.ca' , 'lequotidien.com' ] ) ;
2021-01-08 17:40:14 +00:00
var ca _torstar _domains = [ 'niagarafallsreview.ca' , 'stcatharinesstandard.ca' , 'thepeterboroughexaminer.com' , 'therecord.com' , 'thespec.com' , 'thestar.com' , 'wellandtribune.ca' ] ;
2022-08-03 17:01:39 +00:00
var de _funke _medien _domains = [ 'abendblatt.de' , 'braunschweiger-zeitung.de' , 'morgenpost.de' , 'nrz.de' , 'otz.de' , 'thueringer-allgemeine.de' , 'tlz.de' , 'waz.de' , 'wp.de' , 'wr.de' ] ;
2022-03-31 16:10:47 +00:00
var de _madsack _domains = [ 'haz.de' , 'kn-online.de' , 'ln-online.de' , 'lvz.de' , 'maz-online.de' , 'neuepresse.de' , 'ostsee-zeitung.de' , 'rnd.de' ] ;
2022-04-06 15:17:13 +00:00
var de _madsack _custom _domains = [ 'aller-zeitung.de' , 'dnn.de' , 'gnz.de' , 'goettinger-tageblatt.de' , 'paz-online.de' , 'sn-online.de' , 'waz-online.de' ] ;
2022-08-03 17:01:39 +00:00
var de _westfalen _medien _domains = [ 'muensterschezeitung.de' , 'westfalen-blatt.de' , 'wn.de' ] ;
2022-08-21 06:59:42 +00:00
var es _epiberica _domains = [ 'diariodemallorca.es' , 'eldia.es' , 'epe.es' , 'farodevigo.es' , 'informacion.es' , 'laprovincia.es' , 'levante-emv.com' , 'lne.es' , 'mallorcazeitung.es' ] ;
var es _epiberica _custom _domains = [ 'diaridegirona.cat' , 'diariocordoba.com' , 'diariodeibiza.es' , 'elperiodicodearagon.com' , 'elperiodicoextremadura.com' , 'elperiodicomediterraneo.com' , 'emporda.info' , 'laopinioncoruna.es' , 'laopiniondemalaga.es' , 'laopiniondemurcia.es' , 'laopiniondezamora.es' , 'regio7.cat' ] ;
2022-08-15 16:05:49 +00:00
var es _grupo _vocento _domains = [ 'abc.es' , '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 17:20:35 +00:00
var es _unidad _domains = [ 'elmundo.es' , 'expansion.com' , 'marca.com' ] ;
2022-09-24 16:54:10 +00:00
var fr _be _groupe _rossel = [ 'aisnenouvelle.fr' , 'courrier-picard.fr' , 'lardennais.fr' , 'lavoixdunord.fr' , 'lesoir.be' , 'lest-eclair.fr' , 'liberation-champagne.fr' , 'lunion.fr' , 'nordeclair.fr' , 'nordlittoral.fr' , 'paris-normandie.fr' , 'sudinfo.be' ] ;
2020-12-06 21:32:59 +00: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 17:10:59 +00:00
var fr _groupe _la _depeche _domains = [ 'centrepresseaveyron.fr' , 'ladepeche.fr' , 'lindependant.fr' , 'midi-olympique.fr' , 'midilibre.fr' , 'nrpyrenees.fr' , 'petitbleu.fr' ] ;
2021-12-31 10:50:38 +00:00
var fr _groupe _nice _matin _domains = [ 'monacomatin.mc' , 'nicematin.com' , 'varmatin.com' ] ;
2021-12-12 12:21:28 +00:00
var it _ilmessaggero _domains = [ 'corriereadriatico.it' , 'ilgazzettino.it' , 'ilmattino.it' , 'ilmessaggero.it' , 'quotidianodipuglia.it' ] ;
2022-08-04 15:38:34 +00:00
var it _gedi _domains = [ 'gelocal.it' , 'huffingtonpost.it' , 'ilsecoloxix.it' , 'italian.tech' , 'lastampa.it' , 'lescienze.it' , 'limesonline.com' , 'repubblica.it' ] ;
2021-07-30 06:52:20 +00:00
var it _quotidiano _domains = [ 'ilgiorno.it' , 'ilrestodelcarlino.it' , 'iltelegrafolivorno.it' , 'lanazione.it' , 'quotidiano.net' ] ;
2022-04-28 15:52:26 +00:00
var medium _custom _domains = [ 'betterprogramming.pub' , 'towardsdatascience.com' ] ;
2021-06-20 19:41:11 +00:00
var nl _mediahuis _region _domains = [ 'gooieneemlander.nl' , 'haarlemsdagblad.nl' , 'ijmuidercourant.nl' , 'leidschdagblad.nl' , 'noordhollandsdagblad.nl' ] ;
2022-08-03 18:12:52 +00:00
var nl _dpg _media _domains = [ 'demorgen.be' , 'humo.be' , 'parool.nl' , 'trouw.nl' , 'volkskrant.nl' ] ;
2022-10-24 17:07:37 +00:00
var no _nhst _media _domains = [ 'dn.no' , 'europower-energi.no' , 'fiskeribladet.no' , 'intrafish.com' , 'intrafish.no' , 'rechargenews.com' , 'tradewindsnews.com' , 'upstreamonline.com' ] ;
2022-02-11 16:51:33 +00:00
var pe _grupo _elcomercio _domains = [ 'diariocorreo.pe' , 'elcomercio.pe' , 'gestion.pe' ] ;
2021-07-23 15:47:39 +00:00
var timesofindia _domains = [ 'timesofindia.com' , 'timesofindia.indiatimes.com' ] ;
2021-11-16 17:21:56 +00:00
var usa _adv _local _domains = [ 'al.com' , 'cleveland.com' , 'lehighvalleylive.com' , 'masslive.com' , 'mlive.com' , 'nj.com' , 'oregonlive.com' , 'pennlive.com' , 'silive.com' , 'syracuse.com' ] ;
2022-07-05 15:10:41 +00:00
var usa _conde _nast _domains = [ 'architecturaldigest.com' , 'bonappetit.com' , 'gq.com' , 'newyorker.com' , 'vanityfair.com' , 'vogue.com' , 'wired.com' ] ;
2021-08-17 20:45:11 +00:00
var usa _craincomm _domains = [ 'adage.com' , 'autonews.com' , 'chicagobusiness.com' , 'crainscleveland.com' , 'crainsdetroit.com' , 'crainsnewyork.com' , 'modernhealthcare.com' ] ;
2022-07-31 06:59:34 +00:00
var usa _genomeweb _domains = [ '360dx.com' , 'genomeweb.com' , 'precisiononcologynews.com' ] ;
2022-01-08 14:46:46 +00:00
var usa _hearst _comm _domains = [ 'expressnews.com' , 'houstonchronicle.com' , 'sfchronicle.com' ] ;
2022-08-31 17:56:03 +00:00
var usa _lee _ent _domains = [ 'buffalonews.com' , 'journalnow.com' , 'omaha.com' , 'richmond.com' , 'tucson.com' , 'tulsaworld.com' ] ;
2021-07-08 18:55:11 +00: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 20:49:58 +00:00
var usa _mng _domains = [ 'denverpost.com' , 'eastbaytimes.com' , 'mercurynews.com' , 'ocregister.com' , 'pe.com' , 'twincities.com' ] ;
2022-04-20 15:58:51 +00:00
var usa _outside _mag _domains = [ "backpacker.com" , "betamtb.com" , "betternutrition.com" , "cleaneatingmag.com" , "climbing.com" , "cyclingtips.com" , "gymclimber.com" , "outsideonline.com" , "oxygenmag.com" , "pelotonmagazine.com" , "podiumrunner.com" , "rockandice.com" , "skimag.com" , "trailrunnermag.com" , "triathlete.com" , "vegetariantimes.com" , "velonews.com" , "womensrunning.com" , "yogajournal.com" ] ;
2021-06-20 18:32:12 +00: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 19:23:12 +00:00
// clean local storage of sites (with an exemption for hold-list)
2022-10-24 14:35:15 +00:00
var arr _localstorage _hold = [ 'aachener-nachrichten.de' , 'aachener-zeitung.de' , 'allgaeuer-zeitung.de' , 'augsburger-allgemeine.de' , 'barrons.com' , 'businessoffashion.com' , 'challenges.fr' , 'charliehebdo.fr' , 'cmjornal.pt' , 'corriere.it' , 'corrieredellosport.it' , 'cyclingtips.com' , 'eldiario.es' , 'elespanol.com' , 'elle.fr' , 'elpais.com' , 'elperiodico.com' , 'enotes.com' , 'estadao.com.br' , 'forbes.com' , 'fortune.com' , 'economictimes.com' , 'freiepresse.de' , 'ilfoglio.it' , 'inc42.com' , 'lanouvellerepublique.fr' , 'nknews.org' , 'latimes.com' , 'lesechos.fr' , 'livemint.com' , 'mid-day.com' , 'nw.de' , 'nytimes.com' , 'nzherald.co.nz' , 'sandiegouniontribune.com' , 'scmp.com' , 'seekingalpha.com' , 'substack.com' , 'telegraph.co.uk' , 'tes.com' , 'theatlantic.com' , 'thecritic.co.uk' , 'thetimes.co.uk' , 'uol.com.br' , 'wsj.com' ] . concat ( ca _gcm _domains , de _funke _medien _domains , de _westfalen _medien _domains , es _epiberica _domains , es _epiberica _custom _domains , es _grupo _vocento _domains , es _unidad _domains , fr _groupe _ebra _domains , fr _groupe _la _depeche _domains , fr _groupe _nice _matin _domains , it _gedi _domains , it _quotidiano _domains , ca _gcm _domains , nl _dpg _media _domains , no _nhst _media _domains , usa _hearst _comm _domains ) ;
2021-04-10 06:46:50 +00:00
if ( ! matchDomain ( arr _localstorage _hold ) ) {
window . localStorage . clear ( ) ;
2019-12-06 15:15:49 +00:00
}
2019-12-10 19:08:01 +00:00
2022-03-30 16:22:36 +00:00
function getArticleJsonScript ( ) {
let scripts = document . querySelectorAll ( 'script[type="application/ld+json"]' ) ;
let json _script ;
for ( let script of scripts ) {
if ( script . innerText . includes ( 'articleBody' ) ) {
json _script = script ;
break ;
}
}
return json _script ;
}
2022-02-22 18:23:36 +00:00
var bg2csData ;
// custom/updated sites: load text from json
if ( ( bg2csData !== undefined ) && bg2csData . ld _json && dompurify _loaded ) {
if ( bg2csData . ld _json . includes ( '|' ) ) {
2022-08-01 18:49:58 +00:00
window . setTimeout ( function ( ) {
let ld _json _split = bg2csData . ld _json . split ( '|' ) ;
let paywall _sel = ld _json _split [ 0 ] ;
let article _sel = ld _json _split [ 1 ] ;
2022-08-10 17:19:51 +00:00
let paywall = document . querySelectorAll ( paywall _sel ) ;
if ( paywall . length ) {
removeDOMElement ( ... paywall ) ;
2022-08-01 18:49:58 +00:00
let json _script = getArticleJsonScript ( ) ;
if ( json _script ) {
let json _text = parseHtmlEntities ( JSON . parse ( json _script . text ) . articleBody ) ;
let content = document . querySelector ( article _sel ) ;
if ( json _text && content ) {
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( json _text ) + '</div>' , 'text/html' ) ;
let content _new = doc . querySelector ( 'div' ) ;
content . parentNode . replaceChild ( content _new , content ) ;
}
2022-02-22 18:23:36 +00:00
}
}
2022-08-01 18:49:58 +00:00
} , 1000 ) ;
}
}
// custom/updated sites: load text from Google webcache
if ( ( bg2csData !== undefined ) && bg2csData . ld _google _webcache && dompurify _loaded ) {
if ( bg2csData . ld _google _webcache . includes ( '|' ) ) {
window . setTimeout ( function ( ) {
let url = window . location . href ;
let ld _google _webcache _split = bg2csData . ld _google _webcache . split ( '|' ) ;
let paywall _sel = ld _google _webcache _split [ 0 ] ;
let article _sel = ld _google _webcache _split [ 1 ] ;
2022-08-10 17:19:51 +00:00
let paywall = document . querySelectorAll ( paywall _sel ) ;
if ( paywall . length ) {
removeDOMElement ( ... paywall ) ;
2022-08-02 15:26:56 +00:00
let url _cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url . split ( '?' ) [ 0 ] ;
2022-08-01 18:49:58 +00:00
replaceDomElementExt ( url _cache , true , false , article _sel ) ;
}
} , 1000 ) ;
2022-02-22 18:23:36 +00:00
}
}
2021-04-11 09:17:37 +00:00
var div _bpc _done = document . querySelector ( 'div#bpc_done' ) ;
if ( ! div _bpc _done ) {
2022-07-04 18:35:30 +00:00
if ( ext _api . runtime ) {
ext _api . runtime . onMessage . addListener (
function ( request , sender ) {
if ( request . msg === 'showExtSrc' ) {
replaceDomElementExtSrc ( request . data . url , request . data . html , true , false , request . data . selector , request . data . text _fail , request . data . selector _source ) ;
}
}
)
}
2022-04-09 15:07:30 +00:00
2021-10-17 13:16:44 +00:00
// check for opt-in confirmation (from background.js)
2021-10-17 19:15:00 +00:00
if ( ( bg2csData !== undefined ) && bg2csData . optin _setcookie ) {
2022-07-30 05:41:59 +00:00
if ( matchDomain ( [ 'crusoe.uol.com.br' ] ) ) {
2022-07-29 16:20:36 +00:00
if ( ! cookieExists ( 'crs_subscriber' ) )
setCookie ( 'crs_subscriber' , 1 , 'crusoe.uol.com.br' , '/' , 14 ) ;
2021-10-17 13:16:44 +00:00
}
2021-01-01 11:23:29 +00:00
}
2020-09-08 14:38:18 +00:00
2022-02-03 18:11:51 +00:00
function amp _iframes _replace ( weblink = false , source = '' ) {
let amp _iframes = document . querySelectorAll ( 'amp-iframe' + ( source ? '[src*="' + source + '"]' : '' ) ) ;
2022-08-15 16:05:49 +00:00
let par , elem ;
2021-12-01 17:33:33 +00:00
for ( let amp _iframe of amp _iframes ) {
if ( ! weblink ) {
elem = document . createElement ( 'iframe' ) ;
Object . assign ( elem , {
src : amp _iframe . getAttribute ( 'src' ) ,
sandbox : amp _iframe . getAttribute ( 'sandbox' ) ,
height : amp _iframe . getAttribute ( 'height' ) ,
2021-12-10 17:16:56 +00:00
width : 'auto' ,
2021-12-01 17:33:33 +00:00
style : 'border: 0px;'
} ) ;
2022-08-11 06:33:14 +00:00
amp _iframe . parentNode . replaceChild ( elem , amp _iframe ) ;
2021-12-01 17:33:33 +00:00
} else {
2022-08-15 16:05:49 +00:00
par = document . createElement ( 'p' ) ;
2022-08-11 06:33:14 +00:00
elem = document . createElement ( 'a' ) ;
elem . innerText = 'Media-link' ;
elem . setAttribute ( 'href' , amp _iframe . getAttribute ( 'src' ) ) ;
elem . setAttribute ( 'target' , '_blank' ) ;
2022-08-15 16:05:49 +00:00
par . appendChild ( elem ) ;
amp _iframe . parentNode . replaceChild ( par , amp _iframe ) ;
2021-12-01 17:33:33 +00:00
}
}
}
2022-02-03 18:11:51 +00:00
function amp _unhide _subscr _section ( amp _ads _sel = 'amp-ad, .ad' , replace _iframes = true , amp _iframe _link = false , source = '' ) {
2021-11-30 16:36:15 +00:00
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 amp _ads = document . querySelectorAll ( amp _ads _sel ) ;
removeDOMElement ( ... amp _ads ) ;
2021-12-24 07:32:45 +00:00
if ( replace _iframes )
2022-02-03 18:11:51 +00:00
amp _iframes _replace ( amp _iframe _link , source ) ;
2021-11-30 16:36:15 +00:00
}
2022-02-03 18:11:51 +00:00
function amp _unhide _access _hide ( amp _access = '' , amp _access _not = '' , amp _ads _sel = 'amp-ad, .ad' , replace _iframes = true , amp _iframe _link = false , source = '' ) {
2022-04-01 14:04:06 +00:00
let access _hide = document . querySelectorAll ( '[amp-access' + amp _access + '][amp-access-hide]:not([amp-access="error"], [amp-access^="message"])' ) ;
2022-03-08 18:04:50 +00:00
for ( let elem of access _hide )
2021-11-30 16:36:15 +00:00
elem . removeAttribute ( 'amp-access-hide' ) ;
if ( amp _access _not ) {
2022-01-18 19:16:52 +00:00
let amp _access _not _dom = document . querySelectorAll ( '[amp-access' + amp _access _not + ']' ) ;
removeDOMElement ( ... amp _access _not _dom ) ;
2021-11-30 16:36:15 +00:00
}
let amp _ads = document . querySelectorAll ( amp _ads _sel ) ;
removeDOMElement ( ... amp _ads ) ;
2021-12-24 07:32:45 +00:00
if ( replace _iframes )
2022-02-03 18:11:51 +00:00
amp _iframes _replace ( amp _iframe _link , source ) ;
2021-11-30 16:36:15 +00:00
}
2022-02-22 18:23:36 +00:00
// custom/updated sites: try to unhide text on amp-page
2021-10-17 19:15:00 +00:00
if ( ( bg2csData !== undefined ) && bg2csData . amp _unhide ) {
window . setTimeout ( function ( ) {
2021-12-02 17:02:07 +00:00
let amp _page _hide = document . querySelector ( 'script[src*="/amp-access-"], script[src*="/amp-subscriptions-"]' ) ;
if ( amp _page _hide ) {
2021-11-30 16:36:15 +00:00
amp _unhide _subscr _section ( ) ;
amp _unhide _access _hide ( ) ;
2021-12-01 17:33:33 +00:00
amp _iframes _replace ( ) ;
2021-11-17 16:45:33 +00:00
}
2022-03-08 18:04:50 +00:00
} , 100 ) ;
2021-11-17 16:45:33 +00:00
}
2022-02-22 18:23:36 +00:00
// custom/updated sites: amp-redirect
2021-11-17 16:45:33 +00:00
if ( ( bg2csData !== undefined ) && bg2csData . amp _redirect ) {
window . setTimeout ( function ( ) {
2021-12-02 17:02:07 +00:00
let amp _script = document . querySelector ( 'script[src^="https://cdn.ampproject.org/"]' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
let amp _page = amp _script && ! amphtml ;
2021-11-17 16:45:33 +00:00
if ( ! amp _page ) {
let paywall = true ;
if ( bg2csData . amp _redirect . paywall )
paywall = document . querySelector ( bg2csData . amp _redirect . paywall ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
2021-10-17 19:15:00 +00:00
}
2022-03-08 18:04:50 +00:00
} , 500 ) ;
2021-10-17 19:15:00 +00:00
}
2021-11-18 16:55:25 +00:00
function cs _code _elems ( elems ) {
for ( let elem of elems ) {
let elem _dom = document . querySelectorAll ( elem . cond ) ;
for ( let item of elem _dom ) {
if ( elem . rm _elem )
removeDOMElement ( item ) ;
if ( elem . rm _class ) {
let rm _class = elem . rm _class . split ( ',' ) . map ( x => x . trim ( ) ) ;
item . classList . remove ( ... rm _class ) ;
}
if ( elem . rm _attrib )
item . removeAttribute ( elem . rm _attrib ) ;
2022-05-03 15:42:51 +00:00
if ( elem . set _attrib && elem . set _attrib . includes ( '|' ) ) {
let attrib = elem . set _attrib . split ( '|' ) [ 0 ] ;
let value = elem . set _attrib . split ( '|' ) [ 1 ] ;
item . setAttribute ( attrib , value ) ;
}
2021-11-18 16:55:25 +00:00
if ( elem . elems )
cs _code _elems ( elem . elems ) ;
}
}
}
// updated sites: cs_code
if ( ( bg2csData !== undefined ) && bg2csData . cs _code ) {
window . setTimeout ( function ( ) {
cs _code _elems ( bg2csData . cs _code ) ;
2022-03-08 18:04:50 +00:00
} , 1000 ) ;
2021-11-18 16:55:25 +00:00
}
2020-01-28 22:06:25 +00:00
// Content workarounds/domain
2020-03-27 20:13:28 +00:00
2022-04-28 15:52:26 +00:00
if ( matchDomain ( 'medium.com' ) || matchDomain ( medium _custom _domains ) || document . querySelector ( 'script[src^="https://cdn-client.medium.com/"]' ) ) {
2021-04-10 06:46:50 +00:00
let paywall = document . querySelector ( 'div#paywall-background-color' ) ;
removeDOMElement ( paywall ) ;
2021-08-22 15:42:56 +00:00
if ( paywall ) {
2021-06-09 19:32:35 +00:00
ext _api . runtime . sendMessage ( { request : 'refreshCurrentTab' } ) ;
2021-08-22 15:42:56 +00:00
csDoneOnce = true ;
}
2021-04-10 06:46:50 +00:00
window . setTimeout ( function ( ) {
let meter = document . querySelector ( '[id*="highlight-meter-"]' ) ;
if ( meter )
meter . hidden = true ;
2022-03-08 18:04:50 +00:00
} , 500 ) ;
2020-08-12 06:37:21 +00:00
}
2021-05-29 06:00:38 +00:00
else if ( window . location . hostname . match ( /\.(com|net)\.au$/ ) ) { //australia
2020-09-10 20:01:35 +00:00
2021-05-29 06:00:38 +00:00
if ( matchDomain ( 'thesaturdaypaper.com.au' ) ) {
2021-04-10 06:46:50 +00:00
let paywall = document . querySelector ( 'div.paywall-hard-always-show' ) ;
removeDOMElement ( paywall ) ;
2021-02-20 09:18:12 +00:00
}
2022-05-27 13:11:37 +00:00
else if ( matchDomain ( [ 'brisbanetimes.com.au' , 'smh.com.au' , 'theage.com.au' , 'watoday.com.au' ] ) ) {
if ( ! window . location . hostname . startsWith ( 'amp.' ) ) {
let paywall = document . querySelector ( 'meta[content^="FOR SUBSCRIBERS"], #paywall_prompt' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
} else {
2021-11-30 16:36:15 +00:00
amp _unhide _subscr _section ( ) ;
2021-04-10 06:46:50 +00:00
}
}
else {
// Australian Community Media newspapers
2022-05-06 16:46:36 +00:00
let au _comm _media _domains = [ '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' , 'standard.net.au' , 'theadvocate.com.au' , 'thecourier.com.au' , 'westernadvocate.com.au' ] ;
2022-03-19 18:32:07 +00:00
let au _comm _media _link = document . querySelector ( 'a[href^="https://australiancommunitymedia.zendesk.com"]' ) ;
if ( matchDomain ( au _comm _media _domains ) || au _comm _media _link ) {
2022-08-04 05:57:25 +00:00
let mask = document . querySelector ( 'div[style*="mask-image"]' ) ;
2022-03-22 19:42:01 +00:00
if ( mask ) {
mask . removeAttribute ( 'style' ) ;
2022-08-04 05:57:25 +00:00
let div _hidden = document . querySelectorAll ( 'div.hidden' ) ;
2022-05-06 16:46:36 +00:00
for ( let elem of div _hidden )
elem . classList . remove ( 'hidden' ) ;
2022-03-22 19:42:01 +00:00
} else {
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' ) ;
}
2021-04-10 06:46:50 +00:00
let blocker = document . querySelector ( 'div.blocker' ) ;
2022-08-31 06:40:16 +00:00
let overlays = document . querySelectorAll ( 'div.transition-all, div[id^="headlessui-dialog"]' ) ;
let noscroll = document . querySelectorAll ( 'html[style], body[style]' ) ;
for ( let elem of noscroll )
elem . removeAttribute ( 'style' ) ;
2021-04-10 06:46:50 +00:00
let story _generic _iframe = document . querySelector ( '.story-generic__iframe' ) ;
2022-08-04 05:57:25 +00:00
let ads = document . querySelectorAll ( '.ad-placeholder, .sticky, [id*="-container"], #hindsight-ads-iframe' ) ;
2022-08-30 16:51:01 +00:00
removeDOMElement ( story _generic _iframe , blocker , ... overlays , ... ads ) ;
2021-04-10 06:46:50 +00:00
} else if ( window . location . hostname . endsWith ( '.com.au' ) ) {
// Australia News Corp
2022-01-22 17:37:56 +00:00
let au _news _corp _domains = [ 'adelaidenow.com.au' , 'cairnspost.com.au' , 'codesports.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' ] ;
2022-05-27 13:11:37 +00:00
if ( matchDomain ( au _news _corp _domains ) ) {
2022-09-29 07:24:42 +00:00
if ( window . location . hostname . startsWith ( 'amp.' ) || window . location . search . match ( /(\?|&)amp/ ) ) {
let figure _stretch = document . querySelectorAll ( 'figure.stretch' ) ;
for ( let elem of figure _stretch )
elem . classList . remove ( 'stretch' ) ;
let amp _ads _sel = 'amp-ad, amp-embed, [id^="ad-mrec-"], .story-ad-container' ;
let comments ;
if ( window . location . hostname . startsWith ( 'amp.' ) ) {
amp _unhide _subscr _section ( amp _ads _sel , true , true , '.newscdn.com.au' ) ;
comments = document . querySelector ( '#story-comments, .comments-wrapper' ) ;
} else if ( window . location . search . match ( /(\?|&)amp/ ) ) {
amp _unhide _subscr _section ( amp _ads _sel , true , true , '.newscdn.com.au' ) ;
comments = document . querySelector ( '#comments-load' ) ;
let amp _iframe _sizers = document . querySelectorAll ( 'amp-iframe > i-amphtml-sizer' ) ;
removeDOMElement ( ... amp _iframe _sizers )
}
removeDOMElement ( comments ) ;
} else {
2022-10-14 13:53:54 +00:00
let ads = document . querySelectorAll ( '.header_ads-container, .ad-block, .ad-container' ) ;
2022-09-29 07:24:42 +00:00
removeDOMElement ( ... ads ) ;
2021-12-01 18:06:40 +00:00
}
2021-04-10 06:46:50 +00:00
} else {
// Australian Seven West Media
2022-01-25 17:15:31 +00:00
let swm _image = document . querySelector ( 'img[src^="https://images.thewest.com.au"]' ) ;
if ( matchDomain ( 'thewest.com.au' ) || swm _image ) {
2021-04-10 06:46:50 +00:00
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 17:59:15 +00:00
let par _elem , par _sub1 , par _sub2 ;
let par _dom = document . createElement ( 'div' ) ;
let tweet _id = 1 ;
2021-04-10 06:46:50 +00:00
for ( let par of json _content ) {
2021-06-29 17:59:15 +00:00
par _elem = '' ;
2021-04-10 06:46:50 +00:00
if ( par . kind === 'text' ) {
2021-06-29 17:59:15 +00:00
par _elem = document . createElement ( 'p' ) ;
par _elem . innerText = par . text ;
2021-04-10 06:46:50 +00:00
} else if ( par . kind === 'subhead' ) {
2021-06-29 17:59:15 +00:00
par _elem = document . createElement ( 'h2' ) ;
par _elem . innerText = par . text ;
2021-04-10 06:46:50 +00:00
} else if ( par . kind === 'pull-quote' ) {
2021-06-29 17:59:15 +00:00
par _elem = document . createElement ( 'i' ) ;
par _elem . innerText = ( par . attribution ? par . attribution + ': ' : '' ) + par . text ;
2021-04-10 06:46:50 +00:00
} else if ( par . kind === 'embed' ) {
if ( par . reference . includes ( 'https://omny.fm/' ) || par . reference . includes ( 'https://docdro.id/' ) ) {
2021-06-29 17:59:15 +00: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 06:46:50 +00:00
} else {
2021-06-29 17:59:15 +00:00
par _elem = document . createElement ( 'a' ) ;
par _elem . href = par . reference ;
par _elem . innerText = par . reference . split ( '?' ) [ 0 ] ;
2021-04-10 06:46:50 +00:00
console . log ( 'embed: ' + par . reference ) ;
}
} else if ( par . kind === 'unordered-list' ) {
if ( par . items ) {
2021-06-29 17:59:15 +00:00
par _elem = document . createElement ( 'ul' ) ;
2021-04-10 06:46:50 +00:00
for ( let item of par . items )
2021-07-10 17:02:46 +00:00
if ( item . text ) {
2021-06-29 17:59:15 +00:00
par _sub1 = document . createElement ( 'li' ) ;
2021-07-10 17:02:46 +00: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 17:59:15 +00:00
par _sub2 . innerText = item . text ;
par _sub1 . appendChild ( par _sub2 ) ;
par _elem . appendChild ( par _sub1 ) ;
2021-04-10 06:46:50 +00:00
}
}
} else if ( par . kind === 'inline' ) {
if ( par . asset . kind === 'image' ) {
2021-06-29 17:59:15 +00: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 06:46:50 +00:00
}
} else {
2021-06-29 17:59:15 +00:00
par _elem = document . createElement ( 'p' ) ;
par _elem . innerText = par . text ;
2021-04-10 06:46:50 +00:00
console . log ( par . kind ) ;
}
2021-06-29 17:59:15 +00:00
if ( par _elem )
par _dom . appendChild ( par _elem ) ;
2021-04-10 06:46:50 +00: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 ) ;
}
2022-03-08 18:04:50 +00:00
} , 1500 ) ;
2021-04-10 06:46:50 +00:00
let header _advert = document . querySelector ( '.headerAdvertisement' ) ;
if ( header _advert )
header _advert . setAttribute ( 'style' , 'display: none;' ) ;
}
2019-11-22 04:17:21 +00:00
}
2021-04-10 06:46:50 +00:00
}
else
2021-04-25 11:45:36 +00:00
csDone = true ;
2020-01-28 22:06:25 +00:00
}
2022-06-05 20:19:26 +00:00
} else if ( window . location . hostname . match ( /\.(de|at|ch)$/ ) || matchDomain ( [ 'faz.net' ] ) ) { //germany/austria/switzerland - ch
2021-04-10 06:46:50 +00:00
2022-08-11 19:51:18 +00:00
if ( matchDomain ( 'allgaeuer-zeitung.de' ) ) {
2021-12-18 11:33:08 +00:00
let url = window . location . href ;
if ( ! url . includes ( '?type=amp' ) ) {
let paywall = document . querySelector ( 'p.nfy-text-blur' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
window . location . href = url . split ( '?' ) [ 0 ] + '?type=amp' ;
}
} else {
let preview = document . querySelectorAll ( 'p.nfy-text-blur, div[subscriptions-display^="NOT data."]' ) ;
let amp _ads = document . querySelectorAll ( 'amp-ad' ) ;
removeDOMElement ( ... preview , ... amp _ads ) ;
}
}
2022-09-30 15:40:10 +00:00
else if ( matchDomain ( 'arcinfo.ch' ) ) {
let paywall = document . querySelector ( 'section#paywall-articles' ) ;
if ( paywall && dompurify _loaded ) {
removeDOMElement ( paywall ) ;
2022-10-13 06:01:45 +00:00
let url _id = window . location . href . split ( /[\?#]/ ) [ 0 ] . match ( /\d+$/ ) . pop ( ) ;
2022-09-30 15:40:10 +00:00
let html = document . documentElement . outerHTML ;
2022-10-10 17:34:52 +00:00
let og _url = document . querySelector ( 'meta[name="og:url"][content]' ) ;
2022-10-13 06:01:45 +00:00
if ( og _url && ( og _url . content . match ( /\d+$/ ) . pop ( ) !== url _id ) )
2022-10-10 17:34:52 +00:00
window . location . reload ( true ) ;
2022-09-30 15:40:10 +00:00
let json ;
if ( html . includes ( 'window.__NUXT__=' ) )
2022-10-10 17:34:52 +00:00
json = html . split ( 'window.__NUXT__=' ) [ 1 ] . split ( '</script>' ) [ 0 ] . trim ( ) . replace ( /blocs:\[\{.*?\}\],/g , '' ) ;
2022-09-30 15:40:10 +00:00
let article = document . querySelector ( 'div.html-content' ) ;
2022-10-10 17:34:52 +00:00
let no _intro = false ;
if ( ! article ) {
article = document . querySelector ( 'div.container-mobile-full' ) ;
no _intro = true ;
}
2022-09-30 15:40:10 +00:00
if ( article && json ) {
let content = '' ;
2022-10-09 18:20:19 +00:00
if ( json . includes ( 'text_1="' ) )
content = json . split ( 'text_1="' ) . pop ( ) . split ( '";' ) [ 0 ] ;
2022-09-30 15:40:10 +00:00
else {
let parts = json . split ( 'html:"' ) ;
2022-10-13 06:01:45 +00:00
parts . splice ( 0 , 1 ) ;
for ( let part of parts )
content += part . split ( '",has_pre_content' ) [ 0 ] ;
2022-09-30 15:40:10 +00:00
}
if ( content ) {
content = content . replace ( /\\u003C/g , '<' ) . replace ( /\\u003E/g , '>' ) . replace ( /\\u002F/g , '/' ) . replace ( /\\"/g , '"' ) . replace ( /\\r\\n/g , '' ) ;
let parser = new DOMParser ( ) ;
let content _new = parser . parseFromString ( '<div class="html-content">' + DOMPurify . sanitize ( content ) + '</div>' , 'text/html' ) ;
2022-10-10 17:34:52 +00:00
let article _top ;
if ( ! no _intro ) {
article _top = article . parentNode . parentNode ;
removeDOMElement ( article . parentNode ) ;
} else
article _top = article ;
2022-09-30 15:40:10 +00:00
article _top . appendChild ( content _new . querySelector ( 'div' ) ) ;
} else {
window . location . reload ( true ) ;
}
}
}
}
2021-09-25 07:35:48 +00:00
else if ( matchDomain ( 'augsburger-allgemeine.de' ) ) {
2021-04-10 06:46:50 +00:00
let url = window . location . href ;
2021-06-28 06:51:33 +00: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-11-30 16:36:15 +00:00
amp _unhide _subscr _section ( ) ;
2021-04-10 06:46:50 +00:00
}
2021-02-19 18:28:36 +00:00
}
2022-06-28 15:48:17 +00:00
else if ( matchDomain ( 'automobilwoche.de' ) ) {
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-04-10 06:46:50 +00:00
else if ( matchDomain ( 'berliner-zeitung.de' ) ) {
2022-09-10 07:54:59 +00:00
let ads = document . querySelectorAll ( '[id^="traffective-ad"], [class^="ad-slot_wrapper"], [class^="outbrain_container"]' ) ;
removeDOMElement ( ... ads ) ;
2021-02-19 18:28:36 +00:00
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'cicero.de' ) ) {
let url = window . location . href ;
2022-04-19 19:37:22 +00:00
if ( ! window . location . search . match ( /(\?|&)amp/ ) ) {
2021-04-10 06:46:50 +00:00
let paywall = document . querySelector ( '.plenigo-paywall' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
2022-01-28 15:05:29 +00:00
let url _amp = url . split ( '?' ) [ 0 ] + '?amp' ;
2021-04-10 06:46:50 +00:00
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 22:06:25 +00:00
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'faz.net' ) ) {
if ( matchDomain ( 'zeitung.faz.net' ) ) {
let paywall _z = document . querySelector ( '.c-red-carpet' ) ;
if ( paywall _z ) {
2022-09-08 14:31:08 +00:00
removeDOMElement ( paywall _z ) ;
let og _url = document . querySelector ( 'meta[property="og:url"][content]' ) ;
2021-04-10 06:46:50 +00:00
if ( og _url )
2022-09-08 14:31:08 +00:00
window . location . href = og _url . content ;
2021-04-10 06:46:50 +00:00
}
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/' ) ;
2022-01-27 18:21:26 +00:00
try {
fetch ( mUrl )
. then ( response => {
if ( response . ok ) {
response . text ( ) . then ( html => {
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( html , 'text/html' ) ;
let json = doc . querySelector ( 'script[id="schemaOrgJson"]' ) ;
if ( json ) {
let json _text = json . text . replace ( /(\r|\n)/g , '' ) ;
let split1 = json _text . split ( '"ArticleBody": "' ) ;
let split2 = split1 [ 1 ] . split ( '","author":' ) ;
if ( split2 [ 0 ] . includes ( '"' ) )
json _text = split1 [ 0 ] + '"ArticleBody": "' + split2 [ 0 ] . replace ( /"/g , '“' ) + '","author":' + split2 [ 1 ] ;
try {
json _text = JSON . parse ( json _text ) . ArticleBody ;
} catch ( err ) {
console . log ( err ) ;
return ;
}
if ( ! json _text )
return ;
let article _text = document . querySelector ( '.art_txt.paywall,.atc-Text.js-atc-Text' ) ;
article _text . innerText = '' ;
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 ) ;
} ) ;
2021-04-10 06:46:50 +00:00
}
2022-01-27 18:21:26 +00:00
} )
}
} ) ;
} catch ( err ) {
console . log ( err ) ;
}
2021-04-10 06:46:50 +00:00
}
let lay _paysocial = document . querySelector ( 'div.lay-PaySocial' ) ;
removeDOMElement ( lay _paysocial ) ;
}
2020-01-28 22:06:25 +00:00
}
2019-10-08 15:41:09 +00:00
2021-04-10 06:46:50 +00: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 15:14:23 +00:00
window . setTimeout ( function ( ) {
2021-04-10 06:46:50 +00:00
window . location . href = url . replace ( '-artikel' , '-amp' ) ;
2022-03-08 18:04:50 +00:00
} , 500 ) ;
2021-04-10 06:46:50 +00: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 22:06:25 +00:00
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'krautreporter.de' ) ) {
2022-07-21 05:40:48 +00:00
let paywall = document . querySelector ( '.js-article-paywall' ) ;
2021-04-10 06:46:50 +00:00
if ( paywall ) {
2022-01-29 16:56:29 +00:00
removeDOMElement ( paywall ) ;
window . setTimeout ( function ( ) {
let paywall _divider = document . querySelector ( '.js-paywall-divider' ) ;
let steady _checkout = document . querySelector ( '#steady-checkout' ) ;
removeDOMElement ( paywall _divider , steady _checkout ) ;
let blurred = document . querySelectorAll ( '.blurred' ) ;
for ( let elem of blurred )
elem . classList . remove ( 'blurred' , 'json-ld-paywall-marker' , 'hidden@print' ) ;
2022-03-08 18:04:50 +00:00
} , 500 ) ;
2021-04-10 06:46:50 +00:00
}
2020-01-28 22:06:25 +00:00
}
2021-12-07 18:25:48 +00:00
else if ( matchDomain ( [ 'ksta.de' , 'rundschau-online.de' ] ) ) {
2022-06-24 10:39:49 +00:00
let paywall = document . querySelector ( 'div#c1-template-platzhalter' ) ;
2021-12-07 18:25:48 +00:00
if ( paywall ) {
removeDOMElement ( paywall ) ;
2022-06-24 10:39:49 +00:00
let span _hidden = document . querySelector ( 'span.hide-paid-content' ) ;
if ( span _hidden )
2022-07-13 06:44:00 +00:00
span _hidden . removeAttribute ( 'class' ) ;
2021-12-07 18:25:48 +00:00
}
}
2022-03-12 07:49:01 +00:00
else if ( matchDomain ( [ 'mz.de' , 'volksstimme.de' ] ) ) {
2021-11-04 18:28:07 +00:00
let url = window . location . href . split ( '?' ) [ 0 ] ;
let paywall = document . querySelector ( '.fp-paywall' ) ;
if ( url . includes ( '/amp/' ) ) {
2021-11-30 16:36:15 +00:00
amp _unhide _subscr _section ( 'amp-ad, amp-embed' ) ;
2021-11-04 18:28:07 +00:00
} else {
if ( paywall ) {
removeDOMElement ( paywall ) ;
window . location . href = window . location . href . replace ( '.de/' , '.de/amp/' ) ;
}
}
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( [ 'noz.de' , 'nwzonline.de' , 'shz.de' , 'svz.de' ] ) ) {
2022-02-15 17:44:41 +00:00
if ( window . location . pathname . match ( /(-amp\.html|\/amp)$/ ) ) {
2022-04-19 19:37:22 +00:00
amp _unhide _access _hide ( '="NOT data.reduced"' , '="data.reduced"' , 'amp-ad, amp-embed, .ads-wrapper, #flying-carpet-wrapper' ) ;
2021-04-10 06:46:50 +00:00
} else {
2021-09-04 09:23:58 +00:00
let paywall = document . querySelector ( '.paywall, .story--premium__container' ) ;
2021-04-10 06:46:50 +00:00
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
}
2019-10-05 12:08:57 +00:00
}
2022-08-17 17:10:58 +00:00
else if ( matchDomain ( 'nw.de' ) ) {
if ( ! window . location . pathname . endsWith ( '.amp.html' ) ) {
let paywall = document . querySelector ( 'div[data-tracking-visible^="paywall-"]' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
} else {
amp _unhide _access _hide ( '="loggedIn AND hasAbo"' , '' , 'amp-ad, amp-embed, .banner' ) ;
}
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'rheinpfalz.de' ) ) {
let url = window . location . href ;
if ( url . includes ( 'reduced=true' ) ) {
2020-09-24 18:50:29 +00:00
window . setTimeout ( function ( ) {
2021-04-10 06:46:50 +00:00
window . location . href = url . split ( '?' ) [ 0 ] ;
2022-03-08 18:04:50 +00:00
} , 500 ) ;
2021-04-10 06:46:50 +00:00
}
2019-10-14 12:52:27 +00:00
}
2022-06-30 17:51:51 +00:00
else if ( matchDomain ( 'spiegel.de' ) ) {
let url = window . location . href ;
let paywall = document . querySelector ( 'div[data-area="paywall"]' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
2022-08-11 19:51:18 +00:00
let article = document . querySelector ( 'div[data-area="body"]' ) ;
if ( article )
article . insertBefore ( archiveLink ( url ) , article . firstChild ) ;
2022-08-06 06:22:25 +00:00
}
}
2022-10-27 14:19:03 +00:00
else if ( matchDomain ( 'tagesspiegel.de' ) ) {
let url = window . location . href ;
let paywall = document . querySelector ( 'div.article--paid > div.Mb8' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let article = document . querySelector ( 'div.article--paid' ) ;
if ( article )
article . insertBefore ( archiveLink ( url ) , article . firstChild ) ;
}
}
2022-08-03 17:01:39 +00:00
else if ( matchDomain ( de _westfalen _medien _domains ) ) {
2021-10-01 13:28:11 +00:00
let url = window . location . href ;
if ( url . includes ( '/amp/' ) ) {
2021-11-30 16:36:15 +00:00
amp _unhide _subscr _section ( 'amp-ad, amp-embed, section[class^="fp-ad"]' ) ;
2021-10-29 06:48:52 +00:00
} else {
2022-08-03 17:01:39 +00:00
let paywall = document . querySelector ( '.fp-article-paywall' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
2021-10-29 06:48:52 +00:00
if ( paywall ) {
removeDOMElement ( paywall ) ;
2022-08-03 17:01:39 +00:00
if ( amphtml )
window . location . href = amphtml . href ;
2021-10-29 06:48:52 +00:00
}
2021-10-01 13:28:11 +00:00
}
}
2022-08-03 17:01:39 +00:00
else if ( matchDomain ( de _funke _medien _domains ) || document . querySelector ( 'a[href="https://www.funkemedien.de/"]' ) ) {
if ( window . location . search . startsWith ( '?service=amp' ) )
amp _unhide _access _hide ( '="NOT p.showRegWall AND NOT p.showPayWall"' , '' , 'amp-ad, amp-embed, amp-fx-flying-carpet' ) ;
else
sessionStorage . setItem ( 'deobfuscate' , 'true' ) ;
}
2022-04-06 15:17:13 +00:00
else if ( matchDomain ( de _madsack _domains ) || matchDomain ( de _madsack _custom _domains ) ) {
2022-03-30 16:22:36 +00:00
if ( ! ( window . location . pathname . startsWith ( '/amp/' ) || window . location . search . startsWith ( '?outputType=valid_amp' ) ) ) {
2021-04-24 07:37:20 +00:00
let paidcontent _intro = document . querySelector ( 'div.pdb-article-body-paidcontentintro' ) ;
if ( paidcontent _intro ) {
paidcontent _intro . classList . remove ( 'pdb-article-body-paidcontentintro' ) ;
2022-03-30 16:22:36 +00:00
let json _script = getArticleJsonScript ( ) ;
if ( json _script ) {
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 ;
}
2021-04-24 07:37:20 +00:00
}
let paidcontent _reg = document . querySelector ( 'div.pdb-article-paidcontent-registration' ) ;
removeDOMElement ( paidcontent _reg ) ;
2022-03-30 16:22:36 +00:00
} else {
let paywall = document . querySelector ( 'div.paywall' ) ;
if ( paywall ) {
let gradient = document . querySelector ( 'div[class^="ArticleContentLoaderstyled__Gradient"]' ) ;
let loading = document . querySelector ( '#article > svg' ) ;
removeDOMElement ( paywall , gradient , loading ) ;
let article = document . querySelector ( 'div[class*="ArticleTeaserContainer"] > div:not([class])' ) ;
let json _script = getArticleJsonScript ( ) ;
if ( json _script ) {
let json = JSON . parse ( json _script . text ) ;
if ( article && json ) {
2022-08-25 20:12:16 +00:00
article . parentNode . removeAttribute ( 'class' ) ;
2022-03-30 16:22:36 +00:00
let json _text = json . articleBody ;
let article _new = document . createElement ( 'span' ) ;
let par = article . querySelector ( 'p' ) ;
let par _class = par ? par . getAttribute ( 'class' ) : '' ;
article _new . setAttribute ( 'class' , par _class ) ;
article _new . innerText = json _text ;
article . innerText = '' ;
if ( json . articleSection ) {
let json _section = json . articleSection ;
let article _section = document . querySelector ( 'span' ) ;
article _section . setAttribute ( 'class' , par _class ) ;
article _section . setAttribute ( 'style' , 'font-weight: bold;' ) ;
article _section . innerText = json _section + '. ' ;
article . appendChild ( article _section ) ;
}
article . appendChild ( article _new ) ;
}
}
}
2021-04-24 07:37:20 +00:00
}
2022-09-16 06:13:19 +00:00
let ads = document . querySelectorAll ( 'div[class^="Adstyled__AdWrapper"]' ) ;
removeDOMElement ( ... ads ) ;
2022-04-06 15:17:13 +00:00
} else if ( window . location . pathname . startsWith ( '/amp/' ) ) {
2022-03-30 16:22:36 +00:00
amp _unhide _subscr _section ( '.pdb-ad-container, amp-embed' ) ;
2022-08-25 20:12:16 +00:00
} else {
2022-08-26 17:50:25 +00:00
ampToHtml ( ) ;
2021-04-24 07:37:20 +00:00
}
}
2021-12-22 18:03:54 +00:00
else
csDone = true ;
} else if ( window . location . hostname . match ( /\.(dk|fi|no|se)$/ ) ) { //denmark/finland/norway/sweden
2022-10-04 16:43:23 +00:00
if ( matchDomain ( 'iltalehti.fi' ) ) {
2022-04-15 13:11:11 +00:00
let ads = document . querySelectorAll ( 'div[class^="p2m385-"], div#anop-container, .ad, div.iZivCJ' ) ;
2022-10-19 19:28:47 +00:00
hideDOMElement ( ... ads ) ;
2022-10-04 16:43:23 +00:00
if ( true ) {
2022-02-27 07:04:42 +00:00
let paywall = document . querySelector ( 'div.faded-text' ) ;
2022-02-28 17:02:43 +00:00
if ( paywall && dompurify _loaded ) {
2022-02-27 07:04:42 +00:00
let scripts = document . querySelectorAll ( 'script' ) ;
let json _script ;
for ( let script of scripts ) {
if ( script . innerText . includes ( 'window.App=' ) ) {
json _script = script ;
break ;
}
}
if ( json _script ) {
let json = json _script . innerHTML . split ( 'window.App=' ) [ 1 ] . split ( '</script' ) [ 0 ] ;
json = json . replace ( /undefined/g , '"undefined"' ) ;
let json _article = JSON . parse ( json ) . state . articles ;
if ( ! Object . keys ( json _article ) . length )
ext _api . runtime . sendMessage ( { request : 'refreshCurrentTab' } ) ;
if ( Object . keys ( json _article ) . length ) {
paywall . remove ( ) ;
let url _loaded = Object . keys ( json _article ) [ 0 ] ;
if ( url _loaded && ! window . location . pathname . includes ( url _loaded ) )
ext _api . runtime . sendMessage ( { request : 'refreshCurrentTab' } ) ;
let pars = Object . values ( json _article ) [ 0 ] . items . body ;
let content = document . querySelector ( 'div.article-body' ) ;
if ( content && pars ) {
function ilta _par _text ( items ) {
let par _text = '' ;
for ( let item of items ) {
if ( item . text )
par _text += item . text ;
else if ( item . name )
par _text += '<a href="/henkilot/' + item . name + '">' + item . name + '</a>' ;
else if ( item . type === 'link' )
par _text += '<a href="' + item . url + '" target="_blank">' + item . items [ 0 ] . text + '</a>' ;
else if ( item . type ) {
let item _type = '<' + item . type [ 0 ] + '>' ;
par _text += item . items . map ( i => item _type + i . text + item _type . replace ( '<' , '</' ) ) . join ( '' ) ;
} else if ( item [ 0 ] ) { //aside-list
par _text += item [ 0 ] . text ;
}
}
return par _text ;
}
function ilta _wrap _list ( elem , par _text ) {
if ( par _text ) {
elem += '<div class="article-bullets"><ul>' ;
elem += par _text ;
elem += '</ul></div>' ;
}
return elem ;
}
content . innerHTML = '' ;
let article _new = '' ;
for ( let par of pars ) {
let elem = '' ;
let par _text = '' ;
let par _ignore = false ;
if ( par . type === 'paragraph' ) {
par _text = ilta _par _text ( par . items ) ;
if ( par _text )
elem = '<p class="paragraph">' + par _text + '</p>' ;
} else if ( par . type === 'subheadline' ) {
if ( par . text )
elem = '<h3 class="subheadline" style="margin:20px;">' + par . text + '</h3>' ;
} else if ( par . type === 'aside' ) {
elem = '<div class="aside-container"><div class="aside">' ;
for ( let item of par . items ) {
if ( item . text || ( item . type === 'paragraph' && item . items ) ) {
if ( par _text ) {
elem = ilta _wrap _list ( elem , par _text ) ;
par _text = '' ;
}
if ( item . text )
elem += '<h3 class="subheadline" style="margin:20px;">' + item . text + '</h3>' ;
else {
let par _text _sub = ilta _par _text ( item . items ) ;
if ( par _text _sub )
elem += '<p class="paragraph">' + par _text _sub + '</p>' ;
}
} else if ( item . type === 'list' ) {
let par _text _sub = ilta _par _text ( item . items ) ;
if ( par _text _sub ) {
par _text += '<li>' ;
par _text += par _text _sub ;
par _text += '</li>' ;
}
}
}
if ( par _text )
elem = ilta _wrap _list ( elem , par _text ) ;
elem += '</div></div>' ;
} else if ( par . type === 'blockquote' ) {
elem = '<p style="font-size: 1.2em; margin:20px;"><i>"' + par . items . map ( i => i . text ) . join ( '' ) + '"</i></p>' ;
} else if ( par . type === 'divider' ) {
elem = '<div class="article-divider"><div class="article-divider-content"></div></div>' ;
} else if ( par . type . toLowerCase ( ) === 'list' ) {
elem = '<div class="article-bullets"><ul>' ;
for ( let item of par . items )
elem += '<li>' + item . map ( i => i . text ) . join ( '' ) + '</li>' ;
elem += '</ul></div>' ;
} else if ( par . type === 'related-article' ) {
elem = '<div class="related-articles related-articles-within-text"><h3>Lue myös</h3><a href="/' + par . article . category . category _name + '/a/' + par . article . article _id + '">' + par . article . title + '</a></div>' ;
} else if ( par . type === 'image' ) {
2022-02-28 17:02:43 +00:00
if ( par . urls . default ) {
2022-02-27 07:04:42 +00:00
let caption = par . properties . caption ? par . properties . caption : '' ;
2022-02-28 17:02:43 +00:00
let source = par . properties . source ? par . properties . source : '' ;
elem = '<p><div><div style="text-align: center;"><img src="' + par . urls . default + '" alt="' + caption + '"></div><div class="media-caption"><span class="caption-text">' + caption + '</span><span class="media-source">' + source + '</span></div></div></p>' ;
2022-02-27 07:04:42 +00:00
}
} else if ( par . type === 'embed' ) {
2022-02-28 17:02:43 +00:00
elem = par . embed _html ;
2022-02-27 07:04:42 +00:00
} else if ( par . type === 'advertisement' ) {
par _ignore = true ;
}
if ( elem )
article _new += elem ;
else if ( ! par _ignore )
console . log ( par ) ;
}
let parser = new DOMParser ( ) ;
2022-02-28 17:02:43 +00:00
let par _html = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( article _new , { ADD _TAGS : [ 'iframe' ] } ) + '</div>' , 'text/html' ) ;
2022-02-27 07:04:42 +00:00
content . appendChild ( par _html . querySelector ( 'div' ) ) ;
}
}
}
}
}
2021-12-22 18:03:54 +00:00
}
else if ( matchDomain ( 'nyteknik.se' ) ) {
// plus code in contentScript_once.js
let locked _article = document . querySelector ( 'div.locked-article' ) ;
if ( locked _article )
locked _article . classList . remove ( 'locked-article' ) ;
}
2022-08-01 19:25:50 +00:00
else if ( matchDomain ( 'suomensotilas.fi' ) ) {
let obscured = document . querySelector ( 'div.epfl-pw-obscured' ) ;
if ( obscured )
obscured . classList . remove ( 'epfl-pw-obscured' ) ;
}
2021-04-10 06:46:50 +00:00
else
2021-04-25 11:45:36 +00:00
csDone = true ;
2021-04-10 06:46:50 +00:00
2022-04-26 06:15:18 +00:00
} else if ( window . location . hostname . match ( /\.(es|pt|cat)$/ ) || matchDomain ( [ 'diariocordoba.com' , 'diariovasco.com' , 'elconfidencial.com' , 'elcorreo.com' , 'elespanol.com' , 'elpais.com' , 'elperiodico.com' , 'elperiodicodearagon.com' , 'elperiodicoextremadura.com' , 'elperiodicomediterraneo.com' , 'emporda.info' , 'expansion.com' , 'larioja.com' , 'levante-emv.com' , 'marca.com' , 'politicaexterior.com' ] ) ) { //spain/portugal
2021-04-10 06:46:50 +00:00
2022-08-15 16:05:49 +00:00
if ( matchDomain ( [ 'ara.cat' , 'arabalears.cat' ] ) ) {
2022-05-22 17:59:59 +00:00
let url = window . location . href ;
if ( ! window . location . pathname . endsWith ( '.amp.html' ) ) {
let paywall = document . querySelector ( 'div.paywall' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
}
}
2021-12-09 20:32:27 +00:00
else if ( matchDomain ( 'cmjornal.pt' ) ) {
2021-04-10 06:46:50 +00:00
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-11-30 16:36:15 +00:00
amp _unhide _access _hide ( '="subscriber"' , '="NOT subscriber"' , 'amp-ad, amp-embed, #flying-carpet-wrapper' ) ;
2021-04-10 06:46:50 +00:00
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 22:06:25 +00:00
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'elconfidencial.com' ) ) {
let premium = document . querySelector ( 'div.newsType__content--closed' ) ;
if ( premium )
premium . classList . remove ( 'newsType__content--closed' ) ;
2022-09-21 16:31:24 +00:00
let ads = document . querySelectorAll ( 'div[id^="mega_"], div[id^="roba_"]' ) ;
removeDOMElement ( ... ads ) ;
2020-07-09 17:52:37 +00:00
}
2021-12-12 17:32:28 +00:00
else if ( matchDomain ( 'eldiario.es' ) ) {
if ( window . location . pathname . endsWith ( '.amp.html' ) ) {
amp _unhide _access _hide ( '^="access"' ) ;
2022-01-18 19:16:52 +00:00
} else {
let ads = document . querySelectorAll ( '.edi-advertising, .header-ad' ) ;
removeDOMElement ( ... ads ) ;
2021-12-12 17:32:28 +00:00
}
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'elespanol.com' ) ) {
2021-12-12 17:32:28 +00:00
if ( window . location . pathname . endsWith ( '.amp.html' ) ) {
amp _unhide _subscr _section ( 'amp-ad, amp-embed' ) ;
} else {
2022-08-13 05:51:42 +00:00
let paywall = document . querySelector ( 'div.full-suscriptor-container' ) ;
2021-12-12 17:32:28 +00:00
let adverts = document . querySelectorAll ( '[id*="superior"], [class*="adv"]' ) ;
2022-08-13 05:51:42 +00:00
removeDOMElement ( paywall , ... adverts ) ;
2021-12-12 17:32:28 +00:00
}
2020-01-28 22:06:25 +00:00
}
2021-12-27 16:22:54 +00:00
else if ( matchDomain ( es _unidad _domains ) ) {
2021-04-10 06:46:50 +00:00
let premium = document . querySelector ( '.ue-c-article__premium' ) ;
let url = window . location . href ;
2022-08-04 05:57:25 +00:00
if ( ! window . location . hostname . match ( /^amp(-[a-z]{2})?\./ ) ) {
2021-04-10 06:46:50 +00:00
if ( premium ) {
removeDOMElement ( premium ) ;
2021-12-27 16:22:54 +00:00
window . location . href = url . replace ( '/www.' , '/amp.' ) ;
2021-04-10 06:46:50 +00:00
}
} else {
2021-11-30 16:36:15 +00:00
amp _unhide _access _hide ( '="authorized=true"' , '="authorized!=true"' ) ;
amp _unhide _subscr _section ( '.advertising, amp-embed, amp-ad' ) ;
2021-04-10 06:46:50 +00:00
}
}
else if ( matchDomain ( 'elpais.com' ) ) {
2021-10-08 06:11:56 +00:00
let login _register = document . querySelector ( '.login_register' ) ;
2022-04-21 17:52:47 +00:00
if ( window . location . pathname . endsWith ( '.amp.html' ) || window . location . search . match ( /(\?|&)outputType=amp/ ) ) {
amp _unhide _access _hide ( '="vip"], [amp-access="success"' , '="NOT vip"], [amp-access="NOT success"' ) ;
2021-11-30 16:36:15 +00:00
removeDOMElement ( login _register ) ;
2021-04-10 06:46:50 +00:00
} else {
2021-10-07 17:37:31 +00:00
let counter = document . querySelector ( '#counterLayerDiv' ) ;
removeDOMElement ( counter ) ;
2021-12-27 16:22:54 +00:00
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
2022-04-21 17:52:47 +00:00
if ( login _register && amphtml ) {
2021-10-08 06:11:56 +00:00
removeDOMElement ( login _register , video ) ;
2021-04-10 06:46:50 +00:00
window . location . href = amphtml . href ;
}
}
let paywall _offer = document . querySelector ( '.paywallOffer' ) ;
2022-04-21 17:52:47 +00:00
let ctn _closed _article = document . querySelector ( '#ctn_closed_article, #ctn_freemium_article, #ctn_premium_article' ) ;
2021-10-08 06:11:56 +00:00
removeDOMElement ( paywall _offer , ctn _closed _article ) ;
2019-12-05 20:32:20 +00:00
}
2021-04-10 06:46:50 +00: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-11-30 16:36:15 +00:00
removeDOMElement ( not _logged ) ;
amp _unhide _access _hide ( '^="logged"' , '^="NOT logged"' ) ;
2021-04-10 06:46:50 +00:00
}
2020-12-04 15:14:23 +00:00
window . setTimeout ( function ( ) {
2021-04-10 06:46:50 +00: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/' ) ;
}
2022-03-08 18:04:50 +00:00
} , 3000 ) ;
2021-04-10 06:46:50 +00:00
}
2020-01-28 22:06:25 +00:00
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( es _grupo _vocento _domains ) ) {
2022-10-21 10:44:02 +00:00
let paywall = document . querySelector ( '.voc-paywall, .container-wall-exclusive, .cierre-suscripcion:not([style="display: none;"])' ) ;
2022-04-29 15:58:48 +00:00
if ( ! window . location . pathname . endsWith ( '_amp.html' ) ) {
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
2022-08-15 16:05:49 +00:00
if ( ! amphtml )
amphtml = { href : window . location . pathname . replace ( '.html' , '_amp.html' ) } ;
2022-04-29 15:58:48 +00:00
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
2022-08-15 16:05:49 +00:00
} else {
let banners = document . querySelectorAll ( '.voc-advertising, div.ev-em-modal, span.mega-superior' ) ;
removeDOMElement ( ... banners ) ;
}
2022-04-29 15:58:48 +00:00
} else {
2022-08-15 16:05:49 +00:00
amp _unhide _access _hide ( '="result=\'ALLOW_ACCESS\'"' , '="result!=\'ALLOW_ACCESS\'"' , 'amp-ad, amp-embed' ) ;
removeDOMElement ( paywall ) ;
let body _top = document . querySelector ( 'body#top' ) ;
if ( body _top )
body _top . removeAttribute ( 'id' ) ;
2021-04-10 06:46:50 +00:00
}
2020-01-28 22:06:25 +00:00
}
2022-08-21 06:59:42 +00:00
else if ( matchDomain ( es _epiberica _domains ) || matchDomain ( es _epiberica _custom _domains ) ) {
2021-04-28 19:45:57 +00:00
if ( window . location . href . includes ( '.amp.html' ) ) {
2022-03-28 16:45:51 +00:00
let truncated = document . querySelector ( 'div.article-body--truncated' ) ;
if ( truncated )
truncated . classList . remove ( 'article-body--truncated' ) ;
2022-04-21 17:52:47 +00:00
amp _unhide _access _hide ( '="NOT access"], [amp-access="FALSE"' , '="access"' ) ;
2022-04-01 14:04:06 +00:00
} else if ( window . location . hostname === 'amp.epe.es' ) {
amp _unhide _access _hide ( '="loggedIn"' , '="NOT loggedIn"' , 'amp-ad, amp-embed, amp-next-page' ) ;
2022-03-01 17:50:33 +00:00
} else {
2022-04-01 14:04:06 +00:00
let ads = document . querySelectorAll ( 'div.commercial-up-full__wrapper, div.sidebar--sticky__space, div[data-bbnx-id*="cxense"]' ) ;
2022-03-06 19:09:00 +00:00
removeDOMElement ( ... ads ) ;
2021-04-28 19:45:57 +00:00
}
2020-01-28 22:06:25 +00:00
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'observador.pt' ) ) {
2022-07-01 13:47:47 +00:00
if ( ! window . location . pathname . endsWith ( '/amp/' ) ) {
let paywall = document . querySelector ( '.premium-article' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
paywall . classList . remove ( 'premium-article' ) ;
window . location . href = amphtml . href ;
}
} else {
amp _unhide _subscr _section ( 'amp-ad, amp-consent, section > .modal' ) ;
}
2020-01-05 12:02:44 +00:00
}
2021-04-10 06:46:50 +00: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 16:37:06 +00:00
let json _text = JSON . parse ( json . text ) . description . replace ( /&nbsp;/g , '' ) ;
2021-04-10 06:46:50 +00: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 15:31:22 +00:00
}
2021-04-10 06:46:50 +00:00
else
2021-04-25 11:45:36 +00:00
csDone = true ;
2020-01-05 16:08:07 +00:00
2022-10-23 05:58:00 +00:00
} else if ( window . location . hostname . endsWith ( '.fr' ) || matchDomain ( [ 'bienpublic.com' , 'connaissancedesarts.com' , 'journaldunet.com' , 'la-croix.com' , 'lavenir.net' , 'ledauphine.com' , 'lesinrocks.com' , 'lejsl.com' , 'lesoir.be' , 'loeildelaphotographie.com' , 'marianne.net' , 'nouvelobs.com' , 'parismatch.com' , 'philonomist.com' , 'science-et-vie.com' , 'sudinfo.be' ] . concat ( fr _groupe _nice _matin _domains ) ) ) { //france
2021-04-10 06:46:50 +00: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' ) ;
2022-03-08 18:04:50 +00:00
} , 500 ) ;
2020-01-05 16:16:32 +00:00
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'atlantico.fr' ) ) {
2021-06-16 19:39:14 +00:00
let paywall = document . querySelector ( 'div.markup[class*="Paywall"]' ) ;
2021-04-10 06:46:50 +00:00
if ( paywall )
2021-06-09 18:30:06 +00:00
paywall . setAttribute ( 'class' , 'markup' ) ;
2020-01-05 16:23:28 +00:00
}
2022-09-02 06:27:19 +00:00
else if ( matchDomain ( 'autoplus.fr' ) ) {
let ads = document . querySelectorAll ( 'div.placeholder-pub_dfp' ) ;
removeDOMElement ( ... ads ) ;
}
2021-04-30 15:25:41 +00:00
else if ( matchDomain ( 'challenges.fr' ) ) {
2021-12-12 10:25:09 +00:00
if ( window . location . pathname . endsWith ( '.amp' ) ) {
amp _unhide _access _hide ( '="paywall.access OR cha.access"' , '="NOT (paywall.access OR cha.access)"' ) ;
} else {
let amorce = document . querySelector ( '.user-paying-amorce' ) ;
2022-10-19 19:28:47 +00:00
hideDOMElement ( amorce ) ;
2021-12-12 10:25:09 +00:00
let content = document . querySelectorAll ( '.user-paying-content' ) ;
2022-01-18 19:16:52 +00:00
for ( let elem of content ) {
2021-12-12 10:25:09 +00:00
elem . classList . remove ( 'user-paying-content' ) ;
2022-01-18 19:16:52 +00:00
elem . removeAttribute ( 'hidden' ) ;
}
2021-12-12 10:25:09 +00:00
let paywall = document . querySelector ( '.temp-paywall' ) ;
removeDOMElement ( paywall ) ;
}
2021-04-30 15:25:41 +00:00
}
2021-04-10 06:46:50 +00: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 ) ;
2022-03-08 18:04:50 +00:00
} , 500 ) ;
2021-04-12 16:03:12 +00:00
}
2022-03-10 19:02:19 +00:00
else if ( matchDomain ( 'connaissancedesarts.com' ) ) {
let ads = document . querySelectorAll ( 'div.ad-container' ) ;
removeDOMElement ( ... ads ) ;
}
2021-10-24 17:01:46 +00:00
else if ( matchDomain ( 'elle.fr' ) ) {
2021-12-12 10:25:09 +00:00
if ( window . location . hostname . startsWith ( 'amp.' ) ) {
amp _unhide _access _hide ( '="poool.access OR cmi_premium.access"' ) ;
} else {
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-10-24 17:01:46 +00:00
}
2022-09-24 16:54:10 +00:00
else if ( matchDomain ( fr _be _groupe _rossel ) ) {
2022-09-27 16:04:08 +00:00
let ads = document . querySelectorAll ( 'div[id^="article_"], r-pub, div#rossel-leader-top' ) ;
2022-09-24 16:54:10 +00:00
removeDOMElement ( ... ads ) ;
}
2022-05-27 13:11:37 +00:00
else if ( matchDomain ( fr _groupe _ebra _domains ) ) {
if ( ! window . location . pathname . startsWith ( '/amp/' ) ) {
let paywall = document . querySelector ( 'div.preview' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
2021-04-10 06:46:50 +00:00
}
} else {
2021-12-01 17:33:33 +00:00
amp _unhide _access _hide ( '="access"' , '="NOT access"' , 'amp-ad, amp-embed' ) ;
2021-04-10 06:46:50 +00:00
}
2020-01-05 17:04:40 +00:00
}
2022-05-27 13:11:37 +00:00
else if ( matchDomain ( fr _groupe _la _depeche _domains ) ) {
if ( window . location . pathname . startsWith ( '/amp/' ) ) {
2021-11-30 16:36:15 +00:00
amp _unhide _subscr _section ( 'amp-ad, amp-embed' ) ;
2021-04-30 15:25:41 +00:00
} else {
let paywall = document . querySelector ( 'div.paywall' ) ;
2022-05-27 13:11:37 +00:00
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
2021-04-30 15:25:41 +00:00
removeDOMElement ( paywall ) ;
2022-05-27 13:11:37 +00:00
window . location . href = amphtml . href ;
2021-04-30 15:25:41 +00:00
}
}
}
2022-05-27 13:11:37 +00:00
else if ( matchDomain ( fr _groupe _nice _matin _domains ) ) {
if ( window . location . pathname . startsWith ( '/amp/' ) ) {
2021-12-31 10:50:38 +00:00
amp _unhide _access _hide ( '="access"' , '="NOT access"' , 'amp-ad, amp-embed' ) ;
} else {
let paywall = document . querySelector ( 'div#article-teaser' ) ;
if ( paywall )
paywall . removeAttribute ( 'id' ) ;
}
let ads = document . querySelectorAll ( 'div[class^="ad-slot-"]' ) ;
removeDOMElement ( ... ads ) ;
}
2022-03-19 16:38:47 +00:00
else if ( matchDomain ( 'franc-tireur.fr' ) ) {
let paywall = document . querySelector ( '.paywall' ) ;
removeDOMElement ( paywall ) ;
}
2022-10-22 09:24:37 +00:00
else if ( matchDomain ( 'humanite.fr' ) ) {
if ( window . location . search . startsWith ( '?amp' ) ) {
let qiota _script = document . querySelector ( 'amp-script[src^="https://www.qiota.com/"]' ) ;
if ( qiota _script ) {
let amphtml _fill _content = qiota _script . querySelector ( 'div.i-amphtml-fill-content' ) ;
if ( amphtml _fill _content )
amphtml _fill _content . removeAttribute ( 'class' ) ;
let i _amphtml _sizer = qiota _script . querySelector ( 'i-amphtml-sizer' ) ;
removeDOMElement ( i _amphtml _sizer ) ;
}
2022-10-30 08:32:53 +00:00
} else {
let banner = document . querySelector ( 'div.qiota' ) ;
removeDOMElement ( banner ) ;
2022-10-22 09:24:37 +00:00
}
}
2021-04-10 06:46:50 +00: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 17:04:40 +00:00
}
2021-04-12 16:03:12 +00:00
else if ( matchDomain ( 'la-croix.com' ) ) {
2021-04-10 06:46:50 +00:00
let url = window . location . href ;
if ( ! url . includes ( 'la-croix.com/amp/' ) ) {
2021-10-20 15:53:02 +00:00
let hidden _images = document . querySelectorAll ( 'source[srcset]' ) ;
2022-03-08 18:04:50 +00:00
for ( let elem of hidden _images )
2021-10-20 15:53:02 +00:00
elem . removeAttribute ( 'srcset' ) ;
2021-04-10 06:46:50 +00: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 17:04:40 +00:00
}
2021-04-30 15:25:41 +00:00
else if ( matchDomain ( 'lanouvellerepublique.fr' ) ) {
let alert _didacticiel = document . querySelector ( 'div.alert-didacticiel' ) ;
let loading = document . querySelectorAll ( 'span.loading' ) ;
removeDOMElement ( alert _didacticiel , ... loading ) ;
}
2022-06-24 16:57:37 +00:00
else if ( matchDomain ( 'lavenir.net' ) ) {
let paywall = document . querySelector ( 'div.is-preview' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let div _hidden = document . querySelector ( 'div.is-hidden' ) ;
if ( div _hidden )
div _hidden . classList . remove ( 'is-hidden' ) ;
}
let ads = document . querySelectorAll ( 'div.ap-AdContainer' ) ;
removeDOMElement ( ... ads ) ;
}
2022-08-18 06:50:34 +00:00
else if ( matchDomain ( 'lavie.fr' ) ) {
let paywall = document . querySelector ( 'div.bloc-payant' ) ;
removeDOMElement ( paywall ) ;
let overlay = document . querySelector ( 'div.content-art[style]' ) ;
if ( overlay )
overlay . removeAttribute ( 'style' ) ;
}
2021-04-30 15:25:41 +00:00
else if ( matchDomain ( [ 'lejdd.fr' , 'parismatch.com' ] ) ) {
let poool _banner = document . querySelector ( '#poool-container' ) ;
let forbidden = document . querySelector ( '.forbidden' ) ;
2022-06-30 17:25:33 +00:00
let ads = document . querySelectorAll ( 'div[class^="lmn-"]' ) ;
removeDOMElement ( poool _banner , forbidden , ... ads ) ;
2021-04-30 15:25:41 +00:00
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 06:46:50 +00:00
}
2020-01-13 21:23:03 +00:00
}
2022-08-26 17:50:25 +00:00
else if ( matchDomain ( 'leparisien.fr' ) ) {
2022-08-28 18:54:15 +00:00
let paywall = document . querySelector ( 'div.paywall' ) ;
2022-08-26 17:50:25 +00:00
if ( window . location . pathname . startsWith ( '/amp/' ) ) {
if ( paywall ) {
let paywall _sticky = document . querySelector ( 'div.paywall-sticky' ) ;
removeDOMElement ( paywall , paywall _sticky ) ;
let section _hidden = document . querySelectorAll ( 'section[hidden]' ) ;
for ( let elem of section _hidden )
elem . removeAttribute ( 'hidden' ) ;
let mask = document . querySelector ( '.amp-premium-first-content' ) ;
if ( mask )
mask . classList . remove ( 'amp-premium-first-content' ) ;
}
} else {
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
}
}
2021-12-17 20:22:10 +00:00
else if ( matchDomain ( 'lequipe.fr' ) ) {
let paywall = document . querySelectorAll ( '.Paywall, .Article__paywall' ) ;
2022-09-15 10:17:16 +00:00
if ( window . location . pathname . includes ( '/Article/' ) && paywall . length ) {
2021-12-17 20:22:10 +00:00
let scripts = document . querySelectorAll ( 'script:not([src], [type])' ) ;
let json _script ;
for ( let script of scripts ) {
if ( script . innerText . includes ( 'window.__NUXT__=' ) ) {
json _script = script ;
break ;
}
}
let article = document . querySelector ( 'div.article__body' ) ;
if ( article && json _script && dompurify _loaded ) {
if ( json _script . innerText . includes ( 'articleObject:' ) ) {
2022-03-17 18:37:59 +00:00
removeDOMElement ( ... paywall ) ;
2021-12-17 20:22:10 +00:00
let json = json _script . textContent . split ( 'articleObject:' ) [ 1 ] . split ( ',articleType' ) [ 0 ] ;
2021-12-23 07:43:19 +00:00
let url _nuxt = json _script . textContent . split ( 'comment_count_url:"' ) [ 1 ] . split ( '",' ) [ 0 ] . replace ( /\\u002F/g , '/' ) ;
if ( url _nuxt && ! url _nuxt . includes ( window . location . pathname ) )
2022-04-25 16:09:43 +00:00
window . setTimeout ( function ( ) {
ext _api . runtime . sendMessage ( { request : 'refreshCurrentTab' } ) ;
} , 500 ) ;
2022-05-10 19:22:29 +00:00
json = json . replace ( /keywords:\[([\w\,\$]+)\]/g , "keywords:\"\"" ) . replace ( /([{,])([a-zA-Z_]+\d?):/g , "$1\"$2\":" ) . replace ( /\":(\[)?([\w\$\.]+)([\]},])/g , "\":$1\"$2\"$3" ) . replace ( /},([\w]+),{/g , "},\"$1\",{" ) . replace ( /}(,\w{2})+(\]}|,{)/g , "}$2" ) ;
2022-04-25 16:09:43 +00:00
json = JSON . parse ( json ) ;
if ( json . items ) {
let pars = json . items . filter ( x => x . objet && x . objet . paragraphs ) [ 0 ] . objet . paragraphs ;
2021-12-17 20:22:10 +00:00
article . innerHTML = '' ;
let article _dom ;
let article _text = '' ;
let parser = new DOMParser ( ) ;
2022-04-25 16:09:43 +00:00
for ( let par of pars ) {
if ( par . title || par . content ) {
if ( par . title && par . title . length > 2 )
article _text += '<p><strong>' + par . title + '</strong></p>' ;
2022-04-27 18:40:58 +00:00
if ( par . content && par . content . length > 2 ) {
2022-04-25 16:09:43 +00:00
let par _content = par . content . replace ( 'class=' , '' ) . replace ( /\\u003C/g , '<' ) . replace ( /\\u003E/g , '>' ) . replace ( /\\u002F/g , '/' ) . replace ( /\\"/g , '"' ) . replace ( /(^\"|\"$)/g , '' ) . replace ( /\\t/g , '' ) ;
article _text += '<p>' + par _content + '</p>' ;
2021-12-17 20:22:10 +00:00
}
2022-04-25 16:09:43 +00:00
} else if ( par . media && par . media . url && par . media . ratio ) {
let ratio = par . media . ratio ;
if ( ! parseInt ( ratio ) )
ratio = 1.5 ;
let url = par . media . url . replace ( /\\u002F/g , '/' ) . replace ( '{width}' , '400' ) . replace ( '{height}' , parseInt ( 400 / ratio ) ) . replace ( '{quality}' , '75' ) ;
article _text += '<p><img src="' + url + '" style="width:95%;"</img></p>' ;
if ( par . media . legende && par . media . legende . length > 2 )
article _text += '<p><strong>' + par . media . legende + '</strong></p>' ;
} else if ( par . _ _type && ! par . layout )
console . log ( par ) ;
2021-12-17 20:22:10 +00:00
}
2022-03-26 08:12:03 +00:00
article _dom = parser . parseFromString ( '<div style="margin:20px; font-family:DINNextLTPro-Regular,sans-serif; font-size:18px;">' + DOMPurify . sanitize ( article _text ) + '</div>' , 'text/html' ) ;
2021-12-17 20:22:10 +00:00
article . appendChild ( article _dom . querySelector ( 'div' ) ) ;
}
2022-03-17 18:37:59 +00:00
} else
2022-04-25 16:09:43 +00:00
window . setTimeout ( function ( ) {
ext _api . runtime . sendMessage ( { request : 'refreshCurrentTab' } ) ;
} , 500 ) ;
}
2021-12-17 20:22:10 +00:00
}
}
2022-05-30 15:18:28 +00:00
else if ( matchDomain ( 'lesechos.fr' ) ) {
2022-03-07 21:56:06 +00:00
if ( matchDomain ( 'investir.lesechos.fr' ) ) {
if ( ! window . location . href . includes ( '/amp/' ) ) {
let paywall = document . querySelector ( 'div.bloc-paywall' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
} else {
let amp _ads = document . querySelectorAll ( 'amp-ad' ) ;
removeDOMElement ( ... amp _ads ) ;
}
2022-08-26 17:50:25 +00:00
} else if ( window . location . pathname . startsWith ( '/amp/' ) ) {
ampToHtml ( ) ;
2022-03-07 21:56:06 +00:00
} else {
window . setTimeout ( function ( ) {
2022-06-07 05:56:20 +00:00
let abo _banner = document . querySelector ( 'div[class*="pgxf3b-2"]' ) ;
2022-10-01 10:35:59 +00:00
let ad _blocks = document . querySelectorAll ( '[class*="jzxvkd"]' ) ;
2022-10-19 19:28:47 +00:00
hideDOMElement ( ... ad _blocks ) ;
2022-03-07 21:56:06 +00:00
if ( abo _banner && dompurify _loaded ) {
removeDOMElement ( abo _banner ) ;
let url = window . location . href ;
let html = document . documentElement . outerHTML ;
let state ;
let split1 = html . split ( 'window.__CONFIG__=' ) [ 1 ] ;
let split2 = split1 . split ( '</script>' ) [ 0 ] . trim ( ) ;
if ( split2 . includes ( '; window.__DATA__=' ) ) {
state = split2 . split ( '; window.__DATA__=' ) [ 1 ] . split ( '; window.__' ) [ 0 ] . trim ( ) ;
} else
state = split2 . substr ( 0 , split2 . length - 1 ) ;
try {
let data = JSON . parse ( state ) ;
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 ) )
ext _api . runtime . sendMessage ( { request : 'refreshCurrentTab' } ) ;
let paywallNode = document . querySelector ( '.post-paywall' ) ;
if ( paywallNode ) {
let contentNode = document . createElement ( 'div' ) ;
let parser = new DOMParser ( ) ;
let article _html = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( article ) + '</div>' , 'text/html' ) ;
let article _par = article _html . querySelector ( 'div' ) ;
if ( article _par ) {
contentNode . appendChild ( article _par ) ;
contentNode . className = paywallNode . className ;
paywallNode . parentNode . insertBefore ( contentNode , paywallNode ) ;
removeDOMElement ( paywallNode ) ;
let paywallLastChildNode = document . querySelector ( '.post-paywall > :last-child' ) ;
if ( paywallLastChildNode ) {
paywallLastChildNode . setAttribute ( 'style' , 'height: auto !important; overflow: hidden !important; max-height: none !important;' ) ;
}
2020-05-01 15:50:15 +00:00
}
2021-04-10 06:46:50 +00:00
}
2022-03-07 21:56:06 +00:00
let styleElem = document . head . appendChild ( document . createElement ( 'style' ) ) ;
styleElem . innerHTML = ".post-paywall::after {height: auto !important;}" ;
} catch ( err ) {
ext _api . runtime . sendMessage ( { request : 'refreshCurrentTab' } ) ;
2020-05-02 13:46:52 +00:00
}
2021-04-10 06:46:50 +00:00
}
2022-03-08 18:04:50 +00:00
} , 500 ) ;
2022-03-07 21:56:06 +00:00
}
2020-01-28 22:06:25 +00:00
}
2021-12-22 18:03:54 +00:00
else if ( matchDomain ( 'lesinrocks.com' ) ) {
2022-04-19 19:37:22 +00:00
if ( window . location . search . match ( /(\?|&)amp/ ) ) {
2021-12-22 18:03:54 +00:00
let size _defined = document . querySelector ( 'amp-script.i-amphtml-layout-size-defined' ) ;
if ( size _defined )
size _defined . style = 'overflow:visible !important;' ;
let overlays = document . querySelectorAll ( 'section.learn_more, div.sidebar, div.menu-footer, div.tooltip_bib, footer.content-info' ) ;
removeDOMElement ( ... overlays ) ;
}
}
2022-01-09 16:28:17 +00:00
else if ( matchDomain ( 'lexpress.fr' ) ) {
2022-10-23 16:11:32 +00:00
let ads = document . querySelectorAll ( 'div[class^="block_pub"], div.bottom-bar-full, div.tead, div.ban-bottom' ) ;
2022-01-09 16:28:17 +00:00
removeDOMElement ( ... ads ) ;
}
2021-04-30 15:25:41 +00: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-12-12 10:25:09 +00:00
else if ( matchDomain ( 'lopinion.fr' ) ) {
if ( window . location . search . startsWith ( '?_amp=true' ) )
amp _unhide _access _hide ( '="access"' , '="NOT access"' ) ;
2022-08-30 17:15:23 +00:00
else {
let paywall = document . querySelector ( 'div#poool-widget' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
}
2021-12-12 10:25:09 +00:00
}
2021-10-20 19:46:42 +00:00
else if ( matchDomain ( 'marianne.net' ) ) {
let paywall = document . querySelector ( 'div.paywall' ) ;
2021-10-22 10:36:47 +00:00
if ( paywall && dompurify _loaded ) {
2021-10-20 19:46:42 +00: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 06:46:50 +00:00
else if ( matchDomain ( 'nouvelobs.com' ) ) {
let paywall = document . querySelector ( '.paywall' ) ;
removeDOMElement ( paywall ) ;
2020-03-08 22:16:17 +00:00
}
2022-10-23 05:58:00 +00:00
else if ( matchDomain ( 'philonomist.com' ) ) {
let paywall = document . querySelector ( 'div.content-bandeau' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let json _script = getArticleJsonScript ( ) ;
if ( json _script ) {
try {
let json = JSON . parse ( json _script . text ) ;
if ( json ) {
let json _text = parseHtmlEntities ( json [ '@graph' ] [ 0 ] . articleBody . replace ( /\s{3}/g , '\r\n\r\n' ) ) ;
let content = document . querySelector ( 'div.main-body' ) ;
if ( json _text && content )
content . innerText = json _text ;
}
} catch ( err ) {
console . log ( err ) ;
}
}
}
}
2021-12-12 10:25:09 +00:00
else if ( matchDomain ( 'science-et-vie.com' ) ) {
if ( window . location . hostname . startsWith ( 'amp.' ) ) {
let pars = document . querySelectorAll ( '.qiota_reserve > p, .qiota_reserve > h2' ) ;
let pars _text = [ ] ;
for ( let par of pars ) {
if ( pars _text . includes ( par . innerText ) )
removeDOMElement ( par ) ;
else
pars _text . push ( par . innerText ) ;
}
let sizer = document . querySelector ( 'div.article-content > amp-script > i-amphtml-sizer' ) ;
removeDOMElement ( sizer ) ;
let replaced _content = document . querySelector ( 'div.i-amphtml-replaced-content' ) ;
if ( replaced _content )
replaced _content . removeAttribute ( 'class' ) ;
}
}
2022-02-08 07:01:28 +00:00
else if ( matchDomain ( [ 'sudouest.fr' , 'charentelibre.fr' , 'larepubliquedespyrenees.fr' ] ) ) {
2022-08-26 17:50:25 +00:00
let paywall = document . querySelectorAll ( '.visible-not-premium' ) ;
if ( paywall . length ) {
removeDOMElement ( ... paywall ) ;
2022-06-28 14:39:02 +00:00
let visible _premium = document . querySelectorAll ( 'div.visible-premium' ) ;
for ( let elem of visible _premium )
elem . classList . remove ( 'visible-premium' ) ;
2021-04-10 06:46:50 +00:00
}
window . setTimeout ( function ( ) {
let footer _premium = document . querySelector ( '.footer-premium' ) ;
2022-08-26 17:50:25 +00:00
let ads = document . querySelectorAll ( 'div.pub, div.ph-easy-subscription' ) ;
removeDOMElement ( footer _premium , ... ads ) ;
2022-03-08 18:04:50 +00:00
} , 500 ) ;
2020-03-21 14:48:04 +00:00
}
2021-04-10 06:46:50 +00:00
else
2021-04-25 11:45:36 +00:00
csDone = true ;
2020-03-30 17:59:29 +00:00
2022-02-13 17:55:16 +00:00
} else if ( window . location . hostname . endsWith ( '.it' ) || matchDomain ( [ 'eastwest.eu' , 'italian.tech' , 'limesonline.com' , 'quotidiano.net' ] ) ) { //italy
2020-03-30 18:50:55 +00:00
2021-04-10 06:46:50 +00:00
if ( matchDomain ( 'corriere.it' ) ) {
2021-12-12 12:21:28 +00:00
if ( window . location . pathname . endsWith ( '_amp.html' ) ) {
amp _unhide _subscr _section ( 'amp-ad, amp-embed' ) ;
} else {
let url = window . location . href ;
if ( url . includes ( '_preview.shtml' ) ) {
window . setTimeout ( function ( ) {
window . location . href = url . replace ( '_preview.shtml' , '.shtml' ) . split ( '?' ) [ 0 ] ;
2022-03-08 18:04:50 +00:00
} , 500 ) ;
2021-12-12 12:21:28 +00:00
}
2021-04-10 06:46:50 +00:00
}
2020-04-04 17:42:04 +00:00
}
2022-05-29 06:38:45 +00:00
else if ( matchDomain ( 'corrieredellosport.it' ) ) {
if ( ! window . location . pathname . startsWith ( '/amp/' ) ) {
let paywall = document . querySelector ( 'div[class^="MainTextTruncated_paragraph__"]' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
let ads = document . querySelectorAll ( 'div[class^="AdUnit_placeholder"]' ) ;
removeDOMElement ( ... ads ) ;
} else {
let ads = document . querySelectorAll ( 'amp-ad, amp-embed' ) ;
removeDOMElement ( ... ads ) ;
}
}
2022-02-13 17:55:16 +00:00
else if ( matchDomain ( 'eastwest.eu' ) ) {
let paywall = document . querySelector ( '.paywall' ) ;
if ( paywall ) {
paywall . removeAttribute ( 'style' ) ;
paywall . classList . remove ( 'paywall' ) ;
let intro = document . querySelectorAll ( 'div#testo_articolo > p, div#testo_articolo > h3' ) ;
let offerta = document . querySelectorAll ( 'div.offerta_abbonamenti' ) ;
removeDOMElement ( ... intro , ... offerta ) ;
}
}
2022-08-12 05:36:22 +00:00
else if ( matchDomain ( 'gazzetta.it' ) ) {
if ( window . location . pathname . endsWith ( '_preview.shtml' ) ) {
window . setTimeout ( function ( ) {
window . location . href = window . location . href . split ( '?' ) [ 0 ] . replace ( '_preview' , '' ) + '?gaa_at=g' ;
} , 500 ) ;
2022-08-26 17:50:25 +00:00
} else if ( window . location . pathname . endsWith ( '_amp.shtml' ) )
ampToHtml ( ) ;
2022-08-12 05:36:22 +00:00
}
2022-02-13 17:55:16 +00:00
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'ilfattoquotidiano.it' ) ) {
2021-09-03 10:35:25 +00:00
let url = window . location . href ;
if ( url . includes ( '/amp/' ) ) {
2021-11-30 16:36:15 +00:00
amp _unhide _subscr _section ( 'amp-ad, div#_4sVideoContainer' ) ;
2021-09-03 10:35:25 +00:00
let comments = document . querySelector ( 'div.content.comments' ) ;
2021-11-30 16:36:15 +00:00
removeDOMElement ( comments ) ;
2021-11-03 11:29:46 +00:00
} else if ( url . split ( '?' ) [ 0 ] . match ( /\/\d{4}\/\d{2}\/\d{2}\// ) ) {
2021-10-31 19:19:15 +00:00
let paywall = document . querySelector ( 'div.read-more' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
2021-09-03 10:35:25 +00:00
window . location . href = url . split ( '?' ) [ 0 ] + 'amp' ;
2021-01-11 17:49:09 +00:00
}
2021-09-03 10:35:25 +00:00
}
2020-04-25 15:18:12 +00:00
}
2021-12-29 15:54:49 +00:00
else if ( matchDomain ( 'ilfoglio.it' ) ) {
if ( window . location . pathname . endsWith ( '/amp/' ) ) {
amp _unhide _subscr _section ( 'amp-ad, [class^="adv-"], div#gmpVideoContainer' ) ;
} else {
let paywall = document . querySelector ( 'div.paywall' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
let ads = document . querySelectorAll ( '.advertisement' ) ;
removeDOMElement ( ... ads ) ;
}
}
2022-06-06 07:42:53 +00:00
else if ( matchDomain ( 'ilmanifesto.it' ) ) {
if ( window . location . pathname . match ( /((\w)+(\-)+){3,}/ ) ) {
let paywall = document . querySelector ( 'div[class^="PostPaywall_PostPaywall__"]' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let json _script = document . querySelector ( 'script#__NEXT_DATA__' ) ;
if ( json _script && dompurify _loaded ) {
let json = JSON . parse ( json _script . innerText ) ;
if ( json && json . props . pageProps . content && json . props . pageProps . content . content ) {
let article _new = json . props . pageProps . content . content ;
let article = document . querySelector ( 'div.ArticleBody' ) ;
if ( article ) {
article . innerHTML = '' ;
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( article _new ) + '</div>' , 'text/html' ) ;
let content _new = doc . querySelector ( 'div' ) ;
article . appendChild ( content _new ) ;
}
} else
window . location . reload ( true ) ;
}
}
}
let service _page = document . querySelector ( 'div.service-page' ) ;
if ( service _page ) {
window . setTimeout ( function ( ) {
window . location . reload ( true ) ;
} , 1000 ) ;
}
}
2022-07-02 07:46:39 +00:00
else if ( matchDomain ( [ 'iltirreno.it' , 'lanuovasardegna.it' ] ) ) {
2022-07-13 14:29:59 +00:00
if ( window . location . pathname . includes ( '/news/' ) ) {
2022-09-08 05:46:32 +00:00
let paywall = document . querySelector ( 'div.MuiBox-root > h4.MuiTypography-h4' ) ;
if ( paywall ) {
let article = document . querySelector ( 'div.MuiGrid-root.MuiGrid-grid-sm-7 > div' ) ;
2022-07-17 07:25:31 +00:00
if ( article && dompurify _loaded ) {
2022-09-08 05:46:32 +00:00
removeDOMElement ( paywall . parentNode ) ;
2022-07-17 07:25:31 +00:00
try {
fetch ( window . location . href )
. then ( response => {
if ( response . ok ) {
response . text ( ) . then ( html => {
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( html , 'text/html' ) ;
let json = doc . querySelector ( 'script#__NEXT_DATA__' ) ;
if ( json ) {
let article _new = JSON . parse ( json . text ) . props . pageProps . article . content ;
if ( article _new ) {
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( article _new ) + '</div>' , 'text/html' ) ;
let content _new = doc . querySelector ( 'div' ) ;
2022-09-08 05:46:32 +00:00
article . innerHTML = '' ;
2022-07-17 07:25:31 +00:00
article . appendChild ( content _new ) ;
}
}
} )
}
} ) ;
} catch ( err ) {
console . log ( err ) ;
2022-07-13 14:29:59 +00:00
}
}
}
2022-07-17 07:25:31 +00:00
window . setTimeout ( function ( ) {
let banners = document . querySelectorAll ( 'div.MuiSnackbar-root, div.css-16cchgy' ) ;
removeDOMElement ( ... banners ) ;
} , 1000 ) ;
2022-07-13 14:29:59 +00:00
}
2022-07-02 07:46:39 +00:00
}
2021-12-12 12:21:28 +00:00
else if ( matchDomain ( it _ilmessaggero _domains ) ) {
if ( window . location . pathname . toLowerCase ( ) . includes ( '/amp/' ) ) {
amp _unhide _subscr _section ( 'amp-ad, amp-embed' ) ;
}
}
2021-07-30 06:52:20 +00:00
else if ( matchDomain ( it _quotidiano _domains ) ) {
2021-12-12 12:21:28 +00:00
if ( window . location . pathname . endsWith ( '/amp' ) ) {
2021-12-12 17:32:28 +00:00
amp _unhide _access _hide ( '="c.customGranted"' , '="NOT c.customGranted"' , 'amp-ad, amp-fx-flying-carpet' ) ;
2021-12-12 12:21:28 +00:00
} else {
2022-02-20 07:25:25 +00:00
let paywall = document . querySelector ( 'div[data-testid="paywall-container"]' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
2021-12-12 12:21:28 +00:00
}
2021-04-10 06:46:50 +00:00
}
2020-04-25 18:41:55 +00:00
}
2022-04-23 07:43:03 +00:00
else if ( matchDomain ( 'italiaoggi.it' ) ) {
let paywall = document . querySelector ( 'div.boxAbb' ) ;
if ( paywall && dompurify _loaded ) {
let overlay = document . querySelector ( 'div.article-locked-overlay' ) ;
removeDOMElement ( paywall , overlay ) ;
let article _locked = document . querySelector ( 'div.article-locked' ) ;
if ( article _locked ) {
article _locked . classList . remove ( 'article-locked' ) ;
let json _script = getArticleJsonScript ( ) ;
if ( json _script ) {
let json = JSON . parse ( json _script . text ) ;
if ( json ) {
let json _text = json . articleBody ;
let content = article _locked . querySelector ( 'section' ) ;
if ( json _text && content ) {
2022-08-15 16:05:49 +00:00
let parser = new DOMParser ( ) ;
json _text = DOMPurify . sanitize ( json _text ) . replace ( /&apos;/g , "'" ) . replace ( /;/g , '' ) ;
let doc = parser . parseFromString ( '<div><section>' + json _text + '</section></div>' , 'text/html' ) ;
let content _new = doc . querySelector ( 'div' ) ;
content . parentNode . replaceChild ( content _new , content ) ;
2022-04-23 07:43:03 +00:00
}
}
}
}
}
}
2021-04-10 06:46:50 +00: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 15:02:34 +00:00
}
2022-03-08 18:04:50 +00:00
} , 500 ) ;
2021-04-10 06:46:50 +00:00
if ( window . location . href . includes ( '/ws/detail/' ) ) {
2021-11-30 16:36:15 +00:00
let paywall = document . querySelector ( '.paywall' ) ;
2021-04-10 06:46:50 +00:00
if ( paywall ) {
2021-11-30 16:36:15 +00:00
amp _unhide _subscr _section ( ) ;
2021-07-04 06:43:45 +00:00
csDoneOnce = true ;
2020-05-25 19:01:41 +00:00
}
2021-04-10 06:46:50 +00:00
}
2020-05-25 19:01:41 +00:00
}
2022-08-04 15:38:34 +00:00
else if ( matchDomain ( it _gedi _domains ) ) {
2022-10-07 13:39:52 +00:00
if ( matchDomain ( 'lescienze.it' ) ) {
2022-08-04 15:38:34 +00:00
let paywall = document . querySelector ( '.paywall-adagio' ) ;
if ( paywall ) {
let body _paywall = document . querySelector ( '#detail-body-paywall' ) ;
let shade = document . querySelector ( '.shade' ) ;
removeDOMElement ( paywall , body _paywall , shade ) ;
let detail _body _hidden = document . querySelectorAll ( '.detail_body[hidden]' ) ;
for ( let elem of detail _body _hidden ) {
elem . removeAttribute ( 'hidden' ) ;
elem . removeAttribute ( 'style' ) ;
2021-09-05 06:48:23 +00:00
}
2022-08-04 15:38:34 +00:00
csDoneOnce = true ;
}
} else if ( matchDomain ( 'limesonline.com' ) ) {
2022-10-07 13:39:52 +00:00
if ( window . location . search . includes ( 'prv=true' ) ) {
2022-08-04 15:38:34 +00:00
window . setTimeout ( function ( ) {
2022-10-07 13:39:52 +00:00
window . location . href = window . location . pathname ;
2022-08-04 15:38:34 +00:00
} , 500 ) ;
} else
csDoneOnce = true ;
2022-10-14 17:13:30 +00:00
} else if ( matchDomain ( 'espresso.repubblica.it' ) ) {
if ( ! window . location . pathname . match ( /\amp(\/)?$/ ) ) {
let paywall = document . querySelector ( 'div#paywall' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
} else {
let inline _videos = document . querySelectorAll ( 'div.responsive-video' ) ;
for ( let video of inline _videos ) {
let placeholder = video . querySelector ( 'div.snappedPlaceholder' ) ;
if ( placeholder )
placeholder . removeAttribute ( 'class' ) ;
let iframe = video . querySelector ( 'iframe[data-src]:not([src])' ) ;
if ( iframe ) {
iframe . src = iframe . getAttribute ( 'data-src' ) ;
let elem = document . createElement ( 'a' ) ;
elem . href = iframe . getAttribute ( 'data-src' ) ;
elem . innerText = '>>> external video-link' ;
elem . target = '_blank' ;
video . parentNode . appendChild ( elem ) ;
}
}
}
} else {
amp _unhide _access _hide ( '="showContent"' , '' , 'amp-ad, amp-embed' ) ;
}
2022-08-04 15:38:34 +00:00
} else {
2022-10-07 13:39:52 +00:00
if ( ! window . location . pathname . match ( /\amp(\/)?$/ ) ) {
2022-08-04 15:38:34 +00:00
let ads = document . querySelectorAll ( 'div[id^="adv"]' ) ;
removeDOMElement ( ... ads ) ;
2021-04-10 06:46:50 +00:00
}
}
2020-05-27 05:41:46 +00:00
}
2021-04-10 06:46:50 +00:00
else
2021-04-25 11:45:36 +00:00
csDone = true ;
2021-04-10 06:46:50 +00:00
} else if ( window . location . hostname . match ( /\.(be|nl)$/ ) ) { //belgium/netherlands
2022-04-05 16:12:22 +00:00
if ( matchDomain ( 'fd.nl' ) ) {
2021-04-10 06:46:50 +00:00
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 16:37:06 +00:00
}
2020-06-18 18:55:18 +00:00
else if ( matchDomain ( 'ftm.nl' ) ) {
2022-09-09 12:30:20 +00:00
let banners = document . querySelectorAll ( 'div.banner-pp, a.readmore' ) ;
removeDOMElement ( ... banners ) ;
2020-06-18 18:55:18 +00:00
}
2022-07-10 06:35:21 +00:00
else if ( matchDomain ( [ 'knack.be' , 'kw.be' , 'levif.be' ] ) ) {
2022-07-04 18:35:30 +00:00
let paywall = document . querySelector ( 'div[id*="wall-modal"]' ) ;
2021-05-14 15:40:51 +00:00
if ( paywall ) {
removeDOMElement ( paywall ) ;
2022-10-26 16:34:57 +00:00
let html = document . querySelector ( 'html[class]' ) ;
if ( html )
html . removeAttribute ( 'class' ) ;
2022-06-27 15:13:29 +00:00
function knack _noscroll ( node ) {
node . removeAttribute ( 'style' ) ;
node . removeAttribute ( 'class' ) ;
}
2022-10-26 16:34:57 +00:00
waitDOMAttribute ( 'html' , 'html' , 'class' , knack _noscroll , true ) ;
2022-07-04 18:35:30 +00:00
let intro = document . querySelectorAll ( 'div.article-body > p, div.article-body > style' ) ;
removeDOMElement ( ... intro ) ;
2021-04-10 06:46:50 +00:00
}
2020-06-28 15:41:37 +00:00
}
2022-05-02 15:29:37 +00:00
else if ( matchDomain ( [ 'lc.nl' , 'dvhn.nl' ] ) ) {
2021-04-10 06:46:50 +00:00
let top _ad = document . querySelector ( '.top__ad' ) ;
2022-05-02 15:29:37 +00:00
removeDOMElement ( top _ad ) ;
2021-04-10 06:46:50 +00:00
}
2021-06-20 19:41:11 +00:00
else if ( matchDomain ( nl _mediahuis _region _domains ) ) {
2021-04-10 06:46:50 +00: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 10:36:47 +00:00
if ( premium && dompurify _loaded ) {
2021-04-10 06:46:50 +00: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 19:41:11 +00:00
if ( paywall && auth _body ) {
2021-04-10 06:46:50 +00:00
let auth _body _par _count = auth _body . querySelectorAll ( 'p' ) ;
if ( auth _body _par _count . length < 2 ) {
2021-08-18 16:15:00 +00: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 06:46:50 +00:00
try {
2021-08-18 16:15:00 +00:00
let json = JSON . parse ( json _str ) ;
let article = Object . values ( json ) [ 0 ] [ 'data' ] [ 'article' ] [ 'body' ] ;
2021-04-10 06:46:50 +00:00
auth _body . innerHTML = '' ;
2021-06-20 19:41:11 +00:00
let par _html , par _dom , par _elem , par _div , par _key ;
2021-04-10 06:46:50 +00: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 17:59:15 +00:00
par _html = parser . parseFromString ( '<div><strong>' + DOMPurify . sanitize ( par _key ) + '</strong></div>' , 'text/html' ) ;
2021-06-27 07:56:42 +00:00
par _elem = par _html . querySelector ( 'div' ) ;
2021-04-10 06:46:50 +00:00
} else if ( key === 'twitter' || key === 'instagram' ) {
par _elem = document . createElement ( 'a' ) ;
Object . assign ( par _elem , {
href : par _key ,
2021-06-27 07:56:42 +00:00
innerText : par _key . split ( '?' ) [ 0 ] ,
2021-04-10 06:46:50 +00: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 17:45:08 +00:00
par _elem . appendChild ( par _img ) ;
2021-04-10 06:46:50 +00: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 16:15:00 +00: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 11:33:25 +00:00
}
2021-04-10 06:46:50 +00:00
if ( par _elem )
par _dom . appendChild ( par _elem ) ;
auth _body . appendChild ( par _dom ) ;
}
2020-07-04 11:33:25 +00:00
}
2021-04-10 06:46:50 +00:00
} catch ( err ) {
2021-06-20 19:41:11 +00:00
console . warn ( 'unable to parse text' ) ;
2021-04-10 06:46:50 +00:00
console . warn ( err ) ;
}
2020-07-04 11:33:25 +00:00
}
2021-04-10 06:46:50 +00:00
}
}
2022-03-08 18:04:50 +00:00
} , 500 ) ;
2020-07-22 17:38:49 +00:00
}
2022-08-04 10:38:00 +00:00
else if ( matchDomain ( nl _dpg _media _domains ) ) {
2022-05-04 15:58:35 +00:00
let banners = document . querySelectorAll ( 'div[data-temptation-position^="PAGE_"], div[class^="ad--"]' ) ;
let paywall = document . querySelectorAll ( '[data-temptation-position^="ARTICLE_"]' ) ;
removeDOMElement ( ... banners , ... paywall ) ;
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'nrc.nl' ) ) {
window . setTimeout ( function ( ) {
2021-11-10 16:46:22 +00:00
let nrc _overlay = document . querySelectorAll ( '[id$="modal__overlay"]' ) ;
2021-04-10 06:46:50 +00:00
let subscribe _bar = document . querySelector ( '.header__subscribe-bar' ) ;
2022-08-26 17:50:25 +00:00
let ads = document . querySelectorAll ( '.banner' ) ;
removeDOMElement ( ... nrc _overlay , subscribe _bar , ... ads ) ;
2021-04-10 06:46:50 +00:00
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 07:06:49 +00:00
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'telegraaf.nl' ) ) {
if ( window . location . href . startsWith ( 'https://www.telegraaf.nl/error?ref=/' ) ) {
2020-08-02 10:35:09 +00:00
window . setTimeout ( function ( ) {
2021-04-10 06:46:50 +00: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 15:56:48 +00:00
window . setTimeout ( function ( ) {
2021-04-10 06:46:50 +00:00
window . location . reload ( true ) ;
} , 500 ) ;
}
let article _wrapper = document . querySelector ( '.ArticlePageWrapper__uid' ) ;
let spotx _banner = document . querySelector ( '.ArticleBodyBlocks__inlineArticleSpotXBanner' ) ;
2021-08-04 17:57:08 +00:00
let paywall = document . querySelector ( '.MeteringNotification__backdrop' ) ;
2021-04-10 06:46:50 +00:00
removeDOMElement ( spotx _banner , paywall ) ;
2021-08-04 17:57:08 +00:00
let premium = document . querySelector ( '.PremiumLabelWithLine' ) ;
2021-04-10 06:46:50 +00:00
let article _id = article _wrapper ? article _wrapper . innerText : '123' ;
2022-05-23 17:31:36 +00:00
let article _body _done = window . location . pathname . startsWith ( '/video/' ) || document . querySelector ( '#articleBody' + article _id ) ;
2021-04-10 06:46:50 +00:00
if ( premium && ! article _body _done ) {
let article _body _old = document . querySelector ( '[id^="articleBody"]' ) ;
removeDOMElement ( article _body _old ) ;
2021-08-04 17:57:08 +00:00
let html = document . documentElement . outerHTML ;
2021-08-08 08:02:24 +00:00
let json = html . includes ( 'window.__APOLLO_STATE__=' ) ? html . split ( 'window.__APOLLO_STATE__=' ) [ 1 ] . split ( '};' ) [ 0 ] + '}' : '' ;
2021-04-10 06:46:50 +00:00
if ( json ) {
2022-05-13 12:12:40 +00:00
let json _article _id = json . split ( 'uid\":' ) [ 1 ] . split ( /\D/ ) [ 0 ] ;
2021-08-11 16:31:39 +00:00
if ( json _article _id && json _article _id !== article _id ) {
window . setTimeout ( function ( ) {
window . location . reload ( true ) ;
} , 500 ) ;
}
2021-08-06 11:25:43 +00:00
let json _text = json . includes ( '"body":"' ) ? json . split ( '"body":"' ) [ 1 ] . split ( '","__typename":' ) [ 0 ] : '' ;
2021-08-04 17:57:08 +00:00
if ( json _text ) {
let intro = document . querySelector ( 'span[id^="articleIntro"]' ) ;
if ( intro )
json _text = json _text . replace ( intro . innerText + '\n\n' , '' ) ;
2022-05-23 17:31:36 +00:00
let article _body = document . querySelector ( 'section[data-element="articleBody"]' ) ;
2021-08-04 17:57:08 +00:00
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 ) ;
2022-05-13 12:12:40 +00:00
article _body . insertBefore ( div _main , article _body . firstChild ) ;
2021-08-04 17:57:08 +00:00
}
2021-04-10 06:46:50 +00:00
}
2020-09-25 12:59:06 +00:00
}
2021-04-10 06:46:50 +00:00
}
2020-09-25 12:59:06 +00:00
}
2021-12-16 16:28:18 +00:00
else if ( matchDomain ( 'vn.nl' ) ) {
let paywall = document . querySelector ( 'div.content__message-no-access-container' ) ;
if ( paywall && dompurify _loaded ) {
let content _restriction = document . querySelector ( 'div.content__restriction' ) ;
removeDOMElement ( paywall , content _restriction ) ;
let body = document . querySelector ( 'body' ) ;
if ( body )
body . style = 'height:auto !important;' ;
let article _content = document . querySelector ( 'section[data-article-content-element]' ) ;
if ( article _content )
article _content . style = 'max-height:none !important;' ;
let json _url _dom = document . querySelector ( 'link[rel="alternate"][type="application/json"]' ) ;
if ( json _url _dom ) {
let json _url = json _url _dom . href ;
fetch ( json _url )
. then ( response => {
if ( response . ok ) {
response . json ( ) . then ( json => {
let json _text = json . content . rendered ;
let content = document . querySelector ( 'div[data-article-content-target]' ) ;
if ( json _text && content ) {
let parser = new DOMParser ( ) ;
2022-06-06 12:12:03 +00:00
let doc = parser . parseFromString ( '<div data-article-content-target>' + DOMPurify . sanitize ( json _text , { ADD _TAGS : [ 'iframe' ] , ADD _ATTR : [ 'frameborder' ] } ) + '</div>' , 'text/html' ) ;
2021-12-16 16:28:18 +00:00
let content _new = doc . querySelector ( 'div' ) ;
content . parentNode . replaceChild ( content _new , content ) ;
}
} ) ;
}
} ) ;
}
}
}
2021-04-10 06:46:50 +00:00
else
2021-04-25 11:45:36 +00:00
csDone = true ;
2020-09-26 15:27:41 +00:00
2022-10-26 06:48:51 +00:00
} else if ( window . location . hostname . match ( /\.(ie|uk)$/ ) || matchDomain ( [ 'citywire.com' , 'ft.com' , 'scotsman.com' , 'tes.com' ] ) ) { //united kingdom/ireland
2020-10-02 16:41:44 +00:00
2022-07-30 05:41:59 +00:00
if ( matchDomain ( [ 'belfasttelegraph.co.uk' , 'independent.ie' ] ) ) {
let flip _pay = document . querySelector ( 'div#flip-pay[style]' ) ;
if ( flip _pay )
flip _pay . removeAttribute ( 'style' ) ;
}
2022-10-26 06:48:51 +00:00
else if ( matchDomain ( 'citywire.com' ) ) {
removeClassesList ( [ 'article-locked' , 'm-article--locked' , 'm-media-container--locked' , 'm-article__body--locked' ] ) ;
let banners = document . querySelectorAll ( 'registration-widget, div.alert--locked' ) ;
removeDOMElement ( ... banners ) ;
}
else if ( matchDomain ( 'ft.com' ) ) {
if ( window . location . hostname . startsWith ( 'amp.' ) ) {
amp _unhide _subscr _section ( '.ad-container, amp-ad' ) ;
} else {
let cookie _banner = document . querySelector ( '.o-cookie-message' ) ;
let ribbon = document . querySelector ( '.js-article-ribbon' ) ;
let ads = document . querySelector ( '.o-ads' ) ;
removeDOMElement ( cookie _banner , ribbon , ads ) ;
}
}
2022-07-30 05:41:59 +00:00
else if ( matchDomain ( 'independent.co.uk' ) ) {
2022-01-01 18:01:19 +00:00
let url = window . location . href ;
2022-04-19 19:37:22 +00:00
if ( window . location . search . match ( /(\?|&)amp/ ) ) {
2022-01-01 18:01:19 +00:00
let ads = document . querySelectorAll ( 'amp-ad, amp-embed, [id^="ad-"]' ) ;
removeDOMElement ( ... ads ) ;
} else {
let paywall = document . querySelector ( 'div.article-premium' ) ;
let related = document . querySelector ( 'div.related' ) ;
let msg = document . querySelector ( 'div#bpc_archive' ) ;
if ( paywall && ! related && ! msg ) {
paywall . classList . remove ( 'article-premium' ) ;
let article = document . querySelector ( 'div#main' ) ;
if ( article )
article . insertBefore ( archiveLink ( url ) , article . firstChild ) ;
}
}
}
else if ( matchDomain ( 'prospectmagazine.co.uk' ) ) {
2021-04-10 06:46:50 +00:00
let url = window . location . href ;
2022-01-13 16:26:17 +00:00
let paywall = document . querySelector ( 'div.paywall_overlay_blend, div.paywall' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
2022-04-09 15:07:30 +00:00
csDoneOnce = true ;
2022-08-02 15:26:56 +00:00
let url _cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url . split ( '?' ) [ 0 ] ;
2022-01-13 16:26:17 +00:00
replaceDomElementExt ( url _cache , true , false , 'main' ) ;
}
2022-08-24 18:28:54 +00:00
window . setTimeout ( function ( ) {
let ads = document . querySelectorAll ( '.ad-banner, .advert' ) ;
removeDOMElement ( ... ads ) ;
} , 1000 ) ;
2020-10-11 12:43:35 +00:00
}
2022-10-23 16:11:32 +00:00
else if ( matchDomain ( 'scotsman.com' ) ) {
let premium = document . querySelector ( 'div.premium.no-entitlement' ) ;
if ( premium )
premium . classList . remove ( 'no-entitlement' ) ;
let ads = document . querySelectorAll ( 'div[class^="MarkupAds__Container-"], div[class^="Dailymotion__Wrapper-"], div.OUTBRAIN' ) ;
removeDOMElement ( ... ads ) ;
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'spectator.co.uk' ) ) {
2022-09-15 10:17:16 +00:00
if ( window . location . pathname . startsWith ( '/article/' ) ) {
2022-04-21 20:08:50 +00:00
let body _par = document . querySelector ( 'p[class^="ContentPageBodyParagraph"]' ) ;
2022-09-15 10:17:16 +00:00
if ( ! body _par && dompurify _loaded ) {
csDoneOnce = true ;
let url = window . location . href ;
fetch ( url )
. then ( response => {
if ( response . ok ) {
response . text ( ) . then ( html => {
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( html ) + '</div>' , 'text/html' ) ;
let article = document . querySelector ( 'main > div' ) ;
let article _new = doc . querySelector ( 'main > div' ) ;
if ( article _new ) {
if ( article )
article . appendChild ( article _new ) ;
}
} )
}
} )
2022-04-21 20:08:50 +00:00
}
2021-06-15 19:24:05 +00:00
}
2020-10-16 16:41:41 +00:00
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'telegraph.co.uk' ) ) {
2021-11-09 16:18:34 +00:00
let url = window . location . href . split ( '?' ) [ 0 ] ;
if ( url . endsWith ( '/amp/' ) ) {
2021-11-30 16:36:15 +00:00
let paywall = document . querySelectorAll ( '.premium-paywall' ) ;
2021-12-23 07:43:19 +00:00
if ( paywall . length ) {
2021-04-10 06:46:50 +00:00
let truncated _content = document . querySelector ( '.truncated-content' ) ;
2021-11-30 16:36:15 +00:00
removeDOMElement ( ... paywall , truncated _content ) ;
2021-12-24 07:32:45 +00:00
amp _unhide _access _hide ( '="c.result=\'ALLOW_ACCESS\'"' , '' , 'amp-ad, amp-embed' , false ) ;
2022-01-09 16:28:17 +00:00
} else {
let amp _ads = document . querySelectorAll ( 'amp-ad, amp-embed' ) ;
removeDOMElement ( ... amp _ads ) ;
2020-12-16 17:38:05 +00:00
}
2021-11-09 16:18:34 +00:00
} else {
2021-12-24 07:32:45 +00:00
let subwall = document . querySelectorAll ( '[class^="subwall"]' ) ;
2021-11-09 16:18:34 +00:00
let ads = document . querySelectorAll ( '.advert, .commercial-unit' ) ;
2021-12-24 07:32:45 +00:00
removeDOMElement ( ... subwall , ... ads ) ;
2021-04-10 06:46:50 +00:00
}
2020-10-21 17:54:10 +00:00
}
2022-10-24 14:35:15 +00:00
else if ( matchDomain ( 'tes.com' ) ) {
let banner = document . querySelector ( 'div.js-paywall-info' ) ;
removeDOMElement ( banner ) ;
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'the-tls.co.uk' ) ) {
let paywall = document . querySelector ( '.tls-subscriptions-banner__closed-skin' ) ;
removeDOMElement ( paywall ) ;
2020-11-07 09:44:13 +00:00
}
2022-09-17 06:30:01 +00:00
else if ( matchDomain ( 'theneweuropean.co.uk' ) ) {
let paywall = document . querySelector ( 'div[data-show-fade-on-noaccess]' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let content = document . querySelector ( 'div[data-show-has-access]' ) ;
if ( content )
content . removeAttribute ( 'data-show-has-access' ) ;
}
let banners = document . querySelectorAll ( 'div[data-show-subs-blocked]' ) ;
removeDOMElement ( ... banners ) ;
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'thetimes.co.uk' ) ) {
2021-06-19 17:04:34 +00:00
let url = window . location . href ;
2022-02-03 19:16:59 +00:00
if ( window . location . hostname !== 'epaper.thetimes.co.uk' ) {
2022-08-11 19:51:18 +00:00
let block = document . querySelector ( '.subscription-block' ) ;
let adverts = document . querySelectorAll ( '#ad-article-inline, #sticky-ad-header, div[class*="InlineAdWrapper"], div[class*="NativeAd"], div.gyLkkj' ) ;
removeDOMElement ( block , ... adverts ) ;
2022-02-03 19:16:59 +00:00
let paywall = document . querySelector ( 'div#paywall-portal-article-footer' ) ;
if ( paywall && ! url . includes ( '?shareToken=' ) ) {
removeDOMElement ( paywall ) ;
2022-08-11 19:51:18 +00:00
let article = document . querySelector ( 'article[class^="responsive__BodyContainer"]' ) ;
if ( article )
article . insertBefore ( archiveLink ( url ) , article . firstChild ) ;
2022-02-03 19:16:59 +00:00
}
2022-08-11 19:51:18 +00:00
let paywall _page = document . querySelector ( 'div#paywall-portal-page-footer' ) ;
removeDOMElement ( paywall _page ) ;
2021-06-13 19:59:46 +00:00
}
2020-11-07 16:12:37 +00:00
}
2022-07-30 05:41:59 +00:00
else
2021-04-25 11:45:36 +00:00
csDone = true ;
2021-04-10 06:46:50 +00:00
2022-10-02 06:40:43 +00:00
} else if ( window . location . hostname . match ( /\.(ar|br|cl|pe)$/ ) || matchDomain ( [ 'clarin.com' , 'elespectador.com' , 'elmercurio.com' , 'latercera.com' , 'lasegunda.com' , 'valor.globo.com' ] ) ) { //south america
2021-04-10 06:46:50 +00:00
2021-12-12 17:32:28 +00:00
if ( matchDomain ( 'abril.com.br' ) ) {
if ( window . location . pathname . endsWith ( '/amp/' ) ) {
let paywall = document . querySelector ( '.piano-modal' ) ;
let amp _ads = document . querySelectorAll ( 'amp-ad, amp-embed' ) ;
removeDOMElement ( paywall , ... amp _ads ) ;
}
}
2022-01-19 19:29:41 +00:00
else if ( matchDomain ( 'clarin.com' ) ) {
let ads = document . querySelectorAll ( '.ad-slot' ) ;
removeDOMElement ( ... ads ) ;
}
2022-07-29 16:20:36 +00:00
else if ( matchDomain ( 'crusoe.uol.com.br' ) ) {
let paywall = document . querySelector ( '#wallcontent' ) ;
let ads = document . querySelectorAll ( '#gpt-leaderboard, .ads_desktop, .catchment-box' ) ;
removeDOMElement ( paywall , ... ads ) ;
}
2022-02-11 16:51:33 +00:00
else if ( matchDomain ( pe _grupo _elcomercio _domains ) ) {
2022-09-16 06:13:19 +00:00
let paywall = document . querySelector ( '.paywall' ) ;
2021-04-10 06:46:50 +00:00
if ( paywall ) {
2022-09-16 06:13:19 +00:00
paywall . removeAttribute ( 'class' ) ;
2021-04-10 06:46:50 +00:00
paywall . removeAttribute ( 'style' ) ;
2022-09-16 06:13:19 +00:00
let fade = document . querySelector ( 'p.story-contents--fade' ) ;
if ( fade )
fade . classList . remove ( 'story-contents--fade' ) ;
2021-04-10 06:46:50 +00:00
}
2022-09-16 06:13:19 +00:00
let ads = document . querySelectorAll ( 'div[class^="content_gpt"]' ) ;
2022-07-28 15:41:02 +00:00
removeDOMElement ( ... ads ) ;
2020-11-15 13:15:12 +00:00
}
2021-12-23 16:36:09 +00:00
else if ( matchDomain ( 'elespectador.com' ) ) {
2022-04-26 19:39:02 +00:00
if ( window . location . search . match ( /(\?|&)outputType=amp/ ) ) {
2022-03-15 17:34:21 +00:00
amp _unhide _subscr _section ( 'amp-ad, amp-embed, [class^="Widget"], amp-fx-flying-carpet' ) ;
2021-12-23 16:36:09 +00:00
} else {
2022-04-26 19:39:02 +00:00
let paywall = document . querySelector ( 'div.exclusive_validation' ) ;
2021-12-23 16:36:09 +00:00
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
}
}
2021-04-10 06:46:50 +00: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 18:14:56 +00:00
let page _pdf _content = document . querySelector ( 'div.page_pdf_content' ) ;
let close _html = document . querySelector ( 'div.close_html' ) ;
2022-06-26 07:20:53 +00:00
let cont _page _full = document . querySelector ( 'div.cont_page_full' ) ;
removeDOMElement ( page _pdf _content , close _html , cont _page _full ) ;
2022-03-08 18:04:50 +00:00
} , 1000 ) ;
2021-07-26 18:02:44 +00: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' ) ;
2022-03-08 18:04:50 +00:00
} , 3000 ) ;
2020-11-17 16:39:31 +00:00
}
2022-06-01 15:39:27 +00:00
else if ( matchDomain ( 'em.com.br' ) ) {
if ( ! window . location . pathname . endsWith ( '/amp.html' ) ) {
let paywall = document . querySelector ( '.news-blocked-content' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
let ads = document . querySelectorAll ( '.ads, .containerads' ) ;
removeDOMElement ( ... ads ) ;
} else {
amp _unhide _subscr _section ( 'amp-ad, amp-embed, amp-fx-flying-carpet' ) ;
let compress _text = document . querySelector ( 'div.compress-text' ) ;
if ( compress _text )
compress _text . classList . remove ( 'compress-text' ) ;
}
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'estadao.com.br' ) ) {
2022-09-24 16:54:10 +00:00
if ( window . location . pathname . match ( /(\.amp$|^\/amp\/)/ ) || window . location . search . startsWith ( '?amp' ) ) {
amp _unhide _access _hide ( '="outputValue=\'hide_paywall\'"' , '="outputValue=\'show_paywall\'"' , 'amp-ad, amp-embed, amp-fx-flying-carpet, div[class^="pAd"]' ) ;
2021-12-12 17:32:28 +00:00
} else {
let paywall = document . getElementById ( 'paywall-wrapper-iframe-estadao' ) ;
2022-09-24 16:54:10 +00:00
let ads = document . querySelectorAll ( 'div[class^="styles__Container-sc-"]' ) ;
removeDOMElement ( paywall , ... ads ) ;
2021-12-12 17:32:28 +00:00
}
2020-11-21 18:21:29 +00:00
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'folha.uol.com.br' ) ) {
2022-07-24 06:50:03 +00:00
if ( matchDomain ( 'piaui.folha.uol.com.br' ) ) {
if ( window . location . search . startsWith ( '?amp' ) ) {
amp _unhide _subscr _section ( ) ;
} else {
let paywall = document . querySelector ( '.revista--interna__assineonly' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
}
2021-12-12 17:32:28 +00:00
} else {
2022-07-24 06:50:03 +00:00
if ( window . location . pathname . startsWith ( '/amp/' ) ) {
amp _unhide _subscr _section ( 'amp-ad, amp-sticky-ad, amp-embed' ) ;
} else {
let signup = document . querySelector ( '.c-top-signup' ) ;
removeDOMElement ( signup ) ;
}
2021-12-12 17:32:28 +00:00
}
2020-11-22 14:25:28 +00:00
}
2022-03-15 17:34:21 +00:00
else if ( matchDomain ( 'blogfolha.uol.com.br' ) ) {
let hidden _images = document . querySelectorAll ( 'div[id^="attachment_"] > a > img[src^="http:"][srcset]' ) ;
for ( let hidden _image of hidden _images ) {
hidden _image . src = hidden _image . src . replace ( 'http:' , 'https:' ) ;
hidden _image . srcset = '' ;
}
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'latercera.com' ) ) {
2022-10-02 06:40:43 +00:00
let subscr _banner = document . querySelector ( '.empty' ) ;
removeDOMElement ( subscr _banner ) ;
2020-11-23 17:12:40 +00:00
}
2020-11-28 17:34:26 +00:00
else if ( matchDomain ( 'lasegunda.com' ) ) {
2021-04-10 06:46:50 +00: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 17:34:26 +00:00
}
2022-10-02 06:40:43 +00:00
else if ( matchDomain ( 'lavoz.com.ar' ) ) {
let wrapperblock = document . querySelector ( '.wrapperblock' ) ;
removeDOMElement ( wrapperblock ) ;
}
2022-08-12 05:12:26 +00:00
else if ( matchDomain ( 'valor.globo.com' ) ) {
let url = window . location . href ;
let paywall = document . querySelector ( 'div.paywall' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
csDoneOnce = true ;
let url _cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url ;
replaceDomElementExt ( url _cache , true , false , 'div.protected-content' ) ;
}
window . setTimeout ( function ( ) {
let skeleton _box = document . querySelector ( 'div.glb-skeleton-box' ) ;
if ( skeleton _box ) {
skeleton _box . classList . remove ( 'glb-skeleton-box' ) ;
skeleton _box . removeAttribute ( 'style' ) ;
}
} , 1000 ) ;
}
2022-05-29 13:52:54 +00:00
else if ( window . location . hostname . endsWith ( '.cl' ) && document . querySelector ( 'meta[property="og:image"][content*="://impresa.soy-chile.cl/"]' ) ) {
2021-04-10 06:46:50 +00:00
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 19:39:13 +00:00
}
2021-04-10 06:46:50 +00:00
else
2021-04-25 11:45:36 +00:00
csDone = true ;
2020-12-03 15:52:33 +00:00
2022-01-23 09:13:35 +00:00
} else { //other (like com/org & not at/be/br/ch/cl/de/dk/fi/fr/es/ie/nl/no/pe/pt/se/uk))
2021-04-10 06:46:50 +00:00
2021-11-16 17:21:56 +00:00
if ( matchDomain ( usa _adv _local _domains ) ) {
let url = window . location . href ;
if ( url . includes ( '?outputType=amp' ) ) {
let amp _ads = document . querySelectorAll ( '.amp-ad-container, amp-embed' ) ;
removeDOMElement ( ... amp _ads ) ;
} else {
let paywall = document . querySelector ( '.paywall' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
let ads = document . querySelectorAll ( 'div.ad' ) ;
removeDOMElement ( ... ads ) ;
}
}
else if ( matchDomain ( 'adweek.com' ) ) {
2021-04-10 06:46:50 +00:00
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 21:32:59 +00:00
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'americanbanker.com' ) ) {
2021-05-04 20:13:32 +00: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 17:02:32 +00:00
}
2021-12-02 17:52:30 +00:00
else if ( matchDomain ( 'artnet.com' ) ) {
2021-12-12 08:38:17 +00:00
if ( window . location . pathname . endsWith ( '/amp-page' ) ) {
amp _unhide _subscr _section ( ) ;
} else {
let body _hidden = document . querySelector ( '.article-body' ) ;
if ( body _hidden )
body _hidden . style = 'display:block;' ;
}
2021-12-02 17:52:30 +00:00
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'asia.nikkei.com' ) ) {
2021-11-09 16:18:34 +00:00
let popup = document . querySelector ( '#pianoj_ribbon' ) ;
2021-04-10 06:46:50 +00:00
removeDOMElement ( popup ) ;
2020-12-20 20:28:12 +00:00
}
2021-05-09 12:51:15 +00:00
else if ( matchDomain ( 'asiatimes.com' ) ) {
2022-04-19 19:37:22 +00:00
if ( ! window . location . search . match ( /(\?|&)amp_markup=1/ ) ) {
2022-01-19 20:24:12 +00:00
let paywall = document . querySelector ( 'div.woocommerce' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let url _amp = window . location . href . split ( '?' ) [ 0 ] + '?amp_markup=1' ;
replaceDomElementExt ( url _amp , false , false , 'div.entry-content' , '' , 'article.ia2amp-article' ) ;
}
}
2021-05-09 12:51:15 +00:00
}
2022-10-01 10:35:59 +00:00
else if ( matchDomain ( 'axios.com' ) ) {
2022-10-24 18:15:28 +00:00
function axios _noscroll ( node ) {
node . removeAttribute ( 'style' ) ;
let overlay = document . querySelector ( 'div[class^="Modal_paywallContainer"]' ) ;
hideDOMElement ( overlay ) ;
}
waitDOMAttribute ( 'html' , 'HTML' , 'style' , axios _noscroll , true ) ;
let banners = document . querySelectorAll ( 'div[data-vars-experiment="pro-paywall"], .apexAd' ) ;
2022-10-19 19:28:47 +00:00
hideDOMElement ( ... banners ) ;
2022-10-24 18:15:28 +00:00
csDoneOnce = true ;
2022-10-01 10:35:59 +00:00
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'barrons.com' ) ) {
2021-10-30 08:29:59 +00:00
let url = window . location . href ;
if ( ! url . includes ( 'barrons.com/amp/' ) ) {
2021-04-10 06:46:50 +00:00
let body _continuous = document . querySelector ( 'body.is-continuous' ) ;
let snippet = document . querySelector ( 'meta[content="snippet"]' ) ;
if ( body _continuous && snippet ) {
2021-10-30 08:29:59 +00:00
removeDOMElement ( snippet ) ;
window . location . href = url . replace ( 'barrons.com' , 'barrons.com/amp' ) ;
2021-04-10 06:46:50 +00:00
}
2022-04-24 08:01:13 +00:00
let continue _buttons = document . querySelectorAll ( 'button.snippet__buttons--continue' ) ;
for ( let elem of continue _buttons )
elem . addEventListener ( 'click' , function ( ) { window . location . reload ( ) ; } ) ;
2021-05-15 06:23:47 +00:00
let barrons _ads = document . querySelectorAll ( '.barrons-body-ad-placement' ) ;
removeDOMElement ( ... barrons _ads ) ;
2021-04-10 06:46:50 +00:00
} else {
2021-11-30 16:36:15 +00:00
amp _unhide _subscr _section ( '.wsj-ad, amp-ad' ) ;
2021-04-10 06:46:50 +00:00
}
}
2021-12-11 18:12:13 +00:00
else if ( matchDomain ( 'billboard.com' ) ) {
if ( window . location . pathname . endsWith ( '/amp/' ) ) {
amp _unhide _subscr _section ( 'amp-ad, amp-embed' ) ;
}
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'bloomberg.com' ) ) {
2022-01-11 17:32:49 +00:00
function bloomberg _noscroll ( node ) {
node . removeAttribute ( 'data-paywall-overlay-status' ) ;
}
2022-10-12 07:03:55 +00:00
waitDOMElement ( 'div[id^="fortress-"]' , 'DIV' , removeDOMElement , true ) ;
2022-01-11 17:32:49 +00:00
waitDOMAttribute ( 'body' , 'BODY' , 'data-paywall-overlay-status' , bloomberg _noscroll , true ) ;
2022-10-12 07:03:55 +00:00
let paywall = document . querySelectorAll ( 'div[id^="fortress-"]' ) ;
2022-01-11 17:32:49 +00:00
let leaderboard = document . querySelector ( 'div[id^="leaderboard"], div[class^="leaderboard"], div.canopy-container' ) ;
let noscroll = document . querySelector ( 'body[data-paywall-overlay-status]' ) ;
if ( noscroll )
noscroll . removeAttribute ( 'data-paywall-overlay-status' ) ;
2022-10-19 19:28:47 +00:00
hideDOMElement ( ... paywall , leaderboard ) ;
2021-07-19 17:56:02 +00:00
sessionStorage . clear ( ) ;
2021-08-06 11:25:43 +00:00
let url = window . location . href ;
2022-07-28 15:41:02 +00:00
if ( url . match ( /s\/\d{4}-/ ) ) {
let page _ad = document . querySelectorAll ( 'div.page-ad, div[data-ad-placeholder], div[class*="-ad-top"]' ) ;
2021-08-23 19:31:44 +00:00
let reg _ui _client = document . querySelector ( 'div#reg-ui-client' ) ;
2022-10-19 19:28:47 +00:00
hideDOMElement ( ... page _ad , reg _ui _client ) ;
2021-08-06 11:25:43 +00:00
let hidden _images = document . querySelectorAll ( 'img.lazy-img__image[src][data-native-src]' ) ;
for ( let hidden _image of hidden _images ) {
2021-12-13 19:30:25 +00:00
if ( hidden _image . src . match ( /\/(60|150)x-1\.(png|jpg)$/ ) )
2021-08-06 11:25:43 +00:00
hidden _image . setAttribute ( 'src' , hidden _image . getAttribute ( 'data-native-src' ) ) ;
hidden _image . style . filter = 'none' ;
}
2021-10-20 18:35:52 +00: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 10:17:55 +00:00
let blur = document . querySelector ( 'div.blur[style]' ) ;
if ( blur ) {
blur . classList . remove ( 'blur' ) ;
blur . removeAttribute ( 'style' ) ;
}
2021-12-13 19:30:25 +00:00
let shimmering _content = document . querySelectorAll ( 'div.shimmering-text' ) ;
let body _transparent = document . querySelector ( 'div[class*="nearly-transparent-text-blur"]' ) ;
2022-01-06 15:40:57 +00:00
if ( ( shimmering _content . length || body _transparent ) && dompurify _loaded ) {
2021-12-13 19:30:25 +00:00
removeDOMElement ( ... shimmering _content ) ;
if ( body _transparent )
removeClassesByPrefix ( body _transparent , 'nearly-transparent-text-blur' ) ;
let json _script = document . querySelector ( 'script[data-component-props="ArticleBody"], script[data-component-props="FeatureBody"]' ) ;
2022-03-10 18:45:55 +00:00
if ( json _script ) {
2021-12-13 19:30:25 +00:00
let json = JSON . parse ( json _script . innerHTML ) ;
if ( json ) {
let json _text ;
if ( json . body )
json _text = json . body ;
else if ( json . story && json . story . body )
json _text = json . story . 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 = document . querySelector ( 'div.body-content:not(.art_done)' ) ;
article _class = 'body-content' ;
}
if ( article ) {
article _class += ' art_done' ;
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( '<div class="' + article _class + '">' + DOMPurify . sanitize ( json _text , { ADD _TAGS : [ 'iframe' , 'script' ] } ) + '</div>' , 'text/html' ) ;
let article _new = doc . querySelector ( 'div' ) ;
if ( article _new ) {
article . parentNode . replaceChild ( article _new , article ) ;
let teaser _body = document . querySelector ( 'div.body-content[class*="teaser-content_"]' ) ;
removeDOMElement ( teaser _body ) ;
let thirdparty _embed = document . querySelector ( 'div.thirdparty-embed__container[style*="height: 0;"]' ) ;
if ( thirdparty _embed )
thirdparty _embed . setAttribute ( 'style' , 'height: 550px !important;' ) ;
}
2021-12-12 21:24:54 +00:00
}
2021-08-06 11:25:43 +00:00
}
2021-07-19 17:56:02 +00:00
}
}
2021-04-10 06:46:50 +00:00
}
2021-07-19 17:56:02 +00:00
}
2021-04-10 06:46:50 +00:00
}
2021-06-14 19:45:26 +00:00
else if ( matchDomain ( 'bostonglobe.com' ) ) {
2021-12-11 18:46:23 +00:00
if ( window . location . search . startsWith ( '?outputType=amp' ) ) {
amp _unhide _subscr _section ( ) ;
} else {
let ads = document . querySelectorAll ( 'div.arc_ad' ) ;
removeDOMElement ( ... ads ) ;
}
2021-06-14 19:45:26 +00:00
}
2022-06-26 19:51:30 +00:00
else if ( matchDomain ( 'bqprime.com' ) ) {
if ( window . location . pathname . startsWith ( '/amp/' ) ) {
amp _unhide _subscr _section ( ) ;
}
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'business-standard.com' ) ) {
2021-10-18 19:08:58 +00:00
let skip _button = document . querySelector ( 'a.btn_skip' ) ;
if ( skip _button )
skip _button . click ( ) ;
2022-06-24 09:46:16 +00:00
if ( ! window . location . pathname . startsWith ( '/article-amp/' ) ) {
2022-08-18 18:02:29 +00:00
let paywall = document . querySelector ( 'span.p-content.paywall, main, p.read-txt' ) ;
2022-06-24 09:46:16 +00:00
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
2020-12-24 12:30:55 +00:00
}
2022-09-23 06:07:04 +00:00
let story _content = document . querySelector ( 'div.story-content' ) ;
if ( story _content )
story _content . classList . remove ( 'story-content' ) ;
let ads = document . querySelectorAll ( 'div[class*="adv-"]' ) ;
removeDOMElement ( ... ads ) ;
2022-06-24 09:46:16 +00:00
} else {
2022-08-18 18:02:29 +00:00
amp _unhide _subscr _section ( 'amp-ad, amp-embed, .block-cont-amp, #divnonpaidcontent, div > div.article_image, div[subscriptions-actions], .reader' ) ;
2021-10-18 19:08:58 +00:00
}
2020-12-24 12:30:55 +00:00
}
2021-08-08 08:02:24 +00:00
2022-01-14 14:33:58 +00:00
else if ( matchDomain ( 'businessoffashion.com' ) ) {
2022-08-26 17:50:25 +00:00
if ( window . location . search . startsWith ( '?outputType=amp' ) ) {
amp _unhide _access _hide ( ) ;
} else {
let ads = document . querySelectorAll ( 'div[class^="default__AdsBlockWrapper"]' ) ;
removeDOMElement ( ... ads ) ;
}
2022-01-14 14:33:58 +00:00
}
2022-07-31 06:31:05 +00:00
else if ( matchDomain ( ca _gcm _domains ) ) {
let paywall = document . querySelector ( 'div._block_1dgevo' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
window . setTimeout ( function ( ) {
window . location . reload ( true ) ;
} , 500 ) ;
}
let counter = document . querySelector ( 'div#paywall-banner-content' ) ;
removeDOMElement ( counter ) ;
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( ca _torstar _domains ) ) {
window . setTimeout ( function ( ) {
let meter _banner = document . querySelector ( '.c-article-meter-banner' ) ;
2022-08-29 06:37:02 +00:00
let ads = document . querySelectorAll ( '.seo-media-query, .c-googleadslot, .ad-slot' ) ;
2021-04-10 06:46:50 +00:00
removeDOMElement ( meter _banner , ... ads ) ;
let end _of _article = document . querySelector ( '#end-of-article' ) ;
2022-10-19 19:28:47 +00:00
hideDOMElement ( end _of _article ) ;
2021-04-10 06:46:50 +00:00
let rightrail = document . querySelector ( '.c-article-body__rightrail' ) ;
2022-10-19 19:28:47 +00:00
hideDOMElement ( rightrail ) ;
2021-04-10 06:46:50 +00:00
} , 500 ) ;
}
else if ( matchDomain ( 'cen.acs.org' ) ) {
2022-01-13 16:26:17 +00:00
let meteredBar = document . querySelector ( '.meteredBar' ) ;
removeDOMElement ( meteredBar ) ;
2021-04-10 06:46:50 +00:00
}
2022-08-27 08:11:13 +00:00
else if ( matchDomain ( [ 'chronicle.com' , 'philanthropy.com' ] ) ) {
2021-10-07 17:56:23 +00:00
let preview = document . querySelector ( 'div[data-content-summary]' ) ;
removeDOMElement ( preview ) ;
2022-09-23 13:32:27 +00:00
let article _hidden = document . querySelector ( 'div.contentBody' ) ;
if ( article _hidden ) {
2021-10-07 17:56:23 +00:00
article _hidden . removeAttribute ( 'data-content-body' ) ;
2022-09-23 13:32:27 +00:00
article _hidden . removeAttribute ( 'hidden' ) ;
}
2021-10-07 17:56:23 +00:00
}
2021-07-28 16:33:12 +00:00
else if ( matchDomain ( 'csmonitor.com' ) ) {
let paywall = document . querySelector ( 'div.paywall' ) ;
removeDOMElement ( paywall ) ;
}
2022-05-04 15:58:35 +00:00
else if ( matchDomain ( 'dailywire.com' ) ) {
let paywall = document . querySelector ( '#post-body-text > div > div[class]' ) ;
if ( paywall )
paywall . removeAttribute ( 'class' ) ;
}
2021-12-11 18:46:23 +00:00
else if ( matchDomain ( 'dallasnews.com' ) ) {
if ( window . location . search . startsWith ( '?outputType=amp' ) ) {
amp _unhide _subscr _section ( 'amp-ad, amp-embed' ) ;
2022-05-10 20:31:14 +00:00
} else {
let overlay = document . querySelector ( 'div.sl-overlay' ) ;
removeDOMElement ( overlay ) ;
let noscroll = document . querySelector ( 'div#courier-body-wrapper[style]' ) ;
if ( noscroll )
noscroll . removeAttribute ( 'style' ) ;
2021-12-11 18:46:23 +00:00
}
}
2021-12-11 18:12:13 +00:00
else if ( matchDomain ( 'digiday.com' ) ) {
if ( window . location . pathname . endsWith ( '/amp/' ) ) {
amp _unhide _access _hide ( '="NOT p.showPageviewExpired AND NOT p.showPayWall"' , '' , 'amp-ad, .advertisement, .ad-wrapper' ) ;
}
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'discovermagazine.com' ) ) {
window . setTimeout ( function ( ) {
let mammoth = document . querySelector ( '.iXVGnF' ) ;
if ( mammoth )
window . location . reload ( ) ;
2021-07-11 16:44:45 +00:00
let banner = document . querySelector ( 'div.dPURIw' ) ;
2022-10-19 19:28:47 +00:00
hideDOMElement ( banner ) ;
2022-03-08 18:04:50 +00:00
} , 1000 ) ;
2021-04-10 06:46:50 +00:00
}
2021-05-21 06:04:59 +00:00
else if ( matchDomain ( 'economictimes.com' ) ) {
2021-12-12 08:38:17 +00:00
if ( window . location . pathname . includes ( '/amp_' ) ) {
let paywall = document . querySelector ( '.paywall_wrap' ) ;
if ( paywall ) {
let content = document . querySelector ( '.paywall[style="display:none;"]' ) ;
if ( content )
content . setAttribute ( 'style' , 'display:block;' ) ;
let intro = document . querySelector ( '.art_wrap' ) ;
let article _blocker = document . querySelector ( '.articleBlocker' ) ;
let amp _ads = document . querySelectorAll ( 'amp-ad' ) ;
removeDOMElement ( paywall , intro , article _blocker , ... amp _ads ) ;
2021-05-21 06:04:59 +00:00
}
2021-12-12 08:38:17 +00:00
} else {
window . setTimeout ( function ( ) {
let paywall = document . querySelector ( 'div#blocker_layer' ) ;
let data _prime = document . querySelector ( 'div[data-prime="1"]' ) ;
2022-08-07 17:04:12 +00:00
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( ( paywall || data _prime ) && amphtml ) {
2021-12-12 08:38:17 +00:00
removeDOMElement ( paywall ) ;
if ( data _prime )
data _prime . removeAttribute ( 'data-prime' ) ;
2022-08-07 17:04:12 +00:00
window . location . href = amphtml . href ;
2021-12-12 08:38:17 +00:00
}
2022-03-08 18:04:50 +00:00
} , 500 ) ;
2021-12-12 08:38:17 +00:00
}
2021-05-21 06:04:59 +00:00
}
2021-05-03 20:13:22 +00: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 06:04:59 +00:00
let page _content = document . querySelector ( 'div.pageContent:not([style]' ) ;
if ( page _content )
page _content . setAttribute ( 'style' , 'height: auto !important;' ) ;
2021-05-03 20:13:22 +00:00
}
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'economist.com' ) ) {
2022-01-13 16:26:17 +00:00
let subscribe = document . querySelector ( '.subscription-proposition' ) ;
let wrapper = document . getElementById ( 'bottom-page-wrapper' ) ;
let adverts = document . querySelectorAll ( 'div.advert' ) ;
removeDOMElement ( subscribe , wrapper , ... adverts ) ;
let p _articles = document . querySelectorAll ( 'p.article__body-text' ) ;
let href ;
for ( let p _article of p _articles ) {
let e _anchors = document . querySelectorAll ( 'a' ) ;
href = '' ;
for ( let e _anchor of e _anchors ) {
if ( e _anchor . href ) {
href = e _anchor . href ;
} else {
e _anchor . href = href ;
2021-04-10 06:46:50 +00:00
}
2021-01-11 20:00:41 +00:00
}
2022-01-13 16:26:17 +00:00
}
2021-01-11 20:00:41 +00:00
}
2022-04-22 14:49:43 +00:00
else if ( matchDomain ( 'enotes.com' ) ) {
2022-04-26 05:57:16 +00:00
let paywall = document . querySelectorAll ( 'section.c-cta-section' ) ;
if ( paywall . length ) {
removeDOMElement ( ... paywall ) ;
let blurred = document . querySelectorAll ( 'div[class^="_"]' ) ;
2022-04-22 14:49:43 +00:00
for ( let elem of blurred )
elem . removeAttribute ( 'class' ) ;
2022-04-26 06:15:18 +00:00
let intro = document . querySelectorAll ( 'div.o-rte-text > p:not([class]), div.o-rte-text > h3' ) ;
2022-04-22 14:49:43 +00:00
for ( let elem of intro )
removeDOMElement ( elem ) ;
2022-05-09 18:29:25 +00:00
let section _words = pageContains ( 'p[class="u-align--center"]' , /\(The entire section contains/ ) ;
let ads = document . querySelectorAll ( '.ad-hfu' ) ;
removeDOMElement ( ... section _words , ... ads ) ;
2022-04-22 14:49:43 +00:00
}
}
2021-04-10 06:46:50 +00: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' ) ) ;
}
}
2022-10-19 19:28:47 +00:00
else if ( matchDomain ( 'espn.com' ) ) {
let url = window . location . href ;
let paywall = document . querySelector ( 'aside.espn-plus-container-wrapper' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let article = document . querySelector ( 'div.article-body' ) ;
if ( article )
article . insertBefore ( archiveLink ( url ) , article . firstChild ) ;
}
}
2022-05-29 15:08:47 +00:00
else if ( matchDomain ( 'financialexpress.com' ) ) {
let paywall = document . querySelector ( 'div.paywall' ) ;
if ( paywall )
paywall . classList . remove ( 'paywall' ) ;
let register = document . querySelector ( 'div.pcl-wrap' ) ;
let ads ;
if ( window . location . pathname . endsWith ( '/lite/' ) )
ads = document . querySelectorAll ( 'amp-ad, amp-embed, .ad-bg-container' ) ;
else
ads = document . querySelectorAll ( 'div[class*="-ads-blocks-ad-unit"]' ) ;
removeDOMElement ( register , ... ads ) ;
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'firstthings.com' ) ) {
let paywall = document . querySelector ( '.paywall' ) ;
removeDOMElement ( paywall ) ;
}
else if ( matchDomain ( 'foreignaffairs.com' ) ) {
2021-09-28 18:42:02 +00: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 17:01:46 +00:00
let hidden _images = document . querySelectorAll ( 'img[src^="data:image/"][data-src]' ) ;
2021-09-28 18:42:02 +00:00
for ( let hidden _image of hidden _images ) {
2021-10-24 17:01:46 +00:00
hidden _image . setAttribute ( 'src' , hidden _image . getAttribute ( 'data-src' ) ) ;
hidden _image . removeAttribute ( 'class' ) ;
2021-04-10 06:46:50 +00:00
}
2021-09-28 18:42:02 +00: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 06:46:50 +00:00
}
2022-03-08 18:04:50 +00:00
} , 1000 ) ;
2021-01-09 16:45:21 +00:00
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'foreignpolicy.com' ) ) {
2021-06-16 05:38:22 +00: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 08:45:01 +00:00
}
2021-12-10 17:16:56 +00:00
else if ( matchDomain ( 'fortune.com' ) ) {
2022-04-21 19:27:17 +00:00
let paywall = document . querySelector ( '.paywall' ) ;
2022-04-22 14:21:09 +00:00
if ( window . location . pathname . match ( /\/amp(\/)?/ ) ) {
2021-12-10 17:16:56 +00:00
amp _unhide _access _hide ( '="NOT p.showRegWall AND NOT p.showPayWall"' , '' , '[class^="amp-ad"]' ) ;
removeDOMElement ( paywall ) ;
2022-04-21 19:27:17 +00:00
} else {
if ( paywall )
paywall . removeAttribute ( 'class' ) ;
2021-12-10 17:16:56 +00:00
}
}
2021-04-10 06:46:50 +00: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 17:46:06 +00:00
}
2021-04-10 06:46:50 +00: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 19:12:02 +00:00
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'hbr.org' ) ) {
let popup = document . querySelector ( '.persistent-banner' ) ;
removeDOMElement ( popup ) ;
2021-01-20 19:26:35 +00:00
}
2021-11-06 08:24:44 +00:00
else if ( matchDomain ( 'hbrchina.org' ) ) {
let div _hidden = document . querySelector ( 'div#the_content' ) ;
if ( div _hidden )
div _hidden . removeAttribute ( 'style' ) ;
}
2022-04-05 16:05:13 +00:00
else if ( matchDomain ( 'hilltimes.com' ) ) {
let paywall = document . querySelector ( 'div.paywallcont' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let json _script = getArticleJsonScript ( ) ;
if ( json _script ) {
let json = JSON . parse ( json _script . text ) . filter ( x => x . articleBody ) [ 0 ] ;
if ( json ) {
2022-04-18 06:14:17 +00:00
let json _text = parseHtmlEntities ( json . articleBody ) . replace ( /(\.|\%)\s{3,}/g , "$&\r\n\r\n" ) ;
2022-04-05 16:05:13 +00:00
let content = document . querySelector ( 'div#xorg' ) ;
if ( json _text && content )
content . innerText = '\r\n' + json _text ;
}
}
}
}
2021-05-25 17:28:02 +00: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 06:46:50 +00: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 12:58:54 +00:00
}
2022-01-08 14:46:46 +00:00
else if ( matchDomain ( usa _hearst _comm _domains ) ) {
2021-06-27 07:56:42 +00:00
let wrapper = document . querySelector ( '.belowMastheadWrapper' ) ;
2022-09-18 14:41:03 +00:00
let ads = document . querySelectorAll ( 'div.adModule' ) ;
removeDOMElement ( wrapper , ... ads ) ;
2021-06-27 07:56:42 +00:00
}
2021-08-05 17:43:10 +00: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 ) ;
2021-11-30 16:36:15 +00:00
amp _unhide _access _hide ( '^="NOT p.showPageviewExpired"' )
2021-08-05 17:43:10 +00:00
}
}
}
2021-12-19 10:13:00 +00:00
else if ( matchDomain ( 'indianexpress.com' ) ) {
if ( window . location . pathname . endsWith ( '/lite/' ) )
2022-03-06 16:43:38 +00:00
amp _unhide _access _hide ( '="metering.result=\'ALLOW_ACCESS\'"' , '' , 'amp-ad, amp-embed' ) ;
2021-12-19 10:13:00 +00:00
else {
2022-01-08 15:43:25 +00:00
let paywall = document . querySelector ( 'div#pcl-rest-content[style]' ) ;
if ( paywall )
paywall . removeAttribute ( 'style' ) ;
let register = document . querySelector ( 'div#app-pcl' ) ;
2021-12-19 10:13:00 +00:00
let ads = document . querySelectorAll ( 'div[class^="adsbox"]' ) ;
2022-01-08 15:43:25 +00:00
removeDOMElement ( register , ... ads ) ;
2021-12-19 10:13:00 +00:00
}
}
2022-03-06 16:43:38 +00:00
else if ( matchDomain ( 'indiatoday.in' ) ) {
if ( window . location . pathname . match ( /(\/amp)?\/magazine\// ) ) {
let url = window . location . href ;
if ( ! url . includes ( '/amp/' ) ) {
let paywall = document . querySelector ( '#csc-paywall' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
} else {
amp _unhide _access _hide ( '="granted"' , '="NOT NOT granted"' , 'amp-ad, amp-embed' ) ;
}
} else
csDoneOnce = true ;
}
2021-07-19 15:54:59 +00: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 06:46:50 +00:00
else if ( matchDomain ( 'inkl.com' ) ) {
2022-03-04 15:14:14 +00:00
// plus code in contentScript_once.js
2021-01-22 13:33:25 +00:00
}
2022-03-26 18:51:27 +00:00
else if ( matchDomain ( 'ipolitics.ca' ) ) {
let login = document . querySelector ( 'div.login' ) ;
if ( login ) {
removeDOMElement ( login ) ;
let json _script = document . querySelector ( 'script#__NEXT_DATA__' ) ;
if ( json _script && dompurify _loaded ) {
let json = JSON . parse ( json _script . innerText ) ;
if ( json && json . props . pageProps . post . content ) {
let article _new = json . props . pageProps . post . content ;
let article = document . querySelector ( '.post-header' ) ;
if ( article ) {
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( article _new ) + '</div>' , 'text/html' ) ;
let content _new = doc . querySelector ( 'div' ) ;
article . appendChild ( content _new ) ;
}
}
}
}
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'jpost.com' ) ) {
let premium _banners = document . querySelectorAll ( '.hide-for-premium, #hiddenPremiumForm, #hiddenLink' ) ;
removeDOMElement ( ... premium _banners ) ;
}
2021-12-11 11:59:19 +00:00
else if ( matchDomain ( [ 'latimes.com' , 'sandiegouniontribune.com' ] ) ) {
if ( window . location . search . startsWith ( '?_amp=true' ) ) {
2022-08-22 19:23:43 +00:00
amp _unhide _subscr _section ( 'amp-ad, [class*="-ad-wrapper"], div.enhancement' ) ;
2021-12-11 11:59:19 +00:00
} else {
window . setTimeout ( function ( ) {
let metering _bottompanel = document . querySelector ( 'metering-bottompanel' ) ;
2022-08-22 19:23:43 +00:00
let banners = document . querySelectorAll ( 'div.enhancement, div.google-dfp-ad-wrapper' ) ;
removeDOMElement ( metering _bottompanel , ... banners ) ;
2022-03-08 18:04:50 +00:00
} , 500 ) ;
2021-12-11 11:59:19 +00:00
}
}
2021-08-27 06:37:12 +00:00
else if ( matchDomain ( 'law360.com' ) ) {
window . setTimeout ( function ( ) {
let modal = document . querySelectorAll ( 'div#NewsletterModal, div.modal-backdrop' ) ;
removeDOMElement ( ... modal ) ;
2022-03-08 18:04:50 +00:00
} , 500 ) ;
2021-08-27 06:37:12 +00:00
}
2022-07-22 16:39:59 +00:00
else if ( matchDomain ( 'ledevoir.com' ) ) {
let counter = document . querySelector ( '.paywall-breakpoint-wrapper' ) ;
removeDOMElement ( counter ) ;
}
2021-08-13 15:29:49 +00:00
else if ( matchDomain ( 'livelaw.in' ) ) {
2022-05-15 16:25:58 +00:00
let paywall = document . querySelector ( 'div#subscription_paid_message, div.subscribeNow' ) ;
2022-02-19 08:12:00 +00:00
if ( paywall ) {
2022-05-15 16:25:58 +00:00
let intro = document . querySelector ( 'div.story' ) ;
removeDOMElement ( paywall , intro ) ;
let restricted _message = document . querySelector ( 'div.restricted_message' ) ;
if ( restricted _message )
restricted _message . classList . remove ( 'restricted_message' ) ;
2021-08-13 15:29:49 +00:00
let paywall _content = document . querySelector ( 'div.paywall-content.hide' ) ;
if ( paywall _content )
paywall _content . classList . remove ( 'hide' ) ;
}
2022-05-15 16:25:58 +00:00
let ads = document . querySelectorAll ( 'inside-post-ad, amp-ad' ) ;
removeDOMElement ( ... ads ) ;
2021-08-13 15:29:49 +00:00
}
2021-12-12 08:38:17 +00:00
else if ( matchDomain ( 'livemint.com' ) ) {
if ( window . location . pathname . includes ( '/amp-' ) ) {
let paywall = document . querySelectorAll ( '[amp-access="NOT subscribed"]' ) ;
removeDOMElement ( ... paywall ) ;
2022-08-18 18:02:29 +00:00
} else {
let paywall = document . querySelector ( 'div.paywall' ) ;
if ( paywall )
paywall . classList . remove ( 'paywall' ) ;
let ads = document . querySelectorAll ( '[class^="ad"], [id^="ad"], #subscribeAd, .taboolaHeight' ) ;
removeDOMElement ( ... ads ) ;
2021-12-12 08:38:17 +00:00
}
}
2021-04-10 06:46:50 +00: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 17:13:24 +00:00
}
2021-01-24 09:25:55 +00:00
else if ( matchDomain ( 'marketwatch.com' ) ) {
2021-04-10 06:46:50 +00: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' ) ;
2021-11-30 16:36:15 +00:00
removeDOMElement ( meter , container _sponsored ) ;
amp _unhide _subscr _section ( '.display-ad' ) ;
2021-04-10 06:46:50 +00:00
}
let ads = document . querySelectorAll ( 'div.element--ad, div.j-ad' ) ;
removeDOMElement ( ... ads ) ;
}
2022-10-08 07:12:12 +00:00
else if ( matchDomain ( 'medscape.com' ) ) {
let ads = document . querySelectorAll ( '.AdUnit, [id^="ads-"]' ) ;
removeDOMElement ( ... ads ) ;
}
2022-03-16 17:48:58 +00:00
else if ( matchDomain ( 'mid-day.com' ) ) {
if ( window . location . pathname . startsWith ( '/amp/' ) ) {
amp _unhide _access _hide ( '="granted"' , '="NOT granted"' , 'amp-ad, amp-embed, [class*="BannerAd"]' ) ;
} else {
let paywall = document . querySelector ( 'div#widget-_csc' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
} else {
let read _more = document . querySelector ( '#read-more-my' ) ;
if ( read _more )
read _more . click ( ) ;
}
}
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'nationalgeographic.com' ) ) {
2021-06-30 16:20:20 +00: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 06:43:45 +00:00
subscribed . appendChild ( archiveLink ( url ) ) ;
2021-06-30 16:20:20 +00:00
subscribed . setAttribute ( 'style' , 'overflow: visible !important;' ) ;
if ( overlay )
overlay . classList . remove ( 'Article__Content__Overlay--gated' ) ;
2021-04-10 06:46:50 +00:00
}
2022-01-01 18:01:19 +00:00
let ads = document . querySelectorAll ( 'div.ad-slot' ) ;
removeDOMElement ( ... ads ) ;
2021-01-26 20:27:43 +00:00
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'nationalreview.com' ) ) {
2022-09-04 07:13:36 +00:00
if ( ! window . location . pathname . endsWith ( '/amp/' ) ) {
let paywall = document . querySelector ( 'div.continue-reading' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
2021-04-10 06:46:50 +00:00
}
2021-10-13 15:59:18 +00:00
}
2022-01-09 16:28:17 +00:00
let adverts = document . querySelectorAll ( 'amp-ad, .ad-unit--center, amp-connatix-player' ) ;
2021-10-13 15:59:18 +00:00
removeDOMElement ( ... adverts ) ;
2021-01-28 16:34:00 +00:00
}
2022-06-24 18:57:28 +00:00
else if ( matchDomain ( 'nautil.us' ) ) {
// plus code in contentScript_once.js
let hidden _images = document . querySelectorAll ( 'img[src^="data:image"][data-src]' ) ;
for ( let hidden _image of hidden _images )
hidden _image . src = hidden _image . getAttribute ( 'data-src' ) ;
let empty _video _iframes = document . querySelectorAll ( 'iframe[src="about:blank"][data-litespeed-src]' ) ;
for ( let empty _video _iframe of empty _video _iframes )
empty _video _iframe . src = empty _video _iframe . getAttribute ( 'data-litespeed-src' ) ;
window . setTimeout ( function ( ) {
let banners = document . querySelectorAll ( 'div[class^="a__sc-np"], div.subscibe-bar' ) ;
removeDOMElement ( ... banners ) ;
let overflows = document . querySelectorAll ( 'html[style], body[style]' ) ;
for ( let overflow of overflows )
overflow . removeAttribute ( 'style' ) ;
} , 1000 ) ;
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'newleftreview.org' ) ) {
2021-07-07 16:30:24 +00:00
window . setTimeout ( function ( ) {
let url = window . location . href ;
let paywall = document . querySelector ( 'div.promo-wrapper' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
2022-04-09 15:07:30 +00:00
csDoneOnce = true ;
2022-08-02 15:26:56 +00:00
let url _cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url . split ( '?' ) [ 0 ] ;
2021-12-24 07:32:45 +00:00
replaceDomElementExt ( url _cache , true , false , 'div.article-page' ) ;
2021-07-07 16:30:24 +00:00
}
2022-03-08 18:04:50 +00:00
} , 500 ) ;
2021-04-10 06:46:50 +00:00
}
2021-09-29 18:43:21 +00:00
else if ( matchDomain ( 'newrepublic.com' ) ) {
2021-11-09 16:18:34 +00:00
let pw _popups = document . querySelector ( 'div#pwPopups' ) ;
let ads = document . querySelectorAll ( '.ad-unit, .ad-container' ) ;
removeDOMElement ( pw _popups , ... ads ) ;
2021-09-29 18:43:21 +00:00
}
2022-08-24 18:28:54 +00:00
else if ( matchDomain ( 'newscientist.com' ) ) {
let url = window . location . href ;
let paywall = document . querySelector ( '#subscription-barrier' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
csDoneOnce = true ;
let url _cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url . split ( '?' ) [ 0 ] ;
replaceDomElementExt ( url _cache , true , false , 'div.article-body' ) ;
}
window . setTimeout ( function ( ) {
let lazy _images = document . querySelectorAll ( 'img.lazyload[data-src]:not([src]' ) ;
for ( let elem of lazy _images )
elem . src = elem . getAttribute ( 'data-src' ) . split ( '?' ) [ 0 ] + '?width=800' ;
} , 1000 ) ;
}
2021-12-11 18:12:13 +00:00
else if ( matchDomain ( 'newsday.com' ) ) {
if ( window . location . pathname . startsWith ( '/amp/' ) ) {
amp _unhide _access _hide ( '="AccessLevel = \'Full Content Access\' OR Error = true"' , '="AccessLevel = \'Page View Limit\'"' ) ;
}
}
2021-12-08 16:45:19 +00:00
else if ( matchDomain ( [ 'nola.com' , 'theadvocate.com' ] ) ) {
if ( window . location . pathname . endsWith ( '.amp.html' ) ) {
let body _hidden = document . querySelector ( '.site-container' ) ;
if ( body _hidden )
body _hidden . setAttribute ( 'style' , 'display:block;' ) ;
}
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'nybooks.com' ) ) {
let paywall _article = document . querySelector ( '.paywall-article' ) ;
if ( paywall _article )
paywall _article . classList . remove ( 'paywall-article' ) ;
2022-05-23 17:31:36 +00:00
let banner = document . querySelector ( 'div.toast-cta, div.inline-ad' ) ;
2021-04-10 06:46:50 +00:00
removeDOMElement ( banner ) ;
}
else if ( matchDomain ( 'nytimes.com' ) ) {
2022-08-25 19:28:05 +00:00
let banners = document . querySelectorAll ( 'div[data-testid="inline-message"], div[id^="ad-"], div.expanded-dock' ) ;
removeDOMElement ( ... banners ) ;
2021-01-30 11:55:39 +00:00
}
2022-04-18 18:35:24 +00:00
else if ( matchDomain ( 'nzherald.co.nz' ) ) {
// plus code in contentScript_once.js
let article _content = document . querySelector ( '.article__content' ) ;
if ( article _content ) {
let premium = document . querySelector ( 'span.ellipsis' ) ;
if ( premium && dompurify _loaded ) {
premium . classList . remove ( 'ellipsis' ) ;
let article _offer = document . querySelector ( '.article-offer' ) ;
removeDOMElement ( article _offer ) ;
let css _selector = article _content . querySelectorAll ( 'p[style]' ) [ 1 ] . getAttribute ( 'class' ) ;
let hidden _not _pars = article _content . querySelectorAll ( '.' + css _selector + ':not(p)' ) ;
for ( let hidden _not _par of hidden _not _pars ) {
hidden _not _par . classList . remove ( css _selector ) ;
hidden _not _par . removeAttribute ( 'style' ) ;
}
let hidden _pars = article _content . querySelectorAll ( 'p.' + css _selector ) ;
let par _html , par _dom ;
let parser = new DOMParser ( ) ;
for ( let hidden _par of hidden _pars ) {
2022-07-03 15:52:41 +00:00
let par _html = parser . parseFromString ( '<div style="margin: 10px 0px; font-size: 17px; line-height: 1.6">' + DOMPurify . sanitize ( hidden _par . innerHTML ) + '</div>' , 'text/html' ) ;
2022-04-18 18:35:24 +00: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 ) ;
}
2022-07-08 06:10:35 +00:00
else if ( matchDomain ( 'outlookbusiness.com' ) ) {
let paywall = document . querySelector ( 'div#csc-paywall' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let json _script = document . querySelector ( 'script#__NEXT_DATA__' ) ;
if ( json _script && dompurify _loaded ) {
let json = JSON . parse ( json _script . innerText ) ;
if ( json && json . props . initialState . dashboard . ARTICLE _POST _DETAIL _API . data . article _data . description ) {
let article _new = json . props . initialState . dashboard . ARTICLE _POST _DETAIL _API . data . article _data . description ;
let article = document . querySelector ( 'div.story-content' ) ;
if ( article ) {
article . innerHTML = '' ;
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( article _new ) + '</div>' , 'text/html' ) ;
let content _new = doc . querySelector ( 'div' ) ;
article . appendChild ( content _new ) ;
}
}
}
}
}
2022-04-18 06:14:17 +00:00
else if ( matchDomain ( 'outlookindia.com' ) ) {
let paywall = document . querySelector ( 'div.paywall' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let json _script = getArticleJsonScript ( ) ;
if ( json _script ) {
let json = JSON . parse ( json _script . text ) ;
if ( json ) {
let json _text = parseHtmlEntities ( json . articleBody ) . replace ( /\n/g , "$&\r\n" ) ;
let content = document . querySelector ( 'div#articleBody' ) ;
if ( json _text && content ) {
content . innerHTML = '' ;
let article _new = document . createElement ( 'p' ) ;
article _new . innerText = json _text ;
content . appendChild ( article _new ) ;
}
}
}
}
}
2022-04-30 09:25:42 +00:00
else if ( matchDomain ( 'puck.news' ) ) {
let paywall = document . querySelector ( '.paywall' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let overlay = document . querySelector ( 'body.paywall-active' ) ;
if ( overlay )
overlay . classList . remove ( 'paywall-active' ) ;
let article _style = document . querySelector ( 'article[style]' ) ;
if ( article _style )
article _style . removeAttribute ( 'style' ) ;
}
}
2021-11-13 10:57:46 +00:00
else if ( matchDomain ( 'quora.com' ) ) {
2022-02-03 18:11:51 +00:00
let overlays = document . querySelectorAll ( 'div[class*="_overlay"]' ) ;
removeDOMElement ( ... overlays ) ;
2021-11-13 10:57:46 +00:00
let mask _image = document . querySelector ( 'div.ePDXbR' ) ;
if ( mask _image )
mask _image . classList . remove ( 'ePDXbR' ) ;
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'qz.com' ) ) {
2022-05-30 15:10:35 +00:00
if ( window . location . pathname . startsWith ( '/emails/' ) ) {
let paywall = document . querySelector ( 'div#email-content[class]' ) ;
if ( paywall ) {
paywall . removeAttribute ( 'class' ) ;
let login = pageContains ( 'h2[class]' , /^This story is exclusive to/ ) ;
removeDOMElement ( login [ 0 ] . parentElement ) ;
let noscroll = document . querySelector ( 'iframe[scrolling]' ) ;
if ( noscroll )
noscroll . removeAttribute ( 'scrolling' ) ;
}
2021-06-29 19:13:53 +00:00
}
2021-01-30 18:18:00 +00:00
}
2022-03-06 16:43:38 +00:00
else if ( matchDomain ( 'rugbypass.com' ) ) {
if ( window . location . pathname . startsWith ( '/plus/' ) ) {
let paywall = document . querySelector ( '.premium-fold-bottom' ) ;
if ( paywall ) {
paywall . classList . remove ( 'premium-fold-bottom' ) ;
let offer = document . querySelector ( '.plus-article-offer' ) ;
removeDOMElement ( offer ) ;
let fade = document . querySelector ( '.fade' ) ;
if ( fade )
fade . classList . remove ( 'fade' ) ;
}
} else
csDoneOnce = true ;
2022-03-05 09:39:41 +00:00
}
2022-01-02 18:21:05 +00:00
else if ( matchDomain ( 'science.org' ) ) {
let paywall = document . querySelector ( 'div.alert-read-limit' ) ;
removeDOMElement ( paywall ) ;
let overlay = document . querySelector ( 'body.alert-read-limit__overlay' ) ;
if ( overlay )
overlay . classList . remove ( 'alert-read-limit__overlay' ) ;
}
2022-03-15 17:34:21 +00:00
else if ( matchDomain ( 'scmp.com' ) ) {
if ( window . location . href . includes ( '/amp.' ) ) {
let div _hidden = document . querySelectorAll ( 'div.article-body[amp-access][amp-access-hide]' ) ;
for ( let elem of div _hidden )
elem . removeAttribute ( 'amp-access-hide' ) ;
let default _meters = document . querySelectorAll ( 'div.default-meter, div#archive-article-meter' ) ;
let adverts = document . querySelectorAll ( 'amp-ad, div.ad-banner, div.advert-fly-carpet-container, div.inline-advert' ) ;
removeDOMElement ( ... default _meters , ... adverts ) ;
} else
csDoneOnce = true ;
2021-05-10 16:12:59 +00:00
}
2021-04-10 06:46:50 +00: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/' ) ;
2022-03-08 18:04:50 +00:00
} , 500 ) ;
2021-04-10 06:46:50 +00:00
} else if ( url . includes ( '/amp/' ) ) {
2021-11-30 16:36:15 +00:00
amp _unhide _access _hide ( '*="premium_access OR"' , '' , '.ad-wrap' ) ;
2021-04-10 06:46:50 +00:00
let paywall = document . querySelector ( '[class*="paywall-container"]' ) ;
2021-11-30 16:36:15 +00:00
removeDOMElement ( paywall ) ;
2021-04-10 06:46:50 +00:00
}
2021-02-05 13:57:27 +00:00
}
2021-04-10 06:46:50 +00: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 16:46:39 +00:00
}
2022-05-27 13:11:37 +00:00
else if ( matchDomain ( 'slideshare.net' ) ) {
let limit _overlay = document . querySelector ( '.limit-overlay' ) ;
if ( limit _overlay )
limit _overlay . classList . remove ( 'limit-overlay' ) ;
}
2022-01-23 09:13:35 +00:00
else if ( matchDomain ( 'sloanreview.mit.edu' ) ) {
let paywall = document . querySelector ( 'div.paywall-blinder' ) ;
removeDOMElement ( paywall ) ;
if ( paywall ) {
ext _api . runtime . sendMessage ( { request : 'refreshCurrentTab' } ) ;
csDoneOnce = true ;
}
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'sofrep.com' ) ) {
2022-07-07 17:12:31 +00:00
if ( ! window . location . pathname . startsWith ( '/amp/' ) ) {
let paywall = document . querySelector ( 'div.fader' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
}
2021-04-10 06:46:50 +00:00
let banners = document . querySelectorAll ( '#scrollerCTA, #botCta' ) ;
removeDOMElement ( ... banners ) ;
2021-02-13 17:11:58 +00:00
}
2022-03-27 16:25:09 +00:00
else if ( matchDomain ( 'spglobal.com' ) ) {
let overlay = document . querySelector ( '.article__overlay' ) ;
removeDOMElement ( overlay ) ;
let html _noscroll = document . querySelector ( 'html[class]' ) ;
if ( html _noscroll )
html _noscroll . removeAttribute ( 'class' ) ;
}
2021-05-27 18:22:45 +00:00
else if ( matchDomain ( 'staradvertiser.com' ) ) {
let url = window . location . href . split ( '?' ) [ 0 ] ;
if ( url . endsWith ( '/amp/' ) ) {
2021-11-30 16:36:15 +00:00
amp _unhide _subscr _section ( ) ;
2021-05-27 18:22:45 +00:00
} 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 06:46:50 +00:00
else if ( matchDomain ( 'startribune.com' ) ) {
2022-01-13 16:26:17 +00:00
let ads = document . querySelectorAll ( 'div.ad-placeholder' ) ;
removeDOMElement ( ... ads ) ;
2021-02-18 18:47:12 +00:00
}
2021-04-10 06:46:50 +00: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 13:20:30 +00:00
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'stratfor.com' ) ) {
2021-09-28 18:42:02 +00:00
let banner = document . querySelector ( '.free-cta-container, .paywall-banner' ) ;
2021-04-10 06:46:50 +00: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 17:05:57 +00: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]|-)+)$/ ) ) {
2022-03-15 17:34:21 +00:00
let json _script = document . querySelector ( 'script#__NEXT_DATA__' ) ;
2021-10-25 17:05:57 +00:00
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 16:29:26 +00: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 17:05:57 +00: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 06:46:50 +00:00
}
2022-07-19 19:26:00 +00:00
else if ( matchDomain ( 'studocu.com' ) ) {
window . setTimeout ( function ( ) {
let paywall = document . querySelector ( 'div._de9e5fdb76af' ) ;
if ( paywall ) {
let banners = document . querySelectorAll ( 'div._d18a99c0d544, div#premium-page-header' ) ;
removeDOMElement ( paywall , ... banners ) ;
let blurred _pages = document . querySelectorAll ( 'div.page-content[style*="filter: blur"]' ) ;
for ( let blurred _page of blurred _pages ) {
let page = document . createElement ( 'span' ) ;
page . setAttribute ( 'class' , 'page-content' ) ;
page . appendChild ( blurred _page . firstChild ) ;
blurred _page . parentNode . replaceChild ( page , blurred _page ) ;
}
}
} , 1000 ) ;
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'techinasia.com' ) ) {
let paywall = document . querySelector ( '.paywall-content' ) ;
2021-10-22 10:36:47 +00:00
if ( paywall && dompurify _loaded ) {
2021-04-10 06:46:50 +00:00
paywall . classList . remove ( 'paywall-content' ) ;
2021-05-02 14:14:45 +00:00
let url = window . location . href ;
2021-10-15 14:06:02 +00:00
let url _xhr = url . replace ( '.com/' , '.com/wp-json/techinasia/2.0/posts/' ) . replace ( '/visual-story/' , '/' ) ;
2021-05-02 14:14:45 +00:00
fetch ( url _xhr )
. then ( response => {
if ( response . ok ) {
response . json ( ) . then ( json => {
let json _text = json . posts [ 0 ] . content ;
2021-05-27 18:22:45 +00:00
json _text = json _text . replace ( /width\=\"(\d){3,}\"/g , 'width="100%"' ) . replace ( /height\=\"(\d){3,}\"/g , 'height="100%"' ) ;
2021-05-02 14:14:45 +00:00
let content = document . querySelector ( 'div.content' ) ;
if ( json _text && content ) {
let parser = new DOMParser ( ) ;
2021-06-29 17:59:15 +00:00
let doc = parser . parseFromString ( '<div class="jsx-1794864983 content">' + DOMPurify . sanitize ( json _text ) + '</div>' , 'text/html' ) ;
2021-05-02 14:14:45 +00:00
let content _new = doc . querySelector ( 'div.content' ) ;
content . parentNode . replaceChild ( content _new , content ) ;
}
} ) ;
}
} ) ;
}
2021-04-10 06:46:50 +00:00
let splash _subscribe = document . querySelector ( '.splash-subscribe' ) ;
let paywall _hard = document . querySelector ( '.paywall-hard' ) ;
removeDOMElement ( splash _subscribe , paywall _hard ) ;
}
else if ( matchDomain ( 'the-american-interest.com' ) ) {
let counter = document . getElementById ( 'article-counter' ) ;
removeDOMElement ( counter ) ;
2021-03-01 17:04:43 +00:00
}
2022-06-30 18:26:07 +00:00
else if ( matchDomain ( 'theathletic.com' ) ) {
if ( ! window . location . search . match ( /(\?|&)amp/ ) ) {
2022-10-21 06:03:16 +00:00
let paywall = document . querySelector ( 'div#slideup-paywall' ) ;
if ( paywall ) {
let overlays = document . querySelectorAll ( 'div[id*="overlay"], div:empty:not([data-rjs])' ) ;
removeDOMElement ( paywall , ... overlays ) ;
let body = document . querySelector ( 'body' ) ;
if ( body ) {
body . style . overflow = 'visible' ;
body . style . position = 'relative' ;
}
} else {
let headline _paywall = document . querySelectorAll ( 'a.headline-paywall' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( headline _paywall . length && amphtml ) {
removeDOMElement ( ... headline _paywall ) ;
window . setTimeout ( function ( ) {
window . location . href = amphtml . href ;
} , 1000 ) ;
}
2022-06-30 18:26:07 +00:00
}
} else {
amp _unhide _subscr _section ( ) ;
2022-08-02 21:39:41 +00:00
amp _unhide _access _hide ( '' , '*="NOT granted"' ) ;
2022-06-30 18:26:07 +00:00
}
2022-08-04 10:38:00 +00:00
let apron = document . querySelector ( 'div#free-apron-cta, div.slideup-free-apron-container' ) ;
2022-09-17 06:30:01 +00:00
let ads = document . querySelectorAll ( 'div.ad-container' ) ;
removeDOMElement ( apron , ... ads ) ;
2022-06-30 18:26:07 +00:00
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'theatlantic.com' ) ) {
let banner = document . querySelector ( '.c-nudge__container,.c-non-metered-nudge' ) ;
removeDOMElement ( banner ) ;
2021-03-07 13:03:22 +00:00
}
2021-08-13 13:29:59 +00: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 07:03:09 +00: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 13:29:59 +00:00
}
2021-08-19 07:03:09 +00:00
}
2021-08-13 13:29:59 +00:00
}
}
2021-08-19 07:03:09 +00:00
csDoneOnce = true ;
} catch ( err ) {
console . log ( err ) ;
2021-08-13 13:29:59 +00:00
}
}
}
}
2021-04-14 16:43:07 +00:00
else if ( matchDomain ( 'thediplomat.com' ) ) {
let preview = document . querySelector ( '.dpl-preview' ) ;
if ( preview )
preview . classList . remove ( 'dpl-preview' ) ;
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'theglobeandmail.com' ) ) {
2022-10-15 09:08:46 +00:00
let paywall = document . querySelector ( 'div.c-paywall' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let url = window . location . href . split ( '?' ) [ 0 ] ;
window . location . href = url + '?rel=premium' ;
} else {
let article _body _subscribed = document . querySelector ( '.c-article-body--subscribed' ) ;
if ( article _body _subscribed )
article _body _subscribed . removeAttribute ( 'class' ) ;
let lazy _images = document . querySelectorAll ( 'img[src^="data:image/"][data-src]' ) ;
for ( let elem of lazy _images )
elem . src = elem . getAttribute ( 'data-src' ) ;
}
2022-05-17 18:30:08 +00:00
let banners = document . querySelectorAll ( 'div.c-ad, div#subscription-pencil-area, div.marketing-container-wrapper' ) ;
2022-10-19 19:28:47 +00:00
hideDOMElement ( ... banners ) ;
2021-04-10 06:46:50 +00:00
}
else if ( matchDomain ( [ 'thehindu.com' , 'thehindubusinessline.com' ] ) ) {
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 14:58:27 +00:00
}
2022-06-26 08:48:33 +00:00
else if ( matchDomain ( 'theinitium.com' ) ) {
let paywall = document . querySelector ( 'section.c-wall' ) ;
removeDOMElement ( paywall ) ;
}
2022-05-19 05:56:10 +00:00
else if ( matchDomain ( 'thelawyersdaily.ca' ) ) {
2022-08-26 17:50:25 +00:00
if ( window . location . pathname . startsWith ( '/amp/' ) ) {
ampToHtml ( ) ;
} else {
let modal = document . querySelectorAll ( '#NewsletterModal, .modal-backdrop' ) ;
removeDOMElement ( ... modal ) ;
}
2022-05-19 05:56:10 +00:00
}
2021-04-28 07:14:47 +00: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 06:46:50 +00:00
else if ( matchDomain ( 'thepointmag.com' ) ) {
let overlay = document . querySelectorAll ( 'div.overlay, div#tpopup-' ) ;
for ( let elem of overlay )
removeDOMElement ( elem ) ;
2021-03-16 17:10:55 +00:00
}
2021-06-12 16:19:48 +00:00
else if ( matchDomain ( 'thewrap.com' ) ) {
let paywall = document . querySelector ( '.wrappro-paywall' ) ;
if ( paywall )
paywall . classList . remove ( 'wrappro-paywall' ) ;
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'time.com' ) ) {
let body = document . querySelector ( 'body' ) ;
if ( body )
body . setAttribute ( 'style' , 'position:relative !important;' ) ;
2021-03-16 17:10:55 +00:00
}
2021-04-10 06:46:50 +00: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 16:20:00 +00: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 16:16:30 +00:00
}
2021-07-23 15:47:39 +00:00
else if ( matchDomain ( timesofindia _domains ) ) {
2022-06-27 06:10:50 +00:00
let url = window . location . href ;
2021-07-23 15:47:39 +00:00
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-12-21 16:38:17 +00:00
if ( window . location . pathname . includes ( '/amp_' ) ) {
let paywall = document . querySelector ( 'div.paywall' ) ;
if ( paywall && dompurify _loaded ) {
let contentblocker = document . querySelector ( 'div#contentblocker' ) ;
2022-05-20 14:31:40 +00:00
let bottom _banner = document . querySelector ( '#bottom_banner' ) ;
removeDOMElement ( contentblocker , bottom _banner ) ;
2021-12-21 16:38:17 +00:00
let preview = document . querySelector ( 'div.article-txt' ) ;
if ( preview ) {
let parser = new DOMParser ( ) ;
2022-05-20 14:31:40 +00:00
let doc = parser . parseFromString ( '<div style="margin: 0px 50px;">' + DOMPurify . sanitize ( paywall . innerHTML , { ADD _TAGS : [ 'amp-img' ] } ) + '</div>' , 'text/html' ) ;
2021-12-21 16:38:17 +00:00
let article = doc . querySelector ( 'div' ) ;
preview . parentNode . replaceChild ( article , preview ) ;
preview . classList . remove ( 'prime-bottom-blur' ) ;
}
}
let amp _images = document . querySelectorAll ( 'div.inline-imgecontent > amp-img' ) ;
for ( let amp _img of amp _images ) {
let img _new = document . createElement ( 'img' ) ;
img _new . src = amp _img . getAttribute ( 'src' ) ;
amp _img . parentNode . replaceChild ( img _new , amp _img ) ;
img _new . parentElement . classList . remove ( 'inline-imgecontent' ) ;
img _new . parentElement . style = 'text-align: center;' ;
}
2022-05-20 14:31:40 +00:00
} else {
let paywall = document . querySelector ( 'div#story-blocker' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
2022-06-27 06:10:50 +00:00
if ( ! amphtml )
amphtml = { href : url . replace ( '/timesofindia.indiatimes.com/' , '/m.timesofindia.com/' ) . replace ( '/articleshow/' , '/amp_articleshow/' ) } ;
2022-05-20 14:31:40 +00:00
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
2021-12-21 16:38:17 +00:00
}
2021-07-23 15:47:39 +00:00
}
2022-10-24 17:07:37 +00:00
else if ( matchDomain ( 'tradewindsnews.com' ) ) {
if ( window . location . pathname . startsWith ( '/markets/' ) ) {
2021-07-11 09:21:13 +00: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' ) ;
}
}
2022-02-10 17:18:04 +00:00
else if ( matchDomain ( usa _conde _nast _domains ) ) {
if ( window . location . pathname . endsWith ( '/amp' ) ) {
amp _unhide _subscr _section ( 'amp-ad, amp-embed, .ad' ) ;
} else {
let paywall _bar = document . querySelector ( '.paywall-bar' ) ;
removeDOMElement ( paywall _bar ) ;
}
}
2021-08-17 20:45:11 +00:00
else if ( matchDomain ( usa _craincomm _domains ) ) {
2021-06-20 18:32:12 +00:00
let body _hidden = document . querySelector ( 'body[class]' ) ;
if ( body _hidden )
body _hidden . removeAttribute ( 'class' ) ;
2021-08-23 18:50:54 +00: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 18:32:12 +00:00
}
2022-07-31 06:59:34 +00:00
else if ( matchDomain ( usa _genomeweb _domains ) ) {
let banners = document . querySelectorAll ( 'div.footer__ads-footer' ) ;
removeDOMElement ( ... banners ) ;
}
2022-01-28 15:05:29 +00:00
else if ( matchDomain ( usa _outside _mag _domains ) ) {
let paywall = document . querySelector ( 'div.o-membership-overlay' ) ;
if ( paywall ) {
let is _gated = document . querySelectorAll ( '[class*="is-gated"]' ) ;
for ( let elem of is _gated )
removeClassesByPrefix ( elem , 'is-gated' ) ;
removeDOMElement ( paywall ) ;
}
2022-02-25 17:11:31 +00:00
if ( matchDomain ( 'cyclingtips.com' ) ) {
2022-08-13 05:51:42 +00:00
localStorage . removeItem ( 'av' ) ;
2022-02-25 17:11:31 +00:00
let ads = document . querySelectorAll ( 'div[data-block-name="ads"], div#takeover' ) ;
removeDOMElement ( ... ads ) ;
}
2022-01-28 15:05:29 +00:00
}
2021-06-20 18:32:12 +00:00
else if ( matchDomain ( usa _tribune _domains ) ) {
let overlay = document . querySelector ( 'div#zephr-overlay' ) ;
removeDOMElement ( overlay ) ;
}
2021-05-06 17:50:12 +00:00
else if ( matchDomain ( 'usatoday.com' ) ) {
2021-12-09 16:47:00 +00:00
if ( window . location . hostname . startsWith ( 'amp.' ) ) {
amp _unhide _access _hide ( '="gup.hasAssetAccess"' , '' , 'div[class*="ad-"]' ) ;
} else {
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-05-06 17:50:12 +00:00
}
}
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'venturebeat.com' ) ) {
window . setTimeout ( function ( ) {
let paywall = document . querySelector ( 'div.paywall' ) ;
if ( paywall )
paywall . classList . remove ( 'paywall' ) ;
2022-03-08 18:04:50 +00:00
} , 500 ) ;
2021-04-10 06:46:50 +00:00
}
2022-04-18 17:42:16 +00:00
else if ( matchDomain ( 'voguebusiness.com' ) ) {
if ( window . location . pathname . endsWith ( '/amp' ) ) {
amp _unhide _subscr _section ( ) ;
} else {
let paywall = document . querySelector ( 'div[class*="PaywallInlineBarrier"]' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
}
}
2021-04-10 06:46:50 +00:00
else if ( matchDomain ( 'washingtonpost.com' ) ) {
2022-03-15 17:34:21 +00:00
let leaderboard = document . querySelector ( '#leaderboard-wrapper' ) ;
let adverts = document . querySelectorAll ( 'div[data-qa$="-ad"]' ) ;
removeDOMElement ( leaderboard , ... adverts ) ;
2021-04-05 17:56:50 +00:00
}
2022-03-19 16:24:47 +00:00
else if ( matchDomain ( 'winnipegfreepress.com' ) ) {
let ads = document . querySelectorAll ( '.billboard-ad-space, .ad, .article-ad, .fixed-sky' ) ;
removeDOMElement ( ... ads ) ;
}
2021-10-06 06:46:58 +00:00
else if ( matchDomain ( 'wsj.com' ) ) {
2021-08-01 08:30:10 +00:00
let url = window . location . href ;
2021-04-10 06:46:50 +00:00
if ( location . href . includes ( '/articles/' ) ) {
let close _button = document . querySelector ( 'div.close-btn[role="button"]' ) ;
if ( close _button )
close _button . click ( ) ;
}
2022-04-01 14:04:06 +00:00
let wsj _ads = document . querySelectorAll ( 'div[class*="wsj-ad"], div[class*="BodyAdWrapper"]' ) ;
2021-04-10 06:46:50 +00:00
removeDOMElement ( ... wsj _ads ) ;
2021-08-01 08:30:10 +00: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-11-30 16:36:15 +00:00
amp _unhide _subscr _section ( ) ;
2021-08-01 08:30:10 +00:00
} else {
2022-07-06 18:03:33 +00:00
let snippet = document . querySelector ( '.snippet-promotion, div#cx-snippet-overlay' ) ;
2021-11-02 18:00:40 +00:00
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 08:30:10 +00:00
}
2021-04-07 20:24:53 +00:00
}
2022-07-31 08:43:57 +00:00
else if ( ( domain = matchDomain ( usa _lee _ent _domains ) ) || document . querySelector ( 'a[href^="https://bloxcms.com"][title^="BLOX"]' ) ) {
2022-04-06 15:17:13 +00:00
if ( window . location . pathname . endsWith ( '.amp.html' ) ) {
2022-07-31 08:43:57 +00:00
amp _unhide _access _hide ( '="hasAccess"' , '="NOT hasAccess"' , 'amp-ad, amp-embed, .amp-ads-container' ) ;
2022-04-06 15:17:13 +00:00
let elem _hidden = document . querySelectorAll ( 'html[class], body[class]' ) ;
for ( let elem of elem _hidden )
elem . removeAttribute ( 'class' ) ;
2022-07-31 08:43:57 +00:00
} else if ( ! domain ) {
2022-09-08 05:46:32 +00:00
let subscriber _only = document . querySelectorAll ( 'div.subscriber-only' ) ;
for ( let elem of subscriber _only ) {
2022-07-31 08:43:57 +00:00
elem . removeAttribute ( 'style' ) ;
2022-09-08 05:46:32 +00:00
elem . removeAttribute ( 'class' ) ;
}
2022-09-15 10:17:16 +00:00
let banners = document . querySelectorAll ( 'div.subscription-required, div.redacted-overlay, div.tnt-ads-container' ) ;
removeDOMElement ( ... banners ) ;
2022-04-06 15:17:13 +00:00
}
2021-12-12 08:38:17 +00:00
}
2022-07-26 16:20:19 +00:00
else if ( ( domain = matchDomain ( usa _mcc _domains ) ) ||
( window . location . hostname . startsWith ( 'account.' ) && document . querySelector ( 'script[src*=".mcclatchyinteractive.com/"]' ) ) ||
( window . location . href . match ( /\/\/amp\..+\.com\/(.+\/)?article(\d){8,}\.html/ ) && document . querySelector ( 'a[href^="https://classifieds.mcclatchy.com/"]' ) ) ) {
2021-04-10 06:46:50 +00:00
if ( ! domain )
domain = document . domain . replace ( /(account|amp)\./ , '' ) ;
let url = window . location . href ;
if ( url . includes ( 'account.' + domain + '/paywall/' ) ) {
window . setTimeout ( function ( ) {
2022-01-13 20:03:56 +00:00
window . location . href = 'https://amp.' + domain + '/article' + url . split ( 'resume=' ) [ 1 ] . split ( /[#&]/ ) [ 0 ] + '.html' ;
2022-03-08 18:04:50 +00:00
} , 500 ) ;
2021-04-10 06:46:50 +00:00
} else if ( url . includes ( 'amp.' + domain + '/' ) ) {
2021-11-30 16:36:15 +00:00
amp _unhide _subscr _section ( ) ;
2021-04-10 06:46:50 +00: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 10:53:38 +00:00
}
2022-03-30 16:22:36 +00:00
else if ( 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/"]' ) ) ) {
if ( window . location . pathname . endsWith ( '/amp/' ) ) {
2021-11-30 16:36:15 +00:00
amp _unhide _subscr _section ( 'amp-ad, amp-embed' ) ;
2021-08-16 20:49:58 +00:00
}
}
2021-04-10 06:46:50 +00:00
else
csDone = true ;
}
2021-10-17 19:15:00 +00:00
if ( ( csDone && ( bg2csData !== undefined ) ) || csDoneOnce ) {
2021-04-25 11:45:36 +00:00
addDivBpcDone ( ) ;
2021-10-17 19:15:00 +00:00
if ( csDone && ( bg2csData !== undefined ) && ! bg2csData . amp _unhide )
2021-07-04 06:43:45 +00:00
ext _api . runtime . sendMessage ( { csDone : true } ) ;
2021-04-25 11:45:36 +00:00
}
2020-12-04 15:14:23 +00:00
2021-04-07 20:24:53 +00:00
} // end div_bpc_done
2020-01-28 22:06:25 +00:00
// General Functions
2019-11-23 04:53:56 +00:00
function removeDOMElement ( ... elements ) {
2021-04-10 06:46:50 +00:00
for ( let element of elements ) {
if ( element )
element . remove ( ) ;
}
2019-10-06 17:28:18 +00:00
}
2019-10-08 15:41:09 +00:00
2022-10-19 19:28:47 +00:00
function hideDOMElement ( ... elements ) {
for ( let element of elements ) {
if ( element )
element . style = 'display:none !important;' ;
}
}
2021-04-07 20:24:53 +00:00
function waitDOMElement ( selector , tagName = '' , callback , multiple = false ) {
2021-04-10 06:46:50 +00: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 20:24:53 +00:00
}
2021-04-10 06:46:50 +00:00
}
}
} ) . observe ( document , {
subtree : true ,
childList : true
} ) ;
2021-04-07 20:24:53 +00:00
}
2021-07-10 17:02:46 +00:00
function waitDOMAttribute ( selector , tagName = '' , attributeName = '' , callback , multiple = false ) {
let targetNode = document . querySelector ( selector ) ;
if ( ! targetNode )
2021-12-12 08:38:17 +00:00
return ;
2021-07-10 17:02:46 +00:00
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 20:24:53 +00:00
function addDivBpcDone ( ) {
2021-04-10 06:46:50 +00: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 20:24:53 +00:00
}
2021-12-23 07:43:19 +00:00
function matchDomain ( domains , hostname = window . location . hostname ) {
2021-08-17 16:37:06 +00:00
let matched _domain = false ;
2021-04-10 06:46:50 +00:00
if ( typeof domains === 'string' )
domains = [ domains ] ;
domains . some ( domain => ( hostname === domain || hostname . endsWith ( '.' + domain ) ) && ( matched _domain = domain ) ) ;
return matched _domain ;
2020-03-27 20:13:28 +00:00
}
2022-01-19 20:24:12 +00:00
function replaceDomElementExt ( url , proxy , base64 , selector , text _fail = '' , selector _source = selector ) {
2022-04-09 15:07:30 +00:00
if ( proxy ) {
if ( ! text _fail ) {
if ( url . includes ( 'webcache.googleusercontent.com' ) )
text _fail = 'BPC > failed to load from Google webcache: '
}
ext _api . runtime . sendMessage ( { request : 'getExtSrc' , data : { url : url , selector : selector , selector _source : selector _source , base64 : base64 , text _fail : text _fail } } ) ;
} else {
fetch ( url )
. then ( response => {
let article = document . querySelector ( selector ) ;
if ( response . ok ) {
response . text ( ) . then ( html => {
replaceDomElementExtSrc ( url , html , false , base64 , selector , text _fail , selector _source ) ;
} ) ;
} else {
if ( text _fail && article ) {
replaceTextFail ( article , proxy , text _fail )
2021-04-10 06:46:50 +00:00
}
2021-12-24 07:32:45 +00:00
}
2022-04-09 15:07:30 +00:00
} ) . catch ( function ( err ) {
false ;
} ) ;
}
}
function replaceDomElementExtSrc ( url , html , proxy , base64 , selector , text _fail = '' , selector _source = selector ) {
let article = document . querySelector ( selector ) ;
if ( html ) {
if ( base64 ) {
html = decode _utf8 ( atob ( html ) ) ;
selector _source = 'body' ;
}
let parser = new DOMParser ( ) ;
window . setTimeout ( function ( ) {
2022-08-06 06:22:25 +00:00
let doc = parser . parseFromString ( DOMPurify . sanitize ( html , { ADD _ATTR : [ 'layout' , 'itemprop' ] , ADD _TAGS : [ 'amp-img' , 'iframe' ] } ) , 'text/html' ) ;
2022-04-09 15:07:30 +00:00
//console.log(DOMPurify.removed);
let article _new = doc . querySelector ( selector _source ) ;
if ( article _new ) {
if ( article && article . parentNode )
article . parentNode . replaceChild ( article _new , article ) ;
2021-04-10 06:46:50 +00:00
}
2022-04-09 15:07:30 +00:00
} , 200 ) ;
} else {
replaceTextFail ( url , article , proxy , text _fail ) ;
}
}
function replaceTextFail ( url , article , proxy , text _fail ) {
if ( text _fail && article ) {
let text _fail _div = document . createElement ( 'div' ) ;
text _fail _div . setAttribute ( 'style' , 'margin: 0px 50px; font-weight: bold; color: red;' ) ;
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-04-10 06:46:50 +00:00
}
2022-04-09 15:07:30 +00:00
article . insertBefore ( text _fail _div , article . firstChild ) ;
}
2021-01-11 20:00:41 +00:00
}
2022-08-26 17:50:25 +00:00
function ampToHtml ( ) {
window . setTimeout ( function ( ) {
let canonical = document . querySelector ( 'link[rel="canonical"]' ) ;
window . location . href = canonical . href ;
} , 500 ) ;
}
2022-08-05 16:32:54 +00:00
function archiveLink ( url , text _fail = 'BPC > Full article text:\r\n' ) {
2021-06-29 19:13:53 +00:00
let text _fail _div = document . createElement ( 'div' ) ;
text _fail _div . id = 'bpc_archive' ;
2021-12-24 07:32:45 +00:00
text _fail _div . setAttribute ( 'style' , 'margin: 20px; font-weight: bold; color:red;' ) ;
2022-08-05 16:32:54 +00:00
text _fail _div . appendChild ( document . createTextNode ( text _fail ) ) ;
2022-02-08 18:41:59 +00:00
function add _links ( domains ) {
for ( let domain of domains ) {
let a _link = document . createElement ( 'a' ) ;
a _link . innerText = domain ;
a _link . href = 'https://' + domain + '?run=1&url=' + url . split ( '?' ) [ 0 ] ;
a _link . target = '_blank' ;
text _fail _div . appendChild ( document . createTextNode ( ' | ' ) ) ;
text _fail _div . appendChild ( a _link ) ;
}
}
add _links ( [ 'archive.today' , 'archive.is' ] ) ;
2021-06-29 19:13:53 +00:00
return text _fail _div ;
}
2019-11-23 04:53:56 +00:00
function removeClassesByPrefix ( el , prefix ) {
2021-04-10 06:46:50 +00: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 02:19:36 +00:00
}
2019-11-11 00:37:41 +00:00
2022-10-26 06:48:51 +00:00
function removeClassesList ( list ) {
for ( let class _item of list ) {
let elems = document . querySelectorAll ( '.' + class _item ) ;
for ( let elem of elems )
elem . classList . remove ( class _item ) ;
}
}
2020-06-08 14:44:46 +00:00
function cookieExists ( name ) {
2021-04-10 06:46:50 +00:00
return document . cookie . split ( ';' ) . some ( function ( item ) {
return item . trim ( ) . indexOf ( name + '=' ) === 0
} )
2020-06-08 14:44:46 +00:00
}
function setCookie ( name , value , domain , path , days ) {
2021-08-17 16:37:06 +00:00
let max _age = days * 24 * 60 * 60 ;
2021-04-10 06:46:50 +00:00
document . cookie = name + "=" + ( value || "" ) + "; domain=" + domain + "; path=" + path + "; max-age=" + max _age ;
2020-06-08 14:44:46 +00:00
}
2020-09-12 13:40:50 +00:00
function insert _script ( func , insertAfterDom ) {
2021-04-10 06:46:50 +00: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 16:45:37 +00:00
}
2020-05-29 13:34:02 +00:00
function genHexString ( len ) {
2021-04-10 06:46:50 +00:00
let output = '' ;
for ( let i = 0 ; i < len ; i ++ )
output += ( Math . floor ( Math . random ( ) * 16 ) ) . toString ( 16 ) ;
return output ;
2020-05-29 13:34:02 +00:00
}
2020-10-04 17:08:36 +00:00
function makeRandomNumber ( len ) {
2021-04-10 06:46:50 +00:00
let result = '' ;
2021-08-17 16:37:06 +00:00
let characters = '123456789' ;
let charactersLength = characters . length ;
for ( let i = 0 ; i < len ; i ++ )
2021-04-10 06:46:50 +00:00
result += characters . charAt ( Math . floor ( Math . random ( ) * charactersLength ) ) ;
return result ;
2020-10-04 17:08:36 +00:00
}
2020-01-28 22:06:25 +00:00
function pageContains ( selector , text ) {
2021-04-10 06:46:50 +00:00
let elements = document . querySelectorAll ( selector ) ;
return Array . prototype . filter . call ( elements , function ( element ) {
return RegExp ( text ) . test ( element . textContent ) ;
} ) ;
2020-01-28 22:06:25 +00:00
}
2020-07-04 11:33:25 +00:00
2021-12-07 18:25:48 +00:00
function breakText ( str ) {
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" ) ;
// exceptions: names with alternating lower/uppercase (no general fix)
let str _rep _arr = [ 'AstraZeneca' , 'BaFin' , 'BerlHG' , 'BfArM' , 'BilMoG' , 'BioNTech' , 'DiGA' , 'EuGH' , 'FinTechRat' , 'GlaxoSmithKline' , 'IfSG' , 'medRxiv' , 'mmHg' , 'PlosOne' , 'StVO' ] ;
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 ;
} ;
2020-08-17 21:04:51 +00:00
function parseHtmlEntities ( encodedString ) {
2022-09-30 15:40:10 +00:00
let parser = new DOMParser ( ) ;
2022-10-09 18:20:19 +00:00
let doc = parser . parseFromString ( '<textarea>' + encodedString + '</textarea>' , 'text/html' ) ;
2022-09-30 15:40:10 +00:00
let dom = doc . querySelector ( 'textarea' ) ;
return dom . value ;
}
2021-02-05 18:07:38 +00:00
function encode _utf8 ( str ) {
2021-04-10 06:46:50 +00:00
return unescape ( encodeURIComponent ( str ) ) ;
2021-02-05 18:07:38 +00:00
}
function decode _utf8 ( str ) {
2021-04-10 06:46:50 +00:00
return decodeURIComponent ( escape ( str ) ) ;
2021-02-05 18:07:38 +00:00
}