You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
3.2 KiB
111 lines
3.2 KiB
11 years ago
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
|
||
|
<title>Map of Twister Users</title>
|
||
|
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
|
||
|
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.10.1.min.js"></script>
|
||
|
<style>
|
||
|
|
||
|
body {
|
||
|
font-family: Helvetica, Verdana, Arial, sans-serif;
|
||
|
}
|
||
|
|
||
|
h1, h4 {
|
||
|
padding-bottom: 0;
|
||
|
margin-bottom: 0;
|
||
|
}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<h1>Map of Twister Users</h1>
|
||
|
|
||
|
<p>
|
||
|
<small>(as self-reported in profile)</small>
|
||
|
</p>
|
||
|
<div id="map" style="width: 600px; height: 400px;"></div>
|
||
|
<ul>
|
||
|
<li>Updated at: $timestamp</li>
|
||
|
<li>Users with realistic location: $users_real_loc</li>
|
||
|
<li>Users with unrealistic location: $users_fake_loc</li>
|
||
|
<li>Users without location: $users_no_loc</li>
|
||
|
</ul>
|
||
|
<div id="bottom">For any feedback, ping @toyg on Twister.</div>
|
||
|
<script type="text/javascript">
|
||
|
// Define your locations: HTML content for the info window, latitude, longitude
|
||
|
var locations = [$locations];
|
||
|
|
||
|
// Setup the different icons and shadows
|
||
|
var iconURLPrefix = 'http://maps.google.com/mapfiles/ms/icons/';
|
||
|
var icons = [
|
||
|
iconURLPrefix + 'red-dot.png',
|
||
|
iconURLPrefix + 'green-dot.png',
|
||
|
iconURLPrefix + 'blue-dot.png',
|
||
|
iconURLPrefix + 'orange-dot.png',
|
||
|
iconURLPrefix + 'purple-dot.png',
|
||
|
iconURLPrefix + 'pink-dot.png',
|
||
|
iconURLPrefix + 'yellow-dot.png'
|
||
|
]
|
||
|
var icons_length = icons.length;
|
||
|
|
||
|
var shadow = {
|
||
|
anchor: new google.maps.Point(15, 33),
|
||
|
url: iconURLPrefix + 'msmarker.shadow.png'
|
||
|
};
|
||
|
|
||
|
var map = new google.maps.Map(document.getElementById('map'), {
|
||
|
zoom: 10,
|
||
|
center: new google.maps.LatLng(-37.92, 151.25),
|
||
|
mapTypeId: google.maps.MapTypeId.ROADMAP,
|
||
|
mapTypeControl: false,
|
||
|
streetViewControl: false,
|
||
|
panControl: false,
|
||
|
zoomControlOptions: {
|
||
|
position: google.maps.ControlPosition.LEFT_BOTTOM
|
||
|
}
|
||
|
});
|
||
|
|
||
|
var infowindow = new google.maps.InfoWindow({
|
||
|
maxWidth: 160
|
||
|
});
|
||
|
|
||
|
var marker;
|
||
|
var markers = new Array();
|
||
|
|
||
|
var iconCounter = 0;
|
||
|
|
||
|
// Add the markers and infowindows to the map
|
||
|
for (var i = 0; i < locations.length; i++) {
|
||
|
marker = new google.maps.Marker({
|
||
|
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
|
||
|
map: map,
|
||
|
icon: icons[iconCounter],
|
||
|
shadow: shadow
|
||
|
});
|
||
|
|
||
|
markers.push(marker);
|
||
|
|
||
|
google.maps.event.addListener(marker, 'click', (function (marker, i) {
|
||
|
return function () {
|
||
|
infowindow.setContent(locations[i][0]);
|
||
|
infowindow.open(map, marker);
|
||
|
}
|
||
|
})(marker, i));
|
||
|
|
||
|
iconCounter++;
|
||
|
if (iconCounter >= icons_length) {
|
||
|
iconCounter = 0;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function AutoCenter() {
|
||
|
var bounds = new google.maps.LatLngBounds();
|
||
|
$$.each(markers, function (index, marker) {
|
||
|
bounds.extend(marker.position);
|
||
|
});
|
||
|
map.fitBounds(bounds);
|
||
|
}
|
||
|
AutoCenter();
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|