1 2; /* Start:"a:4:{s:4:"full";s:99:"/bitrix/components/brainforce/brainforce.instagram.list/templates/.default/script.js?16056136853394";s:6:"source";s:84:"/bitrix/components/brainforce/brainforce.instagram.list/templates/.default/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 3(function () { 4 let popup; 5 document.addEventListener('DOMContentLoaded', function () { 6 popup = document.querySelector('.bf-insta-overlay'); 7 managePopup(); 8 }); 9 function managePopup() { 10 const trigger = document.querySelectorAll('.bf-insta__item'); 11 12 for (let i = 0; i < trigger.length; i++) { 13 trigger[i].addEventListener('click', function () { 14 ajaxCall(this.dataset.id, document.getElementById('bf_insta_ajax_url').getAttribute('value')); 15 }); 16 } 17 document.addEventListener('click', function (e) { 18 const target = e.target; 19 20 if ( 21 target.classList.contains('bf-insta-overlay') || 22 target.classList.contains('bf-insta-popup__close') 23 ) { 24 stopVideo(); 25 popup.classList.remove('bf-active'); 26 } 27 }); 28 } 29 // slider 30 function initSlider() { 31 let slideIndex = 1; 32 const slides = document.querySelectorAll('.bf-insta-popup__slider-item'); 33 const previousBtn = document.querySelector('.bf-insta-popup__slider-previous'); 34 const nextBtn = document.querySelector('.bf-insta-popup__slider-next'); 35 const dotWrap = document.querySelector('.bf-insta-popup__slider-dots'); 36 const dots = document.querySelectorAll('.bf-insta-popup__slider-dot'); 37 38 if (slides && Array.from(slides).length > 1) { 39 showSlides(slideIndex); 40 41 function showSlides(n) { 42 if (n > slides.length) { 43 slideIndex = 1; 44 } 45 if (n < 1) { 46 slideIndex = slides.length; 47 } 48 slides.forEach((item) => item.style.display = 'none'); 49 dots.forEach((item) => item.classList.remove('bf-active')); 50 51 slides[slideIndex - 1].style.display = 'block'; 52 dots[slideIndex - 1].classList.add('bf-active'); 53 } 54 55 function nextSlide() { 56 stopVideo(); 57 showSlides(slideIndex += 1); 58 } 59 function previousSlide() { 60 stopVideo(); 61 showSlides(slideIndex -= 1); 62 } 63 64 previousBtn.addEventListener('click', function () { 65 previousSlide(); 66 }); 67 nextBtn.addEventListener('click', function () { 68 nextSlide(); 69 }); 70 71 dotWrap.addEventListener('click', function (event) { 72 for (let i = 0; i < dots.length + 1; i++) { 73 const target = event.target; 74 if (target.classList.contains('dot') && target === dots[i - 1]) { 75 currentSlide(i); 76 } 77 } 78 }); 79 80 function currentSlide(n) { 81 showSlides(slideIndex = n); 82 } 83 currentSlide(1); 84 } 85 } 86 function stopVideo() { 87 const videos = Array.from(popup.querySelectorAll('video')); 88 if(videos.length) { 89 videos.forEach((video) => video.pause()); 90 } 91 } 92 function ajaxCall(id, url) { 93 BX.ajax({ 94 url: url + '/ajax.php?id=' + id, 95 method: 'get', 96 async: true, 97 emulateOnload: true, 98 start: true, 99 cache: false, 100 onsuccess: function (data) { 101 BX.adjust(BX('bf-insta-popup-div'), { html: data }); 102 popup.classList.add('bf-active'); 103 initSlider(); 104 }, 105 onfailure: function () { 106 BX.adjust(BX('bf-insta-popup-div'), { html: `<span class="bf-insta-popup__close">×</span> 107 <span style="color:red;">Error</span>` }); 108 } 109 }); 110 //BX.ajax.insertToNode(url +'/ajax.php?id=' + id, 'bf-insta-popup-div'); 111 112 } 113})(); 114/* End */ 115;; /* /bitrix/components/brainforce/brainforce.instagram.list/templates/.default/script.js?16056136853394*/
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.