-
-
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.
Fix bugs et style dans presse belge, UK et USA (#211)
* Add files via upload Fix : lien après h1 plutot que h2, parfois absent * FIX: bouton ne s'affichait pas systématiquement * Fix style : bouton plus facilement repérable
- Loading branch information
Showing
17 changed files
with
166 additions
and
76 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
.ophirofox-europresse { | ||
display: block; | ||
margin-top: 1rem; | ||
width: 12vw; | ||
margin: 1rem auto; | ||
padding: 0.25rem; | ||
border-radius: 0.3rem; | ||
background-color: #ffc700; | ||
color: #000 !important; | ||
text-align: center; | ||
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
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 |
---|---|---|
@@ -1,8 +1,17 @@ | ||
.ophirofox-europresse { | ||
display: block; | ||
padding: 0.5rem; | ||
background-color: #d90000 !important; | ||
color: #fff !important; | ||
display: inline-block; | ||
margin-top: 1rem; | ||
padding: 0.25rem 1rem; | ||
border-radius: 0.3rem; | ||
background-color: #ffc700 !important; | ||
color: #000 !important; | ||
text-align: center; | ||
text-decoration: none !important; | ||
} | ||
|
||
.ophirofox-modal-link { | ||
display: block; | ||
margin-top: 0; | ||
padding: 0.5rem; | ||
border-radius: 0; | ||
} |
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 |
---|---|---|
@@ -1,34 +1,46 @@ | ||
function extractKeywords() { | ||
return document.querySelector("h1").textContent; | ||
return document.querySelector("header h1").textContent; | ||
} | ||
|
||
let buttonAdded = false; | ||
|
||
async function createLink() { | ||
const subscriptionElem = document.querySelector('[data-current-screen="CtaAuthPaying"] form'); | ||
if (subscriptionElem && buttonAdded == false){ | ||
async function createLink(elt) { | ||
if (elt && buttonAdded == false){ | ||
const a = await ophirofoxEuropresseLink(extractKeywords()); | ||
subscriptionElem.after(a); | ||
elt.after(a); | ||
} | ||
} | ||
|
||
async function onLoad() { | ||
// Lien Europresse dans la modale au chargement de l'article | ||
createLink(); | ||
// Lien Europresse dans le corps de l'article | ||
const paywall = document.querySelector('[data-cj-root="subscription-wall"]'); | ||
const article_title = document.querySelector('header h1'); | ||
|
||
if(paywall){ | ||
createLink(article_title); | ||
} | ||
|
||
// Lien Europresse dans le corps de l'article, une fois la modale fermée | ||
// Lien Europresse dans la modale, au chargement | ||
const callback = (mutationList, observer) => { | ||
for (const mutation of mutationList) { | ||
if(mutation.removedNodes.length > 0){ | ||
createLink(); | ||
buttonAdded = true; | ||
if(mutation.type === 'childList'){ | ||
for(let node of mutation.addedNodes){ | ||
const paywall_modal = document.querySelector('.cj-root'); | ||
if(paywall_modal){ | ||
const subscriptionForm = document.querySelector('[data-current-screen="CtaAuthPaying"] form'); | ||
createLink(subscriptionForm); | ||
buttonAdded = true; | ||
subscriptionForm.nextElementSibling.classList.add('ophirofox-modal-link'); | ||
observer.disconnect(); | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
|
||
const htmlElement = document.querySelector('.cj-root'); | ||
const htmlElement = document.querySelector('body'); | ||
const observer = new MutationObserver(callback); | ||
observer.observe(htmlElement, { childList: true}); | ||
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 |
---|---|---|
@@ -1,8 +1,9 @@ | ||
.ophirofox-europresse { | ||
display: inline-block; | ||
margin-bottom: 1rem; | ||
padding: 0.25rem 1rem; | ||
border: 1px solid #fff; | ||
color: #fff; | ||
padding: 0.5rem 1.5rem; | ||
border-radius: 0.3rem; | ||
background-color: #ffc700; | ||
color: #000; | ||
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 |
---|---|---|
@@ -1,6 +1,17 @@ | ||
.ophirofox-europresse { | ||
display: inline-block; | ||
margin-top: 1rem; | ||
padding: 0.25rem 1rem; | ||
border-radius: 0.3rem; | ||
background-color: #ffc700; | ||
color: #000 !important; | ||
text-align: center; | ||
text-decoration: none; | ||
} | ||
|
||
.ophirofox-modal-link { | ||
display: block; | ||
margin-top: 0; | ||
padding: 0.5rem; | ||
border: 1px solid #d21d10; | ||
text-align: center; | ||
border-radius: 0; | ||
} |
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 |
---|---|---|
@@ -1,34 +1,46 @@ | ||
function extractKeywords() { | ||
return document.querySelector("h1").textContent; | ||
return document.querySelector("header h1").textContent; | ||
} | ||
|
||
let buttonAdded = false; | ||
|
||
async function createLink() { | ||
const subscriptionElem = document.querySelector('[data-current-screen="StopEmailIdentification"] form'); | ||
if (subscriptionElem && buttonAdded == false){ | ||
async function createLink(elt) { | ||
if (elt && buttonAdded == false){ | ||
const a = await ophirofoxEuropresseLink(extractKeywords()); | ||
subscriptionElem.after(a); | ||
elt.after(a); | ||
} | ||
} | ||
|
||
async function onLoad() { | ||
// Lien Europresse dans la modale au chargement de l'article | ||
createLink(); | ||
// Lien Europresse dans le corps de l'article | ||
const paywall = document.querySelector('[data-cj-root="subscription-wall"]'); | ||
const article_title = document.querySelector('header h1'); | ||
|
||
if(paywall){ | ||
createLink(article_title); | ||
} | ||
|
||
// Lien Europresse dans le corps de l'article, une fois la modale fermée | ||
// Lien Europresse dans la modale, au chargement | ||
const callback = (mutationList, observer) => { | ||
for (const mutation of mutationList) { | ||
if(mutation.removedNodes.length > 0){ | ||
createLink(); | ||
buttonAdded = true; | ||
if(mutation.type === 'childList'){ | ||
for(let node of mutation.addedNodes){ | ||
const paywall_modal = document.querySelector('.cj-root'); | ||
if(paywall_modal){ | ||
const subscriptionForm = document.querySelector('[data-current-screen="StopEmailIdentification"] form'); | ||
createLink(subscriptionForm); | ||
buttonAdded = true; | ||
subscriptionForm.nextElementSibling.classList.add('ophirofox-modal-link'); | ||
observer.disconnect(); | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
|
||
const htmlElement = document.querySelector('.cj-root'); | ||
const htmlElement = document.querySelector('body'); | ||
const observer = new MutationObserver(callback); | ||
observer.observe(htmlElement, { childList: true}); | ||
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 |
---|---|---|
@@ -1,5 +1,11 @@ | ||
.ophirofox-europresse { | ||
display: block; | ||
margin-top: 1rem; | ||
width: 12vw; | ||
margin: 1rem auto; | ||
padding: 0.25rem; | ||
border-radius: 0.3rem; | ||
background-color: #ffc700; | ||
color: #000 !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
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 |
---|---|---|
@@ -1,6 +1,17 @@ | ||
.ophirofox-europresse { | ||
display: inline-block; | ||
margin-top: 1rem; | ||
padding: 0.25rem 1rem; | ||
border-radius: 0.3rem; | ||
background-color: #ffc700; | ||
color: #000 !important; | ||
text-align: center; | ||
text-decoration: none; | ||
} | ||
|
||
.ophirofox-modal-link { | ||
display: block; | ||
margin-top: 0; | ||
padding: 0.5rem; | ||
border: 1px solid #0071c7; | ||
text-align: center; | ||
border-radius: 0; | ||
} |
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 |
---|---|---|
@@ -1,34 +1,46 @@ | ||
function extractKeywords() { | ||
return document.querySelector("h1").textContent; | ||
return document.querySelector("header h1").textContent; | ||
} | ||
|
||
let buttonAdded = false; | ||
|
||
async function createLink() { | ||
const subscriptionElem = document.querySelector('[data-current-screen="StopEmailIdentification"] form'); | ||
if (subscriptionElem && buttonAdded == false){ | ||
async function createLink(elt) { | ||
if (elt && buttonAdded == false){ | ||
const a = await ophirofoxEuropresseLink(extractKeywords()); | ||
subscriptionElem.after(a); | ||
elt.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 | ||
async function onLoad() { | ||
// Lien Europresse dans le corps de l'article | ||
const paywall = document.querySelector('[data-cj-root="subscription-wall"]'); | ||
const article_title = document.querySelector('header h1'); | ||
|
||
if(paywall){ | ||
createLink(article_title); | ||
} | ||
|
||
// Lien Europresse dans la modale, au chargement | ||
const callback = (mutationList, observer) => { | ||
for (const mutation of mutationList) { | ||
if(mutation.removedNodes.length > 0){ | ||
createLink(); | ||
buttonAdded = true; | ||
if(mutation.type === 'childList'){ | ||
for(let node of mutation.addedNodes){ | ||
const paywall_modal = document.querySelector('.cj-root'); | ||
if(paywall_modal){ | ||
const subscriptionForm = document.querySelector('[data-current-screen="StopEmailIdentification"] form'); | ||
createLink(subscriptionForm); | ||
buttonAdded = true; | ||
subscriptionForm.nextElementSibling.classList.add('ophirofox-modal-link'); | ||
observer.disconnect(); | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
|
||
const htmlElement = document.querySelector('.cj-root'); | ||
const htmlElement = document.querySelector('body'); | ||
const observer = new MutationObserver(callback); | ||
observer.observe(htmlElement, { childList: true}); | ||
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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
.ophirofox-europresse { | ||
display: inline-block; | ||
margin-top: 1rem; | ||
padding: 0.5rem 1rem; | ||
border: 1px solid #ee1c24; | ||
color: #ee1c24; | ||
padding: 0.5rem 1.5rem; | ||
border-radius: 0.3rem; | ||
background-color: #ffc700; | ||
color: #000; | ||
font-family: "Aeonik","Publica Slab","Helvetica","Arial",sans-serif; | ||
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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
.ophirofox-europresse { | ||
display: inline-block; | ||
margin-top: 1rem; | ||
padding: 0.5rem 1rem; | ||
border: 1px solid #ee1c24; | ||
color: #ee1c24; | ||
padding: 0.5rem 1.5rem; | ||
border-radius: 0.3rem; | ||
background-color: #ffc700; | ||
color: #000; | ||
font-family: "Aeonik","Publica Slab","Helvetica","Arial",sans-serif; | ||
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 |
---|---|---|
@@ -1,10 +1,9 @@ | ||
.ophirofox-europresse{ | ||
display: inline-block; | ||
margin-top: 1rem; | ||
color: #e3120b; | ||
padding: 0.25rem 1rem; | ||
border-radius: 0.3rem; | ||
background-color: #ffc700; | ||
color: #000; | ||
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
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 |
---|---|---|
@@ -1,10 +1,11 @@ | ||
.ophirofox-europresse { | ||
display: inline-block; | ||
margin-top: 1rem; | ||
padding: 0.5rem 1rem; | ||
border: 1px solid #5cb4ab; | ||
color: #5cb4ab; | ||
padding: 0.5rem 1.5rem; | ||
border-radius: 0.3rem; | ||
background-color: #ffc700; | ||
color: #000; | ||
font-family: "Aeonik","Publica Slab","Helvetica","Arial",sans-serif; | ||
font-size: 1.5rem; | ||
font-weight: bold; | ||
text-decoration: none; | ||
} |
Oops, something went wrong.