File size: 1,640 Bytes
72dc496
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
document.addEventListener('DOMContentLoaded', function() {
    // Check if welcome screen has been shown before
    const hasSeenWelcome = localStorage.getItem('hasSeenWelcome');
    
    if (hasSeenWelcome) {
        document.getElementById('welcome-screen').classList.add('hidden');
        document.getElementById('app').classList.remove('hidden');
    }

    // Start button click handler
    document.getElementById('start-btn').addEventListener('click', function() {
        localStorage.setItem('hasSeenWelcome', 'true');
        document.getElementById('welcome-screen').classList.add('fade-out');
        
        setTimeout(() => {
            document.getElementById('welcome-screen').classList.add('hidden');
            document.getElementById('app').classList.remove('hidden');
        }, 300);
    });

    // Check online status for emergency call button
    function updateOnlineStatus() {
        const callBtn = document.getElementById('call-btn-container');
        if (navigator.onLine) {
            callBtn.classList.remove('hidden');
        } else {
            callBtn.classList.add('hidden');
        }
    }

    window.addEventListener('online', updateOnlineStatus);
    window.addEventListener('offline', updateOnlineStatus);
    updateOnlineStatus();

    // About modal handlers
    document.getElementById('about-btn').addEventListener('click', function() {
        document.getElementById('about-modal').classList.remove('hidden');
    });

    document.getElementById('close-about').addEventListener('click', function() {
        document.getElementById('about-modal').classList.add('hidden');
    });
});