Skip to content

Commit 60c596f

Browse files
Another timing debugging
1 parent bc16ee1 commit 60c596f

2 files changed

Lines changed: 30 additions & 68 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 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."
6+
summary: "GRASP Lab news published [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: 29 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
margin-bottom: 0.5rem !important;
8282
}
8383

84-
/* Production debugging - remove after fixing */
84+
/* Production debugging */
8585
.debug-info {
8686
position: fixed;
8787
top: 10px;
@@ -98,10 +98,7 @@
9898

9999
<h1>Media</h1>
100100

101-
<!-- Debug info for production -->
102-
<div class="debug-info" id="debug-info">
103-
HTML loaded
104-
</div>
101+
<div class="debug-info" id="debug-info">HTML loaded</div>
105102

106103
<section class="media-grid">
107104
{% assign media_items = site.media | sort: "date" | reverse %}
@@ -137,73 +134,38 @@ <h3 class="archive__item-title">
137134
{% endfor %}
138135
</section>
139136

137+
<!-- Minimal test script -->
140138
<script>
141-
(function() {
142-
var debug = document.getElementById('debug-info');
143-
144-
function updateDebug(message) {
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
148-
}
149-
}
150-
151-
updateDebug('JavaScript executing');
139+
document.getElementById('debug-info').innerHTML = 'JS executing';
140+
document.getElementById('debug-info').style.background = 'rgba(0,255,0,0.9)';
152141

153-
function masonryLayout() {
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);
180-
}
181-
182-
updateDebug('Masonry layout applied successfully');
183-
}
184-
185-
function init() {
186-
updateDebug('Initializing masonry...');
187-
setTimeout(function() { masonryLayout(); }, 100);
188-
setTimeout(function() { masonryLayout(); }, 1000);
189-
setTimeout(function() { masonryLayout(); }, 3000);
190-
setTimeout(function() { masonryLayout(); }, 6000);
142+
setTimeout(function() {
143+
var grid = document.querySelector('.media-grid');
144+
var items = grid.querySelectorAll('.media-card');
145+
146+
document.getElementById('debug-info').innerHTML = 'Found ' + items.length + ' items';
147+
148+
for (var i = 0; i < items.length; i++) {
149+
var rect = items[i].getBoundingClientRect();
150+
var rowSpan = Math.ceil((rect.height + 12) / 10);
151+
items[i].style.gridRowEnd = 'span ' + Math.max(1, rowSpan);
191152
}
153+
154+
document.getElementById('debug-info').innerHTML = 'Masonry applied';
155+
}, 1000);
192156

193-
// Start when DOM is ready
194-
if (document.readyState === 'loading') {
195-
document.addEventListener('DOMContentLoaded', init);
196-
} else {
197-
init();
157+
setTimeout(function() {
158+
var grid = document.querySelector('.media-grid');
159+
var items = grid.querySelectorAll('.media-card');
160+
161+
for (var i = 0; i < items.length; i++) {
162+
var rect = items[i].getBoundingClientRect();
163+
var rowSpan = Math.ceil((rect.height + 12) / 10);
164+
items[i].style.gridRowEnd = 'span ' + Math.max(1, rowSpan);
198165
}
199-
200-
// Also run when window loads
201-
window.addEventListener('load', function() {
202-
updateDebug('Window loaded - running masonry');
203-
setTimeout(function() { masonryLayout(); }, 500);
204-
});
205-
206-
})();
166+
167+
document.getElementById('debug-info').innerHTML = 'Second masonry pass';
168+
}, 3000);
207169
</script>
208170

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

0 commit comments

Comments
 (0)