flen-crypto commited on
Commit
aeb6ce8
·
verified ·
1 Parent(s): 2cea61d

Upload index.html with huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +53 -8
index.html CHANGED
@@ -1605,22 +1605,67 @@
1605
  </div>
1606
 
1607
  <script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1608
  // Splash screen transition
1609
  document.getElementById('startBtn').addEventListener('click', function() {
1610
  const splashScreen = document.getElementById('splashScreen');
1611
  const mainApp = document.getElementById('mainApp');
1612
 
1613
- splashScreen.style.opacity = '0';
1614
- splashScreen.style.visibility = 'hidden';
1615
-
1616
- setTimeout(() => {
1617
- mainApp.style.display = 'block';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1618
  setTimeout(() => {
1619
- mainApp.style.opacity = '1';
1620
- }, 50);
1621
- }, 800);
 
 
 
1622
  });
1623
 
 
 
 
 
1624
  // Navigation between modules
1625
  const navItems = document.querySelectorAll('.nav-item');
1626
  const modules = document.querySelectorAll('.module-container');
 
1605
  </div>
1606
 
1607
  <script>
1608
+ // Leaflet integration for maps
1609
+ const map = L.map('map').setView([0, 0], 13);
1610
+
1611
+ // Define a function to initialize the map
1612
+ function initializeMap(lat, lng) {
1613
+ // Remove existing map container if exists
1614
+ const mapDiv = document.getElementById('map');
1615
+ if (mapDiv) {
1616
+ mapDiv.style.display = 'block';
1617
+ mapDiv.innerHTML = '';
1618
+ }
1619
+
1620
+ const map = L.map('map').setView([lat, lng], 13);
1621
+ L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
1622
+ attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
1623
+ }).addTo(map);
1624
+
1625
+ L.marker([lat, lng]).addTo(map)
1626
+ .bindPopup('Your location')
1627
+ .openPopup();
1628
+ }
1629
+
1630
  // Splash screen transition
1631
  document.getElementById('startBtn').addEventListener('click', function() {
1632
  const splashScreen = document.getElementById('splashScreen');
1633
  const mainApp = document.getElementById('mainApp');
1634
 
1635
+ // First get location to initialize map
1636
+ if (navigator.geolocation) {
1637
+ navigator.geolocation.getCurrentPosition(position => {
1638
+ const { latitude, longitude } = position.coords;
1639
+
1640
+ splashScreen.style.opacity = '0';
1641
+ splashScreen.style.visibility = 'hidden';
1642
+
1643
+ setTimeout(() => {
1644
+ mainApp.style.display = 'block';
1645
+ setTimeout(() => {
1646
+ mainApp.style.opacity = '1';
1647
+ initializeMap(latitude, longitude);
1648
+ }, 50);
1649
+ }, 800);
1650
+ }, showError);
1651
+ } else {
1652
+ // Handle case where geolocation is not available
1653
+ splashScreen.style.opacity = '0';
1654
+ splashScreen.style.visibility = 'hidden';
1655
+
1656
  setTimeout(() => {
1657
+ mainApp.style.display = 'block';
1658
+ setTimeout(() => {
1659
+ mainApp.style.opacity = '1';
1660
+ }, 50);
1661
+ }, 800);
1662
+ }
1663
  });
1664
 
1665
+ function showError(error) {
1666
+ alert('Geolocation error: ' + error.message);
1667
+ }
1668
+
1669
  // Navigation between modules
1670
  const navItems = document.querySelectorAll('.nav-item');
1671
  const modules = document.querySelectorAll('.module-container');