1jQuery(document).ready(function($){ 2 3 var map; 4 var loadTime = 0; 5 if ($('body').hasClass('elementor-editor-active')) { 6 loadTime = 2000; 7 } 8 9 setTimeout(function() { 10 11 var lang = 'el'; 12 if($('html').attr('lang') == 'en-GB') { 13 lang = 'en'; 14 } 15 16 $('.map-routes .menu-item').click(function() { 17 var routeCategoryId = $(this).attr('data-id'); 18 $('.map-routes .menu-item').removeClass('active'); 19 $(this).addClass('active'); 20 $('.menu-reset').show(); 21 if(routeCategoryId != '' || routeCategoryId != null) { 22 $('#routesMap').remove(); 23 $( "<div class=\"map\" id=\"routesMap\"></div>" ).insertAfter('.map-routes .menu'); 24 $.ajax({ 25 type: 'GET', 26 url: '/wp-json/wp/v2/place?_fields=id,title,acf,place_category&place_category='+routeCategoryId+'&per_page=100&lang='+ lang, 27 dataType: 'json', 28 success: function (items) { 29 routesMap(items); 30 } 31 }); 32 } 33 }); 34 35 $('.menu-reset').click(function() { 36 $('.map-routes .menu-item.active').removeClass('active'); 37 $('.menu-reset').hide(); 38 $('#routesMap').remove(); 39 $( "<div class=\"map\" id=\"routesMap\"></div>" ).insertAfter('.map-routes .menu'); 40 $.ajax({ 41 type: 'GET', 42 url: '/wp-json/wp/v2/place?_fields=id,link,title,acf,place_category&per_page=100&lang='+ lang, 43 dataType: 'json', 44 success: function (items) { 45 routesMap(items); 46 } 47 }); 48 }); 49 50 $('.map-routes #filters').click(function() { 51 $(this).addClass('active'); 52 }); 53 54 $('.map-routes .menu #close-menu').click(function() { 55 $('.map-routes #filters').removeClass('active'); 56 }); 57 58 $('.map-routes .menu .menu-collapse').click(function() { 59 $(this).parent().toggleClass('open'); 60 }); 61 62 $.ajax({ 63 type: 'GET', 64 url: '/wp-json/wp/v2/place?_fields=id,link,title,acf,place_category&per_page=100&lang='+ lang, 65 dataType: 'json', 66 success: function (items) { 67 routesMap(items); 68 } 69 }); 70 71 function routesMap(data) { 72 73 var defaultMapCenter = [40.393019, 23.2157431]; 74 var defaultZoomLevel = 10; 75 var zoomToId = $('[name="queried_id"]').val(); 76 77 var map = new L.Map('routesMap', { 78 scrollWheelZoom: false 79 }); 80 81 if (zoomToId && data.some(item => item.id == zoomToId)) { 82 var zoomItem = data.find(item => item.id == zoomToId);
83 map.setView([zoomItem.acf.lat, zoomItem.acf.long], 15); 84 } else { 85 map.setView(defaultMapCenter, defaultZoomLevel); 86 } 87 88 var museumsIcon = new L.Icon({ 89 iconUrl: '/wp-content/themes/efaxagor/assets/images/icons/museums_pin.png', 90 iconSize: [38, 50], 91 iconAnchor: [22, 38] 92 }), 93 monumentsIcon = new L.Icon({ 94 iconUrl: '/wp-content/themes/efaxagor/assets/images/icons/monuments_pin.png', 95 iconSize: [38, 50], 96 iconAnchor: [22, 38] 97 }), 98 orosIcon = new L.Icon({ 99 iconUrl: '/wp-content/themes/efaxagor/assets/images/icons/oros_pin.png', 100 iconSize: [38, 50], 101 iconAnchor: [22, 38] 102 }), 103 archaelogicalIcon = new L.Icon({ 104 iconUrl: '/wp-content/themes/efaxagor/assets/images/icons/archaelogical_pin.png', 105 iconSize: [38, 50], 106 iconAnchor: [22, 38] 107 }), 108 defaultIcon = new L.Icon({ 109 iconUrl: '/wp-content/themes/efaxagor/assets/images/icons/archaelogical_pin.png', 110 iconSize: [38, 50], 111 iconAnchor: [22, 38] 112 }); 113 114 L.tileLayer('https://tile.jawg.io/dfedf8f2-5404-426c-9d6e-9acad6dc138c/{z}/{x}/{y}{r}.png?access-token=HDcssuYKL1vglr5zXo2BVFNWU7Wd3RnpjHteraDjb2tqqRN9wSUbegEIAIKlFeCn', { 115 attribution: '' 116 }).addTo(map); 117 118 var placePoints = []; 119 $.each(data, function(index, value) { 120 switch(value.place_category[0]) { 121 case 93: 122 markerIcon = museumsIcon; 123 break; 124 case 159: 125 markerIcon = museumsIcon; 126 break; 127 case 91: 128 markerIcon = archaelogicalIcon; 129 break; 130 case 157: 131 markerIcon = archaelogicalIcon; 132 break; 133 case 95: 134 markerIcon = monumentsIcon; 135 break; 136 case 161: 137 markerIcon = monumentsIcon; 138 break; 139 case 89: 140 markerIcon = orosIcon; 141 break; 142 case 155: 143 markerIcon = orosIcon; 144 break; 145 default: 146 markerIcon = defaultIcon; 147 } 148 149 // if you want with popup content 150 // placePoints.push(new L.marker([value.acf.lat, value.acf.long], {icon: markerIcon}).addTo(map).bindPopup("<div class='title'>"+ value.title.rendered +"</div><div class='link'><a href='"+ value.link +"' target='_blank'>Î Ïοβολή</a></div>")); 151 placePoints.push(new L.marker([value.acf.lat, value.acf.long], {icon: markerIcon, alt: 'pin'}) 152 .addTo(map) 153 .bindPopup("<div class='title'>"+ value.title.rendered +"</div><div class='link'><a href='"+ value.link +"' target='_blank'>Î Ïοβολή</a></div>", { 154 offset: [0, -15] 155 }) 156 .on('click', function(e) { 157 map.flyTo([value.acf.lat, value.acf.long], 15); 158 }) 159 ); 160 161 // if you want direct the link 162 // var marker = new L.marker([value.acf.lat, value.acf.long], {icon: markerIcon}) 163 // .addTo(map) 164 // .on('click', function(e) { 165 // window.location.href = value.link; 166 // }); 167 // placePoints.push(marker); 168 169 }); 170 171 map.on('popupclose', function() { 172 map.flyTo([40.393019, 23.2157431], 10); 173 }); 174 175 if(data.length != 0) { 176 var group = L.featureGroup(placePoints).addTo(map); 177 map.fitBounds(group.getBounds()); 178 } else { 179 console.log('no data for now'); 180 } 181 } 182 183 }, loadTime); 184 185});
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.