-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbike.js
44 lines (34 loc) · 973 Bytes
/
bike.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
var latestData;
var bikeStations;
var update = function() {
$.getJSON('http://whateverorigin.org/get?url=' +
encodeURIComponent('http://feeds.bayareabikeshare.com/stations/stations.json') + '&callback=?', function(data) {
latestData = data.contents;
});
setTimeout(function() {
bikeStations = latestData.stationBeanList;
plot();
// $('.update').text('Last updated: ' + latestData.responseJSON.executionTime);
}, 400);
};
var retrieveSF = function() {
map.setView(new L.LatLng(37.783697, -122.408966), 14);
plot();
};
var retrievePA = function() {
map.setView(new L.LatLng(37.410319, -122.143936), 13);
plot();
};
var retrieveSJ = function() {
map.setView(new L.LatLng(37.340319, -121.89936), 14);
plot();
};
$(document).ready(function () {
update();
$('.locsf').on('click', retrieveSF);
$('.locpa').on('click', retrievePA);
$('.locsj').on('click', retrieveSJ);
});
$('.refresh').on('click', function () {
update();
});