-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
73 lines (64 loc) · 1.93 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
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<title></title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="robots" content="" />
</head>
<body>
<header id="header">
</header>
<section id="content">
<h1>This is some content</h1>
<input type="button" onclick="javascript:geomock.go()" value="Geomock Go">
<input type="button" onclick="javascript:plot_pos()" value="Plot position">
<div id="test_map" style="height: 300px;"></div>
</section>
<footer id="footer">
</footer>
<!-- Javascript -->
<script src="js/geomock.js"></script>
<!-- Other stuff -->
<script src="http://maps.googleapis.com/maps/api/js?sensor=true®ion=sg&callback=map_init"></script>
<script>
var test_map = null;
var test_map_marker = null;
var map_init = function() {
navigator.geolocation.getCurrentPosition(function(pos) {
var c = new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude);
if(!test_map) {
test_map = new google.maps.Map(document.getElementById("test_map"), {
center: c,
mapTypeId: google.maps.MapTypeId.ROADMAP,
zoom: 14
});
}
test_map_marker = new google.maps.Marker({
animation: google.maps.Animation.BOUNCE,
position: c,
icon: "http://www.google.com/intl/en_us/mapfiles/ms/micons/green-dot.png",
map: test_map
})
})
}
var plot_pos = function() {
navigator.geolocation.getCurrentPosition(function(pos) {
var c = new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude);
if(!test_map_marker) {
test_map_marker = new google.maps.Marker({
animation: google.maps.Animation.BOUNCE,
position: c,
icon: "http://www.google.com/intl/en_us/mapfiles/ms/micons/green-dot.png",
map: test_map
})
}
else {
test_map_marker.setPosition(c);
}
});
}
</script>
</body>
</html>