Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
47 lines (40 sloc) 1.16 KB
<!DOCTYPE html>
<html>
<head>
<title>maptime</title>
<style type="text/css">
html, body, #map{
width:100%;height:100%;margin:0;
}
</style>
<script type="text/javascript" src="/faye.js"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var client = new Faye.Client('/faye');
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(54, -4),
zoom: 6,
mapTypeId: google.maps.MapTypeId.TERRAIN
};
var map = new google.maps.Map(document.getElementById("map"),mapOptions);
client.subscribe('/tweet', function(message) {
if(message.geo && message.geo.coordinates){
placeMarker(message.geo.coordinates);
}
});
function placeMarker(coords){
var latlng = new google.maps.LatLng(coords[0],coords[1]);
new google.maps.Marker({
position: latlng,
map: map,
title:"Hello World!"
});
}
}
</script>
</head>
<body onload="initialize()">
<div id="map" style="height:100%;width:100%"></div>
</body>
</html>