A dark, mysterious five-act ARG built around hidden archives and forgotten witnesses.

Viewing files at commit a02fe2fc8753Commit detailsView latest

assets/js/app.js 62 lines · 1.9 KB · javascript
1
// Main application initialization
2
3
document.addEventListener('DOMContentLoaded', () => {
4
  // Initialize game state
5
  GameState.init();
6
  
7
  // Render initial page
8
  UIRouter.navigate(GameState.currentPage || 'landing');
9
  
10
  // Update progress bar
11
  const progressFill = document.querySelector('.progress-fill');
12
  const completion = GameState.getCompletion();
13
  progressFill.style.width = completion + '%';
14
  
15
  // Update status
16
  const statusEl = document.querySelector('.status');
17
  if (GameState.currentAct > 0) {
18
    statusEl.textContent = `ACT ${GameState.currentAct + 1}/5`;
19
  }
20
  
21
  // Keyboard shortcuts
22
  document.addEventListener('keydown', (e) => {
23
    // Alt+1 through Alt+5 for act navigation
24
    if (e.altKey && e.key >= '1' && e.key <= '5') {
25
      const act = parseInt(e.key) - 1;
26
      if (GameState.unlockedSections.has('act' + (act + 1))) {
27
        UIRouter.navigate('act' + (act + 1));
28
      }
29
    }
30
    
31
    // Alt+H for home
32
    if (e.altKey && e.key === 'h') {
33
      UIRouter.navigate('landing');
34
    }
35
    
36
    // Alt+I for inventory
37
    if (e.altKey && e.key === 'i') {
38
      UIRouter.navigate('inventory');
39
    }
40
  });
41
  
42
  // Easter egg: Konami code
43
  const konamiCode = ['ArrowUp', 'ArrowUp', 'ArrowDown', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'ArrowLeft', 'ArrowRight', 'b', 'a'];
44
  let konamiIndex = 0;
45
  
46
  document.addEventListener('keydown', (e) => {
47
    if (e.key === konamiCode[konamiIndex]) {
48
      konamiIndex++;
49
      if (konamiIndex === konamiCode.length) {
50
        GameState.discoverSecret('konami_code');
51
        alert('🎮 CHEAT CODE ACTIVATED\n\nSecret content unlocked.');
52
        konamiIndex = 0;
53
      }
54
    } else {
55
      konamiIndex = 0;
56
    }
57
  });
58
  
59
  console.log(`%c🏛️ THE HOLLOW ARCHIVE`, 'font-size: 20px; font-weight: bold; color: #ff4444;');
60
  console.log('Welcome, witness. The archive is watching.');
61
  console.log(`Completion: ${GameState.getCompletion()}%`);
62
});