//"use strict";
var ext_api = (typeof browser === 'object') ? browser : chrome;
var domain;
var csDone = false;
var csDoneOnce = false;
var dompurify_loaded = (typeof DOMPurify === 'function');
var ca_gcm_domains = ['lesoleil.com'].concat(['latribune.ca', 'lavoixdelest.ca', 'ledroit.com', 'ledroitfranco.com', 'lenouvelliste.ca', 'lequotidien.com']);
var ca_torstar_domains = ['niagarafallsreview.ca', 'stcatharinesstandard.ca', 'thepeterboroughexaminer.com', 'therecord.com', 'thespec.com', 'thestar.com', 'wellandtribune.ca'];
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'];
var de_madsack_domains = ['haz.de', 'kn-online.de', 'ln-online.de', 'lvz.de', 'maz-online.de', 'neuepresse.de', 'ostsee-zeitung.de', 'rnd.de'];
var de_madsack_custom_domains = ['aller-zeitung.de', 'dnn.de', 'gnz.de', 'goettinger-tageblatt.de', 'paz-online.de', 'sn-online.de', 'waz-online.de'];
var de_westfalen_medien_domains = ['muensterschezeitung.de', 'westfalen-blatt.de', 'wn.de'];
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'];
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'];
var es_unidad_domains = ['elmundo.es', 'expansion.com', 'marca.com'];
var fi_alma_talent_domains = ['arvopaperi.fi', 'iltalehti.fi', 'kauppalehti.fi', 'marmai.fi', 'mediuutiset.fi', 'mikrobitti.fi', 'talouselama.fi', 'tekniikkatalous.fi', 'tivi.fi', 'uusisuomi.fi'];
var fr_groupe_ebra_domains = ['bienpublic.com', 'dna.fr', 'estrepublicain.fr', 'lalsace.fr', 'ledauphine.com', 'lejsl.com', 'leprogres.fr', 'republicain-lorrain.fr', 'vosgesmatin.fr'];
var fr_groupe_la_depeche_domains = ['centrepresseaveyron.fr', 'ladepeche.fr', 'lindependant.fr', 'midi-olympique.fr', 'midilibre.fr', 'nrpyrenees.fr', 'petitbleu.fr'];
var fr_groupe_nice_matin_domains = ['monacomatin.mc', 'nicematin.com', 'varmatin.com'];
var it_ilmessaggero_domains = ['corriereadriatico.it', 'ilgazzettino.it', 'ilmattino.it', 'ilmessaggero.it', 'quotidianodipuglia.it'];
var it_gedi_domains = ['gelocal.it', 'huffingtonpost.it', 'ilsecoloxix.it', 'italian.tech', 'lastampa.it', 'lescienze.it', 'limesonline.com', 'repubblica.it'];
var it_quotidiano_domains = ['ilgiorno.it', 'ilrestodelcarlino.it', 'iltelegrafolivorno.it', 'lanazione.it', 'quotidiano.net'];
var medium_custom_domains = ['betterprogramming.pub', 'towardsdatascience.com'];
var nl_mediahuis_region_domains = ['gooieneemlander.nl', 'haarlemsdagblad.nl', 'ijmuidercourant.nl', 'leidschdagblad.nl', 'noordhollandsdagblad.nl'];
var nl_dpg_media_domains = ['demorgen.be', 'humo.be', 'parool.nl', 'trouw.nl', 'volkskrant.nl'];
var no_nhst_media_domains = ['intrafish.com', 'rechargenews.com', 'tradewindsnews.com', 'upstreamonline.com'];
var pe_grupo_elcomercio_domains = ['diariocorreo.pe', 'elcomercio.pe', 'gestion.pe'];
var timesofindia_domains = ['timesofindia.com', 'timesofindia.indiatimes.com'];
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'];
var usa_conde_nast_domains = ['architecturaldigest.com', 'bonappetit.com', 'gq.com' , 'newyorker.com', 'vanityfair.com', 'vogue.com', 'wired.com'];
var usa_craincomm_domains = ['adage.com', 'autonews.com', 'chicagobusiness.com', 'crainscleveland.com', 'crainsdetroit.com', 'crainsnewyork.com', 'modernhealthcare.com'];
var usa_genomeweb_domains = ['360dx.com', 'genomeweb.com', 'precisiononcologynews.com'];
var usa_hearst_comm_domains = ['expressnews.com', 'houstonchronicle.com', 'sfchronicle.com'];
var usa_lee_ent_domains = ['buffalonews.com', 'richmond.com', 'tucson.com', 'tulsaworld.com'];
var usa_mcc_domains = ['bnd.com', 'charlotteobserver.com', 'fresnobee.com', 'kansas.com', 'kansascity.com', 'kentucky.com', 'miamiherald.com', 'newsobserver.com', 'sacbee.com', 'star-telegram.com', 'thestate.com', 'tri-cityherald.com'];
var usa_mng_domains = ['denverpost.com', 'eastbaytimes.com', 'mercurynews.com', 'ocregister.com', 'pe.com', 'twincities.com'];
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"];
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 = ['allgaeuer-zeitung.de', 'augsburger-allgemeine.de', 'barrons.com', 'businessoffashion.com', 'challenges.fr', 'charliehebdo.fr', 'cmjornal.pt', 'corriere.it', 'corrieredellosport.it', 'cyclingtips.com', 'eldiario.es', 'elespanol.com', 'elle.fr', 'elpais.com', 'elperiodico.com', 'enotes.com', 'estadao.com.br', 'forbes.com', 'fortune.com', 'economictimes.com', 'freiepresse.de', 'ilfoglio.it', 'inc42.com', 'lanouvellerepublique.fr', 'latimes.com', 'lesechos.fr', 'livemint.com', 'mid-day.com', 'nw.de', 'nytimes.com', 'nzherald.co.nz', 'sandiegouniontribune.com', 'scmp.com', 'seekingalpha.com', 'substack.com', 'telegraph.co.uk', 'theatlantic.com', 'thehindu.com', 'thetimes.co.uk', 'uol.com.br', 'wsj.com'].concat(de_funke_medien_domains, de_westfalen_medien_domains, es_epiberica_domains, es_epiberica_custom_domains, es_grupo_vocento_domains, es_unidad_domains, fr_groupe_ebra_domains, fr_groupe_la_depeche_domains, fr_groupe_nice_matin_domains, it_quotidiano_domains, ca_gcm_domains, nl_dpg_media_domains, no_nhst_media_domains, usa_hearst_comm_domains);
if (!matchDomain(arr_localstorage_hold)) {
window.localStorage.clear();
}
function getArticleJsonScript() {
let scripts = document.querySelectorAll('script[type="application/ld+json"]');
let json_script;
for (let script of scripts) {
if (script.innerText.includes('articleBody')) {
json_script = script;
break;
}
}
return json_script;
}
var bg2csData;
// custom/updated sites: load text from json
if ((bg2csData !== undefined) && bg2csData.ld_json && dompurify_loaded) {
if (bg2csData.ld_json.includes('|')) {
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];
let paywall = document.querySelectorAll(paywall_sel);
if (paywall.length) {
removeDOMElement(...paywall);
let json_script = getArticleJsonScript();
if (json_script) {
let json_text = parseHtmlEntities(JSON.parse(json_script.text).articleBody);
let content = document.querySelector(article_sel);
if (json_text && content) {
let parser = new DOMParser();
let doc = parser.parseFromString('
', 'text/html');
par_elem = par_html.querySelector('div');
} else if (key === 'legacy-ml') {
par_html = parser.parseFromString('
' + DOMPurify.sanitize(par_key) + '
', 'text/html');
par_elem = par_html.querySelector('div');
if (!flourish && par_key.includes('flourish.studio')) {
let flourish_script = document.createElement('script');
flourish_script.setAttribute('src', 'https://public.flourish.studio/resources/embed.js');
if (head)
head.appendChild(flourish_script);
flourish = true;
}
} else {
console.log(key);
console.log(par_key);
par_html = parser.parseFromString('
' + DOMPurify.sanitize(par_key) + '
', 'text/html');
par_elem = par_html.querySelector('p');
}
if (!['streamone', 'legacy-ml', 'iframe_sized'].includes(key))
par_elem.setAttribute('style', 'font-size: 16px;');
if (par_elem)
div_content.appendChild(par_elem);
}
}
}
} catch (err) {
console.warn('unable to parse text');
console.warn(err);
}
}
window.setTimeout(function () {
let overlay = document.querySelector('div.cj-root');
removeDOMElement(overlay);
let noscroll = document.querySelector('html.is-dialog-active');
if (noscroll)
noscroll.classList.remove('is-dialog-active');
}, 500); // Delay (in milliseconds)
}
else if (matchDomain(['knack.be', 'kw.be', 'levif.be'])) {
let paywall = document.querySelector('div[id*="wall-modal"]');
if (paywall) {
removeDOMElement(paywall);
function knack_noscroll(node) {
node.removeAttribute('style');
node.removeAttribute('class');
}
waitDOMAttribute('html', 'html', 'style', knack_noscroll, true);
let intro = document.querySelectorAll('div.article-body > p, div.article-body > style');
removeDOMElement(...intro);
}
}
else if (matchDomain(['lc.nl', 'dvhn.nl'])) {
let top_ad = document.querySelector('.top__ad');
removeDOMElement(top_ad);
}
else if (matchDomain(nl_mediahuis_region_domains)) {
window.setTimeout(function () {
let close_button = document.querySelector('button[data-testid="button-close"]');
if (close_button)
close_button.click();
let premium = document.querySelector('div.common-components-plus_pluslabel--container');
if (premium && dompurify_loaded) {
let hidden_article = document.querySelector('div[data-auth-body="article"]');
if (hidden_article)
hidden_article.removeAttribute('style');
let paywall = document.querySelector('div[data-auth-root="paywall"]');
removeDOMElement(paywall);
let auth_body = document.querySelector('div[data-auth-body="article"]');
if (paywall && auth_body) {
let auth_body_par_count = auth_body.querySelectorAll('p');
if (auth_body_par_count.length < 2) {
let json_script = document.querySelector('script[data-fragment-type="PacoArticleContent"]');
let json_str = json_script.text.substring(json_script.textContent.indexOf('{'));
try {
let json = JSON.parse(json_str);
let article = Object.values(json)[0]['data']['article']['body'];
auth_body.innerHTML = '';
let par_html, par_dom, par_elem, par_div, par_key;
let parser = new DOMParser();
for (let par of article) {
for (let key in par) {
par_dom = document.createElement('p');
par_elem = '';
par_key = par[key];
if (key === 'subhead') {
par_html = parser.parseFromString('
' + DOMPurify.sanitize(par_key) + '
', 'text/html');
par_elem = par_html.querySelector('div');
} else if (key === 'twitter' || key === 'instagram') {
par_elem = document.createElement('a');
Object.assign(par_elem, {
href: par_key,
innerText: par_key.split('?')[0],
target: '_blank'
});
} else if (key === 'youtube') {
par_elem = document.createElement('iframe');
Object.assign(par_elem, {
src: 'https://www.youtube.com/embed/' + par_key.id,
id: 'ytplayer',
type: 'text/html',
width: 640,
height: 360,
frameborder: 0
});
} else if (key === 'streamone') {
par_elem = document.createElement('iframe');
Object.assign(par_elem, {
src: 'https://content.tmgvideo.nl/embed/item=' + par_key.id,
type: 'text/html',
width: 640,
height: 360,
frameborder: 0
});
} else if (key === 'image') {
par_elem = document.createElement('div');
let par_img = document.createElement('img');
par_img.src = par_key.url;
par_elem.appendChild(par_img);
par_div = document.createElement('div');
par_div.innerText = par[key].caption ? par[key].caption : '';
par_div.innerText += par[key].credit ? '\n' + par[key].credit : '';
par_elem.appendChild(par_div);
} else {
par_html = parser.parseFromString('
' + DOMPurify.sanitize(par_key) + '
', 'text/html');
par_elem = par_html.querySelector('p');
}
if (par_elem)
par_dom.appendChild(par_elem);
auth_body.appendChild(par_dom);
}
}
} catch (err) {
console.warn('unable to parse text');
console.warn(err);
}
}
}
}
}, 500);
}
else if (matchDomain(nl_dpg_media_domains)) {
let banners = document.querySelectorAll('div[data-temptation-position^="PAGE_"], div[class^="ad--"]');
let paywall = document.querySelectorAll('[data-temptation-position^="ARTICLE_"]');
removeDOMElement(...banners, ...paywall);
}
else if (matchDomain('nrc.nl')) {
window.setTimeout(function () {
let nrc_overlay = document.querySelectorAll('[id$="modal__overlay"]');
let subscribe_bar = document.querySelector('.header__subscribe-bar');
let ads = document.querySelectorAll('.banner');
removeDOMElement(...nrc_overlay, subscribe_bar, ...ads);
let paywall = document.querySelector('.has-paywall');
if (paywall)
paywall.classList.remove('has-paywall');
let paywall_overlay = document.querySelector('.has-paywall-overlay');
if (paywall_overlay)
paywall_overlay.classList.remove('has-paywall-overlay');
}, 100);
}
else if (matchDomain('telegraaf.nl')) {
if (window.location.href.startsWith('https://www.telegraaf.nl/error?ref=/')) {
window.setTimeout(function () {
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) {
window.setTimeout(function () {
window.location.reload(true);
}, 500);
}
let article_wrapper = document.querySelector('.ArticlePageWrapper__uid');
let spotx_banner = document.querySelector('.ArticleBodyBlocks__inlineArticleSpotXBanner');
let paywall = document.querySelector('.MeteringNotification__backdrop');
removeDOMElement(spotx_banner, paywall);
let premium = document.querySelector('.PremiumLabelWithLine');
let article_id = article_wrapper ? article_wrapper.innerText : '123';
let article_body_done = window.location.pathname.startsWith('/video/') || document.querySelector('#articleBody' + article_id);
if (premium && !article_body_done) {
let article_body_old = document.querySelector('[id^="articleBody"]');
removeDOMElement(article_body_old);
let html = document.documentElement.outerHTML;
let json = html.includes('window.__APOLLO_STATE__=') ? html.split('window.__APOLLO_STATE__=')[1].split('};')[0] + '}' : '';
if (json) {
let json_article_id = json.split('uid\":')[1].split(/\D/)[0];
if (json_article_id && json_article_id !== article_id) {
window.setTimeout(function () {
window.location.reload(true);
}, 500);
}
let json_text = json.includes('"body":"') ? json.split('"body":"')[1].split('","__typename":')[0] : '';
if (json_text) {
let intro = document.querySelector('span[id^="articleIntro"]');
if (intro)
json_text = json_text.replace(intro.innerText + '\n\n', '');
let article_body = document.querySelector('section[data-element="articleBody"]');
if (article_body) {
let div_main = document.createElement('div');
div_main.setAttribute('id', 'articleBody' + article_id);
let div_elem = document.createElement('div');
div_elem.setAttribute('data-element', 'articleBodyBlocks');
let text_array = json_text.split('\\n');
text_array.forEach(p_text => {
let p_div = document.createElement('p');
p_div.setAttribute('class', 'ArticleBodyBlocks__paragraph');
p_div.innerText = p_text;
div_elem.appendChild(p_div);
});
div_main.appendChild(div_elem);
article_body.insertBefore(div_main, article_body.firstChild);
}
}
}
}
}
else if (matchDomain('vn.nl')) {
let paywall = document.querySelector('div.content__message-no-access-container');
if (paywall && dompurify_loaded) {
let content_restriction = document.querySelector('div.content__restriction');
removeDOMElement(paywall, content_restriction);
let body = document.querySelector('body');
if (body)
body.style = 'height:auto !important;';
let article_content = document.querySelector('section[data-article-content-element]');
if (article_content)
article_content.style = 'max-height:none !important;';
let json_url_dom = document.querySelector('link[rel="alternate"][type="application/json"]');
if (json_url_dom) {
let json_url = json_url_dom.href;
fetch(json_url)
.then(response => {
if (response.ok) {
response.json().then(json => {
let json_text = json.content.rendered;
let content = document.querySelector('div[data-article-content-target]');
if (json_text && content) {
let parser = new DOMParser();
let doc = parser.parseFromString('
' + DOMPurify.sanitize(json_text, {ADD_TAGS: ['iframe'], ADD_ATTR: ['frameborder']}) + '
', 'text/html');
let content_new = doc.querySelector('div');
content.parentNode.replaceChild(content_new, content);
}
});
}
});
}
}
}
else
csDone = true;
} else if (window.location.hostname.match(/\.(ie|uk)$/)) {//united kingdom/ireland
if (matchDomain(['belfasttelegraph.co.uk', 'independent.ie'])) {
let flip_pay = document.querySelector('div#flip-pay[style]');
if (flip_pay)
flip_pay.removeAttribute('style');
}
else if (matchDomain('independent.co.uk')) {
let url = window.location.href;
if (window.location.search.match(/(\?|&)amp/)) {
let ads = document.querySelectorAll('amp-ad, amp-embed, [id^="ad-"]');
removeDOMElement(...ads);
} else {
let paywall = document.querySelector('div.article-premium');
let related = document.querySelector('div.related');
let msg = document.querySelector('div#bpc_archive');
if (paywall && !related && !msg) {
paywall.classList.remove('article-premium');
let article = document.querySelector('div#main');
if (article)
article.insertBefore(archiveLink(url), article.firstChild);
}
}
}
else if (matchDomain('prospectmagazine.co.uk')) {
let url = window.location.href;
let paywall = document.querySelector('div.paywall_overlay_blend, div.paywall');
if (paywall) {
removeDOMElement(paywall);
csDoneOnce = true;
let url_cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url.split('?')[0];
replaceDomElementExt(url_cache, true, false, 'main');
}
window.setTimeout(function () {
let ads = document.querySelectorAll('.ad-banner, .advert');
removeDOMElement(...ads);
}, 1000);
}
else if (matchDomain('spectator.co.uk')) {
if (window.location.pathname.match(/\/amp(\/)?$/)) {
let banners = document.querySelectorAll('div[amp-access^="p.show"], div[amp-access*="NOT loggedIn"]');
removeDOMElement(...banners);
} else if (window.location.pathname.startsWith('/article/')) {
let paywall = document.querySelector('.HardPayWallContainer-module__overlay');
let body_par = document.querySelector('p[class^="ContentPageBodyParagraph"]');
let amphtml = document.querySelector('link[rel="amphtml"]');
if ((paywall || !body_par) && amphtml) {
removeDOMElement(paywall);
window.setTimeout(function () {
window.location.href = amphtml.href;
}, 500);
}
}
}
else if (matchDomain('telegraph.co.uk')) {
let url = window.location.href.split('?')[0];
if (url.endsWith('/amp/')) {
let paywall = document.querySelectorAll('.premium-paywall');
if (paywall.length) {
let truncated_content = document.querySelector('.truncated-content');
removeDOMElement(...paywall, truncated_content);
amp_unhide_access_hide('="c.result=\'ALLOW_ACCESS\'"', '', 'amp-ad, amp-embed', false);
} else {
let amp_ads = document.querySelectorAll('amp-ad, amp-embed');
removeDOMElement(...amp_ads);
}
} else {
let subwall = document.querySelectorAll('[class^="subwall"]');
let ads = document.querySelectorAll('.advert, .commercial-unit');
removeDOMElement(...subwall, ...ads);
}
}
else if (matchDomain('the-tls.co.uk')) {
let paywall = document.querySelector('.tls-subscriptions-banner__closed-skin');
removeDOMElement(paywall);
}
else if (matchDomain('thetimes.co.uk')) {
let url = window.location.href;
if (window.location.hostname !== 'epaper.thetimes.co.uk') {
let block = document.querySelector('.subscription-block');
let adverts = document.querySelectorAll('#ad-article-inline, #sticky-ad-header, div[class*="InlineAdWrapper"], div[class*="NativeAd"], div.gyLkkj');
removeDOMElement(block, ...adverts);
let paywall = document.querySelector('div#paywall-portal-article-footer');
if (paywall && !url.includes('?shareToken=')) {
removeDOMElement(paywall);
let article = document.querySelector('article[class^="responsive__BodyContainer"]');
if (article)
article.insertBefore(archiveLink(url), article.firstChild);
}
let paywall_page = document.querySelector('div#paywall-portal-page-footer');
removeDOMElement(paywall_page);
}
}
else
csDone = true;
} else if (window.location.hostname.match(/\.(br|cl|pe)$/) || matchDomain(['clarin.com', 'elespectador.com', 'elmercurio.com', 'latercera.com', 'lasegunda.com', 'valor.globo.com'])) {//south america
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);
}
}
else if (matchDomain('clarin.com')) {
let ads = document.querySelectorAll('.ad-slot');
removeDOMElement(...ads);
}
else if (matchDomain('crusoe.uol.com.br')) {
let paywall = document.querySelector('#wallcontent');
let ads = document.querySelectorAll('#gpt-leaderboard, .ads_desktop, .catchment-box');
removeDOMElement(paywall, ...ads);
}
else if (matchDomain(pe_grupo_elcomercio_domains)) {
let paywall = document.querySelector('.story-content__nota-premium');
if (paywall) {
paywall.classList.remove('story-content__nota-premium');
paywall.removeAttribute('style');
}
let ads = document.querySelectorAll('div[class*="_ads"]');
removeDOMElement(...ads);
}
else if (matchDomain('elespectador.com')) {
if (window.location.search.match(/(\?|&)outputType=amp/)) {
amp_unhide_subscr_section('amp-ad, amp-embed, [class^="Widget"], amp-fx-flying-carpet');
} else {
let paywall = document.querySelector('div.exclusive_validation');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
}
}
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');
let page_pdf_content = document.querySelector('div.page_pdf_content');
let close_html = document.querySelector('div.close_html');
let cont_page_full = document.querySelector('div.cont_page_full');
removeDOMElement(page_pdf_content, close_html, cont_page_full);
}, 1000);
window.setTimeout(function () {
let cont_articlelight = document.querySelector('div.cont_articlelight');
if (cont_articlelight)
cont_articlelight.setAttribute('style', 'height: 100% !important; width: 90% !important');
}, 3000);
}
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');
}
}
else if (matchDomain('estadao.com.br')) {
if (window.location.pathname.endsWith('.amp')) {
amp_unhide_access_hide('="granted"', '="NOT granted"', 'amp-ad, amp-embed, amp-fx-flying-carpet');
} else {
let paywall = document.getElementById('paywall-wrapper-iframe-estadao');
removeDOMElement(paywall);
}
}
else if (matchDomain('folha.uol.com.br')) {
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;
}
}
} else {
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);
}
}
}
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 = '';
}
}
else if (matchDomain('latercera.com')) {
let subscr_banner = document.querySelector('.empty');
removeDOMElement(subscr_banner);
}
else if (matchDomain('lasegunda.com')) {
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);
}
}
else if (matchDomain('valor.globo.com')) {
let url = window.location.href;
let paywall = document.querySelector('div.paywall');
if (paywall) {
removeDOMElement(paywall);
csDoneOnce = true;
let url_cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url;
replaceDomElementExt(url_cache, true, false, 'div.protected-content');
}
window.setTimeout(function () {
let skeleton_box = document.querySelector('div.glb-skeleton-box');
if (skeleton_box) {
skeleton_box.classList.remove('glb-skeleton-box');
skeleton_box.removeAttribute('style');
}
}, 1000);
}
else if (window.location.hostname.endsWith('.cl') && document.querySelector('meta[property="og:image"][content*="://impresa.soy-chile.cl/"]')) {
let content = document.querySelector('div.content');
if (content)
content.setAttribute('id', 'content_new');
let modal_wrapper = document.querySelector('div.modal-wrapper');
removeDOMElement(modal_wrapper);
let body_modal = document.querySelector('body.modal-open');
if (body_modal)
body_modal.classList.remove('modal-open');
}
else
csDone = true;
} else {//other (like com/org & not at/be/br/ch/cl/de/dk/fi/fr/es/ie/nl/no/pe/pt/se/uk))
if (matchDomain(usa_adv_local_domains)) {
let url = window.location.href;
if (url.includes('?outputType=amp')) {
let amp_ads = document.querySelectorAll('.amp-ad-container, amp-embed');
removeDOMElement(...amp_ads);
} else {
let paywall = document.querySelector('.paywall');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
let ads = document.querySelectorAll('div.ad');
removeDOMElement(...ads);
}
}
else if (matchDomain('adweek.com')) {
let url = window.location.href;
let body_single = document.querySelector('body.single');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (body_single && amphtml) {
body_single.classList.remove('single');
window.location.href = amphtml.href;
}
}
else if (matchDomain('americanbanker.com')) {
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');
}
}
else if (matchDomain('artnet.com')) {
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;';
}
}
else if (matchDomain('asia.nikkei.com')) {
let popup = document.querySelector('#pianoj_ribbon');
removeDOMElement(popup);
}
else if (matchDomain('asiatimes.com')) {
if (!window.location.search.match(/(\?|&)amp_markup=1/)) {
let paywall = document.querySelector('div.woocommerce');
if (paywall) {
removeDOMElement(paywall);
let url_amp = window.location.href.split('?')[0] + '?amp_markup=1';
replaceDomElementExt(url_amp, false, false, 'div.entry-content', '', 'article.ia2amp-article');
}
}
}
else if (matchDomain('barrons.com')) {
let url = window.location.href;
if (!url.includes('barrons.com/amp/')) {
let body_continuous = document.querySelector('body.is-continuous');
let snippet = document.querySelector('meta[content="snippet"]');
if (body_continuous && snippet) {
removeDOMElement(snippet);
window.location.href = url.replace('barrons.com', 'barrons.com/amp');
}
let continue_buttons = document.querySelectorAll('button.snippet__buttons--continue');
for (let elem of continue_buttons)
elem.addEventListener('click', function () { window.location.reload(); });
let barrons_ads = document.querySelectorAll('.barrons-body-ad-placement');
removeDOMElement(...barrons_ads);
} else {
amp_unhide_subscr_section('.wsj-ad, amp-ad');
}
}
else if (matchDomain('billboard.com')) {
if (window.location.pathname.endsWith('/amp/')) {
amp_unhide_subscr_section('amp-ad, amp-embed');
}
}
else if (matchDomain('bloomberg.com')) {
function bloomberg_noscroll(node) {
node.removeAttribute('data-paywall-overlay-status');
}
waitDOMElement('div#fortress-paywall-container-root', 'DIV', removeDOMElement, true);
waitDOMAttribute('body', 'BODY', 'data-paywall-overlay-status', bloomberg_noscroll, true);
let paywall = document.querySelector('div#fortress-paywall-container-root');
let counter = document.querySelector('div#fortress-preblocked-container-root');
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');
removeDOMElement(paywall, counter, leaderboard);
sessionStorage.clear();
let url = window.location.href;
if (url.match(/s\/\d{4}-/)) {
let page_ad = document.querySelectorAll('div.page-ad, div[data-ad-placeholder], div[class*="-ad-top"]');
let reg_ui_client = document.querySelector('div#reg-ui-client');
removeDOMElement(leaderboard, ...page_ad, reg_ui_client);
let hidden_images = document.querySelectorAll('img.lazy-img__image[src][data-native-src]');
for (let hidden_image of hidden_images) {
if (hidden_image.src.match(/\/(60|150)x-1\.(png|jpg)$/))
hidden_image.setAttribute('src', hidden_image.getAttribute('data-native-src'));
hidden_image.style.filter = 'none';
}
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);
}
let blur = document.querySelector('div.blur[style]');
if (blur) {
blur.classList.remove('blur');
blur.removeAttribute('style');
}
let shimmering_content = document.querySelectorAll('div.shimmering-text');
let body_transparent = document.querySelector('div[class*="nearly-transparent-text-blur"]');
if ((shimmering_content.length || body_transparent) && dompurify_loaded) {
removeDOMElement(...shimmering_content);
if (body_transparent)
removeClassesByPrefix(body_transparent, 'nearly-transparent-text-blur');
let json_script = document.querySelector('script[data-component-props="ArticleBody"], script[data-component-props="FeatureBody"]');
if (json_script) {
let json = JSON.parse(json_script.innerHTML);
if (json) {
let json_text;
if (json.body)
json_text = json.body;
else if (json.story && json.story.body)
json_text = json.story.body;
if (json_text) {
removeDOMElement(json_script);
let article = document.querySelector('div.body-copy-v2:not(.art_done)');
let article_class = 'body-copy-v2';
if (!article) {
article = document.querySelector('div.body-copy:not(.art_done)');
article_class = 'body-copy';
}
if (!article) {
article = document.querySelector('div.body-content:not(.art_done)');
article_class = 'body-content';
}
if (article) {
article_class += ' art_done';
let parser = new DOMParser();
let doc = parser.parseFromString('
' + DOMPurify.sanitize(json_text, {ADD_TAGS: ['iframe', 'script']}) + '
', '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;');
}
}
}
}
}
}
}
}
else if (matchDomain('bostonglobe.com')) {
if (window.location.search.startsWith('?outputType=amp')) {
amp_unhide_subscr_section();
} else {
let ads = document.querySelectorAll('div.arc_ad');
removeDOMElement(...ads);
}
}
else if (matchDomain('bqprime.com')) {
if (window.location.pathname.startsWith('/amp/')) {
amp_unhide_subscr_section();
}
}
else if (matchDomain('business-standard.com')) {
let skip_button = document.querySelector('a.btn_skip');
if (skip_button)
skip_button.click();
if (!window.location.pathname.startsWith('/article-amp/')) {
let paywall = document.querySelector('span.p-content.paywall, main, p.read-txt');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
} else {
amp_unhide_subscr_section('amp-ad, amp-embed, .block-cont-amp, #divnonpaidcontent, div > div.article_image, div[subscriptions-actions], .reader');
}
}
else if (matchDomain('businessoffashion.com')) {
if (window.location.search.startsWith('?outputType=amp')) {
amp_unhide_access_hide();
} else {
let ads = document.querySelectorAll('div[class^="default__AdsBlockWrapper"]');
removeDOMElement(...ads);
}
}
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);
}
else if (matchDomain(ca_torstar_domains)) {
window.setTimeout(function () {
let meter_banner = document.querySelector('.c-article-meter-banner');
let ads = document.querySelectorAll('.seo-media-query, .c-googleadslot');
removeDOMElement(meter_banner, ...ads);
let end_of_article = document.querySelector('#end-of-article');
if (end_of_article)
end_of_article.setAttribute('style', 'display:none;');
let rightrail = document.querySelector('.c-article-body__rightrail');
if (rightrail)
rightrail.setAttribute('style', 'display:none;');
}, 500);
}
else if (matchDomain('cen.acs.org')) {
let meteredBar = document.querySelector('.meteredBar');
removeDOMElement(meteredBar);
}
else if (matchDomain(['chronicle.com', 'philanthropy.com'])) {
let preview = document.querySelector('div[data-content-summary]');
removeDOMElement(preview);
let article_hidden = document.querySelector('div[data-content-body]');
if (article_hidden)
article_hidden.removeAttribute('data-content-body');
}
else if (matchDomain('csmonitor.com')) {
let paywall = document.querySelector('div.paywall');
removeDOMElement(paywall);
}
else if (matchDomain('dailywire.com')) {
let paywall = document.querySelector('#post-body-text > div > div[class]');
if (paywall)
paywall.removeAttribute('class');
}
else if (matchDomain('dallasnews.com')) {
if (window.location.search.startsWith('?outputType=amp')) {
amp_unhide_subscr_section('amp-ad, amp-embed');
} else {
let overlay = document.querySelector('div.sl-overlay');
removeDOMElement(overlay);
let noscroll = document.querySelector('div#courier-body-wrapper[style]');
if (noscroll)
noscroll.removeAttribute('style');
}
}
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');
}
}
else if (matchDomain('discovermagazine.com')) {
window.setTimeout(function () {
let mammoth = document.querySelector('.iXVGnF');
if (mammoth)
window.location.reload();
let banner = document.querySelector('div.dPURIw');
if (banner)
banner.setAttribute('style', 'display:none;');
}, 1000);
}
else if (matchDomain('economictimes.com')) {
if (window.location.pathname.includes('/amp_')) {
let paywall = document.querySelector('.paywall_wrap');
if (paywall) {
let content = document.querySelector('.paywall[style="display:none;"]');
if (content)
content.setAttribute('style', 'display:block;');
let intro = document.querySelector('.art_wrap');
let article_blocker = document.querySelector('.articleBlocker');
let amp_ads = document.querySelectorAll('amp-ad');
removeDOMElement(paywall, intro, article_blocker, ...amp_ads);
}
} else {
window.setTimeout(function () {
let paywall = document.querySelector('div#blocker_layer');
let data_prime = document.querySelector('div[data-prime="1"]');
let amphtml = document.querySelector('link[rel="amphtml"]');
if ((paywall || data_prime) && amphtml) {
removeDOMElement(paywall);
if (data_prime)
data_prime.removeAttribute('data-prime');
window.location.href = amphtml.href;
}
}, 500);
}
}
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;
let page_content = document.querySelector('div.pageContent:not([style]');
if (page_content)
page_content.setAttribute('style', 'height: auto !important;');
}
}
else if (matchDomain('economist.com')) {
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;
}
}
}
}
else if (matchDomain('enotes.com')) {
let paywall = document.querySelectorAll('section.c-cta-section');
if (paywall.length) {
removeDOMElement(...paywall);
let blurred = document.querySelectorAll('div[class^="_"]');
for (let elem of blurred)
elem.removeAttribute('class');
let intro = document.querySelectorAll('div.o-rte-text > p:not([class]), div.o-rte-text > h3');
for (let elem of intro)
removeDOMElement(elem);
let section_words = pageContains('p[class="u-align--center"]', /\(The entire section contains/);
let ads = document.querySelectorAll('.ad-hfu');
removeDOMElement(...section_words, ...ads);
}
}
else if (matchDomain('entrepreneur.com')) {
let promo = document.querySelector('.paywall-promo');
if (promo) {
removeDOMElement(promo);
let gate_check = document.querySelector('.gate-check');
if (gate_check)
gate_check.removeAttribute('class');
let hidden_images = document.querySelectorAll('img.lazy[src*="blur"][data-src]');
for (let hidden_image of hidden_images)
hidden_image.setAttribute('src', hidden_image.getAttribute('data-src'));
}
}
else if (matchDomain('financialexpress.com')) {
let paywall = document.querySelector('div.paywall');
if (paywall)
paywall.classList.remove('paywall');
let register = document.querySelector('div.pcl-wrap');
let ads;
if (window.location.pathname.endsWith('/lite/'))
ads = document.querySelectorAll('amp-ad, amp-embed, .ad-bg-container');
else
ads = document.querySelectorAll('div[class*="-ads-blocks-ad-unit"]');
removeDOMElement(register, ...ads);
}
else if (matchDomain('firstthings.com')) {
let paywall = document.querySelector('.paywall');
removeDOMElement(paywall);
}
else if (matchDomain('foreignaffairs.com')) {
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');
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'));
hidden_image.removeAttribute('class');
}
let img_list = document.querySelectorAll('.magazine-list-article img');
for (let img_elem of img_list)
img_elem.setAttribute('class', 'mb-4');
if (window.location.href.includes('/interviews/')) {
let img_header = document.querySelector('.interview-header > div');
if (img_header) {
let img_src = img_header.getAttribute('data-src');
let img_elem = document.createElement('img');
img_elem.src = img_src;
img_header.appendChild(img_elem);
}
}
}, 1000);
}
else if (matchDomain('foreignpolicy.com')) {
let content_ungated = document.querySelector('div.content-ungated');
removeDOMElement(content_ungated);
let content_gated = document.querySelector('div.content-gated');
if (content_gated)
content_gated.classList.remove('content-gated');
}
else if (matchDomain('fortune.com')) {
let paywall = document.querySelector('.paywall');
if (window.location.pathname.match(/\/amp(\/)?/)) {
amp_unhide_access_hide('="NOT p.showRegWall AND NOT p.showPayWall"', '', '[class^="amp-ad"]');
removeDOMElement(paywall);
} else {
if (paywall)
paywall.removeAttribute('class');
}
}
else if (matchDomain('ft.com')) {
if (window.location.hostname.startsWith('amp.')) {
amp_unhide_subscr_section('.ad-container, amp-ad');
} else {
let cookie_banner = document.querySelector('.o-cookie-message');
let ribbon = document.querySelector('.js-article-ribbon');
let ads = document.querySelector('.o-ads');
removeDOMElement(cookie_banner, ribbon, ads);
}
}
else if (matchDomain('griffithreview.com')) {
let body_single = document.querySelector('body.single');
if (body_single)
body_single.classList.remove('single');
let subscribe = document.querySelector('div.call-to-action');
removeDOMElement(subscribe);
}
else if (matchDomain('harpers.org')) {
let overlay = document.querySelector('div[id^="pum-"]');
removeDOMElement(overlay);
let entry_content = document.querySelectorAll('.entry-content');
for (let elem of entry_content)
elem.setAttribute('style', 'display: block !important');
}
else if (matchDomain('hbr.org')) {
let popup = document.querySelector('.persistent-banner');
removeDOMElement(popup);
}
else if (matchDomain('hbrchina.org')) {
let div_hidden = document.querySelector('div#the_content');
if (div_hidden)
div_hidden.removeAttribute('style');
}
else if (matchDomain('hilltimes.com')) {
let paywall = document.querySelector('div.paywallcont');
if (paywall) {
removeDOMElement(paywall);
let json_script = getArticleJsonScript();
if (json_script) {
let json = JSON.parse(json_script.text).filter(x => x.articleBody)[0];
if (json) {
let json_text = parseHtmlEntities(json.articleBody).replace(/(\.|\%)\s{3,}/g, "$&\r\n\r\n");
let content = document.querySelector('div#xorg');
if (json_text && content)
content.innerText = '\r\n' + json_text;
}
}
}
}
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);
}
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);
}
else if (matchDomain(usa_hearst_comm_domains)) {
let wrapper = document.querySelector('.belowMastheadWrapper');
removeDOMElement(wrapper);
}
else if (matchDomain('inc42.com')) {
let url = window.location.href;
if (!url.includes('/amp/')) {
let premium = document.querySelector('div.premium-container');
if (premium) {
removeDOMElement(premium);
window.location.href = url.split('?')[0] + 'amp/';
}
} else {
let plus_popup = document.querySelector('div#plus-pop');
if (plus_popup) {
removeDOMElement(plus_popup);
let expired = document.querySelectorAll('div[amp-access="p.showPageviewExpired"], div[amp-access="cm.maxViews AND NOT loggedIn"]');
removeDOMElement(...expired);
amp_unhide_access_hide('^="NOT p.showPageviewExpired"')
}
}
}
else if (matchDomain('indianexpress.com')) {
if (window.location.pathname.endsWith('/lite/'))
amp_unhide_access_hide('="metering.result=\'ALLOW_ACCESS\'"', '', 'amp-ad, amp-embed');
else {
let paywall = document.querySelector('div#pcl-rest-content[style]');
if (paywall)
paywall.removeAttribute('style');
let register = document.querySelector('div#app-pcl');
let ads = document.querySelectorAll('div[class^="adsbox"]');
removeDOMElement(register, ...ads);
}
}
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;
}
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');
}
}
else if (matchDomain('inkl.com')) {
// plus code in contentScript_once.js
}
else if (matchDomain('ipolitics.ca')) {
let login = document.querySelector('div.login');
if (login) {
removeDOMElement(login);
let json_script = document.querySelector('script#__NEXT_DATA__');
if (json_script && dompurify_loaded) {
let json = JSON.parse(json_script.innerText);
if (json && json.props.pageProps.post.content) {
let article_new = json.props.pageProps.post.content;
let article = document.querySelector('.post-header');
if (article) {
let parser = new DOMParser();
let doc = parser.parseFromString('
' + DOMPurify.sanitize(article_new) + '
', 'text/html');
let content_new = doc.querySelector('div');
article.appendChild(content_new);
}
}
}
}
}
else if (matchDomain('jpost.com')) {
let premium_banners = document.querySelectorAll('.hide-for-premium, #hiddenPremiumForm, #hiddenLink');
removeDOMElement(...premium_banners);
}
else if (matchDomain(['latimes.com', 'sandiegouniontribune.com'])) {
if (window.location.search.startsWith('?_amp=true')) {
amp_unhide_subscr_section('amp-ad, [class*="-ad-wrapper"], div.enhancement');
} else {
window.setTimeout(function () {
let metering_bottompanel = document.querySelector('metering-bottompanel');
let banners = document.querySelectorAll('div.enhancement, div.google-dfp-ad-wrapper');
removeDOMElement(metering_bottompanel, ...banners);
}, 500);
}
}
else if (matchDomain('law360.com')) {
window.setTimeout(function () {
let modal = document.querySelectorAll('div#NewsletterModal, div.modal-backdrop');
removeDOMElement(...modal);
}, 500);
}
else if (matchDomain('ledevoir.com')) {
let counter = document.querySelector('.paywall-breakpoint-wrapper');
removeDOMElement(counter);
}
else if (matchDomain('livelaw.in')) {
let paywall = document.querySelector('div#subscription_paid_message, div.subscribeNow');
if (paywall) {
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');
let paywall_content = document.querySelector('div.paywall-content.hide');
if (paywall_content)
paywall_content.classList.remove('hide');
}
let ads = document.querySelectorAll('inside-post-ad, amp-ad');
removeDOMElement(...ads);
}
else if (matchDomain('livemint.com')) {
if (window.location.pathname.includes('/amp-')) {
let paywall = document.querySelectorAll('[amp-access="NOT subscribed"]');
removeDOMElement(...paywall);
} 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);
}
}
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');
}
else if (matchDomain('marketwatch.com')) {
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');
removeDOMElement(meter, container_sponsored);
amp_unhide_subscr_section('.display-ad');
}
let ads = document.querySelectorAll('div.element--ad, div.j-ad');
removeDOMElement(...ads);
}
else if (matchDomain('medianama.com')) {
window.setTimeout(function () {
let modal = document.querySelector('div.modal');
removeDOMElement(modal);
}, 500);
function medianama_height(node) {
node.removeAttribute('style');
}
waitDOMAttribute('div.zox-post-body', 'DIV', 'style', medianama_height, true);
csDoneOnce = true;
}
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();
}
}
}
else if (matchDomain('nation.africa')) {
let datawall_content = document.querySelector('.datawall-content');
if (datawall_content)
datawall_content.classList.remove('datawall-content');
let div_hidden = document.querySelectorAll('[data="datawall-content"]');
for (let elem of div_hidden)
elem.removeAttribute('style');
let hidden_images = document.querySelectorAll('img.lazy-img:not([src])[data-srcset]');
for (let hidden_image of hidden_images) {
hidden_image.classList.remove('lazy-img');
hidden_image.setAttribute('src', hidden_image.getAttribute('data-srcset').split(',')[1].split(' ')[0]);
}
}
else if (matchDomain('nationalgeographic.com')) {
// plus code in contentScript_once.js
let url = window.location.href;
let subscribed = document.querySelector('.Article__Content--gated');
let overlay = document.querySelector('.Article__Content__Overlay--gated');
let msg = document.querySelector('div#bpc_archive');
if (subscribed && !msg) {
subscribed.appendChild(archiveLink(url));
subscribed.setAttribute('style', 'overflow: visible !important;');
if (overlay)
overlay.classList.remove('Article__Content__Overlay--gated');
}
let ads = document.querySelectorAll('div.ad-slot');
removeDOMElement(...ads);
}
else if (matchDomain('nationalreview.com')) {
let url = window.location.href.split('?')[0];
if (!url.includes('/amp/')) {
let continue_reading = document.querySelector('div.continue-reading');
if (continue_reading) {
removeDOMElement(continue_reading);
window.location.href = url + 'amp';
}
}
let adverts = document.querySelectorAll('amp-ad, .ad-unit--center, amp-connatix-player');
removeDOMElement(...adverts);
}
else if (matchDomain('nautil.us')) {
// plus code in contentScript_once.js
let hidden_images = document.querySelectorAll('img[src^="data:image"][data-src]');
for (let hidden_image of hidden_images)
hidden_image.src = hidden_image.getAttribute('data-src');
let empty_video_iframes = document.querySelectorAll('iframe[src="about:blank"][data-litespeed-src]');
for (let empty_video_iframe of empty_video_iframes)
empty_video_iframe.src = empty_video_iframe.getAttribute('data-litespeed-src');
window.setTimeout(function () {
let banners = document.querySelectorAll('div[class^="a__sc-np"], div.subscibe-bar');
removeDOMElement(...banners);
let overflows = document.querySelectorAll('html[style], body[style]');
for (let overflow of overflows)
overflow.removeAttribute('style');
}, 1000);
}
else if (matchDomain('newleftreview.org')) {
window.setTimeout(function () {
let url = window.location.href;
let paywall = document.querySelector('div.promo-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-page');
}
}, 500);
}
else if (matchDomain('newrepublic.com')) {
let pw_popups = document.querySelector('div#pwPopups');
let ads = document.querySelectorAll('.ad-unit, .ad-container');
removeDOMElement(pw_popups, ...ads);
}
else if (matchDomain('newscientist.com')) {
let url = window.location.href;
let paywall = document.querySelector('#subscription-barrier');
if (paywall) {
removeDOMElement(paywall);
csDoneOnce = true;
let url_cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url.split('?')[0];
replaceDomElementExt(url_cache, true, false, 'div.article-body');
}
window.setTimeout(function () {
let lazy_images = document.querySelectorAll('img.lazyload[data-src]:not([src]');
for (let elem of lazy_images)
elem.src = elem.getAttribute('data-src').split('?')[0] + '?width=800';
}, 1000);
}
else if (matchDomain('newsday.com')) {
if (window.location.pathname.startsWith('/amp/')) {
amp_unhide_access_hide('="AccessLevel = \'Full Content Access\' OR Error = true"', '="AccessLevel = \'Page View Limit\'"');
}
}
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;');
}
}
else if (matchDomain('nybooks.com')) {
let paywall_article = document.querySelector('.paywall-article');
if (paywall_article)
paywall_article.classList.remove('paywall-article');
let banner = document.querySelector('div.toast-cta, div.inline-ad');
removeDOMElement(banner);
}
else if (matchDomain('nytimes.com')) {
let banners = document.querySelectorAll('div[data-testid="inline-message"], div[id^="ad-"], div.expanded-dock');
removeDOMElement(...banners);
}
else if (matchDomain('nzherald.co.nz')) {
// plus code in contentScript_once.js
let article_content = document.querySelector('.article__content');
if (article_content) {
let premium = document.querySelector('span.ellipsis');
if (premium && dompurify_loaded) {
premium.classList.remove('ellipsis');
let article_offer = document.querySelector('.article-offer');
removeDOMElement(article_offer);
let css_selector = article_content.querySelectorAll('p[style]')[1].getAttribute('class');
let hidden_not_pars = article_content.querySelectorAll('.' + css_selector + ':not(p)');
for (let hidden_not_par of hidden_not_pars) {
hidden_not_par.classList.remove(css_selector);
hidden_not_par.removeAttribute('style');
}
let hidden_pars = article_content.querySelectorAll('p.' + css_selector);
let par_html, par_dom;
let parser = new DOMParser();
for (let hidden_par of hidden_pars) {
let par_html = parser.parseFromString('
' + DOMPurify.sanitize(hidden_par.innerHTML) + '
', 'text/html');
let par_dom = par_html.querySelector('div');
article_content.insertBefore(par_dom, hidden_par);
}
let first_span = document.querySelector('p > span');
if (first_span)
first_span.removeAttribute('class');
}
}
let premium_toaster = document.querySelector('#premium-toaster');
removeDOMElement(premium_toaster);
}
else if (matchDomain('outlookbusiness.com')) {
let paywall = document.querySelector('div#csc-paywall');
if (paywall) {
removeDOMElement(paywall);
let json_script = document.querySelector('script#__NEXT_DATA__');
if (json_script && dompurify_loaded) {
let json = JSON.parse(json_script.innerText);
if (json && json.props.initialState.dashboard.ARTICLE_POST_DETAIL_API.data.article_data.description) {
let article_new = json.props.initialState.dashboard.ARTICLE_POST_DETAIL_API.data.article_data.description;
let article = document.querySelector('div.story-content');
if (article) {
article.innerHTML = '';
let parser = new DOMParser();
let doc = parser.parseFromString('
' + DOMPurify.sanitize(article_new) + '
', 'text/html');
let content_new = doc.querySelector('div');
article.appendChild(content_new);
}
}
}
}
}
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);
}
}
}
}
}
else if (matchDomain('puck.news')) {
let paywall = document.querySelector('.paywall');
if (paywall) {
removeDOMElement(paywall);
let overlay = document.querySelector('body.paywall-active');
if (overlay)
overlay.classList.remove('paywall-active');
let article_style = document.querySelector('article[style]');
if (article_style)
article_style.removeAttribute('style');
}
}
else if (matchDomain('quora.com')) {
let overlays = document.querySelectorAll('div[class*="_overlay"]');
removeDOMElement(...overlays);
let mask_image = document.querySelector('div.ePDXbR');
if (mask_image)
mask_image.classList.remove('ePDXbR');
}
else if (matchDomain('qz.com')) {
if (window.location.pathname.startsWith('/emails/')) {
let paywall = document.querySelector('div#email-content[class]');
if (paywall) {
paywall.removeAttribute('class');
let login = pageContains('h2[class]', /^This story is exclusive to/);
removeDOMElement(login[0].parentElement);
let noscroll = document.querySelector('iframe[scrolling]');
if (noscroll)
noscroll.removeAttribute('scrolling');
}
}
}
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;
}
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');
}
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;
}
else if (matchDomain('seekingalpha.com')) {
let url = window.location.href;
let locked = document.querySelector('div[data-test-id="post-locked-banner"]');
if (locked && !url.includes('/amp/')) {
window.setTimeout(function () {
window.location.href = url.replace('seekingalpha.com/', 'seekingalpha.com/amp/');
}, 500);
} else if (url.includes('/amp/')) {
amp_unhide_access_hide('*="premium_access OR"', '', '.ad-wrap');
let paywall = document.querySelector('[class*="paywall-container"]');
removeDOMElement(paywall);
}
}
else if (matchDomain('slate.com')) {
let slate_roadblock = document.querySelector('.slate-roadblock');
let ads = document.querySelectorAll('section[class*="-ad"]');
removeDOMElement(slate_roadblock, ...ads);
}
else if (matchDomain('slideshare.net')) {
let limit_overlay = document.querySelector('.limit-overlay');
if (limit_overlay)
limit_overlay.classList.remove('limit-overlay');
}
else if (matchDomain('sloanreview.mit.edu')) {
let paywall = document.querySelector('div.paywall-blinder');
removeDOMElement(paywall);
if (paywall) {
ext_api.runtime.sendMessage({request: 'refreshCurrentTab'});
csDoneOnce = true;
}
}
else if (matchDomain('sofrep.com')) {
if (!window.location.pathname.startsWith('/amp/')) {
let paywall = document.querySelector('div.fader');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
}
let banners = document.querySelectorAll('#scrollerCTA, #botCta');
removeDOMElement(...banners);
}
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');
}
else if (matchDomain('staradvertiser.com')) {
let url = window.location.href.split('?')[0];
if (url.endsWith('/amp/')) {
amp_unhide_subscr_section();
} else {
let paywall = document.querySelector('div#hsa-paywall-overlay');
if (paywall) {
removeDOMElement(paywall);
let div_hidden = document.querySelector('div#hsa-paywall-content[style]');
if (div_hidden)
div_hidden.removeAttribute('style');
}
}
}
else if (matchDomain('startribune.com')) {
let ads = document.querySelectorAll('div.ad-placeholder');
removeDOMElement(...ads);
}
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);
}
else if (matchDomain('stratfor.com')) {
let banner = document.querySelector('.free-cta-container, .paywall-banner');
removeDOMElement(banner);
let hidden_images = document.querySelectorAll('img[src^="data:image/gif"][data-src]');
for (let hidden_image of hidden_images)
hidden_image.setAttribute('src', hidden_image.getAttribute('data-src'));
let url = window.location.href.split('?')[0];
if (url.match(/(\/(\d){4}-([a-z]|-)+-forecast(-([a-z]|-)+)?|-forecast-(\d){4}-([a-z]|[0-9]|-)+)$/)) {
let json_script = document.querySelector('script#__NEXT_DATA__');
if (json_script && dompurify_loaded) {
let json = JSON.parse(json_script.innerText);
if (json && json.props.pageProps.data) {
let overview_div = document.querySelector('div[class^="overview_overview__"] > div');
if (overview_div) {
let data = json.props.pageProps.data;
let parser = new DOMParser();
let data_overview = data.overview;
if (!parseHtmlEntities(data_overview).includes(data.teaser_body))
data_overview = '
' + data.teaser_body + '
' + data_overview;
let doc = parser.parseFromString('
' + DOMPurify.sanitize(data_overview + '
Sections
') + '
', 'text/html');
let content_new = doc.querySelector('div');
let sections = data.section;
for (let section of sections) {
let section_link = document.createElement('a');
section_link.innerText = section.title;
section_link.href = 'https://' + window.location.hostname + '/' + section.path_alias;
content_new.appendChild(section_link);
content_new.appendChild(document.createElement('br'));
}
overview_div.parentNode.replaceChild(content_new, overview_div);
csDoneOnce = true;
}
}
}
waitDOMElement('div.paywall-banner', 'DIV', removeDOMElement, false);
} else if (url.match(/\/article\/.+-forecast(-.+)?\//)) {
let next_section_buttons = document.querySelectorAll('div[class^="nextSection_nextSection__"] > button');
for (let elem of next_section_buttons) {
let section_link = document.createElement('a');
section_link.innerText = elem.innerText;
section_link.href = url.replace(/[^\/]+$/, '') + elem.innerText.split(': ')[1].toLowerCase().split(' ').filter(x => !['a', 'an', 'of', 'the'].includes(x)).join('-');
elem.parentNode.replaceChild(section_link, elem);
}
}
}
else if (matchDomain('studocu.com')) {
window.setTimeout(function () {
let paywall = document.querySelector('div._de9e5fdb76af');
if (paywall) {
let banners = document.querySelectorAll('div._d18a99c0d544, div#premium-page-header');
removeDOMElement(paywall, ...banners);
let blurred_pages = document.querySelectorAll('div.page-content[style*="filter: blur"]');
for (let blurred_page of blurred_pages) {
let page = document.createElement('span');
page.setAttribute('class', 'page-content');
page.appendChild(blurred_page.firstChild);
blurred_page.parentNode.replaceChild(page, blurred_page);
}
}
}, 1000);
}
else if (matchDomain('techinasia.com')) {
let paywall = document.querySelector('.paywall-content');
if (paywall && dompurify_loaded) {
paywall.classList.remove('paywall-content');
let url = window.location.href;
let url_xhr = url.replace('.com/', '.com/wp-json/techinasia/2.0/posts/').replace('/visual-story/', '/');
fetch(url_xhr)
.then(response => {
if (response.ok) {
response.json().then(json => {
let json_text = json.posts[0].content;
json_text = json_text.replace(/width\=\"(\d){3,}\"/g, 'width="100%"').replace(/height\=\"(\d){3,}\"/g, 'height="100%"');
let content = document.querySelector('div.content');
if (json_text && content) {
let parser = new DOMParser();
let doc = parser.parseFromString('
' + DOMPurify.sanitize(json_text) + '
', 'text/html');
let content_new = doc.querySelector('div.content');
content.parentNode.replaceChild(content_new, content);
}
});
}
});
}
let splash_subscribe = document.querySelector('.splash-subscribe');
let paywall_hard = document.querySelector('.paywall-hard');
removeDOMElement(splash_subscribe, paywall_hard);
}
else if (matchDomain('the-american-interest.com')) {
let counter = document.getElementById('article-counter');
removeDOMElement(counter);
}
else if (matchDomain('theathletic.com')) {
if (!window.location.search.match(/(\?|&)amp/)) {
let paywall = document.querySelector('div#slideup-paywall');
if (paywall) {
let overlays = document.querySelectorAll('div[id*="overlay"], div:empty:not([data-rjs])');
removeDOMElement(paywall, ...overlays);
let body = document.querySelector('body');
if (body) {
body.style.overflow = 'visible';
body.style.position = 'relative';
}
} else {
let headline_paywall = document.querySelectorAll('a.headline-paywall');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (headline_paywall.length && amphtml) {
removeDOMElement(...headline_paywall);
window.setTimeout(function () {
window.location.href = amphtml.href;
}, 1000);
}
}
} else {
amp_unhide_subscr_section();
amp_unhide_access_hide('', '*="NOT granted"');
}
let apron = document.querySelector('div#free-apron-cta, div.slideup-free-apron-container');
removeDOMElement(apron);
}
else if (matchDomain('theatlantic.com')) {
let banner = document.querySelector('.c-nudge__container,.c-non-metered-nudge');
removeDOMElement(banner);
}
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) {
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);
}
}
}
}
csDoneOnce = true;
} catch (err) {
console.log(err);
}
}
}
}
else if (matchDomain('thediplomat.com')) {
let preview = document.querySelector('.dpl-preview');
if (preview)
preview.classList.remove('dpl-preview');
}
else if (matchDomain('theglobeandmail.com')) {
let paywall = document.querySelector('div.c-paywall');
if (paywall) {
removeDOMElement(paywall);
let url = window.location.href.split('?')[0];
window.location.href = url + '?rel=premium';
} else {
let article_body_subscribed = document.querySelector('.c-article-body--subscribed');
if (article_body_subscribed)
article_body_subscribed.removeAttribute('class');
}
let banners = document.querySelectorAll('div.c-ad, div#subscription-pencil-area, div.marketing-container-wrapper');
removeDOMElement(...banners);
}
else if (matchDomain(['thehindu.com', 'thehindubusinessline.com'])) {
if (!localStorage.geo) {
localStorage.setItem("geo", '{"v":{"clientTcpRtt":20,"longitude":"' + makeRandomNumber(2) + '.' + makeRandomNumber(5) + '","httpProtocol":"HTTP/2","tlsCipher":"AEAD-AES128-GCM-SHA256","continent":"EU","asn":1234,"clientAcceptEncoding":"gzip, deflate,br","country":"UK","isEUCountry":"1","tlsClientAuth":{"certIssuerDNLegacy":"","certIssuerDN":"","certIssuerDNRFC2253":"","certSubjectDNLegacy":"","certVerified":"NONE","certNotAfter":"","certSubjectDN":"","certFingerprintSHA1":"","certNotBefore":"","certSerial":"","certPresented":"0","certSubjectDNRFC2253":""},"tlsVersion":"TLSv1.3","colo":"DUS","timezone":"Europe/London","edgeRequestKeepAliveStatus":1,"requestPriority":"weight=220;exclusive=1","botManagement":{"staticResource":false,"verifiedBot":false,"score":99},"clientTrustScore":99,"postalCode":"' + makeRandomNumber(4) + '","regionCode":"QR","region":"County","city":"London","latitude":"' + makeRandomNumber(2) + '.' + makeRandomNumber(5) + '"},"e":' + makeRandomNumber(13) + '}');
}
let counter = document.querySelector('#test');
removeDOMElement(counter);
function hindu_main() {
document.addEventListener('bpc_event', function (e) {
if (window) {
window.Adblock = false;
window.isNonSubcribed = false;
}
})
}
insert_script(hindu_main);
document.dispatchEvent(new CustomEvent('bpc_event', {}));
}
else if (matchDomain('theinitium.com')) {
let paywall = document.querySelector('section.c-wall');
removeDOMElement(paywall);
}
else if (matchDomain('thelawyersdaily.ca')) {
if (window.location.pathname.startsWith('/amp/')) {
ampToHtml();
} else {
let modal = document.querySelectorAll('#NewsletterModal, .modal-backdrop');
removeDOMElement(...modal);
}
}
else if (matchDomain('thenewatlantis.com')) {
let article_gated = document.querySelector('.article-gated');
if (article_gated)
article_gated.classList.remove('article-gated');
}
else if (matchDomain('thepointmag.com')) {
let overlay = document.querySelectorAll('div.overlay, div#tpopup-');
for (let elem of overlay)
removeDOMElement(elem);
}
else if (matchDomain('thewrap.com')) {
let paywall = document.querySelector('.wrappro-paywall');
if (paywall)
paywall.classList.remove('wrappro-paywall');
}
else if (matchDomain('time.com')) {
let body = document.querySelector('body');
if (body)
body.setAttribute('style', 'position:relative !important;');
}
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');
}
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);
}
else if (matchDomain(timesofindia_domains)) {
let url = window.location.href;
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');
}
if (window.location.pathname.includes('/amp_')) {
let paywall = document.querySelector('div.paywall');
if (paywall && dompurify_loaded) {
let contentblocker = document.querySelector('div#contentblocker');
let bottom_banner = document.querySelector('#bottom_banner');
removeDOMElement(contentblocker, bottom_banner);
let preview = document.querySelector('div.article-txt');
if (preview) {
let parser = new DOMParser();
let doc = parser.parseFromString('
' + DOMPurify.sanitize(paywall.innerHTML, {ADD_TAGS: ['amp-img']}) + '
', 'text/html');
let article = doc.querySelector('div');
preview.parentNode.replaceChild(article, preview);
preview.classList.remove('prime-bottom-blur');
}
}
let amp_images = document.querySelectorAll('div.inline-imgecontent > amp-img');
for (let amp_img of amp_images) {
let img_new = document.createElement('img');
img_new.src = amp_img.getAttribute('src');
amp_img.parentNode.replaceChild(img_new, amp_img);
img_new.parentElement.classList.remove('inline-imgecontent');
img_new.parentElement.style = 'text-align: center;';
}
} else {
let paywall = document.querySelector('div#story-blocker');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (!amphtml)
amphtml = {href: url.replace('/timesofindia.indiatimes.com/', '/m.timesofindia.com/').replace('/articleshow/', '/amp_articleshow/')};
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
}
}
else if (matchDomain(no_nhst_media_domains)) {
let url = window.location.href;
if (url.includes('.tradewinds.com/markets/')) {
let paywall = document.querySelector('iframe[src]');
removeDOMElement(paywall);
let overflow = document.querySelector('body[style]');
if (overflow)
overflow.removeAttribute('style');
let blurred = document.querySelector('body > div[style]');
if (blurred)
blurred.removeAttribute('style');
} else {
window.setTimeout(function () {
let paywall = document.querySelector('iframe#paywall-iframe');
if (paywall && dompurify_loaded) {
let article = paywall.parentNode;
removeDOMElement(paywall);
fetch(url)
.then(response => {
if (response.ok) {
response.text().then(html => {
let split1 = html.split('window.__INITIAL_STATE__=')[1];
let state = (split1.split('};')[0] + '}').split('')[0];
if (state) {
let json = JSON.parse(state);
if (json) {
let json_text = json.article.body;
let parser = new DOMParser();
let doc = parser.parseFromString('
' + DOMPurify.sanitize(json_text, {ADD_ATTR: ['itemprop'], ADD_TAGS: ['link']}) + '
', 'text/html');
let article_new = doc.querySelector('div');
if (article_new) {
if (article)
article.appendChild(article_new);
}
}
}
})
}
})
}
}, 500);
}
}
else if (matchDomain(usa_conde_nast_domains)) {
if (window.location.pathname.endsWith('/amp')) {
amp_unhide_subscr_section('amp-ad, amp-embed, .ad');
} else {
let paywall_bar = document.querySelector('.paywall-bar');
removeDOMElement(paywall_bar);
}
}
else if (matchDomain(usa_craincomm_domains)) {
let body_hidden = document.querySelector('body[class]');
if (body_hidden)
body_hidden.removeAttribute('class');
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);
}
else if (matchDomain(usa_genomeweb_domains)) {
let banners = document.querySelectorAll('div.footer__ads-footer');
removeDOMElement(...banners);
}
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);
}
if (matchDomain('cyclingtips.com')) {
localStorage.removeItem('av');
let ads = document.querySelectorAll('div[data-block-name="ads"], div#takeover');
removeDOMElement(...ads);
}
}
else if (matchDomain(usa_tribune_domains)) {
let overlay = document.querySelector('div#zephr-overlay');
removeDOMElement(overlay);
}
else if (matchDomain('usatoday.com')) {
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);
}
}
}
}
else if (matchDomain('venturebeat.com')) {
window.setTimeout(function () {
let paywall = document.querySelector('div.paywall');
if (paywall)
paywall.classList.remove('paywall');
}, 500);
}
else if (matchDomain('voguebusiness.com')) {
if (window.location.pathname.endsWith('/amp')) {
amp_unhide_subscr_section();
} else {
let paywall = document.querySelector('div[class*="PaywallInlineBarrier"]');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
}
}
else if (matchDomain('washingtonpost.com')) {
let leaderboard = document.querySelector('#leaderboard-wrapper');
let adverts = document.querySelectorAll('div[data-qa$="-ad"]');
removeDOMElement(leaderboard, ...adverts);
}
else if (matchDomain('winnipegfreepress.com')) {
let ads = document.querySelectorAll('.billboard-ad-space, .ad, .article-ad, .fixed-sky');
removeDOMElement(...ads);
}
else if (matchDomain('wsj.com')) {
let url = window.location.href;
if (location.href.includes('/articles/')) {
let close_button = document.querySelector('div.close-btn[role="button"]');
if (close_button)
close_button.click();
}
let wsj_ads = document.querySelectorAll('div[class*="wsj-ad"], div[class*="BodyAdWrapper"]');
removeDOMElement(...wsj_ads);
if (url.includes('/amp/')) {
let masthead_link = document.querySelector('div.masthead > a[href*="/articles/"]');
if (masthead_link)
masthead_link.href = 'https://www.wsj.com';
amp_unhide_subscr_section();
} else {
let snippet = document.querySelector('.snippet-promotion, div#cx-snippet-overlay');
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');
}
}
}
else if ((domain = matchDomain(usa_lee_ent_domains)) || document.querySelector('a[href^="https://bloxcms.com"][title^="BLOX"]')) {
if (window.location.pathname.endsWith('.amp.html')) {
amp_unhide_access_hide('="hasAccess"', '="NOT hasAccess"', 'amp-ad, amp-embed, .amp-ads-container');
let elem_hidden = document.querySelectorAll('html[class], body[class]');
for (let elem of elem_hidden)
elem.removeAttribute('class');
} else if (!domain) {
let subscriber_only = document.querySelectorAll('div.subscriber-only[style]:not(.encrypted-content)');
for (let elem of subscriber_only)
elem.removeAttribute('style');
}
}
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/"]'))) {
if (!domain)
domain = document.domain.replace(/(account|amp)\./, '');
let url = window.location.href;
if (url.includes('account.' + domain + '/paywall/')) {
window.setTimeout(function () {
window.location.href = 'https://amp.' + domain + '/article' + url.split('resume=')[1].split(/[#&]/)[0] + '.html';
}, 500);
} else if (url.includes('amp.' + domain + '/')) {
amp_unhide_subscr_section();
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.');
}
}
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/')) {
amp_unhide_subscr_section('amp-ad, amp-embed');
}
}
else
csDone = true;
}
if ((csDone && (bg2csData !== undefined)) || csDoneOnce) {
addDivBpcDone();
if (csDone && (bg2csData !== undefined) && !bg2csData.amp_unhide)
ext_api.runtime.sendMessage({csDone: true});
}
} // end div_bpc_done
// General Functions
function removeDOMElement(...elements) {
for (let element of elements) {
if (element)
element.remove();
}
}
function waitDOMElement(selector, tagName = '', callback, multiple = false) {
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();
}
}
}
}
}).observe(document, {
subtree: true,
childList: true
});
}
function waitDOMAttribute(selector, tagName = '', attributeName = '', callback, multiple = false) {
let targetNode = document.querySelector(selector);
if (!targetNode)
return;
new window.MutationObserver(function (mutations) {
for (let mutation of mutations) {
if (mutation.target.attributes[attributeName]) {
callback(mutation.target);
if (!multiple)
this.disconnect();
}
}
}).observe(targetNode, {
attributes: true,
attributeFilter: [attributeName]
});
}
function addDivBpcDone() {
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);
}
function matchDomain(domains, hostname = window.location.hostname) {
let matched_domain = false;
if (typeof domains === 'string')
domains = [domains];
domains.some(domain => (hostname === domain || hostname.endsWith('.' + domain)) && (matched_domain = domain));
return matched_domain;
}
function replaceDomElementExt(url, proxy, base64, selector, text_fail = '', selector_source = selector) {
if (proxy) {
if (!text_fail) {
if (url.includes('webcache.googleusercontent.com'))
text_fail = 'BPC > failed to load from Google webcache: '
}
ext_api.runtime.sendMessage({request: 'getExtSrc', data: {url: url, selector: selector, selector_source: selector_source, base64: base64, text_fail: text_fail}});
} else {
fetch(url)
.then(response => {
let article = document.querySelector(selector);
if (response.ok) {
response.text().then(html => {
replaceDomElementExtSrc(url, html, false, base64, selector, text_fail, selector_source);
});
} else {
if (text_fail && article) {
replaceTextFail(article, proxy, text_fail)
}
}
}).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 () {
let doc = parser.parseFromString(DOMPurify.sanitize(html, {ADD_ATTR: ['layout', 'itemprop'], ADD_TAGS: ['amp-img', 'iframe']}), 'text/html');
//console.log(DOMPurify.removed);
let article_new = doc.querySelector(selector_source);
if (article_new) {
if (article && article.parentNode)
article.parentNode.replaceChild(article_new, article);
}
}, 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);
}
article.insertBefore(text_fail_div, article.firstChild);
}
}
function ampToHtml() {
window.setTimeout(function () {
let canonical = document.querySelector('link[rel="canonical"]');
window.location.href = canonical.href;
}, 500);
}
function archiveLink(url, text_fail = 'BPC > Full article text:\r\n') {
let text_fail_div = document.createElement('div');
text_fail_div.id = 'bpc_archive';
text_fail_div.setAttribute('style', 'margin: 20px; font-weight: bold; color:red;');
text_fail_div.appendChild(document.createTextNode(text_fail));
function add_links(domains) {
for (let domain of domains) {
let a_link = document.createElement('a');
a_link.innerText = domain;
a_link.href = 'https://' + domain + '?run=1&url=' + url.split('?')[0];
a_link.target = '_blank';
text_fail_div.appendChild(document.createTextNode(' | '));
text_fail_div.appendChild(a_link);
}
}
add_links(['archive.today', 'archive.is']);
return text_fail_div;
}
function removeClassesByPrefix(el, prefix) {
let el_classes = el.classList;
for (let el_class of el_classes) {
if (el_class.startsWith(prefix))
el_classes.remove(el_class);
}
}
function cookieExists(name) {
return document.cookie.split(';').some(function (item) {
return item.trim().indexOf(name + '=') === 0
})
}
function setCookie(name, value, domain, path, days) {
let max_age = days * 24 * 60 * 60;
document.cookie = name + "=" + (value || "") + "; domain=" + domain + "; path=" + path + "; max-age=" + max_age;
}
function insert_script(func, insertAfterDom) {
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);
}
}
function genHexString(len) {
let output = '';
for (let i = 0; i < len; i++)
output += (Math.floor(Math.random() * 16)).toString(16);
return output;
}
function makeRandomNumber(len) {
let result = '';
let characters = '123456789';
let charactersLength = characters.length;
for (let i = 0; i < len; i++)
result += characters.charAt(Math.floor(Math.random() * charactersLength));
return result;
}
function pageContains(selector, text) {
let elements = document.querySelectorAll(selector);
return Array.prototype.filter.call(elements, function (element) {
return RegExp(text).test(element.textContent);
});
}
function breakText(str) {
str = str.replace(/(?:^|[A-Za-z\"\“])(\.|\?|!)(?=[A-ZÖÜ\„\d][A-Za-zÀ-ÿ\„\d]{1,})/gm, "$&\n\n");
str = str.replace(/(([a-z]{2,}|[\"\“]))(?=[A-Z](?=[A-Za-zÀ-ÿ]+))/gm, "$&\n\n");
// exceptions: names with alternating lower/uppercase (no general fix)
let str_rep_arr = ['AstraZeneca', 'BaFin', 'BerlHG', 'BfArM', 'BilMoG', 'BioNTech', 'DiGA', 'EuGH', 'FinTechRat', 'GlaxoSmithKline', 'IfSG', 'medRxiv', 'mmHg', 'PlosOne', 'StVO'];
let str_rep_split,
str_rep_src;
for (let str_rep of str_rep_arr) {
str_rep_split = str_rep.split(/([a-z]+)(?=[A-Z](?=[A-Za-z]+))/);
str_rep_src = str_rep_split.reduce(function (accumulator, currentValue) {
return accumulator + currentValue + ((currentValue !== currentValue.toUpperCase()) ? '\n\n' : '');
});
if (str_rep_src.endsWith('\n\n'))
str_rep_src = str_rep_src.slice(0, -2);
str = str.replace(new RegExp(str_rep_src, "g"), str_rep);
}
str = str.replace(/De\n\n([A-Z])/g, "De$1");
str = str.replace(/La\n\n([A-Z])/g, "La$1");
str = str.replace(/Le\n\n([A-Z])/g, "Le$1");
str = str.replace(/Mc\n\n([A-Z])/g, "Mc$1");
return str;
};
function parseHtmlEntities(encodedString) {
let translate_re = /&(nbsp|amp|quot|lt|gt|deg|hellip|laquo|raquo|ldquo|rdquo|lsquo|rsquo|mdash|shy);/g;
let translate = {"nbsp": " ", "amp": "&", "quot": "\"", "lt": "<", "gt": ">", "deg": "°", "hellip": "…",
"laquo": "«", "raquo": "»", "ldquo": "“", "rdquo": "”", "lsquo": "‘", "rsquo": "’", "mdash": "—", "shy": ""};
return encodedString.replace(translate_re, function (match, entity) {
return translate[entity];
}).replace(/(\d+);/gi, function (match, numStr) {
let num = parseInt(numStr, 10);
return String.fromCharCode(num);
});
}
function encode_utf8(str) {
return unescape(encodeURIComponent(str));
}
function decode_utf8(str) {
return decodeURIComponent(escape(str));
}