From 167d1420d37076c5380e87381fae69e4c703685a Mon Sep 17 00:00:00 2001 From: Adam <36013816+iamadamdev@users.noreply.github.com> Date: Thu, 24 Jun 2021 22:04:41 -0700 Subject: [PATCH] Fix foreignpolicy.com --- manifest-ff.json | 3 ++- src/js/background.js | 2 +- src/js/contentScript.js | 11 +++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/manifest-ff.json b/manifest-ff.json index d9feeb1..a05f7ab 100755 --- a/manifest-ff.json +++ b/manifest-ff.json @@ -71,7 +71,8 @@ "*://*.sueddeutsche.de/*", "*://*.elmundo.es/*", "*://*.time.com/*", - "*://*.expansion.com/*" + "*://*.expansion.com/*", + "*://*.foreignpolicy.com/*" ], "js": ["src/js/contentScript.js"] } diff --git a/src/js/background.js b/src/js/background.js index 22e3bfc..c6dffa5 100755 --- a/src/js/background.js +++ b/src/js/background.js @@ -209,7 +209,7 @@ const blockedRegexes = { 'chicagotribune.com': /.+:\/\/.+\.tribdss\.com\//, 'economist.com': /(.+\.tinypass\.com\/.+|economist\.com\/engassets\/_next\/static\/chunks\/framework.+\.js)/, 'editorialedomani.it': /(js\.pelcro\.com\/.+|editorialedomani.it\/pelcro\.js)/, - 'foreignpolicy.com': /.+\.tinypass\.com\/.+/, + 'foreignpolicy.com': /(cdn\.cxense\.com\/|\.tinypass\.com\/)/, 'fortune.com': /.+\.tinypass\.com\/.+/, 'haaretz.co.il': /haaretz\.co\.il\/htz\/js\/inter\.js/, 'haaretz.com': /haaretz\.com\/hdc\/web\/js\/minified\/header-scripts-int.js.+/, diff --git a/src/js/contentScript.js b/src/js/contentScript.js index 0469260..f3701f2 100755 --- a/src/js/contentScript.js +++ b/src/js/contentScript.js @@ -649,11 +649,18 @@ if (matchDomain('elmercurio.com')) { if (paywall) { removeDOMElement(paywall); } else if (incognitoWall) { - removeDOMElement(incognitoWall); - } + removeDOMElement(incognitoWall); + } if (paywall || incognitoWall) { document.body.removeAttribute('style'); } +} else if (matchDomain('foreignpolicy.com')) { + const contentUngated = document.querySelector('div.content-ungated'); + removeDOMElement(contentUngated); + const contentGated = document.querySelector('div.content-gated'); + if (contentGated) { + contentGated.classList.remove('content-gated'); + } } function matchDomain (domains) {