From 5245cb3a72bf721e67fb98bfdac18b122e62ea0e Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Mon, 14 Aug 2023 19:17:02 +0200 Subject: [PATCH 01/26] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e830676..00ce40e 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ L'extension fonctionne avec les portails universitaires suivants : - [**Europresse Université Paris Cité**](https://ezproxy.u-paris.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=UNIVPARIS) - [**Europresse Université de Franche-Comté**](http://scd1.univ-fcomte.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=FCOMTET_1) - [**Europresse Université de Pau et des pays de l'Adour**](https://nouveau-europresse-com.rproxy.univ-pau.fr/access/ip/default.aspx?un=uppaT_2) - - [**Europresse Université d'Artois**] (http://ezproxy.univ-artois.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=littoralT_1) + - [**Europresse Université d'Artois**](http://ezproxy.univ-artois.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=littoralT_1) Ou directement via le site Europresse. From f2e44b78cc492c2fd9d2583f199406073ed9ab90 Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Mon, 14 Aug 2023 20:59:23 +0200 Subject: [PATCH 02/26] Create lesoir.js --- ophirofox/content_scripts/lesoir.js | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 ophirofox/content_scripts/lesoir.js diff --git a/ophirofox/content_scripts/lesoir.js b/ophirofox/content_scripts/lesoir.js new file mode 100644 index 0000000..45a48ac --- /dev/null +++ b/ophirofox/content_scripts/lesoir.js @@ -0,0 +1,32 @@ +async function makeEuropresseUrl() { + const keywords = extractKeywords(); + return await makeOphirofoxReadingLink(keywords); +} + +function extractKeywords() { + return document.querySelector("h1").textContent; +} + +async function createLink() { + const a = document.createElement("a"); + a.href = await makeEuropresseUrl(new URL(window.location)); + a.textContent = "Lire sur Europresse"; + a.className = "fig-premium-mark-article__text ophirofox-europresse"; + return a; +} + + +function findPremiumBanner() { + const title = document.querySelector("h1"); + if (!title) return null; + const elems = title.parentElement.querySelectorAll("span"); + return [...elems].find(d => d.textContent.includes("réservé aux abonnés")) +} + +async function onLoad() { + const premiumBanner = findPremiumBanner(); + if (!premiumBanner) return; + premiumBanner.after(await createLink()); +} + +onLoad().catch(console.error); From da389ea582184eb69eda23fef8a9553fec53e299 Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Mon, 14 Aug 2023 21:01:55 +0200 Subject: [PATCH 03/26] Update manifest.json --- ophirofox/manifest.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ophirofox/manifest.json b/ophirofox/manifest.json index 2f2770a..c83ffd2 100644 --- a/ophirofox/manifest.json +++ b/ophirofox/manifest.json @@ -123,6 +123,15 @@ "content_scripts/le-point.css" ] }, + { + "matches": [ + "https://www.lesoir.be/*" + ], + "js": [ + "content_scripts/config.js", + "content_scripts/lesoir.js" + ] + }, { "matches": [ "https://nouveau.europresse.com/Search/Reading*", From 9002d89698a0677aa64979ffe86dac7c49ec5626 Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Tue, 15 Aug 2023 09:06:55 +0200 Subject: [PATCH 04/26] Create lesoir.css --- ophirofox/content_scripts/lesoir.css | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 ophirofox/content_scripts/lesoir.css diff --git a/ophirofox/content_scripts/lesoir.css b/ophirofox/content_scripts/lesoir.css new file mode 100644 index 0000000..789d488 --- /dev/null +++ b/ophirofox/content_scripts/lesoir.css @@ -0,0 +1,3 @@ +.ophirofox-europresse { + margin-left: 10px; +} From ec94ce6e83740698262a745f4acd9142ede981a7 Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Tue, 15 Aug 2023 09:08:05 +0200 Subject: [PATCH 05/26] Update manifest.json --- ophirofox/manifest.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ophirofox/manifest.json b/ophirofox/manifest.json index c83ffd2..d29eb27 100644 --- a/ophirofox/manifest.json +++ b/ophirofox/manifest.json @@ -130,6 +130,9 @@ "js": [ "content_scripts/config.js", "content_scripts/lesoir.js" + ], + "css": [ + "content_scripts/lesoir.css" ] }, { From 8c23277056cfd8775e75a02aa4873b82935e14bf Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Tue, 15 Aug 2023 09:12:21 +0200 Subject: [PATCH 06/26] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 00ce40e..a720a76 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ L'extension fonctionne avec les portails universitaires suivants : - [L'Humanité](https://www.humanite.fr) - [La Montagne](https://www.lamontagne.fr) - [Le Point](https://www.lepoint.fr) + - [Le Soir](https://www.lesoir.be) Vous pouvez proposer d'autres sites en ouvrant une [demande sur github](https://github.com/lovasoa/ophirofox/issues) From 42d6d5135d9fb649ae8ad34434d15c9b263bde8d Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Tue, 15 Aug 2023 09:13:25 +0200 Subject: [PATCH 07/26] Create ft.js --- ophirofox/content_scripts/ft.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 ophirofox/content_scripts/ft.js diff --git a/ophirofox/content_scripts/ft.js b/ophirofox/content_scripts/ft.js new file mode 100644 index 0000000..832d3fb --- /dev/null +++ b/ophirofox/content_scripts/ft.js @@ -0,0 +1,32 @@ +async function makeEuropresseUrl() { + const keywords = extractKeywords(); + return await makeOphirofoxReadingLink(keywords); +} + +function extractKeywords() { + return document.querySelector("h1").textContent; +} + +async function createLink() { + const a = document.createElement("a"); + a.href = await makeEuropresseUrl(new URL(window.location)); + a.textContent = "Lire sur Europresse"; + a.className = "fig-premium-mark-article__text ophirofox-europresse"; + return a; +} + + +function findPremiumBanner() { + const title = document.querySelector("h1"); + if (!title) return null; + const elems = title.parentElement.querySelectorAll("span"); + return [...elems].find(d => d.textContent.includes("unlock this article")) +} + +async function onLoad() { + const premiumBanner = findPremiumBanner(); + if (!premiumBanner) return; + premiumBanner.after(await createLink()); +} + +onLoad().catch(console.error); From bef7f13517bd41115c2910e3bfadeb2c87395a14 Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Tue, 15 Aug 2023 09:14:26 +0200 Subject: [PATCH 08/26] Update manifest.json --- ophirofox/manifest.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ophirofox/manifest.json b/ophirofox/manifest.json index d29eb27..20fd773 100644 --- a/ophirofox/manifest.json +++ b/ophirofox/manifest.json @@ -135,6 +135,18 @@ "content_scripts/lesoir.css" ] }, + { + "matches": [ + "https://www.ft.com/*" + ], + "js": [ + "content_scripts/config.js", + "content_scripts/ft.js" + ], + "css": [ + "content_scripts/ft.css" + ] + }, { "matches": [ "https://nouveau.europresse.com/Search/Reading*", From 38b38a08aaf18f5ed8fb32ea057243c9bcb00e27 Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Tue, 15 Aug 2023 09:15:01 +0200 Subject: [PATCH 09/26] Create ft.css --- ophirofox/content_scripts/ft.css | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 ophirofox/content_scripts/ft.css diff --git a/ophirofox/content_scripts/ft.css b/ophirofox/content_scripts/ft.css new file mode 100644 index 0000000..789d488 --- /dev/null +++ b/ophirofox/content_scripts/ft.css @@ -0,0 +1,3 @@ +.ophirofox-europresse { + margin-left: 10px; +} From 214ed61bd6afc3d71876fea36b0d084345a5cefa Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Tue, 15 Aug 2023 09:25:18 +0200 Subject: [PATCH 10/26] Update ft.js --- ophirofox/content_scripts/ft.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ophirofox/content_scripts/ft.js b/ophirofox/content_scripts/ft.js index 832d3fb..69340db 100644 --- a/ophirofox/content_scripts/ft.js +++ b/ophirofox/content_scripts/ft.js @@ -20,7 +20,7 @@ function findPremiumBanner() { const title = document.querySelector("h1"); if (!title) return null; const elems = title.parentElement.querySelectorAll("span"); - return [...elems].find(d => d.textContent.includes("unlock this article")) + return [...elems].find(d => d.textContent.includes("Keep reading")) } async function onLoad() { From d27e75616617b3eba9b27e378c5010721b90f89d Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Tue, 15 Aug 2023 09:29:45 +0200 Subject: [PATCH 11/26] Update ft.js --- ophirofox/content_scripts/ft.js | 37 ++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/ophirofox/content_scripts/ft.js b/ophirofox/content_scripts/ft.js index 69340db..a5bb651 100644 --- a/ophirofox/content_scripts/ft.js +++ b/ophirofox/content_scripts/ft.js @@ -1,32 +1,39 @@ -async function makeEuropresseUrl() { +async function makeEuropresseUrl(ftUrl) { + const m = ftUrl.pathname.match(/(\d{4})\/(\d{2})\/(\d{2})\/.*?(\d+_\d+).html/); + if (!m) throw new Error("Format d'URL ft inconnu"); + // docKey : `news·${m[1]}${m[2]}${m[3]}·LMF·${m[4]}`); const keywords = extractKeywords(); return await makeOphirofoxReadingLink(keywords); } function extractKeywords() { - return document.querySelector("h1").textContent; + return extractKeywordsFromTitle() || extractKeywordsFromUrl(window.location); +} + +function extractKeywordsFromTitle() { + const titleElem = document.querySelector("h1.article__title"); + return titleElem && titleElem.textContent; +} + +function extractKeywordsFromUrl(url) { + const source_url = new URL(url); + const ft_match = source_url.pathname.match(/([^/.]+)(_\d*_\d*\.html)?$/); + if (!ft_match) throw new Error("Could not find keywords in ft url"); + return ft_match[1]; } async function createLink() { const a = document.createElement("a"); - a.href = await makeEuropresseUrl(new URL(window.location)); a.textContent = "Lire sur Europresse"; - a.className = "fig-premium-mark-article__text ophirofox-europresse"; + a.className = "btn btn--premium ophirofox-europresse"; + a.href = await makeEuropresseUrl(new URL(window.location)); return a; } - -function findPremiumBanner() { - const title = document.querySelector("h1"); - if (!title) return null; - const elems = title.parentElement.querySelectorAll("span"); - return [...elems].find(d => d.textContent.includes("Keep reading")) -} - async function onLoad() { - const premiumBanner = findPremiumBanner(); - if (!premiumBanner) return; - premiumBanner.after(await createLink()); + const statusElem = document.querySelector(".article__status"); + if (!statusElem) return; + statusElem.appendChild(await createLink()); } onLoad().catch(console.error); From c4ebce7d438ae8070559595b1a01b89d66dd1e40 Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Tue, 15 Aug 2023 09:46:01 +0200 Subject: [PATCH 12/26] Delete ft.css --- ophirofox/content_scripts/ft.css | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 ophirofox/content_scripts/ft.css diff --git a/ophirofox/content_scripts/ft.css b/ophirofox/content_scripts/ft.css deleted file mode 100644 index 789d488..0000000 --- a/ophirofox/content_scripts/ft.css +++ /dev/null @@ -1,3 +0,0 @@ -.ophirofox-europresse { - margin-left: 10px; -} From 510507aec1de93f7bdbbb937460bd88d284d9ba3 Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Tue, 15 Aug 2023 09:46:16 +0200 Subject: [PATCH 13/26] Delete ft.js --- ophirofox/content_scripts/ft.js | 39 --------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 ophirofox/content_scripts/ft.js diff --git a/ophirofox/content_scripts/ft.js b/ophirofox/content_scripts/ft.js deleted file mode 100644 index a5bb651..0000000 --- a/ophirofox/content_scripts/ft.js +++ /dev/null @@ -1,39 +0,0 @@ -async function makeEuropresseUrl(ftUrl) { - const m = ftUrl.pathname.match(/(\d{4})\/(\d{2})\/(\d{2})\/.*?(\d+_\d+).html/); - if (!m) throw new Error("Format d'URL ft inconnu"); - // docKey : `news·${m[1]}${m[2]}${m[3]}·LMF·${m[4]}`); - const keywords = extractKeywords(); - return await makeOphirofoxReadingLink(keywords); -} - -function extractKeywords() { - return extractKeywordsFromTitle() || extractKeywordsFromUrl(window.location); -} - -function extractKeywordsFromTitle() { - const titleElem = document.querySelector("h1.article__title"); - return titleElem && titleElem.textContent; -} - -function extractKeywordsFromUrl(url) { - const source_url = new URL(url); - const ft_match = source_url.pathname.match(/([^/.]+)(_\d*_\d*\.html)?$/); - if (!ft_match) throw new Error("Could not find keywords in ft url"); - return ft_match[1]; -} - -async function createLink() { - const a = document.createElement("a"); - a.textContent = "Lire sur Europresse"; - a.className = "btn btn--premium ophirofox-europresse"; - a.href = await makeEuropresseUrl(new URL(window.location)); - return a; -} - -async function onLoad() { - const statusElem = document.querySelector(".article__status"); - if (!statusElem) return; - statusElem.appendChild(await createLink()); -} - -onLoad().catch(console.error); From 088b3ff992af83ea3e084083133cc69533eae75d Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Tue, 15 Aug 2023 09:47:03 +0200 Subject: [PATCH 14/26] Update manifest.json --- ophirofox/manifest.json | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/ophirofox/manifest.json b/ophirofox/manifest.json index 20fd773..d29eb27 100644 --- a/ophirofox/manifest.json +++ b/ophirofox/manifest.json @@ -135,18 +135,6 @@ "content_scripts/lesoir.css" ] }, - { - "matches": [ - "https://www.ft.com/*" - ], - "js": [ - "content_scripts/config.js", - "content_scripts/ft.js" - ], - "css": [ - "content_scripts/ft.css" - ] - }, { "matches": [ "https://nouveau.europresse.com/Search/Reading*", From 015ede31858400612fbdc3b5226bd7f2ec5980a1 Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Tue, 15 Aug 2023 09:52:30 +0200 Subject: [PATCH 15/26] Create ft.js --- ophirofox/content_scripts/ft.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 ophirofox/content_scripts/ft.js diff --git a/ophirofox/content_scripts/ft.js b/ophirofox/content_scripts/ft.js new file mode 100644 index 0000000..edc42e9 --- /dev/null +++ b/ophirofox/content_scripts/ft.js @@ -0,0 +1,32 @@ +async function makeEuropresseUrl() { + const keywords = extractKeywords(); + return await makeOphirofoxReadingLink(keywords); +} + +function extractKeywords() { + return document.querySelector("title").textContent; +} + +async function createLink() { + const a = document.createElement("a"); + a.href = await makeEuropresseUrl(new URL(window.location)); + a.textContent = "Lire sur Europresse"; + a.className = "ft-premium-mark-article__text ophirofox-europresse"; + return a; +} + + +function findPremiumBanner() { + const title = document.querySelector("h1"); + if (!title) return null; + const elems = title.parentElement.querySelectorAll("span"); + return [...elems].find(d => d.textContent.includes("Subscribe to unlock this article")) +} + +async function onLoad() { + const premiumBanner = findPremiumBanner(); + if (!premiumBanner) return; + premiumBanner.after(await createLink()); +} + +onLoad().catch(console.error); From f06aaacf7b90d27312b73048dc5de55c9831920d Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Tue, 15 Aug 2023 09:53:20 +0200 Subject: [PATCH 16/26] Update manifest.json --- ophirofox/manifest.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ophirofox/manifest.json b/ophirofox/manifest.json index d29eb27..5fdc2d2 100644 --- a/ophirofox/manifest.json +++ b/ophirofox/manifest.json @@ -135,6 +135,15 @@ "content_scripts/lesoir.css" ] }, + { + "matches": [ + "https://www.ft.com/*" + ], + "js": [ + "content_scripts/config.js", + "content_scripts/ft.js" + ] + }, { "matches": [ "https://nouveau.europresse.com/Search/Reading*", From 39f8640a00e943c1cce6f2385622ce201dd0339b Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Tue, 15 Aug 2023 09:57:09 +0200 Subject: [PATCH 17/26] Delete ft.js --- ophirofox/content_scripts/ft.js | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 ophirofox/content_scripts/ft.js diff --git a/ophirofox/content_scripts/ft.js b/ophirofox/content_scripts/ft.js deleted file mode 100644 index edc42e9..0000000 --- a/ophirofox/content_scripts/ft.js +++ /dev/null @@ -1,32 +0,0 @@ -async function makeEuropresseUrl() { - const keywords = extractKeywords(); - return await makeOphirofoxReadingLink(keywords); -} - -function extractKeywords() { - return document.querySelector("title").textContent; -} - -async function createLink() { - const a = document.createElement("a"); - a.href = await makeEuropresseUrl(new URL(window.location)); - a.textContent = "Lire sur Europresse"; - a.className = "ft-premium-mark-article__text ophirofox-europresse"; - return a; -} - - -function findPremiumBanner() { - const title = document.querySelector("h1"); - if (!title) return null; - const elems = title.parentElement.querySelectorAll("span"); - return [...elems].find(d => d.textContent.includes("Subscribe to unlock this article")) -} - -async function onLoad() { - const premiumBanner = findPremiumBanner(); - if (!premiumBanner) return; - premiumBanner.after(await createLink()); -} - -onLoad().catch(console.error); From cd75486b4ed261655bc122100fc880d95410f5c4 Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Tue, 15 Aug 2023 09:57:47 +0200 Subject: [PATCH 18/26] Update manifest.json --- ophirofox/manifest.json | 9 --------- 1 file changed, 9 deletions(-) diff --git a/ophirofox/manifest.json b/ophirofox/manifest.json index 5fdc2d2..d29eb27 100644 --- a/ophirofox/manifest.json +++ b/ophirofox/manifest.json @@ -135,15 +135,6 @@ "content_scripts/lesoir.css" ] }, - { - "matches": [ - "https://www.ft.com/*" - ], - "js": [ - "content_scripts/config.js", - "content_scripts/ft.js" - ] - }, { "matches": [ "https://nouveau.europresse.com/Search/Reading*", From 16c99209a6b960924eed206127177634283a5ce4 Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Tue, 15 Aug 2023 10:01:17 +0200 Subject: [PATCH 19/26] Create ft.js --- ophirofox/content_scripts/ft.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 ophirofox/content_scripts/ft.js diff --git a/ophirofox/content_scripts/ft.js b/ophirofox/content_scripts/ft.js new file mode 100644 index 0000000..85761c0 --- /dev/null +++ b/ophirofox/content_scripts/ft.js @@ -0,0 +1,32 @@ +async function makeEuropresseUrl() { + const keywords = extractKeywords(); + return await makeOphirofoxReadingLink(keywords); +} + +function extractKeywords() { + return document.querySelector("title").textContent; +} + +async function createLink() { + const a = document.createElement("a"); + a.href = await makeEuropresseUrl(new URL(window.location)); + a.textContent = "Lire sur Europresse"; + a.className = "ft-premium-mark-article__text ophirofox-europresse"; + return a; +} + + +function findPremiumBanner() { + const title = document.querySelector("title"); + if (!title) return null; + const elems = title.parentElement.querySelectorAll("span"); + return [...elems].find(d => d.textContent.includes("unlock this article")) +} + +async function onLoad() { + const premiumBanner = findPremiumBanner(); + if (!premiumBanner) return; + premiumBanner.after(await createLink()); +} + +onLoad().catch(console.error); From bb4ce8dc111da2acda58ddc689f746d5ab926745 Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Tue, 15 Aug 2023 10:01:55 +0200 Subject: [PATCH 20/26] Update manifest.json --- ophirofox/manifest.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ophirofox/manifest.json b/ophirofox/manifest.json index d29eb27..5fdc2d2 100644 --- a/ophirofox/manifest.json +++ b/ophirofox/manifest.json @@ -135,6 +135,15 @@ "content_scripts/lesoir.css" ] }, + { + "matches": [ + "https://www.ft.com/*" + ], + "js": [ + "content_scripts/config.js", + "content_scripts/ft.js" + ] + }, { "matches": [ "https://nouveau.europresse.com/Search/Reading*", From cad30506b1f04bbb380f036595c5d7daff92383d Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Tue, 15 Aug 2023 10:10:40 +0200 Subject: [PATCH 21/26] Update ft.js --- ophirofox/content_scripts/ft.js | 36 +++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/ophirofox/content_scripts/ft.js b/ophirofox/content_scripts/ft.js index 85761c0..027b62c 100644 --- a/ophirofox/content_scripts/ft.js +++ b/ophirofox/content_scripts/ft.js @@ -1,32 +1,38 @@ -async function makeEuropresseUrl() { +async function makeEuropresseUrl(lemondeUrl) { const keywords = extractKeywords(); return await makeOphirofoxReadingLink(keywords); } function extractKeywords() { - return document.querySelector("title").textContent; + return extractKeywordsFromTitle(); +} + +function extractArticleNumber(){ + let url = window.location.pathname; + let parameters = url.split('/'); + return parameters[parameters.length - 1]; +} + +function extractKeywordsFromTitle() { + const titleElem = document.getElementsByClassName("crayon article-titre-" + extractArticleNumber() + " h1")[0].innerHTML; + return titleElem; } async function createLink() { const a = document.createElement("a"); - a.href = await makeEuropresseUrl(new URL(window.location)); a.textContent = "Lire sur Europresse"; - a.className = "ft-premium-mark-article__text ophirofox-europresse"; + a.className = "btn btn--premium ophirofox-europresse"; + a.href = await makeEuropresseUrl(new URL(window.location)); return a; } - -function findPremiumBanner() { - const title = document.querySelector("title"); - if (!title) return null; - const elems = title.parentElement.querySelectorAll("span"); - return [...elems].find(d => d.textContent.includes("unlock this article")) -} - async function onLoad() { - const premiumBanner = findPremiumBanner(); - if (!premiumBanner) return; - premiumBanner.after(await createLink()); + const payArticle = document.querySelector('.promo_dispo_article'); + if (!payArticle) return; + + const actionElem = document.querySelector(".actions-article"); + if (!actionElem) return; + actionElem.appendChild(await createLink()); } onLoad().catch(console.error); From 7b373d940c1e7410c70e72c8aa2280bd49787bd3 Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Tue, 15 Aug 2023 10:13:15 +0200 Subject: [PATCH 22/26] Update ft.js --- ophirofox/content_scripts/ft.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/ophirofox/content_scripts/ft.js b/ophirofox/content_scripts/ft.js index 027b62c..4dc4d97 100644 --- a/ophirofox/content_scripts/ft.js +++ b/ophirofox/content_scripts/ft.js @@ -4,18 +4,7 @@ async function makeEuropresseUrl(lemondeUrl) { } function extractKeywords() { - return extractKeywordsFromTitle(); -} - -function extractArticleNumber(){ - let url = window.location.pathname; - let parameters = url.split('/'); - return parameters[parameters.length - 1]; -} - -function extractKeywordsFromTitle() { - const titleElem = document.getElementsByClassName("crayon article-titre-" + extractArticleNumber() + " h1")[0].innerHTML; - return titleElem; + return document.querySelector("title").textContent; } async function createLink() { @@ -27,7 +16,7 @@ async function createLink() { } async function onLoad() { - const payArticle = document.querySelector('.promo_dispo_article'); + const payArticle = document.querySelector('.opt unlock_banner'); if (!payArticle) return; const actionElem = document.querySelector(".actions-article"); From 587d38d71da26bcb90230fe0281a704d59a2338f Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Tue, 15 Aug 2023 10:14:32 +0200 Subject: [PATCH 23/26] Update ft.js --- ophirofox/content_scripts/ft.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ophirofox/content_scripts/ft.js b/ophirofox/content_scripts/ft.js index 4dc4d97..2a07725 100644 --- a/ophirofox/content_scripts/ft.js +++ b/ophirofox/content_scripts/ft.js @@ -18,10 +18,7 @@ async function createLink() { async function onLoad() { const payArticle = document.querySelector('.opt unlock_banner'); if (!payArticle) return; - - const actionElem = document.querySelector(".actions-article"); - if (!actionElem) return; - actionElem.appendChild(await createLink()); + payArticle.after(await createLink()); } onLoad().catch(console.error); From 26b7b974de448c187db9c394bdfc27740021ab60 Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Tue, 15 Aug 2023 10:18:59 +0200 Subject: [PATCH 24/26] Update ft.js --- ophirofox/content_scripts/ft.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ophirofox/content_scripts/ft.js b/ophirofox/content_scripts/ft.js index 2a07725..b3001df 100644 --- a/ophirofox/content_scripts/ft.js +++ b/ophirofox/content_scripts/ft.js @@ -4,7 +4,7 @@ async function makeEuropresseUrl(lemondeUrl) { } function extractKeywords() { - return document.querySelector("title").textContent; + return document.querySelector("h1").textContent; } async function createLink() { From 017480e7c84f77ba4a3ddd1b71b4870f1dcaf1e9 Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Tue, 15 Aug 2023 10:20:21 +0200 Subject: [PATCH 25/26] Update ft.js --- ophirofox/content_scripts/ft.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ophirofox/content_scripts/ft.js b/ophirofox/content_scripts/ft.js index b3001df..27f4800 100644 --- a/ophirofox/content_scripts/ft.js +++ b/ophirofox/content_scripts/ft.js @@ -1,4 +1,4 @@ -async function makeEuropresseUrl(lemondeUrl) { +async function makeEuropresseUrl() { const keywords = extractKeywords(); return await makeOphirofoxReadingLink(keywords); } @@ -16,7 +16,7 @@ async function createLink() { } async function onLoad() { - const payArticle = document.querySelector('.opt unlock_banner'); + const payArticle = document.querySelector('.barrier-banner__container'); if (!payArticle) return; payArticle.after(await createLink()); } From 3682d1756645b9bc64c91cfa7fa3b97d5a44bbb6 Mon Sep 17 00:00:00 2001 From: fmoncomble <59739627+fmoncomble@users.noreply.github.com> Date: Tue, 15 Aug 2023 10:30:20 +0200 Subject: [PATCH 26/26] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a720a76..48fb610 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ L'extension fonctionne avec les portails universitaires suivants : - [La Montagne](https://www.lamontagne.fr) - [Le Point](https://www.lepoint.fr) - [Le Soir](https://www.lesoir.be) + - [Financial Times](https://www.ft.com/) Vous pouvez proposer d'autres sites en ouvrant une [demande sur github](https://github.com/lovasoa/ophirofox/issues)