1document.addEventListener("DOMContentLoaded", function(event) { 2 3 const video = document.getElementById("hero-video"); 4 const fallback = document.getElementById("fallback-image"); 5 const preloader = document.querySelector('.preloader'); 6 7 let isFirstVisit = true; 8 if (sessionStorage.getItem('visited')) { 9 isFirstVisit = false; 10 11 if (preloader) { 12 preloader.style.display = "none"; 13 } 14 15 } else { 16 sessionStorage.setItem('visited', 'true'); 17 18 if (preloader) { 19 const preloaderLogo = document.querySelector('[data-preloader="logo"]'); 20 const preloaderBottom = document.querySelector('[data-preloader="bottom"]'); 21 const preloaderPanel = document.querySelector('[data-preloader="panel"]'); 22 const preloaderPanelValues = document.querySelectorAll('[data-preloader="panel-value"]'); 23 const preloaderSpeedBox = document.querySelector('[data-preloader="speed-box"]'); 24 const preloaderSpeed = document.querySelector('[data-preloader="speed"]'); 25 const preloaderSpeedLine = document.querySelector('[data-preloader="speed-line"]'); 26 const preloaderParamValues = document.querySelectorAll('[data-preloader="param-val"]'); 27 const preloaderPanelIndicators = document.querySelectorAll('[data-preloader="indicator"]'); 28 29 function createCounter(duration, stepSize) { 30 let currentValue = 0; 31 const step = 100 / (duration / 16) * stepSize; 32 const interval = setInterval(() => { 33 currentValue += step; 34 if (currentValue >= 100) { 35 preloaderSpeed.textContent = '100'; 36 clearInterval(interval); 37 } else { 38 preloaderSpeed.textContent = Math.round(currentValue); 39 } 40 }, 16); 41 } 42 43 44 setTimeout(() => { 45 preloaderLogo.style.bottom = "0rem"; 46 preloaderLogo.style.opacity = "1"; 47 }, 100); 48 49 setTimeout(() => { 50 preloaderPanel.style.bottom = "0rem"; 51 preloaderPanel.style.opacity = "1"; 52 53 preloaderSpeedBox.style.opacity = "1"; 54 55 preloaderPanelValues.forEach((el, index) => { 56 setTimeout(() => { 57 el.style.opacity = "1"; 58 el.style.left = "0rem"; 59 }, 100 * index); 60 }); 61 62 preloaderPanelIndicators.forEach((el, index) => { 63 setTimeout(() => { 64 el.style.opacity = "1"; 65 }, 180 * (preloaderPanelIndicators.length - 1 - index)); 66 }); 67 createCounter(3500, 2); 68 preloaderSpeedLine.style.maxWidth = "100%"; 69 70 preloaderParamValues.forEach((el, index) => { 71 setTimeout(() => { 72 el.style.opacity = "1"; 73 el.style.left = "0rem"; 74 }, 100 * index); 75 }); 76 77 }, 300); 78 79 80 setTimeout(() => { 81 preloaderLogo.style.bottom = "3rem"; 82 preloaderLogo.style.opacity = "0"; 83 }, 2700); 84 85 setTimeout(() => { 86 preloaderBottom.style.bottom = "2rem"; 87 preloaderBottom.style.opacity = "0"; 88 }, 2800); 89 90 setTimeout(() => { 91 slideUp(preloader, 700); 92 }, 3300); 93 94 } 95 } 96 97 const delay = isFirstVisit ? 3500 : 500; 98 99 if(video) { 100 setTimeout(() => { 101 video.play() 102 .then(() => { 103 video.style.display = "block"; 104 fallback.style.display = "none"; 105 }) 106 .catch(() => { 107 fallback.style.display = "block"; 108 video.style.display = "none"; 109 }); 110 }, delay); 111 } 112 113 const fadeIn = (el, timeout, display) => { 114 el.style.opacity = 0; 115 el.style.display = display || 'block'; 116 el.style.transition = `opacity ${timeout}ms`; 117 setTimeout(() => { 118 el.style.opacity = 1; 119 }, 10); 120 }; 121 const fadeOut = (el, timeout) => { 122 el.style.opacity = 1; 123 el.style.transition = `opacity ${timeout}ms`; 124 el.style.opacity = 0; 125 setTimeout(() => { 126 el.style.display = 'none'; 127 }, timeout); 128 }; 129 const fadeToggle = (el, timeout, display) => { 130 const computedStyle = window.getComputedStyle(el); 131 if (computedStyle.display === 'none') { 132 fadeIn(el, timeout, display); 133 } else { 134 fadeOut(el, timeout); 135 } 136 }; 137 const slideUp = (target, duration = 500) => { 138 target.style.transitionProperty = 'height, margin, padding'; 139 target.style.transitionDuration = duration + 'ms'; 140 target.style.boxSizing = 'border-box'; 141 target.style.height = target.offsetHeight + 'px'; 142 target.offsetHeight; 143 target.style.overflow = 'hidden'; 144 target.style.height = 0; 145 target.style.paddingTop = 0; 146 target.style.paddingBottom = 0; 147 target.style.marginTop = 0; 148 target.style.marginBottom = 0; 149 window.setTimeout(() => { 150 target.style.display = 'none'; 151 target.style.removeProperty('height'); 152 target.style.removeProperty('padding-top'); 153 target.style.removeProperty('padding-bottom'); 154 target.style.removeProperty('margin-top'); 155 target.style.removeProperty('margin-bottom'); 156 target.style.removeProperty('overflow'); 157 target.style.removeProperty('transition-duration'); 158 target.style.removeProperty('transition-property'); 159 160 }, duration); 161 } 162 const slideDown = (target, duration = 500, displayValue = 'block') => { 163 target.style.removeProperty('display'); 164 let currentDisplay = window.getComputedStyle(target).display; 165 if (currentDisplay === 'none') currentDisplay = displayValue; 166 target.style.display = currentDisplay; 167 let height = target.offsetHeight; 168 target.style.overflow = 'hidden'; 169 target.style.height = 0; 170 target.style.paddingTop = 0; 171 target.style.paddingBottom = 0; 172 target.style.marginTop = 0; 173 target.style.marginBottom = 0; 174 target.offsetHeight; 175 target.style.boxSizing = 'border-box'; 176 target.style.transitionProperty = 'height, margin, padding'; 177 target.style.transitionDuration = duration + 'ms'; 178 target.style.height = height + 'px'; 179 target.style.removeProperty('padding-top'); 180 target.style.removeProperty('padding-bottom'); 181 target.style.removeProperty('margin-top'); 182 target.style.removeProperty('margin-bottom'); 183 window.setTimeout(() => { 184 target.style.removeProperty('height'); 185 target.style.removeProperty('overflow'); 186 target.style.removeProperty('transition-duration'); 187 target.style.removeProperty('transition-property'); 188 189 }, duration); 190 } 191 const slideUp2 = (target, duration = 500) => { 192 target.style.transitionProperty = 'height, margin, padding'; 193 target.style.transitionDuration = duration + 'ms'; 194 target.style.boxSizing = 'border-box'; 195 target.style.height = target.offsetHeight + 'px'; 196 target.offsetHeight; 197 target.style.overflow = 'hidden'; 198 target.style.height = 0; 199 target.style.paddingTop = 0; 200 target.style.paddingBottom = 0; 201 target.style.marginTop = 0; 202 target.style.marginBottom = 0; 203 window.setTimeout(() => { 204 target.style.display = 'none'; 205 target.style.removeProperty('height'); 206 target.style.removeProperty('padding-top'); 207 target.style.removeProperty('padding-bottom'); 208 target.style.removeProperty('margin-top'); 209 target.style.removeProperty('margin-bottom'); 210 target.style.removeProperty('overflow'); 211 target.style.removeProperty('transition-duration'); 212 target.style.removeProperty('transition-property'); 213 // ScrollTrigger.refresh(); 214 }, duration); 215 } 216 const slideDown2 = (target, duration = 500, displayValue = 'block') => { 217 target.style.removeProperty('display'); 218 let currentDisplay = window.getComputedStyle(target).display; 219 if (currentDisplay === 'none') currentDisplay = displayValue; 220 target.style.display = currentDisplay; 221 let height = target.offsetHeight; 222 target.style.overflow = 'hidden'; 223 target.style.height = 0; 224 target.style.paddingTop = 0; 225 target.style.paddingBottom = 0; 226 target.style.marginTop = 0; 227 target.style.marginBottom = 0; 228 target.offsetHeight; 229 target.style.boxSizing = 'border-box'; 230 target.style.transitionProperty = 'height, margin, padding'; 231 target.style.transitionDuration = duration + 'ms'; 232 target.style.height = height + 'px'; 233 target.style.removeProperty('padding-top'); 234 target.style.removeProperty('padding-bottom'); 235 target.style.removeProperty('margin-top'); 236 target.style.removeProperty('margin-bottom'); 237 window.setTimeout(() => { 238 target.style.removeProperty('height'); 239 target.style.removeProperty('overflow'); 240 target.style.removeProperty('transition-duration'); 241 target.style.removeProperty('transition-property'); 242 // ScrollTrigger.refresh(); 243 }, duration); 244 } 245 const slideToggle = (target, duration = 500, displayValue = 'block') => { 246 if (window.getComputedStyle(target).display === 'none') { 247 return slideDown2(target, duration, displayValue); 248 } else { 249 return slideUp2(target, duration); 250 } 251 } 252 253 document.querySelectorAll("img").forEach(function(img) { 254 img.addEventListener("mousedown", function(event) { 255 event.preventDefault(); 256 }); 257 }); 258 259 //mask 260 const phoneInputs = document.querySelectorAll('[type="tel"]');
261 phoneInputs.forEach((phoneInput) => { 262 IMask(phoneInput, { 263 mask: '+{7} (000) 000-00-00', 264 prepare: function (appended, masked) { 265 if (appended === '8' && masked.value === '') { 266 return '7 '; 267 } 268 return appended; 269 }, 270 }); 271 }); 272 273 //scroll 274 const header = document.querySelector('header'); 275 276 function checkScroll() { 277 if (window.pageYOffset >= 2) { 278 header.classList.add('active'); 279 } else { 280 header.classList.remove('active'); 281 } 282 } 283 checkScroll(); 284 window.addEventListener('scroll', function() { 285 checkScroll(); 286 }); 287 288 289 // 290 const serviceItemsAnim = document.querySelectorAll('.service__item'); 291 292 if (serviceItemsAnim.length > 0) { 293 serviceItemsAnim.forEach(item => { 294 const hideBlock = item.querySelector('.service__info-hide'); 295 let hoverTimeout; 296 297 item.addEventListener('mouseenter', () => { 298 clearTimeout(hoverTimeout); 299 300 if (hideBlock.style.display !== 'flex') { 301 hoverTimeout = setTimeout(() => { 302 slideDown(hideBlock, 400, 'flex'); 303 }, 400); 304 } 305 }); 306 307 item.addEventListener('mouseleave', () => { 308 clearTimeout(hoverTimeout); 309 slideUp(hideBlock, 100); 310 }); 311 }); 312 } 313 314 // 315 const socialElements = document.querySelectorAll('.social__element'); 316 317 if (socialElements.length > 0) { 318 const setStyles = (el, styles) => { 319 for (let prop in styles) { 320 el.style[prop] = styles[prop]; 321 } 322 }; 323 324 socialElements.forEach(item => { 325 const hideBlock = item.querySelector('.social__element-info'); 326 const socialElementLink = item.querySelector('.social__element-link'); 327 const socialIco = item.querySelector('.social__item-ico'); 328 const socialDevice = item.querySelector('.social__device-item'); 329 330 item.addEventListener('mouseenter', () => { 331 socialElements.forEach(el => { 332 setStyles(el.querySelector('.social__element-info'), { bottom: "-5rem" }); 333 setStyles(el.querySelector('.social__element-link'), { paddingBottom: "0rem" }); 334 setStyles(el.querySelector('.social__item-ico'), { 335 width: "6.75rem", 336 height: "6.75rem", 337 top: "-1rem", 338 right: "1.5rem" 339 }); 340 setStyles(el.querySelector('.social__device-item'), { 341 opacity: 0 342 }); 343 }); 344 345 setStyles(hideBlock, { bottom: "1.5rem" }); 346 setStyles(socialElementLink, { paddingBottom: "11.75rem" }); 347 setStyles(socialIco, { 348 width: "21.875rem", 349 height: "21.875rem", 350 top: "0rem", 351 right: "6.5rem" 352 }); 353 setStyles(socialDevice, { 354 opacity: 1, 355 transform: "rotate(15deg)", 356 right: "3.5rem", 357 width: "12.35rem" 358 }); 359 }); 360 361 item.addEventListener('mouseleave', () => { 362 socialElements.forEach(el => { 363 setStyles(el.querySelector('.social__element-info'), { bottom: "1.5rem" }); 364 setStyles(el.querySelector('.social__element-link'), { paddingBottom: "9.75rem" }); 365 setStyles(el.querySelector('.social__item-ico'), { 366 width: "12.625rem", 367 height: "12.625rem", 368 top: "0rem", 369 right: "6.5rem" 370 }); 371 setStyles(el.querySelector('.social__device-item'), { 372 opacity: 1, 373 transform: "rotate(-15deg)", 374 right: "1rem", 375 width: "9.35rem" 376 }); 377 }); 378 }); 379 }); 380 } 381 382 383 // 384 gsap.registerPlugin(ScrollTrigger); 385 386 if (window.matchMedia("(min-width: 991px)").matches) { 387 388 389 const ctaLight1 = document.querySelector('.cta__car-light1'); 390 const ctaLight2 = document.querySelector('.cta__car-light2'); 391 // const otherPostBoxs = document.querySelectorAll('.other__post'); 392 const remToPx = rem => rem * parseFloat(getComputedStyle(document.documentElement).fontSize); 393 394 if(ctaLight1) { 395 ScrollTrigger.create({ 396 trigger: ctaLight2, 397 start: "bottom bottom", 398 end: "bottom bottom", 399 onEnter: () => ctaLight2.style.opacity = "1", 400 onLeaveBack: () => ctaLight2.style.opacity = "0", 401 toggleActions: "play none none reverse", 402 }); 403 404 405 ScrollTrigger.create({ 406 trigger: ctaLight1, 407 start: `bottom bottom+=${remToPx(14)}`, 408 end: `bottom bottom+=${remToPx(14)}`, 409 onEnter: () => ctaLight1.style.opacity = "1", 410 onLeaveBack: () => ctaLight1.style.opacity = "0", 411 toggleActions: "play none none reverse", 412 }); 413 } 414 415 // const faqBlock = document.querySelector('.faq__more-block'); 416 417 // if(faqBlock) {
418 // gsap.to(faqBlock, { 419 // y: -30, 420 // scrollTrigger: { 421 // trigger: faqBlock, 422 // pin: true, 423 // start: `top top+=${remToPx(10)}`, 424 // end: () => { 425 // const wrap = document.querySelector("[data-st3]"); 426 // return "+=" + (wrap.offsetHeight - faqBlock.offsetHeight + remToPx(1)); 427 // }, 428 // scrub: true, 429 // } 430 // }); 431 // } 432 433 // if (otherPostBoxs.length > 0) { 434 // otherPostBoxs.forEach((el) => { 435 // gsap.to(el, { 436 // y: -30, 437 // scrollTrigger: { 438 // trigger: el, 439 // pin: true, 440 // start: `top top+=${remToPx(10)}`, 441 // end: () => { 442 // const wrap = el.closest(".post__container"); 443 // if (!wrap) return "+=0"; 444 // 445 // const elOffsetTop = el.offsetTop; 446 447 // const maxScroll = wrap.offsetHeight - elOffsetTop - el.offsetHeight + remToPx(1); 448 449 // return "+=" + Math.max(maxScroll, 0); 450 // }, 451 // scrub: true, 452 // } 453 // }); 454 // }); 455 // } 456 } 457 458 // 459 let object = { 460 value: 1 461 }; 462 463 const marqueTrack = document.querySelector('.marquee_track'); 464 const marqueTrack2 = document.querySelector('.marquee_track2'); 465 466 let tl = gsap.timeline({ repeat: -1 }); 467 468 if(marqueTrack) { 469 tl.fromTo( 470 marqueTrack, 471 { 472 xPercent: 0 473 }, 474 { 475 xPercent: -50, 476 duration: 30, 477 ease: 'none' 478 } 479 ); 480 } 481 482 // 483 const heroTitle = document.querySelector('[data-hero="title"]'); 484 const heroLabel = document.querySelector('[data-hero="label"]'); 485 const heroBtn = document.querySelector('[data-hero="btn"]'); 486 const heroItems = document.querySelectorAll('[data-hero="item"]'); 487 488 // hero animate 489 if (heroTitle || heroLabel || heroBtn || heroItems.length) { 490 const tl = gsap.timeline(); 491 492 setTimeout(() => { 493 if (heroTitle) { 494 tl.fromTo(heroTitle, { y: 50, opacity: 0 }, { y: 0, opacity: 1, duration: 0.7 }); 495 } 496 497 if (heroLabel) { 498 tl.fromTo(heroLabel, { y: 20, opacity: 0 }, { y: 0, opacity: 1, duration: 0.5 }, "+=0.1"); 499 } 500 501 if (heroBtn) { 502 tl.fromTo(heroBtn, { y: 20, opacity: 0 }, { y: 0, opacity: 1, duration: 0.5 }, "+=0.2"); 503 } 504 505 if (heroItems.length) { 506 tl.fromTo(heroItems, { x: -30, opacity: 0 }, { x: 0, opacity: 1, duration: 0.5, stagger: 0.2 }, "-=0.2"); 507 } 508 }, delay); 509 } 510 511 function gsapAimates() { 512 const animationTrigger = document.querySelectorAll('[data-show]'); 513 514 if(animationTrigger.length > 0) { 515 animationTrigger.forEach(item => { 516 gsap.fromTo(item, { 517 y: 65, 518 opacity: 0 519 }, { 520 y: 0, 521 opacity: 1, 522 scrollTrigger: item, 523 scrub: true, 524 duration: 0.7 525 }); 526 }); 527 } 528 }; 529 530 gsapAimates(); 531 document.addEventListener('facetwp-loaded', function() { 532 gsapAimates(); 533 }); 534 535 536 537 // 538 let spaceBetweenRem; 539 let spaceBetweenRem2 = 0.25; 540 if (window.matchMedia("(max-width: 479px)").matches) { 541 spaceBetweenRem = 0.75; 542 } else if (window.matchMedia("(max-width: 991px)").matches) { 543 spaceBetweenRem = 1; 544 } else { 545 spaceBetweenRem = 1.5; 546 } 547 const spaceBetweenPixels = spaceBetweenRem * parseFloat(getComputedStyle(document.documentElement).fontSize); 548 const spaceBetweenPixels2 = spaceBetweenRem2 * parseFloat(getComputedStyle(document.documentElement).fontSize); 549 550 const totalSlidesField = document.querySelector('.service__slider [data-total]'); 551 const currentSlideField = document.querySelector('.service__slider [data-current]'); 552 const serviceSlider = new Swiper('.service__slider', { 553 // spaceBetween: spaceBetweenPixels, 554 navigation: { 555 nextEl: '.service__slider .next__slide', 556 prevEl: '.service__slider .prev__slide', 557 }, 558 loop: true, 559 effect: "fade", 560 fadeEffect: { 561 crossFade: true 562 }, 563 a11y: { 564 enabled: true, 565 slideRole: 'listitem' 566 }, 567 breakpoints: { 568 20: { 569 allowTouchMove: true, 570 }, 571 480: { 572 allowTouchMove: true, 573 }, 574 991: {
575 speed: 800, 576 allowTouchMove: false, 577 }, 578 }, 579 on: { 580 init: function () { 581 const total = this.slides.length; 582 const current = this.realIndex + 1; 583 584 totalSlidesField.textContent = total < 10 ? '0' + total : total; 585 currentSlideField.textContent = current < 10 ? '0' + current : current; 586 }, 587 slideChange: function () { 588 const current = this.realIndex + 1; 589 currentSlideField.textContent = current < 10 ? '0' + current : current; 590 } 591 } 592 593 }); 594 595 const gallerySlider = new Swiper('.gallery__slider', { 596 spaceBetween: spaceBetweenPixels2, 597 navigation: { 598 nextEl: '.gallery__slider .next__slide', 599 prevEl: '.gallery__slider .prev__slide', 600 }, 601 a11y: { 602 enabled: true, 603 slideRole: 'listitem' 604 }, 605 initialSlide: 1, 606 loop: true, 607 breakpoints: { 608 20: { 609 allowTouchMove: true, 610 }, 611 480: { 612 allowTouchMove: true, 613 }, 614 991: { 615 speed: 800, 616 allowTouchMove: false, 617 }, 618 }, 619 }); 620 621 const carSliderElement = document.querySelector('.car__slider'); 622 623 if (carSliderElement && carSliderElement.querySelectorAll('.swiper-slide').length > 0) { 624 const carSlider = new Swiper('.car__slider', { 625 spaceBetween: spaceBetweenPixels, 626 navigation: { 627 nextEl: '.next__slide.v3', 628 prevEl: '.prev__slide.v3', 629 }, 630 a11y: { 631 enabled: true, 632 slideRole: 'listitem' 633 }, 634 loop: false, 635 breakpoints: { 636 20: { 637 allowTouchMove: true, 638 slidesPerView: 1 639 }, 640 480: { 641 allowTouchMove: true, 642 slidesPerView: 2 643 }, 644 991: { 645 speed: 800, 646 allowTouchMove: false, 647 slidesPerView: 4, 648 slidesPerGroup: 2 649 }, 650 }, 651 }); 652 } 653 654
655 document.querySelectorAll('.car__slider').forEach(slider => { 656 if (slider.innerHTML.trim() === '') { 657 slider.closest('section').style.display = 'none'; 658 } 659 }); 660 661 const moreSlider = new Swiper('.more__slider', { 662 spaceBetween: spaceBetweenPixels, 663 navigation: { 664 nextEl: '.is__more .next__slide', 665 prevEl: '.is__more .prev__slide', 666 }, 667 a11y: { 668 enabled: true, 669 slideRole: 'listitem' 670 }, 671 loop: false, 672 breakpoints: { 673 20: { 674 allowTouchMove: true, 675 slidesPerView: 1 676 }, 677 480: { 678 allowTouchMove: true, 679 slidesPerView: 2 680 }, 681 991: { 682 speed: 800, 683 allowTouchMove: false, 684 slidesPerView: 3, 685 }, 686 }, 687 }); 688 689 //thumbnail slider 690 const thumbnailSlider = new Swiper(".thumbnail-slider", { 691 centeredSlides: true, 692 centeredSlidesBounds: true, 693 // freeMode: false, 694 watchSlidesVisibility: true, 695 watchSlidesProgress: true, 696 watchOverflow: true, 697 spaceBetween: spaceBetweenPixels2, 698 a11y: { 699 enabled: true, 700 slideRole: 'listitem' 701 }, 702 breakpoints: { 703 20 : { 704 direction: "horizontal", 705 slidesPerView: 6, 706 centeredSlides: false, 707 centeredSlidesBounds: false, 708 }, 709 480 : { 710 direction: "vertical", 711 slidesPerView: 7.15, 712 centeredSlides: true, 713 centeredSlidesBounds: true, 714 }, 715 991 : { 716 direction: "vertical", 717 slidesPerView: 6.5, 718 speed: 500, 719 } 720 } 721 }); 722 723 //product slider 724 const productSlider = new Swiper(".product-slider", { 725 speed: 500, 726 watchOverflow: true, 727 watchSlidesVisibility: true, 728 watchSlidesProgress: true, 729 preventInteractionOnTransition: true, 730 allowTouchMove: true, 731 effect: "fade", 732 fadeEffect: { 733 crossFade: true 734 }, 735 a11y: { 736 enabled: true, 737 slideRole: 'listitem' 738 }, 739 navigation: { 740 nextEl: '.thumbnail-slider .next__slide', 741 prevEl: '.thumbnail-slider .prev__slide', 742 }, 743 thumbs: { 744 swiper: thumbnailSlider 745 }, 746 keyboard: { 747 enabled: true, 748 }, 749 }); 750 751 752 753 // 754 const tabs = document.querySelectorAll('[data-tab="block"]'); 755 if (tabs.length > 0) {
756 tabs.forEach((element) => { 757 element.querySelectorAll('[data-tab="nav"]').forEach((element, index) => { 758 if (index == 0) { 759 element.classList.add("active"); 760 } 761 element.setAttribute("data-index", index); 762 }); 763 element.querySelectorAll('[data-tab="content-block"]').forEach((element, index) => { 764 element.querySelectorAll('[data-tab="content"]').forEach((element, index) => { 765 if (index == 0) { 766 element.style.display = "block"; 767 } 768 element.setAttribute("data-index", index); 769 }); 770 }); 771 772 const tabNavs = element.querySelectorAll('[data-tab="nav"]'); 773 const tabContents = element.querySelectorAll('[data-tab="content-block"]'); 774 775 tabNavs.forEach((tabNav) => { 776 tabNav.addEventListener("click", function () { 777 let navIndex = this.getAttribute("data-index"); 778 tabNavs.forEach((element) => { 779 element.classList.remove("active"); 780 }); 781 this.classList.add("active"); 782 783 tabContents.forEach((tabContent) => { 784 tabContent.querySelectorAll('[data-tab="content"]').forEach((el) => { 785 let contentIndex = el.getAttribute("data-index"); 786 if (contentIndex === navIndex) { 787 fadeIn(el, 500, "block"); 788 setTimeout(() => { 789 // ScrollTrigger.refresh(); 790 }, 100); 791 } else { 792 el.style.display = "none"; 793 } 794 }); 795 }); 796 }); 797 }); 798 }); 799 } 800 801 //faq 802 const questions = document.querySelectorAll('[data-faq="question"]'); 803 804 if(questions.length > 0) { 805 questions.forEach((question) => { 806 question.addEventListener("click", () => { 807 const clickedIco = question.querySelector('[data-faq="ico"]'); 808 const clickedAnswer = question.nextElementSibling; 809 810 clickedIco.classList.toggle('active'); 811 slideToggle(clickedAnswer, 300); 812 }); 813 }); 814 } 815 816 //show more 817 const divElement = document.querySelector('.seo-rich'); 818 const btnElement = document.querySelector('[more-btn]'); 819 const contentElements = divElement ? divElement.querySelectorAll('p, ul, ol, h2, h3, h4') : []; 820 821 822 if (contentElements.length <= 1) { 823 if (btnElement) { 824 btnElement.style.display = 'none'; 825 } 826 } 827 828 if (divElement) { 829 const btnText = btnElement.querySelector('.more-text'); 830 const btnIco = btnElement.querySelector('.btn__ico-more'); 831 btnElement.addEventListener('click', function() { 832 // ScrollTrigger.refresh(); 833 divElement.classList.toggle('show-all'); 834 835 if (divElement.classList.contains('show-all')) { 836 btnText.textContent = 'СвеÑнÑÑÑ'; 837 btnIco.classList.add('active'); 838 } else { 839 btnText.textContent = 'РазвеÑнÑÑÑ'; 840 btnIco.classList.remove('active'); 841 } 842 }); 843 } 844 845 846 847 848 const modalForms = document.querySelectorAll('.form__box'); 849 const formSuccess = document.querySelectorAll('.success__form'); 850 let isFancyboxClosing = false; 851 852 if(modalForms.length > 0) { 853 document.addEventListener('forms-after-send', function(event) { 854 isFancyboxClosing = true; 855 Fancybox.destroy(); 856 initFancybox(); 857 858 modalForms.forEach((form) => { 859 form.style.display = "none" 860 }) 861 formSuccess.forEach((success) => { 862 success.style.display = "flex" 863 }) 864 Fancybox.show([ 865 { 866 src: "#form", 867 }, 868 ]); 869 870 871 setTimeout(() => { 872 if (isFancyboxClosing) { 873 Fancybox.close(); 874 } 875 setTimeout(() => { 876 closeForms(); 877 }, 200) 878 }, 4500) 879 880 }); 881 } 882 883 function closeForms() { 884 formSuccess.forEach((success) => { 885 success.style.display = "none" 886 }) 887 modalForms.forEach((form) => { 888 form.style.display = "block" 889 }) 890 } 891 892 893 894 // 895 function initFancybox() { 896 Fancybox.bind('[data-fancybox]', { 897 Carousel: { 898 transition: "slide", 899 }, 900 on: { 901 close: () => { 902 closeForms(); 903 isFancyboxClosing = true; 904 }, 905 ready: () => { 906 isFancyboxClosing = false; 907 }, 908 reveal: (fancybox, slide) => { 909 setTimeout(() => { 910 // ScrollTrigger.refresh(); 911 }, 100); 912 }, 913 destroy: (fancybox) => { 914 setTimeout(() => { 915 // ScrollTrigger.refresh(); 916 }, 100); 917 } 918 }, 919 l10n: { 920 CLOSE: "ÐакÑÑÑÑ", 921 NEXT: "СледÑÑÑее", 922 PREV: "ÐÑедÑдÑÑее", 923 ERROR: "Ðе ÑдалоÑÑ Ð·Ð°Ð³ÑÑзиÑÑ ÐºÐ¾Ð½ÑенÑ. ÐожалÑйÑÑа, попÑобÑйÑе позже.", 924 PLAY_START: "ÐаÑаÑÑ ÑлайдÑоÑ", 925 PLAY_STOP: "ÐÑÑановиÑÑ ÑлайдÑоÑ", 926 FULL_SCREEN: "ÐолноÑкÑаннÑй Ñежим", 927 THUMBS: "ÐиниаÑÑÑÑ", 928 DOWNLOAD: "СкаÑаÑÑ", 929 SHARE: "ÐоделиÑÑÑÑ", 930 ZOOM: "УвелиÑиÑÑ" 931 } 932 933 }); 934 } 935 initFancybox(); 936 937 938 939 // click handler 940 const bodyElement = document.querySelector("body"); 941 const navBtn = document.querySelector("[data-nav='btn']"); 942 const navWrapper = document.querySelector("[data-nav='wrap']"); 943 const navBg = document.querySelector(".nav__bg-closer"); 944 const filterWrap = document.querySelector('[data-filter="wrap"]'); 945 const filterBox = document.querySelector('[data-filter="box"]'); 946 947 let navChecker = 0; 948 let filterChecker = 0; 949 let lastClickTime = 0; 950 951 952 document.body.addEventListener("click", function(event) { 953 const now = new Date().getTime(); 954 const timeSinceLastClick = now - lastClickTime; 955 956 if (timeSinceLastClick < 700) { 957 return; 958 } 959 960 lastClickTime = now; 961 962 let target = event.target; 963 while (target !== document.body) { 964 if (target.dataset.action) { 965 const actionType = target.dataset.action; 966 967 if (actionType == "nav") { 968 969 if (window.matchMedia("(min-width: 991px)").matches) { 970 if (navChecker == 0) { 971 bodyElement.classList.add("overflow"); 972 navBtn.classList.add('menu-on'); 973 fadeIn(navBg, 400, 'block'); 974 header.classList.add('is__nav'); 975 setTimeout( function() { 976 slideDown(navWrapper, 400, 'block'); 977 }, 300) 978 navChecker = 1; 979 } else { 980 bodyElement.classList.remove("overflow"); 981 navBtn.classList.remove('menu-on'); 982 slideUp(navWrapper, 400); 983 fadeOut(navBg, 400); 984 setTimeout( function() { 985 header.classList.remove('is__nav'); 986 }, 300) 987 navChecker = 0; 988 } 989 } else { 990 if (navChecker == 0) { 991 bodyElement.classList.add("overflow"); 992 navBtn.classList.add('menu-on'); 993 fadeIn(navBg, 400, 'block'); 994 setTimeout( function() { 995 navWrapper.classList.add('active'); 996 }, 350) 997 navChecker = 1; 998 } else { 999 bodyElement.classList.remove("overflow"); 1000 navBtn.classList.remove('menu-on'); 1001 navWrapper.classList.remove('active'); 1002 setTimeout( function() { 1003 fadeOut(navBg, 400); 1004 }, 350) 1005 navChecker = 0; 1006 } 1007 } 1008 1009 } else if (actionType == "filter") { 1010 if (window.matchMedia("(max-width: 991px)").matches) { 1011 if (filterChecker == 0) { 1012 bodyElement.classList.add("overflow"); 1013 fadeIn(filterWrap, 400, 'block'); 1014 setTimeout( function() { 1015 filterBox.classList.add('active'); 1016 }, 350) 1017 filterChecker = 1; 1018 } else { 1019 bodyElement.classList.remove("overflow"); 1020 filterBox.classList.remove('active'); 1021 setTimeout( function() { 1022 fadeOut(filterWrap, 400); 1023 }, 350) 1024 filterChecker = 0; 1025 } 1026 } 1027 } 1028 1029 return; 1030 } 1031 target = target.parentNode; 1032 } 1033 }); 1034 1035 1036 // 1037 const footerLottie = document.querySelector(".pb__logo");
1038 if(footerLottie) { 1039 var animationSuccess = bodymovin.loadAnimation({ 1040 container: footerLottie, 1041 renderer: "svg", 1042 loop: true, 1043 autoplay: true, 1044 path: "/wp-content/themes/lixiang/json/logo.json" 1045 }); 1046 } 1047 1048 // selects 1049 const selects = document.querySelectorAll('[data-select="wrap"]'); 1050 1051 function closeAllSelects(except = null) { 1052 selects.forEach(select => { 1053 if (select === except) return; 1054 const box = select.querySelector('[data-select="box"]'); 1055 const listWrap = select.querySelector('[data-select="list"]'); 1056 if (box && listWrap && box.classList.contains('active')) { 1057 box.classList.remove('active'); 1058 slideUp(listWrap, 150); 1059 } 1060 }); 1061 } 1062 1063 selects.forEach(select => { 1064 const box = select.querySelector('[data-select="box"]'); 1065 const listWrap = select.querySelector('[data-select="list"]'); 1066 const current = select.querySelector('[data-current="value"]'); 1067 const links = select.querySelectorAll('[data-select="link"]'); 1068 1069 if (!box || !listWrap || !current || links.length === 0) return; 1070 1071 let closeTimeout = null; 1072 1073 box.addEventListener('click', e => { 1074 e.stopPropagation(); 1075 const willBeActive = !box.classList.contains('active'); 1076 closeAllSelects(willBeActive ? select : null); 1077 1078 if (willBeActive) { 1079 box.classList.add('active'); 1080 slideDown(listWrap, 200, 'block'); 1081 } else { 1082 box.classList.remove('active'); 1083 slideUp(listWrap, 150); 1084 } 1085 }); 1086 1087 links.forEach(link => { 1088 link.addEventListener('click', e => { 1089 e.stopPropagation(); 1090 links.forEach(l => l.classList.remove('active')); 1091 link.classList.add('active'); 1092 1093 let text = link.textContent.trim(); 1094 if (current.hasAttribute('data-char-limit')) { 1095 const limit = Number(current.getAttribute('data-char-limit')) || 15; 1096 if (text.length > limit) { 1097 text = text.substring(0, limit).trim() + 'â¦'; 1098 } 1099 } 1100 1101 current.textContent = text; 1102 box.classList.remove('active'); 1103 slideUp(listWrap, 150); 1104 }); 1105 }); 1106 1107 select.addEventListener('mouseenter', () => { 1108 if (closeTimeout) { 1109 clearTimeout(closeTimeout); 1110 closeTimeout = null; 1111 } 1112 }); 1113 1114 select.addEventListener('mouseleave', () => { 1115 if (!box.classList.contains('active')) return; 1116 closeTimeout = setTimeout(() => { 1117 if (box.classList.contains('active')) { 1118 box.classList.remove('active'); 1119 slideUp(listWrap, 150); 1120 } 1121 }, 120); 1122 }); 1123 }); 1124 1125 document.addEventListener('click', e => { 1126 const clickedInside = Array.from(selects).some(select => select.contains(e.target)); 1127 if (!clickedInside) { 1128 closeAllSelects(); 1129 } 1130 }); 1131 1132 const srt = document.querySelector('.service__slider .swiper-wrapper'); 1133 1134 1135 if(srt) { 1136 srt.removeAttribute('role'); 1137 } 1138 1139});
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.