1/** 2 * @file 3 * Control locate. 4 */ 5 6(function ($, Drupal) { 7 "use strict"; 8 9 /** 10 * Locate control. 11 * 12 * @type {Drupal~behavior} 13 * 14 * @prop {Drupal~behaviorAttach} attach 15 * Attaches common map style functionality to relevant elements. 16 */ 17 Drupal.behaviors.geolocationControlLocate = { 18 attach: function (context, drupalSettings) { 19 Drupal.geolocation.executeFeatureOnAllMaps( 20 "control_locate", 21 22 /** 23 * @param {GeolocationMapInterface} map 24 * @param {GeolocationMapFeatureSettings} featureSettings 25 */ 26 function (map, featureSettings) { 27 map.addInitializedCallback(function (map) { 28 var locateButton = $( 29 ".geolocation-map-control .locate", 30 map.wrapper 31 ); 32 33 if ( 34 navigator.geolocation && 35 window.location.protocol === "https:" 36 ) { 37 locateButton.click(function (e) { 38 navigator.geolocation.getCurrentPosition(function ( 39 currentPosition 40 ) { 41 var currentLocation = new google.maps.LatLng( 42 currentPosition.coords.latitude, 43 currentPosition.coords.longitude 44 ); 45 map.setCenterByCoordinates( 46 currentLocation, 47 currentPosition.coords.accuracy, 48 "google_control_locate" 49 ); 50 }); 51 e.preventDefault(); 52 }); 53 } else { 54 locateButton.remove(); 55 } 56 }); 57 58 return true; 59 }, 60 drupalSettings 61 ); 62 }, 63 detach: function (context, drupalSettings) {}, 64 }; 65})(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.