Mohabedalgani commited on
Commit
8e039e6
·
verified ·
1 Parent(s): ddfdf05

Add 1 files

Browse files
Files changed (1) hide show
  1. index.html +497 -38
index.html CHANGED
@@ -1,41 +1,500 @@
1
  <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>My app</title>
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <meta charset="utf-8">
 
 
7
  <style>
8
- body {
9
- display: flex;
10
- justify-content: center;
11
- align-items: center;
12
- overflow: hidden;
13
- height: 100dvh;
14
- font-family: "Arial", sans-serif;
15
- text-align: center;
16
- }
17
- .arrow {
18
- position: absolute;
19
- bottom: 32px;
20
- left: 0px;
21
- width: 100px;
22
- transform: rotate(30deg);
23
- }
24
- h1 {
25
- font-size: 50px;
26
- }
27
- h1 span {
28
- color: #acacac;
29
- font-size: 32px;
30
- }
 
 
 
 
 
 
 
 
 
 
31
  </style>
32
- </head>
33
- <body>
34
- <h1>
35
- <span>I'm ready to work,</span><br />
36
- Ask me anything.
37
- </h1>
38
- <img src="https://enzostvs-deepsite.hf.space/arrow.svg" class="arrow" />
39
- <script></script>
40
- <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=Mohabedalgani/test" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
41
- </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>MediScan - QR Medical Information</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% { transform: scale(1); }
12
+ 50% { transform: scale(1.05); }
13
+ }
14
+ .animate-pulse-slow {
15
+ animation: pulse 3s infinite;
16
+ }
17
+ .scanner-overlay {
18
+ position: absolute;
19
+ top: 0;
20
+ left: 0;
21
+ width: 100%;
22
+ height: 100%;
23
+ background: linear-gradient(
24
+ to bottom,
25
+ rgba(0, 255, 0, 0.1) 0%,
26
+ rgba(0, 255, 0, 0.1) 50%,
27
+ rgba(0, 255, 0, 0.1) 100%
28
+ );
29
+ background-size: 100% 10px;
30
+ animation: scan 2s linear infinite;
31
+ pointer-events: none;
32
+ }
33
+ @keyframes scan {
34
+ 0% { background-position: 0 -100px; }
35
+ 100% { background-position: 0 100px; }
36
+ }
37
+ .scanner-frame {
38
+ position: relative;
39
+ border: 4px solid rgba(16, 185, 129, 0.5);
40
+ border-radius: 1rem;
41
+ box-shadow: 0 0 30px rgba(16, 185, 129, 0.3);
42
+ }
43
  </style>
