diff --git a/changelog.txt b/changelog.txt index fd6302b..14ee738 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,6 +5,7 @@ Updates (install signed xpi-file): https://gitlab.com/magnolia1234/bypass-paywal Post-release Add Groupe ESH Medias (ch) Fix Beobachter.ch & Handelszeitung.ch +Fix Foreign Policy (Insider) * v3.2.2.0 (2023-06-25) Add Follow the Money (Ftm.eu) diff --git a/contentScript.js b/contentScript.js index 3c1ae3f..5675275 100644 --- a/contentScript.js +++ b/contentScript.js @@ -3554,10 +3554,31 @@ else if (matchDomain('foreignaffairs.com')) { else if (matchDomain('foreignpolicy.com')) { let content_ungated = document.querySelector('div.content-ungated'); - removeDOMElement(content_ungated); - let content_gated = document.querySelector('div.content-gated'); - if (content_gated) - content_gated.classList.remove('content-gated'); + if (content_ungated && dompurify_loaded) { + removeDOMElement(content_ungated); + let content_gated = document.querySelector('div.content-gated'); + if (content_gated) { + content_gated.classList.remove('content-gated'); + let insider = document.querySelector('body.is-fp-insider'); + if (insider) { + window.setTimeout(function () { + let json_script = getArticleJsonScript(); + if (json_script) { + let json = JSON.parse(json_script.text); + if (json) { + let content = json.Articlebody.replace(/\r\n/g, '
'); + if (content) { + let parser = new DOMParser(); + let doc = parser.parseFromString('
' + DOMPurify.sanitize(content) + '
', 'text/html'); + let content_new = doc.querySelector('div'); + content_gated.before(content_new); + } + } + } + }, 500); + } + } + } } else if (matchDomain('fortune.com')) { diff --git a/custom/manifest.json b/custom/manifest.json index ffa52dc..63c7b52 100644 --- a/custom/manifest.json +++ b/custom/manifest.json @@ -51,5 +51,5 @@ "webRequestBlocking", "*://*/*" ], - "version": "3.2.2.2" + "version": "3.2.2.3" } diff --git a/manifest.json b/manifest.json index e060fb4..47b6cdd 100644 --- a/manifest.json +++ b/manifest.json @@ -760,5 +760,5 @@ "*://*.wyleex.com/*", "*://webcache.googleusercontent.com/*" ], - "version": "3.2.2.2" + "version": "3.2.2.3" } diff --git a/sites.js b/sites.js index 381e7c1..9d7188e 100644 --- a/sites.js +++ b/sites.js @@ -628,7 +628,8 @@ var defaultSites = { "Foreign Policy": { domain: "foreignpolicy.com", allow_cookies: 1, - block_regex: /\.tinypass\.com\// + block_regex: /\.tinypass\.com\//, + cs_dompurify: 1 }, "Fortune": { domain: "fortune.com",