-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
154 lines (154 loc) · 5.21 KB
/
index.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<html>
<head>
<title>Distance calculator</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"
/>
<link
rel="stylesheet"
href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
crossorigin=""
/>
<link rel="stylesheet" href="style/style.css" />
</head>
<body>
<div class="container ">
<div class="row">
<div class="col m6 s12 coordinates">
<div
class="card blue darken-4 grey-text text-lighten-4"
id="starting_point"
>
<div class="card-content">
<div class="card-title">Starting point</div>
<div class="row">
<div class="input-field col s10 l4">
<input
type="number"
placeholder="Latitude"
class="latitude"
/>
</div>
<div class="input-field col s2 l2">
<select class="latitude_direction">
<option value="N" selected>° N</option>
<option value="S">° S</option>
</select>
</div>
<div class="input-field col s10 l4">
<input
type="number"
placeholder="Longtitude"
class="Longtitude"
/>
</div>
<div class="input-field col s2 l2">
<select class="longtitude_direction">
<option value="E" selected>° E</option>
<option value="W">° W</option>
</select>
</div>
</div>
</div>
</div>
</div>
<div class="col m6 s12 coordinates">
<div
class="card blue darken-4 grey-text text-lighten-4"
id="destination"
>
<div class="card-content">
<div class="card-title">Destination</div>
<div class="row">
<div class="input-field col s10 l4">
<input
type="number"
placeholder="Latitude"
class="latitude"
/>
</div>
<div class="input-field col s2 l2">
<select class="latitude_direction">
<option value="N" selected>° N</option>
<option value="S">° S</option>
</select>
</div>
<div class="input-field col s10 l4">
<input
type="number"
placeholder="Longtitude"
class="Longtitude"
/>
</div>
<div class="input-field col s2 l2">
<select class="longtitude_direction">
<option value="E" selected>° E</option>
<option value="W">° W</option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div id="map"></div>
</div>
<div class="row">
<div class="card blue darken-4 grey-text text-lighten-4" id="calculate">
<div class="card-content center">
CALCULATE
</div>
</div>
</div>
<div class="row">
<div class="card"></div>
</div>
<div
class="card blue darken-4 grey-text text-lighten-4 scale-transition"
id="result"
>
<div class="card-content">
<div class="card-title">Result</div>
<div class="row distance">
<div class="col s8">Distance</div>
<div class="col s4 value">0 km</div>
</div>
</div>
</div>
</div>
</body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<script src="js/main.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
let elems = document.querySelectorAll("select");
let instances = M.FormSelect.init(elems);
});
</script>
<script src="js/form.js"></script>
<script
src="https://unpkg.com/[email protected]/dist/leaflet.js"
integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew=="
crossorigin=""
></script>
<script>
var map = L.map("map").setView([51.505, -0.09], 5);
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
attribution:
'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
navigator.geolocation.getCurrentPosition(position => {
map.panTo(
new L.LatLng(position.coords.latitude, position.coords.longitude)
);
});
</script>
</html>