From d988b034d40c96e0588044150c80ce2ed7432ce1 Mon Sep 17 00:00:00 2001 From: Zofia Szweda Date: Mon, 7 Sep 2026 21:00:43 +0200 Subject: stuff --- height.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 height.js (limited to 'height.js') diff --git a/height.js b/height.js new file mode 100644 index 0000000..626f362 --- /dev/null +++ b/height.js @@ -0,0 +1,32 @@ +const scrobbles = document.getElementById('recent-scrobbles'); +const publications = document.getElementById('recent-publications'); +const changelog = document.getElementById('recent-now'); +const column = document.querySelector('.recent-column'); + +let userResized = false; +let lastSetHeight = null; + +new ResizeObserver(([entry]) => { + const observedHeight = Math.round(entry.contentRect.height); + if (lastSetHeight !== null && observedHeight !== lastSetHeight) { + userResized = true; + column.style.height = 'auto'; // NEW — release the lock so flow can push content down + } +}).observe(changelog); + +function syncHeights() { + if (userResized) return; + + const gap = parseFloat(getComputedStyle(column).rowGap) || 0; + const changelogFloor = parseFloat(getComputedStyle(changelog).minHeight) || 0; + const naturalFloor = publications.offsetHeight + gap + changelogFloor; + const targetColumnHeight = Math.max(naturalFloor, scrobbles.offsetHeight); + const changelogHeight = targetColumnHeight - publications.offsetHeight - gap; + + lastSetHeight = Math.round(changelogHeight); + changelog.style.height = `${changelogHeight}px`; + column.style.height = `${targetColumnHeight}px`; +} + +new ResizeObserver(syncHeights).observe(scrobbles); +new ResizeObserver(syncHeights).observe(publications); -- cgit v1.2.3