-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
74 lines (64 loc) · 2.56 KB
/
Copy pathscript.js
File metadata and controls
74 lines (64 loc) · 2.56 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
document.addEventListener('DOMContentLoaded', () => {
const sosButton = document.getElementById('sos-button');
let sosHoldTimer;
// SOS Button Long Press Functionality
sosButton.addEventListener('mousedown', startSOSTimer);
sosButton.addEventListener('mouseup', cancelSOSTimer);
sosButton.addEventListener('mouseleave', cancelSOSTimer);
// Touch events for mobile
sosButton.addEventListener('touchstart', startSOSTimer);
sosButton.addEventListener('touchend', cancelSOSTimer);
function startSOSTimer() {
sosHoldTimer = setTimeout(() => {
activateEmergencyMode();
}, 3000);
}
function cancelSOSTimer() {
clearTimeout(sosHoldTimer);
}
function activateEmergencyMode() {
alert('Emergency Mode Activated! Sending SOS to emergency contacts.');
// In a real app, this would:
// 1. Send location
// 2. Notify emergency contacts
// 3. Potentially call emergency services
}
// Quick Action Cards Interactivity
const actionCards = document.querySelectorAll('.action-card');
actionCards.forEach(card => {
card.addEventListener('click', () => {
const actionTitle = card.querySelector('h3').textContent;
switch(actionTitle) {
case 'Fake Call':
alert('Simulating an incoming call...');
break;
case 'Safety Walk':
alert('Initiating safety walk tracking...');
break;
case 'Check On Me':
alert('Setting up safety timer...');
break;
case 'Share Location':
alert('Preparing to share live location...');
break;
}
});
});
// Contact Action Buttons
const contactCallButtons = document.querySelectorAll('.call-btn');
const contactMessageButtons = document.querySelectorAll('.message-btn');
contactCallButtons.forEach(button => {
button.addEventListener('click', (e) => {
e.stopPropagation();
const contactName = button.closest('.contact-card').querySelector('h3').textContent;
alert(`Calling ${contactName}...`);
});
});
contactMessageButtons.forEach(button => {
button.addEventListener('click', (e) => {
e.stopPropagation();
const contactName = button.closest('.contact-card').querySelector('h3').textContent;
alert(`Preparing message to ${contactName}...`);
});
});
});