summaryrefslogtreecommitdiff
path: root/height.js
diff options
context:
space:
mode:
authorZofia Szweda <sophies@disroot.org>2026-09-07 21:00:43 +0200
committerZofia Szweda <sophies@disroot.org>2026-09-07 21:01:01 +0200
commitd988b034d40c96e0588044150c80ce2ed7432ce1 (patch)
treeee1331b21fe0a121bd1128101e92386fb445d1f2 /height.js
parent57c46e0f2793fefc69f5036e6a475c848275f964 (diff)
stuff
Diffstat (limited to 'height.js')
-rw-r--r--height.js32
1 files changed, 32 insertions, 0 deletions
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);