diff --git a/changelog.txt b/changelog.txt index ab73a45..51a08af 100644 --- a/changelog.txt +++ b/changelog.txt @@ -4,7 +4,8 @@ Updates: https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/release Post-release Remove Iltalehti.fi (fix obsolete) -Fix Sciences et Avenir.fr +Fix iPolitics.ca (refresh) +Fix Sciences et Avenir.fr (css) * v3.0.9.0 (2023-03-12) Add Medienhaus Aachen diff --git a/contentScript.js b/contentScript.js index 0076f5a..98cf074 100644 --- a/contentScript.js +++ b/contentScript.js @@ -3457,19 +3457,27 @@ else if (matchDomain('ipolitics.ca')) { removeDOMElement(login); let json_script = document.querySelector('script#__NEXT_DATA__'); if (json_script) { - let json = JSON.parse(json_script.innerText); - if (json && json.props.pageProps.post.content) { - let article_new = json.props.pageProps.post.content; - let article = document.querySelector('.post-header'); - if (article) { - let parser = new DOMParser(); - let doc = parser.parseFromString('
' + article_new + '
', 'text/html'); - let content_new = doc.querySelector('div'); - article.appendChild(content_new); - let locked = document.querySelector('div.locked'); - if (locked) - locked.classList.remove('locked'); + try { + let json = JSON.parse(json_script.innerText); + if (json && json.props.pageProps.post && json.props.pageProps.post.content) { + let url_next = json.props.pageProps.post.slug; + if (url_next && !window.location.pathname.includes(url_next)) + refreshCurrentTab(); + let article_new = json.props.pageProps.post.content; + let article = document.querySelector('.post-body'); + if (article) { + article.innerHTML = ''; + article.classList.remove('locked'); + let parser = new DOMParser(); + let doc = parser.parseFromString('
' + article_new + '
', 'text/html'); + let content_new = doc.querySelector('div'); + article.appendChild(content_new); + } + } else { + refreshCurrentTab(); } + } catch (err) { + console.log(err); } } } diff --git a/custom/manifest.json b/custom/manifest.json index 1bf7569..b49ac10 100644 --- a/custom/manifest.json +++ b/custom/manifest.json @@ -51,5 +51,5 @@ "webRequestBlocking", "*://*/*" ], - "version": "3.0.9.1" + "version": "3.0.9.2" } diff --git a/manifest.json b/manifest.json index b6cb930..fac6f4d 100644 --- a/manifest.json +++ b/manifest.json @@ -736,5 +736,5 @@ "*://*.wallkit.net/*", "*://webcache.googleusercontent.com/*" ], - "version": "3.0.9.1" + "version": "3.0.9.2" }