ntdservices commited on
Commit
a40d4b6
·
verified ·
1 Parent(s): f5000a6

Update static/index.html

Browse files
Files changed (1) hide show
  1. static/index.html +36 -18
static/index.html CHANGED
@@ -397,24 +397,42 @@ pin.addEventListener('keydown', (e) => {
397
  overlay.appendChild(pin);
398
 
399
 
400
- if (it.open){
401
- const pop = document.createElement('div'); pop.className='popup';
402
- pop.style.left = it.x+'%'; pop.style.top = it.y+'%'; pop.style.width = it.widthPct+'vw';
403
-
404
- const header = document.createElement('header');
405
- const h4 = document.createElement('h4'); h4.textContent = it.title || (it.type==='image'?'Image':'Video');
406
- const close = document.createElement('button'); close.className='x'; close.innerHTML='×';
407
- close.addEventListener('click', e=>{ e.stopPropagation(); it.open=false; renderItems(); });
408
- header.append(h4, close); pop.appendChild(header);
409
-
410
- const wrap = document.createElement('div'); wrap.className='media';
411
- if (it.type==='video'){ const v = document.createElement('video'); v.src=it.src; v.controls=true; v.playsInline=true; wrap.appendChild(v); }
412
- else { const img = document.createElement('img'); img.src=it.src; img.alt=it.title||'Image'; wrap.appendChild(img); }
413
- pop.appendChild(wrap);
414
-
415
- overlay.appendChild(pop);
416
- requestAnimationFrame(()=>adjustPopupPosition(pop));
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