Add Stylist.co.uk

This commit is contained in:
magnolia1234 2023-05-10 18:13:22 +02:00
parent 32f965b7ee
commit ee6910c981
8 changed files with 129 additions and 15 deletions

View file

@ -414,6 +414,7 @@ Grouped in options:\
[New Left Review](https://newleftreview.org) -
[Private Equity News](https://www.penews.com) -
[Prospect Magazine](https://www.prospectmagazine.co.uk) -
[Stylist](https://www.stylist.co.uk) -
[Tes Magazine](https://www.tes.com/magazine) -
[The Banker](https://www.thebanker.com) -
[The Critic](https://thecritic.co.uk) -

View file

@ -12,7 +12,7 @@ if (typeof ext_api.action !== 'object') {
ext_api.action = ext_api.browserAction;
}
const dompurify_sites = ['arcinfo.ch', 'belfasttelegraph.co.uk', 'bloomberg.com', 'cicero.de', 'defector.com', 'ilmanifesto.it', 'iltirreno.it', 'inc42.com', 'independent.ie', 'ipolitics.ca', 'italiaoggi.it', 'jacobin.de', 'lanuovasardegna.it', 'lecourrierdesstrateges.fr', 'lesechos.fr', 'marianne.net', 'newleftreview.org', 'newscientist.com', 'outlookbusiness.com', 'prospectmagazine.co.uk', 'sloanreview.mit.edu', 'stratfor.com', 'techinasia.com', 'thebulletin.org', 'vn.nl', 'zerohedge.com'].concat(nl_mediahuis_noord_domains, nl_mediahuis_region_domains, no_nhst_media_domains);
const dompurify_sites = ['arcinfo.ch', 'belfasttelegraph.co.uk', 'bloomberg.com', 'cicero.de', 'defector.com', 'ilmanifesto.it', 'iltirreno.it', 'inc42.com', 'independent.ie', 'ipolitics.ca', 'italiaoggi.it', 'jacobin.de', 'lanuovasardegna.it', 'lecourrierdesstrateges.fr', 'lesechos.fr', 'marianne.net', 'newleftreview.org', 'newscientist.com', 'outlookbusiness.com', 'prospectmagazine.co.uk', 'sloanreview.mit.edu', 'stratfor.com', 'stylist.co.uk', 'techinasia.com', 'thebulletin.org', 'vn.nl', 'zerohedge.com'].concat(nl_mediahuis_noord_domains, nl_mediahuis_region_domains, no_nhst_media_domains);
var optin_setcookie = false;
var optin_update = true;
var blocked_referer = false;

View file

@ -4,6 +4,7 @@ Updates (install signed xpi-file): https://gitlab.com/magnolia1234/bypass-paywal
Post-release
Add Monocle (UK)
Add Stylist.co.uk
Fix Advance Local (no amp)
* v3.1.7.3 (2023-05-08)

View file

@ -1,5 +1,6 @@
//"use strict";
var ext_api = (typeof browser === 'object') ? browser : chrome;
var mobile = window.navigator.userAgent.toLowerCase().includes('mobile');
var domain;
var csDone = false;
var csDoneOnce = false;
@ -2621,6 +2622,118 @@ else if (matchDomain('spectator.co.uk')) {
removeDOMElement(banner);
}
else if (matchDomain('stylist.co.uk')) {
let paywall = document.querySelector('div.css-1agpii8');
if (paywall) {
removeDOMElement(paywall);
let json_script = document.querySelector('script#__NEXT_DATA__');
if (json_script) {
try {
let json = JSON.parse(json_script.text);
if (json.props.pageProps.data.post.acf.widgets) {
let url_next = json.props.pageProps.data.post.id;
if (url_next && !window.location.pathname.endsWith(url_next))
refreshCurrentTab();
let pars = json.props.pageProps.data.post.acf.widgets;
let first_par = document.querySelector('p.css-12ac4a9');
if (first_par) {
let par_class = first_par.getAttribute('class');
let article = first_par.parentNode;
let teaser = article.querySelectorAll('div.css-1q9dbt6 > p');
removeDOMElement(...teaser);
if (article) {
let parser = new DOMParser();
for (let par of pars) {
let elem = document.createElement('p');
elem.style = 'font-family: "Source Serif Pro"; font-size: 20px; line-height: 34px;';
if (par.paragraph) {
let content = par.paragraph;
let content_new = parser.parseFromString('<div class="css-1q9dbt6">' + DOMPurify.sanitize(content) + '</div>', 'text/html');
elem = content_new.querySelector('div');
} else if (par.acf_fc_layout === 'heading') {
if (par.text)
elem.appendChild(document.createTextNode(par.text));
} else if (par.image) {
let figure = document.createElement('figure');
let img = document.createElement('img');
img.src = par.image.url;
img.alt = par.image.alt;
img.style = mobile ? 'width: 320px;' : 'width: 640px;';
figure.appendChild(img);
if (par.image.caption || par.image.description) {
let caption = document.createElement('figcaption');
caption.innerText = par.image.caption + ' ' + par.image.description;
figure.appendChild(caption);
}
elem.appendChild(figure);
} else if (par.acf_fc_layout === 'listicle') {
let ul = document.createElement('ul');
for (let sub_item of par.item) {
let li = document.createElement('li');
if (sub_item.url) {
let par_link = document.createElement('a');
par_link.href = sub_item.url;
par_link.innerText = sub_item.title;
par_link.target = '_blank';
li.appendChild(par_link);
} else
li.innerText = sub_item.title;
if (sub_item.paragraph) {
let content = sub_item.paragraph;
let content_new = parser.parseFromString('<div class="css-1q9dbt6">' + DOMPurify.sanitize(content) + '</div>', 'text/html');
let par_elem = content_new.querySelector('div');
li.appendChild(par_elem);
}
if (sub_item.image) {
let img = document.createElement('img');
img.src = sub_item.image.url;
img.alt = sub_item.image.alt;
img.style = mobile ? 'width: 320px;' : 'width: 640px;';
li.appendChild(img);
li.appendChild(document.createElement('br'));
}
li.style = 'font-size: 20px; margin: 20px 0px;';
ul.appendChild(li);
}
elem.appendChild(ul);
} else if (par.embed_link) {
let par_link = document.createElement('a');
par_link.href = par.embed_link;
par_link.innerText = 'Embedded link: ' + par.embed_link;
par_link.target = '_blank';
elem.appendChild(par_link);
} else if (par.acf_fc_layout === 'divider') {
elem.appendChild(document.createElement('hr'));
} else if (par.acf_fc_layout === 'related_articles') {
if (par.posts) {
for (let post of par.posts) {
if (post.link && post.title.rendered) {
let par_link = document.createElement('a');
par_link.href = post.link;
par_link.innerText = 'You may also like: ' + post.title.rendered;
elem.appendChild(par_link);
elem.appendChild(document.createElement('br'));
}
}
}
} else if (!['newsletter_signup', 'pull-quote'].includes(par.acf_fc_layout))
console.log(par);
if (elem.hasChildNodes)
article.appendChild(elem);
}
let div_nostyle = document.querySelectorAll('div.css-1q9dbt6 > *');
for (let elem of div_nostyle)
elem.style = 'font-family: "Source Serif Pro"; font-size: 20px; line-height: 34px;';
}
}
}
} catch (err) {
console.log(err);
}
}
}
}
else if (matchDomain('telegraph.co.uk')) {
if (window.location.pathname.endsWith('/amp/')) {
let paywall = document.querySelectorAll('.premium-paywall');
@ -2888,7 +3001,6 @@ else if (matchDomain('valor.globo.com')) {
removeDOMElement(...ads);
} else {
amp_unhide_subscr_section('amp-ad, amp-embed');
let mobile = window.navigator.userAgent.toLowerCase().includes('mobile');
let amp_images = document.querySelectorAll('figure > amp-img[src^="https://"]');
for (let amp_image of amp_images) {
let elem = document.createElement('img');

View file

@ -51,5 +51,5 @@
"webRequestBlocking",
"*://*/*"
],
"version": "3.1.7.5"
"version": "3.1.7.6"
}

View file

@ -370,6 +370,12 @@
"domain": "makorrishon.co.il",
"useragent": "googlebot"
},
"Manager-magazin.de": {
"add_ext_link": "div[data-area='paywall']|div[data-area='body']",
"add_ext_link_type": "google_search_tool",
"allow_cookies": 1,
"domain": "manager-magazin.de"
},
"Manilatimes.net": {
"allow_cookies": 1,
"domain": "manilatimes.net",
@ -554,17 +560,6 @@
"cs_code": "[{\"cond\":\"div.c-memberships-message\", \"rm_elem\":1, \"elems\":[{\"cond\":\"body.access-restricted\",\"rm_class\":\"access-restricted\"}]}]",
"domain": "stateaffairs.com"
},
"Stylist.co.uk": {
"allow_cookies": 1,
"cs_code": "[{\"cond\":\"div[data-cy='upgradeAccountPaywall']\",\"rm_elem\":1,\"elems\":[{\"cond\":\"div.paywall\",\"rm_attrib\":\"class|style\"},{\"cond\":\"div.css-tu9vsa\",\"rm_attrib\":\"class\"}]}]",
"domain": "stylist.co.uk"
},
"Substack.com": {
"add_ext_link": "div.paywall:not(.modal-paywall)|article",
"add_ext_link_type": "google_search_tool",
"allow_cookies": 1,
"domain": "substack.com"
},
"Supchina.com": {
"allow_cookies": 1,
"block_regex": "\\.tinypass\\.com",

View file

@ -580,6 +580,7 @@
"*://*.stocknews.com/*",
"*://*.stratfor.com/*",
"*://*.studocu.com/*",
"*://*.stylist.co.uk/*",
"*://*.substack.com/*",
"*://*.sudinfo.be/*",
"*://*.sudouest.fr/*",
@ -755,5 +756,5 @@
"*://html.onlineviewer.net/*",
"*://webcache.googleusercontent.com/*"
],
"version": "3.1.7.5"
"version": "3.1.7.6"
}

View file

@ -2395,6 +2395,10 @@ var defaultSites = {
block_regex_general: /\/steadyhq\.com\//,
excluded_domains: ["steadyhq.com"]
},
"Stylist.co.uk": {
domain: "stylist.co.uk",
allow_cookies: 1
},
"Substack (link to Google Search Tool; opt-in to custom sites for custom domains)": {
domain: "###_substack_custom",
group: [