PageSourceSearch

https://shopar.com.ua/wp-content/themes/ninja_dgt/assets/shopar/js/main.js?ver=1.0.0

js shopar.com.ua collected 2026-09-29 22:03:00 UTC 25,956 bytes, 980 lines download raw bytes

1function getCookie(name) {
2	let cookieArr = document.cookie.split(";");
3
4	for(let i = 0; i < cookieArr.length; i++) {
5		let cookie = cookieArr[i].trim();
6
7		// Перевіряємо, чи починається кукі з потрібного імені
8		if (cookie.indexOf(name + "=") == 0) {
9			return cookie.substring(name.length + 1, cookie.length);
10		}
11	}
12
13	return null; // Якщо кукі не знайдено
14}
15
16// Lazy load img
17
18const imageBlockObserver = new IntersectionObserver((entries, imgObserver) => {
19  entries.forEach((entry) => {
20    if (entry.isIntersecting) {
21      const lazyBlock = entry.target;
22      const lazyImage = lazyBlock.querySelectorAll(".lzy_img_new");
23      lazyImage.forEach((elem) => {
24        elem.src = elem.dataset.src;
25        elem.classList.remove("lzy_img_new");
26      });
27      lazyBlock.classList.remove("lzy_img_bl");
28      imgObserver.unobserve(lazyBlock);
29    }
30  });
31});
32const arrBlockImg = document.querySelectorAll(".lzy_img_bl");
33arrBlockImg.forEach((v) => {
34  imageBlockObserver.observe(v);
35});
36
37
38//
39// Lazy bg
40const imageBg = new IntersectionObserver((entries, imgObserver) => {
41  entries.forEach((entry) => {
42    if (entry.isIntersecting) {
43      const lazyBackground = entry.target
44
45      if (window.screen.width < 576 && lazyBackground.dataset.imageMob) {
46        lazyBackground.style.backgroundImage = `url(${lazyBackground.dataset.imageMob})`
47      } else {
48        lazyBackground.style.backgroundImage = `url(${lazyBackground.dataset.image})`
49      }
50      lazyBackground.classList.remove('lzy_bg')
51      imgObserver.unobserve(lazyBackground)
52    }
53  })
54})
55const arrBg = document.querySelectorAll('.lzy_bg')
56arrBg.forEach((v) => {
57  imageBg.observe(v)
58})
59
60const imageBlocBgkObserver = new IntersectionObserver(
61  (entries, imgObserver) => {
62    entries.forEach((entry) => {
63      if (entry.isIntersecting) {
64        const lazyContainer = entry.target
65        const lazyBlockBg = lazyContainer.querySelectorAll('.lzy_bl')
66        lazyBlockBg.forEach((elem) => {
67          if (window.screen.width > 756) {
68            elem.style.backgroundImage = `url(${elem.dataset.image})`
69          } else {
70            elem.style.backgroundImage = `url(${elem.dataset.imageMob})`
71          }
72
73          elem.classList.remove('lzy_bl')
74        })
75        lazyContainer.classList.remove('lzy_bg_container')
76        imgObserver.unobserve(lazyContainer)
77      }
78    })
79  },
80)
81const lzyBgContainer = document.querySelectorAll('.lzy_bg_container')
82lzyBgContainer.forEach((v) => {
83  imageBlocBgkObserver.observe(v)
84})
85// Скролл по клику
86function currentYPosition() {
87  // Firefox, Chrome, Opera, Safari
88  if (self.pageYOffset) return self.pageYOffset
89  // Internet Explorer 6 - standards mode
90  if (document.documentElement && document.documentElement.scrollTop)
91    return document.documentElement.scrollTop
92  // Internet Explorer 6, 7 and 8init_pointer
93  if (document.body.scrollTop) return document.body.scrollTop
94  return 0
95}
96
97function elmYPosition(eID) {
98  let elm = document.querySelector(eID)
99  let y = elm.offsetTop
100  let node = elm
101  while (node.offsetParent && node.offsetParent != document.body) {
102    node = node.offsetParent
103    y += node.offsetTop
104  }
105  return y
106}
107
108function smoothScroll(eID) {
109  let startY = currentYPosition()
110  let stopY = elmYPosition(eID) - 50
111  let distance = stopY > startY ? stopY - startY : startY - stopY
112  if (distance < 100) {
113    scrollTo(0, stopY)
114    return
115  }
116  let speed = Math.round(distance / 100)
117  if (speed >= 20) speed = 20
118  let step = Math.round(distance / 30)
119  let leapY = stopY > startY ? startY + step : startY - step
120  let timer = 0
121  if (stopY > startY) {
122    for (let i = startY; i < stopY; i += step) {
123      setTimeout('window.scrollTo(0, ' + leapY + ')', timer * speed)
124      leapY += step
125      if (leapY > stopY) leapY = stopY
126      timer++
127    }
128    return
129  }
130  for (let i = startY; i > stopY; i -= step) {
131    setTimeout('window.scrollTo(0, ' + leapY + ')', timer * speed)
132    leapY -= step
133    if (leapY < stopY) leapY = stopY
134    timer++
135  }
136}
137if(document.querySelector('.page-template-template-shopar')){
138document.querySelectorAll('.scroll_to, .scroll_wrap > a').forEach((anchor) => {
139  anchor.addEventListener('click', function (e) {
140    e.preventDefault()
141    console.log(e.target)
142    if (e.target.getAttribute('href') != null) {
143      if (document.querySelector(e.target.getAttribute('href'))) {
144        smoothScroll(e.target.getAttribute('href'))
145        overlayMenu.classList.remove('open_menu')
146        overlayMenu.classList.add('close__burger')
147      } else {
148        // console.log(this.getAttribute('href'));
149        window.location = `/${e.target.getAttribute('href')}`
150      }
151    }
152  })
153})
154}
155
156//
157let shopScrollTop = 0;
158// $(window).scroll(function () {
159//   let st = $(this).scrollTop();
160//   if (st > shopScrollTop) {
161//     $('.header').fadeOut(300);
162//   } else {
163//     $('.header').fadeIn(300);
164//   }
165//   shopScrollTop = st;
166// });
167const headSection = document.querySelector('.head__section')
168const headerFixed = document.querySelector('.header')
169// const arrowFixed = document.querySelector('.scroll_up')
170// const aboutLink = document.querySelector('.about__link');
171// const mainHeadSection = document.querySelector(".head_section_main ");
172const htmlTag = document.querySelector('html')
173const windowHeight = window.screen.height / 3
174// console.log(windowHeight)
175window.addEventListener('scroll', function () {
176  if (window.scrollY > 500) {
177    let st = window.scrollY
178    if (st > shopScrollTop) {
179      headerFixed.classList.add('scroll__down')
180      headerFixed.classList.remove('scroll__up')
181    } else {
182      headerFixed.classList.remove('scroll__down')
183      headerFixed.classList.add('scroll__up')
184    }
185    shopScrollTop = st;
186  }
187
188  window.scrollY > 1
189    ? headerFixed.classList.add('header_fixed')
190    : headerFixed.classList.remove('header_fixed')
191})
192if (window.pageYOffset > windowHeight) headerFixed.classList.add('header_fixed')
193// if (window.pageYOffset > 850) arrowFixed.classList.add('visible_arrow');
194
195const btnBurger = document.querySelectorAll('.menu__burger')
196const overlayMenu = document.querySelector('.nav')
197const menuLimk = document.querySelectorAll('.nav__item a')
198
199btnBurger.forEach((elem) => {
200  elem.onclick = () => {
201    document.querySelector('body').classList.toggle('locked')
202    overlayMenu.classList.add('open_menu')
203    // overlayMenu.classList.remove('close__burger')
204  }
205})
206document.querySelectorAll('.menu__close').forEach((elem) => {
207  elem.onclick = function (e) {
208    overlayMenu.classList.remove('open_menu')
209    // overlayMenu.classList.add('close__burger')
210  }
211})
212
213
214
215//////////////////////////
216// Open Form
217//////////////////////////
218
219const elemAnim = document.querySelectorAll('.elem__anim')
220elemAnim.forEach(item => {
221  if (item.hasChildNodes()) {
222    const childList = item.querySelectorAll('h1, h2, h3, h4, a, button, p, ul, ol')
223    childList.forEach(elem => elem.classList.add('xyz_start'))
224  }
225})
226
227
228ScrollOut({
229  targets: '.xyz_start',
230  onShown: (el) => {
231    el.classList.add('xyz-in')
232  },
233})
234
235ScrollOut({
236  targets: '.possible__alien',
237  onShown: (el) => {
238    el.classList.add('animate')
239  },
240})
241
242
243const counters = document.querySelectorAll('.count_value');
244const speed = 200;
245
246ScrollOut({
247  targets: '.effectivity',
248  onShown: (el) => {
249    animateCounter()
250  },
251})
252function animateCounter() {
253  counters.forEach(counter => {
254    const animate = () => {
255      const value = +counter.dataset.akhi;
256      const data = +counter.innerText;
257      const time = value / speed;
258      if (data < value) {
259        counter.innerText = Math.ceil(data + time);
260        setTimeout(animate, 1);
261      } else {
262        counter.innerText = value;
263      }
264    }
265    animate();
266  });
267}
268const reviewSwiper = new Swiper('.review__swiper', {
269  slidesPerView: 1,
270  spaceBetween: 20,
271  navigation: {
272    nextEl: ".review__swiper .swiper__arrow_right",
273    prevEl: ".review__swiper .swiper__arrow_left",
274  },
275  breakpoints: {
276    300: {
277      autoHeight: true,
278    },
279    768: {
280      autoHeight: false,
281    },
282
283  },
284})
285const gallarySwiper = new Swiper('.head__swiper', {
286  slidesPerView: 1,
287  spaceBetween: 20,
288  init: false,
289  lazy:true,
290		// autoplay: {
291		// 	delay: 30000,
292		// },
293  navigation: {
294    nextEl: ".head__section .swiper__arrow_right",
295    prevEl: ".head__section .swiper__arrow_left",
296  },
297})
298
299function playVideoAndHandleEnd() {
300  setTimeout(() => {
301    const media = document.querySelector('.head__swiper .swiper-slide-active video');
302    
303    if (media) {
304      media.play().catch(err => console.log("Помилка автозапуску відео:", err));
305
306      media.onended = () => {
307        gallarySwiper.slideNext();
308      };
309    }
310  }, 100);
311
312}
313
314
315gallarySwiper.on('init', playVideoAndHandleEnd);
316
317gallarySwiper.on('slideChangeTransitionEnd', playVideoAndHandleEnd);
318
319gallarySwiper.init();
320// gallarySwiper.on('init', function () {
321//   // document.querySelector('.head__swiper .swiper-slide-active video').setAttribute('autoplay')
322//   const media =  document.querySelector('.head__swiper .swiper-slide-active video');
323//   if (media.paused) {
324//     // play.setAttribute("data-icon", "u");
325//     media.play();
326//   } 
327// });
328// // init Swiper
329// gallarySwiper.init();
330// gallarySwiper.on('slideChangeTransitionEnd', function () {
331//   const media =  document.querySelector('.head__swiper .swiper-slide-active video');
332//   if (media.paused) {
333//     // play.setAttribute("data-icon", "u");
334//     media.play();
335//   } 
336//   // document.querySelector('.head__swiper .swiper-slide-active video').setAttribute('autoplay', '')
337//   console.log(media);
338// });
339
340const modelviewer = new Swiper('.model_viewer_swiper', {
341	slidesPerView: 1,
342	spaceBetween: 20,
343	init: false,
344	lazy:true,
345	autoplay: {
346		delay: 30000,
347	},
348	// navigation: {
349	// 	nextEl: ".head__section .swiper__arrow_right",
350	// 	prevEl: ".head__section .swiper__arrow_left",
351	// },
352})
353
354const usedSwiper = new Swiper('.used__swiper', {
355  slidesPerView: 1,
356  spaceBetween: 20,
357  autoHeight: true,
358  lazy: true,
359  navigation: {
360    nextEl: ".used__swiper .swiper__arrow_right",
361    prevEl: ".used__swiper .swiper__arrow_left",
362  },
363})
364
365const effectivityItem = document.querySelectorAll('.effectivity__item')
366const effectivityAnimm = document.querySelectorAll('.effectivity__animm')
367// changeColor()
368function changeColor() {
369  for (let index = 0; index < effectivityAnimm.length; index++) {
370    setTimeout(function () {
371      const item = effectivityAnimm[index];
372      const countAnim = item.dataset.count
373      const effectivityAnimmElem = item.querySelectorAll('span')
374      for (let l = countAnim - 1; l >= 0; l--) {
375        const element = effectivityAnimmElem[l];
376        setTimeout(function () {
377          element.classList.add('active')
378        }, l * 100)
379      }
380    }, index * 500)
381  }
382}
383ScrollOut({
384  targets: '.effectivity__block',
385  onShown: (el, idx) => {
386    changeColor()
387  },
388})
389
390const advantSwiper = new Swiper('.advant__swiper', {
391  slidesPerView: 4,
392  spaceBetween: 20,
393  autoHeight: true,
394  lazy: true,
395  navigation: {
396    nextEl: ".advant .swiper__arrow_right",
397    prevEl: ".advant .swiper__arrow_left",
398  },
399  breakpoints: {
400    300: {
401      slidesPerView: 1,
402      spaceBetween: 20,
403    },
404    576: {
405      slidesPerView: 1.5,
406      spaceBetween: 20,
407    },
408    768: {
409      slidesPerView: 2,
410      spaceBetween: 20,
411    },
412    992: {
413      slidesPerView: 3,
414      spaceBetween: 20,
415    },
416    1200: {
417      slidesPerView: 4,
418      spaceBetween: 24,
419    },
420  },
421})
422
423const tarifSwiper = new Swiper('.tarif__swiper', {
424  slidesPerView: 4,
425  spaceBetween: 20,
426  autoHeight: true,
427  navigation: {
428    nextEl: ".tarif .swiper__arrow_right",
429    prevEl: ".tarif .swiper__arrow_left",
430  },
431  breakpoints: {
432    300: {
433      slidesPerView: 1,
434      spaceBetween: 20,
435    },
436    576: {
437      slidesPerView: 1.5,
438      spaceBetween: 20,
439    },
440    768: {
441      slidesPerView: 2,
442      spaceBetween: 20,
443    },
444    992: {
445      slidesPerView: 3,
446      spaceBetween: 20,
447    },
448    1200: {
449      slidesPerView: 4,
450      spaceBetween: 24,
451    },
452  },
453})
454
455const partnersSwiper = new Swiper('.partners__swiper', {
456  slidesPerView: 6,
457  spaceBetween: 20,
458  lazy: true,
459  navigation: {
460    nextEl: ".partners .swiper__arrow_right",
461    prevEl: ".partners .swiper__arrow_left",
462  },
463  breakpoints: {
464    300: {
465      slidesPerView: 2,
466      spaceBetween: 20,
467    },
468    576: {
469      slidesPerView: 2,
470      spaceBetween: 20,
471    },
472    768: {
473      slidesPerView: 3,
474      spaceBetween: 20,
475    },
476    992: {
477      slidesPerView: 4,
478      spaceBetween: 20,
479    },
480    1200: {
481      slidesPerView: 5,
482      spaceBetween: 20,
483    },
484    1440: {
485      slidesPerView: 6,
486      spaceBetween: 20,
487    },
488  },
489})
490
491const AR_BUTTON = document.querySelector(".ar-container");
492
493AR_BUTTON.addEventListener("click", () => {
494  AR_BUTTON.classList.add("active");
495  setTimeout(function () {
496    AR_BUTTON.classList.remove("active");
497  }, 1000)
498}
498);
499
500const workSwiper = new Swiper('.work__swiper', {
501  slidesPerView: 1,
502  spaceBetween: 20,
503  autoHeight: true,
504  effect: "fade",
505  allowTouchMove: false
506  // navigation: {
507  //       nextEl: ".advant .swiper__arrow_right",
508  //       prevEl: ".advant .swiper__arrow_left",
509  //     },
510})
511
512const buttons = document.querySelectorAll('[data-tab="button_slider"]');
513const openQr = document.querySelector('.open__qr')
514const workImg = document.querySelector('.work__img')
515const productBtnAll = document.querySelectorAll('.product__btn')
516const productBtnAllNew = document.querySelectorAll('.my-3d-item')
517const modelViewerContainer = document.getElementById('preview3d');
518if(workImg){
519  if(!document.getElementById('new-version')){
520
521    buttons.forEach((elem, idx) => {
522      elem.addEventListener('click', function (e) {
523        if (!elem.classList.contains('active')) {
524          buttons.forEach(item => {
525            item.classList.remove('active')
526          })
527          elem.classList.add('active')
528          workSwiper.slideTo(idx, 0);
529          productBtnAll.forEach(item => item.classList.remove('active'))
530          setTimeout(searchFirstProduct, 400)
531        }
532      });
533    })
534  
535  
536    searchFirstProduct()
537  
538    function searchFirstProduct() {
539      const productBtn = document.querySelectorAll('.work__swiper .swiper-slide-active .product__btn')
540  
541      productBtn.forEach((btn, idx) => {
542        btn.classList.remove('active')
543        btn.onclick = () => {
544          changeInfo(idx, productBtn)
545        }
546      })
547  
548      changeInfo(0)
549      function changeInfo(idx, productBtnList) {
550        workImg.style.opacity = 0;
551        if (!productBtn[idx].classList.contains('active')) {
552  
553          productBtn.forEach(item => item.classList.remove('active')
554  
555          )
556          productBtn[idx].classList.add('active')
557  
558          // openQr.dataset.qr = productBtn[idx].dataset.qr
559          openQr.setAttribute('href', productBtn[idx].dataset.link)
560  
561          setTimeout(function () {
562            // if(productBtn[idx].dataset['file-3d'] === 'none'){
563            workImg.src = ''
564            workImg.src = productBtn[idx].dataset.img
565            workImg.style.opacity = 1;
566            // }else{
567            //
568            // }
569  
570  
571          }, 300)
572        }
573      }
574  
575    }
576  }else{
577  
578  
579    // NEW BUTTONS FOR NEW 3D file BLOCK
580  
581  buttons.forEach((elem, idx) => {
582    elem.addEventListener('click', function (e) {
583      if (!elem.classList.contains('active')) {
584        buttons.forEach(item => {
585          item.classList.remove('active')
586        })
587        elem.classList.add('active')
588        workSwiper.slideTo(idx, 0);
589        productBtnAllNew.forEach(item => item.classList.remove('active'))
590  
591        setTimeout(searchFirstProductNew, 400)
592      }
593    });
594  })
595  
596  
597  searchFirstProductNew()
598  
599  function searchFirstProductNew() {
600    const productBtn = document.querySelectorAll('.work__swiper .swiper-slide-active .my-3d-item')
601  
602    productBtn.forEach((btn, idx) => {
603      btn.classList.remove('active')
604      btn.onclick = () => {
605        changeInfo(idx, productBtn)
606      }
607    })
608  
609    changeInfo(0)
610    function changeInfo(idx, productBtnList) {
611  
612        // workImg.style.opacity = 0;
613      // modelViewerContainer.style.opacity = 0;
614  
615      if (!productBtn[idx].classList.contains('active')) {
616        workImg.style.opacity = 0;
617        modelViewerContainer.style.opacity = 0;
618  
619        productBtn.forEach(item => item.classList.remove('active'))
620        productBtn[idx].classList.add('active')
621  
622        // openQr.dataset.qr = productBtn[idx].dataset.qr
623        openQr.setAttribute('href', productBtn[idx].dataset.link)
624  
625  
626          if(productBtn[idx].dataset['file-3d'] === 'none'){
627  
628            setTimeout(function () {
629              workImg.src = ''
630              workImg.src = productBtn[idx].dataset.img
631              workImg.style.opacity = 1;
632              modelViewerContainer.style.opacity = 0;
633            }, 300)
634          }else{
635            modelViewerContainer.src = productBtn[idx].dataset['file-3d'];
636  
637  
638            setTimeout(function () {
639              modelViewerContainer.style.opacity = 1;
640              workImg.style.opacity = 0;
641            });
642          }
643  
644  
645  
646      }
647    }
648  
649  }
650  
651  // END
652  
653  
654  }
655}
656
657
658
659
660
661
662
663
664
665if (window.screen.width < 992) {
666  const possibleSwiper = new Swiper('.possible__swiper', {
667    slidesPerView: 2,
668    spaceBetween: 20,
669    navigation: {
670      nextEl: ".possible .swiper__arrow_right",
671      prevEl: ".possible .swiper__arrow_left",
672    },
673    breakpoints: {
674      300: {
675        slidesPerView: 1,
676        spaceBetween: 20,
677      },
678      576: {
679        slidesPerView: 1.5,
680        spaceBetween: 20,
681      },
682      768: {
683        slidesPerView: 2,
684        spaceBetween: 20,
685      },
686      992: {
687        slidesPerView: 3,
688        spaceBetween: 20,
689      },
690
691    },
692  })
693  const workBtns = new Swiper('.work__btns', {
694    slidesPerView: 'auto',
695    spaceBetween: 10,
696
697    // navigation: {
698    //       nextEl: ".advant .swiper__arrow_right",
699    //       prevEl: ".advant .swiper__arrow_left",
700    //     },
701  })
702}
703
704const caseThumb = new Swiper('.case__thumb', {
705  spaceBetween: 10,
706  lazy: true,
707  slidesPerView: 'auto',
708})
709const caseSwiper = new Swiper('.case__swiper', {
710  spaceBetween: 20,
711  lazy: true,
712  slidesPerView: 1,
713  thumbs: {
714    swiper: caseThumb,
715  }, navigation: {
716    nextEl: ".case .swiper__arrow_right",
717    prevEl: ".case .swiper__arrow_left",
718  },
719  breakpoints: {
720    300: {
721      autoHeight: true,
722    },
723    768: {
724      autoHeight: false,
725    },
726  },
727})
728
729
730$('[type="tel"]').mask('+38 (0XX) XXX XX XX')
731
732const slideDownPure = (el) => {
733  el.style.height = `${el.scrollHeight}px`;
734  el.style.opacity = '1';
735  // el.style.overflow = 'visible';
736};
737
738const slideUpPure = (el) => {
739  el.style.height = '0';
740  el.style.opacity = '0';
741  el.style.overflow = 'hidden';
742  // el.style.marginBottom = '0';
743};
744
745
746const faqMore = document.querySelector('.faq__more')
747const faqMoreText = document.querySelector('.faq__more span')
748const faqHide = document.querySelector('.faq__hide')
749if (faqMore) {
750  faqMore.onclick = () => {
751    if (faqMore.classList.contains('active')) {
752      faqHide.style.opacity = 0
753      faqMore.classList.remove('active')
754      faqMoreText.textContent = faqMore.dataset.open
755      setTimeout(function () {
756        faqHide.style.display = 'none'
757      }, 400)
758      faqMore.classList.remove('active')
759    } else {
760      faqMoreText.textContent = faqMore.dataset.close
761
762      faqHide.style.display = 'block'
763      faqMore.classList.add('active')
764      setTimeout(function () {
765        faqHide.style.opacity = 1
766      }, 400)
767    }
768  }
769}
770
771function accordion(secondsTransition) {
772  const items = document.querySelectorAll('[data-accordion="item"]');
773  const texts = document.querySelectorAll('[data-accordion="text"]');
774
775  items.forEach((item) => {
776    const title = item.querySelector('[data-accordion="title"]');
777    const text = item.querySelector('[data-accordion="text"]');
778
779    text.style.opacity = '0';
780    text.style.height = '0';
781    text.style.overflow = 'hidden';
782    text.style.transition = `all ${secondsTransition}s ease`;
783    if (item.classList.contains('open')) {
784      slideDownPure(text);
785    }
786
787    title.onclick = () => {
788      if (item.classList.contains('open')) {
789        item.classList.remove('open');
790        slideUpPure(text);
791      } else {
792        texts.forEach((text) => slideUpPure(text));
793        items.forEach((item) => item.classList.remove('open'));
794        item.classList.add('open');
795        slideDownPure(text);
796      }
797    };
798  });
799}
800
801accordion(0.5);
802
803//////////////////////////
804// Open Form
805//////////////////////////
806const openForm = document.querySelectorAll('.open__form')
807const hiddenInput = document.querySelector('.order_form .hidden__input')
808
809const popupWrap = document.querySelectorAll('.popup')
810popupWrap.forEach((elem) => {
811  elem.onclick = (e) => {
812    console.log(e.target);
813    if (
814      e.target.classList.contains('popup') ||
815      e.target.classList.contains('close_popup') ||
816      e.target.classList.contains('popup__container')
817    ) {
818
819      document.querySelector('html').style.overflowY = 'auto'
820      // document.querySelector('body').style.height = "auto"
821      elem.classList.remove('open')
822    } else if (e.target.classList.contains('open__form')) {
823      e.preventDefault()
824      elem.classList.remove('open')
825      document.querySelector(`.${e.target.dataset.form}`).classList.add('open')
826      document.querySelector('html').style.overflowY = 'hidden'
827    }
828  }
829})
830
831
832
833
834
835
836const popup = document.getElementById('popup');
837const popupForms = document.querySelectorAll('.popup__container');
838
839// Відкриття попапа з потрібною формою
840document.addEventListener('click', (e) => {
841  if (e.target.classList.contains('open__form')) {
842    const formId = e.target.dataset.form;
843    
844    // Ховаємо всі форми
845    popupForms.forEach(form => form.classList.remove('active'));
846    
847    // Показуємо потрібну форму
848    const formToShow = document.getElementById(formId);
849    if (formToShow) {
850      formToShow.classList.add('active');
851      popup.classList.add('open');
852      document.querySelector('html').style.overflowY = 'hidden';
853    }
854  }
855});
856
857// Закриття попапа
858popup.addEventListener('click', (e) => {
859  if (e.target.classList.contains('popup') || e.target.classList.contains('popup__container')) {
860    popup.classList.remove('open');
861    document.querySelector('html').style.overflowY = 'auto';
862  }
863});
864
865
866
867
868
869
870
871document.addEventListener('click', (e) => {
872  if (e.target.classList.contains('open__form')) {
873    let formOpen = document.querySelector(`.${e.target.dataset.form}`)
874    if (formOpen) {
875      console.log(formOpen);
876      formOpen.classList.add('open')
877      document.querySelector('html').style.overflowY = 'hidden'
878    }
879    // if (formOpen.closest('.popup')) {
880    //   formOpen.classList.add('open')
881    //   formOpen.closest('.popup').classList.remove('open')
882    // }
883  }
884
885})
886setTimeout(function () {
887  if(!document.querySelector('.popup.open') && !getCookie('formSubmitted')){
888    document.querySelector('.popup__leave_form').classList.add('open')
889    document.querySelector('html').style.overflowY = 'hidden'
890  }
891},25000)
892 
893
894
895const regForm = document.querySelectorAll('.wpcf7 ')
896regForm.forEach(elem => {
897  elem.addEventListener('wpcf7mailsent', function (event) {
898    console.log(event);
899    document.querySelectorAll('.popup').forEach(item => {
900      item.classList.remove('open')
901    })
902    document.querySelector('html').style.overflowY = 'auto'
903    // if (event.detail.contactFormId == 116) {
904    //   document.querySelector('.popup_success_review').classList.add('open')
905    //   setTimeout(function () {
906    //     document.querySelector('.popup_success_review').classList.remove('open')
907    //     document.querySelector('.wpcf7-response-output').style.display = 'none'
908
909    //   }, 3000)
910    // } else {
911      document.cookie = "formSubmitted=true; path=/; max-age=" + (30 * 24 * 60 * 60);
912			if(thanksPageUrl){
913				window.location.href = thanksPageUrl;
914			}
915
916    // document.querySelector('.popup__success').classList.add('open')
917    setTimeout(function () {
918      document.querySelector('.popup__success').classList.remove('open')
919      document.querySelector('.wpcf7-response-output').style.display = 'none'
920
921    }, 3000)
922    // }
923    setTimeout(function () {
924      document.querySelector('.popup_success').classList.remove('open')
925      document.querySelector('.wpcf7-response-output').style.display = 'none'
926
927    }, 3000)
928  }, false);
929})
930
931const hideTheme = document.querySelectorAll('.hide_theme')
932const tarifCount = document.querySelectorAll('.tarif__popup .tarif__count span')
933hideTheme.forEach((input, idx) => {
934  input.value = tarifCount[idx].textContent.trim()
935})
936
937if(document.querySelector('.other-posts .swiper-container')){
938  const blogSlider = new Swiper('.other-posts .swiper-container', {
939      spaceBetween: 20,
940      lazy: true,
941    slidesPerView: 2,
942    navigation: {
943      nextEl: ".other-posts .swiper__arrow_right",
944      prevEl: ".other-posts .swiper__arrow_left",
945    },
946    breakpoints: {
947      300: {
948        slidesPerView: 1,
949      },
950      1199: {
951        slidesPerView: 2,
952      },
953    },
954  })
955}
956
957
958
959const lazyVideos = document.querySelectorAll("video.lazy-video");
960
961if ("IntersectionObserver" in window) {
962	const observer = new IntersectionObserver((entries, obs) => {
963		entries.forEach(entry => {
964			if (entry.isIntersecting) {
965				const video = entry.target;
966				const source = video.querySelector("source");
967
968				if (source && source.dataset.src) {
969					source.src = source.dataset.src;
970					video.load(); // запускає завантаження відео
971				}
972
973				video.classList.remove("lazy-video");
974				obs.unobserve(video);
975			}
976		});
977	});
978
979	lazyVideos.forEach(video => observer.observe(video));
980}

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.