@ -50,7 +50,7 @@ var usa_outside_mag_domains = ["backpacker.com", "betamtb.com", "betternutrition
var usa _tribune _domains = [ 'baltimoresun.com' , 'chicagotribune.com' , 'courant.com' , 'dailypress.com' , 'mcall.com' , 'nydailynews.com' , 'orlandosentinel.com' , 'pilotonline.com' , 'sun-sentinel.com' ] ;
// clean local storage of sites (with an exemption for hold-list)
var arr _localstorage _hold = [ 'augsburger-allgemeine.de' , 'barrons.com' , 'business-standard.com' , 'businessinsider.com' , 'businessoffashion.com' , 'businesspost.ie' , 'challenges.fr' , 'charliehebdo.fr' , 'cmjornal.pt' , 'columbian.com' , 'corriere.it' , 'corrieredellosport.it' , 'cyclingtips.com' , 'digiday.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' , 'indiatoday.in' , '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' , 'nwzonline.de' , 'nytimes.com' , 'nzherald.co.nz' , 'record.pt' , 'ruhrnachrichten.de' , 'rundschau-online.de' , 'sandiegouniontribune.com' , 'scmp.com' , 'seekingalpha.com' , 'telegraph.co.uk' , 'tes.com' , 'the atlantic.com', 'thebulletin.org' , 'thecritic.co.uk' , 'thetimes.co.uk' , 'theweek.com' , 'tuttosport.com' , 'uol.com.br' , 'vol.at' , 'wsj.com' ] . concat ( be _roularta _domains , ca _gcm _domains , ca _torstar _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 , nl _dpg _media _domains , no _nhst _media _domains , timesofindia _domains , usa _hearst _comm _domains , usa _mcc _domains ) ;
var arr _localstorage _hold = [ 'augsburger-allgemeine.de' , 'barrons.com' , 'business-standard.com' , 'businessinsider.com' , 'businessoffashion.com' , 'businesspost.ie' , 'challenges.fr' , 'charliehebdo.fr' , 'cmjornal.pt' , 'columbian.com' , 'corriere.it' , 'corrieredellosport.it' , 'cyclingtips.com' , 'digiday.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' , 'indiatoday.in' , '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' , 'nwzonline.de' , 'nytimes.com' , 'nzherald.co.nz' , 'record.pt' , 'ruhrnachrichten.de' , 'rundschau-online.de' , 'sandiegouniontribune.com' , 'scmp.com' , 'seekingalpha.com' , 'telegraph.co.uk' , 'tes.com' , 'the -tls.co.uk', 'the atlantic.com', 'thebulletin.org' , 'thecritic.co.uk' , 'thetimes.co.uk' , 'theweek.com' , 'tuttosport.com' , 'uol.com.br' , 'vol.at' , 'wsj.com' ] . concat ( be _roularta _domains , ca _gcm _domains , ca _torstar _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 , nl _dpg _media _domains , no _nhst _media _domains , timesofindia _domains , usa _hearst _comm _domains , usa _mcc _domains ) ;
if ( ! matchDomain ( arr _localstorage _hold ) ) {
window . localStorage . clear ( ) ;
}
@ -149,34 +149,9 @@ if (bg2csData.ld_json_url && dompurify_loaded) {
let ld _json _url _split = bg2csData . ld _json _url . split ( '|' ) ;
let paywall _sel = ld _json _url _split [ 0 ] ;
let article _sel = ld _json _url _split [ 1 ] ;
let paywall = document . querySelectorAll ( paywall _sel ) ;
let article = document . querySelector ( article _sel ) ;
let article _append = ld _json _url _split [ 2 ] ; // optional
if ( paywall . length && article ) {
removeDOMElement ( ... paywall ) ;
let json _url _dom = document . querySelector ( 'head > link[rel="alternate"][type="application/json"][href]' ) ;
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 = parseHtmlEntities ( json . content . rendered ) ;
if ( json _text ) {
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( '<div style="margin: 25px 0px">' + DOMPurify . sanitize ( json _text , { ADD _TAGS : [ 'iframe' ] , ADD _ATTR : [ 'frameborder' ] } ) + '</div>' , 'text/html' ) ;
let article _new = doc . querySelector ( 'div' ) ;
if ( article _append || ! article . parentNode ) {
article . innerHTML = '' ;
article . appendChild ( article _new ) ;
} else if ( article . parentNode )
article . parentNode . replaceChild ( article _new , article ) ;
}
} ) ;
}
} ) ;
}
}
let article _hold = ld _json _url _split [ 3 ] ; // optional
getJsonUrl ( paywall _sel , '' , article _sel , { art _append : article _append , art _hold : article _hold , art _style : 'margin: 25px 0px;' } ) ;
} , 1000 ) ;
}
}
@ -369,32 +344,11 @@ if (matchDomain('medium.com') || matchDomain(medium_custom_domains) || (!matchDo
else if ( window . location . hostname . match ( /\.(com|net)\.au$/ ) ) { //australia
if ( matchDomain ( 'crikey.com.au' ) ) {
let paywall = document . querySelector ( 'div.locked-content' ) ;
if ( paywall && dompurify _loaded ) {
removeDOMElement ( paywall ) ;
let json _url _dom = document . querySelector ( 'head > link[rel="alternate"][type="application/json"][href]' ) ;
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.article-body > div.paywall' ) ;
if ( json _text && content ) {
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( json _text ) + '</div>' , 'text/html' ) ;
let content _new = doc . querySelector ( 'div' ) ;
content . parentNode . replaceChild ( content _new , content ) ;
}
} ) ;
}
} ) ;
}
let fade = document . querySelector ( 'article.article-locked' ) ;
if ( fade )
fade . classList . remove ( 'article-locked' ) ;
}
if ( dompurify _loaded )
getJsonUrl ( 'div.locked-content' , '' , 'div.article-body > div.paywall' ) ;
let fade = document . querySelector ( 'article.article-locked' ) ;
if ( fade )
fade . classList . remove ( 'article-locked' ) ;
}
else if ( matchDomain ( 'macrobusiness.com.au' ) ) {
@ -951,31 +905,10 @@ else if (matchDomain('jacobin.de')) {
}
else if ( matchDomain ( 'jungefreiheit.de' ) ) {
let paywall = document . querySelector ( 'div.paywall-teaser-box' ) ;
if ( paywall && dompurify _loaded ) {
removeDOMElement ( paywall ) ;
let json _url _dom = document . querySelector ( 'head > link[rel="alternate"][type="application/json"][href]' ) ;
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.elementor-widget-container > p' ) ;
if ( json _text && content ) {
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( json _text ) + '</div>' , 'text/html' ) ;
let content _new = doc . querySelector ( 'div' ) ;
content . parentNode . replaceChild ( content _new , content ) ;
}
} ) ;
}
} ) ;
}
let fade = document . querySelector ( 'div[style*="background-image: url"]' ) ;
removeDOMElement ( fade ) ;
}
if ( dompurify _loaded )
getJsonUrl ( 'div.paywall-teaser-box' , '' , 'div.elementor-widget-container > p' ) ;
let fade = document . querySelector ( 'div[style*="background-image: url"]' ) ;
removeDOMElement ( fade ) ;
window . setTimeout ( function ( ) {
let banners = document . querySelectorAll ( 'div > small' ) ;
for ( let elem of banners )
@ -2743,35 +2676,16 @@ else if (matchDomain('tijd.be')) {
}
else if ( matchDomain ( 'vn.nl' ) ) {
let paywall = document . querySelector ( 'div.content__message-no-access-container' ) ;
if ( paywall && dompurify _loaded ) {
let content _restriction = document . querySelector ( 'div.content__restriction' ) ;
removeDOMElement ( paywall , content _restriction ) ;
if ( dompurify _loaded )
getJsonUrl ( 'div.content__message-no-access-container' , '' , 'div[data-article-content-target]' , { art _append : true } ) ;
let content _restriction = document . querySelector ( 'div.content__restriction' ) ;
removeDOMElement ( content _restriction ) ;
let article _content = document . querySelector ( 'section[data-article-content-element]' ) ;
if ( article _content ) {
article _content . style = 'max-height:none !important;' ;
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 ( 'head > link[rel="alternate"][type="application/json"][href]' ) ;
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 ( ) ;
let doc = parser . parseFromString ( '<div data-article-content-target>' + DOMPurify . sanitize ( json _text , { ADD _TAGS : [ 'iframe' ] , ADD _ATTR : [ 'frameborder' ] } ) + '</div>' , 'text/html' ) ;
let content _new = doc . querySelector ( 'div' ) ;
content . parentNode . replaceChild ( content _new , content ) ;
}
} ) ;
}
} ) ;
}
}
}
@ -2944,29 +2858,8 @@ else if (matchDomain('ft.com')) {
}
else if ( matchDomain ( 'granta.com' ) ) {
let paywall = document . querySelector ( 'div.article-sign-up-container' ) ;
if ( paywall && dompurify _loaded ) {
removeDOMElement ( paywall ) ;
let json _url _dom = document . querySelector ( 'head > link[rel="alternate"][type="application/json"][href]' ) ;
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.article-excerpt' ) ;
if ( json _text && content ) {
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( json _text ) + '</div>' , 'text/html' ) ;
let content _new = doc . querySelector ( 'div' ) ;
content . parentNode . replaceChild ( content _new , content ) ;
}
} ) ;
}
} ) ;
}
}
if ( dompurify _loaded )
getJsonUrl ( 'div.article-sign-up-container' , '' , 'div.article-excerpt' ) ;
}
else if ( matchDomain ( 'independent.co.uk' ) ) {
@ -3154,31 +3047,11 @@ else if (matchDomain('tes.com')) {
}
else if ( matchDomain ( 'the-tls.co.uk' ) ) {
let paywall = document . querySelector ( '.tls-single-article__closed-paywall' ) ;
if ( paywall && dompurify _loaded ) {
removeDOMElement ( paywall ) ;
let json _url _dom = document . querySelector ( 'head > link[rel="alternate"][type="application/json"][href]' ) ;
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.tls-article-body' ) ;
if ( json _text && content ) {
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( '<div class="tls-article-body">' + DOMPurify . sanitize ( json _text ) + '</div>' , 'text/html' ) ;
let content _new = doc . querySelector ( 'div' ) ;
content . parentNode . replaceChild ( content _new , content ) ;
}
} ) ;
}
} ) ;
}
}
if ( dompurify _loaded )
getJsonUrl ( 'div.tls-single-article__closed-paywall' , '' , 'div.tls-article-body' , { art _class : 'tls-article-body' } ) ;
let fade = document . querySelector ( 'div.tls-single-article__closed-paywall-wrapper' ) ;
removeDOMElement ( fade ) ;
let ads = document . querySelectorAll ( 'div[class*="tls-single-article__ad-slot"]' ) ;
hideDOMElement ( fade , ... ads ) ;
}
else if ( matchDomain ( 'theneweuropean.co.uk' ) ) {
@ -3556,6 +3429,11 @@ else if (matchDomain('axios.com')) {
csDoneOnce = true ;
}
else if ( matchDomain ( 'balkaninsight.com' ) ) {
if ( dompurify _loaded )
getJsonUrl ( 'div.subscribeWrapper' , '' , 'div.post_teaser' , { art _append : true , art _hold : true } ) ;
}
else if ( matchDomain ( 'barandbench.com' ) ) {
let paywall = document . querySelector ( 'div#paywall-banner' ) ;
if ( paywall ) {
@ -4535,38 +4413,16 @@ else if (matchDomain('project-syndicate.org')) {
}
else if ( matchDomain ( 'puck.news' ) ) {
let paywall = document . querySelectorAll ( 'div[class*="paywall"]' ) ;
if ( paywall . length && dompurify _loaded ) {
removeDOMElement ( ... paywall ) ;
let json _url _dom = document . querySelector ( 'head > link[rel="alternate"][type="application/json"][href]' ) ;
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.entry-content' ) ;
if ( json _text && content ) {
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( json _text ) + '</div>' , 'text/html' ) ;
content . innerHTML = '' ;
let content _new = doc . querySelector ( 'div' ) ;
content . appendChild ( content _new ) ;
}
} ) ;
}
} ) ;
}
let modal = document . querySelector ( 'div#paywall-modal' ) ;
removeDOMElement ( modal ) ;
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' ) ;
}
if ( dompurify _loaded )
getJsonUrl ( 'div[class*="paywall"]' , '' , 'div.entry-content' , { art _append : true } ) ;
let modal = document . querySelector ( 'div#paywall-modal' ) ;
removeDOMElement ( modal ) ;
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' ) ;
}
else if ( matchDomain ( 'quora.com' ) ) {
@ -4867,33 +4723,20 @@ else if (matchDomain('the-scientist.com')) {
}
else if ( matchDomain ( 'theamericanconservative.com' ) ) {
let paywall = document . querySelector ( 'section.c-blog-post__body--locked' ) ;
let paywall _sel = 'section.c-blog-post__body--locked' ;
let paywall = document . querySelector ( paywall _sel ) ;
if ( paywall && dompurify _loaded ) {
paywall . classList . remove ( 'c-blog-post__body--locked' ) ;
let json _url _dom = document . querySelector ( 'head > link[rel="alternate"][type="application/json"][href]' ) ;
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 ;
if ( json _text . includes ( '<p class="has-drop-cap">' ) ) {
let split = json _text . split ( /(<p class="has-drop-cap">)/ ) ;
json _text = split [ 1 ] + split [ 2 ] ;
}
let content = document . querySelector ( 'div.c-blog-post__content' ) ;
if ( json _text && content ) {
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( json _text ) + '</div>' , 'text/html' ) ;
let content _new = doc . querySelector ( 'div' ) ;
content . innerHTML = '' ;
content . appendChild ( content _new ) ;
}
} ) ;
}
} ) ;
}
let art _options = {
art _append : true ,
func _text : function ( json _text ) {
if ( json _text . includes ( '<p class="has-drop-cap">' ) ) {
let split = json _text . split ( /(<p class="has-drop-cap">)/ ) ;
json _text = split [ 1 ] + split [ 2 ] ;
} ;
return json _text ;
}
} ;
getJsonUrl ( paywall _sel , { rm _class : 'c-blog-post__body--locked' } , 'div.c-blog-post__content' , art _options ) ;
} else {
let img _dark = document . querySelector ( 'div.c-hero-article__image-img.o-image' ) ;
if ( img _dark )
@ -5342,32 +5185,10 @@ else if (matchDomain('theweek.com')) {
}
else if ( matchDomain ( 'thewrap.com' ) ) {
let paywall = document . querySelector ( 'div#zephr-payment-form-root' ) ;
if ( paywall && dompurify _loaded ) {
removeDOMElement ( paywall ) ;
let json _url _dom = document . querySelector ( 'head > link[rel="alternate"][type="application/json"][href]' ) ;
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.entry-content' ) ;
if ( json _text && content ) {
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( '<div>' + DOMPurify . sanitize ( json _text ) + '</div>' , 'text/html' ) ;
content . innerHTML = '' ;
let content _new = doc . querySelector ( 'div' ) ;
content . appendChild ( content _new ) ;
}
} ) ;
}
} ) ;
}
let fade = document . querySelector ( 'div.content-area div[style*="background-image: linear-gradient"]' ) ;
removeDOMElement ( fade ) ;
}
if ( dompurify _loaded )
getJsonUrl ( 'div#zephr-payment-form-root' , '' , 'div.entry-content' , { art _append : true } ) ;
let fade = document . querySelector ( 'div.content-area div[style*="background-image: linear-gradient"]' ) ;
removeDOMElement ( fade ) ;
}
else if ( matchDomain ( 'timeshighereducation.com' ) ) {
@ -6093,6 +5914,69 @@ function findKeyJson(json, keys, min_val_len = 0) {
return source ;
}
function getJsonUrlText ( article , callback ) {
let json _url _dom = document . querySelector ( 'head > link[rel="alternate"][type="application/json"][href]' ) ;
let json _url = json _url _dom . href ;
fetch ( json _url )
. then ( response => {
if ( response . ok ) {
response . json ( ) . then ( json => {
try {
let json _text = parseHtmlEntities ( json . content . rendered ) ;
callback ( json _text , article ) ;
} catch ( err ) {
console . log ( err ) ;
}
} ) ;
}
} ) ;
}
function getJsonUrlAdd ( json _text , article , art _options = { } ) {
let art _type = 'div' ;
let art _attrib = '' ;
if ( Object . keys ( art _options ) . length ) {
if ( art _options . art _type )
art _type = art _options . art _type ;
if ( art _options . art _class )
art _attrib += ' class="' + art _options . art _class + '"' ;
if ( art _options . art _style )
art _attrib += ' style="' + art _options . art _style + '"' ;
if ( art _options . func _text )
json _text = art _options . func _text ( json _text ) ;
}
let parser = new DOMParser ( ) ;
let doc = parser . parseFromString ( '<' + art _type + art _attrib + '>' + DOMPurify . sanitize ( json _text , { ADD _TAGS : [ 'iframe' ] , ADD _ATTR : [ 'frameborder' ] } ) + '</' + art _type + '>' , 'text/html' ) ;
let article _new = doc . querySelector ( art _type ) ;
if ( art _options . art _append || ! article . parentNode ) {
if ( ! art _options . art _hold )
article . innerHTML = '' ;
article . appendChild ( article _new ) ;
} else
article . parentNode . replaceChild ( article _new , article ) ;
}
function getJsonUrl ( paywall _sel , paywall _action = '' , article _sel , art _options = { } ) {
let paywall = document . querySelectorAll ( paywall _sel ) ;
let article = document . querySelector ( article _sel ) ;
if ( paywall . length && article && dompurify _loaded ) {
if ( ! paywall _action )
removeDOMElement ( ... paywall ) ;
else {
for ( let elem of paywall ) {
if ( paywall _action . rm _class )
elem . classList . remove ( paywall _action . rm _class ) ;
else if ( paywall _action . rm _attrib )
elem . removeAttribute ( paywall _action . rm _attrib ) ;
}
}
getJsonUrlText ( article , ( json _text , article ) => {
if ( json _text && article )
getJsonUrlAdd ( json _text , article , art _options ) ;
} ) ;
}
}
function genHexString ( len ) {
let output = '' ;
for ( let i = 0 ; i < len ; i ++ )