(function($) { "use strict"; /* -------------------------------------------- google map -------------------------------------------- */ window.onload = maploadscript; function gmapinit() { var gmap = $('.map-canvas'); gmap.each(function() { var $this = $(this), lat = '', lng = '', zoom = 12, scrollwheel = false, zoomcontrol = true, draggable = true, maptype = google.maps.maptypeid.roadmap, title = '', contentstring = '', theme_icon_path = $this.data('icon-path'), datalat = $this.data('lat'), datalng = $this.data('lng'), datazoom = $this.data('zoom'), datatype = $this.data('type'), datascrollwheel = $this.data('scrollwheel'), datazoomcontrol = $this.data('zoomcontrol'), datahue = $this.data('hue'), datatitle = $this.data('title'), datacontent = $this.data('content'); if( datazoom !== undefined && datazoom !== false ) { zoom = parsefloat(datazoom); } if( datalat !== undefined && datalat !== false ) { lat = parsefloat(datalat); } if( datalng !== undefined && datalng !== false ) { lng = parsefloat(datalng); } if( datascrollwheel !== undefined && datascrollwheel !== null ) { scrollwheel = datascrollwheel; } if( datazoomcontrol !== undefined && datazoomcontrol !== null ) { zoomcontrol = datazoomcontrol; } if( datatype !== undefined && datatype !== false ) { if( datatype == 'satellite' ) { maptype = google.maps.maptypeid.satellite; } else if( datatype == 'hybrid' ) { maptype = google.maps.maptypeid.hybrid; } else if( datatype == 'terrain' ) { maptype = google.maps.maptypeid.terrain; } } if( datatitle !== undefined && datatitle !== false ) { title = datatitle; } if( navigator.useragent.match(/ipad|iphone|android/i) ) { draggable = false; } var mapoptions = { zoom : zoom, scrollwheel : scrollwheel, zoomcontrol : zoomcontrol, draggable : draggable, center : new google.maps.latlng(lat, lng), maptypeid : maptype }; var map = new google.maps.map($this[0], mapoptions); //var image = 'images/icons/map-marker.png'; var image = theme_icon_path; if( datacontent !== undefined && datacontent !== false ) { contentstring = '
' + '
' + title + '
' + '
' + datacontent + '
' + '
'; } var infowindow = new google.maps.infowindow({ content: contentstring }); var marker = new google.maps.marker({ position : new google.maps.latlng(lat, lng), map : map, icon : image, title : title }); if( datacontent !== undefined && datacontent !== false ) { google.maps.event.addlistener(marker, 'click', function() { infowindow.open(map,marker); }); } if( datahue !== undefined && datahue !== false ) { var styles = [ { "featuretype": "administrative.neighborhood", "elementtype": "labels.text.fill", "stylers": [ { "color": "#b19090" } ] }, { "featuretype": "landscape", "elementtype": "geometry", "stylers": [ { "visibility": "on" }, { "color": "#f7f1df" } ] }, { "featuretype": "poi", "elementtype": "labels", "stylers": [ { "visibility": "off" } ] }, { "featuretype": "road", "elementtype": "labels", "stylers": [ { "visibility": "off" } ] }, { "featuretype": "road.arterial", "elementtype": "geometry.stroke", "stylers": [ { "visibility": "off" } ] }, { "featuretype": "road.local", "elementtype": "geometry.stroke", "stylers": [ { "visibility": "off" } ] }, { "featuretype": "transit", "elementtype": "geometry.fill", "stylers": [ { "visibility": "on" }, { "color": "#d6d4d4" } ] }, { "featuretype": "transit", "elementtype": "labels.text", "stylers": [ { "visibility": "off" } ] } ]; map.setoptions({styles: styles}); } }); } function maploadscript() { var script = document.createelement('script'); script.type = 'text/javascript'; gmapinit(); document.body.appendchild(script); } })(window.jquery);