mirror of
https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean.git
synced 2024-11-10 07:17:47 +01:00
Fix-update Toronto Star (map-snippet)
This commit is contained in:
parent
3762e8d098
commit
3834b8c9e0
4 changed files with 38 additions and 6 deletions
|
@ -3,6 +3,7 @@ Changelog Bypass Paywalls Clean - Firefox
|
||||||
|
|
||||||
Post-release
|
Post-release
|
||||||
Fix-update Bloomberg (overlay)
|
Fix-update Bloomberg (overlay)
|
||||||
|
Fix-update Toronto Star (map-snippet)
|
||||||
|
|
||||||
* v1.8.9.0 (2020-10-04)
|
* v1.8.9.0 (2020-10-04)
|
||||||
Add Hannoversche Allgemeine Zeitung
|
Add Hannoversche Allgemeine Zeitung
|
||||||
|
|
|
@ -425,10 +425,40 @@ else if (matchDomain("techinasia.com")) {
|
||||||
|
|
||||||
else if (matchDomain("thestar.com")) {
|
else if (matchDomain("thestar.com")) {
|
||||||
let paywall = document.querySelector('.basic-paywall-new');
|
let paywall = document.querySelector('.basic-paywall-new');
|
||||||
removeDOMElement(paywall);
|
if (paywall) {
|
||||||
let tbcs = document.querySelectorAll('.text-block-container');
|
removeDOMElement(paywall);
|
||||||
for (let tbc of tbcs) {
|
let tbcs = document.querySelectorAll('.text-block-container');
|
||||||
tbc.removeAttribute('style');
|
for (let tbc of tbcs) {
|
||||||
|
tbc.removeAttribute('style');
|
||||||
|
}
|
||||||
|
if (document.head.innerText.includes('window.__PRELOADED_STATE__')) {
|
||||||
|
let html = document.head.outerHTML;
|
||||||
|
let split1 = html.split('window.__PRELOADED_STATE__ =')[1];
|
||||||
|
let state = split1.split('//--><!]]></script>')[0].trim();
|
||||||
|
let json = JSON.parse(state);
|
||||||
|
if (json) {
|
||||||
|
let body = json.body;
|
||||||
|
let par_append_text, par_append;
|
||||||
|
for (let elem of body) {
|
||||||
|
if (elem.isParagraph) {
|
||||||
|
par_append_text = parseHtmlEntities(elem.text);
|
||||||
|
} else if (elem.snippet) {
|
||||||
|
let parser = new DOMParser();
|
||||||
|
let article_html = parser.parseFromString('<div id="bpc">' + elem.snippet + '</div>', 'text/html');
|
||||||
|
let article_snippet = article_html.querySelector('div#bpc');
|
||||||
|
let pars = document.querySelectorAll('div.c-article-body__content > p');
|
||||||
|
for (let par of pars) {
|
||||||
|
if (par.innerText.includes(par_append_text)) {
|
||||||
|
par_append = par;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (article_snippet && par_append)
|
||||||
|
par_append.appendChild(article_snippet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -649,6 +679,7 @@ else if (matchDomain('faz.net')) {
|
||||||
str = str.replace(/If\n\nSG/g, "IfSG");
|
str = str.replace(/If\n\nSG/g, "IfSG");
|
||||||
str = str.replace(/m\n\nRNA/g, "mNRA");
|
str = str.replace(/m\n\nRNA/g, "mNRA");
|
||||||
str = str.replace(/St\n\nVO/g, "StVO");
|
str = str.replace(/St\n\nVO/g, "StVO");
|
||||||
|
str = str.replace(/Berl\n\nHG/g, "BerlHG");
|
||||||
str = str.replace(/De\n\n([A-Z])/g, "De$1");
|
str = str.replace(/De\n\n([A-Z])/g, "De$1");
|
||||||
str = str.replace(/La\n\n([A-Z])/g, "La$1");
|
str = str.replace(/La\n\n([A-Z])/g, "La$1");
|
||||||
str = str.replace(/Le\n\n([A-Z])/g, "Le$1");
|
str = str.replace(/Le\n\n([A-Z])/g, "Le$1");
|
||||||
|
|
|
@ -318,5 +318,5 @@
|
||||||
"webRequest",
|
"webRequest",
|
||||||
"webRequestBlocking"
|
"webRequestBlocking"
|
||||||
],
|
],
|
||||||
"version": "1.8.9.1"
|
"version": "1.8.9.2"
|
||||||
}
|
}
|
|
@ -40,5 +40,5 @@
|
||||||
"webRequest",
|
"webRequest",
|
||||||
"webRequestBlocking"
|
"webRequestBlocking"
|
||||||
],
|
],
|
||||||
"version": "1.8.9.1"
|
"version": "1.8.9.2"
|
||||||
}
|
}
|
Loading…
Reference in a new issue