-
-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ajout Washington Post, Financial Times et presse belge néerlandophone (…
…#210) * Ajout Washington Post, Financial Times et presse belge néerlandophone * Ajout Washington Post, Financial Times et presse belge néerlandophone * Ajout Washington Post, Financial Times et presse belge néerlandophone
- Loading branch information
Showing
12 changed files
with
257 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,8 @@ | ||
.ophirofox-europresse { | ||
display: inline-block; | ||
margin-bottom: 1rem; | ||
padding: 0.25rem 1rem; | ||
border: 1px solid #fff; | ||
color: #fff; | ||
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,17 @@ | ||
function extractKeywords() { | ||
return document.querySelector("#barrier-page h1").textContent; | ||
} | ||
|
||
async function createLink() { | ||
const a = await ophirofoxEuropresseLink(extractKeywords()); | ||
return a; | ||
} | ||
|
||
async function onLoad() { | ||
const paywall = document.querySelector('#barrier-page'); | ||
if (paywall == null) return; | ||
const title = document.querySelector("#barrier-page h1"); | ||
title.after(await createLink()); | ||
} | ||
|
||
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,6 @@ | ||
.ophirofox-europresse { | ||
display: block; | ||
padding: 0.5rem; | ||
border: 1px solid #d21d10; | ||
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,34 @@ | ||
function extractKeywords() { | ||
return document.querySelector("h1").textContent; | ||
} | ||
|
||
let buttonAdded = false; | ||
|
||
async function createLink() { | ||
const subscriptionElem = document.querySelector('[data-current-screen="StopEmailIdentification"] 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,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,6 @@ | ||
.ophirofox-europresse { | ||
display: block; | ||
padding: 0.5rem; | ||
border: 1px solid #0071c7; | ||
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,34 @@ | ||
function extractKeywords() { | ||
return document.querySelector("h1").textContent; | ||
} | ||
|
||
let buttonAdded = false; | ||
|
||
async function createLink() { | ||
const subscriptionElem = document.querySelector('[data-current-screen="StopEmailIdentification"] 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,8 @@ | ||
.ophirofox-europresse { | ||
display: flex; | ||
justify-content: center; | ||
margin: 1rem auto; | ||
padding: 0.25rem 1rem; | ||
width: 40%; | ||
border: 1px solid #1955a5; | ||
} |
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,35 @@ | ||
function extractKeywords() { | ||
const titleElem = document.querySelector("h1#main-content"); | ||
return titleElem.textContent; | ||
} | ||
|
||
async function createLink() { | ||
const a = await ophirofoxEuropresseLink(extractKeywords()); | ||
return a; | ||
} | ||
|
||
async function onLoad() { | ||
let linkAdded = false; | ||
const callback = (mutationsList, observer) => { | ||
for (const mutation of mutationsList) { | ||
if(!linkAdded){ | ||
const paywall_modal = document.querySelector('[data-qa="overlay-container"]'); | ||
const paywall_bottom = document.querySelector('#wall-bottom-drawer'); | ||
if(paywall_modal !== null || paywall_bottom !== null){ | ||
const title_bottom = document.querySelector('h1#HEADER'); | ||
createLink().then(function(data){ | ||
title_bottom.after(data); | ||
}); | ||
linkAdded = true; | ||
observer.disconnect(); | ||
} | ||
} | ||
} | ||
}; | ||
|
||
const htmlElement = document.querySelector('body'); | ||
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