1const navBar = () => { 2 // const buttonCalculate = document.querySelector('[data-nav-bar="calculate"]') 3 const buttonScrollTop = document.querySelector('[data-nav-bar="scroll-top"]') 4 const buttonCallMe = document.querySelector('[data-nav-bar="call-me"]') 5 6 // console.log(buttonCalculate) 7 // console.log(buttonScrollTop) 8 // console.log(buttonCallMe) 9 10 if (!buttonScrollTop || !buttonCallMe) return 11 // 12 // buttonCalculate.addEventListener('click', () => { 13 // if (window.marquizWidget) { 14 // window.marquizWidget.open() 15 // } 16 // }) 17 18 buttonScrollTop.addEventListener('click', () => { 19 window.scrollTo({ 20 top: 0, 21 behavior: 'smooth', 22 }) 23 }) 24 25 buttonCallMe.addEventListener('click', () => { 26 const popupButton = document.querySelector('[data-popup="request-call"]') 27 28 if (popupButton) popupButton.click() 29 }) 30} 31 32const hiddenPromo = () => { 33 const promo = document.querySelector('[data-promo]') 34 35 if (!promo) return 36 37 const mobileNav = document.querySelector('[data-mobile-nav]') 38 39 let lastScroll = 0 40 41 window.addEventListener('scroll', () => { 42 const currentScroll = window.scrollY 43 44 if (currentScroll > 50) { 45 promo.classList.add('is-hidden') 46 mobileNav.classList.add('is-hidden') 47 } else { 48 promo.classList.remove('is-hidden') 49 mobileNav.classList.remove('is-hidden') 50 } 51 52 lastScroll = currentScroll 53 }) 54} 55 56$(document).ready(function () { 57 navBar() 58 hiddenPromo() 59 // header 60 function header() { 61 $(".header__burger").on("click", function (e) { 62 e.preventDefault(); 63 var $header = $(this).parents(".header"); 64 var $headerBurgerCount = $(this).find('.header__burger-count'); 65 66 if ($header.hasClass("is-menu")) { 67 $header.removeClass("is-menu is-nav"); 68 $headerBurgerCount.removeClass('hidden'); 69 } else { 70 $header.addClass("is-menu"); 71 $headerBurgerCount.addClass('hidden'); 72 } 73 }); 74 75 $(".header__menu-nav").on("click", function (e) { 76 e.preventDefault(); 77 $(this).parents(".header").addClass("is-nav"); 78 }); 79 80 $(".header__nav-menu").on("click", function (e) { 81 e.preventDefault(); 82 $(this).parents(".header").removeClass("is-nav"); 83 }); 84 85 $(window).on("resize", function () { 86 var wWidth = $(window).width(); 87 88 if (wWidth >= 900) { 89 $(".header.is-menu").removeClass("is-menu is-nav"); 90 } 91 }); 92 } 93 94 // main-slider 95 function mainSlider() { 96 if (!$(".main-slider").length) { 97 return; 98 } 99 100 var mainSlider = null; 101 var sliderType = null; 102 103 function initMainSlider() { 104 var wWidth = $(window).width(); 105 106 if (wWidth < 900 && sliderType !== "mobile") { 107 if (mainSlider) { 108 mainSlider.destroy(); 109 mainSlider = null; 110 } 111 112 mainSlider = new Swiper(".main-slider", { 113 pagination: { 114 el: ".swiper-pagination", 115 type: "bullets", 116 }, 117 threshold: 20, 118 breakpointsInverse: true, 119 breakpoints: { 120 500: { 121 slidesPerView: 2, 122 spaceBetween: 20, 123 }, 124 }, 125 }); 126 127 sliderType = "mobile"; 128 } else if (wWidth >= 900 && sliderType !== "desktop") { 129 if (mainSlider) { 130 mainSlider.destroy(); 131 mainSlider = null; 132 } 133 134 mainSlider = new Swiper(".main-slider", { 135 navigation: { 136 prevEl: ".main-slider__prev", 137 nextEl: ".main-slider__next", 138 }, 139 pagination: { 140 el: ".swiper-pagination", 141 type: "bullets", 142 clickable: true, 143 }, 144 loop: true, 145 loopedSlides: 3, 146 speed: 0, 147 threshold: 20, 148 virtualTranslate: true, 149 }); 150 151 sliderType = "desktop"; 152 } 153 } 154 155 initMainSlider(); 156 157 $(window).on("resize", initMainSlider); 158 } 159 160 // badge 161 function badge() { 162 $(".badge__color").on("click", function () { 163 var $this = $(this); 164 var $colors = $this.siblings(".badge__color"); 165 var color = $this.css("background-color"); 166 167 $colors.removeClass("is-active"); 168 $this.addClass("is-active"); 169 $this.parents(".badge").find(".badge__image-bg").css("background-color", color); 170 }); 171 } 172 173 // advantages 174 function advantages() { 175 if (!$(".advantages__items").length) { 176 return; 177 } 178 179 var advantagesSlider = null; 180 181 function initAdvantagesSlider() { 182 var wWidth = $(window).width(); 183 184 if ($(".advantages__items").length) { 185 if (wWidth < 600 && !advantagesSlider && $(".advantages__items").length) { 186 advantagesSlider = new Swiper(".advantages__items", { 187 wrapperClass: "advantages__wrapper", 188 slideClass: "advantages__col", 189 pagination: { 190 el: ".advantages__pagination", 191 type: "bullets", 192 }, 193 // thumbs: { 194 // swiper: swiper, 195 // }, 196 autoHeight: true, 197 }); 198 } else if (wWidth >= 600 && advantagesSlider) { 199 advantagesSlider.destroy(); 200 advantagesSlider = null; 201 } 202 } 203 204 205 } 206 207 initAdvantagesSlider(); 208 209 $(window).on("resize", function () { 210 initAdvantagesSlider(); 211 }); 212 } 213 214 // filter-menu 215 function filterMenu() { 216 if (!$(".filter-menu").length) { 217 return; 218 } 219 220 $(".filter-menu__select").on("click", function (e) { 221 e.stopPropagation(); 222 223 $(this).parents(".filter-menu").toggleClass("is-active"); 224 }); 225 226 $(".filter-menu__item").on("click", function (e) { 227 if (this.closest(".vacancy-block")) { 228 e.preventDefault(); 229 } 230 231 var $this = $(this); 232 var $items = $this.siblings(".filter-menu__item"); 233 var $elements = $("[data-filter]"); 234 var $target = $('[data-filter="' + $this.attr("data-target") + '"]'); 235 const current = $(".filter-menu__current"); 236 current.text($this.text()); 237 238 $items.removeClass("is-selected"); 239 $this.addClass("is-selected"); 240 $elements.removeClass("is-active"); 241 $target.addClass("is-active"); 242 }); 243 244 $(document).on("click", function () { 245 $(".filter-menu").removeClass("is-active"); 246 }); 247 248 $(window).on("resize", function () { 249 var wWidth = $(window).width(); 250 251 if (wWidth >= 600) { 252 $(".filter-menu.is-active").removeClass("is-active"); 253 } 254 }); 255 } 256 257 // catalog-card 258 function catalogCard() { 259 if (!$(".catalog-card__slider").length) return; 260 261 var catalogCardSlider = new Swiper(".catalog-card__slider", { 262 lazy: true, 263 loop: true, 264 navigation: { 265 prevEl: ".swiper-button-prev", 266 nextEl: ".swiper-button-next", 267 }, 268 pagination: { 269 el: ".swiper-pagination", 270 type: "bullets", 271 }, 272 on: { 273 slideChange: function () { 274 $(this.el).parents('.catalog-card').trigger('watch'); 275 } 276 } 277 }); 278 } 279 280 // kitchen-slider 281 function kitchenSlider() { 282 if (!$(".kitchen-slider").length) { 283 return; 284 } 285 286 var kitchenSlider = new Swiper(".kitchen-slider", { 287 lazy: true, 288 loop: true, 289 navigation: { 290 prevEl: ".swiper-button-prev", 291 nextEl: ".swiper-button-next", 292 }, 293 pagination: { 294 el: ".swiper-pagination", 295 type: "bullets", 296 }, 297 }); 298 299 $(".kitchen-slider").magnificPopup({ 300 delegate: ".kitchen-slider__zoom", 301 type: "image", 302 closeBtnInside: false, 303 gallery: { 304 enabled: true, 305 tCounter: "", 306 }, 307 zoom: { 308 enabled: true, 309 }, 310 }); 311 } 312 function kitchenSlider2() { 313 if (!$(".kitchen-slider2").length) { 314 return; 315 } 316 317 const additionalKitchenSlider = new Swiper('.js-slider-additional', { 318 loop: true, 319 slidesPerView: 7, 320 spaceBetween: 5, 321 freeMode: true, 322 watchSlidesProgress: true, 323 lazy: { 324 loadPrevNextAmount: 2, 325 }, 326 breakpoints: { 327 360: { 328 slidesPerView: 3, 329 }, 330 640: { 331 slidesPerView: 3 332 }, 333 900: { 334 slidesPerView: 5 335 } 336 } 337 })
338 const kitchenSlider2 = new Swiper('.kitchen-slider2', { 339 loop: true, 340 lazy: { 341 loadPrevNextAmount: 2, 342 }, 343 navigation: { 344 prevEl: ".swiper-button-prev", 345 nextEl: ".swiper-button-next", 346 }, 347 thumbs: { 348 swiper: additionalKitchenSlider, 349 }, 350 } 351 ) 352 353 354 $(".kitchen-slider2").magnificPopup({ 355 delegate: ".kitchen-slider__zoom", 356 type: "image", 357 closeBtnInside: false, 358 gallery: { 359 enabled: true, 360 tCounter: "", 361 }, 362 zoom: { 363 enabled: true, 364 } 365 }); 366 } 367 368 // kitchen-badge 369 function kitchenBadge() { 370 if (!$(".kitchen-badge").length && !$(".in-price").length) { 371 return; 372 } 373 374 var isHidden = false; 375 376 function initBadge() { 377 var scrollTop = $(window).scrollTop(); 378 var scrollTarget = $(".in-price").offset().top - 200; 379 380 if (scrollTop >= scrollTarget && !isHidden) { 381 $(".kitchen-badge").addClass("is-hidden"); 382 isHidden = true; 383 } else if (scrollTop < scrollTarget && isHidden) { 384 $(".kitchen-badge").removeClass("is-hidden"); 385 isHidden = false; 386 } 387 } 388 389 initBadge(); 390 391 $(window).on("scroll", function () { 392 initBadge(); 393 }); 394 } 395 396 // colors-textures 397 function colorsTextures() { 398 if (!$(".colors-textures__items").length) { 399 return; 400 } 401 402 var ctSlider = null; 403 404 function initCtSlider() { 405 var wWidth = $(window).width(); 406 407 if (wWidth < 960 && !ctSlider && $(".colors-textures__items").length) { 408 ctSlider = new Swiper(".colors-textures__items", { 409 init: false, 410 wrapperClass: "colors-textures__items-wrapper", 411 slideClass: "colors-textures__item", 412 slideActiveClass: "is-active", 413 slideToClickedSlide: true, 414 slidesPerView: "auto", 415 centeredSlides: true, 416 loop: true, 417 loopedSlides: 11, 418 }); 419 420 function changeColor() { 421 var $slider = $(ctSlider.el); 422 var $block = $slider.parents(".colors-textures"); 423 var activeColor = $slider 424 .find(".colors-textures__item.is-active") 425 .css("background-color"); 426 $block.find(".colors-textures__image img").css("background-color", activeColor); 427 } 428 429 ctSlider.on("init, slideChangeTransitionEnd", changeColor); 430 ctSlider.init(); 431 } else if (wWidth >= 960 && ctSlider) { 432 ctSlider.destroy(true, false); 433 ctSlider = null; 434 $(".colors-textures__items-wrapper").removeAttr("style"); 435 } 436 } 437 438 initCtSlider(); 439 440 $(window).on("resize", function () { 441 initCtSlider(); 442 }); 443 444 $(".colors-textures__item").on("click", function () { 445 var wWidth = $(window).width(); 446 var $this = $(this); 447 var $block = $this.parents(".colors-textures"); 448 449 if (wWidth >= 960) { 450 $this.siblings(".is-active").removeClass("is-active"); 451 $this.addClass("is-active"); 452 453 var activeColor = $this.css("background-color"); 454 $block.find(".colors-textures__image img").css("background-color", activeColor); 455 } 456 }); 457 } 458 459 // kitchen-layout 460 function kitchenLayout() { 461 $(".kitchen-layout__icon").on("click", function () { 462 var $this = $(this); 463 var $layout = $this.parents(".kitchen-layout"); 464 var targetIndex = $this.attr("data-index"); 465 466 if (!$this.hasClass("is-active")) {
467 $layout.find(".is-active[data-index]").removeClass("is-active"); 468 $layout.find('[data-index="' + targetIndex + '"]').addClass("is-active"); 469 $layout 470 .find(".kitchen-layout__wrapper") 471 .css("transform", "translateX(-" + targetIndex * 100 + "%"); 472 } 473 }); 474 } 475 476 // parts 477 function parts() { 478 $(".parts [data-tab]").on("click", function (e) { 479 e.preventDefault(); 480 var $this = $(this); 481 var $parts = $this.parents(".parts"); 482 var targetIndex = $this.attr("data-tab"); 483 484 if (!$this.hasClass("is-active")) { 485 $parts.find(".parts__tab.is-active").removeClass("is-active"); 486 $parts.find('.parts__tab[data-tab="' + targetIndex + '"]').addClass("is-active"); 487 $parts.find(".parts__wrapper").css("transform", "translateX(-" + targetIndex * 100 + "%"); 488 } 489 }); 490 } 491 492 // module-loop 493 function moduleLoop() { 494 if (!$(".module-loop__items").length) { 495 return; 496 } 497 498 var moduleLoopSlider = null; 499 500 function initModuleLoopSlider() { 501 var wWidth = $(window).width(); 502 503 if (wWidth < 700 && !moduleLoopSlider && $(".module-loop__items").length) { 504 moduleLoopSlider = new Swiper(".module-loop__items", { 505 wrapperClass: "module-loop__items-wrapper", 506 slideClass: "module-loop__item", 507 pagination: { 508 el: ".module-loop__pagination", 509 type: "bullets", 510 }, 511 }); 512 } else if (wWidth >= 700 && moduleLoopSlider) { 513 moduleLoopSlider.destroy(); 514 moduleLoopSlider = null; 515 } 516 } 517 518 initModuleLoopSlider(); 519 520 $(window).on("resize", function () { 521 initModuleLoopSlider(); 522 }); 523 } 524 525 // details-header 526 function detailsHeader() { 527 if (!$(".details-header").length && !$(".in-price").length) { 528 return; 529 } 530 531 var isActive = false; 532 533 function initHeader() { 534 var scrollTop = $(window).scrollTop(); 535 var scrollTarget = $(".in-price").offset().top - 200; 536 537 if (scrollTop >= scrollTarget && !isActive) { 538 $(".details-header").addClass("is-active"); 539 isActive = true; 540 } else if (scrollTop < scrollTarget && isActive) { 541 $(".details-header").removeClass("is-active"); 542 isActive = false; 543 } 544 } 545 546 initHeader(); 547 548 $(window).on("scroll", function () { 549 initHeader(); 550 }); 551 } 552 553 // dropdown-block 554 function dropdownBlock() { 555 $(".dropdown-block__title, .closet_dropdown-block__title").on("click", function () { 556 var $dropdown = $(this).parents(".dropdown-block, .closet_dropdown-block"); 557 var $wrapper = $dropdown.find(".dropdown-block__wrapper, .closet_dropdown-block__wrapper"); 558 559 $wrapper.slideToggle(); 560 $dropdown.toggleClass("is-active"); 561 }); 562 } 563 564 // tab 565 function tab() { 566 $(".tab__label").on("click", function () { 567 var $this = $(this); 568 569 if (!$this.hasClass("is-active")) { 570 var $tab = $this.parents(".tab"); 571 var target = $this.attr("data-tab"); 572 var $currentTab = $tab.find(".tab__container.is-active"); 573 var $targetTab = $tab.find('.tab__container[data-tab="' + target + '"]'); 574 575 $this.siblings(".is-active").removeClass("is-active"); 576 $this.addClass("is-active"); 577 $currentTab.removeClass("is-active"); 578 $targetTab.addClass("is-active"); 579 } 580 }); 581 } 582 583 // vacancy-item 584 function vacancyItem() { 585 var isActive = false; 586 587 $(".vacancy-item__link").on("click", function (e) { 588 e.preventDefault(); 589 590 if ($(window).width() < 700) { 591 e.stopImmediatePropagation(); 592 var $add = $(this).parents(".vacancy-item").find(".vacancy-item__add"); 593 594 $add.slideToggle(); 595 isActive = !isActive; 596 } else { 597 var $vacancyItem = $(this).parents(".vacancy-item"); 598 var title = $vacancyItem.find(".vacancy-item__title").text(); 599 var $details = $vacancyItem.find(".vacancy-detail
599s").clone(); 600 var $vacancyBlank = $('.popup-blank[data-id="vacancy"]'); 601 602 $vacancyBlank.find(".popup-blank__title").text(title); 603 $vacancyBlank.find(".popup-blank__vacancy").empty().append($details); 604 } 605 }); 606 607 $(window).on("resize", function () { 608 if ($(window).width() >= 700 && isActive) { 609 $(".vacancy-item__add").slideUp(); 610 isActive = false; 611 } 612 }); 613 } 614 615 // subscribe 616 function subscribe() { 617 if (!$(".subscribe__field[data-sm][data-lg]").length) { 618 return; 619 } 620 621 function setPlaceholder() { 622 var wWidth = $(window).width(); 623 var $field = $(".subscribe__field[data-sm][data-lg]"); 624 var placeholder = wWidth < 700 ? $field.attr("data-sm") : $field.attr("data-lg"); 625 626 $field.attr("placeholder", placeholder); 627 } 628 629 setPlaceholder(); 630 631 $(window).on("resize", setPlaceholder); 632 } 633 634 // video 635 function video() { 636 $(document).on("click", "[data-video-desktop]", function (e) { 637 e.preventDefault(); 638 var $this = $(this); 639 var videoSrc = 640 window.innerWidth >= 900 641 ? $this.attr("data-video-desktop") 642 : $this.attr("data-video-mobile"); 643 var $video = $(".video"); 644 var scrollbarWidth = window.innerWidth - document.documentElement.clientWidth; 645 646 $("body").css({ 647 overflow: "hidden", 648 paddingRight: scrollbarWidth + "px", 649 }); 650 $(".details-header").css({ 651 right: scrollbarWidth + "px", 652 }); 653 $this.addClass("is-hidden"); 654 $video.show(); 655 $video.find(".video__media").attr("src", videoSrc)[0].play(); 656 657 setTimeout(function () { 658 $video.addClass("is-active"); 659 }, 50); 660 }); 661 662 $(".video").on("click", function (e) { 663 e.preventDefault(); 664 var $this = $(this); 665 666 $this.removeClass("is-active").find(".video__media")[0].pause(); 667 668 setTimeout(function () { 669 $("body").css({ 670 overflow: "", 671 paddingRight: "", 672 }); 673 $(".details-header").css({ 674 right: "", 675 }); 676 $("[data-video]").removeClass("is-hidden"); 677 $this.hide(); 678 }, 400); 679 }); 680 681 $(".video__media").on("click", function (e) { 682 e.stopPropagation(); 683 }); 684 } 685 686 // popup 687 function popup() { 688 $(document).on("click", "[data-popup]", function (e) { 689 e.preventDefault(); 690 var $this = $(this); 691 var blankId = $this.attr("data-popup"); 692 var $popup = $(".popup"); 693 var $targetBlank = $popup.find('[data-id="' + blankId + '"]'); 694 var scrollbarWidth = window.innerWidth - document.documentElement.clientWidth; 695 var page = location.href; 696 var dataId = $this.attr("data-id"); 697 var dataName = $this.attr("data-name"); 698 var dataImage = $this.attr("data-image"); 699 var dataPrice = $this.attr("data-price"); 700 var dataCategory = $this.attr("data-category"); 701 702 // var openEvent; 703 704 $("body").css({ 705 overflow: "hidden", 706 paddingRight: scrollbarWidth + "px", 707 }); 708 $(".details-header, .site-phone__container").css({ 709 right: scrollbarWidth + "px", 710 }); 711 $popup.show(); 712 $targetBlank.show(); 713 $targetBlank.find('[name="page"]').val(page); 714 $targetBlank.find('[name="item_id"]').val(dataId); 715 $targetBlank.find('[name="favorites_id"]').val(dataId); 716 $targetBlank.find('[name="item"]').val(dataName); 717 $targetBlank.find('[name="category"]').val(dataCategory); 718 $targetBlank.trigger('open'); 719 720 if (blankId === "order-card") { 721 $targetBlank.find(".order-card__model").text(dataName); 722 $targetBlank.find(".order-card__img").attr("src", dataImage); 723 $targetBlank.find(".order-card__price span").text(dataPrice); 724 } 725 726 setTimeout(function () { 727 $popup.addClass("is-active"); 728 }, 50); 729 730 // window.fbq && window.fbq('track', 'Lead', {content_name: 'micro'}) 731 // window.VK && window.VK.Goal('initiate_checkout') 732 // window.dataLayer = window.dataLayer || [] 733 // window.dataLayer.push({'event': openEvent}) 734 // window.dataLayer.push({'event': 'open_form'}) 735 }); 736 737 $(".popup").on("click", function (e) { 738 e.preventDefault(); 739 var $this = $(this); 740 var $activeBlank = $this.find(".popup-blank:visible"); 741 742 $this.removeClass("is-active"); 743 744 // console.log($this) 745 746 // if ($activeBlank.attr('data-id') === 'leadgen') { 747 // sessionStorage.setItem("leadgenClosed", "true"); 748 // } 749 750 setTimeout(function () { 751 $("body").css({ 752 overflow: "", 753 paddingRight: "", 754 }); 755 $(".details-header, .site-phone__container").css({ 756 right: "", 757 }); 758 $this.hide(); 759 $activeBlank.hide(); 760 $activeBlank.find('[name="page"]').val(""); 761 $activeBlank.find('[name="item_id"]').val(""); 762 $activeBlank.find('[name="favorites_id"]').val(""); 763 $activeBlank.find('[name="item"]').val(""); 764 }, 300); 765 }); 766 767 $(".popup-blank, .popup-additional, .order-card").on("click", function (e) { 768 e.stopPropagation(); 769 }); 770 } 771 772 // request-call 773 function requestCall() { 774 if (location.hash === "#request-call") { 775 $('[data-popup="request-call"]').first().trigger("click"); 776 } 777 } 778 779 // form-time-change 780 function formTimeChange() { 781 let timeInp = $(".form-time-change__fields input"); 782 timeInp.val(""); 783 784 $(".form-time-change__item").on("click", function () { 785 var $this = $(this); 786 var $items = $this.siblings(".form-time-change__item"); 787 var $fields = $this.parents(".form-time-change").find(".form-time-change__fields"); 788 var type = $this.attr("data-type"); 789 var inp = $fields.find(".form-item__field"); 790 791 $items.removeClass("is-active"); 792 $this.addClass("is-active"); 793 794 if (type === "show") { 795 $fields.show(); 796 inp.val("20:00"); 797 } else { 798 $fields.hide(); 799 inp.val(""); 800 } 801 }); 802 } 803 804 // price-calc 805 // function priceCalc() { 806 // $('.price-calc__radio input').on('change', function() { 807 // var $this = $(this); 808 // var type = $this.val(); 809 // var $sizes = $this.parents('.price-calc').find('.price-calc__sizes'); 810 811 // $sizes.attr('data-type', type); 812 // $sizes.find('input').each(function() { 813 // var $sizeInput = $(this); 814 // var typeArr = $sizeInput.attr('data-type') && $sizeInput.attr('data-type').split(', '); 815 // var isRequired = typeArr && typeArr.indexOf(type) > -1; 816 817 // $sizeInput.prop('required', isRequired); 818 // }); 819 // }); 820 // } 821 822 // attach-file 823 function attachFile() { 824 $(document).on("change", ".attach-file__input", function () { 825 var files = this.files; 826 827 $(this).parents(".attach-file").removeClass("is-error"); 828 829 if (files.length) { 830 var size = 0; 831 var name = ""; 832 833 for (var i = 0; i < files.length; i++) { 834 size += files[i].size; 835 836 if (size > 20 * 1024 * 1024) { 837 this.value = ""; 838 name = "ÐÑевÑÑен ÑÐ°Ð·Ð¼ÐµÑ (20 ÐÐ)"; 839 $(this).parents(".attach-file").addClass("is-error"); 840 break; 841 } 842 843 if (i > 0) { 844 name += ", "; 845 } 846 847 name += files[i].name; 848 } 849 850 $(this) 851 .parents(".attach-file") 852 .addClass("is-uploaded") 853 .find(".attach-file__name") 854 .text(name); 855 } else { 856 $(this) 857 .parents(".attach-file") 858 .removeClass("is-uploaded") 859 .find(".attach-file__name") 860 .text(""); 861 } 862 }); 863 } 864 865 // form 866 function form() { 867 function phoneMask(e) { 868 let val = e.target.value.replace(/\D/g, ""); 869 870 if (val) { 871 if (val[0] === "7" || val[0] === "8") { 872 val = val.slice(1); 873 } 874 875 val = val.match(/(\d{0,3})(\d{0,3})(\d{0,2})(\d{0,2})/); 876 val = 877 "+7" + 878 (val[1] ? " " + val[1] : "") + 879 (val[2] ? " " + val[2] : "") + 880 (val[3] ? "-" + val[3] : "") + 881 (val[4] ? "-" + val[4] : ""); 882 } 883 884 e.target.value = val; 885 } 886 887 $(document).on("input", '.js-form [type="tel"]', phoneMask); 888 } 889 890 // up-btn 891 function upBtn() { 892 var isVisible = false;
893 894 function initUpBtn() { 895 var scrollTop = $(window).scrollTop(); 896 897 if (scrollTop >= 350 && !isVisible) { 898 $(".up-btn").addClass("is-active"); 899 isVisible = true; 900 } else if (scrollTop < 350 && isVisible) { 901 $(".up-btn").removeClass("is-active"); 902 isVisible = false; 903 } 904 } 905 906 initUpBtn(); 907 908 $(window).on("scroll", function () { 909 initUpBtn(); 910 }); 911 912 $(".up-btn").on("click", function (e) { 913 e.preventDefault(); 914 915 $("html, body").animate( 916 { 917 scrollTop: 0, 918 }, 919 300 920 ); 921 }); 922 } 923 924 // browsing 925 function browsing() { 926 if (!$(".browsing").length) { 927 return; 928 } 929 930 var $browsing = $(".browsing"); 931 var $count = $browsing.find(".browsing__count"); 932 var from = +$browsing.attr("data-from"); 933 var to = +$browsing.attr("data-to"); 934 var current = null; 935 936 function decl(count, words) { 937 return words[ 938 count % 100 > 4 && count % 100 < 20 939 ? 2 940 : [2, 0, 1, 1, 1, 2][count % 10 < 5 ? count % 10 : 5] 941 ]; 942 } 943 944 function randomize() { 945 if (current) { 946 var count = Math.floor(Math.random() * 7 - 3); 947 current = count >= 0 ? Math.min(to, current + count) : Math.max(from, current + count); 948 } else { 949 current = Math.floor(Math.random() * (to - from + 1) + from); 950 } 951 952 $count.text(current + " " + decl(current, ["Ñеловек", "Ñеловека", "Ñеловек"])); 953 } 954 955 function run() { 956 var delay = Math.floor(Math.random() * 10000); 957 958 setTimeout(function () { 959 randomize(); 960 run(); 961 }, delay); 962 } 963 964 randomize(); 965 run(); 966 } 967 968 // product 969 function product() { 970 if (!$(".product").length) { 971 return; 972 } 973 974 var productSlider = new Swiper(".product__slider", { 975 navigation: { 976 prevEl: ".product__prev", 977 nextEl: ".product__next", 978 }, 979 pagination: { 980 el: ".product__pagination", 981 type: "bullets", 982 }, 983 resistanceRatio: 0, 984 on: { 985 init: function () { 986 var slidesLength = this.slides.length; 987 988 if (slidesLength > 1) { 989 $(this.el).addClass("is-slider"); 990 } 991 }, 992 }, 993 }); 994 995 // $('.product__zoom').on('click', function (e) { 996 // e.preventDefault(); 997 998 // var $product = $(this).parents('.product'); 999 // var $slides = $product.find('.product__image'); 1000 1001 // $product.toggleClass('is-zoomed'); 1002 // $slides.each(function () { 1003 // var $this = $(this); 1004 // var $img = $this.find('img') 1005 // var currImg = $img.attr('src'); 1006 // var newImg = $this.attr('data-zoom'); 1007 1008 // $img.attr('src', newImg); 1009 // $this.attr('data-zoom', currImg); 1010 // }); 1011 1012 // productSlider.update(); 1013 // }); 1014 1015 $(".product__slider").magnificPopup({ 1016 delegate: ".product__zoom", 1017 type: "image", 1018 closeBtnInside: false, 1019 gallery: { 1020 enabled: true, 1021 tCounter: "", 1022 }, 1023 }); 1024 } 1025 1026 // contacts 1027 function contacts() { 1028 if (!$(".contacts-city").length && !$("#map").length) { 1029 return; 1030 } 1031 1032 var coords = $("#map").attr("data-map").split(", "); 1033 1034 var $menu = $(".contacts-menu"); 1035 var $box = $(".contacts-menu__box"); 1036 var $title = $(".contacts-menu__title"); 1037 var $wrapper = $(".contacts-menu__wrapper"); 1038 var $items = $(".contacts-menu__item"); 1039 var $targetElements = $("[data-region]"); 1040 var isActive = false;
1041 1042 function initMap(coords) { 1043 $("#map").empty(); 1044 1045 ymaps.ready(function () { 1046 map = new ymaps.Map("map", { 1047 center: [+coords[0], +coords[1]], 1048 zoom: 12, 1049 controls: [], 1050 }); 1051 1052 var placemark = new ymaps.Placemark( 1053 map.getCenter(), 1054 { 1055 balloonContent: "Ðжедневно 9:00âââ22:00", 1056 }, 1057 { 1058 iconLayout: "default#image", 1059 iconImageHref: "/local/templates/kuhzavod/f/svg/icn-pin.svg", 1060 iconImageSize: [28, 41], 1061 iconImageOffset: [-14, -41], 1062 } 1063 ); 1064 // ÐбÑабаÑÑваем ÑобÑÑие оÑкÑÑÑÐ¸Ñ Ð±Ð°Ð»Ñна на геообÑекÑе: 1065 // наÑинаем загÑÑÐ·ÐºÑ Ð´Ð°Ð½Ð½ÑÑ , заÑем обновлÑем его ÑодеÑжимое. 1066 placemark.events.add("balloonopen", function (e) { 1067 placemark.properties.set("balloonContent", "ÐÐ´ÐµÑ Ð·Ð°Ð³ÑÑзка даннÑÑ ..."); 1068 ymaps 1069 .geocode(placemark.geometry.getCoordinates(), { 1070 results: 1, 1071 }) 1072 .then(function (res) { 1073 var newContent = res.geoObjects.get(0) 1074 ? res.geoObjects.get(0).properties.get("name") 1075 : "Ðе ÑдалоÑÑ Ð¾Ð¿ÑеделиÑÑ Ð°Ð´ÑеÑ."; 1076 1077 // Ðадаем новое ÑодеÑжимое балÑна в ÑооÑвеÑÑÑвÑÑÑее ÑвойÑÑво меÑки. 1078 placemark.properties.set("balloonContent", newContent); 1079 }) 1080 .catch((err) => { 1081 placemark.properties.set("balloonContent", `Ðе ÑдалоÑÑ Ð¿Ð¾Ð»ÑÑиÑÑ ÐºÐ¾Ð¾ÑдинаÑÑ`); 1082 }); 1083 }); 1084 map.geoObjects.add(placemark); 1085 }); 1086 } 1087 1088 function openMenu() { 1089 $menu.addClass("is-active"); 1090 $wrapper[0].style.height = $wrapper[0].scrollHeight + "px"; 1091 isActive = true; 1092 } 1093 1094 function closeMenu() { 1095 $menu.removeClass("is-active"); 1096 $wrapper[0].style.height = ""; 1097 isActive = false; 1098 } 1099 1100 function handleBoxClick() { 1101 if (isActive) { 1102 closeMenu(); 1103 } else { 1104 openMenu(); 1105 } 1106 } 1107 1108 function handleItemClick($el) { 1109 var $activeItem = $(".contacts-menu__item.is-active"); 1110 1111 coords = $el.data("map").split(", "); 1112 1113 $activeItem.removeClass("is-active"); 1114 $el.addClass("is-active"); 1115 $title.text($el.text()); 1116 closeMenu(); 1117 1118 $targetElements.each(function () { 1119 if ($(this).data("region") === $el.data("target")) { 1120 $(this).addClass("is-active"); 1121 } else { 1122 $(this).removeClass("is-active"); 1123 } 1124 }); 1125 1126 initMap(coords); 1127 } 1128 1129 function handleResize() { 1130 if (window.innerWidth >= 700 && isActive) { 1131 closeMenu(); 1132 } 1133 } 1134 1135 initMap(coords); 1136 1137 $box.on("click", handleBoxClick); 1138 1139 $items.on("click", function () { 1140 handleItemClick($(this)); 1141 }); 1142 1143 window.addEventListener("resize", handleResize); 1144 1145 $(".contacts__open-map").on("click", function () { 1146 $(this).parents(".contacts__map-wrapper").addClass("is-active"); 1147 initMap(coords); 1148 }); 1149 1150 $(".contacts__close-map").on("click", function () { 1151 $(this).parents(".contacts__map-wrapper").removeClass("is-active"); 1152 initMap(coords); 1153 }); 1154 } 1155 1156 const timeBox = () => { 1157 const button = document.getElementById('toggleButton'); 1158 const box = document.getElementById('timeBox'); 1159 1160 button.addEventListener('click', (e) => { 1161 box.classList.toggle('open'); 1162 e.target.classList.toggle('open'); 1163 }); 1164 1165 // new feature 1166 const buttons = document.querySelectorAll('.js-toggle-button'); 1167 1168 // console.log(buttons); 1169 1170 buttons.forEach((button) => { 1171 button.addEventListener('click', (_e) => { 1172 const box = button.parentElement.querySelector('.js-time-box'); 1173 box.classList.toggle('open'); 1174 button.classList.toggle('open'); 1175 }); 1176 }); 1177 } 1178 1179 const headerFixed = () => { 1180 const topMenu = document.querySelector('.header'); 1181 const content = document.querySelector('.wrap'); 1182 let lastScrollTop = 0; 1183 1184 const menuHeight = topMenu.clientHeight; 1185 content.style.marginTop = menuHeight + 'px'; 1186 1187 window.addEventListener('scroll', function () { 1188 let scrollTop = window.pageYOffset || document.documentElement.scrollTop; 1189 1190 if (scrollTop > lastScrollTop && distanceToMenuEnd > 0) { 1191 topMenu.style.top = '-' + menuHeight + 'px'; 1192 } else { 1193 topMenu.style.top = '0'; 1194 } 1195 1196 lastScrollTop = scrollTop; 1197 }); 1198 } 1199 1200 // pay 1201 function pay() { 1202 $(".pay__select").on("change", function () { 1203 var $this = $(this); 1204 var selectedOption = $this.find("option:selected"); 1205 var $payHidden = $this.parents(".pay").find(".pay__hidden"); 1206 var $payMessage = $this.parents(".pay").find(".pay__message"); 1207
1208 if (selectedOption.attr("data-details") !== undefined) { 1209 $payHidden.addClass("is-active"); 1210 $payMessage.removeClass("is-active"); 1211 } else { 1212 $payHidden.removeClass("is-active"); 1213 $payMessage.addClass("is-active"); 1214 } 1215 }); 1216 } 1217 1218 // ÐнимаÑÐ¸Ñ svg иконок (_NEW) 1219 function vivus() { 1220 const icons = document.querySelectorAll(".animate-svg"); 1221 icons.forEach((icon) => { 1222 new Vivus(`${icon.id}`, { type: "oneByOne", duration: 100 }); 1223 }); 1224 } 1225 1226 function sitePhone() { 1227 const chengeForm = (textAfter, textBefore) => { 1228 if (document.querySelector(".site-phone__list-container")) { 1229 const form = document.querySelector(".site-phone__list-container"); 1230 const btn = document.querySelector(".site-phone__change-btn"); 1231 1232 form.classList.contains("show") 1233 ? (btn.textContent = textAfter) 1234 : (btn.textContent = textBefore); 1235 form.classList.toggle("show"); 1236 } else { 1237 console.log("ÐÑибка пеÑеданнÑÑ Ð´Ð°Ð½Ð½ÑÑ "); 1238 } 1239 }; 1240 1241 const openForm = (openEl, closeEl) => { 1242 if (document.querySelector(`.${openEl}`) && document.querySelector(`.${closeEl}`)) { 1243 const block = document.querySelector(`.${openEl}`); 1244 const button = document.querySelector(`.${closeEl}`); 1245 1246 button.classList.add("hide"); 1247 block.classList.add("show"); 1248 } else { 1249 console.log("ÐÑибка пеÑеданнÑÑ Ð´Ð°Ð½Ð½ÑÑ "); 1250 } 1251 }; 1252 const closeForm = (openEl, closeEl) => { 1253 if (document.querySelector(`.${openEl}`) && document.querySelector(`.${closeEl}`)) { 1254 const block = document.querySelector(`.${openEl}`); 1255 const button = document.querySelector(`.${closeEl}`); 1256 1257 button.classList.remove("hide"); 1258 block.classList.remove("show"); 1259 } else { 1260 console.log("ÐÑибка пеÑеданнÑÑ Ð´Ð°Ð½Ð½ÑÑ "); 1261 } 1262 }; 1263 const resetSelect = (selectEl) => { 1264 if (document.querySelectorAll(`.${selectEl}`)) { 1265 const select = document.querySelectorAll(`.${selectEl}`); 1266 select.forEach((item) => { 1267 item.selectedIndex = 0; 1268 }); 1269 // Ð ÐµÐ½Ð´ÐµÑ Ð¿Ñи обнÑлении 1270 selectUnlock("select-day", "select-time"); 1271 } else { 1272 console.log("ÐÑибка пеÑеданнÑÑ Ð´Ð°Ð½Ð½ÑÑ "); 1273 } 1274 }; 1275 const selectUnlock = (selectFlag, selectСhangeable) => { 1276 if ( 1277 document.getElementById(`${selectFlag}`) && 1278 document.getElementById(`${selectСhangeable}`) 1279 ) { 1280 const selectFirst = document.getElementById(`${selectFlag}`); 1281 const selectSecond = document.getElementById(`${selectСhangeable}`); 1282 1283 selectFirst.selectedIndex !== 0 1284 ? (selectSecond.disabled = false) 1285 : (selectSecond.disabled = true); 1286 } else { 1287 console.log("ÐÑибка пеÑеданнÑÑ Ð´Ð°Ð½Ð½ÑÑ "); 1288 } 1289 }; 1290 1291 // document.querySelector(".site-phone__preview-btn").addEventListener("click", () => { 1292 // openForm("site-phone__container", "site-phone__preview-btn"); 1293 // }); 1294 1295 const sitePhoneBtn = document.querySelector(".site-phone__close-btn"); 1296 if(sitePhoneBtn){ 1297 sitePhoneBtn.addEventListener("click", () => { 1298 closeForm("site-phone__container", "site-phone__preview-btn"); 1299 }); 1300 1301 document.querySelector(".site-phone__change-btn").addEventListener("click", () => { 1302 chengeForm("ÐÑбеÑиÑе даÑÑ Ð¸ вÑeÐ¼Ñ Ð´Ð»Ñ Ð·Ð²Ð¾Ð½ÐºÐ°", "ÐозвониÑÑ ÑейÑаÑ"); 1303 resetSelect("site-phone__list"); 1304 }); 1305 } 1306 1307 const selectDay = document.getElementById("select-day"); 1308 if(selectDay){ 1309 selectDay.addEventListener("change", () => { 1310 selectUnlock("select-day", "select-time"); 1311 }); 1312 } 1313 } 1314 1315 function catalogMore() { 1316 if (!$(".catalog__btn").length) { 1317 return; 1318 } 1319 1320 var currentPage = 1; 1321 var autoLoad = 2; 1322 var isLoading = false;
1323 var $window = $(window); 1324 1325 function showMore() { 1326 currentPage++; 1327 isLoading = true; 1328 1329 var pageQuery = (location.search ? "&" : "?") + "PAGEN_5=" + currentPage; 1330 1331 $(".catalog__btn").before('<div class="catalog__more"></div>'); 1332 1333 $(".catalog__more").load( 1334 location.pathname + location.search + pageQuery + " .catalog__content", 1335 function () { 1336 $(".catalog__more").find(".catalog__btn, .catalog__paginator, .more-kitchens").remove(); 1337 $(".catalog__more .catalog__col").unwrap().unwrap(); 1338 1339 var pageCount = $(".catalog__btn").data("pcount"); 1340 1341 if (currentPage >= autoLoad && currentPage < pageCount) { 1342 $(".catalog__btn").addClass("active"); 1343 } else { 1344 $(".catalog__btn").removeClass("active"); 1345 } 1346 1347 var catalogCardSlider = new Swiper(".catalog-card__slider", { 1348 lazy: true, 1349 loop: true, 1350 navigation: { 1351 prevEl: ".swiper-button-prev", 1352 nextEl: ".swiper-button-next", 1353 }, 1354 pagination: { 1355 el: ".swiper-pagination", 1356 type: "bullets", 1357 }, 1358 on: { 1359 slideChange: function () { 1360 $(this.el).parents('.catalog-card').trigger('watch'); 1361 } 1362 } 1363 }); 1364 1365 isLoading = false; 1366 1367 $('.catalog__wrapper').trigger('showMore'); 1368 } 1369 ); 1370 1371 if (currentPage > autoLoad) { 1372 window.ym && ym(35801930, "reachGoal", "show_more"); 1373 window.yaCounter35801930 && yaCounter35801930.reachGoal("show_more"); 1374 } else { 1375 window.ym && ym(35801930, "reachGoal", "page_" + currentPage); 1376 window.yaCounter35801930 && yaCounter35801930.reachGoal("page_" + currentPage); 1377 } 1378 } 1379 1380 $window.on("scroll", function () { 1381 var pageCount = $(".catalog__btn").data("pcount"); 1382 1383 if ( 1384 $window.width() >= 900 || 1385 currentPage >= pageCount || 1386 currentPage >= autoLoad || 1387 isLoading 1388 ) { 1389 return; 1390 } 1391 1392 var $catalogContent = $(".catalog__content"); 1393 1394 if ( 1395 $window.scrollTop() + $window.height() * 2 > 1396 $catalogContent.offset().top + $catalogContent.height() 1397 ) { 1398 showMore(); 1399 } 1400 }); 1401 1402 $(document).on("click", ".catalog__btn", function () { 1403 showMore(); 1404 }); 1405 1406 $(".catalog__wrapper").on("ajaxLoad", function () { 1407 currentPage = 1; 1408 }); 1409 } 1410 1411 function favorites() { 1412 let favoritesCookie = getCookie("favorites"); 1413 let favoritesArr = favoritesCookie ? JSON.parse(favoritesCookie) : []; 1414 const favoritesCounts = document.querySelectorAll(".js-favorites-count"); 1415 1416 function initFavorites() { 1417 const favoriteBtns = document.querySelectorAll(".js-favorite"); 1418 1419 favoriteBtns.forEach((el) => { 1420 const id = +el.dataset.id; 1421 1422 if (favoritesArr.includes(id)) { 1423 el.classList.add("active"); 1424 } 1425 }); 1426 } 1427 1428 function initFavoritesCounts() { 1429 if (!favoritesArr.length) return; 1430 1431 favoritesCounts.forEach(el => { 1432 el.classList.add('active'); 1433 1434 if (el.dataset.change !== undefined && favoritesArr.length > 9) { 1435 el.querySelector("span").textContent = '9+'; 1436 } else { 1437 el.querySelector("span").textContent = favoritesArr.length; 1438 } 1439 }); 1440 } 1441 1442 function updateFavoritesCount(prevCount, nextCount) {
1443 favoritesCounts.forEach(el => { 1444 const isChangeable = el.dataset.change !== undefined; 1445 const changeUp = prevCount < nextCount; 1446 const changeDown = prevCount > nextCount; 1447 1448 if (isChangeable && (changeUp && prevCount > 0 || changeDown && nextCount > 0)) { 1449 el.classList.add('change'); 1450 setTimeout(() => el.classList.remove('change'), 300); 1451 } 1452 1453 if (nextCount > 0) { 1454 el.classList.add("active"); 1455 } else { 1456 el.classList.remove("active"); 1457 } 1458 1459 el.querySelector("span").textContent = isChangeable && nextCount > 9 ? '9+' : nextCount; 1460 }); 1461 } 1462 1463 initFavorites(); 1464 initFavoritesCounts(); 1465 1466 $(".catalog__wrapper").on("ajaxLoad", initFavorites); 1467 $(".catalog__wrapper").on("showMore", initFavorites); 1468 1469 document.addEventListener("click", (e) => { 1470 const favoriteBtn = e.target.closest(".js-favorite"); 1471 const favoritesPage = document.querySelector(".favorites"); 1472 const arrLength = favoritesArr.length; 1473 1474 if (!favoriteBtn) return; 1475 1476 const id = +favoriteBtn.dataset.id; 1477 1478 if (favoritesArr.includes(id)) { 1479 favoritesArr = favoritesArr.filter((item) => item !== id); 1480 favoriteBtn.classList.remove("active"); 1481 1482 if (favoritesPage) { 1483 const count = document.querySelector(".favorites-form__count"); 1484 const calcBtn = document.querySelector(".favorites-form__btn"); 1485 const empty = document.querySelector(".favorites__empty"); 1486 const content = document.querySelector(".favorites__content"); 1487 1488 favoriteBtn.closest(".favorites-card").remove(); 1489 count.textContent = 1490 favoritesArr.length + 1491 " " + 1492 declension(favoritesArr.length, [ 1493 "понÑавивÑийÑÑ Ð¿ÑоекÑ", 1494 "понÑавивÑÐ¸Ñ ÑÑ Ð¿ÑоекÑа", 1495 "понÑавивÑÐ¸Ñ ÑÑ Ð¿ÑоекÑов", 1496 ]); 1497 calcBtn.dataset.id = JSON.stringify(favoritesArr); 1498 1499 if (!favoritesArr.length) { 1500 content.classList.remove("active"); 1501 empty.classList.add("active"); 1502 } 1503 } 1504 } else { 1505 favoritesArr.push(id); 1506 favoriteBtn.classList.add("active"); 1507 window.ym && ym(35801930, "reachGoal", "add_favorites"); 1508 } 1509 1510 const newArrLength = favoritesArr.length; 1511 1512 favoritesCookie = JSON.stringify(favoritesArr); 1513 setCookie("favorites", favoritesCookie); 1514 1515 updateFavoritesCount(arrLength, newArrLength); 1516 }); 1517 } 1518 1519 function getCookie(name) { 1520 let matches = document.cookie.match( 1521 new RegExp("(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, "\\$1") + "=([^;]*)") 1522 ); 1523 return matches ? decodeURIComponent(matches[1]) : undefined; 1524 } 1525 1526 function setCookie(name, value, options = {}) { 1527 options = { 1528 path: "/", 1529 "max-age": 30 * 24 * 60 * 60, 1530 ...options, 1531 }; 1532 1533 if (options.expires instanceof Date) { 1534 options.expires = options.expires.toUTCString(); 1535 } 1536 1537 let updatedCookie = encodeURIComponent(name) + "=" + encodeURIComponent(value); 1538 1539 for (let optionKey in options) { 1540 updatedCookie += "; " + optionKey; 1541 let optionValue = options[optionKey]; 1542 if (optionValue !== true) { 1543 updatedCookie += "=" + optionValue; 1544 } 1545 } 1546 1547 document.cookie = updatedCookie; 1548 } 1549 1550 function declension(n, textForms) { 1551 n = Math.abs(n) % 100; 1552 var n1 = n % 10; 1553 1554 if (n > 10 && n < 20) { 1555 return textForms[2]; 1556 } 1557 if (n1 > 1 && n1 < 5) { 1558 return textForms[1]; 1559 } 1560 if (n1 == 1) { 1561 return textForms[0]; 1562 } 1563 1564 return textForms[2]; 1565 } 1566 1567 function leadgen() { 1568 // if(sessionStorage.getItem("leadgenClosed")) return; 1569 1570 /*if (!getCookie("leadgen") && $('[data-id="leadgen"]').length) { 1571 setTimeout(function () { 1572 if (getCookie("leadgen") || $(".popup").hasClass("is-active")) { 1573 return; 1574 } 1575 $('[data-popup="leadgen"]').click(); 1576 }, 60000); 1577 }*/ 1578 const openLeadgenForm = (delay) => { 1579 setTimeout(function() { 1580 if (!$(".popup").hasClass("is-active")) { 1581 $('[data-popup="leadgen"]').click(); 1582 } 1583 }, delay); 1584 }; 1585 1586 if ($('[data-id="leadgen"]').length) { 1587 openLeadgenForm(30000); 1588 openLeadgenForm(90000); 1589 } 1590 1591 $('[data-id="leadgen"] [name="contact"]').on('change', function () { 1592 var newFormType = $(this).val() === 'whatsapp' ? 'leadgen_whatsapp' : 'leadgen'; 1593 $(this).parents('form').find('[name="form_type"]').val(newFormType); 1594 }); 1595 1596 if (location.search === '?lg') { 1597 $('[data-popup="leadgen"]').click(); 1598 } 1599 } 1600 1601 header(); 1602 mainSlider();
1603 badge(); 1604 advantages(); 1605 filterMenu(); 1606 catalogCard(); 1607 kitchenSlider(); 1608 kitchenSlider2(); 1609 kitchenBadge(); 1610 colorsTextures(); 1611 kitchenLayout(); 1612 parts(); 1613 moduleLoop(); 1614 detailsHeader(); 1615 dropdownBlock(); 1616 tab(); 1617 vacancyItem(); 1618 subscribe(); 1619 video(); 1620 popup(); 1621 requestCall(); 1622 formTimeChange(); 1623 timeBox(); 1624 // headerFixed(); 1625 // priceCalc(); 1626 attachFile(); 1627 form(); 1628 upBtn(); 1629 browsing(); 1630 product(); 1631 contacts(); 1632 // pay(); 1633 vivus(); 1634 sitePhone(); 1635 catalogMore(); 1636 favorites(); 1637 leadgen(); 1638}); 1639 1640// blog.js 1641$(document).ready(function () { 1642 if ($(".blog").length) { 1643 var blogSidebar = new StickySidebar(".blog__side-wrapper", { 1644 innerWrapperSelector: ".blog__side-inner", 1645 topSpacing: 25, 1646 bottomSpacing: 25, 1647 }); 1648 1649 $(".blog__show-btn").on("click", function () { 1650 $(this).hide(); 1651 $(".blog__col.is-hidden").removeClass("is-hidden"); 1652 blogSidebar.updateSticky(); 1653 }); 1654 } 1655 1656 if ($(".article").length) { 1657 var articleSidebar = new StickySidebar(".article__side-wrapper", { 1658 innerWrapperSelector: ".article__side-inner", 1659 topSpacing: 25, 1660 bottomSpacing: 25, 1661 }); 1662 1663 var $window = $(window); 1664 var $article = $(".article"); 1665 var $articleWrapper = $(".article__wrapper"); 1666 var $articleViews = $(".js-article-views"); 1667 1668 function handleArticleScroll() { 1669 var scrollTop = $window.scrollTop(); 1670 var target = $articleWrapper.offset().top + $articleWrapper.height() - $window.height(); 1671 1672 if (scrollTop >= target) { 1673 var newViews = +$articleViews.first().text() + 1; 1674 var articleId = $article.attr("data-id"); 1675 1676 $articleViews.text(newViews); 1677 1678 $.ajax({ 1679 type: "POST", 1680 url: "/add-views.php", 1681 data: "views=" + newViews + "&element_id=" + articleId + "&sessid=" + BX.bitrix_sessid(), 1682 }); 1683 1684 $window.off("scroll", handleArticleScroll); 1685 } 1686 } 1687 1688 $window.on("scroll", handleArticleScroll); 1689 $window.on("load", function () { 1690 articleSidebar?.updateSticky(); 1691 }); 1692 1693 $(".article .likes").on("click", function () { 1694 var $this = $(this); 1695 var isAvailable = $this.hasClass("available"); 1696 var newLikes = isAvailable ? +$this.find("span").text() + 1 : +$this.find("span").text() - 1; 1697 var articleId = $this.attr("data-id"); 1698 1699 $(".article .likes").toggleClass("available").find("span").text(newLikes); 1700 1701 $.ajax({ 1702 type: "POST", 1703 url: "/add-likes.php", 1704 data: "likes=" + newLikes + "&element_id=" + articleId + (isAvailable ? "" : "&minus=1") + "&sessid=" + BX.bitrix_sessid(), 1705 }); 1706 }); 1707 } 1708 // СÑаÑÑй ваÑÐ¸Ð°Ð½Ñ Ð¾ÑÑиÑовки блока пÑи оконÑании вÑÐµÑ ÑÑаÑей (оÑÑиÑовка пеÑенеÑена в Ñ-Ð¸Ñ getContent()) 1709 // if ($('.blog__end').length) { 1710 // var $window = $(window); 1711 // var $blogWrapper = $('.blog__wrapper'); 1712 1713 // function handleArticleScroll() { 1714 // var scrollTop = $window.scrollTop(); 1715 // var target = $blogWrapper.offset().top + $blogWrapper.height() - $window.height(); 1716 1717 // if (scrollTop >= target) { 1718 1719 // $('.blog__end').addClass('show'); 1720 1721 // $window.off('scroll', handleArticleScroll); 1722 // } 1723 // } 1724 1725 // $window.on('scroll', handleArticleScroll); 1726 // } 1727 1728 // Lazy loading blog 1729 // ÐÑновной конÑÐµÐ¹Ð½ÐµÑ Ð´Ð»Ñ ÐºÐ°ÑÑоÑек 1730 const blogContainer = document.querySelector(".blog__row"); 1731 const windowHeight = document.documentElement.clientHeight; 1732 // ÐÐ½Ð´ÐµÐºÑ ÑлеменÑа в маÑÑиве json. ÐÑполÑзÑеÑÑÑ Ð´Ð»Ñ Ð¿Ð¾Ð»ÑÑÐµÐ½Ð¸Ñ ÑледÑÑÑей ÑÑаÑÑи пÑи ÑкÑоле
1733 let count = 0; 1734 if (blogContainer) { 1735 window.addEventListener("scroll", lazyListener); 1736 } 1737 1738 function lazyListener() { 1739 if (!blogContainer.classList.contains("_loading")) { 1740 loadMore(); 1741 } 1742 } 1743 1744 // ÐÑÑлеживание ÑкÑола 1745 function loadMore() { 1746 const blogContainerPos = blogContainer.getBoundingClientRect().top + pageYOffset; 1747 const blogContainerHeight = blogContainer.offsetHeight; 1748 if (pageYOffset > blogContainerPos + blogContainerHeight - windowHeight) { 1749 getContent(); 1750 } 1751 } 1752 1753 // РабоÑа Ñ Ñаблоном и json 1754 async function getContent() { 1755 // Шаблон загÑÑзки 1756 if (!document.querySelector(".blog-card__loading")) { 1757 blogContainer.insertAdjacentHTML( 1758 "beforeend", 1759 `<div class="blog__col blog-card__loading"> 1760 <div class="blog-card__loading-img"></div> 1761 <div class="blog-card__loading-text"></div> 1762 <div class="blog-card__loading-text"></div> 1763 <div class="blog-card__loading-text"></div> 1764 <div class="blog-card__loading-views"></div> 1765 <div class="blog-card__loading-date"></div> 1766 </div> 1767 <div class="blog__col blog-card__loading"> 1768 <div class="blog-card__loading-img"></div> 1769 <div class="blog-card__loading-text"></div> 1770 <div class="blog-card__loading-text"></div> 1771 <div class="blog-card__loading-text"></div> 1772 <div class="blog-card__loading-views"></div> 1773 <div class="blog-card__loading-date"></div> 1774 </div> 1775 ` 1776 ); 1777 } 1778 // ÐлаÑÑ Ð´Ð»Ñ Ð¾ÑÑÐ»ÐµÐ¶Ð¸Ð²Ð°Ð½Ð¸Ñ ÑÑаÑÑÑа оÑобÑÐ°Ð¶ÐµÐ½Ð¸Ñ Ð·Ð°Ð³ÑÑзки 1779 blogContainer.classList.add("_loading"); 1780 const url = window.location.pathname.slice(1, -1).split("/"); 1781 let section = ""; 1782 if (url[1]) { 1783 section = url[1]; 1784 } 1785 1786 try { 1787 const res = await fetch(`/blog/ajaxload.php`, { 1788 method: "POST", 1789 body: JSON.stringify({ 1790 num: count, 1791 section: section, 1792 }), 1793 }); 1794 if (res.ok) { 1795 const result = await res.json(); 1796 console.log(result); 1797 addedBlog(result); // оÑпÑавлÑем полÑÑеннÑй json на обÑабоÑÐºÑ Ð¸ оÑÑиÑÐ¾Ð²ÐºÑ 1798 count += result.length; // УвелиÑиваем знаÑÐµÐ½Ð¸Ñ ÑÑеÑÑика ÑÑаÑей Ð´Ð»Ñ Ð·Ð°Ð¿ÑоÑа ÑледÑÑÑего маÑÑива 1799 loadRender(); 1800 } else if (res.status == 500) { 1801 document.querySelector(".blog__end").classList.add("show"); // ÐоказÑвем блок Ñ Ð·Ð°Ð²ÐµÑÑением ленÑÑ Ð±Ð»Ð¾Ð³Ð° 1802 window.removeEventListener("scroll", lazyListener); // УдалÑем ÑлÑÑаÑÐµÐ»Ñ 1803 loadRender(); 1804 } else { 1805 // ÐобавиÑÑ Ð²Ñвод блока Ð´Ð»Ñ Ð¾Ñибки ÑеÑвеÑа 1806 window.removeEventListener("scroll", lazyListener); 1807 loadRender(); 1808 } 1809 } catch (err) { 1810 console.log(`ÐÑибка ${err}`); 1811 return err; 1812 } 1813 } 1814 1815 function loadRender() { 1816 blogContainer.classList.remove("_loading"); // УбиÑаем ÑÑаÑÑÑ Ð·Ð°Ð³ÑÑзки 1817 removeTemplate(); //УдалÑем Ñаблон 1818 blogSidebar?.updateSticky(); 1819 } 1820 1821 // Удаление Ñаблона 1822 function removeTemplate() { 1823 if (document.querySelector(".blog-card__loading")) { 1824 const lodingEl = document.querySelectorAll(".blog-card__loading"); 1825 lodingEl.forEach((element) => { 1826 while (element.firstChild) { 1827 element.firstChild.remove(); 1828 element.remove(); 1829 } 1830 }); 1831 } 1832 return; 1833 } 1834 1835 // ÐеÑÐµÐ±Ð¾Ñ Ð¼Ð°ÑÑива ÑÑаÑей 1836 function addedBlog(obj) {
1837 obj.forEach((article) => { 1838 const newCard = createBlog(article); 1839 blogContainer.appendChild(newCard); 1840 }); 1841 } 1842 1843 function createBlog(article) { 1844 const templateString = ` 1845 <a class="blog-card blog__item" href="#"> 1846 <div class="blog-card__image"> 1847 <div class="blog-card__bg"><img class="blog-card__img" src="" alt=""></div> 1848 <div class="blog-card__image-inner"> 1849 <div class="blog-card__labels"> 1850 <div class="blog-card__video"><span class="blog-card__video-icon"> 1851 <svg> 1852 <use xlink:href="/local/templates/kuhzavod/f/icons/sprite.svg#play"></use> 1853 </svg></span><span>ÐидеообзоÑ</span></div> 1854 <p class="blog-card__category"></p> 1855 </div> 1856 <h3 class="blog-card__title"></h3> 1857 </div> 1858 </div> 1859 <div class="blog-card__content"> 1860 <p class="blog-card__desc"></p> 1861 <div class="blog-card__footer"> 1862 <div class="blog-card__stats"> 1863 <div class="stat blog-card__stat"> 1864 <div class="stat__icon stat__icon_sm"> 1865 <svg> 1866 <use xlink:href="/local/templates/kuhzavod/f/icons/sprite.svg#view"></use> 1867 </svg> 1868 </div><span class="blog-card__views"></span> 1869 </div> 1870 <div class="stat blog-card__stat"> 1871 <div class="stat__icon stat__icon_sm"> 1872 <svg> 1873 <use xlink:href="/local/templates/kuhzavod/f/icons/sprite.svg#like"></use> 1874 </svg> 1875 </div><span class="blog-card__like"></span> 1876 </div> 1877 </div> 1878 <p class="date"></p> 1879 </div> 1880 </div></a>`; 1881 1882 const element = document.createElement("div"); 1883 element.classList.add("blog__col"); 1884 1885 element.insertAdjacentHTML("beforeend", templateString.trim()); 1886 1887 element.querySelector(".blog__item").href = article.url; 1888 element.querySelector(".blog-card__img").src = article.pic; 1889 element.querySelector(".blog-card__title").textContent = article.name; 1890 element.querySelector(".blog-card__category").textContent = article.section; 1891 element.querySelector(".blog-card__desc").textContent = article.text; 1892 element.querySelector(".blog-card__like").textContent = article.likes; 1893 element.querySelector(".date").textContent = article.date; 1894 element.querySelector(".blog-card__views").textContent = article.views; 1895 1896 element.querySelector(".blog-card__category").style.display = "none"; 1897 element.querySelector(".blog-card__video").style.display = "none"; 1898 if (article.video != "") { 1899 element.querySelector(".blog-card__video").style.display = "inline-flex"; 1900 } 1901 if (article.section) { 1902 element.querySelector(".blog-card__category").style.display = "block"; 1903 } 1904 return element; 1905 } 1906}); 1907 1908// add.js 1909$(document).ready(function () { 1910 var sliderExample = $(".work-examples-slider-js"); 1911 1912 if (sliderExample) { 1913 sliderExample.owlCarousel({ 1914 items: 1, 1915 loop: true, 1916 nav: true, 1917 navText: [ 1918 "<span data-dynamic='icn-arrow-r-light'>\ 1919 <svg class='icn-arrow-r-light' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 24'>\ 1920 <path d='M0,24l12-12L0,0'></path>\ 1921 </svg>\ 1922 </span>", 1923 "<span data-dynamic='icn-arrow-r-light'>\ 1924 <svg class='icn-arrow-r-light' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 24'>\ 1925 <path d='M0,24l12-12L0,0'></path>\ 1926 </svg>\ 1927 </span>", 1928 ], 1929 margin: 0, 1930 mouseDrag: document.documentMode ? false : true, // IE check 1931 autoplayHoverPause: true, 1932 autoplay: false, 1933 dots: true, 1934 lazyLoad: true, 1935 responsive: { 1936 320: { 1937 items: 1, 1938 }, 1939 1940 480: { 1941 items: 1, 1942 }, 1943 1944 768: { 1945 items: 1, 1946 }, 1947 1948 1350: { 1949 items: 1, 1950 }, 1951 1952 1500: { 1953 items: 1, 1954 }, 1955 }, 1956 }); 1957 } 1958 1959 files(); 1960 1961 zoomPopUp(".zoom-examples", ".owl-item:not(.cloned) a"); 1962 1963 chekedRadioButton(); 1964 1965 // scrollMagicFun(); 1966 1967 initializeOwlCarousel(); 1968 1969 promoCarousel(); 1970 1971 sliderHeightСalculation(".work-examples-slider-js"); 1972 1973 sliderHeightСalculation(".promo-carousel"); 1974 1975 additionalPopup(); 1976}); 1977 1978function sliderHeightСalculation(slider) { 1979 var sliderInnerHeight = $(slider).find(".owl-stage-outer").outerHeight(); 1980 1981 // $(slider).find('.owl-nav button').outerHeight(sliderInnerHeight); 1982} 1983 1984function additionalPopup() { 1985 // ÑÐ»Ð°Ð¹Ð´ÐµÑ 1986 const checkbox = document.querySelectorAll(".popup-additional__selection-item[data-style]"); 1987 const image = document.querySelector(".popup-additional__image"); 1988 if (checkbox.length > 0 && image) {
1989 checkbox.forEach((el) => { 1990 if (el.dataset.style) { 1991 el.addEventListener("click", changeImage); 1992 } 1993 }); 1994 } 1995 1996 function changeImage(e) { 1997 const item = e.target; 1998 image.style = item.dataset.style; 1999 checkbox.forEach((el) => { 2000 el.classList.remove("popup-additional__selection-item_focus"); 2001 }); 2002 item.classList.add("popup-additional__selection-item_focus"); 2003 } 2004} 2005 2006function promoCarousel() { 2007 var owl = $(".promo-carousel"); 2008 2009 if ($(".promo-carousel__item").length > 1) { 2010 owl.owlCarousel({ 2011 items: 1, 2012 loop: true, 2013 nav: true, 2014 navText: [ 2015 "<span data-dynamic='icn-arrow-r-light'>\ 2016 <svg class='icn-arrow-r-light' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 24'>\ 2017 <path d='M0,24l12-12L0,0'></path>\ 2018 </svg>\ 2019 </span>", 2020 "<span data-dynamic='icn-arrow-r-light'>\ 2021 <svg class='icn-arrow-r-light' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 24'>\ 2022 <path d='M0,24l12-12L0,0'></path>\ 2023 </svg>\ 2024 </span>", 2025 ], 2026 margin: 0, 2027 autoplayHoverPause: true, 2028 autoplay: false, 2029 dots: true, 2030 responsive: { 2031 320: { 2032 items: 1, 2033 }, 2034 2035 480: { 2036 items: 1, 2037 }, 2038 2039 768: { 2040 items: 1, 2041 }, 2042 2043 1350: { 2044 items: 1, 2045 }, 2046 2047 1500: { 2048 items: 1, 2049 }, 2050 }, 2051 }); 2052 } else { 2053 owl.trigger("destroy.owl.carousel").removeClass("owl-carousel owl-loaded"); 2054 2055 owl.addClass("one-item"); 2056 } 2057} 2058 2059function initializeOwlCarousel() { 2060 var slider = $(".best__grid"); 2061 2062 if ($(window).width() <= 767) { 2063 slider.owlCarousel({ 2064 items: 1, 2065 loop: false, 2066 nav: false, 2067 center: true, 2068 margin: 0, 2069 autoplayHoverPause: true, 2070 autoplay: false, 2071 dots: true, 2072 margin: 15, 2073 autoWidth: true, 2074 responsive: { 2075 320: { 2076 items: 2, 2077 }, 2078 2079 480: { 2080 items: 2, 2081 }, 2082 2083 768: { 2084 items: 2, 2085 }, 2086 2087 1350: { 2088 items: 1, 2089 }, 2090 2091 1500: { 2092 items: 1, 2093 }, 2094 }, 2095 }); 2096 } else { 2097 slider.trigger("destroy.owl.carousel").removeClass("owl-carousel owl-loaded"); 2098 } 2099} 2100 2101function chekedRadioButton() { 2102 $(".radio input").on("change", function () { 2103 var radioProp = $(".radio input").prop("checked"); 2104 2105 $(".cupboard-form__radio").parent().removeClass("active"); 2106 2107 if ($(".cupboard-form__radio").hasClass("selected")) { 2108 $(this).parent().addClass("active"); 2109 } else { 2110 $(this).parent().removeClass("active"); 2111 } 2112 }); 2113} 2114 2115function files() { 2116 (function (document, window, index) { 2117 var inputs = document.querySelectorAll(".inputfile"); 2118 Array.prototype.forEach.call(inputs, function (input) { 2119 var label = input.nextElementSibling, 2120 labelVal = label.innerHTML; 2121 2122 input.addEventListener("change", function (e) { 2123 var size = 0; 2124 var fileName = ""; 2125 2126 label.style.color = ""; 2127 2128 if (this.files.length) { 2129 for (var i = 0; i < this.files.length; i++) { 2130 size += this.files[i].size; 2131 2132 if (size > 20 * 1024 * 1024) { 2133 this.value = ""; 2134 fileName = "ÐÑевÑÑен ÑÐ°Ð·Ð¼ÐµÑ Ñайлов"; 2135 label.style.color = "#df0b1d"; 2136 break; 2137 } 2138 2139 fileName += (fileName ? ", " : "") + this.files[i].name; 2140 } 2141 2142 label.querySelector("span").innerHTML = fileName; 2143 } else { 2144 label.innerHTML = labelVal; 2145 } 2146 }); 2147 2148 input.addEventListener("focus", function () { 2149 input.classList.add("has-focus"); 2150 }); 2151 input.addEventListener("blur", function () { 2152 input.classList.remove("has-focus"); 2153 }); 2154 }); 2155 })(document, window, 0); 2156} 2157 2158function responsiveZoom(item) { 2159 var resFlag; 2160 var zoom = ".zoom-card"; 2161 2162 if (item === zoom && $(window).width() < 900) { 2163 $(item).find(".kitchen-slider__item").addClass("pointer-none"); 2164 2165 resFlag = false;
2166 } else { 2167 $(item).find(".kitchen-slider__item").removeClass("pointer-none"); 2168 2169 resFlag = true; 2170 } 2171 2172 return resFlag; 2173} 2174 2175function zoomPopUp(item, elementClick) { 2176 var flag = responsiveZoom(item); 2177 2178 $(item).each(function () { 2179 $(this).magnificPopup({ 2180 delegate: elementClick, 2181 type: "image", 2182 closeOnContentClick: false, 2183 closeBtnInside: false, 2184 disableOn: function () { 2185 return flag; 2186 }, 2187 mainClass: "mfp-with-zoom mfp-img-mobile", 2188 callbacks: { 2189 beforeOpen: function () { 2190 // just a hack that adds mfp-anim class to markup 2191 this.st.image.markup = this.st.image.markup.replace( 2192 "mfp-figure", 2193 "mfp-figure mfp-with-anim" 2194 ); 2195 this.st.mainClass = this.st.el.attr("data-effect"); 2196 }, 2197 }, 2198 image: { 2199 verticalFit: true, 2200 }, 2201 gallery: { 2202 enabled: true, 2203 navigateByImgClick: true, 2204 preload: [0, 1], // Will preload 0 - before current, and 1 after the current image 2205 tCounter: '<span class="mfp-counter">%curr% из %total%</span>', 2206 }, 2207 zoom: { 2208 enabled: true, 2209 duration: 300, // don't foget to change the duration also in CSS 2210 opener: function (element) { 2211 return element.find("img"); 2212 }, 2213 }, 2214 }); 2215 }); 2216} 2217 2218function scrollMagicFun() { 2219 var controller = new ScrollMagic(); 2220 var slider = document.querySelector(".cupboard-filling"); 2221 var ticking = false; 2222 var isFirefox = /Firefox/i.test(navigator.userAgent); 2223 var isIe = /MSIE/i.test(navigator.userAgent) || /Trident.*rv\:11\./i.test(navigator.userAgent); 2224 var mousewheelEvent = isFirefox ? "DOMMouseScroll" : "wheel"; 2225 var scrollSensitivitySetting = 30; 2226 var slideDurationSetting = 1200; 2227 var currentSlideNumber = 0; 2228 var totalSlideNumber = $(".background").length; 2229 2230 var sliderHeight = $(".background").outerHeight(); 2231 2232 if ($("#trigger6").length) { 2233 var scene = new ScrollScene({ 2234 triggerHook: "0", 2235 triggerElement: "#trigger6", 2236 duration: 600, 2237 }); 2238 2239 var flag = false; 2240 2241 if ($(window).width() >= 960) { 2242 scene.setPin("#cupboard-filling"); 2243 scene.addTo(controller); 2244 2245 scene.on("enter", function (e) { 2246 flag = true; 2247 2248 $("html").addClass("scroll-overflow"); 2249 2250 if (flag) { 2251 window.addEventListener(mousewheelEvent, parallaxScroll, false); 2252 } 2253 }); 2254 2255 scene.on("leave", function (e) { 2256 flag = false; 2257 2258 scene.removePin(); 2259 scene.destroy(); 2260 2261 window.removeEventListener(mousewheelEvent, parallaxScroll); 2262 }); 2263 2264 function slideDurationTimeout(slideDuration) { 2265 setTimeout(function () { 2266 ticking = false; 2267 }, slideDuration); 2268 } 2269 2270 function parallaxScroll(evt) { 2271 if (isFirefox) { 2272 //Set delta for Firefox 2273 delta = evt.detail * -120; 2274 } else if (isIe) { 2275 //Set delta for IE 2276 delta = -evt.deltaY; 2277 } else { 2278 //Set delta for all other browsers 2279 delta = evt.wheelDelta; 2280 } 2281 2282 if (ticking != true) { 2283 if (delta <= -scrollSensitivitySetting) { 2284 ticking = true; 2285 if (currentSlideNumber !== totalSlideNumber) { 2286 currentSlideNumber++; 2287 nextItem(); 2288 } 2289 2290 if (currentSlideNumber == totalSlideNumber) { 2291 currentItem(); 2292 } 2293 2294 slideDurationTimeout(slideDurationSetting); 2295 } 2296 2297 if (delta >= scrollSensitivitySetting) { 2298 ticking = true; 2299 2300 if (currentSlideNumber !== 0) { 2301 currentSlideNumber--; 2302 } 2303 2304 if (currentSlideNumber === 0) { 2305 setTimeout(function () { 2306 $("html").removeClass("scroll-overflow"); 2307 }, slideDurationSetting); 2308 } 2309 2310 previousItem(); 2311 slideDurationTimeout(slideDurationSetting); 2312 } 2313 } 2314 } 2315 2316 function currentItem() { 2317 $("html").removeClass("scroll-overflow"); 2318 } 2319 2320 function nextItem() { 2321 var $previousSlide = $(".background").eq(currentSlideNumber); 2322 2323 $("html").addClass("scroll-overflow"); 2324 2325 $(".background:not('.last')").removeClass("scroll"); 2326 2327 $previousSlide.addClass("scroll"); 2328 } 2329 2330 function previousItem() { 2331 var $currentSlide = $(".background").eq(currentSlideNumber); 2332 2333 $(".background").removeClass("scroll"); 2334 $currentSlide.addClass("scroll"); 2335 } 2336 2337 function disableScroll() { 2338 scrollTop = window.pageYOffset || document.documentElement.scrollTop; 2339 (scrollLeft = window.pageXOffset || document.documentElement.scrollLeft), 2340 (window.onscroll = function () { 2341 window.scrollTo(scrollLeft, scrollTop); 2342 }); 2343 } 2344 } else { 2345 scene.removePin(); 2346 scene.destroy(); 2347 controller.enabled(false); 2348 controller = null; 2349 $("html").removeClass("scroll-overflow"); 2350 } 2351 } 2352} 2353 2354var submitedForm, token; 2355 2356function detectForm(e) { 2357 submitedForm = $(e).parents("form"); 2358} 2359 2360function onSubmit(e) { 2361 (token = e), submitedForm.submit(); 2362} 2363 2364$(window).resize(function () { 2365 initializeOwlCarousel(); 2366 sliderHeightСalculation(".work-examples-slider-js"); 2367 sliderHeightСalculation(".promo-carousel"); 2368 // scrollMagicFun(); 2369 // zoomPopUp('.zoom-card'); 2370}); 2371 2372// header select auto width 2373(function resize($, window) { 2374 var arrowWidth = 0; 2375 $.fn.resizeselect = function () { 2376 return this.each(function () { 2377 $(this) 2378 .change(function () { 2379 var $this = $(this); 2380 2381 // create test element 2382 var text = $this.find("option:selected").text(); 2383 var $test = $("<span>") 2384 .html(text) 2385 .css({ 2386 "font-size": $this.css("font-size"), // ensures same size text 2387 visibility: "hidden", // prevents FOUC 2388 }); 2389 2390 // add to parent, get width, and get out 2391 $test.appendTo($this.parent()); 2392 var width = $test.width(); 2393 $test.remove(); 2394 2395 // set select width 2396 $this.width(width + arrowWidth); 2397 2398 // run on start 2399 }) 2400 .change(); 2401 }); 2402 }; 2403 2404 // run by default 2405 $("select.resizeselect").resizeselect(); 2406})(jQuery, window); 2407 2408document.addEventListener("DOMContentLoaded", () => { 2409 const weekendsBanner = document.querySelector(".weekends"); 2410 2411 if (weekendsBanner) { 2412 weekendsBanner.classList.add("shadow"); 2413 } 2414}); 2415 2416// city popup 2417function getCookie(name) { 2418 const cookie = " " + document.cookie; 2419 const search = " " + name + "="; 2420 let setStr = null; 2421 let offset = 0; 2422 let end = 0; 2423 if (cookie.length > 0) { 2424 offset = cookie.indexOf(search); 2425 if (offset != -1) { 2426 offset += search.length; 2427 end = cookie.indexOf(";", offset); 2428 if (end == -1) { 2429 end = cookie.length; 2430 } 2431 setStr = unescape(cookie.substring(offset, end)); 2432 } 2433 } 2434 return setStr; 2435} 2436 2437function getCityList(element) { 2438 const cityContainer = document.querySelectorAll(".select-city-new"); 2439 if (cityContainer) { 2440 cityContainer.forEach((cityItem) => { 2441 const cityList = cityItem.children; 2442 if (cityList.length > 0) { 2443 textChanger(element, cityList); 2444 } 2445 }); 2446 } 2447} 2448 2449function textChanger(element, array) { 2450 if (element && array.length > 0) { 2451 for (i = 0; i < array.length; i++) { 2452 const data = array[i].dataset.city; 2453 array[i].classList.remove("_selected"); 2454 2455 if (getCookie("city") === data) { 2456 element.textContent = array[i].textContent; 2457 array[i].classList.add("_selected"); 2458 } 2459 } 2460 } 2461} 2462 2463document.addEventListener("DOMContentLoaded", () => { 2464 const mapCity = document.querySelector(".map-city-text"); 2465 getCityList(mapCity); 2466}); 2467 2468// catalog.js 2469/* 2470 2471function filterSelectWork() { 2472 document.body.addEventListener('click', (e) => { 2473 2474 let allSelects = document.querySelectorAll('.filter__select'); 2475 if (allSelects.length > 0) {
2476 allSelects.forEach(sel => { 2477 if (e.target.closest('.filter__select') != sel) { 2478 sel.classList.remove('active'); 2479 } 2480 }); 2481 } 2482 2483 if (e.target.closest('.filter__select')) { 2484 let item = e.target.closest('.filter__select'); 2485 let selText = item.querySelector('.filter-js'); 2486 let select = item.querySelector('.filter__select-hidden'); 2487 2488 item.classList.toggle('active'); 2489 2490 if (e.target.closest('.filter__select-options')) { 2491 let opt = item.querySelectorAll('.filter__select-option'); 2492 opt.forEach((element, i) => { 2493 if (e.target == element) { 2494 selText.innerHTML = element.innerHTML; 2495 select.selectedIndex = i; 2496 } 2497 }); 2498 2499 } 2500 } 2501 }); 2502} 2503 2504function SelectStart() { 2505 let selectArr = document.querySelectorAll('.filter__select-hidden'); 2506 if (selectArr.length > 0) { 2507 selectArr.forEach(item => { 2508 item.nextElementSibling.querySelector('.filter-js').innerHTML = item.value; 2509 }); 2510 } 2511} 2512 2513function resetFilters() { 2514 let resetBtn = document.querySelector('.filter__reset'); 2515 2516 if (resetBtn) { 2517 let selects = document.querySelectorAll('.filter__select-hidden'); 2518 let checkboxes = document.querySelectorAll('.filter__radio'); 2519 let formCheckboxes = document.querySelectorAll('.filter__form-radio'); 2520 2521 resetBtn.addEventListener('click', () => { 2522 selects.forEach(item => { 2523 item.selectedIndex = 0; 2524 }); 2525 SelectStart(); 2526 checkboxes.forEach(item => { 2527 item.checked = false; 2528 }); 2529 formCheckboxes.forEach((item, i) => { 2530 if (i == 0) { 2531 item.checked = true; 2532 } 2533 else item.checked = false; 2534 2535 }); 2536 }); 2537 } 2538} 2539 2540document.addEventListener('DOMContentLoaded', () => { 2541 filterSelectWork(); 2542 SelectStart(); 2543 resetFilters(); 2544}); 2545 2546*/ 2547 2548// panorama.js 2549$(function () { 2550 var correction = 0, 2551 viewer, 2552 panoramaLibs = null, 2553 panoramaOpenId = 0; 2554 2555 // three.js и panolens (190 ÐРв gzip) нÑÐ¶Ð½Ñ ÑолÑко Ð´Ð»Ñ 3D-ÑÑÑа, 2556 // поÑÑÐ¾Ð¼Ñ Ð³ÑÑзÑÑÑÑ Ð¿Ñи пеÑвом оÑкÑÑÑии паноÑамÑ, а не на каждой ÑÑÑаниÑе 2557 function loadScript(src) { 2558 return new Promise(function (resolve, reject) { 2559 var script = document.createElement("script"); 2560 script.src = src; 2561 script.onload = resolve; 2562 script.onerror = reject; 2563 document.body.appendChild(script); 2564 }); 2565 } 2566 2567 function loadPanoramaLibs() { 2568 if (!panoramaLibs) { 2569 var path = "/local/templates/kuhzavod/f/new/js/"; 2570 panoramaLibs = loadScript(path + "three.min.js") 2571 .then(function () { 2572 return loadScript(path + "panolens.min.js"); 2573 }) 2574 .catch(function (error) { 2575 panoramaLibs = null; 2576 throw error; 2577 }); 2578 } 2579 return panoramaLibs; 2580 } 2581 2582 function setIndicatorAngle(e) { 2583 var angle = ((e.target.object.rotation._y * 180) / Math.PI) * -1; 2584 var newAngle = angle - correction; 2585 $(".panorama__indicator").css("transform", "rotate(" + newAngle + "deg)"); 2586 } 2587 2588 $(document).on("click", ".js-panorama", function () { 2589 $(".panorama").show(); 2590 $(".panorama__preloader").show(); 2591 2592 var scrollbarWidth = window.innerWidth - document.documentElement.clientWidth + "px"; 2593 2594 $("html").css({ 2595 overflow: "hidden", 2596 }); 2597 $("body").css({ 2598 paddingRight: scrollbarWidth, 2599 overflow: "hidden", 2600 }); 2601 $(".details-header").css({ 2602 paddingRight: scrollbarWidth, 2603 }); 2604 2605 var container = document.querySelector("#panorama-image"); 2606 var image = $(this).attr("data-image"); 2607 var preview = $(this).attr("data-preview"); 2608 var correctionAngle = $(this).attr("data-position"); 2609 var points; 2610 2611 if (correctionAngle) { 2612 correction = +correctionAngle; 2613 } 2614 2615 try { 2616 points = JSON.parse($(this).attr("data-points")); 2617 } catch { 2618 points = null; 2619 } 2620 2621 var previewEl = document.createElement("img"); 2622 2623 previewEl.src = preview; 2624 previewEl.classList.add("panorama__preview"); 2625 2626 var previewReady = new Promise(function (resolve) { 2627 previewEl.onload = resolve; 2628 previewEl.onerror = resolve; 2629 }); 2630 2631 container.append(previewEl); 2632 2633 var openId = ++panoramaOpenId; 2634 2635 Promise.all([loadPanoramaLibs(), previewReady]).then( 2636 function () { 2637 if (openId === panoramaOpenId) { 2638 initPanorama(); 2639 } 2640 }, 2641 function () { 2642 $(".panorama__preloader").hide(); 2643 } 2644 ); 2645 2646 function initPanorama() { 2647 var panorama = new PANOLENS.ImagePanorama(image); 2648 2649 if (points) { 2650 for (var i = 0; i < points.length; i++) { 2651 var spot = new PANOLENS.Infospot( 2652 300, 2653 "/local/templates/kuhzavod/images/infospot-" + (i + 1) + ".png" 2654 ); 2655 var point = points[i]; 2656 2657 var el = document.createElement("div"); 2658 el.classList.add("panorama__info"); 2659 el.innerHTML = 2660 '<div class="panorama__box">' + 2661 (point.image ? '<img class="panorama__thumb" src="' + point.image + '" alt>' : "") + 2662 '<p class="panorama__title">' + 2663 point.title + 2664 "</p></div>"; 2665 2666 spot.position.set(point.coords[0], point.coords[1], point.coords[2]);
2667 spot.addHoverElement(el, -40); 2668 2669 panorama.add(spot); 2670 } 2671 } 2672 2673 panorama.addEventListener("load", function () { 2674 $(".panorama__preview").hide(); 2675 $(".panorama__preloader").hide(); 2676 }); 2677 2678 viewer = new PANOLENS.Viewer({ 2679 container: container, 2680 controlBar: false, 2681 autoHideInfospot: false, 2682 cameraFov: 90, 2683 }); 2684 2685 if (correction !== 0) { 2686 panorama.addEventListener("enter-fade-start", function () { 2687 var x = correction > 0 ? -100 : 100; 2688 var z = x / Math.tan((correction * Math.PI) / 180); 2689 viewer.tweenControlCenter(new THREE.Vector3(x, 0, z), 0); 2690 }); 2691 } 2692 2693 viewer.add(panorama); 2694 viewer.getControl().addEventListener("change", setIndicatorAngle); 2695 } 2696 2697 // metrics 2698 // fbq('track', 'ViewContent'); 2699 // _yaCounter.reachGoal('openTour'); 2700 }); 2701 2702 $(".panorama__overlay, .panorama__close").on("click", function () { 2703 panoramaOpenId++; 2704 2705 if (viewer) { 2706 viewer.destroy(); 2707 viewer = null; 2708 } 2709 2710 $(".panorama").hide(); 2711 $(".panorama__image").empty(); 2712 $(".panorama__indicator").css("transform", ""); 2713 2714 $("html").css({ 2715 overflow: "", 2716 }); 2717 $("body").css({ 2718 paddingRight: "", 2719 overflow: "", 2720 }); 2721 $(".amodal-header").css({ 2722 paddingRight: "", 2723 boxSizing: "", 2724 }); 2725 }); 2726}); 2727 2728// new.js 2729// city 2730function city() { 2731 2732 var checkCity = document.querySelector(".header__popup"); 2733 var selectCity = document.querySelectorAll(".select-city"); 2734 2735 // 27.10.2021- ÐовÑй Popup Ð´Ð»Ñ Ð³Ð¾Ñодов --START 2736 const newSelectCity = document.querySelectorAll(".select-city-new"); 2737 // 27.10.2021- ÐовÑй Popup Ð´Ð»Ñ Ð³Ð¾Ñодов --END 2738 2739 const headerCitiesDropdowns = document.querySelectorAll('.header__cities'); 2740 const headerSelects = document.querySelectorAll('.header__select'); 2741 2742 if (checkCity) { 2743 var checkProof = checkCity.querySelector(".city-popup__info"); 2744 var checkChoice = checkCity.querySelector(".city-popup__choice"); 2745 var btnCheckYes = checkCity.querySelector(".city-popup_agree"); 2746 var btnCheckNot = checkCity.querySelector(".city-popup_not"); 2747 2748 function setCookie(name, value, days) { 2749 var expires = ""; 2750 if (days) { 2751 var date = new Date(); 2752 date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000); 2753 expires = "; expires=" + date.toUTCString(); 2754 } 2755 document.cookie = name + "=" + (value || "") + expires + "; path=/"; 2756 } 2757 2758 function detectedCity(name) { 2759 let matches = document.cookie.match( 2760 new RegExp("(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, "\\$1") + "=([^;]*)") 2761 ); 2762 return matches ? decodeURIComponent(matches[1]) : undefined; 2763 } 2764 2765 function setCity(city) { 2766 if (city != undefined) { 2767 setCookie("city", city, 30); 2768 setCookie("city_selected", "correct", 30); 2769 } 2770 } 2771 2772 if (headerSelects.length && headerCitiesDropdowns.length) { 2773 headerSelects.forEach((headerSelect) => { 2774 headerSelect.addEventListener("click", function (event) { 2775 const currentDropdown = this.nextElementSibling; 2776 if (currentDropdown && currentDropdown.classList.contains('header__cities')) { 2777 currentDropdown.classList.toggle("header__cities_show"); 2778 2779 headerCitiesDropdowns.forEach((dropdown) => { 2780 if (dropdown !== currentDropdown) { 2781 dropdown.classList.remove("header__cities_show"); 2782 } 2783 }); 2784 } 2785 event.stopPropagation(); 2786 }); 2787 }); 2788 2789 document.addEventListener("click", function (event) { 2790 if (!event.target.closest('.header__city')) { 2791 headerCitiesDropdowns.forEach((dropdown) => { 2792 dropdown.classList.remove("header__cities_show"); 2793 }); 2794 } 2795 }); 2796 } 2797 2798 function changeCity() { 2799 if (checkCity) { 2800 var optionCity = document.querySelectorAll(".city-popup__option, .header-cities__link"); 2801 var selectData; 2802
2803 selectCity.forEach(function (el) { 2804 el.addEventListener("change", function () { 2805 selectData = el[el.selectedIndex].dataset.city; 2806 setCity(selectData); 2807 // console.log(document.cookie); 2808 setTimeout(() => window.location.reload(), 50); 2809 }); 2810 }); 2811 2812 // 27.10.2021- ÐовÑй Popup Ð´Ð»Ñ Ð³Ð¾Ñодов --START 2813 newSelectCity.forEach(function (cityList) { 2814 const array = cityList.children; 2815 if (array.length > 0) { 2816 for (i = 0; i < array.length; i++) { 2817 array[i].addEventListener("click", function () { 2818 selectData = this.dataset.city; 2819 setCity(selectData); 2820 console.log(document.cookie); 2821 setTimeout(() => window.location.reload(), 50); 2822 }); 2823 } 2824 } 2825 }); 2826 // 27.10.2021- ÐовÑй Popup Ð´Ð»Ñ Ð³Ð¾Ñодов --END 2827 2828 optionCity.forEach(function (el) { 2829 el.addEventListener("click", function () { 2830 setCity(el.dataset.city); 2831 checkCity.classList.add("header__popup_hidden"); 2832 setTimeout(() => window.location.reload(), 50); 2833 }); 2834 }); 2835 2836 btnCheckNot.addEventListener("click", function () { 2837 checkProof.classList.add("city-popup__info_hidden"); 2838 checkChoice.classList.add("city-popup__choice_show"); 2839 }); 2840 2841 btnCheckYes.addEventListener("click", function () { 2842 selectData = this.dataset.city; 2843 console.log(selectData); 2844 setCity(selectData); 2845 checkCity.classList.add("header__popup_hidden"); 2846 }); 2847 } 2848 } 2849 2850 var cityCookie = detectedCity("city_selected"); 2851 2852// if (cityCookie != "correct") { 2853// checkCity.classList.remove("header__popup_hidden"); 2854// } 2855 2856 changeCity(); 2857 setCity(); 2858 } 2859} 2860 2861//payment 2862function payment() { 2863 var formPayment = document.querySelector(".form-pay"); 2864 2865 if (!formPayment) { 2866 return; 2867 } 2868 2869 var prefix = formPayment.querySelector(".form-item__group_order-prefix"); 2870 var numbers = formPayment.querySelector(".form-item__group_order-numbers"); 2871 var checkbox = formPayment.querySelector(".form-item__checkbox"); 2872 var btn = formPayment.querySelector(".pay__footer button"); 2873 var prefixCorrect = detectCity(); 2874 2875 var choicedCity = ""; 2876 var orderFieldSingle = formPayment.querySelector(".form-item-order_single"); 2877 var orderFieldTwain = formPayment.querySelector(".form-item-order_twain"); 2878 // var inputAdditionalNumber = formPayment.querySelector(".form-item-additional_number input"); 2879 2880 var inputsDocsRequired = { 2881 dataRequiredPrefix: "", 2882 dataRequiredNumbers: "", 2883 }; 2884 2885 function detectCity() { 2886 var correctPrefix; 2887 2888 var formPaymentSelect = formPayment.querySelector(".pay__select"); 2889 var formHidden = formPayment.querySelector(".pay__hidden"); 2890 var formMessage = formPayment.querySelector(".pay__message"); 2891 var formCheckboxOfertaLink = formPayment.querySelector(".form-item_checkbox p"); 2892 var formPaymentSelectData = JSON.parse(formPaymentSelect.dataset.select); 2893 var inputAdditionalNumber = formPayment.querySelector(".form-item-additional_number input"); 2894 var additionalNumber = formPayment.querySelector(".form-item-additional_number"); 2895 2896 if (formPaymentSelect.value === "СанкÑ-ÐеÑеÑбÑÑг") { 2897 formCheckboxOfertaLink.innerHTML = 2898 'СоглаÑен Ñ ÑÑловиÑми <a href="/local/templates/kuhzavod/f/docs/public_oferta_spb.pdf" class="oferta-link" target="_blank">договоÑа оÑеÑÑÑ</a> и <a href="/local/templates/kuhzavod/f/docs/policy_spb.pdf" class="oferta-link" target="_blank">полиÑикой конÑиденÑиалÑноÑÑи</a>'; 2899 formPayment.querySelector("[name=shop_id]").value = formPaymentSelectData.spb.shopid; 2900 correctPrefix = ["Ð", "ÐÐ", "ШÐ", "ÐШÐ"]; 2901 validateContract(); 2902 2903 additionalNumber.style.display = "none"; 2904 inputAdditionalNumber.disabled = true; 2905 formHidden.classList.add("is-active"); 2906 formMessage.classList.remove("is-active"); 2907 2908 } else if (formPaymentSelect.value === "ÐоÑква") { 2909 formCheckboxOfertaLink.innerHTML = 2910 'СоглаÑен Ñ ÑÑловиÑми <a href="/local/templates/kuhzavod/f/docs/public_oferta_msk.pdf" class="oferta-link" target="_blank">договоÑа оÑеÑÑÑ</a> и <a href="/local/templates/kuhzavod/f/docs/policy_msk.pdf" class="oferta-link" target="_blank">полиÑикой конÑиденÑиалÑноÑÑи</a>'; 2911 formPayment.querySelector("[name=shop_id]").value = formPaymentSelectData.msk.shopid; 2912 correctPrefix = ["ШÐ", "ÐШÐ", "Ð", "ÐÐ"]; 2913 2914 additionalNumber.style.display = ""; 2915 inputAdditionalNumber.disabled = false;
2916 formHidden.classList.add("is-active"); 2917 formMessage.classList.remove("is-active"); 2918 2919 } else if (formPaymentSelect.value === "ÐазанÑ") { 2920 formCheckboxOfertaLink.innerHTML = 2921 'СоглаÑен Ñ ÑÑловиÑми <a href="/local/templates/kuhzavod/f/docs/public_oferta_kzn.pdf" class="oferta-link" target="_blank">договоÑа оÑеÑÑÑ</a> и <a href="/local/templates/kuhzavod/f/docs/policy_kzn.pdf" class="oferta-link" target="_blank">полиÑикой конÑиденÑиалÑноÑÑи</a>'; 2922 formPayment.querySelector("[name=shop_id]").value = formPaymentSelectData.kzn.shopid; 2923 // correctPrefix = ["Ð", "ÐÐ", "ÐÐÐ", "ÐÐÐÐ", "ШÐÐÐ", "ÐШÐÐÐ"]; 2924 correctPrefix = ["СÐÐ"]; 2925 validateContract(); 2926 2927 additionalNumber.style.display = "none"; 2928 inputAdditionalNumber.disabled = true; 2929 formHidden.classList.add("is-active"); 2930 formMessage.classList.remove("is-active"); 2931 2932 } else if (formPaymentSelect.value === "Ðижний ÐовгоÑод") { 2933 formCheckboxOfertaLink.innerHTML = 2934 'СоглаÑен Ñ ÑÑловиÑми <a href="/local/templates/kuhzavod/f/docs/public_oferta_nn.pdf" class="oferta-link" target="_blank">договоÑа оÑеÑÑÑ</a> и <a href="/local/templates/kuhzavod/f/docs/policy_nn.pdf" class="oferta-link" target="_blank">полиÑикой конÑиденÑиалÑноÑÑи</a>'; 2935 formPayment.querySelector("[name=shop_id]").value = formPaymentSelectData.nn.shopid; 2936 correctPrefix = ["СÐ", "ÐСÐ", "СÐÐ", "ÐСÐÐ", "ШСÐÐ", "ÐШСÐÐ"]; 2937 validateContract(); 2938 2939 additionalNumber.style.display = "none"; 2940 inputAdditionalNumber.disabled = true; 2941 formHidden.classList.add("is-active"); 2942 formMessage.classList.remove("is-active"); 2943 2944 } else if (formPaymentSelect.value === "ÐÑаÑнодаÑ") { 2945 formCheckboxOfertaLink.innerHTML = 2946 'СоглаÑен Ñ ÑÑловиÑми <a href="/local/templates/kuhzavod/f/docs/public_oferta_krd.pdf" class="oferta-link" target="_blank">договоÑа оÑеÑÑÑ</a> и <a href="/local/templates/kuhzavod/f/docs/policy_krd.pdf" class="oferta-link" target="_blank">полиÑикой конÑиденÑиалÑноÑÑи</a>'; 2947 formPayment.querySelector("[name=shop_id]").value = formPaymentSelectData.krd.shopid; 2948 correctPrefix = ["ÐÐ", "ÐÐÐ"]; 2949 validateContract(); 2950 2951 additionalNumber.style.display = "none"; 2952 inputAdditionalNumber.disabled = true; 2953 formHidden.classList.add("is-active"); 2954 formMessage.classList.remove("is-active"); 2955 2956 } else if (formPaymentSelect.value === "РоÑÑов-на-ÐонÑ") { 2957 formCheckboxOfertaLink.innerHTML = 2958 'СоглаÑен Ñ ÑÑловиÑми <a href="/local/templates/kuhzavod/f/docs/public_oferta_rnd.pdf" class="oferta-link" target="_blank">договоÑа оÑеÑÑÑ</a> и <a href="/local/templates/kuhzavod/f/docs/policy_rnd.pdf" class="oferta-link" target="_blank">полиÑикой конÑиденÑиалÑноÑÑи</a>'; 2959 formPayment.querySelector("[name=shop_id]").value = formPaymentSelectData.rnd.shopid; 2960 correctPrefix = ["Ð Ð", "ÐÐ Ð", "ШРÐ", "ÐШРÐ"]; 2961 validateContract(); 2962 2963 additionalNumber.style.display = "none"; 2964 inputAdditionalNumber.disabled = true; 2965 formHidden.classList.add("is-active"); 2966 formMessage.classList.remove("is-active"); 2967 2968 } else if (formPaymentSelect.value === "ÐипеÑк") { 2969 formCheckboxOfertaLink.innerHTML = 2970 'СоглаÑен Ñ ÑÑловиÑми <a href="/local/templates/kuhzavod/f/docs/public_oferta_lip.pdf" class="oferta-link" target="_blank">договоÑа оÑеÑÑÑ</a> и <a href="/local/templates/kuhzavod/f/docs/policy_lip.pdf" class="oferta-link" target="_blank">полиÑикой конÑиденÑиалÑноÑÑи</a>'; 2971 formPayment.querySelector("[name=shop_id]").value = formPaymentSelectData.lip.shopid; 2972 correctPrefix = ["ÐÐЦ", "ÐÐÐЦ"]; 2973 validateContract(); 2974 2975 additionalNumber.style.display = "none"; 2976 inputAdditionalNumber.disabled = true; 2977 formHidden.classList.add("is-active"); 2978 formMessage.classList.remove("is-active"); 2979 2980 } else if (formPaymentSelect.value === "СаÑаÑов") { 2981 formCheckboxOfertaLink.innerHTML = 2982 'СоглаÑен Ñ ÑÑловиÑми <a href="/local/templates/kuhzavod/f/docs/public_oferta_sar.pdf" class="oferta-link" target="_blank">договоÑа оÑеÑÑÑ</a> и <a href="/local/templates/kuhzavod/f/docs/policy_sar.pdf" class="oferta-link" target="_blank">полиÑикой конÑиденÑиалÑноÑÑи</a>'; 2983 formPayment.querySelector("[name=shop_id]").value = formPaymentSelectData.sar.shopid; 2984 correctPrefix = ["ÐСР", "ÐÐСР"]; 2985 validateContract(); 2986 2987 additionalNumber.style.display = "none"; 2988 inputAdditionalNumber.disabled = true; 2989 formHidden.classList.add("is-active"); 2990 formMessage.classList.remove("is-active"); 2991 2992 } else { 2993 formHidden.classList.remove("is-active"); 2994 formMessage.classList.add("is-active"); 2995 } 2996 2997 choicedCity = formPaymentSelect.value; 2998 2999 return correctPrefix; 3000 } 3001 3002 function setInputs(input, inputFilter) { 3003 var listeners = [ 3004 "input", 3005 "keydown", 3006 "keyup", 3007 "mousedown", 3008 "mouseup", 3009 "select", 3010 "contextmenu", 3011 "drop", 3012 ]; 3013
3014 listeners.forEach(function (event) { 3015 input.addEventListener(event, function () { 3016 if (inputFilter(this.value)) { 3017 var correctValue = this.value; 3018 this.oldValue = this.value; 3019 this.oldSelectionStart = this.selectionStart; 3020 this.oldSelectionEnd = this.selectionEnd; 3021 } else if (this.hasOwnProperty("oldValue")) { 3022 this.value = this.oldValue; 3023 this.setSelectionRange(this.oldSelectionStart, this.oldSelectionEnd); 3024 } else { 3025 this.value = ""; 3026 } 3027 }); 3028 }); 3029 } 3030 3031 function validateContract() { 3032 if (formPayment) { 3033 validateRemoveValue(); 3034 3035 setInputs(numbers.querySelector("input"), function (value) { 3036 return /^[0-9_-]*$/i.test(value); 3037 }); 3038 3039 setInputs(prefix.querySelector("input"), function (value) { 3040 return /^[A-zÐ-ÑÐÑ]*$/i.test(value); 3041 }); 3042 } 3043 } 3044 3045 function validateRemoveValue() { 3046 prefix.querySelector("input").value = ""; 3047 numbers.querySelector("input").value = ""; 3048 3049 prefix.querySelector("input").dataset.required = ""; 3050 numbers.querySelector("input").dataset.required = ""; 3051 } 3052 3053 function validateInputs() { 3054 var inputPrefix = prefix.querySelector("input"); 3055 var inputNumbers = numbers.querySelector("input"); 3056 3057 inputPrefix.addEventListener("keyup", function (evt) { 3058 if (prefixCorrect.includes(this.value.toUpperCase())) { 3059 inputsDocsRequired.dataRequiredPrefix = this.dataset.required = "correct"; 3060 } else if (!prefixCorrect.includes(this.value.toUpperCase()) && this.value != "") { 3061 inputsDocsRequired.dataRequiredPrefix = this.dataset.required = "incorrect"; 3062 } else { 3063 inputsDocsRequired.dataRequiredPrefix = this.dataset.required = ""; 3064 } 3065 3066 changeCheckbox(checkbox, inputsDocsRequired); 3067 }); 3068 3069 inputNumbers.addEventListener("keyup", function (evt) { 3070 var regExp = /^\d/i; 3071 3072 if (this.value.length >= 2 && this.value.match(regExp)) { 3073 inputsDocsRequired.dataRequiredNumbers = this.dataset.required = "correct"; 3074 } else if (this.value.length <= 2) { 3075 inputsDocsRequired.dataRequiredNumbers = this.dataset.required = "incorrect"; 3076 } else if (this.value != "") { 3077 inputsDocsRequired.dataRequiredNumbers = this.dataset.required = "incorrect"; 3078 } else { 3079 inputsDocsRequired.dataRequiredNumbers = this.dataset.required = ""; 3080 } 3081 3082 changeCheckbox(checkbox, inputsDocsRequired); 3083 }); 3084 } 3085 3086 function changeCheckbox(checkbox, inputsRequired) { 3087 var contratsArray = Object.values(inputsRequired); 3088 3089 function isCorrect(str) { 3090 return str == "correct"; 3091 } 3092 3093 if (!contratsArray.every(isCorrect)) { 3094 formPayment.querySelector(".pay__footer button").classList.add("btn_disabled"); 3095 } else if (contratsArray.every(isCorrect) && checkbox.checked) { 3096 formPayment.querySelector(".pay__footer button").classList.remove("btn_disabled"); 3097 } else { 3098 formPayment.querySelector(".pay__footer button").classList.add("btn_disabled"); 3099 } 3100 3101 checkbox.addEventListener("change", function () { 3102 if (contratsArray.every(isCorrect)) { 3103 if (this.checked) { 3104 this.parentElement.nextElementSibling 3105 .querySelector("button") 3106 .classList.remove("btn_disabled"); 3107 } 3108 } else if (choicedCity === "ÐоÑква") { 3109 if (this.checked) { 3110 formPayment.querySelector(".pay__footer button").classList.remove("btn_disabled"); 3111 } else { 3112 formPayment.querySelector(".pay__footer button").classList.add("btn_disabled"); 3113 } 3114 } else { 3115 this.parentElement.nextElementSibling.querySelector("button").classList.add("btn_disabled"); 3116 } 3117 }); 3118 } 3119 3120 function checkedCity(city) { 3121 if (city != "ÐоÑква") { 3122 validateInputs(); 3123 validateContract(); 3124 3125 orderFieldSingle.classList.remove("show"); 3126 orderFieldTwain.classList.add("show"); 3127 } else { 3128 orderFieldTwain.classList.remove("show"); 3129 orderFieldSingle.classList.add("show"); 3130 } 3131 } 3132 3133 formPayment.querySelector(".pay__select").addEventListener("change", function (e) { 3134 validateRemoveValue(); 3135 prefixCorrect = detectCity(); 3136 checkedCity(e.target.value); 3137 }); 3138 3139 formPayment.querySelector(".form-method").addEventListener("change", function () { 3140 prefixCorrect = detectCity(); 3141 }); 3142 3143 detectCity(); 3144
3145 checkedCity(choicedCity); 3146 3147 changeCheckbox(checkbox, inputsDocsRequired); 3148 3149 formPayment.addEventListener("submit", function (e) { 3150 e.preventDefault(); 3151 3152 VK && VK.Retargeting.Event("lead"); 3153 window.ym && ym(35801930, "reachGoal", "payment"); 3154 window.yaCounter35801930 && yaCounter35801930.reachGoal("payment"); 3155 gtag("event", "payment", { 3156 event_category: "Forms", 3157 }); 3158 3159 this.submit(); 3160 }); 3161} 3162 3163//video 3164function videoServices() { 3165 const html = document.querySelector("html"); 3166 const shadow = document.querySelector(".video__shadow"); 3167 const wrapper = document.querySelector(".video__wrapper"); 3168 3169 function findVideos() { 3170 let videos = document.querySelectorAll(".video"); 3171 3172 for (let i = 0; i < videos.length; i++) { 3173 setupVideo(videos[i]); 3174 } 3175 } 3176 3177 function setupVideo(video) { 3178 let media = video.querySelector(".video__media"); 3179 let button = video.querySelector(".video__play"); 3180 let id = parseMediaURL(media); 3181 let iframe; 3182 let videoItem; 3183 3184 button.addEventListener("click", function () { 3185 if (iframe == undefined) { 3186 iframe = createIframe(id); 3187 } 3188 videoItem = wrapper.appendChild(iframe); 3189 video.classList.add("video_go"); 3190 shadow.classList.add("show"); 3191 html.classList.add("no-scroll"); 3192 closedVideo(video, videoItem); 3193 }); 3194 } 3195 3196 function parseMediaURL(media) { 3197 // let regexp = /https:\/\/i\.ytimg\.com\/vi\/([a-zA-Z0-9_-]+)\/maxresdefault\.jpg/i; 3198 let url = media.dataset.src; 3199 let match = url; 3200 3201 return url; 3202 } 3203 3204 function createIframe(id) { 3205 let iframe = document.createElement("video"); 3206 3207 iframe.setAttribute("autoplay", ""); 3208 iframe.setAttribute("controls", ""); 3209 iframe.setAttribute("controlsList", "nodownload"); 3210 iframe.setAttribute("src", generateURL(id)); 3211 iframe.classList.add("video-block__media"); 3212 3213 return iframe; 3214 } 3215 3216 function generateURL(id) { 3217 let query = "?rel=0&showinfo=0&autoplay=1"; 3218 let catalog = "video"; 3219 3220 // return 'https://kuhzavod.ru/' + id + query; 3221 3222 const str = "https://kuhzavod.ru/" + catalog + "/" + id; 3223 3224 if (window.innerWidth <= 767) { 3225 const newStr = str.replace("_desktop", "_mobile"); 3226 const newId = id.replace("_desktop", "_mobile"); 3227 let splitID = newId.split(".")[0]; 3228 3229 gtag("event", "play", { event_category: splitID }); 3230 3231 return newStr; 3232 } else { 3233 let splitID = id.split(".")[0]; 3234 3235 gtag("event", "play", { event_category: splitID }); 3236 3237 return str; 3238 } 3239 } 3240 3241 function closedVideo(element, video) { 3242 let close = wrapper.querySelector(".video__close"); 3243 let button = wrapper.querySelector(".video__play"); 3244 3245 close.addEventListener("click", function (e) { 3246 element.classList.remove("video_go"); 3247 shadow.classList.remove("show"); 3248 html.classList.remove("no-scroll"); 3249 video.remove(); 3250 }); 3251 } 3252 3253 findVideos(); 3254} 3255 3256// forms 3257function forms() { 3258 if (!$(".js-form").length) { 3259 return; 3260 } 3261 3262 var sending = false; 3263 3264 function validate($form) { 3265 var isCorrect = true; 3266 var $requiredInputs = $form.find("[required]"); 3267 3268 $requiredInputs.each(function () { 3269 var $input = $(this); 3270 var inputName = $input.attr("name"); 3271 var inputType = $input.attr("type"); 3272 var inputVal = $input.val(); 3273 3274 if (inputType === "radio" || inputType === "checkbox") { 3275 var checkedLength = $form.find('[name="' + inputName + '"]:checked').length; 3276 3277 if (!checkedLength) { 3278 isCorrect = false; 3279 } 3280 } 3281 if (inputType === "tel" && inputVal.length < 16) { 3282 isCorrect = false; 3283 } 3284 if (inputVal !== null && inputVal.trim() === "") { 3285 isCorrect = false;
3286 } 3287 }); 3288 3289 return isCorrect; 3290 } 3291 3292 function setCookie(name, value, options = {}) { 3293 options = { 3294 path: "/", 3295 "max-age": 30 * 24 * 60 * 60, 3296 ...options, 3297 }; 3298 3299 if (options.expires instanceof Date) { 3300 options.expires = options.expires.toUTCString(); 3301 } 3302 3303 let updatedCookie = encodeURIComponent(name) + "=" + encodeURIComponent(value); 3304 3305 for (let optionKey in options) { 3306 updatedCookie += "; " + optionKey; 3307 let optionValue = options[optionKey]; 3308 if (optionValue !== true) { 3309 updatedCookie += "=" + optionValue; 3310 } 3311 } 3312 3313 document.cookie = updatedCookie; 3314 } 3315 3316 $(document).on("input change", ".js-form [required]", function () { 3317 var $form = $(this).parents(".js-form"); 3318 var $submitBtn = $form.find('[type="submit"]'); 3319 var $submitBtnF = $form.find('button[data-action="submit"]'); 3320 var isCorrect = validate($form); 3321 3322 $submitBtn.prop("disabled", !isCorrect); 3323 $submitBtnF.prop("disabled", !isCorrect); 3324 }); 3325 3326 $(".js-form-size").on("change", function () { 3327 var $this = $(this); 3328 var type = $this.attr("data-value"); 3329 var $form = $this.parents(".js-form"); 3330 var $sizes = $form.find(".js-form-sizes"); 3331 var $submitBtn = $form.find('[type="submit"]'); 3332 var $submitBtnF = $form.find('button[data-action="submit"]'); 3333 3334 $sizes.attr("data-type", type); 3335 $sizes.find("input").each(function () { 3336 var $sizeInput = $(this); 3337 var typeArr = $sizeInput.attr("data-type") && $sizeInput.attr("data-type").split(", "); 3338 var isRequired = typeArr && typeArr.indexOf(type) > -1; 3339 3340 $sizeInput.prop("required", isRequired); 3341 }); 3342 3343 var isCorrect = validate($form); 3344 3345 $submitBtn.prop("disabled", !isCorrect); 3346 $submitBtnF.prop("disabled", !isCorrect); 3347 }); 3348 3349 $(document).on("submit", ".js-form", function (e) { 3350 e.preventDefault(); 3351 3352 if (sending || this.classList.contains('quiz__form')) { 3353 return; 3354 } 3355 3356 3357 var $this = $(this); 3358 var isPopup = $this.parents(".popup-blank").length; 3359 3360 var data = new FormData(e.target); 3361 var formType = $this.find('[name="form_type"]').val(); 3362 var name = $this.find('[name="name"]').val(); 3363 var tel = $this.find('[name="tel"]').val(); 3364 3365 var $submitBtn = $this.find('[type="submit"]'); 3366 var submitBtnText = $submitBtn.text(); 3367 $submitBtn.text("ÐÑпÑавлÑем..."); 3368 3369 var $submitBtnF = $this.find('button[data-action="submit"]'); 3370 var submitBtnTextF = $submitBtnF.text(); 3371 $submitBtnF.text("ÐÑпÑавлÑем..."); 3372 3373 // меÑÑика clientID 3374 var clientID = window.yaCounter35801930?.getClientID(); 3375 3376 if (clientID) { 3377 data.append('clientID', clientID); 3378 } 3379 // 3380 3381 var honeyPot = $this.find('[name="honeypot_field"]').val(); 3382 if(honeyPot) 3383 { 3384 window.ym(35801930,'reachGoal','boti'); 3385 console.info('ym.reachGoal.boti sended!'); 3386 } 3387 3388 sending = true; 3389 3390 $.ajax({ 3391 url: "/send.php", 3392 method: "POST", 3393 data: data, 3394 processData: false, 3395 contentType: false, 3396 success: function (data) { 3397 let response = null; 3398 sending = false; 3399 3400 try { 3401 response = JSON.parse(data); 3402 } catch (err) { 3403 response = null; 3404 } 3405 3406 // СеÑÐ²ÐµÑ Ð¾Ñклонил заÑÐ²ÐºÑ (капÑа не пÑоÑла, оÑÐ²ÐµÑ Ð¯Ð½Ð´ÐµÐºÑа долÑÑе 5 Ñ, 3407 // оÑибка PHP). РанÑÑе поÑеÑиÑÐµÐ»Ñ Ð²ÑÑ Ñавно видел «СпаÑибо», а лид ÑеÑÑлÑÑ. 3408 if (!response || !response.status || response.status === 'error') { 3409 $this.data('kzSendFailed', true); 3410 $submitBtn.text(submitBtnText); 3411 $submitBtnF.text(submitBtnTextF); 3412 $submitBtn.prop("disabled", false); 3413 $submitBtnF.prop("disabled", false); 3414 3415 if (window.smartCaptcha && e.target._smartCaptchaWidgetId !== undefined) { 3416 window.smartCaptcha.reset(e.target._smartCaptchaWidgetId); 3417 } 3418 e.target.dataset.smartCaptchaVerified = '0'; 3419 3420 alert('Ðе ÑдалоÑÑ Ð¾ÑпÑавиÑÑ Ð·Ð°ÑвкÑ. ÐопÑобÑйÑе еÑÑ Ñаз или позвониÑе нам.'); 3421 return; 3422 } 3423 3424 window.Comagic &&
3425 window.Comagic.addOfflineRequest({ 3426 name: e.target.name.value, 3427 phone: e.target.tel.value, 3428 }); 3429 3430 var $detailsMain = $('.details[data-id]'); 3431 if (formType === 'price-calc') { 3432 $this.trigger('purchase'); 3433 } else if ($detailsMain.length) { 3434 $detailsMain.trigger('purchase'); 3435 }else{ 3436 window._tmr.push({ type: 'reachGoal', id: 3154865, goal: 'vk_ecom_purchase'}); 3437 } 3438 3439 // reset inputs 3440 $this[0].reset(); 3441 $this.find(".attach-file").removeClass("is-uploaded").find(".attach-file__name").text(""); 3442 $submitBtn.text(submitBtnText); 3443 $submitBtn.prop("disabled", true); 3444 $submitBtnF.text(submitBtnTextF); 3445 $submitBtnF.prop("disabled", true); 3446 3447 if (isPopup) { 3448 $this.parents(".popup-blank").hide(); 3449 $('.popup-blank[data-id="success"]').show(); 3450 } else { 3451 $this.append('<span data-popup="success"></span>'); 3452 $this.find('[data-popup="success"]').trigger("click"); 3453 $this.remove('[data-popup="success"]'); 3454 } 3455 3456 if (formType === "sitephone") { 3457 $(".site-phone__container").toggleClass("show"); 3458 $(".site-phone__preview-btn").toggleClass("hide"); 3459 } 3460 3461 if (response.data && response.data.FIELDS && response.data.FIELDS.ASSIGNED_BY_ID == 74) { 3462 goals.formSend(formType); 3463 } 3464 3465 setCookie("leadgen", "true"); 3466 }, 3467 error: function (xhr, status, error) { 3468 console.log(error); 3469 $this.data('kzSendFailed', true); 3470 if (window.smartCaptcha && e.target._smartCaptchaWidgetId !== undefined) { 3471 window.smartCaptcha.reset(e.target._smartCaptchaWidgetId); 3472 } 3473 e.target.dataset.smartCaptchaVerified = '0'; 3474 alert('Ðе ÑдалоÑÑ Ð¾ÑпÑавиÑÑ Ð·Ð°ÑвкÑ. ÐÑовеÑÑÑе инÑеÑÐ½ÐµÑ Ð¸ попÑобÑйÑе еÑÑ Ñаз или позвониÑе нам.'); 3475 }, 3476 complete: function (xhr, status) { 3477 sending = false; 3478 $submitBtn.text(submitBtnText); 3479 $submitBtnF.text(submitBtnTextF); 3480 3481 // ÐоÑле ÑÑпеÑной оÑпÑавки ÑоÑма ÑбÑоÑена, кнопки вÑклÑÑÐµÐ½Ñ Ð´Ð¾ нового ввода. 3482 // ÐоÑле оÑибки кнопки оÑÑаÑÑÑÑ Ð²ÐºÐ»ÑÑÑннÑми, ÑÑÐ¾Ð±Ñ Ð¼Ð¾Ð¶Ð½Ð¾ бÑло повÑоÑиÑÑ. 3483 if (status === 'success' && !$this.data('kzSendFailed')) { 3484 $submitBtn.prop("disabled", true); 3485 $submitBtnF.prop("disabled", true); 3486 } 3487 $this.removeData('kzSendFailed'); 3488 } 3489 }); 3490 3491 }); 3492} 3493 3494/*Ñели*/ 3495 3496let goals = { 3497 /*ÐÑе ÑобÑÑÐ¸Ñ Ð¿Ñи оÑпÑавке ÑоÑмÑ*/ 3498 formSend: function (formType) { 3499 try { 3500 switch (formType) { 3501 case "3d-project": 3502 ym(35801930, 'reachGoal', 'lead') 3503 ym(35801930, 'reachGoal', 'get_3d') 3504 break; 3505 case "request-call": 3506 window.ym && ym(35801930, "reachGoal", "zvonokniz"); 3507 window.ym && ym(35801930, "reachGoal", "lead"); 3508 VK.Retargeting.Init("VK-RTRG-737480-1acJR"); 3509 VK.Retargeting.Event("lead"); 3510 3511 gtag("event", "zvonokniz", { 3512 event_category: "Forms", 3513 }); 3514 3515 const zakazat_zvonok = { 3516 type: "CONVERSION", 3517 /* config START */ 3518 site_id: "8159", 3519 order: [], 3520 transaction_id: "", 3521 revenue: "", 3522 pixel_id: "zakazat_zvonok" 3523 /* config END */ 3524 } 3525 3526 window.__GetI && __GetI.push(zakazat_zvonok); 3527 3528 break; 3529 case "price-calc": 3530 window.ym && ym(35801930, "reachGoal", "size"); 3531 window.ym && ym(35801930, "reachGoal", "lead"); 3532 VK.Retargeting.Init("VK-RTRG-737480-1acJR"); 3533 VK.Retargeting.Event("lead"); 3534 3535 gtag("event", "size", { 3536 event_category: "Forms", 3537 }); 3538 3539 const rasschitat_stoimost = { 3540 type: "CONVERSION", 3541 /* config START */ 3542 site_id: "8159", 3543 order: [], 3544 transaction_id: "", 3545 revenue: "", 3546 pixel_id: "rasschitat_stoimost" 3547 /* config END */ 3548 }; 3549 3550 window.__GetI && __GetI.push(rasschitat_stoimost); 3551 3552 break; 3553 case "favorites": 3554 window.ym && ym(35801930, "reachGoal", "favorites"); 3555 window.ym && ym(35801930, "reachGoal", "lead"); 3556 VK.Retargeting.Init("VK-RTRG-737480-1acJR"); 3557 VK.Retargeting.Event("lead"); 3558 3559 gtag("event", "favorites", { 3560 event_category: "Forms", 3561 }); 3562 3563 break; 3564 case "call-designer": 3565 window.ym && ym(35801930, "reachGoal", "vizovdis"); 3566 window.ym && ym(35801930, "reachGoal", "lead"); 3567 VK.Retargeting.Init("VK-RTRG-737480-1acJR"); 3568 VK.Retargeting.Event("lead"); 3569 3570 gtag("event", "vizovdis", { 3571 event_category: "Forms", 3572 }); 3573 3574 const vyzvat_designer = { 3575 type: "CONVERSION", 3576 /* config START */ 3577 site_id: "8159", 3578 order: [], 3579 transaction_id: "", 3580 revenue: "", 3581 pixel_id: "vyzvat_designer" 3582 /* config END */ 3583 }; 3584 window.__GetI && __GetI.push(vyzvat_designer); 3585 3586 break; 3587 case "calculate-project": 3588 window.ym && ym(35801930, "reachGoal", "shkaf_raschet"); 3589 window.ym && ym(35801930, "reachGoal", "lead_shkafi"); 3590 VK.Retargeting.Init("VK-RTRG-737480-1acJR"); 3591 VK.Retargeting.Event("lead"); 3592 3593 gtag("event", "shkaf_raschet", { 3594 event_category: "Forms", 3595 }); 3596 3597 break; 3598 case "call-designer-wardrobes": 3599 window.ym && ym(35801930, "reachGoal", "shkaf_designer"); 3600 window.ym && ym(35801930, "reachGoal", "lead_shkafi"); 3601 VK.Retargeting.Init("VK-RTRG-737480-1acJR"); 3602 VK.Retargeting.Event("lead"); 3603 3604 gtag("event", "shkaf_designer", { 3605 event_category: "Forms", 3606 }); 3607 3608 break; 3609 case "vacancy": 3610 window.ym && ym(35801930, "reachGoal", "sborschik"); 3611 gtag("event", "sborschik", { 3612 event_category: "Forms", 3613 }); 3614 3615 break; 3616 case "partners": 3617 window.ym && ym(35801930, "reachGoal", "zayavkaopt"); 3618 gtag("event", "zayavkaopt", { 3619 event_category: "Forms", 3620 }); 3621 break; 3622 case "subscribe": 3623 window.ym && ym(35801930, "reachGoal", "subscribe_blog"); 3624 gtag("event", "subscribe_blog", { 3625 event_category: "Forms", 3626 }); 3627 break; 3628 case "subscribe-blog": 3629 window.ym && ym(35801930, "reachGoal", "subscribe_blog"); 3630 gtag("event", "subscribe_blog", { 3631 event_category: "Forms", 3632 }); 3633 break; 3634 case "subscribe-article": 3635 window.ym && ym(35801930, "reachGoal", "subscribe_blog"); 3636 gtag("event", "subscribe_blog", { 3637 event_category: "Forms", 3638 }); 3639 break; 3640 case "feedback-production": 3641 window.ym && ym(35801930, "reachGoal", "feedback-production"); 3642 break; 3643 case "feedback-customer": 3644 window.ym && ym(35801930, "reachGoal", "feedback-customer"); 3645 break; 3646 case "credit": 3647 window.ym && ym(35801930, "reachGoal", "lead"); 3648 window.ym && ym(35801930, "reachGoal", "pre_send-form"); 3649 window.ym && ym(35801930, "reachGoal", "zayavkakredit"); 3650 window.ym && ym(35801930, "reachGoal", "rassrochka"); 3651 3652 gtag("event", "zayavkakredit", { 3653 event_category: "Forms", 3654 }); 3655 break; 3656 case "product-order": 3657 window.ym && ym(35801930, "reachGoal", "tekhnika_kupit"); 3658 // window.yaCounter35801930 && yaCounter35801930.reachGoal("tekhnika_kupit"); 3659 gtag("event", "tekhnika_kupit", { 3660 event_category: "Forms", 3661 }); 3662 break; 3663 case "order-card": 3664 window.ym && ym(35801930, "reachGoal", "tekhnika_kupit"); 3665 // window.yaCounter35801930 && yaCounter35801930.reachGoal("tekhnika_kupit"); 3666 gtag("event", "tekhnika_kupit", { 3667 event_category: "Forms", 3668 }); 3669 break; 3670 case "leadgen": 3671 window.ym && ym(35801930, "reachGoal", "leadgen"); 3672 window.ym && ym(35801930, "reachGoal", "lead"); 3673 // window.yaCounter35801930 && yaCounter35801930.reachGoal("leadgen"); 3674 // window.yaCounter35801930 && yaCounter35801930.reachGoal("lead"); 3675 break; 3676 case "leadgen_whatsapp": 3677 window.ym && ym(35801930, "reachGoal", "leadgen_whatsapp"); 3678 window.ym && ym(35801930, "reachGoal", "lead"); 3679 // window.yaCounter35801930 && yaCounter35801930.reachGoal("leadgen_whatsapp"); 3680 // window.yaCounter35801930 && yaCounter35801930.reachGoal("lead"); 3681 break; 3682 case "sitephone": 3683 window.ym && ym(35801930, "reachGoal", "sitephone"); 3684 window.ym && ym(35801930, "reachGoal", "lead"); 3685 // window.yaCounter35801930 && yaCounter35801930.reachGoal("sitephone"); 3686 // window.yaCounter35801930 && yaCounter35801930.reachGoal("lead"); 3687 // fbq('track','Lead'); 3688 VK.Retargeting.Init("VK-RTRG-737480-1acJR"); 3689 VK.Retargeting.Event("lead"); 3690 3691 gtag("event", "sitephone", { 3692 event_category: "Forms", 3693 }); 3694 3695 const sitePhoneOrder = { 3696 type: "CONVERSION", 3697 /* config START */ 3698 site_id: "8159", 3699 order: [], 3700 transaction_id: "", 3701 revenue: "", 3702 pixel_id: "zakazat_zvonok" 3703 /* config END */ 3704 } 3705 3706 window.__GetI && __GetI.push(sitePhoneOrder); 3707 break; 3708 case "gift": 3709 ym(35801930, "reachGoal", "akciya_send"); 3710 ym(35801930, "reachGoal", "lead"); 3711 } 3712 } catch (e) { 3713 console.log(e); 3714 } 3715 3716 var _tmr = window._tmr || (window._tmr = []); 3717 _tmr.push({ type: "reachGoal", id: 3154865, goal: "lead" }); 3718 }, 3719 3720 /*Ñели пÑи оÑкÑÑÑии модалÑнÑÑ ÑоÑм*/ 3721 clicks: function () { 3722 let modals = [ 3723 "request-call", 3724 "call-designer", 3725 "price-calc", 3726 "price-calc-short", 3727 "favorites", 3728 "subscribe", 3729 "calculate-project", 3730 "vacancy", 3731 "call-designer-wardrobes", 3732 "credit", 3733 "product-order", 3734 "order-card", 3735 "gift", 3736 "favorites-short", 3737 "3d-project" 3738 ];
3739 modals.forEach((item) => { 3740 $(document).on("click", `[data-popup="${item}"]`, (e) => { 3741 window.ym && ym(35801930, "reachGoal", "all_forms_open"); 3742 3743 try { 3744 switch (e.target.getAttribute("data-popup")) { 3745 case "3d-project": 3746 console.log('opened 3d popup'); 3747 break; 3748 case "request-call": 3749 window.ym && ym(35801930, "reachGoal", "zvonokniz_open"); 3750 VK.Retargeting.Init("VK-RTRG-737480-1acJR"); 3751 VK.Retargeting.Event("micro"); 3752 break; 3753 case "price-calc": 3754 window.ym && ym(35801930, "reachGoal", "size_open"); 3755 VK.Retargeting.Init("VK-RTRG-737480-1acJR"); 3756 VK.Retargeting.Event("micro"); 3757 3758 const priceCalcOpen = { 3759 type: "CART_ADD", 3760 /* config START */ 3761 site_id: "8159", 3762 order: [], 3763 transaction_id: "", 3764 revenue: "", 3765 pixel_id: "vizov_formi" 3766 /* config END */ 3767 } 3768 3769 const priceCalcFormOpen = { 3770 type: "CONVERSION", 3771 /* config START */ 3772 site_id: "8159", 3773 order: [], 3774 transaction_id: "", 3775 revenue: "", 3776 pixel_id: "form_open" 3777 /* config END */ 3778 } 3779 3780 window.__GetI && __GetI.push(priceCalcOpen); 3781 window.__GetI && __GetI.push(priceCalcFormOpen); 3782 3783 break; 3784 case "price-calc-short": 3785 window.ym && ym(35801930, "reachGoal", "size_open"); 3786 VK.Retargeting.Init("VK-RTRG-737480-1acJR"); 3787 VK.Retargeting.Event("micro"); 3788 3789 const priceCalcShortOpen = { 3790 type: "CART_ADD", 3791 /* config START */ 3792 site_id: "8159", 3793 order: [], 3794 transaction_id: "", 3795 revenue: "", 3796 pixel_id: "vizov_formi" 3797 /* config END */ 3798 } 3799 3800 const priceCalcShortFormOpen = { 3801 type: "CONVERSION", 3802 /* config START */ 3803 site_id: "8159", 3804 order: [], 3805 transaction_id: "", 3806 revenue: "", 3807 pixel_id: "form_open" 3808 /* config END */ 3809 } 3810 3811 window.__GetI && __GetI.push(priceCalcShortOpen); 3812 window.__GetI && __GetI.push(priceCalcShortFormOpen); 3813 3814 break; 3815 case "favorites": 3816 ym && ym(35801930, "reachGoal", "favorites_open"); 3817 VK.Retargeting.Init("VK-RTRG-737480-1acJR"); 3818 VK.Retargeting.Event("micro"); 3819 break; 3820 case "call-designer": 3821 window.ym && ym(35801930, "reachGoal", "vizovdis_open"); 3822 VK.Retargeting.Init("VK-RTRG-737480-1acJR"); 3823 VK.Retargeting.Event("micro"); 3824 3825 const callDesigner = { 3826 type: "CART_ADD", 3827 /* config START */ 3828 site_id: "8159", 3829 order: [], 3830 transaction_id: "", 3831 revenue: "", 3832 pixel_id: "vizov_formi" 3833 /* config END */ 3834 } 3835 3836 const callDesignerFormOpen = { 3837 type: "CONVERSION", 3838 /* config START */ 3839 site_id: "8159", 3840 order: [], 3841 transaction_id: "", 3842 revenue: "", 3843 pixel_id: "form_open" 3844 /* config END */ 3845 } 3846 3847 window.__GetI && __GetI.push(callDesigner); 3848 window.__GetI && __GetI.push(callDesignerFormOpen); 3849 3850 break; 3851 case "calculate-project": 3852 window.ym && ym(35801930, "reachGoal", "shkaf_raschet_open"); 3853 VK.Retargeting.Init("VK-RTRG-737480-1acJR"); 3854 VK.Retargeting.Event("micro"); 3855 break; 3856 case "call-designer-wardrobes": 3857 window.ym && ym(35801930, "reachGoal", "shkaf_designer_open"); 3858 VK.Retargeting.Init("VK-RTRG-737480-1acJR"); 3859 VK.Retargeting.Event("micro"); 3860 break; 3861 case "vacancy": 3862 window.ym && ym(35801930, "reachGoal", "sborschik_open"); 3863 break; 3864 case "subscribe": 3865 window.ym && ym(35801930, "reachGoal", "subscribe_blog_open"); 3866 break; 3867 case "credit": 3868 window.ym && ym(35801930, "reachGoal", "pre_send-form_open"); 3869 window.ym && ym(35801930, "reachGoal", "rassrochka_open"); 3870 break; 3871 case "product-order": 3872 window.ym && ym(35801930, "reachGoal", "tekhnika_kupit_open"); 3873 break; 3874 case "order-card": 3875 window.ym && ym(35801930, "reachGoal", "tekhnika_kupit_open"); 3876 break; 3877 case "gift": 3878 ym(35801930, "reachGoal", "akciya_open"); 3879 break 3880 case "favorites-short": 3881 ym(35801930, "reachGoal", "favorites-short_open"); 3882 break 3883 } 3884 } catch (e) { 3885 console.log(e); 3886 } 3887 }); 3888 }); 3889 /*клик по кнопке видеообзоÑа*/
3890 $(document).on("click", ".catalog-card__video", () => { 3891 window.ym && ym(35801930, "reachGoal", "video_catalog"); 3892 // window.yaCounter35801930 && yaCounter35801930.reachGoal("video_catalog"); 3893 }); 3894 3895 /*клик по кнопке видеообзоÑа*/ 3896 $(document).on("click", ".rozygrysh_tekhnika", () => { 3897 window.ym && ym(35801930, "reachGoal", "rozygrysh_tekhnika"); 3898 // window.yaCounter35801930 && yaCounter35801930.reachGoal("rozygrysh_tekhnika"); 3899 }); 3900 3901 /* клик по номеÑÑ ÑелеÑона*/ 3902 $(document).on("click", ".footer-contacts__phone", () => { 3903 // fbq('track', 'Lead'); 3904 // fbq('track','Contact'); 3905 VK.Retargeting.Event("lead"); 3906 }); 3907 $(document).on("click", ".header__phone", () => { 3908 // fbq('track', 'Lead'); 3909 // fbq('track','Contact') 3910 // ; 3911 VK.Retargeting.Event("lead"); 3912 const phone = { 3913 type: "CONVERSION", 3914 /* config START */ 3915 site_id: "8159", 3916 order: [], 3917 transaction_id: "", 3918 revenue: "", 3919 pixel_id: "telephone" 3920 /* config END */ 3921 }; 3922 window.__GetI && __GetI.push(phone); 3923 }); 3924 3925 /* sitephone */ 3926 $(document).on("click", ".site-phone__preview-btn", () => { 3927 window.ym && ym(35801930, "reachGoal", "open_sitephone"); 3928 // window.yaCounter35801930 && yaCounter35801930.reachGoal("open_sitephone"); 3929 // fbq('track','Lead',{ content_name: 'micro'}); 3930 VK.Retargeting.Init("VK-RTRG-737480-1acJR"); 3931 VK.Retargeting.Event("micro"); 3932 }); 3933 }, 3934}; 3935 3936// catalog 3937function filterSelectWork() { 3938 document.body.addEventListener("click", (e) => { 3939 let allSelects = document.querySelectorAll(".filter__select"); 3940 if (allSelects.length > 0) { 3941 allSelects.forEach((sel) => { 3942 if (e.target.closest(".filter__select") != sel) { 3943 sel.classList.remove("active"); 3944 } 3945 }); 3946 } 3947 3948 if (e.target.closest(".filter__select")) { 3949 let item = e.target.closest(".filter__select"); 3950 let selText = item.querySelector(".filter-js"); 3951 let select = item.querySelector(".filter__select-hidden"); 3952 3953 item.classList.toggle("active"); 3954 3955 if (e.target.closest(".filter__select-options")) { 3956 let opt = item.querySelectorAll(".filter__select-option"); 3957 opt.forEach((element, i) => { 3958 if (e.target == element) { 3959 selText.innerHTML = element.innerHTML; 3960 select.selectedIndex = i; 3961 select.dispatchEvent(new Event("change")); 3962 } 3963 }); 3964 } 3965 } 3966 }); 3967} 3968 3969function SelectStart() { 3970 let selectArr = document.querySelectorAll(".filter__select-hidden"); 3971 if (selectArr.length > 0) { 3972 selectArr.forEach((item) => { 3973 item.nextElementSibling.querySelector(".filter-js").innerHTML = 3974 item.querySelector("option").textContent; 3975 }); 3976 } 3977} 3978 3979function resetFilters() { 3980 let resetBtn = document.querySelector(".filter__reset"); 3981 3982 if (resetBtn) { 3983 let selects = document.querySelectorAll(".filter__select-hidden"); 3984 let checkboxes = document.querySelectorAll(".filter__radio"); 3985 let formCheckboxes = document.querySelectorAll(".filter__form-radio"); 3986 3987 resetBtn.addEventListener("click", () => { 3988 selects.forEach((item) => { 3989 item.selectedIndex = 0; 3990 }); 3991 SelectStart(); 3992 catalogResetChecked(checkboxes, formCheckboxes); 3993 }); 3994 } 3995} 3996 3997function catalogResetChecked(arrayCheckboxes, arrayRadio) { 3998 arrayCheckboxes.forEach((item) => { 3999 item.checked = false; 4000 }); 4001 4002 arrayRadio.forEach((item, i) => { 4003 if (i == 0) { 4004 item.checked = true; 4005 } else item.checked = false;
4006 }); 4007} 4008 4009document.addEventListener("DOMContentLoaded", () => { 4010 filterSelectWork(); 4011 // SelectStart(); 4012 resetFilters(); 4013}); 4014 4015// function catalog() { 4016// var params = {}; 4017// var locationSearch = location.search.slice(1); 4018// var catalogCardSlider = null; 4019// 4020// let checkboxes = document.querySelectorAll('.filter__radio'); 4021// let formCheckboxes = document.querySelectorAll('.filter__form-radio'); 4022// 4023// locationSearch.split('&').forEach(function (item) { 4024// var param = item.split('='); 4025// if (param[0] === 'tag') { 4026// params[param[0]] = param[1] ? param[1].split(',') : []; 4027// } else { 4028// params[param[0]] = param[1] || ''; 4029// } 4030// }); 4031// 4032// function initCatalogCardSlider() { 4033// catalogCardSlider = new Swiper('.catalog-card__slider', { 4034// lazy: true, 4035// loop: true, 4036// navigation: { 4037// prevEl: '.swiper-button-prev', 4038// nextEl: '.swiper-button-next' 4039// }, 4040// pagination: { 4041// el: '.swiper-pagination', 4042// type: 'bullets', 4043// } 4044// }); 4045// } 4046// 4047// function initClosetSlider() { 4048// if (!$('.work-examples-slider-js').length) { 4049// return; 4050// } 4051// 4052// $('.work-examples-slider-js').owlCarousel({ 4053// items: 1, 4054// loop: true, 4055// nav: true, 4056// navText: ["<span data-dynamic='icn-arrow-r-light'>\
4057// <svg class='icn-arrow-r-light' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 24'>\ 4058// <path d='M0,24l12-12L0,0'></path>\ 4059// </svg>\ 4060// </span>", 4061// "<span data-dynamic='icn-arrow-r-light'>\ 4062// <svg class='icn-arrow-r-light' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 24'>\ 4063// <path d='M0,24l12-12L0,0'></path>\ 4064// </svg>\ 4065// </span>" 4066// ], 4067// margin: 0, 4068// mouseDrag: document.documentMode ? false : true, // IE check 4069// autoplayHoverPause: true, 4070// autoplay: false, 4071// dots: true, 4072// lazyLoad: true 4073// }); 4074// } 4075// 4076// function startLoading() { 4077// $('.js-catalog, .work-examples__wrapper').addClass('is-loading'); 4078// } 4079// 4080// function endLoading() { 4081// $('.catalog__wrapper').trigger('ajaxLoad'); 4082// $('.js-catalog, .work-examples__wrapper').removeClass('is-loading'); 4083// initCatalogCardSlider(); 4084// initClosetSlider(); 4085// updateCheckboxes(); 4086// } 4087// 4088// function updateCheckboxes() { 4089// // СбÑаÑÑваем вÑе ÑекбокÑÑ 4090// checkboxes.forEach(function (checkbox) { 4091// checkbox.checked = false; 4092// }); 4093// 4094// // УÑÑанавливаем ÑекбокÑÑ Ð¸Ð· паÑамеÑÑов 4095// checkboxes.forEach(function (checkbox) { 4096// var name = checkbox.getAttribute('data-get'); 4097// var value = checkbox.value; 4098// if (params[name]) { 4099// if (Array.isArray(params[name])) { 4100// checkbox.checked = params[name].includes(value); 4101// } else { 4102// checkbox.checked = params[name] === value; 4103// } 4104// } 4105// }); 4106// } 4107// 4108// 4109// function loadCatalog() { 4110// var searchParams = ''; 4111// 4112// for (var key in params) { 4113// if (params[key] && params[key].length) { 4114// if (Array.isArray(params[key])) { 4115// searchParams += (searchParams ? '&' : '') + key + '=' + params[key].join(','); 4116// } else { 4117// searchParams += (searchParams ? '&' : '') + key + '=' + params[key]; 4118// } 4119// } 4120// } 4121// 4122// if (searchParams) { 4123// searchParams = '?' + searchParams; 4124// } 4125// 4126// history.replaceState(null, '', location.pathname + searchParams); 4127// if ($('.filter__count').length) { 4128// $('.filter__count').load(location.pathname + searchParams + ' .filter__count span'); 4129// } 4130// if ($('.catalog__wrapper').length) { 4131// $('.catalog__wrapper').load(location.pathname + searchParams + ' .catalog__content', endLoading); 4132// } 4133// if ($('.work-examples').length) { 4134// $('.work-examples__pagination-js').load(location.pathname + searchParams + ' .paginator'); 4135// $('.work-examples__wrapper').load(location.pathname + searchParams + ' .work-examples__content', endLoading); 4136// } 4137// } 4138// 4139// $('.js-filter input, .js-filter select').on('change', function () { 4140// var $this = $(this); 4141// var name = $this.attr('data-get'); 4142// var value = $this.val(); 4143// var type = $this.attr('type'); 4144// var isDefault = false;
4145// 4146// if ($this.is('select')) { 4147// isDefault = $this.attr('data-default') === value; 4148// catalogGoals(name, value); 4149// } else if (type === 'radio') { 4150// isDefault = $this.attr('data-default') === ''; 4151// } else if (type === 'checkbox') { 4152// if (!params[name]) { 4153// params[name] = []; 4154// } 4155// if ($this.prop('checked')) { 4156// if (!params[name].includes(value)) { 4157// params[name].push(value); 4158// } 4159// } else { 4160// var index = params[name].indexOf(value); 4161// if (index !== -1) { 4162// params[name].splice(index, 1); 4163// } 4164// } 4165// 4166// updateCheckboxes(); 4167// } 4168// 4169// if (name === 'category') { 4170// if (window.innerWidth >= 560) { 4171// var $select = $this.parents('.js-filter').find('select[data-get="category"]'); 4172// var $selected = $select.next().find('.filter-js'); 4173// 4174// $select.value = value; 4175// $selected.text($select.find('[value="' + value + '"]').text()); 4176// } else { 4177// var $input = $this.parents('.js-filter').find('input[data-get="category"][value="' + value + '"]'); 4178// 4179// $input.prop('checked', true); 4180// } 4181// } 4182// 4183// if (name !== 'tag') { 4184// params[name] = isDefault ? '' : value; 4185// } 4186// 4187// for (var key in params) { 4188// if (key.indexOf('PAGEN') !== -1) { 4189// params[key] = ''; 4190// } 4191// } 4192// 4193// function catalogGoals(name, value) { 4194// ym(35801930, 'reachGoal', name + '_' + value); 4195// ym(35801930, 'reachGoal', 'filter_lead'); 4196// } 4197// 4198// startLoading(); 4199// loadCatalog(); 4200// }); 4201// 4202// $('.js-filter-reset').on('click', function () { 4203// params = {}; 4204// startLoading(); 4205// loadCatalog(); 4206// }); 4207// 4208// $(document).on('click', '.js-catalog-more', function () { 4209// params = {}; 4210// startLoading(); 4211// catalogResetChecked(checkboxes, formCheckboxes); 4212// 4213// $('html, body').animate({ 4214// scrollTop: $('.js-filter').offset().top - 50 4215// }, loadCatalog); 4216// 4217// }); 4218// 4219// $(document).on('click', '.js-catalog-page', function (e) { 4220// e.preventDefault(); 4221// 4222// var pageSearch = $(this).attr('href').split('?')[1]; 4223// 4224// if (pageSearch) { 4225// var pageParam = pageSearch.split('='); 4226// 4227// params[pageParam[0]] = pageParam[1]; 4228// } else { 4229// for (var key in params) { 4230// if (key.indexOf('PAGEN') !== -1) { 4231// params[key] = ''; 4232// } 4233// } 4234// } 4235// 4236// startLoading(); 4237// 4238// $('html, body').animate({ 4239// scrollTop: $('.js-filter').offset().top - 50 4240// }, loadCatalog); 4241// }); 4242// 4243// $('.examples-menu__link').on('click', function() { 4244// params = {} 4245// params.category = $(this).data('filter') === 'sort__filter-all' ? '' : $(this).data('filter'); 4246// 4247// startLoading(); 4248// loadCatalog(); 4249// }); 4250// 4251// 4252// } 4253 4254 4255function catalog() { 4256 var params = {}; 4257 var locationSearch = location.search.slice(1); 4258 var catalogCardSlider = null; 4259 4260 let checkboxes = document.querySelectorAll(".filter__radio"); 4261 let formCheckboxes = document.querySelectorAll(".filter__form-radio"); 4262 4263 locationSearch.split("&").forEach(function (item) { 4264 var param = item.split("="); 4265 params[param[0]] = param[1]; 4266 }); 4267 4268 // locationSearch.split('&').forEach(function (item) { 4269 // var param = item.split('='); 4270 // if (param[0] === 'tag') { 4271 // params[param[0]] = param[1] ? param[1].split(',') : []; 4272 // } else { 4273 // params[param[0]] = param[1] || ''; 4274 // } 4275 // }); 4276 4277 function initCatalogCardSlider() { 4278 catalogCardSlider = new Swiper(".catalog-card__slider", { 4279 lazy: true, 4280 loop: true, 4281 navigation: { 4282 prevEl: ".swiper-button-prev", 4283 nextEl: ".swiper-button-next", 4284 }, 4285 pagination: { 4286 el: ".swiper-pagination", 4287 type: "bullets", 4288 }, 4289 on: { 4290 slideChange: function () { 4291 $(this.el).parents('.catalog-card').trigger('watch'); 4292 } 4293 } 4294 }); 4295 } 4296 4297 function initClosetSlider() { 4298 if (!$(".work-examples-slider-js").length) { 4299 return; 4300 } 4301 4302 $(".work-examples-slider-js").owlCarousel({ 4303 items: 1, 4304 loop: true, 4305 nav: true, 4306 navText: [ 4307 "<span data-dynamic='icn-arrow-r-light'>\ 4308 <svg class='icn-arrow-r-light' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 24'>\ 4309 <path d='M0,24l12-12L0,0'></path>\ 4310 </svg>\ 4311 </span>", 4312 "<span data-dynamic='icn-arrow-r-light'>\ 4313 <svg class='icn-arrow-r-light' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 24'>\ 4314 <path d='M0,24l12-12L0,0'></path>\ 4315 </svg>\ 4316 </span>", 4317 ], 4318 margin: 0, 4319 mouseDrag: document.documentMode ? false : true, // IE check 4320 autoplayHoverPause: true, 4321 autoplay: false, 4322 dots: true, 4323 lazyLoad: true, 4324 }); 4325 } 4326 4327 function startLoading() { 4328 $(".js-catalog, .work-examples__wrapper").addClass("is-loading"); 4329 } 4330 4331 function endLoading() { 4332 $(".catalog__wrapper").trigger("ajaxLoad"); 4333 $(".js-catalog, .work-examples__wrapper").removeClass("is-loading"); 4334 initCatalogCardSlider(); 4335 initClosetSlider(); 4336 } 4337 4338 function loadCatalog() { 4339 var searchParams = ""; 4340 4341 for (var key in params) { 4342 if (params[key]) { 4343 searchParams += (searchParams ? "&" : "") + key + "=" + params[key]; 4344 } 4345 } 4346 4347 if (searchParams) searchParams = "?" + searchParams; 4348 4349 history.replaceState(null, "", location.pathname + searchParams); 4350 4351 $.ajax({ 4352 url: location.pathname + searchParams, 4353 method: "GET", 4354 dataType: "html", 4355 beforeSend: function () { 4356 }, 4357 success: function (html) { 4358 var $doc = $("<div>").append($.parseHTML(html)); 4359 4360 if ($(".filter__count").length) { 4361 var $newCount = $doc.find(".filter__count span").first(); 4362 if ($newCount.length) { 4363 $(".filter__count").html($newCount.html()); 4364 } 4365 } 4366 4367 if ($(".catalog__wrapper").length) { 4368 var $newCatalog = $doc.find(".catalog__content").first(); 4369 if ($newCatalog.length) { 4370 $(".catalog__wrapper").html($newCatalog); 4371 } 4372 } 4373 4374 if ($(".work-examples").length) { 4375 var $newPaginator = $doc.find(".work-examples__pagination-js").first(); 4376 if ($newPaginator.length) { 4377 $(".work-examples__pagination-js").html($newPaginator.html()); 4378 } 4379 4380 var $newWorkContent = $doc.find(".work-examples__content").first(); 4381 if ($newWorkContent.length) { 4382 $(".work-examples__wrapper").html($newWorkContent); 4383 } 4384 } 4385 4386 if (typeof endLoading === "function") endLoading(); 4387 }, 4388 error: function () { 4389 if (typeof endLoading === "function") endLoading(); 4390 } 4391 }); 4392 } 4393 4394 $(".js-filter input, .js-filter select").on("change", function () { 4395 var $this = $(this); 4396 var name = $this.attr("data-get"); 4397 var value = $this.val(); 4398 var type = $this.attr("type"); 4399 var isDefault = false;
4400 4401 console.log($this) 4402 4403 if ($(this).prop("checked")) { 4404 catalogGoals(name, value); 4405 } 4406 4407 if ($this.is("select")) { 4408 isDefault = $this.attr("data-default") === value; 4409 catalogGoals(name, value); 4410 } else if (type === "radio") { 4411 isDefault = $this.attr("data-default") === ""; 4412 } else if (type === "checkbox") { 4413 $this.siblings('[type="checkbox"]').prop("checked", false); 4414 isDefault = !$this.prop("checked"); 4415 } 4416 4417 if (name === "category") { 4418 if (window.innerWidth >= 560) { 4419 var $select = $this.parents(".js-filter").find('select[data-get="category"]'); 4420 var $selected = $select.next().find(".filter-js"); 4421 4422 $select.value = value; 4423 $selected.text($select.find('[value="' + value + '"]').text()); 4424 } else { 4425 var $input = $this 4426 .parents(".js-filter") 4427 .find('input[data-get="category"][value="' + value + '"]'); 4428 4429 $input.prop("checked", true); 4430 } 4431 } 4432 4433 params[name] = isDefault ? "" : value; 4434 4435 for (var key in params) { 4436 if (key.indexOf("PAGEN") !== -1) { 4437 params[key] = ""; 4438 } 4439 } 4440 4441 function catalogGoals(name, value) { 4442 window.ym && ym(35801930, "reachGoal", name + "_" + value); 4443 window.ym && ym(35801930, "reachGoal", "filter_lead"); 4444 window.yaCounter35801930 && yaCounter35801930.reachGoal(name + "_" + value); 4445 window.yaCounter35801930 && yaCounter35801930.reachGoal("filter_lead"); 4446 } 4447 4448 startLoading(); 4449 loadCatalog(); 4450 }); 4451 4452 $(".js-filter-reset").on("click", function () { 4453 params = {}; 4454 startLoading(); 4455 loadCatalog(); 4456 }); 4457 4458 $(document).on("click", ".js-catalog-more", function () { 4459 params = {}; 4460 startLoading(); 4461 catalogResetChecked(checkboxes, formCheckboxes); 4462 4463 $("html, body").animate( 4464 { 4465 scrollTop: $(".js-filter").offset().top - 50, 4466 }, 4467 loadCatalog 4468 ); 4469 }); 4470 4471 $(document).on("click", ".js-catalog-page", function (e) { 4472 e.preventDefault(); 4473 4474 var pageSearch = $(this).attr("href").split("?")[1]; 4475 4476 if (pageSearch) { 4477 var pageParam = pageSearch.split("="); 4478 4479 params[pageParam[0]] = pageParam[1]; 4480 } else { 4481 for (var key in params) { 4482 if (key.indexOf("PAGEN") !== -1) { 4483 params[key] = ""; 4484 } 4485 } 4486 } 4487 4488 startLoading(); 4489 4490 $('html').animate( 4491 { 4492 scrollTop: $(".js-filter").offset().top - 50, 4493 }, 4494 loadCatalog 4495 ); 4496 }); 4497 4498 $(".work-examples-styled").on("click", function () { 4499 $(".work-examples__menu").addClass("active"); 4500 }); 4501 4502 $(".examples-menu__link").on("click", function () { 4503 params = {}; 4504 params.category = $(this).data("filter") === "sort__filter-all" ? "" : $(this).data("filter"); 4505 4506 $(".work-examples__menu").removeClass("active"); 4507 $(".examples-menu__link").removeClass("active"); 4508 $(this).addClass("active"); 4509 $(".work-examples-styled").text($(this).text()); 4510 4511 startLoading(); 4512 loadCatalog(); 4513 }); 4514} 4515 4516function share() { 4517 var shareItem = $(".share__item"); 4518 if (shareItem) { 4519 shareItem.click(function (e) { 4520 console.log($(this).data("type")); 4521 e.preventDefault(); 4522 $(".ya-share2") 4523 .find("." + $(this).data("type") + " .ya-share2__title") 4524 .click(); 4525 }); 4526 } 4527} 4528 4529function swiperCloset() { 4530 const swiperThumb = new Swiper(".swiper-thumbs-js", { 4531 direction: "horizontal", 4532 freeMode: true, 4533 watchSlidesVisibility: true, 4534 watchSlidesProgress: true, 4535 grabCursor: true, 4536 spaceBetween: 12, 4537 preloadImages: true, 4538 lazyLoad: true, 4539 slidesPerView: 5, 4540 breakpoints: { 4541 1080: { 4542 slidesPerView: 9 4543 }, 4544 901: { 4545 slidesPerView: 6 4546 }, 4547 450: { 4548 slidesPerView: 7 4549 }, 4550 } 4551 }); 4552 const swiperCloset = new Swiper(".swiper-closet-js", { 4553 navigation: { 4554 nextEl: ".swiper-button-next", 4555 prevEl: ".swiper-button-prev", 4556 }, 4557 spaceBetween: 10, 4558 slidesPerView: 1, 4559 preloadImages: true, 4560 // lazyLoad: true, 4561 // lazy: { 4562 // loadPrevNext: true, 4563 // }, 4564 4565 thumbs: { 4566 swiper: swiperThumb, 4567 } 4568 }); 4569 const swiperClosetModels = new Swiper(".closet__models-fotos-js", { 4570 navigation: { 4571 nextEl: ".swiper-button-next", 4572 prevEl: ".swiper-button-prev", 4573 }, 4574 spaceBetween: 5, 4575 slidesPerView: 1, 4576 preloadImages: true, 4577 loop: true, 4578 4579 lazy: { 4580 loadPrevNext: true, 4581 }, 4582 }); 4583 4584 $(".closet__slides").magnificPopup({ 4585 delegate: ".closet-slider__zoom", 4586 type: "image", 4587 closeBtnInside: false, 4588 gallery: { 4589 enabled: true, 4590 tCounter: "", 4591 }, 4592 zoom: { 4593 enabled: true, 4594 }, 4595 }); 4596} 4597 4598function cosetTabs() { 4599 const tabs = document.querySelectorAll(".closet__tabs-item"); 4600 4601 if (tabs.length > 0) {
4602 tabs.forEach((item) => { 4603 item.addEventListener("click", () => { 4604 let flag; 4605 4606 if (item.classList.contains("active")) { 4607 flag = true; 4608 } else { 4609 flag = false; 4610 } 4611 tabs.forEach((tab) => { 4612 tab.classList.remove("active"); 4613 }); 4614 4615 if (window.innerWidth < 1361 && flag) { 4616 return false; 4617 } else { 4618 item.classList.add("active"); 4619 } 4620 }); 4621 }); 4622 } 4623} 4624 4625//mask 4626function phoneMask() { 4627 let phone = document.querySelectorAll("input[data-phone]"); 4628 4629 phone.forEach(function (el) { 4630 el.addEventListener("input", function (e) { 4631 let val = e.target.value.replace(/\D/g, ""); 4632 4633 if (val) { 4634 if (val[0] === "7" || val[0] === "8") { 4635 val = val.slice(1); 4636 } 4637 4638 val = val.match(/(\d{0,3})(\d{0,3})(\d{0,2})(\d{0,2})/); 4639 val = 4640 "+7" + 4641 (val[2] ? "(" + val[1] + ")" + val[2] : val[1] ? val[1] : "") + 4642 (val[3] ? "-" + val[3] : "") + 4643 (val[4] ? "-" + val[4] : ""); 4644 } 4645 4646 e.target.value = val; 4647 }); 4648 }); 4649} 4650 4651function ecommerce() { 4652 var $calcPopup = $('[data-id="price-calc-short"]'); 4653 var $calcForm = $calcPopup.find('form'); 4654 var $calcIdInput = $calcForm.find('input[name="item_id"]'); 4655 var $calcNameInput = $calcForm.find('input[name="item"]'); 4656 var $calcCategoryInput = $calcForm.find('input[name="category"]'); 4657 var $calcPriceInput = $calcForm.find('input[name="price"]'); 4658 var $detailsMain = $('.details[data-id]'); 4659 var slideWatched = []; 4660 4661 function pushEntry(actionType, id, name, category, price) { 4662 var entry = { 4663 ecommerce: { 4664 currencyCode: 'RUB', 4665 [actionType]: { 4666 products: [{ 4667 id, 4668 name, 4669 category, 4670 quantity: 1 4671 }] 4672 } 4673 } 4674 }; 4675 4676 if (actionType === 'purchase') { 4677 entry.ecommerce[actionType].actionField = { 4678 id 4679 } 4680 } 4681 4682 window.dataLayer = window.dataLayer || [] 4683 window.dataLayer.push(entry); 4684 4685 // tmr 4686 var tmrGoals = { 4687 detail: 'vk_ecom_product', 4688 add: 'vk_ecom_cart', 4689 purchase: 'vk_ecom_purchase' 4690 } 4691 4692 window._tmr = window._tmr || [] 4693 window._tmr.push({ 4694 type: 'reachGoal', 4695 id: 3154865, 4696 value: price, 4697 goal: tmrGoals[actionType], 4698 params: { product_id: id } 4699 }) 4700 } 4701 4702 // оÑкÑÑÑие деÑалÑной ÑÑÑаниÑÑ 4703 (function () { 4704 if ($detailsMain.length) { 4705 var id = $detailsMain.data('id'); 4706 var name = $detailsMain.data('name'); 4707 var category = $detailsMain.data('category'); 4708 var price = $detailsMain.data('price'); 4709 4710 pushEntry('detail', id, name, category, price); 4711 } 4712 })() 4713 4714 // пÑоÑмоÑÑ Ñлайдов в каÑалоге 4715 $(document).on('watch', '.catalog-card', function () { 4716 var $calcBtn = $(this).find('.catalog-card__btn'); 4717 var id = $calcBtn.data('id'); 4718 var name = $calcBtn.data('name'); 4719 var category = $calcBtn.data('category'); 4720 var price = $calcBtn.data('price'); 4721 4722 if (slideWatched.includes(id)) return 4723 4724 pushEntry('detail', id, name, category, price); 4725 slideWatched.push(id); 4726 }); 4727 4728 // оÑкÑÑÑие ÑоÑÐ¼Ñ ÑаÑÑеÑа 4729 $calcPopup.on('open', function () { 4730 var id = $calcIdInput.val(); 4731 var name = $calcNameInput.val(); 4732 var category = $calcCategoryInput.val(); 4733 var price = $calcPriceInput.val(); 4734 4735 pushEntry('detail', id, name, category, price); 4736 pushEntry('add', id, name, category, price); 4737 }); 4738 4739 // оÑпÑавка ÑоÑÐ¼Ñ ÑаÑÑеÑа 4740 $calcForm.on('purchase', function () { 4741 var id = $calcIdInput.val(); 4742 var name = $calcNameInput.val(); 4743 var category = $calcCategoryInput.val(); 4744 var price = $calcPriceInput.val(); 4745 4746 pushEntry('purchase', id, name, category, price); 4747 }); 4748 4749 // оÑпÑавка ÑоÑÐ¼Ñ Ñ Ð´ÐµÑалÑной ÑÑÑаниÑÑ 4750 $detailsMain.on('purchase', function () { 4751 var id = $(this).data('id'); 4752 var name = $(this).data('name'); 4753 var category = $(this).data('category'); 4754 var price = $(this).data('price'); 4755 4756 pushEntry('purchase', id, name, category, price); 4757 }); 4758}; 4759 4760function changeActiveTimeInForm() { 4761 let buttons = document.querySelectorAll('.js-form-time-choose') 4762 if (buttons) { 4763 buttons.forEach((button) => { 4764 button.addEventListener('click', () => { 4765 button.classList.toggle('is-active') 4766 button.nextElementSibling.classList.toggle("active-time") 4767 }) 4768 }) 4769 } 4770} 4771 4772function swiperAtSinkPage() { 4773 4774 let sinkSlider = document.querySelector('.js-sink-slider') 4775 if (sinkSlider) { 4776 const sinkSwiper = new Swiper('.js-sink-slider', { 4777 loop: true, 4778 spaceBetween: 30, 4779 slidesPerView: 3, 4780 navigation: { 4781 nextEl: '.js-sink-slider_next', 4782 prevEl: '.js-sink-slider_prev' 4783 }, 4784 breakpoints: { 4785 640: { 4786 slidesPerView: 1, 4787 }, 4788 1200: { 4789 slidesPerView: 2, 4790 } 4791 } 4792 }) 4793 } 4794} 4795/** 4796 * 4797 * @param {*} callback ÑÑнкÑÐ¸Ñ ÐºÐ¾ÑоÑÐ°Ñ Ð²ÑзÑваеÑÑÑ Ð¿Ñи ÑдаÑной оÑÑабоÑке ÑÑнкÑии 4798 * 4799 */ 4800function userActivity(callback) { 4801 const intervalLength = 5_000 4802 let is_user_active = false;
4803 const baseScrolling = document.documentElement.scrollTop || window.pageYOffset; 4804 4805 const getDataFromLocalStorage = () => { 4806 let localStorageData = localStorage.getItem('sessionActivity') 4807 return JSON.parse(localStorageData) 4808 } 4809 4810 /** 4811 * ÐÑли Ñ Ð¿Ð¾Ð»ÑзоваÑÐµÐ»Ñ Ñже ÑÑо-Ñо еÑÑÑ Ð² localStorage Ñо ÑабоÑаем Ñ ÐµÐ³Ð¾ даннÑми 4812 * ÐÑли неÑ, Ñо ÑÑавим Ñвои даннÑе по ÑмолÑÐ°Ð½Ð¸Ñ 4813 * @type {any|{1: boolean, 2: boolean, 3: boolean, 4: boolean, 5: boolean, 6: boolean}} 4814 */ 4815 const active_time = getDataFromLocalStorage() ?? { 4816 1: false, 4817 2: false, 4818 3: false, 4819 4: false, 4820 5: false, 4821 6: false 4822 4823 } 4824 4825 const putDataToLocalStorage = (data) => { 4826 localStorage.setItem('sessionActivity', JSON.stringify(data)); 4827 } 4828 const eventWindowScrolling = () => { 4829 const scrollTop = window.pageYOffset || document.documentElement.scrollTop; 4830 if (scrollTop !== baseScrolling) { 4831 is_user_active = true; 4832 } 4833 4834 } 4835 const eventWindowResize = () => { 4836 is_user_active = true 4837 } 4838 const eventButtonKeyDown = () => { 4839 is_user_active = true 4840 } 4841 const eventButtonKeyUp = () => { 4842 is_user_active = true 4843 } 4844 const eventClickOnWindow = () => { 4845 is_user_active = true 4846 } 4847 const eventMopuseMove = (event) => { 4848 is_user_active = true 4849 } 4850 function addActivityListeners() { 4851 window.addEventListener('scroll', eventWindowScrolling) 4852 window.addEventListener('resize', eventWindowResize) 4853 window.addEventListener('keydown', eventButtonKeyDown) 4854 window.addEventListener('keyup', eventButtonKeyUp) 4855 window.addEventListener('click', eventClickOnWindow) 4856 window.addEventListener("mousemove", eventMopuseMove) 4857 } 4858 const removeActivityListeners = () => { 4859 window.removeEventListener('scroll', eventWindowScrolling) 4860 window.removeEventListener('resize', eventWindowResize) 4861 window.removeEventListener('keydown', eventButtonKeyDown) 4862 window.removeEventListener('keyup', eventButtonKeyUp) 4863 window.removeEventListener('click', eventClickOnWindow) 4864 window.removeEventListener("mousemove", eventMopuseMove) 4865 } 4866 addActivityListeners(); 4867 // ÐÑÐ¾Ñ Ð¾Ð´Ð¸Ð¼ÑÑ Ð¿Ð¾ вÑем даннÑм и полÑÑаем акÑивнÑй инÑÐµÐºÑ ( не пÑойденного инÑеÑвала) 4868 // РпÑоÑивном ÑлÑÑае полÑÑаем 1 Ðак пеÑвÑй ÑÐ»ÐµÐ¼ÐµÐ½Ñ 4869 const getActiveIterationIndex = () => { 4870 for (i = 1; i <= Object.keys(active_time).length; i++) { 4871 if (active_time[i] === false) { 4872 return i 4873 } 4874 } 4875 return false 4876 } 4877 4878 let start_i = getActiveIterationIndex(); 4879 const dataArrayLength = Object.keys(active_time).length; 4880 4881 4882 function setActivitySectionTimer() { 4883 if (start_i <= dataArrayLength) { 4884 setTimeout(() => { 4885 if (is_user_active === false) {
4886 setActivitySectionTimer() 4887 } else { 4888 active_time[start_i] = is_user_active; 4889 is_user_active = false; 4890 putDataToLocalStorage(active_time) 4891 start_i++ 4892 setActivitySectionTimer() 4893 } 4894 }, intervalLength) 4895 } else { 4896 removeActivityListeners() 4897 callback() 4898 return 4899 } 4900 } 4901 4902 if (start_i !== false) { // пÑовеÑÑем, ÑÑо акÑивноÑÑÑ Ð½Ðµ законÑена 4903 setActivitySectionTimer() 4904 } else { 4905 console.log('activity check finished') 4906 } 4907 4908 4909} 4910const activityFunction = () => { 4911 ym(35801930, 'reachGoal', 'active_60sec') 4912} 4913 4914 4915document.addEventListener("DOMContentLoaded", function () { 4916 changeActiveTimeInForm(); 4917 swiperAtSinkPage() 4918 city(); 4919 payment(); 4920 // videoServices(); 4921 forms(); 4922 catalog(); 4923 share(); 4924 4925 goals.clicks(); 4926 swiperCloset(); 4927 cosetTabs(); 4928 phoneMask(); 4929 ecommerce(); 4930 informationButtons(); 4931 interactiveButtons(); 4932 userActivity(activityFunction); 4933 initTargets(); 4934 4935}); 4936 4937// $('.filter-menu__item_js').on('click', function (e){ 4938// //console.log('sss'); 4939// e.preventDefault(); 4940// // $.ajax('/sinks/#catalog-sinks') 4941// // .done(function (e){ 4942// // console.log(e); 4943// // 4944// // }); 4945// 4946// // $('.catalog__content').load($(this).attr('href') + ' .catalog__content'); 4947// // history.pushState({}, document.title, $(this).attr('href')); 4948// }); 4949// 4950function informationButtons() { 4951 let infoButtons = document.querySelectorAll('.js-information-button') 4952 infoButtons.forEach((button) => { 4953 button.addEventListener('click', function () { 4954 if (button.classList.contains('active')) { 4955 button.nextElementSibling.style = '0px' 4956 button.classList.remove('active') 4957 } else { 4958 let answer = button.nextElementSibling 4959 button.classList.add('active') 4960 answer.style.height = answer.scrollHeight + 'px' 4961 } 4962 4963 4964 }) 4965 }) 4966} 4967 4968function initTargets() { 4969 const forms = document.querySelectorAll('form'); 4970 targetInputs = ['tel', 'name']; 4971 forms.forEach(form => { 4972 targetInputs.forEach(targetInput => { 4973 const input = form[targetInput]; 4974 if (input) { 4975 input.setAttribute('onfocus', "ym(35801930,'reachGoal','started_filling_field')"); 4976 } 4977 }); 4978 }); 4979} 4980 4981function interactiveButtons() { 4982 let roundButton = document.querySelectorAll('.js-filling-interactive-round-button') 4983 roundButton.forEach((roundButton) => { 4984 roundButton.addEventListener('mouseenter', function () { 4985 roundButton.parentNode.parentNode.classList.add('active') 4986 }) 4987 roundButton.addEventListener('mouseleave', function () { 4988 if (roundButton.parentElement.parentNode.classList.contains('active')) { 4989 roundButton.parentNode.parentNode.classList.remove('active') 4990 } 4991 }) 4992 roundButton.addEventListener('click', function () { 4993 roundButton.parentNode.parentNode.classList.add('active') 4994 console.log('click') 4995 }) 4996 }) 4997} 4998 4999function loadVideo(video) { 5000 5001 if (video.dataset.loaded) return; 5002 5003 const source = video.querySelector('source'); 5004 5005 if (source && source.dataset.src) { 5006 source.src = source.dataset.src; 5007 video.load(); 5008 video.dataset.loaded = true; 5009 } 5010 5011} 5012 5013 5014let videoWithSound = null; 5015let progressVideo = null; 5016 5017// lazy video loader 5018function loadVideo(video) { 5019 if (video.dataset.loaded) return; 5020 5021 const source = video.querySelector('source'); 5022 if (source && source.dataset.src) { 5023 source.src = source.dataset.src; 5024 video.load(); 5025 video.dataset.loaded = true; 5026 } 5027} 5028 5029// progress animation (один на вÑе видео) 5030function progressLoop() { 5031 5032 if (progressVideo && !progressVideo.paused) { 5033 5034 const slide = progressVideo.closest('.swiper-slide'); 5035 const bar = slide.querySelector('.video-progress-bar'); 5036 5037 const progress = (progressVideo.currentTime / progressVideo.duration) * 100; 5038 bar.style.width = progress + "%"; 5039 } 5040 5041 requestAnimationFrame(progressLoop); 5042} 5043 5044progressLoop(); 5045 5046function initReviewsSlider() { 5047 if (!document.querySelector(".js-review-slider")) { 5048 return; 5049 } 5050 5051 const sliderElement = document.querySelector('.js-review-slider'); 5052 const slides = [...sliderElement.querySelectorAll('.swiper-slide')]; 5053 5054 // ÐобавлÑем пÑогÑеÑÑ-Ð±Ð°Ñ Ð´Ð»Ñ ÐºÐ°Ð¶Ð´Ð¾Ð³Ð¾ видео
5055 slides.forEach(slide => { 5056 5057 const wrapper = slide.querySelector('.reviews__video'); 5058 5059 const progress = document.createElement('div'); 5060 progress.className = 'video-progress'; 5061 progress.innerHTML = '<div class="video-progress-bar"></div>'; 5062 5063 wrapper.appendChild(progress); 5064 5065 }); 5066 5067 5068 const swiper = new Swiper('.js-review-slider', { 5069 5070 spaceBetween: 8, 5071 5072 navigation: { 5073 nextEl: '.js-reviews-swiper-button_next', 5074 prevEl: '.js-reviews-swiper-button_prev', 5075 }, 5076 5077 breakpoints: { 5078 0: { slidesPerView: 1.2 }, 5079 420: { slidesPerView: 1.2 }, 5080 530: { slidesPerView: 1.5 }, 5081 640: { slidesPerView: 2.2 }, 5082 840: { slidesPerView: 4.1 }, 5083 1100: { slidesPerView: 4.1 }, 5084 1240: { slidesPerView: 4.1 }, 5085 }, 5086 5087 on: { 5088 5089 init() { 5090 5091 const active = this.slides[this.activeIndex]; 5092 const next = this.slides[this.activeIndex + 1]; 5093 5094 const v1 = active?.querySelector('video'); 5095 const v2 = next?.querySelector('video'); 5096 5097 if (v1) loadVideo(v1); 5098 if (v2) loadVideo(v2); 5099 5100 }, 5101 5102 slideChange() { 5103
5104 slides.forEach(slide => { 5105 5106 const video = slide.querySelector('video'); 5107 const bar = slide.querySelector('.video-progress-bar'); 5108 const playBtn = slide.querySelector('.video-play'); 5109 const wrapper = slide.querySelector('.reviews__video'); 5110 5111 video.pause(); 5112 video.currentTime = 0; 5113 5114 wrapper.classList.remove('active'); 5115 playBtn.classList.remove('hidden'); 5116 bar.style.width = "0%"; 5117 5118 video.muted = true; 5119 5120 }); 5121 5122 videoWithSound = null; 5123 progressVideo = null; 5124 5125 const active = this.slides[this.activeIndex]; 5126 const next = this.slides[this.activeIndex + 1]; 5127 5128 const v1 = active?.querySelector('video'); 5129 const v2 = next?.querySelector('video'); 5130 5131 if (v1) loadVideo(v1); 5132 if (v2) loadVideo(v2); 5133 5134 } 5135 5136 } 5137 5138 }); 5139
5140 slides.forEach(slide => { 5141 5142 const wrapper = slide.querySelector('.reviews__video'); 5143 const video = slide.querySelector('video'); 5144 const bar = slide.querySelector('.video-progress-bar'); 5145 5146 video.muted = true; 5147 video.loop = true; 5148 video.playsInline = true; 5149 5150 slide.addEventListener('mouseenter', () => { 5151 5152 if (videoWithSound === video) return; 5153 5154 loadVideo(video); 5155 5156 wrapper.classList.add('active'); 5157 5158 video.play().catch(()=>{}); 5159 progressVideo = video; 5160 5161 }); 5162 5163 slide.addEventListener('mouseleave', () => { 5164 5165 if (videoWithSound === video) return; 5166 5167 video.pause(); 5168 video.currentTime = 0; 5169 5170 wrapper.classList.remove('active'); 5171 bar.style.width = "0%"; 5172 5173 progressVideo = null; 5174 5175 }); 5176 5177 wrapper.addEventListener('click', e => { 5178 5179 e.stopPropagation(); 5180 5181 loadVideo(video); 5182 5183 // вÑклÑÑаем ÑекÑÑее Ñо звÑком 5184 if (videoWithSound === video) { 5185 5186 video.muted = true; 5187 video.pause(); 5188 video.currentTime = 0; 5189 5190 wrapper.classList.remove('active'); 5191 bar.style.width = "0%"; 5192 5193 videoWithSound = null; 5194 progressVideo = null; 5195 5196 return; 5197 } 5198 5199 // вÑклÑÑаем дÑÑгое 5200 if (videoWithSound) { 5201 5202 const prevSlide = videoWithSound.closest('.swiper-slide'); 5203 5204 videoWithSound.muted = true; 5205 videoWithSound.pause(); 5206 videoWithSound.currentTime = 0; 5207 5208 prevSlide.querySelector('.reviews__video').classList.remove('active'); 5209 prevSlide.querySelector('.video-progress-bar').style.width = "0%"; 5210 5211 } 5212 5213 video.muted = false; 5214 video.play().catch(()=>{}); 5215 5216 wrapper.classList.add('active'); 5217 5218 videoWithSound = video; 5219 progressVideo = video; 5220 5221 }); 5222 5223 }); 5224} 5225 5226function initMasonryReviews() { 5227 if (!document.querySelector('.js-masonry')) return; 5228 5229 const masonry = new Masonry('.js-masonry', { 5230 itemSelector: '.masonry-item', 5231 columnWidth: '.masonry-item', 5232 percentPosition: true, 5233 gutter: 20, 5234 transitionDuration: '0.3s' 5235 }); 5236 5237 function updateColumns() { 5238 const containerWidth = document.querySelector('.js-masonry').offsetWidth; 5239 const masonryItems = document.querySelectorAll('.masonry-item'); 5240 5241 if (window.innerWidth <= 768 && window.innerWidth >640) { 5242 5243 const columnWidth = (containerWidth - 20) / 2; 5244 masonryItems.forEach(item => { 5245 item.style.width = columnWidth + 'px'; 5246 }); 5247 } else if(window.innerWidth <=640) { 5248 // ÐÐ»Ñ Ð´ÐµÑкÑопов - авÑо ÑиÑина 5249 masonryItems.forEach(item => { 5250 const columnWidth = containerWidth 5251 item.style.width = columnWidth + 'px'; 5252 }); 5253 }else{ 5254 masonryItems.forEach(item => { 5255 item.style.width = ''; 5256 }); 5257} 5258 5259 5260 masonry.reloadItems(); 5261 masonry.layout(); 5262 } 5263 5264 5265 updateColumns(); 5266 5267 5268 let resizeTimer; 5269 window.addEventListener('resize', function() { 5270 clearTimeout(resizeTimer); 5271 resizeTimer = setTimeout(updateColumns, 250); 5272 }); 5273 5274 5275 const showMoreBtn = document.querySelector('.js-reviews-show-more'); 5276 if (showMoreBtn) { 5277 showMoreBtn.addEventListener('click', () => { 5278 const hiddenElems = document.querySelectorAll('.hidden.js-review-hidden'); 5279 5280 if (hiddenElems.length <= 9) { 5281 showMoreBtn.remove(); 5282 } 5283 5284 for (let i = 0; i < Math.min(9, hiddenElems.length); i++) { 5285 hiddenElems[i].classList.remove('hidden', 'js-review-hidden'); 5286 } 5287 5288 masonry.reloadItems(); 5289 masonry.layout(); 5290 }); 5291 } 5292} 5293 5294 5295document.querySelector('.js-reviews-show-more')?.addEventListener('click', function () { 5296 const currentBatch = parseInt(this.dataset.currentBatch || 1); 5297 const nextBatch = currentBatch + 1; 5298 5299 const nextItems = document.querySelectorAll('.js-review-hidden[data-review-batch="' + currentBatch + '"]'); 5300 if (nextItems.length === 0) { 5301 this.remove(); 5302 return; 5303 } 5304
5305 nextItems.forEach(el => { 5306 el.classList.remove('hidden'); 5307 el.classList.remove('js-review-hidden'); 5308 }); 5309 5310 this.dataset.currentBatch = nextBatch; 5311 5312 if (!document.querySelector('.js-review-hidden')) { 5313 this.remove(); 5314 } 5315}); 5316 5317 5318 5319 5320document.addEventListener('DOMContentLoaded', function(){ 5321 initReviewsSlider() 5322 initMasonryReviews() 5323 //showMoreReviews() 5324}) 5325 5326 5327function onloadFunction() { 5328 if (!window.smartCaptcha) { 5329 return; 5330 } 5331 5332 var CAPTCHA_SITEKEY = 'ysc1_TgXrZeE33deoj5Ao0CsbWMil13t7UFY0isUwBBtj4ab10c3b'; 5333 5334 function isRequestCallForm(form) { 5335 var blank = form.closest('.popup-blank'); 5336 return !!(blank && blank.getAttribute('data-id') === 'request-call'); 5337 } 5338 5339 // Ðдин Ð²Ð¸Ð´Ð¶ÐµÑ Ð½Ð° ÑоÑмÑ, и ÑолÑко когда ÑоÑма понадобилаÑÑ: оÑкÑÑÑ Ð¿Ð¾Ð¿Ð°Ð¿ 5340 // Ñ Ð½ÐµÐ¹, ÑоÑма попала в ÑкÑан или полÑзоваÑÐµÐ»Ñ Ð½Ð°Ñал ÐµÑ Ð·Ð°Ð¿Ð¾Ð»Ð½ÑÑÑ. 5341 // РанÑÑе вÑе 18-19 виджеÑов ÑоздавалиÑÑ Ð¿Ñи загÑÑзке ÑÑÑаниÑÑ: 34 iframe, 5342 // около 150 запÑоÑов и 13 ÐРкода на каждÑй пÑоÑмоÑÑ. 5343 function initCaptchaForForm(form) { 5344 if (!form || !window.smartCaptcha) { 5345 return null; 5346 } 5347 5348 if (form._smartCaptchaWidgetId !== undefined) { 5349 return form._smartCaptchaWidgetId; 5350 } 5351 5352 var captchaPlace = form.querySelector('.captcha-container'); 5353 5354 if (!captchaPlace) { 5355 return null; 5356 } 5357 5358 /** еÑли капÑа Ð²Ð¸Ð´Ð¸Ð¼Ð°Ñ ÑÑÑанавливаем ÑооÑвеÑÑÑвÑÑÑий пÑизнак */ 5359 var isVisible = isRequestCallForm(form); 5360 form._smartCaptchaVisible = isVisible; 5361 5362 function callback(token) { 5363 var tokenInput = form.querySelector('input[name="smart-token"]'); 5364 5365 if (!tokenInput) { 5366 tokenInput = document.createElement('input'); 5367 tokenInput.type = 'hidden'; 5368 tokenInput.name = 'smart-token'; 5369 form.appendChild(tokenInput); 5370 } 5371 5372 tokenInput.value = token; 5373 5374 form.dataset.smartCaptchaVerified = '1'; 5375 5376 if (!isVisible) { 5377 if (form.classList.contains('quiz__form')) { 5378 form.requestSubmit(); 5379 return; 5380 } 5381 $(form).trigger('submit'); 5382 } 5383 } 5384 5385 var widgetId = window.smartCaptcha.render(captchaPlace, { 5386 sitekey: CAPTCHA_SITEKEY, 5387 invisible: !isVisible, 5388 hideShield: true, 5389 callback: callback, 5390 shieldPosition: 'center-right', 5391 }); 5392 5393 form._smartCaptchaWidgetId = widgetId; 5394 5395 return widgetId; 5396 } 5397 5398 function hasCaptcha(form) { 5399 return !!(form && form.querySelector && form.querySelector('.captcha-container')); 5400 } 5401 5402 // Ðнопка оÑпÑавки: ÑнаÑала пÑовеÑка капÑи, поÑом submit (как и ÑанÑÑе). 5403 // ÐбÑабоÑÑик веÑаеÑÑÑ Ð½Ð° ÑÐ°Ð¼Ñ ÐºÐ½Ð¾Ð¿ÐºÑ, как бÑло до паÑÑа, а не делегиÑÑеÑÑÑ 5404 // докÑменÑÑ: Ñ .popup-blank и .order-card ÑÑÐ¾Ð¸Ñ stopPropagation на клик, 5405 // и из попапа нажаÑие до докÑменÑа не Ð´Ð¾Ñ Ð¾Ð´Ð¸Ñ. ÐÐ¸Ð´Ð¶ÐµÑ ÑоздаÑÑÑÑ Ð·Ð´ÐµÑÑ Ð¶Ðµ, 5406 // еÑли к ÑÑÐ¾Ð¼Ñ Ð¼Ð¾Ð¼ÐµÐ½ÑÑ ÐµÐ³Ð¾ еÑÑ Ð½ÐµÑ. 5407 document.querySelectorAll('form button[data-action="submit"]').forEach(function (button) { 5408 var form = button.form || button.closest('form'); 5409 5410 if (!hasCaptcha(form)) { 5411 return; 5412 } 5413 5414 button.addEventListener('click', function (event) { 5415 event.preventDefault(); 5416 5417 var widgetId = initCaptchaForForm(form); 5418 5419 if (widgetId === null || widgetId === undefined) { 5420 return; 5421 } 5422 5423 /** Ð²Ð¸Ð´Ð¸Ð¼Ð°Ñ ÐºÐ°Ð¿Ñа: полÑзоваÑÐµÐ»Ñ Ñам ÐµÑ Ð¿ÑÐ¾Ñ Ð¾Ð´Ð¸Ñ, еÑли Ñокен Ñже полÑÑен â ÑÑÐ°Ð·Ñ Ð¾ÑпÑавлÑем ÑоÑмÑ. */ 5424 if (form._smartCaptchaVisible) { 5425 if (form.dataset.smartCaptchaVerified === '1') { 5426 if (form.classList.contains('quiz__form')) { 5427 form.requestSubmit(); 5428 } else { 5429 $(form).trigger('submit'); 5430 } 5431 } 5432 return; 5433 } 5434 5435 form.dataset.smartCaptchaVerified = '0'; 5436 window.smartCaptcha.execute(widgetId); 5437 }); 5438 }); 5439 5440 // Ðопап оÑкÑÑлÑÑ: попап-ÑоÑÐ¼Ñ ÑендеÑÑÑ ÐºÐ°Ð¿ÑÑ Ð² ÑÑÐ¾Ñ Ð¼Ð¾Ð¼ÐµÐ½Ñ. 5441 $(document).on('open', '.popup-blank', function () { 5442 $(this).find('form').each(function () { 5443 initCaptchaForForm(this); 5444 }); 5445 }); 5446 5447 // ÐолÑзоваÑÐµÐ»Ñ Ð½Ð°Ñал заполнÑÑÑ ÑоÑмÑ: Ð²Ð¸Ð´Ð¶ÐµÑ Ð´Ð¾Ð»Ð¶ÐµÐ½ бÑÑÑ Ð³Ð¾Ñов к оÑпÑавке. 5448 $(document).on('focusin change', 'form', function () { 5449 if (hasCaptcha(this)) { 5450 initCaptchaForForm(this); 5451 } 5452 }); 5453 5454 // СÑÑÐ°Ñ Ð¾Ð²ÐºÐ° Ð´Ð»Ñ ÑоÑм Ñо Ñвоим обÑабоÑÑиком submit (квиз): Ð²Ð¸Ð´Ð¶ÐµÑ ÑоздаÑÑÑÑ 5455 // до Ñого, как обÑабоÑÑик ÑоÑÐ¼Ñ ÐµÐ³Ð¾ ÑпÑоÑиÑ. 5456 document.addEventListener('submit', function (event) { 5457 if (hasCaptcha(event.target)) { 5458 initCaptchaForForm(event.target); 5459 } 5460 }, true); 5461 5462 // ÐÑÑÑоеннÑе ÑоÑÐ¼Ñ (не в попапе): Ð²Ð¸Ð´Ð¶ÐµÑ ÑоздаÑÑÑÑ Ð¿Ñи пÑиближении к ÑкÑанÑ. 5463 var inlineForms = Array.prototype.filter.call(document.querySelectorAll('form'), function (form) { 5464 return hasCaptcha(form) && !form.closest('.popup'); 5465 }); 5466 5467 if ('IntersectionObserver' in window) { 5468 var io = new IntersectionObserver(function (entries) {
5469 entries.forEach(function (entry) { 5470 if (!entry.isIntersecting) { 5471 return; 5472 } 5473 5474 initCaptchaForForm(entry.target); 5475 io.unobserve(entry.target); 5476 }); 5477 }, { rootMargin: '300px' }); 5478 5479 inlineForms.forEach(function (form) { 5480 io.observe(form); 5481 }); 5482 } else { 5483 inlineForms.forEach(initCaptchaForForm); 5484 } 5485 5486 // Ðопап мог оÑкÑÑÑÑÑÑ ÑанÑÑе, Ñем загÑÑзилÑÑ captcha.js. 5487 $('.popup-blank:visible form').each(function () { 5488 initCaptchaForForm(this); 5489 }); 5490 5491 $(document).on('click', '.add-to-cart-js', function(e){ 5492 e.preventDefault(); 5493 var productId = parseInt($(this).data('product-id'), 10); 5494 if (isNaN(productId) || productId <= 0) return; 5495 5496 var match = document.cookie.match(/(^|;)\s*cart_ids=([^;]+)/); 5497 var cart = []; 5498 if (match) { 5499 try { 5500 cart = JSON.parse(decodeURIComponent(match[2])); 5501 if (!Array.isArray(cart)) cart = []; 5502 } catch (err) { 5503 cart = []; 5504 } 5505 } 5506 5507 if (cart.indexOf(productId) === -1) { 5508 cart.push(productId); 5509 var value = JSON.stringify(cart); 5510 var expires = new Date(); 5511 expires.setTime(expires.getTime() + 7 * 24 * 60 * 60 * 1000); 5512 document.cookie = 'cart_ids=' + encodeURIComponent(value) + '; expires=' + expires.toUTCString() + '; path=/'; 5513 } 5514 5515 $('[id="cart-count"]').text(cart.length); 5516 $('[data-product-id="' + productId + '"].already-in-cart-js').removeClass('disabled'); 5517 $('[data-product-id="' + productId + '"].add-to-cart-js').addClass('disabled'); 5518 5519 }); 5520 5521 $(document).on('click', '.delete-from-cart-js', function (e) { 5522 e.preventDefault(); 5523 var productId = parseInt($(this).data('product-id'), 10); 5524 if (isNaN(productId) || productId <= 0) return; 5525 5526 var match = document.cookie.match(/(^|;)\s*cart_ids=([^;]+)/); 5527 var cart = []; 5528 if (match) { 5529 try { 5530 cart = JSON.parse(decodeURIComponent(match[2])); 5531 if (!Array.isArray(cart)) cart = []; 5532 } catch (err) { 5533 cart = []; 5534 } 5535 } 5536 5537 var idx = cart.indexOf(productId); 5538 if (idx !== -1) { 5539 cart.splice(idx, 1); 5540 var value = JSON.stringify(cart); 5541 var expires = new Date(); 5542 expires.setTime(expires.getTime() + 7 * 24 * 60 * 60 * 1000); 5543 document.cookie = 'cart_ids=' + encodeURIComponent(value) + '; expires=' + expires.toUTCString() + '; path=/'; 5544 } 5545 5546 let urlObj = new URL(window.location.href); 5547 let Url = urlObj.toString(); 5548 $.ajax({ 5549 url: Url, 5550 type: 'GET', 5551 success: function(data) { 5552 const $tempDiv = $('<div>').html(data); 5553 const $newSection = $tempDiv.find('.basket-container-js'); 5554 5555 if ($newSection.length) { 5556 $('.basket-container-js').html($newSection.html()); 5557 } 5558 $('[id="cart-count"]').text(cart.length); 5559 }, 5560 error: function(jqXHR, textStatus, errorThrown) { 5561 console.error('ÐÑибка пÑи загÑÑзке:', errorThrown); 5562 } 5563 }); 5564 }); 5565} 5566$(function () { 5567 const $buttons = $('.interactive_closet_btn'); 5568 const $mainImage = $('#interactiveClosetMainImage'); 5569 const $descriptionWrapper = $('.interactive_closet_description-wrapper'); 5570 const $descriptionNoteWrapper = $('.interactive_closet_description-note_wrapper'); 5571 const $descriptionImage = $('#interactiveClosetDescriptionImage'); 5572 const $descriptionTitle = $('#interactiveClosetDescriptionTitle'); 5573 const $descriptionText = $('#interactiveClosetDescriptionText'); 5574 const $descriptionNote = $('#interactiveClosetDescriptionNote'); 5575 const images = $buttons.map(function () { 5576 return $(this).data('img'); 5577 }).get(); 5578
5579 images.forEach(function (src) { 5580 const img = new Image(); 5581 img.src = src; 5582 }); 5583 5584 function setActive($button) { 5585 $buttons.removeClass('active'); 5586 $button.addClass('active'); 5587 5588 $mainImage.css('opacity', 0); 5589 setTimeout(function () { 5590 $mainImage.attr('src', $button.data('img') || '').css('opacity', 1); 5591 }, 150); 5592 $descriptionWrapper.css('opacity', 0); 5593 setTimeout(function () { 5594 $descriptionImage.attr('src', $button.data('desc-img') || ''); 5595 $descriptionTitle.text($button.data('desc-title') || ''); 5596 $descriptionText.text($button.data('desc-text') || ''); 5597 5598 const note = $button.data('desc-note'); 5599 5600 if (note && String(note).trim() !== '') { 5601 $descriptionNote.text(note); 5602 $descriptionNoteWrapper.show(); 5603 } else { 5604 $descriptionNote.text(''); 5605 $descriptionNoteWrapper.hide(); 5606 } 5607 $descriptionWrapper.css('opacity', 1); 5608 }, 150); 5609 } 5610 5611 $buttons.on('click', function () { 5612 setActive($(this)); 5613 }); 5614 if ($buttons.length > 0) { 5615 setActive($buttons.first()); 5616 } 5617});
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.