mirror of
https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean.git
synced 2024-11-10 03:51:58 +01:00
Fix Puck.news (ld_json_url)
This commit is contained in:
parent
ad6ae71a39
commit
9f0e676d81
6 changed files with 34 additions and 8 deletions
|
@ -4,6 +4,7 @@ Updates (install signed xpi-file): https://gitlab.com/magnolia1234/bypass-paywal
|
|||
|
||||
Post-release
|
||||
Fix Inc42 (js)
|
||||
Fix Puck.news (ld_json_url)
|
||||
Fix Tes Magazine (css)
|
||||
Update block general paywall script (fix Ippen.space)
|
||||
|
||||
|
|
|
@ -4345,13 +4345,31 @@ else if (matchDomain('project-syndicate.org')) {
|
|||
}
|
||||
|
||||
else if (matchDomain('puck.news')) {
|
||||
let url = window.location.href;
|
||||
let paywall = document.querySelectorAll('div[class*="paywall"]');
|
||||
if (paywall.length) {
|
||||
if (paywall.length && dompurify_loaded) {
|
||||
removeDOMElement(...paywall);
|
||||
csDoneOnce = true;
|
||||
let url_cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url.split('?')[0];
|
||||
replaceDomElementExt(url_cache, true, false, 'div.entry-content');
|
||||
let json_url_dom = document.querySelector('link[rel="alternate"][type="application/json"][href]');
|
||||
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.entry-content');
|
||||
if (json_text && content) {
|
||||
let parser = new DOMParser();
|
||||
let doc = parser.parseFromString('<div>' + DOMPurify.sanitize(json_text) + '</div>', 'text/html');
|
||||
content.innerHTML = '';
|
||||
let content_new = doc.querySelector('div');
|
||||
content.appendChild(content_new, content);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
let modal = document.querySelector('div#paywall-modal');
|
||||
removeDOMElement(modal);
|
||||
let overlay = document.querySelector('body.paywall-active');
|
||||
if (overlay)
|
||||
overlay.classList.remove('paywall-active');
|
||||
|
|
|
@ -51,5 +51,5 @@
|
|||
"webRequestBlocking",
|
||||
"*://*/*"
|
||||
],
|
||||
"version": "3.3.2.2"
|
||||
"version": "3.3.2.3"
|
||||
}
|
||||
|
|
|
@ -796,5 +796,5 @@
|
|||
"*://*.wyleex.com/*",
|
||||
"*://webcache.googleusercontent.com/*"
|
||||
],
|
||||
"version": "3.3.2.2"
|
||||
"version": "3.3.2.3"
|
||||
}
|
||||
|
|
2
sites.js
2
sites.js
|
@ -1788,7 +1788,7 @@ var defaultSites = {
|
|||
allow_cookies: 1,
|
||||
block_regex: /\.poool\.fr\//
|
||||
},
|
||||
"Puck.news (cached articles only)": {
|
||||
"Puck.news": {
|
||||
domain: "puck.news",
|
||||
allow_cookies: 1,
|
||||
cs_dompurify: 1
|
||||
|
|
|
@ -81,6 +81,13 @@
|
|||
"ld_google_webcache": "div#paywall-offer|div#article-body-preview",
|
||||
"upd_version": "3.3.1.5"
|
||||
},
|
||||
"Puck.news": {
|
||||
"domain": "puck.news",
|
||||
"allow_cookies": 1,
|
||||
"ld_json_url": "div[class*='paywall']|div.entry-content|1",
|
||||
"cs_block": 1,
|
||||
"upd_version": "3.3.2.3"
|
||||
},
|
||||
"Revista Oeste": {
|
||||
"domain": "revistaoeste.com",
|
||||
"allow_cookies": 1,
|
||||
|
|
Loading…
Reference in a new issue