site-libsoc/Server/public/js/communities.js

48 lines
1.7 KiB
JavaScript
Raw Permalink Normal View History

2023-06-24 20:44:16 +07:00
export let communities = [
2023-07-10 18:09:25 +07:00
{
location: ["CanadaMontreal",[44.654781585774785, -63.61076905562609]],
status: "forming",
members: 2,
contact: ["https://discord.gg/xAPZmyr8B6","DiscordInviteLink"]
},
2023-06-24 20:44:16 +07:00
{
2023-07-09 19:25:09 +07:00
location: ["EstoniaKohtlaJarve",[59.409521829709504, 27.288415912535914]],
status: "forming",
2023-06-24 20:44:16 +07:00
members: 2,
2023-07-09 19:25:09 +07:00
contact: ["https://chat.whatsapp.com/BhnmUNljUxJ2AjeHUwyTKh","WhatsAppInviteLink"]
2023-06-24 20:44:16 +07:00
}
]
2023-07-09 19:25:09 +07:00
export function addMarkersCommunities(map,content) {
2023-06-24 20:44:16 +07:00
for (let g of communities) {
let coordinates
let text = ""
for (let field in g) {
2023-07-03 03:07:45 +07:00
let fieldText = content[field] + ": "
2023-06-24 20:44:16 +07:00
if (field=="contact") {
2023-07-09 19:25:09 +07:00
text += fieldText + "<a href='" + g.contact[0] + "' target='_blank' rel=noreferrer>" + content[g.contact[1]]+ "</a>"
2023-06-24 20:44:16 +07:00
}
else if (field=="location") {
2023-07-09 19:25:09 +07:00
text += fieldText + content[g[field][0]]+ "<br>"
2023-06-24 20:44:16 +07:00
coordinates = g[field][1]
}
2023-07-03 03:07:45 +07:00
else if (field=="status") {
2023-07-09 19:25:09 +07:00
text += fieldText + content[g[field]] + "<br>"
2023-07-03 03:07:45 +07:00
}
2023-06-24 20:44:16 +07:00
else {
text += fieldText + g[field] + "<br>"
}
}
var greenIcon = new L.Icon({
iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-red.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: greenIcon})
marker.addTo(map).bindPopup(text)
}
}