Fix The Daily Beast (members-only)

This commit is contained in:
magnolia1234 2021-08-13 15:29:59 +02:00
parent e0153a51a9
commit f5ae3abd07
5 changed files with 42 additions and 4 deletions

View file

@ -134,7 +134,7 @@ NHST Media Group sites like (opt-in to custom sites)
[Sports Illustrated](https://www.si.com) -
[The Art Newspaper](https://www.theartnewspaper.com) -
[The Athletic](https://theathletic.com) -
[The Daily Beast](https://www.thedailybeast.com)* -
[The Daily Beast](https://www.thedailybeast.com) -
[The New Atlantis](https://www.thenewatlantis.com) -
[The Point Magazine](https://thepointmag.com) -
[The Wrap](https://www.thewrap.com) -

View file

@ -5,6 +5,7 @@ Post-release
Fix group McClatchy (unlisted sites)
Fix MediaNama (modal)
Fix The Athletic
Fix The Daily Beast (members-only)
* v2.3.2.0 (2021-08-08)
Add Inc42 (India)

View file

@ -1688,7 +1688,7 @@ else if (matchDomain('bloomberg.com')) {
if (url.includes('/articles/')) {
let leaderboard = document.querySelector('div[id^="leaderboard"], div.leaderboard-wrapper');
let shimmering_content = document.querySelectorAll('div[class^="shimmering-"]');
let page_ad = document.querySelectorAll('div.page-ad');
let page_ad = document.querySelectorAll('div.page-ad, div[data-ad-placeholder]');
removeDOMElement(leaderboard, ...shimmering_content, ...page_ad);
let hidden_images = document.querySelectorAll('img.lazy-img__image[src][data-native-src]');
for (let hidden_image of hidden_images) {
@ -2506,6 +2506,43 @@ else if (matchDomain('theatlantic.com')) {
removeDOMElement(banner);
}
else if (matchDomain('thedailybeast.com')) {
let paywall = document.querySelector('div.Body__paywall-container');
if (paywall) {
removeDOMElement(paywall);
let json_script = document.querySelector('script[displayName="initialState"]');
if (json_script) {
let json_text = json_script.innerText.includes('"sections":') ? json_script.innerText.split('"sections":')[1].split('},"')[0] : '';
if (json_text) {
let pars = json_text.split('"').filter(function (value) {
return (value.split('[').length < 2 && value.split(']').length < 2);
});
let mobile_doc = document.querySelector('div.Mobiledoc');
if (mobile_doc) {
let mobile_doc_text = mobile_doc.innerText.replace(/(\r|\n)/g, '');
let par, par_elem;
for (let elem of pars) {
if (elem === 'p') {
if (par && !mobile_doc_text.includes(par)) {
par_elem = document.createElement('p');
par_elem.innerText = par;
mobile_doc.appendChild(par_elem);
}
par = '';
} else
par += elem;
}
if (par && !mobile_doc_text.includes(par)) {
par_elem = document.createElement('p');
par_elem.innerText = par;
mobile_doc.appendChild(par_elem);
}
}
}
}
}
}
else if (matchDomain('thediplomat.com')) {
let preview = document.querySelector('.dpl-preview');
if (preview)

View file

@ -545,5 +545,5 @@
"*://*.wallkit.net/*",
"*://*.wsj.net/*"
],
"version": "2.3.2.3"
"version": "2.3.2.4"
}

View file

@ -246,7 +246,7 @@ var defaultSites =
"The Business Journals": "bizjournals.com",
"The Business of Fashion": "businessoffashion.com",
"The Christian Science Monitor": "csmonitor.com",
"The Daily Beast (free articles only)": "thedailybeast.com",
"The Daily Beast": "thedailybeast.com",
"The Dallas Morning News": "dallasnews.com",
"The Denver Post": "denverpost.com",
"The Diplomat": "thediplomat.com",