mirror of
https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean.git
synced 2024-11-10 01:11:04 +00:00
Maintenance contentScript (update sanitize html-input)
This commit is contained in:
parent
3b630d8520
commit
7190c8a9f8
@ -1240,7 +1240,7 @@ if (matchUrlDomain(change_headers, details.url) && (['main_frame', 'sub_frame',
|
|||||||
}
|
}
|
||||||
if ((!['font', 'stylesheet'].includes(details.type) || matchUrlDomain(cs_limit_except, currentTabUrl)) && !csDone) {
|
if ((!['font', 'stylesheet'].includes(details.type) || matchUrlDomain(cs_limit_except, currentTabUrl)) && !csDone) {
|
||||||
let lib_file = 'lib/empty.js';
|
let lib_file = 'lib/empty.js';
|
||||||
if (matchUrlDomain(['business-standard.com', 'cicero.de', 'economictimes.com', 'gva.be', 'lesechos.fr', 'newleftreview.org', 'newyorker.com', 'nzherald.co.nz', 'prospectmagazine.co.uk', 'sudouest.fr', 'techinasia.com', 'valor.globo.com'].concat(nl_mediahuis_region_domains), currentTabUrl))
|
if (matchUrlDomain(['cicero.de', 'economictimes.com', 'gva.be', 'lesechos.fr', 'newleftreview.org', 'newyorker.com', 'nzherald.co.nz', 'prospectmagazine.co.uk', 'sudouest.fr', 'techinasia.com', 'valor.globo.com'].concat(nl_mediahuis_region_domains), currentTabUrl))
|
||||||
lib_file = 'lib/purify.min.js';
|
lib_file = 'lib/purify.min.js';
|
||||||
ext_api.tabs.executeScript(tabId, {
|
ext_api.tabs.executeScript(tabId, {
|
||||||
file: lib_file,
|
file: lib_file,
|
||||||
|
@ -6,6 +6,7 @@ Fix Il Secolo XIX (amp-redirect)
|
|||||||
Fix Miami Herald (group McClatchy)
|
Fix Miami Herald (group McClatchy)
|
||||||
Fix New Left Review (timing)
|
Fix New Left Review (timing)
|
||||||
Fix WaPo (amp/interactive)
|
Fix WaPo (amp/interactive)
|
||||||
|
Maintenance contentScript (update sanitize html-input)
|
||||||
|
|
||||||
* v2.2.8.0 (2021-07-04)
|
* v2.2.8.0 (2021-07-04)
|
||||||
Fix Le Parisien (Googlebot)
|
Fix Le Parisien (Googlebot)
|
||||||
|
@ -1574,6 +1574,11 @@ else if (matchDomain('valor.globo.com')) {
|
|||||||
let url_cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url;
|
let url_cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url;
|
||||||
replaceDomElementExt(url_cache, true, false, 'div.protected-content', 'Failed to load from Google webcache: ');
|
replaceDomElementExt(url_cache, true, false, 'div.protected-content', 'Failed to load from Google webcache: ');
|
||||||
}
|
}
|
||||||
|
let skeleton_box = document.querySelector('div.glb-skeleton-box');
|
||||||
|
if (skeleton_box) {
|
||||||
|
skeleton_box.classList.remove('glb-skeleton-box');
|
||||||
|
skeleton_box.removeAttribute('style');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -1695,12 +1700,11 @@ else if (matchDomain('business-standard.com')) {
|
|||||||
json = script;
|
json = script;
|
||||||
}
|
}
|
||||||
if (json) {
|
if (json) {
|
||||||
let json_text = JSON.parse(json.text.replace(/(\r\n|\n|\r|\t)/gm, ''))[0].articleBody;
|
let json_text = JSON.parse(json.text.replace(/(\r|\n|\t)/gm, ''))[0].articleBody;
|
||||||
json_text = parseHtmlEntities(json_text);
|
json_text = parseHtmlEntities(json_text);
|
||||||
json_text = json_text.replace(/(?:^|[\w\"\'\’])(\.|\?|!)(?=[A-Z\"\”\“\‘\’\'][A-Za-zÀ-ÿ\"\”\“\‘\’\']{1,})/gm, "$&</br></br>") + '</br></br>';
|
json_text = json_text.replace(/(?:^|[\w\"\'\’])(\.|\?|!)(?=[A-Z\"\”\“\‘\’\'][A-Za-zÀ-ÿ\"\”\“\‘\’\']{1,})/gm, "$&\r\n\r\n") + '\r\n\r\n';
|
||||||
let parser = new DOMParser();
|
let article = document.createElement('div');
|
||||||
let html = parser.parseFromString('<div>' + DOMPurify.sanitize(json_text) + '</div>', 'text/html');
|
article.innerText = json_text;
|
||||||
let article = html.querySelector('div');
|
|
||||||
if (article) {
|
if (article) {
|
||||||
let p_content = document.querySelector('span.p-content.paywall');
|
let p_content = document.querySelector('span.p-content.paywall');
|
||||||
if (p_content) {
|
if (p_content) {
|
||||||
@ -1781,7 +1785,7 @@ else if (matchDomain('economictimes.com')) {
|
|||||||
if (content && full_text) {
|
if (content && full_text) {
|
||||||
content.innerText = '';
|
content.innerText = '';
|
||||||
let parser = new DOMParser();
|
let parser = new DOMParser();
|
||||||
html = parser.parseFromString('<div>' + DOMPurify.sanitize(full_text.innerHTML) + '</div>', 'text/html');
|
html = parser.parseFromString('<div>' + DOMPurify.sanitize(full_text.innerHTML, {ADD_ATTR: ['frameborder'], ADD_TAGS: ['iframe']}) + '</div>', 'text/html');
|
||||||
let article = html.querySelector('div');
|
let article = html.querySelector('div');
|
||||||
content.appendChild(article);
|
content.appendChild(article);
|
||||||
removeDOMElement(full_text);
|
removeDOMElement(full_text);
|
||||||
@ -2643,7 +2647,8 @@ function replaceDomElementExt(url, proxy, base64, selector, text_fail = '') {
|
|||||||
selector = 'body';
|
selector = 'body';
|
||||||
}
|
}
|
||||||
let parser = new DOMParser();
|
let parser = new DOMParser();
|
||||||
let doc = parser.parseFromString(DOMPurify.sanitize(html), 'text/html');
|
let doc = parser.parseFromString(DOMPurify.sanitize(html, {ADD_ATTR: ['layout'], ADD_TAGS: ['amp-img']}), 'text/html');
|
||||||
|
//console.log(DOMPurify.removed);
|
||||||
let article_new = doc.querySelector(selector);
|
let article_new = doc.querySelector(selector);
|
||||||
if (article_new) {
|
if (article_new) {
|
||||||
if (article)
|
if (article)
|
||||||
|
@ -534,5 +534,5 @@
|
|||||||
"*://*.wallkit.net/*",
|
"*://*.wallkit.net/*",
|
||||||
"*://*.wsj.net/*"
|
"*://*.wsj.net/*"
|
||||||
],
|
],
|
||||||
"version": "2.2.8.4"
|
"version": "2.2.8.5"
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user