Initial Import.

This commit is contained in:
2013-03-31 23:15:07 +01:00
commit c19f2f5562
66 changed files with 1780 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
function supports_geolocation() {
return 'geolocation' in navigator;
}
function init_geolocation() {
if (supports_geolocation()) {
navigator.geolocation.getCurrentPosition(handle_geolocation_event)
}
}
function handle_geolocation_event(position) {
$('#geolocation a').attr('href', '/stores/search/?lat=' + position.coords.latitude + '&lng=' + position.coords.longitude + '&distance=10');
$('#geolocation').fadeIn(1000);
}
$(document).ready(function() {init_geolocation();})

View File

@@ -0,0 +1,45 @@
var store_icon = '/static/img/map_icons/home-2.png'
var online_icon = '/static/img/map_icons/wifi.png'
var geolocation_icon = '/static/img/map_icons/home-2-green.png'
function lookup_marker(id) {
if (id == null || id == 1) {
return store_icon
} else if (id == 2) {
return online_icon
} else if (id == 999) {
return geolocation_icon
} else {
return store_icon
}
}
function initialize_map(markers, element) {
var mapOptions = {
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(element, mapOptions);
var bounds = new google.maps.LatLngBounds();
for (var i = 0; i < markers.length; i++) {
marker = markers[i];
if (marker[1] != null && marker[2] != null) {
var latlng = new google.maps.LatLng(marker[1], marker[2]);
bounds.extend(latlng);
var marker_obj = new google.maps.Marker({
position: latlng,
map: map,
title: marker[0],
icon: lookup_marker(marker[3])
});
if (marker[4] != '') {
google.maps.event.addListener(marker_obj, 'click', (function(marker) {
return function() {
window.location = marker[4];
}
})(marker));
}
}
}
map.fitBounds(bounds)
}

File diff suppressed because one or more lines are too long