From e32233681dcb234f4415fe487767b5be0255adfe Mon Sep 17 00:00:00 2001 From: pyccino <76261261+pyccino@users.noreply.github.com> Date: Thu, 8 Sep 2022 16:34:53 +0200 Subject: [PATCH 1/6] Added Support for The Economist Using the same code you already created for repubblica.it --- manifest.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index f63f2c3..0149ecb 100644 --- a/manifest.json +++ b/manifest.json @@ -9,14 +9,16 @@ "permissions": [ "webRequest", "webRequestBlocking", - "https://*.repubblica.it/*" + "https://*.repubblica.it/*", + "https://*.economist.com/*" ], "content_scripts": [ { "matches": [ "https://*.repubblica.it/*", "https://*.lastampa.it/*", - "https://*.gazzetta.it/*_preview.shtml*" + "https://*.gazzetta.it/*_preview.shtml*", + "https://*.economist.com/*" ], "run_at": "document_idle", "js": [ From 08994c5f99cff9ed4d3367e2a044712236a1f429 Mon Sep 17 00:00:00 2001 From: pyccino <76261261+pyccino@users.noreply.github.com> Date: Thu, 8 Sep 2022 16:39:01 +0200 Subject: [PATCH 2/6] Added support at economist --- background.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/background.js b/background.js index 65ae72e..0fcd8de 100644 --- a/background.js +++ b/background.js @@ -8,7 +8,7 @@ const fixHeaders = ({requestHeaders}) => { } const filters = { - urls: [ "https://*.repubblica.it/*" ], + urls: [ "https://*.repubblica.it/*","https://*.economist.com/*" ], types: [ "main_frame" ] } const opts = [ "blocking", "requestHeaders" ] From 3f874a91ed6f9ea2dfbf520e5e14cccd4fa9fb0d Mon Sep 17 00:00:00 2001 From: pyccino <76261261+pyccino@users.noreply.github.com> Date: Thu, 8 Sep 2022 18:38:00 +0200 Subject: [PATCH 3/6] Added support for corriere.it With this fix you are able to see any article you might want, but the article links and the dinamic images are not responsive. It works tho --- freeRep.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/freeRep.js b/freeRep.js index 4e8a0e9..8755316 100644 --- a/freeRep.js +++ b/freeRep.js @@ -1,6 +1,6 @@ // ==UserScript== // @name freeRep -// @version 1.6 +// @version 1.5 // @include https://*.repubblica.it/* // @include https://*.lastampa.it/* // @include https://*.gazzetta.it/*_preview.shtml* @@ -15,11 +15,15 @@ const checkAttr = (el, name, value) => { } return retv } - +function sleep(ms) { + return new Promise((resolve) => setTimeout(resolve, ms)); + } + const checkClassName = (el, name) => el.classList && el.classList.contains(name) const hide = el => { if (el) { el.style.display = "none" } } const removeAttr = (el, name) => { el && el.attributes.removeNamedItem(name) } + const isPaywall = el => checkAttr(el, "subscriptions-section", "content") const isPreview = el => checkAttr(el, "subscriptions-section", "content-not-granted") const isBanner = el => checkClassName(el, "paywall-static") @@ -27,10 +31,13 @@ const isNewPaywall = el => checkClassName(el, "paywall__content") const isGazzettaPaywall = el => checkClassName(el, "bck-freemium__wall") const isGazzettaPartnerLink = el => checkClassName(el, "is-partner-link") const isGazzettaContent = el => checkAttr(el, "class", "content") // exact match +const isCorrierePaywall = el => checkClassName(el, "tp-iframe-wrapper") +const isCorriereBlackscreen = el => checkClassName(el, "tp-backdrop") const isRepubblica = () => location.host.endsWith("repubblica.it") const isLaStampa = () => location.host.endsWith("lastampa.it") const isGazzettaIt = () => location.host.endsWith("gazzetta.it") +const isCorriere = () => location.host.endsWith("corriere.it") const findLaStampaPaywall = () => document.querySelector("div.main-content > #article-body > iframe") @@ -102,7 +109,13 @@ const freeRep = () => { const el = findLaStampaPaywall(); if (el) { el.replaceWith(createAmpLink()) - } + } + }else if(isCorriere()){ + sleep(1800).then(() => { + hide(findNode(document, isCorrierePaywall)) + hide(findNode(document, isCorriereBlackscreen)) + document.getElementsByTagName("body")[0].style = "overflow: visible !important" + }) } else { const el = findNode(document, isNewPaywall); if (el) { From ebf4c6713d0d9b37c0497e72cffc39cf44591299 Mon Sep 17 00:00:00 2001 From: pyccino <76261261+pyccino@users.noreply.github.com> Date: Thu, 8 Sep 2022 18:42:10 +0200 Subject: [PATCH 4/6] Update for corriere.it --- manifest.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 0149ecb..ba33e7a 100644 --- a/manifest.json +++ b/manifest.json @@ -10,7 +10,8 @@ "webRequest", "webRequestBlocking", "https://*.repubblica.it/*", - "https://*.economist.com/*" + "https://*.economist.com/*", + "https://*.corriere.it/*" ], "content_scripts": [ { @@ -18,7 +19,8 @@ "https://*.repubblica.it/*", "https://*.lastampa.it/*", "https://*.gazzetta.it/*_preview.shtml*", - "https://*.economist.com/*" + "https://*.economist.com/*", + "https://*.corriere.it/*" ], "run_at": "document_idle", "js": [ From b09348cbc157c737362795b47e03e8243d9ceea8 Mon Sep 17 00:00:00 2001 From: pyccino <76261261+pyccino@users.noreply.github.com> Date: Thu, 8 Sep 2022 18:44:32 +0200 Subject: [PATCH 5/6] Update manifest.json --- manifest.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/manifest.json b/manifest.json index ba33e7a..0149ecb 100644 --- a/manifest.json +++ b/manifest.json @@ -10,8 +10,7 @@ "webRequest", "webRequestBlocking", "https://*.repubblica.it/*", - "https://*.economist.com/*", - "https://*.corriere.it/*" + "https://*.economist.com/*" ], "content_scripts": [ { @@ -19,8 +18,7 @@ "https://*.repubblica.it/*", "https://*.lastampa.it/*", "https://*.gazzetta.it/*_preview.shtml*", - "https://*.economist.com/*", - "https://*.corriere.it/*" + "https://*.economist.com/*" ], "run_at": "document_idle", "js": [ From 66e99e70ad1565b971462521bef2029803ce7d5e Mon Sep 17 00:00:00 2001 From: pyccino <76261261+pyccino@users.noreply.github.com> Date: Thu, 8 Sep 2022 18:44:50 +0200 Subject: [PATCH 6/6] Update manifest.json --- manifest.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 0149ecb..ba33e7a 100644 --- a/manifest.json +++ b/manifest.json @@ -10,7 +10,8 @@ "webRequest", "webRequestBlocking", "https://*.repubblica.it/*", - "https://*.economist.com/*" + "https://*.economist.com/*", + "https://*.corriere.it/*" ], "content_scripts": [ { @@ -18,7 +19,8 @@ "https://*.repubblica.it/*", "https://*.lastampa.it/*", "https://*.gazzetta.it/*_preview.shtml*", - "https://*.economist.com/*" + "https://*.economist.com/*", + "https://*.corriere.it/*" ], "run_at": "document_idle", "js": [