1var maps = document.getElementsByClassName('custom-map'); 2for (var i = 0; i < maps.length; i++) { 3 var mapElement = maps.item(i); 4 var latlng = mapElement.dataset.latlng.split(','); 5 var showmarker = mapElement.dataset.showmarker; 6 var markers = mapElement.dataset.markers; 7 var icon = mapElement.dataset.customicon; 8 9 var map = L.map(mapElement, {fullscreenControl: true}).setView(latlng, 18); 10 11 L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { 12 maxZoom: 19, 13 attribution: '© <a href="https://www.openstreetmap.org/copyright">OSM</a>' 14 }).addTo(map); 15 16 if (icon) { 17 var iconMarker = L.icon({ 18 iconUrl: icon, 19 iconSize: [28, 28], 20 iconAnchor: [28, 28], 21 popupAnchor: [-14, -14] 22 }); 23 } 24 25 if (showmarker === "1") { 26 if (icon) { 27 L.marker(latlng, {icon: iconMarker}).addTo(map); 28 } else { 29 L.marker(latlng).addTo(map); 30 } 31 } 32 33 if (markers) { 34 jQuery.ajax({ 35 type: "GET", 36 dataType: 'json', 37 url: markers, 38 async: false, 39 contentType: "application/json; charset=utf-8", 40 success: function (data) { 41 var latlngBounds = []; 42 43 jQuery.each(data, function (index, value) { 44 latlngBounds[index] = [value.lat, value.lng]; 45 46 var popup = L.popup({autopan: true}).setContent('<h4>' + value.title + '</h4>' + value.description); 47 48 if (icon) { 49 L.marker(latlngBounds[index], {icon: iconMarker}).bindPopup(popup).addTo(map); 50 } else { 51 L.marker(latlngBounds[index]).bindPopup(popup).addTo(map); 52 } 53 }); 54 55 var bounds = new L.LatLngBounds(latlngBounds); 56 map.fitBounds(bounds); 57 } 58 }); 59 } 60}
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.