1/** 2 * @file 3 * Control recenter. 4 */ 5 6(function ($, Drupal) { 7 8 'use strict'; 9 10 /** 11 * Recenter control. 12 * 13 * @type {Drupal~behavior} 14 * 15 * @prop {Drupal~behaviorAttach} attach 16 * Attaches common map recenter functionality to relevant elements. 17 */ 18 Drupal.behaviors.leafletControlRecenter = { 19 attach: function (context, drupalSettings) { 20 Drupal.geolocation.executeFeatureOnAllMaps( 21 'leaflet_control_recenter', 22 23 /** 24 * @param {GeolocationLeafletMap} map - Current map. 25 * @param {GeolocationMapFeatureSettings} featureSettings - Settings for current feature. 26 */ 27 function (map, featureSettings) { 28 map.addInitializedCallback(function (map) { 29 jQuery.each(map.leafletMap.controls, function (index, control) { 30 var currentControlContainer = control.getContainer(); 31 if (!currentControlContainer.classList.contains('leaflet_control_recenter')) { 32 return; 33 } 34 map.leafletMap.removeControl(control); 35 map.leafletMap.addControl(control); 36 }); 37 var recenterButton = $('.geolocation-map-control .recenter', map.wrapper); 38 recenterButton.click(function (e) { 39 map.setCenter(); 40 e.preventDefault(); 41 }); 42 }); 43 44 return true; 45 }, 46 drupalSettings 47 ); 48 }, 49 detach: function (context, drupalSettings) {} 50 }; 51 52})(jQuery, 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.