Skip to content

Commit

Permalink
Merge branch 'lovasoa:master' into readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Altonss authored Sep 3, 2024
2 parents 1d4f3f5 + c712167 commit 6570cd9
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 13 additions & 0 deletions ophirofox/content_scripts/courrier-maires.css
Original file line number Diff line number Diff line change
@@ -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;
}
12 changes: 12 additions & 0 deletions ophirofox/content_scripts/courrier-maires.js
Original file line number Diff line number Diff line change
@@ -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);
6 changes: 4 additions & 2 deletions ophirofox/content_scripts/europresse_search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions ophirofox/content_scripts/la-provence.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
12 changes: 12 additions & 0 deletions ophirofox/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/*"
Expand Down

0 comments on commit 6570cd9

Please sign in to comment.