-
-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ajout presse belge et The Economist (#209)
* Ajout presse belge et The Economist Le Vif, Trends Tendances, Knack, De Standaard, De Morgen * ajout presse belge et The Economist * Ajout presse belge + The Economist
- Loading branch information
Showing
14 changed files
with
345 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.ophirofox-europresse { | ||
display: block; | ||
margin-top: 1rem; | ||
text-align: center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.ophirofox-europresse{ | ||
display: inline-block; | ||
margin-top: 1rem; | ||
color: #e3120b; | ||
text-decoration: none; | ||
} | ||
|
||
.ophirofox-europresse:hover{ | ||
text-decoration: underline; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters