maringetxway commited on
Commit
c816bfa
·
verified ·
1 Parent(s): 4c153d2

Update script.js

Browse files
Files changed (1) hide show
  1. script.js +24 -14
script.js CHANGED
@@ -14,7 +14,7 @@ const robotIcon = L.icon({
14
 
15
  // Custom HQ marker icon
16
  const hqIcon = L.icon({
17
- iconUrl: 'https://cdn.shopify.com/s/files/1/0767/2040/6877/files/HF_Logo.png?v=1745427981',
18
  iconSize: [35, 35],
19
  iconAnchor: [20, 40],
20
  popupAnchor: [0, -35]
@@ -24,24 +24,32 @@ const hqIcon = L.icon({
24
  function addMarkers(data, icon) {
25
  console.log('Processing data:', data); // Log the data being processed
26
  data.forEach(entry => {
27
- const lat = parseFloat(entry.latitude || entry.Latitude);
28
- const lng = parseFloat(entry.longitude || entry.Longitude);
29
- const name = entry.name || entry.Name || 'Unknown';
30
  const desc = entry.description || entry.Description || '';
31
- const address = entry.address || entry.Address || '';
32
- const nbPeople = entry.nb_of_people || entry.Nb_of_people || '';
33
- const discordUsername = entry.discord_username || entry.Discord_username || '';
34
 
35
  if (!isNaN(lat) && !isNaN(lng)) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  L.marker([lat, lng], { icon: icon })
37
  .addTo(map)
38
- .bindPopup(`
39
- <strong>${name}</strong><br>
40
- ${desc}<br>
41
- <strong>Address:</strong> ${address}<br>
42
- <strong>Nb of People:</strong> ${nbPeople}<br>
43
- <strong>Discord Username:</strong> ${discordUsername}
44
- `);
45
  } else {
46
  console.warn('Invalid coordinates:', entry); // Log entries with invalid coordinates
47
  }
@@ -81,3 +89,5 @@ fetch('data_HQ_HF.json')
81
  });
82
 
83
 
 
 
 
14
 
15
  // Custom HQ marker icon
16
  const hqIcon = L.icon({
17
+ iconUrl: 'https://cdn.shopify.com/s/files/1/0767/2040/6877/files/HF_Logo.png?v=1745427981',
18
  iconSize: [35, 35],
19
  iconAnchor: [20, 40],
20
  popupAnchor: [0, -35]
 
24
  function addMarkers(data, icon) {
25
  console.log('Processing data:', data); // Log the data being processed
26
  data.forEach(entry => {
27
+ const lat = parseFloat(entry.latitude || entry.latitude);
28
+ const lng = parseFloat(entry.longitude || entry.longitude);
29
+ const name = entry.name || entry.name || 'Unknown';
30
  const desc = entry.description || entry.Description || '';
31
+ const address = entry.address || entry.address || 'N/A';
32
+ const nbPeople = entry.nb_of_people || entry.nb_of_people || '';
33
+ const discordUsername = entry.discord_username || entry.discord_username || '';
34
 
35
  if (!isNaN(lat) && !isNaN(lng)) {
36
+ let popupContent = `
37
+ <strong>${name}</strong><br>
38
+ ${desc}<br>
39
+ <strong>Address:</strong> ${address}<br>
40
+ `;
41
+
42
+ if (nbPeople && nbPeople !== 'N/A') {
43
+ popupContent += `<strong>Nb of People:</strong> ${nbPeople}<br>`;
44
+ }
45
+
46
+ if (discordUsername && discordUsername !== 'N/A') {
47
+ popupContent += `<strong>Discord Username:</strong> ${discordUsername}<br>`;
48
+ }
49
+
50
  L.marker([lat, lng], { icon: icon })
51
  .addTo(map)
52
+ .bindPopup(popupContent);
 
 
 
 
 
 
53
  } else {
54
  console.warn('Invalid coordinates:', entry); // Log entries with invalid coordinates
55
  }
 
89
  });
90
 
91
 
92
+
93
+