Skip to content

Commit

Permalink
Ajout des sites L'Humanite, LaMontagne et Le point (#21)
Browse files Browse the repository at this point in the history
* Ajout du site LaMontagne

* Ajout du site L'Humanité

* Harmonisations tabs/spaces

* Harmonisations tabs/spaces

* Ajout du site Le Point
Modification Readme pour ajouter L'Humanité, La Montagne et Le Point.
  • Loading branch information
Rohirrim03 authored Feb 5, 2023
1 parent e241469 commit bf8f4a0
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ L'extension fonctionne avec les portails universitaires suivants :
- [Le Monde Diplomatique](https://www.www.monde-diplomatique.fr)
- [La Croix](https://www.la-croix.com)
- [Courrier international](https://www.courrierinternational.com)
- [L'Humanité](https://www.humanite.fr)
- [La Montagne](https://www.lamontagne.fr)
- [Le Point](https://www.lepoint.fr)

Vous pouvez proposer d'autres sites en ouvrant une [demande sur github](https://github.com/lovasoa/ophirofox/issues)

Expand Down
33 changes: 33 additions & 0 deletions ophirofox/content_scripts/humanite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
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";

const div = document.createElement("div");
div.className = "field-name-field-news-auteur ophirofox-europresse";

div.appendChild(a);

return div;
}

async function onLoad() {
const reserve = document.querySelector(".qiota_reserve");
if (!reserve) return;

const auteurElem = document.querySelector(".group-ft-auteur-date-media");
if (!auteurElem) return;

auteurElem.appendChild(await createLink());
}

onLoad().catch(console.error);
3 changes: 3 additions & 0 deletions ophirofox/content_scripts/la-montagne.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.ophirofox-europresse {
padding: 10px !important;
}
30 changes: 30 additions & 0 deletions ophirofox/content_scripts/la-montagne.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
async function makeEuropresseUrl() {
const keywords = extractKeywords();
return await makeOphirofoxReadingLink(keywords);
}

function extractKeywords() {
return document.querySelector("h1").textContent;
}

async function createLink() {
const span = document.createElement("span");
span.textContent = "Lire sur Europresse";
span.className = "premium-message ophirofox-europresse";

const a = document.createElement("a");
a.href = await makeEuropresseUrl(new URL(window.location));

a.appendChild(span);

return a;
}

async function onLoad() {
const reserve = document.querySelector(".premium-message");
if (!reserve) return;

reserve.parentElement.appendChild(await createLink());
}

onLoad().catch(console.error);
3 changes: 3 additions & 0 deletions ophirofox/content_scripts/le-point.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.ophirofox-europresse {
margin-left: 10px;
}
30 changes: 30 additions & 0 deletions ophirofox/content_scripts/le-point.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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.textContent = "Lire sur Europresse";
a.href = await makeEuropresseUrl(new URL(window.location));

const span = document.createElement("span");
span.className = "ophirofox-europresse";

span.appendChild(a);

return span;
}

async function onLoad() {
const reserve = document.querySelector(".ArticleHeader > .subscribers-only");
if (!reserve) return;

reserve.appendChild(await createLink());
}

onLoad().catch(console.error);
33 changes: 33 additions & 0 deletions ophirofox/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,39 @@
"content_scripts/courrier-international.css"
]
},
{
"matches": [
"https://www.lamontagne.fr/*"
],
"js": [
"content_scripts/config.js",
"content_scripts/la-montagne.js"
],
"css": [
"content_scripts/la-montagne.css"
]
},
{
"matches": [
"https://www.humanite.fr/*"
],
"js": [
"content_scripts/config.js",
"content_scripts/humanite.js"
]
},
{
"matches": [
"https://www.lepoint.fr/*"
],
"js": [
"content_scripts/config.js",
"content_scripts/le-point.js"
],
"css": [
"content_scripts/le-point.css"
]
},
{
"matches": [
"https://nouveau.europresse.com/Search/Reading*",
Expand Down

0 comments on commit bf8f4a0

Please sign in to comment.