(function($, _) { var isNotEmptyString = function(str) { if (_.isString(str)) { return str.trim().length; } return 0; } var init = function($mapWrapper){ var maxZoom = 15, $mapCanvas = $mapWrapper.find('.fw-map-canvas'), mapCanvasOY = isNaN(parseInt($mapWrapper.data('map-height'))) ? parseInt($mapCanvas.width() * 0.66) : parseInt($mapWrapper.data('map-height')), locations = $mapWrapper.data('locations'), mapType = $mapWrapper.data('map-type'), mapOptions = { scrollwheel: false, center: ( 'undefined' !== locations && locations.length) ? calculateCenter(locations) : new google.maps.LatLng(-34, 150), mapTypeId: google.maps.MapTypeId[mapType] }, markerBounds = new google.maps.LatLngBounds(), map = new google.maps.Map($mapCanvas.get(0), mapOptions); if ('undefined' !== locations && locations.length) { locations.forEach(function(location){ gMapsCoords = new google.maps.LatLng(location.coordinates.lat, location.coordinates.lng); var marker = new google.maps.Marker({ position: gMapsCoords, map: map, icon: FwPhpVars.template_directory+'/images/Temp/Contact/pin.png' }); markerBounds.extend(gMapsCoords); //set content InfoWindow template if ( isNotEmptyString(location.description) || isNotEmptyString(location.title) || isNotEmptyString(location.url) || isNotEmptyString(location.thumb) ) { var template = _.template( "<% function isNotEmptyString(str) { if (_.isString(str)) { return str.trim().length;} return 0; } %>" + "