summaryrefslogtreecommitdiff
path: root/gaming/stepmania/script.js
blob: 1deb43cebff203814942ef6c5570bc6028882182 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
document.addEventListener('DOMContentLoaded', () => {
  // Simple active link when clicking nav
  const links = Array.from(document.querySelectorAll('nav a[href^="#"]'));
  links.forEach(a => {
    a.addEventListener('click', e => {
      const id = a.getAttribute('href');
      const target = document.querySelector(id);
      if (!target) return;
      e.preventDefault();
      links.forEach(x => x.classList.remove('is-active'));
      a.classList.add('is-active');
      target.scrollIntoView({ behavior: 'smooth', block: 'start' });
      history.replaceState(null, '', id);
    });
  });

  // Minimal demo scoreboard
  const data = [
    { rank: 1, player: 'NeoStep',  song: 'PARANOiA Rebirth', score: '997,450' },
    { rank: 2, player: 'LainDance', song: 'MAX 300',          score: '995,210' },
    { rank: 3, player: 'PadWizard', song: 'vanity angel',      score: '992,880' },
  ];
  const board = document.getElementById('score-board');
  if (board) {
    const table = document.createElement('table');
    table.innerHTML = `
      <thead><tr>
        <th>Rank</th><th>Player</th><th>Song</th><th>Score</th>
      </tr></thead>
      <tbody>
        ${data.map(r => `<tr>
          <td>${r.rank}</td><td>${r.player}</td><td>${r.song}</td><td>${r.score}</td>
        </tr>`).join('')}
      </tbody>`;
    board.replaceChildren(table);
  }

  // Join button feedback
  const btn = document.getElementById('join-event');
  if (btn) {
    btn.addEventListener('click', () => {
      btn.disabled = true;
      btn.textContent = 'You’re in! Check your inbox.';
    });
  }
});