Skip to content

Commit bc16ee1

Browse files
Yet another production timing debug attempt, this time with a trivial wording change to verify the push is live.
1 parent 02c6964 commit bc16ee1

2 files changed

Lines changed: 52 additions & 89 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: 51 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,21 @@
8686
position: fixed;
8787
top: 10px;
8888
right: 10px;
89-
background: rgba(0,0,0,0.8);
89+
background: rgba(255,0,0,0.9);
9090
color: white;
9191
padding: 10px;
9292
font-size: 12px;
9393
z-index: 9999;
9494
max-width: 300px;
95+
border: 2px solid yellow;
9596
}
9697
</style>
9798

9899
<h1>Media</h1>
99100

100101
<!-- Debug info for production -->
101102
<div class="debug-info" id="debug-info">
102-
Initializing...
103+
HTML loaded
103104
</div>
104105

105106
<section class="media-grid">
@@ -137,110 +138,72 @@ <h3 class="archive__item-title">
137138
</section>
138139

139140
<script>
140-
// Simplified version with error handling
141-
try {
142-
let masonryAttempts = 0;
143-
141+
(function() {
142+
var debug = document.getElementById('debug-info');
143+
144144
function updateDebug(message) {
145-
try {
146-
const debug = document.getElementById('debug-info');
147-
if (debug) {
148-
debug.innerHTML = `${message}<br>Time: ${new Date().toLocaleTimeString()}`;
149-
}
150-
} catch (e) {
151-
console.error('Debug update error:', e);
145+
if (debug) {
146+
debug.innerHTML = message + '<br>Time: ' + new Date().toLocaleTimeString();
147+
debug.style.background = 'rgba(0,255,0,0.9)'; // Green when working
152148
}
153149
}
154150

155-
// Test basic functionality first
156-
updateDebug('Script loaded successfully');
151+
updateDebug('JavaScript executing');
157152

158153
function masonryLayout() {
159-
try {
160-
const grid = document.querySelector('.media-grid');
161-
if (!grid) {
162-
updateDebug('Grid not found');
163-
return;
164-
}
165-
166-
const items = grid.querySelectorAll('.media-card');
167-
masonryAttempts++;
168-
169-
updateDebug(`Attempt ${masonryAttempts}: Found ${items.length} items`);
170-
171-
const rowHeight = 10;
172-
const gap = 12;
173-
174-
// Reset all items
175-
items.forEach(item => {
176-
item.style.gridRowEnd = 'auto';
177-
});
178-
179-
// Force reflow
180-
grid.offsetHeight;
181-
182-
// Calculate row spans
183-
items.forEach((item, index) => {
184-
const rect = item.getBoundingClientRect();
185-
const itemHeight = rect.height;
186-
const rowSpan = Math.ceil((itemHeight + gap) / (rowHeight + gap));
187-
item.style.gridRowEnd = `span ${Math.max(1, rowSpan)}`;
188-
});
189-
190-
updateDebug(`Attempt ${masonryAttempts}: Layout applied`);
191-
192-
} catch (e) {
193-
updateDebug(`Error in masonry: ${e.message}`);
194-
console.error('Masonry error:', e);
154+
var grid = document.querySelector('.media-grid');
155+
if (!grid) {
156+
updateDebug('ERROR: Grid not found');
157+
return;
158+
}
159+
160+
var items = grid.querySelectorAll('.media-card');
161+
updateDebug('Processing ' + items.length + ' cards');
162+
163+
var rowHeight = 10;
164+
var gap = 12;
165+
166+
// Reset all items
167+
for (var i = 0; i < items.length; i++) {
168+
items[i].style.gridRowEnd = 'auto';
169+
}
170+
171+
// Force reflow
172+
grid.offsetHeight;
173+
174+
// Apply masonry
175+
for (var i = 0; i < items.length; i++) {
176+
var rect = items[i].getBoundingClientRect();
177+
var itemHeight = rect.height;
178+
var rowSpan = Math.ceil((itemHeight + gap) / (rowHeight + gap));
179+
items[i].style.gridRowEnd = 'span ' + Math.max(1, rowSpan);
195180
}
181+
182+
updateDebug('Masonry layout applied successfully');
196183
}
197184

198-
// Simple initialization
199-
function initMasonry() {
185+
function init() {
200186
updateDebug('Initializing masonry...');
201-
setTimeout(masonryLayout, 100);
202-
setTimeout(masonryLayout, 500);
203-
setTimeout(masonryLayout, 1000);
204-
setTimeout(masonryLayout, 2000);
205-
setTimeout(masonryLayout, 4000);
187+
setTimeout(function() { masonryLayout(); }, 100);
188+
setTimeout(function() { masonryLayout(); }, 1000);
189+
setTimeout(function() { masonryLayout(); }, 3000);
190+
setTimeout(function() { masonryLayout(); }, 6000);
206191
}
207192

208-
// Event listeners
193+
// Start when DOM is ready
209194
if (document.readyState === 'loading') {
210-
document.addEventListener('DOMContentLoaded', initMasonry);
195+
document.addEventListener('DOMContentLoaded', init);
211196
} else {
212-
initMasonry();
197+
init();
213198
}
214199

215-
window.addEventListener('load', () => {
216-
updateDebug('Window loaded');
217-
setTimeout(initMasonry, 200);
200+
// Also run when window loads
201+
window.addEventListener('load', function() {
202+
updateDebug('Window loaded - running masonry');
203+
setTimeout(function() { masonryLayout(); }, 500);
218204
});
219205

220-
// Handle Instagram embeds if available
221-
setTimeout(() => {
222-
try {
223-
if (window.instgrm && window.instgrm.Embeds) {
224-
updateDebug('Processing Instagram embeds');
225-
window.instgrm.Embeds.process();
226-
setTimeout(masonryLayout, 2000);
227-
}
228-
} catch (e) {
229-
updateDebug(`Instagram error: ${e.message}`);
230-
}
231-
}, 2000);
232-
233-
updateDebug('Script initialization complete');
234-
235-
} catch (e) {
236-
// Fallback error reporting
237-
const debug = document.getElementById('debug-info');
238-
if (debug) {
239-
debug.innerHTML = `Script error: ${e.message}`;
240-
}
241-
console.error('Script initialization error:', e);
242-
}
206+
})();
243207
</script>
244208

245-
<!-- Load Instagram script after our script -->
246209
<script async src="https://www.instagram.com/embed.js"></script>

0 commit comments

Comments
 (0)