diff --git a/web/zebra-spaces.html b/web/zebra-spaces.html index 233ebd3..68c7710 100644 --- a/web/zebra-spaces.html +++ b/web/zebra-spaces.html @@ -32,6 +32,13 @@ min-width: 0; display: flex; flex-direction: column; } .controls { min-width: 0; } + .game-tabs { display: flex; gap: 0.4rem; margin-bottom: 0.5rem; flex-wrap: wrap; } + .game-tabs button { + background: #fff; color: #000; border: 1px solid #000; + padding: 0.3rem 0.8rem; font-family: monospace; font-size: 0.8rem; cursor: pointer; + } + .game-tabs button.active { background: #000; color: #fff; } + .game-tabs button:hover:not(.active) { background: #f0f0f0; } .timeline-frame { flex: 1; min-height: 80vh; width: 100%; border: 1px solid #ddd; background: #fff; @@ -158,13 +165,19 @@
- -
@@ -1349,6 +1362,16 @@ $('btn-copy-share').addEventListener('click', async () => { const c = new URLSearchParams(location.search).get('code'); if (c) $('rdv-code').value = c; } + +/* game-tabs: click a button → swap iframe src + mark active. data-src is + * the only source of truth so new games just need a button. */ +$('game-tabs').addEventListener('click', (ev) => { + const b = ev.target.closest('button[data-src]'); + if (!b) return; + const frame = $('game-frame'); + if (frame.src !== b.dataset.src) frame.src = b.dataset.src; + for (const el of $('game-tabs').querySelectorAll('button')) el.classList.toggle('active', el === b); +}); $('btn-leave').addEventListener('click', async () => { wantConnected = false; if (sigReconnect){ clearTimeout(sigReconnect); sigReconnect = null; } @@ -1377,8 +1400,8 @@ logLine('', 'ready — pick a handle, type a rendezvous code, enter the space');