Spaces:
Sleeping
Sleeping
Update static/index.html
Browse files- static/index.html +36 -18
static/index.html
CHANGED
|
@@ -397,24 +397,42 @@ pin.addEventListener('keydown', (e) => {
|
|
| 397 |
overlay.appendChild(pin);
|
| 398 |
|
| 399 |
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 418 |
}
|
| 419 |
|
| 420 |
// items list
|
|
|
|
| 397 |
overlay.appendChild(pin);
|
| 398 |
|
| 399 |
|
| 400 |
+
if (it.open){
|
| 401 |
+
const pop = document.createElement('div');
|
| 402 |
+
pop.className = 'popup';
|
| 403 |
+
pop.style.left = it.x + '%';
|
| 404 |
+
pop.style.top = it.y + '%';
|
| 405 |
+
pop.style.width = it.widthPct + 'vw';
|
| 406 |
+
|
| 407 |
+
// Media wrapper — clicking anywhere on the small image/video closes it
|
| 408 |
+
const wrap = document.createElement('div');
|
| 409 |
+
wrap.className = 'media';
|
| 410 |
+
wrap.addEventListener('click', (e) => {
|
| 411 |
+
e.stopPropagation();
|
| 412 |
+
it.open = false;
|
| 413 |
+
renderItems();
|
| 414 |
+
});
|
| 415 |
+
|
| 416 |
+
if (it.type === 'video') {
|
| 417 |
+
const v = document.createElement('video');
|
| 418 |
+
v.src = it.src;
|
| 419 |
+
v.playsInline = true;
|
| 420 |
+
v.muted = true; // no controls; click closes
|
| 421 |
+
v.autoplay = false;
|
| 422 |
+
v.loop = false;
|
| 423 |
+
wrap.appendChild(v);
|
| 424 |
+
} else {
|
| 425 |
+
const img = document.createElement('img');
|
| 426 |
+
img.src = it.src;
|
| 427 |
+
img.alt = it.title || '';
|
| 428 |
+
wrap.appendChild(img);
|
| 429 |
+
}
|
| 430 |
+
|
| 431 |
+
pop.appendChild(wrap);
|
| 432 |
+
overlay.appendChild(pop);
|
| 433 |
+
requestAnimationFrame(() => adjustPopupPosition(pop));
|
| 434 |
+
}
|
| 435 |
+
|
| 436 |
}
|
| 437 |
|
| 438 |
// items list
|