mirror of
https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean.git
synced 2024-11-10 01:11:04 +00:00
Fix The Daily Beast (images)
This commit is contained in:
parent
0283e6a2db
commit
635bb04e9b
@ -5,7 +5,7 @@ Post-release
|
|||||||
Add Ad Age & Automotive News (& fix group Crain Communications)
|
Add Ad Age & Automotive News (& fix group Crain Communications)
|
||||||
Add MediaNews Group (local USA)
|
Add MediaNews Group (local USA)
|
||||||
Fix group Mediahuis Nederland Regional
|
Fix group Mediahuis Nederland Regional
|
||||||
Fix The Daily Beast (proper)
|
Fix The Daily Beast (proper/images)
|
||||||
|
|
||||||
* v2.3.3.0 (2021-08-15)
|
* v2.3.3.0 (2021-08-15)
|
||||||
Add Live Law (India)
|
Add Live Law (India)
|
||||||
|
@ -2521,37 +2521,61 @@ else if (matchDomain('thedailybeast.com')) {
|
|||||||
removeDOMElement(paywall);
|
removeDOMElement(paywall);
|
||||||
let json_script = document.querySelector('script[displayName="initialState"]');
|
let json_script = document.querySelector('script[displayName="initialState"]');
|
||||||
if (json_script) {
|
if (json_script) {
|
||||||
let json_split = json_script.innerText.includes('"sections":') ? json_script.innerText.split('"sections":') : [];
|
let json_str = json_script.text.substring(json_script.textContent.indexOf('{'));
|
||||||
let json_text;
|
try {
|
||||||
if (json_split.length > 1)
|
let json = JSON.parse(json_str);
|
||||||
json_text = json_split[json_split.length - 1].split('},"')[0];
|
if (json.body) {
|
||||||
if (json_text) {
|
let pars = json.body.sections;
|
||||||
let pars = json_text.split('"').filter(function (value) {
|
let cards = json.body.cards;
|
||||||
return (value.split('[').length < 3 && value.split(']').length < 3);
|
if (pars) {
|
||||||
});
|
|
||||||
let mobile_doc = document.querySelector('div.Mobiledoc');
|
let mobile_doc = document.querySelector('div.Mobiledoc');
|
||||||
if (mobile_doc) {
|
if (mobile_doc) {
|
||||||
let mobile_doc_text = mobile_doc.innerText.replace(/(\r|\n)/g, '');
|
let mobile_doc_text = mobile_doc.innerText.replace(/(\r|\n)/g, '');
|
||||||
let par, par_elem;
|
|
||||||
for (let elem of pars) {
|
for (let elem of pars) {
|
||||||
if (elem === 'p') {
|
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)) {
|
if (par && !mobile_doc_text.includes(par)) {
|
||||||
par_elem = document.createElement('p');
|
par_elem = document.createElement('p');
|
||||||
par_elem.innerText = par;
|
par_elem.innerText = par;
|
||||||
mobile_doc.appendChild(par_elem);
|
|
||||||
}
|
}
|
||||||
par = '';
|
|
||||||
} else
|
|
||||||
par += elem;
|
|
||||||
}
|
}
|
||||||
if (par && !mobile_doc_text.includes(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');
|
par_elem = document.createElement('p');
|
||||||
par_elem.innerText = par;
|
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);
|
mobile_doc.appendChild(par_elem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
csDoneOnce = true;
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -553,5 +553,5 @@
|
|||||||
"*://*.wallkit.net/*",
|
"*://*.wallkit.net/*",
|
||||||
"*://*.wsj.net/*"
|
"*://*.wsj.net/*"
|
||||||
],
|
],
|
||||||
"version": "2.3.3.4"
|
"version": "2.3.3.5"
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user