amirpoorazima commited on
Commit
8c367ac
·
verified ·
1 Parent(s): bd83519

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +296 -19
  3. prompts.txt +1 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Sos Flasher
3
- emoji: 🐠
4
- colorFrom: yellow
5
- colorTo: indigo
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: sos-flasher
3
+ emoji: 🐳
4
+ colorFrom: red
5
+ colorTo: red
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,296 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Emergency SOS Flasher</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ @keyframes pulse {
11
+ 0%, 100% { opacity: 1; }
12
+ 50% { opacity: 0.3; }
13
+ }
14
+ .sos-pulse {
15
+ animation: pulse 1s infinite;
16
+ }
17
+ .emergency-btn {
18
+ box-shadow: 0 0 15px rgba(239, 68, 68, 0.7);
19
+ }
20
+ .morse-code {
21
+ font-family: 'Courier New', monospace;
22
+ letter-spacing: 5px;
23
+ }
24
+ </style>
25
+ </head>
26
+ <body class="bg-gray-900 text-white min-h-screen flex flex-col">
27
+ <header class="bg-gray-800 py-6 px-4 shadow-lg">
28
+ <div class="container mx-auto flex justify-between items-center">
29
+ <h1 class="text-2xl font-bold text-red-500">
30
+ <i class="fas fa-exclamation-triangle mr-2"></i>
31
+ Emergency SOS Flasher
32
+ </h1>
33
+ <div class="flex space-x-4">
34
+ <button id="helpBtn" class="bg-blue-600 hover:bg-blue-700 px-4 py-2 rounded-lg transition">
35
+ <i class="fas fa-question-circle mr-2"></i>Help
36
+ </button>
37
+ </div>
38
+ </div>
39
+ </header>
40
+
41
+ <main class="flex-grow container mx-auto px-4 py-8 flex flex-col items-center justify-center">
42
+ <div class="bg-gray-800 rounded-xl p-8 w-full max-w-2xl shadow-2xl">
43
+ <div class="text-center mb-8">
44
+ <h2 class="text-3xl font-bold mb-2">Emergency Signal</h2>
45
+ <p class="text-gray-400">Use this tool to flash SOS in Morse code (···−−−···)</p>
46
+ </div>
47
+
48
+ <div class="flex flex-col items-center mb-8">
49
+ <div id="flashDisplay" class="w-40 h-40 rounded-full bg-gray-700 mb-6 flex items-center justify-center transition-all duration-300">
50
+ <span id="statusText" class="text-xl font-semibold">OFF</span>
51
+ </div>
52
+
53
+ <div class="mb-6 text-center">
54
+ <p id="morseDisplay" class="morse-code text-2xl font-mono py-4 px-6 bg-gray-700 rounded-lg">··· −−− ···</p>
55
+ <p class="text-gray-400 mt-2">Current Morse Code</p>
56
+ </div>
57
+
58
+ <div class="flex space-x-4 mb-6">
59
+ <button id="testBtn" class="bg-yellow-600 hover:bg-yellow-700 px-6 py-3 rounded-lg font-bold transition">
60
+ <i class="fas fa-bolt mr-2"></i>Test Flash
61
+ </button>
62
+ <button id="toggleBtn" class="emergency-btn bg-red-600 hover:bg-red-700 px-8 py-3 rounded-lg font-bold transition">
63
+ <i class="fas fa-power-off mr-2"></i>Toggle SOS
64
+ </button>
65
+ </div>
66
+
67
+ <div class="w-full max-w-md bg-gray-700 rounded-lg p-4">
68
+ <div class="flex justify-between mb-2">
69
+ <span>Flash Speed</span>
70
+ <span id="speedValue">Medium</span>
71
+ </div>
72
+ <input id="speedSlider" type="range" min="100" max="800" value="400" class="w-full h-2 bg-gray-600 rounded-lg appearance-none cursor-pointer">
73
+ </div>
74
+ </div>
75
+
76
+ <div class="bg-gray-700 rounded-lg p-4">
77
+ <h3 class="font-bold mb-2"><i class="fas fa-info-circle mr-2 text-blue-400"></i>About SOS</h3>
78
+ <p class="text-gray-300">
79
+ SOS is the international distress signal in Morse code. The sequence is three short flashes (·), three long flashes (−), and three short flashes (·).
80
+ This pattern is easy to recognize and can be seen from great distances.
81
+ </p>
82
+ </div>
83
+ </div>
84
+ </main>
85
+
86
+ <footer class="bg-gray-800 py-4 px-4 text-center text-gray-400">
87
+ <p>Emergency SOS Flasher - Use responsibly in genuine emergencies</p>
88
+ </footer>
89
+
90
+ <!-- Help Modal -->
91
+ <div id="helpModal" class="fixed inset-0 bg-black bg-opacity-70 flex items-center justify-center hidden z-50">
92
+ <div class="bg-gray-800 rounded-xl p-6 max-w-2xl w-full mx-4">
93
+ <div class="flex justify-between items-center mb-4">
94
+ <h3 class="text-2xl font-bold"><i class="fas fa-question-circle mr-2 text-blue-400"></i>How to Use</h3>
95
+ <button id="closeHelp" class="text-gray-400 hover:text-white">
96
+ <i class="fas fa-times text-2xl"></i>
97
+ </button>
98
+ </div>
99
+ <div class="space-y-4">
100
+ <div>
101
+ <h4 class="font-bold text-lg mb-2">1. Using the SOS Flasher</h4>
102
+ <p class="text-gray-300">
103
+ Click the red "Toggle SOS" button to start flashing the SOS signal. The display will show the current state (ON/OFF)
104
+ and visualize the Morse code pattern. Adjust the speed slider to change how fast the signal flashes.
105
+ </p>
106
+ </div>
107
+ <div>
108
+ <h4 class="font-bold text-lg mb-2">2. Test Flash</h4>
109
+ <p class="text-gray-300">
110
+ Use the yellow "Test Flash" button to check if the flasher is working without activating the full SOS sequence.
111
+ </p>
112
+ </div>
113
+ <div>
114
+ <h4 class="font-bold text-lg mb-2">3. Emergency Situations</h4>
115
+ <p class="text-gray-300">
116
+ Only use this tool in genuine emergencies. The SOS signal should be directed toward potential rescuers.
117
+ In darkness, this visual signal can be seen from several kilometers away.
118
+ </p>
119
+ </div>
120
+ <div class="bg-blue-900 bg-opacity-30 p-4 rounded-lg">
121
+ <h4 class="font-bold text-lg mb-2"><i class="fas fa-lightbulb mr-2"></i>Tip</h4>
122
+ <p class="text-gray-300">
123
+ For maximum visibility, point your device's screen toward the horizon or potential rescuers.
124
+ In daylight, increase your screen brightness to maximum.
125
+ </p>
126
+ </div>
127
+ </div>
128
+ </div>
129
+ </div>
130
+
131
+ <script>
132
+ document.addEventListener('DOMContentLoaded', function() {
133
+ // Elements
134
+ const toggleBtn = document.getElementById('toggleBtn');
135
+ const testBtn = document.getElementById('testBtn');
136
+ const flashDisplay = document.getElementById('flashDisplay');
137
+ const statusText = document.getElementById('statusText');
138
+ const morseDisplay = document.getElementById('morseDisplay');
139
+ const speedSlider = document.getElementById('speedSlider');
140
+ const speedValue = document.getElementById('speedValue');
141
+ const helpBtn = document.getElementById('helpBtn');
142
+ const helpModal = document.getElementById('helpModal');
143
+ const closeHelp = document.getElementById('closeHelp');
144
+
145
+ // State
146
+ let isSOSActive = false;
147
+ let flashInterval;
148
+ let speed = 400; // Default speed (medium)
149
+
150
+ // Morse code patterns
151
+ const morseSOS = ['...', '---', '...'];
152
+ const morseMap = {
153
+ '.': '·',
154
+ '-': '−'
155
+ };
156
+
157
+ // Update speed display
158
+ speedSlider.addEventListener('input', function() {
159
+ speed = parseInt(this.value);
160
+ updateSpeedDisplay();
161
+
162
+ // If SOS is active, restart with new speed
163
+ if (isSOSActive) {
164
+ stopSOS();
165
+ startSOS();
166
+ }
167
+ });
168
+
169
+ function updateSpeedDisplay() {
170
+ if (speed <= 200) {
171
+ speedValue.textContent = 'Very Fast';
172
+ } else if (speed <= 400) {
173
+ speedValue.textContent = 'Fast';
174
+ } else if (speed <= 600) {
175
+ speedValue.textContent = 'Medium';
176
+ } else {
177
+ speedValue.textContent = 'Slow';
178
+ }
179
+ }
180
+
181
+ // Toggle SOS
182
+ toggleBtn.addEventListener('click', function() {
183
+ if (isSOSActive) {
184
+ stopSOS();
185
+ } else {
186
+ startSOS();
187
+ }
188
+ });
189
+
190
+ // Test flash
191
+ testBtn.addEventListener('click', function() {
192
+ // Flash once
193
+ flashDisplay.classList.add('bg-red-500');
194
+ flashDisplay.classList.remove('bg-gray-700');
195
+ statusText.textContent = 'TEST';
196
+
197
+ setTimeout(() => {
198
+ flashDisplay.classList.remove('bg-red-500');
199
+ flashDisplay.classList.add('bg-gray-700');
200
+ statusText.textContent = 'OFF';
201
+ }, 500);
202
+ });
203
+
204
+ // Start SOS sequence
205
+ function startSOS() {
206
+ isSOSActive = true;
207
+ toggleBtn.innerHTML = '<i class="fas fa-power-off mr-2"></i>Stop SOS';
208
+ toggleBtn.classList.remove('bg-red-600');
209
+ toggleBtn.classList.add('bg-green-600');
210
+ statusText.textContent = 'ON';
211
+
212
+ let sequenceIndex = 0;
213
+ let characterIndex = 0;
214
+ let isFlashOn = false;
215
+
216
+ flashInterval = setInterval(() => {
217
+ if (!isFlashOn) {
218
+ // Flash on
219
+ const currentChar = morseSOS[sequenceIndex][characterIndex];
220
+ const isLong = currentChar === '-';
221
+
222
+ flashDisplay.classList.add('bg-red-500');
223
+ flashDisplay.classList.remove('bg-gray-700');
224
+
225
+ // Update Morse display
226
+ const displayText = morseSOS.map((group, i) => {
227
+ if (i === sequenceIndex) {
228
+ return group.split('').map((c, j) => {
229
+ if (j <= characterIndex) {
230
+ return morseMap[c] || c;
231
+ }
232
+ return ' ';
233
+ }).join('');
234
+ }
235
+ return group.split('').map(c => morseMap[c] || c).join(' ');
236
+ }).join(' ');
237
+
238
+ morseDisplay.textContent = displayText;
239
+
240
+ // Set timeout for flash duration
241
+ const duration = isLong ? speed * 2 : speed;
242
+ setTimeout(() => {
243
+ flashDisplay.classList.remove('bg-red-500');
244
+ flashDisplay.classList.add('bg-gray-700');
245
+ isFlashOn = false;
246
+
247
+ // Move to next character
248
+ characterIndex++;
249
+ if (characterIndex >= morseSOS[sequenceIndex].length) {
250
+ characterIndex = 0;
251
+ sequenceIndex++;
252
+ if (sequenceIndex >= morseSOS.length) {
253
+ sequenceIndex = 0;
254
+ }
255
+ }
256
+ }, duration);
257
+
258
+ isFlashOn = true;
259
+ }
260
+ }, speed * 3); // Base interval
261
+ }
262
+
263
+ // Stop SOS sequence
264
+ function stopSOS() {
265
+ isSOSActive = false;
266
+ clearInterval(flashInterval);
267
+ toggleBtn.innerHTML = '<i class="fas fa-power-off mr-2"></i>Toggle SOS';
268
+ toggleBtn.classList.add('bg-red-600');
269
+ toggleBtn.classList.remove('bg-green-600');
270
+ flashDisplay.classList.remove('bg-red-500');
271
+ flashDisplay.classList.add('bg-gray-700');
272
+ statusText.textContent = 'OFF';
273
+ morseDisplay.textContent = '··· −−− ···';
274
+ }
275
+
276
+ // Help modal
277
+ helpBtn.addEventListener('click', () => {
278
+ helpModal.classList.remove('hidden');
279
+ });
280
+
281
+ closeHelp.addEventListener('click', () => {
282
+ helpModal.classList.add('hidden');
283
+ });
284
+
285
+ helpModal.addEventListener('click', (e) => {
286
+ if (e.target === helpModal) {
287
+ helpModal.classList.add('hidden');
288
+ }
289
+ });
290
+
291
+ // Initialize
292
+ updateSpeedDisplay();
293
+ });
294
+ </script>
295
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=amirpoorazima/sos-flasher" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
296
+ </html>
prompts.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ SOS flasher