forked from Freeport-Metrics/bikeday
/
geolocation.html
executable file
·65 lines (54 loc) · 2.09 KB
/
geolocation.html
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
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="css/normalize.min.css">
<link rel="stylesheet" href="css/main.css">
<!--[if lt IE 9]>
<script src="js/vendor/html5-3.6-respond-1.1.0.min.js"></script>
<![endif]-->
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script src="js/geocoder.js"></script>
<script src="js/veturilo.js"></script>
</head>
<body>
From: <input id="from" name="from" value="Warszawa złota 1"/>
To: <input id="to" name="to" value="Młynarska 7, Warszawa"/>
<input id="search" type="button" value="Search"/>
<div id="resultFrom"></div>
<div id="resultTo"></div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.10.1.min.js"><\/script>')</script>
<script>
$('#search').click(function () {
var from;
var fromStation;
var to;
var toStation;
// translate from
geocode($('#from').val(), function (location) {
from = {location: location, lat: location.lat(), lng: location.lng()};
$("#resultFrom").text(location);
// translate to
console.log('from',from);
geocode($('#to').val(), function (location) {
to = {location: location, lat: location.lat(), lng: location.lng()};
$("#resultTo").text(location);
console.log('to',to);
// veturilo
findStations(function (stations) {
fromStation = findNearestStation(from, stations);
console.log('fromStation', fromStation);
toStation = findNearestStation(to, stations);
console.log('toStation',toStation);
});
});
});
});
</script>
</body>
</html>