diff --git a/changelog.txt b/changelog.txt index 51a08af..43eab07 100644 --- a/changelog.txt +++ b/changelog.txt @@ -4,6 +4,7 @@ Updates: https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/release Post-release Remove Iltalehti.fi (fix obsolete) +Fix ilManifesto.it (timing) Fix iPolitics.ca (refresh) Fix Sciences et Avenir.fr (css) diff --git a/contentScript.js b/contentScript.js index 98cf074..9800bc5 100644 --- a/contentScript.js +++ b/contentScript.js @@ -1771,34 +1771,36 @@ else if (matchDomain('ilfoglio.it')) { } else if (matchDomain('ilmanifesto.it')) { - if (window.location.pathname.match(/((\w)+(\-)+){3,}/)) { - let paywall = document.querySelector('div[class^="PostPaywall_PostPaywall__"]'); - if (paywall) { - removeDOMElement(paywall); - let json_script = document.querySelector('script#__NEXT_DATA__'); - if (json_script) { - let json = JSON.parse(json_script.innerText); - if (json && json.props.pageProps.content && json.props.pageProps.content.content) { - let article_new = json.props.pageProps.content.content; - let article = document.querySelector('div.ArticleBody'); - if (article) { - article.innerHTML = ''; - let parser = new DOMParser(); - let doc = parser.parseFromString('
' + article_new + '
', 'text/html'); - let content_new = doc.querySelector('div'); - article.appendChild(content_new); - } - } else - window.location.reload(true); + window.setTimeout(function () { + if (window.location.pathname.match(/((\w)+(\-)+){3,}/)) { + let paywall = document.querySelector('div[class^="PostPaywall_PostPaywall__"]'); + if (paywall) { + removeDOMElement(paywall); + let json_script = document.querySelector('script#__NEXT_DATA__'); + if (json_script) { + let json = JSON.parse(json_script.innerText); + if (json && json.props.pageProps.content && json.props.pageProps.content.content) { + let article_new = json.props.pageProps.content.content; + let article = document.querySelector('div.ArticleBody'); + if (article) { + article.innerHTML = ''; + let parser = new DOMParser(); + let doc = parser.parseFromString('
' + article_new + '
', 'text/html'); + let content_new = doc.querySelector('div'); + article.appendChild(content_new); + } + } else + window.location.reload(true); + } } } - } - let service_page = document.querySelector('div.service-page'); - if (service_page) { - window.setTimeout(function () { - window.location.reload(true); - }, 1000); - } + let service_page = document.querySelector('div.service-page'); + if (service_page) { + window.setTimeout(function () { + window.location.reload(true); + }, 1000); + } + }, 1000); } else if (matchDomain(['iltirreno.it', 'lanuovasardegna.it'])) { @@ -2049,13 +2051,13 @@ else if (matchDomain(['lc.nl', 'dvhn.nl'])) { span.innerText = child.text; elem.appendChild(span); } - } else if (child.href && child.children[0].text) { - let par_link = document.createElement('a'); - par_link.href = child.href; - par_link.innerText = child.children[0].text; - elem.appendChild(par_link); - } else if (child.children.length && child.children[0].text) { - if (child.children[0].text.length > 2) { + } else if (child.children && child.children.length && child.children[0].text && child.children[0].text.length > 2) { + if (child.href || (child.relation && child.relation.follow && child.relation.follow.url)) { + let par_link = document.createElement('a'); + par_link.href = child.href || child.relation.follow.url; + par_link.innerText = child.children[0].text; + elem.appendChild(par_link); + } else { let span = document.createElement('span'); span.innerText = child.children[0].text; elem.appendChild(span); @@ -2063,7 +2065,7 @@ else if (matchDomain(['lc.nl', 'dvhn.nl'])) { } } } else if (par.typename.length > 2) - console.log(par); + console.log(par); if (elem.hasChildNodes()) { article.appendChild(elem); } diff --git a/custom/manifest.json b/custom/manifest.json index b49ac10..76e306a 100644 --- a/custom/manifest.json +++ b/custom/manifest.json @@ -51,5 +51,5 @@ "webRequestBlocking", "*://*/*" ], - "version": "3.0.9.2" + "version": "3.0.9.3" } diff --git a/manifest.json b/manifest.json index fac6f4d..3b680cb 100644 --- a/manifest.json +++ b/manifest.json @@ -736,5 +736,5 @@ "*://*.wallkit.net/*", "*://webcache.googleusercontent.com/*" ], - "version": "3.0.9.2" + "version": "3.0.9.3" }