1'use strict' 2 3const lpcQueryString = window.location.search; 4 5if (lpcQueryString.includes('lpc_disable_snow')) { 6 7 createCookie('lpc_disable_snow', 1, 30); 8} 9 10;(function() { 11 var $win = $(window), 12 $doc = $(document), 13 $html = $(document.documentElement), 14 $body = $(document.body), 15 iOs = /iPhone|iPad|iPod/i.test(navigator.userAgent), 16 isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), 17 initializedMaps = [], 18 youtubeListPlayers = []; 19 20 21 window.lp_template = { 22 version: 'landing page v3', 23 queue: {} 24 }; 25 26 /*lp_template.queue.newYear = function($self) { 27 if (!!document.querySelector('#lp_constructor')) { 28 let lpcSnow = `<div id="lpc-snow-block" class="sky"></div>`; 29 let newYearTpl = `<div class="lpc-new-year"> 30 <ul class="lpc-new-year__items"> 31 <li></li> 32 <li></li> 33 <li></li> 34 <li></li> 35 <li></li> 36 <li></li> 37 <li></li> 38 </ul> 39 <ul class="lpc-new-year__items"> 40 <li></li> 41 <li></li> 42 <li></li> 43 <li></li> 44 <li></li> 45 <li></li> 46 <li></li> 47 <li class="first_red_toy"></li> 48 <li class="green_toy"></li> 49 </ul> 50 <ul class="lpc-new-year__items second_items"> 51 <li></li> 52 <li></li> 53 <li></li> 54 <li></li> 55 <li></li> 56 <li></li> 57 <li></li> 58 <li class="red_toy"></li> 59 </ul> 60 <ul class="lpc-new-year__items"> 61 <li></li> 62 <li></li> 63 <li></li> 64 <li></li> 65 <li></li> 66 <li></li> 67 <li></li> 68 <li class="last_green_toy"></li> 69 </ul> 70 <ul class="lpc-new-year__items"> 71 <li></li> 72 <li></li> 73 <li></li> 74 <li></li> 75 <li></li> 76 <li></li> 77 <li></li> 78 </ul> 79 </div>`; 80 81 if (!!document.querySelector('#lp_constructor') && !$('.lpc-new-year__items').length) { 82 $('#landing_page_controls').append(newYearTpl); 83 //$('#landing_page_site').append(newYearTpl); 84 $('#landing_page_controls').append(lpcSnow); 85 86 if (readCookie('lpc_disable_snow') != '1') { 87 letItSnow(); 88 }; 89 }; 90 91 let $snow = $('#lpc-snow-block'); 92 93 const config = { 94 attributes: true 95 }; 96 97 const callback = function (mutationsList, observer) { 98 99 for (let mutation of mutationsList) { 100 if (!$(target).hasClass('hidden')) { 101 102 $('#lp_constructor').addClass('opened'); 103 $snow.appendTo($('#landing_page_controls')); 104 105 } else { 106 107 $('#lp_constructor').removeClass('opened'); 108 $snow.appendTo($('#landing_page_site')); 109 110 } 111 112 if (!$(target2).is(':hidden')) { 113 $('._live._live--lp ._live__header').addClass('hide_live_header'); 114 } else { 115 $('._live._live--lp ._live__header').removeClass('hide_live_header'); 116 } 117 } 118 }; 119 120 let target = document.querySelector('.folders-menu-wrapper'); 121 let target2 = document.querySelector('.block-css-controls'); 122 123 const observer = new MutationObserver(callback); 124 const observer2 = new MutationObserver(callback); 125 126 observer.observe(target, config); 127 observer2.observe(target2, config); 128 }; 129 };*/ 130 131 lp_template.queue.aboutPopupLink = function($self) { 132 if (!s3LP.is_cms) { 133 if(window.location.pathname != "/my/s3/cms/v1/lp/live.edit.php"){ 134 $('a[href^="popup:"]').attr('style','pointer-events: none'); 135 } 136 $(window).on('load', function(){ 137 $('a[href^="popup:"]').attr('style','pointer-events: auto'); 138 }) 139 } 140 } 141 142 lp_template.queue.blockAfterBefore = function ($self) { 143 var $block = $self.find(".lp-before-and-after-init"); 144 145 if ($block.length) { 146 (() => {'use strict'; 147 148 class BeforeAfter { 149 constructor(selector = '.before-after') { 150 this.selector = selector; 151 this.items = []; 152 } 153 154 init() { 155 let wrappers = document.querySelectorAll(this.selector); 156 157 for (let wrapper of wrappers) { 158 if (wrapper.dataset.beforeAfterInitialized === 'true') { 159 continue; 160 } 161 let item = new BeforeAfterItem(wrapper).init(); 162 this.items.push(item); 163 164 wrapper.dataset.beforeAfterInitialized = 'true'; 165 166 let observer = new MutationObserver(function (mutations) { 167 mutations.forEach(function (mutation) { 168 if ($(mutation.target).hasClass('lp-selected-element')) { 169 $(mutation.target).parent().addClass('active'); 170 } else { 171 $(mutation.target).parent().removeClass('active'); 172 } 173 }); 174 });
175 let config = { 176 attributes: true, 177 attributeFilter: ['class'] 178 }; 179 180 observer.observe($(wrapper).find('.before-after__img-before')[0], config); 181 observer.observe($(wrapper).find('.before-after__img-after')[0], config); 182 } 183 } 184 } 185 186 class BeforeAfterItem { 187 constructor(el) { 188 this.wrapper = el; 189 this.dragElWrapper = null; 190 this.viewport = null; 191 this.before = null; 192 this.after = null; 193 this.offset = 0; 194 this.pageXStart = 0; 195 this.startOffset = 0; 196 this.onPointerDown = this.onPointerDown.bind(this); 197 this.onPointerMove = this.onPointerMove.bind(this); 198 this.onPointerUp = this.onPointerUp.bind(this); 199 } 200 init() { 201 let wrapper = this.wrapper; 202 203 let dragElWrapper = this.dragElWrapper = document.createElement('div'); 204 205 dragElWrapper.classList.add('before-after__drag-wrapper'); 206 dragElWrapper.style.left = '50%'; 207 208 let dragEl = document.createElement('div'); 209 210 dragEl.classList.add('before-after__drag'); 211 212 dragElWrapper.append(dragEl); 213 214 let viewport = this.viewport = wrapper.querySelector('.before-after__viewport'); 215 216 viewport.append(dragElWrapper); 217 wrapper.classList.add('before-after--loaded'); 218 219 this.before = viewport.querySelector('.lp-image-before'); 220 this.after = viewport.querySelector('.lp-image-after'); 221 222 this.move(this.offset); 223 224 dragElWrapper.addEventListener('mousedown', this.onPointerDown); 225 dragElWrapper.addEventListener('touchstart', this.onPointerDown); 226 227 dragElWrapper.addEventListener('dragstart', () => { 228 return false; 229 }); 230 231 return this; 232 } 233 234 onPointerDown(e) { 235 e.stopPropagation(); 236 237 if (e.touches) { 238 this.pageXStart = e.touches[0].pageX; 239 } else { 240 this.pageXStart = e.pageX; 241 } 242 this.startOffset = this.offset; 243 244 document.addEventListener('mousemove', this.onPointerMove); 245 document.addEventListener('touchmove', this.onPointerMove); 246 document.addEventListener('mouseup', this.onPointerUp); 247 document.addEventListener('touchend', this.onPointerUp); 248 } 249 250 onPointerMove(e) { 251 let viewport = this.viewport, 252 pxOffset = 0, 253 percentOffset = 0; 254 255 if (e.touches) { 256 pxOffset = e.touches[0].pageX - this.pageXStart; 257 } else { 258 pxOffset = e.pageX - this.pageXStart; 259 } 260 261 percentOffset = parseFloat((pxOffset / viewport.clientWidth * 100).toFixed(6)); 262 263 this.offset = this.startOffset + percentOffset; 264 265 if (this.offset >= 50) { 266 this.offset = 50; 267 } else if (this.offset <= -50) { 268 this.offset = -50; 269 } 270 271 this.move(this.offset); 272 } 273 274 onPointerUp() { 275 document.removeEventListener('mousemove', this.onPointerMove); 276 document.removeEventListener('touchmove', this.onPointerMove); 277 document.removeEventListener('mouseup', this.onPointerUp); 278 document.removeEventListener('touchend', this.onPointerUp); 279 } 280 281 move(offset) { 282 this.dragElWrapper.style.left = 'calc(50% + ' + offset + '%)'; 283 this.before.style.clipPath = 'inset(0 calc(50% - ' + offset + '%) 0 0)'; 284 this.after.style.clipPath = 'inset(0 0 0 calc(50% + ' + offset + '%))'; 285 } 286 287 } 288 window.BeforeAfter = BeforeAfter; 289 })(); 290 291 new BeforeAfter().init(); 292 } 293 }; 294 295 lp_template.queue.splideMarquee = function ($self) { 296 let $block = $self.attr('data-marquee-init') ? $self : $self.find('[data-marquee-init]'); 297 298 setTimeout(function(){ 299 300 if ($block.length) { 301 $block.each(function () { 302 let $this = $(this); 303 let mediaGap = $this.data('marquee-margin'); 304 let mediaPerPage = $this.data('marquee-count'); 305 let margueeDrag = $this.data('marquee-drag'); 306 let margueePause = $this.data('marquee-pause'); 307 let margueeSpeed = $this.data('marquee-speed'); 308 let margueeReverse = $this.data('marquee-revese'); 309 310 let autoScrollSpeed = (margueeReverse === true || margueeReverse === 'true') ? -margueeSpeed : margueeSpeed; 311 312 if ($(this).data('move')) { 313 var $mediaMove = $(this).data('move'); 314 } else { 315 var $mediaMove = 1; 316 } 317 318 if ($this.find('.splide').not('.is-active').length != 0) { 319 320 $this.find('.splide').not('.is-active').each(function () { 321 322 let splide = new Splide($(this)[0], { 323 type: 'loop', 324 drag: margueeDrag, 325 focus: 'center',
326 arrows: false, 327 pagination: false, 328 perMove: $mediaMove, 329 perPage: checkInitPerPage(), 330 lazyLoad: 'nearby', 331 autoScroll: { 332 speed: autoScrollSpeed, 333 pauseOnHover: margueePause, 334 pauseOnFocus: margueePause, 335 } 336 }); 337 338 splide.mount(window.splide.Extensions); 339 340 sliderBreakPoints(); 341 342 //document.addEventListener('dataMediaSourceChange', sliderBreakPoints); 343 344 function sliderBreakPoints() { 345 let dataMediaSource = document.querySelector('html').dataset.mediaSource; 346 347 switch (dataMediaSource) { 348 case 'media-xl': 349 splide.options = { 350 gap: mediaGap[0], 351 perPage: mediaPerPage[0], 352 }; 353 break; 354 case 'media-lg': 355 splide.options = { 356 gap: mediaGap[1], 357 perPage: mediaPerPage[1], 358 }; 359 break; 360 case 'media-md': 361 splide.options = { 362 gap: mediaGap[2], 363 perPage: mediaPerPage[2], 364 }; 365 break; 366 case 'media-sm': 367 splide.options = { 368 gap: mediaGap[3], 369 perPage: mediaPerPage[3], 370 }; 371 break; 372 case 'media-xs': 373 splide.options = { 374 gap: mediaGap[4], 375 perPage: mediaPerPage[4], 376 }; 377 break; 378 } 379 }; 380 381 function checkInitPerPage() { 382 let dataMediaSource = document.querySelector('html').dataset.mediaSource; 383 384 switch (dataMediaSource) { 385 case 'media-xl': 386 return mediaPerPage[0] 387 break; 388 case 'media-lg': 389 return mediaPerPage[1] 390 break; 391 case 'media-md': 392 return mediaPerPage[2] 393 break; 394 case 'media-sm': 395 return mediaPerPage[3] 396 break; 397 case 'media-xs': 398 return mediaPerPage[4] 399 break; 400 }; 401 }; 402 }); 403 } 404 }); 405 } 406 407 }, 1000); 408 }; 409 410 lp_template.queue.newHeaderInit = function ($self) { 411 let $block = $self.find('.js-header-init'); 412 413 if (!$block.length) return; 414 415 $block.each(function () { 416 const $this = $(this); 417 const $menu = $this.find('.lp-init-menu'); 418 const $menuList = $menu.find('.lp-init-menu__list'); 419 const $moreItem = $menuList.find('.lp-more'); 420 const $items = $menuList.find('.lp-init-menu__item:not(.lp-more)'); 421 const $burgerButton = $this.find('.js-burger-open'); 422 const $burgerPopup = $this.find('.lp-init-popup'); 423 const $burgerInner = $this.find('.lp-init-popup__inner'); 424 const $closeButton = $this.find('.lp-init-popup__close'); 425 const $wrap = $this; 426 const $fixedContainer = $this.closest('.lp-fixed-block:not(.js-community), .lp-fixed-block.js-community'); 427 428 function adaptMenu() { 429 const $menu = $this.find('.lp-init-menu'); 430 const $menuList = $menu.find('.lp-init-menu__list'); 431 const $moreItem = $menuList.find('.lp-more'); 432 const $items = $menuList.find('.lp-init-menu__item:not(.lp-more)'); 433 434 if (!$menu.length || !$menuList.length || !$moreItem.length || !$items.length) return; 435 436 $items.removeClass('hidden'); 437 438 const menuWidth = $menuList[0].clientWidth; 439 const moreWidth = $moreItem[0].offsetWidth; 440 441 const computedStyle = getComputedStyle($menuList[0]); 442 let gap = parseFloat(computedStyle.gap || computedStyle.columnGap || 0); 443 if (isNaN(gap)) gap = 0; 444 445 let usedWidth = moreWidth; 446 let hasHidden = false; 447 448 $items.each(function (index) { 449 const $item = $(this); 450 const itemWidth = $item.outerWidth(true); 451 452 if (index > 0) usedWidth += gap; 453 454 if (usedWidth + itemWidth > menuWidth) { 455 $item.addClass('hidden'); 456 hasHidden = true; 457 } else { 458 usedWidth += itemWidth; 459 } 460 }); 461 462 $moreItem.css('display', hasHidden ? 'inline-flex' : 'none'); 463 $menuList[0].style.flexWrap = 'wrap'; 464 } 465 466 467 function toggleHiddenItems() { 468 const isActive = $moreItem.hasClass('active'); 469 $menuList.find('.lp-init-menu__item.hidden').each(function () { 470 $(this).toggleClass('revealed', !isActive); 471 }); 472 $moreItem.toggleClass('active', !isActive); 473 } 474 475 function setupBurgerMenu() { 476 if (!$burgerButton.length || !$burgerPopup.length || !$burgerInner.length || !$closeButton.length) return; 477 478 const html = document.documentElement; 479 const $hat = $this; 480
481 function toggleBurger(open) { 482 $burgerPopup.toggleClass('is-active', open); 483 $(html).toggleClass('no-scroll', open); 484 485 if (s3LP.is_cms) { 486 if (open) { 487 $hat.css('z-index', 999); 488 } else { 489 $hat.css('z-index', ''); 490 } 491 } 492 } 493 494 $burgerButton.on("click", function (e) { 495 e.stopPropagation(); 496 toggleBurger(true); 497 }); 498 499 $closeButton.on("click", function (e) { 500 e.stopPropagation(); 501 toggleBurger(false); 502 }); 503 504 $(document).on("keydown", function (e) { 505 if (e.key === "Escape") toggleBurger(false); 506 }); 507 508 if (!s3LP.is_cms) { 509 510 $(document).on("click", function (e) { 511 if (!$burgerPopup.hasClass("is-active")) return; 512 513 const clickedInside = $burgerInner[0].contains(e.target); 514 const clickedLink = $(e.target).closest("a").length; 515 516 if (!clickedInside || clickedLink) { 517 requestAnimationFrame(() => toggleBurger(false)); 518 } 519 }); 520 } 521 } 522 523 setupBurgerMenu(); 524 525 if ($this.find('.lp-menu-more-init').length) { 526 adaptMenu(); 527 528 let resizeTimer; 529 $(window).on('resize', function () { 530 clearTimeout(resizeTimer); 531 resizeTimer = setTimeout(() => requestAnimationFrame(adaptMenu), 500); 532 }); 533 534 $moreItem.on('click', toggleHiddenItems); 535 } 536 537 setTimeout(function () { 538 if ($wrap.length && $fixedContainer.length) { 539 $fixedContainer.css('height', $wrap.outerHeight() + 'px'); 540 } 541 }, 100); 542 543 let headerHeight = 0; 544 let bgToggleEnabled = false; 545 546 if ($this.length && $this.hasClass('_off_background')) { 547 headerHeight = $this.outerHeight(); 548 bgToggleEnabled = true; 549 } 550 551 $(window).on('scroll', function () { 552 const $wrap = $this.closest(".lp-fixed-block .lp-exclusive-hat__container"); 553 554 if ($wrap.length) { 555 $wrap.toggleClass("fixed", window.scrollY > 0); 556 } 557 558 if (!bgToggleEnabled) return; 559 560 if (window.scrollY >= headerHeight) { 561 $this.removeClass('_off_background'); 562 } else { 563 $this.addClass('_off_background'); 564 } 565 }); 566 }); 567 }; 568 569 lp_template.queue.iPhoneNavigator = function ($self) { 570 let $block = $self.find('.iPhone-navigator'); 571 572 if ($block.length) { 573 $block.each(function () { 574 let $this = $(this); 575 let $blockBg = $this.find('.lp-block-bg'); 576 577 if (/iPhone|iPad|iPod|webOS/i.test(navigator.userAgent)) { 578 $blockBg.each(function () { 579 this.style.backgroundAttachment = 'scroll'; 580 }); 581 } 582 }); 583 } 584 } 585 586 lp_template.queue.movingPictures = function ($self) { 587 let $block = $self.find('.lp_moving_pictures_init'); 588 589 if ($block.length) { 590 591 setTimeout(function () { 592 593 $block.each(function () { 594 let $this = $(this), 595 $wrapper = $this.find('.lp_moving_pictures_wrap'), 596 $marquee = $this.find('.lp_moving_pictures_move'), 597 marqueeSpeed = $this.data('marquee-speed') || 1, 598 speed = marqueeSpeed, 599 position = 0, 600 animationFrame, 601 wrapperWidth = $wrapper[0].offsetWidth, 602 direction = 'left', 603 isInMiddle = false, 604 totalWidth = 0; 605 606 if (!s3LP.is_cms) { 607 608 $marquee.find('.lp_moving_pictures_item').each(function () { 609 totalWidth += $(this).outerWidth(true); 610 }); 611 612 while (totalWidth < wrapperWidth) { 613 $marquee.find('.lp_moving_pictures_item').each(function () { 614 let $clone = $(this).clone(); 615 $marquee.append($clone); 616 totalWidth += $clone.outerWidth(true); 617 }); 618 } 619 620 let clonedContent = $marquee.html(); 621 $marquee.html(clonedContent + clonedContent); 622 623 } else { 624 625 function s3lazyLoadImages() { 626 627 const $s3lazyImage = $(".lp-ticker__carousel-mask-item img[data-src]"); 628 629 const s3LoadImage = (image) => { 630 const src = $(image).attr('data-src'); 631 632 if (src) { 633 $(image).attr('src', src); 634 $(image).removeAttr('data-src'); 635 } 636 }; 637 638 $s3lazyImage.each(function () { 639 s3LoadImage(this); 640 }); 641 } 642 643 s3lazyLoadImages(); 644 } 645 646 let marqueeWidth = totalWidth; 647 648 function lazyLoadImages() { 649 const $lazyImage = $(".lp-ticker__carousel-mask-item img[data-src]"); 650 651 const loadImage = (image) => { 652 const src = $(image).attr('data-src'); 653 654 if (src) { 655 $(image).attr('src', src); 656 $(image).removeAttr('data-src'); 657 } 658 }; 659 660 const isImageVisible = (image) => { 661 let imgLeft = $(image).offset().left, 662 imgRight = imgLeft + $(image).outerWidth(), 663 wrapperLeft = $wrapper.offset().left, 664 wrapperRight = wrapperLeft + $wrapper.outerWidth(); 665 666 return imgRight > wrapperLeft && imgLeft < wrapperRight; 667 }; 668 669 $lazyImage.each(function () { 670 if (isImageVisible(this)) { 671 loadImage(this); 672 } 673 }); 674 } 675 676 function move() { 677 window.cancelAnimationFrame(animationFrame); 678 679 if (direction === 'left') { 680 position -= speed; 681 } else { 682 position += speed; 683 } 684 685 if (!s3LP.is_cms) { 686 687 if (direction === 'left' && position <= -marqueeWidth) { 688 position = 0; 689 } else if (direction === 'right' && position >= 0) { 690 position = -marqueeWidth; 691 } 692 693 $marquee.css('transform', 'translate3d(' + position + 'px, 0, 0)'); 694 695 animationFrame = window.requestAnimationFrame(move); 696 697 lazyLoadImages(); 698 699 } else { 700 701 if (direction === 'left' && position <= -(marqueeWidth - wrapperW
701idth)) { 702 window.cancelAnimationFrame(animationFrame); 703 return; 704 } else if (direction === 'right' && position >= 0) { 705 window.cancelAnimationFrame(animationFrame); 706 return; 707 } 708 709 $marquee.css('transform', 'translate3d(' + position + 'px, 0, 0)'); 710 711 animationFrame = window.requestAnimationFrame(move); 712 } 713 } 714 715 move(); 716 717 var leftRightZoneWidth = wrapperWidth * 0.4; 718 var middleZoneWidth = wrapperWidth * 0.2; 719 720 var getZone = function (posX) { 721 if (posX < leftRightZoneWidth) { 722 return 'left'; 723 } else if (posX > wrapperWidth - leftRightZoneWidth) { 724 return 'right'; 725 } else { 726 return 'middle'; 727 } 728 }; 729 730 var prevMouseX; 731 var minSpeed = speed; 732 733 var handleMove = function (event, isTouch = false) { 734 var posX = isTouch ? event.originalEvent.touches[0].pageX - $wrapper[0].getBoundingClientRect().left : event.pageX - $wrapper[0].getBoundingClientRect().left; 735 var zone = getZone(posX); 736 var speedIncrement = 0.03; 737 var maxSpeed = speed + (speed * 0.5); 738 739 if (zone === 'left') { 740 direction = 'right'; 741 742 if (prevMouseX !== undefined) { 743 var distanceMoved = prevMouseX - posX; 744 speed += distanceMoved * speedIncrement; 745 speed = Math.max(minSpeed, Math.min(speed, maxSpeed)); 746 } 747 748 prevMouseX = posX; 749 750 } else if (zone === 'right') { 751 direction = 'left'; 752 753 if (prevMouseX !== undefined) { 754 var distanceMoved = posX - prevMouseX; 755 speed += distanceMoved * speedIncrement; 756 speed = Math.max(minSpeed, Math.min(speed, maxSpeed)); 757 } 758 759 prevMouseX = posX; 760 761 } else if (zone === 'middle') { 762 window.cancelAnimationFrame(animationFrame); 763 isInMiddle = true; 764 prevMouseX = posX; 765 return; 766 } 767 768 if (isInMiddle) { 769 isInMiddle = false; 770 move(); 771 } 772 }; 773 774 if (isMobile) { 775 $wrapper.on('touchmove', function (event) { 776 handleMove(event, true); 777 }); 778 779 $wrapper.on('touchend', function () { 780 speed = minSpeed; 781 prevMouseX = undefined; 782 move(); 783 }); 784 } else { 785 $wrapper.on('mousemove', handleMove); 786 787 $wrapper.on('mouseleave', function () { 788 speed = minSpeed; 789 prevMouseX = undefined; 790 move(); 791 }); 792 } 793 }); 794 795 lp_template.queue.lgNew($block); 796 797 }, 500); 798 } 799 }; 800 801 lp_template.queue.audioBlock = function ($self) { 802 var $block = $self.find('.lp-audio'); 803 804 let observer = new IntersectionObserver((entries, observer) => { 805 entries.forEach(entry => { 806 if (entry.isIntersecting) { 807 let $block = $(entry.target); 808 initAudioBlock($block); 809 observer.unobserve(entry.target); // УбиÑаем наблÑдение поÑле иниÑиализаÑии 810 } 811 }); 812 }, { threshold: 0.3 }); // ÐаÑÑÑоен на 30% видимоÑÑи 813 814 $block.each(function () { 815 observer.observe(this); 816 }); 817 818 819 820 function initAudioBlock($block) { 821 let audios = $block.find("audio"); 822 let playPauseButtons = $block.find(".audio-play-pause"); 823 let progressBars = $block.find(".audio-progress"); 824 let timeDisplays = $block.find(".audio-time"); 825 let volumeSliders = $block.find(".audio-volume"); 826 let downloadButtons = $block.find(".audio-download"); 827 let muteButtons = $block.find(".audio-muted"); 828 let moreBtns = $block.find('.audio-more-btn'); 829 let speedSelects = $block.find('.audio-speed-select'); 830 831 playPauseButtons.each(function (index) { 832 let playPause = $(this); 833 let audio = audios[index]; 834 let volumeSlider = volumeSliders.eq(index); 835 let downloadButton = downloadButtons.eq(index); 836 let muteButton = muteButtons.eq(index); 837 let moreBtn = moreBtns.eq(index); 838 let speedSelect = speedSelects.eq(index); 839 let progressBar = progressBars.eq(index); 840 let timeDisplay = timeDisplays.eq(index); 841 842 let computedColor = '#ffffff'; // fallback по ÑмолÑÐ°Ð½Ð¸Ñ 843 844 setTimeout(() => { 845 let audioPlayer = playPause.closest('.audio-player')[0]; 846 if (audioPlayer) { 847 computedColor = getComputedStyle(audioPlayer).color; 848 } 849 850 // УÑÑановка гÑадиенÑа гÑомкоÑÑи пÑи иниÑиализаÑии 851 volumeSlider.css('background', `linear-gradient(to right, var(--primary-color-base) 100%, ${c
851omputedColor} 100%)`); 852 }, 50); 853 854 let playIcon = '<svg width="25" height="25" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.6235 17.8087L17.5059 13.3848C17.8353 13.1724 18 12.8775 18 12.5C18 12.1225 17.8353 11.8276 17.5059 11.6152L10.6235 7.1913C10.2706 6.95536 9.91177 6.93767 9.54706 7.13822C9.18235 7.33877 9 7.65139 9 8.07609V16.9239C9 17.3486 9.18235 17.6612 9.54706 17.8618C9.91177 18.0623 10.2706 18.0446 10.6235 17.8087Z"/></svg>'; 855 let pauseIcon = '<svg width="25" height="25" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8 17C8 17.5523 8.44772 18 9 18H10C10.5523 18 11 17.5523 11 17V8C11 7.44771 10.5523 7 10 7H9C8.44772 7 8 7.44772 8 8V17ZM14 17C14 17.5523 14.4477 18 15 18H16C16.5523 18 17 17.5523 17 17V8C17 7.44771 16.5523 7 16 7H15C14.4477 7 14 7.44772 14 8V17Z" fill="#1F1F1F"/></svg>'; 856 857 playPause.on("click", function () { 858 if (audio.paused) { 859 $("audio").each(function () { this.pause(); }); 860 $(".audio-play-pause").html(playIcon); 861 audio.play(); 862 playPause.html(pauseIcon); 863 } else { 864 audio.pause(); 865 playPause.html(playIcon); 866 } 867 }); 868 869 $(audio).on("timeupdate", function () { 870 if (isFinite(audio.duration)) { 871 let val = (audio.currentTime / audio.duration) * 100; 872 progressBar.val(val); 873 timeDisplay.text(formatTime(audio.currentTime)); 874 progressBar.css('background', `linear-gradient(to right, var(--primary-color-base) ${val}%, ${computedColor} ${val}%)`); 875 } 876 }); 877 878 progressBar.on("input", function () { 879 if (isFinite(audio.duration)) { 880 audio.currentTime = (progressBar.val() / 100) * audio.duration; 881 } 882 }); 883 884 volumeSlider.on("input", function () { 885 audio.volume = volumeSlider.val(); 886 let valVol = audio.volume * 100; 887 volumeSlider.css('background', `linear-gradient(to right, var(--primary-color-base) ${valVol}%, ${computedColor} ${valVol}%)`); 888 889 if (audio.volume == 0) { 890 muteButton.addClass('mute'); 891 } else { 892 muteButton.removeClass('mute'); 893 } 894 895 if (audio.muted) audio.muted = false; 896 }); 897 898 downloadButton.on("click", function () { 899 let audioSrc = $(audio).attr("src"); 900 let link = document.createElement("a"); 901 link.href = audioSrc; 902 link.download = audioSrc.split("/").pop(); 903 document.body.appendChild(link); 904 link.click(); 905 document.body.removeChild(link); 906 }); 907 908 909 muteButton.on("click", function () { 910 $(this).toggleClass('mute'); 911 audio.muted = !audio.muted; 912 913 if (audio.muted) { 914 volumeSlider.val(0); 915 volumeSlider.css('background', `linear-gradient(to right, var(--primary-color-base) 0%, ${computedColor} 0%)`); 916 } else { 917 let vol = audio.volume || 1; 918 let volVal = vol * 100; 919 volumeSlider.val(vol); 920 volumeSlider.css('background', `linear-gradient(to right, var(--primary-color-base) ${volVal}%, ${computedColor} ${volVal}%)`); 921 } 922 }); 923 924 moreBtn.on('click', function () { 925 $(".audio-more-dropdown").hide().find('.audio-speed-select').removeClass('_open'); 926 $(this).siblings('.audio-more-dropdown').show().css({ "transform": "translate(0px, 0px)", "opacity": "1"}); 927 }); 928 929 $(document).on("click", ".audio-speed-control", function () { 930 $(this).find(".audio-speed-select").addClass('_open'); 931 }); 932 933 $(document).on("click", function (e) { 934 if (!$(e.target).closest('.audio-more-dropdown').length && !$(e.target).closest('.audio-more-btn').length) { 935 $(".audio-more-dropdown").hide().find('.audio-speed-select').removeClass('_open'); 936 } 937 }); 938 939 speedSelect.on('change', function () { 940 let speed = parseFloat($(this).val()); 941 if (audio) audio.playbackRate = speed; 942 }); 943 944 function formatTime(seconds) { 945 let min = Math.floor(seconds / 60); 946 let sec = Math.floor(seconds % 60).toString().padStart(2, "0"); 947 return `${min}:${sec}`; 948 } 949 }); 950 } 951 }; 952 953 lp_template.queue.refreshForm = function ($self) { 954 955 const $refreshButton = $('.lp-refresh-form'); 956 if (!$refreshButton.length) return; 957 958 $refreshButton.each(function () { 959 const $button = $(this); 960 961 const href = $button.attr('href'); 962 if (!href) return; 963 964 const popupMatch = href.match(/popup:_lp_block_(\d+)/); 965 if (!popupMatch) return; 966 967 const popupId = popupMatch[1]; 968 const $popupElement = $(`[data-block-id="${popupId}"]`); 969 if (!$popupElement.length) return; 970 971 const $form = $popupElement.find('.lp-form-tpl'); 972 if (!$form.length) { 973 console.warn('ФоÑма не найдена внÑÑÑи попапа'); 974 return; 975 } 976 977 const apiUrl = $form.attr('data-api-url'); 978 if (!apiUrl) { 979 console.warn('API URL не найден Ñ ÑоÑмÑ'); 980 return; 981 } 982 983 const $successBlock = $popupElement.find('.hide-on-success'); 984 let $successClone = null; 985 if ($successBlock.length) { 986 $successClone = $successBlock.clone(true); 987 } 988 989 $button.off('click.refreshForm').on('click.refreshForm', function (e) { 990 e.preventDefault(); 991 992 const isFormSubmitted = $popupElement.find('.lp-form-tpl__success').length > 0; 993 994 if (!isFormSubmitted) return; 995 996 const $formOld = $popupElement.find('.lp-form-tpl'); 997 const $productBlock = $button.closest('.lp-product-name'); 998 const prodName = $productBlock.find('[data-name-product]').data('name-product') || ''; 999 1000 $.ajax({ 1001 url: apiUrl, 1002 dataType: 'json', 1003 success: function (response) { 1004 if (!response.result.error) { 1005 const htmlForm = response.result.html;
1006 const $tempContainer = $('<div>').append($.parseHTML(htmlForm)); 1007 const $newFormTpl = $tempContainer.find('.lp-form-tpl'); 1008 1009 if (!$newFormTpl.length) return; 1010 1011 $formOld.replaceWith($newFormTpl); 1012 1013 $newFormTpl.find('.lp-form-tpl__title-wrapper').remove(); 1014 1015 if ($successClone && $popupElement.find('.hide-on-success').length === 0) { 1016 $newFormTpl.before($successClone); 1017 } 1018 1019 s3LP.initForms($(`#_lp_block_${popupId}`)); 1020 1021 setTimeout(function () { 1022 const $newForm = $popupElement.find('.lp-form-tpl'); 1023 const $targetInput = $newForm.find('input[data-alias="product_name"]'); 1024 1025 if (prodName && $targetInput.length) { 1026 $targetInput.val(prodName); 1027 } else { 1028 console.warn('ÐÐ¼Ñ ÑоваÑа или поле не найдено'); 1029 } 1030 }, 100); 1031 1032 } else { 1033 console.warn('ÐÑибка в оÑвеÑе ÑеÑвеÑа:', response.result.message); 1034 } 1035 }, 1036 error: function (xhr, status, error) { 1037 console.error('ÐÑибка пÑи полÑÑении ÑоÑмÑ:', status, error); 1038 } 1039 }); 1040 }); 1041 }); 1042 }; 1043 1044 lp_template.queue.sliderBlockThumb = function ($self) { 1045 var $block = $self.attr('data-slider-thumb-init') ? $self : $self.find('[data-slider-thumb-init]'); 1046 if ($block.length) { 1047 $block.each(function(){ 1048 let $this = $(this); 1049 let $alignItem = $this.find($this.data('align-item')); 1050 let mediaGap = $this.data('margin'); 1051 let mediaPerPage = $(this).data('count'); 1052 let mediaThumbGap = $this.data('thumb-margin'); 1053 let mediaThumbFixedWidth = $this.data('thumb-width'); 1054 let mediaThumbFixedHeight = $this.data('thumb-height'); 1055 1056 if($this.find('#main-slider').not('.is-active').length != 0 ) { 1057 let splideThumb = new Splide( $this.find('.splide').not('.is-active')[0], { 1058 autoplay: $this.data('autoplay'), 1059 speed: $this.data('speed'), 1060 interval: $this.data('pause'), 1061 rewind: $this.data('infinite'), 1062 lazyLoad: $this.data('lazy-load'), 1063 rewind: true, 1064 perMove: 1, 1065 perPage: checkInitPerPage(), 1066 dragMinThreshold: { 1067 mouse: 5, 1068 touch: 10, 1069 } 1070 }); 1071 1072 let thumbnails = new Splide($this.find('.thumbnail-slider').not('.is-active')[0], { 1073 rewind : $this.data('rewind'), 1074 fixedWidth : checkInitThumbWidth(), 1075 fixedHeight : checkInitThumbHeight(), 1076 isNavigation : true, 1077 focus : $this.data('thumb-focus'), 1078 pagination : false, 1079 cover : false, 1080 arrows : $this.data('thumb-arrow'), 1081 drag : false, 1082 padding : 4, 1083 gap : checkInitThumbGap(), 1084 dragMinThreshold: { 1085 mouse: 5, 1086 touch: 10, 1087 } , 1088 classes : { 1089 arrows: "splide__arrows splide__custom__arrows" 1090 } 1091 }); 1092 1093 splideThumb.sync(thumbnails); 1094 1095 splideThumb.mount(); 1096 1097 thumbnails.mount(); 1098 1099 sliderBreakPoints(); 1100 1101 sliderPaginationChecking(); 1102 1103 //document.addEventListener('dataMediaSourceChange', sliderBreakPoints); 1104 1105 function sliderBreakPoints() { 1106 let dataMediaSource = document.querySelector('html').dataset.mediaSource; 1107 1108 setTimeout(function(){ 1109 if ($alignItem.length) { 1110 let itemHeight = $alignItem.outerHeight() / 2; 1111 let arrowsPosition = itemHeight + $alignItem.position().top; 1112 1113 $this.find('.splide__arrow').css('top', arrowsPosition); 1114 } 1115 }, 100); 1116 1117 switch (dataMediaSource) { 1118 case 'media-xl': 1119 splideThumb.options = { 1120 arrows: true, 1121 pagination: true, 1122 gap: mediaGap[0], 1123 perPage: mediaPerPage[0], 1124 }; 1125 1126 break; 1127 case 'media-lg': 1128 splideThumb.options = { 1129 arrows: true, 1130 pagination: true,
1131 gap: mediaGap[1], 1132 perPage: mediaPerPage[1], 1133 }; 1134 1135 break; 1136 case 'media-md': 1137 splideThumb.options = { 1138 arrows: true, 1139 pagination: true, 1140 gap: mediaGap[2], 1141 perPage: mediaPerPage[2], 1142 }; 1143 break; 1144 case 'media-sm': 1145 splideThumb.options = { 1146 arrows: false, 1147 pagination: true, 1148 gap: mediaGap[3], 1149 perPage: mediaPerPage[3], 1150 }; 1151 1152 break; 1153 case 'media-xs': 1154 splideThumb.options = { 1155 arrows: false, 1156 pagination: true, 1157 gap: mediaGap[4], 1158 perPage: mediaPerPage[4], 1159 }; 1160 1161 break; 1162 } 1163 if($block.data('slider-thumb-init') == true) { 1164 switch (dataMediaSource) { 1165 case 'media-xl': 1166 thumbnails.options = { 1167 gap: mediaThumbGap[0], 1168 fixedWidth: mediaThumbFixedWidth[0], 1169 fixedHeight: mediaThumbFixedHeight[0], 1170 }; 1171 1172 break; 1173 case 'media-lg': 1174 thumbnails.options = { 1175 gap: mediaThumbGap[1], 1176 fixedWidth: mediaThumbFixedWidth[1], 1177 fixedHeight: mediaThumbFixedHeight[1], 1178 }; 1179 1180 break; 1181 case 'media-md': 1182 thumbnails.options = { 1183 gap: mediaThumbGap[2], 1184 fixedWidth: mediaThumbFixedWidth[2], 1185 fixedHeight: mediaThumbFixedHeight[2], 1186 }; 1187 1188 break; 1189 case 'media-sm': 1190 thumbnails.options = { 1191 gap: mediaThumbGap[3], 1192 fixedWidth: mediaThumbFixedWidth[3], 1193 fixedHeight: mediaThumbFixedHeight[3], 1194 }; 1195 1196 break; 1197 case 'media-xs': 1198 thumbnails.options = { 1199 gap: mediaThumbGap[4], 1200 fixedWidth: mediaThumbFixedWidth[4], 1201 fixedHeight: mediaThumbFixedHeight[4], 1202 }; 1203 1204 break; 1205 } 1206 } 1207 }; 1208 1209 function checkInitPerPage() { 1210 let dataMediaSource = document.querySelector('html').dataset.mediaSource; 1211 1212 switch (dataMediaSource) { 1213 case 'media-xl': 1214 return mediaPerPage[0] 1215 break; 1216 case 'media-lg': 1217 return mediaPerPage[1] 1218 break; 1219 case 'media-md': 1220 return mediaPerPage[2] 1221 break; 1222 case 'media-sm': 1223 return mediaPerPage[3] 1224 break; 1225 case 'media-xs': 1226 return mediaPerPage[4] 1227 break; 1228 }; 1229 }; 1230 1231 function checkInitThumbWidth() { 1232 let dataMediaSource = document.querySelector('html').dataset.mediaSource; 1233 1234 switch (dataMediaSource) { 1235 case 'media-xl': 1236 return mediaThumbFixedWidth[0] 1237 break; 1238 case 'media-lg': 1239 return mediaThumbFixedWidth[1] 1240 break; 1241 case 'media-md': 1242 return mediaThumbFixedWidth[2] 1243 break; 1244 case 'media-sm': 1245 return mediaThumbFixedWidth[3] 1246 break; 1247 case 'media-xs': 1248 return mediaThumbFixedWidth[4] 1249 break; 1250 }; 1251 }; 1252 1253 function checkInitThumbHeight() { 1254 let dataMediaSource = document.querySelector('html').dataset.mediaSource; 1255 1256 switch (dataMediaSource) { 1257 case 'media-xl': 1258 return mediaThumbFixedHeight[0] 1259 break; 1260 case 'media-lg': 1261 return mediaThumbFixedHeight[1] 1262 break; 1263 case 'media-md': 1264 return mediaThumbFixedHeight[2] 1265 break; 1266 case 'media-sm': 1267 return mediaThumbFixedHeight[3] 1268 break; 1269 case 'media-xs': 1270 return mediaThumbFixedHeight[4] 1271 break; 1272 }; 1273 }; 1274 1275 function checkInitThumbGap() { 1276 let dataMediaSource = document.querySelector('html').dataset.mediaSource; 1277 1278 switch (dataMediaSource) { 1279 case 'media-xl': 1280 return mediaThumbGap[0] 1281 break; 1282 case 'media-lg': 1283 return mediaThumbGap[1] 1284 break; 1285 case 'media-md': 1286 return mediaThumbGap[2] 1287 break; 1288 case 'media-sm': 1289 return mediaThumbGap[3] 1290 break; 1291 case 'media-xs': 1292 return mediaThumbGap[4] 1293 break; 1294 }; 1295 }; 1296 1297 function sliderPaginationChecking() { 1298 let sliderPaginationBlock = $this.find('.splide__custom__pagination'); 1299 1300 setTimeout(function() { 1301 if (sliderPaginationBlock.find('li').length == 1) { 1302 sliderPaginationBlock.hide(); 1303 } 1304 }, 200); 1305 }; 1306 } 1307 }); 1308 } 1309 }; 1310 1311 lp_template.checkAutoplayVideo = function($blocks) { 1312 $blocks.each(function() { 1313 var $this = $(this), 1314 playStatus = $this.data('playStatus'), 1315 inViewport = isElementInViewport(this), 1316 $video = $this.find('video'), 1317 $thisVideo = $video.length ? $video : $this.find('iframe'); 1318 1319 1320 1321 if (inViewport && playStatus !== 'play') { 1322 $this.trigger('autoplayVideo', ['play', $thisVideo[0].nodeName.toLowerCase()]); 1323 $this.data('playStatus', 'play'); 1324 } else if (!inViewport && playStatus === 'play') { 1325 $this.trigger('autoplayVideo', ['pause', $thisVideo[0].nodeName.toLowerCase()]); 1326 $this.data('playStatus', 'pause'); 1327 } 1328 1329 }) 1330 } 1331 1332 lp_template.queue.dropDownContacts = function ($self) { 1333 let block = $self.find('.lp-drop-down-init'); 1334 1335 if (block.length) { 1336 block.each(function () {
1337 let $this = $(this); 1338 let countContact = $this.data('count-contact'); 1339 1340 if (typeof countContact === 'undefined') return; 1341 1342 let $showAllButton = $this.find('.lp-contacts-more'); 1343 let $itemContact = $this.find('.lp-contacts-item:hidden'); 1344 let currentText = $showAllButton.text(); 1345 let hideText = $('html').attr('lang') === 'ru' ? 'СкÑÑÑÑ' : 'Hide'; 1346 1347 $showAllButton.on('click', function () { 1348 let $button = $(this); 1349 $button.toggleClass('active'); 1350 $button.text($button.hasClass('active') ? hideText : currentText); 1351 $this.toggleClass('active'); 1352 }); 1353 }); 1354 } 1355 }; 1356 1357 lp_template.queue.masonGallery = function ($self) { 1358 let $block = $self.find('.lp-masonry-init'); 1359 1360 if ($block.length) { 1361 $block.each(function () { 1362 let $this = $(this); 1363 let listbox = $this.find(".lp-image-mason__list"); 1364 let lazyItems = $this.find(".lp-image-mason__item img[data-src]"); 1365 let windowHeight = $(window).height(); 1366 1367 function loadVisibleItems() { 1368 lazyItems.each(function (index, item) { 1369 const rect = item.getBoundingClientRect(); 1370 1371 if (rect.top < windowHeight) { 1372 const img = $(item); 1373 1374 if (!img.hasClass('is-loaded')) { 1375 img.on('load', function () { 1376 img.closest('.lp-image-mason__item').addClass('is-show'); 1377 resizeGridItem(img.closest('.lp-image-mason__item')); 1378 }); 1379 1380 img.attr('src', img.data('src')); 1381 img.addClass('is-loaded'); 1382 } 1383 } 1384 }); 1385 1386 lazyItems = $this.find(".lp-image-mason__item img[data-src]"); 1387 } 1388 1389 function resizeGridItem(item) { 1390 let grid = $this.find('.lp-image-mason__list'); 1391 let rowHeight = parseInt(grid.css("grid-auto-rows")); 1392 let rowGap = parseInt(grid.css("grid-row-gap")); 1393 1394 let rowSpan = Math.ceil( 1395 (item.find('.lp-image-mason__image').outerHeight() + rowGap) / (rowHeight + rowGap) 1396 ); 1397 item.css("grid-row-end", "span " + rowSpan); 1398 1399 let image = item.find('.lp-image-mason__image'); 1400 image.css("height", "100%"); 1401 } 1402 1403 $(window).on('scroll', function () { 1404 loadVisibleItems(); 1405 }); 1406 1407 loadVisibleItems(); 1408 }); 1409 } 1410 } 1411 1412 lp_template.queue.donationsBlock = function($self) { 1413 let $block = $self.find('.lp-payment-block-2'); 1414 1415 if (!s3LP.is_cms) { 1416 $block.each(function(){ 1417 let $this = $(this); 1418 let $price = $this.find('.lp-payment__form .lp-form-tpl__item:first-of-type').addClass('custom_price_input'); 1419 1420 let $email = $this.find('.lp-payment__form input[name="email"]').val('[email protected]'); 1421 let $phone = $this.find('.lp-payment__form input[name="phone"]').val('+1234567890'); 1422 1423 $price.find('input[name="price"]').val($block.find('.lp_payment_buttons_js .lp-button--type-1').text().replace(/\D/g, '')); 1424 1425 $this.find('.lp_payment_buttons_js .lp-button').on('click', function(){ 1426 let currentValue = $(this).text().replace(/\D/g, ''); 1427 1428 $this.find('.lp_payment_buttons_js .lp-button').removeClass('lp-button--type-1').addClass('lp-button--type-2'); 1429 $(this).removeClass('lp-button--type-2').addClass('lp-button--type-1'); 1430 1431 if ($(this).hasClass('custom_price_btn')) { 1432 $price.fadeIn(200); 1433 $this.find('input[name="price"]').val('').focus(); 1434 } else { 1435 $this.find('input[name="price"]').val(currentValue); 1436 $price.hide(); 1437 }; 1438 }); 1439 }); 1440 } 1441 }; 1442 1443 lp_template.queue.iframeLazyLoading = function($self) { 1444 var $block = $self.find('.lp-lazy-iframe-js'); 1445 var iframes = $block.find($('iframe')); 1446 1447 if($block.length && iframes.length) { 1448 iframes.each(function() { 1449 var iframe = $(this); 1450 /*var src = iframe.attr('src'); 1451 iframe.removeAttr('src'); 1452 iframe.attr('loading', 'lazy'); 1453 iframe.attr('data-src', src);*/ 1454 iframe.addClass('lazy lazyload'); 1455 }); 1456 } 1457 }; 1458 1459 /*lp_template.queue.iframeLazyLoading = function($self) { 1460 var $block = $self.find('.lp-lazy-iframe-js'); 1461 var iframes = $block.find($('iframe')); 1462 1463 if ($block.length && iframes.length) { 1464 var observer = new IntersectionObserver(function(entries, observer) {
1465 entries.forEach(function(entry) { 1466 if (entry.isIntersecting) { 1467 var iframe = entry.target; 1468 iframe.src = iframe.dataset.src; 1469 iframe.classList.remove('lazy'); 1470 observer.unobserve(iframe); 1471 } 1472 }); 1473 }, { 1474 root: null, 1475 rootMargin: '0px', 1476 threshold: 0.1 1477 }); 1478 1479 iframes.each(function() { 1480 var iframe = $(this); 1481 1482 iframe.addClass('lazy'); 1483 iframe.attr('data-src', iframe.attr('src')); 1484 iframe.attr('src', ''); 1485 observer.observe(iframe[0]); 1486 }); 1487 } 1488 };*/ 1489 1490 lp_template.queue.ImageParallax = function ($self) { 1491 1492 let $blocks = $self.find('.init-image-parallax'); 1493 if (!$blocks.length) return; 1494 1495 $blocks.each(function () { 1496 1497 const $block = $(this); 1498 const image = $block.find('.lp-promotions__image')[0]; 1499 if (!image || isMobile) return; 1500 1501 const promotion = $block.closest('.lp-promotions')[0]; 1502 if (!promotion) return; 1503 1504 let targetX = 0, targetY = 0; 1505 let currentX = 0, currentY = 0; 1506 let frame = null; 1507 1508 const intensity = 25; 1509 1510 const animate = () => { 1511 currentX += (targetX - currentX) * 0.1; 1512 currentY += (targetY - currentY) * 0.1; 1513 1514 image.style.transform = `translate(${currentX}px, ${currentY}px)`; 1515 1516 if (Math.abs(currentX - targetX) > 0.1 || Math.abs(currentY - targetY) > 0.1) { 1517 frame = requestAnimationFrame(animate); 1518 } else { 1519 frame = null; 1520 } 1521 }; 1522 1523 promotion.addEventListener('mousemove', (e) => { 1524 const rect = promotion.getBoundingClientRect(); 1525 const x = e.clientX - rect.left; 1526 const y = e.clientY - rect.top; 1527 1528 const offsetX = (x / rect.width - 0.1) * 1; 1529 const offsetY = (y / rect.height - 0.1) * 1; 1530 1531 targetX = offsetX * intensity; 1532 targetY = offsetY * intensity; 1533 1534 if (!frame) frame = requestAnimationFrame(animate); 1535 }); 1536 1537 promotion.addEventListener('mouseleave', () => { 1538 targetX = 0; 1539 targetY = 0; 1540 if (!frame) frame = requestAnimationFrame(animate); 1541 }); 1542 }); 1543 }; 1544 1545 1546 lp_template.queue.wizardStepForm = function ($self) { 1547 1548 let $block = $self.find('.wizard-step-init'); 1549 1550 if ($block.length) { 1551 $block.each(function () { 1552 const wrap = this; 1553 const stepsWrap = wrap.querySelector(".lp-wizard-step__steps"); 1554 const coverWrap = wrap.querySelector(".lp-wizard-cover"); 1555 const coverBtn = wrap.querySelector(".lp-wizard-cover__btn"); 1556 1557 const steps = wrap.querySelectorAll(".lp-wizard-step__options"); 1558 const nextBtn = wrap.querySelector(".lp-wizard-step__next"); 1559 const prevBtn = wrap.querySelector(".lp-wizard-step__prev"); 1560 const buttonsWrap = wrap.querySelector(".lp-wizard-step__button"); 1561 const finalForm = wrap.querySelector(".lp-wizard-step__standalone-form"); 1562 1563 const progressBar = wrap.querySelector(".lp-wizard-progress__bar"); 1564 const progressCounter = wrap.querySelector(".lp-wizard-progress__counter"); 1565 1566 let currentStep = 0; 1567 1568 finalForm.style.display = "none"; 1569 nextBtn.disabled = true; 1570 nextBtn.classList.add("disabled"); 1571 1572 let allowAutoStep = true; 1573 steps.forEach(step => { 1574 if (step.querySelectorAll("input[type='checkbox']").length > 0) { 1575 allowAutoStep = false; 1576 } 1577 }); 1578 1579 if (stepsWrap && stepsWrap.classList.contains("_hidden_steps_form")) { 1580 if (coverWrap) coverWrap.style.display = "block"; 1581 } 1582 1583 if (coverBtn) { 1584 coverBtn.addEventListener("click", function () { 1585 stepsWrap.style.display = "block"; 1586 stepsWrap.classList.remove("_hidden_steps_form"); 1587 if (coverWrap) coverWrap.style.display = "none"; 1588 updateSteps(); 1589 }); 1590 } 1591 1592 function getCompletedStepsCount() { 1593 let completed = 0; 1594 1595 steps.forEach(step => { 1596 const inputs = step.querySelectorAll("input[type='radio'], input[type='checkbox'], select"); 1597 1598 const isDone = Array.from(inputs).some(el => { 1599 if (el.type === "checkbox") return el.checked; 1600 if (el.type === "radio") return el.checked; 1601 if (el.tagName === "SELECT") return el.value.trim() !== ""; 1602 }); 1603 1604 if (isDone) completed++; 1605 }); 1606 1607 return completed; 1608 } 1609 1610 function updateProgress() { 1611 const completed = getCompletedStepsCount(); 1612 const percent = (completed / steps.length) * 100; 1613 1614 if (progressBar) { 1615 progressBar.style.width = percent + "%"; 1616 } 1617 1618 if (progressCounter) { 1619 progressCounter.textContent = `${completed} / ${steps.length}`; 1620 } 1621 } 1622 1623 function updateSteps() { 1624 steps.forEach((step, i) => { 1625 step.style.display = i === currentStep ? "flex" : "none"; 1626 }); 1627 1628 prevBtn.style.display = currentStep === 0 ? "none" : "inline-block"; 1629 nextBtn.textContent = currentStep === steps.length - 1 ? "ÐавеÑÑиÑÑ" : "Ðалее"; 1630 1631 updateProgress(); 1632 validateStep(); 1633 } 1634 1635 steps.forEach(step => { 1636 step.addEventListener("change", () => { 1637 updateProgress(); 1638 }); 1639 }); 1640 1641 function validateStep() { 1642 const stepEl = steps[currentStep]; 1643 const isMandatory = stepEl.getAttribute("data-mandatory") === "true"; 1644 1645 if (!isMandatory) { 1646 nextBtn.disabled = false;
1647 nextBtn.classList.remove("disabled"); 1648 return true; 1649 } 1650 1651 const currentInputs = stepEl.querySelectorAll("input[type='radio'], input[type='checkbox']"); 1652 const hasChecked = Array.from(currentInputs).some(i => i.checked); 1653 1654 nextBtn.disabled = !hasChecked; 1655 nextBtn.classList.toggle("disabled", !hasChecked); 1656 1657 return hasChecked; 1658 } 1659 1660 function getCleanLabelText(input) { 1661 const label = input.closest("label"); 1662 return label ? label.innerText.trim() : input.value.trim(); 1663 } 1664 1665 function collectWizardDataReadable() { 1666 let result = []; 1667 1668 steps.forEach((step, index) => { 1669 const checked = step.querySelectorAll("input:checked"); 1670 const title = step.querySelector(".lp-wizard-step__title")?.innerText.trim() || `Шаг-${index + 1}`; 1671 1672 let text = checked.length 1673 ? Array.from(checked).map(i => getCleanLabelText(i)).join(", ") 1674 : "(не вÑбÑан)"; 1675 1676 result.push(`${title}: ${text}`); 1677 }); 1678 1679 return result.join("; "); 1680 } 1681 1682 function putDataIntoHiddenField(dataStr) { 1683 const hiddenInput = finalForm.querySelector('input[data-alias="wizard_data"]'); 1684 if (hiddenInput) hiddenInput.value = dataStr; 1685 } 1686 1687 steps.forEach(step => step.addEventListener("change", validateStep)); 1688 1689 if (allowAutoStep) { 1690 steps.forEach((step, index) => { 1691 const radios = step.querySelectorAll("input[type='radio']"); 1692 1693 if (radios.length) { 1694 radios.forEach(radio => { 1695 radio.addEventListener("change", () => { 1696 1697 updateProgress(); 1698 1699 if (step.classList.contains("_automatic_step") && currentStep === index) { 1700 1701 if (!validateStep()) return; 1702 1703 if (currentStep < steps.length - 1) { 1704 currentStep++; 1705 updateSteps(); 1706 updateProgress(); 1707 } else { 1708 if (allowAutoStep) { 1709 const dataStr = collectWizardDataReadable(); 1710 putDataIntoHiddenField(dataStr); 1711 1712 finalForm.style.display = "flex"; 1713 stepsWrap.style.display = "none"; 1714 buttonsWrap.style.display = "none"; 1715 } 1716 } 1717 } 1718 }); 1719 }); 1720 } 1721 }); 1722 } 1723 1724 nextBtn.addEventListener("click", function () { 1725 if (!validateStep()) return; 1726 1727 if (currentStep < steps.length - 1) { 1728 currentStep++; 1729 updateSteps(); 1730 updateProgress(); 1731 } else { 1732 const dataStr = collectWizardDataReadable(); 1733 putDataIntoHiddenField(dataStr); 1734 1735 finalForm.style.display = "flex"; 1736 stepsWrap.style.display = "none"; 1737 buttonsWrap.style.display = "none"; 1738 } 1739 }); 1740 1741 prevBtn.addEventListener("click", function () { 1742 if (currentStep > 0) { 1743 currentStep--; 1744 updateSteps(); 1745 updateProgress(); 1746 } 1747 }); 1748 1749 if (!stepsWrap.classList.contains("_hidden_steps_form")) { 1750 updateSteps(); 1751 } 1752 1753 }); 1754 } 1755 }; 1756 1757 lp_template.queue.constructorClick = function ($self) { 1758 let $block = $self.find('.lp-constructor'); 1759 1760 if ($block.length) { 1761 $block.each(function () {
1762 let $this = $(this); 1763 let lpcClick = $this.find(".lp-active-click"); 1764 let item = $this.find(".lp-constructor-click"); 1765 1766 if (s3LP.is_cms) { 1767 lpcClick.on('click', function () { 1768 item.toggleClass('lp-image-show'); 1769 }); 1770 } 1771 }); 1772 } 1773 }; 1774 1775 lp_template.queue.typeWriter = function ($self) { 1776 let $block = $self.find('.lp-typewriter-init'); 1777 1778 if ($block.length) { 1779 $block.each(function () { 1780 const $this = $(this); 1781 const stringElements = $this.find(".lp-typewriter-string"); 1782 const delay = $this.attr("data-delay"); 1783 const delayDeletion = $this.attr("data-delay-deletion"); 1784 const stopDialing = $this.attr("data-stop-dialing"); 1785 1786 function typeText(element, text, delay, callback) { 1787 let index = 0; 1788 const textLength = text.length; 1789 1790 function addCharacter() { 1791 if (index < textLength) { 1792 element.textContent += text.charAt(index); 1793 index++; 1794 setTimeout(addCharacter, delay); 1795 } else { 1796 setTimeout(callback, delayDeletion); 1797 } 1798 } 1799 1800 addCharacter(); 1801 } 1802 1803 function eraseText(element, delay, callback) { 1804 const text = element.textContent; 1805 let index = text.length; 1806 1807 function removeCharacter() { 1808 if (index > 0) { 1809 element.textContent = text.substring(0, index - 1); 1810 index--; 1811 setTimeout(removeCharacter, delay); 1812 } else { 1813 callback(); 1814 } 1815 } 1816 1817 removeCharacter(); 1818 } 1819 1820 function animateElements(index) { 1821 if (index < stringElements.length) { 1822 const element = stringElements[index]; 1823 const text = element.getAttribute("data-text"); 1824 1825 typeText(element, text, delay, function () { 1826 if (index === stringElements.length - 1 && stopDialing === "1") { 1827 1828 setTimeout(function () { 1829 element.style.display = "inline"; 1830 animateElements(index + 1); 1831 }, 250); 1832 1833 } else { 1834 1835 eraseText(element, delay, function () { 1836 element.style.display = "none"; 1837 setTimeout(function () { 1838 animateElements(index + 1); 1839 }, 250); 1840 }); 1841 } 1842 }); 1843 } else { 1844 if (stopDialing === "1") { 1845 const lastElement = stringElements[stringElements.length - 1]; 1846 const lastText = lastElement.getAttribute("data-text"); 1847 lastElement.textContent = lastText; 1848 } else { 1849 setTimeout(function () { 1850 $this.find(".lp-typewriter-string").each(function () { 1851 $(this).text(""); 1852 $(this).css("display", "inline"); 1853 }); 1854 animateElements(0); 1855 }, delay); 1856 } 1857 } 1858 } 1859 1860 animateElements(0); 1861 }); 1862 } 1863 } 1864 1865 lp_template.queue.scrollToAnchor = function($self) { 1866 1867 if (s3LP.is_cms) return; 1868 1869 $self.on('click', 'a', function(e){ 1870 var $this = $(this), 1871 thisHref = $this.attr('href'); 1872 1873 if (thisHref.length < 2 || thisHref[0] != '#') return; 1874 1875 var $thisBlock = $(thisHref); 1876 1877 if (!$thisBlock.length) return; 1878 1879 e.preventDefault(); 1880 1881 //42658 1882 let scrollValue = $thisBlock.offset().top; 1883 const $fixedMenu =$(`.js-fixed-menu._to-fix-menu:not(._is-cms)`); 1884 1885 if ($fixedMenu.size() && $fixedMenu.height()){ 1886 scrollValue -= $fixedMenu.height(); 1887 } 1888 1889 $('html, body').animate({ 1890 scrollTop: scrollValue 1891 }); 1892 $('html').css({ 1893 //overflow: 'visible' 1894 overflow: '' 1895 }); 1896 }); 1897 } 1898 1899 lp_template.popupAdaptiveBlock = function () { 1900 1901 let decorPopupWrap = document.querySelector(".lp-popup-inner .decor-wrap"); 1902 1903 if(decorPopupWrap) { 1904 let decorPopupWrapWidth = decorPopupWrap.offsetWidth; 1905 if (decorPopupWrapWidth < 480) { 1906 decorPopupWrap.setAttribute("data-media-source", "media-xs"); 1907 checkMediaSource('media-xs'); 1908 } else if (decorPopupWrapWidth < 768) { 1909 decorPopupWrap.setAttribute("data-media-source", "media-sm"); 1910 checkMediaSource('media-sm'); 1911 } else if (decorPopupWrapWidth < 992) { 1912 decorPopupWrap.setAttribute("data-media-source", "media-md"); 1913 checkMediaSource('media-md'); 1914 } else if (decorPopupWrapWidth < 1280) { 1915 decorPopupWrap.setAttribute("data-media-source", "media-lg"); 1916 checkMediaSource('media-lg'); 1917 } else if (decorPopupWrapWidth >= 1280) { 1918 decorPopupWrap.setAttribute("data-media-source", "media-xl"); 1919 checkMediaSource('media-xl'); 1920 } 1921 } 1922 }; 1923 1924 lp_template.checkMapInitialization = function ($blocks) { 1925 $blocks.each(function () { 1926 var $this = $(this), 1927 id = $this.attr('id'); 1928 1929 if (!id) { 1930 return; 1931 } 1932 1933 if (initializedMaps.includes(id)) { 1934 return; 1935 } 1936 1937 if (isElementInViewport(this)) { 1938 initializedMaps.push(id); 1939 lp_template.initMaps($this); 1940 } 1941 }); 1942 }; 1943 1944 lp_template.initGoogleMaps = function(options) { 1945 var map = new google.maps.Map(document.getElementById(options.id), { 1946 zoom: parseInt(options.zoom), 1947 scrollwheel: false, 1948 center: new google.maps.LatLng(options.center[0], options.center[1]) 1949 }); 1950 1951 $.each(options.data, function(key, item) { 1952 var marker = new google.maps.Marker({ 1953 position: new google.maps.LatLng(item.coords[0], item.coords[1]), 1954 map: map, 1955 title: item.name 1956 }); 1957 1958 var infowindow = new google.maps.InfoWindow({ 1959 content: '<div class="baloon-content">' + 1960 '<h3 style="margin: 0; padding-bottom: 3px;">' + item.name + '</h3>' + 1961 item.desc + 1962 '</div>' 1963 }); 1964 1965 google.maps.event.addListener(marker, 'click', function() { 1966 infowindow.open(map, marker); 1967 }); 1968 }); 1969 } 1970 1971 lp_template.initYandexMaps = function(options, objectListFlag) { 1972 if (objectListFlag) { 1973 let groups = options.data; 1974 1975 var map = new ymaps.Map(options.id, { 1976 center: options.center, 1977 zoom: options.zoom, 1978 behaviors: ["drag", "rightMouseButtonMagnifier"], 1979 }, { 1980 searchControlProvider: 'yandex#search' 1981 }); 1982 1983 for (var i = 0; i < groups.length; i++) { 1984 createGroup(groups[i]); 1985 } 1986 1987 if (options.data[0].items.length > 1) { 1988 map.setBounds(map.geoObjects.getBounds()); 1989 map.setZoom(map.getZoom() - 1); 1990 } 1991 1992 1993 }else { 1994 1995 var map = new ymaps.Map(options.id, { 1996 center: options.center, 1997 zoom: options.zoom, 1998 behaviors: ['drag', 'rightMouseButtonMagnifier'], 1999 }); 2000 } 2001 2002 2003 2004 map.controls.add( 2005 new ymaps.control.ZoomControl() 2006 ); 2007 2008 var MyBalloonContentLayoutClass = ymaps.templateLayoutFactory.createClass( 2009 '<div class="baloon-content" style="padding: 0 10px;">' + 2010 '<h3 style="margin: 0;">$[properties.name]</h3>' + 2011 '<p>$[properties.desc]</p>' + 2012 '</div>' 2013 ); 2014 2015 var myCollection = new ymaps.GeoObjectCollection(); 2016 2017 if (objectListFlag) { 2018 $.each(options.data, function(key, item) { 2019 myCollection.add(new ymaps.Placemark( 2020 item.coords, 2021 item, { 2022 balloonContentLayout: MyBalloonContentLayoutClass 2023 } 2024 )); 2025 }); 2026 }else { 2027 $.each(options.data, function (key, item) { 2028 if(this.image){ 2029 myCollection.add( 2030 new ymaps.Placemark(item.coords, item, { 2031 balloonContentLayout: MyBalloonContentLayoutClass, 2032 iconLayout: 'default#image', 2033 iconImageHref: this.image, 2034 iconImageOffset: [-15, -15], 2035 }) 2036 ); 2037 } else{ 2038 myCollection.add( 2039 new ymaps.Placemark(item.coords, item, { 2040 balloonContentLayout: MyBalloonContentLayoutClass, 2041 iconImageOffset: [-15, -15], 2042 preset: this.icon, 2043 iconColor: this.color, 2044 }) 2045 ); 2046 } 2047 }); 2048 } 2049 2050 map.geoObjects.add(myCollection); 2051 2052 $('#' + options.id).data('ymaps', map); 2053 } 2054 2055 lp_template.initMaps = function($block) { 2056 var options = $block.data('init-params'); 2057 2058 if (!options) { 2059 return; 2060 } 2061 2062 $block.addClass('map-init'); 2063 2064 2065 options = typeof options === 'string' ? JSON.parse(options) : options; 2066 2067 2068 if (typeof options.center === 'string') { 2069 options.center = options.center.split(','); 2070 } 2071 2072 $.each(options.data, function(key, item) { 2073 if (typeof item.coords === 'string') { 2074 item.coords = item.coords.split(','); 2075 } 2076 }); 2077 2078 var keyMap = options.key ?? ''; 2079 2080 if (options.type === "google") { 2081 if (window.google && window.google.maps) { 2082 lp_template.initGoogleMaps(options); 2083 } else { 2084 var script = document.createElement('script'); 2085 script.async = 'async';
2086 script.src = `//maps.googleapis.com/maps/api/js?key=${keyMap}`; 2087 document.body.append(script); 2088 2089 script.onload = function() { 2090 lp_template.initGoogleMaps(options); 2091 } 2092 } 2093 } else { 2094 if (typeof window.ymaps !== 'undefined') { 2095 lp_template.initYandexMaps(options) 2096 } else { 2097 /*var script = document.createElement('script'); 2098 script.async = 'async'; 2099 //script.src = `//api-maps.yandex.ru/2.1/?apikey=${keyMap}&lang=ru_RU`; 2100 2101 //start 1935 2102 var scriptLangSrc = `${$ite.params.lang}_${$ite.params.lang.toUpperCase()}`; 2103 if (scriptLangSrc == 'en_EN') { 2104 scriptLangSrc = 'en_US' 2105 } 2106 script.src = `//api-maps.yandex.ru/2.1/?apikey=${keyMap}&lang=` + scriptLangSrc; 2107 //end 1935 2108 2109 document.body.append(script); 2110 2111 script.onload = function() { 2112 ymaps.ready(function() { 2113 lp_template.initYandexMaps(options) 2114 }); 2115 }*/ 2116 2117 2118 var htmlLang = document.documentElement.lang; 2119 var script = document.createElement("script"); 2120 script.async = "async"; 2121 if (htmlLang == "en") { 2122 if (keyMap!="") { 2123 script.src = `//api-maps.yandex.ru/2.1/?apikey=${keyMap}&lang=en_RU`; 2124 } else { 2125 script.src = `//api-maps.yandex.ru/2.1/?lang=en_RU`; 2126 } 2127 } else { 2128 if (keyMap!="") { 2129 script.src = `//api-maps.yandex.ru/2.1/?apikey=${keyMap}&lang=ru_RU`; 2130 } else { 2131 script.src = `//api-maps.yandex.ru/2.1/?lang=ru_RU`; 2132 } 2133 } 2134 2135 document.body.append(script); 2136 2137 script.onload = function () { 2138 ymaps.ready(function () { 2139 lp_template.initYandexMaps(options); 2140 }); 2141 }; 2142 } 2143 } 2144 } 2145 2146 /* 2147 lp_template.initMaps = function(options) { 2148 var map; 2149 2150 if (options.type === "google") { 2151 map = new google.maps.Map(document.getElementById(options.id), { 2152 zoom: parseInt(options.zoom), 2153 scrollwheel: false, 2154 center: new google.maps.LatLng(options.center[0], options.center[1]) 2155 }); 2156 2157 $.each(options.data, function(key, item) { 2158 2159 var marker = new google.maps.Marker({ 2160 position: new google.maps.LatLng(item.coords[0], item.coords[1]), 2161 map: map, 2162 title: item.name 2163 }); 2164 2165 var infowindow = new google.maps.InfoWindow({ 2166 content: '<div class="baloon-content">' + 2167 '<h3 style="margin: 0; padding-bottom: 3px;">' + item.name + '</h3>' + 2168 item.desc + 2169 '</div>' 2170 }); 2171 2172 google.maps.event.addListener(marker, 'click', function() { 2173 infowindow.open(map, marker); 2174 }); 2175 2176 2177 }); 2178 2179 } else { 2180 2181 ymaps.ready(function() { 2182 2183 map = new ymaps.Map(options.id, { 2184 center: options.center, 2185 zoom: options.zoom, 2186 behaviors: ['drag', 'rightMouseButtonMagnifier'], 2187 }); 2188 2189 map.controls.add( 2190 new ymaps.control.ZoomControl() 2191 ); 2192 2193 var MyBalloonContentLayoutClass = ymaps.templateLayoutFactory.createClass( 2194 '<div class="baloon-content" style="padding: 0 10px;">' + 2195 '<h3 style="margin: 0;">$[properties.name]</h3>' + 2196 '<p>$[properties.desc]</p>' + 2197 '</div>' 2198 ); 2199 2200 var myCollection = new ymaps.GeoObjectCollection(); 2201 2202 $.each(options.data, function(key, item) { 2203 myCollection.add(new ymaps.Placemark( 2204 item.coords, 2205 item, { 2206 balloonContentLayout: MyBalloonContentLayoutClass 2207 } 2208 )); 2209 }); 2210 2211 map.geoObjects.add(myCollection); 2212 2213 $('#' + options.id).data('ymaps', map); 2214 }); 2215 } 2216 } 2217 2218 lp_template.queue.lpSimpleMap = function($self) { 2219 var $block = $self.find('.js-lp-simple-map'); 2220 2221 if ($block.length) { 2222 setTimeout(function(){ 2223 $block.each(function(){ 2224 var $this = $(this), 2225 thisParams = $this.data('init-params'); 2226 2227 thisParams = typeof thisParams === 'string' ? JSON.parse(thisParams) : thisParams; 2228 2229 if (typeof thisParams.center === 'string') { 2230 thisParams.center = thisParams.center.split(','); 2231 } 2232 2233 $.each(thisParams.data, function(key, item) { 2234 if (typeof item.coords === 'string') { 2235 item.coords = item.coords.split(','); 2236 } 2237 }); 2238 2239 lp_template.initMaps(thisParams); 2240 }); 2241 }, 750); 2242 } 2243 } 2244 */ 2245 2246 lp_template.queue.lpSliderMagic = function ($self) { 2247 2248 //var $block = $self.hasClass('.lpc-flexible-image-js') ? $self : $self.find('.lpc-flexible-image-js'); 2249 var $block = $self.hasClass('magic-slider') ? $self : $self.find('.magic-slider'); 2250 if($block.length) { 2251 2252 $block.each(function () { 2253 2254 2255 let $item = $(this); 2256 let $itemId = $item.attr('id'); 2257 2258 let $sliderMagic = `#${$itemId}.magic-slider`; 2259 2260 2261 function sliderInit(parent){ 2262 2263 2264 let sliderBlock = document.querySelector(parent); 2265 2266 let decorWrap = document.querySelector('.decor-wrap'); 2267 2268 let mediaSource = decorWrap.getAttribute('data-media-source'); 2269 2270 if (!sliderBlock) return; // ÐÑовеÑка на ÑÑÑеÑÑвование ÑлеменÑа 2271 2272 let sliderTrigger = Number(sliderBlock.getAttribute('data-trigger-hook')); 2273 2274 let sliderContainer = sliderBlock.querySelector('.lp-prods-m__magic-slider-container'); 2275 2276 let slider = sliderBlock.querySelector('.lp-prods-m__magic-slider'); 2277 2278 let scrollWidth = 0; 2279 2280 let slideBox = sliderBlock.querySelector('.lp-prods-m__wrap-box'); 2281 2282 let sliderTitle = sliderBlock.querySelector('.magic-slider-header'); 2283 2284 //let sliderContainerWidth = sliderContainer; 2285 //ÑÐ»Ð°Ð¹Ð´Ñ 2286 let slideItem = sliderBlock.querySelectorAll('.lp-prods-m__magic-slide'); 2287 2288 // ÐолиÑеÑÑво Ñлайдов 2289 let slideCount = slideItem.length; 2290 2291 let progress = 0; 2292 2293 let itemGap = 0; 2294 2295 let slideWrap = sliderBlock.querySelector('.lpc-magic-full-width-init'); 2296 2297 2298 function sliderInitInter() { 2299 let slideWidth = slideWrap.offsetWidth; 2300 2301 let docWidth = document.documentElement.clientWidth; 2302 2303 //let itemMargin = (docWidth - slideWidth) / 2; 2304 //console.log(slideWrap.getBoundingClientRect().left); 2305 //console.log(slideWrap.getBoundingClientRect().right - slideWidth); 2306 2307 let itemMarginLeft = slideWrap.getBoundingClientRect().left; 2308 2309 //let itemMarginRight = slideWrap.getBoundingClientRect().right - slideWidth 2310 let itemMarginRight = docWidth - slideWrap.getBoundingClientRect().right; 2311 2312 //console.log(itemMarginLeft) 2313 //console.log(itemMarginRight) 2314 /*if(sliderBlock.classList.contains('magic-slider-full-width')){ 2315 slideBox.style.marginLeft = '-' + itemMargin + 'px'; 2316 slideBox.style.marginRight = '-' + itemMargin + 'px'; 2317 } 2318 slideBox.style.marginLeft = '-' + itemMargin + 'px'; 2319 slideBox.style.marginRight = '-' + itemMargin + 'px';*/ 2320 2321 slideBox.style.marginLeft = '-' + itemMarginLeft + 'px'; 2322 slideBox.style.marginRight = '-' + itemMarginRight + 'px'; 2323 2324 /*if(!sliderBlock.classList.contains('magic-slider-full-width') && slideBox.classList.contains('magic-slider-container-block')){ 2325 slideBox.style.marginLeft = 0; 2326 slideBox.style.marginRight = 0; 2327 }*/ 2328 2329 // ÐлеменÑÑ 2330 2331 if(sliderTitle){ 2332 2333
2334 if(!sliderBlock.classList.contains('magic-slider-full-width')){ 2335 sliderTitle.style.width = slideWidth + 'px'; 2336 sliderTitle.style.marginLeft = itemMarginLeft + 'px'; 2337 } 2338 2339 if(!sliderBlock.classList.contains('magic-slider-full-width') && slideBox.classList.contains('magic-slider-container-block')){ 2340 sliderTitle.style.marginLeft = 0; 2341 } 2342 2343 if(sliderBlock.classList.contains('magic-slider-full-width') && slideBox.classList.contains('magic-slider-container-block')){ 2344 sliderTitle.style.width = slideWidth + 'px'; 2345 sliderTitle.style.marginLeft = itemMarginLeft + 'px'; 2346 } 2347 } 2348 2349 let itemWidth = 0; 2350 2351 let coefficient = 0; 2352 2353 if(sliderBlock.classList.contains('magic-slider-middle') && decorWrap.getAttribute('data-media-source') !== 'media-xs'){ 2354 itemWidth = slideWidth / 3 * 2; 2355 coefficient = itemWidth / 2 2356 2357 } else if (sliderBlock.classList.contains('magic-slider-small') && decorWrap.getAttribute('data-media-source') !== 'media-xs'){ 2358 itemWidth = slideWidth / 2; 2359 coefficient = itemWidth 2360 } else { 2361 itemWidth = slideWidth; 2362 } 2363 2364 let slideItemMarginLeft = 0; 2365 2366 slideItemMarginLeft = parseInt(getComputedStyle(slideItem[0]).marginLeft); 2367 2368 //let itemGap = 0; 2369 2370 for(let i = 0; i < slideItem.length - 1; i++){ 2371 itemGap += parseInt(getComputedStyle(slideItem[i]).marginRight); 2372 } 2373 2374 //console.log(itemGap) 2375 2376 //еÑли конÑÐµÐ¹Ð½ÐµÑ Ð¸ не на вÑÑ ÑиÑÐ¸Ð½Ñ Ð±Ð»Ð¾Ðº 2377 2378 if(!sliderBlock.classList.contains('magic-slider-full-width') && slideBox.classList.contains('magic-slider-container-block')){ 2379 2380 itemWidth = itemWidth - slideItemMarginLeft; 2381 2382 } 2383 2384 //наÑÑÑойка макÑималÑной ÑиÑÐ¸Ð½Ñ Ñлайда ÑÑÐ¾Ð±Ñ Ð²ÑÑоÑа Ñлайда не пÑевÑÑала 78vh 2385 2386 let itemMaxHeight = window.innerHeight * 0.78; 2387 let aspectRatio = 16 / 9; 2388 2389 let itemMaxWidth = itemMaxHeight * aspectRatio; 2390 2391 let itemsCountWidth = 0 2392 let itemMathWidth = 0; 2393 let itemCount = 0; 2394 2395 function slideSheetTarget(){ 2396 slider.addEventListener('click', function(event){ 2397 2398 if(event.target.classList.contains('magic-item-sheet-btn')){ 2399 let sheetBtn = event.target; 2400 let itemSheetContainer = sheetBtn.closest('.magic-item-column-slide'); 2401 let sheet = itemSheetContainer.querySelector('.magic-item-sheet'); 2402 let sheetClose = itemSheetContainer.querySelector('.magic-item-sheet-close'); 2403 let sheetContainer = itemSheetContainer.querySelector('.magic-item-column-text'); 2404 let itemSheetImage = itemSheetContainer.querySelector('.magic-item-column-image'); 2405 2406 let sheetContainerHeight = sheetContainer.offsetHeight; 2407 sheetContainer.style.minHeight = sheetContainerHeight + 'px'; 2408 sheet.classList.remove('hidden-text'); 2409 itemSheetContainer.classList.add('active'); 2410 itemSheetImage.style.opacity = 0; 2411 2412 /*************************************/ 2413 2414 if(progress !== 0 && progress !== 1){ 2415 let transformMatrix = window.getComputedStyle(slider).transform; 2416 let translateX = 0; 2417 2418 if (transformMatrix !== 'none') { 2419 const matrixValues = transformMatrix.match(/matrix\((.+)\)/)[1].split(', '); 2420 translateX = parseFloat(matrixValues[4]); 2421 } 2422 2423 /*let progressStatus = Math.round(progress * 100); 2424 2425 console.log(progressStatus)*/ 2426 2427 //let itemScrollAmount = translateX; 2428 2429 let itemScrollAmount = 0; 2430 2431 //let scrollWidth = sliderBlock.scene.duration(); 2432 2433 //console.log(itemScrollAmount) 2434 2435 let rect = itemSheetContainer.getBoundingClientRect(); 2436 let leftDistance = rect.left; // РаÑÑÑоÑние Ð¾Ñ Ð»ÐµÐ²Ð¾Ð³Ð¾ кÑÐ°Ñ ÑкÑана 2437 let rightDistance = window.innerWidth - rect.right; // РаÑÑÑоÑние Ð¾Ñ Ð¿Ñавого кÑÐ°Ñ ÑкÑана 2438 2439 //console.log("ÐевÑй кÑай: " + leftDistance + "px, ÐÑавÑй кÑай: " + rightDistance + "px"); 2440 2441 let windowWidth = document.documentElement.clientWidth; 2442 2443 //console.log("ШиÑина viewport " + windowWidth) 2444 2445 let itemSheetContainerWidth = itemSheetContainer.offsetWidth; 2446 2447 //console.log("ШиÑина Ñлайда " + itemSheetContainerWidth) 2448 2449 let itemSheetContainerCenter = (windowWidth - itemSheetContainerWidth) / 2 2450 2451 //console.log("колиÑеÑÑво пикÑелей Ð´Ð»Ñ ÑенÑÑовки " + itemSheetContainerCenter) 2452 //console.log("полоÑа пÑокÑÑÑки " + scrollWidth) 2453 2454 if(leftDistance > rightDistance){ 2455 itemScrollAmount = leftDistance - itemSheetContainerCenter; 2456 2457 //console.log("нÑжно пÑокÑÑÑиÑÑ Ð²Ð¿Ñаво на " + itemScrollAmount) 2458 } else if(rightDistance > leftDistance){ 2459 2460 itemScrollAmount = rightDistance - itemSheetContainerCenter 2461 itemScrollAmount = -itemScrollAmount 2462 2463 //console.log("нÑжно пÑокÑÑÑиÑÑ Ð²Ð»ÐµÐ²Ð¾ на " + itemScrollAmount) 2464 } 2465 2466 //itemScrollAmount = itemSheetContainer.offsetWidth + parseInt(getComputedStyle(itemSheetContainer).marginRight); 2467 2468 let itemsSheet = [...slider.children]; // ÐÑеобÑазÑем в маÑÑив 2469 2470 // ÐпÑеделÑем, пеÑвÑй ли ÑÑо ÑÐ»ÐµÐ¼ÐµÐ½Ñ 2471 /*if (itemsSheet[0] === itemSheetContainer) { 2472 console.log('ÐÑо пеÑвÑй ÑлеменÑ:'); 2473 }*/ 2474 // ÐпÑеделÑем, поÑледний ли ÑÑо ÑÐ»ÐµÐ¼ÐµÐ½Ñ 2475 /*if (itemsSheet[itemsSheet.length - 1] === itemSheetContainer) { 2476 console.log('ÐÑо поÑледний ÑлеменÑ:'); 2477 }*/ 2478 2479 2480 window.scrollBy({ top: itemScrollAmount, left: 0, behavior: "smooth" }); 2481 //console.log(itemScrollAmount) 2482 } 2483 2484 /*************************************/ 2485 2486 sheetClose.addEventListener('click', function(event){ 2487 sheetContainer.style.minHeight = 0; 2488 sheet.classList.add('hidden-text'); 2489 itemSheetContainer.classList.remove('active'); 2490 itemSheetImage.style.opacity = 1; 2491 }); 2492 2493 window.addEventListener('resize', function(){ 2494 sheetContainer.style.minHeight = 0; 2495 sheet.classList.add('hidden-text'); 2496 itemSheetContainer.classList.remove('active'); 2497 itemSheetImage.style.opacity = 1; 2498 }) 2499 2500 document.addEventListener('click', function(e){ 2501 if (!e.target.closest('.lp-prods-m-item')) { 2502 sheetContainer.style.minHeight = 0; 2503 sheet.classList.add('hidden-text'); 2504 itemSheetContainer.classList.remove('active'); 2505 itemSheetImage.style.opacity = 1; 2506 } 2507 }); 2508 } 2509 2510 2511 }); 2512 } 2513 2514 slideSheetTarget() 2515 2516 for(let i = 0; i < slideItem.length; i++){ 2517 slideItem[i].style.width = itemWidth + 'px'; 2518 slideItem[i].style.maxWidth = itemMaxWidth + 'px'; 2519 2520 2521 let slideItemRow = slideItem[i].querySelector('.magic-slide-item-row'); 2522 2523 let slideItemRowHeight = slideItemRow.offsetHeight; 2524 2525 let slideItemRowImage = slideItemRow.querySelector('.magic-item-column-image') 2526 let slideItemRowText = slideItemRow.querySelector('.magic-item-column-text') 2527 2528 if (slideItemRowImage){ 2529 let slideItemRowImageHeight = slideItemRowImage.offsetHeight; 2530 2531 let newWidth = 0; 2532 2533 if(decorWrap.getAttribute('data-media-source') === 'media-xs'){ 2534 2535 2536 let slideItemRowTextTitle = slideItemRow.querySelector('.magic-item-column-text-title'); 2537 let slideItemRowTextDesc = slideItemRow.querySelector('.magic-item-column-text-desc'); 2538 let slideItemRowTextMobHeight = 0; 2539 2540 if (slideItemRowTextTitle){ 2541 let slideItemRowTextTitleHeight = slideItemRowTextTitle.offsetHeight; 2542 let slideItemRowTextTitleMargin = parseInt(getComputedStyle(slideItemRowTextTitle).marginBottom) 2543 2544 slideItemRowTextMobHeight += slideItemRowTextTitleHeight + slideItemRowTextTitleMargin 2545 } 2546 2547 if (slideItemRowTextDesc){ 2548 let slideItemRowTextDescHeight = slideItemRowTextDesc.offsetHeight; 2549 2550 slideItemRowTextMobHeight += slideItemRowTextDescHeight 2551 2552 } 2553 2554 if(slideItemRowImageHeight + slideItemRowTextMobHeight > slideItemRowHeight){ 2555 2556 while (slideItemRowImageHeight + slideItemRowTextMobHeight > slideItemRowHeight) { 2557 newWidth = slideItem[i].offsetWidth; 2558 slideItem[i].style.width = newWidth - 10 + "px"; 2559 2560 slideItemRowImageHeight = slideItemRowImage.offsetHeight; 2561 slideItemRowHeight = slideItemRow.offsetHeight; 2562 2563 if(slideItemRowImageHeight + slideItemRowTextMobHeight <= slideItemRowHeight){ 2564 2565 break 2566 2567 } 2568 2569 } 2570 2571 } 2572 2573 2574 2575 } else { 2576 2577 if(slideItemRowImageHeight > slideItemRowHeight){ 2578 2579 while (slideItemRowImageHeight > slideItemRowHeight) { 2580 newWidth = slideItem[i].offsetWidth; 2581 slideItem[i].style.width = newWidth - 10 + "px"; 2582 2583 slideItemRowImageHeight = slideItemRowImage.offsetHeight; 2584 slideItemRowHeight = slideItemRow.offsetHeight; 2585 2586 if(slideItemRowImageHeight <= slideItemRowHeight){ 2587 2588 break 2589 2590 } 2591 2592 } 2593 2594 } 2595 } 2596 2597 } 2598 2599 2600 itemsCountWidth = itemsCountWidth + slideItem[i].offsetWidth; 2601 ++itemCount; 2602 2603 2604 } 2605 2606 2607 itemMathWidth = itemsCountWidth / itemCount; 2608 2609 2610 2611 if(sliderBlock.classList.contains('magic-slider-full-width')){ 2612 2613 let boxWidth = slideBox.clientWidth; 2614 sliderContainer.style.maxWidth = boxWidth + 'px'; 2615 2616 //scrollWidth = (itemMathWidth * (slideCount - 1)) - (itemMargin * 2) + (slideItemMarginLeft * 2) + itemGap - coefficient - (itemWidth - itemMathWidth); 2617 2618 scrollWidth = (itemMathWidth * (slideCount - 1)) - (itemMarginLeft + itemMarginRight) + (slideItemMarginLeft * 2) + itemGap - coefficient - (itemWidth - itemMathWidth); 2619 2620 2621 if(slideBox.classList.contains('magic-slider-container-block')){ 2622 2623 let boxWidth = slideBox.clientWidth; 2624 sliderContainer.style.maxWidth = boxWidth + 'px'; 2625 2626 slideItem[0].style.marginLeft = itemMarginLeft + 'px'; 2627 scrollWidth = itemMathWidth * (slideCount - 1) + itemGap - coefficient - (itemWidth - itemMathWidth); 2628 2629 } 2630 2631 } else { 2632 2633 /*if(!sliderBlock.classList.contains('magic-slider-full-width') && slideBox.classList.contains('magic-slider-container-block')){*/ 2634 if(slideBox.classList.contains('magic-slider-container-block')){ 2635 2636 slideBox.style.marginLeft = 0; 2637 slideBox.style.marginRight = 0; 2638 2639 let boxWidth = slideBox.clientWidth; 2640 2641 sliderContainer.style.maxWidth = boxWidth + 'px'; 2642 2643 2644 //scrollWidth = itemMathWidth * (slideCount - 1) + itemGap - coefficient + (slideItemMarginLeft * 1); 2645 scrollWidth = itemMathWidth * (slideCount - 1) + itemGap - coefficient - (itemWidth - itemMathWidth) + slideItemMarginLeft; 2646 2647 2648 } else { 2649 2650 let boxWidth = slideBox.clientWidth; 2651 sliderContainer.style.maxWidth = boxWidth + 'px'; 2652 2653 slideItem[0].style.marginLeft = itemMarginLeft + 'px'; 2654 scrollWidth = itemMathWidth * (slideCount - 1) + itemGap - coefficient - (itemWidth - itemMathWidth); 2655 2656 } 2657 2658 2659 } 2660 } 2661 2662 2663 function sliderInitRemoveStyle(){ 2664 slideBox.removeAttribute('style'); 2665 2666 if(sliderTitle) { 2667 sliderTitle.removeAttribute('style'); 2668 } 2669 2670 2671 for(let i = 0; i < slideItem.length; i++){ 2672 slideItem[i].removeAttribute('style'); 2673 } 2674 } 2675 2676 //ÑÑÑ Ð±Ñл ÑаÑÑÐµÑ ÑиÑÐ¸Ð½Ñ Ð±Ð»Ð¾ÐºÐ¾Ð², ÑÐµÑ Ð°Ð» на веÑÑ 2677
2678 let controller = null; // ÐонÑÑÐ¾Ð»Ð»ÐµÑ Ð¾Ð±ÑÑвлÑем глобалÑно 2679 let scene = null; 2680 2681 destroySlider(); 2682 2683 function initSlider() { 2684 if(scrollWidth > 0) { 2685 2686 controller = new ScrollMagic.Controller(); 2687 sliderBlock.controller = controller; 2688 2689 scene = new ScrollMagic.Scene({ 2690 triggerElement: sliderContainer, 2691 duration: scrollWidth, 2692 triggerHook: sliderTrigger, 2693 offset: 0 2694 }) 2695 .setPin(sliderContainer) 2696 .on("progress", function (event) { 2697 progress = event.progress; 2698 let transformPos = Math.round(-scrollWidth * progress); 2699 slider.style.transform = "translateX(" + transformPos + "px)"; 2700 }) 2701 .addTo(controller); 2702 2703 sliderBlock.scene = scene; // Ð¡Ð¾Ñ ÑанÑем ÑÑÐµÐ½Ñ 2704 2705 } else { 2706 sliderContainer.style.height = 'auto'; 2707 } 2708 2709 } 2710 2711 2712 // ФÑнкÑÐ¸Ñ Ð´Ð»Ñ ÑниÑÑÐ¾Ð¶ÐµÐ½Ð¸Ñ ÑлайдеÑа 2713 function destroySlider() { 2714 if (sliderBlock.controller) { 2715 sliderBlock.controller.destroy(true); 2716 sliderBlock.controller = null; 2717 slider.style.transform = "translateX(" + 0 + ")"; 2718 scene = null; 2719 } 2720 } 2721 2722 2723 // ФÑнкÑÐ¸Ñ Ð´Ð»Ñ Ð¾Ð±ÑабоÑки изменений аÑÑибÑÑа 2724 function handleAttributeChange() { 2725 2726 mediaSource = $('html').attr('data-media-source'); 2727 2728 if(sliderBlock.classList.contains('lp_scroll_disable')) { 2729 2730 console.log("reg"); 2731 2732 if (mediaSource === 'media-xs' || mediaSource === 'media-md' || mediaSource === 'media-sm') { 2733 2734 sliderInitRemoveStyle() 2735 destroySlider(); 2736 } else if (mediaSource === 'media-xl' || mediaSource === 'media-lg') { 2737 if (!sliderBlock.controller) { 2738 sliderInitInter() 2739 initSlider(); 2740 } 2741 } 2742 2743 } else { 2744 if (!sliderBlock.controller) { 2745 2746 if (mediaSource === 'media-xs') { 2747 2748 sliderInitInter() 2749 initSlider(); 2750 2751 } else if (mediaSource === 'media-xl' || mediaSource === 'media-lg' || mediaSource === 'media-md' || mediaSource === 'media-sm') { 2752 sliderInitInter() 2753 initSlider(); 2754 } 2755 2756 } 2757 } 2758 } 2759 2760 // ÐапÑÑкаем наблÑдаÑÐµÐ»Ñ Ð·Ð° аÑÑибÑÑами 2761 let observer = new MutationObserver(handleAttributeChange); 2762 observer.observe(decorWrap, { attributes: true, attributeFilter: ['data-media-source'] }); 2763 2764 // ÐапÑÑкаем ÑлайдеÑ, еÑли ÑÑÐ°Ð·Ñ mxledia- 2765 handleAttributeChange(); 2766 2767 } 2768 2769 if (s3LP.is_cms){ 2770 if(document.querySelector($sliderMagic)){ 2771 2772 document.addEventListener('lp_init_after', function(){ 2773 sliderInit($sliderMagic); 2774 }); 2775 2776 setTimeout(function(){ 2777 sliderInit($sliderMagic); 2778 }, 1000) 2779 2780 } 2781 2782 }else{ 2783 document.addEventListener('lp_init_after', function() { 2784 2785 var sliderSelector = $sliderMagic; 2786 var sliderEl = document.querySelector(sliderSelector); 2787 if (!sliderEl) return; // еÑли блока Ð½ÐµÑ â вÑÑ Ð¾Ð´Ð¸Ð¼ 2788 2789 var sliderInitialized = false; 2790 2791 // ФÑнкÑÐ¸Ñ Ð´Ð»Ñ Ð¸Ð½Ð¸ÑиализаÑии ÑлайдеÑа (однокÑаÑно) 2792 function initSlider() { 2793 if (!sliderInitialized) { 2794 sliderInit(sliderSelector); 2795 sliderInitialized = true; 2796 // ÐÑли иниÑиализаÑÐ¸Ñ ÑÑебÑеÑÑÑ ÑолÑко один Ñаз, можно ÑбÑаÑÑ ÑлÑÑаÑÐµÐ»Ñ ÑкÑолла: 2797 window.removeEventListener('scroll', scrollHandler); 2798 } 2799 } 2800 2801 // ÐÑовеÑÑем, виден ли блок или Ñже бÑл показан (напÑимеÑ, еÑли Ð¼Ñ Ð¿ÐµÑезагÑÑзили ÑÑÑаниÑÑ Ð½Ð¸Ð¶Ðµ блока) 2802 function checkVisibility() { 2803 var rect = sliderEl.getBoundingClientRect(); 2804 // ÐÑли веÑÑ Ð½ÑÑ Ð³ÑаниÑа блока менÑÑе вÑÑоÑÑ Ð¾ÐºÐ½Ð° â знаÑиÑ, блок либо виден, либо Ñже пÑоÑÑл мимо 2805 if (rect.top < window.innerHeight) { 2806 2807 initSlider(); 2808 2809 } 2810 } 2811 2812 function scrollHandler() { 2813 checkVisibility(); 2814 } 2815 2816 // ÐÑи загÑÑзке ÑÑÑаниÑÑ Ð¿ÑовеÑÑем видимоÑÑÑ Ð±Ð»Ð¾ÐºÐ° 2817 checkVisibility(); 2818 // ÐÑли блок еÑÑ Ð½Ðµ бÑл показан, Ñледим за пÑокÑÑÑкой 2819 window.addEventListener('scroll', scrollHandler); 2820 2821 // ÐÑи изменении ÑазмеÑов окна пеÑезапÑÑкаем ÑÐ»Ð°Ð¹Ð´ÐµÑ (как в иÑÑ Ð¾Ð´Ð½Ð¾Ð¼ ваÑианÑе) 2822 window.addEventListener('resize', function(){ 2823 setTimeout(function(){ 2824 // ÐÑли ÑÐ»Ð°Ð¹Ð´ÐµÑ Ñже бÑл иниÑиализиÑован â обновлÑем его, 2825 // еÑли еÑÑ Ð½ÐµÑ â пÑовеÑÑем видимоÑÑÑ Ð±Ð»Ð¾ÐºÐ° 2826 if (sliderInitialized) { 2827 sliderInit(sliderSelector); 2828 } else { 2829 checkVisibility(); 2830 } 2831 }, 500); 2832 }); 2833 }); 2834 2835 2836 } 2837 2838 if ($(this).hasClass('lp-container-type')) { 2839 $(this).removeClass('lp-gap-full lp-prods-m__container lp-container-type'); 2840 $(this).find('.magic-slider-container-block').addClass('lp-gap-full lp-prods-m__container lp-container-type'); 2841 } 2842 2843 }); 2844 } 2845 } 2846 2847 lp_template.queue.tabsBlocks = function($self) { 2848 var $block = $self.find('.lp-js-tabs'); 2849 if ($block.length) { 2850 $block.each(function() {
2851 let $this = $(this); 2852 var $tab = $this.find(".lp-tab-gallery__tab"); 2853 var $tabs = $this.find(".lp-tab-gallery__tabs"); 2854 var $item = $this.find(".lp-tab-gallery__image"); 2855 2856 if ($tabs.hasClass('_type-group') || $tabs.hasClass('_type-btn')) { 2857 $tab.first().find('.lp-button').addClass('lp-button--type-1'); 2858 $tab.first().find('.lp-button').removeClass('lp-button--type-3'); 2859 $tab.first().find('.lp-button').removeClass('lp-button--type-2'); 2860 2861 setTimeout(function() { 2862 let lpcButtonType1 = $this.find('.lp-button--type-1'); 2863 let borderRadiusValue = lpcButtonType1.css('border-radius'); 2864 2865 $('.lp-tab-gallery__tabs._type-group').css('border-radius', borderRadiusValue); 2866 }, 50); 2867 } 2868 $tab.first().addClass('active'); 2869 $item.first().addClass('active'); 2870 2871 2872 $tab.on('click', function () { 2873 const index = $(this).index(); 2874 2875 $tab.removeClass('active'); 2876 2877 $item.removeClass('active'); 2878 2879 $(this).addClass('active'); 2880 $item.eq(index).addClass('active'); 2881 if ($(this).closest('._type-group').length){ 2882 if ($(this).hasClass('active')) { 2883 $(this).find('.lp-button').removeClass('lp-button--type-2', 'lp-button--type-3'); 2884 $(this).find('.lp-button').addClass('lp-button--type-1'); 2885 $(this).siblings('.lp-tab-gallery__tab').find('.lp-button').removeClass('lp-button--type-1'); 2886 $(this).siblings('.lp-tab-gallery__tab').find('.lp-button').addClass('lp-button--type-2', 'lp-button--type-3'); 2887 } 2888 } 2889 if ($(this).closest('._type-btn').length){ 2890 if ($(this).hasClass('active')) { 2891 $(this).find('.lp-button').removeClass('lp-button--type-2'); 2892 $(this).find('.lp-button').addClass('lp-button--type-1'); 2893 $(this).siblings('.lp-tab-gallery__tab').find('.lp-button').removeClass('lp-button--type-1'); 2894 $(this).siblings('.lp-tab-gallery__tab').find('.lp-button').addClass('lp-button--type-2'); 2895 } 2896 } 2897 }); 2898 }); 2899 } 2900 }; 2901 2902 2903 let bgWatchers = {}; 2904 2905 lp_template.queue.lpcDecorText = function($self) { 2906 var $block = $self.hasClass('lpc-elements-dynamic-headline') ? $self : $self.find('.lpc-elements-dynamic-headline'); 2907 2908 function initHeadline() { 2909 if($block.length) { 2910 $block.each(function () { 2911 let $item = $(this); 2912 let $itemId = $item.attr('id'); 2913 let $title = `#${$itemId} .lpc-elements-dynamic-headline__title`; 2914 let $titleInit = `#${$itemId} .lpc-dynamic-title-init`; 2915 let $bgItem = `#${$itemId} .lp-block-bg_item`; 2916 let $overlayItem = `#${$itemId} .lp-block-overlay_item`; 2917 2918 2919 dynamicTextWidth($titleInit, $title); 2920 2921 if (document.querySelector($title) && document.querySelector($title).classList.contains('bg_clip')) { 2922 dynamicTextBg($titleInit, $title, $bgItem, $overlayItem); 2923 }; 2924 2925 let observerTitle = bindObserver($title, $titleInit, $bgItem, $overlayItem); 2926 2927 2928 // ÐÑÑлеживание изменений Ñона 2929 if (document.querySelector($title) && document.querySelector($title).classList.contains('bg_clip')) { 2930 let bgPrev, ovPrev; 2931 2932 if (bgWatchers[$itemId]) { 2933 clearInterval(bgWatchers[$itemId]); 2934 } 2935 2936 bgWatchers[$itemId] = setInterval(() => { 2937 const t = document.querySelector($title); 2938 if (!t || !t.classList.contains('bg_clip')) return; 2939 2940 const bg = document.querySelector($bgItem); 2941 const ov = document.querySelector($overlayItem); 2942 if (!bg || !ov) return; 2943 2944 const bgNow = getComputedStyle(bg).background; 2945 const ovNow = getComputedStyle(ov).background; 2946 2947 if ((bgPrev && bgPrev !== bgNow) || (ovPrev && ovPrev !== ovNow)) { 2948 dynamicTextBg($titleInit, $title, $bgItem, $overlayItem); 2949 } 2950 2951 bgPrev = bgNow; 2952 ovPrev = ovNow; 2953 }, 300); 2954 }; 2955 2956 $(document).on('click', '#publish_button, #cancel_all_button, .clear-control', function() { 2957 setTimeout(function () { 2958 // пеÑеÑÑÑÑ ÑазмеÑа 2959 dynamicTextWidth($titleInit, $title); 2960 2961 // пÑовеÑка Ñона 2962 dynamicTextBg($titleInit, $title, $bgItem, $overlayItem); 2963 2964 // пеÑезапÑÑк наблÑÐ´ÐµÐ½Ð¸Ñ 2965 if (observerTitle) observerTitle.disconnect(); 2966 observerTitle = bindObserver($title, $titleInit, $bgItem, $overlayItem); 2967 }, 50); 2968 }); 2969 2970 2971 // ÐÐ»Ñ ÐÐЦ
2972 function waitForStylesheet(callback, delay = 500) { 2973 const interval = setInterval(() => { 2974 if (document.getElementById('lpc-stylesheet')) { 2975 clearInterval(interval); 2976 setTimeout(callback, delay); 2977 } 2978 }, 250); 2979 } 2980 2981 waitForStylesheet(() => { 2982 dynamicTextWidth($titleInit, $title); 2983 }, 500); 2984 2985 if (!s3LP.is_cms) { 2986 let initTimeout; 2987 2988 $(window).on('resize', function(){ 2989 clearInterval(initTimeout); 2990 2991 initTimeout = setTimeout(function(){ 2992 dynamicTextWidth($titleInit, $title); 2993 2994 if (document.querySelector($title) && document.querySelector($title).classList.contains('bg_clip')) { 2995 dynamicTextBg($titleInit, $title, $bgItem, $overlayItem); 2996 }; 2997 }, 50); 2998 }); 2999 }; 3000 }); 3001 } 3002 }; 3003 3004 function bindObserver($title, $titleInit, $bgItem, $overlayItem) { 3005 let contentTitle = document.querySelector($title); 3006 if (!contentTitle) return; 3007 3008 let observerTitle = new MutationObserver((mutations) => { 3009 mutations.forEach((mutation) => { 3010 if ($(mutation.target).closest('.lpc-dynamic-title-init').length) { 3011 3012 if (mutation.type === "characterData" || mutation.type === "childList") { 3013 dynamicTextWidth($titleInit, $title); 3014 3015 setTimeout(function () { 3016 let el = document.querySelector($title); 3017 if (el && el.classList.contains('bg_clip')) { 3018 dynamicTextBg($titleInit, $title, $bgItem, $overlayItem); 3019 } 3020 }, 100); 3021 } 3022 } 3023 }); 3024 }); 3025 3026 observerTitle.observe(contentTitle, { 3027 childList: true, 3028 subtree: true, 3029 characterData: true 3030 }); 3031 3032 return observerTitle; 3033 }; 3034 3035 function dynamicTextWidth(parent, child) { 3036 let $dynamicWrap = $(parent); 3037 let $dynamicTitle = $(child); 3038 3039 let dynamicTitleMinSize = 2; 3040 let dynamicTitleMaxSize = 55; 3041 3042 function isMobile() { 3043 return /Android|iPhone|iPad|iPod|Opera Mini|IEMobile|WPDesktop/i.test(navigator.userAgent) 3044 || window.matchMedia("(max-width: 768px)").matches; 3045 } 3046 3047 if (isMobile()) { 3048 dynamicTitleMinSize = 4.2; 3049 } else { 3050 if ($dynamicWrap.hasClass('lpc-full-width-init')) { 3051 dynamicTitleMinSize = 3.2; 3052 } else { 3053 dynamicTitleMinSize = 2; 3054 } 3055 } 3056 3057 // ÐÐ»Ñ ÑенÑÑиÑÐ¾Ð²Ð°Ð½Ð¸Ñ Ð±Ð»Ð¾ÐºÐ° еÑли Ð¿Ð¾Ð»Ð½Ð°Ñ ÑиÑина 3058 if ($dynamicWrap.hasClass('lpc-full-width-init')) { 3059 let $dynamicBlockWrap = $dynamicWrap.closest('.lpc-full-width'); 3060 let $dynamicBlockIn = $dynamicWrap.closest('.lpc-elements-dynamic-headline__wrap'); 3061 let viewportWidth = $(window).width(); 3062 let dynamicWrapMargin = (viewportWidth - $dynamicBlockWrap.outerWidth()) / 2; 3063 3064 $dynamicBlockIn.css({ 3065 'margin-left': `-${dynamicWrapMargin}px`, 3066 'margin-right': `-${dynamicWrapMargin}px` 3067 }); 3068 } 3069 3070 let min = dynamicTitleMinSize; 3071 let max = dynamicTitleMaxSize; 3072 let attempts = 0; 3073 let maxAttempts = 20; // заÑиÑа Ð¾Ñ Ð¿ÑоклÑÑий 3074 3075 $dynamicTitle.css('white-space', 'nowrap'); 3076 3077 while (attempts < maxAttempts) { 3078 let mid = (min + max) / 2; 3079 $dynamicTitle.css('font-size', mid + 'vw'); 3080 3081 if ($dynamicTitle.outerWidth() > $dynamicWrap.outerWidth()) { 3082 max = mid; // ÑлиÑком болÑÑой ÑÐ°Ð·Ð¼ÐµÑ 3083 } else { 3084 min = mid; // можно попÑобоваÑÑ Ð±Ð¾Ð»ÑÑе 3085 } 3086 3087 attempts++; 3088 } 3089 3090 $dynamicTitle.css('font-size', min + 'vw'); 3091 $dynamicTitle.css('opacity', 1); 3092 3093 // ÐÑли кÑоÑеÑнÑй ÑекÑÑ â воÑоÑаем пеÑеноÑÑ 3094 if (min <= dynamicTitleMinSize + 0.2) { 3095 $dynamicTitle.css('white-space', 'normal'); 3096 } 3097 }; 3098 3099 3100 function dynamicTextBg(parent, child, overlays, overlayItem) { 3101 if (document.querySelector(parent)) { 3102 let dynamicWrap = document.querySelector(parent); 3103 let dynamicTitle = dynamicWrap.querySelector(child); 3104
3105 let titleOverlays = dynamicWrap.querySelectorAll(overlays); 3106 let titleOverlayLast = titleOverlays[titleOverlays.length - 1] 3107 let titleOverlayItem = titleOverlayLast.querySelector(overlayItem); 3108 3109 if (titleOverlayLast) { 3110 3111 let titleOverlayItemBg = getComputedStyle(titleOverlayItem).backgroundImage; 3112 let titleOverlayItemBgCol = getComputedStyle(titleOverlayItem).backgroundColor; 3113 let titleOverlayLastBg = getComputedStyle(titleOverlayLast).backgroundImage; 3114 3115 3116 if (titleOverlayItemBg !== 'none') { 3117 3118 let computedStyles = window.getComputedStyle(titleOverlayLast); 3119 3120 let bgProperties = [ 3121 'background-image', 3122 'background-position', 3123 'background-size', 3124 'background-repeat', 3125 'background-attachment' 3126 ]; 3127 3128 bgProperties.forEach(function (properties) { 3129 dynamicTitle.style[properties] = computedStyles.getPropertyValue(properties); 3130 3131 }) 3132 3133 dynamicTitle.style.backgroundImage = titleOverlayItemBg + ', ' + titleOverlayLastBg; 3134 3135 } else if (titleOverlayItemBgCol !== 'transparent' && titleOverlayItemBgCol !== 'rgba(0, 0, 0, 0)' && titleOverlayItemBgCol !== 'rgba(255, 255, 255, 0)') { 3136 3137 let computedStyles = window.getComputedStyle(titleOverlayLast); 3138 3139 3140 let bgProperties = [ 3141 'background-image', 3142 'background-position', 3143 'background-size', 3144 'background-repeat', 3145 'background-attachment' 3146 ]; 3147 3148 bgProperties.forEach(function (properties) { 3149 if (bgProperties !== 'background-image') { 3150 dynamicTitle.style[properties] = computedStyles.getPropertyValue(properties); 3151 } 3152 }) 3153 3154 dynamicTitle.style.backgroundImage = 'linear-gradient(to right,' + titleOverlayItemBgCol + ', ' + titleOverlayItemBgCol + ')' + ', ' + titleOverlayLastBg; 3155 3156 } else if ((titleOverlayItemBgCol === 'transparent' || titleOverlayItemBgCol === 'rgba(0, 0, 0, 0)') && titleOverlayLastBg === 'none') { 3157 3158 let rootStyles = getComputedStyle(document.documentElement); // :root ÑÑили 3159 let bgColor = rootStyles.getPropertyValue('--text-color-base').trim(); 3160 3161 dynamicTitle.style.backgroundColor = bgColor; 3162 dynamicTitle.style.backgroundImage = 'none'; 3163 3164 3165 } else { 3166 3167 let computedStyles = window.getComputedStyle(titleOverlayLast); 3168 let bgProperties = [ 3169 'background-image', 3170 'background-position', 3171 'background-size', 3172 'background-repeat', 3173 'background-attachment' 3174 ]; 3175 3176 bgProperties.forEach(function (properties) { 3177 if (bgProperties !== 'background-image') { 3178 dynamicTitle.style[properties] = computedStyles.getPropertyValue(properties); 3179 } 3180 3181 let value = computedStyles.getPropertyValue(properties); 3182 if (properties === 'background-image' && value === 'none') { 3183 dynamicTitle.style.removeProperty('background-image'); 3184 } 3185 }) 3186 } 3187 3188 if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) { 3189 dynamicTitle.style.backgroundAttachment = 'scroll'; 3190 } 3191 } 3192 } 3193 }; 3194 3195 document.addEventListener("lp_init_after", function () { 3196 if (s3LP.is_cms) { 3197 initHeadline(); 3198 }; 3199 }); 3200 }; 3201 3202 3203 /*lp_template.queue.lpcDecorText = function($self) { 3204 var $block = $self.hasClass('lpc-elements-dynamic-headline') ? $self : $self.find('.lpc-elements-dynamic-headline'); 3205 3206 function initHeadline() { 3207 if($block.length) { 3208 $block.each(function () { 3209 let $item = $(this); 3210 let $itemId = $item.attr('id'); 3211 let $title = `#${$itemId} .lpc-elements-dynamic-headline__title`; 3212 let $titleInit = `#${$itemId} .lpc-dynamic-title-init`; 3213 let $bgItem = `#${$itemId} .lp-block-bg_item`; 3214 let $overlayItem = `#${$itemId} .lp-block-overlay_item`; 3215 3216 dynamicTextWidth($titleInit, $title); 3217 3218 if (document.querySelector($title) && document.querySelector($title).classList.contains('bg_clip')) { 3219 dynamicTextBg($titleInit, $title, $bgItem, $overlayItem); 3220 }; 3221 3222 // ÐенÑем ÑÐ°Ð·Ð¼ÐµÑ Ð¿Ð¾Ñле Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ ÑекÑÑа
3223 let contentTitle = document.querySelector($title); 3224 let observerTitle = new MutationObserver((mutations) => { 3225 3226 mutations.forEach((mutation) => { 3227 if ($(mutation.target).parents('.lpc-elements-dynamic-headline__title').length) { 3228 if (mutation.type === "characterData" || mutation.type === "childList") { 3229 dynamicTextWidth($titleInit, $title); 3230 3231 setTimeout(function(){ 3232 if (document.querySelector($title) && document.querySelector($title).classList.contains('bg_clip')) { 3233 dynamicTextBg($titleInit, $title, $bgItem, $overlayItem); 3234 } 3235 }, 100); 3236 } 3237 } 3238 }); 3239 }); 3240 3241 observerTitle.observe(contentTitle, { 3242 childList: true, 3243 subtree: true, 3244 //attributes: true, 3245 characterData: true 3246 }); 3247 3248 3249 $(document).on('click', '.publish-button', function() { 3250 setTimeout(function(){ 3251 dynamicTextWidth($titleInit, $title); 3252 3253 if (document.querySelector($title) && document.querySelector($title).classList.contains('bg_clip')) { 3254 dynamicTextBg($titleInit, $title, $bgItem, $overlayItem); 3255 } 3256 }, 0); 3257 }); 3258 3259 $(document).on('click', '#cancel_all_button', function() { 3260 setTimeout(function(){ 3261 dynamicTextWidth($titleInit, $title); 3262 3263 if (document.querySelector($title) && document.querySelector($title).classList.contains('bg_clip')) { 3264 dynamicTextBg($titleInit, $title, $bgItem, $overlayItem); 3265 } 3266 }, 0); 3267 }); 3268 3269 $(document).on('click', '.clear-control', function() { 3270 setTimeout(function(){ 3271 dynamicTextWidth($titleInit, $title); 3272 3273 if (document.querySelector($title) && document.querySelector($title).classList.contains('bg_clip')) { 3274 dynamicTextBg($titleInit, $title, $bgItem, $overlayItem); 3275 } 3276 }, 0); 3277 }); 3278 3279 if (!s3LP.is_cms) { 3280 let initTimeout; 3281 3282 $(window).on('resize', function(){ 3283 clearInterval(initTimeout); 3284 3285 initTimeout = setTimeout(function(){ 3286 dynamicTextWidth($titleInit, $title); 3287 3288 if (document.querySelector($title) && document.querySelector($title).classList.contains('bg_clip')) { 3289 dynamicTextBg($titleInit, $title, $bgItem, $overlayItem); 3290 }; 3291 }, 50); 3292 }); 3293 }; 3294 }); 3295 } 3296 }; 3297 3298 function dynamicTextWidth(parent, child) { 3299 let $dynamicWrap = $(parent); 3300 let $dynamicTitle = $(child); 3301 let dynamicTitleFontSize = parseFloat($dynamicTitle.css('font-size')); 3302 let dynamicTitleFontSizeVW = (dynamicTitleFontSize / $(window).width()) * 100; 3303 let dynamicTitleMinSize = 3.2; 3304 let dynamicTitleMaxSize = 55; 3305 3306 function isMobile() { 3307 return /Android|iPhone|iPad|iPod|Opera Mini|IEMobile|WPDesktop/i.test(navigator.userAgent) 3308 || window.matchMedia("(max-width: 768px)").matches; 3309 }; 3310 3311 if (isMobile()) { 3312 dynamicTitleMinSize = 4.2; 3313 } else { 3314 if ($dynamicWrap.hasClass('lpc-full-width-init')) { 3315 dynamicTitleMinSize = 3.2; 3316 } else { 3317 dynamicTitleMinSize = 2; 3318 } 3319 } 3320 3321 if ($dynamicWrap.hasClass('lpc-full-width-init')) { 3322 let $dynamicBlockWrap = $dynamicWrap.closest('.lpc-full-width'); 3323 let $dynamicBlockIn = $dynamicWrap.closest('.lpc-elements-dynamic-headline__wrap'); 3324 let viewportWidth = $(window).width(); 3325 let dynamicWrapMargin = (viewportWidth - $dynamicBlockWrap.outerWidth()) / 2; 3326 3327 $dynamicBlockIn.css({ 3328 'margin-left': '-' + dynamicWrapMargin + 'px', 3329 'margin-right': '-' + dynamicWrapMargin + 'px' 3330 }); 3331 } 3332 3333 if ($dynamicWrap.outerWidth() > $dynamicTitle.outerWidth()) { 3334 while ($dynamicWrap.outerWidth() > $dynamicTitle.outerWidth()) { 3335 dynamicTitleFontSizeVW = dynamicTitleFontSizeVW + 0.05; 3336 $dynamicTitle.css('font-size', dynamicTitleFontSizeVW + 'vw'); 3337 $dynamicTitle.css('white-space', 'nowrap'); 3338 if (dynamicTitleFontSizeVW >= dynamicTitleMaxSize) { 3339 break; 3340 } 3341 } 3342 3343 $dynamicTitle.css('font-size', (dynamicTitleFontSizeVW - 0.05) + 'vw') 3344 .css('opacity', 1); 3345 3346 if (dynamicTitleFontSizeVW <= dynamicTitleMinSize) { 3347 $dynamicTitle.css('font-size', dynamicTitleMinSize + 'vw'); 3348 $dynamicTitle.css('white-space', 'normal'); 3349 } 3350 3351 return; 3352 } 3353 3354 if ($dynamicWrap.outerWidth() <= $dynamicTitle.outerWidth()) { 3355 while ($dynamicWrap.outerWidth() <= $dynamicTitle.outerWidth()) { 3356 dynamicTitleFontSizeVW = dynamicTitleFontSizeVW - 0.05; 3357 $dynamicTitle.css('font-size', dynamicTitleFontSizeVW + 'vw'); 3358 $dynamicTitle.css('white-space', 'nowrap'); 3359 3360 if (dynamicTitleFontSizeVW <= dynamicTitleMinSize) { 3361 break; 3362 } 3363 } 3364 3365 $dynamicTitle.css('opacity', 1); 3366 3367 if (dynamicTitleFontSizeVW <= dynamicTitleMinSize) { 3368 $dynamicTitle.css('font-size', dynamicTitleMinSize + 'vw'); 3369 $dynamicTitle.css('white-space', 'normal'); 3370 } 3371 3372 return; 3373 } 3374 3375 $dynamicTitle.css('opacity', 1); 3376 3377 return; 3378 }; 3379 3380 function dynamicTextBg(parent, child, overlays, overlayItem) { 3381 if (document.querySelector(parent)) { 3382 let dynamicWrap = document.querySelector(parent); 3383 let dynamicTitle = dynamicWrap.querySelector(child); 3384
3385 let titleOverlays = dynamicWrap.querySelectorAll(overlays); 3386 let titleOverlayLast = titleOverlays[titleOverlays.length - 1] 3387 let titleOverlayItem = titleOverlayLast.querySelector(overlayItem); 3388 3389 if (titleOverlayLast) { 3390 3391 let titleOverlayItemBg = getComputedStyle(titleOverlayItem).backgroundImage; 3392 let titleOverlayItemBgCol = getComputedStyle(titleOverlayItem).backgroundColor; 3393 let titleOverlayLastBg = getComputedStyle(titleOverlayLast).backgroundImage; 3394 3395 3396 if (titleOverlayItemBg !== 'none') { 3397 3398 let computedStyles = window.getComputedStyle(titleOverlayLast); 3399 3400 let bgProperties = [ 3401 'background-image', 3402 'background-position', 3403 'background-size', 3404 'background-repeat', 3405 'background-attachment' 3406 ]; 3407 3408 bgProperties.forEach(function (properties) { 3409 dynamicTitle.style[properties] = computedStyles.getPropertyValue(properties); 3410 3411 }) 3412 3413 dynamicTitle.style.backgroundImage = titleOverlayItemBg + ', ' + titleOverlayLastBg; 3414 3415 } else if (titleOverlayItemBgCol !== 'transparent' && titleOverlayItemBgCol !== 'rgba(0, 0, 0, 0)' && titleOverlayItemBgCol !== 'rgba(255, 255, 255, 0)') { 3416 3417 let computedStyles = window.getComputedStyle(titleOverlayLast); 3418 3419 3420 let bgProperties = [ 3421 'background-image', 3422 'background-position', 3423 'background-size', 3424 'background-repeat', 3425 'background-attachment' 3426 ]; 3427 3428 bgProperties.forEach(function (properties) { 3429 if (bgProperties !== 'background-image') { 3430 dynamicTitle.style[properties] = computedStyles.getPropertyValue(properties); 3431 } 3432 }) 3433 3434 dynamicTitle.style.backgroundImage = 'linear-gradient(to right,' + titleOverlayItemBgCol + ', ' + titleOverlayItemBgCol + ')' + ', ' + titleOverlayLastBg; 3435 3436 } else if ((titleOverlayItemBgCol === 'transparent' || titleOverlayItemBgCol === 'rgba(0, 0, 0, 0)') && titleOverlayLastBg === 'none') { 3437 3438 let rootStyles = getComputedStyle(document.documentElement); // :root ÑÑили 3439 let bgColor = rootStyles.getPropertyValue('--text-color-base').trim(); 3440 3441 dynamicTitle.style.backgroundColor = bgColor; 3442 dynamicTitle.style.backgroundImage = 'none'; 3443 3444 3445 } else { 3446 3447 let computedStyles = window.getComputedStyle(titleOverlayLast); 3448 let bgProperties = [ 3449 'background-image', 3450 'background-position', 3451 'background-size', 3452 'background-repeat', 3453 'background-attachment' 3454 ]; 3455 3456 bgProperties.forEach(function (properties) { 3457 if (bgProperties !== 'background-image') { 3458 dynamicTitle.style[properties] = computedStyles.getPropertyValue(properties); 3459 } 3460 3461 let value = computedStyles.getPropertyValue(properties); 3462 if (properties === 'background-image' && value === 'none') { 3463 dynamicTitle.style.removeProperty('background-image'); 3464 } 3465 }) 3466 } 3467 3468 if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) { 3469 dynamicTitle.style.backgroundAttachment = 'scroll'; 3470 } 3471 } 3472 } 3473 }; 3474 3475 document.addEventListener("lp_init_after", function () { 3476 if (s3LP.is_cms) { 3477 initHeadline(); 3478 }; 3479 }); 3480 };*/ 3481 3482 3483 /*lp_template.queue.lpcDecorText = function ($self) { 3484 const paramsGet = new URLSearchParams(window.location.search); 3485 if(paramsGet.has('lpc_test')){ 3486 var $block = $self.hasClass('lpc-elements-dynamic-headline') ? $self : $self.find('.lpc-elements-dynamic-headline'); 3487 3488 if($block.length) { 3489 3490 $block.each(function () { 3491 3492 let $item = $(this); 3493 let $itemId = $item.attr('id'); 3494 3495 let $title = `#${$itemId} .lpc-elements-dynamic-headline__title`; 3496 let $titleInit = `#${$itemId} .lpc-dynamic-title-init`; 3497 let $bgItem = `#${$itemId} .lp-block-bg_item`; 3498 let $overlayItem = `#${$itemId} .lp-block-overlay_item`; 3499 3500 function dynamicTextBg(parent, child, overlays, overlayItem){ 3501 if(document.querySelector(parent)){ 3502 let dynamicWrap = document.querySelector(parent); 3503 let dynamicTitle = dynamicWrap.querySelector(child); 3504
3505 let titleOverlays = dynamicWrap.querySelectorAll(overlays); 3506 let titleOverlayLast = titleOverlays[titleOverlays.length - 1] 3507 let titleOverlayItem = titleOverlayLast.querySelector(overlayItem); 3508 3509 if (titleOverlayLast) { 3510 3511 let titleOverlayItemBg = getComputedStyle(titleOverlayItem).backgroundImage; 3512 let titleOverlayItemBgCol = getComputedStyle(titleOverlayItem).backgroundColor; 3513 let titleOverlayLastBg = getComputedStyle(titleOverlayLast).backgroundImage; 3514 3515 3516 if(titleOverlayItemBg !== 'none'){ 3517 3518 let computedStyles = window.getComputedStyle(titleOverlayLast); 3519 3520 let bgProperties = [ 3521 'background-image', 3522 'background-position', 3523 'background-size', 3524 'background-repeat', 3525 'background-attachment' 3526 ]; 3527 3528 bgProperties.forEach(function(properties){ 3529 dynamicTitle.style[properties] = computedStyles.getPropertyValue(properties); 3530 3531 }) 3532 3533 dynamicTitle.style.backgroundImage = titleOverlayItemBg + ', ' + titleOverlayLastBg; 3534 3535 } else if(titleOverlayItemBgCol !== 'transparent' && titleOverlayItemBgCol !== 'rgba(0, 0, 0, 0)' && titleOverlayItemBgCol !== 'rgba(255, 255, 255, 0)'){ 3536 3537 let computedStyles = window.getComputedStyle(titleOverlayLast); 3538 3539 3540 let bgProperties = [ 3541 'background-image', 3542 'background-position', 3543 'background-size', 3544 'background-repeat', 3545 'background-attachment' 3546 ]; 3547 3548 bgProperties.forEach(function(properties){ 3549 if(bgProperties !== 'background-image'){ 3550 dynamicTitle.style[properties] = computedStyles.getPropertyValue(properties); 3551 } 3552 }) 3553 3554 dynamicTitle.style.backgroundImage = 'linear-gradient(to right,' + titleOverlayItemBgCol + ', ' + titleOverlayItemBgCol + ')' + ', ' + titleOverlayLastBg; 3555 3556 } else if((titleOverlayItemBgCol === 'transparent' || titleOverlayItemBgCol === 'rgba(0, 0, 0, 0)') && titleOverlayLastBg === 'none') { 3557 3558 let rootStyles = getComputedStyle(document.documentElement); // :root ÑÑили 3559 let bgColor = rootStyles.getPropertyValue('--text-color-base').trim(); 3560 3561 dynamicTitle.style.backgroundColor = bgColor; 3562 dynamicTitle.style.backgroundImage = 'none'; 3563 3564 3565 } else { 3566 3567 let computedStyles = window.getComputedStyle(titleOverlayLast); 3568 let bgProperties = [ 3569 'background-image', 3570 'background-position', 3571 'background-size', 3572 'background-repeat', 3573 'background-attachment' 3574 ]; 3575 3576 bgProperties.forEach(function(properties){ 3577 if(bgProperties !== 'background-image'){ 3578 dynamicTitle.style[properties] = computedStyles.getPropertyValue(properties); 3579 } 3580 3581 let value = computedStyles.getPropertyValue(properties); 3582 if (properties === 'background-image' && value === 'none') { 3583 dynamicTitle.style.removeProperty('background-image'); 3584 } 3585 }) 3586 } 3587 3588 if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) { 3589 dynamicTitle.style.backgroundAttachment = 'scroll'; 3590 } 3591 } 3592 } 3593 } 3594 3595 function dynamicTextWidth(parent, child){ 3596 if(typeof ReactLPConstructor == 'object'){ 3597 if ($(parent).length && $(parent).find(child).length) { 3598 let $dynamicWrap = $(parent); 3599 let $dynamicTitle = $dynamicWrap.find(child); 3600 let dynamicTitleFontSize = parseFloat($dynamicTitle.css('font-size')); 3601 let dynamicTitleFontSizeVW = (dynamicTitleFontSize / $(window).width()) * 100; 3602 3603 let dynamicTitleMinSize = 3.2; 3604 let dynamicTitleMaxSize = 55; 3605 3606 function isMobile() { 3607 return /Android|iPhone|iPad|iPod|Opera Mini|IEMobile|WPDesktop/i.test(navigator.userAgent) 3608 || window.matchMedia("(max-width: 768px)").matches; 3609 } 3610 3611 if (isMobile()) { 3612 dynamicTitleMinSize = 4.2; 3613 } else { 3614 if ($dynamicWrap.hasClass('lpc-full-width-init')) { 3615 dynamicTitleMinSize = 3.2; 3616 } else { 3617 dynamicTitleMinSize = 2; 3618 } 3619 } 3620 3621 if ($dynamicWrap.hasClass('lpc-full-width-init')) { 3622 let $dynamicBlockWrap = $dynamicWrap.closest('.lpc-full-width'); 3623 let $dynamicBlockIn = $dynamicWrap.closest('.lpc-elements-dynamic-headline__wrap'); 3624 let viewportWidth = $(window).width(); 3625 let dynamicWrapMargin = (viewportWidth - $dynamicBlockWrap.outerWidth()) / 2; 3626 3627 $dynamicBlockIn.css({ 3628 'margin-left': '-' + dynamicWrapMargin + 'px', 3629 'margin-right': '-' + dynamicWrapMargin + 'px' 3630 }); 3631 } 3632 3633 if ($dynamicWrap.outerWidth() > $dynamicTitle.outerWidth()) { 3634 while ($dynamicWrap.outerWidth() > $dynamicTitle.outerWidth()) { 3635 dynamicTitleFontSizeVW = dynamicTitleFontSizeVW + 0.05; 3636 $dynamicTitle.css('font-size', dynamicTitleFontSizeVW + 'vw'); 3637 if (dynamicTitleFontSizeVW >= dynamicTitleMaxSize) { 3638 break; 3639 } 3640 } 3641 3642 $dynamicTitle.css('font-size', (dynamicTitleFontSizeVW - 0.05) + 'vw') 3643 .css('opacity', 1); 3644 3645 if (dynamicTitleFontSizeVW <= dynamicTitleMinSize) { 3646 $dynamicTitle.css('font-size', dynamicTitleMinSize + 'vw'); 3647 } 3648 3649 return; 3650 } 3651 3652 if ($dynamicWrap.outerWidth() <= $dynamicTitle.outerWidth()) { 3653 while ($dynamicWrap.outerWidth() <= $dynamicTitle.outerWidth()) { 3654 dynamicTitleFontSizeVW = dynamicTitleFontSizeVW - 0.05; 3655 $dynamicTitle.css('font-size', dynamicTitleFontSizeVW + 'vw'); 3656 3657 if (dynamicTitleFontSizeVW <= dynamicTitleMinSize) { 3658 break; 3659 } 3660 } 3661 3662 $dynamicTitle.css('opacity', 1); 3663 3664 if (dynamicTitleFontSizeVW <= dynamicTitleMinSize) { 3665 $dynamicTitle.css('font-size', dynamicTitleMinSize + 'vw'); 3666 } 3667 3668 return; 3669 } 3670 3671 $dynamicTitle.css('opacity', 1); 3672 return; 3673 } 3674 3675 }else { 3676 if(document.querySelector(parent) && document.querySelector(child)){ 3677 3678 let dynamicWrap = document.querySelector(parent); 3679 let dynamicTitle = dynamicWrap.querySelector(child); 3680 let dynamicTitleFontSize = parseFloat(getComputedStyle(dynamicTitle).fontSize); 3681 let dynamicTitleFontSizeVW = (dynamicTitleFontSize / window.innerWidth) * 100; 3682 3683 let dynamicTitleMInSize = 3.2; 3684 let dynamicTitleMaxSize = 55; 3685 3686 function isMobile() { 3687 return /Android|iPhone|iPad|iPod|Opera Mini|IEMobile|WPDesktop/i.test(navigator.userAgent) || window.matchMedia("(max-width: 768px)").matches; 3688 } 3689 3690 if (isMobile()) { 3691 dynamicTitleMInSize = 4.2; 3692 } else { 3693 3694 if(dynamicWrap.classList.contains('lpc-full-width-init')){ 3695 dynamicTitleMInSize = 3.2; 3696 } else { 3697 dynamicTitleMInSize = 2; 3698 } 3699 } 3700 3701 3702 if (dynamicWrap.classList.contains('lpc-full-width-init')) { 3703 let dynamicBlockWrap = dynamicWrap.closest('.lpc-full-width'); 3704 let dynamicBlockIn = dynamicWrap.closest('.lpc-elements-dynamic-headline__wrap'); 3705 let viewportWidth = $(window).width(); 3706 let dynamicWrapMargin = (viewportWidth - dynamicBlockWrap.offsetWidth) / 2; 3707 3708 $(dynamicBlockIn).css({ 3709 'margin-left': '-' + (dynamicWrapMargin) + 'px', 3710 'margin-right': '-' + (dynamicWrapMargin) + 'px' 3711 }); 3712 } 3713 3714 3715 if(dynamicWrap.offsetWidth > dynamicTitle.offsetWidth){ 3716 while (dynamicWrap.offsetWidth > dynamicTitle.offsetWidth) { 3717 dynamicTitleFontSizeVW = dynamicTitleFontSizeVW + 0.05; 3718 dynamicTitle.style.fontSize = dynamicTitleFontSizeVW + 'vw'; 3719 if(dynamicTitleFontSizeVW >= dynamicTitleMaxSize){ 3720 break; 3721 } 3722 } 3723 3724 dynamicTitle.style.fontSize = (dynamicTitleFontSizeVW - 0.05) + 'vw'; 3725 dynamicTitle.style.opacity = 1; 3726 3727 if(dynamicTitleFontSizeVW <= dynamicTitleMInSize){ 3728 dynamicTitle.style.fontSize = dynamicTitleMInSize + 'vw'; 3729 } 3730 3731 return; 3732 } 3733 3734 if(dynamicWrap.offsetWidth <= dynamicTitle.offsetWidth){ 3735 3736 while(dynamicWrap.offsetWidth <= dynamicTitle.offsetWidth) { 3737 dynamicTitleFontSizeVW = dynamicTitleFontSizeVW - 0.05; 3738 3739 dynamicTitle.style.fontSize = dynamicTitleFontSizeVW + 'vw'; 3740 3741 3742 if(dynamicTitleFontSizeVW <= dynamicTitleMInSize){ 3743 break; 3744 } 3745 } 3746 dynamicTitle.style.opacity = 1; 3747 3748 if(dynamicTitleFontSizeVW <= dynamicTitleMInSize){ 3749 dynamicTitle.style.fontSize = dynamicTitleMInSize + 'vw'; 3750 } 3751 3752 return; 3753 } 3754 3755 dynamicTitle.style.opacity = 1; 3756 3757 return; 3758 } 3759 } 3760 3761 3762 3763 } 3764 3765 if (s3LP.is_cms) { 3766 3767 if (document.querySelector(`${$titleInit} .lpc-elements-dynamic-headline__title`)) { 3768 3769 document.addEventListener("lp_init_after", function () { 3770 setTimeout(function () { 3771 dynamicTextWidth($titleInit, $title); 3772 3773 3774 if (document.querySelector($title) && document.querySelector($title).classList.contains('bg_clip')) { 3775 3776 dynamicTextBg($titleInit, $title, $bgItem, $overlayItem); 3777 3778 } 3779 3780 }, 1000); 3781
3782 function waitForStylesheet(callback, delay = 500) { 3783 const interval = setInterval(() => { 3784 if (document.getElementById('lpc-stylesheet')) { 3785 clearInterval(interval); 3786 setTimeout(callback, delay); 3787 } 3788 }, 250); 3789 } 3790 3791 waitForStylesheet(() => { 3792 dynamicTextWidth($titleInit, $title); 3793 }, 500); 3794 }); 3795 3796 // Watch bg and overlay style changes 3797 if (document.querySelector($title) && document.querySelector($title).classList.contains('bg_clip')) { 3798 let elementBg = document.querySelector($bgItem); 3799 let elementOverlay = document.querySelector($overlayItem); 3800 3801 let observerBg = new MutationObserver((mutationsList) => { 3802 mutationsList.forEach((mutation) => { 3803 if (mutation.type === "attributes" && mutation.attributeName === "style") { 3804 dynamicTextBg($titleInit, $title, $bgItem, $overlayItem); 3805 } 3806 }); 3807 }); 3808 3809 let config = { 3810 attributes: true, 3811 attributeFilter: ["style"] 3812 }; 3813 3814 observerBg.observe(elementBg, config); 3815 observerBg.observe(elementOverlay, config); 3816 } 3817 3818 // Watch text content changes 3819 let contentTitle = document.querySelector($title); 3820 3821 let observerTitle = new MutationObserver((mutations) => { 3822 mutations.forEach((mutation) => { 3823 dynamicTextWidth($titleInit, $title); 3824 }); 3825 }); 3826 3827 observerTitle.observe(contentTitle, { 3828 childList: true, 3829 subtree: true, 3830 characterData: true 3831 }); 3832 3833 // On style removed (eraser) 3834 function observeStyleChanges(targetSelector, dynamicFunction) { 3835 let targetTitle = document.querySelector(targetSelector); 3836 3837 if (!targetTitle) return; 3838 3839 const observerBlock = new MutationObserver((mutationsList) => { 3840 for (const mutation of mutationsList) { 3841 if (mutation.type === "attributes" && mutation.attributeName === "style") { 3842 if (!targetTitle.getAttribute("style")) { 3843 dynamicFunction(); 3844 } 3845 } 3846 } 3847 }); 3848 3849 observerBlock.observe(targetTitle, { 3850 attributes: true, 3851 attributeFilter: ["style"] 3852 }); 3853 3854 dynamicFunction(); 3855 } 3856 3857 observeStyleChanges( 3858 $title, 3859 () => dynamicTextWidth($titleInit, $title) 3860 ); 3861 3862 // On publish 3863 const targetElement = document.querySelector($title); 3864 3865 if (targetElement) { 3866 const observer = new MutationObserver((mutationsList) => { 3867 mutationsList.forEach((mutation) => { 3868 if (mutation.type === "attributes" && mutation.attributeName === "class") { 3869 if (!targetElement.classList.contains("modified")) { 3870 setTimeout(function () { 3871 dynamicTextWidth($titleInit, $title); 3872 3873 if (document.querySelector($title) && document.querySelector($title).classList.contains('bg_clip')) { 3874 dynamicTextBg($titleInit, $title, $bgItem, $overlayItem); 3875 } 3876 }, 2000); 3877 } 3878 } 3879 }); 3880 }); 3881 3882 observer.observe(targetElement, { attributes: true }); 3883 } 3884 3885 } 3886 3887 } else { 3888 3889 function observeElementWithClass(targetClass) { 3890 let widthTitleObserver = new MutationObserver((mutationsList, observer) => { 3891 let targetElement = document.querySelector('.' + targetClass); 3892 if (targetElement) { 3893 if (document.querySelector(`${$titleInit} .lpc-elements-dynamic-headline__title`)) { 3894 setTimeout(function () { 3895 dynamicTextWidth($titleInit, $title); 3896 }, 500); 3897 3898 let currentWidth = window.innerWidth; 3899 3900 window.addEventListener('resize', function () { 3901 if (window.innerWidth !== currentWidth) { 3902 currentWidth = window.innerWidth; 3903 3904 setTimeout(function () { 3905 dynamicTextWidth($titleInit, $title); 3906 }, 500); 3907 } 3908 }, true); 3909 } 3910 3911 observer.disconnect(); 3912 } 3913 }); 3914 3915 widthTitleObserver.observe(document.body, { childList: true, subtree: true }); 3916 } 3917 3918 observeElementWithClass('decor-wrap'); 3919 3920 document.addEventListener("lp_init_after", function () { 3921 let dynamic = setInterval(function () { 3922 dynamicTextWidth($titleInit, $title); 3923 clearInterval(dynamic); 3924 }, 1000); 3925 3926 if (document.querySelector($title) && document.querySelector($title).classList.contains('bg_clip')) { 3927 dynamicTextBg($titleInit, $title, $bgItem, $overlayItem); 3928 } 3929 }); 3930 3931 } 3932 3933 3934 3935 }); 3936 } 3937 } 3938 };*/ 3939 3940 3941 3942 lp_template.queue.steps11 = function($self) { 3943 var $block = $self.hasClass('js-step-11') ? $self : $self.find('.js-step-11'); 3944 if ($block.length) { 3945 try { 3946 let linePos = function(){
3947 let firstItemPos = $('.lp-steps-11-item__number').first().position().top, 3948 firstItemHeight = $('.lp-steps-11-item__number').first().outerHeight(), 3949 lastItemPos = $('.lp-steps-11-item__number').last().position().top; 3950 3951 $('.lp-steps-11-items .line span').css('height', lastItemPos-firstItemPos-firstItemHeight); 3952 $('.lp-steps-11-items .line').css('top', firstItemPos+firstItemHeight); 3953 } 3954 3955 linePos(); 3956 $(window).resize(function(){ 3957 var numbElemWidth = $block.find('.lp-steps-11-item__number').outerWidth() / 2; 3958 linePos(); 3959 if (window.matchMedia('(max-width : 959px)').matches) { 3960 $block.find('.line').css('left', numbElemWidth); 3961 } 3962 else { 3963 $block.find('.line').css('left', '50%'); 3964 } 3965 }); 3966 3967 } catch(e) { 3968 console.log(e); 3969 } 3970 } 3971 } 3972 3973 3974 3975 lp_template.queue.initVideoBlocks = function () { 3976 let blocks = document.querySelectorAll(".lp-wrapp"); 3977 3978 blocks.forEach((block) => { 3979 let videoPosters = block.querySelectorAll(".lp-video-poster"); 3980 3981 videoPosters.forEach((videoPoster) => { 3982 3983 videoPoster.addEventListener("click", function () { 3984 let _this = this; 3985 3986 let parent = _this.closest('.lp-video-block-wrappper'); 3987 3988 let container = parent.querySelector(".lp-video-container"); 3989 3990 let iframe = container.querySelector("iframe"); 3991 3992 let src = iframe.getAttribute("data-src").replace('autoplay=0','autoplay=1'); 3993 3994 3995 iframe.setAttribute("src", src); 3996 3997 videoPoster.style.display = "none"; 3998 3999 container.style.display = "block"; 4000 }); 4001 }); 4002 }); 4003 /* 4004 const blocks = document.querySelectorAll(".lp-wrapp"); 4005 4006 blocks.forEach((block) => { 4007 const videoPosters = block.querySelectorAll(".lp-video-poster"); 4008 const videoContainers = block.querySelectorAll(".lp-video-container"); 4009 4010 videoPosters.forEach((videoPoster, index) => { 4011 const iframe = videoContainers[index].querySelector("iframe"); 4012 4013 videoPoster.addEventListener("click", function () { 4014 const dataSrc = videoPoster.getAttribute("data-youtube-id"); 4015 4016 if (dataSrc) { 4017 iframe.setAttribute("src", "https://www.youtube.com/embed/" + dataSrc + "?autoplay=1&mute=1"); 4018 videoPoster.removeAttribute("data-youtube-id"); 4019 videoPoster.style.display = "none"; 4020 videoContainers[index].style.display = "block"; 4021 } 4022 }); 4023 }); 4024 });*/ 4025 }; 4026 4027 document.addEventListener("DOMContentLoaded", function () { 4028 lp_template.queue.initVideoBlocks(); 4029 }); 4030 4031 document.addEventListener("DOMContentLoaded", function () { 4032 var queryString = window.location.search; 4033 /*if (queryString.includes('lpc_test')) {*/ 4034 $('body').prepend("<div class='lp-blocks-fon lp-blocks-fon-default'></div>"); 4035 /*}*/ 4036 4037 }); 4038 4039 $('body').prepend("<div class='lp-blocks-fon lp-blocks-fon-default'></div>"); 4040 4041 lp_template.queue.bgVariable = function($self) { 4042 setTimeout(function() { 4043 let sourceElementBg = document.querySelector('.lp-blocks-fon'); 4044 if (sourceElementBg) { 4045 // ÐолÑÑаем знаÑение ÑвеÑа Ñона 4046 let backgroundColor = window.getComputedStyle(sourceElementBg).backgroundColor; 4047 // ÐÑиÑваиваем ÑÑо знаÑение пеÑеменной CSS 4048 document.documentElement.style.setProperty('--content-background-lp', backgroundColor); 4049 } 4050 }, 50); 4051 4052 } 4053 4054 lp_template.queue.lpWrappOffset = function($self) { 4055 function decorOffset() { 4056 const lpWrapp = document.querySelector('.lp-wrapp'); 4057 const decorWrap = document.querySelector('.decor-wrap'); 4058 4059 if (!lpWrapp || !decorWrap) return; 4060 4061 // 1. ÐолÑÑаем кооÑдинаÑÑ lp-wrapp оÑноÑиÑелÑно ÑкÑана 4062 const rect = lpWrapp.getBoundingClientRect(); 4063 const viewportWidth = document.documentElement.clientWidth; 4064 4065 // 2. ÐолÑÑаем вÑÑиÑленнÑе паддинги lp-wrapp 4066 const computedStyle = window.getComputedStyle(lpWrapp); 4067 // parseFloat ÑбиÑÐ°ÐµÑ 'px' и пÑевÑаÑÐ°ÐµÑ ÑÑÑÐ¾ÐºÑ Ð² ÑиÑло Ð´Ð»Ñ Ð¼Ð°ÑемаÑики 4068 const paddingLeft = parseFloat(computedStyle.paddingLeft) || 0; 4069 const paddingRight = parseFloat(computedStyle.paddingRight) || 0; 4070 4071 // 3. СÑиÑаем ÑÑммаÑное ÑаÑÑÑоÑние Ð¾Ñ ÐºÑаев ÑкÑана до конÑенÑа внÑÑÑи lp-wrapp 4072 const totalOffsetLeft = rect.left + paddingLeft; 4073 const totalOffsetRight = (viewportWidth - rect.right) + paddingRight; 4074 4075 // 4. ÐапиÑÑваем ÑезÑлÑÑÐ°Ñ Ð² CSS-пеÑеменнÑе 4076 decorWrap.style.setProperty('--lp-offset-left', `${totalOffsetLeft}px`); 4077 decorWrap.style.setProperty('--lp-offset-right', `${totalOffsetRight}px`); 4078 } 4079 4080 function decorThrottle(func, limit) { 4081 let inThrottle; 4082 return function() { 4083 if (!inThrottle) { 4084 func(); 4085 inThrottle = true; 4086 setTimeout(() => inThrottle = false, limit); 4087 } 4088 } 4089 } 4090 4091 window.addEventListener('resize', decorThrottle(decorOffset, 150)); 4092 decorOffset(); 4093 }; 4094 4095 lp_template.queue.popupStepForm = function($self) { 4096 var $block = $self.find('.js-step-form-popup'); 4097 4098 if ($block.length) { 4099 $block.formsteps({ 4100 mode: 'popup' 4101 }); 4102 } 4103 }; 4104 4105 lp_template.queue.sliderBlockThumbGallery = function ($self) {
4106 var $block = $self.attr('data-slider-gallary-thumb-init') ? $self : $self.find('[data-slider-gallary-thumb-init]'); 4107 4108 if ($block.length) { 4109 $block.each(function(){ 4110 let $this = $(this); 4111 let $alignItem = $this.find($this.data('align-item')); 4112 let mediaGap = $this.data('margin'); 4113 let mediaPerPage = $this.data('count'); 4114 let mediaThumbGap = $this.data('thumb-margin'); 4115 let mediaThumbFixedWidth = $this.data('thumb-width'); 4116 let mediaThumbFixedHeight = $this.data('thumb-height'); 4117 let mediaThumbDirectionItems = $this.data('thumb-direction'); 4118 let mediaThumbDirection = []; 4119 4120 if ($(this).data('move')) { 4121 var $mediaMove = $(this).data('move'); 4122 } else { 4123 var $mediaMove = 1; 4124 } 4125 4126 mediaThumbDirectionItems.forEach(function (item){ 4127 if(item == 1) { 4128 item = 'ttb' 4129 } 4130 if(item == 0) { 4131 item = 'ltr' 4132 } 4133 mediaThumbDirection.push(item) 4134 }); 4135 4136 if($this.find('#main-slider').not('.is-active').length != 0 ) { 4137 let splideThumbGallary = new Splide( $this.find('.splide').not('.is-active')[0], { 4138 autoplay: $this.data('autoplay'), 4139 speed: $this.data('speed'), 4140 interval: $this.data('pause'), 4141 /*rewind: $this.data('infinite'),*/ 4142 //lazyLoad: $this.data('lazy-load'), 4143 rewind: true, 4144 perMove: $mediaMove, 4145 perPage: mediaPerPage[0], 4146 gap: mediaGap[0], 4147 dragMinThreshold: { 4148 mouse: 5, 4149 touch: 10, 4150 }, 4151 breakpoints: { 4152 1379: { 4153 perPage: 3, 4154 arrows: true, 4155 pagination: true, 4156 rewindByDrag: true, 4157 gap: mediaGap[1], 4158 perPage: mediaPerPage[1], 4159 }, 4160 1199: { 4161 arrows: false, 4162 pagination: true, 4163 rewindByDrag: true, 4164 gap: mediaGap[2], 4165 perPage: mediaPerPage[2], 4166 }, 4167 959: { 4168 arrows: false, 4169 pagination: true, 4170 rewindByDrag: true, 4171 gap: mediaGap[3], 4172 perPage: mediaPerPage[3], 4173 }, 4174 599: { 4175 arrows: false, 4176 pagination: true, 4177 rewindByDrag: true, 4178 gap: mediaGap[4], 4179 perPage: mediaPerPage[4], 4180 } 4181 } 4182 }); 4183 4184 let thumbnailsGallary = new Splide($this.find('.thumbnail-slider').not('.is-active')[0], { 4185 direction : mediaThumbDirection[0], 4186 rewind : true, 4187 count : 6, 4188 fixedWidth : mediaThumbFixedWidth[0], 4189 fixedHeight : mediaThumbFixedHeight[0], 4190 isNavigation : true, 4191 pagination : false, 4192 perPage : 6, 4193 cover : false, 4194 arrows : $this.data('thumb-arrow'), 4195 drag : true, 4196 padding : 4, 4197 gap : mediaThumbGap[0], 4198 clones : 5, 4199 heightRatio : $this.data('height'), 4200 dragMinThreshold: { 4201 mouse: 5, 4202 touch: 10, 4203 } , 4204 classes : { 4205 arrows: "splide__arrows splide__custom__arrows" 4206 }, 4207 breakpoints: { 4208 1379: { 4209 gap: mediaThumbGap[1], 4210 fixedWidth: mediaThumbFixedWidth[1], 4211 fixedHeight: mediaThumbFixedHeight[1], 4212 direction: mediaThumbDirection[1], 4213 heightRatio : 3.2, 4214 }, 4215 1199: { 4216 gap: mediaThumbGap[2], 4217 fixedWidth: mediaThumbFixedWidth[2], 4218 fixedHeight: mediaThumbFixedHeight[2], 4219 direction: mediaThumbDirection[2], 4220 heightRatio : 3.2, 4221 }, 4222 959: { 4223 gap: mediaThumbGap[3], 4224 fixedWidth: mediaThumbFixedWidth[3], 4225 fixedHeight: mediaThumbFixedHeight[3], 4226 direction: mediaThumbDirection[3], 4227 heightRatio : 3.2, 4228 }, 4229 599: { 4230 gap: mediaThumbGap[4], 4231 fixedWidth: mediaThumbFixedWidth[4], 4232 fixedHeight: mediaThumbFixedHeight[4], 4233 direction: mediaThumbDirection[4], 4234 heightRatio : 3.2, 4235 } 4236 } 4237 }); 4238 4239 splideThumbGallary.sync( thumbnailsGallary ); 4240 4241 splideThumbGallary.mount(); 4242 4243 thumbnailsGallary.mount(); 4244 4245 sliderBreakPoints(); 4246 4247 //sliderPaginationChecking(); 4248 4249 //document.addEventListener('dataMediaSourceChange', sliderBreakPoints); 4250 4251 function sliderBreakPoints() { 4252 setTimeout(function(){ 4253 if ($alignItem.length) { 4254 let itemHeight = $alignItem.outerHeight() / 2; 4255 let arrowsPosition = itemHeight + $alignItem.position().top; 4256 $this.find('.splide__arrow').css('top', arrowsPosition); 4257 } 4258 }, 100); 4259 }; 4260 } 4261 }); 4262 } 4263 }; 4264 4265 lp_template.queue.sliderBlock = function ($self) { 4266
4267 let $block = $self.attr('data-slider-init') ? $self : $self.find('[data-slider-init]'); 4268 4269 if ($block.length) { 4270 if ($block.data('slider-thumb-init') != true) { 4271 $block.each(function(){ 4272 let $this = $(this); 4273 let $alignItem = $this.find($this.data('align-item')); 4274 let mediaGap = $this.data('margin'); 4275 let mediaPerPage = $this.data('count'); 4276 4277 if ($(this).data('move')) { 4278 var $mediaMove = $(this).data('move'); 4279 } else { 4280 var $mediaMove = 1; 4281 } 4282 4283 4284 let hasIframe = $this.find('iframe').length > 0; 4285 if (hasIframe) { 4286 $this.attr('data-arrows', true); 4287 $this.addClass('lp_arrow_style'); 4288 } 4289 4290 if($this.find('.splide').not('.is-active').length != 0) { 4291 let splide = new Splide( $this.find('.splide').not('.is-active')[0], { 4292 autoplay: $this.data('autoplay'), 4293 speed: $this.data('speed'), 4294 interval: $this.data('pause'), 4295 rewind: $this.data('infinite'), 4296 //lazyLoad: $this.data('lazy-load'), 4297 /*rewindByDrag: true,*/ 4298 perMove: $mediaMove, 4299 perPage: mediaPerPage[0], 4300 gap: mediaGap[0], 4301 breakpoints: { 4302 /*1380: { 4303 perPage: 3, 4304 arrows: false, 4305 pagination: true, 4306 rewindByDrag: true, 4307 gap: mediaGap[0], 4308 perPage: mediaPerPage[0], 4309 },*/ 4310 1379: { 4311 arrows: true, 4312 pagination: true, 4313 /*rewindByDrag: true,*/ 4314 gap: mediaGap[1], 4315 perPage: mediaPerPage[1], 4316 }, 4317 1199: { 4318 arrows: true, 4319 pagination: true, 4320 /*rewindByDrag: true,*/ 4321 gap: mediaGap[2], 4322 perPage: mediaPerPage[2], 4323 }, 4324 959: { 4325 arrows: $this.data('arrows'), 4326 pagination: true, 4327 /*rewindByDrag: true,*/ 4328 gap: mediaGap[3], 4329 perPage: mediaPerPage[3], 4330 }, 4331 599: { 4332 arrows: $this.data('arrows'), 4333 pagination: true, 4334 /*rewindByDrag: true,*/ 4335 gap: mediaGap[4], 4336 perPage: mediaPerPage[4], 4337 } 4338 } 4339 }); 4340 4341 /*splide.on('mounted', function() { 4342 // Ðобавление клаÑÑов к ÐºÐ°Ð¶Ð´Ð¾Ð¼Ñ ÑÐ»Ð°Ð¹Ð´Ñ 4343 splide.Components.Slides.forEach(function(slide, index) { 4344 // ÐобавлÑем каÑÑомнÑй клаÑÑ Ðº ÐºÐ°Ð¶Ð´Ð¾Ð¼Ñ ÑÐ»Ð°Ð¹Ð´Ñ 4345 slide.slide.classList.add('custom-slide-class'); 4346 // ÐапÑимеÑ, добавлÑем клаÑÑ Ñ Ð¿Ð¾ÑÑдковÑм номеÑом 4347 slide.slide.classList.add('slide-' + index); 4348 }); 4349 4350 // ÐобавлÑем каÑÑомнÑй клаÑÑ Ðº ÑÑÑелкам 4351 var prevArrow = splide.root.querySelector('.splide__arrow--prev .splide__arrow__bg'); 4352 var nextArrow = splide.root.querySelector('.splide__arrow--next .splide__arrow__bg'); 4353 4354 if (prevArrow) prevArrow.classList.add('lp-button', 'lp-button--type-1', '_primary-fill', '_v2-icon'); 4355 if (nextArrow) nextArrow.classList.add('lp-button', 'lp-button--type-1', '_primary-fill', '_v2-icon'); 4356 });*/ 4357 4358 splide.mount(); 4359 4360 sliderBreakPoints(); 4361 4362 function sliderBreakPoints() { 4363 setTimeout(function(){ 4364 if ($alignItem.length) { 4365 let itemHeight = $alignItem.outerHeight() / 2; 4366 let arrowsPosition = itemHeight + $alignItem.position().top; 4367 $this.find('.splide__arrow').css('top', arrowsPosition); 4368 } 4369 }, 100); 4370 }; 4371 } 4372 }); 4373 } 4374 } 4375 }; 4376 4377 4378 lp_template.queue.multipleSliders = function ($self) { 4379 let $blocks = $self.attr('data-initializing-multiple-sliders') ? $self : $self.find('[data-initializing-multiple-sliders]'); 4380 4381 if ($blocks.length) { 4382 $blocks.each(function () { 4383 let $block = $(this); 4384 4385 if ($block.data('slider-thumb-init') === true) return; 4386 $block.data('slider-thumb-init', true); 4387 4388 let $alignItem = $block.find($block.data('align-item')); 4389 let mediaGap = $block.data('margin'); 4390 let mediaPerPage = $block.data('count'); 4391 4392 let mediaMove = $block.data('move') ? $block.data('move') : 1; 4393 4394 let $splide = $block.find('.splide').not('.is-active'); 4395 if ($splide.length) { 4396 $splide.each(function () { 4397 let splide = new Splide(this, { 4398 autoplay: $block.data('autoplay'), 4399 speed: $block.data('speed'), 4400 interval: $block.data('pause'), 4401 rewind:$block.data('infinite'), 4402 rewindByDrag: true, 4403 perMove: mediaMove, 4404 perPage: mediaPerPage[0], 4405 gap: mediaGap[0], 4406 breakpoints: { 4407 1379: { 4408 arrows: true, 4409 pagination: true, 4410 rewindByDrag: true,
4411 gap: mediaGap[1], 4412 perPage: mediaPerPage[1], 4413 }, 4414 1199: { 4415 arrows: true, 4416 pagination: true, 4417 rewindByDrag: true, 4418 gap: mediaGap[2], 4419 perPage: mediaPerPage[2], 4420 }, 4421 959: { 4422 arrows: false, 4423 pagination: true, 4424 rewindByDrag: true, 4425 gap: mediaGap[3], 4426 perPage: mediaPerPage[3], 4427 }, 4428 599: { 4429 arrows: false, 4430 pagination: true, 4431 rewindByDrag: true, 4432 gap: mediaGap[4], 4433 perPage: mediaPerPage[4], 4434 } 4435 } 4436 }); 4437 4438 splide.mount(); 4439 4440 setTimeout(function () { 4441 if ($alignItem.length) { 4442 let itemHeight = $alignItem.outerHeight() / 2; 4443 let arrowsPosition = itemHeight + $alignItem.position().top; 4444 $block.find('.splide__arrow').css('top', arrowsPosition); 4445 } 4446 }, 100); 4447 }); 4448 } 4449 }); 4450 } 4451 }; 4452 4453 4454 lp_template.queue.sliderReviews = function ($self) { 4455 let $block = $self.attr('data-slider-reviews-init') ? $self : $self.find('[data-slider-reviews-init]'); 4456 4457 if ($block.length) { 4458 $block.each(function () { 4459 let $this = $(this); 4460 let $alignItem = $this.find($this.data('align-item')); 4461 4462 if ($this.find('.splide').not('.is-active').length != 0) { 4463 $this.find('.splide').not('.is-active').each(function () { 4464 4465 let splide = new Splide($(this)[0], { 4466 autoplay: $this.data('autoplay'), 4467 speed: $this.data('speed'), 4468 interval: $this.data('pause'), 4469 lazyLoad: $this.data('lazy-load'), 4470 rewind: true, 4471 arrows: true, 4472 pagination: true, 4473 gap: 0, 4474 perPage: 1 4475 }); 4476 4477 splide.mount(); 4478 4479 if ($(this).find('.lp-reviews-gallery__item').length <= 1) { 4480 $(this).addClass('splide--pointer-events'); 4481 } 4482 }); 4483 } 4484 }); 4485 } 4486 }; 4487 4488 4489 4490 4491 /* 4492 lp_template.queue.promoSlider = function($self) { 4493 var $block = $self.find('.js-promo2-slider'); 4494 4495 $block.each(function (index, slider) { 4496 var $slider = $(slider); 4497 var autoplay = $slider.data('autoplay') || false; 4498 $slider.slick({ 4499 dots: true, 4500 autoplay: !!autoplay, 4501 autoplaySpeed: autoplay 4502 }); 4503 $slider.on('beforeChange', function (event, slick) { 4504 var $this = $(this); 4505 var $cloned = $this.find('.slick-cloned'); 4506 $cloned.each(function (index, slide) { 4507 styleSlide(slide); 4508 }); 4509 slick.$slides.each(function (index, slide) { 4510 styleSlide(slide); 4511 }); 4512 }); 4513 }); 4514 4515 function styleSlide(slide) { 4516 var $slide = $(slide).find('.lp-promo2__slider-item'); 4517 var $img = $slide.find('img'); 4518 4519 if ($img.height() < $slide.height()) { 4520 $slide.css({ 4521 'display': 'flex', 4522 'align-items': 'center' 4523 }); 4524 } 4525 } 4526 };*/ 4527 4528 lp_template.queue.spoilerBlock = function ($self) { 4529 let $block = $self.hasClass('spoiler-init') ? $self : $self.find('.spoiler-init'); 4530 4531 $block.each(function(){ 4532 4533 let $this = $(this); 4534 4535 function initSpoiler() { 4536 let $hidden = $this.find('.spoiler-item:hidden'); 4537 let $firstNotHidden = $this.find('.spoiler-item').first(); 4538 let $btn = $this.find('.spoiler-btn'); 4539 let $btnWrap = $this.find('.spoiler-btn-wrap'); 4540 4541 4542 4543 if ($hidden.length) { 4544 $btnWrap.addClass('show_spoiler'); 4545 4546 $btn.on('click', function(){ 4547 $hidden.slideDown('150', function(){ 4548 if ($firstNotHidden.css('display') == 'flex') { 4549 $hidden.css('display', 'flex'); 4550 } 4551 }); 4552 $(this).hide(); 4553 $(this).parent('.spoiler-btn-wrap').removeClass('show_spoiler'); 4554 }); 4555 } else { 4556 $btnWrap.removeClass('show_spoiler'); 4557 } 4558 } 4559 4560 initSpoiler(); 4561 }); 4562 }; 4563 4564 lp_template.queue.headerInPopup = function($self) { 4565 4566 /* Old Version */ 4567 if (s3LP.is_cms) return; 4568 4569 var $block = $self.find('._js-in-promo'); 4570 4571 if ($block.length) { 4572 $block.each(function(){ 4573 var $this = $(this), 4574 $thisParent = $this.next('._insert-header'); 4575 4576 if ($thisParent.length) { 4577 $this.insertBefore($thisParent.find('.js-promo-before')); 4578 $thisParent.addClass('_header_inserted'); 4579 } 4580 }); 4581 } 4582 }; 4583 4584 lp_template.queue.headerCommunity = function($self) { 4585 var $header = $self.find('.js-community'); 4586 4587 if (s3LP.is_cms) return; 4588 4589 if ($header.length) { 4590 $header.each(function() { 4591 var $this = $(this), 4592 $thisNewParent = findPromoBlock($this); 4593 4594 if ($thisNewParent) { 4595 $this.insertBefore($thisNewParent.find('.js-before-community')); 4596 $thisNewParent.addClass('_unified'); 4597 } 4598 }); 4599 } 4600 4601 function findPromoBlock ($block) { 4602 if (!$block.length) return null; 4603 4604 var $next = $block.next('.js-make-community'); 4605 4606 if ($next.length) { 4607 $next.addClass('js-make-community-style'); 4608 return $next; 4609 } 4610 4611 return findPromoBlock($block.next()); 4612 } 4613 }; 4614 4615 lp_template.queue.partnersSlider1 = function($self) { 4616 var $block = $self.find('.js-partners-1'); 4617 4618 if ($block.length) { 4619 4620 $block.each(function() { 4621 var $slider = $(this), 4622 count = $slider.data('count'), 4623 autoplay = !!$slider.data('autoplay'), 4624 pause = $slider.data('pause'), 4625 speed = $slider.data('speed'), 4626 arrows = !!$slider.data('arrows'), 4627 rewind = false, 4628 infinite = !!$slider.data('infinite'); 4629 4630 4631 if(s3LP.is_cms){ 4632 var infinite = false, 4633 $rewind = true, 4634 autoplay = false;
4635 } 4636 else if(typeof ReactLPConstructor == 'object') { 4637 var infinite = false, 4638 $rewind = true, 4639 autoplay = false; 4640 4641 } 4642 4643 $slider.owlCarousel({ 4644 autoplay: autoplay, 4645 autoplayTimeout: pause, 4646 smartSpeed: speed, 4647 rewind: $rewind, 4648 loop: infinite, 4649 dots: false, 4650 responsive: { 4651 0: { 4652 items: 1, 4653 margin: 0 4654 }, 4655 600: { 4656 items: 3, 4657 margin: 24 4658 }, 4659 960: { 4660 items: 3, 4661 margin: 48 4662 }, 4663 1200: { 4664 items: count, 4665 margin: 24 4666 }, 4667 1380: { 4668 items: count, 4669 margin: 36 4670 } 4671 } 4672 }); 4673 }); 4674 } 4675 }; 4676 4677 lp_template.queue.elementsTable = function($self) { 4678 var $table = $self.find('.lp-elements-table table'); 4679 if ($table.length) { 4680 $table.wrap('<div class="table-wrapper"></div>'); 4681 }; 4682 } 4683 4684 lp_template.queue.contactsTab = function($self) { 4685 var $block = $self.find('.js-contacts-tab-1'); 4686 var $allTabs = $self.find('.tab-item'); 4687 var activeClass = 'active'; 4688 4689 $block.on('click', function(){ 4690 4691 var $thisParent = $(this).closest('.tab-item'); 4692 4693 if ($thisParent.hasClass(activeClass)) { 4694 $thisParent.removeClass(activeClass).find('.tab-item__text-part').slideUp(); 4695 } else { 4696 4697 $allTabs.removeClass(activeClass).find('.tab-item__text-part').slideUp(); 4698 4699 $thisParent.addClass(activeClass).find('.tab-item__text-part').slideDown(); 4700 } 4701 }); 4702 4703 $($block[0]).trigger('click'); 4704 } 4705 4706 lp_template.queue.formInputs = function($self) { 4707 4708 $doc.on('click', '.js-select, .js-multi_select', function() { 4709 var $this = $(this), 4710 openedClass = '_opened', 4711 $thisParent = $this.closest('.lp-form-tpl__field-select, .lp-form-tpl__field-multi_select'), 4712 $thisList = $thisParent.find('.lp-form-tpl__field-select__list, .lp-form-tpl__field-multi_select__list'); 4713 4714 if ($thisParent.hasClass(openedClass)) { 4715 $thisParent.removeClass(openedClass); 4716 $thisList.slideUp(); 4717 } else { 4718 $thisParent.addClass(openedClass); 4719 $thisList.slideDown(); 4720 } 4721 }); 4722 4723 $(document).ready(function () { 4724 $(".js-choose-select._checked").each(function () { 4725 var $this = $(this), 4726 thisText = $this.text(), 4727 $thisParent = $this.closest(".lp-form-tpl__field-select"), 4728 checkedClass = "_checked"; 4729 4730 $thisParent.find(".js-choose-select").removeClass(checkedClass); 4731 $thisParent.find(".lp-form-tpl__field-select__input").text(thisText); 4732 $thisParent.parent().find("input").val(thisText); 4733 }); 4734 }); 4735 4736 $doc.on('click', '.js-choose-select', function() { 4737 var $this = $(this), 4738 thisText = $this.text(), 4739 $thisParent = $this.closest('.lp-form-tpl__field-select'), 4740 checkedClass = '_checked'; 4741 4742 if (!$this.hasClass(checkedClass)) { 4743 $thisParent.find('.js-choose-select').removeClass(checkedClass); 4744 $this.addClass(checkedClass); 4745 $thisParent.find('.lp-form-tpl__field-select__input').text(thisText); 4746 $thisParent.parent().find('input').val(thisText); 4747 } 4748 4749 $thisParent.find('.lp-form-tpl__field-select__list').slideUp(); 4750 $thisParent.removeClass('_opened'); 4751 4752 }); 4753 4754 $doc.on('click', '.js-choose-milti_select', function() { 4755 var $this = $(this), 4756 $thisParent = $this.closest('.lp-form-tpl__field-multi_select'), 4757 checkedClass = '_checked'; 4758 4759 if (!$this.hasClass(checkedClass)) { 4760 $this.addClass(checkedClass); 4761 } else { 4762 $this.removeClass(checkedClass); 4763 } 4764 4765 var choosenElements = $thisParent.find('.' + checkedClass), 4766 choosenElementsText = []; 4767 4768 choosenElements.each(function() { 4769 choosenElementsText.push($(this).text()); 4770 }); 4771 4772 $thisParent.find('.lp-form-tpl__field-multi_select__input--count').text(choosenElements.length); 4773 $thisParent.parent().find('input').val(choosenElementsText.join(', ')); 4774 }); 4775 4776 4777 4778 $doc.on('click', function(e) { 4779 if ($(e.target).closest('.lp-form-tpl__field-select, .lp-form-tpl__field-multi_select').length) return; 4780 4781 $doc.find('.lp-form-tpl__field-select, .lp-form-tpl__field-multi_select').removeClass('_opened'); 4782 4783 $doc.find('.lp-form-tpl__field-select__list, .lp-form-tpl__field-multi_select__list').slideUp(); 4784 }); 4785 } 4786 4787 lp_template.queue.fpInit = function($self) { 4788 var $block = $self.find('.js-lp-fastpay'); 4789 if ($block.length) { 4790 $block.on('click', '.js-fp-show-form', function(e) { 4791 e.preventDefault(); 4792 4793 var $this = $(this), 4794 $parent = $this.closest('.js-lp-fastpay'), 4795 needHref = $parent.data('page-path'), 4796 serviceID = $this.data('service-id'), 4797 $currentItem = $this.closest('.lp-payment-service-item'), // ÐакеÑиÑовали ÑекÑÑий ÑÐ»ÐµÐ¼ÐµÐ½Ñ 4798 fastPayID = $currentItem.attr('data-fastpay-id'); 4799 4800 $this.addClass('_opened'); 4801 4802 $.ajax({ 4803 url: '/-/x-api/v1/public/?method=fastpay/getService¶m[service_id]='+serviceID+'¶m[fast_pay_id]='+ fastPayID +'¶m[tpl]=global:lp.fast_payment.tpl', 4804 success: function(data) { 4805 var htmlForm = data.result.html; 4806 var $newBlock = $currentItem.append(htmlForm); 4807 4808 s3LP.initForms($newBlock); 4809 $currentItem.find('.lp-payment-service-item_button').hide(); 4810 4811 var needAttr = $self.find('.lp-payment__form').attr('data-api-url') + "¶m[href]=" + needHref; 4812 $newBlock.find('.lp-payment__form').attr('data-api-url', needAttr); 4813 $newBlock.find('.lp-payment__form').data('api-url', needAttr); 4814 $currentItem.find('.payment-selection:first').addClass('_active'); 4815 4816 // --- ÐÑпÑавленнÑй блок ÑабоÑÑ Ñо ÑÑÑлками --- 4817 var agreementLink = $currentItem.data('agreement-link'); 4818 var policyLink = $currentItem.data('policy-link'); 4819 4820 var $agreement = $currentItem.find('.lp-payment__form .lp-payment-user-aggrement-inner a').eq(0); 4821 var $policy = $currentItem.find('.lp-payment__form .lp-payment-user-aggrement-inner a').eq(1); 4822 4823 $agreement.attr('href', agreementLink); 4824 $policy.attr('href', policyLink); 4825 // --------------------------------------------- 4826 } 4827 }); 4828 4829 }); 4830 4831 $block.find('.fp_free_wrap').each(function() { 4832 var $this = $(this).find('.js-lp-fp-form'), 4833 $parent = $this.closest('.js-lp-fastpay'), 4834 needHref = $parent.data('page-path'), 4835 needAttr = $this.attr('data-api-url') + "¶m[href]=" + needHref; 4836 4837 $this.attr('data-api-url', needAttr); 4838 $this.data('api-url', needAttr); 4839 }); 4840 4841 $block.on('click', '.payment-selection-in', function(e) { 4842 $(this).each(function () { 4843 e.preventDefault(); 4844 $(this).parent('.payment-selection').siblings('.payment-selection').removeClass('_active'); 4845 $(this).parent('.payment-selection').addClass('_active'); 4846 $(this).siblings('.type-radio-payment').click(); 4847 }); 4848 }); 4849 4850 if($block.hasClass('lp-payment-ps_redirect')) { 4851 $block.closest('.lp-payment__wrap').addClass('status-fail'); 4852 } 4853 } 4854 }; 4855 4856 4857 4858 4859 lp_template.queue.popupFastPayData = function ($self) { 4860 var searchLinkPopupText = "popup"; 4861 var searchLinkScrollText = "popup"; 4862 4863 if(s3LP.is_cms) { 4864 $(document).ready(function () { 4865 $(".lp-popup-fastpay .lp-popup-fastpay__form-price").text('0'); 4866 }); 4867 } 4868 4869 4870 $doc.on("click", function (e) { 4871 if($(e.target).closest('.lp-tarifs-compare').length){ 4872 if($(e.target).closest('.lp-popup-hide-input-check').length) { 4873 $(e.target).closest('.lp-popup-hide-input-check').each(function(){ 4874 var prodPrice = $(this).data('button-index'); 4875 var prodPriceCustom = prodPrice.replace(/\D/g, ''); 4876 4877 if (prodPrice.indexOf('/') !== -1) { 4878 var prodPrice = false;
4879 } 4880 4881 if(prodPrice) { 4882 $('.lp-popup-fastpay__form').show(); 4883 $('.lp-popup-fastpay .lp-payment-inner form input[name="price"]').val(prodPriceCustom).hide(); 4884 $('.lp-popup-fastpay .lp-payment-inner form input[name="price"]').closest('.lp-payment__form').removeClass('_input-active'); 4885 4886 if($('.lp-popup-fastpay .lp-payment-inner form input[name="price"]').closest('.lp-popup-fastpay__content').find('.lp-popup-fastpay__form-price').length == 0){ 4887 $('.lp-popup-fastpay .lp-payment-inner form input[name="price"]').closest('.lp-popup-fastpay__content').find('.lp-popup-fastpay__form-price').text(prodPrice).show(); 4888 }else { 4889 $('.lp-popup-fastpay .lp-payment-inner form input[name="price"]').closest('.lp-popup-fastpay__content').find('.lp-popup-fastpay__form-price').text(prodPrice); 4890 } 4891 } 4892 else { 4893 $('.lp-popup-fastpay .lp-payment-inner form input[name="price"]').closest('.lp-payment__form').addClass('_input-active'); 4894 $('.lp-popup-fastpay__form').hide(); 4895 $('.lp-popup-fastpay .lp-payment-inner form input[name="price"]').val("").show(); 4896 } 4897 }); 4898 4899 var prodName = $(e.target).closest('.lp-popup-hide-input-check').data('button-name'); 4900 4901 if ($('.lp-popup-wrapper .lp-payment__form form').find('input[name=_order_details]').length) { 4902 $('.lp-popup-wrapper .lp-payment__form form').find('input[name=_order_details]').val(prodName); 4903 } 4904 } 4905 } else { 4906 if($(e.target).closest('.lp-popup-hide-input-check').length) { 4907 if($doc.find("[name='price']") && $doc.find(".lp-payment__form") && $(e.target).attr('href').includes(searchLinkPopupText) && $(e.target).closest('.lp-product-name').find('[data-price-product]').length){ 4908 var $this = $(this), 4909 prodPrice = $(e.target).closest('.lp-product-name').find('[data-price-product]').data('price-product'); 4910 if (prodPrice.indexOf('/') !== -1) { 4911 var prodPrice = false; 4912 }else{ 4913 var prodPriceCustom = $(e.target).closest('.lp-product-name').find('[data-price-product]').data('price-product').replace(/\D/g, ''); 4914 } 4915 4916 if(prodPrice) { 4917 $('.lp-popup-fastpay__form').show(); 4918 $('.lp-popup-fastpay .lp-payment-inner form input[name="price"]').val(prodPriceCustom).hide(); 4919 $('.lp-popup-fastpay .lp-payment-inner form input[name="price"]').closest('.lp-payment__form').removeClass('_input-active'); 4920 4921 if($('.lp-popup-fastpay .lp-payment-inner form input[name="price"]').closest('.lp-popup-fastpay__content').find('.lp-popup-fastpay__form-price').length == 0){ 4922 $('.lp-popup-fastpay .lp-payment-inner form input[name="price"]').closest('.lp-popup-fastpay__content').find('.lp-popup-fastpay__form-price').text(prodPrice).show(); 4923 }else { 4924 $('.lp-popup-fastpay .lp-payment-inner form input[name="price"]').closest('.lp-popup-fastpay__content').find('.lp-popup-fastpay__form-price').text(prodPrice); 4925 } 4926 }else { 4927 $('.lp-popup-fastpay .lp-payment-inner form input[name="price"]').closest('.lp-payment__form').addClass('_input-active'); 4928 $('.lp-popup-fastpay__form').hide(); 4929 $('.lp-popup-fastpay .lp-payment-inner form input[name="price"]').val("").show(); 4930 } 4931 4932 } else if($doc.find("[name='price']") && $doc.find(".lp-payment__form") && $(e.target).attr('href').includes(searchLinkPopupText) && !$(e.target).closest('.lp-product-name').find('[data-price-product]').length) { 4933 $('.lp-popup-fastpay .lp-payment-inner form input[name="price"]').closest('.lp-payment__form').addClass('_input-active'); 4934 $('.lp-popup-fastpay__form').hide(); 4935 $('.lp-popup-fastpay .lp-payment-inner form input[name="price"]').val("").show(); 4936 $('.lp-popup-fastpay .lp-payment-inner form input[name="price"]').siblings('.lp-form-tpl__field-text-elem').hide(); 4937 } 4938 var prodName = $(e.target).closest('.lp-product-name').find('[data-name-product]').data('name-product'); 4939 if ($('.lp-popup-wrapper .lp-payment__form form').find('input[name=_order_details]').length) { 4940 $('.lp-popup-wrapper .lp-payment__form form').find('input[name=_order_details]').val(prodName); 4941 } 4942 } 4943 4944 /*if($(e.target).closest('.lp-popup-hide-input-check').length && (!$(e.target).attr('href').includes(searchLinkPopupText) && !$(e.target).attr('href').includes(searchLinkScrollText)) && $(e.target).closest('.lp-product-name').find('[data-price-product]').length){ 4945 var buttonLink = $(e.target).attr('href'); 4946 prodPrice = $(e.target).closest('.lp-product-name').find('[data-price-product]').data('price-product'); 4947 var fastPayLink = buttonLink + '?price=' + prodPrice; 4948 e.preventDefault(); 4949 window.location.href = fastPayLink; 4950 }*/ 4951 } 4952 if ($(e.target).closest('a').length && $(e.target).closest('.lp-popup-hide-input-check').length == 0) { 4953 $('.lp-popup-fastpay .lp-payment-inner form input[name="price"]').closest('.lp-payment__form').addClass('_input-active'); 4954 $('.lp-popup-fastpay__form').hide(); 4955 $('.lp-popup-fastpay .lp-payment-inner form input[name="price"]').val("").show(); 4956 } 4957 }); 4958 }; 4959 4960 lp_template.queue.calendar = function($self) { 4961 $doc.on('click', '.js-form-calendar', function() { 4962 var $this = $(this), 4963 thisCalendarInited = $this.data('calendarInited'); 4964 4965 if (!thisCalendarInited) { 4966 var bb = $this.datepicker().data('datepicker'); 4967 bb.show(); 4968 thisCalendarInited = $this.data('calendarInited', true); 4969 4970 } 4971 }); 4972 4973 $doc.on('click', '.js-form-calendar-interval', function() { 4974 var $this = $(this), 4975 thisCalendarInited = $this.data('calendarInited'); 4976 4977 if (!thisCalendarInited) { 4978 var isMobile = window.matchMedia("(max-width: 768px)").matches; // мобилÑÐ½Ð°Ñ Ð²ÐµÑÑÐ¸Ñ 4979 4980 var position; 4981 if (isMobile) { 4982 // Ð´Ð»Ñ Ð´ÐµÑкÑопа â пÑовеÑÑем положение 4983 var elementOffset = $this.offset().top - $(window).scrollTop(); 4984 var windowHeight = $(window).height(); 4985 position = (elementOffset < windowHeight / 2) ? 'bottom center' : 'top center'; 4986 // Ð´Ð»Ñ Ð¼Ð¾Ð±Ð¸Ð»Ñной â вÑегда ÑÐ½Ð¸Ð·Ñ 4987 4988 } else { 4989 position = 'bottom center'; 4990 } 4991 4992 var bb = $this.datepicker({ 4993 range: true, 4994 multipleDatesSeparator: " - ", 4995 position: position, 4996 }).data('datepicker'); 4997
4998 bb.show(); 4999 thisCalendarInited = $this.data('calendarInited', true); 5000 } 5001 }); 5002 } 5003 5004 lp_template.queue.lgNew = function($self) { 5005 let $block = $self.find('.js-new-lg-init'); 5006 5007 if ($block.length) { 5008 $block.each(function() { 5009 let $block = $(this); 5010 let lgCounter = $block.data('lg-counter'); 5011 let lgThumbnail = $block.data('lg-thumbnail'); 5012 5013 setTimeout(function () { 5014 $block.find('.lp-lg-item').each(function () { 5015 let $a = $(this); 5016 5017 if ($a.is('[data-lp-vk]')) { 5018 let iframe = $a.find('iframe'); 5019 if (iframe.length) { 5020 let src = iframe.attr('src'); 5021 if (src) { 5022 $a.attr('href', src).attr('data-iframe', 'true'); 5023 } 5024 } 5025 } 5026 }); 5027 }, 200); 5028 5029 setTimeout(function () { 5030 lightGallery($block[0], { 5031 plugins: [Zoom, Thumbnail, Video], 5032 counter: lgCounter, 5033 thumbnail: lgThumbnail, 5034 selector: '.lp-lg-item', 5035 download: false, 5036 mobileSettings: { 5037 preload: 2, 5038 controls: false, 5039 showCloseIcon: true 5040 } 5041 }); 5042 }, 300); 5043 5044 $block.find('.lp-lg-item').removeClass('lp_lg_pointer_events'); 5045 }); 5046 } 5047 } 5048 5049 lp_template.queue.lg = function($self) { 5050 var $block = $self.find('.js-lg-init'); 5051 5052 if ($block.length) { 5053 $block.lightGallery({ 5054 selector: '.lg-item', 5055 share: false, 5056 hash: false, 5057 autoplayControls: false, 5058 actualSize: false, 5059 toogleThumb: false, 5060 getCaptionFromTitleOrAlt: false, 5061 download: false, 5062 thumbWidth: 64, 5063 thumbHeight: '64px', 5064 nextHtml: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.98528 4.32805C9.3758 3.93753 10.009 3.93753 10.3995 4.32805L17.0563 10.9849C17.4469 11.3754 17.4469 12.0086 17.0563 12.3991L10.3995 19.056C10.009 19.4465 9.3758 19.4465 8.98528 19.056C8.59475 18.6654 8.59475 18.0323 8.98528 17.6418L14.935 11.692L8.98528 5.74226C8.59475 5.35174 8.59475 4.71857 8.98528 4.32805Z" fill="white"/></svg>', 5065 prevHtml: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14.8492 5.03516L8.19239 11.692L14.8492 18.3489" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>' 5066 }); 5067 5068 $block.find('.lg-item').removeClass('lg-pointer-events'); 5069 } 5070 } 5071 5072 lp_template.queue.qaToggle = function($self) { 5073 var $block = $self.hasClass('js-qa-toggle') ? $self : $self.find('.js-qa-toggle'); 5074 5075 if($block.length) { 5076 $block.each(function(){ 5077 var $this = $(this); 5078 5079 if($('.lp-qa-3-questions-col').length) { 5080 var elemLength = $('.lp-qa-3-questions-col:first-child').find('.lp-qa-3-questions__item'); 5081 function getMaxOfArray(nums) { 5082 return Math.max.apply(null, nums); 5083 } 5084 for (i = 0; i < elemLength.length; i++) { 5085 var i = i, 5086 numArr = [], 5087 $thisElem = $this.find('.lp-qa-3-questions__item:nth-child(' + (i + 1) + ') .lp-qa-3-questions__item-title'); 5088 $($thisElem).each(function(){ 5089 var height = $(this).outerHeight(); 5090 numArr.push(height); 5091 }); 5092 $thisElem.css('height', getMaxOfArray(numArr)); 5093 } 5094 } 5095 5096 if (s3LP.is_cms && !$('body').hasClass('preview_mode')) { 5097 setTimeout(function(){ 5098 $this.find('._col:first-child ._item:first-child').addClass('isCMS').addClass('active'); 5099 },500); 5100 } 5101 5102 var $button = $this.find('.js-qa-show'), 5103 activeClass = 'active', 5104 $closeButton = $this.find('.js-qa-hide'); 5105 5106 5107 5108 5109 $button.on('click', function(e) { 5110 e.preventDefault(); 5111 var $parent = $(this).closest('._item'), 5112 $wrapScroll = $(window).scrollTop(); 5113 5114 $parent.addClass(activeClass); 5115 $parent.find('._text').slideDown(); 5116 $(this).siblings('.js-qa-hide').attr('data-scroll-top', $wrapScroll); 5117 }); 5118 5119 $closeButton.on('click', function(e) { 5120 e.preventDefault(); 5121 var $parent = $(this).closest('._item'), 5122 $scroolTop = $(this).attr('data-scroll-top'); 5123 5124 5125 $parent.removeClass(activeClass); 5126 $parent.find('._text').slideUp(); 5127 $(window).scrollTop($scroolTop); 5128 }); 5129 }); 5130 5131 } 5132 } 5133 5134 lp_template.queue.titleHeight = function($self) { 5135 var $block = $self.find('.js-title-height'), 5136 func = function() { 5137 $block.each(function(){ 5138 var $this = $(this), 5139 $title = $this.find('._title'), 5140 minWidth = $this.data('min-width') || 960, 5141 minHeight = 0; 5142 5143 $title.css({ 5144 minHeight: 0 5145 }); 5146 5147 if ($(window).width() >= minWidth) { 5148 $title.each(function(){ 5149 var thisHeight = $(this).height(); 5150 5151 if (minHeight < thisHeight) { 5152 minHeight = thisHeight; 5153 } 5154 }); 5155 5156 $title.css({ 5157 minHeight: minHeight 5158 }); 5159 } 5160 }); 5161 }; 5162 5163 $(window).on('resize', func); 5164 if (s3LP.is_cms && typeof LpController !== 'undefined') { 5165 setTimeout(function(){ 5166 LpController.afterSave(function () { 5167 func(); 5168 }); 5169 },1000); 5170 } 5171 } 5172 5173 lp_template.queue.accordeonContact = function ($self) { 5174 var $block = $self.find('.lp-contact-accordeon-wrap .js-accordeon'); 5175 5176 $block.each(function(){ 5177 var $tabsRemember = $(this).closest('.lp-block').find('._item'); 5178 5179 $(this).on('click', function (event) { 5180 var $thisParent = $(this).closest('._item'), 5181 $thisText = $thisParent.find('._text'), 5182 $maps = $(this).parents('.lp-maps-parent').find('.js-lp-simple-map'), 5183 $thisBlock = $(this).closest('.lp-block').data('block-layout'); 5184 5185 if ($(event.target).hasClass('_text')) { 5186 event.stopPropagation(); 5187 return; 5188 } 5189 5190 if (!$thisText.is(':animated')) { 5191 $thisParent.toggleClass('active'); 5192 $thisText.slideToggle(); 5193 5194 if ($maps.length && !$maps.hasClass('initialized')) { 5195 $maps.each(function () { 5196 var $map = $(this); 5197 5198 setTimeout(function(){ 5199 lp_template.checkMapInitialization($map); 5200 $map.addClass('initialized'); 5201 }, 400) 5202 }); 5203 } 5204 } 5205 5206 var openTabsArray = []; 5207 5208 $tabsRemember.each(function(index) { 5209 if ($(this).hasClass('active')) { 5210 openTabsArray.push(index); 5211 } 5212 }); 5213 5214 var jsonStrOpenTabsArray = JSON.stringify(openTabsArray); 5215 5216 createCookie($thisBlock, jsonStrOpenTabsArray, 1); 5217 }); 5218 5219 $tabsRemember.each(function(){ 5220 if ($(this).hasClass('active')) { 5221 $(this).find('._text').slideDown(); 5222 } 5223 }); 5224 5225 if ($(this).data('accordeon-opened') == 1) { 5226 $(this).trigger('click', function(){}); 5227 5228 if (s3LP.is_cms) { 5229 $('.content_contructor').trigger('click', function(){}); 5230 } 5231 } 5232 }); 5233 5234 }; 5235 5236 lp_template.queue.accordeon = function($self) { 5237 var $block = $self.find('.js-accordeon'); 5238 5239 $block.on('click', function() { 5240 var $thisParent = $(this).closest('._item'), 5241 $thisToggle = $(this).parents('.lp-accordion-toggle'), 5242 $thisText = $thisParent.find('._text'); 5243 5244 if ($thisToggle.length && !$thisParent.hasClass('active')) { 5245 $thisToggle.find('._item.active ._text').hide(); 5246 $thisToggle.find('._item.active').removeClass('active'); 5247 } 5248 5249 if (!$thisText.is(':animated')) { 5250 $thisParent.toggleClass('active'); 5251 $thisText.slideToggle(); 5252 } 5253 }); 5254 5255 if (s3LP.is_cms && !$('body').hasClass('preview_mode')) { 5256 $block.closest('[data-block-layout]').find('._item:first-child').addClass('isCMS').addClass('active'); 5257 } 5258 5259 $(document).off('click', '._click-field').on('click', '._click-field', function(e) { 5260 if ($(e.target).closest('._click-field').length && !$(e.target).closest('.js-accordeon').length && !$(e.target).closest('._text').length) { 5261 $(this).find('.js-accordeon').trigger('click'); 5262 } 5263 }); 5264 } 5265 5266 lp_template.queue.qa10Tabs = function($self) { 5267 var $block = $self.find('.js-10-qa'); 5268 5269 /*$win.on('resize', function(){ 5270 5271 $block.each(function(){ 5272 var contentHeight = 0, 5273 $this = $(this); 5274 5275 $this.find('.lp-qa-10-item__text').each(function(){ 5276 if ($(this).height()>contentHeight){ 5277 contentHeight = $(this).height() 5278 } 5279 }); 5280 5281 $this.find('.lp-qa-10-content').css('min-height', contentHeight); 5282 }); 5283 });*/ 5284 5285 $block.on('click', '.lp-qa-10-item__title', function() { 5286 var $this = $(this), 5287 $parent = $this.closest('.js-10-qa'), 5288 $content = $this.parent().find('.lp-qa-10-item__text'), 5289 $allTitles = $parent.find('.lp-qa-10-item__title'); 5290 5291 if ($win.width() > 959) { 5292 5293 var qaContent = $parent.find('.lp-qa-10-content'); 5294 5295 if ($this.hasClass('_active')) { 5296 qaContent.html(''); 5297 $this.removeClass('_active'); 5298 } else { 5299 qaContent.html(''); 5300 $allTitles.removeClass('_active'); 5301 $this.addClass('_active'); 5302 $content.clone(true).removeAttr('style').appendTo(qaContent); 5303 } 5304 5305 5306 } else { 5307 5308 if ($this.hasClass('_active')) { 5309 $this.removeClass('_active'); 5310 $content.slideUp(); 5311 } else { 5312 $allTitles.removeClass('_active'); 5313 $parent.find('.lp-qa-10-item__text').slideUp(); 5314 5315 $this.toggleClass('_active') 5316 $content.slideDown(); 5317 } 5318 } 5319 }); 5320 5321 $block.each(function(){ 5322 var $this = $(this); 5323 5324 $this.append('<div class="lp-qa-10-content"></div>'); 5325 5326 $this.find('.lp-qa-10-item__title').eq(0).trigger('click'); 5327 }); 5328 } 5329 5330 lp_template.queue.videoPlayButton = function($self) { 5331 //$self.find('.js-lp-play-video').remove(); 5332 //$self.find('.lp-video-block-wrappper').find('video').attr('controls', 1); 5333 5334 var $allVideoParets = $self.find('.js-lp-play-video').closest('.lp-video-block-wrappper'); 5335 5336 $self.on('click', '.js-lp-play-video', function(e) { 5337 e.preventDefault(); 5338 5339 var $this = $(this); 5340 var thisVideo = $this.parent('.lp-video-block-wrappper').find('video')[0]; 5341 5342 $this.addClass('hide'); 5343 thisVideo.play(); 5344 thisVideo.setAttribute('controls', 1); 5345 }); 5346 5347 $allVideoParets.find('video').each(function(){ 5348 var $video = $(this); 5349 5350 this.addEventListener('play', function() { 5351 $video.parent('.lp-video-block-wrappper').find('.js-lp-play-video').addClass('hide'); 5352 }); 5353 5354 this.addEventListener('pause', function(){ 5355 $video.parent('.lp-video-block-wrappper').find('.js-lp-play-video').removeClass('hide'); 5356 }); 5357 }); 5358 } 5359 5360 lp_template.queue.QRcode = function ($self) { 5361 let $block = $self.find('.lp_qr_init'); 5362 5363 if ($block.length) { 5364 $block.each(function () { 5365 let item = $(this); 5366 let messengerWrap = item.find('.lp_qr_code_item'); 5367 5368 messengerWrap.each(function () { 5369 let item = $(this);
5370 let containerQr = item.find('.lp_qr_code_container'); 5371 let containerQrPhone = item.find('.lp_qr_code_container_phone'); 5372 5373 let messengerLinks = item.find('.lp_qr_code_link'); 5374 let messengerLinksPhone = item.find('.lp_qr_code_link_phone'); 5375 5376 let urls = messengerLinks.map(function () { 5377 return $(this).attr('href'); 5378 }).get(); 5379 5380 let urlsPhone = messengerLinksPhone.map(function () { 5381 return $(this).attr('href').replace(/[^\d+]/g, ''); 5382 }).get(); 5383 5384 let sizes = messengerLinks.map(function () { 5385 return $(this).attr('data-qr-code-size'); 5386 }).get(); 5387 5388 let sizesPhone = messengerLinksPhone.map(function () { 5389 return $(this).attr('data-qr-code-size'); 5390 }).get(); 5391 5392 urls.forEach(function (url, index) { 5393 if (containerQr.length) { 5394 createQR(containerQr.eq(index), sizes[index], url); 5395 $('body').append(containerQr.eq(index)); 5396 } 5397 }); 5398 5399 urlsPhone.forEach(function (url, index) { 5400 if (containerQrPhone.length) { 5401 createQR(containerQrPhone.eq(index), sizesPhone[index], url); 5402 $('body').append(containerQrPhone.eq(index)); 5403 } 5404 }); 5405 5406 messengerLinks.hover(function () { 5407 let index = messengerLinks.index(this); 5408 showQR(containerQr.eq(index), $(this)); 5409 }, function () { 5410 let index = messengerLinks.index(this); 5411 hideQR(containerQr.eq(index)); 5412 }); 5413 5414 messengerLinksPhone.hover(function () { 5415 let index = messengerLinksPhone.index(this); 5416 showQR(containerQrPhone.eq(index), $(this)); 5417 }, function () { 5418 let index = messengerLinksPhone.index(this); 5419 hideQR(containerQrPhone.eq(index)); 5420 }); 5421 5422 let activeQR = null; 5423 5424 function createQR(container, size, url) { 5425 container.qrcode({ 5426 width: size, 5427 height: size, 5428 text: url 5429 }).css({ 5430 position: 'absolute', 5431 display: 'none', 5432 zIndex: 10 5433 }); 5434 } 5435 5436 function showQR(container, link) { 5437 const linkRect = link[0].getBoundingClientRect(); 5438 const containerWidth = container.outerWidth(); 5439 const containerHeight = container.outerHeight(); 5440 5441 let left = linkRect.left; 5442 let top = linkRect.top - containerHeight - 10; 5443 5444 if (left + containerWidth > $(window).width()) { 5445 left = linkRect.left + link.outerWidth() - containerWidth; 5446 } 5447 5448 container.css({ 5449 top: top + 'px', 5450 left: left + 'px', 5451 display: 'block', 5452 position: 'fixed' 5453 }); 5454 5455 activeQR = container; 5456 } 5457 5458 function hideQR(container) { 5459 container.css({ 5460 display: 'none' 5461 }); 5462 5463 if (activeQR && container.is(activeQR)) { 5464 activeQR = null; 5465 } 5466 } 5467 5468 $(window).off('scroll.hideQR').on('scroll.hideQR', function () { 5469 if (activeQR) { 5470 activeQR.hide(); 5471 activeQR = null; 5472 } 5473 }); 5474 }); 5475 }); 5476 } 5477 }; 5478 5479 lp_template.queue.lpFlexImageBlock = function ($self) { 5480 /*const paramsGet = new URLSearchParams(window.location.search); 5481 if(paramsGet.has('lpc_test')){*/ 5482 var $block = $self.hasClass('lp-flexible-image-js') ? $self : $self.find('.lp-flexible-image-js'); 5483 // if(typeof ReactLPConstructor == 'object') { 5484 // var $block = $self.find('.lp-flexible-image-js') ? $self : $self.hasClass('.lp-flexible-image-js'); 5485 // }else { 5486 // var $block = $self.hasClass('.lp-flexible-image-js') ? $self : $self.find('.lp-flexible-image-js'); 5487 // } 5488 5489 if($block.length) { 5490 5491 $block.each(function () { 5492 let $item = $(this); 5493 let $itemId = $item.attr('id'); 5494 5495 let $imgInit = `#${$itemId}.lp-flexible-image-js`; 5496 5497 console.log($imgInit); 5498 5499 function flexibleImage(parent){ 5500 console.log("tes"); 5501 5502 let blockParent = document.querySelector(parent); 5503 let inner = blockParent.querySelector('.lp-flexible-image__inner-js'); 5504 let list = blockParent.querySelector('.lp-flexible-image__list-js'); 5505 5506 let wrap = blockParent.querySelector('.lp-flexible-image__wrap-js'); 5507 let wrapWidth = wrap.offsetWidth; 5508 5509 let blockParentWidth = blockParent.offsetWidth; 5510 5511 list.style.width = blockParentWidth + 'px'; 5512 5513 let inWrap = blockParent.querySelector('.lp-flexible-image__in-wrap-js'); 5514 5515 let docWidth = document.documentElement.clientWidth; 5516 5517 let WrapPos = wrap.getBoundingClientRect(); 5518 5519 //console.log(WrapPos.left) 5520 5521 //inWrap.style.marginLeft = -WrapPos.left + 'px'; 5522 //inWrap.style.marginRight = -(WrapPos.right - wrapWidth) + 'px'; 5523
5524 let inWrapMarginLeft = WrapPos.left; 5525 let inWrapMarginRight = (docWidth - WrapPos.right); 5526 5527 inWrap.style.marginLeft = -inWrapMarginLeft + 'px'; 5528 inWrap.style.marginRight = -inWrapMarginRight + 'px'; 5529 5530 //console.log(inWrapMarginLeft) 5531 //console.log(inWrapMarginRight) 5532 5533 //let itemMarginRight = docWidth - slideWrap.getBoundingClientRect().right; 5534 5535 inner.classList.add('load'); 5536 5537 5538 let listGapStr = getComputedStyle(list).gridGap 5539 5540 if(listGapStr === 'normal'){ 5541 listGapStr = '32px'; 5542 } 5543 5544 let listGap = parseInt(listGapStr); 5545 5546 5547 let blockOutDivision = 8; 5548 let innerMargin = (wrapWidth - (listGap * 3)) / blockOutDivision; 5549 5550 //console.log(innerMargin) 5551 5552 let innerMarginLeft = 0; 5553 let innerMarginRight = 0; 5554 5555 if(inWrapMarginLeft !== inWrapMarginRight){ 5556 innerMarginLeft = innerMargin - ((inWrapMarginLeft - inWrapMarginRight) / 2); 5557 innerMarginRight = innerMargin + ((inWrapMarginLeft - inWrapMarginRight) / 2); 5558 } else { 5559 innerMarginLeft = innerMargin; 5560 innerMarginRight = innerMargin; 5561 } 5562 5563 inner.style.marginLeft = -innerMarginLeft + 'px'; 5564 inner.style.marginRight = -innerMarginRight + 'px'; 5565 5566 let innerWidth = inner.offsetWidth; 5567 let innerHeight = inner.offsetHeight; 5568 5569 let listStageWidth = innerWidth - blockParentWidth; 5570 5571 //console.log(innerWidth) 5572 5573 let images = blockParent.querySelectorAll('.lp-flexible-image__image-js'); 5574 5575 let miniImageWidth = (blockParentWidth - listGap * 3) / 4; 5576 5577 5578 list.style.gridTemplateColumns = miniImageWidth + 'px ' + 'auto ' + 'auto ' + miniImageWidth + 'px'; 5579 5580 if(images[0]){ 5581 5582 let imageBig = images[0]; 5583 5584 if(imageBig.classList.contains('_1_1')) { 5585 5586 imageBig.style.height = blockParentWidth / 2 + 'px'; 5587 5588 } else if (imageBig.classList.contains('_4_3h')) { 5589 5590 5591 imageBig.style.height = blockParentWidth * 3 / 8 + 'px'; 5592 5593 } else if (imageBig.classList.contains('_3_2h')) { 5594 5595 imageBig.style.height = blockParentWidth / 3 + 'px'; 5596 5597 } else if (imageBig.classList.contains('_16_9h')) { 5598 5599 5600 imageBig.style.height = blockParentWidth * 9 / 30 + 'px'; 5601 5602 } else if (imageBig.classList.contains('_4_3v')) { 5603 5604 5605 imageBig.style.height = blockParentWidth * 2 / 3 + 'px'; 5606 5607 } else if (imageBig.classList.contains('_3_2v')) { 5608 5609 5610 imageBig.style.height = blockParentWidth * 3 / 4 + 'px'; 5611 5612 } else if (imageBig.classList.contains('_16_9v')) { 5613 5614 5615 imageBig.style.height = blockParentWidth * 8 / 9 + 'px'; 5616 5617 } 5618 5619 5620 5621 } 5622 5623 let heightStep = 0; 5624 5625 heightStep = 40; 5626 5627 5628 function updateHeightStep() { 5629 const decorWrap = document.querySelector('.decor-wrap'); 5630 if (decorWrap) { 5631 const mediaSource = decorWrap.getAttribute('data-media-source'); 5632 if (mediaSource === 'media-xl' || mediaSource === 'media-lg' || mediaSource === 'media-md') { 5633 heightStep = 40; 5634 } else if (mediaSource === 'media-sm' || mediaSource === 'media-xs') { 5635 heightStep = 60; 5636 } 5637 } 5638 } 5639 5640 // ÐаблÑдаÑÐµÐ»Ñ Ð·Ð° изменениÑми аÑÑибÑÑа data-media-source 5641 const observer = new MutationObserver(updateHeightStep); 5642 5643 // ÐаÑало наблÑÐ´ÐµÐ½Ð¸Ñ Ð·Ð° ÑлеменÑом 5644 const decorWrap = document.querySelector('.decor-wrap'); 5645 if (decorWrap) { 5646 observer.observe(decorWrap, { 5647 attributes: true, // ÐаблÑдаем за изменениÑми аÑÑибÑÑов 5648 attributeFilter: ['data-media-source'] // ФилÑÑÑÑем ÑолÑко Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ Ð°ÑÑибÑÑа data-media-source 5649 }); 5650 } 5651 5652 // ÐÑзов ÑÑнкÑии Ð´Ð»Ñ Ð¿ÐµÑвонаÑалÑной ÑÑÑановки знаÑÐµÐ½Ð¸Ñ 5653 updateHeightStep(); 5654 5655 5656 5657 5658 let heightStepArr = [heightStep, heightStep - 10, heightStep - 20, heightStep - 30] 5659 5660 5661 //console.log(heightStepArr) 5662 5663 5664 5665 let listNewWidth = blockParentWidth; 5666 5667 let windowHeight = document.documentElement.clientHeight; 5668 5669 let topStagePercent = 0; 5670 5671 let debounceTimer; 5672 5673 window.addEventListener('scroll', function(event){ 5674 clearTimeout(debounceTimer); 5675 5676 debounceTimer = setTimeout(function () { 5677 updateListWidth() 5678 }, 5); 5679 }) 5680 5681 updateListWidth() 5682 5683 function updateListWidth() { 5684 topStagePercent = Math.round(list.getBoundingClientRect().top / windowHeight * 100); 5685 5686 //console.log(topStagePercent); 5687 5688 if(inner.classList.contains('_rotate_left')){ 5689 5690 if(topStagePercent < heightStepArr[0] && topStagePercent >= heightStepArr[1]){ 5691 list.style.width = listNewWidth + (listStageWidth / 4) + 'px'; 5692 inner.style.transform = 'rotate(-' + 1 + 'deg)'; 5693 5694 } else if (topStagePercent < heightStepArr[1] && topStagePercent >= heightStepArr[2]) { 5695 list.style.width = listNewWidth + (listStageWidth / 2) + 'px'; 5696 inner.style.transform = 'rotate(-' + 2 + 'deg)'; 5697 5698 } else if (topStagePercent < heightStepArr[2] && topStagePercent >= heightStepArr[3]) { 5699 list.style.width = listNewWidth + (listStageWidth / 4 * 3) + 'px'; 5700 inner.style.transform = 'rotate(-' + 3 + 'deg)'; 5701 5702 } else if (topStagePercent < heightStepArr[3]) { 5703 list.style.width = listNewWidth + listStageWidth + 'px'; 5704 inner.style.transform = 'rotate(-' + 4 + 'deg)'; 5705 5706 } else { 5707 listNewWidth = blockParentWidth 5708 list.style.width = listNewWidth + 'px'; 5709 inner.style.transform = 'rotate(' + 0 + 'deg)'; 5710 5711 } 5712 5713 } else if(inner.classList.contains('_rotate_right')){ 5714 5715 if(topStagePercent < heightStepArr[0] && topStagePercent >= heightStepArr[1]){ 5716 list.style.width = listNewWidth + (listStageWidth / 4) + 'px'; 5717 inner.style.transform = 'rotate(' + 1 + 'deg)'; 5718 5719 } else if (topStagePercent < heightStepArr[1] && topStagePercent >= heightStepArr[2]) { 5720 list.style.width = listNewWidth + (listStageWidth / 2) + 'px'; 5721 inner.style.transform = 'rotate(' + 2 + 'deg)'; 5722 5723 } else if (topStagePercent < heightStepArr[2] && topStagePercent >= heightStepArr[3]) { 5724 list.style.width = listNewWidth + (listStageWidth / 4 * 3) + 'px'; 5725 inner.style.transform = 'rotate(' + 3 + 'deg)'; 5726 5727 } else if (topStagePercent < heightStepArr[3]) { 5728 list.style.width = listNewWidth + listStageWidth + 'px'; 5729 inner.style.transform = 'rotate(' + 4 + 'deg)'; 5730 5731 } else { 5732 listNewWidth = blockParentWidth 5733 list.style.width = listNewWidth + 'px'; 5734 inner.style.transform = 'rotate(' + 0 + 'deg)'; 5735 5736 } 5737 5738 } else { 5739 5740 //console.log(listNewWidth) 5741 5742 if(topStagePercent < heightStepArr[0] && topStagePercent >= heightStepArr[1]){ 5743 list.style.width = listNewWidth + (listStageWidth / 4) + 'px'; 5744 5745 } else if (topStagePercent < heightStepArr[1] && topStagePercent >= heightStepArr[2]) { 5746 list.style.width = listNewWidth + (listStageWidth / 2) + 'px'; 5747 5748 } else if (topStagePercent < heightStepArr[2] && topStagePercent >= heightStepArr[3]) { 5749 list.style.width = listNewWidth + (listStageWidth / 4 * 3) + 'px'; 5750 5751 } else if (topStagePercent < heightStepArr[3]) { 5752 list.style.width = listNewWidth + listStageWidth + 'px'; 5753 5754 } else { 5755 listNewWidth = blockParentWidth 5756 list.style.width = listNewWidth + 'px'; 5757 5758 } 5759 5760 } 5761 } 5762 5763 } 5764 5765 5766 if (s3LP.is_cms) { 5767 if(document.querySelector($imgInit)){ 5768 5769 document.addEventListener('lpcLoadingDone', function(){ 5770 flexibleImage($imgInit); 5771 }); 5772 5773 setTimeout(function(){ 5774 flexibleImage($imgInit); 5775 }, 1000) 5776 5777 } 5778 5779 }else{ 5780 document.addEventListener('lpc_init_after', function () { 5781 5782 let lpc_block = document.querySelector($imgInit); 5783 5784 if (lpc_block) { 5785 let observer = new IntersectionObserver((entries, observer) => {
5786 entries.forEach(entry => { 5787 if (entry.isIntersecting) { 5788 flexibleImage($imgInit); 5789 observer.unobserve(entry.target); // ÐÑÑановиÑÑ Ð½Ð°Ð±Ð»Ñдение поÑле пеÑвого поÑÐ²Ð»ÐµÐ½Ð¸Ñ 5790 } 5791 }); 5792 }, { threshold: 0.1 }); // ÐапÑÑкаÑÑ, когда Ñ Ð¾ÑÑ Ð±Ñ 10% блока в зоне видимоÑÑи 5793 5794 observer.observe(lpc_block); 5795 } 5796 }); 5797 5798 // ÐÑÑлеживание Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ ÑазмеÑа окна 5799 let currentWidth = window.innerWidth; 5800 5801 window.addEventListener('resize', function () { 5802 5803 setTimeout(function(){ 5804 if (window.innerWidth !== currentWidth) { 5805 currentWidth = window.innerWidth; 5806 let lpc_block = document.querySelector($imgInit); 5807 5808 if (lpc_block) { 5809 let observer = new IntersectionObserver((entries, observer) => { 5810 entries.forEach(entry => { 5811 if (entry.isIntersecting) { 5812 flexibleImage($imgInit); 5813 observer.unobserve(entry.target); // ÐÑÑановиÑÑ Ð½Ð°Ð±Ð»Ñдение поÑле пеÑвого поÑÐ²Ð»ÐµÐ½Ð¸Ñ 5814 } 5815 }); 5816 }, { threshold: 0.1 }); 5817 5818 observer.observe(lpc_block); 5819 } 5820 } 5821 }, 500) 5822 5823 }, true); 5824 5825 } 5826 }); 5827 } 5828 /*}*/ 5829 } 5830 5831 lp_template.queue.lpStepForm = function($self) { 5832 var $block = $self.find('.js-lp-steps-form'); 5833 5834 if ($block.length) { 5835 $block.formsteps(); 5836 } 5837 } 5838 5839 lp_template.queue.qaSlider1 = function($self) { 5840 var $block = $self.find('.js-qa-slider-1'); 5841 5842 if ($block.length) { 5843 $block.each(function(){ 5844 var $this = $(this), 5845 autoplay = !!$this.data('autoplay'), 5846 count = $this.data('count') || 2, 5847 loop = !!$this.data('infinite'), 5848 nav = !!$this.data('arrows'), 5849 dots = !!$this.data('dots'), 5850 pause = $this.data('pause') || 5000, 5851 speed = $this.data('speed') || 250, 5852 $parent = $this.closest('[data-block-layout]'), 5853 rewind = false, 5854 $dots = $parent.find('.js-dot-item'); 5855 5856 if(s3LP.is_cms){ 5857 var loop = false, 5858 $rewind = true, 5859 autoplay = false; 5860 } 5861 else if(typeof ReactLPConstructor == 'object') { 5862 var loop = false, 5863 $rewund = true, 5864 autoplay = false; 5865 } 5866 5867 $this.owlCarousel({ 5868 autoplay : autoplay, 5869 loop : loop, 5870 nav : nav, 5871 dots : true, 5872 rewind: $rewind, 5873 smartSpeed: speed, 5874 autoplayTimeout: pause, 5875 responsive:{ 5876 0: { 5877 items : 1, 5878 margin : 0 5879 }, 5880 960: { 5881 items: count, 5882 margin : count > 1 ? 48 : 0 5883 }, 5884 1200: { 5885 items: count, 5886 margin : count > 1 ? 24 : 0 5887 }, 5888 1380: { 5889 items: count, 5890 margin : count > 1 ? 32 : 0 5891 } 5892 }, 5893 onInitialized: function() { 5894 $dots.eq(0).addClass('active') 5895 }, 5896 onTranslated: function(e) { 5897 $dots.removeClass('active'); 5898 } 5899 }); 5900 5901 $parent.on('click', '.js-next-slide', function(e) { 5902 e.preventDefault(); 5903 $this.trigger('next.owl.carousel'); 5904 }); 5905 5906 $parent.on('click', '.js-prev-slide', function(e) { 5907 e.preventDefault(); 5908 $this.trigger('prev.owl.carousel'); 5909 }); 5910 5911 $parent.on('click', '.js-dot-item', function(e) { 5912 e.preventDefault(); 5913 $this.trigger('to.owl.carousel', [$(this).index()]); 5914 }); 5915 5916 }); 5917 } 5918 } 5919 5920 lp_template.queue.simpleSlider = function ($self) { 5921 var $block = $self.find('.js-simple-slider'); 5922 5923 if ($block.length) { 5924 $block.each(function () { 5925 var $this = $(this), 5926 autoplay = !!$this.data('autoplay'), 5927 loop = !!$this.data('infinite'), 5928 autoWidth = !!$this.data('autowidth'), 5929 center = !!$this.data('center'), 5930 nav = !!$this.data('arrows'), 5931 dotsEach = !!$this.data('dots-each'), 5932 dots = 1, 5933 $rewind = 0, 5934 pause = $this.data('pause') || 5000, 5935 speed = $this.data('speed') || 250, 5936 fade = !!$this.data('fade'), 5937 drag = $this.data('drag'), 5938 parentSelector = $this.data('parent') ? $this.data('parent') : '[data-block-layout]', 5939 $parent = $this.closest(parentSelector), 5940 dataResponse = $this.data('response'), 5941 response = {}, 5942 $dots = $parent.find('.lp-dots-wrapper'); 5943 5944 if (typeof drag === "undefined") { 5945 drag = 1; 5946 } 5947 5948 if(s3LP.is_cms){ 5949 var loop = false, 5950 $rewind = true, 5951 autoplay = false;
5952 } 5953 else if(typeof ReactLPConstructor == 'object') { 5954 var loop = false, 5955 $rewind = true, 5956 autoplay = false; 5957 5958 } 5959 5960 response.responsive = dataResponse || {}; 5961 if ($this.parents('[data-elem-type="block"]').find('.js-lg-init').length) { 5962 setTimeout(function () { 5963 initSlider() 5964 }, 500); 5965 } else { 5966 initSlider() 5967 }; 5968 5969 5970 function initSlider() { 5971 $this.owlCarousel($.extend({ 5972 items: 1, 5973 autoplay: autoplay, 5974 loop: loop, 5975 autoWidth: autoWidth, 5976 center: center, 5977 nav: nav, 5978 dots: true, 5979 rewind: $rewind, 5980 dotsEach: dotsEach, 5981 animateIn: fade ? 'fadeIn' : false, 5982 animateOut: fade ? 'fadeOut' : false, 5983 smartSpeed: speed, 5984 touchDrag: s3LP.is_cms ? false : true, 5985 mouseDrag: drag, 5986 autoplayTimeout: pause, 5987 onInitialized: function (e) { 5988 var $dotsCount = $parent.find('.owl-dot').length; 5989 5990 if (!$dots.length || $dotsCount < 2) { 5991 $dots.html(''); 5992 5993 if (!$dots.length && $dotsCount < 2) { 5994 $parent.find('.js-next-slide, .js-prev-slide').addClass('_hide'); 5995 } 5996 return; 5997 }; 5998 var $dotsHTML = ''; 5999 6000 for (var i = 0; i < $dotsCount; i++) { 6001 $dotsHTML += '<div class="lp-dots-item js-dot-item" data-elem-type="container" data-lp-selector=".lp-dots-item"></div>'; 6002 } 6003 6004 if (!$dots.hasClass('_unchanged')) { 6005 6006 $dots.html($dotsHTML); 6007 6008 } 6009 6010 $dots.find('.lp-dots-item').eq(0).addClass('active'); 6011 6012 }, 6013 6014 onResized: function (e) { 6015 if (!$dots.length || e.page.count < 2) { 6016 $dots.html(''); 6017 $parent.find('.js-next-slide, .js-prev-slide').addClass('_hide'); 6018 $parent.find('.js-next-slide, .js-prev-slide').removeClass('_show'); 6019 return; 6020 } else { 6021 $parent.find('.js-next-slide, .js-prev-slide').addClass('_show'); 6022 $parent.find('.js-next-slide, .js-prev-slide').removeClass('_hide'); 6023 } 6024 6025 var $dotsHTML = ''; 6026 for (var i = 0; i < e.page.count; i++) { 6027 $dotsHTML += '<div class="lp-dots-item js-dot-item" data-elem-type="container" data-lp-selector=".lp-dots-item"></div>'; 6028 } 6029 6030 if (!$dots.hasClass('_unchanged')) { 6031 $dots.html($dotsHTML); 6032 } 6033 $dots.find('.lp-dots-item').removeClass('active'); 6034 $dots.find('.lp-dots-item').eq(e.page.index).addClass('active'); 6035 }, 6036 onTranslate: function (e) { 6037 $dots.find('.lp-dots-item').removeClass('active'); 6038 $dots.find('.lp-dots-item').eq(e.page.index).addClass('active'); 6039 } 6040 }, response)); 6041 6042 if (autoplay) { 6043 $this.on('mousedown', function(event) { 6044 if (event.which === 1) { 6045 $this.trigger('stop.owl.autoplay'); 6046 } 6047 }); 6048 6049 $this.on('mouseup', function(event) { 6050 if (event.which === 1) { 6051 $this.trigger('play.owl.autoplay'); 6052 } 6053 }); 6054 } 6055 6056 $parent.on('click', '.js-next-slide', function (e) { 6057 e.preventDefault(); 6058 $this.trigger('next.owl.carousel'); 6059 }); 6060 6061 $parent.on('click', '.js-prev-slide', function (e) { 6062 e.preventDefault(); 6063 $this.trigger('prev.owl.carousel'); 6064 }); 6065 6066 $parent.on('click', '.js-dot-item', function (e) { 6067 e.preventDefault(); 6068 $this.trigger('to.owl.carousel', [$(this).index()]); 6069 }); 6070 6071 if (s3LP.is_cms) { 6072 setTimeout(function () { 6073 if (typeof LpController !== 'undefined') { 6074 LpController.afterSave(function () { 6075 setTimeout(function () { 6076 $this.trigger('refresh.owl.carousel'); 6077 }, 500); 6078 }); 6079 } 6080 $this.trigger('refresh.owl.carousel'); 6081 }, 3000); 6082 } 6083 6084 $win.on('load', function () { 6085 setTimeout(function () { 6086 $this.trigger('refresh.owl.carousel'); 6087 6088 if ($this.hasClass('js-lg-init')) { 6089 $this.data('lightGallery').destroy(true); 6090 $this.lightGallery({ 6091 selector: '.owl-item:not(.cloned) .lg-item', 6092 share: false, 6093 hash: false, 6094 autoplayControls: false, 6095 actualSize: false, 6096 toogleThumb: false, 6097 getCaptionFromTitleOrAlt: false, 6098 download: false, 6099 thumbWidth: 64,
6100 thumbHeight: '64px', 6101 nextHtml: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.98528 4.32805C9.3758 3.93753 10.009 3.93753 10.3995 4.32805L17.0563 10.9849C17.4469 11.3754 17.4469 12.0086 17.0563 12.3991L10.3995 19.056C10.009 19.4465 9.3758 19.4465 8.98528 19.056C8.59475 18.6654 8.59475 18.0323 8.98528 17.6418L14.935 11.692L8.98528 5.74226C8.59475 5.35174 8.59475 4.71857 8.98528 4.32805Z" fill="white"/></svg>', 6102 prevHtml: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14.8492 5.03516L8.19239 11.692L14.8492 18.3489" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>' 6103 }); 6104 } 6105 }, 500); 6106 }); 6107 } 6108 6109 }); 6110 } 6111 6112 if ($block.hasClass('lp-video-9-slides-wrapp')) { 6113 $('.lp-video-9-slides-wrapp').on('changed.owl.carousel', function (event) { 6114 $('.lp-video-9-slides-wrapp video').trigger('pause'); 6115 $('.lp-video-9-slides-wrapp ._lp-youtube-video').each(function () { 6116 var el_src = $(this).attr("src"); 6117 $(this).attr("src", el_src); 6118 }); 6119 }) 6120 } 6121 } 6122 6123 lp_template.queue.adv17HalfHeight = function($self) { 6124 var $block = $self.find('.js-advantages-17'); 6125 6126 $block.each(function(){ 6127 var $this = $(this); 6128 6129 6130 $(window).on('resize', function(){ 6131 calcMargin($this); 6132 }); 6133 }); 6134 6135 function calcMargin(e) { 6136 var itemHalfHeight = e.parent().find('.lp-advantages-17__item').eq(0).outerHeight() / 2; 6137 6138 e.css({ 6139 paddingBottom: itemHalfHeight, 6140 marginBottom: -itemHalfHeight 6141 }); 6142 }; 6143 } 6144 6145 lp_template.queue.video13 = function($self) { 6146 var $block = $self.find('.js-video-13'); 6147 6148 $block.each(function(){ 6149 var $this = $(this); 6150 6151 6152 $(window).on('resize', function(){ 6153 calcMargin($this); 6154 }); 6155 }); 6156 6157 function calcMargin(e) { 6158 var itemHeight = e.parent().find('.lp-video-13__item-video').eq(0).outerHeight(); 6159 6160 e.css({ 6161 paddingBottom: itemHeight, 6162 marginBottom: -itemHeight 6163 }); 6164 }; 6165 } 6166 6167 lp_template.queue.header15Popup = function($self) { 6168 var $block = $self.find('.lp-header-15'); 6169 $block.find('.js-burger').on('click', function(){ 6170 $(this).closest('.lp-wrapp').find('.js-menu__wrap').fadeIn().addClass('opened'); 6171 $('body').css('overflow', 'hidden'); 6172 }); 6173 $block.find('.js-close, .js-bg').on('click', function(){ 6174 $(this).closest('.lp-wrapp').find('.js-menu__wrap').removeClass('opened').fadeOut(); 6175 $('body').css('overflow','visible'); 6176 }); 6177 6178 $block.find('.js-menu a').on('click', function(){ 6179 setTimeout(function(){ 6180 $block.find('.js-menu__wrap').removeClass('opened').fadeOut(); 6181 $('body').css('overflow','visible'); 6182 },300); 6183 }); 6184 6185 $(document).keyup(function(e) { 6186 if (e.key === "Escape") { // escape key maps to keycode '27' 6187 $block.find('.js-menu__wrap.opened').removeClass('opened').fadeOut(); 6188 $('body').css('overflow','visible'); 6189 } 6190 }); 6191 } 6192 6193 lp_template.queue.lpTriggerPopupBlock = function ($self) { 6194 var $block = $self.find("[data-popup-type]"); 6195 6196 if($block.length){ 6197 document.addEventListener('lpcTriggerPopupInitDone', function(){ 6198 lp_template.popupAdaptiveBlock(); 6199 }); 6200 } 6201 }; 6202 6203 lp_template.queue.lpTimer = function($self) { 6204 var $block = $self.find('.js-lp-timer'), 6205 htmlLang = document.documentElement.lang, 6206 timerDays, timerHours, timerMinutes, timerSeconds, formatOut; 6207 6208 if (htmlLang == 'de' || htmlLang == 'en') { 6209 timerDays = 'days'; 6210 timerHours = 'hours'; 6211 timerMinutes = 'minutes'; 6212 timerSeconds = 'seconds' 6213 } else { 6214 timerDays = 'Ðней'; 6215 timerHours = 'ЧаÑов'; 6216 timerMinutes = 'ÐинÑÑ'; 6217 timerSeconds = 'СекÑнд' 6218 } 6219 6220 var formatOut = '<div class="lp-ui-timer__item"><div class="lp-ui-timer__item-number" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-number">%d</div><div class="lp-ui-timer__item-text lp-header-text-4" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-text">' + timerDays + '</div></div><div class="lp-ui-timer__item"><div class="lp-ui-timer__item-number" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-number">%h</div><div class="lp-ui-timer__item-text lp-header-text-4" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-text">' + timerHours + '</div></div><div class="lp-ui-timer__item"><div class="lp-ui-timer__item-number" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-number">%m</div><div class="lp-ui-timer__item-text lp-header-text-4" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-text">' + timerMinutes + '</div></div><div class="lp-ui-timer__item"><div class="lp-ui-timer__item-number" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-number">%s</div><div class="lp-ui-timer__item-text lp-header-text-4" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-text">' + timerSeconds +'</div></div>'; 6221 var formatEnd = '<div class="lp-ui-timer__item"><div class="lp-ui-timer__item-number" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-number">00</div><div class="lp-ui-timer__item-text lp-header-text-4" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-text">' + timerDays + '</div></div><div class="lp-ui-timer__item"><div class="lp-ui-timer__item-number" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-number">00</div><div class="lp-ui-timer__item-text lp-header-text-4" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-text">' + timerHours + '</div></div><div class="lp-ui-timer__item"><div class="lp-ui-timer__item-number" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-number">00</div><div class="lp-ui-timer__item-text lp-header-text-4" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-text">' + timerMinutes + '</div></div><div class="lp-ui-timer__item"><div class="lp-ui-timer__item-number" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-number">00</div><div class="lp-ui-timer__item-text lp-header-text-4" data-elem-type="text" data-lp-selector=".lp-ui-timer__item-text">' + timerSeconds +'</div></div>'; 6222 6223 6224 6225 if ($block.length) { 6226 $block.each(function(){ 6227 var $this = $(this); 6228 6229 $this.timer({ 6230 format_in: "%d.%M.%y %h:%m:%s", 6231 language: htmlLang, 6232 update_time: s3LP.is_cms ? 100000 : 1000, 6233 format_out: formatOut, 6234 onEnd: function(){ 6235 $this.html(formatEnd); 6236 } 6237 }) 6238 }); 6239 } 6240 } 6241 6242 lp_template.queue.fixedSocialsBox = function ($self) { 6243 6244 const $block = $self.find('.fixed-socials-init'); 6245 if (!$block.length) return; 6246 6247 $block.each(function () { 6248 6249 let $box = $(this); 6250 let $fixedBlock = $box.find('.lp-fixed-socials-box'); 6251 let $container = $box.find('.lp-fixed-socials-box__container'); 6252 let $button = $box.find('.lp-fixed-socials-box__button'); 6253 let $mosaicWrap = $('.mosaic-wrap'); 6254 6255 let offsetDesktop = $fixedBlock.data('lp-offset') || 0; 6256 let offsetMobile = $fixedBlock.data('lp-offset-mobile') || 0; 6257 6258 let offset = (typeof isMobile !== 'undefined' && isMobile) ? offsetMobile : offsetDesktop; 6259 6260 $fixedBlock.css({ 6261 top: '', 6262 bottom: '', 6263 transform: '' 6264 }); 6265 6266 if ($fixedBlock.hasClass('lp_middle')) { // middle 6267 $fixedBlock.css({ 6268 top: '50%', 6269 transform: 'translateY(-50%)' 6270 }); 6271 }else if ($fixedBlock.hasClass('lp_bottom')) { // bottom 6272 $fixedBlock.css('bottom', offset + 'px'); 6273 }else { // top 6274 $fixedBlock.css('top', offset + 'px'); 6275 } 6276 6277 if ($mosaicWrap.length && !$box.hasClass('lp_constructor')) { 6278 $mosaicWrap.prepend($fixedBlock); 6279 } 6280 6281 $button.on('click', function (e) { 6282 e.stopPropagation(); 6283 const isOpen = $container.hasClass('is-open'); 6284 6285 $('.lp-fixed-socials-box__container.is-open') 6286 .not($container) 6287 .removeClass('is-open'); 6288 6289 $container.toggleClass('is-open', !isOpen); 6290 }); 6291 }); 6292 6293 $(document).off('click.fixedSocials').on('click.fixedSocials', function (e) { 6294 if (!$(e.target).closest('.lp-fixed-socials-box__container').length) { 6295 $('.lp-fixed-socials-box__container').removeClass('is-open'); 6296 } 6297 }); 6298 }; 6299 6300 lp_template.queue.popupFormHiddenInput = function ($self) { 6301 if($doc.find("[data-alias='product_name']" && $doc.find("[data-form-hide-input]"))){ 6302 $doc.on("click", function (e) { 6303 6304 if($(e.target).closest('.lp-popup-hide-input-check').length) { 6305 var $this = $(this), 6306 prodName = $(e.target).closest('.lp-product-name').find('[data-name-product]').data('name-product'); 6307 6308 $('.lp-popup-wrapper form input[data-alias=product_name]').val(prodName); 6309 } 6310 }); 6311 } 6312 $('a[href^="popup:"]').on('click', function (){ 6313 setTimeout(function() { 6314 if ($('.lp-popup-wrapper form').find('input[data-alias=product_name]').val() == ""){ 6315 $('.lp-popup-wrapper form').find('input[data-alias=product_name]').val("ФоÑма"); 6316 } 6317 }, 180); 6318 }); 6319 }; 6320 6321 /*lp_template.queue.menu11Popup = function($self) { 6322 var $block = $self.hasClass('lp-menu-11') ? $self : $self.find('.lp-menu-11'); 6323 6324 $($block).append('<div class="lp-menu-block-bg"></div>'); 6325 6326 if (!$block.length) return; 6327 6328 $block.each(function(){ 6329 var $this = $(this), 6330 contactsMobile = true, 6331 mobile = true; 6332 6333 $(window).on('resize', function(){ 6334 contactsMobile = contactsPend($this, contactsMobile); 6335 mobile = menuPend($this, mobile); 6336 }); 6337 }) 6338 6339 function contactsPend($block, bool) { 6340 6341 if (window.matchMedia('(max-width : 599px)').matches && !bool) { 6342 $block.find('.lp-menu-11__top').appendTo($block.find('.lp-menu-11__popup .lp-menu-11__menu_inner')); 6343 return true; 6344 } 6345 else if (window.matchMedia('(min-width : 600px)').matches && bool) { 6346 $block.find('.lp-menu-11__top').prependTo($block.find('.lp-menu-11-wrap_top .lp-wrapp')); 6347 return false;
6348 } 6349 6350 return bool; 6351 } 6352 6353 function menuPend($block, bool) { 6354 if (window.matchMedia('(max-width : 959px)').matches && !bool) { 6355 $block.find('.js-menu_appedable').prependTo($block.find('.lp-menu-11__popup')); 6356 $block.find('.lp-menu-11__burger').show().css('display', 'flex'); 6357 return true; 6358 } 6359 else if (window.matchMedia('(min-width : 960px)').matches && bool) { 6360 $block.find('.lp-menu-11__logo').after($block.find('.js-menu_appedable')); 6361 return false; 6362 } 6363 6364 return bool; 6365 } 6366 6367 6368 var $popup = $block.find('.js-popup'), 6369 popupHeight = $(window).height() - $block.height(), 6370 menuHeight = $block.outerHeight(), 6371 popupTop = menuHeight < 0 ? 0 : menuHeight, 6372 popupTop = s3LP.is_cms ? popupTop + 72 : popupTop, 6373 $bgTop = $block.height() + 50 < 0 ? 0 : $block.height() + 50, 6374 $bgTop = s3LP.is_cms ? $bgTop + 72 : $bgTop; 6375 6376 $block.find('.lp-menu-block-bg').css({top: $bgTop}); 6377 6378 $popup.css({top: popupTop}); 6379 6380 6381 $block.find('.js-burger').on('click', function(){ 6382 if ($(this).hasClass('_in-side')) { 6383 $popup.animate({top: 0}, 200); 6384 $block.find('.lp-menu-block-bg').css('top', 0); 6385 } 6386 if (!$(this).hasClass('_in-side')) { 6387 if (s3LP.is_cms) { 6388 $('html, body').animate({ 6389 scrollTop: $block.offset().top - 72 6390 }, 200); 6391 } 6392 else { 6393 $('html, body').animate({ 6394 scrollTop: $block.offset().top 6395 }, 200); 6396 } 6397 } 6398 6399 $popup.css('overflow', 'auto'); 6400 6401 $block.find('.js-burger').toggleClass('opened'); 6402 if ($(this).closest('.lp-menu-11').find('.js-popup').hasClass('opened')) { 6403 $(this).closest('.lp-menu-11').find('.js-popup').animate({height: "0%"}, 300, 6404 function() { 6405 $block.css('z-index', ''); 6406 } 6407 ).removeClass('opened'); 6408 $block.find('.lp-menu-block-bg').fadeOut(300); 6409 6410 $('html').css('overflow', ''); 6411 if (s3LP.is_cms) { 6412 $('html').css('overflow', ''); 6413 } 6414 } 6415 else { 6416 $(this).closest('.lp-menu-11').find('.js-popup').animate({height: popupHeight}, 800).addClass('opened'); 6417 $block.find('.lp-menu-block-bg').fadeIn(800); 6418 $block.css('z-index', '30'); 6419 $('html').css('overflow', 'hidden'); 6420 if (s3LP.is_cms) { 6421 $('html').css('overflow', 'hidden'); 6422 } 6423 } 6424 6425 }); 6426 6427 $(document).on('click', function(e) { 6428 if(!$(e.target).closest('.lp-menu-11__popup, .lp-menu-11-button, .lp-block-menu-12__btn, .lp-block-menu-12__menu-in, .lp-menu-21__popup, .lp-menu-21-button').not(this).length){ 6429 $(this).find('.js-popup').animate({height: "0%"}, 300, 6430 function() { 6431 $block.css('z-index', ''); 6432 } 6433 ).removeClass('opened'); 6434 $(this).find('.lp-menu-block-bg').fadeOut(300); 6435 $block.find('.js-burger').removeClass('opened'); 6436 $('html').css('overflow', ''); 6437 if (s3LP.is_cms) { 6438 $('html').css('overflow', ''); 6439 } 6440 } 6441 }); 6442 6443 $block.find('.lp-menu-11__menu__link').on('click', function(){ 6444 $block.find('.js-burger').toggleClass('opened'); 6445 $popup.animate({height: "0%"}, 100, 6446 function() { 6447 $block.css('z-index', ''); 6448 } 6449 ).removeClass('opened'); 6450 $block.find('.lp-menu-block-bg').fadeOut(800); 6451 $('html').css('overflow', ''); 6452 }); 6453 6454 $(window).on('resize', function(){ 6455 var $ulWidth = 0, 6456 $ulWrapWidth = $block.find('.lp-menu-11__bot').innerWidth() - ($block.find('.lp-menu-11__logo').width() + $block.find('.lp-menu-11__right').outerWidth(true)); 6457 $('li.lp-menu-11__menu__list-item').each(function(){ 6458 var $width = $(this).outerWidth(true); 6459 $ulWidth += $width; 6460 }); 6461 if (window.matchMedia('(min-width : 961px)').matches && ($ulWidth > $ulWrapWidth)) { 6462 $block.find('.js-menu_appedable').prependTo('.lp-menu-11__popup'); 6463 $block.find('.lp-menu-11__burger').show().css('display', 'flex'); 6464 } 6465 else if (window.matchMedia('(min-width : 961px)').matches && ($ulWidth < $ulWrapWidth)) { 6466 $block.find('.lp-menu-11__logo').after($block.find('.js-menu_appedable')); 6467 $block.find('.lp-menu-11__burger').hide(); 6468 } 6469 6470 6471 6472 menuHeight = $block.outerHeight(), 6473 popupTop = menuHeight < 0 ? 0 : menuHeight, 6474 popupTop = s3LP.is_cms ? popupTop + 72 : popupTop, 6475 $bgTop = $block.height() + 50 < 0 ? 0 : $block.height() + 50, 6476 $bgTop = s3LP.is_cms ? $bgTop + 72 : $bgTop; 6477 6478 $popup.animate({top: popupTop}); 6479 6480 $block.find('.lp-menu-block-bg').css('top', $bgTop); 6481 }); 6482 }*/ 6483 lp_template.queue.menu11Popup = function($self) { 6484 6485 var $blocks = $self.hasClass('lp-menu-11') ? $self : $self.find('.lp-menu-11'); 6486 6487 if (!$blocks.length) return; 6488 6489 $blocks.each(function() { 6490 var $block = $(this); 6491 6492 // ÐобавлÑем Ñон, еÑли его еÑÑ Ð½ÐµÑ 6493 if (!$block.find('.lp-menu-block-bg').length) { 6494 $block.append('<div class="lp-menu-block-bg"></div>'); 6495 } 6496 6497 var contactsMobile = true; 6498 var mobile = true; 6499 6500 // ФÑнкÑии адапÑаÑии (пеÑедаÑм конкÑеÑнÑй $block) 6501 function contactsPend($b, bool) { 6502 if (window.matchMedia('(max-width: 599px)').matches && !bool) {
6503 $b.find('.lp-menu-11__top') 6504 .appendTo($b.find('.lp-menu-11__popup .lp-menu-11__menu_inner')); 6505 return true; 6506 } 6507 else if (window.matchMedia('(min-width: 600px)').matches && bool) { 6508 $b.find('.lp-menu-11__top') 6509 .prependTo($b.find('.lp-menu-11-wrap_top .lp-wrapp')); 6510 return false; 6511 } 6512 return bool; 6513 } 6514 6515 function menuPend($b, bool) { 6516 if (window.matchMedia('(max-width: 959px)').matches && !bool) { 6517 $b.find('.js-menu_appedable') 6518 .prependTo($b.find('.lp-menu-11__popup')); 6519 $b.find('.lp-menu-11__burger') 6520 .show().css('display', 'flex'); 6521 return true; 6522 } 6523 else if (window.matchMedia('(min-width: 960px)').matches && bool) { 6524 $b.find('.js-menu_appedable') 6525 .insertAfter($b.find('.lp-menu-11__logo')); 6526 return false; 6527 } 6528 return bool; 6529 } 6530 6531 // ÐеÑвиÑÐ½Ð°Ñ Ð¸Ð½Ð¸ÑиализаÑÐ¸Ñ 6532 contactsMobile = contactsPend($block, contactsMobile); 6533 mobile = menuPend($block, mobile); 6534 6535 // ÐеÑеменнÑе Ð´Ð»Ñ Ð¿Ð¾Ð¿Ð°Ð¿Ð° 6536 var $popup = $block.find('.js-popup'); 6537 var popupHeight = $(window).height() - $block.height(); 6538 var menuHeight = $block.outerHeight(); 6539 var popupTop = Math.max(menuHeight, 0); 6540 popupTop = s3LP.is_cms ? popupTop + 72 : popupTop; 6541 6542 var bgTop = Math.max($block.height() + 50, 0); 6543 bgTop = s3LP.is_cms ? bgTop + 72 : bgTop; 6544 6545 $block.find('.lp-menu-block-bg').css({ top: bgTop }); 6546 $popup.css({ top: popupTop }); 6547 6548 // ÐбÑабоÑÑик бÑÑгеÑа â пÑивÑзÑваем к ÐºÐ°Ð¶Ð´Ð¾Ð¼Ñ Ð±Ð»Ð¾ÐºÑ Ð¾ÑделÑно 6549 $block.find('.js-burger').on('click', function() { 6550 var $thisBurger = $(this); 6551 var $currentPopup = $block.find('.js-popup'); 6552 6553 $currentPopup.css('overflow', 'auto'); 6554 6555 if ($currentPopup.hasClass('opened')) { 6556 // закÑÑваем 6557 $currentPopup.animate({ height: "0%" }, 300, function() { 6558 $block.css('z-index', ''); 6559 }).removeClass('opened'); 6560 6561 $block.find('.lp-menu-block-bg').fadeOut(300); 6562 $thisBurger.removeClass('opened'); 6563 $('html').css('overflow', ''); 6564 } else { 6565 // оÑкÑÑваем 6566 if (!$thisBurger.hasClass('_in-side')) { 6567 $('html, body').animate({ 6568 scrollTop: $block.offset().top - (s3LP.is_cms ? 72 : 0) 6569 }, 200); 6570 } 6571 6572 $currentPopup.animate({ height: popupHeight }, 500) 6573 .addClass('opened'); 6574 6575 $block.find('.lp-menu-block-bg').fadeIn(400); 6576 $block.css('z-index', '30'); 6577 $thisBurger.addClass('opened'); 6578 $('html').css('overflow', 'hidden'); 6579 } 6580 }); 6581 6582 // ÐакÑÑÑие пÑи клике по ÑÑÑлке Ð¼ÐµÐ½Ñ 6583 $block.find('.lp-menu-11__menu__link').on('click', function() { 6584 $block.find('.js-burger').removeClass('opened'); 6585 $popup.animate({ height: "0%" }, 200, function() { 6586 $block.css('z-index', ''); 6587 }).removeClass('opened'); 6588 $block.find('.lp-menu-block-bg').fadeOut(300); 6589 $('html').css('overflow', ''); 6590 }); 6591 6592 // ÐбÑабоÑÑик ÑеÑайза â Ñоже внÑÑÑи, но Ñ ÑникалÑнÑм namespace 6593 $(window).on('resize.menu11-' + $block.index(), function() { 6594 contactsMobile = contactsPend($block, contactsMobile); 6595 mobile = menuPend($block, mobile); 6596 6597 // ÐеÑеÑÑÑÑ Ð¿Ð¾Ð·Ð¸Ñий 6598 var newPopupHeight = $(window).height() - $block.height(); 6599 var newMenuHeight = $block.outerHeight(); 6600 var newPopupTop = Math.max(newMenuHeight, 0); 6601 newPopupTop = s3LP.is_cms ? newPopupTop + 72 : newPopupTop; 6602 6603 var newBgTop = Math.max($block.height() + 50, 0); 6604 newBgTop = s3LP.is_cms ? newBgTop + 72 : newBgTop; 6605 6606 $popup.css({ top: newPopupTop }); 6607 $block.find('.lp-menu-block-bg').css({ top: newBgTop }); 6608 6609 // Ðогика Ñ ÑиÑиной пÑнкÑов Ð¼ÐµÐ½Ñ (еÑли вÑÑ ÐµÑÑ Ð½Ñжна) 6610 var $ulWidth = 0; 6611 var $ulWrapWidth = $block.find('.lp-menu-11__bot').innerWidth() - 6612 ($block.find('.lp-menu-11__logo').width() + 6613 $block.find('.lp-menu-11__right').outerWidth(true)); 6614 6615 $block.find('li.lp-menu-11__menu__list-item').each(function() { 6616 $ulWidth += $(this).outerWidth(true); 6617 }); 6618
6619 if (window.matchMedia('(min-width: 961px)').matches) { 6620 if ($ulWidth > $ulWrapWidth) { 6621 $block.find('.js-menu_appedable').prependTo($block.find('.lp-menu-11__popup')); 6622 $block.find('.lp-menu-11__burger').show().css('display', 'flex'); 6623 } else { 6624 $block.find('.js-menu_appedable').insertAfter($block.find('.lp-menu-11__logo')); 6625 $block.find('.lp-menu-11__burger').hide(); 6626 } 6627 } 6628 }); 6629 }); 6630 6631 // ÐлобалÑнÑй обÑабоÑÑик клика вне Ð¼ÐµÐ½Ñ â один на вÑÑ ÑÑÑаниÑÑ 6632 $(document).off('click.menu11-close').on('click.menu11-close', function(e) { 6633 if ($(e.target).closest('.lp-menu-11__popup, .js-burger, .lp-menu-11-button').length) { 6634 return; 6635 } 6636 6637 $('.lp-menu-11 .js-popup.opened').each(function() { 6638 var $popup = $(this); 6639 var $block = $popup.closest('.lp-menu-11'); 6640 6641 $popup.animate({ height: "0%" }, 300, function() { 6642 $block.css('z-index', ''); 6643 }).removeClass('opened'); 6644 6645 $block.find('.lp-menu-block-bg').fadeOut(300); 6646 $block.find('.js-burger').removeClass('opened'); 6647 $('html').css('overflow', ''); 6648 }); 6649 }); 6650 }; 6651 6652 lp_template.queue.lpMapsEditorInit = function ($self) { 6653 var $block = $self.find(".js-lp-simple-map"); 6654 6655 if(s3LP.is_cms){ 6656 $(document).ready(function() { 6657 if($block.hasClass('map-init')) { 6658 return; 6659 } 6660 if ($block.length) { 6661 setTimeout(function() { 6662 lp_template.initMaps($block); 6663 }, 200); 6664 } 6665 }); 6666 } 6667 } 6668 6669 lp_template.queue.lpReviews10Slider = function($self) { 6670 var $block = $self.hasClass('lp-reviews-10') ? $self : $self.find('.lp-reviews-10'); 6671 var $slider = $block.find('.js-review-10-slider'); 6672 if ($slider.length) { 6673 6674 $slider.each(function(){ 6675 6676 var $this = $(this); 6677 var $parent = $this.closest('[data-block-layout]'); 6678 var $arrows = $this.data('arrows'); 6679 var $dots = $this.data('dots'); 6680 var $autoplay = $this.data('autoplay'); 6681 var $infinite = $this.data('infinite'); 6682 var $autoplaySpeed = $this.data('autoplay-speed'); 6683 var $speed = $this.data('speed'); 6684 var $slide = $this.find('.lp-reviews-10-slider__slide'); 6685 6686 if(s3LP.is_cms){ 6687 var $infinite = false, 6688 $autoplay = false; 6689 } 6690 else if(typeof ReactLPConstructor == 'object') { 6691 var $infinite = false, 6692 $autoplay = false; 6693 } 6694 6695 // ÑÑо нÑжно Ð´Ð»Ñ Ñого, ÑÑÐ¾Ð±Ñ Ð¿Ð¾Ñледний Ñлайд вÑегда ÑоÑÑоÑл из 3 оÑзÑвов 6696 $slider.on('init', function(slick, currentSlide){ 6697 var slides = currentSlide.$slides; 6698 var lastChild = slides[slides.length - 1];//ÐоÑледний Ñлайд 6699 var children = lastChild.children; 6700 var emptyDivs = []; 6701 6702 if(slides.length > 1) { 6703 6704 for(var i = 0; i < children.length; i++) { 6705 if(children[i].childNodes.length < 1) { 6706 emptyDivs.push(children[i]); 6707 } 6708 } 6709 6710 for(var j = 0; j < emptyDivs.length; j++) { 6711 emptyDivs[j].appendChild($slide[j].cloneNode(true)); 6712 } 6713 } 6714 }); 6715 6716 $this.slick({ 6717 infinite: $infinite, 6718 mobileFirst: true, 6719 // fade:$fade, 6720 dots:$dots, 6721 autoplay: $autoplay, 6722 autoplaySpeed: $autoplaySpeed, 6723 speed: $speed, 6724 dotsClass:'lp-reviews-10-slider__dots', 6725 appendDots:$parent.find('.lp-reviews-10-slider__dots-block'), 6726 arrows:false, 6727 appendArrows:$parent.find('.lp-reviews-10-slider__arrows-block'), 6728 prevArrow:'<a href="#" data-elem-type="card_container" data-lp-selector=".lp-reviews-10-slider__arrows" class="lp-button lp-button--type-1 lp-reviews-10-slider__arrows lp-reviews-10-slider__arrows--left _v2-icon"><div class="_slider-arrows" data-elem-type="card_container" data-lp-selector="._slider-arrows-inner"><div class="_slider-arrows-inner"></div><div class="_slider-arrows-inner"></div></div></a>', 6729 nextArrow:'<a href="#" data-elem-type="card_container" data-lp-selector=".lp-reviews-10-slider__arrows" class="lp-button lp-button--type-1 lp-reviews-10-slider__arrows lp-reviews-10-slider__arrows--right _v2-icon"><div class="_slider-arrows reverse" data-elem-type="card_container" data-lp-selector="._slider-arrows-inner"><div class="_slider-arrows-inner"></div><div class="_slider-arrows-inner"></div></div></a>', 6730 responsive: [ 6731 { 6732 breakpoint: 599.9, 6733 settings: { 6734 arrows:$arrows 6735 } 6736 }, 6737 { 6738 breakpoint: 959.9, 6739 settings: { 6740 arrows:$arrows, 6741 slidesPerRow:1, 6742 rows:3 6743 6744 } 6745 } 6746 ] 6747 }); 6748 }); 6749 $(window).on('resize', function(){ 6750 setTimeout(function(){ 6751 var $dotItem = $block.find('.lp-reviews-10-slider__dots li button'); 6752 if ($dotItem.hasClass('lp-reviews-10-slider__dot')) { 6753 6754 } 6755 else { 6756 $dotItem.attr('data-elem-type', 'card_container'); 6757 $dotItem.addClass('lp-reviews-10-slider__dot'); 6758 $dotItem.attr('data-lp-selector','.lp-reviews-10-slider__dot'); 6759 } 6760 },100); 6761 }); 6762 } 6763 } 6764 6765 lp_template.queue.arrowPositioning = function ($self) { 6766 6767 const $blocks = $self.find('.init-arrow-positioning'); 6768 if (!$blocks.length) return; 6769 6770 function updateStepsArrows($block) { 6771 6772 const mediaSource = $('html').attr('data-media-source'); 6773 const $arrows = $block.find('.lp-steps-new__arrow'); 6774 6775 if (!['media-xl', 'media-lg', 'media-md'].includes(mediaSource)) { 6776 $arrows.css({ 6777 top: '', 6778 marginLeft: '' 6779 }); 6780 return; 6781 } 6782 6783 const $items = $block.find('.lp-steps-new__item'); 6784 6785 $items.each(function (index) { 6786 6787 const $item = $(this); 6788 const $arrow = $item.find('.lp-steps-new__arrow'); 6789 const $icon = $item.find('.lp-steps-new__icon-box'); 6790 6791 if (!$arrow.length || !$icon.length) return; 6792 6793 const $nextItem = $items.eq(index + 1); 6794 if (!$nextItem.length) return; 6795 6796 const itemRect = $item[0].getBoundingClientRect(); 6797 const nextItemRect = $nextItem[0].getBoundingClientRect(); 6798 const iconRect = $icon[0].getBoundingClientRect(); 6799 const arrowRect = $arrow[0].getBoundingClientRect(); 6800 6801 const top = (iconRect.top - itemRect.top) + (iconRect.height / 2) - (arrowRect.height / 2); 6802 6803 const centerBetween = (itemRect.right + nextItemRect.left) / 2; 6804 6805 const marginLeft = centerBetween - itemRect.left - (arrowRect.width / 2); 6806 6807 $arrow.css({ 6808 top, 6809 marginLeft 6810 }); 6811 }); 6812 } 6813 6814 $blocks.each(function () { 6815 6816 const $block = $(this); 6817 6818 const run = () => updateStepsArrows($block); 6819 6820 if (typeof s3LP !== 'undefined' && s3LP.is_cms) { 6821 setTimeout(run, 250); 6822 } else { 6823 run(); 6824 } 6825 6826 $(window).on('resize', run); 6827 }); 6828 }; 6829 6830 lp_template.queue.lpForm19CalcBottomMargin = function($self) { 6831 var $block = $self, 6832 margin = ($block.find('.lp-form-19__bottom').height() 6833 + parseInt($(".lp-form-19__bottom").css("padding-top")) 6834 + parseInt($(".lp-form-19__bottom").css("padding-bottom")))/2; 6835 $block.find('.lp-form-19__top-bg').css({ 6836 "margin-bottom" : - margin 6837 }); 6838 }; 6839 6840 lp_template.queue.lpGallery1 = function($self) { 6841 var $block = $self.hasClass('lp-gallery-1') ? $self : $self.find('.lp-gallery-1'), 6842 $mainSlider = $block.find('.js-main-slick'), 6843 $thumbSlider = $block.find('.js-thumb-slick'), 6844 $prevBtn = $block.find('.js-slider-prev'), 6845 $nextBtn = $block.find('.js-slider-next'), 6846 $slidesToShowData = $block.data('count'); 6847 6848 if ($mainSlider.length) { 6849 $mainSlider.slick({ 6850 slidesToShow: 1, 6851 slidesToScroll: 1,
6852 arrows: false, 6853 fade: true, 6854 asNavFor: $thumbSlider, 6855 adaptiveHeight: false 6856 }) 6857 6858 $thumbSlider.slick({ 6859 slidesToShow: 3, 6860 slidesToScroll: 1, 6861 asNavFor: $mainSlider, 6862 dots: false, 6863 centerMode: true, 6864 arrows: false, 6865 touches: true, 6866 prevArrow: $prevBtn, 6867 nextArrow: $nextBtn, 6868 focusOnSelect: true, 6869 adaptiveHeight: false, 6870 centerPadding: '6px', 6871 mobileFirst: true, 6872 swipeToSlide: false, 6873 responsive: [ 6874 { 6875 breakpoint: 600, 6876 settings: { 6877 slidesToShow: $slidesToShowData, 6878 centerPadding: '20px' 6879 } 6880 }, 6881 { 6882 breakpoint: 960, 6883 settings: { 6884 slidesToShow: $slidesToShowData, 6885 arrows: true, 6886 centerPadding: '0px' 6887 } 6888 } 6889 ] 6890 }); 6891 } 6892 }; 6893 6894 lp_template.queue.lpGallery3 = function ($self) { 6895 6896 var $block = $self, 6897 owl = $block.find('.js-photo-3-mask'), 6898 $nextSlide = $block.find('.js-next-slide'), 6899 $prevSlide = $block.find('.js-prev-slide'), 6900 $thumbItem = $block.find('.js-preview-item'); 6901 6902 if (owl.length) { 6903 6904 owl.owlCarousel({ 6905 items : 1, 6906 autoplay : false, 6907 loop : false, 6908 nav : false, 6909 dots : false, 6910 animateIn: 'fadeIn', 6911 animateOut: 'fadeOut', 6912 smartSpeed: 300, 6913 mouseDrag: false, 6914 touchDrag: false 6915 }); 6916 6917 6918 $($nextSlide).click(function(e) { 6919 e.preventDefault(); 6920 owl.trigger('next.owl.carousel'); 6921 }); 6922 $($prevSlide).click(function(e) { 6923 e.preventDefault(); 6924 owl.trigger('prev.owl.carousel', [300]); 6925 }); 6926 6927 $($thumbItem).on('click', function () { 6928 var click = $(this).index(); 6929 owl.trigger( 'to.owl.carousel', [click] ); 6930 $(this).addClass('_active').siblings().removeClass('_active'); 6931 }); 6932 } 6933 }; 6934 6935 lp_template.queue.products29 = function($self) { 6936 $self.on('click', '.js-gallery29-item', function(){ 6937 var $this = $(this); 6938 6939 $this.addClass('_active').siblings().removeClass('_active'); 6940 $this.closest('[data-block-layout]').find('.lp-prods-29-background__item').removeClass('_active').eq($this.index()).addClass('_active'); 6941 6942 }); 6943 } 6944 6945 6946 6947 lp_template.queue.lpGallery17 = function($self) { 6948 6949 var $block = $self.hasClass('js-grid-gallery') ? $self : $self.find('.js-grid-gallery'); 6950 6951 $block.each(function(){ 6952 if ($block.length) { 6953 var $this = $(this), 6954 $slider = $this.find('.js-gallery-items'), 6955 autoplay = !!$slider.data('autoplay'), 6956 infinite = !!$slider.data('infinite'), 6957 nav = !!$slider.data('arrows'), 6958 dotsEach = !!$slider.data('dots-each'), 6959 dots = true, 6960 pause = $slider.data('pause') || 5000, 6961 speed = $slider.data('speed') || 250, 6962 fade = !!$slider.data('fade'), 6963 $parent = $slider.closest('[data-block-layout]'), 6964 dataResponse = $slider.data('response'), 6965 response = {}, 6966 $dots = $this.find('.lp-dots-wrapper'), 6967 navigatoBox = $this.find('.lp-gallery-17-items__nav'); 6968 6969 if(s3LP.is_cms){ 6970 var infinite = false, 6971 rewind = true, 6972 autoplay = false; 6973 } 6974 else if(typeof ReactLPConstructor == 'object') { 6975 var infinite = false, 6976 rewind = true, 6977 autoplay = false; 6978 6979 } 6980 6981 try { 6982 let owl = $this.find('.js-gallery-items.js-owl-carousel'), 6983 windowWidth = $(window).width(), 6984 gridFormer = function(){ 6985 let wrapper = '<div class="js-gallery-items-grid"></div>', 6986 itemsCount = $slider.children('.js-gallery-item').length, 6987 sliceFunc = function(itemsInGrid){ 6988 for (var i = 0; i < itemsCount/itemsInGrid; i++) { 6989 $slider.children('.js-gallery-item').slice(0, itemsInGrid).wrapAll(wrapper); 6990 } 6991 $slider.find('.js-gallery-items-grid').each(function(){ 6992 $(this).addClass('_'+$(this).children().length); 6993 }); 6994 }; 6995 6996 if (windowWidth<600) { 6997 sliceFunc(2); 6998 } else if (windowWidth<1200) { 6999 sliceFunc(4); 7000 } else { 7001 sliceFunc(5); 7002 } 7003 } 7004 7005 let initOwl = function(){ 7006 7007 $slider.owlCarousel($.extend({ 7008 items : 1, 7009 autoplay : autoplay, 7010 loop : infinite, 7011 rewind: true, 7012 nav : nav, 7013 dots : dots, 7014 animateIn: fade ? 'fadeIn' : false, 7015 animateOut: fade ? 'fadeOut' : false, 7016 smartSpeed: speed, 7017 autoplayTimeout: pause, 7018 margin: 16, 7019 onInitialized: function(e) { 7020 7021 var $dotsCount = $this.find('.owl-dot').length; 7022 7023 if (!$dots.length || $dotsCount < 2) { 7024 $dots.html(''); 7025 return; 7026 }; 7027 var $dotsHTML = ''; 7028 7029 for(var i = 0; i < $dotsCount; i++) { 7030 $dotsHTML += '<div class="lp-dots-item js-dot-item" data-elem-type="container" data-lp-selector=".lp-dots-item"></div>'; 7031 } 7032 7033 if (!$dots.hasClass('_unchanged')) { 7034 7035 $dots.html($dotsHTML); 7036 7037 } 7038 7039 $dots.find('.lp-dots-item').eq(0).addClass('active'); 7040 7041 }, 7042 7043 onResized: function(e) { 7044 if (!$dots.length || e.page.count < 2) { 7045 $dots.html(''); 7046 return; 7047 } 7048 7049 var $dotsHTML = ''; 7050 for(var i = 0; i < e.page.count; i++) { 7051 $dotsHTML += '<div class="lp-dots-item js-dot-item" data-elem-type="container" data-lp-selector=".lp-dots-item"></div>'; 7052 } 7053 7054 if (!$dots.hasClass('_unchanged')) { 7055 $dots.html($dotsHTML); 7056 } 7057 $dots.find('.lp-dots-item').removeClass('active'); 7058 $dots.find('.lp-dots-item').eq(e.page.index).addClass('active'); 7059 }, 7060 onTranslated: function(e) { 7061 $dots.find('.lp-dots-item').removeClass('active'); 7062 $dots.find('.lp-dots-item').eq(e.page.index).addClass('active'); 7063 } 7064 }, response)); 7065 7066 $this.find('.js-next-slide').off(); 7067 $this.find('.js-next-slide').on('click', function(e) { 7068 e.preventDefault(); 7069 owl.trigger('next.owl.carousel'); 7070 }); 7071 7072 $this.find('.js-prev-slide').off(); 7073 $this.find('.js-prev-slide').on('click', function(e) { 7074 e.preventDefault(); 7075 owl.trigger('prev.owl.carousel'); 7076 }); 7077 7078 var $itemCount = $this.find('.owl-item').length; 7079 7080 if ($itemCount > 1) { 7081 navigatoBox.show(); 7082 } else { 7083 navigatoBox.hide(); 7084 }; 7085 7086 // ÐолÑÑаем вÑе ÑоÑки 7087 const $dotsItems = $dots.find('.lp-dots-item'); 7088 7089 // СобÑÑие клика на ÑоÑки 7090 $dotsItems.on('click', function() { 7091 const index = $(this).index(); 7092 owl.trigger('to.owl.carousel', index); 7093 }); 7094 7095 } 7096 7097 let reInitOwl = function(){ 7098 owl.trigger('destroy.owl.carousel'); 7099 $this.find('.js-gallery-item').unwrap(); 7100 gridFormer(); 7101 initOwl(); 7102 } 7103 7104 gridFormer(); 7105 7106 initOwl(); 7107 7108 7109 $(window).resize(function(){ 7110 let newWindowWidth = $(window).width(); 7111 if (windowWidth < 1200 && windowWidth >= 600) { 7112 if (newWindowWidth >= 1200 || newWindowWidth < 600) { 7113 windowWidth = newWindowWidth; 7114 reInitOwl(); 7115 } 7116 } else if (windowWidth>=1200){ 7117 if (newWindowWidth < 1200) { 7118 windowWidth = newWindowWidth; 7119 reInitOwl(); 7120 } 7121 } else if (windowWidth<600){ 7122 if (newWindowWidth>=600) { 7123 windowWidth = newWindowWidth; 7124 reInitOwl(); 7125 } 7126 } 7127 }); 7128 7129 } catch(exception) { 7130 console.log(exception); 7131 } 7132 } 7133 }); 7134 } 7135 7136 lp_template.queue.lpGallery19 = function($self) { 7137 7138 var $block = $self.hasClass('lp-gallery-19') ? $self : $self.find('.lp-gallery-19'); 7139
7140 $block.each(function(){ 7141 if ($block.length) { 7142 var $this = $(this), 7143 $slider = $this.find('.js-gallery-items'), 7144 autoplay = !!$slider.data('autoplay'), 7145 infinite = !!$slider.data('infinite'), 7146 nav = !!$slider.data('arrows'), 7147 dotsEach = !!$slider.data('dots-each'), 7148 dots = true, 7149 pause = $slider.data('pause') || 5000, 7150 speed = $slider.data('speed') || 250, 7151 fade = !!$slider.data('fade'), 7152 $parent = $slider.closest('[data-block-layout]'), 7153 dataResponse = $slider.data('response'), 7154 response = {}, 7155 $dots = $this.find('.lp-dots-wrapper'); 7156 7157 if(s3LP.is_cms){ 7158 var infinite = false, 7159 autoplay = false; 7160 } 7161 else if(typeof ReactLPConstructor == 'object') { 7162 var infinite = false, 7163 autoplay = false; 7164 7165 } 7166 try { 7167 let owl = $this.find('.js-gallery-items.js-owl-carousel'), 7168 windowWidth = $(window).width(), 7169 gridFormer = function(){ 7170 let wrapper = '<div class="lp-gallery-19__slider-item"></div>', 7171 itemsCount = $slider.children('.js-gallery-item').length, 7172 sliceFunc = function(itemsInGrid){ 7173 for (var i = 0; i < itemsCount/itemsInGrid; i++) { 7174 $slider.children('.js-gallery-item').slice(0, itemsInGrid).wrapAll(wrapper); 7175 } 7176 $slider.find('.lp-gallery-19__slider-item').each(function(){ 7177 $(this).addClass('_'+$(this).children().length); 7178 }); 7179 }; 7180 7181 if (windowWidth<600) { 7182 sliceFunc(1); 7183 } else if (windowWidth<1200) { 7184 sliceFunc(4); 7185 } else { 7186 sliceFunc(4); 7187 } 7188 } 7189 7190 let initOwl = function(){ 7191 7192 $slider.owlCarousel($.extend({ 7193 items : 1, 7194 autoplay : autoplay, 7195 loop : infinite, 7196 rewind: true, 7197 nav : nav, 7198 dots : dots, 7199 animateIn: fade ? 'fadeIn' : false, 7200 animateOut: fade ? 'fadeOut' : false, 7201 smartSpeed: speed, 7202 autoplayTimeout: pause, 7203 margin: 16, 7204 onInitialized: function(e) { 7205 var $dotsCount = $this.find('.owl-dot').length; 7206 7207 if (!$dots.length || $dotsCount < 2) { 7208 $dots.html(''); 7209 return; 7210 }; 7211 var $dotsHTML = ''; 7212 7213 for(var i = 0; i < $dotsCount; i++) { 7214 $dotsHTML += '<div class="lp-dots-item js-dot-item" data-elem-type="container" data-lp-selector=".lp-dots-item"></div>'; 7215 } 7216 7217 if (!$dots.hasClass('_unchanged')) { 7218 7219 $dots.html($dotsHTML); 7220 7221 } 7222 7223 $dots.find('.lp-dots-item').eq(0).addClass('active'); 7224 7225 }, 7226 7227 onResized: function(e) { 7228 if (!$dots.length || e.page.count < 2) { 7229 $dots.html(''); 7230 return; 7231 } 7232 7233 var $dotsHTML = ''; 7234 for(var i = 0; i < e.page.count; i++) { 7235 $dotsHTML += '<div class="lp-dots-item js-dot-item" data-elem-type="container" data-lp-selector=".lp-dots-item"></div>'; 7236 } 7237 7238 if (!$dots.hasClass('_unchanged')) { 7239 $dots.html($dotsHTML); 7240 } 7241 $dots.find('.lp-dots-item').removeClass('active'); 7242 $dots.find('.lp-dots-item').eq(e.page.index).addClass('active'); 7243 }, 7244 onTranslated: function(e) { 7245 $dots.find('.lp-dots-item').removeClass('active'); 7246 $dots.find('.lp-dots-item').eq(e.page.index).addClass('active'); 7247 } 7248 }, response)); 7249 $this.find('.js-next-slide').off(); 7250 $this.find('.js-next-slide').on('click', function(e) { 7251 e.preventDefault(); 7252 owl.trigger('next.owl.carousel'); 7253 }); 7254 $this.find('.js-prev-slide').off(); 7255 $this.find('.js-prev-slide').on('click', function(e) { 7256 e.preventDefault(); 7257 owl.trigger('prev.owl.carousel'); 7258 }); 7259 7260 } 7261 7262 let reInitOwl = function(){ 7263 owl.trigger('destroy.owl.carousel'); 7264 $this.find('.js-gallery-item').unwrap(); 7265 gridFormer(); 7266 initOwl(); 7267 } 7268 7269 gridFormer(); 7270 7271 initOwl(); 7272 7273 $(window).resize(function(){ 7274 let newWindowWidth = $(window).width(); 7275 if (windowWidth < 1200 && windowWidth >= 600) { 7276 if (newWindowWidth >= 1200 || newWindowWidth < 600) { 7277 windowWidth = newWindowWidth; 7278 reInitOwl(); 7279 } 7280 } else if (windowWidth>=1200){ 7281 if (newWindowWidth < 1200) { 7282 windowWidth = newWindowWidth; 7283 reInitOwl(); 7284 } 7285 } else if (windowWidth<600){ 7286 if (newWindowWidth>=600) { 7287 windowWidth = newWindowWidth; 7288 reInitOwl(); 7289 } 7290 } 7291 }); 7292 7293 } catch(exception) { 7294 console.log(exception); 7295 } 7296 } 7297 }); 7298 } 7299 7300 lp_template.queue.blockAfterBefore = function ($self) { 7301 var $block = $self.find(".lp-before-and-after-init"); 7302 7303 if ($block.length) { 7304 (() => {'use strict'; 7305 7306 class BeforeAfter { 7307 constructor(selector = '.before-after') { 7308 this.selector = selector; 7309 this.items = []; 7310 } 7311 7312 init() { 7313 let wrappers = document.querySelectorAll(this.selector); 7314 7315 for (let wrapper of wrappers) { 7316 if (wrapper.dataset.beforeAfterInitialized === 'true') { 7317 continue; 7318 } 7319 let item = new BeforeAfterItem(wrapper).init(); 7320 this.items.push(item); 7321 7322 wrapper.dataset.beforeAfterInitialized = 'true'; 7323 7324 let observer = new MutationObserver(function (mutations) { 7325 mutations.forEach(function (mutation) { 7326 if ($(mutation.target).hasClass('lp-selected-element')) { 7327 $(mutation.target).parent().addClass('active'); 7328 } else { 7329 $(mutation.target).parent().removeClass('active'); 7330 } 7331 }); 7332 });
7333 let config = { 7334 attributes: true, 7335 attributeFilter: ['class'] 7336 }; 7337 7338 observer.observe($(wrapper).find('.before-after__img-before')[0], config); 7339 observer.observe($(wrapper).find('.before-after__img-after')[0], config); 7340 } 7341 } 7342 } 7343 7344 class BeforeAfterItem { 7345 constructor(el) { 7346 this.wrapper = el; 7347 this.dragElWrapper = null; 7348 this.viewport = null; 7349 this.before = null; 7350 this.after = null; 7351 this.offset = 0; 7352 this.pageXStart = 0; 7353 this.startOffset = 0; 7354 this.onPointerDown = this.onPointerDown.bind(this); 7355 this.onPointerMove = this.onPointerMove.bind(this); 7356 this.onPointerUp = this.onPointerUp.bind(this); 7357 } 7358 init() { 7359 let wrapper = this.wrapper; 7360 7361 let dragElWrapper = this.dragElWrapper = document.createElement('div'); 7362 7363 dragElWrapper.classList.add('before-after__drag-wrapper'); 7364 dragElWrapper.style.left = '50%'; 7365 7366 let dragEl = document.createElement('div'); 7367 7368 dragEl.classList.add('before-after__drag'); 7369 7370 dragElWrapper.append(dragEl); 7371 7372 let viewport = this.viewport = wrapper.querySelector('.before-after__viewport'); 7373 7374 viewport.append(dragElWrapper); 7375 wrapper.classList.add('before-after--loaded'); 7376 7377 this.before = viewport.querySelector('.lp-image-before'); 7378 this.after = viewport.querySelector('.lp-image-after'); 7379 7380 this.move(this.offset); 7381 7382 dragElWrapper.addEventListener('mousedown', this.onPointerDown); 7383 dragElWrapper.addEventListener('touchstart', this.onPointerDown); 7384 7385 dragElWrapper.addEventListener('dragstart', () => { 7386 return false; 7387 }); 7388 7389 return this; 7390 } 7391 7392 onPointerDown(e) { 7393 e.stopPropagation(); 7394 7395 if (e.touches) { 7396 this.pageXStart = e.touches[0].pageX; 7397 } else { 7398 this.pageXStart = e.pageX; 7399 } 7400 this.startOffset = this.offset; 7401 7402 document.addEventListener('mousemove', this.onPointerMove); 7403 document.addEventListener('touchmove', this.onPointerMove); 7404 document.addEventListener('mouseup', this.onPointerUp); 7405 document.addEventListener('touchend', this.onPointerUp); 7406 } 7407 7408 onPointerMove(e) { 7409 let viewport = this.viewport, 7410 pxOffset = 0, 7411 percentOffset = 0; 7412 7413 if (e.touches) { 7414 pxOffset = e.touches[0].pageX - this.pageXStart; 7415 } else { 7416 pxOffset = e.pageX - this.pageXStart; 7417 } 7418 7419 percentOffset = parseFloat((pxOffset / viewport.clientWidth * 100).toFixed(6)); 7420 7421 this.offset = this.startOffset + percentOffset; 7422 7423 if (this.offset >= 50) { 7424 this.offset = 50; 7425 } else if (this.offset <= -50) { 7426 this.offset = -50; 7427 } 7428 7429 this.move(this.offset); 7430 } 7431 7432 onPointerUp() { 7433 document.removeEventListener('mousemove', this.onPointerMove); 7434 document.removeEventListener('touchmove', this.onPointerMove); 7435 document.removeEventListener('mouseup', this.onPointerUp); 7436 document.removeEventListener('touchend', this.onPointerUp); 7437 } 7438 7439 move(offset) { 7440 this.dragElWrapper.style.left = 'calc(50% + ' + offset + '%)'; 7441 this.before.style.clipPath = 'inset(0 calc(50% - ' + offset + '%) 0 0)'; 7442 this.after.style.clipPath = 'inset(0 0 0 calc(50% + ' + offset + '%))'; 7443 } 7444 7445 } 7446 window.BeforeAfter = BeforeAfter; 7447 })(); 7448 7449 new BeforeAfter().init(); 7450 } 7451 } 7452 7453 lp_template.queue.lpGallery23 = function($self) { 7454 var $block = $('.lp-gallery-23'); 7455 if ($block.length) { 7456 $block.each(function(){ 7457 var $this = $(this), 7458 $thisCount = $this.hasClass('_3') ? 4 : 3, 7459 $button = $this.find('.lp-gallery-23__button'), 7460 openText = $this.find('.lp-gallery-23__button-in._open-text'), 7461 closeText = $this.find('.lp-gallery-23__button-in._close-text'), 7462 $hiddenElems; 7463 7464 7465 try { 7466 let itemMargin = 0, 7467 itemHeight = 0, 7468 containerHeight = 0, 7469 checkHeight = function(){ 7470 itemMargin = parseInt($this.find('.lp-gallery-23-item').css('margin-bottom'), 10), 7471 itemHeight = $this.find('.lp-gallery-23-item').height() + itemMargin, 7472 containerHeight = $this.find('.lp-gallery-23-items-wrapper').height() 7473 $thisCount = $this.hasClass('_3') ? 4 : 3; 7474 7475 if ($(window).width()<600 && itemHeight < 590) { 7476 itemHeight *= 2; 7477 } 7478 7479 if ($(window).width()<600) { 7480 $thisCount = 2; 7481 } 7482 else if ($(window).width()<960) { 7483 $thisCount = 3; 7484 } 7485 7486 $hiddenElems = $this.find('.lp-gallery-23-item:nth-child(n + ' + $thisCount + ')'); 7487 7488 $this.find('.lp-gallery-23-items').css('max-height', itemHeight); 7489 $this.find('.lp-gallery-23-item').show(); 7490 $hiddenElems.hide(); 7491 }; 7492 7493 checkHeight(); 7494 7495 /*$(window).resize(function(){ 7496 $button.removeClass('_opened'); 7497 closeText.hide(); 7498 openText.show(); 7499 checkHeight(); 7500 });*/ 7501 7502 var win_width=$(window).width(); 7503 $(window).resize(function() { 7504 var new_win_width=$(window).width(); 7505 if(new_win_width!=win_width) { 7506 $button.removeClass('_opened'); 7507 closeText.hide(); 7508 openText.show(); 7509 checkHeight(); 7510 win_width=new_win_width; 7511 } 7512 }); 7513 7514 $button.on('click', function(e){ 7515 if ($(this).hasClass('_opened')) { 7516 $this.find('.lp-gallery-23-items').animate({ 7517 'max-height': itemHeight 7518 }, 1000 ); 7519 closeText.hide(); 7520 openText.show(); 7521 $hiddenElems.fadeOut(); 7522 } else { 7523 $this.find('.lp-gallery-23-items').animate({ 7524 'max-height': 100000 7525 }, 1000); 7526 closeText.show(); 7527 openText.hide(); 7528 $hiddenElems.fadeIn(); 7529 } 7530 $(this).toggleClass('_opened'); 7531 }); 7532 7533 7534 } catch(exception) { 7535 console.log(exception); 7536 } 7537 7538 }); 7539 } 7540 } 7541 7542 lp_template.queue.lpGallery25 = function($self) { 7543 var $block = $('.lp-gallery-25'); 7544 if ($block.length) { 7545 try { 7546 let bgPos = function(){ 7547 if ($(window).width()<960) { 7548 let headerHeight = $('.lp-gallery-25__title').outerHeight(); 7549 $('.lp-gallery-25 .lp-half-bg').css({ 7550 top: headerHeight, 7551 left: 0, 7552 right: 0 7553 }); 7554 } else { 7555 let headerWidth = 0; 7556 7557 $('.lp-gallery-25 .lp-half-bg').css('top', 0); 7558 if ($('.lp-gallery-25').hasClass('_reverse')) { 7559 headerWidth = $('.lp-gallery-25__title').outerWidth() + $('.lp-gallery-25-items').offset().left; 7560 $('.lp-gallery-25 .lp-half-bg').css({ 7561 right: headerWidth, 7562 left: 0 7563 }); 7564 } else { 7565 headerWidth = $('.lp-gallery-25__title').outerWidth() + $('.lp-gallery-25__title').offset().left; 7566 $('.lp-gallery-25 .lp-half-bg').css({ 7567 right: 0, 7568 left: headerWidth 7569 }); 7570 } 7571 } 7572 } 7573 7574 if ($('div').is(".lp-gallery-25__title")) { 7575 if (s3LP.is_cms && !$('body').hasClass('preview_mode')) { 7576 setTimeout(function(){ 7577 bgPos(); 7578 },500); 7579 } 7580 7581 $(window).resize(function(){ 7582 bgPos(); 7583 }); 7584 } 7585 7586 } catch(exception) { 7587 console.log(exception); 7588 } 7589 } 7590 } 7591 7592 lp_template.queue.lpCertificate15 = function($self) { 7593 7594 var $block = $self.hasClass('lp-certificate-15') ? $self : $self.find('.lp-certificate-15'); 7595 7596 $block.each(function(){ 7597 if ($block.length) { 7598 var $this = $(this), 7599 $slider = $this.find('.js-gallery-items'), 7600 autoplay = !!$slider.data('autoplay'), 7601 infinite = !!$slider.data('infinite'), 7602 nav = !!$slider.data('arrows'), 7603 dotsEach = !!$slider.data('dots-each'), 7604 dots = true, 7605 pause = $slider.data('pause') || 5000, 7606 speed = $slider.data('speed') || 250, 7607 fade = !!$slider.data('fade'), 7608 $parent = $slider.closest('[data-block-layout]'), 7609 dataResponse = $slider.data('response'), 7610 response = {}, 7611 $dots = $this.find('.lp-dots-wrapper'); 7612 7613 if(s3LP.is_cms){ 7614 var infinite = false, 7615 autoplay = false;
7616 } 7617 else if(typeof ReactLPConstructor == 'object') { 7618 var loop = false, 7619 autoplay = false; 7620 7621 } 7622 try { 7623 let owl = $this.find('.js-gallery-items'), 7624 windowWidth = $(window).width(), 7625 gridFormer = function(){ 7626 let wrapper = '<div class="lp-certificate-15__slider-item-wr"></div>', 7627 itemsCount = $slider.children('.js-gallery-item').length, 7628 sliceFunc = function(itemsInGrid){ 7629 for (var i = 0; i < itemsCount/itemsInGrid; i++) { 7630 $slider.children('.js-gallery-item').slice(0, itemsInGrid).wrapAll(wrapper); 7631 } 7632 $slider.find('.lp-certificate-15-slider-item').each(function(){ 7633 $(this).addClass('_'+$(this).children().length); 7634 }); 7635 }; 7636 7637 if (windowWidth<600) { 7638 sliceFunc(1); 7639 } else if (windowWidth<1200) { 7640 sliceFunc(2); 7641 } else { 7642 sliceFunc(2); 7643 } 7644 } 7645 7646 let initOwl = function(){ 7647 7648 $slider.owlCarousel($.extend({ 7649 items : 1, 7650 autoplay : autoplay, 7651 loop : infinite, 7652 rewind: true, 7653 nav : nav, 7654 dots : dots, 7655 animateIn: fade ? 'fadeIn' : false, 7656 animateOut: fade ? 'fadeOut' : false, 7657 smartSpeed: speed, 7658 autoplayTimeout: pause, 7659 margin: 0, 7660 onInitialized: function(e) { 7661 var $dotsCount = $this.find('.owl-dot').length; 7662 7663 if (!$dots.length || $dotsCount < 2) { 7664 $dots.html(''); 7665 return; 7666 }; 7667 var $dotsHTML = ''; 7668 7669 for(var i = 0; i < $dotsCount; i++) { 7670 $dotsHTML += '<div class="lp-dots-item js-dot-item" data-elem-type="container" data-lp-selector=".lp-dots-item"></div>'; 7671 } 7672 7673 if (!$dots.hasClass('_unchanged')) { 7674 $dots.html($dotsHTML); 7675 } 7676 7677 $dots.find('.lp-dots-item').eq(0).addClass('active'); 7678 7679 // обÑабоÑка кликов по каÑÑомнÑм ÑоÑкам 7680 $dots.off('click', '.lp-dots-item').on('click', '.lp-dots-item', function() { 7681 var index = $(this).index(); 7682 $slider.trigger('to.owl.carousel', [index, 300]); 7683 }); 7684 7685 }, 7686 7687 onResized: function(e) { 7688 if (!$dots.length || e.page.count < 2) { 7689 $dots.html(''); 7690 return; 7691 } 7692 7693 var $dotsHTML = ''; 7694 for(var i = 0; i < e.page.count; i++) { 7695 $dotsHTML += '<div class="lp-dots-item js-dot-item" data-elem-type="container" data-lp-selector=".lp-dots-item"></div>'; 7696 } 7697 7698 if (!$dots.hasClass('_unchanged')) { 7699 $dots.html($dotsHTML); 7700 } 7701 $dots.find('.lp-dots-item').removeClass('active'); 7702 $dots.find('.lp-dots-item').eq(e.page.index).addClass('active'); 7703 7704 // обновлÑем обÑабоÑÑик пÑи ÑеÑайзе 7705 $dots.off('click', '.lp-dots-item').on('click', '.lp-dots-item', function() { 7706 var index = $(this).index(); 7707 $slider.trigger('to.owl.carousel', [index, 300]); 7708 }); 7709 }, 7710 onTranslated: function(e) { 7711 $dots.find('.lp-dots-item').removeClass('active'); 7712 $dots.find('.lp-dots-item').eq(e.page.index).addClass('active'); 7713 } 7714 }, response)); 7715 7716 $this.find('.js-next-slide').off(); 7717 $this.find('.js-next-slide').on('click', function(e) { 7718 e.preventDefault(); 7719 $slider.trigger('next.owl.carousel'); 7720 }); 7721 $this.find('.js-prev-slide').off(); 7722 $this.find('.js-prev-slide').on('click', function(e) { 7723 e.preventDefault(); 7724 $slider.trigger('prev.owl.carousel'); 7725 }); 7726 } 7727 7728 let reInitOwl = function(){ 7729 owl.trigger('destroy.owl.carousel'); 7730 $this.find('.js-gallery-item').unwrap(); 7731 gridFormer(); 7732 initOwl(); 7733 } 7734 7735 gridFormer(); 7736 7737 initOwl(); 7738 7739 $(window).resize(function(){ 7740 let newWindowWidth = $(window).width(); 7741 if (windowWidth < 1200 && windowWidth >= 600) { 7742 if (newWindowWidth >= 1200 || newWindowWidth < 600) { 7743 windowWidth = newWindowWidth; 7744 reInitOwl(); 7745 } 7746 } else if (windowWidth>=1200){ 7747 if (newWindowWidth < 1200) { 7748 windowWidth = newWindowWidth; 7749 reInitOwl(); 7750 } 7751 } else if (windowWidth<600){ 7752 if (newWindowWidth>=600) { 7753 windowWidth = newWindowWidth; 7754 reInitOwl(); 7755 } 7756 } 7757 }); 7758 7759 } catch(exception) { 7760 console.log(exception); 7761 } 7762 } 7763 }); 7764 } 7765 7766 lp_template.queue.lpPromo10 = function($self) { 7767 var $block = $self, 7768 $block_slider = $block.find('.js-promo10-slider'); 7769
7770 if ($block_slider.length) { 7771 $block_slider.each(function(){ 7772 7773 var $this = $(this), 7774 $parent = $this.closest('[data-block-layout]'), 7775 $dots = $this.data('dots'), 7776 $autoplay = $this.data('autoplay'), 7777 $infinite = $this.data('infinite'), 7778 $autoplaySpeed = $this.data('autoplay-speed'), 7779 $speed = $this.data('speed'); 7780 7781 $this.slick({ 7782 arrows: false, 7783 dots: $dots, 7784 infinite: $infinite, 7785 fade: true, 7786 speed: $speed, 7787 slidesToShow: 1, 7788 autoplay: $autoplay, 7789 autoplaySpeed: $autoplaySpeed, 7790 dotsClass:'lp-promo10__slider-dots', 7791 appendDots:$this 7792 }); 7793 }); 7794 7795 $(window).on('resize', function(){ 7796 setTimeout(function(){ 7797 var $dotItem = $block.find('.lp-promo10__slider-dots li button'); 7798 if ($dotItem.hasClass('lp-promo10__slider-dot')) { 7799 7800 } 7801 else { 7802 $dotItem.attr('data-elem-type', 'card_container'); 7803 $dotItem.addClass('lp-promo10__slider-dot'); 7804 $dotItem.attr('data-lp-selector','.lp-promo10__slider-dot'); 7805 $dotItem.attr('data-has-event','1'); 7806 } 7807 },500); 7808 }); 7809 } 7810 } 7811 7812 lp_template.queue.lpPromo12 = function ($self) { 7813 7814 var $block = $self, 7815 $slider = $self.find('.js-promo12-slider'); 7816 7817 if ($slider.length) { 7818 $slider.each(function(){ 7819 7820 let $this = $(this); 7821 let $parent = $this.closest('[data-block-layout]'); 7822 7823 var $dots = $this.data('dots'), 7824 $autoplay = $this.data('autoplay'), 7825 $infinite = $this.data('infinite'), 7826 $autoplaySpeed = $this.data('autoplay-speed'), 7827 $speed = $this.data('speed'); 7828 if(s3LP.is_cms){ 7829 var $infinite = false, 7830 $autoplay = false; 7831 } 7832 else if(typeof ReactLPConstructor == 'object') { 7833 var $infinite = false, 7834 $autoplay = false; 7835 } 7836 7837 $this.slick({ 7838 slidesToShow: 1, 7839 slidesToScroll: 1, 7840 fade: true, 7841 infinite: $infinite, 7842 dots: $dots, 7843 autoplay: $autoplay, 7844 autoplaySpeed: $autoplaySpeed, 7845 speed: $speed, 7846 dotsClass: 'lp-promo-12-slider__dots', 7847 appendDots: $parent.find('.lp-promo-12-slider'), 7848 prevArrow: $parent.find('.lp-promo-12-slider__arrow--left'), 7849 nextArrow: $parent.find('.lp-promo-12-slider__arrow--right') 7850 }); 7851 7852 $(window).on('resize', function(){ 7853 setTimeout(function(){ 7854 var $dotItem = $block.find('.lp-promo-12-slider__dots li button'); 7855 if ($dotItem.hasClass('lp-promo-12-slider__dot')) { 7856 7857 } 7858 else { 7859 $dotItem.attr('data-elem-type', 'card_container'); 7860 $dotItem.addClass('lp-promo-12-slider__dot'); 7861 $dotItem.attr('data-lp-selector','.lp-promo-12-slider__dot'); 7862 $dotItem.attr('data-has-event','1'); 7863 } 7864 },100); 7865 }); 7866 }); 7867 } 7868 } 7869 7870 lp_template.queue.lpPromo17 = function ($self) { 7871 7872 var $slider = $self.find('.js-promo-17-slider'); 7873 7874 if ($slider.length) { 7875 $slider.each(function(){ 7876 7877 var $this = $(this); 7878 var $parent = $this.closest('[data-block-layout]'); 7879 7880 $this.slick({ 7881 infinite: true, 7882 slidesToShow: 1, 7883 slidesToScroll: 1, 7884 fade: true, 7885 dots:true, 7886 dotsClass: 'lp-promo-17__dots', 7887 appendDots: $parent.find('.lp-promo-17'), 7888 prevArrow: $parent.find('.lp-promo-17__slider-arrow--left'), 7889 nextArrow: $parent.find('.lp-promo-17__slider-arrow--right') 7890 }); 7891 }); 7892 } 7893 } 7894 7895 lp_template.queue.check_age = function($self) { 7896 $self.on('click', '.js-close-popup.lp-popup-block-3__button', function(e){ 7897 e.preventDefault(); 7898 var $parent = $(this).closest('[data-block-id]'); 7899 createCookie('block_' + $parent.data('block-id'), 1, 30); 7900 }); 7901 7902 $self.on('click', '.js-little-age', function(e) { 7903 e.preventDefault(); 7904 var $parent = $(this).closest('[data-block-id]'); 7905 7906 $parent.find('.lp-popup-block-3__confirm').hide(); 7907 $parent.find('.lp-popup-block-3__alert').show(); 7908 7909 createCookie('little_age', 1, 30); 7910 }); 7911 7912 function createCookie(name,value,days) { 7913 if (days) { 7914 var date = new Date(); 7915 date.setTime(date.getTime()+(days*24*60*60*1000)); 7916 var expires = "; expires="+date.toGMTString(); 7917 } 7918 else var expires = ""; 7919 document.cookie = name+"="+encodeURIComponent(value)+expires+"; path=/"; 7920 } 7921 } 7922 7923 lp_template.queue.certificates8 = function($self) { 7924 7925 var $block = $self.hasClass('lp-certificate-8') ? $self : $self.find('.lp-certificate-8'); 7926 7927 $block.each(function(){ 7928 var $this = $(this), 7929 $imageSlider = $this.find('.js-image-slider'), 7930 $textSlider = $this.find('.js-text-slider'), 7931 $sliderArrows = $this.find('.js-slider-arrows'), 7932 $autoplay = $imageSlider.data('autoplay'), 7933 $pause = $imageSlider.data('pause'), 7934 $speed = $imageSlider.data('speed'), 7935 $dots = $imageSlider.data('dots'), 7936 $infinite = !!$imageSlider.data('infinite'); 7937 if(s3LP.is_cms){ 7938 var $infinite = false, 7939 $autoplay = false;
7940 } 7941 else if(typeof ReactLPConstructor == 'object') { 7942 var $infinite = false, 7943 $autoplay = false; 7944 } 7945 7946 if ($('.lp-certificate-8__content').length) { 7947 if ($imageSlider.find('.js-image-slider-item').length > 3) { 7948 $imageSlider.slick({ 7949 asNavFor: $textSlider, 7950 prevArrow: $this.find('.js-prev-slide'), 7951 nextArrow: $this.find('.js-next-slide'), 7952 mobileFirst: true, 7953 slidesToScroll: 1, 7954 slidesToShow: 1, 7955 centerMode: true, 7956 centerPadding: '0', 7957 focusOnSelect: false, 7958 autoplay: $autoplay, 7959 autoplaySpeed: $pause, 7960 speed: $speed, 7961 infinite: $infinite, 7962 dots: $dots, 7963 dotsClass:'lp-certificate-8-slider__dots', 7964 appendDots:$('.lp-certificate-8__dots-block'), 7965 responsive: [{ 7966 breakpoint: 960, 7967 settings: { 7968 centerMode: true, 7969 slidesToShow: 3 7970 } 7971 }] 7972 }); 7973 } else { 7974 $sliderArrows.hide(); 7975 $imageSlider.css('display', 'flex'); 7976 } 7977 7978 7979 $(window).on('resize', function(){ 7980 setTimeout(function(){ 7981 var $dotItem = $this.find('.lp-certificate-8-slider__dots li button'); 7982 if ($dotItem.hasClass('lp-certificate-8-slider__dot')) { 7983 7984 } 7985 else { 7986 $dotItem.attr('data-elem-type', 'card_container'); 7987 $dotItem.addClass('lp-certificate-8-slider__dot'); 7988 $dotItem.attr('data-lp-selector','.lp-certificate-8-slider__dot'); 7989 } 7990 },100); 7991 }); 7992 7993 $textSlider.slick({ 7994 slidesToShow: 1, 7995 slidesToScroll: 1, 7996 fade: true, 7997 autoplay: $autoplay, 7998 autoplaySpeed: $pause, 7999 speed: $speed, 8000 infinite: $infinite, 8001 arrows: false, 8002 selector: '.js-text-slider-item', 8003 mobileFirst: true, 8004 asNavFor: $imageSlider, 8005 accessibility: false 8006 }); 8007 8008 $this.find('.js-lg-init').lightGallery({ 8009 selector: '.lg-item', 8010 toogleThumb: false, 8011 getCaptionFromTitleOrAlt: false, 8012 download: false, 8013 thumbWidth: 64, 8014 thumbHeight: '64px', 8015 nextHtml: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.98528 4.32805C9.3758 3.93753 10.009 3.93753 10.3995 4.32805L17.0563 10.9849C17.4469 11.3754 17.4469 12.0086 17.0563 12.3991L10.3995 19.056C10.009 19.4465 9.3758 19.4465 8.98528 19.056C8.59475 18.6654 8.59475 18.0323 8.98528 17.6418L14.935 11.692L8.98528 5.74226C8.59475 5.35174 8.59475 4.71857 8.98528 4.32805Z" fill="white"/></svg>', 8016 prevHtml: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14.8492 5.03516L8.19239 11.692L14.8492 18.3489" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>' 8017 }); 8018 } 8019 }); 8020 } 8021 8022 // УнивеÑÑалÑÐ½Ð°Ñ Ð¿ÑовеÑка на конÑÑÑÑкÑÐ¾Ñ (ÑедакÑоÑ) 8023 function isInEditor() { 8024 try { 8025 return typeof s3LP !== 'undefined' && s3LP.is_cms === true; 8026 } catch (e) { 8027 return false; 8028 } 8029 } 8030 8031 lp_template.queue.menuSimplePopup = function ($self) { 8032 var $block = $self.hasClass('js-menu-wrap') ? $self : $self.find('.js-menu-wrap'); 8033 8034 $block.each(function () { 8035 var $this = $(this), 8036 $topMenuWrap = $this.find('.js-menu__wrap'), 8037 $menu = $this.find('.js-menu_appedable'), 8038 $burger = $this.find('.js-burger'), 8039 $popup = $this.find('.js-popup'), 8040 $liHaschild = $this.find('.haschild'); 8041 8042 $this.append('<div class="lp-menu-block-bg"></div>'); 8043 8044 let popupHeight = $(window).height() - $this.height(); 8045 let popupTop = $this.outerHeight(); 8046 let bgTop = $this.height() + 50; 8047 8048 if (isInEditor()) { 8049 popupTop += 72; 8050 bgTop += 72; 8051 } 8052 8053 $this.find('.lp-menu-block-bg').animate({ top: bgTop }, 400); 8054 $popup.css('top', popupTop); 8055 /*$menu.clone().prependTo($topMenuWrap);*/ 8056 8057 if (!$topMenuWrap.find('.js-menu_appedable.lp-menu-clone').length) { 8058 $menu.clone().addClass('lp-menu-clone').prependTo($topMenuWrap); 8059 } 8060 8061 var $visibleMenu = $topMenuWrap.find('.js-menu_appedable'); 8062 8063 function initRowMenu() { 8064 if ($visibleMenu.hasClass('lp-menu-row')) { 8065 8066 const $firstLi = $visibleMenu.find('li').first(); 8067 const liClass = $firstLi.attr('class'); 8068 const aClass = $firstLi.find('a').attr('class'); 8069 const menuText = $visibleMenu.data('row-text'); 8070 8071 if (!$visibleMenu.find('.row-menu-btn').length && window.matchMedia('(min-width: 960px)').matches) { 8072 $visibleMenu.rowMenu({ 8073 moreText: menuText, 8074 moreWidth: 100 8075 }); 8076 8077 $visibleMenu.find('.row-menu-btn').addClass(liClass); 8078 $visibleMenu.find('.row-menu-btn > a').addClass(aClass); 8079 $visibleMenu.find('.row-menu-btn > ul').addClass('lp-row-menu__popup'); 8080 } 8081 } 8082 } 8083 8084 initRowMenu(); 8085 8086 function menuShow() { 8087 let ulWidth = 0; 8088 let ulWrapWidth = $topMenuWrap.width(); 8089 let $visibleMenu = $topMenuWrap.find('.js-menu_appedable'); 8090 8091 $visibleMenu.children('li').each(function () { 8092 ulWidth += $(this).outerWidth(true); 8093 }); 8094 8095 if (window.matchMedia('(min-width : 960px)').matches) { 8096 8097 if ($visibleMenu.hasClass('lp-menu-row')) { 8098 $topMenuWrap.addClass('show'); 8099 $burger.hide(); 8100 $visibleMenu.closest('.lp-row-menu__not-overflow').css('overflow', "initial"); 8101 8102 } else if (ulWidth <= ulWrapWidth) { 8103 $burger.hide(); 8104 $topMenuWrap.addClass('show'); 8105 8106 } else { 8107 $topMenuWrap.removeClass('show'); 8108 $burger.show(); 8109 } 8110 8111 } else { 8112 $topMenuWrap.removeClass('show'); 8113 $burger.show(); 8114 } 8115 8116 let newPopupTop = $this.outerHeight(); 8117 let newBgTop = $this.height(); 8118 8119 if (isInEditor()) { 8120 newPopupTop += 72; 8121 newBgTop += 72; 8122 } 8123 8124 $popup.css('top', newPopupTop); 8125 $this.find('.lp-menu-block-bg').animate({ top: newBgTop }, 400); 8126 } 8127 8128 function openMenu() { 8129 $popup.animate({ height: popupHeight }, 800).addClass('opened'); 8130 $this.find('.lp-menu-block-bg').fadeIn(600); 8131 $this.css('z-index', '999'); 8132 $('html').css('overflow', 'hidden'); 8133 } 8134 8135 function closeMenu() { 8136 $popup.animate({ height: "0%" }, 800).removeClass('opened'); 8137 $this.find('.lp-menu-block-bg').fadeOut(600); 8138 $this.css('z-index', ''); 8139 $('html').css('overflow', ''); 8140 $burger.removeClass('opened'); 8141 } 8142 8143 $(window).on('resize', function () { 8144 setTimeout(menuShow, 500); 8145 }).trigger('resize'); 8146 8147 $burger.on('click', function () { 8148 $menu.find('li a').addClass('menu-popup-item-custom'); 8149 8150 if ($(this).hasClass('_in-side')) { 8151 $popup.animate({ top: 0 }, 400); 8152 $this.find('.lp-menu-block-bg').css('top', 0); 8153 } else { 8154 const scrollTopOffset = isInEditor() ? $this.offset().top - 72 : $this.offset().top; 8155 $('html, body').animate({ scrollTop: scrollTopOffset }, 100); 8156 } 8157 8158 $popup.find('.js-popup__inner').css({ 8159 overflow: 'auto', 8160 'max-height': '100%' 8161 }); 8162 8163 $burger.addClass('opened'); 8164 8165 if ($popup.hasClass('opened')) { 8166 closeMenu(); 8167 } else { 8168 openMenu(); 8169 } 8170 }); 8171 8172 $this.find('.haschild').on('click', function(e){ 8173 e.stopPropagation(); 8174 $(this).toggleClass('_open').children('ul').slideToggle(); 8175 }); 8176 8177 /*$liHaschild.on('click', function (e) { 8178 e.stopPropagation(); 8179 const $thisItem = $(this); 8180 $thisItem.toggleClass('_open').children('ul').slideToggle(); 8181 8182 if ($thisItem.hasClass('lp-menu-22-burger__item')) { 8183 $thisItem.siblings('.lp-menu-22-burger__item._open') 8184 .removeClass('_open') 8185 .children('ul').slideUp(); 8186 } 8187 });*/ 8188 8189 $popup.find('.js-menu_appedable').on('click', 'a', function () { 8190 closeMenu(); 8191 }); 8192 8193 8194 $(document).on('click', function (e) { 8195 const $popupInner = $popup.find('.js-popup__inner'); 8196 8197 if (isInEditor()) return; 8198 8199 if ( 8200 !$popupInner.is(e.target) && 8201 $popupInner.has(e.target).length === 0 && 8202 !$burger.is(e.target) && 8203 $burger.has(e.target).length === 0 8204 ) { 8205 closeMenu(); 8206 } 8207 }); 8208 8209 $(document).on('keydown', function (e) { 8210 if ((e.key === 'Escape' || e.keyCode === 27) && $popup.hasClass('opened')) { 8211 closeMenu(); 8212 } 8213 }); 8214 8215 8216 if (isInEditor() && typeof LpController !== 'undefined') { 8217 setTimeout(function () { 8218 LpController.afterSave(function () { 8219 menuShow(); 8220 setTimeout(function () { 8221 $(window).trigger('resize'); 8222 }, 500); 8223 }); 8224 }, 2000); 8225 } 8226 }); 8227 }; 8228 8229 lp_template.queue.productsTabs10 = function($self) { 8230 let $tabsBlock = $self.find('.js-prods10'); 8231 8232 if ($tabsBlock.length) { 8233 $tabsBlock.each(function(){ 8234
8235 let $this = $(this), 8236 $tabItem = $this.find('.js-tab-item'), 8237 $tabContent = $this.find('.js-content'), 8238 $firstTabItem = $tabItem.first(), 8239 $firstTabContent = $tabContent.first(), 8240 8241 activeFirstTab = function(){ 8242 $firstTabItem.addClass('_active'); 8243 $firstTabContent.addClass('_active'); 8244 } 8245 8246 activeFirstTab(); 8247 8248 8249 $tabItem.on('click', function() { 8250 $(this).addClass('_active').siblings().removeClass('_active'); 8251 $tabContent.removeClass('_active').eq($(this).index()).addClass('_active'); 8252 }); 8253 }) 8254 } 8255 } 8256 8257 lp_template.queue.setPropsForCircled = function($self) { 8258 var $block = $self.find('.circled_container'); 8259 8260 var resizedFunction = function() { 8261 $block.each(function(){ 8262 var $this = $(this); 8263 8264 $this.css({ 8265 'width' : '', 8266 'height' : '' 8267 }); 8268 8269 var $thisHeight = $this.height(), 8270 $thisWidth = $this.width(), 8271 maxValue = $thisHeight > $thisWidth ? $thisHeight : $thisWidth; 8272 8273 setTimeout(function(){ 8274 $this.css({ 8275 'width' : maxValue, 8276 'height' : maxValue 8277 }); 8278 },1000); 8279 }); 8280 } 8281 8282 $(window).on('resize', resizedFunction); 8283 if (s3LP.is_cms && typeof LpController !== 'undefined') { 8284 setTimeout(function(){ 8285 LpController.afterSave(function () { 8286 resizedFunction(); 8287 }); 8288 },1000); 8289 } 8290 } 8291 8292 lp_template.queue.equalHeight = function($self) { 8293 var $block = $self.find('.equal-height'); 8294 8295 var resizedFunction = function() { 8296 $block.each(function(){ 8297 var $this = $(this); 8298 8299 $this.css({ 8300 'height' : '' 8301 }); 8302 8303 var $thisWidth = $this.width(), 8304 maxValue = $thisWidth; 8305 8306 setTimeout(function(){ 8307 $this.css({ 8308 'height' : maxValue 8309 }); 8310 },1000); 8311 }); 8312 } 8313 8314 $(window).on('resize', resizedFunction); 8315 if (s3LP.is_cms && typeof LpController !== 'undefined') { 8316 setTimeout(function(){ 8317 LpController.afterSave(function () { 8318 resizedFunction(); 8319 }); 8320 },1000); 8321 } 8322 } 8323 8324 lp_template.queue.steps17 = function($self) { 8325 var $block = $self.hasClass('lp-steps-17') ? $self : $self.find('.lp-steps-17'); 8326 $block.each(function(){ 8327 if ($(this).length) { 8328 $(this).find('.js-counter-btn').on('click', function(){ 8329 var $this = $(this), 8330 $thisIndex = $this.index(), 8331 $item = $this.parents('.lp-steps-17').find('.js-slider-item').eq($thisIndex); 8332 if (!$this.hasClass('_active')) $this.addClass('_active').siblings().removeClass('_active'); 8333 if (!$item.hasClass('_active')) $($item).fadeIn().addClass('_active').css('display', 'flex').siblings().hide().removeClass('_active'); 8334 }); 8335 } 8336 }); 8337 } 8338 8339 lp_template.queue.qa13 = function($self) { 8340 var $block = $self.hasClass('lp-qa-13') ? $self : $self.find('.lp-qa-13'); 8341 if ($block.length) { 8342 $block.each(function(){ 8343 var $this = $(this); 8344 try { 8345 let colWrapper = '<div class="lp-qa-13-items-col"></div>', 8346 windowWidth = $(window).width(), 8347 evenElems = $this.find('.lp-qa-13-item:nth-child(even)'); 8348 8349 8350 $this.find('.lp-qa-13-item').each(function(index, element){ 8351 $(this).css('order', index+1); 8352 evenElems.addClass('_even'); 8353 }); 8354 8355 let splitInCols = function() { 8356 if (windowWidth >= 960) { 8357 /* $this.find('.lp-qa-13-items > .lp-qa-13-item:odd').wrapAll(colWrapper); 8358 $this.find('.lp-qa-13-items > .lp-qa-13-item').wrapAll(colWrapper);*/ 8359 8360 $this.find('.lp-qa-13-item._even').prependTo($this.find('.lp-qa-13-items-col').last()); 8361 } 8362 } 8363 8364 let setItemHeight = function(windowWidth) { 8365 if (windowWidth >= 960) { 8366 $this.find('.lp-qa-13-items-col').first().children('.lp-qa-13-item').each(function(index, element){ 8367 8368 let firstColItem = $(this).children('.lp-qa-13-item-title-wrapper'), 8369 secColItem = $this.find('.lp-qa-13-items-col').last().children('.lp-qa-13-item').eq(index).children('.lp-qa-13-item-title-wrapper'); 8370 if (firstColItem.height()<secColItem.height()) { 8371 firstColItem.css('min-height', secColItem.height()); 8372 } else { 8373 secColItem.css('min-height', firstColItem.height()); 8374 } 8375 }); 8376 } else { 8377 $this.find('.lp-qa-13-item-title-wrapper').css('min-height', ''); 8378 } 8379 } 8380 splitInCols(); 8381 setItemHeight(windowWidth); 8382 $(window).resize(function(){ 8383 let newWindowWidth = $(window).width(); 8384 if (windowWidth>=960){ 8385 if (newWindowWidth < 960) { 8386 windowWidth = newWindowWidth; 8387 //$this.find('.lp-qa-13-item').unwrap(); 8388 $this.find('.lp-qa-13-items-col').last().find('.lp-qa-13-item._even').appendTo($this.find('.lp-qa-13-items-col').first()); 8389 } 8390 } else if (windowWidth<960){ 8391 if (newWindowWidth>=960) { 8392 windowWidth = newWindowWidth; 8393 splitInCols(); 8394 } 8395 } 8396 setItemHeight(newWindowWidth); 8397 }); 8398 8399 } catch(e) { 8400 console.log(e); 8401 } 8402 }); 8403 } 8404 } 8405 8406 lp_template.queue.header11 = function($self) { 8407 var $block = $self.hasClass('has-one-line-menu') ? $self : $self.find('.has-one-line-menu'); 8408 if ($block.length) { 8409 $block.each(function(){ 8410 var $this = $(this), 8411 $menu = $this.find('.js-nav-menu'),
8412 $menuControls = !!$this.data('menu-controls') ? $this.data('menu-controls') : 'border, indents, shadow, background', 8413 $dots = $this.find('.js-nav-menu-dots'), 8414 $navMenu = $this.find('.js-menu-wrap .js-nav-menu'), 8415 $lastLi = $this.find('.js-hidden-nav-menu'), 8416 $burger = $this.find('.js-side-menu-open-btn'), 8417 $sideMenu = $this.find('.js-side-menu'), 8418 $burgerIconsColor = $menu.find('li > a').css("color"); 8419 8420 /*function oneLineMenu() { 8421 $navMenu.oneLineMenu({ 8422 minWidth : 599, 8423 lastClass : 'lp-header-hidden-nav js-hidden-nav-menu', 8424 left: -25, 8425 kebabHtml: '<div class="lp-header-dots js-nav-menu-dots" data-has-event="1" data-elem-type="container" data-lp-selector=".lp-header-dots"><div class="lp-header-dots-in" data-lp-selector=".circle" data-elem-type="container"><div class="circle"></div><div class="circle"></div><div class="circle"></div></div></div>' 8426 }); 8427 8428 $(window).on('resize', function(){ 8429 $dots = $this.find('.js-nav-menu-dots'), 8430 $lastLi = $this.find('.js-hidden-nav-menu'); 8431 $dots.on('click', function(){ 8432 $this.find('.js-hidden-nav-menu > ul').toggleClass('_open'); 8433 }); 8434 8435 $lastLi.find('a').on('click', function(){ 8436 $this.find('.js-hidden-nav-menu > ul').toggleClass('_open'); 8437 }); 8438 8439 $this.find('.js-hidden-nav-menu > ul').attr('data-elem-type', 'generate').attr('data-lp-controls-list', $menuControls).addClass('lp-menu-19-inner').attr('data-lp-selector', '.lp-menu-19-inner'); 8440 $this.find('.lp-block-bg').clone().prependTo($this.find('.js-hidden-nav-menu > ul')); 8441 }).trigger('resize'); 8442 8443 $burger.on('click', function(){ 8444 $sideMenu.toggleClass('_open'); 8445 $this.find('._overlay').toggleClass('_open'); 8446 $this.toggleClass('_opened'); 8447 $burger.toggleClass('is-active'); 8448 $('body').toggleClass('overflow'); 8449 }); 8450 8451 $sideMenu.on('click', 'a', function(){ 8452 $sideMenu.toggleClass('_open'); 8453 $this.find('._overlay').toggleClass('_open'); 8454 $this.toggleClass('_opened'); 8455 $burger.toggleClass('is-active'); 8456 $('body').toggleClass('overflow'); 8457 }); 8458 8459 $burger.find('.burger-inner, .hamburger-inner').css('background', $burgerIconsColor); 8460 }*/ 8461 8462 function oneLineMenu() { 8463 8464 $navMenu.oneLineMenu({ 8465 minWidth : 599, 8466 lastClass : 'lp-header-hidden-nav js-hidden-nav-menu', 8467 left: -25, 8468 kebabHtml: '<div class="lp-header-dots js-nav-menu-dots" data-has-event="1" data-elem-type="container" data-lp-selector=".lp-header-dots"><div class="lp-header-dots-in" data-lp-selector=".circle" data-elem-type="container"><div class="circle"></div><div class="circle"></div><div class="circle"></div></div></div>' 8469 }); 8470 8471 $(window).on('resize', function () { 8472 8473 $dots = $this.find('.js-nav-menu-dots'); 8474 $lastLi = $this.find('.js-hidden-nav-menu'); 8475 8476 // Ðлик по ÑоÑкам 8477 $dots.off('click').on('click', function (e) { 8478 e.stopPropagation(); 8479 $this.find('.js-hidden-nav-menu > ul').toggleClass('_open'); 8480 }); 8481 8482 // Ðлик по пÑнкÑÑ Ð¼ÐµÐ½Ñ 8483 $lastLi.find('a').off('click').on('click', function (e) { 8484 e.stopPropagation(); 8485 $this.find('.js-hidden-nav-menu > ul').removeClass('_open'); 8486 }); 8487 8488 // ÐÑÑибÑÑÑ 8489 $this.find('.js-hidden-nav-menu > ul').attr('data-elem-type', 'generate').attr('data-lp-controls-list', $menuControls).addClass('lp-menu-19-inner').attr('data-lp-selector', '.lp-menu-19-inner'); 8490 8491 if (!$this.find('.js-hidden-nav-menu > ul .lp-block-bg').length) { 8492 $this.find('.lp-block-bg').clone().prependTo($this.find('.js-hidden-nav-menu > ul')); 8493 } 8494 8495 }).trigger('resize'); 8496 8497 $burger.on('click', function (e) { 8498 e.stopPropagation(); 8499 8500 $sideMenu.toggleClass('_open'); 8501 $this.find('._overlay').toggleClass('_open'); 8502 $this.toggleClass('_opened'); 8503 $burger.toggleClass('is-active'); 8504 $('body').toggleClass('overflow'); 8505 }); 8506 8507 $sideMenu.on('click', 'a', function () { 8508 $sideMenu.removeClass('_open'); 8509 $this.find('._overlay').removeClass('_open'); 8510 $this.removeClass('_opened'); 8511 $burger.removeClass('is-active'); 8512 $('body').removeClass('overflow'); 8513 }); 8514 8515 $(document).on('click', function () { 8516 8517 if (!s3LP.is_cms && typeof LpController !== 'undefined') { 8518 8519 $this.find('.js-hidden-nav-menu > ul').removeClass('_open'); 8520 8521 if ($sideMenu.hasClass('_open')) { 8522 $sideMenu.removeClass('_open'); 8523 $this.find('._overlay').removeClass('_open'); 8524 $this.removeClass('_opened'); 8525 $burger.removeClass('is-active'); 8526 $('body').removeClass('overflow'); 8527 } 8528 } 8529 }); 8530 8531 $this.on('click', '.js-hidden-nav-menu, .js-nav-menu-dots, ._overlay, .lp-header, .lp-header *', function (e) { 8532 e.stopPropagation(); 8533 }); 8534 8535 //$burger.find('.burger-inner, .hamburger-inner').css('background', $burgerIconsColor); 8536 } 8537 8538 oneLineMenu(); 8539 8540 if (s3LP.is_cms && typeof LpController !== 'undefined') { 8541 setTimeout(function(){ 8542 LpController.afterSave(function () { 8543 $navMenu.destroy(); 8544 oneLineMenu(); 8545 }); 8546 },1000); 8547 } 8548 8549 if ($block.hasClass('lp-header-14')) { 8550 if ($block.find('.lp-header-14-nav li').length == 0) { 8551 $block.find('.lp-header-14-side-menu-button').hide(); 8552 } 8553 } 8554 }); 8555 } 8556 } 8557 8558 lp_template.queue.steps14 = function($self) { 8559 8560 var $block = $self.hasClass('lp-steps-14') ? $self : $self.find('.lp-steps-14'); 8561 8562 if ($block.length) { 8563 $block.each(function(){ 8564 var $this = $(this);
8565 try { 8566 var wrapRows = function wrapRows() { 8567 var itemsCount = $this.find('.lp-steps-14-content>.lp-steps-14-item').length 8568 , sliceFunc = function sliceFunc(itemsInRow) { 8569 for (var i = 0; i < itemsCount / itemsInRow; i++) { 8570 $this.find('.lp-steps-14-content>.lp-steps-14-item').slice(0, itemsInRow).wrapAll(wrapper); 8571 } 8572 }; 8573 8574 if (windowWidth < 600) {} else if (windowWidth < 960) { 8575 sliceFunc(2); 8576 } else if (windowWidth < 1200) { 8577 sliceFunc(3); 8578 } else { 8579 sliceFunc(itemsInRow); 8580 } 8581 }; 8582 8583 var windowWidth = $(window).width() 8584 , wrapper = '<div class="lp-steps-14-row"></div>' 8585 , itemsInRow = $this.find('.lp-steps-14-content').attr('data-count'); 8586 wrapRows(); 8587 $(window).resize(function() { 8588 var newWindowWidth = $(window).width(); 8589 8590 if (windowWidth < 960 && windowWidth >= 600) { 8591 if (newWindowWidth >= 960 || newWindowWidth < 600) { 8592 windowWidth = newWindowWidth; 8593 $this.find('.lp-steps-14-row>.lp-steps-14-item').unwrap(); 8594 wrapRows(); 8595 } 8596 } else if (windowWidth < 1200 && windowWidth >= 960) { 8597 if (newWindowWidth >= 1200 || newWindowWidth < 960) { 8598 windowWidth = newWindowWidth; 8599 $this.find('.lp-steps-14-row>.lp-steps-14-item').unwrap(); 8600 wrapRows(); 8601 } 8602 } else if (windowWidth >= 1200) { 8603 if (newWindowWidth < 1200) { 8604 windowWidth = newWindowWidth; 8605 $this.find('.lp-steps-14-row>.lp-steps-14-item').unwrap(); 8606 wrapRows(); 8607 } 8608 } else if (windowWidth < 600) { 8609 if (newWindowWidth >= 600) { 8610 windowWidth = newWindowWidth; 8611 $this.find('.lp-steps-14-row>.lp-steps-14-item').unwrap(); 8612 wrapRows(); 8613 } 8614 } 8615 8616 8617 if (window.matchMedia('(min-width : 600px)').matches) { 8618 var $circle = $this.find('.lp-steps-14-item__counter'), 8619 $circleHeight = $circle.outerHeight() / 2, 8620 $lastItem = $this.find('.lp-steps-14-item:not(:last-child)'), 8621 $arrow = $lastItem.find('.lp-steps-14-item__arrow'); 8622 8623 $('.lp-steps-14-item__arrow').css('top', ''); 8624 $arrow.css('top', $circleHeight); 8625 } 8626 8627 else { 8628 $('.lp-steps-14-item__arrow').css('top', ''); 8629 } 8630 8631 8632 8633 }); 8634 } catch (e) { 8635 console.log(e); 8636 } 8637 }); 8638 } 8639 } 8640 8641 lp_template.queue.features28 = function($self) { 8642 var $block = $self.hasClass('lp-features-28') ? $self : $self.find('.lp-features-28'); 8643 8644 if ($block.length) { 8645 8646 $block.each(function() { 8647 var $this = $(this), 8648 pie28 = ''; 8649 8650 function donutInit() { 8651 var listData = new Array(), 8652 listColor = new Array(), 8653 $pie = '.lp-features-28-pie'; 8654 8655 $this.find('.lp-features-28-item').each(function(index, element){ 8656 let itemValue = parseInt($(this).find('.lp-features-28-item__text').text()), 8657 itemText = $(this).find('.lp-features-28-item__text').text(); 8658 8659 listColor.push($(this).find('.lp-features-28-item__color').css('background-color')), 8660 listData.push([itemText, itemValue]); 8661 }); 8662 8663 pie28 = $.jqplot($pie, [listData], { 8664 seriesDefaults: {
8665 renderer:$.jqplot.DonutRenderer, 8666 rendererOptions:{ 8667 padding: 0, 8668 shadowOffset: 0, 8669 sliceMargin: 0, 8670 startAngle: 180, 8671 showDataLabels: true, 8672 dataLabels: 'label', 8673 totalLabel: false, 8674 seriesColors: listColor, 8675 borderWidth: 0.0 8676 } 8677 }, 8678 grid: { 8679 borderWidth: 0.0, 8680 shadow: false, 8681 background: '#ffffff', 8682 backgroundColor: 'rgba(255, 255, 255, 0)' 8683 8684 } 8685 }); 8686 8687 $this.find('.lp-features-28-pie .jqplot-data-label').addClass('lp-header-title-6 lp-features-28-item__text').attr('data-elem-type', 'text'); 8688 $this.find('.lp-features-28-pie .jqplot-data-label').attr('data-lp-selecttor', '.lp-features-28-item__text'); 8689 } 8690 8691 donutInit(); 8692 8693 if (s3LP.is_cms && typeof LpController !== 'undefined') { 8694 setTimeout(function(){ 8695 LpController.afterSave(function () { 8696 8697 pie28.destroy(); 8698 setTimeout(function(){ 8699 donutInit(); 8700 },1000); 8701 8702 }); 8703 },1000); 8704 } 8705 8706 $(window).resize(function(){ 8707 if (window.matchMedia('(max-width : 600px)').matches) { 8708 pie28.destroy(); 8709 donutInit(); 8710 } 8711 else { 8712 pie28.destroy(); 8713 donutInit(); 8714 } 8715 }); 8716 8717 }); 8718 } 8719 }; 8720 8721 lp_template.queue.features31 = function($self) { 8722 var $block = $self.hasClass('lp-features-31') ? $self : $self.find('.lp-features-31'); 8723 8724 if ($block.length) { 8725 8726 $block.each(function() { 8727 var $this = $(this); 8728 8729 $this.find('.lp-features-31-item').each(function(index, element){ 8730 var listData = new Array(), 8731 listColor = new Array(), 8732 $pie = '#' + $this.find('.lp-features-31-pie').eq(index).attr('id'), 8733 $innerDiameter = 250; 8734 8735 let itemValue = parseInt($(this).find('.lp-features-31-item__title').attr('data-value')), 8736 itemValueHidden = parseInt($(this).find('.lp-features-31-item__title._hidden').attr('data-value')), 8737 itemText = $(this).find('.lp-features-31-item__text').text(), 8738 itemTextHidden = $(this).find('.lp-features-31-item__title._hidden + .lp-features-31-item__text').text(); 8739 listColor.push($(this).find('.lp-features-31-item__color._active-color').css('background-color')); 8740 listColor.push($(this).find('.lp-features-31-item__color._disabled-color').css('background-color')); 8741 listData.push([itemTextHidden, itemValueHidden]); 8742 listData.push([itemText, itemValue]); 8743 8744 $(window).on('resize', function(){ 8745 8746 if (window.matchMedia('(min-width : 1380px)').matches) { 8747 $innerDiameter = 222; 8748 } else if (window.matchMedia('(min-width : 1200px)').matches) { 8749 $innerDiameter = 224; 8750 } else if (window.matchMedia('(min-width : 960px)').matches) { 8751 $innerDiameter = 228; 8752 } else if (window.matchMedia('(min-width : 600px)').matches) { 8753 $innerDiameter = 241; 8754 } 8755 8756 if(!$('.lp-features-31-pie').eq(index).is(':empty')) { 8757 $('.lp-features-31-pie').html(''); 8758 } 8759 8760 var pie31 = $.jqplot($pie, [listData], { 8761 seriesDefaults: { 8762 renderer:$.jqplot.DonutRenderer, 8763 rendererOptions:{ 8764 padding: 0, 8765 shadowOffset: 0, 8766 innerDiameter: $innerDiameter, 8767 sliceMargin: 0, 8768 startAngle: -90, 8769 showDataLabels: true, 8770 dataLabels: 'label', 8771 totalLabel: false, 8772 seriesColors: listColor, 8773 borderWidth: 0.0 8774 } 8775 }, 8776 grid: { 8777 borderWidth: 0.0, 8778 shadow: false, 8779 background: 'rgba(255, 255, 255, 0)' 8780 } 8781 }); 8782 8783 $this.find('.lp-features-31-pie .jqplot-data-label').addClass('lp-header-title-1 lp-features-31-item__text').attr('data-elem-type','text').attr('data-lp-selector','.lp-features-31-item__text'); 8784 }).trigger('resize'); 8785 8786 }); 8787 8788 }); 8789 } 8790 }; 8791 8792 8793 lp_template.queue.sertificate5 = function($self) { 8794 var $block = $self.hasClass('lp-certificate-5') ? $self : $self.find('.lp-certificate-5'); 8795 8796 if ($block.length) { 8797 8798 $block.each(function() { 8799 var $this = $(this); 8800 8801 function isotopeinit () { 8802 var $mansoryItem = $this.find('.js-main-item'), 8803 $isotope = $this.find('.js-isotope'); 8804 8805 setTimeout(function(){ 8806 $isotope.isotope({ 8807 itemSelector: '.js-isotope-item', 8808 originLeft: true 8809 }); 8810 }, 0.100); 8811 } 8812 isotopeinit(); 8813 8814 if (s3LP.is_cms && typeof LpController !== 'undefined') { 8815 setTimeout(function(){ 8816 LpController.afterSave(function () { 8817 isotopeinit(); 8818 }); 8819 },1000); 8820 } 8821 }); 8822 } 8823 }; 8824 8825 8826 lp_template.queue.sertificate9 = function($self) { 8827 var $block = $self.hasClass('lp-certificate-9') ? $self : $self.find('.lp-certificate-9'); 8828 8829 if ($block.length) { 8830 8831 $block.each(function() { 8832 var $this = $(this); 8833 8834 8835 if ($this.find('.lp-certificate-9-item').hasClass('_not_con')) { 8836 $this.find('.lp-certificate-9-arrow').hide(); 8837 } 8838 }); 8839 } 8840 }; 8841 8842 lp_template.queue.Init221303 = function ($self) { 8843 8844 var $gallery = $self.find('.lp-gallery-2'); 8845 8846 if ($gallery.length) { 8847 $gallery.each(function(){ 8848 var $thisBlock = $(this); 8849 var $window = $(window); 8850 var $maskPhoto = $(this).find('.js-photo-mask'); 8851 var $mainPhoto = $(this).find('.js-main-item'); 8852 var $previewPhoto = $(this).find('.js-preview-item'); 8853 var $touchStartX = 0; 8854 var $touchEndX = 0; 8855 var $nextPhotoBtn = $(this).find('.js-next-item'); 8856 var $prevPhotoBtn = $(this).find('.js-prev-item'); 8857 var $showMoreBtn = $(this).find('.js-show-more'); 8858 var $lightGallery = $(this).find('.js-light-gallery'); 8859 8860 8861 $mainPhoto.on('touchstart', function() { 8862 // event.preventDefault(); 8863 // event.stopPropagation(); 8864 $touchStartX = event.targetTouches[0].screenX; 8865 }); 8866 8867 $mainPhoto.on('touchend', function() { 8868 // event.preventDefault(); 8869 // event.stopPropagation(); 8870 $touchEndX = event.changedTouches[0].screenX; 8871 handleGesture(); 8872 }); 8873 8874 function showNextPhoto() { 8875 if ($mainPhoto.length <= 7) { 8876 if ( !$mainPhoto.last().hasClass('_active')) { 8877 $mainPhoto.siblings('._active').next().addClass('_active'); 8878 $previewPhoto.siblings('._active').next().addClass('_active'); 8879 $mainPhoto.siblings('._active').first().removeClass('_active'); 8880 $previewPhoto.siblings('._active').first().removeClass('_active'); 8881 } else { 8882 $mainPhoto.siblings().removeClass('_active'); 8883 $previewPhoto.siblings().removeClass('_active'); 8884 $mainPhoto.first().addClass('_active'); 8885 $previewPhoto.first().addClass('_active'); 8886 } 8887 } else { 8888 if ( !$mainPhoto.eq(5).hasClass('_active')) { 8889 $mainPhoto.siblings('._active').next().addClass('_active'); 8890 $previewPhoto.siblings('._active').next().addClass('_active'); 8891 $mainPhoto.siblings('._active').first().removeClass('_active'); 8892 $previewPhoto.siblings('._active').first().removeClass('_active'); 8893 } else { 8894 $mainPhoto.siblings().removeClass('_active'); 8895 $previewPhoto.siblings().removeClass('_active'); 8896 $mainPhoto.first().addClass('_active'); 8897 $previewPhoto.first().addClass('_active'); 8898 } 8899 } 8900 8901 $thisBlock.find('.lp-gallery-2-photo__preview-item-mask._active').removeClass('_active').attr('data-lp-selector', '.lp-gallery-2-photo__preview-item-mask'); 8902 $thisBlock.find('.lp-gallery-2-photo__preview-item._active .lp-gallery-2-photo__preview-item-mask').addClass('_active').attr('data-lp-selector', '.lp-gallery-2-photo__preview-item-mask._active'); 8903 } 8904 8905 function showPrevPhoto() { 8906 8907 if ($mainPhoto.length <= 7) { 8908 if ( !$mainPhoto.first().hasClass('_active')) { 8909 $mainPhoto.siblings('._active').prev().addClass('_active'); 8910 $previewPhoto.siblings('._active').prev().addClass('_active'); 8911 $mainPhoto.siblings('._active').last().removeClass('_active'); 8912 $previewPhoto.siblings('._active').last().removeClass('_active'); 8913 } else { 8914 $mainPhoto.siblings().removeClass('_active'); 8915 $previewPhoto.siblings().removeClass('_active'); 8916 $mainPhoto.last().addClass('_active'); 8917 $previewPhoto.last().addClass('_active'); 8918 } 8919 } else { 8920 if ( !$mainPhoto.first().hasClass('_active')) { 8921 $mainPhoto.siblings('._active').prev().addClass('_active'); 8922 $previewPhoto.siblings('._active').prev().addClass('_active'); 8923 $mainPhoto.siblings('._active').last().removeClass('_active'); 8924 $previewPhoto.siblings('._active').last().removeClass('_active'); 8925 } else { 8926 $mainPhoto.siblings().removeClass('_active'); 8927 $previewPhoto.siblings().removeClass('_active'); 8928 $mainPhoto.eq(5).addClass('_active'); 8929 $previewPhoto.eq(5).addClass('_active'); 8930 } 8931 } 8932 8933 $thisBlock.find('.lp-gallery-2-photo__preview-item-mask._active').removeClass('_active').attr('data-lp-selector', '.lp-gallery-2-photo__preview-item-mask'); 8934 $thisBlock.find('.lp-gallery-2-photo__preview-item._active .lp-gallery-2-photo__preview-item-mask').addClass('_active').attr('data-lp-selector', '.lp-gallery-2-photo__preview-item-mask._active'); 8935 } 8936 8937 8938 8939 function handleGesture() { 8940 var $touchPath = $touchStartX - $touchEndX; 8941 if (Math.abs($touchPath) > 50) { 8942 if ($touchPath > 0) { 8943 //Next 8944 showNextPhoto(); 8945 } else { 8946 //Prev 8947 showPrevPhoto(); 8948 } 8949 } 8950 } 8951 8952 var setPhotoMaskSize = function() { 8953 $maskPhoto.height($maskPhoto.width()); 8954 } 8955 8956 8957 var showFirstPhoto = function() { 8958 $mainPhoto.first().addClass('_active'); 8959 $previewPhoto.first().addClass('_active'); 8960 $previewPhoto.first().find('.lp-gallery-2-photo__preview-item-mask').addClass('_active').attr('data-lp-selector', '.lp-gallery-2-photo__preview-item-mask._active'); 8961 } 8962 8963 showFirstPhoto(); 8964 8965 if ($(window).width() < 600) { 8966 setPhotoMaskSize(); 8967 } 8968 8969 $window.resize(function() { 8970 if ($(window).width() < 600) { 8971 setPhotoMaskSize(); 8972 } 8973 }) 8974 8975 $nextPhotoBtn.on ('click', function (e) { 8976 e.preventDefault(); 8977 showNextPhoto(); 8978 }) 8979 8980 $prevPhotoBtn.on('click', function (e) { 8981 e.preventDefault(); 8982 showPrevPhoto(); 8983 }) 8984 8985 $previewPhoto.on('click', function() { 8986 var $this = $(this); 8987 if (!$this.hasClass('_active')) { 8988 $this.addClass('_active'); 8989 $this.find('.lp-gallery-2-photo__preview-item-mask').addClass('_active').attr('data-lp-selector', '.lp-gallery-2-photo__preview-item-mask._active'); 8990 $this.siblings().removeClass('_active'); 8991 $this.siblings().find('.lp-gallery-2-photo__preview-item-mask').removeClass('_active').attr('data-lp-selector', '.lp-gallery-2-photo__preview-item-mask'); 8992 } 8993 $mainPhoto.eq($this.index()).addClass('_active').siblings().removeClass('_active'); 8994 }) 8995 8996 $lightGallery.lightGallery({ 8997 thumbnail: true, 8998 hideControlOnEnd: true,
8999 slideEndAnimatoin: false, 9000 loop: true, 9001 download: false, 9002 thumbWidth: 64, 9003 thumbContHeight: 96, 9004 toogleThumb: false, 9005 thumbMargin: 8, 9006 selector: '.js-main-item' 9007 }) 9008 9009 $showMoreBtn.on('click', function() { 9010 $mainPhoto.eq(6).trigger('click') 9011 }) 9012 }) 9013 } 9014 } 9015 9016 lp_template.queue.lpGallery20 = function ($self) { 9017 9018 var $block = $self.hasClass('lp-gallery-20') ? $self : $self.find('.lp-gallery-20'); 9019 9020 if ($block.length) { 9021 $block.each(function(){ 9022 var $this = $(this), 9023 $photos = $this.find('.js-photos'); 9024 9025 function placePhotoToMosaic() { 9026 $photos.children('.js-photo').each(function(index) { 9027 if (window.outerWidth < 960) { 9028 if (index % 3 == 0) { // wrap by 2 items 9029 9030 $(this).add($(this).next('.js-photo')).add( 9031 $(this).next().next('.js-photo') 9032 ).wrapAll('<div class="lp-gallery-20-photo__item-wrap 1" />'); 9033 } 9034 } else { 9035 9036 if (index % 5 == 0) { // wrap by 2 items 9037 9038 $(this).add( 9039 $(this).next('.js-photo')).add( 9040 $(this).next().next('.js-photo').add( 9041 $(this).next().next().next('.js-photo').add( 9042 $(this).next().next().next().next('.js-photo') 9043 ) 9044 ) 9045 ).wrapAll('<div class="lp-gallery-20-photo__item-wrap " />'); 9046 } 9047 9048 // коÑÑÑÐ»Ñ Ð´Ð»Ñ ÐРв СУ, ÑÑÐ¾Ð±Ñ Ð½Ðµ ÑÑавил две обеÑÑки 9049 if ($photos.find('.js-photo').parent().hasClass('lp-gallery-20-photo__item-wrap')) { 9050 return; 9051 } 9052 } 9053 }); 9054 9055 $photos.find('.lp-gallery-20-photo__item-wrap').each(function(el) { 9056 $(this).addClass('_' + $(this).children().length + '-item') 9057 }); 9058 } 9059 9060 $(window).on('resize', function(){ 9061 if ($photos.find('.js-photo').parent().hasClass('lp-gallery-20-photo__item-wrap')) { 9062 $photos.find('.js-photo').unwrap(); 9063 } 9064 9065 setTimeout(function(){ 9066 placePhotoToMosaic(); 9067 },0); 9068 }); 9069 }) 9070 } 9071 } 9072 9073 lp_template.queue.lpGallery22 = function($self) { 9074 var $block = $self.hasClass('lp-gallery-22') ? $self : $self.find('.lp-gallery-22'); 9075 9076 if ($block.length) { 9077 $block.each(function(){ 9078 var $this = $(this), 9079 $slider = $this.find('.js-owl-carousel'), 9080 autoplay = !!$slider.data('autoplay'), 9081 loop = !!$slider.data('infinite'), 9082 nav = !!$slider.data('arrows'), 9083 dotsEach = !!$slider.data('dots-each'), 9084 dots = 1, 9085 pause = $slider.data('pause') || 5000, 9086 $rewind = 0, 9087 speed = $slider.data('speed') || 250, 9088 fade = !!$slider.data('fade'), 9089 $parent = $slider.closest('[data-block-layout]'), 9090 dataResponse = $slider.data('response'), 9091 response = {}, 9092 $dots = $parent.find('.lp-dots-wrapper'), 9093 $window = $(window), 9094 $itemsInRow; 9095 9096 if(s3LP.is_cms){ 9097 var infinite = false, 9098 $rewind = 1, 9099 autoplay = false; 9100 } 9101 else if(typeof ReactLPConstructor == 'object') { 9102 var infinite = false, 9103 $rewind = 1, 9104 autoplay = false; 9105 9106 } 9107 9108 9109 $slider.find('.js-photo-item').each(function(index) { 9110 if (index % 2 == 0) { // wrap by 2 items 9111 $(this).add($(this).next('.js-photo-item')).wrapAll('<div class="lp-gallery-22-gallery-item-wrap js-owl-carousel-item" />'); 9112 } 9113 }); 9114 9115 var $sliderItem = $this.find('.js-owl-carousel-item'); 9116 9117 if ($this.hasClass('_6')) { 9118 $itemsInRow = 6; 9119 } else if ($this.hasClass('_8')) { 9120 $itemsInRow = 8; 9121 } else if ($this.hasClass('_12')) { 9122 9123 if ($window.width() < 960) { 9124 $itemsInRow = 8 9125 } else { 9126 $itemsInRow = 12; 9127 } 9128 } else { 9129 $itemsInRow = 4; 9130 } 9131 9132 if ($sliderItem.length > $itemsInRow) { 9133 $slider.owlCarousel({ 9134 autoplay : autoplay, 9135 loop : loop, 9136 nav : nav, 9137 dots : true, 9138 dotsEach: dotsEach, 9139 rewind: $rewind, 9140 animateIn: fade ? 'fadeIn' : false, 9141 animateOut: fade ? 'fadeOut' : false, 9142 smartSpeed: speed, 9143 mouseDrag: s3LP.is_cms ? false : true, 9144 autoplayTimeout: pause, 9145 responsive: { 9146 0: { 9147 items: 2, 9148 slideBy: 2 9149 }, 9150 600: { 9151 items: $itemsInRow, 9152 slideBy: 1 9153 } 9154 }, 9155 onInitialized: function(e) { 9156 var $dotsCount = $parent.find('.owl-dot').length; 9157 9158 if (!$dots.length || $dotsCount < 2) { 9159 $dots.html(''); 9160 9161 $parent.find('.js-next-slide, .js-prev-slide').addClass('_hide'); 9162 return; 9163 }; 9164 var $dotsHTML = ''; 9165 9166 for(var i = 0; i < $dotsCount; i++) { 9167 $dotsHTML += '<div class="lp-dots-item js-dot-item" data-elem-type="container" data-lp-selector=".lp-dots-item"></div>'; 9168 } 9169 9170 if (!$dots.hasClass('_unchanged')) { 9171 9172 $dots.html($dotsHTML); 9173 9174 } 9175 9176 $dots.find('.lp-dots-item').eq(0).addClass('active'); 9177 9178 }, 9179 9180 onResized: function(e) { 9181 if (!$dots.length || e.page.count < 2) { 9182 $dots.html(''); 9183 $parent.find('.js-next-slide, .js-prev-slide').addClass('_hide'); 9184 return; 9185 } else { 9186 $parent.find('.js-next-slide, .js-prev-slide').addClass('_show'); 9187 } 9188 9189 var $dotsHTML = ''; 9190 for(var i = 0; i < e.page.count; i++) { 9191 $dotsHTML += '<div class="lp-dots-item js-dot-item" data-elem-type="container" data-lp-selector=".lp-dots-item"></div>'; 9192 } 9193 9194 if (!$dots.hasClass('_unchanged')) { 9195 $dots.html($dotsHTML); 9196 } 9197 $dots.find('.lp-dots-item').removeClass('active'); 9198 $dots.find('.lp-dots-item').eq(e.page.index).addClass('active'); 9199 }, 9200 onTranslate: function(e) { 9201 $dots.find('.lp-dots-item').removeClass('active'); 9202 $dots.find('.lp-dots-item').eq(e.page.index).addClass('active'); 9203 } 9204 }); 9205 9206 $parent.on('click', '.js-next-slide', function(e) { 9207 e.preventDefault(); 9208 $slider.trigger('next.owl.carousel'); 9209 }); 9210 9211 $parent.on('click', '.js-prev-slide', function(e) { 9212 e.preventDefault(); 9213 $slider.trigger('prev.owl.carousel'); 9214 }); 9215 9216 $parent.on('click', '.js-dot-item', function(e) { 9217 e.preventDefault(); 9218 $slider.trigger('to.owl.carousel', [$(this).index()]); 9219 }); 9220 } 9221 }); 9222 } 9223 } 9224 9225 lp_template.queue.lpPromo13 = function($self) { 9226 var $slider = $self.find('.js-promo-13-slider'); 9227 9228 if ($slider.length) { 9229 $slider.each(function(){ 9230 9231 var $this = $(this), 9232 $parent = $this.closest('[data-block-layout]'), 9233 $currentSlideBlock = $parent.find('.js-promo-13-current'), 9234 $totalSlidesBlock = $parent.find('.js-promo-13-total'), 9235 $autoplay = $this.data('autoplay'), 9236 $infinite = $this.data('infinite'), 9237 $autoplaySpeed = $this.data('autoplay-speed'), 9238 $speed = $this.data('speed'); 9239 9240 if(s3LP.is_cms){ 9241 var $infinite = false, 9242 $autoplay = false;
9243 } 9244 else if(typeof ReactLPConstructor == 'object') { 9245 var $infinite = false, 9246 $autoplay = false; 9247 } 9248 9249 9250 function changeProgressWidth($progressWidth) { 9251 var $progressWidthBlock = $parent.find('.js-promo-13-progress'), 9252 outerWidth = $progressWidthBlock.outerWidth(), 9253 innerWidth = $progressWidthBlock.innerWidth(), 9254 $progressMaxWidthBlock = outerWidth - innerWidth; 9255 9256 $progressWidthBlock.css('width', 'calc(' + $progressWidth + '%' + ' - ' + $progressMaxWidthBlock + 'px'); 9257 } 9258 9259 $this.on('init reInit', function(event, slick) { 9260 var $totalSlides = slick.slideCount; 9261 9262 if($totalSlides > 1) { 9263 var $progressWidth = 1 /$totalSlides*100; 9264 $totalSlidesBlock.text($totalSlides); 9265 changeProgressWidth($progressWidth); 9266 } else { 9267 $parent.find('.js-promo-13-progress-block').css('display', 'none') 9268 } 9269 9270 9271 }); 9272 9273 $this.slick({ 9274 infinite: $infinite, 9275 speed: $speed, 9276 autoplay: $autoplay, 9277 autoplaySpeed: $autoplaySpeed, 9278 slidesToShow: 1, 9279 slidesToScroll: 1, 9280 fade: true, 9281 dots:false, 9282 prevArrow: $parent.find('.lp-promo-13-slider__arrow--left'), 9283 nextArrow: $parent.find('.lp-promo-13-slider__arrow--right') 9284 }); 9285 9286 $this.on('afterChange', function(event, slick, currentSlide){ 9287 var $currentSlide = currentSlide + 1, 9288 $totalSlides = slick.slideCount, 9289 $progressWidth = $currentSlide/$totalSlides*100; 9290 $currentSlideBlock.text($currentSlide); 9291 changeProgressWidth($progressWidth); 9292 }); 9293 9294 }); 9295 } 9296 } 9297 9298 lp_template.queue.lpPromo16 = function($self) { 9299 var $slider = $self.find('.js-promo-16-slider'); 9300 9301 if ($slider.length) { 9302 $slider.each(function(){ 9303 9304 var $this = $(this), 9305 $parent = $this.closest('[data-block-layout]'), 9306 $currentSlideBlock = $parent.find('.js-promo-16-current'), 9307 $totalSlidesBlock = $parent.find('.js-promo-16-total'), 9308 $autoplay = $this.data('autoplay'), 9309 $infinite = $this.data('infinite'), 9310 $autoplaySpeed = $this.data('autoplay-speed'), 9311 $speed = $this.data('speed'); 9312 9313 if(s3LP.is_cms){ 9314 var $infinite = false, 9315 $autoplay = false; 9316 } 9317 else if(typeof ReactLPConstructor == 'object') { 9318 var $infinite = false, 9319 $autoplay = false; 9320 } 9321 9322 $this.on('init reInit afterChange', function(event, slick) { 9323 var $totalSlides = slick.slideCount; 9324 9325 if($totalSlides > 1) { 9326 $totalSlidesBlock.text($totalSlides); 9327 } else { 9328 $('.js-promo-16-progress-block').css('display', 'none') 9329 } 9330 }); 9331 9332 $this.on('afterChange', function(event, slick, currentSlide){ 9333 var $currentSlide = currentSlide + 1; 9334 $currentSlideBlock.text($currentSlide); 9335 }); 9336 9337 $this.slick({ 9338 infinite: $infinite, 9339 speed: $speed, 9340 autoplay: $autoplay, 9341 autoplaySpeed: $autoplaySpeed, 9342 slidesToShow: 1, 9343 slidesToScroll: 1, 9344 fade: true, 9345 dots:false, 9346 prevArrow: $parent.find('.lp-promo-16-slide__arrow--left'), 9347 nextArrow: $parent.find('.lp-promo-16-slide__arrow--right') 9348 }); 9349 }); 9350 } 9351 } 9352 9353 lp_template.queue.lpProducts39 = function($self) { 9354 var $block = $self.hasClass('lp-prods-39') ? $self : $self.find('.lp-prods-39'); 9355 9356 if ($block.length) { 9357 var func = function() { 9358 $block.each(function(){ 9359 var $this = $(this); 9360 if (window.matchMedia('(min-width: 1200px)').matches) { 9361 $this.find('.lp-prods-39__subblock').each(function(index) { 9362 var item = $(this).find('.lp-prods-39__item:first-child()'), 9363 itemHeight = item.height() + 2*parseInt(item.css('border-width')); 9364 9365 $(this).find('.lp-prods-39__title-wrap').css('min-height', itemHeight); 9366 9367 }); 9368 } else { 9369 $this.find('.lp-prods-39__title-wrap').css('min-height', ''); 9370 } 9371 }); 9372 }; 9373 9374 $(window).on('resize', func); 9375 if (s3LP.is_cms && typeof LpController !== 'undefined') { 9376 setTimeout(function(){ 9377 LpController.afterSave(function () { 9378 func(); 9379 }); 9380 },1000); 9381 } 9382 } 9383 } 9384 9385 lp_template.queue.lpContacts6 = function($self) { 9386 var $contactsBlock = $self.hasClass('js-contacts-6') ? $self : $self.find('.js-contacts-6'); 9387 9388 setTimeout(function() { 9389 $('.lp-contacts-6-data-column').removeClass('lp-contacts-6-data-column-load'); 9390 }, 1000); 9391 9392 if ($contactsBlock.length) { 9393 $contactsBlock.each(function() { 9394 9395 var $tab = $contactsBlock.find('.js-tab'), 9396 $tabsBlock = $contactsBlock.find('.js-tabs'), 9397 $contactsData = $contactsBlock.find('.js-contacts-data'); 9398 9399 // ÐÐ´Ð¸Ð½Ð°ÐºÐ¾Ð²Ð°Ñ Ð²ÑÑоÑа Ñ Ð²ÑÐµÑ Ð±Ð»Ð¾ÐºÐ¾Ð² 9400 9401 function setHeight() { 9402 var maxHeight = $contactsData.eq(0).height(); 9403 $contactsData.each(function () { 9404 if ( $(this).height() > maxHeight ) { 9405 maxHeight = $(this).height(); 9406 } 9407 }); 9408 $contactsData.css('minHeight', maxHeight); 9409 9410 setTimeout(function(){ 9411 $contactsData.hide(); 9412 $contactsData.eq(0).addClass('_active'); 9413 }, 500); 9414 } 9415 9416 // Ð¢Ð°Ð±Ñ 9417
9418 function tabsInit() { 9419 $tab.on('click', function() { 9420 $(this).addClass('_active').siblings().removeClass('_active'); 9421 $contactsData.removeClass('_active').eq($(this).index()).addClass('_active'); 9422 lp_template.checkMapInitialization($contactsData.eq($(this).index()).find('.js-lp-simple-map')); 9423 if ($contactsBlock.find('.lp-contacts-6-map').data('map-type') == 'yandex') { 9424 $contactsData.eq($(this).index()).find('.js-lp-simple-map').data('ymaps').container.fitToViewport(); 9425 } 9426 }); 9427 } 9428 9429 // ÐаÑÑомнÑй ÑкÑолл 9430 9431 function scrollInit() { 9432 9433 // ÐоказÑваÑÑ ÑкÑолл, еÑли он нÑжен 9434 var widthSum = 0; 9435 $tab.each(function () { 9436 widthSum += +$(this).outerWidth(true) 9437 }) 9438 9439 if(widthSum > $tabsBlock.width()) { 9440 baron({ 9441 root: '.lp-contacts-6-scroll', 9442 scroller: '.lp-contacts-6-scroll__inner', 9443 bar: '.lp-contacts-6-scroll__bar', 9444 scrollingCls: '_scrolling', 9445 draggingCls: '_dragging', 9446 direction: 'h', 9447 9448 }) 9449 } 9450 } 9451 9452 // ÐаÑÑÑ 9453 9454 setHeight(); 9455 tabsInit(); 9456 //scrollInit(); 9457 9458 }); 9459 } 9460 } 9461 9462 lp_template.queue.lpReviews18 = function($self) { 9463 9464 var $block = $self.hasClass('lp-reviews-18') ? $self : $self.find('.lp-reviews-18'); 9465 if ($block.length) { 9466 $block.each(function(){ 9467 var $this = $(this); 9468 9469 try { 9470 adjustHeight(); 9471 9472 $(window).on('resize', function(){ 9473 adjustHeight(); 9474 }); 9475 } catch(exception) { 9476 console.log(exception); 9477 } 9478 9479 function adjustHeight() { 9480 if (window.matchMedia('(min-width: 960px)').matches) { 9481 var wrapTopPadding = parseInt($this.find('.lp-reviews-18__wrap').css('padding-top')), 9482 headerHeight = $this.find('.lp-reviews-18__header').height(), 9483 imgHeight = $this.find('.lp-reviews-18__bg-img').height(), 9484 top = wrapTopPadding + headerHeight, 9485 contentMinHeight = imgHeight + headerHeight; 9486 9487 $this.find('.lp-reviews-18__bg-img').css({top: top}); 9488 $this.find('.lp-reviews-18__content').css({minHeight:contentMinHeight}); 9489 } else { 9490 $this.find('.lp-reviews-18__bg-img').css({top: ''}); 9491 $this.find('.lp-reviews-18__content').css({minHeight: ''}); 9492 } 9493 }; 9494 9495 if (s3LP.is_cms && typeof LpController !== 'undefined') { 9496 setTimeout(function(){ 9497 LpController.afterSave(function () { 9498 $(window).trigger('resize'); 9499 }); 9500 },3000); 9501 } 9502 }); 9503 } 9504 } 9505 9506 lp_template.queue.lpReviews19 = function($self) { 9507 9508 var $block = $self.hasClass('lp-reviews-19') ? $self : $self.find('.lp-reviews-19'); 9509 9510 $block.each(function(){ 9511 var $this = $(this); 9512 9513 try { 9514 setTimeout(function(){ 9515 imgHeight(); 9516 },3000); 9517 9518 $(window).on('resize', function(){ 9519 setTimeout(function(){ 9520 imgHeight(); 9521 },300); 9522 }); 9523 9524 if (s3LP.is_cms && typeof LpController !== 'undefined') { 9525 setTimeout(function(){ 9526 LpController.afterSave(function () { 9527 imgHeight(); 9528 }); 9529 },3000); 9530 9531 } 9532 9533 } catch(exception) { 9534 console.log(exception); 9535 } 9536 9537 function imgHeight() { 9538 if (window.matchMedia('(min-width: 960px)').matches) { 9539 var topHeight = $this.find('.lp-reviews-19__top').height(); 9540 9541 $this.find('.lp-reviews-19__block-img').css({height: topHeight}); 9542 9543 } else { 9544 $this.find('.lp-reviews-19__block-img').css({height: ''}); 9545 } 9546 }; 9547 }); 9548 } 9549 9550 9551 lp_template.queue.lpVideo17 = function($self) { 9552 var $block = $self.hasClass('lp-video-17') ? $self : $self.find('.lp-video-17'); 9553 9554 if ($block.length) { 9555 $block.each(function(){ 9556 var $this = $(this), 9557 $sliderBig = $this.find('.lp-video-17__slider-big'), 9558 slider_thumbs = $this.find('.lp-video-17__slider-thumbs'), 9559 $nav = !!slider_thumbs.data('arrows'), 9560 $dot = !!slider_thumbs.data('dots'), 9561 $autoplay = !!$sliderBig.data('autoplay'), 9562 $infinite = $sliderBig.data('infinite'), 9563 $autoplaySpeed = $sliderBig.data('pause'), 9564 $speed = $sliderBig.data('speed'); 9565 9566 if(s3LP.is_cms){ 9567 var $infinite = false, 9568 $autoplay = false;
9569 } 9570 else if(typeof ReactLPConstructor == 'object') { 9571 var $infinite = false, 9572 $autoplay = false; 9573 } 9574 9575 try { 9576 9577 initSlick(); 9578 9579 } catch(exception) { 9580 console.log(exception); 9581 } 9582 9583 function initSlick() { 9584 $this.find('.lp-video-17__slider-big').slick({ 9585 infinite: $infinite, 9586 speed: $speed, 9587 vertical: false, 9588 verticalSwiping: true, 9589 slidesPerRow: 1, 9590 slidesToShow: 1, 9591 slidesToScroll: 1, 9592 asNavFor: $this.find('.lp-video-17__slider-thumbs'), 9593 arrows: false, 9594 fade: true, 9595 dots: false, 9596 adaptiveHeight: true, 9597 draggable: true, 9598 responsive: [ 9599 { 9600 breakpoint: 1200, 9601 settings: { 9602 vertical: false, 9603 fade: true, 9604 cssEase: 'ease', 9605 verticalSwiping: false, 9606 } 9607 }, 9608 { 9609 breakpoint: 600, 9610 settings: { 9611 vertical: false, 9612 verticalSwiping: false, 9613 dots: true, 9614 arrows: true, 9615 appendArrows: $this.find('.lp-video-17__big-controls'), 9616 prevArrow: '<button data-has-event="1" data-elem-type="container" data-lp-selector=".lp-video-17__arrow" class="lp-video-17__arrow lp-video-17__arrow-prev js-prev-item _primary-fill _svg-light-fill"><div data-elem-type="container" class="arrow-line-wr" data-lp-selector=".arrow-line"><div class="arrow-line"></div><div class="arrow-line"></div></div></button>', 9617 nextArrow: '<button data-has-event="1" data-elem-type="container" data-lp-selector=".lp-video-17__arrow" class="lp-video-17__arrow lp-video-17__arrow-next js-next-item _primary-fill _svg-light-fill"><div data-elem-type="container" class="arrow-line-wr" data-lp-selector=".arrow-line"><div class="arrow-line"></div><div class="arrow-line"></div></div></button>', 9618 appendDots: $this.find('.lp-video-17__big-dots'), 9619 } 9620 } 9621 ] 9622 }); 9623 9624 $this.find(".lp-video-17__slider-thumbs").slick({ 9625 infinite: $infinite, 9626 speed: $speed, 9627 autoplay: $autoplay, 9628 autoplaySpeed: $autoplaySpeed, 9629 vertical: true, 9630 verticalSwiping: true, 9631 slidesPerRow: 1, 9632 slidesToShow: 4, 9633 asNavFor: $this.find('.lp-video-17__slider-big'), 9634 focusOnSelect: true, 9635 arrows: true, 9636 dots: true, 9637 adaptiveHeight: true, 9638 appendArrows: $this.find('.lp-video-17__thumbs-controls'), 9639 appendDots: $this.find('.lp-video-17__thumbs-dots'), 9640 prevArrow: '<button data-has-event="1" data-elem-type="container" data-lp-selector=".lp-video-17__arrow" class="lp-video-17__arrow lp-video-17__arrow-prev js-prev-item _primary-fill _svg-light-fill"><div data-elem-type="container" class="arrow-line-wr" data-lp-selector=".arrow-line"><div class="arrow-line"></div><div class="arrow-line"></div></div></button>', 9641 nextArrow: '<button data-has-event="1" data-elem-type="container" data-lp-selector=".lp-video-17__arrow" class="lp-video-17__arrow lp-video-17__arrow-next js-next-item _primary-fill _svg-light-fill"><div data-elem-type="container" class="arrow-line-wr" data-lp-selector=".arrow-line"><div class="arrow-line"></div><div class="arrow-line"></div></div></button>', 9642 responsive: [ 9643 { 9644 breakpoint: 1200, 9645 settings: { 9646 vertical: false, 9647 slidesToShow: 3, 9648 slidesPerRow: 1, 9649 infinite: $infinite, 9650 slidesToScroll: 3, 9651 verticalSwiping: false, 9652 } 9653 }, 9654 { 9655 breakpoint: 960, 9656 settings: { 9657 vertical: false, 9658 slidesPerRow: 1, 9659 slidesToShow: 2, 9660 slidesToScroll: 1, 9661 infinite: $infinite, 9662 verticalSwiping: false, 9663 } 9664 }, 9665 ] 9666 }); 9667 }; 9668 $('.slick-slider.lp-video-17__slider-thumbs').on('beforeChange', function(event, slick, currentSlide, nextSlide){ 9669 $('.lp-video-17__slider-big video').trigger('pause'); 9670 $('.lp-video-17__slider-big ._lp-youtube-video').each(function(){ 9671 var el_src = $(this).attr("src"); 9672 $(this).attr("src",el_src); 9673 9674 }); 9675 }); 9676 9677 9678 9679 $(window).on('resize', function(){ 9680 setTimeout(function(){ 9681 var $dotItem = $block.find('.lp-video-17__thumbs-dots li button');
9682 if ($dotItem.hasClass('lp-video-17__slider-dot')) { 9683 9684 } 9685 else { 9686 $dotItem.attr('data-elem-type', 'card_container'); 9687 $dotItem.addClass('lp-video-17__slider-dot'); 9688 $dotItem.attr('data-lp-selector','.lp-video-17__slider-dot'); 9689 $dotItem.attr('data-has-event','1'); 9690 } 9691 },500); 9692 }); 9693 }); 9694 } 9695 } 9696 9697 lp_template.queue.lpSteps7 = function($self) { 9698 var $block = $self.find('.js-simple-tabs'); 9699 9700 if ($block.length) { 9701 $block.each(function(){ 9702 var $this = $(this); 9703 if (!s3LP.is_cms) { 9704 $this.bind('mousewheel', function(e){ 9705 if(e.originalEvent.wheelDelta /120 > 0) { 9706 $this.find('.active:not(:first-child)').removeClass('active').delay(800).prev().addClass('active').delay(800); 9707 } 9708 else{ 9709 $this.find('.active:not(:last-child)').removeClass('active').delay(800).next().addClass('active').delay(800); 9710 } 9711 9712 if ($this.find('.count').last().hasClass('active') || $this.find('.count').first().hasClass('active')) { 9713 return; 9714 } 9715 else { 9716 e.stopPropagation(); 9717 e.preventDefault(); 9718 } 9719 }); 9720 } 9721 9722 $('.js-tab').on('click', function(){ 9723 var $index = $(this).index() + 1; 9724 $this.find('.js-tab-content:nth-child(' + $index + ')').addClass('active').siblings().removeClass('active'); 9725 $(this).addClass('active').siblings().removeClass('active') 9726 }); 9727 }); 9728 } 9729 } 9730 9731 lp_template.queue.lpMenu20 = function($self) { 9732 var $block = $self.find('.js-phone-btn'); 9733 9734 if ($block.length) { 9735 $block.each(function(){ 9736 var $this = $(this); 9737 9738 $this.on('click', function(){ 9739 $(this).siblings('.js-phone').toggleClass('active'); 9740 }); 9741 9742 if (!s3LP.is_cms) { 9743 $(document).mouseup(function (e){ 9744 var div = $(".lp-menu-20-phone"); 9745 if (!div.is(e.target) 9746 && div.has(e.target).length === 0) { 9747 div.find('.js-phone').removeClass('active'); 9748 } 9749 }); 9750 } 9751 }); 9752 } 9753 } 9754 9755 9756 lp_template.queue.lpCertificate19 = function($self) { 9757 var $block = $self.hasClass('lp-certificate-19') ? $self : $self.find('.lp-certificate-19'); 9758
9759 if ($block.length) { 9760 $block.each(function(){ 9761 var $this = $(this), 9762 $mainSlider = $this.find('.js-main-slick'), 9763 $thumbSlider = $this.find('.js-thumb-slick'), 9764 $prevBtn = $this.find('.js-slider-prev'), 9765 $nextBtn = $this.find('.js-slider-next'), 9766 $dots = !!$mainSlider.data('dots'), 9767 $arrows = !!$mainSlider.data('arrows'), 9768 $autoplay = $mainSlider.data('autoplay'), 9769 $infinite = $mainSlider.data('infinite'), 9770 $autoplaySpeed = $mainSlider.data('pause'), 9771 $speed = $mainSlider.data('speed'); 9772 9773 if(s3LP.is_cms){ 9774 var $infinite = false, 9775 $autoplay = false; 9776 } 9777 else if(typeof ReactLPConstructor == 'object') { 9778 var $infinite = false, 9779 $autoplay = false; 9780 } 9781 9782 $mainSlider.slick({ 9783 slidesToShow: 1, 9784 slidesToScroll: 1, 9785 arrows: false, 9786 fade: true, 9787 asNavFor: $thumbSlider, 9788 infinite: $infinite, 9789 speed: $speed, 9790 autoplay: $autoplay, 9791 autoplaySpeed: $autoplaySpeed, 9792 adaptiveHeight: false, 9793 responsive: [ 9794 { 9795 breakpoint: 600, 9796 settings: { 9797 slidesToShow: 1, 9798 arrows: $arrows 9799 } 9800 } 9801 ] 9802 }) 9803 9804 $thumbSlider.slick({ 9805 slidesToShow: 5, 9806 slidesToScroll: 1, 9807 asNavFor: $mainSlider, 9808 dots: $dots, 9809 dotsClass:'lp-certificate-19__thumbs-dots-in', 9810 appendDots:$this.find('.lp-certificate-19__thumbs-dots'), 9811 infinite: $infinite, 9812 speed: $speed, 9813 autoplay: $autoplay, 9814 autoplaySpeed: $autoplaySpeed, 9815 centerMode: false, 9816 arrows: $arrows, 9817 touches: true, 9818 prevArrow: $prevBtn, 9819 nextArrow: $nextBtn, 9820 focusOnSelect: true, 9821 adaptiveHeight: false, 9822 centerPadding: '6px', 9823 mobileFirst: true, 9824 swipeToSlide: false, 9825 responsive: [ 9826 { 9827 breakpoint: 600, 9828 settings: { 9829 slidesToShow: 4, 9830 centerPadding: '20px' 9831 } 9832 }, 9833 { 9834 breakpoint: 960, 9835 settings: { 9836 slidesToShow: 4, 9837 arrows: true, 9838 centerPadding: '0px' 9839 } 9840 }, 9841 { 9842 breakpoint: 1380, 9843 settings: { 9844 slidesToShow: 5, 9845 arrows: true, 9846 centerPadding: '0px' 9847 } 9848 } 9849 ] 9850 }); 9851 9852 $(window).on('resize', function(){ 9853 setTimeout(function(){ 9854 var $dotItem = $this.find('.lp-certificate-19__thumbs-dots li button'); 9855 if ($dotItem.hasClass('lp-certificate-19__thumbs-dot')) { 9856 9857 } 9858 else { 9859 $dotItem.attr('data-elem-type', 'card_container'); 9860 $dotItem.addClass('lp-certificate-19__thumbs-dot'); 9861 $dotItem.attr('data-lp-selector','.lp-certificate-19__thumbs-dot'); 9862 $dotItem.attr('data-has-event','1'); 9863 } 9864 },500); 9865 }); 9866 }); 9867 } 9868 }; 9869 9870 lp_template.queue.lpPartners15 = function($self) { 9871 9872 var $block = $self.hasClass('lp-partners-15') ? $self : $self.find('.lp-partners-15'); 9873 9874 $block.each(function(){ 9875 if ($block.length) { 9876 var $this = $(this), 9877 $slider = $this.find('.lp-partners-15-items.js-owl-carousel'), 9878 autoplay = !!$slider.data('autoplay'), 9879 infinite = !!$slider.data('infinite'), 9880 nav = !!$slider.data('arrows'), 9881 dotsEach = !!$slider.data('dots-each'), 9882 dots = true, 9883 pause = $slider.data('pause') || 5000, 9884 speed = $slider.data('speed') || 250, 9885 $rewind = 0, 9886 fade = !!$slider.data('fade'), 9887 $parent = $slider.closest('[data-block-layout]'), 9888 dataResponse = $slider.data('response'), 9889 response = {}, 9890 $dots = $this.find('.lp-dots-wrapper'); 9891 9892 if(s3LP.is_cms){ 9893 var infinite = false, 9894 $rewind = 1, 9895 autoplay = false;
9896 } 9897 else if(typeof ReactLPConstructor == 'object') { 9898 var infinite = false, 9899 $rewind = 1, 9900 autoplay = false; 9901 9902 } 9903 9904 9905 try { 9906 let owl = $slider, 9907 windowWidth = $(window).width(), 9908 gridFormer = function(){ 9909 let wrapper = '<div class="lp-partners-15-items-grid"></div>', 9910 itemsCount = $this.find('.lp-partners-15-items>.lp-partners-15-item').length, 9911 sliceFunc = function(itemsInGrid){ 9912 for (var i = 0; i < itemsCount/itemsInGrid; i++) { 9913 $this.find('.lp-partners-15-items>.lp-partners-15-item').slice(0, itemsInGrid).wrapAll(wrapper); 9914 } 9915 $this.find('.lp-partners-15-items-grid').each(function(){ 9916 $(this).addClass('_'+$(this).children().length); 9917 }); 9918 }; 9919 9920 if (windowWidth>=600) { 9921 sliceFunc(4); 9922 } 9923 } 9924 9925 let initOwl = function(){ 9926 owl.owlCarousel({ 9927 dots: true, 9928 nav: true, 9929 mouseDrag: false, 9930 margin: 16, 9931 autoplay : autoplay, 9932 loop : infinite, 9933 rewind: $rewind, 9934 smartSpeed: speed, 9935 autoplayTimeout: pause, 9936 items: 1, 9937 onInitialized: function(e) { 9938 var $dotsCount = $this.find('.owl-dot').length; 9939 9940 if (!$dots.length || $dotsCount < 2) { 9941 $dots.html(''); 9942 return; 9943 }; 9944 var $dotsHTML = ''; 9945 9946 for(var i = 0; i < $dotsCount; i++) { 9947 $dotsHTML += '<div class="lp-dots-item js-dot-item" data-elem-type="container" data-lp-selector=".lp-dots-item"></div>'; 9948 } 9949 9950 if (!$dots.hasClass('_unchanged')) { 9951 9952 $dots.html($dotsHTML); 9953 9954 } 9955 9956 $dots.find('.lp-dots-item').eq(0).addClass('active'); 9957 9958 }, 9959 9960 onResized: function(e) { 9961 if (!$dots.length || e.page.count < 2) { 9962 $dots.html(''); 9963 return; 9964 } 9965 9966 var $dotsHTML = ''; 9967 for(var i = 0; i < e.page.count; i++) { 9968 $dotsHTML += '<div class="lp-dots-item js-dot-item" data-elem-type="container" data-lp-selector=".lp-dots-item"></div>'; 9969 } 9970 9971 if (!$dots.hasClass('_unchanged')) { 9972 $dots.html($dotsHTML); 9973 } 9974 $dots.find('.lp-dots-item').removeClass('active'); 9975 $dots.find('.lp-dots-item').eq(e.page.index).addClass('active'); 9976 }, 9977 onTranslated: function(e) { 9978 $dots.find('.lp-dots-item').removeClass('active'); 9979 $dots.find('.lp-dots-item').eq(e.page.index).addClass('active'); 9980 } 9981 }); 9982 9983 $this.find('.js-next-slide').off(); 9984 $this.find('.js-next-slide').on('click', function(e) { 9985 e.preventDefault(); 9986 owl.trigger('next.owl.carousel'); 9987 }); 9988 $this.find('.js-prev-slide').off(); 9989 $this.find('.js-prev-slide').on('click', function(e) { 9990 e.preventDefault(); 9991 owl.trigger('prev.owl.carousel'); 9992 }); 9993 9994 $this.find('.js-dot-item').on('click', function(e) { 9995 e.preventDefault(); 9996 owl.trigger('to.owl.carousel', [$(this).index()]); 9997 }); 9998 9999 } 10000 10001 let reInitOwl = function(){ 10002 owl.trigger('destroy.owl.carousel'); 10003 if (windowWidth<600) { 10004 $this.find('.lp-partners-15-item').unwrap(); 10005 } 10006 gridFormer(); 10007 initOwl(); 10008 } 10009 10010 gridFormer(); 10011 10012 initOwl(); 10013 10014 10015 $(window).resize(function(){ 10016 let newWindowWidth = $(window).width(); 10017 if (windowWidth<600){ 10018 if (newWindowWidth>=600) { 10019 windowWidth = newWindowWidth; 10020 reInitOwl(); 10021 } 10022 } else if (windowWidth>=600){ 10023 if (newWindowWidth<600) { 10024 windowWidth = newWindowWidth; 10025 reInitOwl(); 10026 } 10027 } 10028 }); 10029 10030 } catch(exception) { 10031 console.log(exception); 10032 } 10033 } 10034 }); 10035 } 10036 10037 lp_template.queue.lpStaff7 = function($self) { 10038 10039 var $block = $self.hasClass('lp-staff-7') ? $self : $self.find('.lp-staff-7'); 10040 10041 if ($block.length) { 10042 $block.each(function(){ 10043 10044 var $this = $(this); 10045 10046 $this.find('.lp-header-tab').not('._active').on('click', function(){ 10047 $(this).addClass('_active').siblings().removeClass('_active'); 10048 $this.find('.lp-staff-body-items').removeClass('_active').eq($(this).index()).addClass('_active'); 10049 }); 10050 10051 $this.find('.lp-header-tab').first().addClass('_active'); 10052 $this.find('.lp-staff-body-items').first().addClass('_active'); 10053 10054 var widthSum = 0; 10055 $this.find('.lp-header-tab').each(function () { 10056 widthSum += +$(this).outerWidth(true) 10057 }) 10058 10059 if(widthSum > $('.lp-header-tabs').width()) { 10060 baron({ 10061 root: '.lp-staff-7-scroll', 10062 scroller: '.lp-staff-7-scroll__inner', 10063 bar: '.lp-staff-7-scroll__bar', 10064 scrollingCls: '_scrolling', 10065 draggingCls: '_dragging', 10066 direction: 'h', 10067 10068 }) 10069 } 10070 10071 }); 10072 } 10073 } 10074 10075 lp_template.queue.lpForm29 = function($self) { 10076 var $block = $self.hasClass('lp-form-29') ? $self : $self.find('.lp-form-29'); 10077 10078 if ($block.length) { 10079 10080 $block.each(function() { 10081 var $this = $(this); 10082 10083 try { 10084 setMinHeight(); 10085 $(window).on('resize', function(){ 10086 setMinHeight(); 10087 }); 10088 } catch(exception) { 10089 console.log(exception); 10090 } 10091 10092 function setMinHeight() { 10093 if (window.matchMedia('(min-width: 960px)').matches) { 10094 var formHeight = $this.find('.lp-form-29__form').height() 10095 + parseInt($this.find('.lp-form-29__form').css('padding-top')) 10096 + parseInt($this.find('.lp-form-29__form').css('padding-bottom')), 10097 minHeight = formHeight - 160; 10098 10099 $this.find('.lp-form-29__top').css({ 10100 minHeight : minHeight 10101 }); 10102 10103 var topHeight = $this.find('.lp-form-29__top').height(); 10104 10105 if (topHeight > (formHeight + 40)) { 10106 $this.find('.lp-form-29__top').css({'margin-top' : '40px'}); 10107 } else { 10108 $this.find('.lp-form-29__top').css({'margin-top' : ''}); 10109 } 10110 } else { 10111 $this.find('.lp-form-29__top').css({ 10112 minHeight : '', 10113 'margin-top' : '' 10114 }); 10115 } 10116 }; 10117 }); 10118 } 10119 }; 10120 10121 lp_template.queue.lpFeatures29 = function($self) { 10122 var $block = $self.find('.lp-features-29-item__percentage'); 10123 if ($block.length) { 10124 function perc() { 10125 $block.each(function(){ 10126 var $this = $(this), 10127 $parent = $this.closest('.lp-features-29-item'), 10128 $inner = $parent.find('.lp-features-29-item__field-inner'), 10129 $percent = Number.isNaN(parseInt($this.text())) ? 0 : parseInt($this.text()), 10130 $percent = $percent < 101 ? $percent : 100; 10131 10132 $inner.css('width', $percent + '%'); 10133 $this.text($percent + '%'); 10134 }); 10135 } 10136 10137 if (s3LP.is_cms && typeof LpController !== 'undefined') { 10138 setTimeout(function(){ 10139 LpController.afterSave(function () { 10140 perc(); 10141 }); 10142 },1000); 10143 } 10144 } 10145 } 10146 10147 lp_template.queue.QRcode = function ($self) { 10148 let $block = $self.find('.lp_qr_init'); 10149 10150 if ($block.length) { 10151 $block.each(function () { 10152 let item = $(this); 10153 let messengerWrap = item.find('.lp_qr_code_item'); 10154 10155 messengerWrap.each(function () { 10156 let item = $(this);
10157 let containerQr = item.find('.lp_qr_code_container'); 10158 let containerQrPhone = item.find('.lp_qr_code_container_phone'); 10159 10160 let messengerLinks = item.find('.lp_qr_code_link'); 10161 let messengerLinksPhone = item.find('.lp_qr_code_link_phone'); 10162 10163 let urls = messengerLinks.map(function () { 10164 return $(this).attr('href'); 10165 }).get(); 10166 10167 let urlsPhone = messengerLinksPhone.map(function () { 10168 return $(this).attr('href').replace(/[^\d+]/g, ''); 10169 }).get(); 10170 10171 let sizes = messengerLinks.map(function () { 10172 return $(this).attr('data-qr-code-size'); 10173 }).get(); 10174 10175 let sizesPhone = messengerLinksPhone.map(function () { 10176 return $(this).attr('data-qr-code-size'); 10177 }).get(); 10178 10179 urls.forEach(function (url, index) { 10180 if (containerQr.length) { 10181 createQR(containerQr.eq(index), sizes[index], url); 10182 $('body').append(containerQr.eq(index)); 10183 } 10184 }); 10185 10186 urlsPhone.forEach(function (url, index) { 10187 if (containerQrPhone.length) { 10188 createQR(containerQrPhone.eq(index), sizesPhone[index], url); 10189 $('body').append(containerQrPhone.eq(index)); 10190 } 10191 }); 10192 10193 messengerLinks.hover(function () { 10194 let index = messengerLinks.index(this); 10195 showQR(containerQr.eq(index), $(this)); 10196 }, function () { 10197 let index = messengerLinks.index(this); 10198 hideQR(containerQr.eq(index)); 10199 }); 10200 10201 messengerLinksPhone.hover(function () { 10202 let index = messengerLinksPhone.index(this); 10203 showQR(containerQrPhone.eq(index), $(this)); 10204 }, function () { 10205 let index = messengerLinksPhone.index(this); 10206 hideQR(containerQrPhone.eq(index)); 10207 }); 10208 }); 10209 10210 function createQR(container, size, url) { 10211 container.qrcode({ 10212 width: size, 10213 height: size, 10214 text: url 10215 }).css({ 10216 position: 'absolute', 10217 display: 'none', 10218 zIndex: 1000 10219 }); 10220 } 10221 10222 function showQR(container, link) { 10223 let linkOffset = link.offset(); 10224 let containerWidth = container.outerWidth(); 10225 let containerHeight = container.outerHeight(); 10226 10227 let left = linkOffset.left; // ÐÑноÑиÑелÑно левого кÑÐ°Ñ Ð½Ð°Ð²ÐµÐ´ÐµÐ½Ð½Ð¾Ð³Ð¾ ÑлеменÑа 10228 let top = linkOffset.top - containerHeight - 10; 10229 10230 // ÐÑовеÑÑем, вÑÑ Ð¾Ð´Ð¸Ñ Ð»Ð¸ конÑÐµÐ¹Ð½ÐµÑ Ð·Ð° пÑÐµÐ´ÐµÐ»Ñ ÑкÑана ÑпÑава 10231 if (left + containerWidth > $(window).width()) { 10232 left = linkOffset.left - containerWidth + link.outerWidth(); 10233 } 10234 10235 container.css({ 10236 top: top, 10237 left: left, 10238 display: 'block' 10239 }); 10240 } 10241 10242 function hideQR(container) { 10243 container.css({ 10244 display: 'none' 10245 }); 10246 } 10247 }); 10248 } 10249 }; 10250 10251 lp_template.queue.albumGallery = function ($self) { 10252 let $block = $self.find('.lp-album-gallery-init'); 10253 10254 if ($block.length) { 10255 $block.each(function () { 10256 let $this = $(this); 10257 let item = $this.find('.lp-gallery-click'); 10258 let popup = $this.find('.lp-album-gallery-popup'); 10259 let popupItems = $this.find('.lp-album-gallery-popup__item'); 10260 let buttonBack = $this.find('.lp-album-gallery-popup__back'); 10261 let buttonClose = $this.find('.lp-album-gallery-popup__close'); 10262 10263 let body = $('body'); 10264 let popupImageBox = popup.find('.lp-album-gallery-popup__image-box'); 10265 let mosaicWrap = $(document).find('.mosaic-wrap'); 10266 10267 setTimeout(function(){ 10268 if (mosaicWrap.length && !$block.hasClass('lp_constructor')) { 10269 mosaicWrap.prepend(popup); 10270 } 10271 }, 350); 10272 10273 if (popup.find('.js-new-lg-init').length) { 10274 10275 popupImageBox.click(function () { 10276 popup.addClass('is-hidden'); 10277 }); 10278 10279 body.on('click', function (event) { 10280 if (!$(event.target).closest('.lg-prev, .lg-next, .lg-toolbar, .lg-image, .lp-album-gallery-popup, .lp-album-gallery-popup__image-box').length) { 10281 popup.removeClass('is-hidden'); 10282 } 10283 10284 if ($(event.target).closest('.lg-close').length) { 10285 popup.removeClass('is-hidden'); 10286 } 10287 }); 10288 } 10289 10290 item.click(function () { 10291 let dataIndex = $(this).data("index"); 10292 10293 popup.fadeIn().addClass("active"); 10294 $(this).closest('.lp-album-gallery').addClass('_opened-popup'); 10295 10296 if (!isMobile) { 10297 $("body").css({ 'padding-right': '17px' }); 10298 } 10299 10300 $("html").addClass("lp-no-scroll"); 10301 popupItems.removeClass("active"); 10302 popupItems.filter("[data-index='" + dataIndex + "']").addClass("active"); 10303 }); 10304 10305 buttonBack.click(function () { 10306 $(this).closest('.lp-album-gallery').removeClass('_opened-popup'); 10307 popup.fadeOut().removeClass("active"); 10308 $("body").css({ 'padding-right': '' }); 10309 $("html").removeClass("lp-no-scroll"); 10310 popupItems.removeClass("active"); 10311 }); 10312 10313 buttonClose.click(function () { 10314 $(this).closest('.lp-album-gallery').removeClass('_opened-popup'); 10315 popup.fadeOut().removeClass("active"); 10316 $("body").css({ 'padding-right': '' }); 10317 $("html").removeClass("lp-no-scroll"); 10318 popupItems.removeClass("active"); 10319 }); 10320 10321 $(document).keydown(function (e) { 10322 if (e.keyCode === 27 && !$('.lg-outer').length) { 10323 popup.closest('.lp-album-gallery').removeClass('_opened-popup'); 10324 popup.fadeOut().removeClass("active"); 10325 $("body").css({ 'padding-right': '' }); 10326 $("html").removeClass("lp-no-scroll"); 10327 popupItems.removeClass("active"); 10328 } 10329 10330 popup.removeClass('is-hidden'); 10331 }); 10332 }); 10333 } 10334 }; 10335 10336 lp_template.queue.anchorMenu = function ($self) { 10337 let $block = $self.find('.lp_anchor_menu_init'); 10338 10339 if ($block.length) { 10340 let links = $block.find('.lp-anchor-menu-fixed__link'); 10341 let choiceElem = $block.attr('data-lp-choice-elem'); 10342 let booleanValue = (choiceElem === 'true'); 10343 let fixedBlock = $block.find('.lp-anchor-menu-fixed'); 10344 let mosaicWrap = $(document).find('.mosaic-wrap'); 10345 let button = $block.find('.lp-anchor-menu-fixed__button-text'); 10346 let $lpWrap = $(document); 10347 10348 let hiddenBlockIds = []; 10349 10350 $lpWrap.each(function () {
10351 let $this = $(this); 10352 10353 if (s3LP.is_cms) { 10354 $this.find('.popup-row-block').each(function() { 10355 let s3lpPopupValue = $(this).find('[data-blocks-popup]').data('blocks-popup'); 10356 hiddenBlockIds.push(s3lpPopupValue); 10357 }); 10358 } else { 10359 let blocksPopupValue = $this.find('[data-blocks-popup]').data('blocks-popup'); 10360 let blocksPopupValue2 = $this.find('._hide-block').data('block-id'); 10361 10362 hiddenBlockIds.push(blocksPopupValue === undefined ? blocksPopupValue2 : blocksPopupValue); 10363 } 10364 }); 10365 10366 if (isMobile) { 10367 let touchStartX = 0, touchEndX = 0; 10368 let isActive = false; 10369 10370 button.on('click', function () { 10371 if (isActive && fixedBlock.hasClass('active')) { 10372 fixedBlock.removeClass('active'); 10373 isActive = false; 10374 } else { 10375 fixedBlock.addClass('active'); 10376 isActive = true; 10377 } 10378 }); 10379 10380 button.on('touchstart', function(e) { 10381 touchStartX = e.originalEvent.touches[0].clientX; 10382 }); 10383 10384 button.on('touchmove', function(e) { 10385 touchEndX = e.originalEvent.touches[0].clientX; 10386 }); 10387 10388 button.on('touchend', function(e) { 10389 handleButtonSwipe(); 10390 }); 10391 10392 function handleButtonSwipe() { 10393 var swipeLength = touchEndX - touchStartX; 10394 if (swipeLength > 100) { 10395 fixedBlock.removeClass('active'); 10396 } else if (swipeLength < -100) { 10397 fixedBlock.addClass('active'); 10398 } 10399 10400 touchStartX = 0; 10401 touchEndX = 0; 10402 } 10403 10404 $(document).on('keydown', function (e) { 10405 if (e.keyCode === 27) { 10406 fixedBlock.removeClass('active'); 10407 } 10408 }); 10409 10410 $(document).on('click', function (e) { 10411 if (!$(e.target).closest('.lp-anchor-menu-fixed').length) { 10412 fixedBlock.removeClass('active'); 10413 } 10414 }); 10415 } 10416 10417 setTimeout(function(){ 10418 let buttonHeight = $block.find('.lp-anchor-menu-fixed__button').outerHeight(); 10419 let listHeight = $block.find('.lp-anchor-menu-fixed__list').outerHeight(); 10420 let listBlock = $block.find('.lp-anchor-menu-fixed__list'); 10421 10422 var $wrapBlock = $block.closest('.lp-anchor-menu'); 10423 var blockId = $wrapBlock.attr('id'); 10424 var blockLayout = $wrapBlock.attr('data-block-layout'); 10425 10426 if (buttonHeight === listHeight) { 10427 listBlock.addClass('no-border-radius'); 10428 } else { 10429 listBlock.removeClass('no-border-radius'); 10430 } 10431 10432 if (mosaicWrap.length && !$block.hasClass('lp_constructor')) { 10433 mosaicWrap.prepend(fixedBlock); 10434 10435 fixedBlock.attr('id', blockId); 10436 fixedBlock.attr('data-block-layout', blockLayout); 10437 } 10438 10439 }, 350); 10440 10441 /*links.each(function () { 10442 let $this = $(this); 10443 let blockId = $this.attr('href').replace('#', ''); 10444 let offsetValue = parseFloat($this.attr('data-lp-offset')); 10445 let offsetValueMobile = parseFloat($this.attr('data-lp-offset-mobile')); 10446 let targetBlock = $('#' + blockId); 10447 let headerElements = targetBlock.find('[data-elem-type="header"]:not(.lp-list-illustration__title--hidden)'); 10448 10449 let blockPopupId = parseFloat($this.attr('href').replace(/\D/g, '')); 10450 10451 if (hiddenBlockIds.includes(blockPopupId)) { 10452 $this.parent('.lp-anchor-menu-fixed__item').remove(); 10453 } 10454 10455 if (headerElements.length > 0 && $this.hasClass('lp-has-block-name')) { 10456 let headerText = headerElements.first().text(); 10457 $this.text(headerText); 10458 } 10459 10460 if (booleanValue === false && headerElements.length === 0) { 10461 if ($this.length > 0) { 10462 $this.parent().remove(); 10463 } 10464 } else { 10465 $this.on('click', function (event) { 10466 event.preventDefault(); 10467 10468 links.removeClass('active'); 10469 $this.addClass('active'); 10470 10471 var targetBlockOffset = isMobile ? targetBlock.offset().top - offsetValueMobile : targetBlock.offset().top - offsetValue; 10472 10473 if (targetBlock.length) { 10474 $('html, body').stop().animate({ 10475 scrollTop: targetBlockOffset 10476 }, 800, function () { 10477 history.pushState(null, null, '#' + blockId); 10478 }); 10479 } 10480 }); 10481 } 10482 10483 links.removeClass('lp-opacity'); 10484 10485 });*/ 10486 10487 links.each(function () { 10488 const $this = $(this); 10489 const href = $this.attr('href'); 10490 10491 if (!href) return; 10492 10493 const isPopup = href.startsWith('popup:'); 10494 const isAnchor = href.startsWith('#'); 10495 const isMail = href.startsWith('mailto:'); 10496 const isTel = href.startsWith('tel:'); 10497 10498 if (isMail || isTel) { 10499 return; 10500 } 10501 10502 if (isPopup) { 10503 $this.on('click', function (event) { 10504 event.preventDefault(); 10505 }); 10506 return; 10507 } 10508 10509 if (!isAnchor) { 10510 return; 10511 } 10512 10513 const blockId = href.slice(1); 10514 const targetBlock = $('#' + blockId); 10515 10516 const offsetValue = parseFloat($this.data('lp-offset')) || 0; 10517 const offsetValueMobile = parseFloat($this.data('lp-offset-mobile')) || 0; 10518 10519 const headerElements = targetBlock.find('[data-elem-type="header"]:not(.lp-list-illustration__title--hidden)'); 10520 10521 const blockPopupId = parseFloat(blockId.replace(/\D/g, '')); 10522 10523 if (hiddenBlockIds.includes(blockPopupId) && !$this.hasClass('_link_item')) { 10524 $this.parent('.lp-anchor-menu-fixed__item').remove(); 10525 return; 10526 } 10527 10528 if (headerElements.length && $this.hasClass('lp-has-block-name')) { 10529 $this.text(headerElements.first().text()); 10530 } 10531 10532 if (!booleanValue && !headerElements.length && !$this.hasClass('_link_item')) { 10533 $this.parent().remove(); 10534 return; 10535 } 10536 10537 if (!$this.hasClass('_link_item')) { 10538 10539 $this.on('click', function (event) { 10540 event.preventDefault(); 10541 10542 if (!targetBlock.length) return; 10543 10544 const offsetTop = targetBlock.offset(); 10545 if (!offsetTop) return; 10546 10547 links.removeClass('active'); 10548 $this.addClass('active'); 10549 10550 const targetPosition = isMobile ? offsetTop.top - offsetValueMobile : offsetTop.top - offsetValue; 10551 10552 window.scrollTo({ 10553 top: targetPosition, 10554 behavior: 'smooth' 10555 }); 10556 10557 setTimeout(function () { 10558 history.replaceState(null, null, '#' + blockId); 10559 }, 600); 10560 }); 10561 } 10562 }); 10563 10564 links.removeClass('lp-opacity'); 10565 } 10566 }; 10567 10568 lp_template.queue.scrollTop = function($self) { 10569 var $block = $self.find('.scrollHide'); 10570 if ($block.length) { 10571 if($block.closest('.lp-elements-to-top').length) { 10572 var $this = $(this), 10573 $scrollBtn = $self.find('.js-19-elem'); 10574 10575 var lastScrollTop = 0; 10576 var delta = 50; // ÐеболÑÑÐ°Ñ "меÑÑÐ²Ð°Ñ Ð·Ð¾Ð½Ð°" Ð´Ð»Ñ ÑкÑолла 10577 var scrollThreshold = 500; // ÐоÑог в 500px из ваÑего пÑимеÑа 10578 10579 $(window).on('scroll', function(){ 10580 var $scrollTop = $(this).scrollTop(); 10581 if ($scrollTop < lastScrollTop && $scrollTop > scrollThreshold) { 10582 $scrollBtn.addClass('_show'); 10583 } 10584 else { 10585 $scrollBtn.removeClass('_show'); 10586 } 10587 lastScrollTop = $scrollTop; 10588 }); 10589 }else{ 10590 var $this = $(this), 10591 $scrollBtn = $self.find('.js-19-elem'); 10592 $(window).on('scroll', function(){ 10593 var $scrollTop = $(this).scrollTop(); 10594 if ($scrollTop > 500) { 10595 $scrollBtn.addClass('_show'); 10596 } 10597 else { 10598 $scrollBtn.removeClass('_show'); 10599 } 10600 10601 }); 10602 } 10603 } 10604 } 10605 10606 lp_template.queue.minHeight = function($self) { 10607 var $block = $self.find('.js-min-height'), 10608 func = function() { 10609 $block.each(function(){ 10610 var $this = $(this), 10611 $title = $this.find('.js-item'), 10612 $border = $this.find('._title'), 10613 minWidth = $this.data('min-width') || 0, 10614 minHeight = $title.eq(0).height(); 10615 10616 $border.css({ 10617 minHeight: 0 10618 }); 10619 10620 if ($(window).width() >= minWidth) { 10621 $title.each(function(){ 10622 var thisHeight = $(this).height(); 10623 10624 if (minHeight > thisHeight) { 10625 minHeight = thisHeight; 10626 } 10627 }); 10628 10629 $border.css({ 10630 minHeight: minHeight 10631 }); 10632 } 10633 }); 10634 }; 10635 10636 $(window).on('resize', func); 10637 if (s3LP.is_cms && typeof LpController !== 'undefined') { 10638 setTimeout(function(){ 10639 LpController.afterSave(function () { 10640 func(); 10641 }); 10642 },1000); 10643 } 10644 } 10645 10646 lp_template.queue.animatedAnchor = function($self) { 10647 var $block = $self; 10648 10649 if ($(".js-19-elem").length) { 10650 $block.find(".js-19-elem").on('click touch', function(e){ 10651 e.preventDefault(); 10652 $('html, body').animate({ 10653 scrollTop: $("body").offset().top 10654 }, 2000); 10655 }); 10656 } 10657 } 10658 10659 lp_template.queue.previewModeIsCms = function($self) { 10660 setTimeout(function(){ 10661 if ($('body').hasClass('preview_mode')) { 10662 $('._is-cms').removeClass('_is-cms'); 10663 } 10664 }, 2000); 10665 } 10666 10667 /* ТеÑÑовÑй ÑÑÐ°Ð³Ð¼ÐµÐ½Ñ ÑкÑипÑа, не ÑдалÑÑÑ */ 10668 lp_template.queue.headerNewPopup = function($self) { 10669 let block = $self.find('.lp-new-header'); 10670 10671 if (block.length) { 10672 block.each(function() {
10673 let $this = $(this); 10674 let phoneList = $this.find('.lp-new-header-phone'); 10675 let showAllButton = $this.find('.lp-new-header__more'); 10676 let phoneItem = phoneList.find('.lp-new-header-phone__item:hidden'); 10677 let currentText = showAllButton.text(); 10678 let hideText = $('html').attr('lang') === 'ru' ? 'СкÑÑÑÑ' : 'Hide'; 10679 let overlay = $this.find('.lp-new-header-popup-overlay'); 10680 let popup = $this.find('.lp-new-header-popup'); 10681 let popupInner = $this.find('.lp-new-header-popup__inner'); 10682 let popupButton = $this.find('.lp-new-header-popup-button'); 10683 let popupClose = $this.find('.lp-new-header-popup__close'); 10684 10685 showAllButton.on('click', function () { 10686 $(this).toggleClass('active'); 10687 phoneList.toggleClass('is-active'); 10688 $(this).text(showAllButton.hasClass('active') ? hideText : currentText); 10689 }); 10690 10691 function openPopup() { 10692 overlay.addClass('is-open'); 10693 popup.addClass('is-open'); 10694 $('html').css("overflow", "hidden"); 10695 } 10696 10697 function closePopup() { 10698 overlay.removeClass('is-open'); 10699 popup.removeClass('is-open'); 10700 $('html').css("overflow", "auto"); 10701 } 10702 10703 popupButton.click(openPopup); 10704 popupClose.click(closePopup); 10705 10706 $(document).keyup(function(e) { 10707 if (e.key === "Escape" && overlay.hasClass('is-open')) { 10708 closePopup(); 10709 } 10710 }); 10711 10712 // ÐбÑабоÑÑик клика вне вÑплÑваÑÑего окна Ð´Ð»Ñ ÐµÐ³Ð¾ закÑÑÑÐ¸Ñ 10713 //$(document).mouseup(function(e) { 10714 // if (!popupInner.is(e.target) && popupInner.has(e.target).length === 0) { 10715 // closePopup(); 10716 // } 10717 //}); 10718 }); 10719 } 10720 }; 10721 /* ТеÑÑовÑй ÑÑÐ°Ð³Ð¼ÐµÐ½Ñ ÑкÑипÑа, не ÑдалÑÑÑ */ 10722 10723 lp_template.queue.fixedMenu = function($self) { 10724 var $block = $self.hasClass('js-fixed-menu') ? $self : $self.find('.js-fixed-menu'); 10725 var $fixedElem = $block.find('._fixed-element'); 10726 10727 $block.data('isFixed', false); 10728 10729 $fixedElem = $fixedElem.length ? $fixedElem : $block; 10730 10731 $block.each(function(){ 10732 var $this = $(this); 10733 10734 $this.data('topPosition', $this.offset().top); 10735 }); 10736 10737 if ($block.length) { 10738 $win.on('scroll', function(e){ 10739 $block.each(function(){ 10740 var $this = $(this), 10741 isAfterScroll = !!$this.data('after-scroll'), 10742 $thisBurger = $this.find('.js-burger'), 10743 $fixedElem = $this.find('._fixed-element'); 10744 10745 $fixedElem = $fixedElem.length ? $fixedElem : $this; 10746 10747 var position = $this.data('isFixed') ? $fixedElem[0].parentNode.getBoundingClientRect() : this.getBoundingClientRect(); 10748 10749 if ( !$this.data('isFixed') && ((!isAfterScroll && position.top <= 0) || (isAfterScroll && position.top <= 0 - $this.outerHeight()))) { 10750 if (!s3LP.is_cms) { 10751 $fixedElem.wrap('<div class="fixed-element-wrap"></div>'); 10752 $(window).on('resize', function(){ 10753 //$fixedElem.closest('.fixed-element-wrap').height($fixedElem.height()); 10754 $fixedElem.closest('.fixed-element-wrap').height($fixedElem.outerHeight()); 10755 }); 10756 $win.trigger('resize'); 10757 //$fixedElem.closest('.fixed-element-wrap').height($fixedElem.height()); 10758 $fixedElem.addClass('_to-fix-menu'); 10759 $this.data('isFixed', true); 10760 if ($thisBurger.hasClass('add_in-side')) $thisBurger.addClass('_in-side'); 10761 } 10762 } else if ($this.data('isFixed') && (position.top > 0 || (isAfterScroll && $win.scrollTop() < $this.data('topPosition')))) { 10763 $fixedElem.removeClass('_to-fix-menu'); 10764 $this.data('isFixed', false); 10765 $thisBurger.removeClass('_in-side'); 10766 $win.trigger('resize'); 10767 $fixedElem.unwrap(); 10768 } 10769 }); 10770 }).trigger('scroll'); 10771 } 10772 }; 10773 10774 lp_template.queue.autoplayVideo = function($self) { 10775 var $block = $self.find('[data-autoplay-video="1"]'); 10776 10777 if ($block.length) { 10778 10779 $block.on('autoplayVideo', function(e, type, nodeName) { 10780
10781 var video = this.querySelector(nodeName); 10782 if (nodeName === 'video') { 10783 if (type === 'play') { 10784 video.play(); 10785 } else { 10786 video.pause(); 10787 } 10788 } else if (nodeName === 'iframe') { 10789 var video = $(video).data('youtube'); 10790 if (type === 'play') { 10791 setTimeout(function() { 10792 video.playVideo(); 10793 }, 500); 10794 10795 } else { 10796 video.pauseVideo(); 10797 } 10798 } 10799 10800 }); 10801 } 10802 } 10803 10804 window.lp_init = function($block) { 10805 10806 if (typeof ReactLPConstructor == 'object') { 10807 s3LP.is_cms = true; 10808 } // ÑÑÐ¾Ð±Ñ Ñлаг заÑабоÑал в новом конÑÑÑÑкÑоÑе 10809 10810 var partners_2_img_h = $('.lp-partners_2__list-item').data('image-height'); 10811 $('.lp-partners_2__list-item').css('height', partners_2_img_h); 10812 setTimeout(function() { 10813 $('.lp-partners_2__list-item').removeAttr('style'); 10814 }, 2500); 10815 10816 var $autoplayVideo = $doc.find('[data-autoplay-video="1"]'); 10817 var $maps = $block.find('.js-lp-simple-map'); 10818 10819 if ($maps.length) { 10820 10821 lp_template.checkMapInitialization($maps); 10822 10823 $(window).on('scroll resize', function () { 10824 lp_template.checkMapInitialization($maps); 10825 }); 10826 10827 } else { 10828 console.warn('ÐаÑÑÑ Ð½Ðµ Ð½Ð°Ð¹Ð´ÐµÐ½Ñ Ð½Ð° ÑÑÑаниÑе!'); 10829 } 10830 10831 if ($autoplayVideo.length && !s3LP.is_cms) { 10832 $win.on('scroll', function() { 10833 lp_template.checkAutoplayVideo($autoplayVideo); 10834 }); 10835 } 10836 10837 Object.keys(lp_template.queue).forEach(function(func) { 10838 var thisFunction = lp_template.queue[func]; 10839 if (typeof thisFunction == 'function') { 10840 thisFunction($block); 10841 } 10842 }); 10843 10844 $win.trigger('resize'); 10845 10846 setTimeout(function() { 10847 $win.trigger('resize'); 10848 }, 700); 10849 10850 if (typeof window.s3AnimatorLoaded === 'undefined') { 10851 window.s3AnimatorLoaded = true; 10852 $.getScript("/g/s3/misc/animator/1.1.0/js/s3.animator.js", function(){ 10853 $('body').append('<link rel="stylesheet" type="text/css" href="/g/s3/misc/animator/1.0.0/css/s3.animator.scss.css">'); 10854 s3Animator.once = true; 10855 10856 setTimeout(function() { 10857 s3Animator.updateElements() 10858 }, 500); 10859 }); 10860 } 10861 10862 10863 /*setTimeout(function() { 10864 $win.trigger('scroll'); 10865 }, 2000);*/ 10866 document.dispatchEvent(new Event('lp_init_after', {bubbles: true})); 10867 10868 } 10869 10870 window.onYouTubeIframeAPIReady = function() { 10871 $(function(){ 10872 var listYoutube = $('.js-lp-video-youtube'); 10873 10874 listYoutube.each(function(){ 10875 var $this = $(this), 10876 isFullFrame = $this.hasClass('_not-paused'); 10877 10878 var player = new YT.Player(this.id, { 10879 iv_load_policy: 3, 10880 modestbranding: 1, 10881 rel: 0, 10882 mute: isFullFrame ? 1 : 0, 10883 playsinline: 1, 10884 showinfo: isFullFrame ? 0 : 1, 10885 events: { 10886 'onStateChange': function(event) { 10887 if (event.data == YT.PlayerState.ENDED && isFullFrame) { 10888 event.target.playVideo(); 10889 } 10890 } 10891 } 10892 }); 10893 10894 $this.data('youtube', player); 10895 10896 $('.slick-slider').on('beforeChange', function(event, slick, currentSlide, nextSlide){ 10897 }); 10898 }); 10899 }); 10900 } 10901 10902 function isElementInViewport(el) { 10903 const rect = el.getBoundingClientRect(); 10904 return ( 10905 rect.top < (window.innerHeight || document.documentElement.clientHeight) && rect.bottom > 0 && rect.left < (window.innerWidth || document.documentElement.clientWidth) && rect.right > 0 10906 ); 10907 } 10908 10909 // function isElementInViewport(el) { 10910 // var rect = el.getBoundingClientRect(); 10911 // return ( 10912 // rect.top <= window.innerHeight-200 && 10913 // rect.bottom >= 50 10914 // ); 10915 // } 10916 10917})(); 10918 10919document.addEventListener("DOMContentLoaded", function () { 10920 let lpContent = document.getElementById("lp_constructor"); 10921 let timeout = 20; 10922 if (lpContent) { 10923 timeout = 1500; 10924 } 10925 10926 setTimeout(function () { 10927 10928 const toRGBAArray = (rgbStr) => { 10929 const values = rgbStr.match(/[\d.]+/g).map(Number); 10930 10931 if (values.length === 3) values.push(1); 10932 return values; 10933 }; 10934 10935 const baseTextColor = getComputedStyle(document.documentElement).getPropertyValue('--text-color-base').trim(); 10936 10937 document.querySelectorAll('.has_custom_bg').forEach(function (element) { 10938 const computedStyle = window.getComputedStyle(element); 10939 const bgColor = computedStyle.backgroundColor; 10940 const rgba = toRGBAArray(bgColor);
10941 const alpha = rgba[3]; 10942 10943 if (bgColor === "transparent" || alpha === 0) { 10944 element.style.color = baseTextColor; 10945 element.querySelectorAll('[data-elem-type="text"], [data-elem-type="header"], [data-elem-type="generate"], [data-elem-type="button"].lp-button--type-3, .has-custom-bg-item').forEach(function (innerElem) { 10946 innerElem.style.color = baseTextColor; 10947 }); 10948 return; 10949 } 10950 10951 const brightness = Math.round((rgba[0] * 299 + rgba[1] * 587 + rgba[2] * 114) / 1000); 10952 const textColor = brightness > 150 ? baseTextColor : '#fff'; 10953 10954 element.style.color = textColor; 10955 element.querySelectorAll('[data-elem-type="text"], [data-elem-type="header"], [data-elem-type="generate"], [data-elem-type="button"].lp-button--type-3, .has-custom-bg-item').forEach(function (innerElem) { 10956 innerElem.style.color = textColor; 10957 }); 10958 }); 10959 10960 document.querySelectorAll('.ya-share2').forEach(function (element) { 10961 const computedStyle = window.getComputedStyle(element); 10962 const rgba = toRGBAArray(computedStyle.backgroundColor); 10963 const alpha = rgba[3]; 10964 10965 const brightness = Math.round((rgba[0] * 299 + rgba[1] * 587 + rgba[2] * 114) / 1000); 10966 10967 if (alpha === 0 || computedStyle.backgroundColor === "transparent" || brightness > 150) { 10968 element.classList.add("lp-share-light-mode"); 10969 } else { 10970 element.classList.add("lp-share-dark-mode"); 10971 } 10972 }); 10973 }, timeout); 10974 10975 10976 /*setTimeout(function () { 10977 10978 const toRGBArray = rgbStr => rgbStr.match(/\d+/g).map(Number); 10979 10980 document.querySelectorAll('.has_custom_bg').forEach(function (element) { 10981 let customBg = toRGBArray(window.getComputedStyle(element).backgroundColor); 10982 let textColor = Math.round((parseInt(customBg[0]) * 299 + parseInt(customBg[1]) * 587 + parseInt(customBg[2]) * 114) / 1000); 10983 10984 if (textColor > 150) { 10985 element.style.color = '#000'; 10986 element.querySelectorAll('[data-elem-type="text"]').forEach(function (textElement) { 10987 textElement.style.color = '#000'; 10988 }); 10989 element.querySelectorAll('[data-elem-type="header"]').forEach(function (headerElement) { 10990 headerElement.style.color = '#000'; 10991 }); 10992 element.querySelectorAll('[data-elem-type="generate"]').forEach(function (generateElement) { 10993 generateElement.style.color = '#000'; 10994 }); 10995 } else { 10996 element.style.color = '#fff'; 10997 element.querySelectorAll('[data-elem-type="text"]').forEach(function (textElement) { 10998 textElement.style.color = '#fff'; 10999 }); 11000 element.querySelectorAll('[data-elem-type="header"]').forEach(function (headerElement) { 11001 headerElement.style.color = '#fff'; 11002 }); 11003 element.querySelectorAll('[data-elem-type="generate"]').forEach(function (generateElement) { 11004 generateElement.style.color = '#fff'; 11005 }); 11006 } 11007 }); 11008 11009 document.querySelectorAll('.ya-share2').forEach(function (element) { 11010 let customBgShare = toRGBArray(window.getComputedStyle(element).backgroundColor); 11011 let textColorShare = Math.round((parseInt(customBgShare[0]) * 299 + parseInt(customBgShare[1]) * 587 + parseInt(customBgShare[2]) * 114) / 1000); 11012 11013 if (textColorShare > 150) { 11014 $('.ya-share2').addClass("lp-share-light-mode"); 11015 } else { 11016 $('.ya-share2').addClass("lp-share-dark-mode"); 11017 } 11018 }); 11019 }, timeout);*/ 11020 11021 setTimeout(() => { 11022 const calculators = document.querySelectorAll('.lp-calculator'); 11023 11024 if (calculators.length) { 11025 calculators.forEach(calculator => { 11026 const calc = new Calculator(calculator); 11027 calc.init(); 11028 }); 11029 } 11030 }, 500); 11031}); 11032 11033 11034 11035 11036class Calculator { 11037 constructor(calculator) { 11038 this.calculator = calculator; 11039 this.calculateButton = this.calculator.querySelector('.calculate_button'); 11040 this.calculateFormula = this.calculateButton.getAttribute('data-calculator-formula'); 11041 this.calculateResult = this.calculator.querySelector('.js_calculate_result'); 11042 this.calculateInputs = Array.from(this.calculator.querySelectorAll('input')); 11043 this.calculateErrorBlock = this.calculator.querySelector('.calculate-error-block'); 11044 } 11045 11046 parseCalculatorFormula(formula) { 11047 let variableRegex = '([a-zA-Z0-9]?[a-zA-Z]+)'; 11048 let formulaVariables = Array.from(formula.matchAll(variableRegex)); 11049 let parsedFormula = formula; 11050 for (const formulaVariable of formulaVariables) { 11051 let inputValue = this.calculator.querySelector(`input[data-calculator-alias=${formulaVariable[0]}]`).value; 11052 parsedFormula = parsedFormula.replace(formulaVariable[0], inputValue ? inputValue : NULL); 11053 } 11054 11055 return eval(parsedFormula); 11056 } 11057 11058 initializeRangeFields(fields) { 11059 fields.forEach((field) => { 11060 let input = field; 11061 let parent = input.parentNode; 11062 let min = parseFloat(input.min); 11063 let max = parseFloat(input.max); 11064 let current = parent.querySelector(".lp-calculator-range--current"); 11065 let currentLine = parent.querySelector(".lp-calculator-range--current-line"); 11066 11067 const updateCurrentPosition = () => { 11068 let value = parseFloat(input.value); 11069 current.textContent = value; 11070 11071 let currentWidth = current.getBoundingClientRect().width; 11072 let currentPos = (100 * (value - min) / (max - min)); 11073 11074 if (currentPos < 0) { 11075 currentPos = 0; 11076 } else if (currentPos > 100) { 11077 currentPos = 100; 11078 } 11079 11080 current.style.left = `${(currentPos / 100) * (input.getBoundingClientRect().width - currentWidth)}px`; 11081 currentLine.style.width = `${currentPos}%`; 11082 }; 11083 11084 field.addEventListener("input", updateCurrentPosition); 11085 updateCurrentPosition(); 11086 }); 11087 } 11088 11089 initializeNumberFields(fields) { 11090 fields.forEach((field) => { 11091 let input = field; 11092 let parent = input.parentNode; 11093 let min = input.min; 11094 let step = input.step; 11095 let max = input.max; 11096 let decrementButton = parent.querySelector(".lp-calculator-number--dec"); 11097 let incrementButton = parent.querySelector(".lp-calculator-number--inc"); 11098 11099 input.addEventListener("change", () => { 11100 const value = Number(input.value); 11101 if (value >= max) { 11102 incrementButton.setAttribute("disabled", true); 11103 decrementButton.removeAttribute("disabled"); 11104 input.value = max; 11105 } else if (value <= min) { 11106 input.value = min; 11107 incrementButton.removeAttribute("disabled"); 11108 decrementButton.setAttribute("disabled", true); 11109 } else { 11110 incrementButton.removeAttribute("disabled"); 11111 decrementButton.removeAttribute("disabled"); 11112 } 11113 }); 11114 11115 decrementButton.addEventListener("click", () => { 11116 incrementButton.disabled = false 11117 let current = input.value 11118 let currentVal = current - step 11119 11120 if (currentVal <= min) { 11121 input.textContent = min 11122 decrementButton.disabled = true 11123 return input.value = min 11124 } 11125 11126 input.textContent = currentVal 11127 return input.value = currentVal 11128 }); 11129 11130 incrementButton.addEventListener("click", () => { 11131 decrementButton.disabled = false 11132 let current = input.value 11133 let currentVal = Number(current) + Number(step) 11134 11135 if (Number(currentVal) >= Number(max)) { 11136 incrementButton.disabled = true 11137 input.textContent = max 11138 return input.value = max 11139 } 11140 11141 input.textContent = currentVal 11142 return input.value = currentVal 11143 }); 11144 }) 11145 } 11146 11147 11148 initializeFieldTypes() { 11149 let rangeFields = this.calculateInputs.filter((item) => item.classList.contains('lp-calculator-input--range')); 11150 let numberFields = this.calculateInputs.filter((item) => item.classList.contains('lp-calculator-input--number')); 11151 11152 this.initializeRangeFields(rangeFields); 11153 this.initializeNumberFields(numberFields); 11154 } 11155 11156 init() { 11157 this.initializeFieldTypes(); 11158 this.calculateButton.addEventListener('click', () => { 11159 this.calculateErrorBlock.innerHTML = ''; 11160 try { 11161 const result = this.parseCalculatorFormula(this.calculateFormula); 11162 if (!isNaN(result) && isFinite(result)) { 11163 this.calculateResult.querySelector('span').textContent = result.toFixed(2); 11164 console.log(result); 11165 } else { 11166 this.calculateErrorBlock.innerHTML += '<p>ÐÑовеÑÑÑе коÑÑекÑноÑÑÑ Ð²Ð²ÐµÐ´ÐµÐ½Ð½ÑÑ Ð´Ð°Ð½Ð½ÑÑ </p>'; 11167 this.calculateResult.querySelector('span').textContent = 0; 11168 } 11169 } catch (e) { 11170 this.calculateErrorBlock.innerHTML += '<p>ÐÑовеÑÑÑе коÑÑекÑноÑÑÑ Ð²Ð²ÐµÐ´ÐµÐ½Ð½ÑÑ Ð´Ð°Ð½Ð½ÑÑ </p>'; 11171 this.calculateResult.querySelector('span').textContent = 0; 11172 } 11173 }); 11174 } 11175} 11176 11177 11178/*function letItSnow() {
11179 var COUNT = 30; 11180 var masthead = document.querySelector('.sky'); 11181 var canvas = document.createElement('canvas'); 11182 var ctx = canvas.getContext('2d'); 11183 var width = masthead.clientWidth; 11184 var height = masthead.clientHeight; 11185 var i = 0; 11186 var active = false; 11187 11188 function onResize() { 11189 width = masthead.clientWidth; 11190 height = masthead.clientHeight; 11191 canvas.width = width; 11192 canvas.height = height; 11193 ctx.fillStyle = '#FFF'; 11194 11195 var wasActive = active; 11196 active = width > 600; 11197 11198 if (!wasActive && active) 11199 requestAnimFrame(update); 11200 } 11201 11202 var Snowflake = function () { 11203 this.x = 0; 11204 this.y = 0; 11205 this.vy = 0; 11206 this.vx = 0; 11207 this.r = 0; 11208 11209 this.reset(); 11210 } 11211 11212 Snowflake.prototype.reset = function() { 11213 this.x = Math.random() * width; 11214 this.y = Math.random() * -height; 11215 this.vy = 1 + Math.random() * 3; 11216 this.vx = 0.5 - Math.random(); 11217 this.r = 1 + Math.random() * 2; 11218 this.o = 0.5 + Math.random() * 0.5; 11219 } 11220 11221 canvas.style.position = 'absolute'; 11222 canvas.style.left = canvas.style.top = '0'; 11223 11224 var snowflakes = [], snowflake; 11225 for (i = 0; i < COUNT; i++) { 11226 snowflake = new Snowflake(); 11227 snowflake.reset(); 11228 snowflakes.push(snowflake); 11229 } 11230 11231 function update() { 11232 11233 ctx.clearRect(0, 0, width, height); 11234 11235 if (!active) 11236 return; 11237 11238 for (i = 0; i < COUNT; i++) { 11239 snowflake = snowflakes[i]; 11240 snowflake.y += snowflake.vy; 11241 snowflake.x += snowflake.vx; 11242 11243 ctx.globalAlpha = snowflake.o; 11244 ctx.beginPath(); 11245 ctx.arc(snowflake.x, snowflake.y, snowflake.r, 0, Math.PI * 2, false); 11246 ctx.closePath(); 11247 ctx.fill(); 11248 11249 if (snowflake.y > height) { 11250 snowflake.reset(); 11251 } 11252 } 11253 11254 requestAnimFrame(update); 11255 } 11256 11257 // shim layer with setTimeout fallback 11258 window.requestAnimFrame = (function(){ 11259 return window.requestAnimationFrame || 11260 window.webkitRequestAnimationFrame || 11261 window.mozRequestAnimationFrame || 11262 function( callback ){ 11263 window.setTimeout(callback, 1000 / 60); 11264 }; 11265 })(); 11266 11267 onResize(); 11268 window.addEventListener('resize', onResize, false); 11269 11270 masthead.appendChild(canvas); 11271};*/
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.