Merge pull request #57 from gdg-x/develop

Added a configuration for Jekyll to enable/disable auto directions on Logistics page
This commit is contained in:
Oleh Zasadnyy 2015-02-20 23:48:08 +02:00
commit 261527905b
4 changed files with 19 additions and 10 deletions

View file

@ -215,6 +215,7 @@ findWayTransit: "TRANSIT"
findWayFindFlight: "Find Flight"
logisticsMapCenterCoordinates: "49.056728, 3.117289"
logisticsMapMobileCenterCoordinates: "48.335365, 23.711648"
logisticsMapAutoDirections: true
# Logistics Direction Details Block
directionDetailsImage: "direction-details.jpg"

View file

@ -53,6 +53,9 @@ layout: compress
</script>
{% elsif page.permalink == '/logistics/' %}
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places,geometry"></script>
<script type="text/javascript">
var autoDirectionEnabled = {% if site.logisticsMapAutoDirections %} true {% else %} false {% endif %};
</script>
{% endif %}
<script>
Waves.displayEffect();

View file

@ -484,6 +484,15 @@
$('#find-way h3').removeClass('fadeInUp').addClass('fadeOutDown');
}
function calcRouteFromMyLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
origin = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
calcRoute(origin, 'TRANSIT');
});
}
}
function makeMarker(position) {
var directionMarker = new google.maps.Marker({
position: position,
@ -542,15 +551,7 @@
calcRoute(origin, selectedMode);
});
$("#direction-locate").click(function() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
origin = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
calcRoute(origin, 'TRANSIT');
});
}
});
$("#direction-locate").click(calcRouteFromMyLocation);
$("#direction-cancel").click(function() {
$('#find-way').removeClass('location-active');
@ -570,6 +571,10 @@
smoothZoom(5);
$('#find-way h3').removeClass('fadeOutDown').addClass('fadeInUp');
});
if (autoDirectionEnabled) {
calcRouteFromMyLocation();
}
}
google.maps.event.addDomListener(window, 'load', initialize);

2
js/scripts.min.js vendored

File diff suppressed because one or more lines are too long