Update index.html
Browse filesadded unique url for each card + thumbnail option
- index.html +44 -2
index.html
CHANGED
|
@@ -283,15 +283,44 @@
|
|
| 283 |
`
|
| 284 |
};
|
| 285 |
|
| 286 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 287 |
for (let i = 1; i <= 24; i++) {
|
| 288 |
const card = document.createElement('div');
|
| 289 |
card.className = 'card';
|
| 290 |
card.dataset.day = i;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 291 |
card.innerHTML = `
|
| 292 |
-
${
|
| 293 |
<div class="card-content">
|
| 294 |
${cardContents[i]}
|
|
|
|
|
|
|
|
|
|
| 295 |
</div>
|
| 296 |
`;
|
| 297 |
calendar.appendChild(card);
|
|
@@ -338,6 +367,19 @@
|
|
| 338 |
iframe.msRequestFullscreen();
|
| 339 |
}
|
| 340 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 341 |
</script>
|
| 342 |
</body>
|
| 343 |
</html>
|
|
|
|
| 283 |
`
|
| 284 |
};
|
| 285 |
|
| 286 |
+
// Add this function before the card creation loop
|
| 287 |
+
function getCardLink(day) {
|
| 288 |
+
const url = new URL(window.location.href);
|
| 289 |
+
url.searchParams.set('day', day);
|
| 290 |
+
return url.toString();
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
// Add this object before the card creation loop to define custom text labels
|
| 294 |
+
const cardLabels = {
|
| 295 |
+
1: "🔮<br>Clem's2025 predictions",
|
| 296 |
+
2: "❤️<br>Most liked & downloaded models",
|
| 297 |
+
// Add more custom labels as needed
|
| 298 |
+
// 3: "Custom Text",
|
| 299 |
+
// 4: "Another Label",
|
| 300 |
+
};
|
| 301 |
+
|
| 302 |
+
// Modify the card creation loop
|
| 303 |
for (let i = 1; i <= 24; i++) {
|
| 304 |
const card = document.createElement('div');
|
| 305 |
card.className = 'card';
|
| 306 |
card.dataset.day = i;
|
| 307 |
+
card.dataset.link = getCardLink(i);
|
| 308 |
+
|
| 309 |
+
// Define a condition to use a thumbnail for specific cards
|
| 310 |
+
const useThumbnail = [].includes(i);
|
| 311 |
+
|
| 312 |
+
// Get custom label if it exists, otherwise use the number
|
| 313 |
+
const cardContent = useThumbnail
|
| 314 |
+
? `<img src="images/${i}.png" style="width: 75%; height: 75%; object-fit: cover; border-radius: 12px;">`
|
| 315 |
+
: `<div style="text-align: center; margin: 0 20%;">${cardLabels[i] || i}</div>`;
|
| 316 |
+
|
| 317 |
card.innerHTML = `
|
| 318 |
+
${cardContent}
|
| 319 |
<div class="card-content">
|
| 320 |
${cardContents[i]}
|
| 321 |
+
<div style="margin-top: 20px; padding-top: 20px; border-top: 1px solid #eee;">
|
| 322 |
+
<p style="font-size: 0.8em;">🔗 Share this card: <a href="${getCardLink(i)}" onclick="event.stopPropagation();">${getCardLink(i)}</a></p>
|
| 323 |
+
</div>
|
| 324 |
</div>
|
| 325 |
`;
|
| 326 |
calendar.appendChild(card);
|
|
|
|
| 367 |
iframe.msRequestFullscreen();
|
| 368 |
}
|
| 369 |
}
|
| 370 |
+
|
| 371 |
+
// Add this code after your existing event listeners
|
| 372 |
+
// Handle direct links to cards
|
| 373 |
+
window.addEventListener('load', () => {
|
| 374 |
+
const params = new URLSearchParams(window.location.search);
|
| 375 |
+
const day = params.get('day');
|
| 376 |
+
if (day) {
|
| 377 |
+
const card = document.querySelector(`[data-day="${day}"]`);
|
| 378 |
+
if (card) {
|
| 379 |
+
card.click(); // Automatically open the modal for the linked card
|
| 380 |
+
}
|
| 381 |
+
}
|
| 382 |
+
});
|
| 383 |
</script>
|
| 384 |
</body>
|
| 385 |
</html>
|