fix footnotes

This commit is contained in:
isUnknown 2024-04-10 17:23:32 +02:00
parent c70b4890f8
commit 17517f3ee8
2 changed files with 32 additions and 1 deletions

View file

@ -25,11 +25,17 @@
} }
h1, h1,
h1 *,
h2, h2,
h2 *,
h3, h3,
h3 *,
h4, h4,
h4 *,
h5, h5,
p { h5 *,
p,
p * {
font-weight: var(--font-weight-light); font-weight: var(--font-weight-light);
line-height: 1; line-height: 1;
} }
@ -156,6 +162,14 @@ article p:not(:last-child) {
margin-bottom: var(--unit--vertical); margin-bottom: var(--unit--vertical);
} }
.footnote,
.footnote * {
scroll-margin-block-start: calc(var(--unit--vertical) * 6);
color: var(--color-secondary);
text-decoration: none !important;
font-weight: var(--font-weight-bold) !important;
}
@media screen and (min-width: 640px) { @media screen and (min-width: 640px) {
.title-center { .title-center {
margin-left: calc(2 * var(--unit--horizontal)); margin-left: calc(2 * var(--unit--horizontal));

View file

@ -130,6 +130,21 @@ function togglePanel(side) {
} }
} }
function fixFootNotes() {
const footnotes = document.querySelectorAll('a[href^="#sdfootnote"]');
footnotes.forEach((footnote) => {
const href = footnote.href;
footnote.classList.add("footnote");
if (href.includes("sym")) {
footnote.id = footnote.hash.replace("sym", "anc").replace("#", "");
}
if (href.includes("anc")) {
footnote.id = footnote.hash.replace("anc", "sym").replace("#", "");
}
});
}
document.addEventListener("DOMContentLoaded", () => { document.addEventListener("DOMContentLoaded", () => {
window.window.scrollTo({ window.window.scrollTo({
top: 0, top: 0,
@ -141,6 +156,8 @@ document.addEventListener("DOMContentLoaded", () => {
setWindowHeightFactor(); setWindowHeightFactor();
fixFootNotes();
// Wait for fonts applied // Wait for fonts applied
setTimeout(() => { setTimeout(() => {
enableToggleEntriesVisibility(); enableToggleEntriesVisibility();