diff --git a/README.md b/README.md index 611b8e45..c7df4ab8 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ Voici la liste triée par ordre alphabétique : - [Sud Ouest](https://www.sudouest.fr/) - [Le Télégramme](https://www.letelegramme.fr/) - [Le Progrès](https://www.leprogres.fr/) + - [Le Courrier des maires](https://www.courrierdesmaires.fr/) ### Presse étrangère - [Courrier international](https://www.courrierinternational.com) diff --git a/ophirofox/content_scripts/courrier-maires.css b/ophirofox/content_scripts/courrier-maires.css new file mode 100644 index 00000000..3f6adc8d --- /dev/null +++ b/ophirofox/content_scripts/courrier-maires.css @@ -0,0 +1,13 @@ +.ophirofox-europresse { + background-color: #fec22d; + padding: 1rem 1.5rem; + color: #262626; + text-align: center; + display: block; + margin-top: 1rem; + margin-bottom: 1rem; +} + +.ophirofox-europresse:hover { + background-color: #e5ae29; +} diff --git a/ophirofox/content_scripts/courrier-maires.js b/ophirofox/content_scripts/courrier-maires.js new file mode 100644 index 00000000..3d10bf32 --- /dev/null +++ b/ophirofox/content_scripts/courrier-maires.js @@ -0,0 +1,12 @@ +async function createLink() { + return await ophirofoxEuropresseLink(); +} + +async function onLoad() { + const statusElem = document.querySelector(".encartEssai"); + const abo = document.querySelector(".etiquetteArt"); + if (!statusElem || !abo) return; + statusElem.before(await createLink()); +} + +onLoad().catch(console.error); diff --git a/ophirofox/content_scripts/europresse_search.js b/ophirofox/content_scripts/europresse_search.js index 11cce167..bf79e379 100644 --- a/ophirofox/content_scripts/europresse_search.js +++ b/ophirofox/content_scripts/europresse_search.js @@ -16,7 +16,8 @@ async function onLoad() { path.startsWith("/Search/Advanced") || path.startsWith("/Search/AdvancedMobile") || path.startsWith("/Search/Express") || - path.startsWith("/Search/Simple") + path.startsWith("/Search/Simple") || + path.startsWith("/Search/Result") )) return; const { search_terms, published_time } = await consumeReadRequest(); if (!search_terms) return; @@ -34,7 +35,8 @@ async function onLoad() { .split(/[^\p{L}\p{M}\p{Nd}]+/u) .filter(w => !stopwords.has(w)) .join(' '); - const keyword_field = document.getElementById("Keywords"); + const keyword_field_id = path.startsWith("/Search/Result") ? "NativeQuery" : "Keywords"; + const keyword_field = document.getElementById(keyword_field_id); keyword_field.value = 'TIT_HEAD=' + keywords; // Looking for a time range diff --git a/ophirofox/content_scripts/la-provence.js b/ophirofox/content_scripts/la-provence.js index 63da85e0..16a99350 100644 --- a/ophirofox/content_scripts/la-provence.js +++ b/ophirofox/content_scripts/la-provence.js @@ -6,10 +6,10 @@ async function createLink() { function findPremiumBanner() { - const title = document.querySelector(".header-article-premium__stamp"); - if (!title) return null; - const elems = title.parentElement.querySelectorAll("span"); - return [...elems].find(d => d.textContent.includes("Article réservé aux abonnés")) + const array = document.querySelectorAll(".rev-margin-0.rev-text-xs-bold"); + const reserve = Array.from(array).find(p => p.textContent.includes("Article réservé aux abonnés")); + if (!reserve) return null; + return reserve } async function onLoad() { diff --git a/ophirofox/manifest.json b/ophirofox/manifest.json index b5f12d53..7305bcd8 100644 --- a/ophirofox/manifest.json +++ b/ophirofox/manifest.json @@ -160,6 +160,18 @@ "content_scripts/monde-diplo.js" ] }, + { + "matches": [ + "https://www.courrierdesmaires.fr/*" + ], + "js": [ + "content_scripts/config.js", + "content_scripts/courrier-maires.js" + ], + "css": [ + "content_scripts/courrier-maires.css" + ] + }, { "matches": [ "https://www.la-croix.com/*"