44
+ </head>
45
+ <body class="bg-gray-50 min-h-screen">
46
+ <!-- Header -->
47
+ <header class="bg-teal-600 text-white shadow-lg">
48
+ <div class="container mx-auto px-4 py-6">
49
+ <div class="flex justify-between items-center">
50
+ <div class="flex items-center space-x-2">
51
+ <i class="fas fa-heartbeat text-3xl"></i>
52
+ <h1 class="text-2xl font-bold">MediScan</h1>
53
+ </div>
54
+ <nav class="hidden md:flex space-x-6">
55
+ <a href="#" class="hover:text-teal-200 transition">Home</a>
56
+ <a href="#" class="hover:text-teal-200 transition">About</a>
57
+ <a href="#" class="hover:text-teal-200 transition">Services</a>
58
+ <a href="#" class="hover:text-teal-200 transition">Contact</a>
59
+ </nav>
60
+ <button class="md:hidden text-2xl">
61
+ <i class="fas fa-bars"></i>
62
+ </button>
63
+ </div>
64
+ </div>
65
+ </header>
66
+
67
+ <!-- Hero Section -->
68
+ <section class="bg-gradient-to-r from-teal-500 to-teal-700 text-white py-16">
69
+ <div class="container mx-auto px-4 text-center">
70
+ <h2 class="text-4xl md:text-5xl font-bold mb-6">Access Medical Information Instantly</h2>
71
+ <p class="text-xl mb-8 max-w-3xl mx-auto">Scan QR codes on medical products, prescriptions, or patient IDs to get instant access to vital health information.</p>
72
+ <button id="startScanBtn" class="bg-white text-teal-700 font-bold py-3 px-8 rounded-full hover:bg-teal-100 transition duration-300 shadow-lg animate-pulse-slow">
73
+ <i class="fas fa-qrcode mr-2"></i> Start Scanning
74
+ </button>
75
+ </div>
76
+ </section>
77
+
78
+ <!-- How It Works Section -->
79
+ <section class="py-16 bg-white">
80
+ <div class="container mx-auto px-4">
81
+ <h2 class="text-3xl font-bold text-center mb-12 text-gray-800">How It Works</h2>
82
+
83
+ <div class="grid md:grid-cols-3 gap-8">
84
+ <!-- Step 1 -->
85
+ <div class="bg-gray-50 p-6 rounded-xl shadow-md hover:shadow-lg transition">
86
+ <div class="bg-teal-100 w-16 h-16 rounded-full flex items-center justify-center mb-4 mx-auto">
87
+ <span class="text-teal-700 text-2xl font-bold">1</span>
88
+ </div>
89
+ <h3 class="text-xl font-semibold mb-3 text-center text-gray-800">Grant Camera Access</h3>
90
+ <p class="text-gray-600">When prompted, allow MediScan to access your device's camera. We only use this to scan QR codes and don't store any images.</p>
91
+ </div>
92
+
93
+ <!-- Step 2 -->
94
+ <div class="bg-gray-50 p-6 rounded-xl shadow-md hover:shadow-lg transition">
95
+ <div class="bg-teal-100 w-16 h-16 rounded-full flex items-center justify-center mb-4 mx-auto">
96
+ <span class="text-teal-700 text-2xl font-bold">2</span>
97
+ </div>
98
+ <h3 class="text-xl font-semibold mb-3 text-center text-gray-800">Scan the QR Code</h3>
99
+ <p class="text-gray-600">Point your camera at the medical QR code. Hold steady until the code is recognized (usually within seconds).</p>
100
+ </div>
101
+
102
+ <!-- Step 3 -->
103
+ <div class="bg-gray-50 p-6 rounded-xl shadow-md hover:shadow-lg transition">
104
+ <div class="bg-teal-100 w-16 h-16 rounded-full flex items-center justify-center mb-4 mx-auto">
105
+ <span class="text-teal-700 text-2xl font-bold">3</span>
106
+ </div>
107
+ <h3 class="text-xl font-semibold mb-3 text-center text-gray-800">Get Instant Information</h3>
108
+ <p class="text-gray-600">View the medical information securely. This could be patient records, medication details, or product information.</p>
109
+ </div>
110
+ </div>
111
+ </div>
112
+ </section>
113
+
114
+ <!-- Scanner Modal -->
115
+ <div id="scannerModal" class="fixed inset-0 bg-black bg-opacity-90 z-50 hidden flex-col items-center justify-center p-4">
116
+ <div class="w-full max-w-md">
117
+ <div class="flex justify-between items-center mb-4">
118
+ <h3 class="text-xl font-bold text-white">Scan Medical QR Code</h3>
119
+ <button id="closeScannerBtn" class="text-white text-2xl">
120
+ <i class="fas fa-times"></i>
121
+ </button>
122
+ </div>
123
+
124
+ <div class="scanner-frame relative">
125
+ <video id="scannerVideo" class="w-full h-auto rounded-lg" playsinline></video>
126
+ <div class="scanner-overlay rounded-lg"></div>
127
+ </div>
128
+
129
+ <div class="mt-6 text-center text-white">
130
+ <p class="mb-4">Point your camera at a medical QR code. Make sure it's well-lit and within the frame.</p>
131
+ <div class="flex justify-center space-x-4">
132
+ <button id="toggleTorchBtn" class="bg-gray-700 hover:bg-gray-600 text-white py-2 px-4 rounded-full">
133
+ <i class="fas fa-lightbulb mr-2"></i> Torch
134
+ </button>
135
+ <button id="switchCameraBtn" class="bg-gray-700 hover:bg-gray-600 text-white py-2 px-4 rounded-full">
136
+ <i class="fas fa-camera-retro mr-2"></i> Switch Camera
137
+ </button>
138
+ </div>
139
+ </div>
140
+ </div>
141
+ </div>
142
+
143
+ <!-- Camera Permission Guide -->
144
+ <section class="py-16 bg-gray-100">
145
+ <div class="container mx-auto px-4">
146
+ <div class="bg-white rounded-xl shadow-lg overflow-hidden max-w-4xl mx-auto">
147
+ <div class="md:flex">
148
+ <div class="md:w-1/2 bg-teal-600 text-white p-8 flex items-center">
149
+ <div>
150
+ <h2 class="text-3xl font-bold mb-4">Camera Access Guide</h2>
151
+ <p class="mb-6">We need camera access to scan QR codes, but we respect your privacy. Here's how to grant permission:</p>
152
+ <div class="space-y-4">
153
+ <div class="flex items-start space-x-3">
154
+ <i class="fas fa-mobile-alt mt-1"></i>
155
+ <div>
156
+ <h4 class="font-semibold">On Mobile Devices</h4>
157
+ <p class="text-sm">Tap "Allow" when the browser asks for camera permission.</p>
158
+ </div>
159
+ </div>
160
+ <div class="flex items-start space-x-3">
161
+ <i class="fas fa-lock mt-1"></i>
162
+ <div>
163
+ <h4 class="font-semibold">Privacy Assurance</h4>
164
+ <p class="text-sm">We don't store or transmit any images from your camera.</p>
165
+ </div>
166
+ </div>
167
+ </div>
168
+ </div>
169
+ </div>
170
+ <div class="md:w-1/2 p-8">
171
+ <h3 class="text-xl font-semibold mb-4 text-gray-800">Troubleshooting</h3>
172
+ <div class="space-y-4">
173
+ <div class="flex items-start space-x-3">
174
+ <i class="fas fa-exclamation-triangle text-yellow-500 mt-1"></i>
175
+ <div>
176
+ <h4 class="font-semibold">Permission Denied?</h4>
177
+ <p class="text-sm text-gray-600">Go to your browser settings and enable camera access for this site.</p>
178
+ </div>
179
+ </div>
180
+ <div class="flex items-start space-x-3">
181
+ <i class="fas fa-question-circle text-blue-500 mt-1"></i>
182
+ <div>
183
+ <h4 class="font-semibold">Can't Scan?</h4>
184
+ <p class="text-sm text-gray-600">Ensure good lighting and hold the QR code steady in the frame.</p>
185
+ </div>
186
+ </div>
187
+ <div class="flex items-start space-x-3">
188
+ <i class="fas fa-camera text-purple-500 mt-1"></i>
189
+ <div>
190
+ <h4 class="font-semibold">No Camera?</h4>
191
+ <p class="text-sm text-gray-600">You can upload an image containing the QR code instead.</p>
192
+ </div>
193
+ </div>
194
+ </div>
195
+ <button class="mt-6 w-full bg-teal-600 hover:bg-teal-700 text-white py-3 rounded-lg font-medium transition">
196
+ <i class="fas fa-camera mr-2"></i> Try Scanning Again
197
+ </button>
198
+ </div>
199
+ </div>
200
+ </div>
201
+ </div>
202
+ </section>
203
+
204
+ <!-- Features Section -->
205
+ <section class="py-16 bg-white">
206
+ <div class="container mx-auto px-4">
207
+ <h2 class="text-3xl font-bold text-center mb-12 text-gray-800">Why Use MediScan?</h2>
208
+
209
+ <div class="grid md:grid-cols-2 lg:grid-cols-3 gap-8">
210
+ <div class="bg-teal-50 p-6 rounded-xl border border-teal-100">
211
+ <div class="text-teal-600 text-3xl mb-4">
212
+ <i class="fas fa-bolt"></i>
213
+ </div>
214
+ <h3 class="text-xl font-semibold mb-3 text-gray-800">Instant Access</h3>
215
+ <p class="text-gray-600">Get immediate access to medical information without typing or searching.</p>
216
+ </div>
217
+
218
+ <div class="bg-teal-50 p-6 rounded-xl border border-teal-100">
219
+ <div class="text-teal-600 text-3xl mb-4">
220
+ <i class="fas fa-shield-alt"></i>
221
+ </div>
222
+ <h3 class="text-xl font-semibold mb-3 text-gray-800">Secure</h3>
223
+ <p class="text-gray-600">All data is encrypted and transmitted securely to protect patient privacy.</p>
224
+ </div>
225
+
226
+ <div class="bg-teal-50 p-6 rounded-xl border border-teal-100">
227
+ <div class="text-teal-600 text-3xl mb-4">
228
+ <i class="fas fa-mobile-alt"></i>
229
+ </div>
230
+ <h3 class="text-xl font-semibold mb-3 text-gray-800">Mobile-Friendly</h3>
231
+ <p class="text-gray-600">Optimized for all mobile devices with easy one-handed operation.</p>
232
+ </div>
233
+
234
+ <div class="bg-teal-50 p-6 rounded-xl border border-teal-100">
235
+ <div class="text-teal-600 text-3xl mb-4">
236
+ <i class="fas fa-history"></i>
237
+ </div>
238
+ <h3 class="text-xl font-semibold mb-3 text-gray-800">History</h3>
239
+ <p class="text-gray-600">View your scan history for quick reference (optional and encrypted).</p>
240
+ </div>
241
+
242
+ <div class="bg-teal-50 p-6 rounded-xl border border-teal-100">
243
+ <div class="text-teal-600 text-3xl mb-4">
244
+ <i class="fas fa-language"></i>
245
+ </div>
246
+ <h3 class="text-xl font-semibold mb-3 text-gray-800">Multi-Language</h3>
247
+ <p class="text-gray-600">Supports multiple languages for international medical standards.</p>
248
+ </div>
249
+
250
+ <div class="bg-teal-50 p-6 rounded-xl border border-teal-100">
251
+ <div class="text-teal-600 text-3xl mb-4">
252
+ <i class="fas fa-bell"></i>
253
+ </div>
254
+ <h3 class="text-xl font-semibold mb-3 text-gray-800">Alerts</h3>
255
+ <p class="text-gray-600">Get important alerts about medications or medical conditions.</p>
256
+ </div>
257
+ </div>
258
+ </div>
259
+ </section>
260
+
261
+ <!-- Footer -->
262
+ <footer class="bg-gray-800 text-white py-12">
263
+ <div class="container mx-auto px-4">
264
+ <div class="grid md:grid-cols-4 gap-8">
265
+ <div>
266
+ <h3 class="text-xl font-bold mb-4 flex items-center">
267
+ <i class="fas fa-heartbeat mr-2"></i> MediScan
268
+ </h3>
269
+ <p class="text-gray-400">Providing instant access to medical information through secure QR code scanning technology.</p>
270
+ </div>
271
+ <div>
272
+ <h4 class="text-lg font-semibold mb-4">Quick Links</h4>
273
+ <ul class="space-y-2">
274
+ <li><a href="#" class="text-gray-400 hover:text-white transition">Home</a></li>
275
+ <li><a href="#" class="text-gray-400 hover:text-white transition">About Us</a></li>
276
+ <li><a href="#" class="text-gray-400 hover:text-white transition">Services</a></li>
277
+ <li><a href="#" class="text-gray-400 hover:text-white transition">Contact</a></li>
278
+ </ul>
279
+ </div>
280
+ <div>
281
+ <h4 class="text-lg font-semibold mb-4">Legal</h4>
282
+ <ul class="space-y-2">
283
+ <li><a href="#" class="text-gray-400 hover:text-white transition">Privacy Policy</a></li>
284
+ <li><a href="#" class="text-gray-400 hover:text-white transition">Terms of Service</a></li>
285
+ <li><a href="#" class="text-gray-400 hover:text-white transition">HIPAA Compliance</a></li>
286
+ </ul>
287
+ </div>
288
+ <div>
289
+ <h4 class="text-lg font-semibold mb-4">Contact Us</h4>
290
+ <ul class="space-y-2">
291
+ <li class="flex items-center text-gray-400"><i class="fas fa-envelope mr-2"></i> [email protected]</li>
292
+ <li class="flex items-center text-gray-400"><i class="fas fa-phone mr-2"></i> (800) 555-HELP</li>
293
+ <li class="flex items-center text-gray-400"><i class="fas fa-map-marker-alt mr-2"></i> 123 Medical Way, Boston, MA</li>
294
+ </ul>
295
+ </div>
296
+ </div>
297
+ <div class="border-t border-gray-700 mt-8 pt-8 text-center text-gray-400">
298
+ <p>&copy; 2023 MediScan. All rights reserved.</p>
299
+ </div>
300
+ </div>
301
+ </footer>
302
+
303
+ <!-- QR Code Detected Modal -->
304
+ <div id="resultModal" class="fixed inset-0 bg-black bg-opacity-90 z-50 hidden flex-col items-center justify-center p-4">
305
+ <div class="bg-white rounded-xl shadow-2xl max-w-md w-full p-6">
306
+ <div class="flex justify-between items-center mb-4">
307
+ <h3 class="text-xl font-bold text-gray-800">Scan Result</h3>
308
+ <button id="closeResultBtn" class="text-gray-500 hover:text-gray-700 text-2xl">
309
+ <i class="fas fa-times"></i>
310
+ </button>
311
+ </div>
312
+ <div id="scanResultContent" class="mb-6">
313
+ <!-- Dynamic content will be inserted here -->
314
+ </div>
315
+ <div class="flex justify-between">
316
+ <button id="newScanBtn" class="bg-teal-600 hover:bg-teal-700 text-white py-2 px-4 rounded-lg font-medium transition">
317
+ <i class="fas fa-qrcode mr-2"></i> Scan Another
318
+ </button>
319
+ <button id="saveResultBtn" class="bg-gray-200 hover:bg-gray-300 text-gray-800 py-2 px-4 rounded-lg font-medium transition">
320
+ <i class="fas fa-save mr-2"></i> Save
321
+ </button>
322
+ </div>
323
+ </div>
324
+ </div>
325
+
326
+ <script>
327
+ document.addEventListener('DOMContentLoaded', function() {
328
+ // Elements
329
+ const startScanBtn = document.getElementById('startScanBtn');
330
+ const scannerModal = document.getElementById('scannerModal');
331
+ const closeScannerBtn = document.getElementById('closeScannerBtn');
332
+ const scannerVideo = document.getElementById('scannerVideo');
333
+ const toggleTorchBtn = document.getElementById('toggleTorchBtn');
334
+ const switchCameraBtn = document.getElementById('switchCameraBtn');
335
+ const resultModal = document.getElementById('resultModal');
336
+ const closeResultBtn = document.getElementById('closeResultBtn');
337
+ const newScanBtn = document.getElementById('newScanBtn');
338
+ const saveResultBtn = document.getElementById('saveResultBtn');
339
+ const scanResultContent = document.getElementById('scanResultContent');
340
+
341
+ // Variables
342
+ let stream = null;
343
+ let currentFacingMode = 'environment';
344
+ let torchEnabled = false;
345
+ let track = null;
346
+
347
+ // Start scanning
348
+ startScanBtn.addEventListener('click', async function() {
349
+ scannerModal.classList.remove('hidden');
350
+ document.body.style.overflow = 'hidden';
351
+
352
+ try {
353
+ stream = await navigator.mediaDevices.getUserMedia({
354
+ video: {
355
+ facingMode: currentFacingMode,
356
+ width: { ideal: 1280 },
357
+ height: { ideal: 720 }
358
+ }
359
+ });
360
+
361
+ scannerVideo.srcObject = stream;
362
+ track = stream.getVideoTracks()[0];
363
+
364
+ // Check if torch is available
365
+ if ('torch' in track.getCapabilities()) {
366
+ toggleTorchBtn.classList.remove('hidden');
367
+ }
368
+
369
+ // Start QR code detection
370
+ detectQRCode();
371
+
372
+ } catch (error) {
373
+ console.error('Error accessing camera:', error);
374
+ alert('Could not access the camera. Please ensure you have granted camera permissions.');
375
+ closeScanner();
376
+ }
377
+ });
378
+
379
+ // Close scanner
380
+ closeScannerBtn.addEventListener('click', closeScanner);
381
+
382
+ function closeScanner() {
383
+ if (stream) {
384
+ stream.getTracks().forEach(track => track.stop());
385
+ }
386
+ scannerModal.classList.add('hidden');
387
+ document.body.style.overflow = 'auto';
388
+ }
389
+
390
+ // Toggle torch
391
+ toggleTorchBtn.addEventListener('click', function() {
392
+ if (!track) return;
393
+
394
+ try {
395
+ torchEnabled = !torchEnabled;
396
+ track.applyConstraints({
397
+ advanced: [{torch: torchEnabled}]
398
+ });
399
+
400
+ toggleTorchBtn.innerHTML = torchEnabled
401
+ ? '<i class="fas fa-lightbulb mr-2"></i> Torch On'
402
+ : '<i class="fas fa-lightbulb mr-2"></i> Torch Off';
403
+
404
+ } catch (error) {
405
+ console.error('Error toggling torch:', error);
406
+ }
407
+ });
408
+
409
+ // Switch camera
410
+ switchCameraBtn.addEventListener('click', async function() {
411
+ if (!stream) return;
412
+
413
+ currentFacingMode = currentFacingMode === 'user' ? 'environment' : 'user';
414
+
415
+ try {
416
+ // Stop previous stream
417
+ stream.getTracks().forEach(track => track.stop());
418
+
419
+ // Get new stream
420
+ stream = await navigator.mediaDevices.getUserMedia({
421
+ video: {
422
+ facingMode: currentFacingMode,
423
+ width: { ideal: 1280 },
424
+ height: { ideal: 720 }
425
+ }
426
+ });
427
+
428
+ scannerVideo.srcObject = stream;
429
+ track = stream.getVideoTracks()[0];
430
+
431
+ // Reset torch
432
+ torchEnabled = false;
433
+ if ('torch' in track.getCapabilities()) {
434
+ toggleTorchBtn.classList.remove('hidden');
435
+ toggleTorchBtn.innerHTML = '<i class="fas fa-lightbulb mr-2"></i> Torch';
436
+ } else {
437
+ toggleTorchBtn.classList.add('hidden');
438
+ }
439
+
440
+ } catch (error) {
441
+ console.error('Error switching camera:', error);
442
+ }
443
+ });
444
+
445
+ // QR Code detection
446
+ function detectQRCode() {
447
+ // In a real implementation, you would use a QR code scanning library like jsQR
448
+ // This is a simplified simulation for demonstration purposes
449
+
450
+ // Simulate QR code detection after 3 seconds
451
+ setTimeout(() => {
452
+ // Only show result if scanner is still open
453
+ if (!scannerModal.classList.contains('hidden')) {
454
+ showResult({
455
+ type: "Medical QR",
456
+ data: "Patient: John Doe\nMedication: Ibuprofen 200mg\nDosage: 1 tablet every 6 hours\nExpires: 12/2024\nLot: IBU12345",
457
+ timestamp: new Date().toLocaleString()
458
+ });
459
+ closeScanner();
460
+ }
461
+ }, 3000);
462
+ }
463
+
464
+ // Show scan result
465
+ function showResult(data) {
466
+ scanResultContent.innerHTML = `
467
+ <div class="bg-teal-50 border-l-4 border-teal-600 p-4 mb-4">
468
+ <h4 class="font-bold text-teal-800">${data.type}</h4>
469
+ <p class="text-sm text-gray-600">Scanned at ${data.timestamp}</p>
470
+ </div>
471
+ <div class="bg-gray-100 p-4 rounded-lg">
472
+ <pre class="text-sm whitespace-pre-wrap font-mono">${data.data}</pre>
473
+ </div>
474
+ `;
475
+ resultModal.classList.remove('hidden');
476
+ document.body.style.overflow = 'hidden';
477
+ }
478
+
479
+ // Close result modal
480
+ closeResultBtn.addEventListener('click', function() {
481
+ resultModal.classList.add('hidden');
482
+ document.body.style.overflow = 'auto';
483
+ });
484
+
485
+ // New scan
486
+ newScanBtn.addEventListener('click', function() {
487
+ resultModal.classList.add('hidden');
488
+ startScanBtn.click();
489
+ });
490
+
491
+ // Save result
492
+ saveResultBtn.addEventListener('click', function() {
493
+ alert('Scan result saved to your history.');
494
+ resultModal.classList.add('hidden');
495
+ document.body.style.overflow = 'auto';
496
+ });
497
+ });
498
+ </script>
499
+ <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=Mohabedalgani/test" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
500
+ </html>