From f2b2085bba193e9fe834ea27f714cf3318bec7ee Mon Sep 17 00:00:00 2001 From: Joffrey <541722+Write@users.noreply.github.com> Date: Sun, 1 Sep 2024 07:34:02 +0200 Subject: [PATCH] Fix lesechos (#242) * fix lesechos * update descriptions onLoad() of lesechos --- ophirofox/content_scripts/lesechos.css | 4 +- ophirofox/content_scripts/lesechos.js | 59 ++++++++++++++++++-------- 2 files changed, 43 insertions(+), 20 deletions(-) diff --git a/ophirofox/content_scripts/lesechos.css b/ophirofox/content_scripts/lesechos.css index a9bb4f60..aecd8f62 100644 --- a/ophirofox/content_scripts/lesechos.css +++ b/ophirofox/content_scripts/lesechos.css @@ -6,5 +6,5 @@ border: 1px solid grey; border-radius: 50px; text-decoration: none; - font-size: 0.85em; -} + font-size: 1.2rem; +} \ No newline at end of file diff --git a/ophirofox/content_scripts/lesechos.js b/ophirofox/content_scripts/lesechos.js index 502bf7ee..dad48d5b 100644 --- a/ophirofox/content_scripts/lesechos.js +++ b/ophirofox/content_scripts/lesechos.js @@ -6,7 +6,7 @@ function extractKeywords() { let buttonAdded = false; async function addEuropresseButton() { - if(!buttonAdded) { + if (!buttonAdded) { const elt = document.querySelector("button[aria-label=Commenter]")?.parentElement?.parentElement; if (elt) { const a = await ophirofoxEuropresseLink(extractKeywords()); @@ -17,40 +17,63 @@ async function addEuropresseButton() { } async function onLoad() { - + /* 2 cases: - 1. either a page is initially loaded, and we must wait for the actual end of loading (determined - by a new iframe #rufous-sandbox) and add the button (this is the first observer) - 2. Or a page is newly routed (for instance, when one goes from the homepage to an article) : + 1. either a page is initially loaded, and we must wait for the actual end of loading (determined + by a new meta with name ad:postAcces) and add the button (this is the first observer). + 2. Or a page is newly routed (for instance, when one goes from the homepage to an article) : - it is detected with the second observer that watches for changes in