mirror of
https://github.com/medialab-prado/datamad2017.git
synced 2024-12-27 05:01:23 +01:00
Added a configuration for Jekyll to enable/disable auto directions in Logistics page.
This commit is contained in:
parent
5ab408316f
commit
41746dfe14
4 changed files with 19 additions and 10 deletions
|
@ -215,6 +215,7 @@ findWayTransit: "TRANSIT"
|
||||||
findWayFindFlight: "Find Flight"
|
findWayFindFlight: "Find Flight"
|
||||||
logisticsMapCenterCoordinates: "49.056728, 3.117289"
|
logisticsMapCenterCoordinates: "49.056728, 3.117289"
|
||||||
logisticsMapMobileCenterCoordinates: "48.335365, 23.711648"
|
logisticsMapMobileCenterCoordinates: "48.335365, 23.711648"
|
||||||
|
logisticsMapAutoDirections: true
|
||||||
|
|
||||||
# Logistics Direction Details Block
|
# Logistics Direction Details Block
|
||||||
directionDetailsImage: "direction-details.jpg"
|
directionDetailsImage: "direction-details.jpg"
|
||||||
|
|
|
@ -53,6 +53,9 @@ layout: compress
|
||||||
</script>
|
</script>
|
||||||
{% elsif page.permalink == '/logistics/' %}
|
{% elsif page.permalink == '/logistics/' %}
|
||||||
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places,geometry"></script>
|
<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 %}
|
{% endif %}
|
||||||
<script>
|
<script>
|
||||||
Waves.displayEffect();
|
Waves.displayEffect();
|
||||||
|
|
|
@ -484,6 +484,15 @@
|
||||||
$('#find-way h3').removeClass('fadeInUp').addClass('fadeOutDown');
|
$('#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) {
|
function makeMarker(position) {
|
||||||
var directionMarker = new google.maps.Marker({
|
var directionMarker = new google.maps.Marker({
|
||||||
position: position,
|
position: position,
|
||||||
|
@ -542,15 +551,7 @@
|
||||||
calcRoute(origin, selectedMode);
|
calcRoute(origin, selectedMode);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#direction-locate").click(calcRouteFromMyLocation);
|
||||||
$("#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-cancel").click(function() {
|
$("#direction-cancel").click(function() {
|
||||||
$('#find-way').removeClass('location-active');
|
$('#find-way').removeClass('location-active');
|
||||||
|
@ -570,6 +571,10 @@
|
||||||
smoothZoom(5);
|
smoothZoom(5);
|
||||||
$('#find-way h3').removeClass('fadeOutDown').addClass('fadeInUp');
|
$('#find-way h3').removeClass('fadeOutDown').addClass('fadeInUp');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (autoDirectionEnabled) {
|
||||||
|
calcRouteFromMyLocation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
google.maps.event.addDomListener(window, 'load', initialize);
|
google.maps.event.addDomListener(window, 'load', initialize);
|
||||||
|
|
2
js/scripts.min.js
vendored
2
js/scripts.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue