Skip to content

Commit 8b8a6af

Browse files
Back to simple card layout because I couldn't get the rearrangement to fill whitespace working in production.
1 parent 0c49863 commit 8b8a6af

2 files changed

Lines changed: 12 additions & 84 deletions

File tree

_media/grasp-news.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ title: "GRASP Lab’s Award-Winning Automated System for Printing Origami Robots
33
date: 2024-05-15
44
permalink: /media/grasp-news
55
link: https://www.grasp.upenn.edu/news/kinegami/
6-
summary: "GRASP Lab news put out [a feature article](https://www.grasp.upenn.edu/news/kinegami/) on [the Kinegami project](https://sung.seas.upenn.edu/research/kinegami/) that I'm part of. They wrote this when [the project's first paper](https://ieeexplore.ieee.org/document/9914656) (which was from before I joined) got an honorable mention for the T-RO best paper award: the article also discusses the future of the project including my [OSME paper](https://repository.upenn.edu/handle/20.500.14332/60333) and ongoing work."
6+
summary: "GRASP Lab news wrote [a feature article](https://www.grasp.upenn.edu/news/kinegami/) on [the Kinegami project](https://sung.seas.upenn.edu/research/kinegami/) that I'm part of. They wrote this when [the project's first paper](https://ieeexplore.ieee.org/document/9914656) (which was from before I joined) got an honorable mention for the T-RO best paper award: the article also discusses the future of the project including my [OSME paper](https://repository.upenn.edu/handle/20.500.14332/60333) and ongoing work."
77
---

_pages/media.html

Lines changed: 11 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
border-radius: 8px !important;
1818
padding: 1rem !important;
1919
box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
20-
margin: 0 !important;
20+
margin: 0 0 15px 0 !important; /* Use margin instead of grid for vertical spacing */
2121
display: block !important;
2222
width: 100% !important;
2323
box-sizing: border-box !important;
@@ -30,14 +30,12 @@
3030
border-color: #d1d5da !important;
3131
}
3232

33-
/* Grid container with separate horizontal and vertical gaps */
33+
/* Simplified grid - let CSS handle everything */
3434
body .media-page .media-grid,
3535
.media-grid {
3636
display: grid !important;
3737
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important;
38-
grid-auto-rows: 20px !important; /* Row height for masonry calculation */
39-
row-gap: 1px !important; /* Vertical gap between rows */
40-
column-gap: 20px !important; /* Horizontal gap between columns */
38+
column-gap: 20px !important; /* Only horizontal gap */
4139
align-items: start !important;
4240
width: 100% !important;
4341
max-width: none !important;
@@ -119,92 +117,22 @@ <h3 class="archive__item-title">
119117
{% endfor %}
120118
</section>
121119

120+
<!-- Minimal JavaScript - only handle Instagram embeds -->
122121
<script>
123-
var lastHeights = [];
124-
var masonryAttempts = 0;
125-
var isStable = false;
126-
127-
function applyMasonry() {
128-
var grid = document.querySelector('.media-grid');
129-
var items = grid.querySelectorAll('.media-card');
130-
131-
var rowHeight = 20; // Match CSS grid-auto-rows
132-
var verticalGap = 1; // Match CSS row-gap
133-
134-
masonryAttempts++;
135-
136-
// Check current heights first
137-
var currentHeights = [];
138-
for (var i = 0; i < items.length; i++) {
139-
var rect = items[i].getBoundingClientRect();
140-
currentHeights.push(rect.height);
141-
}
142-
143-
// Only proceed if heights have changed or this is the first run
144-
var heightsChanged = JSON.stringify(currentHeights) !== JSON.stringify(lastHeights);
145-
146-
if (!heightsChanged && masonryAttempts > 1) {
147-
if (!isStable) {
148-
isStable = true; // Mark as stable, stop periodic checks
149-
}
150-
return; // No need to recalculate
151-
}
152-
153-
lastHeights = currentHeights.slice();
154-
155-
// Reset all items first
156-
for (var i = 0; i < items.length; i++) {
157-
items[i].style.gridRowEnd = 'auto';
158-
}
159-
160-
// Force reflow
161-
grid.offsetHeight;
162-
163-
// Wait for content to settle, then calculate
122+
// Handle Instagram embeds when they're ready
123+
if (window.instgrm) {
164124
setTimeout(function() {
165-
for (var i = 0; i < items.length; i++) {
166-
var rect = items[i].getBoundingClientRect();
167-
var itemHeight = rect.height;
168-
169-
var rowSpan = Math.ceil((itemHeight + verticalGap) / rowHeight);
170-
items[i].style.gridRowEnd = 'span ' + rowSpan;
125+
if (window.instgrm.Embeds) {
126+
window.instgrm.Embeds.process();
171127
}
172-
}, 100);
128+
}, 1000);
173129
}
174130

175-
// Initial load timing - less aggressive
176-
setTimeout(applyMasonry, 500);
177-
setTimeout(applyMasonry, 1500);
178-
setTimeout(applyMasonry, 3000);
179-
setTimeout(applyMasonry, 6000);
180-
181-
window.addEventListener('resize', function() {
182-
isStable = false; // Reset stability on resize
183-
setTimeout(applyMasonry, 300);
184-
});
185-
186-
// Handle Instagram embeds
187-
function handleInstagramEmbeds() {
131+
setTimeout(function() {
188132
if (window.instgrm && window.instgrm.Embeds) {
189133
window.instgrm.Embeds.process();
190-
setTimeout(function() {
191-
isStable = false; // Reset stability when Instagram loads
192-
applyMasonry();
193-
}, 2000);
194-
}
195-
}
196-
197-
setTimeout(handleInstagramEmbeds, 2000);
198-
setTimeout(handleInstagramEmbeds, 5000);
199-
200-
// Only check periodically if not stable, and less frequently
201-
var periodicCheck = setInterval(function() {
202-
if (!isStable && masonryAttempts < 20) {
203-
applyMasonry();
204-
} else {
205-
clearInterval(periodicCheck);
206134
}
207-
}, 5000); // Every 5 seconds instead of 2
135+
}, 3000);
208136
</script>
209137

210138
<script async src="https://www.instagram.com/embed.js"></script>

0 commit comments

Comments
 (0)