2020-10-01 16:11:57 +02:00
//"use strict";
2020-09-08 16:38:18 +02:00
var ext _api = ( typeof browser === 'object' ) ? browser : chrome ;
2023-05-10 18:13:22 +02:00
var mobile = window . navigator . userAgent . toLowerCase ( ) . includes ( 'mobile' ) ;
2020-09-08 16:38:18 +02:00
var domain ;
2020-12-04 16:14:23 +01:00
var csDone = false ;
2021-07-04 08:43:45 +02:00
var csDoneOnce = false ;
2023-05-08 20:05:06 +02:00
var dompurify _loaded = ( typeof DOMPurify === 'function' ) ;
2020-09-08 16:38:18 +02:00
2023-03-29 13:03:10 +02:00
var ar _grupo _clarin _domains = [ 'clarin.com' , 'lavoz.com.ar' , 'losandes.com.ar' ] ;
var be _groupe _ipm _domains = [ 'dhnet.be' , 'lalibre.be' , 'lavenir.net' ] ;
2023-02-16 12:20:18 +01:00
var be _roularta _domains = [ 'artsenkrant.com' , 'femmesdaujourdhui.be' , 'flair.be' , 'knack.be' , 'kw.be' , 'levif.be' , 'libelle.be' ] ;
2022-07-31 08:31:05 +02:00
var ca _gcm _domains = [ 'lesoleil.com' ] . concat ( [ 'latribune.ca' , 'lavoixdelest.ca' , 'ledroit.com' , 'ledroitfranco.com' , 'lenouvelliste.ca' , 'lequotidien.com' ] ) ;
2023-07-20 22:15:51 +02:00
var ca _torstar _domains = [ 'niagarafallsreview.ca' , 'stcatharinesstandard.ca' , 'thepeterboroughexaminer.com' , 'therecord.com' , 'thespec.com' , 'thestar.com' , 'wellandtribune.ca' ] ;
2022-08-03 19:01:39 +02: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' ] ;
2023-02-25 14:20:33 +01:00
var de _lv _domains = [ 'profi.de' , 'topagrar.at' , 'topagrar.com' , 'wochenblatt.com' ] ;
2022-03-31 18:10:47 +02: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' ] ;
2023-07-20 19:10:52 +02:00
var de _mhs _custom _domains = [ 'cannstatter-zeitung.de' , 'esslinger-zeitung.de' , 'frankenpost.de' , 'insuedthueringen.de' , 'krzbb.de' , 'kurier.de' , 'np-coburg.de' , 'verlagshaus-jaumann.de' ] ;
2023-02-05 14:25:33 +01:00
var de _vrm _domains = [ 'allgemeine-zeitung.de' , 'echo-online.de' , 'wiesbadener-kurier.de' ] ;
2023-07-21 10:41:57 +02:00
var de _vrm _custom _domains = [ 'buerstaedter-zeitung.de' , 'hochheimer-zeitung.de' , 'lampertheimer-zeitung.de' , 'lauterbacher-anzeiger.de' , 'main-spitze.de' , 'mittelhessen.de' , 'oberhessische-zeitung.de' , 'wormser-zeitung.de' ] ;
2022-08-03 19:01:39 +02:00
var de _westfalen _medien _domains = [ 'muensterschezeitung.de' , 'westfalen-blatt.de' , 'wn.de' ] ;
2022-08-21 08:59:42 +02: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 18:05:49 +02: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 19:20:35 +02:00
var es _unidad _domains = [ 'elmundo.es' , 'expansion.com' , 'marca.com' ] ;
2023-02-18 09:42:27 +01: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' , 'nordlittoral.fr' , 'paris-normandie.fr' , 'sudinfo.be' ] ;
2020-12-06 22:32:59 +01:00
var fr _groupe _ebra _domains = [ 'bienpublic.com' , 'dna.fr' , 'estrepublicain.fr' , 'lalsace.fr' , 'ledauphine.com' , 'lejsl.com' , 'leprogres.fr' , 'republicain-lorrain.fr' , 'vosgesmatin.fr' ] ;
2023-07-06 19:31:32 +02:00
var fr _groupe _la _depeche _domains = [ 'centrepresseaveyron.fr' , 'ladepeche.fr' , 'lindependant.fr' , 'midilibre.fr' , 'nrpyrenees.fr' , 'petitbleu.fr' , 'rugbyrama.fr' ] ;
2021-12-31 11:50:38 +01:00
var fr _groupe _nice _matin _domains = [ 'monacomatin.mc' , 'nicematin.com' , 'varmatin.com' ] ;
2021-12-12 13:21:28 +01:00
var it _ilmessaggero _domains = [ 'corriereadriatico.it' , 'ilgazzettino.it' , 'ilmattino.it' , 'ilmessaggero.it' , 'quotidianodipuglia.it' ] ;
2022-11-11 07:39:09 +01:00
var it _gedi _domains = [ 'italian.tech' , 'lescienze.it' , 'repubblica.it' ] ;
2021-07-30 08:52:20 +02:00
var it _quotidiano _domains = [ 'ilgiorno.it' , 'ilrestodelcarlino.it' , 'iltelegrafolivorno.it' , 'lanazione.it' , 'quotidiano.net' ] ;
2022-04-28 17:52:26 +02:00
var medium _custom _domains = [ 'betterprogramming.pub' , 'towardsdatascience.com' ] ;
2021-06-20 21:41:11 +02:00
var nl _mediahuis _region _domains = [ 'gooieneemlander.nl' , 'haarlemsdagblad.nl' , 'ijmuidercourant.nl' , 'leidschdagblad.nl' , 'noordhollandsdagblad.nl' ] ;
2022-11-09 17:58:21 +01:00
var nl _dpg _adr _domains = [ 'ad.nl' , 'bd.nl' , 'bndestem.nl' , 'destentor.nl' , 'ed.nl' , 'gelderlander.nl' , 'pzc.nl' , 'tubantia.nl' ] ;
2023-03-25 09:07:05 +01:00
var nl _dpg _media _domains = [ 'demorgen.be' , 'flair.nl' , 'humo.be' , 'libelle.nl' , 'margriet.nl' , 'parool.nl' , 'trouw.nl' , 'volkskrant.nl' ] ;
2022-11-09 18:14:23 +01:00
var no _nhst _media _domains = [ 'europower-energi.no' , 'fiskeribladet.no' , 'intrafish.com' , 'intrafish.no' , 'rechargenews.com' , 'tradewindsnews.com' , 'upstreamonline.com' ] ;
2022-02-11 17:51:33 +01:00
var pe _grupo _elcomercio _domains = [ 'diariocorreo.pe' , 'elcomercio.pe' , 'gestion.pe' ] ;
2021-07-23 17:47:39 +02:00
var timesofindia _domains = [ 'timesofindia.com' , 'timesofindia.indiatimes.com' ] ;
2023-02-17 18:19:29 +01:00
var uk _nat _world _domains = [ 'scotsman.com' , 'yorkshirepost.co.uk' ] ;
2021-11-16 18:21:56 +01: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' ] ;
2023-05-03 08:32:15 +02:00
var usa _arizent _custom _domains = [ 'accountingtoday.com' , 'benefitnews.com' , 'bondbuyer.com' , 'dig-in.com' , 'financial-planning.com' , 'nationalmortgagenews.com' ] ;
2023-04-01 09:28:21 +02:00
var usa _conde _nast _domains = [ 'architecturaldigest.com' , 'bonappetit.com' , 'epicurious.com' , 'gq.com' , 'newyorker.com' , 'vanityfair.com' , 'vogue.com' , 'wired.com' ] ;
2021-08-17 22:45:11 +02:00
var usa _craincomm _domains = [ 'adage.com' , 'autonews.com' , 'chicagobusiness.com' , 'crainscleveland.com' , 'crainsdetroit.com' , 'crainsnewyork.com' , 'modernhealthcare.com' ] ;
2023-04-30 07:38:33 +02:00
var usa _gannett _domains = [ 'azcentral.com' , 'cincinnati.com' , 'commercialappeal.com' , 'courier-journal.com' , 'democratandchronicle.com' , 'detroitnews.com' , 'freep.com' , 'indystar.com' , 'jsonline.com' , 'knoxnews.com' , 'news-press.com' , 'northjersey.com' , 'oklahoman.com' , 'statesman.com' , 'tennessean.com' ] ;
2022-07-31 08:59:34 +02:00
var usa _genomeweb _domains = [ '360dx.com' , 'genomeweb.com' , 'precisiononcologynews.com' ] ;
2022-01-08 15:46:46 +01:00
var usa _hearst _comm _domains = [ 'expressnews.com' , 'houstonchronicle.com' , 'sfchronicle.com' ] ;
2022-08-31 19:56:03 +02:00
var usa _lee _ent _domains = [ 'buffalonews.com' , 'journalnow.com' , 'omaha.com' , 'richmond.com' , 'tucson.com' , 'tulsaworld.com' ] ;
2022-12-28 12:21:06 +01:00
var usa _mcc _domains = [ 'bnd.com' , 'charlotteobserver.com' , 'fresnobee.com' , 'kansas.com' , 'kansascity.com' , 'kentucky.com' , 'mcclatchydc.com' , 'miamiherald.com' , 'newsobserver.com' , 'sacbee.com' , 'star-telegram.com' , 'thestate.com' , 'tri-cityherald.com' ] ;
2021-08-16 22:49:58 +02:00
var usa _mng _domains = [ 'denverpost.com' , 'eastbaytimes.com' , 'mercurynews.com' , 'ocregister.com' , 'pe.com' , 'twincities.com' ] ;
2022-04-20 17:58:51 +02: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 20:32:12 +02:00
var usa _tribune _domains = [ 'baltimoresun.com' , 'chicagotribune.com' , 'courant.com' , 'dailypress.com' , 'mcall.com' , 'nydailynews.com' , 'orlandosentinel.com' , 'pilotonline.com' , 'sun-sentinel.com' ] ;
2020-12-10 20:23:12 +01:00
// clean local storage of sites (with an exemption for hold-list)
2023-07-21 10:41:57 +02:00
var arr _localstorage _hold = [ 'allgaeuer-zeitung.de' , 'augsburger-allgemeine.de' , 'barrons.com' , 'businessinsider.com' , 'businessoffashion.com' , 'businesspost.ie' , 'challenges.fr' , 'charliehebdo.fr' , 'cmjornal.pt' , 'corriere.it' , 'corrieredellosport.it' , 'cyclingtips.com' , 'dvhn.nl' , 'economictimes.com' , 'eldiario.es' , 'elespanol.com' , 'elle.fr' , 'elpais.com' , 'elperiodico.com' , 'enotes.com' , 'estadao.com.br' , 'forbes.com' , 'fortune.com' , 'freiepresse.de' , 'gauchazh.clicrbs.com.br' , 'globo.com' , 'ilfoglio.it' , 'inc42.com' , 'indianexpress.com' , 'ksta.de' , 'kurier.at' , 'lanouvellerepublique.fr' , 'latimes.com' , 'lc.nl' , 'lesechos.fr' , 'livemint.com' , 'mid-day.com' , 'mundodeportivo.com' , 'nationalreview.com' , 'nrc.nl' , 'nw.de' , 'nytimes.com' , 'nzherald.co.nz' , 'record.pt' , 'rundschau-online.de' , 'sandiegouniontribune.com' , 'scmp.com' , 'seekingalpha.com' , 'telegraph.co.uk' , 'tes.com' , 'theatlantic.com' , 'thebulletin.org' , 'thecritic.co.uk' , 'thetimes.co.uk' , 'uol.com.br' , 'wsj.com' ] . concat ( be _roularta _domains , ca _gcm _domains , de _funke _medien _domains , de _lv _domains , de _vrm _domains , de _vrm _custom _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 , timesofindia _domains , usa _hearst _comm _domains , usa _mcc _domains ) ;
2021-04-10 08:46:50 +02:00
if ( ! matchDomain ( arr _localstorage _hold ) ) {
window . localStorage . clear ( ) ;
2019-12-06 16:15:49 +01:00
}
2019-12-10 20:08:01 +01:00
2023-05-08 20:05:06 +02:00
function runOnMessage ( bg2csData , dompurify _loaded ) {
2022-02-22 19:23:36 +01:00
// custom/updated sites: load text from json
2023-05-08 20:05:06 +02:00
if ( bg2csData . ld _json && dompurify _loaded ) {
2022-02-22 19:23:36 +01:00
if ( bg2csData . ld _json . includes ( '|' ) ) {
2022-08-01 20:49:58 +02: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 19:19:51 +02:00
let paywall = document . querySelectorAll ( paywall _sel ) ;
2023-05-07 13:13:41 +02:00
let article = document . querySelector ( article _sel ) ;
let article _append = ld _json _split [ 2 ] ; // optional
if ( paywall . length && article ) {
2022-08-10 19:19:51 +02:00
removeDOMElement ( ... paywall ) ;
2022-08-01 20:49:58 +02:00
let json _script = getArticleJsonScript ( ) ;
if ( json _script ) {
2022-11-30 08:56:21 +01:00
try {
2023-01-28 11:10:24 +01:00
let json = JSON . parse ( json _script . text . replace ( /[\r\n]/g , '' ) . replace ( /(\\r)?\\n/g , '<br>' ) ) ;
2023-02-04 17:29:46 +01:00
let json _key , json _text ;
if ( Array . isArray ( json ) ) {
2023-03-09 19:36:16 +01:00
json = json . filter ( x => json _key = Object . keys ( x ) . find ( key => key . match ( /^articlebody$/i ) ) ) || json . filter ( x => json _key = Object . keys ( x ) . find ( key => key . match ( /^text$/i ) ) ) ;
2023-02-04 17:29:46 +01:00
if ( json _key )
json _text = parseHtmlEntities ( json [ 0 ] [ json _key ] ) ;
} else {
2023-03-09 19:36:16 +01:00
json _key = Object . keys ( json ) . find ( key => key . match ( /^articlebody$/i ) ) || Object . keys ( json ) . find ( key => key . match ( /^text$/i ) ) ;
2023-02-04 17:29:46 +01:00
json _text = parseHtmlEntities ( json [ json _key ] ) ;
}
2023-05-07 13:13:41 +02:00
if ( json _text && article . parentNode ) {
2022-11-30 08:56:21 +01:00
let parser = new DOMParser ( ) ;
2023-05-08 20:05:06 +02:00
let doc = parser . parseFromString ( '<div style="margin: 25px 0px">' + DOMPurify . sanitize ( json _text ) + '</div>' , 'text/html' ) ;
2023-05-07 13:13:41 +02:00
let article _new = doc . querySelector ( 'div' ) ;
if ( article _append || ! article . parentNode ) {
article . innerHTML = '' ;
article . appendChild ( article _new ) ;
} else
article . parentNode . replaceChild ( article _new , article ) ;
2022-11-30 08:56:21 +01:00
}
} catch ( err ) {
console . log ( err ) ;
2022-08-01 20:49:58 +02:00
}
2022-02-22 19:23:36 +01:00
}
}
2022-08-01 20:49:58 +02:00
} , 1000 ) ;
}
}
2023-05-08 20:05:06 +02:00
if ( bg2csData . ld _json _next && dompurify _loaded ) {
2023-05-07 13:13:41 +02:00
if ( bg2csData . ld _json _next . includes ( '|' ) ) {
window . setTimeout ( function ( ) {
let ld _json _next _split = bg2csData . ld _json _next . split ( '|' ) ;
let paywall _sel = ld _json _next _split [ 0 ] ;
let article _sel = ld _json _next _split [ 1 ] ;
let paywall = document . querySelectorAll ( paywall _sel ) ;
let article = document . querySelector ( article _sel ) ;
let article _append = ld _json _next _split [ 2 ] ; // optional
if ( paywall . length && article ) {
removeDOMElement ( ... paywall ) ;
let json _script = document . querySelector ( 'script#__NEXT_DATA__' ) ;
let json = JSON . parse ( json _script . text ) ;
if ( json ) {
let url _next = findKeyJson ( json , [ 'slug' ] ) ;
if ( url _next && ! window . location . pathname . endsWith ( url _next ) )
refreshCurrentTab ( ) ;
let json _text = parseHtmlEntities ( findKeyJson ( json , [ 'body' , 'content' , 'description' ] , 500 ) ) ;
if ( json _text && article . parentNode ) {
let parser = new DOMParser ( ) ;
2023-05-08 20:05:06 +02:00
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( json _text ) + '</div>' , 'text/html' ) ;
2023-05-07 13:13:41 +02:00
let article _new = doc . querySelector ( 'div' ) ;
if ( article _append || ! article . parentNode ) {
article . innerHTML = '' ;
article . appendChild ( article _new ) ;
} else
article . parentNode . replaceChild ( article _new , article ) ;
}
}
}
} , 1000 ) ;
}
}
2022-08-01 20:49:58 +02:00
// custom/updated sites: load text from Google webcache
2023-05-08 20:05:06 +02:00
if ( bg2csData . ld _google _webcache && dompurify _loaded ) {
2022-08-01 20:49:58 +02:00
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 19:19:51 +02:00
let paywall = document . querySelectorAll ( paywall _sel ) ;
if ( paywall . length ) {
removeDOMElement ( ... paywall ) ;
2022-08-02 17:26:56 +02:00
let url _cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url . split ( '?' ) [ 0 ] ;
2022-08-01 20:49:58 +02:00
replaceDomElementExt ( url _cache , true , false , article _sel ) ;
}
} , 1000 ) ;
2022-02-22 19:23:36 +01:00
}
}
2023-02-19 12:36:09 +01:00
// custom/updated sites: add link to article
if ( bg2csData . add _ext _link ) {
if ( bg2csData . add _ext _link . css && bg2csData . add _ext _link . css . includes ( '|' ) && bg2csData . add _ext _link . type ) {
window . setTimeout ( function ( ) {
2023-05-02 12:17:13 +02:00
let url = window . location . href . split ( /[#\?]/ ) [ 0 ] ;
if ( matchUrlDomain ( 'zeit.de' , url ) ) {
if ( document . querySelector ( 'link[rel="next"]' ) )
url += '/komplettansicht' ;
}
2023-02-19 12:36:09 +01:00
let add _ext _link _split = bg2csData . add _ext _link . css . split ( '|' ) ;
let paywall _sel = add _ext _link _split [ 0 ] ;
let article _sel = add _ext _link _split [ 1 ] ;
let paywall = document . querySelectorAll ( paywall _sel ) ;
if ( paywall . length ) {
removeDOMElement ( ... paywall ) ;
let article = document . querySelector ( article _sel ) ;
if ( article ) {
switch ( bg2csData . add _ext _link . type ) {
case 'archive.is' :
article . firstChild . before ( archiveLink ( url ) ) ;
break ;
case '12ft.io' :
article . firstChild . before ( ext _12ftLink ( url ) ) ;
break ;
}
}
}
} , 1000 ) ;
}
}
2023-05-08 20:05:06 +02:00
// check for opt-in confirmation (from background.js)
if ( bg2csData . optin _setcookie ) {
2023-07-09 18:19:21 +02:00
false ;
2023-05-08 20:05:06 +02:00
}
2022-02-22 19:23:36 +01:00
// custom/updated sites: try to unhide text on amp-page
2022-12-16 12:31:29 +01:00
if ( bg2csData . amp _unhide ) {
2021-10-17 21:15:00 +02:00
window . setTimeout ( function ( ) {
2021-12-02 18:02:07 +01:00
let amp _page _hide = document . querySelector ( 'script[src*="/amp-access-"], script[src*="/amp-subscriptions-"]' ) ;
if ( amp _page _hide ) {
2021-11-30 17:36:15 +01:00
amp _unhide _subscr _section ( ) ;
amp _unhide _access _hide ( ) ;
2021-12-01 18:33:33 +01:00
amp _iframes _replace ( ) ;
2021-11-17 17:45:33 +01:00
}
2022-03-08 19:04:50 +01:00
} , 100 ) ;
2021-11-17 17:45:33 +01:00
}
2022-02-22 19:23:36 +01:00
// custom/updated sites: amp-redirect
2022-12-16 12:31:29 +01:00
if ( bg2csData . amp _redirect ) {
2021-11-17 17:45:33 +01:00
window . setTimeout ( function ( ) {
2021-12-02 18:02:07 +01: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 17:45:33 +01: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 21:15:00 +02:00
}
2022-03-08 19:04:50 +01:00
} , 500 ) ;
2021-10-17 21:15:00 +02:00
}
2021-11-18 17:55:25 +01: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 ) ;
}
2022-12-21 18:04:11 +01:00
if ( elem . rm _attrib ) {
let rm _attribs = elem . rm _attrib . split ( '|' ) ;
for ( let rm _attrib of rm _attribs )
item . removeAttribute ( rm _attrib ) ;
}
2022-05-03 17:42:51 +02: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 17:55:25 +01:00
if ( elem . elems )
cs _code _elems ( elem . elems ) ;
}
}
}
// updated sites: cs_code
2022-12-16 12:31:29 +01:00
if ( bg2csData . cs _code ) {
2021-11-18 17:55:25 +01:00
window . setTimeout ( function ( ) {
cs _code _elems ( bg2csData . cs _code ) ;
2022-03-08 19:04:50 +01:00
} , 1000 ) ;
2021-11-18 17:55:25 +01:00
}
2022-12-16 12:31:29 +01:00
} // runOnMessage
var msg _once = false ;
if ( ext _api . runtime ) {
ext _api . runtime . onMessage . addListener (
function ( request , sender ) {
if ( request . msg === 'bg2cs' && ! msg _once ) {
msg _once = true ;
2023-05-08 20:05:06 +02:00
runOnMessage ( request . data , dompurify _loaded ) ;
2022-12-16 12:31:29 +01:00
}
} )
}
2023-07-07 08:41:44 +02:00
window . addEventListener ( 'message' , function ( event ) {
if ( event . data ) {
if ( event . data . type === 'from_page' ) {
if ( matchDomain ( 'businesspost.ie' ) ) {
let data = event . data . data ;
let article = document . querySelector ( 'div.article-body-section' ) ;
if ( data && article && dompurify _loaded && ! msg _once ) {
msg _once = true ;
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( data ) + '</div>' , 'text/html' ) ;
let article _new = doc . querySelector ( 'div' ) ;
if ( article _new ) {
article . innerHTML = '' ;
article . appendChild ( article _new ) ;
}
}
}
}
}
} , false ) ;
2022-12-21 18:04:11 +01:00
var div _bpc _done = document . querySelector ( 'div#bpc_done' ) ;
2022-12-16 12:31:29 +01:00
if ( ! div _bpc _done ) {
if ( ext _api . runtime ) {
ext _api . runtime . onMessage . addListener (
function ( request , sender ) {
2023-07-14 11:10:22 +02:00
if ( request . msg === 'showExtSrc' && ! msg _once ) {
msg _once = true ;
2022-12-16 12:31:29 +01:00
replaceDomElementExtSrc ( request . data . url , request . data . html , true , false , request . data . selector , request . data . text _fail , request . data . selector _source ) ;
}
} )
}
2020-01-28 23:06:25 +01:00
// Content workarounds/domain
2020-03-27 21:13:28 +01:00
2022-12-07 13:14:32 +01:00
if ( matchDomain ( 'medium.com' ) || matchDomain ( medium _custom _domains ) || document . querySelector ( 'script[src*=".medium.com/"]' ) ) {
2023-07-14 11:10:22 +02:00
let url = window . location . href ;
2023-07-18 08:15:54 +02:00
let paywall = document . querySelector ( 'section button[aria-label="Member-only story"]' ) ;
if ( paywall ) {
paywall . removeAttribute ( 'aria-label' ) ;
let article = document . querySelector ( 'article' ) ;
if ( article )
article . firstChild . before ( googleWebcacheLink ( url ) ) ;
}
2021-04-10 08:46:50 +02:00
window . setTimeout ( function ( ) {
2023-07-19 12:31:04 +02:00
let banner = pageContains ( 'div > h2 > div, div > div > h2' , /(Read (the full story with|this story from)|Get unlimited access to)/ ) ;
2023-07-18 08:15:54 +02:00
if ( banner . length )
removeDOMElement ( banner [ 0 ] . parentNode . parentNode ) ;
2023-07-14 11:10:22 +02:00
} , 1000 ) ;
2020-08-12 08:37:21 +02:00
}
2021-05-29 08:00:38 +02:00
else if ( window . location . hostname . match ( /\.(com|net)\.au$/ ) ) { //australia
2020-09-10 22:01:35 +02:00
2023-07-02 11:07:32 +02:00
if ( matchDomain ( 'macrobusiness.com.au' ) ) {
let paywall = pageContains ( 'div > p' , 'The full text of this article is available' ) ;
if ( paywall [ 0 ] && dompurify _loaded ) {
let fade = document . querySelector ( 'div.bg-gradient-to-t' ) ;
removeDOMElement ( paywall [ 0 ] . parentNode , fade ) ;
let json _script = document . querySelector ( 'script#__NUXT_DATA__' ) ;
if ( json _script ) {
try {
let json = JSON . parse ( json _script . text ) ;
let json _text = json . filter ( x => typeof x === 'string' && x . match ( /(<|\\u003C)p>/ ) ) [ 0 ] ;
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( json _text ) + '</div>' , 'text/html' ) ;
let content _new = doc . querySelector ( 'div' )
let article = document . querySelector ( 'div.content' ) ;
if ( article ) {
article . innerHTML = '' ;
article . appendChild ( content _new ) ;
}
} catch ( err ) {
console . log ( err ) ;
}
}
}
}
else if ( matchDomain ( 'thesaturdaypaper.com.au' ) ) {
2022-12-28 18:19:57 +01:00
let hide _end = document . querySelector ( 'div.hide-end' ) ;
if ( hide _end ) {
2023-01-11 19:36:19 +01:00
refreshCurrentTab ( ) ;
2022-12-28 18:19:57 +01:00
csDoneOnce = true ;
}
2021-04-10 08:46:50 +02:00
let paywall = document . querySelector ( 'div.paywall-hard-always-show' ) ;
removeDOMElement ( paywall ) ;
2021-02-20 10:18:12 +01:00
}
2022-05-27 15:11:37 +02: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 17:36:15 +01:00
amp _unhide _subscr _section ( ) ;
2021-04-10 08:46:50 +02:00
}
}
else {
// Australian Community Media newspapers
2022-05-06 18:46:36 +02: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' ] ;
2023-07-21 17:04:27 +02:00
let au _comm _media _link = document . querySelector ( 'a[href^="https://austcommunitymedia.my.site.com/"]' ) ;
2022-03-19 19:32:07 +01:00
if ( matchDomain ( au _comm _media _domains ) || au _comm _media _link ) {
2023-07-18 19:19:40 +02:00
let mask = document . querySelector ( 'div[class^="gradient-mask-"]' ) ;
2022-03-22 20:42:01 +01:00
if ( mask ) {
2023-07-18 19:19:40 +02:00
mask . removeAttribute ( 'class' ) ;
2023-07-21 17:04:27 +02:00
let div _hidden = document . querySelectorAll ( 'div.flex-col div.hidden' ) ;
2022-05-06 18:46:36 +02:00
for ( let elem of div _hidden )
elem . classList . remove ( 'hidden' ) ;
2022-03-22 20:42:01 +01: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 08:46:50 +02:00
let blocker = document . querySelector ( 'div.blocker' ) ;
2022-08-31 08:40:16 +02: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 08:46:50 +02:00
let story _generic _iframe = document . querySelector ( '.story-generic__iframe' ) ;
2022-08-04 07:57:25 +02:00
let ads = document . querySelectorAll ( '.ad-placeholder, .sticky, [id*="-container"], #hindsight-ads-iframe' ) ;
2022-08-30 18:51:01 +02:00
removeDOMElement ( story _generic _iframe , blocker , ... overlays , ... ads ) ;
2021-04-10 08:46:50 +02:00
} else if ( window . location . hostname . endsWith ( '.com.au' ) ) {
// Australia News Corp
2023-05-03 17:38:21 +02: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 15:11:37 +02:00
if ( matchDomain ( au _news _corp _domains ) ) {
2023-05-03 17:38:21 +02:00
if ( window . location . hostname . startsWith ( 'amp.' ) || window . location . search . match ( /[&\?]amp/ ) ) {
2022-09-29 09:24:42 +02:00
let figure _stretch = document . querySelectorAll ( 'figure.stretch' ) ;
for ( let elem of figure _stretch )
elem . classList . remove ( 'stretch' ) ;
2023-01-18 17:34:01 +01:00
let amp _ads _sel = 'amp-ad, amp-embed, [id^="ad-mrec-"], [class*="ad-container"]' ;
2022-09-29 09:24:42 +02:00
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' ) ;
2023-01-19 08:31:41 +01:00
comments = document . querySelector ( '#comments-load, .comments-module' ) ;
2022-09-29 09:24:42 +02:00
let amp _iframe _sizers = document . querySelectorAll ( 'amp-iframe > i-amphtml-sizer' ) ;
removeDOMElement ( ... amp _iframe _sizers )
}
removeDOMElement ( comments ) ;
} else {
2022-12-11 18:01:05 +01:00
if ( matchDomain ( 'codesports.com.au' ) ) {
let lazy _images = document . querySelectorAll ( 'img.lazyload[data-src]:not([src])' ) ;
for ( let elem of lazy _images ) {
elem . src = elem . getAttribute ( 'data-src' ) ;
elem . classList . remove ( 'lazyload' ) ;
}
}
2022-10-14 15:53:54 +02:00
let ads = document . querySelectorAll ( '.header_ads-container, .ad-block, .ad-container' ) ;
2022-09-29 09:24:42 +02:00
removeDOMElement ( ... ads ) ;
2021-12-01 19:06:40 +01:00
}
2021-04-10 08:46:50 +02:00
} else {
// Australian Seven West Media
2023-02-08 16:58:13 +01:00
if ( matchDomain ( 'thewest.com.au' ) || document . querySelector ( 'li > a[href*=".sevenwestmedia.com.au"]' ) ) {
2021-04-10 08:46:50 +02:00
window . setTimeout ( function ( ) {
2023-03-24 16:06:51 +01:00
let breach _screen = document . querySelector ( 'div.paywall div[data-testid*="BreachScreen"], div[class*="StyledBreachWallContent"]' ) ;
2021-04-10 08:46:50 +02:00
if ( breach _screen ) {
2023-07-19 12:31:04 +02:00
let scripts = document . querySelectorAll ( 'script:not([src]):not([type])' ) ;
2021-04-10 08:46:50 +02:00
let json _script ;
for ( let script of scripts ) {
2023-02-08 21:58:02 +01:00
if ( script . text . includes ( 'window.PAGE_DATA =' ) ) {
2021-04-10 08:46:50 +02:00
json _script = script ;
break ;
}
}
2023-02-08 21:58:02 +01:00
if ( json _script ) {
2023-02-08 16:58:13 +01:00
let json _text = json _script . text . split ( 'window.PAGE_DATA =' ) [ 1 ] . split ( '</script' ) [ 0 ] ;
2023-04-08 19:19:49 +02:00
json _text = json _text . replace ( /:undefined([,}])/g , ':"undefined"$1' ) ;
2023-02-08 16:58:13 +01:00
try {
2021-04-10 08:46:50 +02:00
let json _article = JSON . parse ( json _text ) ;
let json _pub ;
2023-02-08 16:58:13 +01:00
for ( let key in json _article ) {
let json _resolution = json _article [ key ] . data . result . resolution ;
if ( json _resolution && json _resolution . publication ) {
json _pub = json _resolution . publication ;
2021-04-10 08:46:50 +02:00
break ;
}
2023-02-08 16:58:13 +01:00
}
2021-04-10 08:46:50 +02:00
let json _content = [ ] ;
let url _loaded ;
if ( json _pub ) {
json _content = json _pub . content . blocks ;
url _loaded = json _pub . _self ;
} else
window . location . reload ( true ) ;
//let json_video = json_pub.mainVideo;
let url = window . location . href ;
if ( ! url _loaded || ! url . includes ( url _loaded . slice ( - 10 ) ) )
window . location . reload ( true ) ;
2021-06-29 19:59:15 +02:00
let par _elem , par _sub1 , par _sub2 ;
let par _dom = document . createElement ( 'div' ) ;
let tweet _id = 1 ;
2021-04-10 08:46:50 +02:00
for ( let par of json _content ) {
2021-06-29 19:59:15 +02:00
par _elem = '' ;
2021-04-10 08:46:50 +02:00
if ( par . kind === 'text' ) {
2021-06-29 19:59:15 +02:00
par _elem = document . createElement ( 'p' ) ;
par _elem . innerText = par . text ;
2021-04-10 08:46:50 +02:00
} else if ( par . kind === 'subhead' ) {
2021-06-29 19:59:15 +02:00
par _elem = document . createElement ( 'h2' ) ;
par _elem . innerText = par . text ;
2021-04-10 08:46:50 +02:00
} else if ( par . kind === 'pull-quote' ) {
2021-06-29 19:59:15 +02:00
par _elem = document . createElement ( 'i' ) ;
par _elem . innerText = ( par . attribution ? par . attribution + ': ' : '' ) + par . text ;
2021-04-10 08:46:50 +02:00
} else if ( par . kind === 'embed' ) {
if ( par . reference . includes ( 'https://omny.fm/' ) || par . reference . includes ( 'https://docdro.id/' ) ) {
2021-06-29 19:59:15 +02:00
par _elem = document . createElement ( 'embed' ) ;
par _elem . src = par . reference ;
par _elem . style = 'height:500px; width:100%' ;
par _elem . frameborder = '0' ;
2021-04-10 08:46:50 +02:00
} else {
2021-06-29 19:59:15 +02:00
par _elem = document . createElement ( 'a' ) ;
par _elem . href = par . reference ;
par _elem . innerText = par . reference . split ( '?' ) [ 0 ] ;
2021-04-10 08:46:50 +02:00
console . log ( 'embed: ' + par . reference ) ;
}
} else if ( par . kind === 'unordered-list' ) {
if ( par . items ) {
2021-06-29 19:59:15 +02:00
par _elem = document . createElement ( 'ul' ) ;
2021-04-10 08:46:50 +02:00
for ( let item of par . items )
2021-07-10 19:02:46 +02:00
if ( item . text ) {
2021-06-29 19:59:15 +02:00
par _sub1 = document . createElement ( 'li' ) ;
2021-07-10 19:02:46 +02:00
if ( item . intentions [ 0 ] && item . intentions [ 0 ] . href ) {
par _sub2 = document . createElement ( 'a' ) ;
par _sub2 . href = item . intentions [ 0 ] . href ;
} else {
par _sub2 = document . createElement ( 'span' ) ;
}
2021-06-29 19:59:15 +02:00
par _sub2 . innerText = item . text ;
par _sub1 . appendChild ( par _sub2 ) ;
par _elem . appendChild ( par _sub1 ) ;
2021-04-10 08:46:50 +02:00
}
}
} else if ( par . kind === 'inline' ) {
if ( par . asset . kind === 'image' ) {
2021-06-29 19:59:15 +02:00
par _elem = document . createElement ( 'figure' ) ;
par _sub1 = document . createElement ( 'img' ) ;
par _sub1 . src = par . asset . original . reference ;
par _sub1 . style = 'width:100%' ;
par _elem . appendChild ( par _sub1 ) ;
if ( par . asset . captionText ) {
par _sub2 = document . createElement ( 'figcaption' ) ;
2023-03-07 09:22:31 +01:00
par _sub2 . innerText = par . asset . captionText + ' ' + ( par . asset . copyrightByline ? par . asset . copyrightByline : '' ) +
2021-06-29 19:59:15 +02:00
( ( par . asset . copyrightCredit && par . asset . captionText !== par . asset . copyrightByline ) ? '/' + par . asset . copyrightCredit : '' ) ;
par _elem . appendChild ( par _sub2 ) ;
}
2021-04-10 08:46:50 +02:00
}
2023-02-08 21:58:02 +01:00
} else if ( par . kind === 'inline-related' ) {
par _elem = document . createElement ( 'p' ) ;
if ( par . publications ) {
for ( let elem of par . publications ) {
let par _link = document . createElement ( 'a' ) ;
par _link . href = elem . _self ;
par _link . innerText = elem . heading ;
par _elem . appendChild ( par _link ) ;
par _elem . appendChild ( document . createElement ( 'br' ) ) ;
}
}
2021-04-10 08:46:50 +02:00
} else {
2021-06-29 19:59:15 +02:00
par _elem = document . createElement ( 'p' ) ;
par _elem . innerText = par . text ;
2021-04-10 08:46:50 +02:00
console . log ( par . kind ) ;
}
2021-06-29 19:59:15 +02:00
if ( par _elem )
par _dom . appendChild ( par _elem ) ;
2021-04-10 08:46:50 +02:00
}
let content = document . querySelector ( 'div[class*="StyledArticleContent"]' ) ;
if ( content ) {
2023-03-07 09:22:31 +01:00
content . innerHTML = '' ;
2021-04-10 08:46:50 +02:00
content . appendChild ( par _dom ) ;
} else {
par _dom . setAttribute ( 'style' , 'margin: 20px;' ) ;
2023-01-25 18:46:53 +01:00
breach _screen . before ( par _dom ) ;
2021-04-10 08:46:50 +02:00
}
2023-02-08 16:58:13 +01:00
} catch ( err ) {
console . log ( err ) ;
}
2021-04-10 08:46:50 +02:00
}
removeDOMElement ( breach _screen ) ;
}
2023-02-08 21:58:02 +01:00
} , 2000 ) ;
2021-04-10 08:46:50 +02:00
let header _advert = document . querySelector ( '.headerAdvertisement' ) ;
2023-02-08 16:58:13 +01:00
hideDOMElement ( header _advert ) ;
2021-04-10 08:46:50 +02:00
}
2019-11-22 05:17:21 +01:00
}
2021-04-10 08:46:50 +02:00
}
else
2021-04-25 13:45:36 +02:00
csDone = true ;
2020-01-28 23:06:25 +01:00
}
2023-02-25 14:20:33 +01:00
} else if ( window . location . hostname . match ( /\.(de|at|ch)$/ ) || matchDomain ( [ 'faz.net' , 'topagrar.com' , 'wochenblatt.com' ] ) ) { //germany/austria/switzerland - ch
2021-04-10 08:46:50 +02:00
2023-07-01 08:49:27 +02:00
if ( matchDomain ( 'aerztezeitung.de' ) ) {
2023-01-21 17:47:44 +01:00
let paywall = document . querySelector ( 'div.AZLoginModule' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let json _script = getArticleJsonScript ( ) ;
if ( json _script ) {
let json = JSON . parse ( json _script . text ) ;
if ( json ) {
let json _text = json . articleBody ;
let content = document . querySelector ( 'p.intro' ) ;
if ( json _text && content ) {
let article _new = document . createElement ( 'p' ) ;
article _new . innerText = json _text ;
content . after ( article _new ) ;
}
}
}
}
}
else if ( matchDomain ( 'allgaeuer-zeitung.de' ) ) {
2023-04-30 07:38:33 +02:00
if ( ! window . location . search . startsWith ( '?type=amp' ) ) {
2021-12-18 12:33:08 +01:00
let paywall = document . querySelector ( 'p.nfy-text-blur' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
2023-04-29 09:51:38 +02:00
window . location . href = window . location . pathname + '?type=amp' ;
2021-12-18 12:33:08 +01:00
}
} 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 ) ;
}
}
2023-06-27 12:26:17 +02:00
else if ( matchDomain ( [ 'arcinfo.ch' , 'lacote.ch' , 'lenouvelliste.ch' ] ) ) { // Groupe ESH Médias
2022-09-30 17:40:10 +02:00
let paywall = document . querySelector ( 'section#paywall-articles' ) ;
2023-05-08 20:05:06 +02:00
if ( paywall && dompurify _loaded ) {
2022-09-30 17:40:10 +02:00
removeDOMElement ( paywall ) ;
2023-01-08 09:35:56 +01:00
let url _id = window . location . pathname . match ( /\d+$/ ) . pop ( ) ;
2022-09-30 17:40:10 +02:00
let html = document . documentElement . outerHTML ;
2022-10-10 19:34:52 +02:00
let og _url = document . querySelector ( 'meta[name="og:url"][content]' ) ;
2023-01-08 09:35:56 +01:00
if ( og _url && ! og _url . content . endsWith ( url _id ) )
2022-10-10 19:34:52 +02:00
window . location . reload ( true ) ;
2022-09-30 17:40:10 +02:00
let json ;
if ( html . includes ( 'window.__NUXT__=' ) )
2022-10-10 19:34:52 +02:00
json = html . split ( 'window.__NUXT__=' ) [ 1 ] . split ( '</script>' ) [ 0 ] . trim ( ) . replace ( /blocs:\[\{.*?\}\],/g , '' ) ;
2022-09-30 17:40:10 +02:00
let article = document . querySelector ( 'div.html-content' ) ;
2022-10-10 19:34:52 +02:00
let no _intro = false ;
if ( ! article ) {
article = document . querySelector ( 'div.container-mobile-full' ) ;
no _intro = true ;
}
2022-09-30 17:40:10 +02:00
if ( article && json ) {
let content = '' ;
2022-10-09 20:20:19 +02:00
if ( json . includes ( 'text_1="' ) )
content = json . split ( 'text_1="' ) . pop ( ) . split ( '";' ) [ 0 ] ;
2022-09-30 17:40:10 +02:00
else {
let parts = json . split ( 'html:"' ) ;
2022-10-13 08:01:45 +02:00
parts . splice ( 0 , 1 ) ;
for ( let part of parts )
content += part . split ( '",has_pre_content' ) [ 0 ] ;
2022-09-30 17:40:10 +02:00
}
if ( content ) {
content = content . replace ( /\\u003C/g , '<' ) . replace ( /\\u003E/g , '>' ) . replace ( /\\u002F/g , '/' ) . replace ( /\\"/g , '"' ) . replace ( /\\r\\n/g , '' ) ;
let parser = new DOMParser ( ) ;
2023-05-08 20:05:06 +02:00
let content _new = parser . parseFromString ( '<div class="html-content">' + DOMPurify . sanitize ( content ) + '</div>' , 'text/html' ) ;
2022-10-10 19:34:52 +02:00
let article _top ;
if ( ! no _intro ) {
article _top = article . parentNode . parentNode ;
removeDOMElement ( article . parentNode ) ;
} else
article _top = article ;
2022-09-30 17:40:10 +02:00
article _top . appendChild ( content _new . querySelector ( 'div' ) ) ;
} else {
window . location . reload ( true ) ;
}
}
}
}
2021-09-25 09:35:48 +02:00
else if ( matchDomain ( 'augsburger-allgemeine.de' ) ) {
2021-04-10 08:46:50 +02:00
let url = window . location . href ;
2021-06-28 08:51:33 +02:00
if ( ! url . includes ( '-amp.html' ) ) {
let paywall = document . querySelector ( 'div.aa-visible-logged-out' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
window . location . href = url . replace ( '.html' , '-amp.html' ) ;
}
} else {
2021-11-30 17:36:15 +01:00
amp _unhide _subscr _section ( ) ;
2021-04-10 08:46:50 +02:00
}
2021-02-19 19:28:36 +01:00
}
2023-06-26 18:53:12 +02:00
else if ( matchDomain ( [ 'beobachter.ch' , 'handelszeitung.ch' ] ) ) {
let paywall = document . querySelector ( 'div#piano-inlined' ) ;
if ( paywall && dompurify _loaded ) {
removeDOMElement ( paywall ) ;
let json _script = document . querySelector ( 'script#hydrationdata' ) ;
if ( json _script ) {
try {
let json = JSON . parse ( json _script . text ) ;
if ( json ) {
let url _id = json _script . text . includes ( '"gcid":"' ) ? json _script . text . split ( '"gcid":"' ) [ 1 ] . split ( '","nid"' ) [ 0 ] : '' ;
if ( url _id && ! window . location . pathname . endsWith ( url _id ) )
refreshCurrentTab ( ) ;
let pars = json . state ;
let paragraphs = document . querySelectorAll ( 'div.paragraph' ) ;
let article = paragraphs [ 0 ] ;
if ( article ) {
article . setAttribute ( 'class' , 'paragraph text-paragraph' ) ;
for ( let paragraph of paragraphs )
paragraph . innerHTML = '' ;
let parser = new DOMParser ( ) ;
for ( let par in pars ) {
let content = pars [ par ] . text ;
if ( content ) {
let content _new = parser . parseFromString ( '<div style="font-size: 1.7rem; margin: 50px;">' + DOMPurify . sanitize ( content ) + '</div>' , 'text/html' ) ;
let article _new = content _new . querySelector ( 'div' ) ; ;
article . appendChild ( article _new ) ;
}
}
}
}
} catch ( err ) {
console . log ( err ) ;
}
}
}
let ads = document . querySelectorAll ( 'div.ad-wrapper' ) ;
hideDOMElement ( ... ads ) ;
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'berliner-zeitung.de' ) ) {
2023-03-04 10:33:24 +01:00
window . setTimeout ( function ( ) {
let ads = document . querySelectorAll ( '[id^="traffective-ad"], [class^="ad-slot_wrapper"], [class^="outbrain_container"]' ) ;
hideDOMElement ( ... ads ) ;
} , 1000 ) ;
2021-02-19 19:28:36 +01:00
}
2023-05-30 19:27:56 +02:00
else if ( matchDomain ( 'boersen-zeitung.de' ) ) {
let url = window . location . href ;
let paywall = document . querySelector ( 'storefront-element[child-id="paywall"]' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
replaceDomElementExt ( url , false , false , 'article' ) ;
}
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'cicero.de' ) ) {
let url = window . location . href ;
2022-04-19 21:37:22 +02:00
if ( ! window . location . search . match ( /(\?|&)amp/ ) ) {
2021-04-10 08:46:50 +02:00
let paywall = document . querySelector ( '.plenigo-paywall' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
2022-01-28 16:05:29 +01:00
let url _amp = url . split ( '?' ) [ 0 ] + '?amp' ;
2021-04-10 08:46:50 +02: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 23:06:25 +01:00
}
2021-04-10 08:46:50 +02: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 16:31:08 +02:00
removeDOMElement ( paywall _z ) ;
let og _url = document . querySelector ( 'meta[property="og:url"][content]' ) ;
2021-04-10 08:46:50 +02:00
if ( og _url )
2022-09-08 16:31:08 +02:00
window . location . href = og _url . content ;
2021-04-10 08:46:50 +02: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 19:21:26 +01: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 ( '"' ) )
2023-03-20 20:01:19 +01:00
json _text = split1 [ 0 ] + '"ArticleBody": "' + split2 [ 0 ] . replace ( /(\\)?"/g , "'" ) + '","author":' + split2 [ 1 ] ;
2022-01-27 19:21:26 +01:00
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 08:46:50 +02:00
}
2022-01-27 19:21:26 +01:00
} )
}
} ) ;
} catch ( err ) {
console . log ( err ) ;
}
2021-04-10 08:46:50 +02:00
}
let lay _paysocial = document . querySelector ( 'div.lay-PaySocial' ) ;
2022-11-17 17:20:50 +01:00
let ads = document . querySelectorAll ( 'div.iqadtile_wrapper' ) ;
removeDOMElement ( lay _paysocial , ... ads ) ;
2021-04-10 08:46:50 +02:00
}
2020-01-28 23:06:25 +01:00
}
2019-10-08 17:41:09 +02:00
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'freiepresse.de' ) ) {
let url = window . location . href ;
let article _teaser = document . querySelector ( 'div.article-teaser' ) ;
if ( article _teaser && url . match ( /(\-artikel)(\d){6,}/ ) ) {
2020-12-04 16:14:23 +01:00
window . setTimeout ( function ( ) {
2021-04-10 08:46:50 +02:00
window . location . href = url . replace ( '-artikel' , '-amp' ) ;
2022-03-08 19:04:50 +01:00
} , 500 ) ;
2021-04-10 08:46:50 +02:00
} else if ( url . match ( /(\-amp)(\d){6,}/ ) ) {
let amp _ads = document . querySelectorAll ( 'amp-fx-flying-carpet, amp-ad, amp-embed' ) ;
let pw _layer = document . querySelector ( '.pw-layer' ) ;
removeDOMElement ( ... amp _ads , pw _layer ) ;
}
2020-01-28 23:06:25 +01:00
}
2023-04-11 22:06:32 +02:00
else if ( matchDomain ( 'jacobin.de' ) ) {
let paywall = pageContains ( 'h3.m-auto' , 'Dieser Artikel ist nur mit Abo zugänglich.' ) ;
if ( paywall . length ) {
let slash = document . querySelector ( 'div.slash' ) ;
removeDOMElement ( paywall [ 0 ] . parentNode , slash ) ;
let json _script = document . querySelector ( 'script#__NEXT_DATA__' ) ;
if ( json _script ) {
try {
let json = JSON . parse ( json _script . text ) ;
if ( json && json . props . pageProps . sections && json . props . pageProps . sections [ 1 ] . content ) {
let url _next = json . query . slug ;
if ( url _next && ! window . location . pathname . includes ( url _next ) )
refreshCurrentTab ( ) ;
let pars = json . props . pageProps . sections [ 1 ] . content ;
let first _par = document . querySelector ( 'body > div#__next p.bodyText' ) ;
if ( first _par ) {
let par _class = first _par . getAttribute ( 'class' ) ;
let article = first _par . parentNode ;
if ( article ) {
let add _par = false ;
for ( let par of pars ) {
if ( ! add _par ) {
if ( par . type === 'paywall' )
add _par = true ;
} else {
if ( par . text ) {
let elem _type = 'p' ;
let elem _class = par _class ;
let elem _style ;
if ( [ 'paragraph' , 'quote' ] . includes ( par . type ) ) {
if ( par . type === 'quote' )
elem _style = 'font-size: 36px; font-weight: bold;' ;
} else if ( par . type === 'header' ) {
elem _type = 'h2' ;
elem _class = 'content-element font-headline h2 my-1em' ;
}
let content = par . text . replace ( / /g , '' ) ;
let parser = new DOMParser ( ) ;
2023-05-08 20:05:06 +02:00
let content _new = parser . parseFromString ( '<' + elem _type + ' class="' + elem _class + ( elem _style ? '" style="' + elem _style : '' ) + '">' + DOMPurify . sanitize ( content ) + '</' + elem _type + 'p>' , 'text/html' ) ;
2023-04-11 22:06:32 +02:00
article . appendChild ( content _new . querySelector ( elem _type ) ) ;
} else
console . log ( par ) ;
}
}
}
}
}
} catch ( err ) {
console . log ( err ) ;
}
}
}
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'krautreporter.de' ) ) {
2022-07-21 07:40:48 +02:00
let paywall = document . querySelector ( '.js-article-paywall' ) ;
2021-04-10 08:46:50 +02:00
if ( paywall ) {
2022-01-29 17:56:29 +01: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 19:04:50 +01:00
} , 500 ) ;
2021-04-10 08:46:50 +02:00
}
2020-01-28 23:06:25 +01:00
}
2021-12-07 19:25:48 +01:00
else if ( matchDomain ( [ 'ksta.de' , 'rundschau-online.de' ] ) ) {
2022-11-09 18:32:12 +01:00
let paywall = document . querySelector ( 'div[data-tm-placeholder]' ) ;
2021-12-07 19:25:48 +01:00
if ( paywall ) {
removeDOMElement ( paywall ) ;
2022-11-09 18:32:12 +01:00
let span _hidden = document . querySelector ( 'div.dm-paint' ) ;
2022-06-24 12:39:49 +02:00
if ( span _hidden )
2022-07-13 08:44:00 +02:00
span _hidden . removeAttribute ( 'class' ) ;
2023-02-08 21:58:02 +01:00
} else {
let paywall _new = document . querySelector ( 'div.paywalled-content' ) ;
if ( paywall _new )
paywall _new . removeAttribute ( 'class' ) ;
let wrapper = document . querySelector ( 'div.dm-paywall-wrapper' ) ;
removeDOMElement ( wrapper ) ;
2021-12-07 19:25:48 +01:00
}
2023-02-08 21:58:02 +01:00
let banners = document . querySelectorAll ( 'div.dm-slot, div[id^="taboola-feed"]' ) ;
2022-12-16 12:31:29 +01:00
removeDOMElement ( ... banners ) ;
2021-12-07 19:25:48 +01:00
}
2023-02-04 09:00:36 +01:00
else if ( matchDomain ( 'kurier.at' ) ) {
let paywall = document . querySelector ( 'div.plusContent' ) ;
if ( paywall ) {
paywall . classList . remove ( 'plusContent' ) ;
window . setTimeout ( function ( ) {
let elem _hidden = paywall . querySelectorAll ( '.ng-star-inserted[style="display: none;"]' ) ;
for ( let elem of elem _hidden )
elem . removeAttribute ( 'style' ) ;
} , 2000 ) ;
}
2023-02-05 14:25:33 +01:00
let banners = document . querySelectorAll ( 'div#view-offer, app-paywall, adfullbanner, outbrain' ) ;
2023-02-04 09:00:36 +01:00
removeDOMElement ( ... banners ) ;
}
2022-12-02 13:36:27 +01:00
else if ( matchDomain ( [ 'noz.de' , 'shz.de' , 'svz.de' ] ) ) {
if ( window . location . pathname . endsWith ( '/amp' ) ) {
2022-04-19 21:37:22 +02:00
amp _unhide _access _hide ( '="NOT data.reduced"' , '="data.reduced"' , 'amp-ad, amp-embed, .ads-wrapper, #flying-carpet-wrapper' ) ;
2021-04-10 08:46:50 +02:00
} else {
2022-12-17 16:48:04 +01:00
let ads = document . querySelectorAll ( 'div.nozmhn_ad' ) ;
2023-03-07 09:22:31 +01:00
hideDOMElement ( ... ads ) ;
2021-04-10 08:46:50 +02:00
}
2019-10-05 14:08:57 +02:00
}
2022-08-17 19:10:58 +02: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' ) ;
}
}
2022-11-23 16:56:53 +01:00
else if ( matchDomain ( 'nzz.ch' ) ) {
if ( ! window . location . href . includes ( '/amp/' ) ) {
let ads = document . querySelectorAll ( 'div.resor' ) ;
2023-03-07 09:22:31 +01:00
hideDOMElement ( ... ads ) ;
2022-11-23 16:56:53 +01:00
} else {
let amp _ads = document . querySelectorAll ( 'amp-ad' ) ;
removeDOMElement ( ... amp _ads ) ;
}
}
2023-01-02 12:04:51 +01:00
else if ( matchDomain ( 'philomag.de' ) ) {
let paywall = document . querySelector ( 'div[id^="block-paywall"]' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let json _script = getArticleJsonScript ( ) ;
if ( json _script ) {
let json = JSON . parse ( json _script . text ) ;
if ( json ) {
2023-01-28 11:10:24 +01:00
let json _text = json . articlebody . replace ( /%paywall%/g , '' ) . replace ( /(\\r)?\\n/g , '<br><br>' ) ;
2023-01-02 12:04:51 +01:00
let content = document . querySelector ( 'div.content-center > div.description' ) ;
if ( json _text && content ) {
content . innerHTML = '' ;
let article _new = document . createElement ( 'p' ) ;
article _new . innerText = json _text ;
content . appendChild ( article _new ) ;
}
}
}
}
}
2023-04-01 14:00:23 +02:00
else if ( matchDomain ( 'schwaebische.de' ) ) {
let url = window . location . href ;
let paywall = document . querySelector ( 'div.sve-paywall-wrapper' ) ;
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' ) ;
let body = document . querySelector ( 'body' ) ;
if ( body )
body . removeAttribute ( 'style' ) ;
waitDOMAttribute ( 'body' , 'body' , 'style' , node => node . removeAttribute ( 'style' ) , true ) ;
}
window . setTimeout ( function ( ) {
let ads = document . querySelectorAll ( 'div.fp-ad-placeholder' ) ;
hideDOMElement ( ... ads ) ;
} , 1000 ) ;
}
2023-02-19 13:45:20 +01:00
else if ( matchDomain ( 'spiegel.de' ) ) {
let url = window . location . href ;
let paywall = document . querySelector ( 'div[data-area="paywall"]' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let article = document . querySelector ( 'div[data-area="body"]' ) ;
if ( article )
article . firstChild . before ( archiveLink ( url ) ) ;
}
}
2023-07-20 19:10:52 +02:00
else if ( matchDomain ( [ 'stuttgarter-nachrichten.de' , 'stuttgarter-zeitung.de' , 'schwarzwaelder-bote.de' ] ) || matchDomain ( de _mhs _custom _domains ) ) {
2023-07-03 16:36:31 +02:00
let banner = document . querySelector ( 'div.mod-paywall' ) ;
removeDOMElement ( banner ) ;
}
2023-06-28 17:25:38 +02:00
else if ( matchDomain ( 'zeit.de' ) ) {
let url = window . location . href ;
let paywall = document . querySelector ( 'aside#paywall' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let article = document . querySelector ( 'div.article-body' ) ;
if ( article )
article . firstChild . before ( archiveLink ( url ) ) ;
let fade = document . querySelector ( 'div.paragraph--faded' ) ;
if ( fade )
fade . classList . remove ( 'paragraph--faded' ) ;
}
}
2023-02-25 14:20:33 +01:00
else if ( matchDomain ( de _lv _domains ) ) {
let paywall _topagrar = document . querySelector ( 'div > div.paywall-package' ) ;
let paywall _other = document . querySelector ( 'div[id^="paymentprocess-"]' ) ;
if ( paywall _topagrar || paywall _other ) {
if ( paywall _topagrar )
removeDOMElement ( paywall _topagrar . parentNode ) ;
else {
let intro = document . querySelector ( 'div.m-paywall__textFadeOut' ) ;
removeDOMElement ( paywall _other , intro ) ;
}
let div _hidden = document . querySelector ( 'div.paywall-full-content[style]' ) ;
if ( div _hidden ) {
div _hidden . removeAttribute ( 'class' ) ;
div _hidden . removeAttribute ( 'style' ) ;
}
}
let banners = document . querySelectorAll ( '.adZone' ) ;
removeDOMElement ( ... banners ) ;
}
2022-08-03 19:01:39 +02:00
else if ( matchDomain ( de _westfalen _medien _domains ) ) {
2021-10-01 15:28:11 +02:00
let url = window . location . href ;
if ( url . includes ( '/amp/' ) ) {
2021-11-30 17:36:15 +01:00
amp _unhide _subscr _section ( 'amp-ad, amp-embed, section[class^="fp-ad"]' ) ;
2021-10-29 08:48:52 +02:00
} else {
2022-08-03 19:01:39 +02:00
let paywall = document . querySelector ( '.fp-article-paywall' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
2021-10-29 08:48:52 +02:00
if ( paywall ) {
removeDOMElement ( paywall ) ;
2022-08-03 19:01:39 +02:00
if ( amphtml )
window . location . href = amphtml . href ;
2021-10-29 08:48:52 +02:00
}
2021-10-01 15:28:11 +02:00
}
}
2022-08-03 19:01:39 +02: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' ) ;
}
2023-02-22 17:26:02 +01:00
else if ( matchDomain ( de _madsack _domains ) || document . querySelector ( 'link[href*=".rndtech.de/"]' ) ) {
2023-01-31 22:36:41 +01:00
// plus code in contentScript_once_var.js (timing)
2023-01-14 17:35:16 +01:00
if ( ! window . location . search . startsWith ( '?outputType=valid_amp' ) ) {
2022-09-16 08:13:19 +02:00
let ads = document . querySelectorAll ( 'div[class^="Adstyled__AdWrapper"]' ) ;
2023-03-07 09:22:31 +01:00
hideDOMElement ( ... ads ) ;
2022-08-25 22:12:16 +02:00
} else {
2022-08-26 19:50:25 +02:00
ampToHtml ( ) ;
2021-04-24 09:37:20 +02:00
}
}
2023-07-21 10:41:57 +02:00
else if ( matchDomain ( de _vrm _domains ) || matchDomain ( de _vrm _custom _domains ) ) {
2023-02-25 14:20:33 +01:00
let url = window . location . href ;
let paywall = document . querySelector ( 'div.storyElementWrapper__paywallContainer' ) ;
let article = document . querySelector ( 'section[data-testid="storyPage-main-content"]' ) ;
2023-07-21 10:41:57 +02:00
if ( paywall && article && dompurify _loaded ) {
2023-02-25 14:20:33 +01:00
removeDOMElement ( paywall ) ;
fetch ( url )
. then ( response => {
if ( response . ok ) {
response . text ( ) . then ( html => {
if ( html . includes ( 'window.__INITIAL_STATE__=' ) ) {
let split1 = html . split ( 'window.__INITIAL_STATE__=' ) [ 1 ] ;
let state = ( split1 . split ( '};' ) [ 0 ] + '}' ) . split ( '</script>' ) [ 0 ] ;
if ( state ) {
try {
let json = JSON . parse ( state ) ;
if ( json ) {
let json _text = json . contentPage . data . context . storylineText ;
let pars = json _text . split ( /(?=<p>)/ ) ;
let page _items = json . contentPage . data . context . elements ;
if ( json _text && page _items ) {
2023-07-21 10:41:57 +02:00
let parser = new DOMParser ( ) ;
2023-02-25 14:20:33 +01:00
let n = 0 ;
let new _article = document . createElement ( 'div' ) ;
new _article . setAttribute ( 'style' , 'font-size: 17px; font-family:Calibri, Helvetica, Arial; margin: auto; max-width: 620px;' ) ;
for ( let item of page _items ) {
let elem = document . createElement ( 'p' ) ;
if ( item . type === 'paragraph' ) {
if ( pars [ n ] ) {
let par = pars [ n ] ;
n ++ ;
elem . innerText = par . replace ( /<\/?p>/g , '' ) ;
}
} else if ( item . type === 'subhead' ) {
if ( item . fields ) {
elem = document . createElement ( 'h2' ) ;
elem . appendChild ( document . createTextNode ( item . fields [ 0 ] . value ) ) ;
}
2023-07-21 10:41:57 +02:00
} else if ( item . type === 'multimediaIntro' ) {
if ( item . fields ) {
elem . appendChild ( document . createTextNode ( item . fields [ 0 ] . value ) ) ;
}
2023-02-25 14:20:33 +01:00
} else if ( item . type === 'internal_link' ) {
if ( item . relation ) {
let par _link = document . createElement ( 'a' ) ;
par _link . href = item . relation . href ;
par _link . innerText = item . relation . title ;
elem . appendChild ( par _link ) ;
}
2023-07-21 10:41:57 +02:00
} else if ( [ 'embed' , 'embed_code' ] . includes ( item . type ) ) {
2023-02-25 14:20:33 +01:00
let fields = item . fields [ 0 ] ;
if ( fields . name && fields . name === 'uri' && fields . value ) {
let par _link = document . createElement ( 'a' ) ;
par _link . href = fields . value ;
par _link . innerText = fields . value . split ( '?' ) [ 0 ] ;
par _link . target = '_blank' ;
elem . appendChild ( par _link ) ;
2023-07-21 10:41:57 +02:00
} else if ( fields . name && fields . name === 'basic' && fields . value ) {
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( fields . value , { ADD _TAGS : [ 'iframe' ] } ) + '</div>' , 'text/html' ) ;
let sub _item = doc . querySelector ( 'div' ) ;
elem . appendChild ( sub _item ) ;
2023-02-25 14:20:33 +01:00
}
2023-07-21 10:41:57 +02:00
} else if ( ! [ 'dateline' , 'gallery' , 'headline' , 'image' , 'infobox' , 'infobox_title' , 'infobox_paragraph' , 'leadtext' , 'linkbox' , 'linkbox_title' , 'relation' , 'quote' , 'quotebody' ] . includes ( item . type ) ) {
2023-02-25 14:20:33 +01:00
elem = '' ;
console . log ( item . type ) ;
console . log ( item ) ;
}
if ( elem )
new _article . appendChild ( elem ) ;
}
if ( new _article . hasChildNodes ( ) )
article . appendChild ( new _article ) ;
}
}
} catch ( err ) {
console . log ( err ) ;
}
}
}
} )
}
} )
}
2023-07-21 10:41:57 +02:00
let ads = document . querySelectorAll ( 'div.adSlot' ) ;
hideDOMElement ( ... ads ) ;
2023-02-25 14:20:33 +01:00
}
2022-11-23 16:56:53 +01:00
else if ( document . querySelector ( 'script[src^="https://assets.static-chmedia.ch/"]' ) ) { // nzz.ch regional/CH Media
let infobox _body = document . querySelector ( 'div.infobox__body' ) ;
if ( infobox _body )
infobox _body . removeAttribute ( 'class' ) ;
}
2021-12-22 19:03:54 +01:00
else
csDone = true ;
2022-11-20 16:09:38 +01:00
} else if ( window . location . hostname . match ( /\.(dk|fi|se)$/ ) ) { //denmark/finland/sweden
2021-12-22 19:03:54 +01:00
2023-07-07 09:05:26 +02:00
if ( matchDomain ( 'etc.se' ) ) {
2022-11-19 10:18:16 +01:00
let paywall = document . querySelector ( 'div.paywalled' ) ;
if ( paywall ) {
paywall . removeAttribute ( 'class' ) ;
let gradient = document . querySelector ( 'div.bg-gradient-white' ) ;
if ( gradient )
gradient . removeAttribute ( 'class' ) ;
let footer = document . querySelector ( 'footer' ) ;
removeDOMElement ( footer . parentNode ) ;
}
let ads = document . querySelectorAll ( 'div[class$="-ad"]' ) ;
removeDOMElement ( ... ads ) ;
let video _iframes = document . querySelectorAll ( 'div.embed-block > iframe[width][height]' ) ;
for ( let elem of video _iframes ) {
if ( elem . width > 1000 ) {
let ratio = elem . width / 640 ;
if ( window . navigator . userAgent . toLowerCase ( ) . includes ( 'mobile' ) )
ratio = elem . width / 320 ;
elem . width = elem . width / ratio ;
elem . height = elem . height / ratio ;
}
}
}
2021-12-22 19:03:54 +01:00
else if ( matchDomain ( 'nyteknik.se' ) ) {
let locked _article = document . querySelector ( 'div.locked-article' ) ;
if ( locked _article )
locked _article . classList . remove ( 'locked-article' ) ;
2022-11-05 15:09:46 +01:00
window . setTimeout ( function ( ) {
let hidden _images = document . querySelectorAll ( 'img[src=""][data-proxy-image]' ) ;
for ( let hidden _image of hidden _images )
hidden _image . setAttribute ( 'src' , hidden _image . getAttribute ( 'data-proxy-image' ) . replace ( '_320' , '_640' ) ) ;
} , 2000 ) ;
2021-12-22 19:03:54 +01:00
}
2022-08-01 21:25:50 +02: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 08:46:50 +02:00
else
2021-04-25 13:45:36 +02:00
csDone = true ;
2021-04-10 08:46:50 +02:00
2022-12-31 11:47:13 +01: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' , 'lavanguardia.com' , 'levante-emv.com' , 'marca.com' , 'mundodeportivo.com' , 'politicaexterior.com' ] ) ) { //spain/portugal
2021-04-10 08:46:50 +02:00
2022-08-15 18:05:49 +02:00
if ( matchDomain ( [ 'ara.cat' , 'arabalears.cat' ] ) ) {
2022-05-22 19:59:59 +02: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 ;
}
}
}
2023-07-11 08:31:13 +02:00
else if ( matchDomain ( [ 'cmjornal.pt' , 'record.pt' , 'sabado.pt' ] ) ) {
let paywall = document . querySelector ( '.bloqueio_exclusivos, .container_assinatura, .bloco_bloqueio' ) ;
2021-04-10 08:46:50 +02:00
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 {
2023-07-11 08:31:13 +02:00
amp _unhide _access _hide ( '="subscriber"' , '="NOT subscriber"' , 'amp-ad, amp-embed, amp-consent, .detalheAds, .exclusivos_bar' ) ;
2021-04-10 08:46:50 +02: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 23:06:25 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'elconfidencial.com' ) ) {
let premium = document . querySelector ( 'div.newsType__content--closed' ) ;
if ( premium )
premium . classList . remove ( 'newsType__content--closed' ) ;
2022-09-21 18:31:24 +02:00
let ads = document . querySelectorAll ( 'div[id^="mega_"], div[id^="roba_"]' ) ;
removeDOMElement ( ... ads ) ;
2020-07-09 19:52:37 +02:00
}
2021-12-12 18:32:28 +01:00
else if ( matchDomain ( 'eldiario.es' ) ) {
if ( window . location . pathname . endsWith ( '.amp.html' ) ) {
amp _unhide _access _hide ( '^="access"' ) ;
2022-01-18 20:16:52 +01:00
} else {
let ads = document . querySelectorAll ( '.edi-advertising, .header-ad' ) ;
removeDOMElement ( ... ads ) ;
2021-12-12 18:32:28 +01:00
}
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'elespanol.com' ) ) {
2021-12-12 18:32:28 +01:00
if ( window . location . pathname . endsWith ( '.amp.html' ) ) {
amp _unhide _subscr _section ( 'amp-ad, amp-embed' ) ;
} else {
2022-08-13 07:51:42 +02:00
let paywall = document . querySelector ( 'div.full-suscriptor-container' ) ;
2021-12-12 18:32:28 +01:00
let adverts = document . querySelectorAll ( '[id*="superior"], [class*="adv"]' ) ;
2022-08-13 07:51:42 +02:00
removeDOMElement ( paywall , ... adverts ) ;
2021-12-12 18:32:28 +01:00
}
2020-01-28 23:06:25 +01:00
}
2021-12-27 17:22:54 +01:00
else if ( matchDomain ( es _unidad _domains ) ) {
2021-04-10 08:46:50 +02:00
let premium = document . querySelector ( '.ue-c-article__premium' ) ;
let url = window . location . href ;
2022-08-04 07:57:25 +02:00
if ( ! window . location . hostname . match ( /^amp(-[a-z]{2})?\./ ) ) {
2021-04-10 08:46:50 +02:00
if ( premium ) {
removeDOMElement ( premium ) ;
2021-12-27 17:22:54 +01:00
window . location . href = url . replace ( '/www.' , '/amp.' ) ;
2021-04-10 08:46:50 +02:00
}
} else {
2021-11-30 17:36:15 +01:00
amp _unhide _access _hide ( '="authorized=true"' , '="authorized!=true"' ) ;
amp _unhide _subscr _section ( '.advertising, amp-embed, amp-ad' ) ;
2021-04-10 08:46:50 +02:00
}
}
else if ( matchDomain ( 'elpais.com' ) ) {
2021-10-08 08:11:56 +02:00
let login _register = document . querySelector ( '.login_register' ) ;
2022-04-21 19:52:47 +02: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 17:36:15 +01:00
removeDOMElement ( login _register ) ;
2021-04-10 08:46:50 +02:00
} else {
2021-10-07 19:37:31 +02:00
let counter = document . querySelector ( '#counterLayerDiv' ) ;
removeDOMElement ( counter ) ;
2021-12-27 17:22:54 +01:00
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
2022-04-21 19:52:47 +02:00
if ( login _register && amphtml ) {
2021-10-08 08:11:56 +02:00
removeDOMElement ( login _register , video ) ;
2021-04-10 08:46:50 +02:00
window . location . href = amphtml . href ;
}
}
let paywall _offer = document . querySelector ( '.paywallOffer' ) ;
2022-04-21 19:52:47 +02:00
let ctn _closed _article = document . querySelector ( '#ctn_closed_article, #ctn_freemium_article, #ctn_premium_article' ) ;
2021-10-08 08:11:56 +02:00
removeDOMElement ( paywall _offer , ctn _closed _article ) ;
2019-12-05 21:32:20 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'elperiodico.com' ) ) {
let url = window . location . href ;
if ( ! url . includes ( 'amp.elperiodico.com' ) ) {
let div _hidden = document . querySelector ( 'div.closed' ) ;
if ( div _hidden )
div _hidden . classList . remove ( 'closed' ) ;
else {
let paywall = document . querySelector ( '.ep-masPeriodico-info-login' ) ;
removeDOMElement ( paywall ) ;
if ( paywall )
window . location . href = url . replace ( 'www.' , 'amp.' ) ;
}
} else {
let not _logged = document . querySelector ( '.ep-masPeriodico-info-login' ) ;
if ( not _logged ) {
2021-11-30 17:36:15 +01:00
removeDOMElement ( not _logged ) ;
amp _unhide _access _hide ( '^="logged"' , '^="NOT logged"' ) ;
2021-04-10 08:46:50 +02:00
}
2020-12-04 16:14:23 +01:00
window . setTimeout ( function ( ) {
2021-04-10 08:46:50 +02:00
let amp _img = document . querySelectorAll ( 'amp-img > img' ) ;
for ( let elem of amp _img ) {
if ( elem . src )
elem . src = elem . src . replace ( 'amp.elperiodico.com/clip/' , 'estaticos-cdn.elperiodico.com/clip/' ) ;
}
2022-03-08 19:04:50 +01:00
} , 3000 ) ;
2021-04-10 08:46:50 +02:00
}
2020-01-28 23:06:25 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( es _grupo _vocento _domains ) ) {
2022-10-21 12:44:02 +02:00
let paywall = document . querySelector ( '.voc-paywall, .container-wall-exclusive, .cierre-suscripcion:not([style="display: none;"])' ) ;
2022-04-29 17:58:48 +02:00
if ( ! window . location . pathname . endsWith ( '_amp.html' ) ) {
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
2022-08-15 18:05:49 +02:00
if ( ! amphtml )
amphtml = { href : window . location . pathname . replace ( '.html' , '_amp.html' ) } ;
2023-02-22 20:07:36 +01:00
if ( paywall && amphtml && ! matchDomain ( [ 'diariovasco.com' , 'eldiariomontanes.es' ] ) ) {
2022-04-29 17:58:48 +02:00
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
2022-08-15 18:05:49 +02:00
} else {
2023-02-26 13:11:15 +01:00
let banners = document . querySelectorAll ( '.voc-advertising, div.ev-em-modal, span.mega-superior, .v-adv' ) ;
2022-08-15 18:05:49 +02:00
removeDOMElement ( ... banners ) ;
}
2022-04-29 17:58:48 +02:00
} else {
2023-02-26 13:11:15 +01:00
amp _unhide _access _hide ( '="result=\'ALLOW_ACCESS\'"' , '="result!=\'ALLOW_ACCESS\'"' , 'amp-ad, amp-embed, .v-adv' ) ;
2022-08-15 18:05:49 +02:00
removeDOMElement ( paywall ) ;
let body _top = document . querySelector ( 'body#top' ) ;
if ( body _top )
body _top . removeAttribute ( 'id' ) ;
2021-04-10 08:46:50 +02:00
}
2020-01-28 23:06:25 +01:00
}
2022-08-21 08:59:42 +02:00
else if ( matchDomain ( es _epiberica _domains ) || matchDomain ( es _epiberica _custom _domains ) ) {
2021-04-28 21:45:57 +02:00
if ( window . location . href . includes ( '.amp.html' ) ) {
2022-03-28 18:45:51 +02:00
let truncated = document . querySelector ( 'div.article-body--truncated' ) ;
if ( truncated )
truncated . classList . remove ( 'article-body--truncated' ) ;
2022-04-21 19:52:47 +02:00
amp _unhide _access _hide ( '="NOT access"], [amp-access="FALSE"' , '="access"' ) ;
2022-04-01 16:04:06 +02: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 18:50:33 +01:00
} else {
2022-04-01 16:04:06 +02:00
let ads = document . querySelectorAll ( 'div.commercial-up-full__wrapper, div.sidebar--sticky__space, div[data-bbnx-id*="cxense"]' ) ;
2022-03-06 20:09:00 +01:00
removeDOMElement ( ... ads ) ;
2021-04-28 21:45:57 +02:00
}
2020-01-28 23:06:25 +01:00
}
2022-12-31 11:47:13 +01:00
else if ( matchDomain ( [ 'lavanguardia.com' , 'mundodeportivo.com' ] ) ) {
2023-04-27 19:51:21 +02:00
let ads = document . querySelectorAll ( 'span.content-ad, span.hidden-ad, span.ad-unit, div.ad-div' ) ;
hideDOMElement ( ... ads ) ;
2022-11-22 17:25:01 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'observador.pt' ) ) {
2022-07-01 15:47:47 +02: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 13:02:44 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'politicaexterior.com' ) ) {
let paywall = document . querySelector ( 'div[class^="paywall-"]' ) ;
if ( paywall ) {
let article = document . querySelector ( 'div.entry-content-text' ) ;
2023-04-01 14:00:23 +02:00
let json = document . querySelector ( 'script[type="application/ld+json"]:not([class])' ) ;
2021-04-10 08:46:50 +02:00
if ( json ) {
2021-08-17 18:37:06 +02:00
let json _text = JSON . parse ( json . text ) . description . replace ( /&nbsp;/g , '' ) ;
2021-04-10 08:46:50 +02:00
let article _new = document . createElement ( 'div' ) ;
article _new . setAttribute ( 'class' , 'entry-content-text' ) ;
article _new . innerText = '\r\n' + json _text ;
article . parentNode . replaceChild ( article _new , article ) ;
}
removeDOMElement ( paywall ) ;
}
2020-01-05 16:31:22 +01:00
}
2021-04-10 08:46:50 +02:00
else
2021-04-25 13:45:36 +02:00
csDone = true ;
2020-01-05 17:08:07 +01:00
2023-05-28 09:34:59 +02:00
} else if ( ( window . location . hostname . endsWith ( '.fr' ) && ! matchDomain ( [ 'lemagit.fr' ] ) ) || matchDomain ( [ 'bienpublic.com' , 'connaissancedesarts.com' , 'journaldunet.com' , 'la-croix.com' , 'ledauphine.com' , 'legrandcontinent.eu' , 'lejsl.com' , 'lesinrocks.com' , 'lesoir.be' , 'loeildelaphotographie.com' , 'marianne.net' , 'nouvelobs.com' , 'parismatch.com' , 'science-et-vie.com' , 'sudinfo.be' ] . concat ( fr _groupe _nice _matin _domains ) ) ) { //france
2021-04-10 08:46:50 +02:00
if ( matchDomain ( 'alternatives-economiques.fr' ) ) {
window . setTimeout ( function ( ) {
let paywall = document . querySelector ( '#temp-paywall' ) ;
removeDOMElement ( paywall ) ;
let data _ae _poool = document . querySelector ( 'div[data-ae-poool]' ) ;
if ( data _ae _poool )
data _ae _poool . removeAttribute ( 'style' ) ;
2022-03-08 19:04:50 +01:00
} , 500 ) ;
2020-01-05 17:16:32 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'atlantico.fr' ) ) {
2021-06-16 21:39:14 +02:00
let paywall = document . querySelector ( 'div.markup[class*="Paywall"]' ) ;
2021-04-10 08:46:50 +02:00
if ( paywall )
2021-06-09 20:30:06 +02:00
paywall . setAttribute ( 'class' , 'markup' ) ;
2020-01-05 17:23:28 +01:00
}
2022-09-02 08:27:19 +02:00
else if ( matchDomain ( 'autoplus.fr' ) ) {
let ads = document . querySelectorAll ( 'div.placeholder-pub_dfp' ) ;
removeDOMElement ( ... ads ) ;
}
2023-03-14 17:00:17 +01:00
else if ( matchDomain ( [ 'challenges.fr' , 'sciencesetavenir.fr' ] ) ) {
2021-12-12 11:25:09 +01:00
if ( window . location . pathname . endsWith ( '.amp' ) ) {
amp _unhide _access _hide ( '="paywall.access OR cha.access"' , '="NOT (paywall.access OR cha.access)"' ) ;
} else {
2023-05-27 08:54:23 +02:00
let amorce = document . querySelector ( 'div.amorce.manual' ) ;
hideDOMElement ( amorce ) ;
2021-12-12 11:25:09 +01:00
let content = document . querySelectorAll ( '.user-paying-content' ) ;
2022-01-18 20:16:52 +01:00
for ( let elem of content ) {
2021-12-12 11:25:09 +01:00
elem . classList . remove ( 'user-paying-content' ) ;
2022-01-18 20:16:52 +01:00
elem . removeAttribute ( 'hidden' ) ;
}
2021-12-12 11:25:09 +01:00
let paywall = document . querySelector ( '.temp-paywall' ) ;
removeDOMElement ( paywall ) ;
2023-03-14 17:00:17 +01:00
let ads = document . querySelectorAll ( 'div[class^="pub-container"], div[id^="moneytag-"]' ) ;
hideDOMElement ( ... ads ) ;
2021-12-12 11:25:09 +01:00
}
2021-04-30 17:25:41 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'charliehebdo.fr' ) ) {
window . setTimeout ( function ( ) {
let paywalled _content = document . querySelector ( 'div.ch-paywalled-content' ) ;
if ( paywalled _content )
paywalled _content . removeAttribute ( 'style' ) ;
let poool _widget = document . querySelector ( 'div#poool-widget' ) ;
removeDOMElement ( poool _widget ) ;
2022-03-08 19:04:50 +01:00
} , 500 ) ;
2021-04-12 18:03:12 +02:00
}
2022-03-10 20:02:19 +01:00
else if ( matchDomain ( 'connaissancedesarts.com' ) ) {
let ads = document . querySelectorAll ( 'div.ad-container' ) ;
removeDOMElement ( ... ads ) ;
}
2021-10-24 19:01:46 +02:00
else if ( matchDomain ( 'elle.fr' ) ) {
2021-12-12 11:25:09 +01: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 19:01:46 +02:00
}
2022-09-24 18:54:10 +02:00
else if ( matchDomain ( fr _be _groupe _rossel ) ) {
2023-03-05 09:22:02 +01:00
if ( matchDomain ( 'sudinfo.be' ) ) {
let paywall = document . querySelector ( 'div.r-blurred' ) ;
if ( paywall ) {
let paywall _header = document . querySelector ( '.r-paywall--header' ) ;
let intro = document . querySelector ( 'div.r-not-blurred' ) ;
removeDOMElement ( paywall , paywall _header , intro ) ;
let json _script = getArticleJsonScript ( ) ;
if ( json _script ) {
let json = JSON . parse ( json _script . text ) ;
if ( json ) {
let json _text = json . articleBody . replace ( / /g , '' ) . replace ( /\[.*\]/ , '' ) ;
let content = document . querySelector ( 'article' ) ;
if ( json _text && content ) {
let par = document . createElement ( 'p' ) ;
par . innerText = '\r\n' + json _text ;
content . appendChild ( par ) ;
}
}
}
}
}
2022-09-27 18:04:08 +02:00
let ads = document . querySelectorAll ( 'div[id^="article_"], r-pub, div#rossel-leader-top' ) ;
2023-04-19 18:18:59 +02:00
hideDOMElement ( ... ads ) ;
2022-09-24 18:54:10 +02:00
}
2022-05-27 15:11:37 +02: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 08:46:50 +02:00
}
} else {
2021-12-01 18:33:33 +01:00
amp _unhide _access _hide ( '="access"' , '="NOT access"' , 'amp-ad, amp-embed' ) ;
2021-04-10 08:46:50 +02:00
}
2020-01-05 18:04:40 +01:00
}
2022-05-27 15:11:37 +02:00
else if ( matchDomain ( fr _groupe _la _depeche _domains ) ) {
if ( window . location . pathname . startsWith ( '/amp/' ) ) {
2021-11-30 17:36:15 +01:00
amp _unhide _subscr _section ( 'amp-ad, amp-embed' ) ;
2021-04-30 17:25:41 +02:00
} else {
let paywall = document . querySelector ( 'div.paywall' ) ;
2022-05-27 15:11:37 +02:00
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
2023-01-23 08:17:27 +01:00
if ( paywall ) {
2021-04-30 17:25:41 +02:00
removeDOMElement ( paywall ) ;
2023-01-23 08:17:27 +01:00
if ( amphtml )
window . location . href = amphtml . href ;
else {
let json _script = getArticleJsonScript ( ) ;
if ( json _script ) {
let json = JSON . parse ( json _script . text ) ;
if ( json ) {
let json _text = parseHtmlEntities ( json . articleBody ) ;
let content = document . querySelector ( 'div.article-full__body-content' ) ;
if ( json _text && content ) {
content . innerHTML = '' ;
let article _new = document . createElement ( 'p' ) ;
article _new . innerText = json _text ;
content . appendChild ( article _new ) ;
content . removeAttribute ( 'style' ) ;
content . removeAttribute ( 'data-state' ) ;
}
}
}
}
2021-04-30 17:25:41 +02:00
}
}
}
2022-05-27 15:11:37 +02:00
else if ( matchDomain ( fr _groupe _nice _matin _domains ) ) {
if ( window . location . pathname . startsWith ( '/amp/' ) ) {
2021-12-31 11:50:38 +01: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-"]' ) ;
2023-04-19 18:18:59 +02:00
hideDOMElement ( ... ads ) ;
2021-12-31 11:50:38 +01:00
}
2022-03-19 17:38:47 +01:00
else if ( matchDomain ( 'franc-tireur.fr' ) ) {
let paywall = document . querySelector ( '.paywall' ) ;
removeDOMElement ( paywall ) ;
}
2022-10-22 11:24:37 +02: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 09:32:53 +01:00
} else {
let banner = document . querySelector ( 'div.qiota' ) ;
removeDOMElement ( banner ) ;
2022-10-22 11:24:37 +02:00
}
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'journaldunet.com' ) ) {
let reg _wall = document . querySelector ( '.reg_wall' ) ;
removeDOMElement ( reg _wall ) ;
let entry _reg _wall = document . querySelector ( '.entry_reg_wall' ) ;
if ( entry _reg _wall ) {
entry _reg _wall . removeAttribute ( 'style' ) ;
}
2020-01-05 18:04:40 +01:00
}
2021-04-12 18:03:12 +02:00
else if ( matchDomain ( 'la-croix.com' ) ) {
2021-04-10 08:46:50 +02:00
let url = window . location . href ;
if ( ! url . includes ( 'la-croix.com/amp/' ) ) {
2022-11-11 07:26:34 +01:00
let ads = document . querySelectorAll ( 'div[class^="ads-wrapper-"]' ) ;
removeDOMElement ( ... ads ) ;
2021-04-10 08:46:50 +02:00
} else {
let paywall _block = document . querySelector ( '#paywall_block' ) ;
let amp _ads = document . querySelectorAll ( 'amp-ad, amp-embed' ) ;
removeDOMElement ( paywall _block , ... amp _ads ) ;
}
2020-01-05 18:04:40 +01:00
}
2021-04-30 17:25:41 +02:00
else if ( matchDomain ( 'lanouvellerepublique.fr' ) ) {
let alert _didacticiel = document . querySelector ( 'div.alert-didacticiel' ) ;
let loading = document . querySelectorAll ( 'span.loading' ) ;
removeDOMElement ( alert _didacticiel , ... loading ) ;
}
2023-01-04 18:58:20 +01:00
else if ( matchDomain ( 'lecourrierdesstrateges.fr' ) ) {
window . setTimeout ( function ( ) {
let paywall = document . querySelector ( 'div.jpw-truncate-btn' ) ;
2023-05-08 20:05:06 +02:00
if ( paywall && dompurify _loaded ) {
2023-01-04 18:58:20 +01:00
removeDOMElement ( paywall ) ;
let json _script = getArticleJsonScript ( ) ;
if ( json _script ) {
let json = JSON . parse ( json _script . text ) ;
if ( json ) {
let json _text = json . articleBody ;
let content = document . querySelector ( 'div.content-inner' ) ;
if ( json _text && content ) {
let parser = new DOMParser ( ) ;
2023-05-08 20:05:06 +02:00
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( json _text ) + '</div>' , 'text/html' ) ;
2023-01-04 18:58:20 +01:00
let content _new = doc . querySelector ( 'div' ) ;
content . parentNode . replaceChild ( content _new , content ) ;
let hidden _images = document . querySelectorAll ( 'img[src][srcset]' ) ;
for ( let elem of hidden _images )
elem . removeAttribute ( 'srcset' ) ;
let entry _content = document . querySelector ( 'div.entry-content[style]' ) ;
if ( entry _content )
entry _content . removeAttribute ( 'style' ) ;
}
}
}
}
} , 500 ) ;
}
2023-04-02 20:25:38 +02:00
else if ( matchDomain ( 'legrandcontinent.eu' ) ) {
let paywall = document . querySelector ( 'body.paywall, body.pw, body.softwall' ) ;
if ( paywall )
paywall . classList . remove ( 'paywall' , 'pw' , 'softwall' ) ;
2023-04-03 17:52:09 +02:00
let banners = document . querySelectorAll ( 'div#fix-pw, div.disposableBanner' ) ;
2023-04-02 20:25:38 +02:00
removeDOMElement ( ... banners ) ;
}
2022-11-10 08:44:10 +01:00
else if ( matchDomain ( [ 'lejdd.fr' , 'parismatch.com' , 'public.fr' ] ) ) {
2023-07-11 08:31:13 +02:00
let poool _banners = document . querySelectorAll ( '#poool-container, #poool-widget-content, #poool-widget' ) ;
2021-04-30 17:25:41 +02:00
let forbidden = document . querySelector ( '.forbidden' ) ;
2022-06-30 19:25:33 +02:00
let ads = document . querySelectorAll ( 'div[class^="lmn-"]' ) ;
2023-07-11 08:31:13 +02:00
removeDOMElement ( ... poool _banners , forbidden , ... ads ) ;
2021-04-30 17:25:41 +02: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 08:46:50 +02:00
}
2020-01-13 22:23:03 +01:00
}
2022-08-26 19:50:25 +02:00
else if ( matchDomain ( 'leparisien.fr' ) ) {
2022-08-28 20:54:15 +02:00
let paywall = document . querySelector ( 'div.paywall' ) ;
2022-08-26 19:50:25 +02: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 ;
}
}
}
2022-05-30 17:18:28 +02:00
else if ( matchDomain ( 'lesechos.fr' ) ) {
2023-01-09 17:05:06 +01:00
if ( window . location . pathname . startsWith ( '/amp/' ) ) {
2023-01-10 18:16:24 +01:00
ampToHtml ( ) ;
2022-03-07 22:56:06 +01:00
} else {
window . setTimeout ( function ( ) {
2022-06-07 07:56:20 +02:00
let abo _banner = document . querySelector ( 'div[class*="pgxf3b-2"]' ) ;
2022-10-01 12:35:59 +02:00
let ad _blocks = document . querySelectorAll ( '[class*="jzxvkd"]' ) ;
2022-10-19 21:28:47 +02:00
hideDOMElement ( ... ad _blocks ) ;
2023-05-08 20:05:06 +02:00
if ( abo _banner && dompurify _loaded ) {
2022-03-07 22:56:06 +01:00
removeDOMElement ( abo _banner ) ;
let url = window . location . href ;
let html = document . documentElement . outerHTML ;
try {
2023-04-06 19:39:32 +02:00
let split1 = html . split ( /window\.__REACT_QUERY_STATE__\s?=/ ) [ 1 ] ;
let state = split1 . split ( '</script>' ) [ 0 ] . trim ( ) . replace ( /;$/ , '' ) ;
2022-03-07 22:56:06 +01:00
let data = JSON . parse ( state ) ;
2023-04-06 19:39:32 +02:00
let data _article = data . queries [ 1 ] . state ;
2022-03-07 22:56:06 +01:00
let url _loaded = data _article . data . path ;
2023-04-06 19:39:32 +02:00
if ( url _loaded && ( ! url _loaded . slice ( - 7 ) . match ( /\d+/ ) || ! url . includes ( url _loaded . slice ( - 7 ) ) ) )
2023-01-11 19:36:19 +01:00
refreshCurrentTab ( ) ;
2023-04-06 19:39:32 +02:00
else {
let article = data _article . data . stripes [ 0 ] . mainContent [ 0 ] . data . description . replace ( /allowfullscreen='(true)?'/g , '' ) ;
let paywallNode = document . querySelector ( '.post-paywall' ) ;
if ( paywallNode ) {
let contentNode = document . createElement ( 'div' ) ;
let parser = new DOMParser ( ) ;
2023-05-08 20:05:06 +02:00
let article _html = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( article ) + '</div>' , 'text/html' ) ;
2023-04-06 19:39:32 +02:00
let article _par = article _html . querySelector ( 'div' ) ;
if ( article _par ) {
contentNode . appendChild ( article _par ) ;
contentNode . className = paywallNode . className ;
paywallNode . before ( contentNode ) ;
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;' ) ;
}
2022-03-07 22:56:06 +01:00
}
2020-05-01 17:50:15 +02:00
}
2023-04-06 19:39:32 +02:00
let styleElem = document . head . appendChild ( document . createElement ( 'style' ) ) ;
styleElem . innerHTML = ".post-paywall::after {height: auto !important;}" ;
2021-04-10 08:46:50 +02:00
}
2022-03-07 22:56:06 +01:00
} catch ( err ) {
2023-02-06 20:12:59 +01:00
console . log ( err ) ;
2020-05-02 15:46:52 +02:00
}
2021-04-10 08:46:50 +02:00
}
2022-03-08 19:04:50 +01:00
} , 500 ) ;
2022-03-07 22:56:06 +01:00
}
2020-01-28 23:06:25 +01:00
}
2021-12-22 19:03:54 +01:00
else if ( matchDomain ( 'lesinrocks.com' ) ) {
2022-04-19 21:37:22 +02:00
if ( window . location . search . match ( /(\?|&)amp/ ) ) {
2021-12-22 19:03:54 +01: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 ) ;
}
}
2023-06-24 08:21:13 +02:00
else if ( matchDomain ( 'letelegramme.fr' ) ) {
let paywall = document . querySelectorAll ( 'div.tlg-paywalled' ) ;
for ( let elem of paywall )
elem . classList . remove ( 'tlg-paywalled' ) ;
let ads = document . querySelectorAll ( 'div[id^="pub_"]' ) ;
hideDOMElement ( ... ads ) ;
}
2022-01-09 17:28:17 +01:00
else if ( matchDomain ( 'lexpress.fr' ) ) {
2022-12-09 17:08:18 +01:00
let ads = document . querySelectorAll ( 'div[class^="block_pub"], div.bottom-bar-full, div.tead, div.ban-bottom, div.placeholder--ban-atf' ) ;
2023-04-19 18:18:59 +02:00
hideDOMElement ( ... ads ) ;
2022-01-09 17:28:17 +01:00
}
2021-04-30 17:25:41 +02:00
else if ( matchDomain ( 'loeildelaphotographie.com' ) ) {
let paywall = document . querySelector ( '.paywall' ) ;
if ( paywall ) {
paywall . removeAttribute ( 'class' ) ;
}
let premium _pic _boxes = document . querySelectorAll ( '.premium-pic-box' ) ;
let banners = document . querySelectorAll ( '.membership-promo-container, .login_form_litle' ) ;
removeDOMElement ( ... premium _pic _boxes , ... banners ) ;
let blurred _images = document . querySelectorAll ( 'img[style*="blur"]' ) ;
for ( let blurred _image of blurred _images )
blurred _image . removeAttribute ( 'style' ) ;
}
2021-10-20 21:46:42 +02:00
else if ( matchDomain ( 'marianne.net' ) ) {
let paywall = document . querySelector ( 'div.paywall' ) ;
2023-05-08 20:05:06 +02:00
if ( paywall && dompurify _loaded ) {
2021-10-20 21:46:42 +02:00
let article _source = document . querySelector ( 'div.article-body[data-content-src]' ) ;
if ( article _source ) {
let article _text = decode _utf8 ( atob ( article _source . getAttribute ( 'data-content-src' ) ) ) ;
let parser = new DOMParser ( ) ;
2023-05-08 20:05:06 +02:00
let html = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( article _text ) + '</div>' , 'text/html' ) ;
2021-10-20 21:46:42 +02:00
let article = html . querySelector ( 'div' ) ;
article _source . innerHTML = '' ;
article _source . appendChild ( article ) ;
article _source . removeAttribute ( 'data-content-src' ) ;
}
removeDOMElement ( paywall ) ;
}
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'nouvelobs.com' ) ) {
let paywall = document . querySelector ( '.paywall' ) ;
removeDOMElement ( paywall ) ;
2023-04-19 18:18:59 +02:00
let fade = document . querySelector ( 'div.paywall--gradient-top' ) ;
if ( fade )
fade . classList . remove ( 'paywall--gradient-top' ) ;
2020-03-08 23:16:17 +01:00
}
2021-12-12 11:25:09 +01: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 08:01:28 +01:00
else if ( matchDomain ( [ 'sudouest.fr' , 'charentelibre.fr' , 'larepubliquedespyrenees.fr' ] ) ) {
2022-08-26 19:50:25 +02:00
let paywall = document . querySelectorAll ( '.visible-not-premium' ) ;
if ( paywall . length ) {
removeDOMElement ( ... paywall ) ;
2022-06-28 16:39:02 +02:00
let visible _premium = document . querySelectorAll ( 'div.visible-premium' ) ;
for ( let elem of visible _premium )
elem . classList . remove ( 'visible-premium' ) ;
2021-04-10 08:46:50 +02:00
}
window . setTimeout ( function ( ) {
let footer _premium = document . querySelector ( '.footer-premium' ) ;
2022-08-26 19:50:25 +02:00
let ads = document . querySelectorAll ( 'div.pub, div.ph-easy-subscription' ) ;
2023-04-19 18:18:59 +02:00
hideDOMElement ( footer _premium , ... ads ) ;
2022-03-08 19:04:50 +01:00
} , 500 ) ;
2020-03-21 15:48:04 +01:00
}
2022-11-30 16:29:53 +01:00
else if ( matchDomain ( 'lamontagne.fr' ) || document . querySelector ( 'ul.list-inline > li > a[href="https://www.centrefrance.com/"]' ) ) { // Groupe Centre France
let paywall = document . querySelector ( 'div#poool-widget' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let json _script = getArticleJsonScript ( ) ;
if ( json _script ) {
let json = JSON . parse ( json _script . text ) ;
if ( json ) {
let json _text = json . articleBody ;
let content = document . querySelector ( 'div.entry-content' ) ;
if ( json _text && content ) {
content . innerHTML = '' ;
let article _new = document . createElement ( 'p' ) ;
article _new . innerText = json _text ;
content . appendChild ( article _new ) ;
}
}
}
}
}
2021-04-10 08:46:50 +02:00
else
2021-04-25 13:45:36 +02:00
csDone = true ;
2020-03-30 19:59:29 +02:00
2022-02-13 18:55:16 +01:00
} else if ( window . location . hostname . endsWith ( '.it' ) || matchDomain ( [ 'eastwest.eu' , 'italian.tech' , 'limesonline.com' , 'quotidiano.net' ] ) ) { //italy
2020-03-30 20:50:55 +02:00
2021-04-10 08:46:50 +02:00
if ( matchDomain ( 'corriere.it' ) ) {
2021-12-12 13:21:28 +01:00
if ( window . location . pathname . endsWith ( '_amp.html' ) ) {
amp _unhide _subscr _section ( 'amp-ad, amp-embed' ) ;
} else {
2023-04-29 09:51:38 +02:00
if ( window . location . pathname . includes ( '_preview.shtml' ) && ! window . location . pathname . startsWith ( '/podcast/' ) ) {
2021-12-12 13:21:28 +01:00
window . setTimeout ( function ( ) {
2023-04-29 09:51:38 +02:00
window . location . href = window . location . pathname . replace ( '_preview.shtml' , '.shtml' ) ;
2022-03-08 19:04:50 +01:00
} , 500 ) ;
2021-12-12 13:21:28 +01:00
}
2021-04-10 08:46:50 +02:00
}
2020-04-04 19:42:04 +02:00
}
2022-05-29 08:38:45 +02: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 18:55:16 +01: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 07:36:22 +02:00
else if ( matchDomain ( 'gazzetta.it' ) ) {
2023-06-25 09:13:05 +02:00
function header _nofix ( header ) {
if ( header ) {
let nofix _div = document . createElement ( 'div' ) ;
nofix _div . setAttribute ( 'style' , 'margin: 20px; font-weight: bold; color: red;' ) ;
nofix _div . innerText = 'BPC > no fix' ;
header . appendChild ( nofix _div ) ;
}
}
2022-08-12 07:36:22 +02:00
if ( window . location . pathname . endsWith ( '_preview.shtml' ) ) {
2023-06-02 20:24:23 +02:00
let paywall = document . querySelector ( 'section.bck-freemium__wall' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
2023-06-25 09:13:05 +02:00
if ( ! window . location . search . startsWith ( '?reason=unauthenticated' ) ) {
window . location . href = window . location . pathname . replace ( '_preview' , '' ) + '?gaa_at=g' ;
} else {
let json _script = getArticleJsonScript ( ) ;
let header = document . querySelector ( 'div.content > h2' ) ;
if ( json _script ) {
let json = JSON . parse ( json _script . text ) ;
if ( json ) {
let json _text = json . articleBody . replace ( /(\s{3}| )/g , '\r\n\r\n' ) ;
let content = document . querySelector ( 'div.content > p.has-first-letter' ) ;
if ( json _text && content ) {
let content _new = document . createElement ( 'p' ) ;
content _new . innerText = json _text ;
content . parentNode . replaceChild ( content _new , content ) ;
let article _body = document . querySelector ( 'section.body-article' ) ;
if ( article _body )
article _body . style = 'height: auto;' ;
} else
header _nofix ( header ) ;
}
} else
header _nofix ( header ) ;
}
2023-06-02 20:24:23 +02:00
}
2022-08-26 19:50:25 +02:00
} else if ( window . location . pathname . endsWith ( '_amp.shtml' ) )
ampToHtml ( ) ;
2022-08-12 07:36:22 +02:00
}
2022-02-13 18:55:16 +01:00
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'ilfattoquotidiano.it' ) ) {
2021-09-03 12:35:25 +02:00
let url = window . location . href ;
if ( url . includes ( '/amp/' ) ) {
2023-02-23 12:46:03 +01:00
amp _unhide _subscr _section ( 'amp-ad, amp-embed, div#_4sVideoContainer' ) ;
2021-09-03 12:35:25 +02:00
let comments = document . querySelector ( 'div.content.comments' ) ;
2021-11-30 17:36:15 +01:00
removeDOMElement ( comments ) ;
2023-04-29 09:51:38 +02:00
} else if ( window . location . pathname . match ( /\/\d{4}\/\d{2}\/\d{2}\// ) ) {
2021-10-31 20:19:15 +01:00
let paywall = document . querySelector ( 'div.read-more' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
2023-04-29 09:51:38 +02:00
window . location . href = window . location . pathname + 'amp' ;
2021-01-11 18:49:09 +01:00
}
2021-09-03 12:35:25 +02:00
}
2020-04-25 17:18:12 +02:00
}
2021-12-29 16:54:49 +01: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 09:42:53 +02:00
else if ( matchDomain ( 'ilmanifesto.it' ) ) {
2023-03-15 19:01:46 +01:00
window . setTimeout ( function ( ) {
if ( window . location . pathname . match ( /((\w)+(\-)+){3,}/ ) ) {
let paywall = document . querySelector ( 'div[class^="PostPaywall_PostPaywall__"]' ) ;
2023-05-08 20:05:06 +02:00
if ( paywall && dompurify _loaded ) {
2023-03-15 19:01:46 +01:00
removeDOMElement ( paywall ) ;
let json _script = document . querySelector ( 'script#__NEXT_DATA__' ) ;
if ( json _script ) {
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 ( ) ;
2023-05-08 20:05:06 +02:00
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( article _new ) + '</div>' , 'text/html' ) ;
2023-03-15 19:01:46 +01:00
let content _new = doc . querySelector ( 'div' ) ;
article . appendChild ( content _new ) ;
}
} else
window . location . reload ( true ) ;
}
2022-06-06 09:42:53 +02:00
}
}
2023-03-15 19:01:46 +01:00
let service _page = document . querySelector ( 'div.service-page' ) ;
if ( service _page ) {
window . setTimeout ( function ( ) {
window . location . reload ( true ) ;
} , 1000 ) ;
}
} , 1000 ) ;
2022-06-06 09:42:53 +02:00
}
2023-05-18 08:22:47 +02:00
else if ( matchDomain ( [ 'iltirreno.it' , 'lanuovasardegna.it' ] ) || matchDomain ( [ 'gazzettadimodena.it' , 'gazzettadireggio.it' , 'lanuovaferrara.it' ] ) ) {
2022-07-13 16:29:59 +02:00
if ( window . location . pathname . includes ( '/news/' ) ) {
2022-07-17 09:25:31 +02:00
window . setTimeout ( function ( ) {
let banners = document . querySelectorAll ( 'div.MuiSnackbar-root, div.css-16cchgy' ) ;
removeDOMElement ( ... banners ) ;
} , 1000 ) ;
2022-07-13 16:29:59 +02:00
}
2022-07-02 09:46:39 +02:00
}
2021-12-12 13:21:28 +01: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 08:52:20 +02:00
else if ( matchDomain ( it _quotidiano _domains ) ) {
2023-02-22 20:07:36 +01:00
if ( window . location . pathname . endsWith ( '/amp' ) || window . location . search . startsWith ( '?amp' ) ) {
amp _unhide _access _hide ( '="c.customGranted"' , '="NOT c.customGranted"' , 'amp-ad, amp-embed, amp-fx-flying-carpet, .watermark-adv, .amp__watermark' ) ;
2021-12-12 13:21:28 +01:00
} else {
2023-02-22 20:07:36 +01:00
let paywall = document . querySelector ( 'div[data-testid="paywall-container"], div[class^="Paywall_paywall_"]' ) ;
2022-02-20 08:25:25 +01:00
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
2022-12-03 08:24:16 +01:00
if ( ! amphtml )
amphtml = { href : window . location . pathname + '/amp' } ;
2022-02-20 08:25:25 +01:00
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
2023-02-22 20:07:36 +01:00
} else {
let ads = document . querySelectorAll ( 'div[id^="div-gpt-ad"]' ) ;
removeDOMElement ( ... ads ) ;
2021-12-12 13:21:28 +01:00
}
2021-04-10 08:46:50 +02:00
}
2020-04-25 20:41:55 +02:00
}
2022-04-23 09:43:03 +02:00
else if ( matchDomain ( 'italiaoggi.it' ) ) {
let paywall = document . querySelector ( 'div.boxAbb' ) ;
2023-05-08 20:05:06 +02:00
if ( paywall && dompurify _loaded ) {
2022-04-23 09:43:03 +02:00
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 18:05:49 +02:00
let parser = new DOMParser ( ) ;
2023-02-11 09:20:49 +01:00
json _text = json _text . replace ( /&apos;/g , "'" ) . replace ( /;/g , '' ) ;
2023-05-08 20:05:06 +02:00
let doc = parser . parseFromString ( '<div><section>' + DOMPurify . sanitize ( json _text ) + '</section></div>' , 'text/html' ) ;
2022-08-15 18:05:49 +02:00
let content _new = doc . querySelector ( 'div' ) ;
content . parentNode . replaceChild ( content _new , content ) ;
2022-04-23 09:43:03 +02:00
}
}
}
}
}
}
2022-08-04 17:38:34 +02:00
else if ( matchDomain ( it _gedi _domains ) ) {
2023-06-24 08:37:37 +02:00
if ( matchDomain ( 'espresso.repubblica.it' ) ) {
2022-10-14 19:13:30 +02:00
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 {
2023-01-15 15:08:33 +01:00
amp _unhide _access _hide ( '="showContent"' , '="NOT (showContent)"' , 'amp-ad, amp-embed' ) ;
2023-01-10 18:16:24 +01:00
let logo = document . querySelector ( 'div.logo-container > a' ) ;
if ( logo ) {
logo . innerText = "L'Espresso" ;
logo . style . color = 'white' ;
}
2023-01-15 15:08:33 +01:00
let placeholders = document . querySelectorAll ( 'figure > amp-img[placeholder][src]' ) ;
for ( let elem of placeholders ) {
let img = document . createElement ( 'img' ) ;
img . src = elem . getAttribute ( 'src' ) ;
elem . parentNode . replaceChild ( img , elem ) ;
}
2023-01-10 18:16:24 +01:00
let inline _videos = document . querySelectorAll ( 'div.video-container > iframe[src]' ) ;
for ( let video of inline _videos ) {
let elem = document . createElement ( 'a' ) ;
elem . href = video . src ;
elem . innerText = '>>> external video-link' ;
elem . target = '_blank' ;
video . parentNode . replaceChild ( elem , video ) ;
}
2022-10-14 19:13:30 +02:00
}
2022-08-04 17:38:34 +02:00
} else {
2022-10-07 15:39:52 +02:00
if ( ! window . location . pathname . match ( /\amp(\/)?$/ ) ) {
2022-11-12 18:13:45 +01:00
let paywall = document . querySelector ( 'div#paywall' ) ;
2022-08-04 17:38:34 +02:00
let ads = document . querySelectorAll ( 'div[id^="adv"]' ) ;
2022-11-12 18:13:45 +01:00
removeDOMElement ( paywall , ... ads ) ;
2022-11-12 08:39:05 +01:00
} else
ampToHtml ( ) ;
2021-04-10 08:46:50 +02:00
}
2020-05-27 07:41:46 +02:00
}
2023-07-20 08:08:39 +02:00
else if ( matchDomain ( 'money.it' ) ) {
if ( ! window . location . search . startsWith ( '?page=amp' ) ) {
let paywall = document . querySelector ( 'div#paywall' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let article _id _dom = document . querySelector ( 'div[data-idarticle]' ) ;
if ( article _id _dom ) {
let article _id = article _id _dom . getAttribute ( 'data-idarticle' ) ;
window . location . href = 'https://www.money.it/?page=amp&id_article=' + article _id ;
}
}
}
}
2021-04-10 08:46:50 +02:00
else
2021-04-25 13:45:36 +02:00
csDone = true ;
2021-04-10 08:46:50 +02:00
2023-03-29 13:03:10 +02:00
} else if ( window . location . hostname . match ( /\.(be|nl)$/ ) || matchDomain ( [ 'artsenkrant.com' , 'lavenir.net' ] ) ) { //belgium/netherlands
if ( matchDomain ( be _groupe _ipm _domains ) ) {
let paywall = document . querySelector ( 'div.is-preview' ) ;
if ( paywall ) {
paywall . classList . remove ( 'is-preview' ) ;
window . setTimeout ( function ( ) {
let div _hidden = document . querySelector ( 'div.is-hidden' ) ;
if ( div _hidden )
div _hidden . classList . remove ( 'is-hidden' ) ;
} , 1000 ) ;
}
let ads = document . querySelectorAll ( 'div.ap-AdContainer, div.ap-Outbrain' ) ;
2023-04-19 18:18:59 +02:00
hideDOMElement ( ... ads ) ;
2023-03-29 13:03:10 +02:00
}
2021-04-10 08:46:50 +02:00
2023-03-29 13:03:10 +02:00
else if ( matchDomain ( 'fd.nl' ) ) {
2023-01-17 12:16:38 +01:00
let reg _modal = document . querySelector ( 'div.modal.upsell' ) ;
if ( reg _modal )
refreshCurrentTab ( ) ;
2020-06-14 18:37:06 +02:00
}
2020-06-18 20:55:18 +02:00
else if ( matchDomain ( 'ftm.nl' ) ) {
2022-09-09 14:30:20 +02:00
let banners = document . querySelectorAll ( 'div.banner-pp, a.readmore' ) ;
removeDOMElement ( ... banners ) ;
2020-06-18 20:55:18 +02:00
}
2023-02-16 12:20:18 +01:00
else if ( matchDomain ( be _roularta _domains ) ) {
2022-07-04 20:35:30 +02:00
let paywall = document . querySelector ( 'div[id*="wall-modal"]' ) ;
2021-05-14 17:40:51 +02:00
if ( paywall ) {
removeDOMElement ( paywall ) ;
2022-10-26 18:34:57 +02:00
let html = document . querySelector ( 'html[class]' ) ;
if ( html )
html . removeAttribute ( 'class' ) ;
2023-02-16 12:20:18 +01:00
function roularta _noscroll ( node ) {
2022-06-27 17:13:29 +02:00
node . removeAttribute ( 'style' ) ;
node . removeAttribute ( 'class' ) ;
}
2023-02-16 12:20:18 +01:00
waitDOMAttribute ( 'html' , 'html' , 'class' , roularta _noscroll , true ) ;
2022-07-04 20:35:30 +02:00
let intro = document . querySelectorAll ( 'div.article-body > p, div.article-body > style' ) ;
removeDOMElement ( ... intro ) ;
2023-02-16 12:20:18 +01:00
let locked = document . querySelector ( 'body.locked' ) ;
if ( locked )
locked . classList . remove ( 'locked' ) ;
2021-04-10 08:46:50 +02:00
}
2023-04-26 17:50:00 +02:00
if ( ! window . navigator . userAgent . toLowerCase ( ) . includes ( 'chrome' ) && ! matchDomain ( [ 'artsenkrant.com' , 'kw.be' ] ) && window . location . href . match ( /\/((\w)+(\-)+){3,}/ ) ) {
let lazy _images = document . querySelectorAll ( '[src^="data:image/"][data-lazy-src]' ) ;
for ( let elem of lazy _images ) {
elem . src = elem . getAttribute ( 'data-lazy-src' ) ;
}
}
let ads = document . querySelectorAll ( 'div.rmgAd' ) ;
hideDOMElement ( ... ads ) ;
2020-06-28 17:41:37 +02:00
}
2023-07-08 08:09:47 +02:00
else if ( matchDomain ( [ 'lc.nl' , 'dvhn.nl' ] ) || document . querySelector ( 'link[href*=".ndcmediagroep.nl/"]' ) ) {
2023-02-15 08:44:39 +01:00
if ( true ) {
2023-03-01 08:46:00 +01:00
let paywall = document . querySelector ( 'div.signupPlus, div.pw-wrapper' ) ;
2023-05-08 20:05:06 +02:00
if ( paywall && dompurify _loaded ) {
2023-01-17 12:16:38 +01:00
let intro = document . querySelector ( 'div.startPayWall' ) ;
removeDOMElement ( paywall , intro ) ;
let html = document . documentElement . outerHTML ;
if ( html . includes ( 'window.__NUXT__=' ) ) {
let json = html . split ( 'window.__NUXT__=' ) [ 1 ] . split ( '</script>' ) [ 0 ] . trim ( ) ;
2023-07-22 08:17:09 +02:00
let url _nuxt = json . match ( /[(,]null,/ ) ? json . split ( /[(,]null,/ ) [ 1 ] . match ( /\d+\.(html|ece)/ ) [ 0 ] : false ;
if ( url _nuxt && ! window . location . pathname . includes ( url _nuxt ) )
2023-01-17 12:16:38 +01:00
refreshCurrentTab ( ) ;
2023-01-17 18:20:17 +01:00
else if ( json . includes ( ',body:' ) ) {
2023-05-26 16:29:58 +02:00
let json _text = json . split ( ',body:' ) [ 1 ] . split ( /,(leadText|brand_key|tts):/ ) [ 0 ] . replace ( /([{,])([a-zA-Z_0-9]+\d?):/g , "$1\"$2\":" ) . replace ( /\":(\[)?([\w\$\.]+)([\]},])/g , "\":$1\"$2\"$3" ) ;
2023-01-30 17:57:29 +01:00
let article = document . querySelector ( 'div.content' ) ;
if ( article ) {
article . innerHTML = '' ;
try {
let pars = JSON . parse ( json _text ) ;
2023-05-07 19:01:23 +02:00
function addParText ( elem , par _text , add _br = false ) {
2023-05-13 19:13:03 +02:00
if ( par _text . length > 2 ) {
2023-05-07 19:01:23 +02:00
let span = document . createElement ( 'span' ) ;
span . innerText = par _text ;
elem . appendChild ( span ) ;
if ( add _br )
elem . appendChild ( document . createElement ( 'br' ) ) ;
}
}
2023-01-30 17:57:29 +01:00
for ( let par of pars ) {
let elem = document . createElement ( 'p' ) ;
if ( par . typename === 'HTMLCustomEmbed' ) {
if ( par . code ) {
let parser = new DOMParser ( ) ;
2023-05-26 16:29:58 +02:00
let article _html = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( par . code , { ADD _TAGS : [ 'iframe' ] } ) + '</div>' , 'text/html' ) ;
2023-01-30 17:57:29 +01:00
elem = article _html . querySelector ( 'div' ) ;
}
2023-03-01 08:46:00 +01:00
} else if ( par . insertbox _head || par . insertbox _text ) {
if ( par . insertbox _head && par . insertbox _head . length > 2 ) {
2023-05-07 19:01:23 +02:00
addParText ( elem , par . insertbox _head , true ) ;
2023-01-30 17:57:29 +01:00
}
if ( par . insertbox _text ) {
for ( let item of par . insertbox _text ) {
if ( item . children ) {
for ( let child of item . children ) {
2023-02-03 13:29:41 +01:00
if ( child . text ) {
2023-05-07 19:01:23 +02:00
addParText ( elem , child . text , true ) ;
2023-05-17 18:14:27 +02:00
} else if ( child . href && child . href . length > 2 ) {
let par _link = document . createElement ( 'a' ) ;
par _link . href = child . href ;
par _link . innerText = child . children [ 0 ] . text ;
elem . appendChild ( par _link ) ;
2023-06-27 12:26:17 +02:00
elem . appendChild ( document . createElement ( 'br' ) ) ;
2023-02-03 13:29:41 +01:00
} else if ( child . children ) {
for ( let sub _child of child . children ) {
if ( sub _child . text ) {
2023-05-07 19:01:23 +02:00
addParText ( elem , sub _child . text ) ;
} else if ( sub _child . children && sub _child . children . length && sub _child . children [ 0 ] . text ) {
addParText ( elem , sub _child . children [ 0 ] . text ) ;
2023-02-03 13:29:41 +01:00
}
}
}
2023-01-30 17:57:29 +01:00
}
}
}
}
} else if ( par . text ) {
2023-05-07 19:01:23 +02:00
addParText ( elem , par . text ) ;
2023-01-30 17:57:29 +01:00
} else if ( par . children ) {
for ( let child of par . children ) {
2023-05-26 16:29:58 +02:00
if ( child . relation ) {
if ( child . type === 'img' && child . relation . href ) {
let figure = document . createElement ( 'figure' ) ;
let img = document . createElement ( 'img' ) ;
img . src = child . relation . href ;
figure . appendChild ( img ) ;
if ( child . relation . caption && child . relation . caption . length > 2 ) {
let caption = document . createElement ( 'figcaption' ) ;
caption . innerText = item . caption ;
figure . appendChild ( caption ) ;
}
elem . appendChild ( figure ) ;
2023-06-02 20:24:23 +02:00
} else if ( child . relation . link && child . relation . link . length > 2 && ( ( child . relation . title && child . relation . title . length > 2 ) || child . relation . imageAlt ) ) {
2023-05-26 16:29:58 +02:00
let par _link = document . createElement ( 'a' ) ;
par _link . href = child . relation . link ;
2023-06-27 12:26:17 +02:00
par _link . innerText = child . relation . title . length > 2 ? child . relation . title : ( child . relation . imageAlt . length > 2 ? child . relation . imageAlt : child . relation . link ) ;
2023-05-26 16:29:58 +02:00
elem . appendChild ( par _link ) ;
}
} else if ( child . text ) {
2023-05-07 19:01:23 +02:00
addParText ( elem , child . text ) ;
2023-03-15 19:01:46 +01:00
} else if ( child . children && child . children . length && child . children [ 0 ] . text && child . children [ 0 ] . text . length > 2 ) {
2023-05-07 19:01:23 +02:00
if ( ( child . href && child . href . length > 2 ) || ( child . relation && child . relation . follow && child . relation . follow . url ) ) {
2023-03-15 19:01:46 +01:00
let par _link = document . createElement ( 'a' ) ;
par _link . href = child . href || child . relation . follow . url ;
par _link . innerText = child . children [ 0 ] . text ;
elem . appendChild ( par _link ) ;
} else {
2023-05-07 19:01:23 +02:00
addParText ( elem , child . children [ 0 ] . text ) ;
2023-03-01 08:46:00 +01:00
}
2023-01-30 17:57:29 +01:00
}
2023-01-17 12:16:38 +01:00
}
2023-01-30 17:57:29 +01:00
} else if ( par . typename . length > 2 )
2023-03-15 19:01:46 +01:00
console . log ( par ) ;
2023-01-30 17:57:29 +01:00
if ( elem . hasChildNodes ( ) ) {
article . appendChild ( elem ) ;
2023-01-17 12:16:38 +01:00
}
}
2023-01-30 17:57:29 +01:00
} catch ( err ) {
console . log ( err ) ;
2023-01-17 12:16:38 +01:00
}
}
2023-01-17 18:20:17 +01:00
}
2023-01-17 12:16:38 +01:00
}
}
}
2023-02-15 08:44:39 +01:00
let ads = document . querySelectorAll ( '.top__ad, .marketingblock-article' ) ;
removeDOMElement ( ... ads ) ;
2021-04-10 08:46:50 +02:00
}
2021-06-20 21:41:11 +02:00
else if ( matchDomain ( nl _mediahuis _region _domains ) ) {
2021-04-10 08:46:50 +02:00
window . setTimeout ( function ( ) {
let close _button = document . querySelector ( 'button[data-testid="button-close"]' ) ;
if ( close _button )
close _button . click ( ) ;
let premium = document . querySelector ( 'div.common-components-plus_pluslabel--container' ) ;
2023-05-08 20:05:06 +02:00
if ( premium && dompurify _loaded ) {
2021-04-10 08:46:50 +02:00
let hidden _article = document . querySelector ( 'div[data-auth-body="article"]' ) ;
if ( hidden _article )
hidden _article . removeAttribute ( 'style' ) ;
let paywall = document . querySelector ( 'div[data-auth-root="paywall"]' ) ;
removeDOMElement ( paywall ) ;
let auth _body = document . querySelector ( 'div[data-auth-body="article"]' ) ;
2021-06-20 21:41:11 +02:00
if ( paywall && auth _body ) {
2021-04-10 08:46:50 +02:00
let auth _body _par _count = auth _body . querySelectorAll ( 'p' ) ;
if ( auth _body _par _count . length < 2 ) {
2021-08-18 18:15:00 +02:00
let json _script = document . querySelector ( 'script[data-fragment-type="PacoArticleContent"]' ) ;
let json _str = json _script . text . substring ( json _script . textContent . indexOf ( '{' ) ) ;
2021-04-10 08:46:50 +02:00
try {
2021-08-18 18:15:00 +02:00
let json = JSON . parse ( json _str ) ;
let article = Object . values ( json ) [ 0 ] [ 'data' ] [ 'article' ] [ 'body' ] ;
2021-04-10 08:46:50 +02:00
auth _body . innerHTML = '' ;
2021-06-20 21:41:11 +02:00
let par _html , par _dom , par _elem , par _div , par _key ;
2021-04-10 08:46:50 +02:00
let parser = new DOMParser ( ) ;
for ( let par of article ) {
for ( let key in par ) {
par _dom = document . createElement ( 'p' ) ;
par _elem = '' ;
par _key = par [ key ] ;
if ( key === 'subhead' ) {
2023-05-08 20:05:06 +02:00
par _html = parser . parseFromString ( '<div><strong>' + DOMPurify . sanitize ( par _key ) + '</strong></div>' , 'text/html' ) ;
2021-06-27 09:56:42 +02:00
par _elem = par _html . querySelector ( 'div' ) ;
2021-04-10 08:46:50 +02:00
} else if ( key === 'twitter' || key === 'instagram' ) {
par _elem = document . createElement ( 'a' ) ;
Object . assign ( par _elem , {
href : par _key ,
2021-06-27 09:56:42 +02:00
innerText : par _key . split ( '?' ) [ 0 ] ,
2021-04-10 08:46:50 +02:00
target : '_blank'
} ) ;
} else if ( key === 'youtube' ) {
par _elem = document . createElement ( 'iframe' ) ;
Object . assign ( par _elem , {
src : 'https://www.youtube.com/embed/' + par _key . id ,
id : 'ytplayer' ,
type : 'text/html' ,
width : 640 ,
height : 360 ,
frameborder : 0
} ) ;
} else if ( key === 'streamone' ) {
par _elem = document . createElement ( 'iframe' ) ;
Object . assign ( par _elem , {
src : 'https://content.tmgvideo.nl/embed/item=' + par _key . id ,
type : 'text/html' ,
width : 640 ,
height : 360 ,
frameborder : 0
} ) ;
} else if ( key === 'image' ) {
par _elem = document . createElement ( 'div' ) ;
let par _img = document . createElement ( 'img' ) ;
par _img . src = par _key . url ;
2021-07-05 19:45:08 +02:00
par _elem . appendChild ( par _img ) ;
2021-04-10 08:46:50 +02:00
par _div = document . createElement ( 'div' ) ;
par _div . innerText = par [ key ] . caption ? par [ key ] . caption : '' ;
par _div . innerText += par [ key ] . credit ? '\n' + par [ key ] . credit : '' ;
par _elem . appendChild ( par _div ) ;
} else {
2023-05-08 20:05:06 +02:00
par _html = parser . parseFromString ( '<p style="font-size: 18px; line-height: 1.625;">' + DOMPurify . sanitize ( par _key ) + '</div>' , 'text/html' ) ;
2021-08-18 18:15:00 +02:00
par _elem = par _html . querySelector ( 'p' ) ;
2020-07-04 13:33:25 +02:00
}
2021-04-10 08:46:50 +02:00
if ( par _elem )
par _dom . appendChild ( par _elem ) ;
auth _body . appendChild ( par _dom ) ;
}
2020-07-04 13:33:25 +02:00
}
2021-04-10 08:46:50 +02:00
} catch ( err ) {
2021-06-20 21:41:11 +02:00
console . warn ( 'unable to parse text' ) ;
2021-04-10 08:46:50 +02:00
console . warn ( err ) ;
}
2020-07-04 13:33:25 +02:00
}
2021-04-10 08:46:50 +02:00
}
}
2022-03-08 19:04:50 +01:00
} , 500 ) ;
2020-07-22 19:38:49 +02:00
}
2023-06-30 18:43:00 +02:00
else if ( matchDomain ( nl _dpg _adr _domains . concat ( [ 'hln.be' ] ) ) ) {
2022-11-09 17:58:21 +01:00
let url = window . location . href ;
let paywall = document . querySelector ( 'div#remaining-paid-content' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let article = document . querySelector ( 'div.article__body' ) ;
if ( article )
2023-01-25 18:46:53 +01:00
article . firstChild . before ( archiveLink ( url ) ) ;
2022-11-09 17:58:21 +01:00
}
}
2022-08-04 12:38:00 +02:00
else if ( matchDomain ( nl _dpg _media _domains ) ) {
2022-05-04 17:58:35 +02: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 08:46:50 +02:00
else if ( matchDomain ( 'nrc.nl' ) ) {
2023-05-19 18:58:33 +02:00
let banners = document . querySelectorAll ( 'div[id$="modal__overlay"], div.header__subscribe-bar, div.banner' ) ;
removeDOMElement ( ... banners ) ;
2020-07-25 09:06:49 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'telegraaf.nl' ) ) {
if ( window . location . href . startsWith ( 'https://www.telegraaf.nl/error?ref=/' ) ) {
2020-08-02 12:35:09 +02:00
window . setTimeout ( function ( ) {
2021-04-10 08:46:50 +02:00
window . location . href = window . location . href . split ( '&' ) [ 0 ] . replace ( 'error?ref=/' , '' ) ;
} , 500 ) ;
}
let refresh = document . querySelector ( 'div[id="content"] > meta[http-equiv="refresh"]' ) ;
if ( refresh ) {
2020-12-04 16:56:48 +01:00
window . setTimeout ( function ( ) {
2021-04-10 08:46:50 +02:00
window . location . reload ( true ) ;
} , 500 ) ;
}
2023-07-11 20:23:19 +02:00
let paywall = document . querySelector ( 'div.MeteringNotification__backdrop, data-hydrate[data-name="PaywallHandler"]' ) ;
2023-07-16 21:57:12 +02:00
let article _body = document . querySelector ( 'div.DetailBodyBlocks, section.TextArticlePage__imageWrapper, section > div.DetailArticleImage' ) ;
2023-06-29 15:41:00 +02:00
if ( paywall && article _body ) {
let div _main = document . createElement ( 'div' ) ;
div _main . style = 'margin: 20px 0px;' ;
let div _elem = document . createElement ( 'div' ) ;
let par _style = 'font-weight: normal; font-size: 16px; line-height: 1.5;' ;
2023-07-19 12:31:04 +02:00
let scripts = document . querySelectorAll ( 'script:not([src]):not([type])' ) ;
2023-06-29 15:41:00 +02:00
let apollo _script ;
for ( let script of scripts ) {
if ( script . text . includes ( 'window.__APOLLO_STATE__=' ) ) {
apollo _script = script ;
break ;
}
}
if ( apollo _script ) {
2023-06-02 13:43:48 +02:00
removeDOMElement ( paywall ) ;
try {
2023-06-29 15:41:00 +02:00
let apollo _json = JSON . parse ( apollo _script . text . replace ( /(^window.__APOLLO_STATE__=|;$)/g , '' ) ) ;
let start = false ;
for ( let key in apollo _json ) {
let elem = apollo _json [ key ] ;
if ( ! start ) {
if ( key . includes ( '.introBlocks.' ) )
start = true ;
} else {
let typename = elem . _ _typename ;
if ( key . startsWith ( 'Article:' ) || [ 'ArticleAuthorBiography' ] . includes ( typename ) )
break ;
else {
let par = document . createElement ( 'p' ) ;
if ( typename === 'HtmlBlock' ) {
let item = document . createElement ( 'p' ) ;
item . innerText = elem . contentHTML . replace ( /((<|\\u003c)([^>]+)(>|\\u003e))/gi , '' ) ;
item . style = par _style ;
par . appendChild ( item ) ;
} else if ( typename === 'SubheadBlock' ) {
let item = document . createElement ( 'p' ) ;
item . innerText = elem . text . replace ( /((<|\\u003c)([^>]+)(>|\\u003e))/gi , '' ) ;
item . style = par _style ;
par . appendChild ( item ) ;
} else if ( typename === 'Image' ) {
let figure = document . createElement ( 'figure' ) ;
let img = document . createElement ( 'img' ) ;
img . src = elem . url . startsWith ( 'https:' ) ? elem . url : 'https:' + elem . url ;
img . width = ! mobile ? 640 : 320 ;
figure . appendChild ( img ) ;
if ( elem . description ) {
let caption = document . createElement ( 'figcaption' ) ;
caption . innerText = elem . description + ( elem . copyright ? ' | ' + elem . copyright : '' ) ;
figure . appendChild ( caption ) ;
}
par . appendChild ( figure ) ;
} else if ( typename === 'Article' ) {
let item = document . createElement ( 'a' ) ;
item . href = elem . url . startsWith ( 'https:' ) ? elem . url : 'https:' + elem . url ;
item . innerText = elem . title ;
par . appendChild ( item ) ;
} else if ( ! [ 'ImageBlock' , 'InlineRelatedArticlesBlock' , 'Video' , 'Webshop' ] . includes ( typename ) )
console . log ( elem ) ;
if ( par . childNodes ) {
div _main . appendChild ( par ) ; ;
}
}
}
}
} catch ( err ) {
console . log ( err ) ;
}
} else {
let json _script = getArticleJsonScript ( ) ;
if ( json _script ) {
removeDOMElement ( paywall ) ;
try {
let json = JSON . parse ( json _script . text ) ;
if ( json ) {
let json _text = json . articleBody ;
if ( json _text ) {
let intro = document . querySelector ( 'span[id^="articleIntro"], p.Article__intro > span' ) ;
if ( intro )
json _text = json _text . replace ( intro . innerText + '\n\n' , '' ) ;
2023-06-02 13:43:48 +02:00
let text _array = json _text . split ( '\\n' ) ;
text _array . forEach ( p _text => {
let p _div = document . createElement ( 'p' ) ;
p _div . innerText = p _text ;
2023-06-29 15:41:00 +02:00
p _div . style = par _style ;
2023-06-02 13:43:48 +02:00
div _elem . appendChild ( p _div ) ;
} ) ;
div _main . appendChild ( div _elem ) ;
}
}
2023-06-29 15:41:00 +02:00
} catch ( err ) {
console . log ( err ) ;
2021-08-04 19:57:08 +02:00
}
2021-04-10 08:46:50 +02:00
}
2020-09-25 14:59:06 +02:00
}
2023-06-29 15:41:00 +02:00
article _body . after ( div _main ) ;
2021-04-10 08:46:50 +02:00
}
2023-06-02 13:43:48 +02:00
let banners = document . querySelectorAll ( '.ArticleBodyBlocks__inlineArticleSpotXBanner, .WebpushOptin' ) ;
2023-06-29 15:41:00 +02:00
removeDOMElement ( ... banners ) ;
2020-09-25 14:59:06 +02:00
}
2021-12-16 17:28:18 +01:00
else if ( matchDomain ( 'vn.nl' ) ) {
let paywall = document . querySelector ( 'div.content__message-no-access-container' ) ;
2023-05-08 20:05:06 +02:00
if ( paywall && dompurify _loaded ) {
2021-12-16 17:28:18 +01:00
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 ( ) ;
2023-05-08 20:05:06 +02: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 17:28:18 +01:00
let content _new = doc . querySelector ( 'div' ) ;
content . parentNode . replaceChild ( content _new , content ) ;
}
} ) ;
}
} ) ;
}
}
}
2021-04-10 08:46:50 +02:00
else
2021-04-25 13:45:36 +02:00
csDone = true ;
2020-09-26 17:27:41 +02:00
2022-10-26 08:48:51 +02:00
} else if ( window . location . hostname . match ( /\.(ie|uk)$/ ) || matchDomain ( [ 'citywire.com' , 'ft.com' , 'scotsman.com' , 'tes.com' ] ) ) { //united kingdom/ireland
2020-10-02 18:41:44 +02:00
2022-07-30 07:41:59 +02:00
if ( matchDomain ( [ 'belfasttelegraph.co.uk' , 'independent.ie' ] ) ) {
let flip _pay = document . querySelector ( 'div#flip-pay[style]' ) ;
2023-05-08 20:05:06 +02:00
if ( flip _pay && dompurify _loaded ) {
2023-01-26 19:03:07 +01:00
let content = document . querySelector ( 'script[data-fragment-type="ArticleContent"]' ) ;
if ( content ) {
removeDOMElement ( flip _pay ) ;
let intro = document . querySelector ( 'div[data-auth-intro="article"]' ) ;
if ( intro && intro . parentNode ) {
let content _text = content . innerText ;
if ( content _text . includes ( '__PRELOADED_STATE_GRAPH' ) ) {
content _text = content _text . replace ( /window\["__PRELOADED_STATE_GRAPH__.+"\]\s=\s/ , '' ) ;
try {
let json = JSON . parse ( content _text ) ;
if ( Object . keys ( json ) . length ) {
let key = Object . keys ( json ) [ 0 ] ;
let pars = json [ key ] . data . article . body ;
let parser = new DOMParser ( ) ;
for ( let par of pars ) {
for ( let type in par ) {
let item = par [ type ] ;
let elem = document . createElement ( 'p' ) ;
elem . setAttribute ( 'style' , "margin: 10px;" ) ;
if ( type === 'bullet_list' ) {
let ul = document . createElement ( 'ul' ) ;
for ( let sub _item of item ) {
let li = document . createElement ( 'li' ) ;
li . innerText = sub _item ;
ul . appendChild ( li ) ;
}
elem . appendChild ( ul ) ;
} else if ( type === 'image' ) {
let figure = document . createElement ( 'figure' ) ;
let img = document . createElement ( 'img' ) ;
img . src = item . url ;
figure . appendChild ( img ) ;
let caption = document . createElement ( 'figcaption' ) ;
caption . innerText = item . caption ;
figure . appendChild ( caption ) ;
elem . appendChild ( figure ) ;
} else if ( type === 'related' ) {
if ( item . articles ) {
let articles = item . articles ;
for ( let article of articles ) {
let elem _link = document . createElement ( 'a' ) ;
elem _link . href = article . webcmsRelativeUrl ;
elem _link . innerText = article . title ;
elem . appendChild ( elem _link ) ;
elem . appendChild ( document . createElement ( 'br' ) ) ;
}
}
} else if ( type !== 'ad' ) {
2023-05-08 20:05:06 +02:00
let html = parser . parseFromString ( '<p style="font-size: 18px; font-family: Georgia, serif; margin: 10px;">' + DOMPurify . sanitize ( item , { ADD _TAGS : [ 'iframe' ] } ) + '</p>' , 'text/html' ) ;
2023-01-26 19:03:07 +01:00
elem = html . querySelector ( 'p' ) ;
if ( ! [ 'p' , 'subhead' , 'legacy-ml' ] . includes ( type ) ) {
console . log ( type ) ;
console . log ( item ) ;
}
}
window . setTimeout ( function ( ) {
if ( elem )
intro . parentNode . appendChild ( elem ) ;
} , 500 ) ;
}
}
}
} catch ( err ) {
console . log ( err ) ;
}
}
}
} else
flip _pay . removeAttribute ( 'style' ) ;
}
let ads = document . querySelectorAll ( 'div[id^="ad_article"]' ) ;
hideDOMElement ( ... ads ) ;
2022-07-30 07:41:59 +02:00
}
2023-03-28 12:31:49 +02:00
else if ( matchDomain ( 'businesspost.ie' ) ) {
2023-07-07 08:41:44 +02:00
function bpie _main ( ) {
if ( $ ) {
let article _id _dom = document . querySelector ( 'article[id]' ) ;
let article _id ;
if ( article _id _dom )
article _id = article _id _dom . id ;
if ( article _id ) {
let bp _ajaxurl = 'https://www.businesspost.ie/wp-admin/admin-ajax.php' ;
let data _ajax = {
action : 'fetch_article_content' ,
type : 'POST' ,
data : {
id : article _id
} ,
dataType : 'json' ,
contentType : 'application/json'
} ;
$ . ajax ( {
type : 'POST' ,
url : bp _ajaxurl ,
data : data _ajax ,
success : function ( data ) {
window . postMessage ( { type : 'from_page' , data : data } ) ;
}
} ) ;
}
} else
window . location . reload ( true ) ;
2023-03-28 12:31:49 +02:00
}
2023-07-07 08:41:44 +02:00
csDoneOnce = true ;
window . setTimeout ( function ( ) {
let paywall = document . querySelector ( 'div#bp_paywall_content' ) ;
let article _id _dom = document . querySelector ( 'article[id]' ) ;
let article _id ;
if ( article _id _dom )
article _id = article _id _dom . id ;
if ( paywall || article _id ) {
removeDOMElement ( paywall ) ;
insert _script ( bpie _main ) ;
}
} , 500 ) ;
2023-03-28 12:31:49 +02:00
}
2022-10-26 08:48:51 +02:00
else if ( matchDomain ( 'citywire.com' ) ) {
2023-04-02 19:49:28 +02:00
let url = window . location . href ;
let paywall = document . querySelector ( 'div.locked-content.cw-article-body' ) ;
if ( paywall ) {
paywall . classList . remove ( 'locked-content' ) ;
csDoneOnce = true ;
let url _cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url . split ( '?' ) [ 0 ] ;
replaceDomElementExt ( url _cache , true , false , 'div.cw-article-body' ) ;
}
window . setTimeout ( function ( ) {
let banner = document . querySelector ( 'div#lockedLoginPanel' ) ;
removeDOMElement ( banner ) ;
let article = document . querySelector ( 'div.cw-article-body' ) ;
if ( article )
removeDOMElement ( article . nextSibling ) ;
} , 1000 ) ;
2022-10-26 08:48:51 +02:00
}
else if ( matchDomain ( 'ft.com' ) ) {
if ( window . location . hostname . startsWith ( 'amp.' ) ) {
amp _unhide _subscr _section ( '.ad-container, amp-ad' ) ;
} else {
2023-03-22 15:42:53 +01:00
let banners = document . querySelectorAll ( '.o-cookie-message, .js-article-ribbon, .o-ads, .o-banner' ) ;
removeDOMElement ( ... banners ) ;
2022-10-26 08:48:51 +02:00
}
}
2022-07-30 07:41:59 +02:00
else if ( matchDomain ( 'independent.co.uk' ) ) {
2022-01-01 19:01:19 +01:00
let url = window . location . href ;
2022-04-19 21:37:22 +02:00
if ( window . location . search . match ( /(\?|&)amp/ ) ) {
2022-01-01 19:01:19 +01: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 )
2023-01-25 18:46:53 +01:00
article . firstChild . before ( archiveLink ( url ) ) ;
2022-01-01 19:01:19 +01:00
}
}
}
else if ( matchDomain ( 'prospectmagazine.co.uk' ) ) {
2021-04-10 08:46:50 +02:00
let url = window . location . href ;
2022-01-13 17:26:17 +01:00
let paywall = document . querySelector ( 'div.paywall_overlay_blend, div.paywall' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
2022-04-09 17:07:30 +02:00
csDoneOnce = true ;
2022-08-02 17:26:56 +02:00
let url _cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url . split ( '?' ) [ 0 ] ;
2022-01-13 17:26:17 +01:00
replaceDomElementExt ( url _cache , true , false , 'main' ) ;
}
2022-08-24 20:28:54 +02:00
window . setTimeout ( function ( ) {
let ads = document . querySelectorAll ( '.ad-banner, .advert' ) ;
removeDOMElement ( ... ads ) ;
} , 1000 ) ;
2020-10-11 14:43:35 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'spectator.co.uk' ) ) {
2022-11-11 18:17:01 +01:00
let banner = document . querySelector ( '#subscribe-ribbon' ) ;
removeDOMElement ( banner ) ;
2020-10-16 18:41:41 +02:00
}
2023-05-10 18:13:22 +02:00
else if ( matchDomain ( 'stylist.co.uk' ) ) {
let paywall = document . querySelector ( 'div.css-1agpii8' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let json _script = document . querySelector ( 'script#__NEXT_DATA__' ) ;
if ( json _script ) {
try {
let json = JSON . parse ( json _script . text ) ;
if ( json . props . pageProps . data . post . acf . widgets ) {
let url _next = json . props . pageProps . data . post . id ;
if ( url _next && ! window . location . pathname . endsWith ( url _next ) )
refreshCurrentTab ( ) ;
let pars = json . props . pageProps . data . post . acf . widgets ;
let first _par = document . querySelector ( 'p.css-12ac4a9' ) ;
if ( first _par ) {
let par _class = first _par . getAttribute ( 'class' ) ;
let article = first _par . parentNode ;
let teaser = article . querySelectorAll ( 'div.css-1q9dbt6 > p' ) ;
removeDOMElement ( ... teaser ) ;
if ( article ) {
let parser = new DOMParser ( ) ;
for ( let par of pars ) {
let elem = document . createElement ( 'p' ) ;
elem . style = 'font-family: "Source Serif Pro"; font-size: 20px; line-height: 34px;' ;
if ( par . paragraph ) {
let content = par . paragraph ;
let content _new = parser . parseFromString ( '<div class="css-1q9dbt6">' + DOMPurify . sanitize ( content ) + '</div>' , 'text/html' ) ;
elem = content _new . querySelector ( 'div' ) ;
} else if ( par . acf _fc _layout === 'heading' ) {
if ( par . text )
elem . appendChild ( document . createTextNode ( par . text ) ) ;
} else if ( par . image ) {
let figure = document . createElement ( 'figure' ) ;
let img = document . createElement ( 'img' ) ;
img . src = par . image . url ;
img . alt = par . image . alt ;
img . style = mobile ? 'width: 320px;' : 'width: 640px;' ;
figure . appendChild ( img ) ;
if ( par . image . caption || par . image . description ) {
let caption = document . createElement ( 'figcaption' ) ;
caption . innerText = par . image . caption + ' ' + par . image . description ;
figure . appendChild ( caption ) ;
}
elem . appendChild ( figure ) ;
} else if ( par . acf _fc _layout === 'listicle' ) {
let ul = document . createElement ( 'ul' ) ;
for ( let sub _item of par . item ) {
let li = document . createElement ( 'li' ) ;
if ( sub _item . url ) {
let par _link = document . createElement ( 'a' ) ;
par _link . href = sub _item . url ;
par _link . innerText = sub _item . title ;
par _link . target = '_blank' ;
li . appendChild ( par _link ) ;
} else
li . innerText = sub _item . title ;
if ( sub _item . paragraph ) {
let content = sub _item . paragraph ;
let content _new = parser . parseFromString ( '<div class="css-1q9dbt6">' + DOMPurify . sanitize ( content ) + '</div>' , 'text/html' ) ;
let par _elem = content _new . querySelector ( 'div' ) ;
li . appendChild ( par _elem ) ;
}
if ( sub _item . image ) {
let img = document . createElement ( 'img' ) ;
img . src = sub _item . image . url ;
img . alt = sub _item . image . alt ;
img . style = mobile ? 'width: 320px;' : 'width: 640px;' ;
li . appendChild ( img ) ;
li . appendChild ( document . createElement ( 'br' ) ) ;
}
li . style = 'font-size: 20px; margin: 20px 0px;' ;
ul . appendChild ( li ) ;
}
elem . appendChild ( ul ) ;
} else if ( par . embed _link ) {
let par _link = document . createElement ( 'a' ) ;
par _link . href = par . embed _link ;
par _link . innerText = 'Embedded link: ' + par . embed _link ;
par _link . target = '_blank' ;
elem . appendChild ( par _link ) ;
} else if ( par . acf _fc _layout === 'divider' ) {
elem . appendChild ( document . createElement ( 'hr' ) ) ;
} else if ( par . acf _fc _layout === 'related_articles' ) {
if ( par . posts ) {
for ( let post of par . posts ) {
if ( post . link && post . title . rendered ) {
let par _link = document . createElement ( 'a' ) ;
par _link . href = post . link ;
par _link . innerText = 'You may also like: ' + post . title . rendered ;
elem . appendChild ( par _link ) ;
elem . appendChild ( document . createElement ( 'br' ) ) ;
}
}
}
} else if ( ! [ 'newsletter_signup' , 'pull-quote' ] . includes ( par . acf _fc _layout ) )
console . log ( par ) ;
if ( elem . hasChildNodes )
article . appendChild ( elem ) ;
}
let div _nostyle = document . querySelectorAll ( 'div.css-1q9dbt6 > *' ) ;
for ( let elem of div _nostyle )
elem . style = 'font-family: "Source Serif Pro"; font-size: 20px; line-height: 34px;' ;
}
}
}
} catch ( err ) {
console . log ( err ) ;
}
}
}
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'telegraph.co.uk' ) ) {
2023-04-29 09:51:38 +02:00
if ( window . location . pathname . endsWith ( '/amp/' ) ) {
2021-11-30 17:36:15 +01:00
let paywall = document . querySelectorAll ( '.premium-paywall' ) ;
2021-12-23 08:43:19 +01:00
if ( paywall . length ) {
2021-04-10 08:46:50 +02:00
let truncated _content = document . querySelector ( '.truncated-content' ) ;
2021-11-30 17:36:15 +01:00
removeDOMElement ( ... paywall , truncated _content ) ;
2021-12-24 08:32:45 +01:00
amp _unhide _access _hide ( '="c.result=\'ALLOW_ACCESS\'"' , '' , 'amp-ad, amp-embed' , false ) ;
2022-01-09 17:28:17 +01:00
} else {
let amp _ads = document . querySelectorAll ( 'amp-ad, amp-embed' ) ;
removeDOMElement ( ... amp _ads ) ;
2020-12-16 18:38:05 +01:00
}
2021-11-09 17:18:34 +01:00
} else {
2021-12-24 08:32:45 +01:00
let subwall = document . querySelectorAll ( '[class^="subwall"]' ) ;
2021-11-09 17:18:34 +01:00
let ads = document . querySelectorAll ( '.advert, .commercial-unit' ) ;
2021-12-24 08:32:45 +01:00
removeDOMElement ( ... subwall , ... ads ) ;
2021-04-10 08:46:50 +02:00
}
2020-10-21 19:54:10 +02:00
}
2022-10-24 16:35:15 +02:00
else if ( matchDomain ( 'tes.com' ) ) {
let banner = document . querySelector ( 'div.js-paywall-info' ) ;
removeDOMElement ( banner ) ;
}
2022-09-17 08:30:01 +02: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 08:46:50 +02:00
else if ( matchDomain ( 'thetimes.co.uk' ) ) {
2021-06-19 19:04:34 +02:00
let url = window . location . href ;
2022-02-03 20:16:59 +01:00
if ( window . location . hostname !== 'epaper.thetimes.co.uk' ) {
let paywall = document . querySelector ( 'div#paywall-portal-article-footer' ) ;
if ( paywall && ! url . includes ( '?shareToken=' ) ) {
removeDOMElement ( paywall ) ;
2022-08-11 21:51:18 +02:00
let article = document . querySelector ( 'article[class^="responsive__BodyContainer"]' ) ;
if ( article )
2023-01-17 12:16:38 +01:00
article . firstChild . before ( archiveLink ( url ) ) ;
waitDOMAttribute ( 'body' , 'BODY' , 'style' , node => node . removeAttribute ( 'style' ) , true ) ;
2023-05-25 12:34:47 +02:00
waitDOMAttribute ( 'html' , 'HTML' , 'style' , node => node . removeAttribute ( 'style' ) , true ) ;
2022-02-03 20:16:59 +01:00
}
2022-08-11 21:51:18 +02:00
let paywall _page = document . querySelector ( 'div#paywall-portal-page-footer' ) ;
2023-01-17 12:16:38 +01:00
let block = document . querySelector ( '.subscription-block' ) ;
let ads = document . querySelectorAll ( '#ad-article-inline, #sticky-ad-header, div[class*="InlineAdWrapper"], div[class*="NativeAd"], div.gyLkkj' ) ;
removeDOMElement ( paywall _page , block , ... ads ) ;
2021-06-13 21:59:46 +02:00
}
2020-11-07 17:12:37 +01:00
}
2023-02-17 18:19:29 +01:00
else if ( matchDomain ( uk _nat _world _domains ) || document . querySelector ( 'footer > div a[href^="https://www.nationalworldplc.com"]' ) ) {
let premium = document . querySelector ( 'div.premium' ) ;
if ( premium )
premium . removeAttribute ( 'class' ) ;
let amp _images = document . querySelectorAll ( 'article amp-img[src^="https://"]' ) ;
for ( let amp _image of amp _images ) {
let elem = document . createElement ( 'img' ) ;
Object . assign ( elem , {
src : amp _image . getAttribute ( 'src' ) ,
alt : amp _image . getAttribute ( 'alt' )
} ) ;
amp _image . parentNode . replaceChild ( elem , amp _image ) ;
}
let ads = document . querySelectorAll ( 'div[class^="MarkupAds__Container-"], div[class*="_AdContainer-"], div[class^="Dailymotion__Wrapper-"], div.OUTBRAIN' ) ;
removeDOMElement ( ... ads ) ;
}
2022-07-30 07:41:59 +02:00
else
2021-04-25 13:45:36 +02:00
csDone = true ;
2021-04-10 08:46:50 +02:00
2023-07-12 16:46:59 +02:00
} else if ( window . location . hostname . match ( /\.(ar|br|cl|pe|uy)$/ ) || matchDomain ( [ 'clarin.com' , 'elespectador.com' , 'elmercurio.com' , 'eltiempo.com' , 'eltribuno.com' , 'lasegunda.com' , 'latercera.com' , 'valor.globo.com' ] ) ) { //south america
2021-04-10 08:46:50 +02:00
2021-12-12 18:32:28 +01: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 ) ;
2023-07-11 20:48:44 +02:00
} else {
let ads = document . querySelectorAll ( 'div.ads, div[class^="ads-"]' ) ;
hideDOMElement ( ... ads ) ;
2021-12-12 18:32:28 +01:00
}
}
2023-02-21 17:45:05 +01:00
else if ( matchDomain ( ar _grupo _clarin _domains ) ) {
let ads = document . querySelectorAll ( '.ad-slot, .box-adv, .sticky, .wrapperblock' ) ;
2022-01-19 20:29:41 +01:00
removeDOMElement ( ... ads ) ;
}
2022-07-29 18:20:36 +02:00
else if ( matchDomain ( 'crusoe.uol.com.br' ) ) {
let ads = document . querySelectorAll ( '#gpt-leaderboard, .ads_desktop, .catchment-box' ) ;
2023-07-09 18:19:21 +02:00
removeDOMElement ( ... ads ) ;
2022-07-29 18:20:36 +02:00
}
2022-02-11 17:51:33 +01:00
else if ( matchDomain ( pe _grupo _elcomercio _domains ) ) {
2022-09-16 08:13:19 +02:00
let paywall = document . querySelector ( '.paywall' ) ;
2021-04-10 08:46:50 +02:00
if ( paywall ) {
2022-09-16 08:13:19 +02:00
paywall . removeAttribute ( 'class' ) ;
2021-04-10 08:46:50 +02:00
paywall . removeAttribute ( 'style' ) ;
2022-09-16 08:13:19 +02:00
let fade = document . querySelector ( 'p.story-contents--fade' ) ;
if ( fade )
fade . classList . remove ( 'story-contents--fade' ) ;
2021-04-10 08:46:50 +02:00
}
2022-09-16 08:13:19 +02:00
let ads = document . querySelectorAll ( 'div[class^="content_gpt"]' ) ;
2022-07-28 17:41:02 +02:00
removeDOMElement ( ... ads ) ;
2020-11-15 14:15:12 +01:00
}
2021-12-23 17:36:09 +01:00
else if ( matchDomain ( 'elespectador.com' ) ) {
2022-04-26 21:39:02 +02:00
if ( window . location . search . match ( /(\?|&)outputType=amp/ ) ) {
2022-03-15 18:34:21 +01:00
amp _unhide _subscr _section ( 'amp-ad, amp-embed, [class^="Widget"], amp-fx-flying-carpet' ) ;
2021-12-23 17:36:09 +01:00
} else {
2022-04-26 21:39:02 +02:00
let paywall = document . querySelector ( 'div.exclusive_validation' ) ;
2021-12-23 17:36:09 +01:00
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
}
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'elmercurio.com' ) ) {
window . setTimeout ( function ( ) {
let elem _hidden = document . querySelectorAll ( '[style="visibility:hidden"]' ) ;
for ( let elem of elem _hidden )
elem . removeAttribute ( 'style' ) ;
2021-05-04 20:14:56 +02:00
let page _pdf _content = document . querySelector ( 'div.page_pdf_content' ) ;
let close _html = document . querySelector ( 'div.close_html' ) ;
2022-06-26 09:20:53 +02:00
let cont _page _full = document . querySelector ( 'div.cont_page_full' ) ;
removeDOMElement ( page _pdf _content , close _html , cont _page _full ) ;
2022-03-08 19:04:50 +01:00
} , 1000 ) ;
2021-07-26 20:02:44 +02:00
window . setTimeout ( function ( ) {
let cont _articlelight = document . querySelector ( 'div.cont_articlelight' ) ;
if ( cont _articlelight )
cont _articlelight . setAttribute ( 'style' , 'height: 100% !important; width: 90% !important' ) ;
2022-03-08 19:04:50 +01:00
} , 3000 ) ;
2020-11-17 17:39:31 +01:00
}
2023-04-12 17:03:09 +02:00
else if ( matchDomain ( 'elobservador.com.uy' ) ) {
if ( window . location . pathname . endsWith ( '/amp' ) ) {
amp _unhide _access _hide ( '="observador.mostrarNota"' ) ;
let amp _images = document . querySelectorAll ( 'div.fixed-container > amp-img.null' ) ;
for ( let amp _image of amp _images ) {
let elem = document . createElement ( 'img' ) ;
Object . assign ( elem , {
src : amp _image . getAttribute ( 'src' ) ,
alt : amp _image . getAttribute ( 'alt' ) ,
title : amp _image . getAttribute ( 'title' )
} ) ;
amp _image . parentNode . replaceChild ( elem , amp _image ) ;
}
} else {
let paywall = document . querySelector ( 'div.mensaje_member' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
window . location . href = window . location . pathname + '/amp' ;
}
}
}
2023-02-16 21:55:20 +01:00
else if ( matchDomain ( 'eltiempo.com' ) ) {
let modulos = document . querySelector ( 'div.modulos' ) ;
if ( modulos )
modulos . classList . remove ( 'modulos' ) ;
}
2023-07-12 16:46:59 +02:00
else if ( matchDomain ( 'eltribuno.com' ) ) {
let lazy _images = document . querySelectorAll ( 'img.lazyload[data-src]:not([src])' ) ;
for ( let elem of lazy _images ) {
elem . src = elem . getAttribute ( 'data-src' ) ;
elem . classList . remove ( 'lazyload' ) ;
}
}
2022-06-01 17:39:27 +02: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 08:46:50 +02:00
else if ( matchDomain ( 'estadao.com.br' ) ) {
2022-09-24 18:54:10 +02: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 18:32:28 +01:00
} else {
let paywall = document . getElementById ( 'paywall-wrapper-iframe-estadao' ) ;
2022-09-24 18:54:10 +02:00
let ads = document . querySelectorAll ( 'div[class^="styles__Container-sc-"]' ) ;
removeDOMElement ( paywall , ... ads ) ;
2021-12-12 18:32:28 +01:00
}
2020-11-21 19:21:29 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'folha.uol.com.br' ) ) {
2022-07-24 08:50:03 +02: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 18:32:28 +01:00
} else {
2022-07-24 08:50:03 +02: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 18:32:28 +01:00
}
2020-11-22 15:25:28 +01:00
}
2022-03-15 18:34:21 +01: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 = '' ;
}
}
2023-05-22 17:40:33 +02:00
else if ( matchDomain ( 'gauchazh.clicrbs.com.br' ) ) {
let ads = document . querySelectorAll ( 'div.ad-banner, div.ad-container' ) ;
hideDOMElement ( ... ads ) ;
}
2023-04-12 17:03:09 +02:00
else if ( matchDomain ( 'ladiaria.com.uy' ) ) {
if ( window . location . search . startsWith ( '?display=amp' ) ) {
csDoneOnce = true ;
ampToHtml ( ) ;
} else {
let banners = document . querySelectorAll ( 'div.softwall, div.subscribe-notice' ) ;
removeDOMElement ( ... banners ) ;
}
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'latercera.com' ) ) {
2022-10-02 08:40:43 +02:00
let subscr _banner = document . querySelector ( '.empty' ) ;
removeDOMElement ( subscr _banner ) ;
2020-11-23 18:12:40 +01:00
}
2020-11-28 18:34:26 +01:00
else if ( matchDomain ( 'lasegunda.com' ) ) {
2021-04-10 08:46:50 +02:00
let url = window . location . href ;
if ( url . includes ( 'digital.lasegunda.com/mobile' ) ) {
let lessreadmore = document . querySelectorAll ( 'article.lessreadmore' ) ;
for ( let article of lessreadmore )
article . classList . remove ( 'lessreadmore' ) ;
let bt _readmore = document . querySelectorAll ( 'div[id*="bt_readmore_"]' ) ;
removeDOMElement ( ... bt _readmore ) ;
}
2020-11-28 18:34:26 +01:00
}
2022-08-12 07:12:26 +02:00
else if ( matchDomain ( 'valor.globo.com' ) ) {
let url = window . location . href ;
2023-03-21 18:12:34 +01:00
if ( ! window . location . pathname . startsWith ( '/google/amp/' ) ) {
let paywall = document . querySelector ( 'div.paywall' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
2022-08-12 07:12:26 +02:00
}
2023-01-25 18:46:53 +01:00
let ads = document . querySelectorAll ( '[id^="ad-container"], .content-ads' ) ;
removeDOMElement ( ... ads ) ;
2023-03-21 18:12:34 +01:00
} else {
amp _unhide _subscr _section ( 'amp-ad, amp-embed' ) ;
let amp _images = document . querySelectorAll ( 'figure > amp-img[src^="https://"]' ) ;
for ( let amp _image of amp _images ) {
let elem = document . createElement ( 'img' ) ;
elem . src = amp _image . getAttribute ( 'src' ) ;
elem . alt = amp _image . getAttribute ( 'alt' ) ;
elem . style = mobile ? 'width: 320px;' : 'margin: 0px 250px; display:block;' ;
amp _image . parentNode . replaceChild ( elem , amp _image ) ;
}
}
2022-08-12 07:12:26 +02:00
}
2022-05-29 15:52:54 +02:00
else if ( window . location . hostname . endsWith ( '.cl' ) && document . querySelector ( 'meta[property="og:image"][content*="://impresa.soy-chile.cl/"]' ) ) {
2023-05-13 19:13:03 +02:00
window . setTimeout ( function ( ) {
let content = document . querySelector ( 'div.content' ) ;
if ( content )
content . setAttribute ( 'id' , 'content_new' ) ;
let modal _wrapper = document . querySelector ( 'div.modal-wrapper' ) ;
removeDOMElement ( modal _wrapper ) ;
} , 1000 ) ;
waitDOMAttribute ( 'body' , 'BODY' , 'class' , node => node . removeAttribute ( 'class' ) , true ) ;
csDoneOnce = true ;
2020-11-30 20:39:13 +01:00
}
2021-04-10 08:46:50 +02:00
else
2021-04-25 13:45:36 +02:00
csDone = true ;
2020-12-03 16:52:33 +01:00
2022-01-23 10:13:35 +01: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 08:46:50 +02:00
2021-11-16 18:21:56 +01: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"]' ) ;
2023-05-09 12:36:40 +02:00
if ( ! amphtml )
amphtml = { href : window . location . pathname + '?outputType=amp' } ;
2021-11-16 18:21:56 +01:00
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
let ads = document . querySelectorAll ( 'div.ad' ) ;
removeDOMElement ( ... ads ) ;
}
}
2023-05-03 08:32:15 +02:00
else if ( matchDomain ( 'americanbanker.com' ) || matchDomain ( usa _arizent _custom _domains ) ) {
2021-05-04 22:13:32 +02:00
let inline _gate = document . querySelector ( '.inline-gate' ) ;
if ( inline _gate ) {
inline _gate . classList . remove ( 'inline-gate' ) ;
let inline _gated = document . querySelectorAll ( '.inline-gated' ) ;
for ( let elem of inline _gated )
elem . classList . remove ( 'inline-gated' ) ;
}
2020-12-08 18:02:32 +01:00
}
2021-12-02 18:52:30 +01:00
else if ( matchDomain ( 'artnet.com' ) ) {
2021-12-12 09:38:17 +01: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 18:52:30 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'asia.nikkei.com' ) ) {
2021-11-09 17:18:34 +01:00
let popup = document . querySelector ( '#pianoj_ribbon' ) ;
2021-04-10 08:46:50 +02:00
removeDOMElement ( popup ) ;
2020-12-20 21:28:12 +01:00
}
2022-10-01 12:35:59 +02:00
else if ( matchDomain ( 'axios.com' ) ) {
2022-10-24 20:15:28 +02: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 21:28:47 +02:00
hideDOMElement ( ... banners ) ;
2022-10-24 20:15:28 +02:00
csDoneOnce = true ;
2022-10-01 12:35:59 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'barrons.com' ) ) {
2021-10-30 10:29:59 +02:00
let url = window . location . href ;
if ( ! url . includes ( 'barrons.com/amp/' ) ) {
2021-04-10 08:46:50 +02:00
let body _continuous = document . querySelector ( 'body.is-continuous' ) ;
let snippet = document . querySelector ( 'meta[content="snippet"]' ) ;
if ( body _continuous && snippet ) {
2021-10-30 10:29:59 +02:00
removeDOMElement ( snippet ) ;
window . location . href = url . replace ( 'barrons.com' , 'barrons.com/amp' ) ;
2021-04-10 08:46:50 +02:00
}
2022-04-24 10:01:13 +02: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 08:23:47 +02:00
let barrons _ads = document . querySelectorAll ( '.barrons-body-ad-placement' ) ;
removeDOMElement ( ... barrons _ads ) ;
2021-04-10 08:46:50 +02:00
} else {
2021-11-30 17:36:15 +01:00
amp _unhide _subscr _section ( '.wsj-ad, amp-ad' ) ;
2021-04-10 08:46:50 +02:00
}
}
2021-12-11 19:12:13 +01:00
else if ( matchDomain ( 'billboard.com' ) ) {
if ( window . location . pathname . endsWith ( '/amp/' ) ) {
amp _unhide _subscr _section ( 'amp-ad, amp-embed' ) ;
}
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'bloomberg.com' ) ) {
2022-01-11 18:32:49 +01:00
function bloomberg _noscroll ( node ) {
node . removeAttribute ( 'data-paywall-overlay-status' ) ;
}
2022-10-12 09:03:55 +02:00
waitDOMElement ( 'div[id^="fortress-"]' , 'DIV' , removeDOMElement , true ) ;
2022-01-11 18:32:49 +01:00
waitDOMAttribute ( 'body' , 'BODY' , 'data-paywall-overlay-status' , bloomberg _noscroll , true ) ;
2022-10-12 09:03:55 +02:00
let paywall = document . querySelectorAll ( 'div[id^="fortress-"]' ) ;
2022-01-11 18:32:49 +01: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 21:28:47 +02:00
hideDOMElement ( ... paywall , leaderboard ) ;
2021-08-06 13:25:43 +02:00
let url = window . location . href ;
2022-07-28 17:41:02 +02: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 21:31:44 +02:00
let reg _ui _client = document . querySelector ( 'div#reg-ui-client' ) ;
2022-10-19 21:28:47 +02:00
hideDOMElement ( ... page _ad , reg _ui _client ) ;
2021-08-06 13:25:43 +02:00
let hidden _images = document . querySelectorAll ( 'img.lazy-img__image[src][data-native-src]' ) ;
for ( let hidden _image of hidden _images ) {
2021-12-13 20:30:25 +01:00
if ( hidden _image . src . match ( /\/(60|150)x-1\.(png|jpg)$/ ) )
2021-08-06 13:25:43 +02:00
hidden _image . setAttribute ( 'src' , hidden _image . getAttribute ( 'data-native-src' ) ) ;
hidden _image . style . filter = 'none' ;
}
2021-10-20 20:35:52 +02:00
let hidden _charts = document . querySelectorAll ( 'div[data-toaster-id][data-src]' ) ;
for ( let hidden _chart of hidden _charts ) {
let elem = document . createElement ( 'iframe' ) ;
Object . assign ( elem , {
src : hidden _chart . getAttribute ( 'data-src' ) ,
frameborder : 0 ,
height : hidden _chart . getAttribute ( 'style' ) . replace ( 'min-height: ' , '' ) ,
scrolling : 'no'
} ) ;
hidden _chart . parentNode . replaceChild ( elem , hidden _chart ) ;
}
2021-10-03 12:17:55 +02:00
let blur = document . querySelector ( 'div.blur[style]' ) ;
if ( blur ) {
blur . classList . remove ( 'blur' ) ;
blur . removeAttribute ( 'style' ) ;
}
2023-07-05 09:01:05 +02:00
let main _column = document . querySelector ( 'div[class*="main-column__"]' ) ;
if ( main _column )
main _column . style = '-webkit-mask-image: none !important; mask-image: none !important;' ;
2021-12-13 20:30:25 +01:00
let shimmering _content = document . querySelectorAll ( 'div.shimmering-text' ) ;
2023-07-16 21:57:12 +02:00
removeDOMElement ( ... shimmering _content ) ;
let body _transparent = document . querySelector ( 'main div[class*="nearly-transparent-text-blur"]' ) ;
let article _blur = document . querySelector ( 'main div[class^="styles_articleBlur__"]' ) ;
if ( ( body _transparent || article _blur ) && dompurify _loaded ) {
if ( body _transparent )
removeClassesByPrefix ( body _transparent , 'nearly-transparent-text-blur' ) ;
if ( article _blur )
article _blur . removeAttribute ( 'class' ) ;
let articles = document . querySelectorAll ( 'article[id], article[data-story-id]' ) ;
if ( articles && articles . length < 2 ) {
let json _script = document . querySelector ( 'script[data-component-props="ArticleBody"], script[data-component-props="FeatureBody"]' ) ;
let json _next _script = document . querySelector ( 'script#__NEXT_DATA__' ) ;
if ( json _next _script ) {
let json = JSON . parse ( json _next _script . text ) ;
let json _pars = json . props . pageProps . story . body . content ;
let article _par = document . querySelector ( 'div > p[class^="Paragraph_text-"]' ) ;
let article ;
if ( article _par ) {
let par _class = article _par . getAttribute ( 'class' ) ;
article = article _par . parentNode ;
function attach _hyperlink ( item _text , item _href , elem ) {
let sub _elem = document . createElement ( 'a' ) ;
sub _elem . innerText = item _text ;
sub _elem . href = item _href ;
sub _elem . style = 'text-decoration: underline;' ;
if ( ! item _href . startsWith ( 'https://www.bloomberg.com' ) )
sub _elem . target = '_blank' ;
elem . appendChild ( sub _elem ) ;
2021-12-13 20:30:25 +01:00
}
2023-07-16 21:57:12 +02:00
function attach _list ( content , elem ) {
let ul = document . createElement ( 'ul' ) ;
ul . setAttribute ( 'style' , 'list-style-type: disc; padding: 5px;' ) ;
for ( let item of content ) {
if ( item . type === 'listItem' ) {
let li = document . createElement ( 'li' ) ;
for ( let list _item of item . content ) {
if ( list _item . type === 'text' ) {
if ( list _item . value ) {
li . appendChild ( document . createTextNode ( list _item . value ) ) ;
}
} else if ( list _item . type === 'list' ) {
if ( list _item . content )
false ; //attach_list(list_item.content, li);
} else if ( ! [ 'entity' ] . includes ( list _item . type ) )
console . log ( list _item ) ;
}
ul . appendChild ( li ) ;
}
}
elem . appendChild ( ul ) ;
2021-12-13 20:30:25 +01:00
}
2023-07-20 08:08:39 +02:00
for ( let par of json _pars ) {
2023-07-16 21:57:12 +02:00
let elem = document . createElement ( 'p' ) ;
elem . setAttribute ( 'class' , par _class ) ;
if ( [ 'heading' , 'paragraph' ] . includes ( par . type ) ) {
for ( let item of par . content ) {
if ( item . type === 'text' && item . value ) {
elem . appendChild ( document . createTextNode ( item . value ) ) ;
} else if ( item . type === 'link' && item . data && item . data . href ) {
if ( item . content && item . content [ 0 ] && item . content [ 0 ] . value )
attach _hyperlink ( item . content [ 0 ] . value , item . data . href , elem ) ;
} else if ( item . type === 'entity' ) {
if ( item . content && item . content [ 0 ] && item . content [ 0 ] . value ) {
if ( [ 'person' , 'security' ] . includes ( item . subType ) ) {
elem . appendChild ( document . createTextNode ( item . content [ 0 ] . value ) ) ;
} else if ( item . subType === 'story' ) {
if ( item . data && item . data . link && item . data . link . destination && item . data . link . destination . web ) {
attach _hyperlink ( item . content [ 0 ] . value , item . data . link . destination . web , elem ) ;
}
} else
console . log ( item ) ;
}
} else
console . log ( item ) ;
}
} else if ( par . type === 'quote' && par . content ) {
for ( let item of par . content ) {
if ( item . type === 'paragraph' && item . content && item . content [ 0 ] && item . content [ 0 ] . value ) {
elem . appendChild ( document . createTextNode ( item . content [ 0 ] . value + ' ' ) ) ;
}
}
elem . setAttribute ( 'style' , 'font-style: italic;' ) ;
} else if ( par . type === 'media' && par . subType === 'chart' ) {
if ( par . data && par . data . chart ) {
let figure = document . createElement ( 'figure' ) ;
if ( par . data . attachment && par . data . attachment . title )
figure . appendChild ( document . createTextNode ( par . data . attachment . title ) ) ;
let img = document . createElement ( 'img' ) ;
img . src = par . data . chart . fallback ;
figure . appendChild ( img ) ;
if ( par . data . attachment && ( par . data . attachment . source || par . data . attachment . footnote ) ) {
let caption = document . createElement ( 'figcaption' ) ;
caption . innerText = par . data . attachment . source + '\r\n' + par . data . attachment . footnote ;
figure . appendChild ( caption ) ;
}
elem . appendChild ( figure ) ;
}
} else if ( par . type === 'list' && par . content ) {
attach _list ( par . content , elem ) ;
} else if ( ! [ 'ad' , 'inline-newsletter' , 'inline-recirc' , 'tabularData' ] . includes ( par . type ) )
console . log ( par ) ;
if ( elem . hasChildNodes )
article . appendChild ( elem ) ;
}
}
} else if ( json _script ) {
let json = JSON . parse ( json _script . text ) ;
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-13 20:30:25 +01:00
}
2021-12-12 22:24:54 +01:00
}
2021-08-06 13:25:43 +02:00
}
2021-07-19 19:56:02 +02:00
}
}
2021-04-10 08:46:50 +02:00
}
2021-07-19 19:56:02 +02:00
}
2023-07-05 09:01:05 +02:00
window . sessionStorage . clear ( ) ;
2023-04-28 09:21:14 +02:00
if ( window . location . pathname . startsWith ( '/live/' ) ) {
setInterval ( function ( ) {
window . localStorage . clear ( ) ;
} , 15 * 60 * 1000 ) ;
}
2021-04-10 08:46:50 +02:00
}
2023-02-28 18:16:44 +01:00
else if ( matchDomain ( 'bloombergadria.com' ) ) {
let article _hidden = document . querySelector ( 'article[style]' ) ;
if ( article _hidden )
article _hidden . removeAttribute ( 'style' ) ;
let ads = document . querySelectorAll ( '.banner' ) ;
removeDOMElement ( ... ads ) ;
}
2021-06-14 21:45:26 +02:00
else if ( matchDomain ( 'bostonglobe.com' ) ) {
2021-12-11 19:46:23 +01:00
if ( window . location . search . startsWith ( '?outputType=amp' ) ) {
amp _unhide _subscr _section ( ) ;
} else {
let ads = document . querySelectorAll ( 'div.arc_ad' ) ;
2023-01-04 11:37:34 +01:00
hideDOMElement ( ... ads ) ;
2021-12-11 19:46:23 +01:00
}
2021-06-14 21:45:26 +02:00
}
2022-06-26 21:51:30 +02:00
else if ( matchDomain ( 'bqprime.com' ) ) {
if ( window . location . pathname . startsWith ( '/amp/' ) ) {
2022-12-30 12:35:13 +01:00
amp _unhide _subscr _section ( '.ad-container' ) ;
2023-01-07 13:26:05 +01:00
} else {
2023-01-12 19:18:09 +01:00
window . setTimeout ( function ( ) {
let geo _block = document . querySelector ( 'div[class*="geotag-container_"]' ) ;
if ( ! window . location . search . startsWith ( '?rel=geo_block' ) ) {
2023-01-07 13:26:05 +01:00
if ( geo _block ) {
removeDOMElement ( geo _block ) ;
window . location . href = window . location . pathname + '?rel=geo_block' ;
}
2023-01-12 19:18:09 +01:00
} else {
if ( geo _block )
refreshCurrentTab ( ) ;
else {
let hidden _images = document . querySelectorAll ( 'img[src^="data:image/"][data-src]' ) ;
for ( let elem of hidden _images )
elem . setAttribute ( 'src' , elem . getAttribute ( 'data-src' ) ) ;
}
}
} , 1000 ) ;
2022-06-26 21:51:30 +02:00
}
2023-01-08 09:35:56 +01:00
let ads = document . querySelectorAll ( '.responsive-ad' ) ;
removeDOMElement ( ... ads ) ;
2022-06-26 21:51:30 +02:00
}
2023-03-29 18:05:49 +02:00
else if ( matchDomain ( 'businessinsider.com' ) ) {
let ads = document . querySelectorAll ( 'div.l-ad, div.in-post-sticky, aside.has-video-ad' ) ;
hideDOMElement ( ... ads ) ;
}
2022-01-14 15:33:58 +01:00
else if ( matchDomain ( 'businessoffashion.com' ) ) {
2022-08-26 19:50:25 +02: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 15:33:58 +01:00
}
2022-07-31 08:31:05 +02: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 08:46:50 +02:00
else if ( matchDomain ( 'cen.acs.org' ) ) {
2022-01-13 17:26:17 +01:00
let meteredBar = document . querySelector ( '.meteredBar' ) ;
removeDOMElement ( meteredBar ) ;
2021-04-10 08:46:50 +02:00
}
2022-08-27 10:11:13 +02:00
else if ( matchDomain ( [ 'chronicle.com' , 'philanthropy.com' ] ) ) {
2021-10-07 19:56:23 +02:00
let preview = document . querySelector ( 'div[data-content-summary]' ) ;
removeDOMElement ( preview ) ;
2022-12-03 08:09:04 +01:00
let article _hidden = document . querySelector ( 'div.contentBody[hidden]' ) ;
2022-09-23 15:32:27 +02:00
if ( article _hidden ) {
2022-12-03 08:09:04 +01:00
let attributes = article _hidden . attributes ;
for ( let elem of attributes ) {
let name = elem . name ;
if ( name !== 'class' )
article _hidden . removeAttribute ( name ) ;
}
2022-09-23 15:32:27 +02:00
}
2021-10-07 19:56:23 +02:00
}
2022-11-14 18:41:18 +01:00
else if ( matchDomain ( 'cnbc.com' ) ) {
let paywall = document . querySelector ( 'div.ArticleGate-proGate' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let article = document . querySelector ( 'div.ArticleBody-articleBody' ) ;
if ( article )
article . style = "margin: 20px 0px; font-family: Lyon,Helvetica,Arial,sans-serif; font-size: 18px; line-height: 1.66" ;
let span _hidden = document . querySelectorAll ( 'span[hidden]' ) ;
for ( let elem of span _hidden ) {
elem . removeAttribute ( 'hidden' ) ;
elem . removeAttribute ( 'class' ) ;
}
}
}
2021-07-28 18:33:12 +02:00
else if ( matchDomain ( 'csmonitor.com' ) ) {
let paywall = document . querySelector ( 'div.paywall' ) ;
removeDOMElement ( paywall ) ;
}
2022-05-04 17:58:35 +02:00
else if ( matchDomain ( 'dailywire.com' ) ) {
let paywall = document . querySelector ( '#post-body-text > div > div[class]' ) ;
if ( paywall )
paywall . removeAttribute ( 'class' ) ;
}
2021-12-11 19:46:23 +01:00
else if ( matchDomain ( 'dallasnews.com' ) ) {
if ( window . location . search . startsWith ( '?outputType=amp' ) ) {
amp _unhide _subscr _section ( 'amp-ad, amp-embed' ) ;
2022-05-10 22:31:14 +02: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 19:46:23 +01:00
}
}
2023-03-17 17:31:00 +01:00
else if ( matchDomain ( 'defector.com' ) ) {
2023-05-26 08:42:46 +02:00
let paywall = document . querySelector ( 'div[class^="ContentGate_wrapper__"]' ) ;
removeDOMElement ( paywall ) ;
2023-03-17 17:31:00 +01:00
}
2021-12-11 19:12:13 +01: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 08:46:50 +02:00
else if ( matchDomain ( 'discovermagazine.com' ) ) {
window . setTimeout ( function ( ) {
let mammoth = document . querySelector ( '.iXVGnF' ) ;
if ( mammoth )
window . location . reload ( ) ;
2021-07-11 18:44:45 +02:00
let banner = document . querySelector ( 'div.dPURIw' ) ;
2022-10-19 21:28:47 +02:00
hideDOMElement ( banner ) ;
2022-03-08 19:04:50 +01:00
} , 1000 ) ;
2021-04-10 08:46:50 +02:00
}
2023-02-27 17:18:46 +01:00
else if ( matchDomain ( 'dn.no' ) ) {
let url = window . location . href ;
let paywall = document . querySelector ( 'div#dn-ncp-popup, div.paywall, iframe[title="Paywall"]' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let article _sel = 'article' ;
let article = document . querySelector ( article _sel ) ;
if ( article ) {
let url _cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url . split ( '?' ) [ 0 ] ;
replaceDomElementExt ( url _cache , true , false , article _sel ) ;
} else {
article = document . querySelector ( 'main#main-story, main.lp_article_content' ) ;
if ( article )
article . firstChild . before ( googleWebcacheLink ( url ) ) ;
}
}
window . setTimeout ( function ( ) {
let preview = document . querySelector ( 'html.dn-preview-page' ) ;
if ( preview )
preview . removeAttribute ( 'class' ) ;
let infobox _content = document . querySelector ( 'div.infobox__content' ) ;
if ( infobox _content )
infobox _content . removeAttribute ( 'class' ) ;
let lazy _images = document . querySelectorAll ( 'img[class*="lazy"][data-srcset]:not([src])' ) ;
for ( let elem of lazy _images ) {
elem . src = elem . getAttribute ( 'data-srcset' ) . split ( ' ' ) [ 0 ] ;
if ( elem . classList . contains ( 'lazy' ) )
elem . classList . remove ( 'lazy' ) ;
else
elem . removeAttribute ( 'class' ) ;
}
let ads = document . querySelectorAll ( 'div[id^="googlead-"]' ) ;
removeDOMElement ( ... ads ) ;
} , 1000 ) ;
}
2021-05-21 08:04:59 +02:00
else if ( matchDomain ( 'economictimes.com' ) ) {
2021-12-12 09:38:17 +01: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;' ) ;
2023-01-19 08:31:41 +01:00
else
window . location . href = 'https://economictimes.indiatimes.com' + window . location . pathname . replace ( 'amp_prime' , 'prime' ) ;
2021-12-12 09:38:17 +01:00
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 08:04:59 +02:00
}
2021-12-12 09:38:17 +01:00
} else {
window . setTimeout ( function ( ) {
let paywall = document . querySelector ( 'div#blocker_layer' ) ;
let data _prime = document . querySelector ( 'div[data-prime="1"]' ) ;
2022-08-07 19:04:12 +02:00
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
2023-01-19 08:31:41 +01:00
if ( paywall || data _prime ) {
2021-12-12 09:38:17 +01:00
removeDOMElement ( paywall ) ;
if ( data _prime )
data _prime . removeAttribute ( 'data-prime' ) ;
2023-01-19 08:31:41 +01:00
if ( amphtml )
window . location . href = amphtml . href ;
else if ( window . location . pathname . startsWith ( '/epaper/' ) )
window . location . href = 'https://economictimes.indiatimes.com' + window . location . pathname ;
} else {
let ads = document . querySelectorAll ( '.adContainer' ) ;
removeDOMElement ( ... ads ) ;
2021-12-12 09:38:17 +01:00
}
2022-03-08 19:04:50 +01:00
} , 500 ) ;
2021-12-12 09:38:17 +01:00
}
2021-05-21 08:04:59 +02:00
}
2021-05-03 22:13:22 +02:00
else if ( matchDomain ( 'economictimes.indiatimes.com' ) ) {
let paywall = document . querySelector ( 'section.prime_paywall' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let content = document . querySelector ( 'div.content1, div.artText' ) ;
let full _text = document . querySelector ( 'div.paywall.p1' ) ;
if ( content && full _text )
content . innerText = full _text . innerText ;
2023-04-01 14:00:23 +02:00
let page _content = document . querySelector ( 'div.pageContent:not([style])' ) ;
2021-05-21 08:04:59 +02:00
if ( page _content )
page _content . setAttribute ( 'style' , 'height: auto !important;' ) ;
2021-05-03 22:13:22 +02:00
}
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'economist.com' ) ) {
2022-01-13 17:26:17 +01: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 08:46:50 +02:00
}
2021-01-11 21:00:41 +01:00
}
2022-01-13 17:26:17 +01:00
}
2021-01-11 21:00:41 +01:00
}
2022-04-22 16:49:43 +02:00
else if ( matchDomain ( 'enotes.com' ) ) {
2022-04-26 07:57:16 +02:00
let paywall = document . querySelectorAll ( 'section.c-cta-section' ) ;
if ( paywall . length ) {
removeDOMElement ( ... paywall ) ;
let blurred = document . querySelectorAll ( 'div[class^="_"]' ) ;
2022-04-22 16:49:43 +02:00
for ( let elem of blurred )
elem . removeAttribute ( 'class' ) ;
2022-04-26 08:15:18 +02:00
let intro = document . querySelectorAll ( 'div.o-rte-text > p:not([class]), div.o-rte-text > h3' ) ;
2022-04-22 16:49:43 +02:00
for ( let elem of intro )
removeDOMElement ( elem ) ;
2022-05-09 20:29:25 +02: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 16:49:43 +02:00
}
}
2022-10-19 21:28:47 +02:00
else if ( matchDomain ( 'espn.com' ) ) {
let url = window . location . href ;
let paywall = document . querySelector ( 'aside.espn-plus-container-wrapper' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
2023-04-20 20:56:23 +02:00
replaceDomElementExt ( url , false , false , 'div.article-body' ) ;
2022-10-19 21:28:47 +02:00
}
}
2022-11-12 08:39:05 +01:00
else if ( matchDomain ( 'fieldandstream.com' ) ) {
let overlay = document . querySelectorAll ( 'div[class^="mailmunch-"]' ) ;
removeDOMElement ( ... overlay ) ;
let noscroll = document . querySelector ( 'html.mailmunch-pop-open' ) ;
if ( noscroll )
noscroll . removeAttribute ( 'class' ) ;
}
2022-05-29 17:08:47 +02: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' ) ;
2023-04-08 19:19:49 +02:00
let ads _selector = window . location . pathname . endsWith ( '/lite/' ) ? 'amp-ad, amp-embed, .ad-bg-container' : 'div[class*="-ads-blocks-ad-unit"]' ;
let ads = document . querySelectorAll ( ads _selector ) ;
2022-05-29 17:08:47 +02:00
removeDOMElement ( register , ... ads ) ;
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'firstthings.com' ) ) {
let paywall = document . querySelector ( '.paywall' ) ;
removeDOMElement ( paywall ) ;
}
else if ( matchDomain ( 'foreignaffairs.com' ) ) {
2021-09-28 20:42:02 +02:00
window . setTimeout ( function ( ) {
let paywall = document . querySelector ( '.paywall' ) ;
let loading _indicator = document . querySelector ( '.loading-indicator' ) ;
let msg _bottom = document . querySelector ( '.messages--container--bottom' ) ;
removeDOMElement ( paywall , loading _indicator , msg _bottom ) ;
let article _dropcap = document . querySelectorAll ( '.article-dropcap' ) ;
for ( let elem of article _dropcap )
elem . classList . add ( 'loaded' ) ;
2022-03-08 19:04:50 +01:00
} , 1000 ) ;
2021-01-09 17:45:21 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'foreignpolicy.com' ) ) {
2021-06-16 07:38:22 +02:00
let content _ungated = document . querySelector ( 'div.content-ungated' ) ;
2023-06-27 18:08:43 +02:00
if ( content _ungated && dompurify _loaded ) {
removeDOMElement ( content _ungated ) ;
let content _gated = document . querySelector ( 'div.content-gated' ) ;
if ( content _gated ) {
content _gated . classList . remove ( 'content-gated' ) ;
let insider = document . querySelector ( 'body.is-fp-insider' ) ;
if ( insider ) {
window . setTimeout ( function ( ) {
let json _script = getArticleJsonScript ( ) ;
if ( json _script ) {
let json = JSON . parse ( json _script . text ) ;
if ( json ) {
let content = json . Articlebody . replace ( /\r\n/g , '<br>' ) ;
if ( content ) {
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( '<div style="margin: 50px;">' + DOMPurify . sanitize ( content ) + '</div>' , 'text/html' ) ;
let content _new = doc . querySelector ( 'div' ) ;
content _gated . before ( content _new ) ;
}
}
}
} , 500 ) ;
}
}
}
2020-12-31 09:45:01 +01:00
}
2021-12-10 18:16:56 +01:00
else if ( matchDomain ( 'fortune.com' ) ) {
2022-04-21 21:27:17 +02:00
let paywall = document . querySelector ( '.paywall' ) ;
2022-04-22 16:21:09 +02:00
if ( window . location . pathname . match ( /\/amp(\/)?/ ) ) {
2021-12-10 18:16:56 +01:00
amp _unhide _access _hide ( '="NOT p.showRegWall AND NOT p.showPayWall"' , '' , '[class^="amp-ad"]' ) ;
removeDOMElement ( paywall ) ;
2022-04-21 21:27:17 +02:00
} else {
if ( paywall )
paywall . removeAttribute ( 'class' ) ;
2021-12-10 18:16:56 +01:00
}
}
2023-06-24 10:18:15 +02:00
else if ( matchDomain ( 'ftm.eu' ) ) {
let banners = document . querySelectorAll ( 'div.banner-pp, a.readmore' ) ;
removeDOMElement ( ... banners ) ;
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'hbr.org' ) ) {
let popup = document . querySelector ( '.persistent-banner' ) ;
removeDOMElement ( popup ) ;
2022-12-02 17:33:00 +01:00
let paywall = document . querySelector ( 'site-paywall' ) ;
if ( paywall ) { //legacy
removeDOMElement ( paywall ) ;
let intro = document . querySelector ( '.article-ideainbrief' ) ;
if ( intro )
intro . removeAttribute ( 'class' ) ;
let main _hidden = document . querySelector ( 'div#main[style]' ) ;
if ( main _hidden )
main _hidden . removeAttribute ( 'style' ) ;
}
2021-01-20 20:26:35 +01:00
}
2021-11-06 09:24:44 +01:00
else if ( matchDomain ( 'hbrchina.org' ) ) {
let div _hidden = document . querySelector ( 'div#the_content' ) ;
if ( div _hidden )
div _hidden . removeAttribute ( 'style' ) ;
}
2022-04-05 18:05:13 +02:00
else if ( matchDomain ( 'hilltimes.com' ) ) {
2023-02-04 17:29:46 +01:00
let paywall = document . querySelectorAll ( 'div[class^="paywallcont"]' ) ;
if ( paywall . length ) {
removeDOMElement ( ... paywall ) ;
let json _script = document . querySelector ( 'script.saswp-schema-markup-output' ) ;
if ( json _script ) {
try {
let json = JSON . parse ( json _script . text ) ;
json _text = json . filter ( x => x . articleBody ) [ 0 ] . articleBody . replace ( /\s{2,}/g , '\r\n\r\n' ) ;
let article = document . querySelector ( 'div#fadebg > p' ) ;
if ( article )
article . innerText = parseHtmlEntities ( json _text ) ;
} catch ( err ) {
console . log ( err ) ;
2022-04-05 18:05:13 +02:00
}
}
}
2023-02-04 17:29:46 +01:00
let banner = document . querySelector ( 'section.hide_this_section' ) ;
hideDOMElement ( banner ) ;
2022-04-05 18:05:13 +02:00
}
2021-05-25 19:28:02 +02:00
else if ( matchDomain ( 'hindustantimes.com' ) ) {
let paywall = document . querySelector ( '.freemium-card' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let freemium _text = document . querySelector ( '.freemiumText' ) ;
if ( freemium _text )
freemium _text . classList . remove ( 'freemiumText' ) ;
}
let noscroll = document . querySelector ( 'body.open-popup' ) ;
if ( noscroll )
noscroll . classList . remove ( 'open-popup' ) ;
let close _story = document . querySelector ( '.closeStory' ) ;
let ads = document . querySelectorAll ( 'div[class^="adHeight"]' ) ;
removeDOMElement ( close _story , ... ads ) ;
}
2023-06-25 09:55:49 +02:00
else if ( matchDomain ( 'hindutamil.in' ) ) {
if ( ! window . location . pathname . startsWith ( '/amp/' ) ) {
let paywall = document . querySelector ( 'div.premium-class-bt' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
}
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'historyextra.com' ) ) {
let article _masked = document . querySelector ( '.template-article__masked' ) ;
if ( article _masked ) {
let extra _pars = document . querySelectorAll ( 'div.template-article__masked > p' ) ;
removeDOMElement ( ... extra _pars ) ;
article _masked . classList . remove ( 'template-article__masked' ) ;
}
let ad _banner = document . querySelector ( '.ad-banner-container' ) ;
removeDOMElement ( ad _banner ) ;
2021-01-22 13:58:54 +01:00
}
2022-01-08 15:46:46 +01:00
else if ( matchDomain ( usa _hearst _comm _domains ) ) {
2021-06-27 09:56:42 +02:00
let wrapper = document . querySelector ( '.belowMastheadWrapper' ) ;
2022-09-18 16:41:03 +02:00
let ads = document . querySelectorAll ( 'div.adModule' ) ;
removeDOMElement ( wrapper , ... ads ) ;
2021-06-27 09:56:42 +02:00
}
2021-08-05 19:43:10 +02:00
else if ( matchDomain ( 'inc42.com' ) ) {
let url = window . location . href ;
2023-01-09 17:00:43 +01:00
let paywall = document . querySelector ( 'div#inc42_article_content_lock' ) ;
let article _sel = 'div.content-wrapper, section[amp-access="status"]' ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
csDoneOnce = true ;
let url _cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url . split ( '?' ) [ 0 ] ;
replaceDomElementExt ( url _cache , true , false , article _sel ) ;
}
window . setTimeout ( function ( ) {
if ( window . location . pathname . endsWith ( '/amp/' ) ) {
let lazy _images = document . querySelectorAll ( 'img.lazyload[src^="data:image/"][data-src]' ) ;
for ( let elem of lazy _images ) {
elem . src = elem . getAttribute ( 'data-src' ) ;
elem . classList . remove ( 'lazyload' ) ;
if ( elem . width > 1000 ) {
let ratio = elem . width / 640 ;
if ( window . navigator . userAgent . toLowerCase ( ) . includes ( 'mobile' ) )
ratio = elem . width / 320 ;
elem . width = elem . width / ratio ;
elem . height = elem . height / ratio ;
}
}
2021-08-05 19:43:10 +02:00
}
2023-01-09 17:00:43 +01:00
let also _read = document . querySelector ( 'div > .also-read' ) ;
if ( also _read ) {
let article = document . querySelector ( article _sel ) ;
if ( article )
article . appendChild ( also _read . parentNode ) ;
2021-08-05 19:43:10 +02:00
}
2023-01-09 17:00:43 +01:00
} , 1000 ) ;
2021-08-05 19:43:10 +02:00
}
2021-12-19 11:13:00 +01:00
else if ( matchDomain ( 'indianexpress.com' ) ) {
if ( window . location . pathname . endsWith ( '/lite/' ) )
2022-03-06 17:43:38 +01:00
amp _unhide _access _hide ( '="metering.result=\'ALLOW_ACCESS\'"' , '' , 'amp-ad, amp-embed' ) ;
2021-12-19 11:13:00 +01:00
else {
2022-01-08 16:43:25 +01: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 11:13:00 +01:00
let ads = document . querySelectorAll ( 'div[class^="adsbox"]' ) ;
2022-01-08 16:43:25 +01:00
removeDOMElement ( register , ... ads ) ;
2021-12-19 11:13:00 +01:00
}
}
2022-03-06 17:43:38 +01: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 17:54:59 +02:00
else if ( matchDomain ( 'infzm.com' ) ) {
let url = window . location . href ;
if ( url . includes ( '/wap/#/' ) ) {
let container = document . querySelector ( 'section.container' ) ;
if ( container )
container . classList . remove ( 'container' ) ;
let overlay = document . querySelector ( 'div.article-content[style]' ) ;
if ( overlay )
overlay . removeAttribute ( 'style' ) ;
}
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'inkl.com' ) ) {
2023-03-07 09:22:31 +01:00
let paywall = document . querySelector ( 'div.paywall' ) ;
if ( paywall ) {
paywall . removeAttribute ( 'class' ) ;
2022-11-05 15:09:46 +01:00
let gradient _container = document . querySelector ( 'div.gradient-container' ) ;
2023-03-07 09:22:31 +01:00
removeDOMElement ( gradient _container ) ;
2022-11-05 15:09:46 +01:00
}
let what _is _inkl = document . querySelector ( '.what-is-inkl-container, .features-panel' ) ;
2023-01-21 17:47:44 +01:00
let signup = document . querySelectorAll ( '.article-signup-container, .locked-sign-up-container, div[class*="/inkl-watermark.svg"]' ) ;
let shared _banner = document . querySelector ( 'div.shared-article-inline-banner' ) ;
removeDOMElement ( what _is _inkl , ... signup , shared _banner ) ;
2022-11-05 15:09:46 +01:00
let dismiss _button = document . querySelector ( 'div.dismiss-button-container button.btn' ) ;
if ( dismiss _button )
dismiss _button . click ( ) ;
let dive _deeper _summary _bodies = document . querySelectorAll ( 'div.dive-deeper-container div.summary-body' ) ;
if ( dive _deeper _summary _bodies ) {
for ( let summary _body of dive _deeper _summary _bodies ) {
if ( ! summary _body . querySelector ( 'a' ) ) {
let ng _click = summary _body . getAttribute ( 'ng-click' ) . replace ( "showArticle('" , '' ) . replace ( "')" , '' ) ;
let weblink = document . createElement ( 'a' ) ;
weblink . text = 'open' ;
weblink . href = 'https://www.inkl.com/news/' + ng _click ;
summary _body . appendChild ( weblink ) ;
}
}
}
2021-01-22 14:33:25 +01:00
}
2022-03-26 19:51:27 +01:00
else if ( matchDomain ( 'ipolitics.ca' ) ) {
let login = document . querySelector ( 'div.login' ) ;
2023-05-08 20:05:06 +02:00
if ( login && dompurify _loaded ) {
2022-03-26 19:51:27 +01:00
removeDOMElement ( login ) ;
let json _script = document . querySelector ( 'script#__NEXT_DATA__' ) ;
2023-02-11 09:20:49 +01:00
if ( json _script ) {
2023-03-15 18:37:22 +01:00
try {
let json = JSON . parse ( json _script . innerText ) ;
if ( json && json . props . pageProps . post && json . props . pageProps . post . content ) {
let url _next = json . props . pageProps . post . slug ;
if ( url _next && ! window . location . pathname . includes ( url _next ) )
refreshCurrentTab ( ) ;
let article _new = json . props . pageProps . post . content ;
let article = document . querySelector ( '.post-body' ) ;
if ( article ) {
article . innerHTML = '' ;
article . classList . remove ( 'locked' ) ;
let parser = new DOMParser ( ) ;
2023-05-08 20:05:06 +02:00
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( article _new ) + '</div>' , 'text/html' ) ;
2023-03-15 18:37:22 +01:00
let content _new = doc . querySelector ( 'div' ) ;
article . appendChild ( content _new ) ;
}
} else {
refreshCurrentTab ( ) ;
2022-03-26 19:51:27 +01:00
}
2023-03-15 18:37:22 +01:00
} catch ( err ) {
console . log ( err ) ;
2022-03-26 19:51:27 +01:00
}
}
}
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'jpost.com' ) ) {
let premium _banners = document . querySelectorAll ( '.hide-for-premium, #hiddenPremiumForm, #hiddenLink' ) ;
removeDOMElement ( ... premium _banners ) ;
}
2021-12-11 12:59:19 +01:00
else if ( matchDomain ( [ 'latimes.com' , 'sandiegouniontribune.com' ] ) ) {
2023-02-03 19:20:36 +01:00
let ads = document . querySelectorAll ( 'div.enhancement, div.google-dfp-ad-wrapper' ) ;
removeDOMElement ( ... ads ) ;
2021-12-11 12:59:19 +01:00
}
2022-07-22 18:39:59 +02:00
else if ( matchDomain ( 'ledevoir.com' ) ) {
let counter = document . querySelector ( '.paywall-breakpoint-wrapper' ) ;
removeDOMElement ( counter ) ;
}
2021-08-13 17:29:49 +02:00
else if ( matchDomain ( 'livelaw.in' ) ) {
2022-05-15 18:25:58 +02:00
let paywall = document . querySelector ( 'div#subscription_paid_message, div.subscribeNow' ) ;
2022-02-19 09:12:00 +01:00
if ( paywall ) {
2022-05-15 18:25:58 +02: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 17:29:49 +02:00
let paywall _content = document . querySelector ( 'div.paywall-content.hide' ) ;
if ( paywall _content )
paywall _content . classList . remove ( 'hide' ) ;
}
2022-05-15 18:25:58 +02:00
let ads = document . querySelectorAll ( 'inside-post-ad, amp-ad' ) ;
removeDOMElement ( ... ads ) ;
2021-08-13 17:29:49 +02:00
}
2021-12-12 09:38:17 +01: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 20:02:29 +02: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 09:38:17 +01:00
}
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'magazine.atavist.com' ) ) {
let bottom _notification = document . querySelector ( 'div.bottom-notification' ) ;
let overlay = document . querySelector ( 'div.notification-overlay' ) ;
removeDOMElement ( bottom _notification , overlay ) ;
let paywall = document . querySelector ( 'body.paywall-notification-visible' ) ;
if ( paywall )
paywall . classList . remove ( 'paywall-notification-visible' ) ;
2021-01-23 18:13:24 +01:00
}
2021-01-24 10:25:55 +01:00
else if ( matchDomain ( 'marketwatch.com' ) ) {
2021-04-10 08:46:50 +02:00
let premium = document . querySelector ( 'html.is-paywall' ) ;
let url = window . location . href ;
if ( ! url . includes ( '/amp/' ) ) {
if ( premium ) {
premium . classList . remove ( 'is-paywall' ) ;
window . location . href = url . replace ( '.marketwatch.com/' , '.marketwatch.com/amp/' ) ;
}
} else {
let meter = document . querySelector ( 'div.meter' ) ;
let container _sponsored = document . querySelector ( 'div.container--sponsored' ) ;
2021-11-30 17:36:15 +01:00
removeDOMElement ( meter , container _sponsored ) ;
amp _unhide _subscr _section ( '.display-ad' ) ;
2021-04-10 08:46:50 +02:00
}
let ads = document . querySelectorAll ( 'div.element--ad, div.j-ad' ) ;
removeDOMElement ( ... ads ) ;
}
2022-10-08 09:12:12 +02:00
else if ( matchDomain ( 'medscape.com' ) ) {
let ads = document . querySelectorAll ( '.AdUnit, [id^="ads-"]' ) ;
removeDOMElement ( ... ads ) ;
}
2022-03-16 18:48:58 +01: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 08:46:50 +02:00
else if ( matchDomain ( 'nationalgeographic.com' ) ) {
2022-11-05 15:09:46 +01:00
function natgeo _func ( node ) {
removeDOMElement ( node ) ;
let body = document . querySelector ( 'body[class]' ) ;
if ( body ) {
body . removeAttribute ( 'class' ) ;
body . removeAttribute ( 'style' ) ;
}
2021-04-10 08:46:50 +02:00
}
2022-11-05 15:09:46 +01:00
waitDOMElement ( 'div[id^="fittPortal"]' , 'DIV' , natgeo _func , false ) ;
csDoneOnce = true ;
window . setTimeout ( function ( ) {
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 ) {
subscribed . appendChild ( archiveLink ( url ) ) ;
subscribed . setAttribute ( 'style' , 'overflow: visible !important;' ) ;
if ( overlay )
overlay . classList . remove ( 'Article__Content__Overlay--gated' ) ;
}
2023-01-28 11:10:24 +01:00
let ads = document . querySelectorAll ( 'div.ad-slot, div.InsertedAd' ) ;
2022-11-05 15:09:46 +01:00
removeDOMElement ( ... ads ) ;
} , 1000 ) ;
2021-01-26 21:27:43 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'nationalreview.com' ) ) {
2022-09-04 09:13:36 +02:00
if ( ! window . location . pathname . endsWith ( '/amp/' ) ) {
2023-01-11 19:36:19 +01:00
window . setTimeout ( function ( ) {
let paywall = document . querySelector ( 'div.continue-reading' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
refreshCurrentTab ( ) ;
}
} , 1000 ) ;
2021-10-13 17:59:18 +02:00
}
2023-01-11 19:36:19 +01:00
let zephr _wrapper = document . querySelector ( 'div.zephr-wrapper' ) ;
hideDOMElement ( zephr _wrapper ) ;
let ads = document . querySelectorAll ( 'amp-ad, .ad-unit, .ad-skeleton, amp-connatix-player, div[class*="-connatix-"]' ) ;
hideDOMElement ( ... ads ) ;
2021-01-28 17:34:00 +01:00
}
2022-06-24 20:57:28 +02:00
else if ( matchDomain ( 'nautil.us' ) ) {
2023-04-07 10:06:43 +02:00
let banners = document . querySelectorAll ( 'div[class^="a__sc-np"], div.subscibe-bar' ) ;
removeDOMElement ( ... banners ) ;
2022-06-24 20:57:28 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'newleftreview.org' ) ) {
2021-07-07 18:30:24 +02:00
window . setTimeout ( function ( ) {
let url = window . location . href ;
let paywall = document . querySelector ( 'div.promo-wrapper' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
2022-04-09 17:07:30 +02:00
csDoneOnce = true ;
2022-08-02 17:26:56 +02:00
let url _cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url . split ( '?' ) [ 0 ] ;
2021-12-24 08:32:45 +01:00
replaceDomElementExt ( url _cache , true , false , 'div.article-page' ) ;
2021-07-07 18:30:24 +02:00
}
2022-03-08 19:04:50 +01:00
} , 500 ) ;
2021-04-10 08:46:50 +02:00
}
2021-09-29 20:43:21 +02:00
else if ( matchDomain ( 'newrepublic.com' ) ) {
2023-03-23 18:40:27 +01:00
let modal = document . querySelector ( 'div.article-scheduled-modal' ) ;
2021-11-09 17:18:34 +01:00
let pw _popups = document . querySelector ( 'div#pwPopups' ) ;
let ads = document . querySelectorAll ( '.ad-unit, .ad-container' ) ;
2023-03-23 18:40:27 +01:00
removeDOMElement ( modal , pw _popups , ... ads ) ;
2021-09-29 20:43:21 +02:00
}
2022-08-24 20:28:54 +02: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 ] ;
2023-03-02 12:05:13 +01:00
replaceDomElementExt ( url _cache , true , false , 'div.article-body, article' ) ;
2022-08-24 20:28:54 +02:00
}
window . setTimeout ( function ( ) {
2023-04-01 14:00:23 +02:00
let lazy _images = document . querySelectorAll ( 'img.lazyload[data-src]:not([src])' ) ;
2022-08-24 20:28:54 +02:00
for ( let elem of lazy _images )
elem . src = elem . getAttribute ( 'data-src' ) . split ( '?' ) [ 0 ] + '?width=800' ;
2023-03-02 12:05:13 +01:00
let ads = document . querySelectorAll ( 'div[class*="Advert"]' ) ;
removeDOMElement ( ... ads ) ;
2022-08-24 20:28:54 +02:00
} , 1000 ) ;
}
2021-12-11 19:12:13 +01:00
else if ( matchDomain ( 'newsday.com' ) ) {
if ( window . location . pathname . startsWith ( '/amp/' ) ) {
2023-02-15 16:58:28 +01:00
amp _unhide _access _hide ( '="AccessLevel = \'Full Content Access\' OR Error = true"' , '="Error != true AND UserState != \'Subscribed\'"' ) ;
2023-02-26 13:11:15 +01:00
} else {
let nd _lock = document . querySelector ( 'html[class]' ) ;
if ( nd _lock )
nd _lock . removeAttribute ( 'class' ) ;
let ads = document . querySelectorAll ( 'div[class^="ad_full-banner_"]' ) ;
hideDOMElement ( ... ads ) ;
2021-12-11 19:12:13 +01:00
}
}
2021-12-08 17:45:19 +01: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 08:46:50 +02: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 19:31:36 +02:00
let banner = document . querySelector ( 'div.toast-cta, div.inline-ad' ) ;
2021-04-10 08:46:50 +02:00
removeDOMElement ( banner ) ;
}
else if ( matchDomain ( 'nytimes.com' ) ) {
2023-04-22 10:24:36 +02:00
let banners = document . querySelectorAll ( 'div[data-testid="inline-message"], div[id^="ad-"], div.expanded-dock, div.pz-ad-box' ) ;
2022-08-25 21:28:05 +02:00
removeDOMElement ( ... banners ) ;
2021-01-30 12:55:39 +01:00
}
2022-04-18 20:35:24 +02:00
else if ( matchDomain ( 'nzherald.co.nz' ) ) {
2023-01-31 22:36:41 +01:00
// plus code in contentScript_once_var.js (timing)
2022-04-18 20:35:24 +02:00
let premium _toaster = document . querySelector ( '#premium-toaster' ) ;
2022-12-08 18:08:28 +01:00
let ads = document . querySelectorAll ( '.ad' ) ;
2023-01-25 08:55:58 +01:00
hideDOMElement ( premium _toaster , ... ads ) ;
2022-04-18 20:35:24 +02:00
}
2022-07-08 08:10:35 +02:00
else if ( matchDomain ( 'outlookbusiness.com' ) ) {
let paywall = document . querySelector ( 'div#csc-paywall' ) ;
2023-05-08 20:05:06 +02:00
if ( paywall && dompurify _loaded ) {
2022-07-08 08:10:35 +02:00
removeDOMElement ( paywall ) ;
let json _script = document . querySelector ( 'script#__NEXT_DATA__' ) ;
2023-02-11 09:20:49 +01:00
if ( json _script ) {
2022-07-08 08:10:35 +02:00
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 ( ) ;
2023-05-08 20:05:06 +02:00
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( article _new ) + '</div>' , 'text/html' ) ;
2022-07-08 08:10:35 +02:00
let content _new = doc . querySelector ( 'div' ) ;
article . appendChild ( content _new ) ;
}
}
}
}
}
2022-04-18 08:14:17 +02: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-11-16 08:27:47 +01:00
else if ( matchDomain ( 'project-syndicate.org' ) ) {
let url = window . location . href ;
let paywall = document . querySelector ( 'div.paywall--base' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let article = document . querySelector ( 'div[data-page-area="article-body"]' ) ;
if ( article )
2023-01-25 18:46:53 +01:00
article . firstChild . before ( archiveLink ( url ) ) ;
2022-11-16 08:27:47 +01:00
}
}
2023-07-01 09:21:00 +02:00
else if ( matchDomain ( 'puck.news' ) ) {
let url = window . location . href ;
2023-07-19 12:31:04 +02:00
let paywall = document . querySelectorAll ( 'div[class*="paywall"]' ) ;
if ( paywall . length ) {
removeDOMElement ( ... paywall ) ;
2023-07-01 09:21:00 +02:00
csDoneOnce = true ;
let url _cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url . split ( '?' ) [ 0 ] ;
replaceDomElementExt ( url _cache , true , false , 'div.entry-content' ) ;
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 11:57:46 +01:00
else if ( matchDomain ( 'quora.com' ) ) {
2022-02-03 19:11:51 +01:00
let overlays = document . querySelectorAll ( 'div[class*="_overlay"]' ) ;
removeDOMElement ( ... overlays ) ;
2023-05-26 13:41:05 +02:00
let mask _image = document . querySelector ( 'div.jhqnqh' ) ;
2021-11-13 11:57:46 +01:00
if ( mask _image )
2023-05-26 13:41:05 +02:00
mask _image . classList . remove ( 'jhqnqh' ) ;
let read _more _buttons = document . querySelectorAll ( 'button.puppeteer_test_read_more_button.qu-bg--gray_ultralight' ) ;
2022-11-18 14:17:44 +01:00
for ( let elem of read _more _buttons )
elem . click ( ) ;
let overlay _cards = document . querySelectorAll ( 'div[class*="OverlayCard"]' ) ;
for ( let elem of overlay _cards )
elem . removeAttribute ( 'class' ) ;
window . setTimeout ( function ( ) {
let answers = document . querySelectorAll ( 'div[class*="dom_annotate_question_answer_item_"]' ) ;
for ( let answer of answers ) {
let wall = answer . querySelector ( 'div.content-monetization-wall' ) ;
if ( wall ) {
wall . classList . remove ( 'content-monetization-wall' ) ;
let timestamp _link = answer . querySelector ( 'a.answer_timestamp[href]' ) ;
if ( timestamp _link ) {
let answer _link = document . createElement ( 'a' ) ;
answer _link . innerText = 'BPC > open Quora+ answer' ;
answer _link . href = timestamp _link . href ;
wall . appendChild ( answer _link ) ;
}
}
}
} , 500 ) ;
2021-11-13 11:57:46 +01:00
}
2022-03-06 17:43:38 +01: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 10:39:41 +01:00
}
2022-01-02 19:21:05 +01: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 18:34:21 +01: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 18:12:59 +02:00
}
2023-01-06 17:41:41 +01:00
else if ( matchDomain ( 'seattletimes.com' ) ) {
let ads = document . querySelectorAll ( '.top-ad-wrapper, .ad-container' ) ;
removeDOMElement ( ... ads ) ;
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'seekingalpha.com' ) ) {
2022-11-18 14:17:44 +01:00
if ( ! window . location . pathname . startsWith ( '/amp/' ) ) {
let locked = document . querySelector ( 'div[data-test-id="post-locked-banner"]' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
if ( locked && amphtml ) {
locked . removeAttribute ( 'data-test-id' ) ;
window . location . href = amphtml . href ;
} else {
let read _more = document . querySelector ( 'button[id^="continueReadingButton"]' ) ;
if ( read _more )
read _more . click ( ) ;
}
} else {
2021-11-30 17:36:15 +01:00
amp _unhide _access _hide ( '*="premium_access OR"' , '' , '.ad-wrap' ) ;
2021-04-10 08:46:50 +02:00
let paywall = document . querySelector ( '[class*="paywall-container"]' ) ;
2021-11-30 17:36:15 +01:00
removeDOMElement ( paywall ) ;
2021-04-10 08:46:50 +02:00
}
2021-02-05 14:57:27 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'slate.com' ) ) {
let slate _roadblock = document . querySelector ( '.slate-roadblock' ) ;
let ads = document . querySelectorAll ( 'section[class*="-ad"]' ) ;
removeDOMElement ( slate _roadblock , ... ads ) ;
2021-02-13 17:46:39 +01:00
}
2022-05-27 15:11:37 +02: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 10:13:35 +01:00
else if ( matchDomain ( 'sloanreview.mit.edu' ) ) {
2022-12-12 09:06:10 +01:00
let url = window . location . href ;
let paywall = document . querySelector ( 'body.is-paywall' ) ;
2022-01-23 10:13:35 +01:00
if ( paywall ) {
2022-12-12 09:06:10 +01:00
paywall . classList . remove ( 'is-paywall' ) ;
2022-01-23 10:13:35 +01:00
csDoneOnce = true ;
2022-12-12 09:06:10 +01:00
let url _cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url . split ( '?' ) [ 0 ] ;
replaceDomElementExt ( url _cache , true , false , 'div#article-content' ) ;
2022-01-23 10:13:35 +01:00
}
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'sofrep.com' ) ) {
2023-01-26 09:08:35 +01:00
let paywall = document . querySelector ( 'div.paywall' ) ;
if ( paywall ) {
paywall . removeAttribute ( 'class' ) ;
let intro = document . querySelector ( 'div.non-paywall' ) ;
removeDOMElement ( intro ) ;
waitDOMElement ( 'div#paywall_wrap' , 'DIV' , node => removeDOMElement ( node . parentNode ) ) ;
2022-07-07 19:12:31 +02:00
}
2021-04-10 08:46:50 +02:00
let banners = document . querySelectorAll ( '#scrollerCTA, #botCta' ) ;
removeDOMElement ( ... banners ) ;
2021-02-13 18:11:58 +01:00
}
2022-03-27 18:25:09 +02: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' ) ;
}
2023-05-05 07:26:10 +02:00
else if ( matchDomain ( 'sportico.com' ) ) {
if ( window . location . pathname . endsWith ( '/amp/' ) )
amp _unhide _subscr _section ( 'amp-ad, amp-embed' , false ) ;
}
2021-05-27 20:22:45 +02:00
else if ( matchDomain ( 'staradvertiser.com' ) ) {
2023-04-29 09:51:38 +02:00
if ( window . location . pathname . endsWith ( '/amp/' ) ) {
2021-11-30 17:36:15 +01:00
amp _unhide _subscr _section ( ) ;
2021-05-27 20:22:45 +02: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 08:46:50 +02:00
else if ( matchDomain ( 'startribune.com' ) ) {
2023-07-18 08:50:51 +02:00
let modal = document . querySelector ( 'body.ReactModal__Body--open' ) ;
if ( modal )
modal . classList . remove ( 'ReactModal__Body--open' ) ;
2023-07-21 17:04:27 +02:00
let banner = document . querySelector ( 'div#meterContent' ) ;
let banner _modal ;
if ( banner )
banner _modal = banner . closest ( 'div.ReactModalPortal' ) ;
2022-01-13 17:26:17 +01:00
let ads = document . querySelectorAll ( 'div.ad-placeholder' ) ;
2023-07-21 17:04:27 +02:00
removeDOMElement ( banner _modal , ... ads ) ;
2021-02-18 19:47:12 +01:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'stocknews.com' ) ) {
let hideme = document . querySelector ( 'div#hideme' ) ;
removeDOMElement ( hideme ) ;
let blurmes = document . querySelectorAll ( 'div[id^="blurme"]' ) ;
for ( let i = 0 ; i < blurmes . length ; i ++ )
blurmes [ i ] . setAttribute ( 'id' , 'blurmenot' + i ) ;
2021-02-27 14:20:30 +01:00
}
2023-01-18 17:19:26 +01:00
else if ( matchDomain ( 'statista.com' ) ) {
if ( window . location . pathname . startsWith ( '/outlook/' ) ) {
let promo = document . querySelector ( 'section#promotionElement' ) ;
let chartbox _paywall = document . querySelectorAll ( 'div.xmoChartBoxPaywall' ) ;
removeDOMElement ( promo , ... chartbox _paywall ) ;
let blurred = document . querySelectorAll ( '.blurred' ) ;
for ( let elem of blurred )
elem . removeAttribute ( 'class' ) ;
}
}
2022-07-19 21:26:00 +02:00
else if ( matchDomain ( 'studocu.com' ) ) {
window . setTimeout ( function ( ) {
2023-02-01 17:34:26 +01:00
let paywall = document . querySelector ( 'button[data-test-selector^="preview-banner-"]' ) ;
2022-07-19 21:26:00 +02:00
if ( paywall ) {
2023-04-17 20:25:35 +02:00
let paywall _banner = document . querySelector ( '#document-wrapper > div:not([style])' ) ;
2023-02-01 17:34:26 +01:00
let banners = document . querySelectorAll ( 'div.pf > :not(.page-content), div#premium-page-header' ) ;
removeDOMElement ( paywall _banner , ... banners ) ;
2023-01-25 18:46:53 +01:00
window . setTimeout ( function ( ) {
let blurred _pages = document . querySelectorAll ( 'div.page-content[style]' ) ;
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 ) ;
}
} , 2000 ) ;
2022-07-19 21:26:00 +02:00
}
} , 1000 ) ;
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'techinasia.com' ) ) {
let paywall = document . querySelector ( '.paywall-content' ) ;
2023-05-08 20:05:06 +02:00
if ( paywall && dompurify _loaded ) {
2021-04-10 08:46:50 +02:00
paywall . classList . remove ( 'paywall-content' ) ;
2021-05-02 16:14:45 +02:00
let url = window . location . href ;
2021-10-15 16:06:02 +02:00
let url _xhr = url . replace ( '.com/' , '.com/wp-json/techinasia/2.0/posts/' ) . replace ( '/visual-story/' , '/' ) ;
2021-05-02 16:14:45 +02:00
fetch ( url _xhr )
. then ( response => {
if ( response . ok ) {
response . json ( ) . then ( json => {
let json _text = json . posts [ 0 ] . content ;
2021-05-27 20:22:45 +02:00
json _text = json _text . replace ( /width\=\"(\d){3,}\"/g , 'width="100%"' ) . replace ( /height\=\"(\d){3,}\"/g , 'height="100%"' ) ;
2021-05-02 16:14:45 +02:00
let content = document . querySelector ( 'div.content' ) ;
if ( json _text && content ) {
let parser = new DOMParser ( ) ;
2023-05-08 20:05:06 +02:00
let doc = parser . parseFromString ( '<div class="jsx-1794864983 content">' + DOMPurify . sanitize ( json _text ) + '</div>' , 'text/html' ) ;
2021-05-02 16:14:45 +02:00
let content _new = doc . querySelector ( 'div.content' ) ;
content . parentNode . replaceChild ( content _new , content ) ;
}
} ) ;
}
} ) ;
}
2021-04-10 08:46:50 +02:00
let splash _subscribe = document . querySelector ( '.splash-subscribe' ) ;
let paywall _hard = document . querySelector ( '.paywall-hard' ) ;
removeDOMElement ( splash _subscribe , paywall _hard ) ;
}
2023-05-28 09:34:59 +02:00
else if ( matchDomain ( [ 'techtarget.com' , 'computerweekly.com' , 'lemagit.fr' ] ) ) {
let paywall = document . querySelector ( 'div.paywall' ) ;
if ( paywall ) {
paywall . classList . remove ( 'paywall' ) ;
let banners = document . querySelectorAll ( 'p#firstP, div#inlineRegistrationWrapper' ) ;
removeDOMElement ( ... banners ) ;
}
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'the-american-interest.com' ) ) {
let counter = document . getElementById ( 'article-counter' ) ;
removeDOMElement ( counter ) ;
2021-03-01 18:04:43 +01:00
}
2022-06-30 20:26:07 +02:00
else if ( matchDomain ( 'theathletic.com' ) ) {
2022-12-04 17:53:35 +01:00
if ( ! ( window . location . search . match ( /(\?|&)amp/ ) && ! document . querySelector ( 'link[rel="amphtml"]' ) ) ) {
2023-06-24 08:02:53 +02:00
function theathletic _func ( node ) {
removeDOMElement ( node ) ;
2022-10-21 08:03:16 +02:00
let overlays = document . querySelectorAll ( 'div[id*="overlay"], div:empty:not([data-rjs])' ) ;
2023-01-11 07:37:33 +01:00
hideDOMElement ( ... overlays ) ;
2022-10-21 08:03:16 +02:00
let body = document . querySelector ( 'body' ) ;
if ( body ) {
body . style . overflow = 'visible' ;
body . style . position = 'relative' ;
}
2022-06-30 20:26:07 +02:00
}
2023-06-24 08:02:53 +02:00
waitDOMElement ( 'div[id^="slideup-"]' , 'DIV' , theathletic _func ) ;
csDoneOnce = true ;
2022-06-30 20:26:07 +02:00
} else {
amp _unhide _subscr _section ( ) ;
2022-08-02 23:39:41 +02:00
amp _unhide _access _hide ( '' , '*="NOT granted"' ) ;
2022-06-30 20:26:07 +02:00
}
2022-08-04 12:38:00 +02:00
let apron = document . querySelector ( 'div#free-apron-cta, div.slideup-free-apron-container' ) ;
2022-09-17 08:30:01 +02:00
let ads = document . querySelectorAll ( 'div.ad-container' ) ;
removeDOMElement ( apron , ... ads ) ;
2022-06-30 20:26:07 +02:00
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'theatlantic.com' ) ) {
2023-02-04 07:49:48 +01:00
let lazy _images = document . querySelectorAll ( 'img.Image_lazy__tutlP' ) ;
for ( let elem of lazy _images )
elem . classList . remove ( 'Image_lazy__tutlP' ) ;
2022-12-03 18:13:37 +01:00
let banners = document . querySelectorAll ( '.c-nudge__container, .c-non-metered-nudge, div[class^="ArticleInjector_"]' ) ;
2023-02-02 08:16:46 +01:00
hideDOMElement ( ... banners ) ;
2021-03-07 14:03:22 +01:00
}
2022-12-27 12:51:47 +01:00
else if ( matchDomain ( 'thebulletin.org' ) ) {
let url = window . location . href ;
let paywall = document . querySelector ( 'div.article--cropped' ) ;
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#body-copy' ) ;
}
}
2021-08-13 15:29:59 +02:00
else if ( matchDomain ( 'thedailybeast.com' ) ) {
let paywall = document . querySelector ( 'div.Body__paywall-container' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let json _script = document . querySelector ( 'script[displayName="initialState"]' ) ;
if ( json _script ) {
2021-08-19 09:03:09 +02:00
let json _str = json _script . text . substring ( json _script . textContent . indexOf ( '{' ) ) ;
try {
let json = JSON . parse ( json _str ) ;
if ( json . body ) {
let pars = json . body . sections ;
let cards = json . body . cards ;
if ( pars ) {
let mobile _doc = document . querySelector ( 'div.Mobiledoc' ) ;
if ( mobile _doc ) {
let mobile _doc _text = mobile _doc . innerText . replace ( /(\r|\n)/g , '' ) ;
for ( let elem of pars ) {
let par _elem = '' ;
if ( elem [ 0 ] === 1 ) {
if ( elem [ 1 ] === 'p' ) {
let par = '' ;
for ( let part of elem [ 2 ] )
par += part [ 3 ] ;
if ( par && ! mobile _doc _text . includes ( par ) ) {
par _elem = document . createElement ( 'p' ) ;
par _elem . innerText = par ;
}
}
} else if ( elem [ 0 ] === 10 ) {
if ( cards && cards [ elem [ 1 ] ] ) {
let card = cards [ elem [ 1 ] ] ;
if ( card [ 0 ] === 'pt-image' ) {
par _elem = document . createElement ( 'p' ) ;
let par _fig = document . createElement ( 'figure' ) ;
let par _img = document . createElement ( 'img' ) ;
par _img . src = card [ 1 ] . url ;
par _fig . appendChild ( par _img ) ;
par _elem . appendChild ( par _fig ) ;
let par _cap = document . createElement ( 'figcaption' ) ;
par _cap . innerText = card [ 1 ] . title + ' ' + card [ 1 ] . credit ;
par _elem . appendChild ( par _cap ) ;
} else if ( card [ 0 ] === 'pt-fancy-links-card' ) {
par _elem = document . createElement ( 'p' ) ;
let par _link = document . createElement ( 'a' ) ;
par _link . href = card [ 1 ] . links ;
par _link . innerText = card [ 1 ] . linksData [ 0 ] . long _headline ;
par _elem . appendChild ( par _link ) ;
}
}
}
if ( par _elem )
mobile _doc . appendChild ( par _elem ) ;
2021-08-13 15:29:59 +02:00
}
2021-08-19 09:03:09 +02:00
}
2021-08-13 15:29:59 +02:00
}
}
2021-08-19 09:03:09 +02:00
csDoneOnce = true ;
} catch ( err ) {
console . log ( err ) ;
2021-08-13 15:29:59 +02:00
}
}
}
}
2021-04-14 18:43:07 +02:00
else if ( matchDomain ( 'thediplomat.com' ) ) {
let preview = document . querySelector ( '.dpl-preview' ) ;
if ( preview )
preview . classList . remove ( 'dpl-preview' ) ;
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'theglobeandmail.com' ) ) {
2023-05-19 18:58:33 +02:00
if ( ! window . location . search . startsWith ( '?rel=premium' ) ) {
let paywall = document . querySelector ( 'div.c-paywall' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
window . location . href = window . location . pathname + '?rel=premium' ;
}
} else {
let header _hidden = document . querySelectorAll ( 'div.o-primary-header, div.c-article-meta' ) ;
for ( let elem of header _hidden )
elem . setAttribute ( 'style' , 'display: block !important;' ) ;
2022-10-15 11:08:46 +02:00
}
2023-02-01 17:34:26 +01:00
let lazy _images = document . querySelectorAll ( 'img[src^="data:image/"][data-src]' ) ;
for ( let elem of lazy _images )
elem . src = elem . getAttribute ( 'data-src' ) ;
2023-05-19 18:58:33 +02:00
let banners = document . querySelectorAll ( 'div.c-ad, div#subscription-pencil-area, div.marketing-container-wrapper, div[class^="BaseAd__"]' ) ;
2022-10-19 21:28:47 +02:00
hideDOMElement ( ... banners ) ;
2021-04-10 08:46:50 +02:00
}
else if ( matchDomain ( [ 'thehindu.com' , 'thehindubusinessline.com' ] ) ) {
2022-11-24 17:30:56 +01:00
if ( ! window . location . pathname . endsWith ( '/amp/' ) ) {
let counter = document . querySelector ( '#test' ) ;
let ads = document . querySelectorAll ( '.ad, .article-ad, .dfp-ad' ) ;
removeDOMElement ( counter , ... ads ) ;
} else {
let ads = document . querySelectorAll ( 'amp-ad, amp-embed, [class^="height"], [class^="advt"], [id^="piano"]' ) ;
removeDOMElement ( ... ads ) ;
}
2021-04-10 08:46:50 +02:00
function hindu _main ( ) {
2022-11-24 17:30:56 +01:00
if ( window ) {
window . Adblock = false ;
window . isNonSubcribed = false ;
}
2021-04-10 08:46:50 +02:00
}
insert _script ( hindu _main ) ;
2021-03-13 15:58:27 +01:00
}
2022-06-26 10:48:33 +02:00
else if ( matchDomain ( 'theinitium.com' ) ) {
let paywall = document . querySelector ( 'section.c-wall' ) ;
removeDOMElement ( paywall ) ;
}
2023-03-18 10:09:53 +01:00
else if ( matchDomain ( [ 'thejuggernaut.com' , 'jgnt.co' ] ) ) {
let paywall = pageContains ( 'div.font-mono' , /\Read this article and many more by subscribing today/ ) ;
if ( paywall . length ) {
removeDOMElement ( paywall [ 0 ] . parentNode ) ;
let json _script = document . querySelector ( 'script#__NEXT_DATA__' ) ;
if ( json _script ) {
try {
let json = JSON . parse ( json _script . innerText ) ;
if ( json && json . props . pageProps . post ) {
let url _next = json . query . slug ;
if ( url _next && ! window . location . pathname . includes ( url _next ) )
refreshCurrentTab ( ) ;
let pars = json . props . pageProps . post . fields . textEssay . fields . body . content ;
let article = document . querySelector ( 'div.opacity-50' ) ;
if ( article ) {
article . innerHTML = '' ;
article . removeAttribute ( 'class' ) ;
let par _first = true ;
function attach _text ( sub _item , elem ) {
if ( sub _item . value ) {
let sub _elem = document . createElement ( 'span' ) ;
sub _elem . innerText = sub _item . value ;
if ( sub _item . marks && sub _item . marks . length ) {
let style = '' ;
for ( let mark of sub _item . marks ) {
if ( mark . type === 'bold' )
style += 'font-weight: bold;' ;
else if ( mark . type === 'italic' )
style += 'font-style: italic;' ;
else if ( mark . type === 'underline' )
style += 'text-decoration: underline;' ;
}
sub _elem . style = style ;
}
elem . appendChild ( sub _elem ) ;
}
}
function attach _hyperlink ( sub _item , elem ) {
if ( sub _item . content && sub _item . content [ 0 ] && sub _item . content [ 0 ] . value && sub _item . data && sub _item . data . uri ) {
let sub _elem = document . createElement ( 'a' ) ;
sub _elem . href = sub _item . data . uri ;
sub _elem . innerText = sub _item . content [ 0 ] . value ;
if ( ! matchUrlDomain ( [ 'thejuggernaut.com' , 'jgnt.co' ] , sub _item . data . uri ) )
sub _elem . target = '_blank' ;
sub _elem . style = 'text-decoration: underline;' ;
elem . appendChild ( sub _elem ) ;
}
}
function attach _paragraph ( par , elem ) {
if ( par . content && par . content . length ) {
let span _elem = document . createElement ( 'span' ) ;
for ( let item of par . content ) {
if ( item . nodeType === 'text' ) {
attach _text ( item , span _elem ) ;
} else if ( item . nodeType === 'hyperlink' ) {
attach _hyperlink ( item , span _elem ) ;
} else
console . log ( item ) ;
}
elem . appendChild ( span _elem ) ;
}
}
for ( let par of pars ) {
let elem = document . createElement ( 'p' ) ;
if ( [ 'paragraph' , 'heading-1' ] . includes ( par . nodeType ) ) {
attach _paragraph ( par , elem ) ;
} else if ( [ 'blockquote' ] . includes ( par . nodeType ) ) {
if ( par . content && par . content . length ) {
for ( let item of par . content ) {
if ( item . nodeType === 'paragraph' ) {
elem . style = 'margin: 0px 20px; font-style: italic;' ;
attach _paragraph ( item , elem ) ;
} else
console . log ( item ) ;
}
}
} else if ( par . nodeType === 'hr' ) {
elem . appendChild ( document . createElement ( 'hr' ) ) ;
} else if ( par . nodeType === 'embedded-asset-block' ) {
if ( ! par _first ) {
if ( par . data && par . data . target && par . data . target . fields ) {
if ( par . data . target . fields . file && par . data . target . fields . file . url ) {
let figure = document . createElement ( 'figure' ) ;
let img = document . createElement ( 'img' ) ;
img . src = par . data . target . fields . file . url ;
figure . appendChild ( img ) ;
if ( par . data . target . fields . description ) {
let caption = document . createElement ( 'figcaption' ) ;
caption . innerText = par . data . target . fields . description ;
figure . appendChild ( caption ) ;
}
elem . appendChild ( figure ) ;
}
}
} else
par _first = false ;
} else if ( par . nodeType === 'unordered-list' ) {
if ( par . content && par . content . length ) {
let ul = document . createElement ( 'ul' ) ;
for ( let item of par . content ) {
if ( item . nodeType === 'list-item' ) {
if ( item . content ) {
for ( let sub _item _par of item . content ) {
if ( sub _item _par . nodeType === 'paragraph' ) {
let li = document . createElement ( 'li' ) ;
attach _paragraph ( sub _item _par , li ) ;
ul . appendChild ( li ) ;
}
}
}
} else
console . log ( item ) ;
}
elem . appendChild ( ul ) ;
}
} else {
console . log ( par ) ;
}
if ( elem . hasChildNodes ) {
article . appendChild ( document . createElement ( 'br' ) ) ;
article . appendChild ( elem ) ;
}
}
}
} else
refreshCurrentTab ( ) ;
} catch ( err ) {
console . log ( err ) ;
}
}
}
}
2022-05-19 07:56:10 +02:00
else if ( matchDomain ( 'thelawyersdaily.ca' ) ) {
2022-08-26 19:50:25 +02:00
if ( window . location . pathname . startsWith ( '/amp/' ) ) {
ampToHtml ( ) ;
} else {
let modal = document . querySelectorAll ( '#NewsletterModal, .modal-backdrop' ) ;
removeDOMElement ( ... modal ) ;
}
2022-05-19 07:56:10 +02:00
}
2021-04-28 09:14:47 +02:00
else if ( matchDomain ( 'thenewatlantis.com' ) ) {
let article _gated = document . querySelector ( '.article-gated' ) ;
if ( article _gated )
article _gated . classList . remove ( 'article-gated' ) ;
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'thepointmag.com' ) ) {
let overlay = document . querySelectorAll ( 'div.overlay, div#tpopup-' ) ;
2023-04-08 19:19:49 +02:00
removeDOMElement ( ... overlay ) ;
2021-03-16 18:10:55 +01:00
}
2023-01-06 18:13:16 +01:00
else if ( matchDomain ( 'thequint.com' ) ) {
let paywall = document . querySelector ( 'div.zsqcu' ) ;
if ( paywall ) {
removeDOMElement ( paywall ) ;
let body _hidden = document . querySelector ( 'div#story-body-wrapper' ) ;
if ( body _hidden )
body _hidden . removeAttribute ( 'class' ) ;
function thequint _unhide ( node ) {
node . removeAttribute ( 'class' ) ;
}
waitDOMAttribute ( 'div#story-body-wrapper' , 'DIV' , 'class' , thequint _unhide , true ) ;
}
}
2021-06-12 18:19:48 +02:00
else if ( matchDomain ( 'thewrap.com' ) ) {
let paywall = document . querySelector ( '.wrappro-paywall' ) ;
if ( paywall )
paywall . classList . remove ( 'wrappro-paywall' ) ;
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'timeshighereducation.com' ) ) {
let paywall _cta = document . querySelector ( 'div.paywall-cta' ) ;
if ( paywall _cta ) {
paywall _cta . removeAttribute ( 'style' ) ;
let hidden _divs = document . querySelectorAll ( 'div[style="display: none;"]' ) ;
for ( let hidden _div of hidden _divs )
hidden _div . removeAttribute ( 'style' ) ;
let paywall _fade = document . querySelector ( 'div.paywall-fade' ) ;
if ( paywall _fade )
paywall _fade . classList . remove ( 'paywall-fade' ) ;
}
2021-10-05 18:20:00 +02:00
let hidden _images = document . querySelectorAll ( 'img.b-lazy[src^="data:image/"][data-src]' ) ;
for ( let hidden _image of hidden _images ) {
hidden _image . setAttribute ( 'src' , hidden _image . getAttribute ( 'data-src' ) ) ;
hidden _image . classList . remove ( 'b-lazy' ) ;
hidden _image . parentElement . classList . remove ( 'media--loading' ) ;
}
let ads = document . querySelectorAll ( 'div[id^="div-gpt-in-article-ad-"], div[class^="the-dfp__in-article-ATD"]' ) ;
removeDOMElement ( ... ads ) ;
2021-03-20 17:16:30 +01:00
}
2021-07-23 17:47:39 +02:00
else if ( matchDomain ( timesofindia _domains ) ) {
2022-06-27 08:10:50 +02:00
let url = window . location . href ;
2021-07-23 17:47:39 +02: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' ) ;
}
2023-02-11 09:20:49 +01:00
if ( ! window . location . pathname . includes ( '/amp_' ) ) {
2022-05-20 16:31:40 +02:00
let paywall = document . querySelector ( 'div#story-blocker' ) ;
let amphtml = document . querySelector ( 'link[rel="amphtml"]' ) ;
2022-06-27 08:10:50 +02:00
if ( ! amphtml )
amphtml = { href : url . replace ( '/timesofindia.indiatimes.com/' , '/m.timesofindia.com/' ) . replace ( '/articleshow/' , '/amp_articleshow/' ) } ;
2022-05-20 16:31:40 +02:00
if ( paywall && amphtml ) {
removeDOMElement ( paywall ) ;
window . location . href = amphtml . href ;
}
2023-06-24 09:49:26 +02:00
} else {
let amp _images = document . querySelectorAll ( 'div.inline-image > div.inline-imgecontent > amp-img[src]' ) ;
for ( let amp _image of amp _images ) {
amp _image . parentNode . removeAttribute ( 'class' ) ;
amp _image . parentNode . parentNode . removeAttribute ( 'class' ) ;
let elem = document . createElement ( 'img' ) ;
Object . assign ( elem , {
src : amp _image . getAttribute ( 'src' ) ,
alt : amp _image . getAttribute ( 'alt' )
} ) ;
amp _image . parentNode . replaceChild ( elem , amp _image ) ;
}
2021-12-21 17:38:17 +01:00
}
2021-07-23 17:47:39 +02:00
}
2022-11-09 18:14:23 +01:00
else if ( matchDomain ( no _nhst _media _domains ) ) {
let url = window . location . href ;
if ( url . includes ( '.tradewindsnews.com/markets/' ) ) {
2021-07-11 11:21:13 +02:00
let paywall = document . querySelector ( 'iframe[src]' ) ;
removeDOMElement ( paywall ) ;
let overflow = document . querySelector ( 'body[style]' ) ;
if ( overflow )
overflow . removeAttribute ( 'style' ) ;
let blurred = document . querySelector ( 'body > div[style]' ) ;
if ( blurred )
blurred . removeAttribute ( 'style' ) ;
2022-11-09 18:14:23 +01:00
} else {
window . setTimeout ( function ( ) {
let paywall = document . querySelector ( 'iframe#paywall-iframe' ) ;
2023-05-08 20:05:06 +02:00
if ( paywall && dompurify _loaded ) {
2022-11-09 18:14:23 +01:00
let intro = document . querySelector ( 'div.global-article-selector' ) ;
let article = paywall . parentNode ;
removeDOMElement ( paywall , intro ) ;
fetch ( url )
. then ( response => {
if ( response . ok ) {
response . text ( ) . then ( html => {
let split1 = html . split ( 'window.__INITIAL_STATE__=' ) [ 1 ] ;
let state = ( split1 . split ( '};' ) [ 0 ] + '}' ) . split ( '</script>' ) [ 0 ] ;
if ( state ) {
let json = JSON . parse ( state ) ;
if ( json ) {
let json _text = json . article . body ;
let parser = new DOMParser ( ) ;
2023-05-08 20:05:06 +02:00
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( json _text , { ADD _ATTR : [ 'itemprop' ] , ADD _TAGS : [ 'link' ] } ) + '</div>' , 'text/html' ) ;
2022-11-09 18:14:23 +01:00
let article _new = doc . querySelector ( 'div' ) ;
if ( article _new ) {
if ( article )
article . appendChild ( article _new ) ;
}
}
}
} )
}
} )
}
} , 500 ) ;
2021-07-11 11:21:13 +02:00
}
}
2022-02-10 18:18:04 +01:00
else if ( matchDomain ( usa _conde _nast _domains ) ) {
if ( window . location . pathname . endsWith ( '/amp' ) ) {
amp _unhide _subscr _section ( 'amp-ad, amp-embed, .ad' ) ;
} else {
2023-01-31 09:05:04 +01:00
let banners = document . querySelectorAll ( '.paywall-bar, div[class^="MessageBannerWrapper-"' ) ;
removeDOMElement ( ... banners ) ;
2022-02-10 18:18:04 +01:00
}
}
2021-08-17 22:45:11 +02:00
else if ( matchDomain ( usa _craincomm _domains ) ) {
2021-06-20 20:32:12 +02:00
let body _hidden = document . querySelector ( 'body[class]' ) ;
if ( body _hidden )
body _hidden . removeAttribute ( 'class' ) ;
2021-08-23 20:50:54 +02:00
let lazy _images = document . querySelectorAll ( 'img.lazy[data-src]' ) ;
for ( let lazy _image of lazy _images ) {
lazy _image . src = lazy _image . getAttribute ( 'data-src' ) ;
lazy _image . removeAttribute ( 'class' ) ;
}
let lazy _sources = document . querySelectorAll ( 'source[srcset^="data:image"]' ) ;
removeDOMElement ( ... lazy _sources ) ;
2023-05-02 12:17:13 +02:00
let sponsored _article = document . querySelector ( 'div.sponsored-article' ) ;
if ( sponsored _article )
sponsored _article . classList . remove ( 'sponsored-article' ) ;
2021-06-20 20:32:12 +02:00
}
2022-07-31 08:59:34 +02:00
else if ( matchDomain ( usa _genomeweb _domains ) ) {
let banners = document . querySelectorAll ( 'div.footer__ads-footer' ) ;
removeDOMElement ( ... banners ) ;
}
2022-01-28 16:05:29 +01: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 18:11:31 +01:00
if ( matchDomain ( 'cyclingtips.com' ) ) {
2022-08-13 07:51:42 +02:00
localStorage . removeItem ( 'av' ) ;
2022-02-25 18:11:31 +01:00
let ads = document . querySelectorAll ( 'div[data-block-name="ads"], div#takeover' ) ;
removeDOMElement ( ... ads ) ;
}
2022-01-28 16:05:29 +01:00
}
2021-06-20 20:32:12 +02:00
else if ( matchDomain ( usa _tribune _domains ) ) {
let overlay = document . querySelector ( 'div#zephr-overlay' ) ;
removeDOMElement ( overlay ) ;
}
2021-05-06 19:50:12 +02:00
else if ( matchDomain ( 'usatoday.com' ) ) {
2021-12-09 17:47:00 +01: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 19:50:12 +02:00
}
}
}
2021-04-10 08:46:50 +02:00
else if ( matchDomain ( 'venturebeat.com' ) ) {
window . setTimeout ( function ( ) {
let paywall = document . querySelector ( 'div.paywall' ) ;
if ( paywall )
paywall . classList . remove ( 'paywall' ) ;
2022-03-08 19:04:50 +01:00
} , 500 ) ;
2021-04-10 08:46:50 +02:00
}
else if ( matchDomain ( 'washingtonpost.com' ) ) {
2022-03-15 18:34:21 +01:00
let leaderboard = document . querySelector ( '#leaderboard-wrapper' ) ;
let adverts = document . querySelectorAll ( 'div[data-qa$="-ad"]' ) ;
removeDOMElement ( leaderboard , ... adverts ) ;
2021-04-05 19:56:50 +02:00
}
2022-03-19 17:24:47 +01:00
else if ( matchDomain ( 'winnipegfreepress.com' ) ) {
let ads = document . querySelectorAll ( '.billboard-ad-space, .ad, .article-ad, .fixed-sky' ) ;
removeDOMElement ( ... ads ) ;
}
2021-10-06 08:46:58 +02:00
else if ( matchDomain ( 'wsj.com' ) ) {
2021-08-01 10:30:10 +02:00
let url = window . location . href ;
2021-04-10 08:46:50 +02:00
if ( location . href . includes ( '/articles/' ) ) {
let close _button = document . querySelector ( 'div.close-btn[role="button"]' ) ;
if ( close _button )
close _button . click ( ) ;
}
2023-07-13 17:50:49 +02:00
let wsj _ads = document . querySelectorAll ( 'div.wsj-ad, div.adWrapper' ) ;
2021-04-10 08:46:50 +02:00
removeDOMElement ( ... wsj _ads ) ;
2021-08-01 10:30:10 +02:00
if ( url . includes ( '/amp/' ) ) {
let masthead _link = document . querySelector ( 'div.masthead > a[href*="/articles/"]' ) ;
if ( masthead _link )
masthead _link . href = 'https://www.wsj.com' ;
2021-11-30 17:36:15 +01:00
amp _unhide _subscr _section ( ) ;
2021-08-01 10:30:10 +02:00
} else {
2022-07-06 20:03:33 +02:00
let snippet = document . querySelector ( '.snippet-promotion, div#cx-snippet-overlay' ) ;
2021-11-02 19:00:40 +01: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 10:30:10 +02:00
}
2021-04-07 22:24:53 +02:00
}
2022-12-30 12:35:13 +01:00
else if ( matchDomain ( 'zerohedge.com' ) ) {
2023-03-29 18:05:49 +02:00
window . setTimeout ( function ( ) {
let paywall = document . querySelector ( 'div[class^="PremiumOverlay_container__"]' ) ;
2023-05-08 20:05:06 +02:00
if ( paywall && dompurify _loaded ) {
2023-03-29 18:05:49 +02:00
removeDOMElement ( paywall ) ;
let json _script = document . querySelector ( 'script#__NEXT_DATA__' ) ;
if ( json _script ) {
try {
let json = JSON . parse ( json _script . innerText ) ;
if ( json && json . props . pageProps . node . body ) {
let article _new = parseHtmlEntities ( decode _utf8 ( atob ( json . props . pageProps . node . body . substring ( 21 ) ) ) ) ;
let article = document . querySelector ( 'div[class^="NodeContent_mainContent__"' ) ;
if ( article ) {
article . innerHTML = '' ;
let parser = new DOMParser ( ) ;
2023-05-08 20:05:06 +02:00
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( article _new ) + '</div>' , 'text/html' ) ;
2023-03-29 18:05:49 +02:00
let content _new = doc . querySelector ( 'div' ) ;
article . appendChild ( content _new ) ;
}
2022-12-30 12:35:13 +01:00
}
2023-03-29 18:05:49 +02:00
} catch ( err ) {
console . log ( err ) ;
2022-12-30 12:35:13 +01:00
}
}
}
2023-03-29 18:05:49 +02:00
} , 1000 ) ;
2022-12-30 12:35:13 +01:00
}
2023-04-30 07:38:33 +02:00
else if ( matchDomain ( usa _gannett _domains ) || document . querySelector ( 'img[srcset^="https://www.gannett-cdn.com/"], link[href*=".gannett-cdn.com/"]' ) ) {
if ( window . location . pathname . endsWith ( '/restricted/' ) && window . location . search . startsWith ( '?return=' ) )
window . location . href = decodeURIComponent ( window . location . href . split ( '?return=' ) [ 1 ] ) ;
}
2023-07-20 22:15:51 +02:00
else if ( ( domain = matchDomain ( usa _lee _ent _domains ) ) || matchDomain ( ca _torstar _domains ) || document . querySelector ( 'script[src*=".townnews.com/"][src*="/tncms/"]' ) ) {
2022-04-06 17:17:13 +02:00
if ( window . location . pathname . endsWith ( '.amp.html' ) ) {
2022-07-31 10:43:57 +02:00
amp _unhide _access _hide ( '="hasAccess"' , '="NOT hasAccess"' , 'amp-ad, amp-embed, .amp-ads-container' ) ;
2022-04-06 17:17:13 +02:00
let elem _hidden = document . querySelectorAll ( 'html[class], body[class]' ) ;
for ( let elem of elem _hidden )
elem . removeAttribute ( 'class' ) ;
2023-07-20 22:15:51 +02:00
let amp _images = document . querySelectorAll ( 'div.main-content amp-img[src^="https://"]' ) ;
for ( let amp _image of amp _images ) {
let elem = document . createElement ( 'img' ) ;
Object . assign ( elem , {
src : amp _image . getAttribute ( 'src' ) ,
alt : amp _image . getAttribute ( 'alt' ) ,
height : '400'
} ) ;
amp _image . parentNode . replaceChild ( elem , amp _image ) ;
}
2023-03-01 08:46:00 +01:00
} else {
if ( ! domain ) {
2023-05-24 20:13:55 +02:00
function unscramble ( t ) {
for ( var n = "" , i = 0 , r = t . length ; i < r ; i ++ ) {
var s = t . charCodeAt ( i ) ;
if ( s >= 33 && s <= 126 ) {
var sTmp = String . fromCharCode ( 33 + ( s - 33 + 47 ) % 94 ) ;
n += sTmp ;
} else
n += t . charAt ( i ) ;
}
return n ;
}
let subscriber _only = document . querySelectorAll ( 'div.subscriber-only' ) ;
2023-03-01 08:46:00 +01:00
for ( let elem of subscriber _only ) {
2023-05-24 20:13:55 +02:00
if ( elem . classList . contains ( 'encrypted-content' ) && dompurify _loaded ) {
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( unscramble ( elem . innerText ) ) + '</div>' , 'text/html' ) ;
let content _new = doc . querySelector ( 'div' ) ;
elem . parentNode . replaceChild ( content _new , elem ) ;
}
2023-03-01 08:46:00 +01:00
elem . removeAttribute ( 'style' ) ;
elem . removeAttribute ( 'class' ) ;
}
let banners = document . querySelectorAll ( 'div.subscription-required, div.redacted-overlay' ) ;
removeDOMElement ( ... banners ) ;
2022-09-08 07:46:32 +02:00
}
2023-03-01 08:46:00 +01:00
let ads = document . querySelectorAll ( 'div.tnt-ads-container' ) ;
removeDOMElement ( ... ads ) ;
2022-04-06 17:17:13 +02:00
}
2021-12-12 09:38:17 +01:00
}
2022-07-26 18:20:19 +02: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 08:46:50 +02:00
let url = window . location . href ;
2023-02-07 17:37:15 +01:00
let hostname = window . location . hostname ;
if ( ! domain )
domain = hostname . replace ( /^(account|amp)\./ , '' ) ;
if ( hostname . startsWith ( 'account.' ) && window . location . search . startsWith ( '?resume=' ) ) {
2021-04-10 08:46:50 +02:00
window . setTimeout ( function ( ) {
2022-01-13 21:03:56 +01:00
window . location . href = 'https://amp.' + domain + '/article' + url . split ( 'resume=' ) [ 1 ] . split ( /[#&]/ ) [ 0 ] + '.html' ;
2022-03-08 19:04:50 +01:00
} , 500 ) ;
2021-04-10 08:46:50 +02:00
} else if ( url . includes ( 'amp.' + domain + '/' ) ) {
2022-12-18 11:08:16 +01:00
amp _unhide _subscr _section ( 'amp-ad, amp-embed' , false ) ;
2023-02-23 12:46:03 +01:00
let subscriptions _action = document . querySelector ( 'div[subscriptions-action][subscriptions-display="NOT data.hasError"]' ) ;
if ( subscriptions _action )
subscriptions _action . removeAttribute ( 'subscriptions-action' ) ;
2021-04-10 08:46:50 +02:00
let subscr _tag = document . querySelector ( 'div#subscriber-exclusive-tag' ) ;
let amp _players = document . querySelectorAll ( 'amp-connatix-player' ) ;
removeDOMElement ( subscr _tag , ... amp _players ) ;
}
let premium _svgs = document . querySelectorAll ( 'h3 > a > svg' ) ;
let premium _link ;
for ( let premium _svg of premium _svgs ) {
premium _link = premium _svg . parentElement ;
if ( premium _link . href . includes ( 'www.' ) )
premium _link . href = premium _link . href . replace ( 'www.' , 'amp.' ) ;
}
2023-02-06 20:12:59 +01:00
let ads = document . querySelectorAll ( 'div[id^="zone-el-"]' ) ;
removeDOMElement ( ... ads ) ;
2021-03-27 11:53:38 +01:00
}
2022-03-30 18:22:36 +02: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/' ) ) {
2022-12-17 10:04:08 +01:00
amp _unhide _subscr _section ( 'amp-ad, amp-embed, div.ampWrapperInside' ) ;
2021-08-16 22:49:58 +02:00
}
}
2022-12-23 15:48:26 +01:00
else if ( document . querySelector ( 'script[src*=".axate.io/"]' ) ) {
let premium = document . querySelector ( '.premium, div[class*="-premium"]' ) ;
if ( premium )
premium . removeAttribute ( 'class' ) ;
}
2021-04-10 08:46:50 +02:00
else
csDone = true ;
}
2022-12-16 12:31:29 +01:00
if ( csDone || csDoneOnce ) {
2021-04-25 13:45:36 +02:00
addDivBpcDone ( ) ;
}
2020-12-04 16:14:23 +01:00
2021-04-07 22:24:53 +02:00
} // end div_bpc_done
2020-01-28 23:06:25 +01:00
// General Functions
2019-11-23 05:53:56 +01:00
function removeDOMElement ( ... elements ) {
2021-04-10 08:46:50 +02:00
for ( let element of elements ) {
if ( element )
element . remove ( ) ;
}
2019-10-06 19:28:18 +02:00
}
2019-10-08 17:41:09 +02:00
2022-10-19 21:28:47 +02:00
function hideDOMElement ( ... elements ) {
for ( let element of elements ) {
if ( element )
element . style = 'display:none !important;' ;
}
}
2021-04-07 22:24:53 +02:00
function waitDOMElement ( selector , tagName = '' , callback , multiple = false ) {
2021-04-10 08:46:50 +02:00
new window . MutationObserver ( function ( mutations ) {
for ( let mutation of mutations ) {
for ( let node of mutation . addedNodes ) {
if ( ! tagName || ( node . tagName === tagName ) ) {
if ( node . matches ( selector ) ) {
callback ( node ) ;
if ( ! multiple )
this . disconnect ( ) ;
}
2021-04-07 22:24:53 +02:00
}
2021-04-10 08:46:50 +02:00
}
}
} ) . observe ( document , {
subtree : true ,
childList : true
} ) ;
2021-04-07 22:24:53 +02:00
}
2021-07-10 19:02:46 +02:00
function waitDOMAttribute ( selector , tagName = '' , attributeName = '' , callback , multiple = false ) {
let targetNode = document . querySelector ( selector ) ;
if ( ! targetNode )
2021-12-12 09:38:17 +01:00
return ;
2021-07-10 19:02:46 +02: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 22:24:53 +02:00
function addDivBpcDone ( ) {
2021-04-10 08:46:50 +02:00
let div _bpc _new = document . createElement ( 'div' ) ;
div _bpc _new . setAttribute ( 'id' , 'bpc_done' ) ;
div _bpc _new . setAttribute ( 'style' , 'display: none;' ) ;
let insertAfter = ( document . body || document . head || document . documentElement ) ;
insertAfter . appendChild ( div _bpc _new ) ;
2021-04-07 22:24:53 +02:00
}
2021-12-23 08:43:19 +01:00
function matchDomain ( domains , hostname = window . location . hostname ) {
2021-08-17 18:37:06 +02:00
let matched _domain = false ;
2021-04-10 08:46:50 +02:00
if ( typeof domains === 'string' )
domains = [ domains ] ;
domains . some ( domain => ( hostname === domain || hostname . endsWith ( '.' + domain ) ) && ( matched _domain = domain ) ) ;
return matched _domain ;
2020-03-27 21:13:28 +01:00
}
2023-03-18 10:09:53 +01:00
function urlHost ( url ) {
if ( /^http/ . test ( url ) ) {
try {
return new URL ( url ) . hostname ;
} catch ( e ) {
console . log ( ` url not valid: ${ url } error: ${ e } ` ) ;
}
}
return url ;
}
function matchUrlDomain ( domains , url ) {
return matchDomain ( domains , urlHost ( url ) ) ;
}
2022-01-19 21:24:12 +01:00
function replaceDomElementExt ( url , proxy , base64 , selector , text _fail = '' , selector _source = selector ) {
2022-04-09 17:07:30 +02: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 {
2023-04-20 20:56:23 +02:00
let options = { } ;
if ( matchUrlDomain ( 'espn.com' , url ) )
options . headers = {
'X-Forwarded-For' : randomIP ( 185 , 185 )
} ;
fetch ( url , options )
2022-04-09 17:07:30 +02:00
. 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 {
2023-05-30 19:27:56 +02:00
replaceTextFail ( url , article , proxy , text _fail ) ;
2021-12-24 08:32:45 +01:00
}
2022-04-09 17:07:30 +02: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 ( ) {
2023-05-08 20:05:06 +02:00
let doc = parser . parseFromString ( DOMPurify . sanitize ( html , { ADD _ATTR : [ 'layout' , 'itemprop' ] , ADD _TAGS : [ 'amp-img' , 'iframe' ] } ) , 'text/html' ) ;
//console.log(DOMPurify.removed);
2022-04-09 17:07:30 +02:00
let article _new = doc . querySelector ( selector _source ) ;
if ( article _new ) {
if ( article && article . parentNode )
article . parentNode . replaceChild ( article _new , article ) ;
2021-04-10 08:46:50 +02:00
}
2022-04-09 17:07:30 +02: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 08:46:50 +02:00
}
2023-01-25 18:46:53 +01:00
article . firstChild . before ( text _fail _div ) ;
2022-04-09 17:07:30 +02:00
}
2021-01-11 21:00:41 +01:00
}
2022-12-16 12:31:29 +01:00
function amp _iframes _replace ( weblink = false , source = '' ) {
let amp _iframes = document . querySelectorAll ( 'amp-iframe' + ( source ? '[src*="' + source + '"]' : '' ) ) ;
let par , elem ;
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' ) ,
width : 'auto' ,
style : 'border: 0px;'
} ) ;
amp _iframe . parentNode . replaceChild ( elem , amp _iframe ) ;
} else {
par = document . createElement ( 'p' ) ;
elem = document . createElement ( 'a' ) ;
elem . innerText = 'Media-link' ;
elem . setAttribute ( 'href' , amp _iframe . getAttribute ( 'src' ) ) ;
elem . setAttribute ( 'target' , '_blank' ) ;
par . appendChild ( elem ) ;
amp _iframe . parentNode . replaceChild ( par , amp _iframe ) ;
}
}
}
function amp _unhide _subscr _section ( amp _ads _sel = 'amp-ad, .ad' , replace _iframes = true , amp _iframe _link = false , source = '' ) {
2023-02-23 12:46:03 +01:00
let preview = document . querySelectorAll ( '[subscriptions-section="content-not-granted"]' ) ;
removeDOMElement ( ... preview ) ;
2022-12-16 12:31:29 +01:00
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 ) ;
if ( replace _iframes )
amp _iframes _replace ( amp _iframe _link , source ) ;
}
function amp _unhide _access _hide ( amp _access = '' , amp _access _not = '' , amp _ads _sel = 'amp-ad, .ad' , replace _iframes = true , amp _iframe _link = false , source = '' ) {
2023-04-13 19:00:16 +02:00
let access _hide = document . querySelectorAll ( '[amp-access' + amp _access + '][amp-access-hide]:not([amp-access="error"], [amp-access^="message"], .piano)' ) ;
2022-12-16 12:31:29 +01:00
for ( let elem of access _hide )
elem . removeAttribute ( 'amp-access-hide' ) ;
if ( amp _access _not ) {
let amp _access _not _dom = document . querySelectorAll ( '[amp-access' + amp _access _not + ']' ) ;
removeDOMElement ( ... amp _access _not _dom ) ;
}
let amp _ads = document . querySelectorAll ( amp _ads _sel ) ;
removeDOMElement ( ... amp _ads ) ;
if ( replace _iframes )
amp _iframes _replace ( amp _iframe _link , source ) ;
}
2022-08-26 19:50:25 +02:00
function ampToHtml ( ) {
window . setTimeout ( function ( ) {
let canonical = document . querySelector ( 'link[rel="canonical"]' ) ;
window . location . href = canonical . href ;
2022-11-14 17:10:40 +01:00
} , 1000 ) ;
2022-08-26 19:50:25 +02:00
}
2023-01-11 19:36:19 +01:00
function refreshCurrentTab ( ) {
ext _api . runtime . sendMessage ( { request : 'refreshCurrentTab' } ) ;
}
2023-06-28 16:20:10 +02:00
function archiveLink ( url , text _fail = 'BPC > Try for full article text (only report issue if not working for over a week):\r\n' ) {
2022-12-02 13:36:27 +01:00
return externalLink ( [ 'archive.today' , 'archive.is' ] , 'https://{domain}?run=1&url={url}' , url , text _fail ) ;
}
2023-07-14 11:10:22 +02:00
function googleWebcacheLink ( url , text _fail = 'BPC > Try for full article text:\r\n' ) {
2022-12-02 13:36:27 +01:00
return externalLink ( [ 'webcache.googleusercontent.com' ] , 'https://{domain}/search?q=cache:{url}' , url , text _fail ) ;
}
2023-07-14 11:10:22 +02:00
function ext _12ftLink ( url , text _fail = 'BPC > Try for full article text:\r\n' ) {
2022-12-02 13:36:27 +01:00
return externalLink ( [ '12ft.io' ] , 'https://{domain}/{url}' , url , text _fail ) ;
}
function externalLink ( domains , ext _url _templ , url , text _fail = 'BPC > Full article text:\r\n' ) {
2021-06-29 21:13:53 +02:00
let text _fail _div = document . createElement ( 'div' ) ;
text _fail _div . id = 'bpc_archive' ;
2023-04-13 19:00:16 +02:00
text _fail _div . setAttribute ( 'style' , 'margin: 20px; font-weight: bold; color: red;' ) ;
2023-05-03 17:38:21 +02:00
let parser = new DOMParser ( ) ;
text _fail = text _fail . replace ( /\[([^\]]+)\]/g , "<a href='$1' target='_blank' style='color: red'>$1</a>" ) ;
let doc = parser . parseFromString ( '<span>' + text _fail + '</span>' , 'text/html' ) ;
let elem = doc . querySelector ( 'span' ) ;
text _fail _div . appendChild ( elem ) ;
2022-12-02 13:36:27 +01:00
for ( let domain of domains ) {
let ext _url = ext _url _templ . replace ( '{domain}' , domain ) . replace ( '{url}' , url . split ( '?' ) [ 0 ] ) ;
let a _link = document . createElement ( 'a' ) ;
a _link . innerText = domain ;
a _link . href = ext _url ;
a _link . target = '_blank' ;
text _fail _div . appendChild ( document . createTextNode ( ' | ' ) ) ;
text _fail _div . appendChild ( a _link ) ;
2022-02-08 19:41:59 +01:00
}
2021-06-29 21:13:53 +02:00
return text _fail _div ;
}
2019-11-23 05:53:56 +01:00
function removeClassesByPrefix ( el , prefix ) {
2021-04-10 08:46:50 +02:00
let el _classes = el . classList ;
for ( let el _class of el _classes ) {
if ( el _class . startsWith ( prefix ) )
el _classes . remove ( el _class ) ;
}
2019-11-21 03:19:36 +01:00
}
2019-11-11 01:37:41 +01:00
2022-10-26 08:48:51 +02: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 16:44:46 +02:00
function cookieExists ( name ) {
2021-04-10 08:46:50 +02:00
return document . cookie . split ( ';' ) . some ( function ( item ) {
return item . trim ( ) . indexOf ( name + '=' ) === 0
} )
2020-06-08 16:44:46 +02:00
}
function setCookie ( name , value , domain , path , days ) {
2021-08-17 18:37:06 +02:00
let max _age = days * 24 * 60 * 60 ;
2021-04-10 08:46:50 +02:00
document . cookie = name + "=" + ( value || "" ) + "; domain=" + domain + "; path=" + path + "; max-age=" + max _age ;
2020-06-08 16:44:46 +02:00
}
2020-09-12 15:40:50 +02:00
function insert _script ( func , insertAfterDom ) {
2021-04-10 08:46:50 +02:00
let bpc _script = document . querySelector ( 'script#bpc_script' ) ;
if ( ! bpc _script ) {
let script = document . createElement ( 'script' ) ;
script . setAttribute ( 'id' , 'bpc_script' ) ;
script . appendChild ( document . createTextNode ( '(' + func + ')();' ) ) ;
let insertAfter = insertAfterDom ? insertAfterDom : ( document . body || document . head || document . documentElement ) ;
insertAfter . appendChild ( script ) ;
}
2020-07-15 18:45:37 +02:00
}
2022-12-16 12:31:29 +01:00
function getArticleJsonScript ( ) {
let scripts = document . querySelectorAll ( 'script[type="application/ld+json"]' ) ;
let json _script ;
for ( let script of scripts ) {
2023-01-02 12:04:51 +01:00
if ( script . innerText . match ( /"(articlebody|text)":/i ) ) {
2022-12-16 12:31:29 +01:00
json _script = script ;
break ;
}
}
return json _script ;
}
2023-05-07 13:13:41 +02:00
function findKeyJson ( json , keys , min _val _len = 0 ) {
let source ;
if ( Array . isArray ( json ) ) {
for ( let elem of json )
source = source || findKeyJson ( json [ elem ] , keys , min _val _len ) ;
} else if ( typeof json === 'object' ) {
for ( let elem in json ) {
let json _elem = json [ elem ] ;
if ( typeof json _elem === 'string' && keys . includes ( elem ) ) {
if ( json _elem . length > min _val _len )
return json _elem ;
} else
source = source || findKeyJson ( json _elem , keys , min _val _len ) ;
}
}
return source ;
}
2020-05-29 15:34:02 +02:00
function genHexString ( len ) {
2021-04-10 08:46:50 +02:00
let output = '' ;
for ( let i = 0 ; i < len ; i ++ )
output += ( Math . floor ( Math . random ( ) * 16 ) ) . toString ( 16 ) ;
return output ;
2020-05-29 15:34:02 +02:00
}
2020-10-04 19:08:36 +02:00
function makeRandomNumber ( len ) {
2021-04-10 08:46:50 +02:00
let result = '' ;
2021-08-17 18:37:06 +02:00
let characters = '123456789' ;
let charactersLength = characters . length ;
for ( let i = 0 ; i < len ; i ++ )
2021-04-10 08:46:50 +02:00
result += characters . charAt ( Math . floor ( Math . random ( ) * charactersLength ) ) ;
return result ;
2020-10-04 19:08:36 +02:00
}
2023-04-20 20:56:23 +02:00
function randomInt ( max ) {
return Math . floor ( Math . random ( ) * Math . floor ( max ) ) ;
}
function randomIP ( range _low = 0 , range _high = 223 ) {
let rndmIP = [ ] ;
for ( let n = 0 ; n < 4 ; n ++ ) {
if ( n === 0 )
rndmIP . push ( range _low + randomInt ( range _high - range _low + 1 ) ) ;
else
rndmIP . push ( randomInt ( 255 ) + 1 ) ;
}
return rndmIP . join ( '.' ) ;
}
2020-01-28 23:06:25 +01:00
function pageContains ( selector , text ) {
2021-04-10 08:46:50 +02:00
let elements = document . querySelectorAll ( selector ) ;
return Array . prototype . filter . call ( elements , function ( element ) {
return RegExp ( text ) . test ( element . textContent ) ;
} ) ;
2020-01-28 23:06:25 +01:00
}
2020-07-04 13:33:25 +02:00
2021-12-07 19:25:48 +01:00
function breakText ( str ) {
2023-03-20 20:01:19 +01:00
str = str . replace ( /(?:^|[A-Za-z\"\“\)])(\.|\?|!)(?=[A-ZÖÜ\„\d][A-Za-zÀ-ÿ\„\d]{1,})/gm , "$&\n\n" ) ;
2021-12-07 19:25:48 +01:00
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 23:04:51 +02:00
function parseHtmlEntities ( encodedString ) {
2022-09-30 17:40:10 +02:00
let parser = new DOMParser ( ) ;
2022-10-09 20:20:19 +02:00
let doc = parser . parseFromString ( '<textarea>' + encodedString + '</textarea>' , 'text/html' ) ;
2022-09-30 17:40:10 +02:00
let dom = doc . querySelector ( 'textarea' ) ;
return dom . value ;
}
2021-02-05 19:07:38 +01:00
function encode _utf8 ( str ) {
2021-04-10 08:46:50 +02:00
return unescape ( encodeURIComponent ( str ) ) ;
2021-02-05 19:07:38 +01:00
}
function decode _utf8 ( str ) {
2021-04-10 08:46:50 +02:00
return decodeURIComponent ( escape ( str ) ) ;
2021-02-05 19:07:38 +01:00
}