Update
This commit is contained in:
@@ -73,6 +73,16 @@ export let groups = [
|
||||
location: [["USA","Ohio"], [40.18243610076637, -83.07800532738788]],
|
||||
members: 1,
|
||||
contact: ["https://discord.gg/Qk8KUk787z","DiscordInviteLink"]
|
||||
},
|
||||
{
|
||||
location: [["Thailand","Chiang Mai"], [18.788343253574393, 98.99423221087719]],
|
||||
members: 1,
|
||||
contact: ["https://discord.gg/Qk8KUk787z","DiscordInviteLink"]
|
||||
},
|
||||
{
|
||||
location: [["Switzerland","Cham"], [47.18298143153399, 8.460076421717238]],
|
||||
members: 1,
|
||||
contact: ["https://discord.gg/Qk8KUk787z","DiscordInviteLink"]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -93,6 +103,18 @@ let groupsMarkersLayerIn = L.layerGroup()
|
||||
|
||||
let contactGeneral =["https://discord.gg/4BUau4AZre","DiscordInviteLink"]
|
||||
|
||||
export function translate(content, x) {
|
||||
let out = content[x]
|
||||
if (out==undefined) {
|
||||
return x
|
||||
}
|
||||
else {
|
||||
return out
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function addMarkersToLayer(g,layer,content,locale) {
|
||||
let coordinates
|
||||
let text = "<b>"+content["Group"]+"</b><br>"
|
||||
@@ -108,7 +130,7 @@ function addMarkersToLayer(g,layer,content,locale) {
|
||||
locationString = location.map(x => x).join(", ")
|
||||
}
|
||||
else {
|
||||
locationString = location.map(x => content[x]).join(", ")
|
||||
locationString = location.map(x => translate(content, x)).join(", ")
|
||||
}
|
||||
text += fieldText + locationString + "<br>"
|
||||
coordinates = g[field][1]
|
||||
|
@@ -35,6 +35,7 @@ export function sendData(route,data,callback) {
|
||||
callback(xhr.responseText)
|
||||
}
|
||||
} else {
|
||||
callback(false)
|
||||
console.log("Request gave an error")
|
||||
// Oh no! There has been an error with the request!
|
||||
}
|
||||
@@ -57,6 +58,7 @@ export function sendText(route,data,callback) {
|
||||
}
|
||||
} else {
|
||||
callback(false)
|
||||
console.log("Request gave an error")
|
||||
// Oh no! There has been an error with the request!
|
||||
}
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@
|
||||
"Germany": "Германия",
|
||||
"USA": "CША",
|
||||
"Bulgaria": "Болгария",
|
||||
"Thailand": "Тайланд",
|
||||
"Colorado": "Колорадо",
|
||||
"Georgia": "Джорджия",
|
||||
"Ohio": "Огайо",
|
||||
|
@@ -5,7 +5,7 @@
|
||||
import { onMount } from 'svelte'
|
||||
import { writable } from 'svelte/store';
|
||||
import { groupsByCountry, addMarkersGroups } from '/js/groups.js'
|
||||
import { loadLocaleContent, getData, sendText } from "/js/libraries/serverTools.js"
|
||||
import { loadLocaleContent, getData, sendData } from "/js/libraries/serverTools.js"
|
||||
|
||||
// Import components
|
||||
import "/js/components/map-component.js"
|
||||
@@ -105,9 +105,27 @@
|
||||
|
||||
function submitLocation() {
|
||||
if (addressVec!=undefined) {
|
||||
let data = [...addressVec,userPinLat,userPinLng,contactInput.value]
|
||||
let data = {
|
||||
country: addressVec[0],
|
||||
state: addressVec[1],
|
||||
town: addressVec[2],
|
||||
latitude: userPinLat,
|
||||
longitude: userPinLng,
|
||||
contact: contactInput.value,
|
||||
members: 1
|
||||
}
|
||||
|
||||
if (data.state=="") {
|
||||
data.state = null
|
||||
}
|
||||
if (data.town=="") {
|
||||
data.town = null
|
||||
}
|
||||
if (data.contact=="") {
|
||||
data.contact = null
|
||||
}
|
||||
let url = "/" + locale + "/groups-add-post/"
|
||||
sendText(url,JSON.stringify(data),updateConfirmationMsg)
|
||||
sendData(url,data,updateConfirmationMsg)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
// Import statements
|
||||
import { onMount } from 'svelte'
|
||||
import { writable } from 'svelte/store';
|
||||
import { groupsByCountry, addMarkersGroups } from '/js/groups.js'
|
||||
import { groupsByCountry, addMarkersGroups, translate } from '/js/groups.js'
|
||||
import { loadLocaleContent, getData, sendData } from "/js/libraries/serverTools.js"
|
||||
|
||||
// Import components
|
||||
@@ -22,14 +22,14 @@
|
||||
addMarkersGroups(map,content,locale)
|
||||
}
|
||||
|
||||
function getCountry(name) {
|
||||
return locale=="en" ? name : $content[name]
|
||||
function getCountry(x) {
|
||||
return locale=="en" ? x : translate($content,x)
|
||||
}
|
||||
|
||||
function getAddress(group) {
|
||||
return group.location[0].map(x => locale=="en" ? x : $content[x]).join(", ")
|
||||
return group.location[0].map(x => locale=="en" ? x : translate($content,x)).join(", ")
|
||||
}
|
||||
|
||||
|
||||
onMount(() => {
|
||||
|
||||
})
|
||||
|
Reference in New Issue
Block a user