Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

73 lines (64 sloc) 1.973 kb
<!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&region=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>
Jump to Line
Something went wrong with that request. Please try again.