-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
41 lines (34 loc) · 1.12 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
let current_user = {};
let getLocation = () => {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition((position) => {
current_user.lat = position.coords.latitude;
current_user.long = position.coords.longitude;
console.log("got location");
console.log(position.coords);
});
} else {
console.log("Geolocation is not supported by this browser.");
}
}
getLocation();
// $('#nameInput').val() = current_user.name || "";
let getValues = () => {
current_user.name = $('#nameInput').val();
current_user.time = (new Date()).toString();
current_user.added = false;
$('#add-to-map').show();
$('#save-user').show();
// storeUser(current_user.name, current_user.lat, current_user.long, current_user.time);
}
$('#add-to-map').hide();
$('#save-user').hide();
$('#add-to-map').click(() => {
storeUser(current_user.name, current_user.lat, current_user.long, current_user.time);
});
$('#save-user').click(() => {
userCanvas.save(`nid-diwali-${current_user.name || ""}.png`);
})
$('#save-map').click(() => {
indiaCanvas.save(`nid-diwali-map-${(new Date()).toString()}.png`);
})