1 2function initMap(){ 3 let mapCheck = document.querySelector('.contacts-address') 4 if (mapCheck) { 5 6 ymaps.ready(init); 7 let latStart = document.querySelector('.contacts-address').getAttribute('data-lat'); 8 let lonStart = document.querySelector('.contacts-address').getAttribute('data-lon'); 9 let map; 10 11 // init 12 function init () { 13 map = new ymaps.Map('map', { 14 center: [latStart, lonStart], 15 zoom: 14, 16 controls: [] 17 }); 18 19 20 // mark placement 21 let collection = new ymaps.GeoObjectCollection(null, { 22 hasBalloon: false, 23 }); 24 let startPos = document.querySelectorAll('.contacts-address'); 25 startPos.forEach((pos) => { 26 collection.add(new ymaps.Placemark([pos.dataset.lat, pos.dataset.lon]), { 27 hintContent: 'СобÑÑвеннÑй знаÑок меÑки', 28 balloonContent: 'ÐÑо кÑаÑÐ¸Ð²Ð°Ñ Ð¼ÐµÑка' 29 }) 30 }) 31 map.geoObjects.add(collection); 32 33 34 // clicking on mark opens the corresponding tab 35 let tabElements = document.querySelectorAll('.contacts-address'); 36 collection.events.add('click', function (e) { 37 let target = e.get('target'); 38 let currentLat = target.geometry.getCoordinates()[0]; 39 map.panTo([target.geometry.getCoordinates()], 10); 40 41 tabElements.forEach(el => { 42 el.classList.remove('active'); 43 if (el.getAttribute('data-lat') == currentLat) { 44 el.classList.add('active'); 45 } 46 47 }); 48 }); 49 50 tabElements.forEach(tab => { 51 tab.addEventListener('click', function(e){ 52 53 tabElements.forEach(t => t.classList.remove('active')); 54 this.classList.add('active') 55 let coordinates = [parseFloat(this.getAttribute('data-lat')), parseFloat(this. getAttribute('data-lon'))]; 56 map.panTo(coordinates, 10); 57 console.log(map.panTo) 58 console.log(coordinates) 59 }) 60 }) 61 62 } 63 64 } 65} 66 67initMap(); 68 69const s_bar = document.querySelector('.js-search-bar'); 70if(s_bar){ 71 const s_block = document.querySelector('.js-search-content'); 72 s_bar.addEventListener("submit", function(e){ 73 const s_field = s_bar.querySelector('input').value 74 e.preventDefault(); 75 BX.ajax.insertToNode('/ajax/search-contacts.php?s=' + s_field, s_block); 76 }); 77} 78
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.