Several templates had their own <script> blocks instead of going through webpack like game1.js already does. Extracted the waiting page, lobby page, and admin session-log tab scripts into their own files under assets/, imported from the main app.js entry. Since app.js is already loaded on every page, each module just reads its own data-* attributes and no-ops if its target element isn't present on the current page - same pattern game1.js already uses. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
28 lines
995 B
JavaScript
28 lines
995 B
JavaScript
document.addEventListener('DOMContentLoaded', () => {
|
|
const buttons = document.querySelectorAll('[data-tab-target]');
|
|
if (!buttons.length) {
|
|
return;
|
|
}
|
|
|
|
const activate = (id) => {
|
|
document.querySelectorAll('[id^="player-"]').forEach(el => el.style.display = 'none');
|
|
const target = document.getElementById(id);
|
|
if (target) {
|
|
target.style.display = 'block';
|
|
}
|
|
|
|
buttons.forEach(btn => {
|
|
const active = btn.dataset.tabTarget === id;
|
|
btn.style.background = active ? '#fff' : '#f8fafc';
|
|
btn.style.color = active ? '#1e40af' : '#64748b';
|
|
btn.style.fontWeight = active ? '600' : '400';
|
|
btn.style.borderColor = active ? '#3b82f6' : '#e2e8f0';
|
|
btn.style.borderBottom = active ? '1px solid #fff' : '1px solid #e2e8f0';
|
|
});
|
|
};
|
|
|
|
buttons.forEach(btn => {
|
|
btn.addEventListener('click', () => activate(btn.dataset.tabTarget));
|
|
});
|
|
});
|