export let parties = [ { logo: "roots", name: "Roots", location: ["Ireland",[52.98479517270413, -7.649233227534782]], //members: 6, link: "https://discord.gg/pSTMacJZsK", description: "descriptionRoots" } ] export let partiesByCountry = {} for (let g of parties) { let country = g.location[0] if (country in partiesByCountry) { partiesByCountry[country].push(g) } else { partiesByCountry[country] = [g] } } export function addMarkersParties(map,content) { for (let g of parties) { let coordinates let text = "" for (let field in g) { let fieldText if (field!="logo") { fieldText = content[field] + ": " } if (field=="logo") { text += "logo" + "
" } else if (field=="link") { text += fieldText + "" + g.link + "" + "
" } else if (field=="website") { text += fieldText + "" + g.website + "" + "
" } else if (field=="location") { text += fieldText + content[g[field][0]] + "
" coordinates = g[field][1] } else if (field=="description") { text += fieldText + content[g[field]] + "
" } else { text += fieldText + g[field] + "
" } } var markerIcon = new L.Icon({ iconUrl: 'https://www.libsoc.org/img/common/markers/marker-gold.png', shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png', iconSize: [25, 41], iconAnchor: [12, 41], popupAnchor: [1, -34], shadowSize: [41, 41] }); let marker = L.marker(coordinates, {icon: markerIcon}) marker.addTo(map).bindPopup(text) } }