-
Notifications
You must be signed in to change notification settings - Fork 41
/
Map.js
65 lines (49 loc) · 1.66 KB
/
Map.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
53
54
55
56
57
58
59
60
61
62
63
64
65
var globalMap;
$(function() {
var MapFcns = {
loadSiteList: function () {
var airportList = $('#airport-list');
airportList.html('');
airportList.append('<option value=""></option>');
for (var i in sites) {
var newOption = $('<option value="' + sites[i].Code + '">' + sites[i].Code + '</option>');
airportList.append(newOption);
}
},
siteListChange: function() {
var ctl = $(this),
airportCode = ctl.val();
if(airportCode) {
var currAirport = _.findWhere(sites, {Code: airportCode});
$('#setting-code').text(currAirport.Code);
$('#setting-city').text(currAirport.City);
var marker = new google.maps.Marker({
position: {lat: currAirport.Latitude, lng: currAirport.Longitude},
map: globalMap,
title: currAirport.Code
});
}
}
}
MapFcns.loadSiteList();
$('#airport-list').change(MapFcns.siteListChange);
$('#exercise-toggle').click(function() {
var toggleCtl = $(this),
toggleVal = toggleCtl.text();
if (toggleVal == '-') {
toggleCtl.text('+');
$('#exercise-instructions').hide();
} else {
toggleCtl.text('-');
$('#exercise-instructions').show();
}
});
});
function initMap() {
// Callback function to create a map object and specify the DOM element for display.
globalMap = new google.maps.Map(document.getElementById('airport-map'), {
center: {lat: 42.2814, lng: -83.7483},
scrollwheel: true,
zoom: 6
});
}