1/** 2 * @file 3 * Marker InfoWindow. 4 */ 5 6/** 7 * @typedef {Object} MarkerInfoWindowSettings 8 * 9 * @extends {GeolocationMapFeatureSettings} 10 * 11 * @property {Boolean} infoAutoDisplay 12 * @property {Boolean} disableAutoPan 13 * @property {Boolean} infoWindowSolitary 14 * @property {int} maxWidth 15 */ 16 17/** 18 * @typedef {Object} GoogleInfoWindow 19 * @property {Function} open 20 * @property {Function} close 21 */ 22 23/** 24 * @property {GoogleInfoWindow} GeolocationGoogleMap.infoWindow 25 * @property {function({}):GoogleInfoWindow} GeolocationGoogleMap.InfoWindow 26 */ 27 28(function (Drupal) { 29 30 'use strict'; 31 32 /** 33 * Marker InfoWindow. 34 * 35 * @type {Drupal~behavior} 36 * 37 * @prop {Drupal~behaviorAttach} attach 38 * Attaches common map style functionality to relevant elements. 39 */ 40 Drupal.behaviors.geolocationMarkerInfoWindow = { 41 attach: function (context, drupalSettings) { 42 Drupal.geolocation.executeFeatureOnAllMaps( 43 'marker_infowindow', 44 45 /** 46 * @param {GeolocationGoogleMap} map - Current map. 47 * @param {MarkerInfoWindowSettings} featureSettings - Settings for current feature. 48 */ 49 function (map, featureSettings) { 50 map.addMarkerAddedCallback(function (currentMarker) { 51 if (typeof (currentMarker.locationWrapper) === 'undefined') { 52 return; 53 } 54 55 var content = currentMarker.locationWrapper.find('.location-content'); 56 57 if (content.length < 1) { 58 return; 59 } 60 content = content.html(); 61 62 var markerInfoWindow = { 63 content: content.toString(), 64 disableAutoPan: featureSettings.disableAutoPan 65 }; 66 67 if (featureSettings.maxWidth > 0) { 68 markerInfoWindow.maxWidth = featureSettings.maxWidth; 69 } 70 71 // Set the info popup text. 72 var currentInfoWindow = new google.maps.InfoWindow(markerInfoWindow); 73 74 currentMarker.addListener('click', function () { 75 if (featureSettings.infoWindowSolitary) { 76 if (typeof map.infoWindow !== 'undefined') { 77 map.infoWindow.close(); 78 } 79 map.infoWindow = currentInfoWindow; 80 } 81 currentInfoWindow.open(map.googleMap, currentMarker); 82 }); 83 84 if (featureSettings.infoAutoDisplay) { 85 if (map.googleMap.get('tilesloading')) { 86 google.maps.event.addListenerOnce(map.googleMap, 'tilesloaded', function () { 87 google.maps.event.trigger(currentMarker, 'click'); 88 }); 89 } 90 else { 91 jQuery.each(map.mapMarkers, function (index, currentMarker) { 92 google.maps.event.trigger(currentMarker, 'click'); 93 }) 94 } 95 } 96 }); 97 98 return true; 99 }, 100 drupalSettings 101 ); 102 }, 103 detach: function (context, drupalSettings) {} 104 }; 105})(Drupal);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.