salahAlkaabi commited on
Commit
a2f6ea3
·
verified ·
1 Parent(s): 6982784

Create Interactive Dubai Sustainability Map.html

Browse files
Interactive Dubai Sustainability Map.html ADDED
@@ -0,0 +1,626 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>Dubai Sustainability Map</title>
7
+ <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
8
+ <style>
9
+ * {
10
+ margin: 0;
11
+ padding: 0;
12
+ box-sizing: border-box;
13
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
14
+ }
15
+
16
+ body {
17
+ background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
18
+ color: #333;
19
+ min-height: 100vh;
20
+ }
21
+
22
+ .container {
23
+ max-width: 1400px;
24
+ margin: 0 auto;
25
+ padding: 20px;
26
+ }
27
+
28
+ header {
29
+ display: flex;
30
+ justify-content: space-between;
31
+ align-items: center;
32
+ margin-bottom: 20px;
33
+ padding: 15px 20px;
34
+ background: white;
35
+ border-radius: 12px;
36
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
37
+ }
38
+
39
+ .logo {
40
+ display: flex;
41
+ align-items: center;
42
+ gap: 10px;
43
+ }
44
+
45
+ .logo-icon {
46
+ font-size: 28px;
47
+ color: #0c6b4c;
48
+ }
49
+
50
+ .logo-text {
51
+ font-size: 24px;
52
+ font-weight: 700;
53
+ color: #0c6b4c;
54
+ }
55
+
56
+ .logo-text span {
57
+ color: #ffc107;
58
+ }
59
+
60
+ .language-toggle {
61
+ display: flex;
62
+ align-items: center;
63
+ gap: 10px;
64
+ }
65
+
66
+ .lang-btn {
67
+ background: transparent;
68
+ border: 1px solid #0c6b4c;
69
+ color: #0c6b4c;
70
+ padding: 8px 18px;
71
+ border-radius: 20px;
72
+ cursor: pointer;
73
+ transition: all 0.3s;
74
+ font-weight: 500;
75
+ }
76
+
77
+ .lang-btn.active {
78
+ background: #0c6b4c;
79
+ color: white;
80
+ }
81
+
82
+ .map-container {
83
+ position: relative;
84
+ height: 650px;
85
+ border-radius: 12px;
86
+ overflow: hidden;
87
+ box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
88
+ }
89
+
90
+ #map {
91
+ height: 100%;
92
+ width: 100%;
93
+ }
94
+
95
+ .map-controls {
96
+ position: absolute;
97
+ top: 15px;
98
+ right: 15px;
99
+ z-index: 1000;
100
+ background: white;
101
+ border-radius: 10px;
102
+ box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
103
+ padding: 15px;
104
+ width: 240px;
105
+ }
106
+
107
+ .layer-title {
108
+ font-weight: 600;
109
+ margin-bottom: 12px;
110
+ color: #0c6b4c;
111
+ display: flex;
112
+ align-items: center;
113
+ gap: 8px;
114
+ font-size: 16px;
115
+ }
116
+
117
+ .toggle-container {
118
+ display: flex;
119
+ justify-content: space-between;
120
+ align-items: center;
121
+ margin-bottom: 15px;
122
+ }
123
+
124
+ .toggle-switch {
125
+ position: relative;
126
+ display: inline-block;
127
+ width: 54px;
128
+ height: 28px;
129
+ }
130
+
131
+ .toggle-switch input {
132
+ opacity: 0;
133
+ width: 0;
134
+ height: 0;
135
+ }
136
+
137
+ .slider {
138
+ position: absolute;
139
+ cursor: pointer;
140
+ top: 0;
141
+ left: 0;
142
+ right: 0;
143
+ bottom: 0;
144
+ background-color: #ccc;
145
+ transition: .4s;
146
+ border-radius: 28px;
147
+ }
148
+
149
+ .slider:before {
150
+ position: absolute;
151
+ content: "";
152
+ height: 20px;
153
+ width: 20px;
154
+ left: 4px;
155
+ bottom: 4px;
156
+ background-color: white;
157
+ transition: .4s;
158
+ border-radius: 50%;
159
+ }
160
+
161
+ input:checked + .slider {
162
+ background-color: #0c6b4c;
163
+ }
164
+
165
+ input:checked + .slider:before {
166
+ transform: translateX(26px);
167
+ }
168
+
169
+ .legend {
170
+ margin-top: 15px;
171
+ padding-top: 15px;
172
+ border-top: 1px solid #e1e5e9;
173
+ }
174
+
175
+ .legend-title {
176
+ font-weight: 600;
177
+ margin-bottom: 10px;
178
+ font-size: 14px;
179
+ color: #0c6b4c;
180
+ }
181
+
182
+ .legend-item {
183
+ display: flex;
184
+ align-items: center;
185
+ margin-bottom: 8px;
186
+ font-size: 13px;
187
+ }
188
+
189
+ .legend-color {
190
+ width: 22px;
191
+ height: 12px;
192
+ margin-right: 10px;
193
+ border-radius: 3px;
194
+ }
195
+
196
+ .property-popup {
197
+ max-width: 280px;
198
+ }
199
+
200
+ .popup-title {
201
+ font-weight: 600;
202
+ margin-bottom: 8px;
203
+ color: #0c6b4c;
204
+ font-size: 16px;
205
+ }
206
+
207
+ .sustainability-score {
208
+ display: inline-block;
209
+ padding: 4px 10px;
210
+ border-radius: 12px;
211
+ font-size: 13px;
212
+ font-weight: 600;
213
+ margin-bottom: 12px;
214
+ }
215
+
216
+ .high-score {
217
+ background-color: #0c6b4c;
218
+ color: white;
219
+ }
220
+
221
+ .medium-score {
222
+ background-color: #ffc107;
223
+ color: #333;
224
+ }
225
+
226
+ .low-score {
227
+ background-color: #dc3545;
228
+ color: white;
229
+ }
230
+
231
+ .green-badge {
232
+ display: inline-flex;
233
+ align-items: center;
234
+ background-color: #0c6b4c;
235
+ color: white;
236
+ padding: 5px 12px;
237
+ border-radius: 12px;
238
+ font-size: 13px;
239
+ font-weight: 600;
240
+ margin-bottom: 12px;
241
+ gap: 5px;
242
+ }
243
+
244
+ .metrics {
245
+ margin-top: 12px;
246
+ }
247
+
248
+ .metric {
249
+ display: flex;
250
+ justify-content: space-between;
251
+ margin-bottom: 6px;
252
+ font-size: 14px;
253
+ }
254
+
255
+ .metric-name {
256
+ color: #666;
257
+ }
258
+
259
+ .metric-value {
260
+ font-weight: 600;
261
+ color: #0c6b4c;
262
+ }
263
+
264
+ .info-panel {
265
+ margin-top: 25px;
266
+ background: white;
267
+ border-radius: 10px;
268
+ padding: 20px;
269
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
270
+ }
271
+
272
+ .info-title {
273
+ font-weight: 600;
274
+ margin-bottom: 12px;
275
+ color: #0c6b4c;
276
+ font-size: 18px;
277
+ }
278
+
279
+ .info-text {
280
+ font-size: 15px;
281
+ line-height: 1.6;
282
+ color: #555;
283
+ }
284
+
285
+ .stats-container {
286
+ display: grid;
287
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
288
+ gap: 15px;
289
+ margin-top: 15px;
290
+ }
291
+
292
+ .stat-card {
293
+ background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
294
+ padding: 15px;
295
+ border-radius: 8px;
296
+ text-align: center;
297
+ }
298
+
299
+ .stat-value {
300
+ font-size: 24px;
301
+ font-weight: 700;
302
+ color: #0c6b4c;
303
+ }
304
+
305
+ .stat-label {
306
+ font-size: 13px;
307
+ color: #666;
308
+ margin-top: 5px;
309
+ }
310
+
311
+ @media (max-width: 768px) {
312
+ .map-container {
313
+ height: 500px;
314
+ }
315
+
316
+ .map-controls {
317
+ width: 200px;
318
+ }
319
+
320
+ header {
321
+ flex-direction: column;
322
+ gap: 15px;
323
+ align-items: flex-start;
324
+ }
325
+
326
+ .language-toggle {
327
+ align-self: flex-end;
328
+ }
329
+ }
330
+
331
+ .heatmap-overlay {
332
+ position: absolute;
333
+ top: 0;
334
+ left: 0;
335
+ width: 100%;
336
+ height: 100%;
337
+ pointer-events: none;
338
+ opacity: 0.4;
339
+ z-index: 500;
340
+ }
341
+ </style>
342
+ </head>
343
+ <body>
344
+ <div class="container">
345
+ <header>
346
+ <div class="logo">
347
+ <div class="logo-icon">🌍</div>
348
+ <div class="logo-text">Dubai<span>Sustainability</span>Map</div>
349
+ </div>
350
+ <div class="language-toggle">
351
+ <button class="lang-btn active" id="english-btn">English</button>
352
+ <button class="lang-btn" id="arabic-btn">العربية</button>
353
+ </div>
354
+ </header>
355
+
356
+ <div class="map-container">
357
+ <div id="map"></div>
358
+
359
+ <div class="map-controls">
360
+ <div class="layer-title">♻️ Sustainability Layer</div>
361
+ <div class="toggle-container">
362
+ <span id="toggle-label">OFF</span>
363
+ <label class="toggle-switch">
364
+ <input type="checkbox" id="sustainability-toggle">
365
+ <span class="slider"></span>
366
+ </label>
367
+ </div>
368
+
369
+ <div class="legend" id="legend">
370
+ <div class="legend-title">Sustainability Score</div>
371
+ <div class="legend-item">
372
+ <div class="legend-color" style="background-color: #0c6b4c;"></div>
373
+ <span>High (8-10)</span>
374
+ </div>
375
+ <div class="legend-item">
376
+ <div class="legend-color" style="background-color: #ffc107;"></div>
377
+ <span>Medium (5-7)</span>
378
+ </div>
379
+ <div class="legend-item">
380
+ <div class="legend-color" style="background-color: #dc3545;"></div>
381
+ <span>Low (0-4)</span>
382
+ </div>
383
+ </div>
384
+ </div>
385
+ </div>
386
+
387
+ <div class="info-panel">
388
+ <div class="info-title">About the Sustainability Layer</div>
389
+ <div class="info-text" id="info-text">
390
+ The Sustainability Layer highlights properties across Dubai based on their environmental sustainability scores.
391
+ Properties are color-coded according to their scores: dark green for highly sustainable, yellow for medium sustainability,
392
+ and red for low sustainability. Properties with high scores also display a "🌱 Green Certified" badge.
393
+ Click on any property to view detailed sustainability metrics.
394
+ </div>
395
+
396
+ <div class="stats-container">
397
+ <div class="stat-card">
398
+ <div class="stat-value">100</div>
399
+ <div class="stat-label">Green Certified Properties</div>
400
+ </div>
401
+ </div>
402
+ </div>
403
+
404
+ <script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
405
+ <script>
406
+ // Initialize the map
407
+ const map = L.map('map').setView([25.2048, 55.2708], 11);
408
+
409
+ // Add tile layer (using OpenStreetMap as base)
410
+ L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
411
+ attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
412
+ }).addTo(map);
413
+
414
+ // Generate 100 sample properties across Dubai with sustainability scores
415
+ const properties = [];
416
+ const dubaiAreas = [
417
+ { name: "Downtown Dubai", lat: 25.1972, lng: 55.2744, density: 15 },
418
+ { name: "Dubai Marina", lat: 25.0764, lng: 55.1394, density: 20 },
419
+ { name: "Jumeirah", lat: 25.2000, lng: 55.2400, density: 10 },
420
+ { name: "Business Bay", lat: 25.1859, lng: 55.2797, density: 12 },
421
+ { name: "Al Barsha", lat: 25.1189, lng: 55.2028, density: 15 },
422
+ { name: "Deira", lat: 25.2667, lng: 55.3167, density: 8 },
423
+ { name: "Bur Dubai", lat: 25.2500, lng: 55.3000, density: 10 },
424
+ { name: "Jebel Ali", lat: 25.0167, lng: 55.0667, density: 5 },
425
+ { name: "Mirdif", lat: 25.2200, lng: 55.4100, density: 5 },
426
+ { name: "The Greens", lat: 25.1250, lng: 55.2000, density: 8 },
427
+ { name: "Arabian Ranches", lat: 25.0381, lng: 55.2261, density: 7 },
428
+ { name: "Dubai Hills", lat: 25.0625, lng: 55.2944, density: 10 }
429
+ ];
430
+
431
+ // Function to generate random sustainability data
432
+ function generateSustainabilityData() {
433
+ const energyRatings = ["A++", "A+", "A", "B", "C", "D"];
434
+ const waterSystems = ["Advanced Smart System", "Smart System", "Standard System"];
435
+ const materials = [
436
+ "Recycled Steel & Glass",
437
+ "Eco-friendly Materials",
438
+ "Mixed Materials",
439
+ "Standard Concrete"
440
+ ];
441
+ const greenSpaces = [
442
+ "Abundant Green Spaces",
443
+ "Nearby Parks",
444
+ "Limited Green Spaces",
445
+ "Waterfront Access"
446
+ ];
447
+
448
+ return {
449
+ energyEfficiency: energyRatings[Math.floor(Math.random() * energyRatings.length)],
450
+ waterUse: waterSystems[Math.floor(Math.random() * waterSystems.length)],
451
+ solarPanels: Math.random() > 0.5 ? "Yes" : "No",
452
+ materials: materials[Math.floor(Math.random() * materials.length)],
453
+ greenSpaces: greenSpaces[Math.floor(Math.random() * greenSpaces.length)]
454
+ };
455
+ }
456
+
457
+ // Generate 100 properties across Dubai
458
+ let propertyId = 1;
459
+ dubaiAreas.forEach(area => {
460
+ for (let i = 0; i < area.density; i++) {
461
+ // Generate random coordinates within the area
462
+ const lat = area.lat + (Math.random() - 0.5) * 0.1;
463
+ const lng = area.lng + (Math.random() - 0.5) * 0.1;
464
+
465
+ // Generate sustainability score (weighted towards medium/high for realism)
466
+ let sustainabilityScore;
467
+ const rand = Math.random();
468
+ if (rand < 0.2) {
469
+ sustainabilityScore = Math.floor(Math.random() * 3) + 8; // 20% high (8-10)
470
+ } else if (rand < 0.6) {
471
+ sustainabilityScore = Math.floor(Math.random() * 3) + 5; // 40% medium (5-7)
472
+ } else {
473
+ sustainabilityScore = Math.floor(Math.random() * 5); // 40% low (0-4)
474
+ }
475
+
476
+ const sustainabilityData = generateSustainabilityData();
477
+
478
+ properties.push({
479
+ id: propertyId++,
480
+ name: `${area.name} Property ${i+1}`,
481
+ lat: lat,
482
+ lng: lng,
483
+ sustainabilityScore: sustainabilityScore,
484
+ energyEfficiency: sustainabilityData.energyEfficiency,
485
+ waterUse: sustainabilityData.waterUse,
486
+ solarPanels: sustainabilityData.solarPanels,
487
+ materials: sustainabilityData.materials,
488
+ greenSpaces: sustainabilityData.greenSpaces
489
+ });
490
+ }
491
+ });
492
+
493
+ // Property markers
494
+ let propertyMarkers = [];
495
+
496
+ // Function to get color based on sustainability score
497
+ function getSustainabilityColor(score) {
498
+ if (score >= 8) return '#0c6b4c'; // Dark Green
499
+ if (score >= 5) return '#ffc107'; // Yellow
500
+ return '#dc3545'; // Red
501
+ }
502
+
503
+ // Function to add property markers to the map
504
+ function addPropertyMarkers() {
505
+ // Clear existing markers
506
+ propertyMarkers.forEach(marker => map.removeLayer(marker));
507
+ propertyMarkers = [];
508
+
509
+ // Add new markers
510
+ properties.forEach(property => {
511
+ const color = getSustainabilityColor(property.sustainabilityScore);
512
+
513
+ // Create marker
514
+ const marker = L.circleMarker([property.lat, property.lng], {
515
+ color: color,
516
+ fillColor: color,
517
+ fillOpacity: 0.7,
518
+ radius: 10
519
+ }).addTo(map);
520
+
521
+ // Create popup content
522
+ let popupContent = `<div class="property-popup">`;
523
+ popupContent += `<div class="popup-title">${property.name}</div>`;
524
+
525
+ // Add sustainability score badge
526
+ let scoreClass = '';
527
+ if (property.sustainabilityScore >= 8) scoreClass = 'high-score';
528
+ else if (property.sustainabilityScore >= 5) scoreClass = 'medium-score';
529
+ else scoreClass = 'low-score';
530
+
531
+ popupContent += `<div class="sustainability-score ${scoreClass}">Sustainability Score: ${property.sustainabilityScore}/10</div>`;
532
+
533
+ // Add green certified badge for high scores
534
+ if (property.sustainabilityScore >= 8) {
535
+ popupContent += `<div class="green-badge">🌱 Green Certified</div>`;
536
+ }
537
+
538
+ // Add sustainability metrics
539
+ popupContent += `<div class="metrics">`;
540
+ popupContent += `<div class="metric"><span class="metric-name">Energy Efficiency:</span><span class="metric-value">${property.energyEfficiency}</span></div>`;
541
+ popupContent += `<div class="metric"><span class="metric-name">Water Use:</span><span class="metric-value">${property.waterUse}</span></div>`;
542
+ popupContent += `<div class="metric"><span class="metric-name">Solar Panels:</span><span class="metric-value">${property.solarPanels}</span></div>`;
543
+ popupContent += `<div class="metric"><span class="metric-name">Materials:</span><span class="metric-value">${property.materials}</span></div>`;
544
+ popupContent += `<div class="metric"><span class="metric-name">Green Spaces:</span><span class="metric-value">${property.greenSpaces}</span></div>`;
545
+ popupContent += `</div></div>`;
546
+
547
+ // Bind popup to marker
548
+ marker.bindPopup(popupContent);
549
+
550
+ // Add to markers array
551
+ propertyMarkers.push(marker);
552
+ });
553
+ }
554
+
555
+ // Initially add property markers
556
+ addPropertyMarkers();
557
+
558
+ // Toggle sustainability layer
559
+ const sustainabilityToggle = document.getElementById('sustainability-toggle');
560
+ const legend = document.getElementById('legend');
561
+ const toggleLabel = document.getElementById('toggle-label');
562
+
563
+ sustainabilityToggle.addEventListener('change', function() {
564
+ if (this.checked) {
565
+ // Layer is ON - show markers
566
+ propertyMarkers.forEach(marker => map.addLayer(marker));
567
+ legend.style.display = 'block';
568
+ toggleLabel.textContent = 'ON';
569
+ toggleLabel.style.color = '#0c6b4c';
570
+ } else {
571
+ // Layer is OFF - hide markers
572
+ propertyMarkers.forEach(marker => map.removeLayer(marker));
573
+ legend.style.display = 'none';
574
+ toggleLabel.textContent = 'OFF';
575
+ toggleLabel.style.color = '#666';
576
+ }
577
+ });
578
+
579
+ // Language toggle functionality
580
+ const englishBtn = document.getElementById('english-btn');
581
+ const arabicBtn = document.getElementById('arabic-btn');
582
+ const infoText = document.getElementById('info-text');
583
+
584
+ // English content
585
+ const englishContent = {
586
+ layerTitle: "♻️ Sustainability Layer",
587
+ legendTitle: "Sustainability Score",
588
+ toggleLabel: "ON",
589
+ infoText: "The Sustainability Layer highlights properties across Dubai based on their environmental sustainability scores. Properties are color-coded according to their scores: dark green for highly sustainable, yellow for medium sustainability, and red for low sustainability. Properties with high scores also display a '🌱 Green Certified' badge. Click on any property to view detailed sustainability metrics."
590
+ };
591
+
592
+ // Arabic content
593
+ const arabicContent = {
594
+ layerTitle: "♻️ طبقة الاستدامة",
595
+ legendTitle: "درجة الاستدامة",
596
+ toggleLabel: "تشغيل",
597
+ infoText: "تسلط طبقة الاستدامة الضوء على العقارات في جميع أنحاء دبي بناءً على درجات الاستدامة البيئية. يتم ترميز العقارات بالألوان وفقًا لدرجاتها: الأخضر الداكن للاستدامة العالية، والأصفر للاستدامة المتوسطة، والأحمر للاستدامة المنخفضة. تعرض العقارات ذات الدرجات العالية أيضًا شارة '🌱 معتمدة باللون الأخضر'. انقر على أي عقار لعرض مقاييس الاستدامة التفصيلية."
598
+ };
599
+
600
+ englishBtn.addEventListener('click', function() {
601
+ englishBtn.classList.add('active');
602
+ arabicBtn.classList.remove('active');
603
+
604
+ // Update text content
605
+ document.querySelector('.layer-title').textContent = englishContent.layerTitle;
606
+ document.querySelector('.legend-title').textContent = englishContent.legendTitle;
607
+ toggleLabel.textContent = sustainabilityToggle.checked ? englishContent.toggleLabel : 'OFF';
608
+ infoText.textContent = englishContent.infoText;
609
+ });
610
+
611
+ arabicBtn.addEventListener('click', function() {
612
+ arabicBtn.classList.add('active');
613
+ englishBtn.classList.remove('active');
614
+
615
+ // Update text content
616
+ document.querySelector('.layer-title').textContent = arabicContent.layerTitle;
617
+ document.querySelector('.legend-title').textContent = arabicContent.legendTitle;
618
+ toggleLabel.textContent = sustainabilityToggle.checked ? arabicContent.toggleLabel : 'إيقاف';
619
+ infoText.textContent = arabicContent.infoText;
620
+ });
621
+
622
+ // Initialize with English
623
+ englishBtn.click();
624
+ </script>
625
+ </body>
626
+ </html>