summaryrefslogtreecommitdiff
path: root/src/js
diff options
context:
space:
mode:
authorache <ache@ache.one>2026-06-04 06:15:09 +0200
committerache <ache@ache.one>2026-06-04 06:18:14 +0200
commit13a9397d18d9369bc541fc83d7fdb2623066fcd8 (patch)
tree7d904bc0f465a439e91a325af7c098ad361a018c /src/js
parentFix footnotes i18n (diff)
Fix sidenotes when screen is too short
Diffstat (limited to 'src/js')
-rw-r--r--src/js/sidenotes.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/js/sidenotes.js b/src/js/sidenotes.js
index 9519c88..3160c1a 100644
--- a/src/js/sidenotes.js
+++ b/src/js/sidenotes.js
@@ -22,13 +22,22 @@ const resize = () => {
window.innerWidth ||
document.documentElement.clientWidth ||
document.body.clientWidth;
+
+ // Si la page est trop petite pour afficher les notes dans la marge, on ne fait rien
if (sidenote.offsetWidth < 200 || viewportWidth < 1400) {
sidenote.innerHTML = "";
return;
}
- const notes = Array.from(article.querySelectorAll("li")).filter((element) =>
- element.id.startsWith("user-content-fn"),
+ const notes = Array.from(article.querySelectorAll("li")).filter(
+ (element) => {
+ console.log("🦒", element.innerText);
+ return (
+ element.id.startsWith("user-content-fn") && // If it's a foot-note
+ !element.innerText.startsWith("http") && // But not a source
+ !element.innerText.startsWith("Source:")
+ );
+ },
);
const newSidenotes = notes.map((sidenoteLi) => {
const div = document.createElement("div");