mirror of
https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean.git
synced 2024-11-04 12:00:10 +00:00
Fix Advance Local (json)
This commit is contained in:
parent
e930eb769e
commit
59a75e56e7
@ -4,6 +4,7 @@ Updates (install signed xpi-file): https://gitlab.com/magnolia1234/bypass-paywal
|
||||
|
||||
Post-release
|
||||
Add CH Media (opt-in to custom sites for unlisted)
|
||||
Fix Advance Local (json)
|
||||
Fix Groupe ESH Medias (iframely)
|
||||
Fix Kurier.at (js & css)
|
||||
Fix Los Angeles Times (images)
|
||||
|
@ -3501,12 +3501,62 @@ else
|
||||
} else {//other (like com/org & not at/be/br/ch/cl/de/dk/fi/fr/es/ie/nl/no/pe/pt/se/uk))
|
||||
|
||||
if (matchDomain(usa_adv_local_domains)) {
|
||||
let url = window.location.href;
|
||||
if (url.includes('?outputType=amp')) {
|
||||
let amp_ads = document.querySelectorAll('.amp-ad-container, amp-embed');
|
||||
hideDOMElement(...amp_ads);
|
||||
if (window.location.search.startsWith('?outputType=amp')) {
|
||||
let ads = document.querySelectorAll('.amp-ad-container, amp-embed');
|
||||
hideDOMElement(...ads);
|
||||
} else {
|
||||
amp_redirect('div.paywall', '', window.location.pathname + '?outputType=amp');
|
||||
let paywall_sel = 'div.paywall';
|
||||
let paywall = document.querySelector(paywall_sel);
|
||||
let article = document.querySelector('div.entry-content');
|
||||
if (paywall && article && dompurify_loaded) {
|
||||
let fusion_script = document.querySelector('script#fusion-metadata');
|
||||
if (fusion_script && fusion_script.text.includes('Fusion.globalContent=')) {
|
||||
paywall.classList.remove('paywall');
|
||||
try {
|
||||
let json = JSON.parse(fusion_script.text.split('Fusion.globalContent=')[1].split('};')[0] + '}');
|
||||
if (json) {
|
||||
article.innerHTML = '';
|
||||
let parser = new DOMParser();
|
||||
let pars = json.content_elements;
|
||||
for (let par of pars) {
|
||||
let par_new;
|
||||
if (['header', 'text'].includes(par.type)) {
|
||||
if (par.content) {
|
||||
let doc = parser.parseFromString('<p class="article__paragraph">' + DOMPurify.sanitize(par.content) + '</p>', 'text/html');
|
||||
par_new = doc.querySelector('p');
|
||||
}
|
||||
} else if (par.image_type) {
|
||||
if (par.url) {
|
||||
par_new = document.createElement('figure');
|
||||
par_new.className = 'article__image';
|
||||
par_new.style = 'width: 75%; margin-left: auto; margin-right: auto;';
|
||||
let img = document.createElement('img');
|
||||
img.src = par.url;
|
||||
if (par.alt_text)
|
||||
img.alt = par.alt_text;
|
||||
par_new.appendChild(img);
|
||||
let caption = document.createElement('figcaption');
|
||||
caption.className = 'article__image-caption';
|
||||
let cap_par = document.createElement('p');
|
||||
cap_par.innerText = par.caption;
|
||||
if (par.credits && par.credits.by && par.credits.by[0] && par.credits.by[0].byline)
|
||||
cap_par.innerText += ' - ' + par.credits.by[0].byline;
|
||||
caption.appendChild(cap_par);
|
||||
par_new.appendChild(caption);
|
||||
}
|
||||
} else if (!['raw_html'].includes(par.type)) {
|
||||
console.log(par);
|
||||
}
|
||||
if (par_new)
|
||||
article.appendChild(par_new);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
} else
|
||||
amp_redirect(paywall_sel, '', window.location.pathname + '?outputType=amp');
|
||||
}
|
||||
let ads = document.querySelectorAll('div.ad');
|
||||
hideDOMElement(...ads);
|
||||
}
|
||||
|
@ -51,5 +51,5 @@
|
||||
"webRequestBlocking",
|
||||
"*://*/*"
|
||||
],
|
||||
"version": "3.5.5.4"
|
||||
"version": "3.5.5.5"
|
||||
}
|
||||
|
@ -855,5 +855,5 @@
|
||||
"*://archive.vn/*",
|
||||
"*://webcache.googleusercontent.com/*"
|
||||
],
|
||||
"version": "3.5.5.4"
|
||||
"version": "3.5.5.5"
|
||||
}
|
||||
|
9
sites.js
9
sites.js
@ -6,7 +6,6 @@ var defaultSites = {
|
||||
},
|
||||
"Advance Local": {
|
||||
domain: "###_usa_adv_local",
|
||||
allow_cookies: 1,
|
||||
group: [
|
||||
"al.com",
|
||||
"cleveland.com",
|
||||
@ -18,7 +17,10 @@ var defaultSites = {
|
||||
"pennlive.com",
|
||||
"silive.com",
|
||||
"syracuse.com"
|
||||
]
|
||||
],
|
||||
allow_cookies: 1,
|
||||
block_regex: /\.sophi\.io\//,
|
||||
cs_dompurify: 1
|
||||
},
|
||||
"Adweek": {
|
||||
domain: "adweek.com",
|
||||
@ -541,7 +543,8 @@ var defaultSites = {
|
||||
domain: "###_de_dfv_medien",
|
||||
group: [],
|
||||
allow_cookies: 1,
|
||||
useragent: "googlebot"
|
||||
useragent: "googlebot",
|
||||
cs_code: "[{\"cond\":\"div.Ad\", \"rm_elem\":1}]"
|
||||
},
|
||||
"Diario Financiero": {
|
||||
domain: "df.cl",
|
||||
|
Loading…
Reference in New Issue
Block a user