mirror of
https://github.com/osmarks/website
synced 2024-12-23 16:40:31 +00:00
fix sidenote layout and performance enhancements
This commit is contained in:
parent
6011e27dbd
commit
d9a3eeae1e
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: "Maghammer: My personal data warehouse"
|
title: "Maghammer: my personal data warehouse"
|
||||||
created: 28/08/2023
|
created: 28/08/2023
|
||||||
updated: 14/05/2024
|
updated: 14/05/2024
|
||||||
description: Powerful search tools as externalized cognition, and how mine work.
|
description: Powerful search tools as externalized cognition, and how mine work.
|
||||||
|
11
src/page.js
11
src/page.js
@ -402,6 +402,15 @@ window.points = (async () => {
|
|||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
|
|
||||||
|
// we don't consider things that might be in a <summary> but it is not relevant here
|
||||||
|
const inCollapsedDetails = el => {
|
||||||
|
while (el) {
|
||||||
|
if (el.nodeName === "DETAILS" && el.open === false) return true
|
||||||
|
el = el.parentElement
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
const footnotes = document.querySelector(".footnotes")
|
const footnotes = document.querySelector(".footnotes")
|
||||||
const sidenotes = document.querySelector(".sidenotes")
|
const sidenotes = document.querySelector(".sidenotes")
|
||||||
if (sidenotes && footnotes) {
|
if (sidenotes && footnotes) {
|
||||||
@ -427,7 +436,7 @@ if (sidenotes && footnotes) {
|
|||||||
const exclusions = [[-Infinity, Math.max(articleRect.top, snRect.top)]]
|
const exclusions = [[-Infinity, Math.max(articleRect.top, snRect.top)]]
|
||||||
for (const codeblock of codeblocks) {
|
for (const codeblock of codeblocks) {
|
||||||
const codeblockRect = codeblock.getBoundingClientRect()
|
const codeblockRect = codeblock.getBoundingClientRect()
|
||||||
if (codeblockRect.width !== 0) { // collapsed
|
if (codeblockRect.width !== 0 && !inCollapsedDetails(codeblock)) { // collapsed
|
||||||
exclusions.push([codeblockRect.top - BORDER, codeblockRect.top + codeblockRect.height + BORDER])
|
exclusions.push([codeblockRect.top - BORDER, codeblockRect.top + codeblockRect.height + BORDER])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ mixin image(src)
|
|||||||
picture
|
picture
|
||||||
each pair in src
|
each pair in src
|
||||||
if pair[0] == "_fallback"
|
if pair[0] == "_fallback"
|
||||||
img(src=pair[1])
|
img(src=pair[1], loading="lazy")
|
||||||
else
|
else
|
||||||
source(srcset=pair[1], type=pair[0])
|
source(srcset=pair[1], type=pair[0])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user