var onlyzoom; onlyzoom = false; function OnlyZoomFalse(){ onlyzoom=false; } function preventDefault(e) { e = e || window.event; if (e.preventDefault) e.preventDefault(); e.returnValue = false; } function disableScroll() { if (window.addEventListener) // older FF window.addEventListener('DOMMouseScroll', preventDefault, false); window.ontouchmove = preventDefault; // mobile } function enableScroll() { window.ontouchmove = null; } var theCurrentPosition = 0; var currentlyInADrag = 0; (function ($) { var settings; var element; var map; var markers = new Array(); var styles = undefined; var methods = { init: function (options) { element = $(this); var defaults = $.extend({ enableGeolocation: false, disableClickEvent: false, openAllInfoboxes: false, pixelOffsetX : -100, pixelOffsetY : -255 }); $(document).off("touchmove","#map").on("touchmove","#map",function(e){ var start = e.originalEvent.touches[0].clientX; var end = e.originalEvent.touches[0].clientY; //e.preventDefault(); }) if (options.styles !== undefined) { styles = options.styles; } settings = $.extend({}, defaults, options); google.maps.visualRefresh = true; google.maps.event.addDomListener(window, 'load', loadMap); if (settings.filterForm && $(settings.filterForm).length !== 0) { $(settings.filterForm).submit(function (e) { var form = $(this); var action = $(this).attr('action'); $.ajax({ type : 'GET', url : action, data : form.serialize(), success: function (data) { element.aviators_map('removeMarkers'); element.aviators_map('addMarkers', { locations: eval(data.locations), types : eval(data.types), contents : eval(data.contents) }); } }); e.preventDefault(); }); } if (options.callback) { options.callback(); } return $(this); }, removeMarkers: function () { for (i = 0; i < markers.length; i++) { markers[i].infobox.close(); markers[i].marker.close(); markers[i].setMap(null); } }, addMarkers: function (options) { markers = new Array(); settings.locations = options.locations; settings.contents = options.contents; settings.types = options.types; renderElements(); } } $.fn.aviators_map = function (method) {if (methods[method]) {return methods[ method ].apply(this, Array.prototype.slice.call(arguments, 1));} else if (typeof method === 'object' || !method) {return methods.init.apply(this, arguments);} else {$.error('Method ' + method + ' does not exist on Map');}}; function loadMap() { var mapOptions = { zoom: 12, mapTypeId : google.maps.MapTypeId.ROADMAP, maxZoom:15, scrollwheel : false, navigationControl: false, mapTypeControl : false, scaleControl: false, draggable : true, panControl : false, panControlOptions: { position: google.maps.ControlPosition.RIGHT_BOTTOM }, zoomControl : true, zoomControlOptions: { style : google.maps.ZoomControlStyle.LARGE, position: google.maps.ControlPosition.RIGHT_BOTTOM }, flat:false, noClear:false, zoom: 12, scrollwheel:false, mapTypeId:google.maps.MapTypeId.ROADMAP, streetViewControl:false, mapTypeControlOptions:{mapTypeIds:[google.maps.MapTypeId.ROADMAP]} }; if (settings.enableGeolocation) { if (navigator.geolocation) { browserSupportFlag = true; navigator.geolocation.getCurrentPosition(function (position) { initialLocation = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); map.setCenter(initialLocation); }, function () { mapOptions.center = new google.maps.LatLng(settings.center.latitude, settings.center.longitude); }); } else { browserSupportFlag = false; mapOptions.center = new google.maps.LatLng(settings.center.latitude, settings.center.longitude); } } else { mapOptions.center = new google.maps.LatLng(settings.center.latitude, settings.center.longitude); } if (styles != undefined) { mapOptions['mapTypeControlOptions'] = { mapTypeIds: ['Styled'] }; mapOptions['mapTypeId'] = 'Styled'; } map = new google.maps.Map($(element)[0], mapOptions); var overlay = new google.maps.OverlayView(); if (settings.mapMoveCenter) { map.panBy(settings.mapMoveCenter.x, settings.mapMoveCenter.y) } if (styles !== undefined) { var styledMapType = new google.maps.StyledMapType(styles, { name: 'Styled' }); map.mapTypes.set('Styled', styledMapType); } window.map = map; var trainLigneCCoordinates = [ new google.maps.LatLng(43.593436,1.418542), new google.maps.LatLng(43.595602, 1.401475), new google.maps.LatLng(43.596608, 1.384133), new google.maps.LatLng(43.599816, 1.371752), new google.maps.LatLng(43.602553, 1.352942), new google.maps.LatLng(43.60356, 1.333949) ]; var trainLigneC = new google.maps.Polyline({ path: trainLigneCCoordinates, geodesic: true, strokeColor: '#FF6600', strokeOpacity: 1.0, strokeWeight: 2, zIndex: -1 }); var tramLigneT1Coordinates = [ new google.maps.LatLng(43.663444,1.362611), new google.maps.LatLng(43.660244, 1.369517), new google.maps.LatLng(43.654814, 1.373586), new google.maps.LatLng(43.648525, 1.375642), new google.maps.LatLng(43.644758, 1.377483), new google.maps.LatLng(43.640472, 1.382581), new google.maps.LatLng(43.636228, 1.385339), new google.maps.LatLng(43.636736, 1.390056), new google.maps.LatLng(43.634314, 1.391292), new google.maps.LatLng(43.630856, 1.391731), new google.maps.LatLng(43.625478, 1.393486), new google.maps.LatLng(43.618203, 1.396931), new google.maps.LatLng(43.607797, 1.396917), new google.maps.LatLng(43.603122, 1.407683), new google.maps.LatLng(43.600825,1.411367 ), new google.maps.LatLng(43.594853, 1.409419), new google.maps.LatLng(43.592822, 1.417933), new google.maps.LatLng(43.589644, 1.421642), new google.maps.LatLng(43.585583, 1.427886), new google.maps.LatLng(43.589294, 1.431778), new google.maps.LatLng(43.592647, 1.435228), new google.maps.LatLng(43.592117, 1.441186), new google.maps.LatLng(43.592217, 1.444594) ]; var tramLigneT1 = new google.maps.Polyline({ path: tramLigneT1Coordinates, geodesic: true, strokeColor: '#004070', strokeOpacity: 1.0, strokeWeight: 2, zIndex: -1 }); var metroLigneBCoordinates = [new google.maps.LatLng(43.640765, 1.45242),new google.maps.LatLng(43.638106,1.444175 ),new google.maps.LatLng(43.633633, 1.435608),new google.maps.LatLng(43.626864, 1.433814),new google.maps.LatLng(43.620442, 1.435908),new google.maps.LatLng(43.615419, 1.433981),new google.maps.LatLng(43.610686, 1.435794),new google.maps.LatLng(43.608736, 1.445386),new google.maps.LatLng(43.60595, 1.448989),new google.maps.LatLng(43.600592, 1.452014),new google.maps.LatLng(43.5977, 1.445453),new google.maps.LatLng(43.592217, 1.444594),new google.maps.LatLng(43.585458, 1.447447),new google.maps.LatLng(43.579875, 1.442078),new google.maps.LatLng(43.580339, 1.449842),new google.maps.LatLng(43.579722, 1.459064), new google.maps.LatLng(43.574914, 1.461639), new google.maps.LatLng(43.568036, 1.464547), new google.maps.LatLng(43.560842, 1.46325), new google.maps.LatLng(43.555778, 1.476361) ]; var metroLigneB = new google.maps.Polyline({path: metroLigneBCoordinates,geodesic: true,strokeColor: '#FFCC00',strokeOpacity: 1.0,strokeWeight: 2,zIndex: -1});var metroLigneACoordinates = [new google.maps.LatLng(43.570056, 1.392314),new google.maps.LatLng(43.566097, 1.398319), new google.maps.LatLng(43.570881, 1.402075), new google.maps.LatLng(43.574744, 1.401997), new google.maps.LatLng(43.579939, 1.412181), new google.maps.LatLng(43.5834, 1.415239),new google.maps.LatLng(43.587544, 1.418417),new google.maps.LatLng(43.593184, 1.418199),new google.maps.LatLng(43.596419, 1.423022),new google.maps.LatLng(43.597981, 1.431558),new google.maps.LatLng(43.600408, 1.444453),new google.maps.LatLng(43.604271, 1.444932),new google.maps.LatLng(43.60595, 1.448989),new google.maps.LatLng(43.610925, 1.45505),new google.maps.LatLng(43.615361, 1.463511),new google.maps.LatLng(43.620019, 1.469531),new google.maps.LatLng(43.624478, 1.476994), new google.maps.LatLng(43.629678, 1.482989) ]; var metroLigneA = new google.maps.Polyline({ path: metroLigneACoordinates, geodesic: true, strokeColor: '#FF0000', strokeOpacity: 1.0, strokeWeight: 2, zIndex: -1 }); metroLigneA.setMap(map); metroLigneB.setMap(map); tramLigneT1.setMap(map);trainLigneC.setMap(map); var dragFlag = false; var start = 0, end = 0; function thisTouchStart(e) { dragFlag = true; start = e.touches[0].pageY; } function thisTouchEnd() { dragFlag = false; } function thisTouchMove(e) { if (!dragFlag) { return } end = e.touches[0].pageY; // window.scrollBy(0, ( start - end )); } var el = jQuery(element.selector)[0]; if (el.addEventListener) { el.addEventListener('touchstart', thisTouchStart, true); el.addEventListener('touchend', thisTouchEnd, true); el.addEventListener('touchmove', thisTouchMove, true); } else if (el.attachEvent){ el.attachEvent('touchstart', thisTouchStart); el.attachEvent('touchend', thisTouchEnd); el.attachEvent('touchmove', thisTouchMove); } if (!settings.disableClickEvent) { google.maps.event.addListener(map, 'zoom_changed', function () { $.each(markers, function (index, marker) { marker.infobox.close(); marker.infobox.isOpen = false; }); }); google.maps.event.addListener(map, 'click', function () { $.each(markers, function (index, marker) { marker.infobox.close(); marker.infobox.isOpen = false; }); }); } renderElements(); $('.infobox .close').click(function () { $.each(markers, function (index, marker) { marker.infobox.close(); marker.infobox.isOpen = false; }); }); } function renderElements() { var newMarkers = []; $.each( settings.locations, function (index, location) { var marker = new google.maps.Marker({ position: new google.maps.LatLng(location[0], location[1]), map : map, visible: true, icon : settings.transparentMarkerImage }); marker.infobox = new InfoBox({ content : settings.contents[index], disableAutoPan : false, maxWidth : 0, pixelOffset : new google.maps.Size(settings.pixelOffsetX-24, settings.pixelOffsetY-52), zIndex : null, closeBoxURL : "", infoBoxClearance : new google.maps.Size(1, 1), position : new google.maps.LatLng(location[0], location[1]), isHidden : false, pane : "floatPane", enableEventPropagation: false, contextmenu: true }); marker.infobox.isOpen = false; marker.marker = new InfoBox({ draggable : true, content : '