bypass-paywalls-chrome-clean/contentScript.js

4313 lines
172 KiB
JavaScript
Raw Normal View History

//"use strict";
var ext_api = (typeof browser === 'object') ? browser : chrome;
var domain;
var csDone = false;
2021-07-03 23:43:34 -07:00
var csDoneOnce = false;
2021-10-22 03:36:25 -07:00
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']);
2021-01-08 09:40:01 -08:00
var ca_torstar_domains = ['niagarafallsreview.ca', 'stcatharinesstandard.ca', 'thepeterboroughexaminer.com', 'therecord.com', 'thespec.com', 'thestar.com', 'wellandtribune.ca'];
2022-08-03 10:01:21 -07:00
var de_funke_medien_domains = ['abendblatt.de', 'braunschweiger-zeitung.de', 'morgenpost.de', 'nrz.de', 'otz.de', 'thueringer-allgemeine.de', 'tlz.de', 'waz.de', 'wp.de', 'wr.de'];
2022-03-31 09:10:24 -07:00
var de_madsack_domains = ['haz.de', 'kn-online.de', 'ln-online.de', 'lvz.de', 'maz-online.de', 'neuepresse.de', 'ostsee-zeitung.de', 'rnd.de'];
var de_madsack_custom_domains = ['aller-zeitung.de', 'dnn.de', 'gnz.de', 'goettinger-tageblatt.de', 'paz-online.de', 'sn-online.de', 'waz-online.de'];
2022-08-03 10:01:21 -07:00
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'];
2022-08-15 09:05:31 -07:00
var es_grupo_vocento_domains = ['abc.es', 'diariosur.es', 'diariovasco.com', 'elcomercio.es', 'elcorreo.com', 'eldiariomontanes.es', 'elnortedecastilla.es', 'hoy.es', 'ideal.es', 'larioja.com', 'lasprovincias.es', 'laverdad.es', 'lavozdigital.es'];
2021-07-30 10:20:16 -07:00
var es_unidad_domains = ['elmundo.es', 'expansion.com', 'marca.com'];
2022-02-26 23:04:24 -08:00
var fi_alma_talent_domains = ['arvopaperi.fi', 'iltalehti.fi', 'kauppalehti.fi', 'marmai.fi', 'mediuutiset.fi', 'mikrobitti.fi', 'talouselama.fi', 'tekniikkatalous.fi', 'tivi.fi', 'uusisuomi.fi'];
2020-12-06 13:31:54 -08:00
var fr_groupe_ebra_domains = ['bienpublic.com', 'dna.fr', 'estrepublicain.fr', 'lalsace.fr', 'ledauphine.com', 'lejsl.com', 'leprogres.fr', 'republicain-lorrain.fr', 'vosgesmatin.fr'];
2020-12-07 09:10:29 -08:00
var fr_groupe_la_depeche_domains = ['centrepresseaveyron.fr', 'ladepeche.fr', 'lindependant.fr', 'midi-olympique.fr', 'midilibre.fr', 'nrpyrenees.fr', 'petitbleu.fr'];
2021-12-31 02:50:03 -08:00
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'];
2022-08-04 08:38:17 -07:00
var it_gedi_domains = ['gelocal.it', 'huffingtonpost.it', 'ilsecoloxix.it', 'italian.tech', 'lastampa.it', 'lescienze.it', 'limesonline.com', 'repubblica.it'];
2021-07-29 23:51:03 -07:00
var it_quotidiano_domains = ['ilgiorno.it', 'ilrestodelcarlino.it', 'iltelegrafolivorno.it', 'lanazione.it', 'quotidiano.net'];
2022-04-28 08:52:06 -07:00
var medium_custom_domains = ['betterprogramming.pub', 'towardsdatascience.com'];
2021-06-20 12:40:30 -07:00
var nl_mediahuis_region_domains = ['gooieneemlander.nl', 'haarlemsdagblad.nl', 'ijmuidercourant.nl', 'leidschdagblad.nl', 'noordhollandsdagblad.nl'];
2022-08-03 11:12:32 -07:00
var nl_dpg_media_domains = ['demorgen.be', 'humo.be', 'parool.nl', 'trouw.nl', 'volkskrant.nl'];
2021-07-23 07:11:57 -07:00
var no_nhst_media_domains = ['intrafish.com', 'rechargenews.com', 'tradewindsnews.com', 'upstreamonline.com'];
2022-02-11 08:51:16 -08:00
var pe_grupo_elcomercio_domains = ['diariocorreo.pe', 'elcomercio.pe', 'gestion.pe'];
2021-07-23 08:47:24 -07:00
var timesofindia_domains = ['timesofindia.com', 'timesofindia.indiatimes.com'];
2021-11-16 09:21:45 -08:00
var usa_adv_local_domains = ['al.com', 'cleveland.com', 'lehighvalleylive.com', 'masslive.com', 'mlive.com', 'nj.com', 'oregonlive.com', 'pennlive.com', 'silive.com', 'syracuse.com'];
2022-07-05 08:10:22 -07:00
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'];
2022-07-30 23:59:27 -07:00
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', 'journalnow.com', 'omaha.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'];
2021-08-16 13:49:46 -07:00
var usa_mng_domains = ['denverpost.com', 'eastbaytimes.com', 'mercurynews.com', 'ocregister.com', 'pe.com', 'twincities.com'];
2022-04-20 08:58:42 -07:00
var usa_outside_mag_domains = ["backpacker.com", "betamtb.com", "betternutrition.com", "cleaneatingmag.com", "climbing.com", "cyclingtips.com", "gymclimber.com", "outsideonline.com", "oxygenmag.com", "pelotonmagazine.com", "podiumrunner.com", "rockandice.com", "skimag.com", "trailrunnermag.com", "triathlete.com", "vegetariantimes.com", "velonews.com", "womensrunning.com", "yogajournal.com"];
var usa_tribune_domains = ['baltimoresun.com', 'chicagotribune.com', 'courant.com', 'dailypress.com', 'mcall.com', 'nydailynews.com', 'orlandosentinel.com', 'pilotonline.com', 'sun-sentinel.com'];
2020-12-10 11:22:57 -08:00
// 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();
}
2018-12-07 04:43:16 -08:00
2022-03-30 09:22:20 -07:00
function getArticleJsonScript() {
let scripts = document.querySelectorAll('script[type="application/ld+json"]');
let json_script;
for (let script of scripts) {
if (script.innerText.includes('articleBody')) {
json_script = script;
break;
}
}
return json_script;
}
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('<div>' + DOMPurify.sanitize(json_text) + '</div>', 'text/html');
let content_new = doc.querySelector('div');
content.parentNode.replaceChild(content_new, content);
}
}
}
}, 1000);
}
}
// custom/updated sites: load text from Google webcache
if ((bg2csData !== undefined) && bg2csData.ld_google_webcache && dompurify_loaded) {
if (bg2csData.ld_google_webcache.includes('|')) {
window.setTimeout(function () {
let url = window.location.href;
let ld_google_webcache_split = bg2csData.ld_google_webcache.split('|');
let paywall_sel = ld_google_webcache_split[0];
let article_sel = ld_google_webcache_split[1];
let paywall = document.querySelectorAll(paywall_sel);
if (paywall.length) {
removeDOMElement(...paywall);
2022-08-02 08:26:48 -07:00
let url_cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url.split('?')[0];
replaceDomElementExt(url_cache, true, false, article_sel);
}
}, 1000);
}
}
var div_bpc_done = document.querySelector('div#bpc_done');
if (!div_bpc_done) {
2022-07-04 11:35:21 -07:00
if (ext_api.runtime) {
ext_api.runtime.onMessage.addListener(
function(request, sender) {
if (request.msg === 'showExtSrc') {
replaceDomElementExtSrc(request.data.url, request.data.html, true, false, request.data.selector, request.data.text_fail, request.data.selector_source);
}
}
)
}
2022-04-09 08:07:08 -07:00
// check for opt-in confirmation (from background.js)
2021-10-17 12:14:29 -07:00
if ((bg2csData !== undefined) && bg2csData.optin_setcookie) {
if (matchDomain(['crusoe.uol.com.br'])) {
2022-07-29 09:20:27 -07:00
if (!cookieExists('crs_subscriber'))
setCookie('crs_subscriber', 1, 'crusoe.uol.com.br', '/', 14);
}
}
2022-02-03 10:11:34 -08:00
function amp_iframes_replace(weblink = false, source = '') {
let amp_iframes = document.querySelectorAll('amp-iframe' + (source ? '[src*="'+ source + '"]' : ''));
2022-08-15 09:05:31 -07:00
let par, elem;
for (let amp_iframe of amp_iframes) {
if (!weblink) {
elem = document.createElement('iframe');
Object.assign(elem, {
src: amp_iframe.getAttribute('src'),
sandbox: amp_iframe.getAttribute('sandbox'),
height: amp_iframe.getAttribute('height'),
2021-12-10 09:16:40 -08:00
width: 'auto',
style: 'border: 0px;'
});
2022-08-10 23:32:58 -07:00
amp_iframe.parentNode.replaceChild(elem, amp_iframe);
} else {
2022-08-15 09:05:31 -07:00
par = document.createElement('p');
2022-08-10 23:32:58 -07:00
elem = document.createElement('a');
elem.innerText = 'Media-link';
elem.setAttribute('href', amp_iframe.getAttribute('src'));
elem.setAttribute('target', '_blank');
2022-08-15 09:05:31 -07:00
par.appendChild(elem);
amp_iframe.parentNode.replaceChild(par, amp_iframe);
}
}
}
2022-02-03 10:11:34 -08:00
function amp_unhide_subscr_section(amp_ads_sel = 'amp-ad, .ad', replace_iframes = true, amp_iframe_link = false, source = '') {
2021-11-30 08:35:45 -08:00
let preview = document.querySelector('[subscriptions-section="content-not-granted"]');
removeDOMElement(preview);
let subscr_section = document.querySelectorAll('[subscriptions-section="content"]');
for (let elem of subscr_section)
elem.removeAttribute('subscriptions-section');
let amp_ads = document.querySelectorAll(amp_ads_sel);
removeDOMElement(...amp_ads);
if (replace_iframes)
2022-02-03 10:11:34 -08:00
amp_iframes_replace(amp_iframe_link, source);
2021-11-30 08:35:45 -08:00
}
2022-02-03 10:11:34 -08:00
function amp_unhide_access_hide(amp_access = '', amp_access_not = '', amp_ads_sel = 'amp-ad, .ad', replace_iframes = true, amp_iframe_link = false, source = '') {
2022-04-01 07:03:49 -07:00
let access_hide = document.querySelectorAll('[amp-access' + amp_access + '][amp-access-hide]:not([amp-access="error"], [amp-access^="message"])');
2022-03-08 10:04:40 -08:00
for (let elem of access_hide)
2021-11-30 08:35:45 -08:00
elem.removeAttribute('amp-access-hide');
if (amp_access_not) {
let amp_access_not_dom = document.querySelectorAll('[amp-access' + amp_access_not + ']');
removeDOMElement(...amp_access_not_dom);
2021-11-30 08:35:45 -08:00
}
let amp_ads = document.querySelectorAll(amp_ads_sel);
removeDOMElement(...amp_ads);
if (replace_iframes)
2022-02-03 10:11:34 -08:00
amp_iframes_replace(amp_iframe_link, source);
2021-11-30 08:35:45 -08:00
}
// custom/updated sites: try to unhide text on amp-page
2021-10-17 12:14:29 -07:00
if ((bg2csData !== undefined) && bg2csData.amp_unhide) {
window.setTimeout(function () {
let amp_page_hide = document.querySelector('script[src*="/amp-access-"], script[src*="/amp-subscriptions-"]');
if (amp_page_hide) {
2021-11-30 08:35:45 -08:00
amp_unhide_subscr_section();
amp_unhide_access_hide();
amp_iframes_replace();
2021-11-17 08:45:14 -08:00
}
2022-03-08 10:04:40 -08:00
}, 100);
2021-11-17 08:45:14 -08:00
}
// custom/updated sites: amp-redirect
2021-11-17 08:45:14 -08:00
if ((bg2csData !== undefined) && bg2csData.amp_redirect) {
window.setTimeout(function () {
let amp_script = document.querySelector('script[src^="https://cdn.ampproject.org/"]');
let amphtml = document.querySelector('link[rel="amphtml"]');
let amp_page = amp_script && !amphtml;
2021-11-17 08:45:14 -08:00
if (!amp_page) {
let paywall = true;
if (bg2csData.amp_redirect.paywall)
paywall = document.querySelector(bg2csData.amp_redirect.paywall);
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
2021-10-17 12:14:29 -07:00
}
2022-03-08 10:04:40 -08:00
}, 500);
2021-10-17 12:14:29 -07:00
}
function cs_code_elems(elems) {
for (let elem of elems) {
let elem_dom = document.querySelectorAll(elem.cond);
for (let item of elem_dom) {
if (elem.rm_elem)
removeDOMElement(item);
if (elem.rm_class) {
let rm_class = elem.rm_class.split(',').map(x => x.trim());
item.classList.remove(...rm_class);
}
if (elem.rm_attrib)
item.removeAttribute(elem.rm_attrib);
2022-05-03 08:42:21 -07:00
if (elem.set_attrib && elem.set_attrib.includes('|')) {
let attrib = elem.set_attrib.split('|')[0];
let value = elem.set_attrib.split('|')[1];
item.setAttribute(attrib, value);
}
if (elem.elems)
cs_code_elems(elem.elems);
}
}
}
// updated sites: cs_code
if ((bg2csData !== undefined) && bg2csData.cs_code) {
window.setTimeout(function () {
cs_code_elems(bg2csData.cs_code);
2022-03-08 10:04:40 -08:00
}, 1000);
}
// Content workarounds/domain
2022-04-28 08:52:06 -07:00
if (matchDomain('medium.com') || matchDomain(medium_custom_domains) || document.querySelector('script[src^="https://cdn-client.medium.com/"]')) {
let paywall = document.querySelector('div#paywall-background-color');
removeDOMElement(paywall);
2021-08-22 08:42:30 -07:00
if (paywall) {
ext_api.runtime.sendMessage({request: 'refreshCurrentTab'});
2021-08-22 08:42:30 -07:00
csDoneOnce = true;
}
window.setTimeout(function () {
let meter = document.querySelector('[id*="highlight-meter-"]');
if (meter)
meter.hidden = true;
2022-03-08 10:04:40 -08:00
}, 500);
2020-08-11 23:36:58 -07:00
}
else if (window.location.hostname.match(/\.(com|net)\.au$/)) {//australia
2020-09-10 13:00:53 -07:00
if (matchDomain('thesaturdaypaper.com.au')) {
let paywall = document.querySelector('div.paywall-hard-always-show');
removeDOMElement(paywall);
2021-02-20 01:18:01 -08:00
}
2022-05-27 06:11:26 -07:00
else if (matchDomain(['brisbanetimes.com.au', 'smh.com.au', 'theage.com.au', 'watoday.com.au'])) {
if (!window.location.hostname.startsWith('amp.')) {
let paywall = document.querySelector('meta[content^="FOR SUBSCRIBERS"], #paywall_prompt');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
} else {
2021-11-30 08:35:45 -08:00
amp_unhide_subscr_section();
}
}
else {
// Australian Community Media newspapers
2022-05-06 09:46:17 -07:00
let au_comm_media_domains = ['bendigoadvertiser.com.au', 'bordermail.com.au', 'canberratimes.com.au', 'centralwesterndaily.com.au', 'dailyadvertiser.com.au', 'dailyliberal.com.au', 'examiner.com.au', 'illawarramercury.com.au', 'newcastleherald.com.au', 'northerndailyleader.com.au', 'standard.net.au', 'theadvocate.com.au', 'thecourier.com.au', 'westernadvocate.com.au'];
let au_comm_media_link = document.querySelector('a[href^="https://australiancommunitymedia.zendesk.com"]');
if (matchDomain(au_comm_media_domains) || au_comm_media_link) {
2022-08-03 22:57:17 -07:00
let mask = document.querySelector('div[style*="mask-image"]');
2022-03-22 12:41:46 -07:00
if (mask) {
mask.removeAttribute('style');
2022-08-03 22:57:17 -07:00
let div_hidden = document.querySelectorAll('div.hidden');
2022-05-06 09:46:17 -07:00
for (let elem of div_hidden)
elem.classList.remove('hidden');
2022-03-22 12:41:46 -07:00
} else {
let subscribe_truncate = document.querySelector('.subscribe-truncate');
if (subscribe_truncate)
subscribe_truncate.classList.remove('subscribe-truncate');
let subscriber_hiders = document.querySelectorAll('.subscriber-hider');
for (let subscriber_hider of subscriber_hiders)
subscriber_hider.classList.remove('subscriber-hider');
}
let blocker = document.querySelector('div.blocker');
let overlays = document.querySelectorAll('div.transition-all, div[id^="headlessui-dialog"]');
let noscroll = document.querySelectorAll('html[style], body[style]');
for (let elem of noscroll)
elem.removeAttribute('style');
let story_generic_iframe = document.querySelector('.story-generic__iframe');
2022-08-03 22:57:17 -07:00
let ads = document.querySelectorAll('.ad-placeholder, .sticky, [id*="-container"], #hindsight-ads-iframe');
removeDOMElement(story_generic_iframe, blocker, ...overlays, ...ads);
} else if (window.location.hostname.endsWith('.com.au')) {
// Australia News Corp
2022-01-22 09:37:32 -08:00
let au_news_corp_domains = ['adelaidenow.com.au', 'cairnspost.com.au', 'codesports.com.au', 'couriermail.com.au', 'dailytelegraph.com.au', 'geelongadvertiser.com.au', 'goldcoastbulletin.com.au', 'heraldsun.com.au', 'ntnews.com.au', 'theaustralian.com.au', 'thechronicle.com.au', 'themercury.com.au', 'townsvillebulletin.com.au', 'weeklytimesnow.com.au'];
2022-05-27 06:11:26 -07:00
if (matchDomain(au_news_corp_domains)) {
let header_ads = document.querySelector('.header_ads-container');
removeDOMElement(header_ads);
let figure_stretch = document.querySelectorAll('figure.stretch');
for (let elem of figure_stretch)
elem.classList.remove('stretch');
let amp_ads_sel = 'amp-ad, amp-embed, [id^="ad-mrec-"], .story-ad-container';
2022-02-03 23:50:47 -08:00
let comments;
if (window.location.hostname.startsWith('amp.')) {
2022-08-10 23:32:58 -07:00
amp_unhide_subscr_section(amp_ads_sel, true, true, '.newscdn.com.au');
2022-02-03 23:50:47 -08:00
comments = document.querySelector('#story-comments, .comments-wrapper');
2022-04-19 12:37:13 -07:00
} else if (window.location.search.match(/(\?|&)amp/)) {
2022-08-10 23:32:58 -07:00
amp_unhide_subscr_section(amp_ads_sel, true, true, '.newscdn.com.au');
2022-02-03 23:50:47 -08:00
comments = document.querySelector('#comments-load');
2022-02-03 10:11:34 -08:00
let amp_iframe_sizers = document.querySelectorAll('amp-iframe > i-amphtml-sizer');
removeDOMElement(...amp_iframe_sizers)
}
2022-02-03 23:50:47 -08:00
removeDOMElement(comments);
} else {
// Australian Seven West Media
2022-01-25 09:15:13 -08:00
let swm_image = document.querySelector('img[src^="https://images.thewest.com.au"]');
if (matchDomain('thewest.com.au') || swm_image) {
window.setTimeout(function () {
let breach_screen = document.querySelector('div[data-testid*="BreachScreen"]');
if (breach_screen) {
let scripts = document.querySelectorAll('script:not([src], [type])');
let json_script;
for (let script of scripts) {
if (script.innerText.includes('window.PAGE_DATA =')) {
json_script = script;
break;
}
}
if (json_script) {
let json_text = json_script.innerHTML.split('window.PAGE_DATA =')[1].split('</script')[0];
json_text = json_text.replace(/undefined/g, '"undefined"');
let json_article = JSON.parse(json_text);
let json_pub;
for (let key in json_article)
if (json_article[key].data.result.resolution && json_article[key].data.result.resolution.publication) {
json_pub = json_article[key].data.result.resolution.publication;
break;
}
let json_content = [];
let url_loaded;
if (json_pub) {
json_content = json_pub.content.blocks;
url_loaded = json_pub._self;
} else
window.location.reload(true);
//let json_video = json_pub.mainVideo;
let url = window.location.href;
if (!url_loaded || !url.includes(url_loaded.slice(-10)))
window.location.reload(true);
let par_elem, par_sub1, par_sub2;
let par_dom = document.createElement('div');
let tweet_id = 1;
for (let par of json_content) {
par_elem = '';
if (par.kind === 'text') {
par_elem = document.createElement('p');
par_elem.innerText = par.text;
} else if (par.kind === 'subhead') {
par_elem = document.createElement('h2');
par_elem.innerText = par.text;
} else if (par.kind === 'pull-quote') {
par_elem = document.createElement('i');
par_elem.innerText = (par.attribution ? par.attribution + ': ' : '') + par.text;
} else if (par.kind === 'embed') {
if (par.reference.includes('https://omny.fm/') || par.reference.includes('https://docdro.id/')) {
par_elem = document.createElement('embed');
par_elem.src = par.reference;
par_elem.style = 'height:500px; width:100%';
par_elem.frameborder = '0';
} else {
par_elem = document.createElement('a');
par_elem.href = par.reference;
par_elem.innerText = par.reference.split('?')[0];
console.log('embed: ' + par.reference);
}
} else if (par.kind === 'unordered-list') {
if (par.items) {
par_elem = document.createElement('ul');
for (let item of par.items)
2021-07-10 10:02:36 -07:00
if (item.text) {
par_sub1 = document.createElement('li');
2021-07-10 10:02:36 -07:00
if (item.intentions[0] && item.intentions[0].href) {
par_sub2 = document.createElement('a');
par_sub2.href = item.intentions[0].href;
} else {
par_sub2 = document.createElement('span');
}
par_sub2.innerText = item.text;
par_sub1.appendChild(par_sub2);
par_elem.appendChild(par_sub1);
}
}
} else if (par.kind === 'inline') {
if (par.asset.kind === 'image') {
par_elem = document.createElement('figure');
par_sub1 = document.createElement('img');
par_sub1.src = par.asset.original.reference;
par_sub1.style = 'width:100%';
par_elem.appendChild(par_sub1);
if (par.asset.captionText) {
par_sub2 = document.createElement('figcaption');
par_sub2.innerText = par.asset.captionText + ' ' + par.asset.copyrightByline +
((par.asset.copyrightCredit && par.asset.captionText !== par.asset.copyrightByline) ? '/' + par.asset.copyrightCredit : '');
par_elem.appendChild(par_sub2);
}
}
} else {
par_elem = document.createElement('p');
par_elem.innerText = par.text;
console.log(par.kind);
}
if (par_elem)
par_dom.appendChild(par_elem);
}
let content = document.querySelector('div[class*="StyledArticleContent"]');
if (content) {
content.appendChild(par_dom);
} else {
par_dom.setAttribute('style', 'margin: 20px;');
breach_screen.parentElement.insertBefore(par_dom, breach_screen);
}
}
removeDOMElement(breach_screen);
}
2022-03-08 10:04:40 -08:00
}, 1500);
let header_advert = document.querySelector('.headerAdvertisement');
if (header_advert)
header_advert.setAttribute('style', 'display: none;');
}
2019-10-19 10:11:44 -07:00
}
}
else
2021-04-25 04:45:26 -07:00
csDone = true;
2018-12-07 04:43:16 -08:00
}
2019-05-12 22:27:15 -07:00
2022-06-05 13:18:58 -07:00
} else if (window.location.hostname.match(/\.(de|at|ch)$/) || matchDomain(['faz.net'])) {//germany/austria/switzerland - ch
if (matchDomain('allgaeuer-zeitung.de')) {
2021-12-18 03:32:56 -08:00
let url = window.location.href;
if (!url.includes('?type=amp')) {
let paywall = document.querySelector('p.nfy-text-blur');
if (paywall) {
removeDOMElement(paywall);
window.location.href = url.split('?')[0] + '?type=amp';
}
} else {
let preview = document.querySelectorAll('p.nfy-text-blur, div[subscriptions-display^="NOT data."]');
let amp_ads = document.querySelectorAll('amp-ad');
removeDOMElement(...preview, ...amp_ads);
}
}
2021-09-25 00:30:07 -07:00
else if (matchDomain('augsburger-allgemeine.de')) {
let url = window.location.href;
2021-06-27 23:51:22 -07:00
if (!url.includes('-amp.html')) {
let paywall = document.querySelector('div.aa-visible-logged-out');
if (paywall) {
removeDOMElement(paywall);
window.location.href = url.replace('.html', '-amp.html');
}
} else {
2021-11-30 08:35:45 -08:00
amp_unhide_subscr_section();
}
}
2022-06-28 08:48:04 -07:00
else if (matchDomain('automobilwoche.de')) {
let lazy_images = document.querySelectorAll('img.lazy[data-src]');
for (let lazy_image of lazy_images) {
lazy_image.src = lazy_image.getAttribute('data-src');
lazy_image.removeAttribute('class');
}
let lazy_sources = document.querySelectorAll('source[srcset^="data:image"]');
removeDOMElement(...lazy_sources);
}
else if (matchDomain('berliner-zeitung.de')) {
let url = window.location.href;
let paywall = document.querySelector('.paywall-dialog-box');
if (url.split('?')[0].includes('.amp')) {
if (paywall) {
2021-11-30 08:35:45 -08:00
removeDOMElement(paywall);
2022-04-10 07:20:13 -07:00
amp_unhide_subscr_section('amp-ad, amp-embed, amp-fx-flying-carpet, div.amp-flying-carpet-text-border');
}
} else {
if (paywall) {
removeDOMElement(paywall);
window.location.href = url.split('?')[0] + '.amp';
}
}
}
else if (matchDomain('cicero.de')) {
let url = window.location.href;
2022-04-19 12:37:13 -07:00
if (!window.location.search.match(/(\?|&)amp/)) {
let paywall = document.querySelector('.plenigo-paywall');
if (paywall) {
removeDOMElement(paywall);
2022-01-28 07:05:18 -08:00
let url_amp = url.split('?')[0] + '?amp';
replaceDomElementExt(url_amp, false, false, '.field-name-field-cc-body');
}
} else {
let teasered_content = document.querySelector('.teasered-content');
if (teasered_content)
teasered_content.classList.remove('teasered-content');
let teasered_content_fader = document.querySelector('.teasered-content-fader');
let btn_read_more = document.querySelector('.btn--read-more');
let amp_ads = document.querySelectorAll('amp-ad');
removeDOMElement(teasered_content_fader, btn_read_more, ...amp_ads);
}
let urban_ad_sign = document.querySelectorAll('.urban-ad-sign');
removeDOMElement(...urban_ad_sign);
2019-06-02 04:33:52 -07:00
}
else if (matchDomain('faz.net')) {
if (matchDomain('zeitung.faz.net')) {
let paywall_z = document.querySelector('.c-red-carpet');
if (paywall_z) {
let og_url = document.querySelector('meta[property="og:url"]');
if (og_url)
window.setTimeout(function () {
window.location.href = og_url.content;
2022-03-08 10:04:40 -08:00
}, 500);
}
let sticky_advt = document.querySelector('.sticky-advt');
removeDOMElement(sticky_advt);
} else {
let paywall = document.querySelector('#paywall-form-container-outer, .atc-ContainerPaywall');
if (paywall) {
removeDOMElement(paywall);
let url = new URL(window.location.href);
let mUrl = new URL(url.pathname, 'https://m.faz.net/');
2022-01-27 10:21:08 -08:00
try {
fetch(mUrl)
.then(response => {
if (response.ok) {
response.text().then(html => {
let parser = new DOMParser();
let doc = parser.parseFromString(html, 'text/html');
let json = doc.querySelector('script[id="schemaOrgJson"]');
if (json) {
let json_text = json.text.replace(/(\r|\n)/g, '');
let split1 = json_text.split('"ArticleBody": "');
let split2 = split1[1].split('","author":');
if (split2[0].includes('"'))
json_text = split1[0] + '"ArticleBody": "' + split2[0].replace(/"/g, '“') + '","author":' + split2[1];
try {
json_text = JSON.parse(json_text).ArticleBody;
} catch (err) {
console.log(err);
return;
}
if (!json_text)
return;
let article_text = document.querySelector('.art_txt.paywall,.atc-Text.js-atc-Text');
article_text.innerText = '';
json_text = breakText(json_text);
json_text.split("\n\n").forEach(
(p_text) => {
let elem;
if (p_text.length < 80) {
elem = document.createElement("h2");
elem.setAttribute('class', 'atc-SubHeadline');
} else {
elem = document.createElement("p");
elem.setAttribute('class', 'atc-TextParagraph');
};
elem.innerText = p_text;
article_text.appendChild(elem);
});
}
2022-01-27 10:21:08 -08:00
})
}
});
} catch (err) {
console.log(err);
}
}
let lay_paysocial = document.querySelector('div.lay-PaySocial');
removeDOMElement(lay_paysocial);
}
2019-06-20 21:54:32 -07:00
}
2019-06-20 22:28:29 -07:00
else if (matchDomain('freiepresse.de')) {
let url = window.location.href;
let article_teaser = document.querySelector('div.article-teaser');
if (article_teaser && url.match(/(\-artikel)(\d){6,}/)) {
window.setTimeout(function () {
window.location.href = url.replace('-artikel', '-amp');
2022-03-08 10:04:40 -08:00
}, 500);
} else if (url.match(/(\-amp)(\d){6,}/)) {
let amp_ads = document.querySelectorAll('amp-fx-flying-carpet, amp-ad, amp-embed');
let pw_layer = document.querySelector('.pw-layer');
removeDOMElement(...amp_ads, pw_layer);
}
}
else if (matchDomain('krautreporter.de')) {
2022-07-20 22:40:40 -07:00
let paywall = document.querySelector('.js-article-paywall');
if (paywall) {
2022-01-29 08:56:13 -08:00
removeDOMElement(paywall);
window.setTimeout(function () {
let paywall_divider = document.querySelector('.js-paywall-divider');
let steady_checkout = document.querySelector('#steady-checkout');
removeDOMElement(paywall_divider, steady_checkout);
let blurred = document.querySelectorAll('.blurred');
for (let elem of blurred)
elem.classList.remove('blurred', 'json-ld-paywall-marker', 'hidden@print');
2022-03-08 10:04:40 -08:00
}, 500);
}
2020-01-16 12:16:58 -08:00
}
2019-09-22 17:10:17 -07:00
else if (matchDomain(['ksta.de', 'rundschau-online.de'])) {
let paywall = document.querySelector('div#c1-template-platzhalter');
if (paywall) {
removeDOMElement(paywall);
let span_hidden = document.querySelector('span.hide-paid-content');
if (span_hidden)
span_hidden.removeAttribute('class');
}
}
2022-03-11 23:48:53 -08:00
else if (matchDomain(['mz.de', 'volksstimme.de'])) {
2021-11-04 11:27:43 -07:00
let url = window.location.href.split('?')[0];
let paywall = document.querySelector('.fp-paywall');
if (url.includes('/amp/')) {
2021-11-30 08:35:45 -08:00
amp_unhide_subscr_section('amp-ad, amp-embed');
2021-11-04 11:27:43 -07:00
} else {
if (paywall) {
removeDOMElement(paywall);
window.location.href = window.location.href.replace('.de/', '.de/amp/');
}
}
}
2022-04-08 07:38:28 -07:00
else if (matchDomain('nn.de')) {
let ad_billboard = document.querySelector('div#ad-Billboard');
if (ad_billboard && ad_billboard.parentNode)
removeDOMElement(ad_billboard.parentNode);
let ads = document.querySelectorAll('div[id^="clsdiv_"]');
removeDOMElement(...ads);
}
else if (matchDomain(['noz.de', 'nwzonline.de', 'shz.de', 'svz.de'])) {
2022-02-15 09:44:20 -08:00
if (window.location.pathname.match(/(-amp\.html|\/amp)$/)) {
2022-04-19 12:37:13 -07:00
amp_unhide_access_hide('="NOT data.reduced"', '="data.reduced"', 'amp-ad, amp-embed, .ads-wrapper, #flying-carpet-wrapper');
} else {
2021-09-04 02:23:41 -07:00
let paywall = document.querySelector('.paywall, .story--premium__container');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
}
}
2022-08-17 10:05:15 -07:00
else if (matchDomain('nw.de')) {
if (!window.location.pathname.endsWith('.amp.html')) {
let paywall = document.querySelector('div[data-tracking-visible^="paywall-"]');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
} else {
amp_unhide_access_hide('="loggedIn AND hasAbo"', '', 'amp-ad, amp-embed, .banner');
}
}
else if (matchDomain('rheinpfalz.de')) {
let url = window.location.href;
if (url.includes('reduced=true')) {
2020-09-24 11:49:59 -07:00
window.setTimeout(function () {
window.location.href = url.split('?')[0];
2022-03-08 10:04:40 -08:00
}, 500);
}
}
2022-06-30 10:51:40 -07:00
else if (matchDomain('spiegel.de')) {
let url = window.location.href;
let paywall = document.querySelector('div[data-area="paywall"]');
if (paywall) {
removeDOMElement(paywall);
let article = document.querySelector('div[data-area="body"]');
if (article)
article.insertBefore(archiveLink(url), article.firstChild);
2022-08-05 23:22:07 -07:00
}
}
2022-08-03 10:01:21 -07:00
else if (matchDomain(de_westfalen_medien_domains)) {
2021-10-01 06:27:52 -07:00
let url = window.location.href;
if (url.includes('/amp/')) {
2021-11-30 08:35:45 -08:00
amp_unhide_subscr_section('amp-ad, amp-embed, section[class^="fp-ad"]');
} else {
2022-08-03 10:01:21 -07:00
let paywall = document.querySelector('.fp-article-paywall');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall) {
removeDOMElement(paywall);
2022-08-03 10:01:21 -07:00
if (amphtml)
window.location.href = amphtml.href;
}
2021-10-01 06:27:52 -07:00
}
}
2022-08-03 10:01:21 -07:00
else if (matchDomain(de_funke_medien_domains) || document.querySelector('a[href="https://www.funkemedien.de/"]')) {
if (window.location.search.startsWith('?service=amp'))
amp_unhide_access_hide('="NOT p.showRegWall AND NOT p.showPayWall"', '', 'amp-ad, amp-embed, amp-fx-flying-carpet');
else
sessionStorage.setItem('deobfuscate', 'true');
}
else if (matchDomain(de_madsack_domains) || matchDomain(de_madsack_custom_domains)) {
2022-03-30 09:22:20 -07:00
if (!(window.location.pathname.startsWith('/amp/') || window.location.search.startsWith('?outputType=valid_amp'))) {
let paidcontent_intro = document.querySelector('div.pdb-article-body-paidcontentintro');
if (paidcontent_intro) {
paidcontent_intro.classList.remove('pdb-article-body-paidcontentintro');
2022-03-30 09:22:20 -07:00
let json_script = getArticleJsonScript();
if (json_script) {
let json_text = JSON.parse(json_script.text).articleBody;
if (json_text) {
let pdb_richtext_field = document.querySelectorAll('div.pdb-richtext-field');
if (pdb_richtext_field[1])
pdb_richtext_field[1].innerText = json_text;
}
}
let paidcontent_reg = document.querySelector('div.pdb-article-paidcontent-registration');
removeDOMElement(paidcontent_reg);
2022-03-30 09:22:20 -07:00
} else {
let paywall = document.querySelector('div.paywall');
if (paywall) {
let gradient = document.querySelector('div[class^="ArticleContentLoaderstyled__Gradient"]');
let loading = document.querySelector('#article > svg');
removeDOMElement(paywall, gradient, loading);
let article = document.querySelector('div[class*="ArticleTeaserContainer"] > div:not([class])');
let json_script = getArticleJsonScript();
if (json_script) {
let json = JSON.parse(json_script.text);
if (article && json) {
2022-08-25 13:12:03 -07:00
article.parentNode.removeAttribute('class');
2022-03-30 09:22:20 -07:00
let json_text = json.articleBody;
let article_new = document.createElement('span');
let par = article.querySelector('p');
let par_class = par ? par.getAttribute('class') : '';
article_new.setAttribute('class', par_class);
article_new.innerText = json_text;
article.innerText = '';
if (json.articleSection) {
let json_section = json.articleSection;
let article_section = document.querySelector('span');
article_section.setAttribute('class', par_class);
article_section.setAttribute('style', 'font-weight: bold;');
article_section.innerText = json_section + '. ';
article.appendChild(article_section);
}
article.appendChild(article_new);
}
}
}
}
} else if (window.location.pathname.startsWith('/amp/')) {
2022-03-30 09:22:20 -07:00
amp_unhide_subscr_section('.pdb-ad-container, amp-embed');
2022-08-25 13:12:03 -07:00
} else {
ampToHtml();
}
}
2021-12-22 10:03:42 -08:00
else
csDone = true;
} else if (window.location.hostname.match(/\.(dk|fi|no|se)$/)) {//denmark/finland/norway/sweden
if (matchDomain(fi_alma_talent_domains)) {
2022-04-15 06:11:03 -07:00
let ads = document.querySelectorAll('div[class^="p2m385-"], div#anop-container, .ad, div.iZivCJ');
2022-03-30 13:09:17 -07:00
for (let ad of ads)
ad.setAttribute('style', 'display:none;');
2022-02-26 23:04:24 -08:00
if (matchDomain('iltalehti.fi')) {
let paywall = document.querySelector('div.faded-text');
if (paywall && dompurify_loaded) {
2022-02-26 23:04:24 -08:00
let scripts = document.querySelectorAll('script');
let json_script;
for (let script of scripts) {
if (script.innerText.includes('window.App=')) {
json_script = script;
break;
}
}
if (json_script) {
let json = json_script.innerHTML.split('window.App=')[1].split('</script')[0];
json = json.replace(/undefined/g, '"undefined"');
let json_article = JSON.parse(json).state.articles;
if (!Object.keys(json_article).length)
ext_api.runtime.sendMessage({request: 'refreshCurrentTab'});
if (Object.keys(json_article).length) {
paywall.remove();
let url_loaded = Object.keys(json_article)[0];
if (url_loaded && !window.location.pathname.includes(url_loaded))
ext_api.runtime.sendMessage({request: 'refreshCurrentTab'});
let pars = Object.values(json_article)[0].items.body;
let content = document.querySelector('div.article-body');
if (content && pars) {
function ilta_par_text(items) {
let par_text = '';
for (let item of items) {
if (item.text)
par_text += item.text;
else if (item.name)
par_text += '<a href="/henkilot/' + item.name + '">' + item.name + '</a>';
else if (item.type === 'link')
par_text += '<a href="' + item.url + '" target="_blank">' + item.items[0].text + '</a>';
else if (item.type) {
let item_type = '<' + item.type[0] + '>';
par_text += item.items.map(i => item_type + i.text + item_type.replace('<', '</')).join('');
} else if (item[0]) { //aside-list
par_text += item[0].text;
}
}
return par_text;
}
function ilta_wrap_list(elem, par_text) {
if (par_text) {
elem += '<div class="article-bullets"><ul>';
elem += par_text;
elem += '</ul></div>';
}
return elem;
}
content.innerHTML = '';
let article_new = '';
for (let par of pars) {
let elem = '';
let par_text = '';
let par_ignore = false;
if (par.type === 'paragraph') {
par_text = ilta_par_text(par.items);
if (par_text)
elem = '<p class="paragraph">' + par_text + '</p>';
} else if (par.type === 'subheadline') {
if (par.text)
elem = '<h3 class="subheadline" style="margin:20px;">' + par.text + '</h3>';
} else if (par.type === 'aside') {
elem = '<div class="aside-container"><div class="aside">';
for (let item of par.items) {
if (item.text || (item.type === 'paragraph' && item.items)) {
if (par_text) {
elem = ilta_wrap_list(elem, par_text);
par_text = '';
}
if (item.text)
elem += '<h3 class="subheadline" style="margin:20px;">' + item.text + '</h3>';
else {
let par_text_sub = ilta_par_text(item.items);
if (par_text_sub)
elem += '<p class="paragraph">' + par_text_sub + '</p>';
}
} else if (item.type === 'list') {
let par_text_sub = ilta_par_text(item.items);
if (par_text_sub) {
par_text += '<li>';
par_text += par_text_sub;
par_text += '</li>';
}
}
}
if (par_text)
elem = ilta_wrap_list(elem, par_text);
elem += '</div></div>';
} else if (par.type === 'blockquote') {
elem = '<p style="font-size: 1.2em; margin:20px;"><i>&quot;' + par.items.map(i => i.text).join('') + '&quot;</i></p>';
} else if (par.type === 'divider') {
elem = '<div class="article-divider"><div class="article-divider-content"></div></div>';
} else if (par.type.toLowerCase() === 'list') {
elem = '<div class="article-bullets"><ul>';
for (let item of par.items)
elem += '<li>' + item.map(i => i.text).join('') + '</li>';
elem += '</ul></div>';
} else if (par.type === 'related-article') {
elem = '<div class="related-articles related-articles-within-text"><h3>Lue myös</h3><a href="/' + par.article.category.category_name + '/a/' + par.article.article_id + '">' + par.article.title + '</a></div>';
} else if (par.type === 'image') {
if (par.urls.default) {
2022-02-26 23:04:24 -08:00
let caption = par.properties.caption ? par.properties.caption : '';
let source = par.properties.source ? par.properties.source : '';
elem = '<p><div><div style="text-align: center;"><img src="' + par.urls.default + '" alt="' + caption + '"></div><div class="media-caption"><span class="caption-text">' + caption + '</span><span class="media-source">' + source + '</span></div></div></p>';
2022-02-26 23:04:24 -08:00
}
} else if (par.type === 'embed') {
elem = par.embed_html;
2022-02-26 23:04:24 -08:00
} else if (par.type === 'advertisement') {
par_ignore = true;
}
if (elem)
article_new += elem;
else if (!par_ignore)
console.log(par);
}
let parser = new DOMParser();
let par_html = parser.parseFromString('<div>' + DOMPurify.sanitize(article_new, {ADD_TAGS: ['iframe']}) + '</div>', 'text/html');
2022-02-26 23:04:24 -08:00
content.appendChild(par_html.querySelector('div'));
}
}
}
}
}
2021-12-22 10:03:42 -08:00
}
else if (matchDomain('nyteknik.se')) {
// plus code in contentScript_once.js
let locked_article = document.querySelector('div.locked-article');
if (locked_article)
locked_article.classList.remove('locked-article');
}
2022-08-01 12:25:33 -07:00
else if (matchDomain('suomensotilas.fi')) {
let obscured = document.querySelector('div.epfl-pw-obscured');
if (obscured)
obscured.classList.remove('epfl-pw-obscured');
}
else
2021-04-25 04:45:26 -07:00
csDone = true;
2022-04-25 23:14:59 -07:00
} else if (window.location.hostname.match(/\.(es|pt|cat)$/) || matchDomain(['diariocordoba.com', 'diariovasco.com', 'elconfidencial.com', 'elcorreo.com', 'elespanol.com', 'elpais.com', 'elperiodico.com', 'elperiodicodearagon.com', 'elperiodicoextremadura.com', 'elperiodicomediterraneo.com', 'emporda.info', 'expansion.com', 'larioja.com', 'levante-emv.com', 'marca.com', 'politicaexterior.com'])) {//spain/portugal
2022-08-15 09:05:31 -07:00
if (matchDomain(['ara.cat', 'arabalears.cat'])) {
2022-05-22 10:59:42 -07:00
let url = window.location.href;
if (!window.location.pathname.endsWith('.amp.html')) {
let paywall = document.querySelector('div.paywall');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
}
}
2021-12-09 12:31:58 -08:00
else if (matchDomain('cmjornal.pt')) {
let paywall = document.querySelector('.bloqueio_exclusivos');
let amphtml = document.querySelector('link[rel="amphtml"]');
let url = window.location.href;
if (!url.includes('/amp/')) {
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
} else {
2021-11-30 08:35:45 -08:00
amp_unhide_access_hide('="subscriber"', '="NOT subscriber"', 'amp-ad, amp-embed, #flying-carpet-wrapper');
let amp_links = document.querySelectorAll('a[href^="https://www-cmjornal-pt.cdn.ampproject.org/c/s/"]');
for (let amp_link of amp_links)
amp_link.href = amp_link.href.replace('www-cmjornal-pt.cdn.ampproject.org/c/s/', '');
}
2019-10-29 03:30:06 -07:00
}
else if (matchDomain('elconfidencial.com')) {
let premium = document.querySelector('div.newsType__content--closed');
if (premium)
premium.classList.remove('newsType__content--closed');
2020-07-09 10:52:19 -07:00
}
else if (matchDomain('eldiario.es')) {
if (window.location.pathname.endsWith('.amp.html')) {
amp_unhide_access_hide('^="access"');
} else {
let ads = document.querySelectorAll('.edi-advertising, .header-ad');
removeDOMElement(...ads);
}
}
else if (matchDomain('elespanol.com')) {
if (window.location.pathname.endsWith('.amp.html')) {
amp_unhide_subscr_section('amp-ad, amp-embed');
} else {
2022-08-12 22:51:11 -07:00
let paywall = document.querySelector('div.full-suscriptor-container');
let adverts = document.querySelectorAll('[id*="superior"], [class*="adv"]');
2022-08-12 22:51:11 -07:00
removeDOMElement(paywall, ...adverts);
}
2019-11-12 02:36:29 -08:00
}
else if (matchDomain(es_unidad_domains)) {
let premium = document.querySelector('.ue-c-article__premium');
let url = window.location.href;
2022-08-03 22:57:17 -07:00
if (!window.location.hostname.match(/^amp(-[a-z]{2})?\./)) {
if (premium) {
removeDOMElement(premium);
window.location.href = url.replace('/www.', '/amp.');
}
} else {
2021-11-30 08:35:45 -08:00
amp_unhide_access_hide('="authorized=true"', '="authorized!=true"');
amp_unhide_subscr_section('.advertising, amp-embed, amp-ad');
}
}
else if (matchDomain('elpais.com')) {
2021-10-07 23:11:42 -07:00
let login_register = document.querySelector('.login_register');
2022-04-21 10:52:29 -07:00
if (window.location.pathname.endsWith('.amp.html') || window.location.search.match(/(\?|&)outputType=amp/)) {
amp_unhide_access_hide('="vip"], [amp-access="success"', '="NOT vip"], [amp-access="NOT success"');
2021-11-30 08:35:45 -08:00
removeDOMElement(login_register);
} else {
2021-10-07 10:37:21 -07:00
let counter = document.querySelector('#counterLayerDiv');
removeDOMElement(counter);
let amphtml = document.querySelector('link[rel="amphtml"]');
2022-04-21 10:52:29 -07:00
if (login_register && amphtml) {
2021-10-07 23:11:42 -07:00
removeDOMElement(login_register, video);
window.location.href = amphtml.href;
}
}
let paywall_offer = document.querySelector('.paywallOffer');
2022-04-21 10:52:29 -07:00
let ctn_closed_article = document.querySelector('#ctn_closed_article, #ctn_freemium_article, #ctn_premium_article');
2021-10-07 23:11:42 -07:00
removeDOMElement(paywall_offer, ctn_closed_article);
2019-12-05 12:15:21 -08:00
}
else if (matchDomain('elperiodico.com')) {
let url = window.location.href;
if (!url.includes('amp.elperiodico.com')) {
let div_hidden = document.querySelector('div.closed');
if (div_hidden)
div_hidden.classList.remove('closed');
else {
let paywall = document.querySelector('.ep-masPeriodico-info-login');
removeDOMElement(paywall);
if (paywall)
window.location.href = url.replace('www.', 'amp.');
}
} else {
let not_logged = document.querySelector('.ep-masPeriodico-info-login');
if (not_logged) {
2021-11-30 08:35:45 -08:00
removeDOMElement(not_logged);
amp_unhide_access_hide('^="logged"', '^="NOT logged"');
}
window.setTimeout(function () {
let amp_img = document.querySelectorAll('amp-img > img');
for (let elem of amp_img) {
if (elem.src)
elem.src = elem.src.replace('amp.elperiodico.com/clip/', 'estaticos-cdn.elperiodico.com/clip/');
}
2022-03-08 10:04:40 -08:00
}, 3000);
}
}
else if (matchDomain(es_grupo_vocento_domains)) {
2022-08-15 09:05:31 -07:00
let paywall = document.querySelector('.voc-paywall, .container-wall-exclusive');
if (!window.location.pathname.endsWith('_amp.html')) {
let amphtml = document.querySelector('link[rel="amphtml"]');
2022-08-15 09:05:31 -07:00
if (!amphtml)
amphtml = {href: window.location.pathname.replace('.html', '_amp.html')};
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
2022-08-15 09:05:31 -07:00
} else {
let banners = document.querySelectorAll('.voc-advertising, div.ev-em-modal, span.mega-superior');
removeDOMElement(...banners);
}
} else {
2022-08-15 09:05:31 -07:00
amp_unhide_access_hide('="result=\'ALLOW_ACCESS\'"', '="result!=\'ALLOW_ACCESS\'"', 'amp-ad, amp-embed');
removeDOMElement(paywall);
let body_top = document.querySelector('body#top');
if (body_top)
body_top.removeAttribute('id');
}
}
else if (matchDomain(es_epiberica_domains) || matchDomain(es_epiberica_custom_domains)) {
2021-04-28 12:45:45 -07:00
if (window.location.href.includes('.amp.html')) {
let truncated = document.querySelector('div.article-body--truncated');
if (truncated)
truncated.classList.remove('article-body--truncated');
2022-04-21 10:52:29 -07:00
amp_unhide_access_hide('="NOT access"], [amp-access="FALSE"', '="access"');
2022-04-01 07:03:49 -07:00
} else if (window.location.hostname === 'amp.epe.es') {
amp_unhide_access_hide('="loggedIn"', '="NOT loggedIn"', 'amp-ad, amp-embed, amp-next-page');
2022-03-01 09:50:06 -08:00
} else {
2022-04-01 07:03:49 -07:00
let ads = document.querySelectorAll('div.commercial-up-full__wrapper, div.sidebar--sticky__space, div[data-bbnx-id*="cxense"]');
2022-03-06 11:08:43 -08:00
removeDOMElement(...ads);
2021-04-28 12:45:45 -07:00
}
}
else if (matchDomain('observador.pt')) {
2022-07-01 06:47:32 -07:00
if (!window.location.pathname.endsWith('/amp/')) {
let paywall = document.querySelector('.premium-article');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
paywall.classList.remove('premium-article');
window.location.href = amphtml.href;
}
} else {
amp_unhide_subscr_section('amp-ad, amp-consent, section > .modal');
}
2019-12-31 07:27:30 -08:00
}
else if (matchDomain('politicaexterior.com')) {
let paywall = document.querySelector('div[class^="paywall-"]');
if (paywall) {
let article = document.querySelector('div.entry-content-text');
let json = document.querySelector('script[type="application/ld+json"]:not([class]');
if (json) {
2021-08-17 09:36:07 -07:00
let json_text = JSON.parse(json.text).description.replace(/&amp;nbsp;/g, '');
let article_new = document.createElement('div');
article_new.setAttribute('class', 'entry-content-text');
article_new.innerText = '\r\n' + json_text;
article.parentNode.replaceChild(article_new, article);
}
removeDOMElement(paywall);
}
2020-01-01 10:24:29 -08:00
}
else
2021-04-25 04:45:26 -07:00
csDone = true;
2020-01-02 03:01:30 -08:00
2022-07-22 09:39:51 -07:00
} else if (window.location.hostname.endsWith('.fr') || matchDomain(['bienpublic.com', 'connaissancedesarts.com', 'journaldunet.com', 'la-croix.com', 'lavenir.net', 'ledauphine.com', 'lesinrocks.com', 'lejsl.com', 'loeildelaphotographie.com', 'marianne.net', 'nouvelobs.com', 'parismatch.com', 'science-et-vie.com'].concat(fr_groupe_nice_matin_domains))) {//france
if (matchDomain('alternatives-economiques.fr')) {
window.setTimeout(function () {
let paywall = document.querySelector('#temp-paywall');
removeDOMElement(paywall);
let data_ae_poool = document.querySelector('div[data-ae-poool]');
if (data_ae_poool)
data_ae_poool.removeAttribute('style');
2022-03-08 10:04:40 -08:00
}, 500);
}
else if (matchDomain('atlantico.fr')) {
2021-06-16 12:38:56 -07:00
let paywall = document.querySelector('div.markup[class*="Paywall"]');
if (paywall)
2021-06-09 11:29:47 -07:00
paywall.setAttribute('class', 'markup');
}
2022-09-01 23:26:26 -07:00
else if (matchDomain('autoplus.fr')) {
let ads = document.querySelectorAll('div.placeholder-pub_dfp');
removeDOMElement(...ads);
}
2021-04-30 08:24:53 -07:00
else if (matchDomain('challenges.fr')) {
if (window.location.pathname.endsWith('.amp')) {
amp_unhide_access_hide('="paywall.access OR cha.access"', '="NOT (paywall.access OR cha.access)"');
} else {
let amorce = document.querySelector('.user-paying-amorce');
if (amorce)
amorce.setAttribute('style', 'display:none !important');
let content = document.querySelectorAll('.user-paying-content');
for (let elem of content) {
elem.classList.remove('user-paying-content');
elem.removeAttribute('hidden');
}
let paywall = document.querySelector('.temp-paywall');
removeDOMElement(paywall);
}
2021-04-30 08:24:53 -07:00
}
else if (matchDomain('charliehebdo.fr')) {
window.setTimeout(function () {
let paywalled_content = document.querySelector('div.ch-paywalled-content');
if (paywalled_content)
paywalled_content.removeAttribute('style');
let poool_widget = document.querySelector('div#poool-widget');
removeDOMElement(poool_widget);
2022-03-08 10:04:40 -08:00
}, 500);
}
2022-03-10 11:02:09 -08:00
else if (matchDomain('connaissancedesarts.com')) {
let ads = document.querySelectorAll('div.ad-container');
removeDOMElement(...ads);
}
2021-10-24 10:01:36 -07:00
else if (matchDomain('elle.fr')) {
if (window.location.hostname.startsWith('amp.')) {
amp_unhide_access_hide('="poool.access OR cmi_premium.access"');
} else {
let hidden_images = document.querySelectorAll('img[src^="data:image/"][data-src]');
for (let hidden_image of hidden_images)
hidden_image.setAttribute('src', hidden_image.getAttribute('data-src'));
let subscription_bar = document.querySelector('.tc-subscription-bar');
removeDOMElement(subscription_bar);
}
2021-10-24 10:01:36 -07:00
}
else if (matchDomain('esprit.presse.fr')) {
let paywall = document.querySelector('.panel-popup-paywall');
removeDOMElement(paywall);
}
2022-05-27 06:11:26 -07:00
else if (matchDomain(fr_groupe_ebra_domains)) {
if (!window.location.pathname.startsWith('/amp/')) {
let paywall = document.querySelector('div.preview');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
} else {
amp_unhide_access_hide('="access"', '="NOT access"', 'amp-ad, amp-embed');
}
}
2022-05-27 06:11:26 -07:00
else if (matchDomain(fr_groupe_la_depeche_domains)) {
if (window.location.pathname.startsWith('/amp/')) {
2021-11-30 08:35:45 -08:00
amp_unhide_subscr_section('amp-ad, amp-embed');
2021-04-30 08:24:53 -07:00
} else {
let paywall = document.querySelector('div.paywall');
2022-05-27 06:11:26 -07:00
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
2021-04-30 08:24:53 -07:00
removeDOMElement(paywall);
2022-05-27 06:11:26 -07:00
window.location.href = amphtml.href;
2021-04-30 08:24:53 -07:00
}
}
}
2022-05-27 06:11:26 -07:00
else if (matchDomain(fr_groupe_nice_matin_domains)) {
if (window.location.pathname.startsWith('/amp/')) {
2021-12-31 02:50:03 -08:00
amp_unhide_access_hide('="access"', '="NOT access"', 'amp-ad, amp-embed');
} else {
let paywall = document.querySelector('div#article-teaser');
if (paywall)
paywall.removeAttribute('id');
}
let ads = document.querySelectorAll('div[class^="ad-slot-"]');
removeDOMElement(...ads);
}
2022-03-19 09:38:39 -07:00
else if (matchDomain('franc-tireur.fr')) {
let paywall = document.querySelector('.paywall');
removeDOMElement(paywall);
}
else if (matchDomain('journaldunet.com')) {
let reg_wall = document.querySelector('.reg_wall');
removeDOMElement(reg_wall);
let entry_reg_wall = document.querySelector('.entry_reg_wall');
if (entry_reg_wall) {
entry_reg_wall.removeAttribute('style');
}
2020-01-16 12:16:58 -08:00
}
else if (matchDomain('la-croix.com')) {
let url = window.location.href;
if (!url.includes('la-croix.com/amp/')) {
2021-10-20 08:52:45 -07:00
let hidden_images = document.querySelectorAll('source[srcset]');
2022-03-08 10:04:40 -08:00
for (let elem of hidden_images)
2021-10-20 08:52:45 -07:00
elem.removeAttribute('srcset');
} else {
let paywall_block = document.querySelector('#paywall_block');
let amp_ads = document.querySelectorAll('amp-ad, amp-embed');
removeDOMElement(paywall_block, ...amp_ads);
}
}
2021-04-30 08:24:53 -07:00
else if (matchDomain('lanouvellerepublique.fr')) {
let alert_didacticiel = document.querySelector('div.alert-didacticiel');
let loading = document.querySelectorAll('span.loading');
removeDOMElement(alert_didacticiel, ...loading);
}
2022-06-24 09:57:20 -07:00
else if (matchDomain('lavenir.net')) {
let paywall = document.querySelector('div.is-preview');
if (paywall) {
removeDOMElement(paywall);
let div_hidden = document.querySelector('div.is-hidden');
if (div_hidden)
div_hidden.classList.remove('is-hidden');
}
let ads = document.querySelectorAll('div.ap-AdContainer');
removeDOMElement(...ads);
}
2022-08-17 23:50:23 -07:00
else if (matchDomain('lavie.fr')) {
let paywall = document.querySelector('div.bloc-payant');
removeDOMElement(paywall);
let overlay = document.querySelector('div.content-art[style]');
if (overlay)
overlay.removeAttribute('style');
}
2021-04-30 08:24:53 -07:00
else if (matchDomain(['lejdd.fr', 'parismatch.com'])) {
let poool_banner = document.querySelector('#poool-container');
let forbidden = document.querySelector('.forbidden');
2022-06-30 10:25:22 -07:00
let ads = document.querySelectorAll('div[class^="lmn-"]');
removeDOMElement(poool_banner, forbidden, ...ads);
2021-04-30 08:24:53 -07:00
let bottom_hide = document.querySelector('.cnt[data-poool-mode="hide"]');
if (bottom_hide) {
bottom_hide.removeAttribute('data-poool-mode');
bottom_hide.removeAttribute('style');
}
2020-01-25 09:19:36 -08:00
}
else if (matchDomain('leparisien.fr')) {
2022-08-28 11:41:51 -07:00
let paywall = document.querySelector('div.paywall');
if (window.location.pathname.startsWith('/amp/')) {
if (paywall) {
let paywall_sticky = document.querySelector('div.paywall-sticky');
removeDOMElement(paywall, paywall_sticky);
let section_hidden = document.querySelectorAll('section[hidden]');
for (let elem of section_hidden)
elem.removeAttribute('hidden');
let mask = document.querySelector('.amp-premium-first-content');
if (mask)
mask.classList.remove('amp-premium-first-content');
}
} else {
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
}
}
2021-12-17 12:22:00 -08:00
else if (matchDomain('lequipe.fr')) {
let paywall = document.querySelectorAll('.Paywall, .Article__paywall');
2021-12-22 23:43:03 -08:00
if (paywall.length) {
2021-12-17 12:22:00 -08:00
let scripts = document.querySelectorAll('script:not([src], [type])');
let json_script;
for (let script of scripts) {
if (script.innerText.includes('window.__NUXT__=')) {
json_script = script;
break;
}
}
let article = document.querySelector('div.article__body');
if (article && json_script && dompurify_loaded) {
if (json_script.innerText.includes('articleObject:')) {
2022-03-17 11:37:43 -07:00
removeDOMElement(...paywall);
2021-12-17 12:22:00 -08:00
let json = json_script.textContent.split('articleObject:')[1].split(',articleType')[0];
2021-12-22 23:43:03 -08:00
let url_nuxt = json_script.textContent.split('comment_count_url:"')[1].split('",')[0].replace(/\\u002F/g, '/');
if (url_nuxt && !url_nuxt.includes(window.location.pathname))
2022-04-25 09:09:19 -07:00
window.setTimeout(function () {
ext_api.runtime.sendMessage({request: 'refreshCurrentTab'});
}, 500);
2022-05-10 12:22:20 -07:00
json = json.replace(/keywords:\[([\w\,\$]+)\]/g, "keywords:\"\"").replace(/([{,])([a-zA-Z_]+\d?):/g, "$1\"$2\":").replace(/\":(\[)?([\w\$\.]+)([\]},])/g, "\":$1\"$2\"$3").replace(/},([\w]+),{/g, "},\"$1\",{").replace(/}(,\w{2})+(\]}|,{)/g, "}$2");
2022-04-25 09:09:19 -07:00
json = JSON.parse(json);
if (json.items) {
let pars = json.items.filter(x => x.objet && x.objet.paragraphs)[0].objet.paragraphs;
2021-12-17 12:22:00 -08:00
article.innerHTML = '';
let article_dom;
let article_text = '';
let parser = new DOMParser();
2022-04-25 09:09:19 -07:00
for (let par of pars) {
if (par.title || par.content) {
if (par.title && par.title.length > 2)
article_text += '<p><strong>' + par.title + '</strong></p>';
2022-04-27 11:40:37 -07:00
if (par.content && par.content.length > 2) {
2022-04-25 09:09:19 -07:00
let par_content = par.content.replace('class=', '').replace(/\\u003C/g, '<').replace(/\\u003E/g, '>').replace(/\\u002F/g, '/').replace(/\\"/g, '"').replace(/(^\"|\"$)/g, '').replace(/\\t/g, '');
article_text += '<p>' + par_content + '</p>';
2021-12-17 12:22:00 -08:00
}
2022-04-25 09:09:19 -07:00
} else if (par.media && par.media.url && par.media.ratio) {
let ratio = par.media.ratio;
if (!parseInt(ratio))
ratio = 1.5;
let url = par.media.url.replace(/\\u002F/g, '/').replace('{width}', '400').replace('{height}', parseInt(400 / ratio)).replace('{quality}', '75');
article_text += '<p><img src="' + url + '" style="width:95%;"</img></p>';
if (par.media.legende && par.media.legende.length > 2)
article_text += '<p><strong>' + par.media.legende + '</strong></p>';
} else if (par.__type && !par.layout)
console.log(par);
2021-12-17 12:22:00 -08:00
}
2022-03-26 01:11:39 -07:00
article_dom = parser.parseFromString('<div style="margin:20px; font-family:DINNextLTPro-Regular,sans-serif; font-size:18px;">' + DOMPurify.sanitize(article_text) + '</div>', 'text/html');
2021-12-17 12:22:00 -08:00
article.appendChild(article_dom.querySelector('div'));
}
2022-03-17 11:37:43 -07:00
} else
2022-04-25 09:09:19 -07:00
window.setTimeout(function () {
ext_api.runtime.sendMessage({request: 'refreshCurrentTab'});
}, 500);
}
2021-12-17 12:22:00 -08:00
}
}
2022-05-30 08:18:09 -07:00
else if (matchDomain('lesechos.fr')) {
2022-03-07 13:55:56 -08:00
if (matchDomain('investir.lesechos.fr')) {
if (!window.location.href.includes('/amp/')) {
let paywall = document.querySelector('div.bloc-paywall');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
} else {
let amp_ads = document.querySelectorAll('amp-ad');
removeDOMElement(...amp_ads);
}
} else if (window.location.pathname.startsWith('/amp/')) {
ampToHtml();
2022-03-07 13:55:56 -08:00
} else {
window.setTimeout(function () {
2022-06-06 22:55:59 -07:00
let abo_banner = document.querySelector('div[class*="pgxf3b-2"]');
2022-03-07 13:55:56 -08:00
let ad_blocks = document.querySelectorAll('[class*="jzxvkd"');
for (let ad_block of ad_blocks)
ad_block.setAttribute('style', 'display:none');
if (abo_banner && dompurify_loaded) {
removeDOMElement(abo_banner);
let url = window.location.href;
let html = document.documentElement.outerHTML;
let state;
let split1 = html.split('window.__CONFIG__=')[1];
let split2 = split1.split('</script>')[0].trim();
if (split2.includes('; window.__DATA__=')) {
state = split2.split('; window.__DATA__=')[1].split('; window.__')[0].trim();
} else
state = split2.substr(0, split2.length - 1);
try {
let data = JSON.parse(state);
let data_article = data.article ? data.article : data.pageProps;
let article = data_article.data.stripes[0].mainContent[0].data.description;
let url_loaded = data_article.data.path;
if (url_loaded && !url.replace(/%20/g, '').includes(url_loaded))
ext_api.runtime.sendMessage({request: 'refreshCurrentTab'});
let paywallNode = document.querySelector('.post-paywall');
if (paywallNode) {
let contentNode = document.createElement('div');
let parser = new DOMParser();
let article_html = parser.parseFromString('<div>' + DOMPurify.sanitize(article) + '</div>', 'text/html');
let article_par = article_html.querySelector('div');
if (article_par) {
contentNode.appendChild(article_par);
contentNode.className = paywallNode.className;
paywallNode.parentNode.insertBefore(contentNode, paywallNode);
removeDOMElement(paywallNode);
let paywallLastChildNode = document.querySelector('.post-paywall > :last-child');
if (paywallLastChildNode) {
paywallLastChildNode.setAttribute('style', 'height: auto !important; overflow: hidden !important; max-height: none !important;');
}
}
}
2022-03-07 13:55:56 -08:00
let styleElem = document.head.appendChild(document.createElement('style'));
styleElem.innerHTML = ".post-paywall::after {height: auto !important;}";
} catch (err) {
ext_api.runtime.sendMessage({request: 'refreshCurrentTab'});
2020-05-02 06:47:11 -07:00
}
}
2022-03-08 10:04:40 -08:00
}, 500);
2022-03-07 13:55:56 -08:00
}
}
2021-12-22 10:03:42 -08:00
else if (matchDomain('lesinrocks.com')) {
2022-04-19 12:37:13 -07:00
if (window.location.search.match(/(\?|&)amp/)) {
2021-12-22 10:03:42 -08:00
let size_defined = document.querySelector('amp-script.i-amphtml-layout-size-defined');
if (size_defined)
size_defined.style = 'overflow:visible !important;';
let overlays = document.querySelectorAll('section.learn_more, div.sidebar, div.menu-footer, div.tooltip_bib, footer.content-info');
removeDOMElement(...overlays);
}
}
2022-01-09 08:27:53 -08:00
else if (matchDomain('lexpress.fr')) {
let ads = document.querySelectorAll('div.block_pub, div.bottom-bar-full');
removeDOMElement(...ads);
}
2021-04-30 08:24:53 -07:00
else if (matchDomain('loeildelaphotographie.com')) {
let paywall = document.querySelector('.paywall');
if (paywall) {
paywall.removeAttribute('class');
}
let premium_pic_boxes = document.querySelectorAll('.premium-pic-box');
let banners = document.querySelectorAll('.membership-promo-container, .login_form_litle');
removeDOMElement(...premium_pic_boxes, ...banners);
let blurred_images = document.querySelectorAll('img[style*="blur"]');
for (let blurred_image of blurred_images)
blurred_image.removeAttribute('style');
}
else if (matchDomain('lopinion.fr')) {
if (window.location.search.startsWith('?_amp=true'))
amp_unhide_access_hide('="access"', '="NOT access"');
2022-08-30 10:15:08 -07:00
else {
let paywall = document.querySelector('div#poool-widget');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
}
}
2021-10-20 12:46:32 -07:00
else if (matchDomain('marianne.net')) {
let paywall = document.querySelector('div.paywall');
2021-10-22 03:36:25 -07:00
if (paywall && dompurify_loaded) {
2021-10-20 12:46:32 -07:00
let article_source = document.querySelector('div.article-body[data-content-src]');
if (article_source) {
let article_text = decode_utf8(atob(article_source.getAttribute('data-content-src')));
let parser = new DOMParser();
let html = parser.parseFromString('<div>' + DOMPurify.sanitize(article_text) + '</div>', 'text/html');
let article = html.querySelector('div');
article_source.innerHTML = '';
article_source.appendChild(article);
article_source.removeAttribute('data-content-src');
}
removeDOMElement(paywall);
}
}
else if (matchDomain('nouvelobs.com')) {
let paywall = document.querySelector('.paywall');
removeDOMElement(paywall);
}
else if (matchDomain('science-et-vie.com')) {
if (window.location.hostname.startsWith('amp.')) {
let pars = document.querySelectorAll('.qiota_reserve > p, .qiota_reserve > h2');
let pars_text = [];
for (let par of pars) {
if (pars_text.includes(par.innerText))
removeDOMElement(par);
else
pars_text.push(par.innerText);
}
let sizer = document.querySelector('div.article-content > amp-script > i-amphtml-sizer');
removeDOMElement(sizer);
let replaced_content = document.querySelector('div.i-amphtml-replaced-content');
if (replaced_content)
replaced_content.removeAttribute('class');
}
}
2022-02-07 23:00:33 -08:00
else if (matchDomain(['sudouest.fr', 'charentelibre.fr', 'larepubliquedespyrenees.fr'])) {
let paywall = document.querySelectorAll('.visible-not-premium');
if (paywall.length) {
removeDOMElement(...paywall);
2022-06-28 07:38:49 -07:00
let visible_premium = document.querySelectorAll('div.visible-premium');
for (let elem of visible_premium)
elem.classList.remove('visible-premium');
}
window.setTimeout(function () {
let footer_premium = document.querySelector('.footer-premium');
let ads = document.querySelectorAll('div.pub, div.ph-easy-subscription');
removeDOMElement(footer_premium, ...ads);
2022-03-08 10:04:40 -08:00
}, 500);
2020-03-21 07:33:05 -07:00
}
else
2021-04-25 04:45:26 -07:00
csDone = true;
2022-02-13 09:55:05 -08:00
} else if (window.location.hostname.endsWith('.it') || matchDomain(['eastwest.eu', 'italian.tech', 'limesonline.com', 'quotidiano.net'])) {//italy
if (matchDomain('corriere.it')) {
if (window.location.pathname.endsWith('_amp.html')) {
amp_unhide_subscr_section('amp-ad, amp-embed');
} else {
let url = window.location.href;
if (url.includes('_preview.shtml')) {
window.setTimeout(function () {
window.location.href = url.replace('_preview.shtml', '.shtml').split('?')[0];
2022-03-08 10:04:40 -08:00
}, 500);
}
}
2020-04-04 10:36:19 -07:00
}
2022-05-28 23:38:23 -07:00
else if (matchDomain('corrieredellosport.it')) {
if (!window.location.pathname.startsWith('/amp/')) {
let paywall = document.querySelector('div[class^="MainTextTruncated_paragraph__"]');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
let ads = document.querySelectorAll('div[class^="AdUnit_placeholder"]');
removeDOMElement(...ads);
} else {
let ads = document.querySelectorAll('amp-ad, amp-embed');
removeDOMElement(...ads);
}
}
2022-02-13 09:55:05 -08:00
else if (matchDomain('eastwest.eu')) {
let paywall = document.querySelector('.paywall');
if (paywall) {
paywall.removeAttribute('style');
paywall.classList.remove('paywall');
let intro = document.querySelectorAll('div#testo_articolo > p, div#testo_articolo > h3');
let offerta = document.querySelectorAll('div.offerta_abbonamenti');
removeDOMElement(...intro, ...offerta);
}
}
2022-08-11 22:36:16 -07:00
else if (matchDomain('gazzetta.it')) {
if (window.location.pathname.endsWith('_preview.shtml')) {
window.setTimeout(function () {
window.location.href = window.location.href.split('?')[0].replace('_preview', '') + '?gaa_at=g';
}, 500);
} else if (window.location.pathname.endsWith('_amp.shtml'))
ampToHtml();
2022-08-11 22:36:16 -07:00
}
2022-02-13 09:55:05 -08:00
else if (matchDomain('ilfattoquotidiano.it')) {
2021-09-03 03:35:13 -07:00
let url = window.location.href;
if (url.includes('/amp/')) {
2021-11-30 08:35:45 -08:00
amp_unhide_subscr_section('amp-ad, div#_4sVideoContainer');
2021-09-03 03:35:13 -07:00
let comments = document.querySelector('div.content.comments');
2021-11-30 08:35:45 -08:00
removeDOMElement(comments);
2021-11-03 04:28:38 -07:00
} else if (url.split('?')[0].match(/\/\d{4}\/\d{2}\/\d{2}\//)) {
2021-10-31 12:18:57 -07:00
let paywall = document.querySelector('div.read-more');
if (paywall) {
removeDOMElement(paywall);
2021-09-03 03:35:13 -07:00
window.location.href = url.split('?')[0] + 'amp';
2021-01-11 09:48:49 -08:00
}
2021-09-03 03:35:13 -07:00
}
}
2021-12-29 07:54:18 -08:00
else if (matchDomain('ilfoglio.it')) {
if (window.location.pathname.endsWith('/amp/')) {
amp_unhide_subscr_section('amp-ad, [class^="adv-"], div#gmpVideoContainer');
} else {
let paywall = document.querySelector('div.paywall');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
let ads = document.querySelectorAll('.advertisement');
removeDOMElement(...ads);
}
}
2022-06-06 00:42:42 -07:00
else if (matchDomain('ilmanifesto.it')) {
if (window.location.pathname.match(/((\w)+(\-)+){3,}/)) {
let paywall = document.querySelector('div[class^="PostPaywall_PostPaywall__"]');
if (paywall) {
removeDOMElement(paywall);
let json_script = document.querySelector('script#__NEXT_DATA__');
if (json_script && dompurify_loaded) {
let json = JSON.parse(json_script.innerText);
if (json && json.props.pageProps.content && json.props.pageProps.content.content) {
let article_new = json.props.pageProps.content.content;
let article = document.querySelector('div.ArticleBody');
if (article) {
article.innerHTML = '';
let parser = new DOMParser();
let doc = parser.parseFromString('<div>' + DOMPurify.sanitize(article_new) + '</div>', 'text/html');
let content_new = doc.querySelector('div');
article.appendChild(content_new);
}
} else
window.location.reload(true);
}
}
}
let service_page = document.querySelector('div.service-page');
if (service_page) {
window.setTimeout(function () {
window.location.reload(true);
}, 1000);
}
}
2022-07-02 00:46:18 -07:00
else if (matchDomain(['iltirreno.it', 'lanuovasardegna.it'])) {
2022-07-13 07:29:45 -07:00
if (window.location.pathname.includes('/news/')) {
let pars = document.querySelectorAll('div.MuiGrid-root > div > p:not([class])');
if (pars.length === 1) {
let article = pars[0].parentNode;
if (article && dompurify_loaded) {
removeDOMElement(pars[0]);
try {
fetch(window.location.href)
.then(response => {
if (response.ok) {
response.text().then(html => {
let parser = new DOMParser();
let doc = parser.parseFromString(html, 'text/html');
let json = doc.querySelector('script#__NEXT_DATA__');
if (json) {
let article_new = JSON.parse(json.text).props.pageProps.article.content;
if (article_new) {
let parser = new DOMParser();
let doc = parser.parseFromString('<div>' + DOMPurify.sanitize(article_new) + '</div>', 'text/html');
let content_new = doc.querySelector('div');
article.appendChild(content_new);
}
}
})
}
});
} catch (err) {
console.log(err);
2022-07-13 07:29:45 -07:00
}
}
}
window.setTimeout(function () {
let banners = document.querySelectorAll('div.MuiSnackbar-root, div.css-16cchgy');
removeDOMElement(...banners);
}, 1000);
2022-07-13 07:29:45 -07:00
}
2022-07-02 00:46:18 -07:00
}
else if (matchDomain(it_ilmessaggero_domains)) {
if (window.location.pathname.toLowerCase().includes('/amp/')) {
amp_unhide_subscr_section('amp-ad, amp-embed');
}
}
2021-07-29 23:51:03 -07:00
else if (matchDomain(it_quotidiano_domains)) {
if (window.location.pathname.endsWith('/amp')) {
amp_unhide_access_hide('="c.customGranted"', '="NOT c.customGranted"', 'amp-ad, amp-fx-flying-carpet');
} else {
2022-02-19 23:25:15 -08:00
let paywall = document.querySelector('div[data-testid="paywall-container"]');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
}
2020-04-25 11:39:36 -07:00
}
2022-04-23 00:42:41 -07:00
else if (matchDomain('italiaoggi.it')) {
let paywall = document.querySelector('div.boxAbb');
if (paywall && dompurify_loaded) {
let overlay = document.querySelector('div.article-locked-overlay');
removeDOMElement(paywall, overlay);
let article_locked = document.querySelector('div.article-locked');
if (article_locked) {
article_locked.classList.remove('article-locked');
let json_script = getArticleJsonScript();
if (json_script) {
let json = JSON.parse(json_script.text);
if (json) {
let json_text = json.articleBody;
let content = article_locked.querySelector('section');
if (json_text && content) {
2022-08-15 09:05:31 -07:00
let parser = new DOMParser();
json_text = DOMPurify.sanitize(json_text).replace(/&amp;apos;/g, "'").replace(/;/g, '');
let doc = parser.parseFromString('<div><section>' + json_text + '</section></div>', 'text/html');
let content_new = doc.querySelector('div');
content.parentNode.replaceChild(content_new, content);
2022-04-23 00:42:41 -07:00
}
}
}
}
}
}
else if (matchDomain('rep.repubblica.it')) {
window.setTimeout(function () {
if (window.location.href.includes('/pwa/')) {
window.location.href = window.location.href.replace('/pwa/', '/ws/detail/');
2020-05-20 08:02:18 -07:00
}
2022-03-08 10:04:40 -08:00
}, 500);
if (window.location.href.includes('/ws/detail/')) {
2021-11-30 08:35:45 -08:00
let paywall = document.querySelector('.paywall');
if (paywall) {
2021-11-30 08:35:45 -08:00
amp_unhide_subscr_section();
2021-07-03 23:43:34 -07:00
csDoneOnce = true;
2020-05-25 12:01:15 -07:00
}
}
2020-05-25 12:01:15 -07:00
}
2022-08-04 08:38:17 -07:00
else if (matchDomain(it_gedi_domains)) {
if (matchDomain('huffingtonpost.it')) {
csDoneOnce = true;
} else if (matchDomain('lescienze.it')) {
let paywall = document.querySelector('.paywall-adagio');
if (paywall) {
let body_paywall = document.querySelector('#detail-body-paywall');
let shade = document.querySelector('.shade');
removeDOMElement(paywall, body_paywall, shade);
let detail_body_hidden = document.querySelectorAll('.detail_body[hidden]');
for (let elem of detail_body_hidden) {
elem.removeAttribute('hidden');
elem.removeAttribute('style');
2021-09-04 23:48:03 -07:00
}
2022-08-04 08:38:17 -07:00
csDoneOnce = true;
}
} else if (matchDomain('limesonline.com')) {
let url = window.location.href;
if (url.includes('prv=true')) {
window.setTimeout(function () {
window.location.href = url.split('?')[0];
}, 500);
} else
csDoneOnce = true;
} else {
let url = window.location.href.split('?')[0];
if (!url.match(/\amp(\/)?$/)) {
let premium = document.querySelector('#paywall, iframe#__limio_frame');
2021-09-04 23:48:03 -07:00
if (premium) {
removeDOMElement(premium);
2022-08-04 08:38:17 -07:00
let amphtml = document.querySelector('link[rel="amphtml"]');
if (amphtml)
window.location.href = amphtml.href;
} else if (matchDomain('gelocal.it')) {
premium = document.querySelector('.paywall-adagio');
if (premium) {
removeDOMElement(premium);
window.setTimeout(function () {
let article_body = document.querySelector('div#article-body[style]');
if (article_body)
article_body.removeAttribute('style');
}, 1000);
}
2021-09-04 23:48:03 -07:00
}
2022-08-04 08:38:17 -07:00
let ads = document.querySelectorAll('div[id^="adv"]');
removeDOMElement(...ads);
} else {
2022-08-04 08:38:17 -07:00
if (matchDomain(['lastampa.it', 'www.repubblica.it'])) {
let paywall = document.querySelector('div[id^="paywall-banner"]');
removeDOMElement(paywall);
amp_unhide_subscr_section('amp-ad, amp-embed');
} else {
amp_unhide_access_hide('="showContent"', '', 'amp-ad, amp-embed')
}
}
}
}
else
2021-04-25 04:45:26 -07:00
csDone = true;
} else if (window.location.hostname.match(/\.(be|nl)$/)) {//belgium/netherlands
if (matchDomain('fd.nl')) {
document.addEventListener('DOMContentLoaded', () => {
if (window.location.href.includes('?'))
window.location.href = window.location.href.split('?')[0];
let reg_modal = document.querySelector('div.modal.upsell');
if (reg_modal)
window.location.reload(true);
});
2020-06-14 09:36:51 -07:00
}
2020-06-18 11:54:57 -07:00
else if (matchDomain('ftm.nl')) {
let banner_pp = document.querySelector('div.banner-pp');
removeDOMElement(banner_pp);
2020-06-18 11:54:57 -07:00
}
else if (matchDomain(['gva.be', 'hbvl.be', 'nieuwsblad.be'])) {
2022-05-25 09:34:09 -07:00
let paywall = document.querySelector('div[data-cj-root="subscription-wall"]');
if (paywall && dompurify_loaded) {
removeDOMElement(paywall);
let main_content = document.querySelector('div[data-mht-block="article-detail__article-main"]');
let json_script = main_content.querySelector('script');
let json_str = json_script.text.substring(json_script.textContent.indexOf('{'));
try {
let json = JSON.parse(json_str);
if (json) {
let json_text = Object.values(json)[0]['data']['article']['body'];
let parser = new DOMParser();
let div_content = main_content.querySelector('div');
let par_elem, par_key, par_li, par_html, par_link;
let head = document.querySelector('head');
let streamone = false;
let flourish = false;
for (let par of json_text) {
for (let key in par) {
par_elem = document.createElement('p');
par_key = par[key];
if (['p', 'subhead'].includes(key)) {
if (par_key.includes('<')) {
par_html = parser.parseFromString('<p>' + DOMPurify.sanitize(par_key) + '</p>', 'text/html');
par_elem = par_html.querySelector('p');
} else
par_elem.innerText = par_key;
if (key === 'subhead')
par_elem.setAttribute('style', 'font-weight: bold;');
} else if (key === 'image') {
par_elem = document.createElement('img');
par_elem.src = par_key.url;
} else if (key === 'bullet_list') {
par_elem = document.createElement('ul');
for (let bullet of par_key) {
par_html = parser.parseFromString('<li>' + DOMPurify.sanitize(bullet) + '</li>', 'text/html');
par_li = par_html.querySelector('li');
let bullet_link = par_li.querySelector('a');
if (bullet_link && bullet_link.href && !bullet_link.innerText)
bullet_link.innerText = bullet_link.href;
par_elem.appendChild(par_li);
}
} else if (key === 'related') {
par_elem = document.createElement('p');
if (par_key.article && par_key.article.title && par_key.article.webcmsRelativeUrl) {
par_link = document.createElement('a');
if (par_key.article.label)
par_link.innerText = par_key.article.label;
par_link.innerText += par_key.article.title;
par_link.href = par_key.article.webcmsRelativeUrl;
par_elem.appendChild(par_link);
}
} else if (key === 'iframe_sized') {
par_elem = document.createElement('iframe');
par_elem.src = par_key.url;
if (par_key.height && par_key.width) {
par_elem.setAttribute('height', par_key.height);
par_elem.setAttribute('width', par_key.width);
}
} else if (key === 'streamone') {
if (!streamone) {
let streamone_script = document.createElement('script');
streamone_script.setAttribute('src', 'https://shared.mediahuis.be/videoplayers/mediahuis/video-theoplayer.js?v=20220525T184101');
streamone_script.setAttribute('defer', true);
streamone_script.setAttribute('crossorigin', 'anonymous');
if (head)
head.appendChild(streamone_script);
streamone = true;
}
let par_key_id = DOMPurify.sanitize(par_key.id);
par_html = parser.parseFromString('<div id="json_id"><div><div><div><div data-testid="embed-video"><div><div id="video-player-' + par_key_id + '" style="width:100%;" data-video-embed-id="' + par_key_id + '" data-video-target-id="video-player-' + par_key_id + '" data-video-brand="gva" class="js-theoplayer-placeholder"></div></div></div></div></div>', 'text/html');
par_elem = par_html.querySelector('div');
} else if (key === 'legacy-ml') {
par_html = parser.parseFromString('<div>' + DOMPurify.sanitize(par_key) + '</div>', '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('<p>' + DOMPurify.sanitize(par_key) + '</p>', '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);
}
2022-05-25 09:34:09 -07:00
}
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)
2022-05-25 09:34:09 -07:00
}
2022-07-09 23:35:02 -07:00
else if (matchDomain(['knack.be', 'kw.be', 'levif.be'])) {
2022-07-04 11:35:21 -07:00
let paywall = document.querySelector('div[id*="wall-modal"]');
2021-05-14 08:40:34 -07:00
if (paywall) {
removeDOMElement(paywall);
2022-06-27 08:13:14 -07:00
function knack_noscroll(node) {
node.removeAttribute('style');
node.removeAttribute('class');
}
waitDOMAttribute('html', 'html', 'style', knack_noscroll, true);
2022-07-04 11:35:21 -07:00
let intro = document.querySelectorAll('div.article-body > p, div.article-body > style');
removeDOMElement(...intro);
}
2020-06-28 08:41:12 -07:00
}
2022-05-02 08:29:26 -07:00
else if (matchDomain(['lc.nl', 'dvhn.nl'])) {
let top_ad = document.querySelector('.top__ad');
2022-05-02 08:29:26 -07:00
removeDOMElement(top_ad);
}
2021-06-20 12:40:30 -07:00
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');
2021-10-22 03:36:25 -07:00
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"]');
2021-06-20 12:40:30 -07:00
if (paywall && auth_body) {
let auth_body_par_count = auth_body.querySelectorAll('p');
if (auth_body_par_count.length < 2) {
2021-08-18 09:14:49 -07:00
let json_script = document.querySelector('script[data-fragment-type="PacoArticleContent"]');
let json_str = json_script.text.substring(json_script.textContent.indexOf('{'));
try {
2021-08-18 09:14:49 -07:00
let json = JSON.parse(json_str);
let article = Object.values(json)[0]['data']['article']['body'];
auth_body.innerHTML = '';
2021-06-20 12:40:30 -07:00
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('<div><strong>' + DOMPurify.sanitize(par_key) + '</strong></div>', 'text/html');
2021-06-27 00:56:22 -07:00
par_elem = par_html.querySelector('div');
} else if (key === 'twitter' || key === 'instagram') {
par_elem = document.createElement('a');
Object.assign(par_elem, {
href: par_key,
2021-06-27 00:56:22 -07:00
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;
2021-07-05 10:44:40 -07:00
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 {
2021-08-18 09:14:49 -07:00
par_html = parser.parseFromString('<p style="font-size: 18px; line-height: 1.625;">' + DOMPurify.sanitize(par_key) + '</div>', 'text/html');
par_elem = par_html.querySelector('p');
2020-07-04 04:33:09 -07:00
}
if (par_elem)
par_dom.appendChild(par_elem);
auth_body.appendChild(par_dom);
}
2020-07-04 04:33:09 -07:00
}
} catch (err) {
2021-06-20 12:40:30 -07:00
console.warn('unable to parse text');
console.warn(err);
}
2020-07-04 04:33:09 -07:00
}
}
}
2022-03-08 10:04:40 -08:00
}, 500);
}
2022-08-04 03:37:48 -07:00
else if (matchDomain(nl_dpg_media_domains)) {
2022-05-04 08:58:19 -07:00
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);
2020-07-25 00:06:28 -07:00
}
else if (matchDomain('telegraaf.nl')) {
if (window.location.href.startsWith('https://www.telegraaf.nl/error?ref=/')) {
2020-08-02 03:34:48 -07:00
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) {
2020-12-04 07:56:36 -08:00
window.setTimeout(function () {
window.location.reload(true);
}, 500);
}
let article_wrapper = document.querySelector('.ArticlePageWrapper__uid');
let spotx_banner = document.querySelector('.ArticleBodyBlocks__inlineArticleSpotXBanner');
2021-08-04 10:56:37 -07:00
let paywall = document.querySelector('.MeteringNotification__backdrop');
removeDOMElement(spotx_banner, paywall);
2021-08-04 10:56:37 -07:00
let premium = document.querySelector('.PremiumLabelWithLine');
let article_id = article_wrapper ? article_wrapper.innerText : '123';
2022-05-23 10:31:27 -07:00
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);
2021-08-04 10:56:37 -07:00
let html = document.documentElement.outerHTML;
2021-08-08 01:02:13 -07:00
let json = html.includes('window.__APOLLO_STATE__=') ? html.split('window.__APOLLO_STATE__=')[1].split('};')[0] + '}' : '';
if (json) {
2022-05-13 05:12:21 -07:00
let json_article_id = json.split('uid\":')[1].split(/\D/)[0];
2021-08-11 09:29:54 -07:00
if (json_article_id && json_article_id !== article_id) {
window.setTimeout(function () {
window.location.reload(true);
}, 500);
}
2021-08-06 04:25:23 -07:00
let json_text = json.includes('"body":"') ? json.split('"body":"')[1].split('","__typename":')[0] : '';
2021-08-04 10:56:37 -07:00
if (json_text) {
let intro = document.querySelector('span[id^="articleIntro"]');
if (intro)
json_text = json_text.replace(intro.innerText + '\n\n', '');
2022-05-23 10:31:27 -07:00
let article_body = document.querySelector('section[data-element="articleBody"]');
2021-08-04 10:56:37 -07:00
if (article_body) {
let div_main = document.createElement('div');
div_main.setAttribute('id', 'articleBody' + article_id);
let div_elem = document.createElement('div');
div_elem.setAttribute('data-element', 'articleBodyBlocks');
let text_array = json_text.split('\\n');
text_array.forEach(p_text => {
let p_div = document.createElement('p');
p_div.setAttribute('class', 'ArticleBodyBlocks__paragraph');
p_div.innerText = p_text;
div_elem.appendChild(p_div);
});
div_main.appendChild(div_elem);
2022-05-13 05:12:21 -07:00
article_body.insertBefore(div_main, article_body.firstChild);
2021-08-04 10:56:37 -07:00
}
}
2020-09-25 05:57:45 -07:00
}
}
2020-09-25 05:57:45 -07:00
}
2021-12-16 08:28:03 -08:00
else if (matchDomain('vn.nl')) {
let paywall = document.querySelector('div.content__message-no-access-container');
if (paywall && dompurify_loaded) {
let content_restriction = document.querySelector('div.content__restriction');
removeDOMElement(paywall, content_restriction);
let body = document.querySelector('body');
if (body)
body.style = 'height:auto !important;';
let article_content = document.querySelector('section[data-article-content-element]');
if (article_content)
article_content.style = 'max-height:none !important;';
let json_url_dom = document.querySelector('link[rel="alternate"][type="application/json"]');
if (json_url_dom) {
let json_url = json_url_dom.href;
fetch(json_url)
.then(response => {
if (response.ok) {
response.json().then(json => {
let json_text = json.content.rendered;
let content = document.querySelector('div[data-article-content-target]');
if (json_text && content) {
let parser = new DOMParser();
2022-06-06 05:11:49 -07:00
let doc = parser.parseFromString('<div data-article-content-target>' + DOMPurify.sanitize(json_text, {ADD_TAGS: ['iframe'], ADD_ATTR: ['frameborder']}) + '</div>', 'text/html');
2021-12-16 08:28:03 -08:00
let content_new = doc.querySelector('div');
content.parentNode.replaceChild(content_new, content);
}
});
}
});
}
}
}
else
2021-04-25 04:45:26 -07:00
csDone = true;
2020-09-26 08:27:14 -07:00
2022-06-30 11:25:58 -07:00
} else if (window.location.hostname.match(/\.(ie|uk)$/)) {//united kingdom/ireland
2020-10-02 09:40:45 -07:00
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;
2022-04-19 12:37:13 -07:00
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);
2022-04-09 08:07:08 -07:00
csDoneOnce = true;
2022-08-02 08:26:48 -07:00
let url_cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url.split('?')[0];
replaceDomElementExt(url_cache, true, false, 'main');
}
2022-08-24 11:28:09 -07:00
window.setTimeout(function () {
let ads = document.querySelectorAll('.ad-banner, .advert');
removeDOMElement(...ads);
}, 1000);
2020-10-11 05:43:07 -07:00
}
else if (matchDomain('spectator.co.uk')) {
2022-04-21 13:08:25 -07:00
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);
}
2021-06-15 12:23:45 -07:00
}
2020-10-16 09:41:13 -07:00
}
else if (matchDomain('telegraph.co.uk')) {
2021-11-09 08:18:15 -08:00
let url = window.location.href.split('?')[0];
if (url.endsWith('/amp/')) {
2021-11-30 08:35:45 -08:00
let paywall = document.querySelectorAll('.premium-paywall');
2021-12-22 23:43:03 -08:00
if (paywall.length) {
let truncated_content = document.querySelector('.truncated-content');
2021-11-30 08:35:45 -08:00
removeDOMElement(...paywall, truncated_content);
amp_unhide_access_hide('="c.result=\'ALLOW_ACCESS\'"', '', 'amp-ad, amp-embed', false);
2022-01-09 08:27:53 -08:00
} else {
let amp_ads = document.querySelectorAll('amp-ad, amp-embed');
removeDOMElement(...amp_ads);
2020-12-16 09:37:44 -08:00
}
2021-11-09 08:18:15 -08:00
} else {
let subwall = document.querySelectorAll('[class^="subwall"]');
2021-11-09 08:18:15 -08:00
let ads = document.querySelectorAll('.advert, .commercial-unit');
removeDOMElement(...subwall, ...ads);
}
2020-10-21 10:53:49 -07:00
}
else if (matchDomain('the-tls.co.uk')) {
let paywall = document.querySelector('.tls-subscriptions-banner__closed-skin');
removeDOMElement(paywall);
2020-11-07 01:43:21 -08:00
}
else if (matchDomain('thetimes.co.uk')) {
2021-06-19 10:04:16 -07:00
let url = window.location.href;
2022-02-03 11:16:51 -08:00
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);
2022-02-03 11:16:51 -08:00
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);
2022-02-03 11:16:51 -08:00
}
let paywall_page = document.querySelector('div#paywall-portal-page-footer');
removeDOMElement(paywall_page);
}
}
else
2021-04-25 04:45:26 -07:00
csDone = true;
2022-08-11 22:12:17 -07:00
} 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);
}
}
2022-01-19 11:29:25 -08:00
else if (matchDomain('clarin.com')) {
let ads = document.querySelectorAll('.ad-slot');
removeDOMElement(...ads);
}
2022-07-29 09:20:27 -07:00
else if (matchDomain('crusoe.uol.com.br')) {
let paywall = document.querySelector('#wallcontent');
let ads = document.querySelectorAll('#gpt-leaderboard, .ads_desktop, .catchment-box');
removeDOMElement(paywall, ...ads);
}
2022-02-11 08:51:16 -08:00
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');
}
2022-07-28 08:40:47 -07:00
let ads = document.querySelectorAll('div[class*="_ads"]');
removeDOMElement(...ads);
2020-11-15 05:14:57 -08:00
}
2021-12-23 08:35:47 -08:00
else if (matchDomain('elespectador.com')) {
2022-04-26 12:38:52 -07:00
if (window.location.search.match(/(\?|&)outputType=amp/)) {
2022-03-15 10:34:00 -07:00
amp_unhide_subscr_section('amp-ad, amp-embed, [class^="Widget"], amp-fx-flying-carpet');
2021-12-23 08:35:47 -08:00
} else {
2022-04-26 12:38:52 -07:00
let paywall = document.querySelector('div.exclusive_validation');
2021-12-23 08:35:47 -08:00
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');
2021-05-04 11:14:30 -07:00
let page_pdf_content = document.querySelector('div.page_pdf_content');
let close_html = document.querySelector('div.close_html');
2022-06-26 00:20:44 -07:00
let cont_page_full = document.querySelector('div.cont_page_full');
removeDOMElement(page_pdf_content, close_html, cont_page_full);
2022-03-08 10:04:40 -08:00
}, 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');
2022-03-08 10:04:40 -08:00
}, 3000);
}
2022-06-01 08:39:06 -07:00
else if (matchDomain('em.com.br')) {
if (!window.location.pathname.endsWith('/amp.html')) {
let paywall = document.querySelector('.news-blocked-content');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
let ads = document.querySelectorAll('.ads, .containerads');
removeDOMElement(...ads);
} else {
amp_unhide_subscr_section('amp-ad, amp-embed, amp-fx-flying-carpet');
let compress_text = document.querySelector('div.compress-text');
if (compress_text)
compress_text.classList.remove('compress-text');
}
}
else if (matchDomain('estadao.com.br')) {
if (window.location.pathname.endsWith('.amp')) {
2022-01-09 08:27:53 -08:00
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')) {
2022-07-23 23:49:30 -07:00
if (matchDomain('piaui.folha.uol.com.br')) {
if (window.location.search.startsWith('?amp')) {
amp_unhide_subscr_section();
} else {
let paywall = document.querySelector('.revista--interna__assineonly');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
}
} else {
2022-07-23 23:49:30 -07:00
if (window.location.pathname.startsWith('/amp/')) {
amp_unhide_subscr_section('amp-ad, amp-sticky-ad, amp-embed');
} else {
let signup = document.querySelector('.c-top-signup');
removeDOMElement(signup);
}
}
}
2022-03-15 10:34:00 -07:00
else if (matchDomain('blogfolha.uol.com.br')) {
let hidden_images = document.querySelectorAll('div[id^="attachment_"] > a > img[src^="http:"][srcset]');
for (let hidden_image of hidden_images) {
hidden_image.src = hidden_image.src.replace('http:', 'https:');
hidden_image.srcset = '';
}
}
else if (matchDomain('latercera.com')) {
let subscr_banner = document.querySelector('.empty');
removeDOMElement(subscr_banner);
2020-11-23 09:12:13 -08:00
}
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);
}
}
2022-08-11 22:12:17 -07:00
else if (matchDomain('valor.globo.com')) {
let url = window.location.href;
let paywall = document.querySelector('div.paywall');
if (paywall) {
removeDOMElement(paywall);
csDoneOnce = true;
let url_cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url;
replaceDomElementExt(url_cache, true, false, 'div.protected-content');
}
window.setTimeout(function () {
let skeleton_box = document.querySelector('div.glb-skeleton-box');
if (skeleton_box) {
skeleton_box.classList.remove('glb-skeleton-box');
skeleton_box.removeAttribute('style');
}
}, 1000);
}
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');
2020-11-30 11:38:50 -08:00
}
else
2021-04-25 04:45:26 -07:00
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))
2021-11-16 09:21:45 -08:00
if (matchDomain(usa_adv_local_domains)) {
let url = window.location.href;
if (url.includes('?outputType=amp')) {
let amp_ads = document.querySelectorAll('.amp-ad-container, amp-embed');
removeDOMElement(...amp_ads);
} else {
let paywall = document.querySelector('.paywall');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
let ads = document.querySelectorAll('div.ad');
removeDOMElement(...ads);
}
}
else if (matchDomain('adweek.com')) {
let url = window.location.href;
let body_single = document.querySelector('body.single');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (body_single && amphtml) {
body_single.classList.remove('single');
window.location.href = amphtml.href;
}
2020-12-06 13:31:54 -08:00
}
else if (matchDomain('americanbanker.com')) {
2021-05-04 13:13:01 -07:00
let inline_gate = document.querySelector('.inline-gate');
if (inline_gate) {
inline_gate.classList.remove('inline-gate');
let inline_gated = document.querySelectorAll('.inline-gated');
for (let elem of inline_gated)
elem.classList.remove('inline-gated');
}
}
2021-12-02 09:52:19 -08:00
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;';
}
2021-12-02 09:52:19 -08:00
}
else if (matchDomain('asia.nikkei.com')) {
2021-11-09 08:18:15 -08:00
let popup = document.querySelector('#pianoj_ribbon');
removeDOMElement(popup);
2020-12-20 12:27:58 -08:00
}
2021-05-09 05:50:16 -07:00
else if (matchDomain('asiatimes.com')) {
2022-04-19 12:37:13 -07:00
if (!window.location.search.match(/(\?|&)amp_markup=1/)) {
2022-01-19 12:23:59 -08:00
let paywall = document.querySelector('div.woocommerce');
if (paywall) {
removeDOMElement(paywall);
let url_amp = window.location.href.split('?')[0] + '?amp_markup=1';
replaceDomElementExt(url_amp, false, false, 'div.entry-content', '', 'article.ia2amp-article');
}
}
2021-05-09 05:50:16 -07:00
}
else if (matchDomain('barrons.com')) {
2021-10-30 01:29:46 -07:00
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) {
2021-10-30 01:29:46 -07:00
removeDOMElement(snippet);
window.location.href = url.replace('barrons.com', 'barrons.com/amp');
}
2022-04-24 01:00:59 -07:00
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 {
2021-11-30 08:35:45 -08:00
amp_unhide_subscr_section('.wsj-ad, amp-ad');
}
}
2021-12-11 10:12:00 -08:00
else if (matchDomain('billboard.com')) {
if (window.location.pathname.endsWith('/amp/')) {
amp_unhide_subscr_section('amp-ad, amp-embed');
}
}
else if (matchDomain('bloomberg.com')) {
2022-01-11 09:32:42 -08:00
function bloomberg_noscroll(node) {
node.removeAttribute('data-paywall-overlay-status');
}
waitDOMElement('div#fortress-paywall-container-root', 'DIV', removeDOMElement, true);
waitDOMAttribute('body', 'BODY', 'data-paywall-overlay-status', bloomberg_noscroll, true);
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);
2021-07-19 10:55:26 -07:00
sessionStorage.clear();
2021-08-06 04:25:23 -07:00
let url = window.location.href;
2022-07-28 08:40:47 -07:00
if (url.match(/s\/\d{4}-/)) {
let page_ad = document.querySelectorAll('div.page-ad, div[data-ad-placeholder], div[class*="-ad-top"]');
2021-08-23 12:31:23 -07:00
let reg_ui_client = document.querySelector('div#reg-ui-client');
2021-12-13 11:30:14 -08:00
removeDOMElement(leaderboard, ...page_ad, reg_ui_client);
2021-08-06 04:25:23 -07:00
let hidden_images = document.querySelectorAll('img.lazy-img__image[src][data-native-src]');
for (let hidden_image of hidden_images) {
2021-12-13 11:30:14 -08:00
if (hidden_image.src.match(/\/(60|150)x-1\.(png|jpg)$/))
2021-08-06 04:25:23 -07:00
hidden_image.setAttribute('src', hidden_image.getAttribute('data-native-src'));
hidden_image.style.filter = 'none';
}
2021-10-20 11:35:38 -07:00
let hidden_charts = document.querySelectorAll('div[data-toaster-id][data-src]');
for (let hidden_chart of hidden_charts) {
let elem = document.createElement('iframe');
Object.assign(elem, {
src: hidden_chart.getAttribute('data-src'),
frameborder: 0,
height: hidden_chart.getAttribute('style').replace('min-height: ', ''),
scrolling: 'no'
});
hidden_chart.parentNode.replaceChild(elem, hidden_chart);
}
2021-10-03 03:17:44 -07:00
let blur = document.querySelector('div.blur[style]');
if (blur) {
blur.classList.remove('blur');
blur.removeAttribute('style');
}
2021-12-13 11:30:14 -08:00
let shimmering_content = document.querySelectorAll('div.shimmering-text');
let body_transparent = document.querySelector('div[class*="nearly-transparent-text-blur"]');
2022-01-06 07:40:29 -08:00
if ((shimmering_content.length || body_transparent) && dompurify_loaded) {
2021-12-13 11:30:14 -08:00
removeDOMElement(...shimmering_content);
if (body_transparent)
removeClassesByPrefix(body_transparent, 'nearly-transparent-text-blur');
let json_script = document.querySelector('script[data-component-props="ArticleBody"], script[data-component-props="FeatureBody"]');
2022-03-10 10:45:37 -08:00
if (json_script) {
2021-12-13 11:30:14 -08:00
let json = JSON.parse(json_script.innerHTML);
if (json) {
let json_text;
if (json.body)
json_text = json.body;
else if (json.story && json.story.body)
json_text = json.story.body;
if (json_text) {
removeDOMElement(json_script);
let article = document.querySelector('div.body-copy-v2:not(.art_done)');
let article_class = 'body-copy-v2';
if (!article) {
article = document.querySelector('div.body-copy:not(.art_done)');
article_class = 'body-copy';
}
if (!article) {
article = document.querySelector('div.body-content:not(.art_done)');
article_class = 'body-content';
}
if (article) {
article_class += ' art_done';
let parser = new DOMParser();
let doc = parser.parseFromString('<div class="' + article_class + '">' + DOMPurify.sanitize(json_text, {ADD_TAGS: ['iframe', 'script']}) + '</div>', 'text/html');
let article_new = doc.querySelector('div');
if (article_new) {
article.parentNode.replaceChild(article_new, article);
let teaser_body = document.querySelector('div.body-content[class*="teaser-content_"]');
removeDOMElement(teaser_body);
let thirdparty_embed = document.querySelector('div.thirdparty-embed__container[style*="height: 0;"]');
if (thirdparty_embed)
thirdparty_embed.setAttribute('style', 'height: 550px !important;');
}
2021-12-12 13:24:27 -08:00
}
2021-08-06 04:25:23 -07:00
}
2021-07-19 10:55:26 -07:00
}
}
}
2021-07-19 10:55:26 -07:00
}
}
2021-06-14 12:45:12 -07:00
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);
}
2021-06-14 12:45:12 -07:00
}
2022-06-26 12:51:18 -07:00
else if (matchDomain('bqprime.com')) {
if (window.location.pathname.startsWith('/amp/')) {
amp_unhide_subscr_section();
}
}
else if (matchDomain('business-standard.com')) {
2021-10-18 12:04:03 -07:00
let skip_button = document.querySelector('a.btn_skip');
if (skip_button)
skip_button.click();
2022-06-24 02:46:02 -07:00
if (!window.location.pathname.startsWith('/article-amp/')) {
2022-08-18 11:02:12 -07:00
let paywall = document.querySelector('span.p-content.paywall, main, p.read-txt');
2022-06-24 02:46:02 -07:00
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
2020-12-24 04:30:41 -08:00
}
2022-06-24 02:46:02 -07:00
} else {
2022-08-18 11:02:12 -07:00
amp_unhide_subscr_section('amp-ad, amp-embed, .block-cont-amp, #divnonpaidcontent, div > div.article_image, div[subscriptions-actions], .reader');
2021-10-18 12:04:03 -07:00
}
2020-12-24 04:30:41 -08:00
}
2021-08-08 01:02:13 -07:00
2022-01-14 06:33:39 -08:00
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);
}
2022-01-14 06:33:39 -08:00
}
else if (matchDomain(ca_gcm_domains)) {
let paywall = document.querySelector('div._block_1dgevo');
if (paywall) {
removeDOMElement(paywall);
window.setTimeout(function () {
window.location.reload(true);
}, 500);
}
let counter = document.querySelector('div#paywall-banner-content');
removeDOMElement(counter);
}
else if (matchDomain(ca_torstar_domains)) {
window.setTimeout(function () {
let meter_banner = document.querySelector('.c-article-meter-banner');
2022-08-28 23:36:40 -07:00
let ads = document.querySelectorAll('.seo-media-query, .c-googleadslot, .ad-slot');
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);
}
2022-08-27 01:11:03 -07:00
else if (matchDomain(['chronicle.com', 'philanthropy.com'])) {
2021-10-07 10:56:14 -07:00
let preview = document.querySelector('div[data-content-summary]');
removeDOMElement(preview);
let article_hidden = document.querySelector('div[data-content-body]');
if (article_hidden)
article_hidden.removeAttribute('data-content-body');
}
2021-07-28 09:32:55 -07:00
else if (matchDomain('csmonitor.com')) {
let paywall = document.querySelector('div.paywall');
removeDOMElement(paywall);
}
2022-05-04 08:58:19 -07:00
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');
2022-05-10 13:31:05 -07:00
} else {
let overlay = document.querySelector('div.sl-overlay');
removeDOMElement(overlay);
let noscroll = document.querySelector('div#courier-body-wrapper[style]');
if (noscroll)
noscroll.removeAttribute('style');
}
}
2021-12-11 10:12:00 -08:00
else if (matchDomain('digiday.com')) {
if (window.location.pathname.endsWith('/amp/')) {
amp_unhide_access_hide('="NOT p.showPageviewExpired AND NOT p.showPayWall"', '', 'amp-ad, .advertisement, .ad-wrapper');
}
}
else if (matchDomain('discovermagazine.com')) {
window.setTimeout(function () {
let mammoth = document.querySelector('.iXVGnF');
if (mammoth)
window.location.reload();
2021-07-11 09:44:35 -07:00
let banner = document.querySelector('div.dPURIw');
if (banner)
banner.setAttribute('style', 'display:none;');
2022-03-08 10:04:40 -08:00
}, 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"]');
2022-08-07 10:04:04 -07:00
let amphtml = document.querySelector('link[rel="amphtml"]');
if ((paywall || data_prime) && amphtml) {
removeDOMElement(paywall);
if (data_prime)
data_prime.removeAttribute('data-prime');
2022-08-07 10:04:04 -07:00
window.location.href = amphtml.href;
}
2022-03-08 10:04:40 -08:00
}, 500);
}
}
2021-05-03 13:12:58 -07:00
else if (matchDomain('economictimes.indiatimes.com')) {
let paywall = document.querySelector('section.prime_paywall');
if (paywall) {
removeDOMElement(paywall);
let content = document.querySelector('div.content1, div.artText');
let full_text = document.querySelector('div.paywall.p1');
if (content && full_text)
content.innerText = full_text.innerText;
let page_content = document.querySelector('div.pageContent:not([style]');
if (page_content)
page_content.setAttribute('style', 'height: auto !important;');
2021-05-03 13:12:58 -07:00
}
}
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;
}
2021-01-11 11:59:50 -08:00
}
}
2021-01-11 11:59:50 -08:00
}
2022-04-22 07:49:29 -07:00
else if (matchDomain('enotes.com')) {
2022-04-25 22:57:05 -07:00
let paywall = document.querySelectorAll('section.c-cta-section');
if (paywall.length) {
removeDOMElement(...paywall);
let blurred = document.querySelectorAll('div[class^="_"]');
2022-04-22 07:49:29 -07:00
for (let elem of blurred)
elem.removeAttribute('class');
2022-04-25 23:14:59 -07:00
let intro = document.querySelectorAll('div.o-rte-text > p:not([class]), div.o-rte-text > h3');
2022-04-22 07:49:29 -07:00
for (let elem of intro)
removeDOMElement(elem);
2022-05-09 11:29:11 -07:00
let section_words = pageContains('p[class="u-align--center"]', /\(The entire section contains/);
let ads = document.querySelectorAll('.ad-hfu');
removeDOMElement(...section_words, ...ads);
2022-04-22 07:49:29 -07:00
}
}
else if (matchDomain('entrepreneur.com')) {
let promo = document.querySelector('.paywall-promo');
if (promo) {
removeDOMElement(promo);
let gate_check = document.querySelector('.gate-check');
if (gate_check)
gate_check.removeAttribute('class');
let hidden_images = document.querySelectorAll('img.lazy[src*="blur"][data-src]');
for (let hidden_image of hidden_images)
hidden_image.setAttribute('src', hidden_image.getAttribute('data-src'));
}
}
2022-05-29 08:08:18 -07:00
else if (matchDomain('financialexpress.com')) {
let paywall = document.querySelector('div.paywall');
if (paywall)
paywall.classList.remove('paywall');
let register = document.querySelector('div.pcl-wrap');
let ads;
if (window.location.pathname.endsWith('/lite/'))
ads = document.querySelectorAll('amp-ad, amp-embed, .ad-bg-container');
else
ads = document.querySelectorAll('div[class*="-ads-blocks-ad-unit"]');
removeDOMElement(register, ...ads);
}
else if (matchDomain('firstthings.com')) {
let paywall = document.querySelector('.paywall');
removeDOMElement(paywall);
}
else if (matchDomain('foreignaffairs.com')) {
2021-09-28 11:41:49 -07:00
window.setTimeout(function () {
let paywall = document.querySelector('.paywall');
let loading_indicator = document.querySelector('.loading-indicator');
let msg_bottom = document.querySelector('.messages--container--bottom');
removeDOMElement(paywall, loading_indicator, msg_bottom);
let article_dropcap = document.querySelectorAll('.article-dropcap');
for (let elem of article_dropcap)
elem.classList.add('loaded');
2021-10-24 10:01:36 -07:00
let hidden_images = document.querySelectorAll('img[src^="data:image/"][data-src]');
2021-09-28 11:41:49 -07:00
for (let hidden_image of hidden_images) {
2021-10-24 10:01:36 -07:00
hidden_image.setAttribute('src', hidden_image.getAttribute('data-src'));
hidden_image.removeAttribute('class');
}
2021-09-28 11:41:49 -07:00
let img_list = document.querySelectorAll('.magazine-list-article img');
for (let img_elem of img_list)
img_elem.setAttribute('class', 'mb-4');
if (window.location.href.includes('/interviews/')) {
let img_header = document.querySelector('.interview-header > div');
if (img_header) {
let img_src = img_header.getAttribute('data-src');
let img_elem = document.createElement('img');
img_elem.src = img_src;
img_header.appendChild(img_elem);
}
}
2022-03-08 10:04:40 -08:00
}, 1000);
2021-01-09 08:45:09 -08:00
}
else if (matchDomain('foreignpolicy.com')) {
2021-06-15 22:38:02 -07:00
let content_ungated = document.querySelector('div.content-ungated');
removeDOMElement(content_ungated);
let content_gated = document.querySelector('div.content-gated');
if (content_gated)
content_gated.classList.remove('content-gated');
2020-12-31 00:45:12 -08:00
}
2021-12-10 09:16:40 -08:00
else if (matchDomain('fortune.com')) {
2022-04-21 12:27:08 -07:00
let paywall = document.querySelector('.paywall');
2022-04-22 07:21:00 -07:00
if (window.location.pathname.match(/\/amp(\/)?/)) {
2021-12-10 09:16:40 -08:00
amp_unhide_access_hide('="NOT p.showRegWall AND NOT p.showPayWall"', '', '[class^="amp-ad"]');
removeDOMElement(paywall);
2022-04-21 12:27:08 -07:00
} else {
if (paywall)
paywall.removeAttribute('class');
2021-12-10 09:16:40 -08:00
}
}
else if (matchDomain('ft.com')) {
2021-10-18 11:35:41 -07:00
if (window.location.hostname.startsWith('amp.')) {
2021-11-30 08:35:45 -08:00
amp_unhide_subscr_section('.ad-container, amp-ad');
2021-10-18 11:35:41 -07:00
} else {
2022-06-27 12:16:39 -07:00
let cookie_banner = document.querySelector('.o-cookie-message');
2021-10-18 11:35:41 -07:00
let ribbon = document.querySelector('.js-article-ribbon');
let ads = document.querySelector('.o-ads');
removeDOMElement(cookie_banner, ribbon, ads);
}
2021-01-16 01:57:44 -08:00
}
else if (matchDomain('griffithreview.com')) {
let body_single = document.querySelector('body.single');
if (body_single)
body_single.classList.remove('single');
let subscribe = document.querySelector('div.call-to-action');
removeDOMElement(subscribe);
2021-01-19 09:46:16 -08:00
}
else if (matchDomain('harpers.org')) {
let overlay = document.querySelector('div[id^="pum-"]');
removeDOMElement(overlay);
let entry_content = document.querySelectorAll('.entry-content');
for (let elem of entry_content)
elem.setAttribute('style', 'display: block !important');
2021-01-18 11:11:42 -08:00
}
else if (matchDomain('hbr.org')) {
let popup = document.querySelector('.persistent-banner');
removeDOMElement(popup);
2021-01-20 11:25:53 -08:00
}
2021-11-06 01:24:25 -07:00
else if (matchDomain('hbrchina.org')) {
let div_hidden = document.querySelector('div#the_content');
if (div_hidden)
div_hidden.removeAttribute('style');
}
2022-04-05 09:04:57 -07:00
else if (matchDomain('hilltimes.com')) {
let paywall = document.querySelector('div.paywallcont');
if (paywall) {
removeDOMElement(paywall);
let json_script = getArticleJsonScript();
if (json_script) {
let json = JSON.parse(json_script.text).filter(x => x.articleBody)[0];
if (json) {
2022-04-17 23:13:57 -07:00
let json_text = parseHtmlEntities(json.articleBody).replace(/(\.|\%)\s{3,}/g, "$&\r\n\r\n");
2022-04-05 09:04:57 -07:00
let content = document.querySelector('div#xorg');
if (json_text && content)
content.innerText = '\r\n' + json_text;
}
}
}
}
2021-05-25 10:27:32 -07:00
else if (matchDomain('hindustantimes.com')) {
let paywall = document.querySelector('.freemium-card');
if (paywall) {
removeDOMElement(paywall);
let freemium_text = document.querySelector('.freemiumText');
if (freemium_text)
freemium_text.classList.remove('freemiumText');
}
let noscroll = document.querySelector('body.open-popup');
if (noscroll)
noscroll.classList.remove('open-popup');
let close_story = document.querySelector('.closeStory');
let ads = document.querySelectorAll('div[class^="adHeight"]');
removeDOMElement(close_story, ...ads);
}
else if (matchDomain('historyextra.com')) {
let article_masked = document.querySelector('.template-article__masked');
if (article_masked) {
let extra_pars = document.querySelectorAll('div.template-article__masked > p');
removeDOMElement(...extra_pars);
article_masked.classList.remove('template-article__masked');
}
let ad_banner = document.querySelector('.ad-banner-container');
removeDOMElement(ad_banner);
2021-01-22 04:58:33 -08:00
}
else if (matchDomain(usa_hearst_comm_domains)) {
2021-06-27 00:56:22 -07:00
let wrapper = document.querySelector('.belowMastheadWrapper');
removeDOMElement(wrapper);
}
2021-08-05 10:42:43 -07:00
else if (matchDomain('inc42.com')) {
let url = window.location.href;
if (!url.includes('/amp/')) {
let premium = document.querySelector('div.premium-container');
if (premium) {
removeDOMElement(premium);
window.location.href = url.split('?')[0] + 'amp/';
}
} else {
let plus_popup = document.querySelector('div#plus-pop');
if (plus_popup) {
removeDOMElement(plus_popup);
let expired = document.querySelectorAll('div[amp-access="p.showPageviewExpired"], div[amp-access="cm.maxViews AND NOT loggedIn"]');
removeDOMElement(...expired);
2021-11-30 08:35:45 -08:00
amp_unhide_access_hide('^="NOT p.showPageviewExpired"')
2021-08-05 10:42:43 -07:00
}
}
}
2021-12-19 02:12:32 -08:00
else if (matchDomain('indianexpress.com')) {
if (window.location.pathname.endsWith('/lite/'))
2022-03-06 08:43:09 -08:00
amp_unhide_access_hide('="metering.result=\'ALLOW_ACCESS\'"', '', 'amp-ad, amp-embed');
2021-12-19 02:12:32 -08:00
else {
2022-01-08 07:43:05 -08:00
let paywall = document.querySelector('div#pcl-rest-content[style]');
if (paywall)
paywall.removeAttribute('style');
let register = document.querySelector('div#app-pcl');
2021-12-19 02:12:32 -08:00
let ads = document.querySelectorAll('div[class^="adsbox"]');
2022-01-08 07:43:05 -08:00
removeDOMElement(register, ...ads);
2021-12-19 02:12:32 -08:00
}
}
2022-03-06 08:43:09 -08:00
else if (matchDomain('indiatoday.in')) {
if (window.location.pathname.match(/(\/amp)?\/magazine\//)) {
let url = window.location.href;
if (!url.includes('/amp/')) {
let paywall = document.querySelector('#csc-paywall');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
} else {
amp_unhide_access_hide('="granted"', '="NOT NOT granted"', 'amp-ad, amp-embed');
}
} else
csDoneOnce = true;
}
2021-07-19 08:53:49 -07:00
else if (matchDomain('infzm.com')) {
let url = window.location.href;
if (url.includes('/wap/#/')) {
let container = document.querySelector('section.container');
if (container)
container.classList.remove('container');
let overlay = document.querySelector('div.article-content[style]');
if (overlay)
overlay.removeAttribute('style');
}
}
else if (matchDomain('inkl.com')) {
2022-03-04 07:13:54 -08:00
// plus code in contentScript_once.js
2021-01-22 05:32:59 -08:00
}
2022-03-26 11:51:19 -07:00
else if (matchDomain('ipolitics.ca')) {
let login = document.querySelector('div.login');
if (login) {
removeDOMElement(login);
let json_script = document.querySelector('script#__NEXT_DATA__');
if (json_script && dompurify_loaded) {
let json = JSON.parse(json_script.innerText);
if (json && json.props.pageProps.post.content) {
let article_new = json.props.pageProps.post.content;
let article = document.querySelector('.post-header');
if (article) {
let parser = new DOMParser();
let doc = parser.parseFromString('<div>' + DOMPurify.sanitize(article_new) + '</div>', 'text/html');
let content_new = doc.querySelector('div');
article.appendChild(content_new);
}
}
}
}
}
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);
2022-03-08 10:04:40 -08:00
}, 500);
}
}
2021-08-26 23:36:32 -07:00
else if (matchDomain('law360.com')) {
window.setTimeout(function () {
let modal = document.querySelectorAll('div#NewsletterModal, div.modal-backdrop');
removeDOMElement(...modal);
2022-03-08 10:04:40 -08:00
}, 500);
2021-08-26 23:36:32 -07:00
}
2022-07-22 09:39:51 -07:00
else if (matchDomain('ledevoir.com')) {
let counter = document.querySelector('.paywall-breakpoint-wrapper');
removeDOMElement(counter);
}
2021-08-13 08:27:47 -07:00
else if (matchDomain('livelaw.in')) {
2022-05-15 09:25:30 -07:00
let paywall = document.querySelector('div#subscription_paid_message, div.subscribeNow');
2022-02-19 00:11:53 -08:00
if (paywall) {
2022-05-15 09:25:30 -07:00
let intro = document.querySelector('div.story');
removeDOMElement(paywall, intro);
let restricted_message = document.querySelector('div.restricted_message');
if (restricted_message)
restricted_message.classList.remove('restricted_message');
2021-08-13 08:27:47 -07:00
let paywall_content = document.querySelector('div.paywall-content.hide');
if (paywall_content)
paywall_content.classList.remove('hide');
}
2022-05-15 09:25:30 -07:00
let ads = document.querySelectorAll('inside-post-ad, amp-ad');
removeDOMElement(...ads);
2021-08-13 08:27:47 -07:00
}
else if (matchDomain('livemint.com')) {
if (window.location.pathname.includes('/amp-')) {
let paywall = document.querySelectorAll('[amp-access="NOT subscribed"]');
removeDOMElement(...paywall);
2022-08-18 11:02:12 -07:00
} else {
let paywall = document.querySelector('div.paywall');
if (paywall)
paywall.classList.remove('paywall');
let ads = document.querySelectorAll('[class^="ad"], [id^="ad"], #subscribeAd, .taboolaHeight');
removeDOMElement(...ads);
}
}
else if (matchDomain('magazine.atavist.com')) {
let bottom_notification = document.querySelector('div.bottom-notification');
let overlay = document.querySelector('div.notification-overlay');
removeDOMElement(bottom_notification, overlay);
let paywall = document.querySelector('body.paywall-notification-visible');
if (paywall)
paywall.classList.remove('paywall-notification-visible');
}
2021-01-24 01:25:11 -08:00
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');
2021-11-30 08:35:45 -08:00
removeDOMElement(meter, container_sponsored);
amp_unhide_subscr_section('.display-ad');
}
let ads = document.querySelectorAll('div.element--ad, div.j-ad');
removeDOMElement(...ads);
}
2021-08-10 08:23:42 -07:00
else if (matchDomain('medianama.com')) {
window.setTimeout(function () {
let modal = document.querySelector('div.modal');
removeDOMElement(modal);
2022-03-08 10:04:40 -08:00
}, 500);
2022-01-23 09:13:04 -08:00
function medianama_height(node) {
node.removeAttribute('style');
}
waitDOMAttribute('div.zox-post-body', 'DIV', 'style', medianama_height, true);
csDoneOnce = true;
2021-08-10 08:23:42 -07:00
}
2022-03-16 10:48:35 -07:00
else if (matchDomain('mid-day.com')) {
if (window.location.pathname.startsWith('/amp/')) {
amp_unhide_access_hide('="granted"', '="NOT granted"', 'amp-ad, amp-embed, [class*="BannerAd"]');
} else {
let paywall = document.querySelector('div#widget-_csc');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
} else {
let read_more = document.querySelector('#read-more-my');
if (read_more)
read_more.click();
}
}
}
else if (matchDomain('nation.africa')) {
let datawall_content = document.querySelector('.datawall-content');
if (datawall_content)
datawall_content.classList.remove('datawall-content');
let div_hidden = document.querySelectorAll('[data="datawall-content"]');
for (let elem of div_hidden)
elem.removeAttribute('style');
let hidden_images = document.querySelectorAll('img.lazy-img:not([src])[data-srcset]');
for (let hidden_image of hidden_images) {
hidden_image.classList.remove('lazy-img');
hidden_image.setAttribute('src', hidden_image.getAttribute('data-srcset').split(',')[1].split(' ')[0]);
}
2021-01-24 02:04:06 -08:00
}
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) {
2021-07-03 23:43:34 -07:00
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);
2021-01-26 12:27:21 -08:00
}
else if (matchDomain('nationalreview.com')) {
2022-09-04 00:12:52 -07:00
if (!window.location.pathname.endsWith('/amp/')) {
let paywall = document.querySelector('div.continue-reading');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
2021-10-13 08:59:02 -07:00
}
2022-01-09 08:27:53 -08:00
let adverts = document.querySelectorAll('amp-ad, .ad-unit--center, amp-connatix-player');
2021-10-13 08:59:02 -07:00
removeDOMElement(...adverts);
2021-01-28 08:33:48 -08:00
}
2022-06-24 11:57:20 -07:00
else if (matchDomain('nautil.us')) {
// plus code in contentScript_once.js
let hidden_images = document.querySelectorAll('img[src^="data:image"][data-src]');
for (let hidden_image of hidden_images)
hidden_image.src = hidden_image.getAttribute('data-src');
let empty_video_iframes = document.querySelectorAll('iframe[src="about:blank"][data-litespeed-src]');
for (let empty_video_iframe of empty_video_iframes)
empty_video_iframe.src = empty_video_iframe.getAttribute('data-litespeed-src');
window.setTimeout(function () {
let banners = document.querySelectorAll('div[class^="a__sc-np"], div.subscibe-bar');
removeDOMElement(...banners);
let overflows = document.querySelectorAll('html[style], body[style]');
for (let overflow of overflows)
overflow.removeAttribute('style');
}, 1000);
}
else if (matchDomain('newleftreview.org')) {
2021-07-07 09:30:02 -07:00
window.setTimeout(function () {
let url = window.location.href;
let paywall = document.querySelector('div.promo-wrapper');
if (paywall) {
removeDOMElement(paywall);
2022-04-09 08:07:08 -07:00
csDoneOnce = true;
2022-08-02 08:26:48 -07:00
let url_cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url.split('?')[0];
replaceDomElementExt(url_cache, true, false, 'div.article-page');
2021-07-07 09:30:02 -07:00
}
2022-03-08 10:04:40 -08:00
}, 500);
}
2021-09-29 11:42:43 -07:00
else if (matchDomain('newrepublic.com')) {
2021-11-09 08:18:15 -08:00
let pw_popups = document.querySelector('div#pwPopups');
let ads = document.querySelectorAll('.ad-unit, .ad-container');
removeDOMElement(pw_popups, ...ads);
2021-09-29 11:42:43 -07:00
}
2022-08-24 11:28:09 -07:00
else if (matchDomain('newscientist.com')) {
let url = window.location.href;
let paywall = document.querySelector('#subscription-barrier');
if (paywall) {
removeDOMElement(paywall);
csDoneOnce = true;
let url_cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url.split('?')[0];
replaceDomElementExt(url_cache, true, false, 'div.article-body');
}
window.setTimeout(function () {
let lazy_images = document.querySelectorAll('img.lazyload[data-src]:not([src]');
for (let elem of lazy_images)
elem.src = elem.getAttribute('data-src').split('?')[0] + '?width=800';
}, 1000);
}
2021-12-11 10:12:00 -08:00
else if (matchDomain('newsday.com')) {
if (window.location.pathname.startsWith('/amp/')) {
amp_unhide_access_hide('="AccessLevel = \'Full Content Access\' OR Error = true"', '="AccessLevel = \'Page View Limit\'"');
}
}
2021-12-08 08:45:10 -08:00
else if (matchDomain(['nola.com', 'theadvocate.com'])) {
if (window.location.pathname.endsWith('.amp.html')) {
let body_hidden = document.querySelector('.site-container');
if (body_hidden)
body_hidden.setAttribute('style', 'display:block;');
}
}
else if (matchDomain('nybooks.com')) {
let paywall_article = document.querySelector('.paywall-article');
if (paywall_article)
paywall_article.classList.remove('paywall-article');
2022-05-23 10:31:27 -07:00
let banner = document.querySelector('div.toast-cta, div.inline-ad');
removeDOMElement(banner);
}
else if (matchDomain('nytimes.com')) {
2022-08-25 12:27:34 -07:00
let banners = document.querySelectorAll('div[data-testid="inline-message"], div[id^="ad-"], div.expanded-dock');
removeDOMElement(...banners);
2021-01-30 03:56:09 -08:00
}
2022-04-18 11:34:59 -07:00
else if (matchDomain('nzherald.co.nz')) {
// plus code in contentScript_once.js
let article_content = document.querySelector('.article__content');
if (article_content) {
let premium = document.querySelector('span.ellipsis');
if (premium && dompurify_loaded) {
premium.classList.remove('ellipsis');
let article_offer = document.querySelector('.article-offer');
removeDOMElement(article_offer);
let css_selector = article_content.querySelectorAll('p[style]')[1].getAttribute('class');
let hidden_not_pars = article_content.querySelectorAll('.' + css_selector + ':not(p)');
for (let hidden_not_par of hidden_not_pars) {
hidden_not_par.classList.remove(css_selector);
hidden_not_par.removeAttribute('style');
}
let hidden_pars = article_content.querySelectorAll('p.' + css_selector);
let par_html, par_dom;
let parser = new DOMParser();
for (let hidden_par of hidden_pars) {
2022-07-03 08:52:27 -07:00
let par_html = parser.parseFromString('<div style="margin: 10px 0px; font-size: 17px; line-height: 1.6">' + DOMPurify.sanitize(hidden_par.innerHTML) + '</div>', 'text/html');
2022-04-18 11:34:59 -07:00
let par_dom = par_html.querySelector('div');
article_content.insertBefore(par_dom, hidden_par);
}
let first_span = document.querySelector('p > span');
if (first_span)
first_span.removeAttribute('class');
}
}
let premium_toaster = document.querySelector('#premium-toaster');
removeDOMElement(premium_toaster);
}
2022-07-07 23:10:16 -07:00
else if (matchDomain('outlookbusiness.com')) {
let paywall = document.querySelector('div#csc-paywall');
if (paywall) {
removeDOMElement(paywall);
let json_script = document.querySelector('script#__NEXT_DATA__');
if (json_script && dompurify_loaded) {
let json = JSON.parse(json_script.innerText);
if (json && json.props.initialState.dashboard.ARTICLE_POST_DETAIL_API.data.article_data.description) {
let article_new = json.props.initialState.dashboard.ARTICLE_POST_DETAIL_API.data.article_data.description;
let article = document.querySelector('div.story-content');
if (article) {
article.innerHTML = '';
let parser = new DOMParser();
let doc = parser.parseFromString('<div>' + DOMPurify.sanitize(article_new) + '</div>', 'text/html');
let content_new = doc.querySelector('div');
article.appendChild(content_new);
}
}
}
}
}
2022-04-17 23:13:57 -07:00
else if (matchDomain('outlookindia.com')) {
let paywall = document.querySelector('div.paywall');
if (paywall) {
removeDOMElement(paywall);
let json_script = getArticleJsonScript();
if (json_script) {
let json = JSON.parse(json_script.text);
if (json) {
let json_text = parseHtmlEntities(json.articleBody).replace(/\n/g, "$&\r\n");
let content = document.querySelector('div#articleBody');
if (json_text && content) {
content.innerHTML = '';
let article_new = document.createElement('p');
article_new.innerText = json_text;
content.appendChild(article_new);
}
}
}
}
}
2022-04-30 02:25:15 -07:00
else if (matchDomain('puck.news')) {
let paywall = document.querySelector('.paywall');
if (paywall) {
removeDOMElement(paywall);
let overlay = document.querySelector('body.paywall-active');
if (overlay)
overlay.classList.remove('paywall-active');
let article_style = document.querySelector('article[style]');
if (article_style)
article_style.removeAttribute('style');
}
}
2021-11-13 02:57:24 -08:00
else if (matchDomain('quora.com')) {
2022-02-03 10:11:34 -08:00
let overlays = document.querySelectorAll('div[class*="_overlay"]');
removeDOMElement(...overlays);
2021-11-13 02:57:24 -08:00
let mask_image = document.querySelector('div.ePDXbR');
if (mask_image)
mask_image.classList.remove('ePDXbR');
}
else if (matchDomain('qz.com')) {
2022-05-30 08:10:29 -07:00
if (window.location.pathname.startsWith('/emails/')) {
let paywall = document.querySelector('div#email-content[class]');
if (paywall) {
paywall.removeAttribute('class');
let login = pageContains('h2[class]', /^This story is exclusive to/);
removeDOMElement(login[0].parentElement);
let noscroll = document.querySelector('iframe[scrolling]');
if (noscroll)
noscroll.removeAttribute('scrolling');
}
2021-06-29 12:13:42 -07:00
}
2021-01-30 10:17:44 -08:00
}
2022-03-06 08:43:09 -08:00
else if (matchDomain('rugbypass.com')) {
if (window.location.pathname.startsWith('/plus/')) {
let paywall = document.querySelector('.premium-fold-bottom');
if (paywall) {
paywall.classList.remove('premium-fold-bottom');
let offer = document.querySelector('.plus-article-offer');
removeDOMElement(offer);
let fade = document.querySelector('.fade');
if (fade)
fade.classList.remove('fade');
}
} else
csDoneOnce = true;
2022-03-05 01:39:21 -08:00
}
2022-01-02 10:20:45 -08:00
else if (matchDomain('science.org')) {
let paywall = document.querySelector('div.alert-read-limit');
removeDOMElement(paywall);
let overlay = document.querySelector('body.alert-read-limit__overlay');
if (overlay)
overlay.classList.remove('alert-read-limit__overlay');
}
2022-03-15 10:34:00 -07:00
else if (matchDomain('scmp.com')) {
if (window.location.href.includes('/amp.')) {
let div_hidden = document.querySelectorAll('div.article-body[amp-access][amp-access-hide]');
for (let elem of div_hidden)
elem.removeAttribute('amp-access-hide');
let default_meters = document.querySelectorAll('div.default-meter, div#archive-article-meter');
let adverts = document.querySelectorAll('amp-ad, div.ad-banner, div.advert-fly-carpet-container, div.inline-advert');
removeDOMElement(...default_meters, ...adverts);
} else
csDoneOnce = true;
}
else if (matchDomain('seekingalpha.com')) {
let url = window.location.href;
let locked = document.querySelector('div[data-test-id="post-locked-banner"]');
if (locked && !url.includes('/amp/')) {
window.setTimeout(function () {
window.location.href = url.replace('seekingalpha.com/', 'seekingalpha.com/amp/');
2022-03-08 10:04:40 -08:00
}, 500);
} else if (url.includes('/amp/')) {
2021-11-30 08:35:45 -08:00
amp_unhide_access_hide('*="premium_access OR"', '', '.ad-wrap');
let paywall = document.querySelector('[class*="paywall-container"]');
2021-11-30 08:35:45 -08:00
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);
2021-02-13 08:46:26 -08:00
}
2022-05-27 06:11:26 -07:00
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')) {
2022-07-07 10:12:23 -07:00
if (!window.location.pathname.startsWith('/amp/')) {
let paywall = document.querySelector('div.fader');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
}
let banners = document.querySelectorAll('#scrollerCTA, #botCta');
removeDOMElement(...banners);
2021-02-13 09:11:44 -08:00
}
2022-03-27 09:25:00 -07:00
else if (matchDomain('spglobal.com')) {
let overlay = document.querySelector('.article__overlay');
removeDOMElement(overlay);
let html_noscroll = document.querySelector('html[class]');
if (html_noscroll)
html_noscroll.removeAttribute('class');
}
else if (matchDomain('staradvertiser.com')) {
let url = window.location.href.split('?')[0];
if (url.endsWith('/amp/')) {
2021-11-30 08:35:45 -08:00
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);
2021-02-18 10:47:02 -08:00
}
else if (matchDomain('stocknews.com')) {
let hideme = document.querySelector('div#hideme');
removeDOMElement(hideme);
let blurmes = document.querySelectorAll('div[id^="blurme"]');
for (let i = 0; i < blurmes.length; i++)
blurmes[i].setAttribute('id', 'blurmenot' + i);
2021-02-27 05:20:40 -08:00
}
else if (matchDomain('stratfor.com')) {
2021-09-28 11:41:49 -07:00
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'));
2021-10-25 10:05:39 -07:00
let url = window.location.href.split('?')[0];
if (url.match(/(\/(\d){4}-([a-z]|-)+-forecast(-([a-z]|-)+)?|-forecast-(\d){4}-([a-z]|[0-9]|-)+)$/)) {
2022-03-15 10:34:00 -07:00
let json_script = document.querySelector('script#__NEXT_DATA__');
2021-10-25 10:05:39 -07:00
if (json_script && dompurify_loaded) {
let json = JSON.parse(json_script.innerText);
if (json && json.props.pageProps.data) {
let overview_div = document.querySelector('div[class^="overview_overview__"] > div');
if (overview_div) {
let data = json.props.pageProps.data;
let parser = new DOMParser();
let data_overview = data.overview;
if (!parseHtmlEntities(data_overview).includes(data.teaser_body))
data_overview = '<p>' + data.teaser_body + '</p>' + data_overview;
let doc = parser.parseFromString('<div>' + DOMPurify.sanitize(data_overview + '<p><h2>Sections</h2></p>') + '</div>', 'text/html');
2021-10-25 10:05:39 -07:00
let content_new = doc.querySelector('div');
let sections = data.section;
for (let section of sections) {
let section_link = document.createElement('a');
section_link.innerText = section.title;
section_link.href = 'https://' + window.location.hostname + '/' + section.path_alias;
content_new.appendChild(section_link);
content_new.appendChild(document.createElement('br'));
}
overview_div.parentNode.replaceChild(content_new, overview_div);
csDoneOnce = true;
}
}
}
waitDOMElement('div.paywall-banner', 'DIV', removeDOMElement, false);
} else if (url.match(/\/article\/.+-forecast(-.+)?\//)) {
let next_section_buttons = document.querySelectorAll('div[class^="nextSection_nextSection__"] > button');
for (let elem of next_section_buttons) {
let section_link = document.createElement('a');
section_link.innerText = elem.innerText;
section_link.href = url.replace(/[^\/]+$/, '') + elem.innerText.split(': ')[1].toLowerCase().split(' ').filter(x => !['a', 'an', 'of', 'the'].includes(x)).join('-');
elem.parentNode.replaceChild(section_link, elem);
}
}
}
2022-07-19 12:25:15 -07:00
else if (matchDomain('studocu.com')) {
window.setTimeout(function () {
let paywall = document.querySelector('div._de9e5fdb76af');
if (paywall) {
let banners = document.querySelectorAll('div._d18a99c0d544, div#premium-page-header');
removeDOMElement(paywall, ...banners);
let blurred_pages = document.querySelectorAll('div.page-content[style*="filter: blur"]');
for (let blurred_page of blurred_pages) {
let page = document.createElement('span');
page.setAttribute('class', 'page-content');
page.appendChild(blurred_page.firstChild);
blurred_page.parentNode.replaceChild(page, blurred_page);
}
}
}, 1000);
}
else if (matchDomain('techinasia.com')) {
let paywall = document.querySelector('.paywall-content');
2021-10-22 03:36:25 -07:00
if (paywall && dompurify_loaded) {
paywall.classList.remove('paywall-content');
2021-05-02 07:14:24 -07:00
let url = window.location.href;
2021-10-15 07:05:53 -07:00
let url_xhr = url.replace('.com/', '.com/wp-json/techinasia/2.0/posts/').replace('/visual-story/', '/');
2021-05-02 07:14:24 -07:00
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%"');
2021-05-02 07:14:24 -07:00
let content = document.querySelector('div.content');
if (json_text && content) {
let parser = new DOMParser();
let doc = parser.parseFromString('<div class="jsx-1794864983 content">' + DOMPurify.sanitize(json_text) + '</div>', 'text/html');
2021-05-02 07:14:24 -07:00
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);
2021-03-01 09:04:04 -08:00
}
2022-06-30 11:25:58 -07:00
else if (matchDomain('theathletic.com')) {
if (!window.location.search.match(/(\?|&)amp/)) {
2022-08-04 03:37:48 -07:00
let paywall = document.querySelector('div#slideup-paywall');
if (paywall) {
let overlays = document.querySelectorAll('div[id*="overlay"], div:empty:not([data-rjs])');
2022-08-04 03:37:48 -07:00
removeDOMElement(paywall, ...overlays);
let body = document.querySelector('body');
if (body) {
body.style.overflow = 'visible';
body.style.position = 'relative';
}
} else {
let headline_paywall = document.querySelectorAll('a.headline-paywall');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (headline_paywall.length && amphtml) {
removeDOMElement(...headline_paywall);
window.setTimeout(function () {
window.location.href = amphtml.href;
}, 1000);
}
2022-06-30 11:25:58 -07:00
}
} else {
amp_unhide_subscr_section();
2022-08-02 14:39:21 -07:00
amp_unhide_access_hide('', '*="NOT granted"');
2022-06-30 11:25:58 -07:00
}
2022-08-04 03:37:48 -07:00
let apron = document.querySelector('div#free-apron-cta, div.slideup-free-apron-container');
removeDOMElement(apron);
2022-06-30 11:25:58 -07:00
}
else if (matchDomain('theatlantic.com')) {
let banner = document.querySelector('.c-nudge__container,.c-non-metered-nudge');
removeDOMElement(banner);
2021-03-07 05:02:58 -08:00
}
2021-08-13 06:29:49 -07:00
else if (matchDomain('thedailybeast.com')) {
let paywall = document.querySelector('div.Body__paywall-container');
if (paywall) {
removeDOMElement(paywall);
let json_script = document.querySelector('script[displayName="initialState"]');
if (json_script) {
2021-08-19 00:02:51 -07:00
let json_str = json_script.text.substring(json_script.textContent.indexOf('{'));
try {
let json = JSON.parse(json_str);
if (json.body) {
let pars = json.body.sections;
let cards = json.body.cards;
if (pars) {
let mobile_doc = document.querySelector('div.Mobiledoc');
if (mobile_doc) {
let mobile_doc_text = mobile_doc.innerText.replace(/(\r|\n)/g, '');
for (let elem of pars) {
let par_elem = '';
if (elem[0] === 1) {
if (elem[1] === 'p') {
let par = '';
for (let part of elem[2])
par += part[3];
if (par && !mobile_doc_text.includes(par)) {
par_elem = document.createElement('p');
par_elem.innerText = par;
}
}
} else if (elem[0] === 10) {
if (cards && cards[elem[1]]) {
let card = cards[elem[1]];
if (card[0] === 'pt-image') {
par_elem = document.createElement('p');
let par_fig = document.createElement('figure');
let par_img = document.createElement('img');
par_img.src = card[1].url;
par_fig.appendChild(par_img);
par_elem.appendChild(par_fig);
let par_cap = document.createElement('figcaption');
par_cap.innerText = card[1].title + ' ' + card[1].credit;
par_elem.appendChild(par_cap);
} else if (card[0] === 'pt-fancy-links-card') {
par_elem = document.createElement('p');
let par_link = document.createElement('a');
par_link.href = card[1].links;
par_link.innerText = card[1].linksData[0].long_headline;
par_elem.appendChild(par_link);
}
}
}
if (par_elem)
mobile_doc.appendChild(par_elem);
2021-08-13 06:29:49 -07:00
}
2021-08-19 00:02:51 -07:00
}
2021-08-13 06:29:49 -07:00
}
}
2021-08-19 00:02:51 -07:00
csDoneOnce = true;
} catch (err) {
console.log(err);
2021-08-13 06:29:49 -07:00
}
}
}
}
2021-04-14 09:42:48 -07:00
else if (matchDomain('thediplomat.com')) {
let preview = document.querySelector('.dpl-preview');
if (preview)
preview.classList.remove('dpl-preview');
}
else if (matchDomain('theglobeandmail.com')) {
2022-09-04 00:12:52 -07:00
let article_body_subscribed = document.querySelector('.c-article-body--subscribed');
if (article_body_subscribed)
article_body_subscribed.removeAttribute('class');
let lazy_images = document.querySelectorAll('img.lazyimage[src^="data:image/"][data-src]');
for (let elem of lazy_images)
elem.src = elem.getAttribute('data-src');
let banners = document.querySelectorAll('div.c-ad, div#subscription-pencil-area, div.marketing-container-wrapper');
2022-04-07 11:13:39 -07:00
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', {}));
2021-03-13 06:57:46 -08:00
}
2022-06-26 01:48:25 -07:00
else if (matchDomain('theinitium.com')) {
let paywall = document.querySelector('section.c-wall');
removeDOMElement(paywall);
}
2022-05-18 22:55:44 -07:00
else if (matchDomain('thelawyersdaily.ca')) {
if (window.location.pathname.startsWith('/amp/')) {
ampToHtml();
} else {
let modal = document.querySelectorAll('#NewsletterModal, .modal-backdrop');
removeDOMElement(...modal);
}
2022-05-18 22:55:44 -07:00
}
2021-04-28 00:14:33 -07:00
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);
2021-03-16 10:10:41 -07:00
}
2021-06-12 09:19:36 -07:00
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;');
2021-03-16 10:10:41 -07:00
}
else if (matchDomain('timeshighereducation.com')) {
let paywall_cta = document.querySelector('div.paywall-cta');
if (paywall_cta) {
paywall_cta.removeAttribute('style');
let hidden_divs = document.querySelectorAll('div[style="display: none;"]');
for (let hidden_div of hidden_divs)
hidden_div.removeAttribute('style');
let paywall_fade = document.querySelector('div.paywall-fade');
if (paywall_fade)
paywall_fade.classList.remove('paywall-fade');
}
2021-10-05 09:19:10 -07:00
let hidden_images = document.querySelectorAll('img.b-lazy[src^="data:image/"][data-src]');
for (let hidden_image of hidden_images) {
hidden_image.setAttribute('src', hidden_image.getAttribute('data-src'));
hidden_image.classList.remove('b-lazy');
hidden_image.parentElement.classList.remove('media--loading');
}
let ads = document.querySelectorAll('div[id^="div-gpt-in-article-ad-"], div[class^="the-dfp__in-article-ATD"]');
removeDOMElement(...ads);
2021-03-20 09:16:15 -07:00
}
2021-07-23 08:47:24 -07:00
else if (matchDomain(timesofindia_domains)) {
2022-06-26 23:10:12 -07:00
let url = window.location.href;
2021-07-23 08:47:24 -07:00
let region_block = document.querySelector('div.plan-popup.active');
if (region_block) {
removeDOMElement(region_block);
let overflow = document.querySelector('html[style]');
if (overflow)
overflow.removeAttribute('style');
}
2021-12-21 08:38:00 -08:00
if (window.location.pathname.includes('/amp_')) {
let paywall = document.querySelector('div.paywall');
if (paywall && dompurify_loaded) {
let contentblocker = document.querySelector('div#contentblocker');
2022-05-20 07:31:14 -07:00
let bottom_banner = document.querySelector('#bottom_banner');
removeDOMElement(contentblocker, bottom_banner);
2021-12-21 08:38:00 -08:00
let preview = document.querySelector('div.article-txt');
if (preview) {
let parser = new DOMParser();
2022-05-20 07:31:14 -07:00
let doc = parser.parseFromString('<div style="margin: 0px 50px;">' + DOMPurify.sanitize(paywall.innerHTML, {ADD_TAGS: ['amp-img']}) + '</div>', 'text/html');
2021-12-21 08:38:00 -08:00
let article = doc.querySelector('div');
preview.parentNode.replaceChild(article, preview);
preview.classList.remove('prime-bottom-blur');
}
}
let amp_images = document.querySelectorAll('div.inline-imgecontent > amp-img');
for (let amp_img of amp_images) {
let img_new = document.createElement('img');
img_new.src = amp_img.getAttribute('src');
amp_img.parentNode.replaceChild(img_new, amp_img);
img_new.parentElement.classList.remove('inline-imgecontent');
img_new.parentElement.style = 'text-align: center;';
}
2022-05-20 07:31:14 -07:00
} else {
let paywall = document.querySelector('div#story-blocker');
let amphtml = document.querySelector('link[rel="amphtml"]');
2022-06-26 23:10:12 -07:00
if (!amphtml)
amphtml = {href: url.replace('/timesofindia.indiatimes.com/', '/m.timesofindia.com/').replace('/articleshow/', '/amp_articleshow/')};
2022-05-20 07:31:14 -07:00
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
2021-12-21 08:38:00 -08:00
}
2021-07-23 08:47:24 -07:00
}
2021-07-23 07:11:57 -07:00
else if (matchDomain(no_nhst_media_domains)) {
2021-07-11 02:21:02 -07:00
let url = window.location.href;
2021-07-23 07:11:57 -07:00
if (url.includes('.tradewinds.com/markets/')) {
2021-07-11 02:21:02 -07:00
let paywall = document.querySelector('iframe[src]');
removeDOMElement(paywall);
let overflow = document.querySelector('body[style]');
if (overflow)
overflow.removeAttribute('style');
let blurred = document.querySelector('body > div[style]');
if (blurred)
blurred.removeAttribute('style');
} else {
window.setTimeout(function () {
let paywall = document.querySelector('iframe#paywall-iframe');
2021-10-22 03:36:25 -07:00
if (paywall && dompurify_loaded) {
2022-03-07 10:21:13 -08:00
let article = paywall.parentNode;
2021-07-11 02:21:02 -07:00
removeDOMElement(paywall);
fetch(url)
.then(response => {
if (response.ok) {
response.text().then(html => {
let split1 = html.split('window.__INITIAL_STATE__=')[1];
2022-03-07 10:21:13 -08:00
let state = (split1.split('};')[0] + '}').split('</script>')[0];
2021-07-11 02:21:02 -07:00
if (state) {
let json = JSON.parse(state);
if (json) {
let json_text = json.article.body;
let parser = new DOMParser();
2021-07-23 08:47:24 -07:00
let doc = parser.parseFromString('<div>' + DOMPurify.sanitize(json_text, {ADD_ATTR: ['itemprop'], ADD_TAGS: ['link']}) + '</div>', 'text/html');
2021-07-11 02:21:02 -07:00
let article_new = doc.querySelector('div');
if (article_new) {
if (article)
2022-03-07 10:21:13 -08:00
article.appendChild(article_new);
2021-07-11 02:21:02 -07:00
}
}
}
})
}
})
}
2022-03-08 10:04:40 -08:00
}, 500);
2021-07-11 02:21:02 -07:00
}
}
else if (matchDomain(usa_conde_nast_domains)) {
if (window.location.pathname.endsWith('/amp')) {
amp_unhide_subscr_section('amp-ad, amp-embed, .ad');
} else {
let paywall_bar = document.querySelector('.paywall-bar');
removeDOMElement(paywall_bar);
}
}
else if (matchDomain(usa_craincomm_domains)) {
let body_hidden = document.querySelector('body[class]');
if (body_hidden)
body_hidden.removeAttribute('class');
2021-08-23 11:49:44 -07:00
let lazy_images = document.querySelectorAll('img.lazy[data-src]');
for (let lazy_image of lazy_images) {
lazy_image.src = lazy_image.getAttribute('data-src');
lazy_image.removeAttribute('class');
}
let lazy_sources = document.querySelectorAll('source[srcset^="data:image"]');
removeDOMElement(...lazy_sources);
}
2022-07-30 23:59:27 -07:00
else if (matchDomain(usa_genomeweb_domains)) {
let banners = document.querySelectorAll('div.footer__ads-footer');
removeDOMElement(...banners);
}
2022-01-28 07:05:18 -08:00
else if (matchDomain(usa_outside_mag_domains)) {
let paywall = document.querySelector('div.o-membership-overlay');
if (paywall) {
let is_gated = document.querySelectorAll('[class*="is-gated"]');
for (let elem of is_gated)
removeClassesByPrefix(elem, 'is-gated');
removeDOMElement(paywall);
}
2022-02-25 09:11:16 -08:00
if (matchDomain('cyclingtips.com')) {
2022-08-12 22:51:11 -07:00
localStorage.removeItem('av');
2022-02-25 09:11:16 -08:00
let ads = document.querySelectorAll('div[data-block-name="ads"], div#takeover');
removeDOMElement(...ads);
}
2022-01-28 07:05:18 -08:00
}
else if (matchDomain(usa_tribune_domains)) {
let overlay = document.querySelector('div#zephr-overlay');
removeDOMElement(overlay);
}
2021-05-06 10:49:57 -07:00
else if (matchDomain('usatoday.com')) {
2021-12-09 08:46:46 -08:00
if (window.location.hostname.startsWith('amp.')) {
amp_unhide_access_hide('="gup.hasAssetAccess"', '', 'div[class*="ad-"]');
} else {
let roadblock = document.querySelector('.roadblock-container');
if (roadblock) {
removeDOMElement(roadblock);
article_next = document.querySelector('article.next-in-depth-story > div.article-inner');
if (article_next) {
let url = article_next.getAttribute('data-url');
let weblink = document.createElement('a');
weblink.href = url;
weblink.innerText = 'open next in-depth story';
article_next.appendChild(weblink);
}
2021-05-06 10:49:57 -07:00
}
}
}
else if (matchDomain('venturebeat.com')) {
window.setTimeout(function () {
let paywall = document.querySelector('div.paywall');
if (paywall)
paywall.classList.remove('paywall');
2022-03-08 10:04:40 -08:00
}, 500);
}
2022-04-18 10:42:07 -07:00
else if (matchDomain('voguebusiness.com')) {
if (window.location.pathname.endsWith('/amp')) {
amp_unhide_subscr_section();
} else {
let paywall = document.querySelector('div[class*="PaywallInlineBarrier"]');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
}
}
else if (matchDomain('washingtonpost.com')) {
2022-03-15 10:34:00 -07:00
let leaderboard = document.querySelector('#leaderboard-wrapper');
let adverts = document.querySelectorAll('div[data-qa$="-ad"]');
removeDOMElement(leaderboard, ...adverts);
2021-04-05 10:56:27 -07:00
}
2022-03-19 09:24:28 -07:00
else if (matchDomain('winnipegfreepress.com')) {
let ads = document.querySelectorAll('.billboard-ad-space, .ad, .article-ad, .fixed-sky');
removeDOMElement(...ads);
}
2021-10-05 23:46:11 -07:00
else if (matchDomain('wsj.com')) {
2021-08-01 01:29:39 -07:00
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();
}
2022-04-01 07:03:49 -07:00
let wsj_ads = document.querySelectorAll('div[class*="wsj-ad"], div[class*="BodyAdWrapper"]');
removeDOMElement(...wsj_ads);
2021-08-01 01:29:39 -07:00
if (url.includes('/amp/')) {
let masthead_link = document.querySelector('div.masthead > a[href*="/articles/"]');
if (masthead_link)
masthead_link.href = 'https://www.wsj.com';
2021-11-30 08:35:45 -08:00
amp_unhide_subscr_section();
2021-08-01 01:29:39 -07:00
} else {
2022-07-06 11:03:16 -07:00
let snippet = document.querySelector('.snippet-promotion, div#cx-snippet-overlay');
2021-11-02 11:00:31 -07:00
let wsj_pro = document.querySelector('meta[name="page.site"][content="wsjpro"]');
if (snippet || wsj_pro) {
removeDOMElement(snippet, wsj_pro);
window.location.href = url.replace('wsj.com', 'wsj.com/amp');
}
2021-08-01 01:29:39 -07:00
}
2021-04-07 13:24:37 -07:00
}
2022-07-31 01:43:50 -07:00
else if ((domain = matchDomain(usa_lee_ent_domains)) || document.querySelector('a[href^="https://bloxcms.com"][title^="BLOX"]')) {
if (window.location.pathname.endsWith('.amp.html')) {
2022-07-31 01:43:50 -07:00
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');
2022-07-31 01:43:50 -07:00
} else if (!domain) {
let subscriber_only = document.querySelectorAll('div.subscriber-only[style]:not(.encrypted-content)');
for (let elem of subscriber_only)
elem.removeAttribute('style');
}
}
2022-07-26 09:20:11 -07:00
else if ((domain = matchDomain(usa_mcc_domains)) ||
(window.location.hostname.startsWith('account.') && document.querySelector('script[src*=".mcclatchyinteractive.com/"]')) ||
(window.location.href.match(/\/\/amp\..+\.com\/(.+\/)?article(\d){8,}\.html/) && document.querySelector('a[href^="https://classifieds.mcclatchy.com/"]'))) {
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';
2022-03-08 10:04:40 -08:00
}, 500);
} else if (url.includes('amp.' + domain + '/')) {
2021-11-30 08:35:45 -08:00
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.');
}
}
2022-03-30 09:22:20 -07:00
else if (matchDomain(usa_mng_domains) || (window.location.href.match(/\.com\/(\d){4}\/(\d){2}\/(\d){2}\/.+\/amp\//) && document.querySelector('amp-img#paywall[src*=".com/wp-content/plugins/dfm-amp-mods/"]'))) {
if (window.location.pathname.endsWith('/amp/')) {
2021-11-30 08:35:45 -08:00
amp_unhide_subscr_section('amp-ad, amp-embed');
2021-08-16 13:49:46 -07:00
}
}
else
csDone = true;
}
2021-10-17 12:14:29 -07:00
if ((csDone && (bg2csData !== undefined)) || csDoneOnce) {
2021-04-25 04:45:26 -07:00
addDivBpcDone();
2021-10-17 12:14:29 -07:00
if (csDone && (bg2csData !== undefined) && !bg2csData.amp_unhide)
2021-07-03 23:43:34 -07:00
ext_api.runtime.sendMessage({csDone: true});
2021-04-25 04:45:26 -07:00
}
2021-04-07 13:24:37 -07:00
} // end div_bpc_done
// General Functions
2019-10-19 14:24:33 -07:00
function removeDOMElement(...elements) {
for (let element of elements) {
if (element)
element.remove();
}
2019-10-22 04:55:48 -07:00
}
2019-10-08 08:40:34 -07:00
2021-04-07 13:24:37 -07:00
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();
}
2021-04-07 13:24:37 -07:00
}
}
}
}).observe(document, {
subtree: true,
childList: true
});
2021-04-07 13:24:37 -07:00
}
2021-07-10 10:02:36 -07:00
function waitDOMAttribute(selector, tagName = '', attributeName = '', callback, multiple = false) {
let targetNode = document.querySelector(selector);
if (!targetNode)
return;
2021-07-10 10:02:36 -07:00
new window.MutationObserver(function (mutations) {
for (let mutation of mutations) {
if (mutation.target.attributes[attributeName]) {
callback(mutation.target);
if (!multiple)
this.disconnect();
}
}
}).observe(targetNode, {
attributes: true,
attributeFilter: [attributeName]
});
}
2021-04-07 13:24:37 -07:00
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);
2021-04-07 13:24:37 -07:00
}
2021-12-22 23:43:03 -08:00
function matchDomain(domains, hostname = window.location.hostname) {
2021-08-17 09:36:07 -07:00
let matched_domain = false;
if (typeof domains === 'string')
domains = [domains];
domains.some(domain => (hostname === domain || hostname.endsWith('.' + domain)) && (matched_domain = domain));
return matched_domain;
}
2022-01-19 12:23:59 -08:00
function replaceDomElementExt(url, proxy, base64, selector, text_fail = '', selector_source = selector) {
2022-04-09 08:07:08 -07:00
if (proxy) {
if (!text_fail) {
if (url.includes('webcache.googleusercontent.com'))
text_fail = 'BPC > failed to load from Google webcache: '
}
ext_api.runtime.sendMessage({request: 'getExtSrc', data: {url: url, selector: selector, selector_source: selector_source, base64: base64, text_fail: text_fail}});
} else {
fetch(url)
.then(response => {
let article = document.querySelector(selector);
if (response.ok) {
response.text().then(html => {
replaceDomElementExtSrc(url, html, false, base64, selector, text_fail, selector_source);
});
} else {
if (text_fail && article) {
replaceTextFail(article, proxy, text_fail)
}
}
2022-04-09 08:07:08 -07:00
}).catch(function (err) {
false;
});
}
}
function replaceDomElementExtSrc(url, html, proxy, base64, selector, text_fail = '', selector_source = selector) {
let article = document.querySelector(selector);
if (html) {
if (base64) {
html = decode_utf8(atob(html));
selector_source = 'body';
}
let parser = new DOMParser();
window.setTimeout(function () {
2022-08-05 23:22:07 -07:00
let doc = parser.parseFromString(DOMPurify.sanitize(html, {ADD_ATTR: ['layout', 'itemprop'], ADD_TAGS: ['amp-img', 'iframe']}), 'text/html');
2022-04-09 08:07:08 -07:00
//console.log(DOMPurify.removed);
let article_new = doc.querySelector(selector_source);
if (article_new) {
if (article && article.parentNode)
article.parentNode.replaceChild(article_new, article);
}
2022-04-09 08:07:08 -07:00
}, 200);
} else {
replaceTextFail(url, article, proxy, text_fail);
}
}
function replaceTextFail(url, article, proxy, text_fail) {
if (text_fail && article) {
let text_fail_div = document.createElement('div');
text_fail_div.setAttribute('style', 'margin: 0px 50px; font-weight: bold; color: red;');
text_fail_div.appendChild(document.createTextNode(text_fail));
if (proxy) {
let a_link = document.createElement('a');
a_link.innerText = url;
a_link.href = url;
a_link.target = '_blank';
text_fail_div.appendChild(a_link);
}
2022-04-09 08:07:08 -07:00
article.insertBefore(text_fail_div, article.firstChild);
}
2021-01-11 11:59:50 -08:00
}
function ampToHtml() {
window.setTimeout(function () {
let canonical = document.querySelector('link[rel="canonical"]');
window.location.href = canonical.href;
}, 500);
}
2022-08-05 09:32:14 -07:00
function archiveLink(url, text_fail = 'BPC > Full article text:\r\n') {
2021-06-29 12:13:42 -07:00
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;');
2022-08-05 09:32:14 -07:00
text_fail_div.appendChild(document.createTextNode(text_fail));
2022-02-08 10:41:44 -08:00
function add_links(domains) {
for (let domain of domains) {
let a_link = document.createElement('a');
a_link.innerText = domain;
a_link.href = 'https://' + domain + '?run=1&url=' + url.split('?')[0];
a_link.target = '_blank';
text_fail_div.appendChild(document.createTextNode(' | '));
text_fail_div.appendChild(a_link);
}
}
add_links(['archive.today', 'archive.is']);
2021-06-29 12:13:42 -07:00
return text_fail_div;
}
2019-11-06 03:09:27 -08:00
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);
}
2019-11-11 20:21:30 -08:00
}
2019-11-10 11:46:45 -08:00
2020-06-08 07:44:06 -07:00
function cookieExists(name) {
return document.cookie.split(';').some(function (item) {
return item.trim().indexOf(name + '=') === 0
})
2020-06-08 07:44:06 -07:00
}
function setCookie(name, value, domain, path, days) {
2021-08-17 09:36:07 -07:00
let max_age = days * 24 * 60 * 60;
document.cookie = name + "=" + (value || "") + "; domain=" + domain + "; path=" + path + "; max-age=" + max_age;
2020-06-08 07:44:06 -07:00
}
2020-09-12 06:40:21 -07:00
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);
}
2020-07-15 09:45:17 -07:00
}
2020-05-29 06:32:52 -07:00
function genHexString(len) {
let output = '';
for (let i = 0; i < len; i++)
output += (Math.floor(Math.random() * 16)).toString(16);
return output;
2020-05-29 06:32:52 -07:00
}
function makeRandomNumber(len) {
let result = '';
2021-08-17 09:36:07 -07:00
let characters = '123456789';
let charactersLength = characters.length;
for (let i = 0; i < len; i++)
result += characters.charAt(Math.floor(Math.random() * charactersLength));
return result;
}
2019-10-23 10:08:37 -07:00
function pageContains(selector, text) {
let elements = document.querySelectorAll(selector);
return Array.prototype.filter.call(elements, function (element) {
return RegExp(text).test(element.textContent);
});
}
2020-07-04 04:33:09 -07:00
function breakText(str) {
str = str.replace(/(?:^|[A-Za-z\"\“])(\.|\?|!)(?=[A-ZÖÜ\„\d][A-Za-zÀ-ÿ\„\d]{1,})/gm, "$&\n\n");
str = str.replace(/(([a-z]{2,}|[\"\“]))(?=[A-Z](?=[A-Za-zÀ-ÿ]+))/gm, "$&\n\n");
// exceptions: names with alternating lower/uppercase (no general fix)
let str_rep_arr = ['AstraZeneca', 'BaFin', 'BerlHG', 'BfArM', 'BilMoG', 'BioNTech', 'DiGA', 'EuGH', 'FinTechRat', 'GlaxoSmithKline', 'IfSG', 'medRxiv', 'mmHg', 'PlosOne', 'StVO'];
let str_rep_split,
str_rep_src;
for (let str_rep of str_rep_arr) {
str_rep_split = str_rep.split(/([a-z]+)(?=[A-Z](?=[A-Za-z]+))/);
str_rep_src = str_rep_split.reduce(function (accumulator, currentValue) {
return accumulator + currentValue + ((currentValue !== currentValue.toUpperCase()) ? '\n\n' : '');
});
if (str_rep_src.endsWith('\n\n'))
str_rep_src = str_rep_src.slice(0, -2);
str = str.replace(new RegExp(str_rep_src, "g"), str_rep);
}
str = str.replace(/De\n\n([A-Z])/g, "De$1");
str = str.replace(/La\n\n([A-Z])/g, "La$1");
str = str.replace(/Le\n\n([A-Z])/g, "Le$1");
str = str.replace(/Mc\n\n([A-Z])/g, "Mc$1");
return str;
};
function parseHtmlEntities(encodedString) {
2022-04-17 23:13:57 -07:00
let translate_re = /&(nbsp|amp|quot|lt|gt|deg|hellip|laquo|raquo|ldquo|rdquo|lsquo|rsquo|mdash|shy);/g;
2021-08-17 09:36:07 -07:00
let translate = {"nbsp": " ", "amp": "&", "quot": "\"", "lt": "<", "gt": ">", "deg": "°", "hellip": "…",
2022-04-17 23:13:57 -07:00
"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) {
2021-08-17 09:36:07 -07:00
let num = parseInt(numStr, 10);
return String.fromCharCode(num);
});
2020-07-04 04:33:09 -07:00
}
2021-02-05 10:07:06 -08:00
function encode_utf8(str) {
return unescape(encodeURIComponent(str));
2021-02-05 10:07:06 -08:00
}
function decode_utf8(str) {
return decodeURIComponent(escape(str));
2021-02-05 10:07:06 -08:00
}