-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
executable file
·52 lines (42 loc) · 1.23 KB
/
main.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
42
43
44
45
46
47
48
49
50
51
52
/* Chat Section -- Start */
// Initialize the chat component
function onInit() {
loadChat();
}
// Call the initialization function
onInit();
// Ajax Call for the Chat
function loadChat() {
$.ajax({
type: "GET",
url: "chat/chat.html",
dataType: 'html',
cache: false,
success: function (html) {
$('#chat_content').html(html);
}
});
}
/* Chat Section -- End */
/* Map Section -- Start */
// Initialize the map and assign it to a variable for later use
var map = L.map('map', {
// Set latitude and longitude of the map center (required)
center: [46.7712, 23.6236],
// Set the initial zoom level, values 0-18, where 0 is most zoomed-out (required)
zoom: 5,
});
// Create a Tile Layer and add it to the map
var tiles = new L.tileLayer('http://{s}.tile.stamen.com/watercolor/{z}/{x}/{y}.png').addTo(map);
// This one adds a pin on map click
var chatNr = 0;
function onMapClick(e) {
L.marker(e.latlng).addTo(map).bindPopup("Chatroom: " + chatNr).openPopup();
chatNr++;
document.getElementById("infoBox").style.display = "none";
}
map.on('popupopen', function (e) {
getValues(e.popup._content);
});
map.on('click', onMapClick);
/* Map Section -- End */