diff --git a/README.md b/README.md index 0f2bba35..4c72ea6d 100644 --- a/README.md +++ b/README.md @@ -52,13 +52,19 @@ Voici la liste triée par ordre alphabétique : ### Presse étrangère - [Courrier international](https://www.courrierinternational.com) + - [De Morgen (Belgique - néerlandophone)](https://www.demorgen.be/) + - [De Standaard (Belgique - néerlandophone)](https://www.standaard.be/) + - [Knack (Belgique - néerlandophone)](https://www.knack.be/) - [L'Avenir (Belgique)](https://www.lavenir.net/) - [L'Orient-Le Jour (Liban)](https://www.lorientlejour.com/) - [La DH (Belgique)](https://www.dhnet.be/) - [La Libre Belgique](https://www.lalibre.be/) - [Le Soir (Belgique)](https://www.lesoir.be) - [Le Temps (Suisse)](https://www.letemps.ch/) + - [Le Vif (Belgique)](https://www.levif.be/) - [Sudinfo (Belgique)](https://www.sudinfo.be/) + - [The Economist (Royaume-Uni)](https://www.economist.com/) + - [Trends-Tendances (Belgique)](https://trends.levif.be/) Vous pouvez proposer d'autres sites Web de médias en ouvrant une [demande ici-même](https://github.com/lovasoa/ophirofox/issues). diff --git a/ophirofox/content_scripts/demorgen.css b/ophirofox/content_scripts/demorgen.css new file mode 100644 index 00000000..fb7772a1 --- /dev/null +++ b/ophirofox/content_scripts/demorgen.css @@ -0,0 +1,5 @@ +.ophirofox-europresse { + display: block; + margin-top: 1rem; + text-align: center; +} \ No newline at end of file diff --git a/ophirofox/content_scripts/demorgen.js b/ophirofox/content_scripts/demorgen.js new file mode 100644 index 00000000..93d3513f --- /dev/null +++ b/ophirofox/content_scripts/demorgen.js @@ -0,0 +1,39 @@ +function extractKeywords() { + const titleElem = document.querySelector("h1").childNodes[0]; + return titleElem && titleElem.textContent; +} + +let buttonAdded = false; + +async function addEuropresseButton() { + if(!buttonAdded) { + const elts = document.querySelectorAll('.tm-account'); + if (elts) { + for(let elt of elts){ + const a = await ophirofoxEuropresseLink(extractKeywords()); + elt.after(a); + buttonAdded = true; + } + } + } +} + +async function onLoad() { + const callback = (mutationList, observer) => { + for (const mutation of mutationList) { + if(mutation.type === 'attributes' && mutation.attributeName === 'class'){ + const newClassState = mutation.target.classList.contains('js-tm-backdrop-active'); + if(classState !== newClassState){ + addEuropresseButton(); + } + } + } + }; + + const htmlElement = document.querySelector('body'); + const classState = htmlElement.classList.contains('js-tm-backdrop-active'); + const observer = new MutationObserver(callback); + observer.observe(htmlElement, { attributes: true, subtree: true }); +} + +onLoad().catch(console.error); \ No newline at end of file diff --git a/ophirofox/content_scripts/destandaard.css b/ophirofox/content_scripts/destandaard.css new file mode 100644 index 00000000..4bf0956d --- /dev/null +++ b/ophirofox/content_scripts/destandaard.css @@ -0,0 +1,8 @@ +.ophirofox-europresse { + display: block; + padding: 0.5rem; + background-color: #d90000 !important; + color: #fff !important; + text-align: center; + text-decoration: none !important; +} \ No newline at end of file diff --git a/ophirofox/content_scripts/destandaard.js b/ophirofox/content_scripts/destandaard.js new file mode 100644 index 00000000..b578729d --- /dev/null +++ b/ophirofox/content_scripts/destandaard.js @@ -0,0 +1,34 @@ +function extractKeywords() { + return document.querySelector("h1").textContent; +} + +let buttonAdded = false; + +async function createLink() { + const subscriptionElem = document.querySelector('[data-current-screen="CtaAuthPaying"] form'); + if (subscriptionElem && buttonAdded == false){ + const a = await ophirofoxEuropresseLink(extractKeywords()); + subscriptionElem.after(a); + } +} + +async function onLoad() { + // Lien Europresse dans la modale au chargement de l'article + createLink(); + + // Lien Europresse dans le corps de l'article, une fois la modale fermée + const callback = (mutationList, observer) => { + for (const mutation of mutationList) { + if(mutation.removedNodes.length > 0){ + createLink(); + buttonAdded = true; + } + } + }; + + const htmlElement = document.querySelector('.cj-root'); + const observer = new MutationObserver(callback); + observer.observe(htmlElement, { childList: true}); +} + +onLoad().catch(console.error); \ No newline at end of file diff --git a/ophirofox/content_scripts/knack.css b/ophirofox/content_scripts/knack.css new file mode 100644 index 00000000..d61b085d --- /dev/null +++ b/ophirofox/content_scripts/knack.css @@ -0,0 +1,9 @@ +.ophirofox-europresse { + display: inline-block; + margin-top: 1rem; + padding: 0.5rem 1rem; + border: 1px solid #ee1c24; + color: #ee1c24; + font-size: 1.5rem; + font-weight: bold; +} \ No newline at end of file diff --git a/ophirofox/content_scripts/knack.js b/ophirofox/content_scripts/knack.js new file mode 100644 index 00000000..c9e6cee0 --- /dev/null +++ b/ophirofox/content_scripts/knack.js @@ -0,0 +1,37 @@ +function extractKeywords() { + const titleElem = document.querySelector("h1").childNodes[0]; + return titleElem && titleElem.textContent; +} + +let buttonAdded = false; + +async function addEuropresseButton() { + if(!buttonAdded) { + const elt = document.querySelector('.datawall-wrapper .register'); + if (elt) { + const a = await ophirofoxEuropresseLink(extractKeywords()); + elt.after(a); + buttonAdded = true; + } + } +} + +async function onLoad() { + const callback = (mutationList, observer) => { + for (const mutation of mutationList) { + if(mutation.type === 'attributes' && mutation.attributeName === 'class'){ + const newClassState = mutation.target.classList.contains('is-hidden'); + if(classState !== newClassState){ + addEuropresseButton(); + } + } + } + }; + + const htmlElement = document.querySelector('#paywall-modal'); + const classState = htmlElement.classList.contains('is-hidden'); + const observer = new MutationObserver(callback); + observer.observe(htmlElement, { attributes: true, subtree: true }); +} + +onLoad().catch(console.error); \ No newline at end of file diff --git a/ophirofox/content_scripts/levif.css b/ophirofox/content_scripts/levif.css new file mode 100644 index 00000000..d61b085d --- /dev/null +++ b/ophirofox/content_scripts/levif.css @@ -0,0 +1,9 @@ +.ophirofox-europresse { + display: inline-block; + margin-top: 1rem; + padding: 0.5rem 1rem; + border: 1px solid #ee1c24; + color: #ee1c24; + font-size: 1.5rem; + font-weight: bold; +} \ No newline at end of file diff --git a/ophirofox/content_scripts/levif.js b/ophirofox/content_scripts/levif.js new file mode 100644 index 00000000..c9e6cee0 --- /dev/null +++ b/ophirofox/content_scripts/levif.js @@ -0,0 +1,37 @@ +function extractKeywords() { + const titleElem = document.querySelector("h1").childNodes[0]; + return titleElem && titleElem.textContent; +} + +let buttonAdded = false; + +async function addEuropresseButton() { + if(!buttonAdded) { + const elt = document.querySelector('.datawall-wrapper .register'); + if (elt) { + const a = await ophirofoxEuropresseLink(extractKeywords()); + elt.after(a); + buttonAdded = true; + } + } +} + +async function onLoad() { + const callback = (mutationList, observer) => { + for (const mutation of mutationList) { + if(mutation.type === 'attributes' && mutation.attributeName === 'class'){ + const newClassState = mutation.target.classList.contains('is-hidden'); + if(classState !== newClassState){ + addEuropresseButton(); + } + } + } + }; + + const htmlElement = document.querySelector('#paywall-modal'); + const classState = htmlElement.classList.contains('is-hidden'); + const observer = new MutationObserver(callback); + observer.observe(htmlElement, { attributes: true, subtree: true }); +} + +onLoad().catch(console.error); \ No newline at end of file diff --git a/ophirofox/content_scripts/theeconomist.css b/ophirofox/content_scripts/theeconomist.css new file mode 100644 index 00000000..a7893409 --- /dev/null +++ b/ophirofox/content_scripts/theeconomist.css @@ -0,0 +1,10 @@ +.ophirofox-europresse{ + display: inline-block; + margin-top: 1rem; + color: #e3120b; + text-decoration: none; +} + +.ophirofox-europresse:hover{ + text-decoration: underline; +} \ No newline at end of file diff --git a/ophirofox/content_scripts/theeconomist.js b/ophirofox/content_scripts/theeconomist.js new file mode 100644 index 00000000..ca28a8f1 --- /dev/null +++ b/ophirofox/content_scripts/theeconomist.js @@ -0,0 +1,32 @@ +function extractKeywords() { + return document.querySelector("h1").textContent; +} + +async function createLink() { + const a = await ophirofoxEuropresseLink(extractKeywords()); + return a; +} + +async function onLoad() { + const callback = (mutationsList, observer) => { + for (const mutation of mutationsList) { + if(mutation.type === 'childList'){ + for(let node of mutation.addedNodes){ + const subscriptionElem = document.querySelector('section[data-body-id*="cp"]'); + if(node === subscriptionElem){ + const subtitle = document.querySelector('#new-article-template h2'); + createLink().then(function(data){ + subtitle.after(data); + }); + } + } + } + } + }; + + const htmlElement = document.querySelector('#new-article-template'); + const observer = new MutationObserver(callback); + observer.observe(htmlElement, { childList: true, subtree: true}); +} + +onLoad().catch(console.error); \ No newline at end of file diff --git a/ophirofox/content_scripts/trendstendances.css b/ophirofox/content_scripts/trendstendances.css new file mode 100644 index 00000000..5db00f28 --- /dev/null +++ b/ophirofox/content_scripts/trendstendances.css @@ -0,0 +1,10 @@ +.ophirofox-europresse { + display: inline-block; + margin-top: 1rem; + padding: 0.5rem 1rem; + border: 1px solid #5cb4ab; + color: #5cb4ab; + font-size: 1.5rem; + font-weight: bold; + text-decoration: none; +} \ No newline at end of file diff --git a/ophirofox/content_scripts/trendstendances.js b/ophirofox/content_scripts/trendstendances.js new file mode 100644 index 00000000..d455c45a --- /dev/null +++ b/ophirofox/content_scripts/trendstendances.js @@ -0,0 +1,37 @@ +function extractKeywords() { + const titleElem = document.querySelector("h1").childNodes[0]; + return titleElem && titleElem.textContent; +} + +let buttonAdded = false; + +async function addEuropresseButton() { + if(!buttonAdded) { + const elt = document.querySelector('.datawall-wrapper .login'); + if (elt) { + const a = await ophirofoxEuropresseLink(extractKeywords()); + elt.after(a); + buttonAdded = true; + } + } +} + +async function onLoad() { + const callback = (mutationList, observer) => { + for (const mutation of mutationList) { + if(mutation.type === 'attributes' && mutation.attributeName === 'class'){ + const newClassState = mutation.target.classList.contains('is-hidden'); + if(classState !== newClassState){ + addEuropresseButton(); + } + } + } + }; + + const htmlElement = document.querySelector('#paywall-modal'); + const classState = htmlElement.classList.contains('is-hidden'); + const observer = new MutationObserver(callback); + observer.observe(htmlElement, { attributes: true, subtree: true }); +} + +onLoad().catch(console.error); \ No newline at end of file diff --git a/ophirofox/manifest.json b/ophirofox/manifest.json index 26ca02a9..89042160 100644 --- a/ophirofox/manifest.json +++ b/ophirofox/manifest.json @@ -501,6 +501,78 @@ "css": [ "content_scripts/le-progres.css" ] + }, + { + "matches": [ + "https://www.levif.be/*" + ], + "js": [ + "content_scripts/config.js", + "content_scripts/levif.js" + ], + "css": [ + "content_scripts/levif.css" + ] + }, + { + "matches": [ + "https://trends.levif.be/*" + ], + "js": [ + "content_scripts/config.js", + "content_scripts/trendstendances.js" + ], + "css": [ + "content_scripts/trendstendances.css" + ] + }, + { + "matches": [ + "https://www.knack.be/*" + ], + "js": [ + "content_scripts/config.js", + "content_scripts/knack.js" + ], + "css": [ + "content_scripts/knack.css" + ] + }, + { + "matches": [ + "https://www.demorgen.be/*" + ], + "js": [ + "content_scripts/config.js", + "content_scripts/demorgen.js" + ], + "css": [ + "content_scripts/demorgen.css" + ] + }, + { + "matches": [ + "https://www.standaard.be/*" + ], + "js": [ + "content_scripts/config.js", + "content_scripts/destandaard.js" + ], + "css": [ + "content_scripts/destandaard.css" + ] + }, + { + "matches": [ + "https://www.economist.com/*" + ], + "js": [ + "content_scripts/config.js", + "content_scripts/theeconomist.js" + ], + "css": [ + "content_scripts/theeconomist.css" + ] } ], "browser_specific_settings": {