mirror of
https://github.com/nikdoof/vapemap.git
synced 2025-12-20 13:19:21 +00:00
Initial Import.
This commit is contained in:
17
app/stores/static/js/geolocation.js
Normal file
17
app/stores/static/js/geolocation.js
Normal 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();})
|
||||
45
app/stores/static/js/gmap.js
Normal file
45
app/stores/static/js/gmap.js
Normal 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)
|
||||
}
|
||||
1
app/stores/static/js/infobox.js
Normal file
1
app/stores/static/js/infobox.js
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user