PageSourceSearch

https://stansburysbarbershop.com/wp-content/themes/salient/js/elements/nectar-leaflet-map.js?ver=13.0.6

js stansburysbarbershop.com collected 2026-09-30 11:04:57 UTC 4,551 bytes, 135 lines download raw bytes

1/**
2 * Salient "Ineractive Map: Leaflet" script file.
3 *
4 * @package Salient
5 * @author ThemeNectar
6 */
7/* global L */
8
9jQuery(document).ready(function($){
10  
11  "use strict";
12  
13  var maps = [];
14  
15  $(window).on( 'vc_reload', function() {
16    if(maps.length > 0) {
17      for(var i=0; i<maps.length; i++) {
18        maps[i].remove();
19      }
20    }
21    maps = [];
22    nectarLeafletInit();
23  });
24  
25  function nectarLeafletInit() {
26    
27    $('.nectar-leaflet-map').each(function(i){
28      
29      var mapID = $(this).attr('id');
30      var zoomLevel = parseFloat($(this).attr('data-zoom-level'));
31      var centerlat = parseFloat($(this).attr('data-center-lat'));
32      var centerlng = parseFloat($(this).attr('data-center-lng'));
33      var markerStyle = $(this).attr('data-marker-style');
34      var closePopupOnClickBool = ($(this).is('[data-infowindow-start-open]') && $(this).attr('data-infowindow-start-open') == '1') ? false : true;
35      
36      maps[i] = L.map(mapID, {
37        scrollWheelZoom: false, 
38        center: [centerlat, centerlng], 
39        zoom: zoomLevel, 
40        closePopupOnClick: closePopupOnClickBool 
41      });
42      
43      L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
44        attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
45      }).addTo(maps[i]);
46      
47      //store index
48      var j = i;
49      
50      $('.map-marker-list.'+mapID).each(function(){
51        
52        $(this).find('.map-marker').each(function(){
53          
54          var iconObj = {};
55          var customIcon;
56          
57          if(markerStyle == 'nectar') {
58            
59            customIcon = L.divIcon({
60              html: '<div><div class="animated-dot">' +
61              '<div class="middle-dot"></div>' +
62              '<div class="signal"></div>' +
63              '<div class="signal2"></div>' +
64              '</div></div>'
65            });
66            
67            iconObj = { icon: customIcon };
68            
69          }
70          else if($('#'+mapID).attr('data-marker-img').length > 0) {
71            
72            //get image size
73            var imgHeight = ($(this).is('[data-marker-image-height]') && $(this).attr('data-marker-image-height').length > 0) ? parseInt($(this).attr('data-marker-image-height')) : 50;
74            var imgWidth = ($(this).is('[data-marker-image-width]') && $(this).attr('data-marker-image-width').length > 0) ? parseInt($(this).attr('data-marker-image-width')) : 50;
75            
76            customIcon = L.icon({
77              iconUrl: $('#'+mapID).attr('data-marker-img'),
78              iconSize: [imgWidth, imgHeight]
79            });
80            
81            iconObj = { icon: customIcon };
82          } else {
83            
84            //regular
85            customIcon = L.divIcon({
86              html: '<div class="nectar-leaflet-pin"></div>',
87              iconSize: [34, 34],
88              popupAnchor: [-3, -13],
89              iconAnchor: [20, 20],
90            });
91            
92            iconObj = { icon: customIcon };
93          }
94          
95          var markerLat = ($(this).is('[data-lat]') && $(this).attr('data-lat').length > 0) ? parseFloat($(this).attr('data-lat')) : 0;
96          var markerLng = ($(this).is('[data-lng]') && $(this).attr('data-lng').length > 0) ? parseFloat($(this).attr('data-lng')) : 0;
97          
98          //marker
99          
100          ////with infowindow
101          if($(this).attr('data-mapinfo') != '' && $(this).attr('data-mapinfo') != '<br />' && $(this).attr('data-mapinfo') != '<br/>') {
102            
103            if(!closePopupOnClickBool) {
104              //start open
105              L.marker([markerLat, markerLng], iconObj).addTo(maps[j])
106              .bindPopup($(this).attr('data-mapinfo'), {autoClose: false}).openPopup();
107              
108              ////needed to avoid wrong center point (marker autopanning)    
109              maps[j].setView([centerlat, centerlng], zoomLevel);
110              
111            } else {
112              //start closed
113              L.marker([markerLat, markerLng], iconObj).addTo(maps[j])
114              .bindPopup($(this).attr('data-mapinfo'));
115            }
116            
117          }
118          ////without infowindow
119          else {
120            L.marker([markerLat, markerLng], iconObj).addTo(maps[j]);
121          }
122          
123        });
124        
125      });
126      
127      
128      
129    });
130  }
131  
132  nectarLeafletInit();
133  
134  
135});

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.