const gallery = document.querySelector('[data-gallery]'); if (gallery) { const shots = { dashboard: { file: 'web-dashboard.png', title: 'Übersicht', alt: 'wCloud-Dashboard mit Status, Ressourcen und laufenden Instanzen', caption: 'Master, Spieler und laufende Instanzen auf einer Seite.' }, server: { file: 'web-server.png', title: 'Server', alt: 'Serveransicht mit den Gruppen Proxy, Lobby und Survival', caption: 'Gruppen, Vorlagen und aktive Instanzen in der Serveransicht.' }, moderation: { file: 'web-moderation.png', title: 'Moderation', alt: 'Editor für einen zeitlich begrenzten Bann mit MiniMessage-Vorschau', caption: 'Moderationsmeldungen übersetzen, formatieren und vorab prüfen.' }, start: { file: 'cli-start.png', title: 'Startprotokoll', alt: 'Ausgabe eines wCloud-Teststarts mit Webadresse und verbundenen Minecraft-Instanzen', caption: 'Die Ausgabe eines Teststarts zeigt die Dashboard-Adresse und die verbundenen Instanzen.' }, befehle: { file: 'cli-befehle.png', title: 'Befehle', alt: 'Ausgabe der wCloud-Masterbefehle service list und help', caption: 'Die Master-Konsole zeigt Status und Ports mit service list. help listet die Befehle auf.' } }; const tabs = [...gallery.querySelectorAll('[role="tab"]')]; const panel = gallery.querySelector('[role="tabpanel"]'); const image = gallery.querySelector('[data-gallery-image]'); const zoom = gallery.querySelector('[data-zoom]'); const original = gallery.querySelector('[data-open-image]'); const dialog = document.querySelector('[data-lightbox]'); const dialogImage = dialog.querySelector('[data-lightbox-image]'); const title = gallery.querySelector('[data-gallery-title]'); const caption = gallery.querySelector('[data-gallery-caption]'); let current = shots.dashboard; function selectTab(selected) { current = shots[selected.dataset.shot]; for (const tab of tabs) { tab.setAttribute('aria-selected', String(tab === selected)); tab.tabIndex = tab === selected ? 0 : -1; } panel.setAttribute('aria-labelledby', selected.id); const source = 'assets/' + current.file; image.src = source; image.alt = current.alt; zoom.href = source; original.href = source; title.textContent = current.title; caption.textContent = current.caption; } tabs.forEach((tab, index) => { tab.addEventListener('click', () => selectTab(tab)); tab.addEventListener('keydown', event => { const position = { ArrowLeft: (index - 1 + tabs.length) % tabs.length, ArrowRight: (index + 1) % tabs.length, Home: 0, End: tabs.length - 1 }[event.key]; if (position == null) return; event.preventDefault(); selectTab(tabs[position]); tabs[position].focus(); }); }); zoom.addEventListener('click', event => { if (typeof dialog.showModal !== 'function' || event.ctrlKey || event.metaKey || event.shiftKey) return; event.preventDefault(); dialog.querySelector('h2').textContent = current.title; dialogImage.src = zoom.href; dialogImage.alt = current.alt; dialog.showModal(); }); } const copyStatus = document.querySelector('#copy-status'); for (const button of document.querySelectorAll('[data-copy]')) { let reset; button.addEventListener('click', async () => { const code = document.getElementById(button.dataset.copy); if (!code) return; try { await navigator.clipboard.writeText(code.textContent); button.textContent = 'Kopiert'; copyStatus.textContent = 'Befehl kopiert.'; } catch { const range = document.createRange(); range.selectNodeContents(code); const selection = window.getSelection(); selection.removeAllRanges(); selection.addRange(range); button.textContent = 'Markiert'; copyStatus.textContent = 'Befehl markiert. Kopiere ihn mit deiner Tastenkombination.'; } clearTimeout(reset); reset = setTimeout(() => { button.textContent = 'Kopieren'; }, 2200); }); } const chapters = document.querySelector('.guide-nav'); if (chapters) { function markChapter() { const active = location.hash || '#installation'; for (const link of chapters.querySelectorAll('a')) { if (link.hash === active) link.setAttribute('aria-current', 'location'); else link.removeAttribute('aria-current'); } } addEventListener('hashchange', markChapter); markChapter(); }