PageSourceSearch

https://kancelaria-szczepanek.pl/wp-content/plugins/wp-mapbox-gl-j…/js/wp-mapbox-gl-js-public.js?ver=351

js kancelaria-szczepanek.pl collected 2026-10-08 09:59:48 UTC 6,101 bytes, 156 lines download raw bytes

1(function($) {
2  /* map initialization */
3  $(document).ready(function() {
4    if($('.wp-mapbox-gl-js-map').length) {
5      var access_token = $('.wp-mapbox-gl-js-map').first().data('token');
6      mapboxgl.accessToken = access_token;
7
8      var allMaps = {};
9      $('.wp-mapbox-gl-js-map').each(function() {
10         var data = $(this).data();
11         // console.log(data)
12         var mapStyle = {
13           'container' : $(this).attr('id'),
14           'style' : data.style
15         };
16         var baseSettings = ['center','zoom','pitch','bearing',];
17         baseSettings.forEach(function(setting) {
18           if(data[setting]!=='') {
19             if(setting==='center') {
20               mapStyle[setting] = data[setting].split(',');
21             } else {
22               mapStyle[setting] = parseFloat(data[setting]);
23             }
24           }
25         });
26         var map = new mapboxgl.Map(mapStyle);
27         allMaps[$(this).attr('id')] = map;
28
29         map.on('load',function() {
30           // console.log(data.controls)
31            // Add controls
32           if(data.controls.navigation) {
33             var navControl = new mapboxgl.NavigationControl();
34             map.addControl(navControl);
35           }
36           if(data.controls.geocoder) {
37             var geocoder = new MapboxGeocoder({
38                 accessToken: access_token
39             });
40             map.addControl(geocoder,'top-left');
41           }
42           if(data.controls.scale) {
43             var scale = new mapboxgl.ScaleControl({
44               maxWidth: 80,
45               unit: 'metric'
46             })
47             map.addControl(scale,'top-left');
48           }
49           if(data.controls.fullscreen) {
50             var fullscreen = new mapboxgl.FullscreenControl();
51             map.addControl(fullscreen,'top-right');
52           }
53           if(data.controls.directions) {
54             map.addControl(new MapboxDirections({
55                accessToken: mapboxgl.accessToken
56             }), 'top-left');
57           }
58
59           // Map data add
60           data.mapdata.forEach(function(feature,index) {
61             var featureCollection = {
62               "type" : "FeatureCollection",
63               "features" : [feature]
64             }
65             // If only a marker icon or color has changed
66             if(typeof map.getSource(feature.id)==='undefined') {
67               map.addSource(feature.id, {
68                 "type": "geojson",
69                 "data": featureCollection
70               });
71               if(feature.geometry.type==='Point') {
72                 // Add the icon image, then add layer
73                 if(!map.hasImage(feature.properties.marker_icon_url)) {
74                   map.loadImage($('#wp_mapbox_gl_js_plugin_url').val()+'/wp-mapbox-gl-js/admin/wp-mapmaker/public/img/'+feature.properties.marker_icon_url, function(error, image) {
75                     if (error) throw error;
76                     map.addImage(feature.properties.marker_icon_url, image);
77                     // default_marker.svg
78                     var lineLayer = map.addLayer({
79                       'id': feature.id,
80                       'type': 'symbol',
81                       'source' : feature.id,
82                       'layout': {
83                         'icon-image': feature.properties.marker_icon_url,
84                         'icon-anchor' : 'bottom',
85                         'icon-size' : 0.2
86                       }
87                     })
88                     if(feature.properties.popup_open) {
89                       var popup = new mapboxgl.Popup({
90                         offset : 20
91                       });
92                       popup.setLngLat({lat: feature.geometry.coordinates[1], lng: feature.geometry.coordinates[0]})
93                         .setHTML(
94                           '<div>'+
95                             '<div>'+feature.properties.description+'</div>'+
96                           '</div>'
97                         ).addTo(map);
98                     }
99                   });
100                 } else {
101                   var lineLayer = map.addLayer({
102                     'id': feature.id,
103                     'type': 'symbol',
104                     'source' : feature.id,
105                     'layout': {
106                       'icon-image': feature.properties.marker_icon_url,
107                       'icon-anchor' : 'bottom',
108                       'icon-size' : 0.2
109                     }
110                   })
111                 }
112                 if(feature.properties.description!=='') {
113                   map.on('click',feature.id,function(e) {
114                     var popup = new mapboxgl.Popup({
115                       offset : 20
116                     })
117                     popup.setLngLat({lat: feature.geometry.coordinates[1], lng: feature.geometry.coordinates[0]})
118                       .setHTML(
119                         '<div>'+
120                           '<div>'+feature.properties.description+'</div>'+
121                         '</div>'
122                       ).addTo(map);
123                   })
124                 }
125               } else if(feature.geometry.type==='Polygon') {
126                 var lineLayer = map.addLayer({
127                   'id': feature.id,
128                   'type': 'fill',
129                   'source' : feature.id,
130                   'paint': {
131                     'fill-color' : feature.properties.color,
132                     'fill-opacity' : 0.4
133                   }
134                 })
135               } else if(feature.geometry.type==='LineString') {
136                 var lineLayer = map.addLayer({
137                   'id': feature.id,
138                   'type': 'line',
139                   'source' : feature.id,
140                   'paint': {
141                     'line-color' : feature.properties.color
142                   }
143                 })
144               }
145             }
146          });
147        });
148      });
149
150      $(document).on('click','.wp-mapbox-gl-js-map-menu input',function() {
151        allMaps[$(this).data('map-id')].setStyle($(this).attr('id'));
152      });
153
154    }
155  });
156})(jQuery);

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.