|
25 | 25 | <meta content="Scan tokens in seconds. Deep checks on demand." name="twitter:description"/> |
26 | 26 | <meta content="https://metridex.com/og-image.png" name="twitter:image"/> |
27 | 27 | <script data-domain="metridex.com" defer="" src="https://plausible.io/js/script.js"></script> |
| 28 | + |
| 29 | +<style> |
| 30 | +.mdx-lightbox{position:fixed;inset:0;z-index:9999;background:rgba(0,0,0,.86);display:none;align-items:center;justify-content:center} |
| 31 | +.mdx-lightbox.open{display:flex} |
| 32 | +.mdx-lightbox img{max-width:95vw;max-height:90vh;border-radius:10px;box-shadow:0 10px 30px rgba(0,0,0,.55)} |
| 33 | +.mdx-lightbox .mdx-close{position:fixed;top:18px;right:18px;width:40px;height:40px;border-radius:999px;background:rgba(17,17,17,.7);color:#fff;border:1px solid rgba(255,255,255,.15);display:grid;place-items:center;cursor:pointer} |
| 34 | +</style> |
| 35 | + |
28 | 36 | </head> |
29 | 37 | <body> |
30 | 38 | <header class="nav" id="siteNav"> |
@@ -303,5 +311,61 @@ <h2 data-i18n="contact.title">Contact</h2> |
303 | 311 | <img alt="Screenshot preview"> |
304 | 312 | <button class="mdx-close" aria-label="Close">✕</button> |
305 | 313 | </div> |
| 314 | + |
| 315 | +<script> |
| 316 | +(function(){ |
| 317 | + // Helper: ensure lightbox exists |
| 318 | + function ensureLightbox(){ |
| 319 | + var lb = document.getElementById('mdxLightbox'); |
| 320 | + if(!lb){ |
| 321 | + lb = document.createElement('div'); |
| 322 | + lb.id='mdxLightbox'; lb.className='mdx-lightbox'; lb.setAttribute('hidden',''); |
| 323 | + var img=document.createElement('img'); var btn=document.createElement('button'); |
| 324 | + btn.className='mdx-close'; btn.setAttribute('aria-label','Close'); btn.textContent='✕'; |
| 325 | + lb.appendChild(img); lb.appendChild(btn); document.body.appendChild(lb); |
| 326 | + } |
| 327 | + return lb; |
| 328 | + } |
| 329 | + function openLB(src){ |
| 330 | + var lb=ensureLightbox(); var img=lb.querySelector('img'); var btn=lb.querySelector('.mdx-close'); |
| 331 | + img.src=src; lb.classList.add('open'); lb.removeAttribute('hidden'); |
| 332 | + function close(){ lb.classList.remove('open'); lb.setAttribute('hidden',''); } |
| 333 | + lb.addEventListener('click', close, {once:true}); btn&&btn.addEventListener('click', close, {once:true}); |
| 334 | + document.addEventListener('keydown', function esc(e){ if(e.key==='Escape'){ close(); document.removeEventListener('keydown', esc);} }); |
| 335 | + } |
| 336 | + function init(){ |
| 337 | + document.querySelectorAll('.mdx-frame').forEach(function(frame){ |
| 338 | + var list=(frame.getAttribute('data-images')||'').split(',').map(function(s){return s.trim();}).filter(Boolean); |
| 339 | + // If no stage exists, create it: |
| 340 | + var stage = frame.querySelector('.mdx-stage') || (function(){ var d=document.createElement('div'); d.className='mdx-stage'; frame.appendChild(d); return d; })(); |
| 341 | + // If no image child, insert one: |
| 342 | + var img = stage.querySelector('img') || (function(){ var i=new Image(); stage.appendChild(i); return i; })(); |
| 343 | + // Render first image |
| 344 | + var i = 0; function render(){ img.src = list[i]; counter.textContent = (i+1)+' / '+list.length; } |
| 345 | + // Controls (create if not exist) |
| 346 | + var nav = frame.querySelector('.mdx-nav') || (function(){ |
| 347 | + var n=document.createElement('div'); n.className='mdx-nav'; |
| 348 | + var p=document.createElement('button'); p.className='mdx-btn mdx-prev'; p.textContent='◀'; p.setAttribute('aria-label','Prev'); |
| 349 | + var nx=document.createElement('button'); nx.className='mdx-btn mdx-next'; nx.textContent='▶'; nx.setAttribute('aria-label','Next'); |
| 350 | + n.appendChild(p); n.appendChild(nx); frame.appendChild(n); return n; |
| 351 | + })(); |
| 352 | + var prev = nav.querySelector('.mdx-prev'), next = nav.querySelector('.mdx-next'); |
| 353 | + var counter = frame.querySelector('.mdx-counter') || (function(){ var c=document.createElement('div'); c.className='mdx-counter'; frame.appendChild(c); return c; })(); |
| 354 | + function step(d){ if(!list.length) return; i = (i + d + list.length) % list.length; render(); } |
| 355 | + prev.onclick=function(){ step(-1); }; next.onclick=function(){ step(1); }; |
| 356 | + // Click to open |
| 357 | + img.style.cursor='zoom-in'; |
| 358 | + img.onclick=function(){ openLB(img.currentSrc || img.src); }; |
| 359 | + // Touch swipe |
| 360 | + var sx=null; stage.addEventListener('touchstart', function(e){ sx=e.touches[0].clientX; }, {passive:true}); |
| 361 | + stage.addEventListener('touchend', function(e){ if(sx==null) return; var dx=e.changedTouches[0].clientX - sx; if(Math.abs(dx)>40) step(dx<0?1:-1); sx=null; }, {passive:true}); |
| 362 | + // Initial |
| 363 | + if(list.length){ render(); } |
| 364 | + }); |
| 365 | + } |
| 366 | + if(document.readyState==='loading'){ document.addEventListener('DOMContentLoaded', init); } else { init(); } |
| 367 | +})(); |
| 368 | +</script> |
| 369 | + |
306 | 370 | </body> |
307 | 371 | </html> |
0 commit comments