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); 106; 107/** 108 * @file 109 * Control locate. 110 */ 111 112(function ($, Drupal) { 113 114 'use strict'; 115 116 /** 117 * Locate control. 118 * 119 * @type {Drupal~behavior} 120 * 121 * @prop {Drupal~behaviorAttach} attach 122 * Attaches common map style functionality to relevant elements. 123 */ 124 Drupal.behaviors.geolocationControlLocate = { 125 attach: function (context, drupalSettings) { 126 Drupal.geolocation.executeFeatureOnAllMaps( 127 'control_locate', 128 129 /** 130 * @param {GeolocationMapInterface} map 131 * @param {GeolocationMapFeatureSettings} featureSettings 132 */ 133 function (map, featureSettings) { 134 map.addInitializedCallback(function (map) { 135 var locateButton = $('.geolocation-map-control .locate', map.wrapper); 136 137 if (navigator.geolocation && window.location.protocol === 'https:') { 138 locateButton.click(function (e) { 139 navigator.geolocation.getCurrentPosition(function (currentPosition) { 140 var currentLocation = new google.maps.LatLng(currentPosition.coords.latitude, currentPosition.coords.longitude); 141 map.setCenterByCoordinates(currentLocation, currentPosition.coords.accuracy, 'google_control_locate'); 142 }); 143 e.preventDefault(); 144 }); 145 } 146 else { 147 locateButton.remove(); 148 } 149 }); 150 151 return true; 152 }, 153 drupalSettings 154 ); 155 }, 156 detach: function (context, drupalSettings) {} 157 }; 158 159})(jQuery, Drupal); 160; 161/** 162 * @file 163 * Zoom Control. 164 */ 165 166/** 167 * @typedef {Object} ControlZoomSettings 168 * 169 * @extends {GeolocationMapFeatureSettings} 170 * 171 * @property {String} behavior 172 * @property {String} position 173 * @property {String} style 174 */ 175 176(function (Drupal) { 177 178 'use strict'; 179 180 /** 181 * Zoom control. 182 * 183 * @type {Drupal~behavior} 184 * 185 * @prop {Drupal~behaviorAttach} attach 186 * Attaches common map style functionality to relevant elements. 187 */ 188 Drupal.behaviors.geolocationZoomControl = { 189 attach: function (context, drupalSettings) { 190 Drupal.geolocation.executeFeatureOnAllMaps( 191 'control_zoom', 192 193 /** 194 * @param {GeolocationGoogleMap} map - Current map. 195 * @param {ControlZoomSettings} featureSettings - Settings for current feature. 196 */ 197 function (map, featureSettings) { 198 map.addPopulatedCallback(function (map) { 199 var options = { 200 zoomControlOptions: { 201 position: google.maps.ControlPosition[featureSettings.position], 202 style: google.maps.ZoomControlStyle[featureSettings.style] 203 } 204 }; 205 206 if (featureSettings.behavior === 'always') { 207 options.zoomControl = true; 208 } 209 else { 210 options.zoomControl = undefined; 211 } 212 map.googleMap.setOptions(options); 213 }); 214 215 return true; 216 }, 217 drupalSettings 218 ); 219 }, 220 detach: function (context, drupalSettings) {} 221 }; 222 223})(Drupal); 224; 225/** 226 * @file 227 * Control MapType. 228 */ 229 230/** 231 * @typedef {Object} ControlMapTypeSettings 232 * 233 * @extends {GeolocationMapFeatureSettings} 234 * 235 * @property {String} position 236 * @property {String} style 237 * @property {String} behavior 238 */ 239 240(function (Drupal) { 241 242 'use strict'; 243 244 /** 245 * Maptype control. 246 * 247 * @type {Drupal~behavior} 248 * 249 * @prop {Drupal~behaviorAttach} attach 250 * Attaches common map style functionality to relevant elements. 251 */ 252 Drupal.behaviors.geolocationMapTypeControl = { 253 attach: function (context, drupalSettings) { 254 Drupal.geolocation.executeFeatureOnAllMaps( 255 'control_maptype', 256 257 /** 258 * @param {GeolocationGoogleMap} map - Current map. 259 * @param {ControlMapTypeSettings} featureSettings - Settings for current feature. 260 */ 261 function (map, featureSettings) { 262 map.addPopulatedCallback(function (map) { 263 var options = { 264 mapTypeControlOptions: { 265 position: google.maps.ControlPosition[featureSettings.position], 266 style: google.maps.MapTypeControlStyle[featureSettings.style] 267 } 268 }; 269 270 if (featureSettings.behavior === 'always') { 271 options.mapTypeControl = true; 272 } 273 else { 274 options.mapTypeControl = undefined; 275 } 276 277 map.googleMap.setOptions(options); 278 }); 279 280 return true; 281 }, 282 drupalSettings 283 ); 284 }, 285 detach: function (context, drupalSettings) {} 286 }; 287 288})(Drupal); 289; 290/** 291 * @file 292 * Adds the active class to active links, for proper top bar rendering. 293 * 294 */ 295(function ($, Drupal) { 296 297 /** 298 * Adds the "active" class to top bar <li> elements with active child links. 299 */ 300 Drupal.behaviors.foundationTopBarActive = { 301 attach: function (context, settings) { 302 var $active_links = $(context).find('.top-bar .menu-item > a.is-active'); 303 if ($active_links.length) { 304 $active_links.once('foundationTopBarActive').each(function() { 305 $(this).parent().addClass('active'); 306 }); 307 } 308 } 309 }; 310 311})(jQuery, Drupal); 312;
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.