1getRandomInt = function (min, max) { 2 return Math.floor(Math.random() * (max - min)) + min; 3}; 4 5ShowOverlay = function () { 6 $('<div class="jqmOverlay waiting"></div>').appendTo("body"); 7}; 8 9function throttle(f, t) { 10 let throttled, saveThis, saveArgs; 11 const wrapper = function () { 12 if (throttled) { 13 saveThis = this; 14 saveArgs = arguments; 15 return; 16 } 17 throttled = true; 18 f.apply(this, arguments); 19 setTimeout(function () { 20 throttled = false; 21 if (saveArgs) { 22 wrapper.apply(saveThis, saveArgs); 23 saveThis = saveArgs = null; 24 } 25 }, t); 26 }; 27 return wrapper; 28} 29 30function debounce(f, t) { 31 return function (args) { 32 var previousCall = this.lastCall; 33 this.lastCall = Date.now(); 34 if (previousCall && this.lastCall - previousCall <= t) { 35 clearTimeout(this.lastCallTimer); 36 } 37 this.lastCallTimer = setTimeout(function () { 38 f(args); 39 }, t); 40 }; 41} 42 43window.addEventListener("popstate", function (event) { 44 if (typeof startActions == "function") { 45 setTimeout(startActions, 500); 46 } 47}); 48 49$(document).on("change", ".uploader input[type=file]", function () { 50 if (!$(this).next().length || !$(this).next().hasClass("resetfile")) { 51 $( 52 '<span class="resetfile" title="' + 53 BX.message("CLEAR_FILE") + 54 '"><svg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9 1.00161L1 9M9 9L1 1" stroke="#999999" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></span>' 55 ).insertAfter($(this)); 56 } 57}); 58 59$(document).on("click", ".uploader .resetfile", function () { 60 var $uploader = $(this).closest(".uploader"); 61 $uploader.removeClass("error files_add"); 62 $uploader.find(".error").hide(); 63 64 if ($uploader.next().hasClass('error')) { 65 $uploader.next().hide(); 66 } 67 68 var $input = $uploader.find("input[type=file]"); 69 $input.val(""); 70 $.uniform.update($input); 71 72 $(this).remove(); 73}); 74 75$(document).on("click", ".region-close", function () { 76 $(".confirm_region").fadeOut(); 77}); 78 79headerInit = function (targetBlock) { 80 var header = $("header"); 81 if (header.length) { 82 setTimeout(function () { 83 CheckTopMenuDotted(); 84 CheckTopMenuDotted(); 85 }, 1); 86 } 87}; 88 89typeofExt = function (item) { 90 const _toString = Object.prototype.toString; 91 return _toString.call(item).slice(8, -1).toLowerCase(); 92}; 93 94HideOverlay = function () { 95 $(".jqmOverlay").detach(); 96 CloseMobileSearch(); 97 CloseMobilePhone(); 98}; 99 100if (!funcDefined("pauseYmObserver")) { 101 // pause ya metrika webvisor MutationObserver callback (DOM indexer) 102 // use before insert html with some animation 103 pauseYmObserver = function () { 104 if ( 105 typeof MutationObserver === "function" && 106 typeof MutationObserver.observers === "object" && 107 typeof MutationObserver.observers.ym === "object" 108 ) { 109 if (typeof pauseYmObserver.cnt === "undefined") { 110 pauseYmObserver.cnt = 0; 111 } 112 113 ++pauseYmObserver.cnt; 114 115 if (!MutationObserver.observers.ym.paused) { 116 MutationObserver.observers.ym.pause(); 117 } 118 } 119 }; 120} 121 122if (!funcDefined("resumeYmObserver")) { 123 // resume ya metrika webvisor MutationObserver callback 124 // use when animation finished 125 resumeYmObserver = function () { 126 if ( 127 typeof MutationObserver === "function" && 128 typeof MutationObserver.observers === "object" && 129 typeof MutationObserver.observers.ym === "object" 130 ) { 131 if (typeof pauseYmObserver.cnt === "undefined") { 132 pauseYmObserver.cnt = 1; 133 } 134 135 pauseYmObserver.cnt -= pauseYmObserver.cnt > 0 ? 1 : 0; 136 137 if (!pauseYmObserver.cnt && MutationObserver.observers.ym.paused) { 138 MutationObserver.observers.ym.resume(); 139 } 140 } 141 }; 142} 143 144if (!funcDefined("declOfNum")) { 145 declOfNum = function (number, titles) { 146 var cases = [2, 0, 1, 1, 1, 2]; 147 return number + " " + titles[number % 100 > 4 && number % 100 < 20 ? 2 : cases[Math.min(number % 10, 5)]]; 148 }; 149} 150 151if (!funcDefined("togglePropBlock")) { 152 togglePropBlock = function (className) { 153 var all_props_block = className.closest(".bx_filter_parameters_box_container").find(".hidden_values"); 154 if (all_props_block.length && (className.hasClass("inner_text") || className.hasClass("expand_block"))) { 155 if (all_props_block.is(":visible")) { 156 className.text(BX.message("FILTER_EXPAND_VALUES")); 157 all_props_block.hide(); 158 } else { 159 className.text(BX.message("FILTER_HIDE_VALUES")); 160 all_props_block.show(); 161 } 162 } 163 }; 164} 165 166/*countdown start*/ 167if (!funcDefined("initCountdown")) { 168 var initCountdown = function initCountdown() { 169 $(".countdown:not(.countdown-inited)").each(function () { 170 var _this = $(this); 171 172 if (_this.hasClass("init-if-visible") && !_this.is(":visible")) return; 173 _this.addClass("countdown-inited"); 174 175 var activeTo = _this.find(".countdown__active-to").text(), 176 dateTo = new Date(activeTo.replace(/(\d+)\.(\d+)\.(\d+)/, "$3/$2/$1")); 177 178 var checkDate = new Date() < dateTo; 179 180 if (checkDate) { 181 if (_this.hasClass("compact")) 182 _this.find(".countdown__items").countdown( 183 { 184 until: dateTo, 185 format: "dHMS", 186 compact: true, 187 padZeroes: true, 188 layout: 189 '{d<}<span class="days countdown__item">{dn}<div class="text">{dl}</div></span>{d>} <span class="hours countdown__item">{hn}<div class="text">{hl}</div></span> <span class="minutes countdown__item">{mn}<div class="text">{ml}</div></span> <span class="sec countdown__item">{sn}<div class="text">{sl}</div></span>', 190 onExpiry: onExpiryCountdown, 191 }, 192 $.countdown.regionalOptions["ru"] 193 ); 194 else 195 _this.find(".countdown__items").countdown( 196 { 197 until: dateTo, 198 format: "dHMS", 199 padZeroes: true, 200 layout: 201 '{d<}<span class="days countdown__item">{dnn}<div class="text">{dl}</div></span>{d>} <span class="hours countdown__item">{hnn}<div class="text">{hl}</div></span> <span class="minutes countdown__item">{mnn}<div class="text">{ml}</div></span> <span class="sec countdown__item">{snn}<div class="text">{sl}</div></span>', 202 onExpiry: onExpiryCountdown, 203 }, 204 $.countdown.regionalOptions["ru"] 205 ); 206 } else { 207 _this.hide(); 208 } 209 }); 210 }; 211} 212 213if (!funcDefined("onExpiryCountdown")) { 214 function onExpiryCountdown() { 215 var _this = $(this); 216 var countdownBlock = _this.parents(".countdown"); 217 218 if (countdownBlock.length) { 219 countdownBlock.hide(); 220 } 221 } 222} 223 224if (!funcDefined("initCountdownTime")) { 225 var initCountdownTime = function initCountdownTime(block, time) { 226 if (time) { 227 var dateTo = new Date(time.replace(/(\d+)\.(\d+)\.(\d+)/, "$3/$2/$1")); 228 block.find(".countdown__items").countdown("destroy"); 229 if (block.hasClass("compact")) 230 block.find(".countdown__items").countdown( 231 { 232 until: dateTo, 233 format: "dHM", 234 compact: true, 235 padZeroes: true, 236 layout: 237 '{d<}<span class="days countdown__item">{dn}<div class="text">{dl}</div></span>{d>} <span class="hours countdown__item">{hn}<div class="text">{hl}</div></span> <span class="minutes countdown__item">{mn}<div class="text">{ml}</div></span> <span class="sec countdown__item">{sn}<div class="text">{sl}</div></span>', 238 onExpiry: onExpiryCountdownTime, 239 }, 240 $.countdown.regionalOptions["ru"] 241 ); 242 elsecountdown__items; 243 block.find(".countdown__items").countdown( 244 { 245 until: dateTo, 246 format: "dHMS", 247 padZeroes: true, 248 layout: 249 '{d<}<span class="days countdown__item">{dnn}<div class="text">{dl}</div></span>{d>} <span class="hours countdown__item">{hnn}<div class="text">{hl}</div></span> <span class="minutes countdown__item">{mnn}<div class="text">{ml}</div></span> <span class="sec countdown__item">{snn}<div class="text">{sl}</div></span>', 250 onExpiry: onExpiryCountdownTime, 251 }, 252 $.countdown.regionalOptions["ru"] 253 ); 254 block.find(".countdown").show(); 255 } else { 256 block.find(".countdown").hide(); 257 } 258 }; 259} 260if (!funcDefined("onExpiryCountdownTime")) { 261 function onExpiryCountdownTime() {} 262} 263/*countdown end*/ 264 265$(document).on("click", ".map-mobile-opener", function () { 266 if ($(this).hasClass("closer")) { 267 closeFullscreenMap(); 268 } else { 269 openFullsreenMap(this); 270 } 271}); 272 273function openFullsreenMap(element) { 274 var $this = $(element); 275 if ($this.hasClass("closer")) return; 276 277 var currentMap = $this.parents(".bx-map-view-layout"); 278 var mapId = currentMap.find(".bx-yandex-map").attr("id"); 279 window.openedYandexMapFrame = mapId;
280 var mapContainer = $('<div data-mapId="' + mapId + '"></div>'); 281 282 if (!$("div[data-mapId=" + mapId + "]").length) { 283 currentMap.after(mapContainer); 284 } 285 286 var addClass = ""; 287 if ($this.parents(".contacts-page-map-top").length) { 288 addClass += " contacts-map-top-frame "; 289 } 290 291 var yandexMapFrame = $('<div class="yandex-map__frame filter-none' + addClass + '"></div>'); 292 $("body > .body").append(yandexMapFrame); 293 currentMap.appendTo(yandexMapFrame); 294 currentMap.find(".map-mobile-opener").addClass("closer"); 295 296 if (typeof map === "object" && map !== null && "container" in map) { 297 window.map.container.fitToViewport(); 298 } 299} 300 301function closeFullscreenMap() { 302 var yandexMapFrame = $(".yandex-map__frame"); 303 if (yandexMapFrame.length) { 304 var currentMap = yandexMapFrame.find(".bx-map-view-layout"); 305 var yandexMapContainer = $("div[data-mapId=" + window.openedYandexMapFrame + "]"); 306 307 currentMap.appendTo(yandexMapContainer); 308 yandexMapFrame.remove(); 309 currentMap.find(".map-mobile-opener").removeClass("closer"); 310 311 if (typeof map === "object" && map !== null && "container" in map) { 312 window.map.container.fitToViewport(); 313 } 314 } 315} 316 317$.fn.iAppear = function (callback, options) { 318 if (typeof $.fn.iAppear.useObserver === "undefined") { 319 $.fn.iAppear.useObserver = typeof window["IntersectionObserver"] === "function"; 320 321 if (!$.fn.iAppear.useObserver && typeof $.fn.appear !== "function") { 322 $.fn.iAppear.queue = []; 323 BX.loadScript(arAsproOptions.SITE_TEMPLATE_PATH + "/vendor/js/jquery.appear.js", function () { 324 if (typeof $.fn.iAppear.queue === "object") { 325 $.fn.iAppear.queue.forEach(function (queueItem) { 326 $(queueItem.items).iAppear(queueItem.callback, queueItem.options); 327 }); 328 } 329 }); 330 331 return; 332 } 333 } 334 335 if ($.fn.iAppear.useObserver) { 336 var options = $.extend( 337 { 338 root: null, 339 rootMargin: "150px 0px 150px 0px", 340 threshold: 0.0, 341 }, 342 options 343 ); 344 345 $(this).each(function (i, appearBlock) { 346 var observer = new IntersectionObserver(function (entries, observer) { 347 entries.forEach(function (element) { 348 if (element.intersectionRatio > 0 && !element.target.dataset.iAppeared) { 349 element.target.dataset.iAppeared = true; 350 351 if (typeof callback === "function") { 352 callback.call(element.target); 353 } 354 } 355 }); 356 }, options); 357 358 observer.observe(appearBlock); 359 }); 360 } else { 361 if (typeof $.fn.appear !== "function") { 362 if ($(this).length) { 363 $.fn.iAppear.queue.push({ 364 items: this, 365 callback: callback, 366 options: options, 367 }); 368 } 369 370 return; 371 } else { 372 if ($(this).length) { 373 $(this).each(function (i, appearBlock) { 374 $(appearBlock).appear(function () { 375 if (typeof callback === "function") { 376 callback.call(appearBlock); 377 } 378 }, options); 379 }); 380 } 381 } 382 } 383}; 384 385$.fn.mCustomScrollbarDeferred = function (config) { 386 $(this).addClass("scroll-init"); 387 $(this).data("plugin-options", config); 388 389 if ($(this).hasClass("destroyed")) { 390 return; 391 } 392 393 $(this).hover( 394 function (e) { 395 var $this = $(this); 396 if (!$this.hasClass("mCustomScrollbar") && !$(this).hasClass("destroyed")) { 397 $this.data( 398 "scrollTimer", 399 setTimeout(function () { 400 $this.mCustomScrollbar(config); 401 $this.off("touchstart touchmove touchend mousewheel mouseenter mouseleave"); 402 }, 200) 403 ); 404 } 405 }, 406 function (e) { 407 clearTimeout($(this).data("scrollTimer")); 408 } 409 ); 410 411 $(this).on("touchstart touchmove", function (e) { 412 var $this = $(this); 413 if (!$this.hasClass("mCustomScrollbar") && !$(this).hasClass("destroyed")) { 414 $this.mCustomScrollbar(config); 415 } 416 417 var $scrollContainer = $this.find(">.mCustomScrollBox>.mCSB_container"); 418 if ($scrollContainer.length) { 419 var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; 420 421 var newTouch = new Touch({ 422 identifier: 42,
423 target: $scrollContainer[0], 424 clientX: touch.clientX, 425 clientY: touch.clientY, 426 screenX: touch.screenX, 427 screenY: touch.screenY, 428 pageX: touch.pageX, 429 pageY: touch.pageY, 430 radiusX: 1, 431 radiusY: 1, 432 }); 433 434 var newEvent = new TouchEvent(e.type, { 435 cancelable: true, 436 bubbles: false, 437 composed: true, 438 touches: [newTouch], 439 targetTouches: [newTouch], 440 changedTouches: [newTouch], 441 }); 442 443 $scrollContainer[0].dispatchEvent(newEvent); 444 } 445 }); 446 447 $(this).on("touchend", function (e) { 448 $(this).off("touchstart touchmove touchend mousewheel mouseenter mouseleave"); 449 }); 450 451 if ($.event.special.mousewheel) { 452 $(this).on("mousewheel", function (e) { 453 var $this = $(this); 454 if (!$this.hasClass("mCustomScrollbar") && !$(this).hasClass("destroyed")) { 455 $this.mCustomScrollbar(config); 456 $this.off("touchstart touchmove touchend mousewheel mouseenter mouseleave"); 457 } 458 }); 459 } 460}; 461 462InitScrollBar = function (el, initOptions) { 463 var block; 464 if (typeof el === "undefined") { 465 block = $(".srollbar-custom:not(.mobile-scroll):not(.scroll-init)"); 466 } else { 467 block = el.filter(":not(.scroll-init)"); 468 } 469 var blockParent = $(".scrollbar-parent"); 470 471 if ( 472 (block.length || blockParent.length) && 473 !isMobile 474 // (!isMobile || window.matchMedia('(min-width:992px)').matches) 475 ) { 476 block.addClass("scroll-init"); 477 478 var options, 479 defaults = { 480 mouseWheel: { 481 scrollAmount: 150, 482 preventDefault: true, 483 }, 484 }; 485 if (block.length) { 486 var config = $.extend({}, defaults, options, block.data("plugin-options"), initOptions); 487 } else if (blockParent.length) { 488 var config = $.extend({}, defaults, options, blockParent.data("plugin-options"), initOptions); 489 } 490 491 config.callbacks = { 492 onScroll: function () { 493 if ($(this).find(".mCSB_buttonLeft").hasClass("disabled")) 494 $(this).find(".mCSB_buttonLeft").removeClass("disabled"); 495 if ($(this).find(".mCSB_buttonRight").hasClass("disabled")) 496 $(this).find(".mCSB_buttonRight").removeClass("disabled"); 497 }, 498 onTotalScrollBack: function () { 499 $(this).find(".mCSB_buttonLeft").addClass("disabled"); 500 }, 501 onTotalScroll: function () { 502 $(this).find(".mCSB_buttonRight").addClass("disabled"); 503 }, 504 onInit: function () { 505 $(this).find(".mCSB_buttonLeft").addClass("disabled"); 506 }, 507 }; 508 509 // if (block.length) { 510 // block.filter(":not(.scroll-deferred)").mCustomScrollbar(config); 511 // block.filter(".scroll-deferred").mCustomScrollbarDeferred(config); 512 // } 513 514 // if (blockParent.length) { 515 // blockParent.find(".scroll-deferred").mCustomScrollbarDeferred(config); 516 // } 517 } 518}; 519 520/*InitCustomScrollBar = function (el) { 521 var block; 522 if (typeof el === "undefined") { 523 block = $(".scrollbar:not(.mobile-scroll):not(.scroll-init)"); 524 } else { 525 block = el.filter(":not(.scroll-init)"); 526 } 527 528 if (block.length) { 529 block.addClass("scroll-init"); 530 531 var options, 532 defaults = { 533 effect: "fadeIn", 534 effectTime: 300, 535 threshold: 0, 536 // threshold: 30 537 }; 538 539 var config = $.extend({}, defaults, options, block.data("plugin-options")); 540 541 block.filter(":not(.scroll-deferred)").mCustomScrollbar(config); 542 block.filter(".scroll-deferred").mCustomScrollbarDeferred(config); 543 } 544}; 545*/ 546/* slider gallery for fancybox */ 547const InitFancyboxThumbnailsGallery = function(instance) { 548 const bUseThumbs = instance.group[0].opts.$orig[0].classList.contains('fancy-thumbs') && instance.group.length > 1; 549 550 if (bUseThumbs) 551 instance.Thumbs.show(); 552 else 553 return; 554 555 if ( 556 bUseThumbs && 557 $(".fancybox-thumbs") && 558 $(".fancybox-thumbs__list a").length > 1 && 559 !$(".fancybox-thumbs .swiper").length && 560 typeof initSwiperSlider === "function" 561 ) { 562 instance.Thumbs.$grid.find(".fancybox-thumbs__list a").each(function (i, el) { 563 $(el).css("background-image", "url(\"" + location.origin + encodeURI(instance.group[i].src) + "\")"); 564 }); 565 const SLIDER_RESIZE_BREAKPOINT = 600; 566 const $thumbsContainer = $(".fancybox-thumbs"); 567 const $swiperSlides = $(".fancybox-thumbs__list a"); 568 const $swiperWrapper = $(".fancybox-thumbs__list"); 569 const sliderDirection = (window.innerWidth >= SLIDER_RESIZE_BREAKPOINT ? 'vertical' : 'horizontal'); 570 571 const options = { 572 centerInsufficientSlides: true, 573 direction: sliderDirection, 574 mousewheelControl: true, 575 slidesPerView: 'auto', 576 spaceBetween: 16, 577 watchSlidesProgress: true, 578 }; 579 580 options.navigation = { 581 nextEl: ".fancybox-thumbs__wrapper .swiper-button-next", 582 prevEl: ".fancybox-thumbs__wrapper .swiper-button-prev", 583 }; 584
585 $('.fancybox-container').addClass('detail-gallery-big--vertical with-slider'); 586 $('.fancybox-inner').addClass('with-slider'); 587 $thumbsContainer.addClass('detail-gallery-big-slider-thumbs with-slider'); 588 $thumbsContainer.wrapInner( 589 `<div class='fancybox-thumbs__wrapper gallery-slider-thumb__container'> 590 <div class='swiper slider-solution' data-plugin-options='`+JSON.stringify(options)+`'/> 591 </div>` 592 ); 593 const $swiperContainerWrapper = $('.fancybox-thumbs__wrapper'); 594 595 $swiperContainerWrapper.append( 596 `<div class='gallery-slider-thumb-button gallery-slider-thumb-button--next slider-nav slider-nav--no-auto-hide swiper-button-next'> 597 <i class='svg inline stroke-dark-light'><svg width='7' height='12'><use xlink:href='`+arAsproOptions.SITE_TEMPLATE_PATH+`/images/svg/arrows.svg#right-7-12'></use></svg></i> 598 </div>` 599 ); 600 $swiperContainerWrapper.prepend( 601 `<div class='gallery-slider-thumb-button gallery-slider-thumb-button--prev slider-nav slider-nav--no-auto-hide swiper-button-prev'> 602 <i class='svg inline stroke-dark-light'><svg width='7' height='12'><use xlink:href='`+arAsproOptions.SITE_TEMPLATE_PATH+`/images/svg/arrows.svg#left-7-12'></use></svg></i> 603 </div>` 604 ); 605 606 $swiperWrapper.addClass('fancybox-thumb__list--slider-wrapper swiper-wrapper gallery__thumb-wrapper'); 607 $swiperSlides.addClass('swiper-slide gallery__item gallery__item--thumb rounded-x pointer'); 608 $swiperSlides.each(function(){ 609 const background = $(this).css('background-image').replace(/url\(|\"|\'|\)/g, ''); 610 $(this).css('background-image', ''); 611 $(this).wrapInner("<img src='"+background+"' class='rounded-x' alt='' title='' />"); 612 }) 613 614 initSwiperSlider(); 615 616 const swiper = $thumbsContainer.find('.swiper').data('swiper'); 617 swiper.slideTo(instance.curPos, 10); 618 swiper.on('resize', function() { 619 if ( window.innerWidth >= SLIDER_RESIZE_BREAKPOINT && options.direction === 'horizontal') { 620 options.direction = 'vertical'; 621 swiper.changeDirection(options.direction, false); 622 swiper.update(); 623 } else if (window.innerWidth < SLIDER_RESIZE_BREAKPOINT && options.direction === 'vertical') { 624 options.direction = 'horizontal'; 625 swiper.changeDirection(options.direction, false); 626 swiper.update(); 627 } 628 }) 629 } 630} 631/** */ 632InitFancyBox = function () { 633 if (typeof $.fn.fancybox !== "function") { 634 return; 635 } 636 637 if (!$(".fancy").length) { 638 return; 639 } 640 641 $(".fancy").fancybox({ 642 padding: [40, 40, 64, 40], 643 openEffect: "fade", 644 closeEffect: "fade", 645 nextEffect: "fade", 646 prevEffect: "fade", 647 opacity: true, 648 tpl: { 649 closeBtn: 650 '<span title="' + 651 BX.message("FANCY_CLOSE") + 652 '" class="fancybox-item fancybox-close inline svg"><svg class="svg svg-close" width="14" height="14" viewBox="0 0 14 14"><path data-name="Rounded Rectangle 568 copy 16" d="M1009.4,953l5.32,5.315a0.987,0.987,0,0,1,0,1.4,1,1,0,0,1-1.41,0L1008,954.4l-5.32,5.315a0.991,0.991,0,0,1-1.4-1.4L1006.6,953l-5.32-5.315a0.991,0.991,0,0,1,1.4-1.4l5.32,5.315,5.31-5.315a1,1,0,0,1,1.41,0,0.987,0.987,0,0,1,0,1.4Z" transform="translate(-1001 -946)"></path></svg></span>', 653 next: 654 '<a title="' + 655 BX.message("FANCY_NEXT") + 656 '" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>', 657 prev: 658 '<a title="' + 659 BX.message("FANCY_PREV") + 660 '" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>', 661 }, 662 touch: "enabled", 663 buttons: [ 664 //"zoom", 665 //"share", 666 // "slideShow", 667 //"fullScreen", 668 //"download", 669 //"thumbs", 670 "close", 671 ], 672 backFocus: false, 673 onActivate: function (instance) { 674 InitFancyboxThumbnailsGallery(instance); 675 }, 676 beforeShow: function (event) { 677 if ($(".fancybox-thumbs .swiper").length) { 678 const swiper = $(".fancybox-thumbs .swiper").data("swiper"); 679 680 if (typeof event.current !== 'undefined') { 681 swiper.slideTo(event.current.index); 682 } 683 } 684 var bCurrentSrc = 685 typeof event.current !== "undefined" && event.current.contentType == "html" && $(event.current.src).length; 686 var video_block = []; 687 688 if (bCurrentSrc) { 689 video_block = $(event.current.src).find("source.video-content"); 690 } 691 // else { 692 // video_block = $(".company-item source.video-content"); 693 // } 694 if (video_block.length) { 695 if (video_block.attr("src") == "#") { 696 var video_block_wrapper = video_block.closest("video"); 697 var video_block_clone = video_block_wrapper.clone(); 698 699 video_block_clone.find("source").attr("src", video_block_clone.find("source").data("src")); 700 video_block.attr("src", video_block.data("src")); 701 video_block_clone.insertAfter(video_block_wrapper); 702 video_block_clone.siblings("video").remove(); 703 } 704 } 705 var video_block_frame = []; 706 if (bCurrentSrc) { 707 video_block_frame = $(event.current.src).find(".company-item__video-iframe"); 708 } 709 // else { 710 // video_block_frame = $(".company-item .company-item__video-iframe"); 711 // } 712 if (video_block_frame.length) { 713 var data_src_iframe = video_block_frame.attr("data-src"); 714 video_block_frame.attr("src", data_src_iframe); 715 video_block_frame.attr("allow", "autoplay"); 716 } 717 }, 718 afterShow: function (event) { 719 if ($(".fancybox-overlay").css("opacity") == 0) { 720 setTimeout(function () { 721 $(".fancybox-overlay").css("opacity", 1); 722 $("html").addClass("overflow_html"); 723 }, 200); 724 } 725 726 $(".fancybox-nav").css("opacity", 0); 727 setTimeout(function () { 728 $(".fancybox-nav").css("opacity", 1); 729 }, 150); 730 731 var bCurrentSrc = 732 typeof event.current !== "undefined" && event.current.contentType == "html" && $(event.current.src).length; 733 var companyVideo = []; 734 if (bCurrentSrc) { 735 companyVideo = event.current.src[0].getElementsByClassName("company-item__video"); 736 } 737 // else { 738 // companyVideo = $(".fancybox-inner .company-item__video"); 739 // } 740 if (companyVideo.length) { 741 setTimeout(function () { 742 $(".fancybox-wrap video").resize(); 743 setTimeout(function () { 744 $(".fancybox-wrap").addClass("show_video"); 745 if (companyVideo[0].currentTime === 0 || companyVideo[0].paused) { 746 companyVideo[0].currentTime = 0; 747 companyVideo[0].play(); 748 } 749 }, 300); 750 }, 150); 751 } else if ($(".fancybox-wrap iframe").length) { 752 $(".fancybox-inner").height("100%"); 753 } 754 }, 755 beforeClose: function (event) { 756 // closeModal(); 757 $(".fancybox-overlay").fadeOut(); 758 var bCurrentSrc = 759 typeof event.current !== "undefined" && event.current.contentType == "html" && $(event.current.src).length; 760 var companyVideo = []; 761 if (bCurrentSrc) { 762 companyVideo = event.current.src[0].getElementsByClassName("company-item__video"); 763 } 764 // else { 765 // companyVideo = $(".fancybox-inner .company-item__video"); 766 // } 767 if (companyVideo.length) { 768 companyVideo[0].currentTime = 0; 769 } 770 771 $("html").removeClass("overflow_html"); 772 var video_block_frame = []; 773 if (bCurrentSrc) { 774 video_block_frame = $(event.current.src).find(".company-item__video-iframe"); 775 } 776 // else { 777 // video_block_frame = $(".company-item .company-item__video-iframe"); 778 // } 779 if (video_block_frame.length) { 780 video_block_frame.attr("src", ""); 781 } 782 }, 783 onClosed: function (event) { 784 var companyVideo = []; 785 if (bCurrentSrc) { 786 companyVideo = event.current.src[0].getElementsByClassName("company-item__video"); 787 } 788 // else { 789 // companyVideo = $(".fancybox-wrap .company-item__video"); 790 // } 791 if (companyVideo.length) { 792 companyVideo[0].pause(); 793 } 794 }, 795 }); 796}; 797 798InitFancyBoxVideo = function () { 799 if (typeof $.fn.fancybox !== "function") { 800 return; 801 } 802 803 if (!$(".video_link").length) { 804 return; 805 } 806 807 $(".video_link").fancybox({ 808 type: "iframe", 809 maxWidth: 800, 810 maxHeight: 600, 811 fitToView: false, 812 width: "70%", 813 height: "70%", 814 autoSize: false, 815 closeClick: false, 816 opacity: true, 817 tpl: { 818 closeBtn: 819 '<span title="' + 820 BX.message("FANCY_CLOSE") + 821 '" class="fancybox-item fancybox-close inline svg"><svg class="svg svg-close" width="14" height="14" viewBox="0 0 14 14"><path data-name="Rounded Rectangle 568 copy 16" d="M1009.4,953l5.32,5.315a0.987,0.987,0,0,1,0,1.4,1,1,0,0,1-1.41,0L1008,954.4l-5.32,5.315a0.991,0.991,0,0,1-1.4-1.4L1006.6,953l-5.32-5.315a0.991,0.991,0,0,1,1.4-1.4l5.32,5.315,5.31-5.315a1,1,0,0,1,1.41,0,0.987,0.987,0,0,1,0,1.4Z" transform="translate(-1001 -946)"></path></svg></span>', 822 next: 823 '<a title="' + 824 BX.message("FANCY_NEXT") + 825 '" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>', 826 prev: 827 '<a title="' + 828 BX.message("FANCY_PREV") + 829 '" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>', 830 }, 831 beforeShow: function (event) { 832 /*if(!$('.cd-modal-bg').hasClass('is-visible')){ 833 var scaleValue = retrieveScale($('.cd-modal-bg')); 834 835 $('.cd-modal-bg').show().addClass('is-visible').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(){ 836 animateLayer($('.cd-modal-bg'), scaleValue, true); 837 }); 838 }*/ 839 }, 840 afterShow: function () { 841 if ($(".fancybox-overlay").css("opacity") == 0) { 842 setTimeout(function () { 843 $(".fancybox-overlay").css("opacity", 1); 844 $("html").addClass("overflow_html"); 845 }, 200); 846 } 847 848 $(".fancybox-nav").css("opacity", 0); 849 setTimeout(function () { 850 $(".fancybox-nav").css("opacity", 1); 851 }, 150); 852 if ($(".fancybox-wrap iframe").length) { 853 $(".fancybox-inner").height("100%"); 854 } 855 }, 856 beforeClose: function () { 857 // closeModal(); 858 $(".fancybox-overlay").fadeOut(); 859 $("html").removeClass("overflow_html"); 860 }, 861 }); 862}; 863 864 865CheckTopVisibleMenu = function (that) { 866 var dropdownMenu = $(that).find(">.header-menu__dropdown-menu"); 867 868 if (!dropdownMenu.length) { 869 dropdownMenu = $(that).find(">.header-menu__wide-item-wrapper>.header-menu__wide-submenu"); 870 } 871 if (!dropdownMenu.length) { 872 dropdownMenu = $(that).find(">.header-menu__wide-submenu-item-inner>.submenu-wrapper>.header-menu__wide-submenu"); 873 } 874 875 876 if (!dropdownMenu.length) { 877 return; 878 } 879 880 // if( that !== undefined ) { 881 // dropdownMenu.push($(that)); 882 // } 883 884 if (dropdownMenu.length) { 885 dropdownMenu.each(function (i, el) { 886 var dropdownMenuCurrent = $(el); 887 dropdownMenuCurrent.find("a").css("white-space", ""); 888 dropdownMenuCurrent.css("left", ""); 889 dropdownMenuCurrent.css("right", ""); 890 dropdownMenuCurrent.removeClass("toright"); 891 892 var dropdownMenuCurrent_left = dropdownMenuCurrent.offset().left; 893 894 if (typeof dropdownMenuCurrent_left != "undefined") { 895 var menu = dropdownMenuCurrent.parents("header"); 896 if (!menu.length) menu = dropdownMenuCurrent.closest(".header__top-inner"); 897 var menu_width = menu.outerWidth(); 898 var menu_left = menu.offset().left; 899 var menu_right = menu_left + menu_width; 900 var isToRight = dropdownMenuCurrent.parents(".toright").length > 0; 901 var parentsdropdownMenuCurrents = dropdownMenuCurrent.parents(".header-menu__dropdown-menu"); 902 var isHasParentdropdownMenuCurrent = parentsdropdownMenuCurrents.length > 0; 903 if (isHasParentdropdownMenuCurrent) { 904 var parentdropdownMenuCurrent_width = parentsdropdownMenuCurrents.first().outerWidth() 905 ? parentdropdownMenuCurrent_width 906 : 240; 907 var parentdropdownMenuCurrent_left = parentsdropdownMenuCurrents.first().offset().left; 908 var parentdropdownMenuCurrent_right = parentdropdownMenuCurrent_width + parentdropdownMenuCurrent_left; 909 } 910 911 var emptyCurrentWidth = dropdownMenuCurrent.outerWidth() == 0; 912 913 var dropdownMenuCurrent_width = !emptyCurrentWidth ? dropdownMenuCurrent.outerWidth() : 240; 914 915 if (parentdropdownMenuCurrent_right + dropdownMenuCurrent_width > menu_right) { 916 dropdownMenuCurrent.find("a").css("white-space", "normal"); 917 } 918 919 var dropdownMenuCurrent_right = dropdownMenuCurrent_left + dropdownMenuCurrent_width; 920 921 if (dropdownMenuCurrent_right > menu_right || isToRight) { 922 var addleft = 0; 923 addleft = menu_right - dropdownMenuCurrent_right; 924 if (isHasParentdropdownMenuCurrent || isToRight) { 925 dropdownMenuCurrent.css("left", "auto"); 926 dropdownMenuCurrent.css("right", "calc(100% + 8px)"); 927 dropdownMenuCurrent.addClass("toright"); 928 } else { 929 var dropdownMenuCurrent_curLeft = parseInt(dropdownMenuCurrent.css("left")); 930 dropdownMenuCurrent.css("left", dropdownMenuCurrent_curLeft + addleft + "px"); 931 } 932 } 933 var firstMenuItem = dropdownMenuCurrent.parent().hasClass("header-menu__item--first"); 934 if (!firstMenuItem) { 935 if (dropdownMenuCurrent_right < 240 + menu_left) { 936 dropdownMenuCurrent.css("left", "calc(100% + 8px)"); 937 dropdownMenuCurrent.css("right", "0"); 938 dropdownMenuCurrent.removeClass("toright"); 939 } 940 /* 941 var childDropDown = dropdownMenuCurrent.find(">.dropdown"); 942 if (childDropDown.length) { 943 childDropDown.css("left", ""); 944 childDropDown.css("right", ""); 945 } 946 if (emptyCurrentWidth && childDropDown.length && dropdownMenuCurrent_right < 480 + menu_left) { 947 dropdownMenuCurrent.css("left", "calc(100% + 8px)"); 948 dropdownMenuCurrent.css("right", "0"); 949 dropdownMenuCurrent.removeClass("toright"); 950 childDropDown.css("left", "calc(100% + 8px)"); 951 childDropDown.css("right", "0"); 952 } 953 */ 954 } 955 } 956 }); 957 } 958}; 959 960MegaMenuFixed = function () { 961 var animationTime = 150; 962 $megaFixedNlo = $(".mega-fixed-menu").find("[data-nlo]"); 963 964 $(document).on("click", ".header .burger", function () { 965 if ($megaFixedNlo.length) { 966 if (!$megaFixedNlo.hasClass("nlo-loadings")) { 967 $megaFixedNlo.addClass("nlo-loadings"); 968 setTimeout(function () { 969 $.ajax({ 970 data: { nlo: $megaFixedNlo.attr("data-nlo") }, 971 error: function () { 972 $megaFixedNlo.removeClass("nlo-loadings"); 973 }, 974 complete: function (jqXHR, textStatus) { 975 if (textStatus === "success" || jqXHR.status == 404) { 976 var ob = BX.processHTML($.trim(jqXHR.responseText)); 977 BX.ajax.processScripts(ob.SCRIPT); 978 $megaFixedNlo.replaceWith(ob.HTML); 979 } 980 }, 981 }); 982 }, 300); 983 } 984 } 985 986 $("body").css("overflow", "hidden"); 987 $(".mega-fixed-menu").fadeIn(animationTime); 988 $(".mega-fixed-menu").css("display", "flex"); 989 }); 990 991 $(".mega-fixed-menu__close").on("click", function () { 992 $(this).closest(".mega-fixed-menu").fadeOut(animationTime); 993 //$("body").css("overflow", "auto"); 994 $("body").css("overflow", ""); 995 }); 996 997 $(".mega-fixed-menu .dropdown-menu .arrow").on("click", function (e) { 998 e.preventDefault(); 999 e.stopPropagation(); 1000 $(this).closest(".dropdown-submenu").find(".dropdown-menu").slideToggle(animationTime); 1001 $(this).closest(".dropdown-submenu").addClass("opened"); 1002 }); 1003}; 1004 1005CheckMainBannerSliderVText = function (slider) { 1006 /*if(slider.parents('.banners-big').length){ 1007 var sh = slider.height(); 1008 slider.find('.item').each(function() { 1009 var curSlideTextInner = $(this).find('.text .inner'); 1010 if(curSlideTextInner.length){
1011 var ith = curSlideTextInner.actual('height'); 1012 var p = (ith >= sh ? 0 : Math.floor((sh - ith) / 2)); 1013 curSlideTextInner.css('padding-top', p + 'px'); 1014 } 1015 }); 1016 }*/ 1017}; 1018 1019footerInit = function (block) { 1020 if (block.hasClass("check-visible")) { 1021 const blockJsPadding = $(".js-check-padding"); 1022 const blockJsHide = $(".js-check-hide"); 1023 1024 if (blockJsPadding.length && blockJsHide.length && block.data("ajax-check-visible")) { 1025 const arCheckBlock = block.data("ajax-check-visible").split(","); 1026 let bHiddenBlocks = arCheckBlock.every(function (i) { 1027 return $('[data-ajax-load-block="' + i + '"]').hasClass("hidden") === true; 1028 }); 1029 1030 if (bHiddenBlocks) { 1031 blockJsHide.addClass("hidden"); 1032 blockJsPadding.addClass("js-padding"); 1033 } else { 1034 blockJsHide.removeClass("hidden"); 1035 blockJsPadding.removeClass("js-padding"); 1036 } 1037 } 1038 } 1039}; 1040 1041verticalAlign = function (class_name) { 1042 if (typeof class_name == "undefined") class_name = "auto_align"; 1043 if ($("." + class_name).length) { 1044 maxHeight = 0; 1045 $("." + class_name).each(function () { 1046 if ($(this).height() > maxHeight) { 1047 maxHeight = $(this).height(); 1048 } 1049 }); 1050 $("." + class_name).each(function () { 1051 delta = Math.round((maxHeight - $(this).height()) / 2); 1052 $(this).css({ "padding-top": delta + "px", "padding-bottom": delta + "px" }); 1053 }); 1054 } 1055}; 1056 1057getGridSize = function (counts, custom_counts) { 1058 var z = parseInt($(".body_media").css("top")); 1059 if (typeof custom_counts != "undefined") { 1060 if (window.matchMedia("(max-width: 700px)").matches) return counts[3] ? counts[3] : counts[2]; 1061 else if (window.matchMedia("(max-width: 850px)").matches) return counts[2]; 1062 else if (window.matchMedia("(max-width: 1100px)").matches) return counts[1]; 1063 else return counts[0]; 1064 } else { 1065 if (window.matchMedia("(max-width: 600px)").matches) { 1066 return counts[3] ? counts[3] : counts[2]; 1067 } else return z == 2 ? counts[0] : z == 1 ? counts[1] : counts[2]; 1068 } 1069}; 1070
1071CheckFlexSlider = function () { 1072 $(".flexslider:not(.thmb):visible").each(function () { 1073 var slider = $(this); 1074 slider.resize(); 1075 var counts = slider.data("flexslider").vars.counts, 1076 slide_counts = slider.data("flexslider").vars.slide_counts; 1077 if (typeof counts != "undefined") { 1078 var cnt = getGridSize(counts, slider.data("flexslider").vars.customGrid); 1079 var to0 = 1080 cnt != slider.data("flexslider").vars.minItems || 1081 cnt != slider.data("flexslider").vars.maxItems || 1082 cnt != slider.data("flexslider").vars.move; 1083 if (to0) { 1084 slider.data("flexslider").vars.minItems = cnt; 1085 slider.data("flexslider").vars.maxItems = cnt; 1086 if (typeof slide_counts != "undefined") slider.data("flexslider").vars.move = slide_counts; 1087 else slider.data("flexslider").vars.move = cnt; 1088 1089 slider.flexslider(0); 1090 slider.resize(); 1091 slider.resize(); // twise! 1092 } 1093 } 1094 }); 1095}; 1096 1097CheckHeaderFixed = function () { 1098 var header = $("header .header__inner").first(), 1099 header_fixed = $("#headerfixed, body.simple_basket_mode .header_simple"), 1100 header_simple = $("body.simple_basket_mode .header_simple"); 1101 1102 if (header_fixed.length) { 1103 if (header.length) { 1104 var isHeaderFixed = false, 1105 headerCanFix = true, 1106 headerFixedHeight = header_fixed.actual("outerHeight"), 1107 headerNormalHeight = header.actual("outerHeight"), 1108 headerDiffHeight = headerNormalHeight - headerFixedHeight, 1109 mobileBtnMenu = $(".btn.btn-responsive-nav"), 1110 headerTop = $("#panel:visible").actual("outerHeight"), 1111 topBlock = $(".TOP_HEADER").first(), 1112 $headerFixedNlo = header_fixed.find("[data-nlo]"), 1113 isNloLoaded = !$headerFixedNlo.length, 1114 OnHeaderFixedScrollHandler; 1115 1116 if (headerDiffHeight <= 0) headerDiffHeight = 0; 1117 1118 if (topBlock.length) headerTop += topBlock.actual("outerHeight"); 1119 1120 $(window).scroll( 1121 (OnHeaderFixedScrollHandler = function () { 1122 var scrollTop = $(window).scrollTop(); 1123 headerCanFix = !mobileBtnMenu.is(":visible"); 1124 1125 if (!isHeaderFixed) { 1126 if (headerCanFix && scrollTop > headerNormalHeight + headerTop) { 1127 isHeaderFixed = true; 1128 1129 header_fixed.css("top", "-" + headerNormalHeight + "px"); 1130 header_fixed.addClass("fixed"); 1131 1132 header_fixed.animate({ top: "0" }, { duration: 300, complete: function () {} }); 1133 1134 if (header_simple.length) { 1135 headerSimpleHeight = header_simple.actual("outerHeight"); 1136 header_simple.parent().css({"margin-top": headerSimpleHeight}); 1137 } 1138 1139 //CheckTopMenuDotted(); 1140 } 1141 } 1142 1143 if (isHeaderFixed || !headerCanFix) { 1144 if (!headerCanFix || scrollTop <= headerDiffHeight + headerTop) { 1145 isHeaderFixed = false; 1146 header_fixed.removeClass("fixed"); 1147 1148 if (header_simple.length) { 1149 header_simple.parent().css({ "margin-top": "" }); 1150 } 1151 } 1152 } 1153 }) 1154 ); 1155 } 1156 } 1157 1158 // mobile fixed 1159 var mfixed = $("body.mfixed_y.mfixed_view_scroll_top .headers-container"); 1160 if (mfixed.length) { 1161 var mheaderFixed = false, 1162 mheaderFixedHeight = mfixed.actual("outerHeight"), 1163 mheaderTop = $("#panel:visible").actual("outerHeight"), 1164 mheaderStartScroll = 0; 1165 1166 $(window).scroll(function () { 1167 if (window.matchMedia("(max-width:991px)").matches) { 1168 var scrollTop = $(window).scrollTop(); 1169 if (!mheaderFixed) { 1170 if (scrollTop > mheaderTop + mheaderFixedHeight && scrollTop < mheaderStartScroll) { 1171 mfixed.addClass("fixed"); 1172 mheaderFixed = true; 1173 } 1174 } else { 1175 if (scrollTop <= mheaderTop || scrollTop > mheaderStartScroll) { 1176 mfixed.removeClass("fixed"); 1177 mheaderFixed = false; 1178 } 1179 } 1180 1181 mheaderStartScroll = scrollTop; 1182 } else { 1183 mfixed.removeClass("fixed"); 1184 } 1185 }); 1186 } 1187}; 1188 1189CheckObjectsSizes = function () { 1190 $(".container iframe,.container object,.container video").each(function () { 1191 var height_attr = $(this).attr("height"); 1192 var width_attr = $(this).attr("width"); 1193 1194 if (height_attr && width_attr) { 1195 $(this).css("height", ($(this).outerWidth() * height_attr) / width_attr); 1196 } 1197 }); 1198}; 1199 1200var isMobile = jQuery.browser.mobile; 1201var players = {}; 1202 1203if (isMobile) { 1204 document.documentElement.className += " mobile"; 1205} 1206 1207var timerScroll = false, 1208 ignoreScroll = [], 1209 documentScrollTopLast = $(document).scrollTop(), 1210 startScroll = 0; 1211 1212$.fn.equalizeHeights = function (outer, classNull, minHeight, autoHeightBlock) { 1213 var maxHeight = this.map(function (i, e) { 1214 var minus_height = 0, 1215 calc_height = 0; 1216 if (classNull !== false && $(e).find(classNull).is(":visible")) 1217 minus_height = parseInt($(e).find(classNull).actual("outerHeight")); 1218 if (minus_height) minus_height += 15; 1219 $(e).css("height", ""); 1220 if (autoHeightBlock !== false) { 1221 var height_tmp = $(e).find(autoHeightBlock).css("height"); 1222 $(e).find(autoHeightBlock).css("height", ""); 1223 } 1224 if (outer === true) { 1225 calc_height = $(e).actual("outerHeight") - minus_height; 1226 } else { 1227 calc_height = $(e).actual("height") - minus_height; 1228 } 1229 1230 if (autoHeightBlock !== false) { 1231 $(e).find(autoHeightBlock).css("height", height_tmp); 1232 } 1233 if (minHeight !== false) { 1234 if (calc_height < minHeight) { 1235 calc_height += minHeight - calc_height; 1236 } 1237 if (window.matchMedia("(max-width: 520px)").matches) { 1238 calc_height = 300; 1239 } 1240 if (window.matchMedia("(max-width: 400px)").matches) { 1241 calc_height = 200; 1242 } 1243 } 1244 return calc_height; 1245 }).get(); 1246 1247 for (var i = 0, c = maxHeight.length; i < c; ++i) { 1248 if (maxHeight[i] % 2) { 1249 --maxHeight[i]; 1250 } 1251 } 1252 1253 return this.height(Math.max.apply(this, maxHeight)); 1254}; 1255 1256$.fn.getFloatWidth = function () { 1257 var width = 0; 1258 1259 if ($(this).length) { 1260 var rect = $(this)[0].getBoundingClientRect(); 1261 if (!(width = rect.width)) { 1262 width = rect.right - rect.left; 1263 } 1264 } 1265 1266 return width; 1267}; 1268 1269$.fn.sliceHeight2 = function (options) { 1270 function _slice(el) { 1271 el.each(function () { 1272 $(this).css("line-height", ""); 1273 $(this).css("height", ""); 1274 }); 1275 if (typeof options.autoslicecount == "undefined" || options.autoslicecount !== false) { 1276 var elsw = 1277 typeof options.row !== "undefined" && options.row.length 1278 ? el.first().parents(options.row).getFloatWidth() 1279 : el.first().parents(".grid-list").getFloatWidth(), 1280 elw = 1281 typeof options.item !== "undefined" && options.item.length 1282 ? $(options.item).first().getFloatWidth() 1283 : el.first().hasClass("grid-list__item") 1284 ? el.first().getFloatWidth() 1285 : el.first().parents(".grid-list__item").getFloatWidth(); 1286 1287 if (!elsw) { 1288 elsw = el.first().parents(".grid-list").getFloatWidth(); 1289 } 1290 if (elw && options.fixWidth) elw -= options.fixWidth; 1291 1292 if (elsw && elw) { 1293 options.slice = Math.floor(elsw / elw); 1294 } 1295 } 1296 if (typeof options.typeResize == "undefined" || options.typeResize === false) { 1297 if (options.sliceEqualLength && el.closest(".flexslider").length) options.slice = el.length; 1298 if (options.slice >= 1) { 1299 for (var i = 0; i < el.length; i += options.slice) { 1300 $(el.slice(i, i + options.slice)).equalizeHeights( 1301 options.outer, 1302 options.classNull, 1303 options.minHeight, 1304 options.autoHeightBlock 1305 ); 1306 } 1307 } 1308 if (options.lineheight) { 1309 var lineheightAdd = parseInt(options.lineheight); 1310 if (isNaN(lineheightAdd)) { 1311 lineheightAdd = 0; 1312 } 1313 el.each(function () { 1314 $(this).css("line-height", $(this).actual("height") + lineheightAdd + "px"); 1315 }); 1316 } 1317 } 1318
1319 if (typeof options.callback == "function") options.callback(el); 1320 } 1321 var options = $.extend( 1322 { 1323 slice: null, 1324 outer: false, 1325 lineheight: false, 1326 autoslicecount: true, 1327 classNull: false, 1328 minHeight: false, 1329 row: false, 1330 item: false, 1331 typeResize: false, 1332 resize: true, 1333 typeValue: false, 1334 sliceEqualLength: false, 1335 fixWidth: 0, 1336 callback: false, 1337 autoHeightBlock: false, 1338 }, 1339 options 1340 ); 1341 1342 var el = $(this); 1343 ignoreResize.push(true); 1344 _slice(el); 1345 ignoreResize.pop(); 1346 1347 if (options.resize !== false) { 1348 BX.addCustomEvent("onWindowResize", function (eventdata) { 1349 ignoreResize.push(true); 1350 _slice(el); 1351 ignoreResize.pop(); 1352 }); 1353 } 1354}; 1355 1356function extendDepthObject(target, FromObj) { 1357 var to = Object.assign({}, target); 1358 for (var key in FromObj) { 1359 if (typeof FromObj[key] == "object") { 1360 to[key] = extendDepthObject(to[key], FromObj[key]); 1361 } else { 1362 to[key] = FromObj[key]; 1363 } 1364 } 1365 1366 return to; 1367} 1368 1369$.fn.sliceHeight = function (options) { 1370 function _slice(el) { 1371 var arBreakpoints = Object.keys(options.breakpoint); 1372 var resizeOptionsTmp = {}; 1373 if (arBreakpoints.length) { 1374 for (var key in arBreakpoints) { 1375 if (window.matchMedia(arBreakpoints[key].toString()).matches) { 1376 resizeOptionsTmp = options.breakpoint[arBreakpoints[key]]; 1377 } 1378 } 1379 } 1380 1381 var resizeOptions = extendDepthObject(options, resizeOptionsTmp); 1382 1383 var blockNullClass = 1384 resizeOptions.blockNull !== undefined && resizeOptions.blockNull.class !== undefined 1385 ? resizeOptions.blockNull.class 1386 : false; 1387 var parent = 1388 typeof resizeOptions.row !== "undefined" && resizeOptions.row.length 1389 ? el.first().parents(resizeOptions.row) 1390 : el.first().parents(".items"); 1391 var item = ""; 1392 1393 if (typeof resizeOptions.item !== "undefined" && resizeOptions.item.length) { 1394 if (blockNullClass) { 1395 $(resizeOptions.item).each(function (i, element) { 1396 _element = $(element); 1397 if (!_element.hasClass(blockNullClass)) { 1398 item = _element; 1399 } 1400 }); 1401 if (!item) 1402 // if only ignored blocks 1403 return false; 1404 } else { 1405 item = $(resizeOptions.item).first(); 1406 } 1407 } else { 1408 if (el.first().hasClass("item")) { 1409 item = el.first(); 1410 } else { 1411 item = el.first().parents(".item"); 1412 } 1413 } 1414 1415 if (typeof resizeOptions.autoslicecount == "undefined" || resizeOptions.autoslicecount !== false) { 1416 var elsw = parent.getFloatWidth(), 1417 elw = item.getFloatWidth(); 1418 if (!elsw) { 1419 elsw = el.first().parents(".row").getFloatWidth(); 1420 } 1421 if (!elw) { 1422 if (typeof resizeOptions.item !== "undefined" && resizeOptions.item.length) 1423 elw = $(resizeOptions.item + ":eq(1)").getFloatWidth() 1424 ? $(resizeOptions.item + ":eq(1)").getFloatWidth() 1425 : $(resizeOptions.item + ":eq(2)").getFloatWidth(); 1426 else elw = $(el[1]).getFloatWidth() ? $(el[1]).getFloatWidth() : $(el[2]).getFloatWidth(); 1427 } 1428 if (elw && resizeOptions.fixWidth) elw -= resizeOptions.fixWidth; 1429 1430 elw = parseInt(elw * 100) / 100; 1431 1432 if (elsw && elw) { 1433 resizeOptions.slice = Math.floor(elsw / elw); 1434 } 1435 } 1436 1437 if (resizeOptions.customSlice) { 1438 //manual slice count 1439 var bSliceNext = false; 1440 if (resizeOptions.length) { 1441 elw = 1442 typeof resizeOptions.item !== "undefined" && resizeOptions.item.length 1443 ? $(resizeOptions.item).last().getFloatWidth() 1444 : el.last().hasClass("item") 1445 ? el.last().getFloatWidth() 1446 : el.last().parents(".item").getFloatWidth(); 1447 if (elw) resizeOptions.sliceNext = Math.floor(elsw / elw); 1448 1449 bSliceNext = true; 1450 } 1451 } 1452 1453 elements = []; 1454 if (resizeOptions.classes !== undefined && resizeOptions.classes.length) { 1455 for (var i = 0; i < resizeOptions.classes.length; i++) { 1456 var items = $(resizeOptions.item).find(resizeOptions.classes[i]); 1457 elements.push(items); 1458 } 1459 } 1460 var elIndex = elements.push(el) - 1; 1461 1462 if (resizeOptions.mobile === true) { 1463 if (window.matchMedia("(max-width: 550px)").matches) { 1464 for (var block = 0; block < elements.length; block++) { 1465 var items = $(elements[block]); 1466 items.css({ 1467 "line-height": "", 1468 height: "", 1469 }); 1470 } 1471 return; 1472 } 1473 } 1474 1475 if (typeof resizeOptions.typeResize == "undefined" || resizeOptions.typeResize === false) { 1476 if (resizeOptions.slice) { 1477 for (var block = 0; block < elements.length; block++) { 1478 if (resizeOptions.currentRow) { 1479 var itemNumber = el.index(resizeOptions.currentItem); 1480 var rowCount = resizeOptions.slice; 1481 var rowNumber = Math.floor(itemNumber / rowCount); 1482 1483 var items = $(elements[block].slice(rowNumber * rowCount, rowNumber * rowCount + rowCount)); 1484 var classNull = block == elIndex ? resizeOptions.classNull : false;
1485 items.css({ 1486 "line-height": "", 1487 height: "", 1488 }); 1489 items.equalizeHeights(resizeOptions.outer, classNull, resizeOptions); 1490 } else { 1491 for (var i = 0; i < elements[block].length; ) { 1492 if (resizeOptions.customSlice && resizeOptions.sliceNext && bSliceNext && i) 1493 //manual slice count 1494 resizeOptions.slice = resizeOptions.sliceNext; 1495 1496 var slice = resizeOptions.slice; 1497 var items = $(elements[block].slice(i, i + slice)); 1498 if (resizeOptions.blockNull !== undefined) { 1499 if (resizeOptions.blockNull.class !== undefined) { 1500 var counts = 0; 1501 items.each(function (i, item) { 1502 var _item = $(item); 1503 if ( 1504 _item.hasClass(resizeOptions.blockNull.class) || 1505 _item.closest("." + resizeOptions.blockNull.class).length 1506 ) { 1507 counts++; 1508 } 1509 }); 1510 } 1511 } 1512 if (counts) { 1513 slice -= (resizeOptions.blockNull.width - 1) * counts; 1514 } 1515 1516 items = $(elements[block].slice(i, i + slice)); 1517 if (items) { 1518 var classNull = block == elIndex ? resizeOptions.classNull : false; 1519 1520 items.css({ 1521 "line-height": "", 1522 height: "", 1523 }); 1524 items.equalizeHeights(resizeOptions.outer, classNull, resizeOptions); 1525 } 1526 i += slice || 1; 1527 } 1528 } 1529 } 1530 } 1531 if (resizeOptions.lineheight) { 1532 var lineheightAdd = parseInt(resizeOptions.lineheight); 1533 if (isNaN(lineheightAdd)) { 1534 lineheightAdd = 0; 1535 } 1536 el.each(function () { 1537 $(this).css("line-height", $(this).actual("height") + lineheightAdd + "px"); 1538 }); 1539 } 1540 } 1541 } 1542 var options = $.extend( 1543 { 1544 slice: null, 1545 sliceNext: null, 1546 outer: false, 1547 lineheight: false, 1548 autoslicecount: true, 1549 classNull: false, 1550 minHeight: false, 1551 row: false, 1552 item: false, 1553 typeResize: false, 1554 typeValue: false, 1555 fixWidth: 0, 1556 resize: true, 1557 mobile: false, 1558 customSlice: false, 1559 breakpoint: {}, 1560 classes: [], 1561 }, 1562 options 1563 ); 1564 1565 var el = $(this); 1566 1567 ignoreResize.push(true); 1568 _slice(el); 1569 ignoreResize.pop(); 1570 1571 if (options.resize) { 1572 BX.addCustomEvent("onWindowResize", function (eventdata) { 1573 try { 1574 ignoreResize.push(true); 1575 _slice(el); 1576 } catch (e) { 1577 } finally { 1578 ignoreResize.pop(); 1579 } 1580 }); 1581 } else { 1582 if (!ignoreResize.length) { 1583 // ignoreResize.push(true); 1584 _slice(el); 1585 // ignoreResize.pop(); 1586 } 1587 } 1588}; 1589 1590waitingExists = function (selector, delay, callback) { 1591 if (typeof callback !== "undefined" && selector.length && delay > 0) {
1592 delay = parseInt(delay); 1593 delay = delay < 0 ? 0 : delay; 1594 1595 if (!$(selector).length) { 1596 setTimeout(function () { 1597 waitingExists(selector, delay, callback); 1598 }, delay); 1599 } else { 1600 callback(); 1601 } 1602 } 1603}; 1604 1605waitingNotExists = function (selectorExists, selectorNotExists, delay, callback) { 1606 if ( 1607 typeof callback !== "undefined" && 1608 selectorExists.length && 1609 $(selectorExists).length && 1610 selectorNotExists.length && 1611 !$(selectorNotExists).length && 1612 delay > 0 1613 ) { 1614 delay = parseInt(delay); 1615 delay = delay < 0 ? 0 : delay; 1616 1617 setTimeout(function () { 1618 if (selectorExists.length && !$(selectorNotExists).length) { 1619 callback(); 1620 } 1621 }, delay); 1622 } 1623}; 1624 1625function onLoadjqm(name, hash, _this) { 1626 if (funcDefined("onlyCatalogMenuClose")) { 1627 onlyCatalogMenuClose(); 1628 } 1629 1630 if (hash.c.noOverlay === undefined || (hash.c.noOverlay !== undefined && !hash.c.noOverlay)) { 1631 $("body").addClass("jqm-initied"); 1632 } 1633 1634 $("body").addClass("swipeignore"); 1635 1636 if (typeof $(hash.t).data("ls") !== " undefined" && $(hash.t).data("ls")) { 1637 var ls = $(hash.t).data("ls"), 1638 ls_timeout = 0, 1639 v = ""; 1640 1641 if ($(hash.t).data("ls_timeout")) ls_timeout = $(hash.t).data("ls_timeout"); 1642 1643 ls_timeout = ls_timeout ? Date.now() + ls_timeout * 1000 : ""; 1644 1645 if (typeof localStorage !== "undefined") { 1646 var val = localStorage.getItem(ls); 1647 try { 1648 v = JSON.parse(val); 1649 } catch (e) { 1650 v = val; 1651 } 1652 if (v != null) { 1653 localStorage.removeItem(ls); 1654 } 1655 v = {}; 1656 v["VALUE"] = "Y"; 1657 v["TIMESTAMP"] = ls_timeout; // default: seconds for 1 day 1658 1659 localStorage.setItem(ls, JSON.stringify(v)); 1660 } else { 1661 var val = $.cookie(ls); 1662 if (!val) $.cookie(ls, "Y", { expires: ls_timeout }); // default: seconds for 1 day 1663 } 1664 1665 var dopClasses = hash.w.find(".marketing-popup").data("classes"); 1666 if (dopClasses) { 1667 hash.w.addClass(dopClasses); 1668 } 1669 } 1670 1671 //update show password 1672 //show password eye 1673 if (hash.w.hasClass("auth_frame")) { 1674 hash.w.find(".form-group:not(.eye-password-ignore) [type=password]").each(function (item) { 1675 let inputBlock = $(this).closest(".input"); 1676 if (inputBlock.length) { 1677 inputBlock.addClass("eye-password"); 1678 } else { 1679 let labelBlock = passBlock.find(".label_block"); 1680 let passBlock = $(this).closest(".form-group"); 1681 if (labelBlock.length) { 1682 labelBlock.addClass("eye-password"); 1683 } else { 1684 passBlock.addClass("eye-password"); 1685 } 1686 } 1687 }); 1688 } 1689 1690 $.each($(hash.t).get(0).attributes, function (index, attr) { 1691 if (/^data\-autoload\-(.+)$/.test(attr.nodeName)) { 1692 var key = attr.nodeName.match(/^data\-autoload\-(.+)$/)[1]; 1693 var el = $('input[name="' + key.toUpperCase() + '"]'); 1694 if (!el.length) { 1695 //is form block 1696 el = $('input[data-sid="' + key.toUpperCase() + '"]'); 1697 } 1698 1699 var value = $(hash.t).data("autoload-" + key); 1700 value = value.toString().replace(/%99/g, "\\"); // replace symbol \ 1701 1702 el.val(BX.util.htmlspecialcharsback(value)).attr("readonly", "readonly"); 1703 el.closest(".form-group").addClass("input-filed"); 1704 el.attr("title", el.val()); 1705 } 1706 }); 1707 1708 //show gift block 1709 if (hash.w.hasClass("send_gift_frame")) { 1710 let imgHtml, priceHtml, propsHtml; 1711 imgHtml = priceHtml = propsHtml = ''; 1712 1713 if ($('.detail-gallery-big link[itemprop="image"]').length) { 1714 imgHtml = '<img src="' + $('.detail-gallery-big link[itemprop="image"]').attr('href') + '" alt="" title="" />'; 1715 } 1716 1717 if ($('.catalog-detail__buy-block .price__new').length) { 1718 priceHtml = '<div class="item-block-info__price color_222">' + $('.catalog-detail__buy-block .price__new-val').text() + '</div>'; 1719 } 1720 1721 if ($('.catalog-block__offers .sku-props__item').length) { 1722 propsHtml = '<div class="item-block-info__props font_13">'; 1723 $('.catalog-block__offers .sku-props__item').each(function() { 1724 propsHtml += '<div class="item-block-info__props-item">' + $(this).find('.sku-props__title').text() + '</div>'; 1725 }) 1726 propsHtml += '</div>'; 1727 } 1728 1729 $( 1730 '<div class="popup__item-block">' + 1731 '<div class="popup__item-block-title">' + BX.message("POPUP_GIFT_TEXT") + '</div>' + 1732 '<div class="popup__item-block-info bordered rounded-x grid-list grid-list--gap-20">' + 1733 '<div class="item-block-info__image grid-list__item">' + imgHtml + '</div>' + 1734 '<div class="item-block-info__text grid-list__item">' + 1735 '<div class="name">' + $("h1").text() + '</div>' + 1736 priceHtml + 1737 propsHtml + 1738 '</div>' + 1739 '</div>' + 1740 '</div>' 1741 ).prependTo(hash.w.find(".form-body")); 1742 } 1743 1744 if (hash.c.noOverlay === undefined || (hash.c.noOverlay !== undefined && !hash.c.noOverlay)) { 1745 let diffWidth; 1746 if ((diffWidth = window.innerWidth - document.documentElement.clientWidth)) { 1747 $("body").css({ "padding-right": diffWidth + "px" }); 1748 } 1749 1750 $("body").css({ overflow: "hidden", height: "100vh" }); 1751 hash.w.closest("#popup_iframe_wrapper").css({ "z-index": 3000, display: "flex" }); 1752 } 1753 1754 var eventdata = { action: "loadForm" }; 1755 BX.onCustomEvent("onCompleteAction", [eventdata, $(hash.t)[0]]); 1756 1757 if ($(hash.t).data("autohide")) { 1758 $(hash.w).data("autohide", $(hash.t).data("autohide")); 1759 } 1760 1761 if ($(hash.t).data("autoshow")) { 1762 eval($(hash.t).data("autoshow")); 1763 } 1764 1765 if (name == "order_product") { 1766 if ($(hash.t).data("product")) { 1767 $('input[name="PRODUCT"]').closest(".form-group").addClass("input-filed"); 1768 $('input[name="PRODUCT"]') 1769 .val($(hash.t).data("product")) 1770 .attr("readonly", "readonly") 1771 .attr("title", $('input[name="PRODUCT"]').val()); 1772 } 1773 } 1774 if (name == "question") { 1775 if ($(hash.t).data("product")) { 1776 $('input[name="NEED_PRODUCT"]').closest(".form-group").addClass("input-filed"); 1777 $('input[name="NEED_PRODUCT"]') 1778 .val($(hash.t).data("product")) 1779 .attr("readonly", "readonly") 1780 .attr("title", $('input[name="NEED_PRODUCT"]').val()); 1781 } 1782 } 1783 1784 //show one_click_buy block 1785 if (name === "ocb") { 1786 const parent = hash.w.find(".flexbox").first();
1787 const item = _this.closest(".js-popup-block"); 1788 1789 var data = item.find("[data-item]").data("item"); 1790 if (typeof data === "undefined" || !data) { 1791 data = {}; 1792 } 1793 1794 parent.addClass("flexbox--direction-row-reverse"); 1795 1796 parent.find(".form.popup").addClass("flex-grow-1"); 1797 1798 let goodsNode = '<div class="goods-popup"><div class="goods-popup__sticky">'; 1799 1800 //image block 1801 let imageNode = '<div class="goods-popup__image image-list-wrapper">'; 1802 //stiker 1803 if (item.find(".sticker").length) { 1804 imageNode += '<div class="sticker sticker--upper">'; 1805 imageNode += item.find(".sticker").html(); 1806 imageNode += "</div>"; 1807 } 1808 //image 1809 imageNode += '<div class="image">'; 1810 imageNode += 1811 '<img class="img-responsive" src="' + 1812 (item.find(".image-list__link link[itemprop=image]").length 1813 ? item.find(".image-list__link link[itemprop=image]:first").attr("href") 1814 : item.find(".image-list-wrapper img:first").length 1815 ? item.find(".image-list-wrapper img:first").attr("src") 1816 : arAsproOptions.SITE_TEMPLATE_PATH + "/images/svg/noimage_product.svg") + 1817 '" />'; 1818 imageNode += "</div>"; 1819 imageNode += "</div>"; 1820 goodsNode += imageNode; 1821 1822 //info block 1823 let infoNode = '<div class="goods-popup__info">'; 1824 //link 1825 if (item.find(".js-popup-title").attr("href")) { 1826 infoNode += 1827 '<a class="dark_link switcher-title goods-popup__info-link font_15" href="' + 1828 item.find(".js-popup-title").attr("href") + 1829 '">'; 1830 infoNode += data ? data.NAME : item.find(".js-popup-title").html(); 1831 infoNode += "</a>"; 1832 } else { 1833 infoNode += '<div class="color_222 switcher-title goods-popup__info-link font_15">'; 1834 infoNode += data ? data.NAME : item.find(".js-popup-title").html(); 1835 infoNode += "</div>"; 1836 } 1837 1838 // status 1839 let status = ''; 1840 if (item.find(".status-container").length) { 1841 status += '<div class="line-block__item font_14">'; 1842 status += item.find(".status-container").wrap('<div></div>').parent().html(); 1843 status += '</div>'; 1844 } 1845 1846 //article 1847 let article = ''; 1848 if (item.find('.js-popup-info .article').length) { 1849 article += '<div class="line-block__item font_13 color_999">'; 1850 article += item.find('.js-popup-info .article').closest('.line-block__item').html(); 1851 article += '</div>'; 1852 } 1853 1854 if (article || status) { 1855 infoNode += '<div class="line-block line-block--20 flexbox--wrap goods-popup__info-more">' + status + article + '</div>'; 1856 } 1857 1858 infoNode += "</div>"; 1859 goodsNode += infoNode; 1860 1861 //price block 1862 if (item.find(".js-popup-price .price").length) { 1863 let priceNode = '<div class="goods-popup__price">'; 1864 priceNode += item.find(".js-popup-price").html(); 1865 priceNode += "</div>"; 1866 goodsNode += priceNode; 1867 1868 let $price = item.find(".js-popup-price .price__new-val"); 1869 if ($price.length) { 1870 parent.find('input[name=PRODUCT_PRICE],input[data-sid=PRODUCT_PRICE]').val($price.text().trim()); 1871 } 1872 } 1873 1874 goodsNode += "</div></div>"; 1875 1876 $(goodsNode).appendTo(parent); 1877 } 1878 1879 if (name == "fast_view" && $(".smart-filter-filter").length) { 1880 var navButtons = 1881 '<div class="navigation-wrapper-fast-view">' + 1882 '<div class="fast-view-nav prev bg-theme-hover" data-fast-nav="prev">' + 1883 '<i class="svg left">' + 1884 '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="6.969" viewBox="0 0 12 6.969"><path id="Rounded_Rectangle_702_copy_24" data-name="Rounded Rectangle 702 copy 24" class="cls-1" d="M361.691,401.707a1,1,0,0,1-1.414,0L356,397.416l-4.306,4.291a1,1,0,0,1-1.414,0,0.991,0.991,0,0,1,0-1.406l5.016-5a1.006,1.006,0,0,1,1.415,0l4.984,5A0.989,0.989,0,0,1,361.691,401.707Z" transform="translate(-350 -395.031)"/></svg>' + 1885 "</i>" + 1886 "</div>" + 1887 '<div class="fast-view-nav next bg-theme-hover" data-fast-nav="next">' + 1888 '<i class="svg right">' + 1889 '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="6.969" viewBox="0 0 12 6.969"><path id="Rounded_Rectangle_702_copy_24" data-name="Rounded Rectangle 702 copy 24" class="cls-1" d="M361.691,401.707a1,1,0,0,1-1.414,0L356,397.416l-4.306,4.291a1,1,0,0,1-1.414,0,0.99
18891,0.991,0,0,1,0-1.406l5.016-5a1.006,1.006,0,0,1,1.415,0l4.984,5A0.989,0.989,0,0,1,361.691,401.707Z" transform="translate(-350 -395.031)"/></svg>' + 1890 "</i>" + 1891 "</div>" + 1892 "</div>"; 1893 1894 // hash.w.addClass("no_custom_scroll"); 1895 hash.w.closest("#popup_iframe_wrapper").append(navButtons); 1896 } 1897 1898 var needScrollbar = true; 1899 1900 if ( 1901 arAsproOptions["THEME"]["REGIONALITY_SEARCH_ROW"] == "Y" && 1902 (hash.w.hasClass("city_chooser_frame") || hash.w.hasClass("city_chooser_small_frame")) 1903 ) { 1904 hash.w.addClass("small_popup_regions"); 1905 hash.w.addClass("jqmWindow--overflow-visible"); 1906 needScrollbar = false; 1907 } 1908 1909 /*if (!hash.w.hasClass("no_custom_scroll")) { 1910 hash.w.addClass("show srollbar-custom").css({ opacity: 1 }); 1911 InitScrollBar(); 1912 }*/ 1913 hash.w.addClass("show").css({ opacity: 1 }); 1914 if(needScrollbar) 1915 hash.w.find(">div").addClass("scrollbar"); 1916} 1917 1918function onHidejqm(name, hash) { 1919 if ($(hash.w).data("autohide")) { 1920 eval($(hash.w).data("autohide")); 1921 } 1922 1923 // hash.w.css('opacity', 0).hide(); 1924 hash.w.animate({ opacity: 0 }, 200, function () { 1925 // hash.w.removeClass("scroll-init srollbar-custom").mCustomScrollbar("destroy"); 1926 hash.w.hide(); 1927 hash.w.empty(); 1928 hash.o.remove(); 1929 hash.w.removeClass("show"); 1930 hash.w.removeClass("success"); 1931 1932 $("body").css({ overflow: "", height: "", "padding-right": "" }); 1933 1934 if (!hash.w.closest("#popup_iframe_wrapper").find(".jqmOverlay").length) { 1935 hash.w.closest("#popup_iframe_wrapper").css({ "z-index": "", display: "" }); 1936 } 1937 1938 if (window.matchMedia("(max-width: 991px)").matches) { 1939 $("body").removeClass("all_viewed"); 1940 } 1941 if (!$(".jqmOverlay:not(.mobp)").length || $(".jqmOverlay.waiting").length) { 1942 $("body").removeClass("jqm-initied"); 1943 } 1944 1945 $("body").removeClass("swipeignore"); 1946 $("body").removeClass("overflow-block"); 1947 1948 if (name == "fast_view") { 1949 $(".fast_view_popup").remove(); 1950 1951 var navButtons = hash.w.closest("#popup_iframe_wrapper").find(".navigation-wrapper-fast-view"); 1952 navButtons.remove(); 1953 } 1954 1955 if (name == 'ocb') { 1956 hash.w.removeClass('compact'); 1957 } 1958 1959 if (name == "stores") { 1960 window.GLOBAL_arMapObjects = {}; 1961 } 1962 }); 1963 1964 window.b24form = false; 1965} 1966 1967function parseUrlQuery() { 1968 var data = {}; 1969 if (location.search) { 1970 var pair = location.search.substr(1).split("&"); 1971 for (var i = 0; i < pair.length; i++) { 1972 var param = pair[i].split("="); 1973 data[param[0]] = param[1]; 1974 } 1975 } 1976 return data; 1977} 1978 1979function scroll_block(block) { 1980 if (block.length) { 1981 var topPos = block.offset().top, 1982 headerH = $("header").outerHeight(true, true); 1983 if ($(".stores_tab").length) { 1984 $(".stores_tab").addClass("active").siblings().removeClass("active"); 1985 } else { 1986 $(".prices_tab").addClass("active").siblings().removeClass("active"); 1987 if ($(".prices_tab .opener").length && !$(".prices_tab .opener .opened").length) { 1988 var item = $(".prices_tab .opener").first(); 1989 item.find(".opener_icon").addClass("opened"); 1990 item.parents("tr").addClass("nb"); 1991 item.parents("tr").next(".offer_stores").find(".stores_block_wrap").slideDown(200); 1992 } 1993 } 1994 $("html,body").animate({ scrollTop: topPos - 80 }, 150); 1995 } 1996} 1997 1998$.fn.jqmEx = function (onLoad, onHide) { 1999 $(this).each(function () { 2000 let $this = $(this); 2001 let name = $this.data("name"); 2002 name = typeof name === "undefined" || !name.length ? "noname" : name; 2003 2004 let paramsStr = ""; 2005 let trigger = $this; 2006 2007 // trigger attrs and params 2008 $.each($this.get(0).attributes, function (index, attr) { 2009 var attrName = attr.nodeName; 2010 var attrValue = $this.attr(attrName);
2011 if (/^data\-param\-(.+)$/.test(attrName)) { 2012 var key = attrName.match(/^data\-param\-(.+)$/)[1]; 2013 paramsStr += key + "=" + attrValue + "&"; 2014 } 2015 }); 2016 2017 // one click buy with sale 2018 if ( 2019 name == "ocb" && 2020 arAsproOptions.MODULES.sale 2021 ) { 2022 let $buyAction = $this.closest('.buy_block').find('.js-item-action[data-action="basket"]'); 2023 if ($buyAction.length) { 2024 let action = JItemAction.factory($buyAction[0]); 2025 if (action.valid) { 2026 let dataItem = action.data; 2027 if (dataItem) { 2028 paramsStr += 'ELEMENT_ID=' + dataItem.ID + '&'; 2029 paramsStr += 'IBLOCK_ID=' + dataItem.IBLOCK_ID + '&'; 2030 paramsStr += 'ELEMENT_QUANTITY=' + action.quantity + '&'; 2031 } 2032 2033 let props = action.node.getAttribute('data-props') || ''; 2034 try { 2035 props = props.length ? props.split(';') : []; 2036 } 2037 catch(e) { 2038 props = []; 2039 } 2040 2041 paramsStr += 'OFFER_PROPS=' + JSON.stringify(props) + '&'; 2042 } 2043 } 2044 } 2045 2046 // popup url 2047 let script = arAsproOptions["SITE_DIR"] + "ajax/form.php"; 2048 if (name == "auth") { 2049 script += "?" + paramsStr + "auth=Y"; 2050 } else { 2051 script += "?" + paramsStr; 2052 } 2053 2054 // ext frame class 2055 let extClass = ""; 2056 if ($this.closest("#fast_view_item").length) { 2057 extClass = "fast_view_popup"; 2058 } 2059 2060 // use overlay? 2061 var noOverlay = $this.data("noOverlay") == "Y"; 2062 2063 // call counter 2064 if (typeof $.fn.jqmEx.counter === "undefined") { 2065 $.fn.jqmEx.counter = 0; 2066 } else { 2067 ++$.fn.jqmEx.counter; 2068 } 2069 2070 // unique frame to each trigger 2071 if (noOverlay) { 2072 var frame = $( 2073 '<div class="' + 2074 name + 2075 "_frame " + 2076 extClass + 2077 ' jqmWindow popup" data-popup="' + 2078 $.fn.jqmEx.counter + 2079 '"></div>' 2080 ).appendTo("body"); 2081 } else { 2082 var frame = $( 2083 '<div class="' + 2084 name + 2085 "_frame " + 2086 extClass + 2087 ' jqmWindow popup" data-popup="' + 2088 $.fn.jqmEx.counter + 2089 '"></div>' 2090 ).appendTo("#popup_iframe_wrapper"); 2091 } 2092 2093 frame.jqm({ 2094 ajax: script, 2095 trigger: trigger, 2096 noOverlay: noOverlay, 2097 onLoad: function (hash) { 2098 onLoadjqm(name, hash, $this); 2099 2100 if (typeof onLoad === 'function') { 2101 onLoad(name, hash, $this); 2102 } 2103 }, 2104 onHide: function (hash) { 2105 onHidejqm(name, hash, $this); 2106 2107 if (typeof onHide === 'function') { 2108 onHide(name, hash, $this); 2109 } 2110 }, 2111 }); 2112 }); 2113}; 2114 2115InitOwlSlider = function () { 2116 $(".owl-carousel:not(.owl-loaded):not(.appear-block)").each(function () { 2117 var slider = $(this); 2118 var options; 2119 var svg = 2120 '<svg width="7" height="12" viewBox="0 0 7 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6 1L1 6L6 11" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>'; 2121 var defaults = { 2122 navText: [ 2123 '<i class="owl-carousel__button owl-carousel__button--left colored_theme_bg_hover">' + svg + "</i>", 2124 '<i class="owl-carousel__button owl-carousel__button--right colored_theme_bg_hover">' + svg + "</i>", 2125 ], 2126 dotsContainer: slider.siblings(".owl-carousel__dots"), 2127 }; 2128 var config = $.extend({}, defaults, options, slider.data("plugin-options")); 2129 2130 slider.siblings(".owl-carousel__dots").on("click", ".owl-carousel__dot", function () { 2131 var _this = $(this); 2132 var sliderData = slider.data("owl.carousel"); 2133 2134 slider.trigger("to.owl.carousel", [_this.index(), 300]); 2135 if (sliderData.settings.autoplayHoverPause) { 2136 slider.trigger("mouseover.owl.autoplay"); 2137 } 2138 }); 2139 2140 if (slider.hasClass("destroyed")) { 2141 slider.owlCarousel(config); 2142 slider.removeClass("destroyed"); 2143 return; 2144 } 2145 2146 slider.on("initialized.owl.carousel", function (event) { 2147 var eventdata = { slider: $(event.target), data: event }; 2148 2149 BX.onCustomEvent("onSliderInitialized", [eventdata]); 2150 BX.onCustomEvent("onSlide", [eventdata]); 2151 2152 $(event.target).removeClass("loading-state"); 2153 $(event.target).find(".owl-item:first").addClass("current"); 2154 2155 if (typeof sliceItemBlockSlide === "function") { 2156 sliceItemBlockSlide(); 2157 } 2158 }); 2159 2160 // if slider was inited on animated scrolling to block, than need rescroll 2161 if ($("body.scrolling-state").length) { 2162 slider.on("initialized.owl.carousel", function (event) { 2163 setTimeout(function () { 2164 scrollToBlock.rescroll(); 2165 }, 100); 2166 }); 2167 } 2168 2169 slider.on("change.owl.carousel", function (event) { 2170 // var eventdata = {slider: $(event.target)}; 2171 // BX.onCustomEvent('onSlide', [eventdata]); 2172 }); 2173 2174 slider.owlCarousel(config); 2175 2176 slider.on("resized.owl.carousel", function (event) { 2177 if (typeof sliceItemBlockSlide === "function") { 2178 sliceItemBlockSlide({ resize: false }); 2179 } 2180 }); 2181 2182 slider.on("mouseover.owl.autoplay", function (event) { 2183 var slider = $(event.target).closest(".owl-carousel"); 2184 var sliderData = slider.data("owl.carousel"); 2185 var dots = slider.siblings(".owl-carousel__dots--autoplay"); 2186 if (typeof sliderData !== "undefined") { 2187 var bNeedStopDotsAnimation = 2188 sliderData.settings.autoplay && sliderData.settings.autoplayHoverPause && dots.length; 2189 if (bNeedStopDotsAnimation) { 2190 var animationBlock = dots.find(".owl-carousel__dot .owl-carousel__dot-pie"); 2191 if (animationBlock.length) { 2192 animationBlock.css("animation-play-state", "paused"); 2193 } 2194 } 2195 } 2196 }); 2197 2198 slider.on("mouseleave.owl.autoplay", function (event) { 2199 var slider = $(event.target).closest(".owl-carousel"); 2200 var sliderData = slider.data("owl.carousel"); 2201 var dots = slider.siblings(".owl-carousel__dots--autoplay"); 2202 if (typeof sliderData !== "undefined") { 2203 var bNeedStopDotsAnimation = 2204 sliderData.settings.autoplay && sliderData.settings.autoplayHoverPause && dots.length; 2205 var rotating = sliderData._states.current.rotating; 2206 if (bNeedStopDotsAnimation && rotating) { 2207 var animationBlock = dots.find(".owl-carousel__dot .owl-carousel__dot-pie"); 2208 if (animationBlock.length) { 2209 animationBlock.css("animation-play-state", ""); 2210 } 2211 } 2212 } 2213 }); 2214 2215 slider.on("stop.owl.autoplay", function (event) { 2216 var slider = $(event.target); 2217 var sliderData = slider.data("owl.carousel"); 2218 var dots = slider.siblings(".owl-carousel__dots--autoplay"); 2219 if (typeof sliderData !== "undefined") { 2220 var bNeedStopDotsAnimation = 2221 sliderData.settings.autoplay && sliderData.settings.autoplayHoverPause && dots.length; 2222 if (bNeedStopDotsAnimation) { 2223 var animationBlock = dots.find(".owl-carousel__dot .owl-carousel__dot-pie"); 2224 if (animationBlock.length) { 2225 dots.find(".owl-carousel__dot.active").addClass("reset-animation"); 2226 animationBlock.css("animation-play-state", "paused"); 2227 } 2228 } 2229 } 2230 }); 2231 2232 slider.on("play.owl.autoplay", function (event) { 2233 var slider = $(event.target); 2234 var sliderData = slider.data("owl.carousel"); 2235 var dots = slider.siblings(".owl-carousel__dots--autoplay"); 2236 if (typeof sliderData !== "undefined") { 2237 var bNeedStopDotsAnimation = 2238 sliderData.settings.autoplay && sliderData.settings.autoplayHoverPause && dots.length; 2239 dots.find(".owl-carousel__dot.reset-animation").removeClass("reset-animation"); 2240 if (bNeedStopDotsAnimation && !slider.is(":hover") && !dots.is(":hover")) { 2241 var animationBlock = dots.find(".owl-carousel__dot .owl-carousel__dot-pie"); 2242 if (animationBlock.length) { 2243 animationBlock.css("animation-play-state", ""); 2244 } 2245 } 2246 } 2247 }); 2248 2249 slider.on("touchstart.owl.core", function (event) { 2250 slider.trigger("stop.owl.autoplay"); 2251 }); 2252 2253 slider.siblings(".owl-carousel__dots--autoplay").on("mouseover", function (event) { 2254 var sliderData = slider.data("owl.carousel"); 2255 if (sliderData.settings.autoplayHoverPause) { 2256 slider.trigger("mouseover.owl.autoplay"); 2257 } 2258 }); 2259 2260 slider.on("changed.owl.carousel", function (event) { 2261 var $slider = $(event.target); 2262 var sliderData = $slider.data("owl.carousel"); 2263 var pluginOptions = $slider.data("pluginOptions"); 2264 2265 var eventdata = { slider: $slider, data: event }; 2266 BX.onCustomEvent("onSlide", [eventdata]); 2267 2268 if (pluginOptions) { 2269 // click .ajax_load_btn 2270 if ($slider.parent().find(".ajax_load_btn").length) { 2271 if (sliderData._current + 1 + sliderData.settings.items >= sliderData._items.length) { 2272 $slider.parent().find(".ajax_load_btn").trigger("click"); 2273 } 2274 } 2275 if (typeofExt(pluginOptions) === "object") { 2276 if ("index" in pluginOptions) { 2277 if ($(".gallery-view_switch").length) { 2278 $(".gallery-view_switch__count-wrapper--big .gallery-view_switch__count-value").text( 2279 event.item.index + 1 + "/" + event.item.count 2280 ); 2281 } 2282 } 2283 2284 if ("relatedTo" in pluginOptions) { 2285 var relatedClass = pluginOptions.relatedTo, 2286 relatedBlock = $(relatedClass); 2287 2288 if (relatedBlock.length && sliderData) { 2289 if (!sliderData.loop) { 2290 var current = event.item.index; 2291 } else { 2292 var count = event.item.count - 1; 2293 var current = Math.round(event.item.index - event.item.count / 2 - 0.5); 2294 2295 if (current < 0) current = count; 2296 2297 if (current > count) current = 0; 2298 } 2299 2300 relatedBlock.find(".owl-item").removeClass("current").eq(current).addClass("current"); 2301 2302 var onscreen = relatedBlock.find(".owl-item.active").length - 1; 2303 var start = relatedBlock.find(".owl-item.active").first().index(); 2304 var end = relatedBlock.find(".owl-item.active").last().index(); 2305 2306 if (current > end) relatedBlock.data("owl.carousel").to(current, 100, true); 2307 2308 if (current < start) relatedBlock.data("owl.carousel").to(current - onscreen, 100, true); 2309 // $(".owl-slider-"+id).trigger('to.owl.carousel', [itemCarousel]) 2310 } 2311 } 2312 } 2313 } 2314 }); 2315 2316 slider.on("translated.owl.carousel", function (event) {}); 2317 2318 if ("clickTo" in config) { 2319 var relatedClass = config.clickTo, 2320 magnifier = "magnifier" in config; 2321 2322 slider.on("click", ".owl-item", function (e) { 2323 e.preventDefault(); 2324 var _this = $(this), 2325 number = _this.index(); 2326 2327 if (magnifier) { 2328 if ($(relatedClass).closest(".product-container").find(".zoom_picture").length) { 2329 $(relatedClass) 2330 .closest(".product-container") 2331 .find(".zoom_picture") 2332 .attr("data-large", _this.find(".product-detail-gallery__item").data("big")); 2333 $(relatedClass) 2334 .closest(".product-container") 2335 .find(".zoom_picture") 2336 .attr("xoriginal", _this.find(".product-detail-gallery__item").data("big")); 2337 $(relatedClass) 2338 .closest(".product-container") 2339 .find(".zoom_picture") 2340 .attr("src", _this.find(".product-detail-gallery__item img").attr("src")); 2341 } 2342 _this.siblings("").removeClass("current"); 2343 _this.addClass("current"); 2344 } else { 2345 $(relatedClass).data("owl.carousel").to(number, 300, true); 2346 } 2347 }); 2348 } 2349 }); 2350}; 2351 2352InitFlexSlider = function () { 2353 $(".flexslider:not(.thmb):not(.flexslider-init):not(.appear-block):v
2353isible").each(function () { 2354 var slider = $(this); 2355 var options; 2356 var defaults = { 2357 animationLoop: false, 2358 controlNav: false, 2359 directionNav: true, 2360 animation: "slide", 2361 }; 2362 var config = $.extend({}, defaults, options, slider.data("plugin-options")); 2363 if (typeof config.counts != "undefined" && config.direction !== "vertical") { 2364 var slide_counts = ""; 2365 if (typeof slider.data("plugin-options") != "undefined") { 2366 if ("slide_counts" in slider.data("plugin-options")) slide_counts = slider.data("plugin-options").slide_counts; 2367 } 2368 config.maxItems = getGridSize(config.counts); 2369 config.minItems = getGridSize(config.counts); 2370 2371 if (slide_counts) config.move = slide_counts; 2372 else config.move = getGridSize(config.counts); 2373 2374 config.itemWidth = 200; 2375 } 2376 2377 // custom direction nav 2378 if (typeof config.customDirection != "undefined") config.customDirectionNav = $(config.customDirection); 2379 2380 (config.prevText = BX.message("FANCY_PREV")), //String: Set the text for the "previous" directionNav item 2381 (config.nextText = BX.message("FANCY_NEXT")), 2382 (config.after = config.start = 2383 function (slider) { 2384 var eventdata = { slider: slider }; 2385 BX.onCustomEvent("onSlide", [eventdata]); 2386 }); 2387 2388 config.before = function (slider) { 2389 var eventdata = { slider: slider }; 2390 BX.onCustomEvent("onSlideBefore", [eventdata]); 2391 }; 2392 2393 config.end = function (slider) { 2394 var eventdata = { slider: slider }; 2395 BX.onCustomEvent("onSlideEnd", [eventdata]); 2396 }; 2397 2398 /*if(typeof(config.nav) == 'undefined') 2399 slider.addClass('dark-nav');*/ 2400 slider.flexslider(config).addClass("flexslider-init"); 2401 if (config.controlNav) slider.addClass("flexslider-control-nav"); 2402 if (config.directionNav) slider.addClass("flexslider-direction-nav"); 2403 }); 2404}; 2405 2406InitFlexSliderClass = function (class_name) { 2407 //$('.flexslider:not(.thmb):not(.flexslider-init)').each(function(){ 2408 2409 var slider = $(class_name); 2410 var options; 2411 var defaults = { 2412 animationLoop: false, 2413 controlNav: false, 2414 directionNav: true, 2415 animation: "slide", 2416 }; 2417 var config = $.extend({}, defaults, options, slider.data("plugin-options")); 2418 2419 var slide_counts = ""; 2420 if (typeof slider.data("plugin-options") != "undefined") { 2421 if ("slide_counts" in slider.data("plugin-options")) slide_counts = slider.data("plugin-options").slide_counts; 2422 } 2423 2424 if (typeof config.counts != "undefined" && config.direction !== "vertical") { 2425 config.maxItems = getGridSize(config.counts); 2426 config.minItems = getGridSize(config.counts); 2427 config.move = getGridSize(config.counts); 2428 2429 config.itemWidth = 200; 2430 } 2431 if (slide_counts) config.move = slide_counts; 2432 2433 // custom direction nav 2434 if (typeof config.customDirection != "undefined") config.customDirectionNav = $(config.customDirection); 2435 2436 (config.prevText = BX.message("FANCY_PREV")), //String: Set the text for the "previous" directionNav item 2437 (config.nextText = BX.message("FANCY_NEXT")), 2438 (config.after = config.start = 2439 function (slider) { 2440 var eventdata = { slider: slider }; 2441 BX.onCustomEvent("onSlide", [eventdata]); 2442 }); 2443 2444 config.before = function (slider) { 2445 var eventdata = { slider: slider }; 2446 BX.onCustomEvent("onSlideBefore", [eventdata]); 2447 }; 2448 2449 config.end = function (slider) { 2450 var eventdata = { slider: slider }; 2451 BX.onCustomEvent("onSlideEnd", [eventdata]); 2452 }; 2453 2454 slider.flexslider(config).addClass("flexslider-init"); 2455 if (config.controlNav) slider.addClass("flexslider-control-nav"); 2456 if (config.directionNav) slider.addClass("flexslider-direction-nav"); 2457 //}); 2458}; 2459 2460InitFlexSliderMin = function () { 2461 $(".bxSlider.top-small").on("mousedown", ".slides li", function () { 2462 var index = $(this).data("slide_key"); 2463 $(this).siblings().removeClass("flex-active-slide"); 2464 $(this).addClass("flex-active-slide"); 2465 $(this) 2466 .siblings('[data-slide_key="' + index + '"]') 2467 .addClass("flex-active-slide"); 2468 $(".top-bigs").data("flexslider").flexAnimate(index); 2469 }); 2470}; 2471 2472InitAppear = function() { 2473 // progress bar 2474 $("[data-appear-progress-animation]").iAppear( 2475 function () { 2476 var $this = $(this); 2477
2478 var delay = $this.attr("data-appear-animation-delay") ? $this.attr("data-appear-animation-delay") : 1; 2479 if (delay > 1) $this.css("animation-delay", delay + "ms"); 2480 $this.addClass($this.attr("data-appear-animation")); 2481 2482 setTimeout(function () { 2483 $this.animate( 2484 { 2485 width: $this.attr("data-appear-progress-animation"), 2486 }, 2487 1500, 2488 "easeOutQuad", 2489 function () { 2490 $this.find(".progress-bar-tooltip").animate( 2491 { 2492 opacity: 1, 2493 }, 2494 500, 2495 "easeOutQuad" 2496 ); 2497 } 2498 ); 2499 }, delay); 2500 }, 2501 { 2502 rootMargin: "-50px 0px -50px 0px", 2503 accX: 0, 2504 accY: -50, 2505 } 2506 ); 2507 2508 // portfolio item 2509 $(".item.animated-block").iAppear(function () { 2510 $(this).addClass($(this).data("animation")).addClass("visible"); 2511 }); 2512 2513 // flexslider appear 2514 $(".appear-block").iAppear(function () { 2515 $(this).removeClass("appear-block"); 2516 CheckFlexSlider(); 2517 InitFlexSlider(); 2518 InitOwlSlider(); 2519 initSwiperSlider(); 2520 }); 2521}; 2522 2523SliceHeightBlocks = function () { 2524 $('*[data-slice="Y"]').each(function () { 2525 var slice_els = $(this).find('*[data-slice-block="Y"]'); 2526 if (slice_els.length) { 2527 var slice_params = {}; 2528 if (slice_els.data("slice-params")) slice_params = slice_els.data("slice-params"); 2529 slice_els.sliceHeight(slice_params); 2530 } 2531 }); 2532}; 2533 2534createTableCompare = function (originalTable, appendDiv, cloneTable) { 2535 try { 2536 if ($(".tarifs .head-block:visible").length) { 2537 var clone = originalTable.clone().addClass("clone"); 2538 if (cloneTable.length) { 2539 cloneTable.remove(); 2540 appendDiv.html(""); 2541 appendDiv.html(clone); 2542 } else { 2543 appendDiv.append(clone); 2544 } 2545 } 2546 } catch (e) { 2547 } finally { 2548 } 2549}; 2550 2551InitTopestMenuGummi = function () { 2552 if (!isOnceInited) { 2553 function _init() { 2554 var arItems = $menuTopest.find(".menu-topest__item"); 2555 var cntItems = arItems.length; 2556 if (cntItems) { 2557 var itemsWidth = 0; 2558 for (var i = 0; i < cntItems; ++i) { 2559 var item = arItems.eq(i); 2560 var itemWidth = item.actual("outerWidth", { includeMargin: true }); 2561 2562 arItemsHideWidth[i] = (itemsWidth += itemWidth) + (i == cntItems - 1 ? 0 : moreWidth); 2563 } 2564 } 2565 } 2566 2567 function _gummi() { 2568 var rowWidth = $menuTopest.actual("innerWidth"); 2569 var arItems = $menuTopest.find(".menu-topest__item"); 2570 var cntItems = arItems.length; 2571 var arItemsToRemove = []; 2572 2573 if (cntItems) { 2574 var bMore = false; 2575 var moreItems = []; 2576 for (var i = cntItems - 1; i >= 0; --i) { 2577 var item = arItems.eq(i); 2578 var bInMore = item.parents(".menu-topest__more").length > 0; 2579 if (!bInMore) { 2580 if (arItemsHideWidth[i] > rowWidth + 1) { 2581 if (!bMore) { 2582 bMore = true; 2583 more.removeClass("hidden"); 2584 } 2585 var clone = item.clone(); 2586 clone.find(">a").addClass("dark_font"); 2587 moreItems.push(clone[0]); 2588 arItemsToRemove.push(i); 2589 } else { 2590 break; 2591 } 2592 } 2593 } 2594 $(moreItems).prependTo(moreDropdown); 2595 2596 if (!bMore) { 2597 for (var i = 0; i < cntItems; ++i) { 2598 var item = arItems.eq(i); 2599 var bInMore = item.parents(".menu-topest__more li").length > 0; 2600 if (bInMore) { 2601 if (arItemsHideWidth[i] <= rowWidth) { 2602 if (i === cntItems - 1) { 2603 bMore = false; 2604 more.addClass("hidden"); 2605 } 2606 var clone = item.clone(); 2607 clone.find(">a").removeClass("dark_font"); 2608 clone.insertBefore(more); 2609 item.addClass("cloned"); 2610 } 2611 } 2612 } 2613 } 2614 2615 if (arItemsToRemove.length) { 2616 arItemsToRemove.map(function (elIndex) { 2617 $(arItems[elIndex]).remove(); 2618 }); 2619 } 2620 2621 $menuTopest.find(".menu-topest__item.cloned").remove(); 2622 $menuTopest.closest(".menu-topest__wrapper").addClass("dotted-complete"); 2623 var wrapper = $menuTopest.closest(".hide-dotted"); 2624 if (wrapper.length) { 2625 wrapper.addClass("dotted-complete"); 2626 } 2627 } 2628 } 2629 2630 var $menuTopest = $(".menu-topest"); 2631 if ($menuTopest.length) { 2632 var more = $menuTopest.find(".menu-topest__more"); 2633 var moreDropdown = more.find(">.dropdown"); 2634 var moreWidth = more.actual("outerWidth", { includeMargin: true }); 2635 var arItemsHideWidth = []; 2636 2637 ignoreResize.push(true); 2638 _init(); 2639 _gummi(); 2640 ignoreResize.pop(); 2641 2642 BX.addCustomEvent("onWindowResize", function (eventdata) { 2643 try { 2644 ignoreResize.push(true); 2645 _gummi(); 2646 } catch (e) { 2647 } finally { 2648 ignoreResize.pop(); 2649 } 2650 }); 2651 } 2652 } 2653}; 2654 2655CheckHeaderFixedMenu = function () { 2656 if ( 2657 arAsproOptions["THEME"]["HEADER_FIXED"] == 2 && 2658 $("#headerfixed .js-nav").length && 2659 window.matchMedia("(min-width: 992px)").matches 2660 ) { 2661 $("#headerfixed .js-nav").css("width", "0"); 2662 var all_width = 0, 2663 cont_width = $("#headerfixed .maxwidth-theme").actual("width"), 2664 padding_menu = 2665 $("#headerfixed .logo-row.v2 .menu-block").actual("outerWidth") - 2666 $("#headerfixed .logo-row.v2 .menu-block").actual("width"); 2667 $("#headerfixed .logo-row.v2 > .inner-table-block").each(function () { 2668 if (!$(this).hasClass("menu-block")) all_width += $(this).actual("outerWidth"); 2669 }); 2670 $("#headerfixed .js-nav").width(cont_width - all_width - padding_menu); 2671 } 2672}; 2673 2674/*function CheckTopMenuPadding() { 2675 if ($(".logo_and_menu-row .right-icons .wrap_icon").length && $(".logo_and_menu-row .menu-row").length) { 2676 var menuPosition = $(".menu-row .menu-only").position().left, 2677 maxWidth = $(".logo_and_menu-row .maxwidth-theme").width() - 32, 2678 leftPadding = 0, 2679 rightPadding = 0; 2680 2681 $(".logo_and_menu-row .menu-row>div") 2682 .each(function (indx) { 2683 if (!$(this).hasClass("menu-only")) { 2684 var elementPosition = $(this).position().left, 2685 elementWidth = $(this).outerWidth(); 2686 2687 if (elementPosition > menuPosition) { 2688 rightPadding += elementWidth; 2689 } else { 2690 leftPadding += elementWidth; 2691 } 2692 } 2693 }) 2694 .promise() 2695 .done(function () { 2696 $(".logo_and_menu-row .menu-only").css({ "padding-left": leftPadding, "padding-right": rightPadding + 1 }); 2697 }); 2698 } 2699};*/ 2700 2701/*function CheckTopMenuOncePadding() { 2702 if ($(".menu-row.sliced .right-icons .wrap_icon").length) { 2703 var menuPosition = $(".menu-row .menu-only").position().left, 2704 maxWidth = $(".logo_and_menu-row .maxwidth-theme").width() - 32, 2705 leftPadding = 0, 2706 rightPadding = 0; 2707 2708 $(".menu-row.sliced .maxwidth-theme>div>div") 2709 .each(function (indx) { 2710 if (!$(this).hasClass("menu-only")) { 2711 var elementPosition = $(this).position().left, 2712 elementWidth = $(this).outerWidth(); 2713 2714 if (elementPosition > menuPosition) { 2715 rightPadding += elementWidth; 2716 } else { 2717 leftPadding += elementWidth; 2718 } 2719 } 2720 }) 2721 .promise() 2722 .done(function () { 2723 $(".menu-row.sliced .menu-only").css({ "padding-left": leftPadding, "padding-right": rightPadding + 1 }); 2724 }); 2725 } 2726}; 2727*/ 2728 2729CheckSearchWidth = function () { 2730 if ($(".logo_and_menu-row .search_wrap").length) { 2731 var searchPosition = $(".logo_and_menu-row .search_wrap").position().left, 2732 maxWidth = $(".logo_and_menu-row .maxwidth-theme").width() - 32; 2733 width = 0; 2734 2735 $(".logo_and_menu-row .maxwidth-theme>div") 2736 .each(function () { 2737 if (!$(this).hasClass("search_wrap")) { 2738 var elementWidth = $(this).outerWidth(); 2739 2740 width = width ? width - elementWidth : maxWidth - elementWidth; 2741 } 2742 }) 2743 .promise() 2744 .done(function () { 2745 $(".logo_and_menu-row .search_wrap").outerWidth(width).css({ opacity: 1, visibility: "visible" }); 2746 }); 2747 } 2748}; 2749 2750if (!funcDefined("showItemStoresAmount")) { 2751 var showItemStoresAmount = function() { 2752 let blocks = $('.status-icon.instock .status-amount--stores:not(.status-amount--loaded)'); 2753 if (blocks.length) { 2754 let stores = []; 2755 let ids = []; 2756 2757 for (let i = 0, cnt = blocks.length; i < cnt; ++i) { 2758 $(blocks[i]).addClass('status-amount--loaded'); 2759 2760 var data = $(blocks[i]).data('param-amount'); 2761 if ( 2762 typeof data === 'object' && 2763 data 2764 ) { 2765 ids.push(data.ID); 2766 stores = data.STORES; 2767 } 2768 } 2769 2770 if (ids) { 2771 let data = { 2772 ids: ids, 2773 stores: stores, 2774 }; 2775 2776 $.ajax({ 2777 url: arAsproOptions.SITE_DIR + 'ajax/amount.php', 2778 type: 'POST', 2779 data: data, 2780 dataType: 'json', 2781 success: function(result) { 2782 if ( 2783 typeof result === 'object' && 2784 result && 2785 result.success && 2786 result.amount 2787 ) { 2788 for (let i = 0, cnt = blocks.length; i < cnt; ++i) { 2789 var data = $(blocks[i]).data('param-amount'); 2790 if ( 2791 typeof data === 'object' && 2792 data 2793 ) { 2794 if (result.amount[data.ID]) { 2795 $(blocks[i]).html(result.amount[data.ID]); 2796 } 2797 2798 $(blocks[i]).addClass('status-amount--visible'); 2799 } 2800 } 2801 } 2802 }, 2803 }); 2804 } 2805 } 2806 } 2807} 2808 2809var waitReCaptcha = function (delay, callback) { 2810 if (typeof grecaptcha == "object") { 2811 if (typeof callback == "function") { 2812 callback(); 2813 } 2814 } else { 2815 setTimeout(function () { 2816 waitReCaptcha(delay, callback); 2817 }, delay); 2818 } 2819}; 2820 2821var reCaptchaRender = function (response) { 2822 if ($(".g-recaptcha:not(.rendered)").length) { 2823 waitReCaptcha(50, function () { 2824 $(".g-recaptcha:not(.rendered)").each(function () { 2825 $this = $(this); 2826 $this.addClass("rendered"); 2827 var id = grecaptcha.render($this[0], { 2828 sitekey: $this.attr("data-sitekey"), 2829 theme: $this.attr("data-theme"), 2830 size: $this.attr("data-size"), 2831 callback: $this.attr("data-callback"), 2832 }); 2833 $this.attr("data-widgetid", id); 2834 }); 2835 }); 2836 } 2837}; 2838 2839var reCaptchaVerify = function (response) { 2840 $(".g-recaptcha.rendered").each(function () { 2841 var id = $(this).attr("data-widgetid"); 2842 if (typeof id !== "undefined") { 2843 if (grecaptcha.getResponse(id) != "") { 2844 $(this).closest("form").find(".recaptcha").valid(); 2845 } 2846 } 2847 }); 2848}; 2849 2850var reCaptchaVerifyHidden = function (response) { 2851 $(".g-recaptcha.rendered:last").each(function () { 2852 var id = $(this).attr("data-widgetid"); 2853 if (typeof id !== "undefined" && response) { 2854 if (!$(this).closest("form").find(".g-recaptcha-response").val()) 2855 $(this).closest("form").find(".g-recaptcha-response").val(response); 2856 $(this).closest("form").submit(); 2857 } 2858 }); 2859}; 2860 2861waitYTPlayer = function (delay, callback) { 2862 if (typeof YT !== "undefined" && YT && YT.Player) { 2863 if (typeof callback == "function") callback(); 2864 } else { 2865 setTimeout(function () { 2866 waitYTPlayer(delay, callback); 2867 }, delay); 2868 } 2869}; 2870 2871var scrollToTopAnimateClassIn = false;
2872var scrollToTopAnimateClassOut = false; 2873 2874var $body = {}; 2875var isOnceInited = false; 2876 2877if (navigator.userAgent.indexOf("Edge") != -1) document.documentElement.className += " edge"; 2878 2879initFull = function () { 2880 checkMobileRegion(); 2881}; 2882 2883var isFrameDataReceived = false; 2884if (typeof window.frameCacheVars !== "undefined") { 2885 BX.addCustomEvent(window, "onFrameDataRequestFail", function (response) { 2886 // console.log(response); 2887 }); 2888 2889 BX.addCustomEvent("onFrameDataReceivedBefore", function () { 2890 // stop ya metrika webvisor DOM indexer 2891 pauseYmObserver(); 2892 }); 2893 2894 BX.addCustomEvent("onFrameDataReceived", function (json) { 2895 initFull(); 2896 2897 // resume ya metrika webvisor 2898 // (100ms sliceHeight) + (200ms mCustomScroll) + (100ms lazyload) 2899 setTimeout(resumeYmObserver, 400); 2900 2901 isFrameDataReceived = true; 2902 }); 2903} else { 2904 $(document).ready(initFull); 2905} 2906 2907scrollPreviewBlock = function () { 2908 scrollToBlock($.cookie("scroll_block")); 2909 $.cookie("scroll_block", null); 2910}; 2911 2912checkMobileRegion = function () { 2913 if ($(".confirm_region").length) { 2914 if (!$(".top_mobile_region").length) 2915 $('<div class="top_mobile_region"><div class="confirm_region"></div></div>').insertBefore($(".body")); 2916 $(".top_mobile_region .confirm_region").html($(".regions .confirm_region").html()); 2917 } 2918}; 2919 2920$(document).on("click", ".map-items__item", function () { 2921 var _this = $(this), 2922 itemID = _this.data("id"), 2923 animationTime = 200; 2924 2925 _this.closest(".map-wrapper").find(".index-block__subtitle").addClass("hidden"); 2926 _this.closest(".map-wrapper").find(".index-block__title-wrapper").addClass("hidden"); 2927 _this.closest(".map-wrapper").find(".index-block__preview").addClass("hidden"); 2928 2929 _this.closest(".map-container").find(" > .map-detail-items__item-svg").fadeIn(animationTime); 2930 2931 _this.closest(".map-items").fadeOut(animationTime, function () { 2932 _this.closest(".map-container").find(".map-detail-items").fadeIn(animationTime); 2933 _this 2934 .closest(".map-container") 2935 .find(".map-detail-items .map-detail-items__item[data-id=" + itemID + "]") 2936 .fadeIn(animationTime); 2937 2938 var arCoordinates = _this.data("coordinates").split(","); 2939 2940 if (typeof map === "object" && map !== null && "setCenter" in map) { 2941 if ($(".bx-google-map").length) { 2942 map.setCenter({ lat: +arCoordinates[0], lng: +arCoordinates[1] }); 2943 map.setZoom(17); 2944 } else { 2945 map.setCenter([arCoordinates[0], arCoordinates[1]], 15); 2946 } 2947 } 2948 }); 2949}); 2950 2951$(document).on("click", ".map-detail-items__item-svg", function () { 2952 var _this = $(this).closest(".map-container").find(".map-detail-items__item:visible"), 2953 animationTime = 200; 2954 2955 _this.fadeOut(animationTime); 2956 2957 _this.closest(".map-container").find(" > .map-detail-items__item-svg").fadeOut(10); 2958 2959 _this 2960 .closest(".map-container") 2961 .find(".map-detail-items") 2962 .fadeOut(animationTime, function () { 2963 _this.closest(".map-container").find(".map-items").fadeIn(animationTime); 2964 2965 _this.closest(".map-wrapper").find(".index-block__subtitle").removeClass("hidden"); 2966 _this.closest(".map-wrapper").find(".index-block__title-wrapper").removeClass("hidden"); 2967 _this.closest(".map-wrapper").find(".index-block__preview").removeClass("hidden"); 2968 2969 if (typeof map === "object" && map !== null) { 2970 if (typeof clusterer === "object" && clusterer !== null && "setBounds" in map && "getBounds" in clusterer) { 2971 map.setBounds(clusterer.getBounds(), { 2972 zoomMargin: 40, 2973 // checkZoomRange: true 2974 }); 2975 } else if (typeof bounds === "object" && bounds !== null && "fitBounds" in map && "getCenter" in bounds) { 2976 map.fitBounds(bounds); 2977 } 2978 } 2979 }); 2980}); 2981 2982const CloseMobileSearch = function() { 2983 const $body = document.querySelector('body'); 2984 const $header = document.querySelector('[data-ajax-block="HEADER"]') 2985 const $mobileHeader = document.querySelector("#mobileheader"); 2986 2987 $body.classList.remove('header--mobile-search-active', 'jqm-initied', 'overflow-block'); 2988 $header.classList.remove("filter-none"); 2989 $mobileHeader.classList.remove("filter-none"); 2990} 2991 2992$(document).ready(function () { 2993 (typeof scrollToTop === 'function') && scrollToTop(); 2994 2995 InitScrollBar(); 2996 initCountdown(); 2997 2998 // ripple effect for buttons
2999 $.ripple(".btn:not(.btn--no-rippple)", { 3000 debug: false, // Turn Ripple.js logging on/off 3001 on: "mouseenter", // The event to trigger a ripple effect 3002 opacity: 0.4, // The opacity of the ripple 3003 color: "auto", // Set the background color. If set to "auto", it will use the text color 3004 multi: true, // Allow multiple ripples per element 3005 duration: 0.6, // The duration of the ripple 3006 easing: "linear", // The CSS3 easing function of the ripple 3007 }); 3008 3009 if (!jQuery.browser.safari) { 3010 CheckTopMenuPadding(); 3011 CheckTopMenuOncePadding(); 3012 CheckHeaderFixed(); 3013 CheckTopMenuDotted(); 3014 MegaMenuFixed(); 3015 CheckSearchWidth(); 3016 InitTopestMenuGummi(); 3017 isOnceInited = true; 3018 /* 3019 setTimeout(function () { 3020 $(window).resize(); // need to check resize flexslider & menu 3021 }, 350); 3022 */ 3023 3024 setTimeout(function () { 3025 $(window).scroll(); 3026 }, 250); // need to check position fixed ask block 3027 } else { 3028 setTimeout(function () { 3029 $(window).resize(); // need to check resize flexslider & menu 3030 3031 setTimeout(function () { 3032 CheckTopMenuPadding(); 3033 CheckTopMenuOncePadding(); 3034 CheckHeaderFixed(); 3035 CheckTopMenuDotted(); 3036 MegaMenuFixed(); 3037 CheckSearchWidth(); 3038 InitTopestMenuGummi(); 3039 isOnceInited = true; 3040 3041 setTimeout(function () { 3042 $(window).scroll(); 3043 }, 50); 3044 }, 50); 3045 }, 350); 3046 } 3047 3048 showItemStoresAmount(); 3049 3050 // --- Bind mobile menu --- 3051 var $mobileMenu = $("#mobilemenu"); 3052 if ($mobileMenu.length) { 3053 $mobileMenu.isOpen = $mobileMenu.hasClass("show"); 3054 $mobileMenu.isLeftSide = $("body").hasClass("mmenu_leftside"); 3055 $mobileMenuNlo = $mobileMenu.find("[data-nlo]"); 3056 3057 $(document).on("click", "#mobileheader .burger", function () { 3058 SwipeMobileMenu(); 3059 CloseMobilePhone(); 3060 }); 3061 3062 $(document).on("click", ".mobilemenu__close", function () { 3063 CloseMobileMenu(); 3064 $(".mobilemenu__menu-item").removeClass("mobilemenu__menu-item--expanded"); 3065 }); 3066 3067 $(document).on("click", ".mobilemenu__menu .toggle_block", function (e) { 3068 e.stopPropagation(); 3069 3070 var $this = $(this); 3071 var $item = $this.closest(".mobilemenu__menu-item"); 3072 3073 if ($item.hasClass("mobilemenu__menu-item--parent")) { 3074 e.preventDefault(); 3075 3076 $item.addClass("mobilemenu__menu-item--expanded"); 3077 MoveMobileMenuWrapNext(); 3078 } 3079 }); 3080 3081 $(document).on("click", ".mobilemenu__menu a", function (e) { 3082 var $this = $(this); 3083 var $item = $this.closest(".mobilemenu__menu-item"); 3084 3085 if ($item.hasClass("mobilemenu__menu-item--back")) { 3086 e.preventDefault(); 3087 3088 MoveMobileMenuWrapPrev(); 3089 setTimeout(function () { 3090 $item.closest(".mobilemenu__menu-item--expanded").removeClass("mobilemenu__menu-item--expanded"); 3091 }, 400); 3092 } else { 3093 var href = $this.attr("href"); 3094 if (typeof href !== "undefined") { 3095 if (href.length) { 3096 window.location.href = href; 3097 //window.location.reload(); 3098 } else { 3099 if ($item.hasClass("mobilemenu__menu-item--parent")) { 3100 e.preventDefault(); 3101 3102 $item.addClass("mobilemenu__menu-item--expanded"); 3103 MoveMobileMenuWrapNext(); 3104 3105 return; 3106 } else if ($item.hasClass("mobilemenu__menu-item--title")) { 3107 e.preventDefault(); 3108 3109 return; 3110 } 3111 } 3112 } 3113 3114 CloseMobileMenu(); 3115 } 3116 }); 3117 3118 if ($mobileMenu.isLeftSide) { 3119 $mobileMenu.parent().append('<div class="mobilemenu__overlay"></div>'); 3120 var $mobileMenuOverlay = $(".mobilemenu__overlay"); 3121 3122 $mobileMenuOverlay.click(function () { 3123 if ($mobileMenu.isOpen) { 3124 CloseMobileMenu(); 3125 } 3126 }); 3127 3128 /* $(document).swiperight(function (e) { 3129 if ( 3130 !$(e.target).closest(".owl-carousel").length && 3131 !$(e.target).closest(".swipeignore").length && 3132 !$(e.target).closest(".mobile-scrolled").length 3133 ) { 3134 var partWindowWidth = document.documentElement.clientWidth / 3;
3135 var swipeStart = e.swipestart.coords[0]; 3136 if (swipeStart <= partWindowWidth) { 3137 OpenMobileMenu(); 3138 } 3139 } 3140 }); 3141 3142 $(document).swipeleft(function (e) { 3143 if ( 3144 !$(e.target).closest(".owl-carousel").length && 3145 !$(e.target).closest(".swipeignore").length && 3146 !$(e.target).closest(".mobile-scrolled").length 3147 ) { 3148 CloseMobileMenu(); 3149 } 3150 });*/ 3151 } else { 3152 $(document).on("click", "#mobileheader", function (e) { 3153 if ( 3154 !$(e.target).closest("#mobilemenu").length && 3155 !$(e.target).closest(".burger").length && 3156 $mobileMenu.isOpen 3157 ) { 3158 CloseMobileMenu(); 3159 } 3160 }); 3161 } 3162 3163 OpenMobileMenu = function () { 3164 if (!$mobileMenu.isOpen && window.matchMedia("(max-width: 991px)").matches) { 3165 // hide styleswitcher 3166 if ($(".style-switcher").hasClass("active")) { 3167 $(".style-switcher .switch").trigger("click"); 3168 } 3169 $(".style-switcher .switch").hide(); 3170 $(".style-switcher .switch_presets").hide(); 3171 3172 if ($mobileMenu.isLeftSide) { 3173 setTimeout(function () { 3174 // hide body scroll 3175 $("body").addClass("overflow-block"); 3176 3177 // blur body 3178 $("#mobileheader").addClass("filter-none"); 3179 $("#mobilemenu").addClass("filter-none"); 3180 $("body").addClass("jqm-initied"); 3181 3182 // show overlay 3183 $mobileMenuOverlay.fadeIn("fast"); 3184 }, 100); 3185 } else { 3186 // hide body scroll 3187 $("body").addClass("overflow-block"); 3188 3189 // set menu top = bottom of header 3190 $mobileMenu.css({ 3191 top: +($("#mobileheader")[0].getBoundingClientRect().top + $("#mobileheader").height()) + "px", 3192 }); 3193 3194 // change burger icon 3195 // $('#mobileheader .burger').addClass('c'); 3196 } 3197 3198 // show menu 3199 $mobileMenu.addClass("show"); 3200 $mobileMenu.isOpen = true; 3201 3202 var $inner = $mobileMenu.find(".mobilemenu__inner"); 3203 var params = $inner.data("params"); 3204 if (typeof params === "undefined") { 3205 params = { 3206 depth: 0, 3207 scroll: {}, 3208 height: {}, 3209 }; 3210 } 3211 $inner.data("params", params); 3212 3213 if ($mobileMenuNlo.length) { 3214 if (!$mobileMenuNlo.hasClass("nlo-loadings")) { 3215 $mobileMenuNlo.addClass("nlo-loadings"); 3216 setTimeout(function () { 3217 $.ajax({ 3218 data: { nlo: $mobileMenuNlo.attr("data-nlo") }, 3219 error: function () { 3220 $mobileMenuNlo.removeClass("nlo-loadings"); 3221 }, 3222 complete: function (jqXHR, textStatus) { 3223 if (textStatus === "success" || jqXHR.status == 404) { 3224 var ob = BX.processHTML($.trim(jqXHR.responseText)); 3225 BX.ajax.processScripts(ob.SCRIPT); 3226 $mobileMenuNlo.replaceWith(ob.HTML); 3227 } 3228 }, 3229 }); 3230 }, 300); 3231 } 3232 } 3233 } 3234 }; 3235 3236 CloseMobileMenu = function () { 3237 if ($mobileMenu.isOpen) { 3238 // hide menu 3239 $mobileMenu.removeClass("show"); 3240 $mobileMenu.isOpen = false; 3241 3242 $mobileMenu.find(".mobilemenu__menu-item--expanded").removeClass("mobilemenu__menu-item--expanded"); 3243 3244 // show styleswitcher 3245 $(".style-switcher .switch").show(); 3246 $(".style-switcher .switch_presets").show(); 3247 3248 if ($mobileMenu.isLeftSide) { 3249 setTimeout(function () { 3250 // hide overlay 3251 $mobileMenuOverlay.fadeOut("fast"); 3252 3253 // show body scroll 3254 $("body").removeClass("overflow-block"); 3255 3256 // unblur body 3257 $("body").removeClass("jqm-initied"); 3258 $("#mobilemenu").removeClass("filter-none"); 3259 $("#mobileheader").removeClass("filter-none"); 3260 }, 100); 3261 } else { 3262 // change burger icon 3263 // $('#mobileheader .burger').removeClass('c'); 3264 3265 // show body scroll 3266 $("body").removeClass("overflow-block"); 3267 } 3268 3269 setTimeout(function () { 3270 var $scroller = $mobileMenu.find(".mobilemenu"); 3271 var $inner = $mobileMenu.find(".mobilemenu__inner"); 3272 var params = $inner.data("params"); 3273 params.depth = 0; 3274 $inner.data("params", params).attr("style", ""); 3275 $mobileMenu.scrollTop(0); 3276 $scroller.css("height", ""); 3277 }, 400); 3278 } 3279 }; 3280 3281 SwipeMobileMenu = function () { 3282 if ($mobileMenu.isOpen) { 3283 CloseMobileMenu(); 3284 } else { 3285 OpenMobileMenu(); 3286 } 3287 }; 3288 3289 CheckMobileMenu = function () { 3290 if (!window.matchMedia("(max-width: 991px)").matches) { 3291 CloseMobileMenu(); 3292 } 3293 }; 3294 3295 function MoveMobileMenuWrapNext() { 3296 var $scroller = $mobileMenu.find(".mobilemenu"); 3297 var $inner = $mobileMenu.find(".mobilemenu__inner"); 3298 if ($inner.length) { 3299 var params = $inner.data("params"); 3300 var $dropdownNext = $mobileMenu 3301 .find(".mobilemenu__menu-item--expanded>.mobilemenu__menu-dropdown") 3302 .eq(params.depth); 3303 if ($dropdownNext.length) { 3304 // save scroll position 3305 params.scroll[params.depth] = parseInt($mobileMenu.scrollTop()); 3306 3307 // height while move animating 3308 params.height[params.depth + 1] = Math.max( 3309 $dropdownNext.height(), 3310 !params.depth 3311 ? $inner.height() 3312 : $mobileMenu 3313 .find(".mobilemenu__menu-item--expanded>.mobilemenu__menu-dropdown") 3314 .eq(params.depth - 1) 3315 .height() 3316 ); 3317 $scroller.css("height", params.height[params.depth + 1] + "px"); 3318 3319 // inc depth 3320 ++params.depth; 3321 3322 // translateX for move
3323 $inner.css("transform", "translateX(" + -100 * params.depth + "%)"); 3324 3325 // scroll to top 3326 setTimeout(function () { 3327 $mobileMenu.animate({ scrollTop: 0 }, 200); 3328 }, 100); 3329 3330 // height on enimating end 3331 var h = 3332 $dropdownNext.outerHeight(); 3333 setTimeout(function () { 3334 if (h) { 3335 $scroller.css("height", h + "px"); 3336 } else { 3337 $scroller.css("height", ""); 3338 } 3339 }, 200); 3340 } 3341 3342 $inner.data("params", params); 3343 } 3344 } 3345 3346 function MoveMobileMenuWrapPrev() { 3347 var $scroller = $mobileMenu.find(".mobilemenu"); 3348 var $inner = $mobileMenu.find(".mobilemenu__inner"); 3349 if ($inner.length) { 3350 var params = $inner.data("params"); 3351 if (params.depth > 0) { 3352 var $dropdown = $mobileMenu 3353 .find(".mobilemenu__menu-item--expanded>.mobilemenu__menu-dropdown") 3354 .eq(params.depth - 1); 3355 if ($dropdown.length) { 3356 // height while move animating 3357 $scroller.css("height", params.height[params.depth] + "px"); 3358 3359 // dec depth 3360 --params.depth; 3361 3362 // translateX for move 3363 $inner.css("transform", "translateX(" + -100 * params.depth + "%)"); 3364 3365 // restore scroll position 3366 setTimeout(function () { 3367 $mobileMenu.animate({ scrollTop: params.scroll[params.depth] }, 200); 3368 }, 100); 3369 3370 // height on enimating end 3371 var h = !params.depth 3372 ? false 3373 : $mobileMenu 3374 .find(".mobilemenu__menu-item--expanded>.mobilemenu__menu-dropdown") 3375 .eq(params.depth - 1) 3376 .outerHeight(); 3377 setTimeout(function () { 3378 if (h) { 3379 $scroller.css("height", h + "px"); 3380 } else { 3381 $scroller.css("height", ""); 3382 } 3383 }, 200); 3384 } 3385 } 3386 3387 $inner.data("params", params); 3388 } 3389 } 3390 } 3391 // --- END Bind mobile menu --- 3392 3393 // --- Bind mobile phone --- 3394 if ($("#mobilephones").length) { 3395 $(document).on("click", ".mobileheader .phones__inner .icon-block__only-icon", function (e) { 3396 e.stopPropagation(); 3397 SwipeMobilePhone(); 3398 }); 3399 3400 $(document).on("click", ".mobilephones__menu-item a,.mobilephones__close", function (e) { 3401 e.stopPropagation(); 3402 CloseMobilePhone(); 3403 }); 3404 } 3405 3406 SwipeMobilePhone = function () { 3407 if ($("#mobilephones.show").length) { 3408 CloseMobilePhone(); 3409 } else { 3410 OpenMobilePhone(); 3411 } 3412 }; 3413 3414 OpenMobilePhone = function () { 3415 if (!$("#mobilephones.show").length) { 3416 CloseMobileMenu(); 3417 3418 // show overlay 3419 $('<div class="jqmOverlay mobp"></div>').appendTo("body"); 3420 3421 // blur body 3422 $("#mobileheader").addClass("filter-none"); 3423 $("body").addClass("jqm-initied"); 3424 3425 // toggle phones 3426 setTimeout(function () { 3427 $("#mobilephones").slideDown("fast", function () { 3428 $("#mobilephones").addClass("show"); 3429 }); 3430 }, 100); 3431 } 3432 }; 3433 3434 CloseMobilePhone = function () { 3435 if ($("#mobilephones.show").length) { 3436 // toggle phones 3437 setTimeout(function () { 3438 $("#mobilephones").slideUp("fast", function () { 3439 $("#mobilephones").removeClass("show"); 3440 3441 // unblur body 3442 $("body").removeClass("jqm-initied"); 3443 $("#mobileheader").removeClass("filter-none"); 3444 3445 // hide overlay 3446 $(".jqmOverlay.mobp").remove(); 3447 }); 3448 }, 100); 3449 } 3450 }; 3451 3452 checkMobilePhone = function () { 3453 if (!window.matchMedia("(max-width: 991px)").matches) { 3454 CloseMobilePhone(); 3455 } 3456 }; 3457 // --- END Bind mobile phone --- 3458 3459 // change type2 menu for fixed 3460 if ($("#headerfixed .js-nav").length) { 3461 if (arAsproOptions["THEME"]["HEADER_FIXED"] == 2) CheckHeaderFixedMenu(); 3462 3463 setTimeout(function () { 3464 $("#headerfixed .js-nav").addClass("opacity1"); 3465 }, 350); 3466 } 3467 3468 // close search block 3469 $("html, body").on("mousedown", function (e) { 3470 if (typeof e.target.className == "string" && e.target.className.indexOf("adm") < 0) { 3471 e.stopPropagation(); 3472 var search_target = $(e.target).closest(".searche-result"); 3473 if ( 3474 !$(e.target).closest("#mobileheader").length && 3475 !$(e.target).closest("#mobilefilter").length && 3476 !$(e.target).closest(".popup").length && 3477 !$(e.target).hasClass("inline-search-block") && 3478 !$(e.target).hasClass("svg") && 3479 !$(e.target).closest(".searche-result__all").length && 3480 !$(e.target).closest('[data-ajax-block="HEADER"]') && 3481 !search_target.length 3482 ) { 3483 $(".inline-search-block").removeClass("show"); 3484 $(".title-search-result").hide(); 3485 3486 $("body").removeClass("overflow-block"); 3487 } 3488 3489 if (isMobile) { 3490 if (search_target.length) location.href = search_target.attr("href"); 3491 } 3492 3493 var class_name = $(e.target).attr("class"); 3494 if (typeof class_name == "undefined" || class_name.indexOf("tooltip") < 0) 3495 //tooltip link 3496 $(".tooltip-link").tooltip("hide"); 3497 } 3498 }); 3499 $(".inline-search-block") 3500 .find("*") 3501 .on("mousedown", function (e) { 3502 e.stopPropagation(); 3503 }); 3504 3505 $(".filter-action").on("click", function () { 3506 $(this).toggleClass("active"); 3507 $(this).find(".svg").toggleClass("white"); 3508 if ($(".introtext").length) { 3509 var top_pos = $(".filters-wrap").position(); 3510 $(".bx_filter").css({ top: top_pos.top + 40 }); 3511 } 3512 $(".bx_filter").slideToggle(); 3513 }); 3514 3515 // -- scroll after apply option 3516 scrollPreviewBlock(); 3517 3518 $.extend($.validator.messages, { 3519 required: BX.message("JS_REQUIRED"), 3520 email: BX.message("JS_FORMAT"), 3521 equalTo: BX.message("JS_PASSWORD_COPY"), 3522 minlength: BX.message("JS_PASSWORD_LENGTH"), 3523 remote: BX.message("JS_ERROR"),
3524 }); 3525 3526 $.validator.addMethod( 3527 "regexp", 3528 function (value, element, regexp) { 3529 var re = new RegExp(regexp); 3530 return this.optional(element) || re.test(value); 3531 }, 3532 BX.message("JS_FORMAT") 3533 ); 3534 3535 $.validator.addMethod( 3536 "filesize", 3537 function (value, element, param) { 3538 return this.optional(element) || element.files[0].size <= param; 3539 }, 3540 BX.message("JS_FILE_SIZE") 3541 ); 3542 3543 $.validator.addMethod( 3544 "date", 3545 function (value, element, param) { 3546 var status = false; 3547 if (!value || value.length <= 0) { 3548 status = true; 3549 } else { 3550 var re = new RegExp("^([0-9]{2})(.)([0-9]{2})(.)([0-9]{4})$"); 3551 var matches = re.exec(value); 3552 if (matches) { 3553 var composedDate = new Date(matches[5], matches[3] - 1, matches[1]); 3554 status = 3555 composedDate.getMonth() == matches[3] - 1 && 3556 composedDate.getDate() == matches[1] && 3557 composedDate.getFullYear() == matches[5]; 3558 } 3559 } 3560 return status; 3561 }, 3562 BX.message("JS_DATE") 3563 ); 3564 3565 $.validator.addMethod( 3566 "datetime", 3567 function (value, element, param) { 3568 var status = false; 3569 if (!value || value.length <= 0) { 3570 status = true; 3571 } else { 3572 var re = new RegExp("^([0-9]{2})(.)([0-9]{2})(.)([0-9]{4}) ([0-9]{1,2}):([0-9]{1,2})$"); 3573 var matches = re.exec(value); 3574 if (matches) { 3575 var composedDate = new Date(matches[5], matches[3] - 1, matches[1], matches[6], matches[7]); 3576 status = 3577 composedDate.getMonth() == matches[3] - 1 && 3578 composedDate.getDate() == matches[1] && 3579 composedDate.getFullYear() == matches[5] && 3580 composedDate.getHours() == matches[6] && 3581 composedDate.getMinutes() == matches[7]; 3582 } 3583 } 3584 return status; 3585 }, 3586 BX.message("JS_DATETIME") 3587 ); 3588 3589 $.validator.addMethod( 3590 "extension", 3591 function (value, element, param) { 3592 param = typeof param === "string" ? param.replace(/,/g, "|") : "png|jpe?g|gif"; 3593 return this.optional(element) || value.match(new RegExp(".(" + param + ")$", "i")); 3594 }, 3595 BX.message("JS_FILE_EXT") 3596 ); 3597 3598 $.validator.addMethod( 3599 "captcha", 3600 function (value, element, params) { 3601 let sid = $(element).closest("form").find('input[name="captcha_sid"]').val(); 3602 return $.validator.methods.remote.call(this, value, element, { 3603 url: arAsproOptions["SITE_DIR"] + "ajax/check-captcha.php", 3604 type: "post", 3605 data: { 3606 captcha_word: value, 3607 captcha_sid: sid, 3608 }, 3609 }); 3610 }, 3611 BX.message("JS_ERROR") 3612 ); 3613 3614 $.validator.addMethod( 3615 "recaptcha", 3616 function (value, element, param) { 3617 var id = $(element).closest("form").find(".g-recaptcha").attr("data-widgetid"); 3618 if (typeof id !== "undefined") { 3619 return grecaptcha.getResponse(id) != ""; 3620 } else { 3621 return true; 3622 } 3623 }, 3624 BX.message("JS_RECAPTCHA_ERROR") 3625 ); 3626 3627 // reload captcha 3628 $(document).on("click", ".refresh", function (e) { 3629 var captcha = $(this).parents(".captcha-row"); 3630 e.preventDefault(); 3631 $.ajax({ 3632 url: arAsproOptions["SITE_DIR"] + "ajax/captcha.php", 3633 }).done(function (text) { 3634 captcha.find("input[name=captcha_sid],input[name=captcha_code]").val(text); 3635 captcha.find("img").attr("src", "/bitrix/tools/captcha.php?captcha_sid=" + text); 3636 captcha.find("input[name=captcha_word]").val("").removeClass("error"); 3637 captcha.find(".captcha_input").removeClass("error").find(".error").remove(); 3638 }); 3639 }); 3640 3641 $.validator.addClassRules({ 3642 phone: { 3643 regexp: arAsproOptions["THEME"]["VALIDATE_PHONE_MASK"], 3644 }, 3645 confirm_password: { 3646 equalTo: "input.password", 3647 minlength: 6, 3648 }, 3649 password: { 3650 minlength: 6, 3651 }, 3652 inputfile: { 3653 extension: arAsproOptions["THEME"]["VALIDATE_FILE_EXT"], 3654 filesize: 5000000, 3655 }, 3656 datetime: { 3657 datetime: "", 3658 }, 3659 captcha: { 3660 captcha: "", 3661 }, 3662 recaptcha: { 3663 recaptcha: "", 3664 }, 3665 }); 3666 3667 $.validator.setDefaults({ 3668 highlight: function (element) { 3669 $(element).parent().addClass("error"); 3670 }, 3671 unhighlight: function (element) { 3672 $(element).parent().removeClass("error"); 3673 }, 3674 errorPlacement: function(error, element) { 3675 let uploader = element.closest('.uploader'); 3676 if (uploader.length) { 3677 error.insertAfter(uploader); 3678 } 3679 else { 3680 error.insertAfter(element); 3681 } 3682 }, 3683 }); 3684 3685 // expand/hide filter values 3686 $(document).on("click", ".expand_block", function () { 3687 togglePropBlock($(this)); 3688 }); 3689 3690 // popup img list 3691 $(document).on("click", ".fancy-js", function () { 3692 const parent = $(this).closest(".image-list"); 3693 let arItems = []; 3694 let index = 0; 3695 parent.find("[data-big]").each(function () { 3696 let _this = $(this); 3697 let obItem = { 3698 src: _this.data("big"), 3699 opts: { 3700 caption: _this.attr("alt"), 3701 }, 3702 }; 3703 arItems.push(obItem); 3704 }); 3705 index = parent.find(".active").index(); 3706 if (arItems.length) { 3707 if (typeof $.fn.fancybox === "function") { 3708 $.fancybox.open(arItems, { loop: false }, index); 3709 } 3710 } 3711 }); 3712 3713 $(".mobilemenu__menu-item--city a").on("click", function (e) { 3714 e.preventDefault(); 3715 var _this = $(this); 3716 $.removeCookie("current_region"); 3717 3718 if (arAsproOptions["SITE_ADDRESS"].indexOf(",") != "-1") { 3719 var arDomains = arAsproOptions["SITE_ADDRESS"].split(","); 3720 if (arDomains) { 3721 for (var i in arDomains) { 3722 var domain_name = arDomains[i].replace("\n", ""); 3723 domain_name = arDomains[i].replace("'", ""); 3724 $.cookie("current_region", _this.data("id"), { path: "/", domain: domain_name }); 3725 } 3726 } 3727 }
3727 else $.cookie("current_region", _this.data("id"), { path: "/", domain: arAsproOptions["SITE_ADDRESS"] }); 3728 3729 location.href = _this.attr("href"); 3730 }); 3731 3732 InitOwlSlider(); 3733 InitFlexSlider(); 3734 InitFlexSliderMin(); 3735 3736 InitFancyBox(); 3737 InitFancyBoxVideo(); 3738 3739 // for check flexslider bug in composite mode 3740 waitingNotExists(".detail .galery #slider", ".detail .galery #slider .flex-viewport", 1000, function () { 3741 InitOwlSlider(); 3742 InitFlexSlider(); 3743 setTimeout(function () { 3744 $(window).resize(); 3745 }, 350); 3746 }); 3747 3748 // change view type catalog 3749 $(".view-button").on("click", function () { 3750 $(this).siblings().removeClass("cur"); 3751 $(this).addClass("cur"); 3752 }); 3753 3754 // -- escape close popup form 3755 $(document).on("keydown", function (e) { 3756 if (e.keyCode == 27) { 3757 if ($(".jqmWindow.show").length) $(".jqmWindow.show .jqmClose").click(); 3758 if ($(".inline-search-block.fixed.show").length) { 3759 $(".inline-search-block.fixed .inline-search-hide").click(); 3760 setTimeout(function () { 3761 $(".title-search-result").hide(); 3762 }, 0); 3763 } 3764 if ($(".mega-fixed-menu").is(":visible")) { 3765 $(".mega-fixed-menu .mega-fixed-menu__close").click(); 3766 } 3767 } 3768 }); 3769 3770 $(document).on("click", '*[data-event="jqm"]', function (e) { 3771 e.preventDefault(); 3772 e.stopPropagation(); 3773 if (!$(this).hasClass("clicked")) { 3774 $(this).addClass("clicked"); 3775 $(this).jqmEx(); 3776 $(this).trigger("click"); 3777 } 3778 }); 3779 3780 $(".animate-load").on("click", function (e) { 3781 $(this).parent().addClass("loadings"); 3782 }); 3783 3784 BX.addCustomEvent("onCompleteAction", function (eventdata, _this) { 3785 try { 3786 if (eventdata.action === "loadForm") { 3787 $(_this).parent().removeClass("loadings"); 3788 $(_this).removeClass("clicked"); 3789 } else if (eventdata.action === "loadBasket") { 3790 } else if (eventdata.action === "loadRSS") { 3791 } else if (eventdata.action === "jsLoadBlock") { 3792 InitScrollBar(); 3793 } else if (eventdata.action === "ajaxContentLoaded") { 3794 } 3795 } catch (e) { 3796 console.error(e); 3797 } 3798 }); 3799 3800 BX.addCustomEvent(window, "onAjaxSuccess", function (e) { 3801 if (e != "OK") { 3802 InitOwlSlider(); 3803 InitFlexSlider(); 3804 InitFlexSliderMin(); 3805 } 3806 }); 3807 3808 // show print 3809 if (arAsproOptions["THEME"]["PRINT_BUTTON"] == "Y") { 3810 setTimeout(function () { 3811 if ($(".page-top .rss-block.top").length) { 3812 $('<div class="print-link"><i class="svg svg-print"></i></div>').insertBefore( 3813 $(".page-top .rss-block.top .shares-block") 3814 ); 3815 } else if ($(".page-top .rss").length) { 3816 $('<div class="print-link"><i class="svg svg-print"></i></div>').insertAfter($(".page-top .rss")); 3817 } else if ($(".page-top h1").length) 3818 $('<div class="print-link"><i class="svg svg-print"></i></div>').insertBefore($(".page-top h1")); 3819 // else 3820 // $('footer .print-block').html('<div class="print-link"><i class="svg svg-print"><svg id="Print.svg" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path class="cls-1" d="M1553,287h-2v3h-8v-3h-2a2,2,0,0,1-2-2v-5a2,2,0,0,1,2-2h2v-4h8v4h2a2,2,0,0,1,2,2v5A2,2,0,0,1,1553,287Zm-8,1h4v-4h-4v4Zm4-12h-4v2h4v-2Zm4,4h-12v5h2v-3h8v3h2v-5Z" transform="translate(-1539 -274)"/></svg></i></div>'); 3821 }, 150); 3822 } 3823 3824 $(document).on("click", ".print-link", function () { 3825 window.print(); 3826 }); 3827 3828 $(".head-block .item-link").on("click", function () { 3829 var _this = $(this); 3830 _this.siblings().removeClass("active"); 3831 _this.addClass("active"); 3832 }); 3833 3834 //alert(navigator.userAgent); 3835 $("table.table").each(function () { 3836 var _this = $(this), 3837 first_td = _this.find("thead tr th"); 3838 if (!first_td.length) first_td = _this.find("thead tr td"); 3839 if (first_td.length) { 3840 _this.find("tbody tr:not(.nomobile)").each(function (i) { 3841 $(this) 3842 .find("td") 3843 .each(function (i) { 3844 if (typeof first_td[i] !== "undefined") 3845 $('<div class="th-mobile">' + first_td[i].textContent + "</div>").appendTo($(this)); 3846 }); 3847 }); 3848 } 3849 }); 3850 3851 if ($("a.fancybox").length) { 3852 if (typeof $.fn.fancybox == "function") { 3853 $("a.fancybox").fancybox(); 3854 } 3855 } 3856 3857 // flex pagination 3858 $(document).on("mouseenter", ".flex-viewport .item", function () { 3859 $(this).closest(".flexslider").find(".flex-control-nav").toggleClass("noz"); 3860 $(this).closest(".flexslider").find(".flex-control-nav").css("z-index", "0"); 3861 }); 3862 $(document).on("mouseleave", ".flex-viewport .item", function () { 3863 $(this).closest(".flexslider").find(".flex-control-nav").toggleClass("noz"); 3864 $(this).closest(".flexslider").find(".flex-control-nav").css("z-index", "2"); 3865 }); 3866 3867 // ajax more items 3868 $(document).on("click", ".ajax_load_btn", function () { 3869 var url = $(this).closest(".bottom_nav").find(".arrows-pagination__next").attr("href"), 3870 th = $(this).find(".more_text_ajax"), 3871 _this = $(this), 3872 bottom_nav = $(this).closest(".bottom_nav"); 3873 3874 if (!th.hasClass("loadings")) { 3875 th.addClass("loadings"); 3876 3877 var objUrl = parseUrlQuery(), 3878 obData = { AJAX_REQUEST: "Y", ajax_get: "Y", bitrix_include_areas: "N" }; 3879 3880 if ("clear_cache" in objUrl && objUrl.clear_cache == "Y") { 3881 obData.clear_cache = "Y"; 3882 } 3883 3884 //index page 3885 if ($(".body.index").length) { 3886 var class_block = th.closest(".drag-block").data("class").replace("_drag", ""); 3887 class_block = class_block.replace(/\s/g, ""); 3888 obData.BLOCK = class_block; 3889 3890 // get mainblock action file 3891 let $dragBlock = th.closest('.drag-block'); 3892 if ($dragBlock.length) { 3893 $jsParamsBlock = $dragBlock[0].querySelector(".js-request-data"); 3894 if ($jsParamsBlock) { 3895 if ($jsParamsBlock.dataset.action) { 3896 let action = new URL(window.location.origin + url); 3897 url = window.location.origin + $jsParamsBlock.dataset.action + action.search; 3898 } 3899 } 3900 } 3901 } 3902 3903 if (_this.closest(".ajax-pagination-wrapper").length) { 3904 obData.BLOCK = _this.closest(".ajax-pagination-wrapper").data("class"); 3905 } 3906 3907 if ($(".banners-small.front").length) { 3908 obData.MD = $(".banners-small.front").find(".items").data("c
3908olmd"); 3909 obData.SM = $(".banners-small.front").find(".items").data("colsm"); 3910 } 3911 3912 // tabs block 3913 if (_this.closest(".tab-content-block").length) { 3914 var filter = th.closest(".tab-content-block").data("filter"); 3915 obData.GLOBAL_FILTER = filter; 3916 } 3917 3918 $.ajax({ 3919 url: url, 3920 data: BX.ajax.prepareData(obData), 3921 success: function (html) { 3922 var html = html.trim(); 3923 var mobileBottomClicked = bottom_nav.hasClass("mobile_slider"); 3924 var hasMobileBottomNav = $(html).find(".bottom_nav.mobile_slider"); 3925 var bottomNav = hasMobileBottomNav.length ? hasMobileBottomNav : $(html).find(".bottom_nav"); 3926 var bottomNavHtml = bottomNav.html(); 3927 var bottomNavScrollClass = bottomNav.data("scroll-class"); 3928 var hasBottomNav = $(html).find(".ajax_load_btn").length; 3929 3930 var eventdata = { action: "ajaxContentLoaded", content: html }; 3931 3932 if ($(".banners-small.front").length) { 3933 $(".banners-small .items.row").append(html); 3934 $(".bottom_nav").html($(".banners-small .items.row .bottom_nav").html()); 3935 $(".banners-small .items.row .bottom_nav").remove(); 3936 } else if (bottom_nav.data("append") !== undefined && bottom_nav.data("parent") !== undefined) { 3937 var $slider = th.closest(bottom_nav.data("parent")).find(".owl-carousel"); 3938 if ($slider.length) { 3939 var obData = BX.processHTML(html); 3940 html = obData.HTML; 3941 3942 var $slides = $("<div>" + html + "</div>").find(">*"); 3943 $slides.each(function () { 3944 if (!$(this).hasClass("wrap_nav")) { 3945 $slider.trigger("add.owl.carousel", [$(this).wrap("<div></div>").parent().html()]); 3946 } 3947 }); 3948 $slider.trigger("refresh.owl.carousel"); 3949 3950 setTimeout(function () { 3951 BX.ajax.processScripts(obData.SCRIPT); 3952 }, 100); 3953 } else { 3954 var target = html; 3955 if (bottom_nav.data("target") !== undefined) { 3956 target = $(html).find(bottom_nav.data("target")); 3957 } 3958 if (mobileBottomClicked || hasMobileBottomNav.length) { 3959 var mobileSliderNav = th.closest(bottom_nav.data("parent")).find(".bottom_nav.mobile_slider"); 3960 if (mobileSliderNav.length) { 3961 mobileSliderNav.before(target); 3962 } else { 3963 bottom_nav.before(target); 3964 } 3965 } else { 3966 th.closest(bottom_nav.data("parent")).find(bottom_nav.data("append")).append(target); 3967 } 3968 th.closest(bottom_nav.data("parent")) 3969 .find(bottom_nav.data("append")) 3970 .find(".bottom_nav_wrapper") 3971 .remove(); 3972 3973 if (hasBottomNav) { 3974 if (bottomNavScrollClass !== undefined) { 3975 th.closest(bottom_nav.data("parent")).find(bottomNavScrollClass).addClass("has-bottom-nav"); 3976 } 3977 th.closest(bottom_nav.data("parent")).find(bottom_nav.data("append")).addClass("has-bottom-nav"); 3978 } else { 3979 if (bottomNavScrollClass !== undefined) { 3980 th.closest(bottom_nav.data("parent")).find(bottomNavScrollClass).removeClass("has-bottom-nav"); 3981 } 3982 th.closest(bottom_nav.data("parent")).find(bottom_nav.data("append")).removeClass("has-bottom-nav"); 3983 } 3984 } 3985 3986 bottom_nav = th.closest(bottom_nav.data("parent")).find(".bottom_nav"); 3987 bottom_nav.html(bottomNavHtml); 3988 var icon = bottom_nav.find(".svg-inline-bottom_nav-icon"); 3989 icon.css("display", ""); 3990 3991 eventdata.container = th.closest(bottom_nav.data("parent")); 3992 } else { 3993 $(html).insertBefore($(".blog .bottom_nav")); 3994 $(".bottom_nav").html($(".blog .bottom_nav:hidden").html()); 3995 $(".blog .bottom_nav:hidden").remove(); 3996 } 3997 3998 setTimeout(function () { 3999 BX.onCustomEvent("onCompleteAction", [eventdata, th[0]]); 4000 $(".banners-small .item.normal-block").sliceHeight(); 4001 th.removeClass("loading"); 4002 }, 100); 4003 }, 4004 }); 4005 } 4006 }); 4007 4008 // bug fix in ff 4009 $("img").removeAttr("draggable"); 4010 4011 // Responsive Menu Events 4012 var addActiveClass = false;
4013 $("#mainMenu li.dropdown > a > i, #mainMenu li.dropdown-submenu > a > i").on("click", function (e) { 4014 e.preventDefault(); 4015 if ($(window).width() > 979) return; 4016 addActiveClass = $(this).closest("li").hasClass("resp-active"); 4017 // $('#mainMenu').find('.resp-active').removeClass('resp-active'); 4018 if (!addActiveClass) { 4019 $(this).closest("li").addClass("resp-active"); 4020 } else { 4021 $(this).closest("li").removeClass("resp-active"); 4022 } 4023 }); 4024 4025 // animate increment 4026 if ($(".spincrement").length) { 4027 $(".spincrement").counterUp({ 4028 delay: 80, 4029 time: 1000, 4030 }); 4031 } 4032 4033 // form rating 4034 $(document).on("mouseenter", ".form .votes_block.with-text .item-rating", function () { 4035 var $this = $(this), 4036 index = $this.index(), 4037 ratingMessage = $this.data("message"); 4038 4039 $(this).addClass("rating__star-svg--filled"); 4040 $this.siblings().each(function () { 4041 if ($(this).index() <= index) $(this).addClass("rating__star-svg--filled"); 4042 else $(this).removeClass("rating__star-svg--filled"); 4043 }); 4044 $this.closest(".votes_block").find(".rating_message").text(ratingMessage); 4045 }); 4046 4047 $(document).on("mouseleave", ".form .votes_block.with-text", function () { 4048 var $this = $(this), 4049 index = $this.data("rating"), 4050 ratingMessage = $this.closest(".votes_block").find(".rating_message").data("message"); 4051 4052 $this.find(".item-rating").each(function () { 4053 if ($(this).index() < index && index !== undefined) $(this).addClass("rating__star-svg--filled"); 4054 else $(this).removeClass("rating__star-svg--filled"); 4055 }); 4056 $this.closest(".votes_block").find(".rating_message").text(ratingMessage); 4057 }); 4058 4059 $(document).on("click", ".form .votes_block.with-text .item-rating", function () { 4060 var $this = $(this), 4061 rating = $this.closest(".votes_block").data("rating"), 4062 index = $this.index() + 1, 4063 ratingMessage = $this.data("message"); 4064 4065 $this.closest(".votes_block").data("rating", index); 4066 if ($this.closest(".form-group").find("input[name=RATING]").length) { 4067 $this.closest(".form-group").find("input[name=RATING]").val(index); 4068 } else { 4069 $this.closest(".form-group").find("input[data-sid=RATING]").val(index); 4070 } 4071 $this.closest(".votes_block").find(".rating_message").data("message", ratingMessage); 4072 $this.closest(".form").find(".error").remove(); 4073 }); 4074 4075 $(document).on('paste, change, keyup', '.form.blog-comment-fields input[required]', function () { 4076 let value = $(this).val(); 4077 4078 if (value.length) { 4079 $(this).closest('.form-group').find('label.error').remove(); 4080 } 4081 }); 4082 4083 $(".toggle .more_items").on("click", function () { 4084 $(this).closest(".toggle").find(".collapsed").fadeToggle(); 4085 $(this).remove(); 4086 if (typeof $(this).data("resize") !== "undefined" && $(this).data("resize")) $(window).resize(); 4087 }); 4088 $(".toggle_menu .more_items").on("click", function () { 4089 $(this).closest(".toggle_menu").find(".collapsed").addClass("clicked_exp"); 4090 $(this).remove(); 4091 }); 4092 4093 // search sync 4094 $(document).on("keyup", ".search-input-div input", function (e) { 4095 var inputValue = $(this).val(); 4096 $(".search-input-div input").val(inputValue); 4097 4098 if ($(this).closest("#headerfixed").length) { 4099 if (e.keyCode == 13) $(".search form").submit(); 4100 } 4101 }); 4102 $(document).on("click", ".search-button-div button", function (e) { 4103 if ($(this).closest("#headerfixed").length) $(".search form").submit(); 4104 }); 4105 4106 $(document).on("click", ".header-search__mobile, .bottom-icons-panel__content-link--search", function (e) { 4107 const $body = document.querySelector('body'); 4108 const $header = document.querySelector('[data-ajax-block="HEADER"]') 4109 const $mobileHeader = document.querySelector("#mobileheader"); 4110 4111 if ($body.classList.contains('jqm-initied')) { 4112 CloseMobilePhone(); 4113 CloseMobileMenu(); 4114 4115 setTimeout(function() { 4116 $body.classList.add('header--mobile-search-active', 'jqm-initied', 'overflow-block'); 4117 $header.classList.add("filter-none"); 4118 $mobileHeader.classList.add("filter-none"); 4119 if(!$("body>.jqmOverlay.mobp").length){ 4120 $('<div class="jqmOverlay mobp"></div>').appendTo("body"); 4121 } 4122 }, 400); 4123 } else { 4124 $body.classList.add('header--mobile-search-active', 'jqm-initied', 'overflow-block'); 4125 $header.classList.add("filter-none"); 4126 $mobileHeader.classList.add("filter-none"); 4127 $('<div class="jqmOverlay mobp"></div>').appendTo("body"); 4128 } 4129 4130 // document.querySelector('body').classList.add('header--mobile-search-active'); 4131 // setTimeout(function() { 4132 // if (!document.querySelector('.jqmOverlay.mobp')) { 4133 // $('<div class="jqmOverlay mobp"></div>').appendTo("body"); 4134 // // $("#mobileheader").addClass("filter-none"); 4135 // // $("body").addClass("jqm-initied"); 4136 // } 4137 // }, 400) 4138 // const $bannerTopHeader = document.querySelector('.banner.TOP_HEADER'); 4139 // if($bannerTopHeader){ 4140 // document.querySelector('[data-ajax-block="HEADER"]').style.top = $bannerTopHeader.clientHeight + 'px'; 4141 // } 4142 }); 4143 4144 $(document).on("click", ".search-input-close", function (e) { 4145 HideOverlay(); 4146 }); 4147 4148 $(document).on("click", ".jqmOverlay.mobp", function (e) { 4149 HideOverlay(); 4150 }); 4151 4152 if ($(".styled-block .row > div.col-md-3").length) { 4153 BX.addCustomEvent("onWindowResize", function (eventdata) {
4154 try { 4155 ignoreResize.push(true); 4156 $(".styled-block .row > div.col-md-3").each(function () { 4157 $(this).css({ height: "", "line-height": "" }); 4158 var z = parseInt($(".body_media").css("top")); 4159 if (z > 0) { 4160 var rowHeight = $(this).parents(".row").first().actual("outerHeight"); 4161 $(this).css({ height: rowHeight + "px", "line-height": rowHeight + "px" }); 4162 } 4163 }); 4164 } catch (e) { 4165 } finally { 4166 ignoreResize.pop(); 4167 } 4168 }); 4169 } 4170 4171 if ($(".order-block").length) { 4172 BX.addCustomEvent("onWindowResize", function (eventdata) { 4173 try { 4174 ignoreResize.push(true); 4175 $(".order-block").each(function () { 4176 var cols = $(this).find(".row > div"); 4177 if (cols.length) { 4178 var colFirst = cols.first(); 4179 var colLast = cols.last(); 4180 var colText = colFirst.find(".text"); 4181 var bText = colText.length; 4182 var bOnlyText = cols.length === 1 && bText; 4183 var bPrice = colFirst.find(".price").length; 4184 var z = parseInt($(".body_media").css("top")); 4185 4186 cols.css({ height: "", "padding-top": "", "padding-bottom": "" }); 4187 colText.css({ height: "", "padding-top": "", "padding-bottom": "" }); 4188 if ((!bPrice && z > 0) || (bPrice && z > 1)) { 4189 var minHeight = 83; 4190 4191 if (!bOnlyText) { 4192 var colLast_height = colLast.outerHeight(); 4193 colLast_height = colLast_height >= minHeight ? colLast_height : minHeight; 4194 } 4195 4196 if (bText) { 4197 var colFirst_height = colFirst.outerHeight(); 4198 colFirst_height = colFirst_height >= minHeight ? colFirst_height : minHeight; 4199 } 4200 4201 var colMax_height = bText 4202 ? !bOnlyText 4203 ? colLast_height >= colFirst_height 4204 ? colLast_height 4205 : colFirst_height 4206 : colLast_height 4207 : colFirst_height; 4208 4209 if (!bOnlyText) { 4210 var textPadding = 41 + (colMax_height - colFirst.outerHeight()) / 2; 4211 colLast.find(".btns").css({ 4212 "padding-top": textPadding + "px", 4213 "padding-bottom": textPadding + "px", 4214 height: colMax_height + "px", 4215 }); 4216 } 4217 if (bText) { 4218 colLast.css({ height: colMax_height + "px" }); 4219 var textPadding = 41 + (colMax_height - colText.outerHeight()) / 2; 4220 colText.css({ 4221 "padding-top": textPadding + "px", 4222 "padding-bottom": textPadding + "px", 4223 height: colMax_height + "px", 4224 }); 4225 } 4226 } 4227 } 4228 }); 4229 } catch (e) { 4230 } finally { 4231 ignoreResize.pop(); 4232 } 4233 }); 4234 } 4235 4236 if ($(".equal-padding").length) { 4237 BX.addCustomEvent("onWindowResize", function (eventdata) { 4238 try { 4239 ignoreResize.push(true); 4240 $(".equal-padding").each(function () { 4241 $(this).find(".text").css({ "padding-top": "0px", "padding-bottom": "0px" }); 4242 var equal_block = $(this).siblings(".equals"), 4243 height = $(this).actual("outerHeight"); 4244 4245 delta = Math.round((equal_block.actual("outerHeight") - height) / 2); 4246 if (delta) 4247 $(this) 4248 .find(".text") 4249 .css({ "padding-top": delta + "px", "padding-bottom": delta + "px" }); 4250 }); 4251 } catch (e) { 4252 } finally { 4253 ignoreResize.pop(); 4254 } 4255 }); 4256 } 4257 4258 $(document).on("click", ".mega-menu .dropdown-menu", function (e) { 4259 e.stopPropagation(); 4260 }); 4261 4262 $(document).on("click", ".mega-menu .dropdown-toggle.more-items", function (e) { 4263 e.preventDefault(); 4264 }); 4265 4266 // $(".table-menu .dropdown,.table-menu .dropdown-submenu,.table-menu .dropdown-toggle").on("mouseenter", function () {
4267 // CheckTopVisibleMenu(); 4268 // }); 4269 4270 $(document).on( 4271 "mouseenter", 4272 ".header-menu__wrapper .header-menu__item--dropdown:not(.header-menu__item--wide), .header-menu__wrapper .header-menu__item--dropdown:not(.header-menu__item--wide) .header-menu__dropdown-item.header-menu__dropdown-item--with-dropdown, .header-menu__wrapper .header-menu__item--more-items, .header-menu__wrapper .header-menu__item--more-items .header-menu__dropdown-item--with-dropdown, .header-menu__wrapper .header-menu__item--more-items .header-menu__item--dropdown.header-menu__item--wide, .header-menu__wrapper .header-menu__item--more-items .header-menu__item--dropdown.header-menu__item--wide .header-menu__dropdown-item--with-dropdown, .header-menu__wrapper .header-menu__item--more-items .header-menu__item--dropdown.header-menu__item--wide .header-menu__dropdown-item--with-dropdown .header-menu__wide-submenu-item--with-dropdown", 4273 function (e) { 4274 CheckTopVisibleMenu($(e.currentTarget)); 4275 } 4276 ); 4277 4278 $(document).on( 4279 "mouseenter", 4280 ".header-menu__item--wide, .header-menu__item--wide .header-menu__dropdown-menu", 4281 function () { 4282 var bannerMenu = $(this).find(".side_banners .owl-carousel-hover"); 4283 if (bannerMenu.length) { 4284 bannerMenu.removeClass("owl-carousel-hover").addClass("owl-carousel"); 4285 setTimeout(function () { 4286 InitOwlSlider(); 4287 bannerMenu.removeClass("loading-state"); 4288 }, 1); 4289 } 4290 } 4291 ); 4292 4293 $(document).on("mouseenter", ".menu-side-column__item--wide", function () { 4294 var bannerMenu = $(".bottom-banners .owl-carousel-hover"); 4295 if (bannerMenu.length) { 4296 bannerMenu.removeClass("owl-carousel-hover").addClass("owl-carousel"); 4297 setTimeout(function () { 4298 InitOwlSlider(); 4299 bannerMenu.removeClass("loading-state"); 4300 }, 1); 4301 } 4302 }); 4303 $(".mega-menu .search-item .search-icon, .menu-row #title-search .fa-close").on("click", function (e) { 4304 e.preventDefault(); 4305 $(".menu-row #title-search").toggleClass("hide"); 4306 }); 4307 4308 $(".mega-menu ul.nav .search input").on("keyup", function (e) { 4309 var inputValue = $(this).val(); 4310 $(".menu-row > .search input").val(inputValue); 4311 if (e.keyCode == 13) { 4312 $(".menu-row > .search form").submit(); 4313 } 4314 }); 4315 4316 $(".menu-row > .search input").on("keyup", function (e) { 4317 var inputValue = $(this).val(); 4318 $(".mega-menu ul.nav .search input").val(inputValue); 4319 if (e.keyCode == 13) { 4320 $(".menu-row > .search form").submit(); 4321 } 4322 }); 4323 4324 $(".mega-menu ul.nav .search button").on("click", function (e) { 4325 e.preventDefault(); 4326 var inputValue = $(this).parents(".search").find("input").val(); 4327 $(".menu-and-search .search input").val(inputValue); 4328 $(".menu-row > .search form").submit(); 4329 }); 4330 4331 $(".filter .calendar").on("click", function () { 4332 var button = $(this).next(); 4333 if (button.hasClass("calendar-icon")) { 4334 button.trigger("click"); 4335 } 4336 }); 4337 4338 // sliceheights 4339 if ($(".banners-small .item.normal-block").length) $(".banners-small .item.normal-block").sliceHeight(); 4340 if ($(".teasers .item").length) $(".teasers .item").sliceHeight(); 4341 if ($(".wrap-portfolio-front .row.items > div").length) 4342 $(".wrap-portfolio-front .row.items > div").sliceHeight({ row: ".row.items", item: ".item1" }); 4343 4344 SliceHeightBlocks(); 4345 4346 // toggle 4347 var $this = this, 4348 previewParClosedHeight = 25; 4349 4350 $("section.toggle > label").prepend($("<i />").addClass("fa fa-plus")); 4351 $("section.toggle > label").prepend($("<i />").addClass("fa fa-minus")); 4352 $("section.toggle.active > p").addClass("preview-active"); 4353 $("section.toggle.active > div.toggle-content").slideDown(350, function () {}); 4354 4355 $("section.toggle > label").click(function (e) { 4356 var parentSection = $(this).parent(), 4357 parentWrapper = $(this).parents("div.toogle"), 4358 previewPar = false, 4359 isAccordion = parentWrapper.hasClass("toogle-accordion"); 4360 4361 if (isAccordion && typeof e.originalEvent != "undefined") { 4362 parentWrapper.find("section.toggle.active > label").trigger("click"); 4363 } 4364 4365 parentSection.toggleClass("active"); 4366 4367 // Preview Paragraph 4368 if (parentSection.find("> p").get(0)) { 4369 previewPar = parentSection.find("> p"); 4370 var previewParCurrentHeight = previewPar.css("height"); 4371 previewPar.css("height", "auto"); 4372 var previewParAnimateHeight = previewPar.css("height"); 4373 previewPar.css("height", previewParCurrentHeight); 4374 } 4375 4376 // Content 4377 var toggleContent = parentSection.find("> div.toggle-content"); 4378 4379 if (parentSection.hasClass("active")) { 4380 $(previewPar).animate( 4381 { 4382 height: previewParAnimateHeight, 4383 }, 4384 350, 4385 function () { 4386 $(this).addClass("preview-active"); 4387 } 4388 ); 4389 toggleContent.slideDown(350, function () {}); 4390 } else { 4391 $(previewPar).animate( 4392 { 4393 height: previewParClosedHeight, 4394 }, 4395 350, 4396 function () { 4397 $(this).removeClass("preview-active"); 4398 } 4399 ); 4400 toggleContent.slideUp(350, function () {}); 4401 } 4402 }); 4403 4404 // accordion 4405 $(".accordion-head").on("click", function (e) { 4406 e.preventDefault(); 4407 if (!$(this).next().hasClass("collapsing")) { 4408 $(this).toggleClass("accordion-open"); 4409 $(this).toggleClass("accordion-close"); 4410 } 4411 }); 4412 4413 InitAppear(); 4414 4415 // js-load-block appear 4416 if ($(".js-load-block").length) { 4417 var objUrl = parseUrlQuery(); 4418 var bClearCache = false;
4419 if ("clear_cache" in objUrl) { 4420 if (objUrl.clear_cache == "Y") { 4421 bClearCache = true; 4422 } 4423 } 4424 4425 var items = []; 4426 var bIdle = true; 4427 var insertNextBlockContent = function () { 4428 if (bIdle) { 4429 if (items.length) { 4430 bIdle = false; 4431 var item = items.pop(); 4432 4433 item.content = $.trim(item.content); 4434 4435 // remove /bitrix/js/main/core/core_window.js if it was loaded already 4436 if (item.content.indexOf("/bitrix/js/main/core/core_window.") !== -1 && BX.WindowManager) { 4437 item.content = item.content.replace( 4438 /<script src="\/bitrix\/js\/main\/core\/core_window\.[^>]*><\/script>/gm, 4439 "" 4440 ); 4441 } 4442 4443 // remove /bitrix/js/currency/core_currency.js if it was loaded already 4444 if ( 4445 item.content.indexOf("/bitrix/js/currency/core_currency.") !== -1 && 4446 typeof BX.Currency === "object" && 4447 BX.Currency.defaultFormat 4448 ) { 4449 item.content = item.content.replace( 4450 /<script src="\/bitrix\/js\/currency\/core_currency\.[^>]*><\/script>/gm, 4451 "" 4452 ); 4453 } 4454 4455 // remove /bitrix/js/main/pageobject/pageobject.js if it was loaded already 4456 if (item.content.indexOf("/bitrix/js/main/pageobject/pageobject.") !== -1 && BX.PageObject) { 4457 item.content = item.content.replace( 4458 /<script src="\/bitrix\/js\/main\/pageobject\/pageobject\.[^>]*><\/script>/gm, 4459 "" 4460 ); 4461 } 4462 4463 // remove /bitrix/js/main/polyfill/promise/js/promise.js if it not need 4464 if ( 4465 item.content.indexOf("/bitrix/js/main/polyfill/promise/js/promise.") !== -1 && 4466 typeof window.Promise !== "undefined" && 4467 window.Promise.toString().indexOf("[native code]") !== -1 4468 ) { 4469 item.content = item.content.replace( 4470 /<script src="\/bitrix\/js\/main\/polyfill\/promise\/js\/promise\.[^>]*><\/script>/gm, 4471 "" 4472 ); 4473 } 4474 4475 var ob = BX.processHTML(item.content); 4476 4477 // stop ya metrika webvisor DOM indexer 4478 pauseYmObserver(); 4479 4480 item.block.removeAttr("data-file").removeClass("loader_circle"); 4481 4482 if (item.block.data("appendTo")) { 4483 item.block.find(item.block.data("appendTo"))[0].innerHTML = ob.HTML; 4484 } else { 4485 if (item.block.find('> div[id*="bx_incl_"]').length) { 4486 item.block.find('> div[id*="bx_incl_"]')[0].innerHTML = ob.HTML; 4487 } else { 4488 item.block[0].innerHTML = ob.HTML; 4489 } 4490 } 4491 4492 BX.ajax.processScripts(ob.SCRIPT); 4493 4494 var eventdata = { action: "jsLoadBlock" }; 4495 BX.onCustomEvent("onCompleteAction", [eventdata, item.block]); 4496 4497 // resume ya metrika webvisor 4498 // 500ms 4499 setTimeout(resumeYmObserver, 500); 4500 4501 bIdle = true; 4502 insertNextBlockContent(); 4503 } 4504 } 4505 }; 4506 4507 $(".js-load-block").iAppear( 4508 function () { 4509 var $this = $(this); 4510 4511 if ($this.data("file")) { 4512 var add_url = bClearCache ? "?clear_cache=Y" : ""; 4513 if ($this.data("block")) { 4514 add_url += (bClearCache ? "&" : "?") + "BLOCK=" + $this.data("block"); 4515 } 4516 4517 // get content 4518 $.get($this.data("file") + add_url).done(function (html) { 4519 items.push({ 4520 block: $this, 4521 content: html, 4522 }); 4523 4524 if (items.length == 1) { 4525 setTimeout(insertNextBlockContent, 100); 4526 } 4527 }); 4528 } 4529 }, 4530 { 4531 rootMargin: isMobile ? "300px 0px 300px 0px" : "150px 0px 150px 0px", 4532 accX: 0, 4533 accY: isMobile ? 300 : 150, 4534 } 4535 ); 4536 } 4537 4538 $("a[rel=tooltip]").tooltip(); 4539 $("span[data-toggle=tooltip]").tooltip(); 4540 4541 $("select.sort").on("change", function () { 4542 location.href = $(this).val(); 4543 }); 4544 4545 setTimeout(function (th) { 4546 $(".catalog.group.list .item").each(function () { 4547 var th = $(this); 4548 if ((tmp = th.find(".image").outerHeight() - th.find(".text_info").outerHeight()) > 0) { 4549 th.find(".text_info .titles").height(th.find(".text_info .titles").outerHeight() + tmp); 4550 } 4551 }); 4552 }, 50); 4553 4554 // ajax tabs 4555 4556 // tabs on front in mobile 4557 $(".items-link-mobile").each(function () { 4558 var _this = $(this), 4559 selectOption = _this.find("option"), 4560 selectOptionLength = selectOption.length, 4561 selectedOption = selectOption.filter(":selected"), 4562 duration = 200; // 4563 4564 _this.hide(); 4565 _this.wrap('<div class="select"></div>'); 4566 $("<div>", { 4567 class: "new-select", 4568 text: _this.children("option:disabled").text(), 4569 }).insertAfter(_this); 4570 4571 var selectHead = _this.next(".new-select"); 4572 $("<div>", { 4573 class: "new-select__list", 4574 }).insertAfter(selectHead); 4575 4576 var selectList = selectHead.next(".new-select__list"); 4577 for (var i = 1; i < selectOptionLength; i++) { 4578 $("<div>", { 4579 class: "new-select__item", 4580 html: $("<span>", { 4581 text: selectOption.eq(i).text(), 4582 }), 4583 }) 4584 .attr("data-value", selectOption.eq(i).val()) 4585 .appendTo(selectList); 4586 } 4587 4588 var selectItem = selectList.find(".new-select__item"); 4589 var selectItemFirst = selectList.find(".new-select__item:first-child"); 4590 selectList.slideUp(); 4591 selectHead.on("click", function () { 4592 if (!$(this).hasClass("on")) { 4593 $(this).addClass("on"); 4594 selectList.slideDown(duration); 4595
4596 selectItemCur = selectList.find(".new-select__item.active"); 4597 4598 if (!selectItem.hasClass("active")) { 4599 selectItemFirst.addClass("active"); 4600 selectItemCur = selectItemFirst; 4601 } 4602 4603 selectItem.on("click", function () { 4604 selectItemCur.removeClass("active"); 4605 var chooseItem = $(this).data("value"); 4606 4607 $("select").val(chooseItem).attr("selected", "selected"); 4608 selectHead.text($(this).find("span").text()); 4609 selectHead.attr("data-value", $(this).attr("data-value")); 4610 $(this).addClass("active"); 4611 var _this = $(this); 4612 selectList.slideUp(150, function () { 4613 selectHead.removeClass("on"); 4614 4615 var index = _this.index(); 4616 var curHeadBlock = _this.closest(".head-block"); 4617 var indexTab = curHeadBlock.find(".items-link .item-link.active"); 4618 var indexActiveTab = indexTab.index(); 4619 4620 if (indexActiveTab != index) { 4621 curHeadBlock.find(".items-link .item-link").eq(index).trigger("click"); 4622 } 4623 }); 4624 }); 4625 } else { 4626 $(this).removeClass("on"); 4627 selectList.slideUp(duration); 4628 } 4629 }); 4630 }); 4631 4632 // gallery in list 4633 $(document).on("mouseenter", ".section-gallery-wrapper .section-gallery-wrapper__item", function () { 4634 const _this = $(this); 4635 const index = _this.index(); 4636 const $nav_items = _this.closest(".image-list-wrapper").find(".section-gallery-nav .section-gallery-nav__item"); 4637 4638 _this.siblings().removeClass("active"); 4639 _this.addClass("active"); 4640 4641 $nav_items.removeClass("active"); 4642 $nav_items.filter(":eq(" + index + ")").addClass("active"); 4643 }); 4644 4645 // return to the first image 4646 $(document).on("mouseleave", ".section-gallery-wrapper", function() { 4647 const _this = $(this); 4648 const $elements = $(this).find('.section-gallery-wrapper__item'); 4649 const $nav_items = _this.closest(".image-list-wrapper").find(".section-gallery-nav .section-gallery-nav__item"); 4650 4651 if ($elements.length) { 4652 $elements.removeClass('active'); 4653 $($elements[0]).addClass('active'); 4654 $nav_items.removeClass('active'); 4655 $($nav_items[0]).addClass('active'); 4656 } 4657 }); 4658 4659 $(document).on("click", ".section-gallery-nav .section-gallery-nav__item", function () { 4660 const _this = $(this); 4661 const index = _this.index(); 4662 const items = _this.closest(".image-list-wrapper").find(".section-gallery-wrapper .section-gallery-wrapper__item"); 4663 4664 _this.siblings().removeClass("active"); 4665 _this.addClass("active"); 4666 4667 items.removeClass("active"); 4668 items.filter(":eq(" + index + ")").addClass("active"); 4669 }); 4670 4671 // item galery 4672 $(".thumbs .item a").on("click", function (e) { 4673 e.preventDefault(); 4674 $(".thumbs .item").removeClass("current"); 4675 $(this).closest(".item").toggleClass("current"); 4676 $(".slides li" + $(this).attr("href")) 4677 .addClass("current") 4678 .siblings() 4679 .removeClass("current"); 4680 }); 4681 4682 $("header.fixed .btn-responsive-nav").on("click", function () { 4683 $("html, body").animate({ scrollTop: 0 }, 400); 4684 }); 4685 4686 $("body").on("click", ".form .refresh-page", function () { 4687 location.href = location.href; 4688 }); 4689 4690 // show props 4691 $(document).on("click", ".show_props", function () { 4692 $(this).prev(".props_list").stop().slideToggle(333); 4693 $(this).find(".char_title").toggleClass("opened"); 4694 }); 4695 4696 // animated labels 4697 $(document) 4698 .on("focus", ".fill-animate input,.fill-animate textarea", function () { 4699 $(this).addClass("input-filed"); 4700 }) 4701 .on("focusout", ".fill-animate input,.fill-animate textarea", function () { 4702 if ("" != $(this).val()) { 4703 $(this).addClass("input-filed"); 4704 } else { 4705 $(this).removeClass("input-filed"); 4706 } 4707 }); 4708 4709 // accordion action 4710 $(".panel-collapse").on("hidden.bs.collapse", function () { 4711 $(this).parent().toggleClass("opened"); 4712 }); 4713 $(".panel-collapse").on("show.bs.collapse", function () { 4714 $(this).parent().toggleClass("opened"); 4715 }); 4716 4717 $(document).on("click", ".reload-page", function () { 4718 location.reload(true); 4719 }); 4720 4721 $("select.region").on("change", function () { 4722 var val = parseInt($(this).val()); 4723 if ($("select.city").length) { 4724 if (val) { 4725 $("select.city").removeAttr("disabled"); 4726 $("select.city option").hide(); 4727 $("select.city option[data-parent_section=" + val + "]").show(); 4728 } else $("select.city").attr("disabled", "disabled"); 4729 } 4730 }); 4731 4732 $("select.city, select.region").on("change", function () { 4733 var _this = $(this), 4734 val = parseInt(_this.val()); 4735 if (_this.hasClass("region")) { 4736 $("select.city option:eq(0)").show(); 4737 $("select.city").val(0); 4738 } 4739 4740 if ((_this.hasClass("region") && !val) || _this.hasClass("city")) { 4741 $.ajax({ 4742 type: "POST", 4743 data: { ID: val }, 4744 }).done(function (html) { 4745 var ob = BX.processHTML(html); 4746 $(".ajax_items")[0].innerHTML = ob.HTML; 4747 BX.ajax.processScripts(ob.SCRIPT); 4748 }); 4749 } 4750 }); 4751 4752 $(document).on("click", ".print", function () { 4753 window.print(); 4754 }); 4755 4756 $(".choise").on("click", function () { 4757 var $this = $(this); 4758 if (typeof $this.data("block") !== "undefined") { 4759 var block = $this.attr("data-block"); 4760
4761 try { 4762 var $block = BX(block) ? $("#" + block) : $(".detail-block." + block); 4763 } catch (e) { 4764 var $block = $(block); 4765 } 4766 4767 if ($block.length) { 4768 if ($block.closest(".tab-pane").length) { 4769 var offset = -206; 4770 if (typeof arAsproOptions !== "undefined") { 4771 offset = window.matchMedia("(max-width:991px)").matches 4772 ? arAsproOptions.THEME.HEADER_MOBILE_FIXED !== "Y" || arAsproOptions.THEME.HEADER_MOBILE_SHOW !== "ALWAYS" 4773 ? -187 + 62 4774 : -187 4775 : arAsproOptions.THEME.TOP_MENU_FIXED !== "Y" 4776 ? -206 + 81 4777 : -206; 4778 } 4779 4780 $block.data("offset", offset); 4781 $('.ordered-block a[href="#' + $block.closest(".tab-pane").attr("id") + '"]').click(); 4782 } 4783 4784 scrollToBlock($block); 4785 } 4786 } 4787 }); 4788 4789 // touch event 4790 document.addEventListener( 4791 "touchend", 4792 function (event) { 4793 if (!$(event.target).closest(".menu-item").length && !$(event.target).hasClass("menu-item")) { 4794 $(".mega-menu .dropdown-menu").css({ display: "none", opacity: 0 }); 4795 $(".menu-item").removeClass("hover"); 4796 } 4797 if (!$(event.target).closest(".menu.topest").length) { 4798 $(".menu.topest").css({ overflow: "hidden" }); 4799 $(".menu.topest > li").removeClass("hover"); 4800 } 4801 if (!$(event.target).closest(".full.has-child").length) { 4802 $(".menu_top_block.catalog_block li").removeClass("hover"); 4803 } 4804 // if(!$(event.target).closest('.basket_block').length){ 4805 // $('.basket_block .link').removeClass('hover'); 4806 // $('.basket_block .basket_popup_wrapp').slideUp(); 4807 // } 4808 // if(!$(event.target).closest('.catalog_item').length){ 4809 // var tabsContentUnhoverHover = $('.tab:visible').attr('data-unhover') * 1; 4810 // $('.tab:visible').stop().animate({'height': tabsContentUnhoverHover}, 100); 4811 // $('.tab:visible').find('.catalog_item').removeClass('hover'); 4812 // $('.tab:visible').find('.catalog_item .buttons_block').stop().fadeOut(233); 4813 // if($('.catalog_block').length){ 4814 // $('.catalog_block').find('.catalog_item_wrapp').removeClass('hover'); 4815 // $('.catalog_block').find('.catalog_item').removeClass('hover'); 4816 // } 4817 // } 4818 }, 4819 false 4820 ); 4821 4822 touchMenu(".mega-menu .menu-item"); 4823 touchTopMenu(".menu.topest li"); 4824}); 4825 4826function touchMenu(selector) { 4827 if (isMobile) { 4828 if ($(selector).length) { 4829 $(selector).each(function () { 4830 var th = $(this); 4831 th.on("touchend", function (e) { 4832 var _th = $(e.target).closest(".menu-item"); 4833 4834 $(".menu.topest > li").removeClass("hover"); 4835 $(".menu_top_block.catalog_block li").removeClass("hover"); 4836 4837 if (_th.find(".dropdown-menu").length && !_th.hasClass("hover")) { 4838 e.preventDefault(); 4839 e.stopPropagation(); 4840 _th.siblings().removeClass("hover"); 4841 _th.addClass("hover"); 4842 $(".menu-row .dropdown-menu").css({ display: "none", opacity: 0 }); 4843 if (_th.hasClass("menu-item")) { 4844 _th.closest(".dropdown-menu").css({ display: "block", opacity: 1 }); 4845 } 4846 if (_th.find("> .wrap > .dropdown-menu")) { 4847 _th.find("> .wrap > .dropdown-menu").css({ display: "block", opacity: 1 }); 4848 } else if (_th.find("> .dropdown-menu")) { 4849 _th.find("> .dropdown-menu").css({ display: "block", opacity: 1 }); 4850 } 4851 CheckTopVisibleMenu(); 4852 } else { 4853 var href = $(e.target).attr("href") ? $(e.target).attr("href") : $(e.target).closest("a").attr("href"); 4854 if (href && href !== "undefined") location.href = href; 4855 } 4856 }); 4857 }); 4858 } 4859 } else { 4860 $(selector).off(); 4861 } 4862} 4863 4864function touchTopMenu(selector) { 4865 if (isMobile) { 4866 if ($(selector).length) { 4867 $(selector).each(function () { 4868 var th = $(this); 4869 th.on("touchend", function (e) { 4870 var _th = $(e.target).closest("li"); 4871 4872 $(".menu-item").removeClass("hover"); 4873 $(".menu-item .dropdown-menu").css({ display: "none", opacity: 0 }); 4874 $(".menu_top_block.catalog_block li").removeClass("hover"); 4875 4876 if (_th.hasClass("more") && !_th.hasClass("hover")) { 4877 e.preventDefault(); 4878 e.stopPropagation(); 4879 _th.siblings().removeClass("hover"); 4880 _th.addClass("hover"); 4881 $(".menu.topest").css({ overflow: "visible" }); 4882 } else { 4883 var href = $(e.target).attr("href") ? $(e.target).attr("href") : $(e.target).closest("a").attr("href"); 4884 if (href && href !== "undefined") location.href = href; 4885 } 4886 }); 4887 }); 4888 } 4889 } else { 4890 $(selector).off(); 4891 } 4892} 4893 4894scrollToBlock = function (block) { 4895 if ($(block).length) { 4896 scrollToBlock.last = block; 4897 4898 if (typeof $(block).data("toggle") !== "undefined") { 4899 $(block).click(); 4900 } 4901 4902 var offset = -81 - 64; 4903 if (typeof $(block).data("offset") !== "undefined") { 4904 offset = $(block).data("offset"); 4905 } else { 4906 if (typeof arAsproOptions !== "undefined") { 4907 offset = window.matchMedia("(max-width:991px)").matches 4908 ? arAsproOptions.THEME.HEADER_MOBILE_FIXED !== "Y" || arAsproOptions.THEME.HEADER_MOBILE_SHOW !== "ALWAYS" 4909 ? -43 4910 : -62 - 43 4911 : arAsproOptions.THEME.TOP_MENU_FIXED !== "Y" 4912 ? -43 4913 : -81 - 43; 4914 4915 if ($(block).hasClass("drag-block")) { 4916 offset += 43; 4917 } 4918 } 4919 } 4920 4921 offset = $(block).offset().top + offset; 4922 4923 $("body").addClass("scrolling-state"); 4924 $("body, html").animate({ scrollTop: offset }, 500); 4925 setTimeout(function () { 4926 $("body").removeClass("scrolling-state"); 4927 }, 500); 4928 } 4929}; 4930 4931scrollToBlock.rescroll = function () { 4932 if (typeof scrollToBlock.last !== "undefined") { 4933 scrollToBlock(scrollToBlock.last); 4934 } 4935}; 4936 4937$(document).on("click", ".counter__action--plus", function () { 4938 //for corporate basket 4939 if ($(this).closest(".counter--basket").length) return; 4940 4941 let $input = $(this).closest(".counter").find(".counter__count"); 4942 let currentValue = $input.val(); 4943 4944 let $buyBlock = $(this).closest(".buy_block"); 4945 let $toCart = $buyBlock.find(".item-action .to_cart"); 4946 4947 let isFloatRatio = $toCart.data("float_ratio"); 4948 let ratio = $toCart.data("ratio"); 4949 ratio = isFloatRatio ? parseFloat(ratio) : parseInt(ratio, 10); 4950 4951 if (isFloatRatio) { 4952 ratio = Math.round(ratio * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / arAsproOptions.JS_ITEM_CLICK.precisionFactor; 4953 } 4954 4955 let newValue = isFloatRatio ? parseFloat(currentValue) : parseInt(currentValue, 10); 4956 newValue += ratio; 4957 4958 if (isFloatRatio) { 4959 newValue = Math.round(newValue * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / arAsproOptions.JS_ITEM_CLICK.precisionFactor; 4960 } 4961 4962 let maxValue = parseFloat($(this).data("max")); 4963 if (parseFloat(maxValue) > 0) { 4964 if ($input.val() < maxValue) { 4965 if (newValue <= maxValue) { 4966 $input.val(newValue); 4967 } 4968 4969 $input.change(); 4970 } 4971 } else { 4972 $input.val(newValue); 4973 $input.change(); 4974 } 4975}); 4976 4977$(document).on("click", ".counter__action--minus", function () { 4978 //for corporate basket 4979 if ($(this).closest(".counter--basket").length) return; 4980 4981 let $input = $(this).closest(".counter").find(".counter__count"); 4982 let currentValue = $input.val(); 4983 4984 let $buyBlock = $(this).closest(".buy_block"); 4985 let $toCart = $buyBlock.find(".item-action .to_cart"); 4986 4987 let isFloatRatio = $toCart.data("float_ratio"); 4988 let ratio = $toCart.data("ratio"); 4989 ratio = isFloatRatio ? parseFloat(ratio) : parseInt(ratio, 10); 4990 4991 if (isFloatRatio) { 4992 ratio = Math.round(ratio * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / arAsproOptions.JS_ITEM_CLICK.precisionFactor; 4993 } 4994 4995 let newValue = isFloatRatio ? parseFloat(currentValue) : parseInt(currentValue, 10); 4996 newValue -= ratio; 4997 4998 if (isFloatRatio) { 4999 newValue = Math.round(newValue * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / arAsproOptions.JS_ITEM_CLICK.precisionFactor; 5000 } 5001 5002 let minValue = parseFloat($(this).data("min")); 5003 if (minValue && !ratio) { 5004 ratio = minValue; 5005 } 5006 5007 let maxValue = $(this).closest(".counter").find(".counter__action--plus").data("max"); 5008 if (parseFloat(maxValue) > 0) { 5009 if (currentValue > ratio) { 5010 if (newValue < ratio) { 5011 $input.val(ratio); 5012 } else { 5013 $input.val(newValue); 5014 } 5015 5016 // $input.change(); 5017 } 5018 } else { 5019 if (newValue > ratio) { 5020 $input.val(newValue); 5021 } else { 5022 if (parseFloat(newValue) === 0) { // remove from cart 5023 $input.val(newValue); 5024 } else { 5025 if (ratio) { 5026 $input.val(ratio); 5027 } else if (currentValue > 1) { 5028 $input.val(newValue); 5029 } 5030 } 5031 } 5032 } 5033 $input.change(); 5034}); 5035 5036$(document).on("focus", ".counter__count", function (e) { 5037 $(this).addClass("focus"); 5038}); 5039 5040$(document).on("blur", ".counter__count", function (e) { 5041 $(this).removeClass("focus"); 5042}); 5043 5044var timerChangeCounterValue = false;
5045$(document).on("change", ".counter__count", function (e) { 5046 //for corporate basket 5047 if ($(this).closest(".counter--basket").length) return; 5048 5049 let currentValue = $(this).val(); 5050 5051 let $buyBlock = $(this).closest(".buy_block"); 5052 let $toCart = $buyBlock.find(".item-action .to_cart"); 5053 5054 let isFloatRatio = $toCart.data("float_ratio"); 5055 let ratio = $toCart.data("ratio"); 5056 ratio = isFloatRatio ? parseFloat(ratio) : parseInt(ratio, 10); 5057 5058 let diff = currentValue % ratio; 5059 5060 if (isFloatRatio) { 5061 ratio = Math.round(ratio * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / arAsproOptions.JS_ITEM_CLICK.precisionFactor; 5062 5063 if (Math.round(diff * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / arAsproOptions.JS_ITEM_CLICK.precisionFactor == ratio) { 5064 diff = 0; 5065 } 5066 } 5067 5068 if ($(this).hasClass("focus")) { 5069 intCount = Math.round(Math.round((currentValue * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / ratio) / arAsproOptions.JS_ITEM_CLICK.precisionFactor) || 1; 5070 if (parseFloat(currentValue) !== 0) { 5071 currentValue = intCount <= 1 ? ratio : intCount * ratio; 5072 } 5073 currentValue = Math.round(currentValue * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / arAsproOptions.JS_ITEM_CLICK.precisionFactor; 5074 } 5075 5076 let maxValue = $(this).closest(".counter").find(".counter__action--plus").data("max"); 5077 if (parseFloat(maxValue) > 0) { 5078 if (currentValue > parseFloat(maxValue)) { 5079 currentValue = parseFloat(maxValue); 5080 } 5081 } 5082 5083 let minValue = $(this).closest(".counter").find(".counter__action--minus").data("min"); 5084 if (parseFloat(minValue) > 0) { 5085 if (currentValue < parseFloat(minValue)) { 5086 currentValue = parseFloat(minValue); 5087 } 5088 } 5089 5090 if (timerChangeCounterValue) { 5091 clearTimeout(timerChangeCounterValue); 5092 } 5093 5094 // remove from cart 5095 if (parseFloat(currentValue) === 0) { 5096 let itemAction = JItemAction.factory($toCart[0]); 5097 itemAction.state = false; 5098 itemAction.resetQuantity(); 5099 5100 5101 5102 BX.onCustomEvent('onCounterGoals', [{ 5103 goal: itemAction.getStateGoalCode(false), 5104 params: { 5105 id: itemAction.node.getAttribute('data-id'), 5106 } 5107 }]); 5108 5109 // remove notice 5110 if (typeof JNoticeSurface === 'function') { 5111 JNoticeSurface.get().node.remove() 5112 } 5113 5114 return itemAction.updateState(); 5115 } 5116 5117 if (currentValue < ratio) { 5118 currentValue = ratio; 5119 } else if (!parseFloat(currentValue)) { 5120 currentValue = 1; 5121 } 5122 5123 //console.log($toCart); 5124 $toCart.attr("data-quantity", currentValue); 5125 5126 $(this).val(currentValue); 5127 5128 5129console.log($toCart[0]); 5130 5131 timerChangeCounterValue = setTimeout(function(){ 5132 JItemAction.factory($toCart[0]).updateState(); 5133 timerChangeCounterValue = false; 5134 }, 700); 5135 5136 BX.onCustomEvent( 5137 "onCounterProductAction", 5138 [ 5139 { 5140 type: "change", 5141 params: { 5142 id: $(this), 5143 value: currentValue, 5144 } 5145 } 5146 ] 5147 ); 5148 5149 if ( 5150 $(this).closest(".complect-block").length && 5151 typeof setNewPriceComplect === "function" 5152 ) { 5153 setNewPriceComplect(); 5154 } 5155}); 5156 5157/*hover basket*/ 5158if (!funcDefined("basketTop")) { 5159 var basketTop = function basketTop(action, hoverBlock) { 5160 5161 hoverBlock = $("#headerfixed .basket-dropdown, header .basket-dropdown"); 5162 5163 hoverBlock.removeClass("loaded"); 5164 var firstTime = hoverBlock.find("div").length ? "false" : "true"; 5165 var params = $("#basket_form").find("input#fly_basket_params").val(); 5166 var postData = { 5167 firstTime: firstTime, 5168 }; 5169 if (params !== undefined) { 5170 postData.PARAMS = params; 5171 } 5172 5173 $.post( 5174 arAsproOptions["SITE_DIR"] + "ajax/showBasketHover.php", 5175 postData, 5176 $.proxy(function (data) { 5177 var ob = BX.processHTML(data); 5178 5179 // inject 5180 hoverBlock.html(ob.HTML); 5181 BX.ajax.processScripts(ob.SCRIPT); 5182 5183 if (window.matchMedia("(min-width: 992px)").matches) { 5184 hoverBlock.addClass("loaded"); 5185 } 5186 }) 5187 ); 5188 }; 5189} 5190$(document).on("mouseenter", ".header-cart .top.basket", function () { 5191 var _this = $(this); 5192 var parent = _this.closest("header, #headerfixed"); 5193 var hover_block = parent.find(".basket-dropdown"); 5194 5195 if (!hover_block.hasClass("loaded")) { 5196 basketTop("", hover_block); 5197 } 5198}); 5199/*end hover basket*/ 5200 5201CheckTabActive = function () {}; 5202 5203/* parallax bg */ 5204ParallaxBg = function () { 5205 if ($("*[data-type=parallax-bg]").length) { 5206 var x = $(window).scrollTop() / $(document).height(); 5207 x = parseInt(-x * 280); 5208 $("*[data-type=parallax-bg]") 5209 .stop() 5210 .animate({ "background-position-y": x + "px" }, 400, "swing"); 5211 } 5212}; 5213 5214// Events 5215var timerScroll = false, 5216 ignoreScroll = [], 5217 documentScrollTopLast = $(document).scrollTop(), 5218 documentScrollTop = documentScrollTopLast; 5219$(window).scroll(function () { 5220 documentScrollTop = $(document).scrollTop(); 5221 5222 if (!ignoreScroll.length) { 5223 if (timerScroll) { 5224 clearTimeout(timerScroll); 5225 timerScroll = false;
5226 } 5227 timerScroll = setTimeout(function () { 5228 BX.onCustomEvent("onWindowScroll", false); 5229 }, 100); 5230 } 5231 5232 documentScrollTopLast = $(document).scrollTop(); 5233}); 5234 5235var timerResize = false, 5236 ignoreResize = []; 5237 5238$(window).resize(function () { 5239 documentScrollTop = $(document).scrollTop(); 5240 5241 CheckTopMenuPadding(); 5242 CheckTopMenuOncePadding(); 5243 CheckSearchWidth(); 5244 5245 if (!ignoreResize.length) { 5246 if (timerResize) { 5247 clearTimeout(timerResize); 5248 timerResize = false; 5249 } 5250 timerResize = setTimeout(function () { 5251 BX.onCustomEvent("onWindowResize", false); 5252 }, 100); 5253 } 5254 5255 documentScrollTopLast = $(document).scrollTop(); 5256}); 5257 5258BX.addCustomEvent("onWindowScroll", function (eventdata) { 5259 try { 5260 ignoreScroll.push(true); 5261 ParallaxBg(); 5262 5263 //CheckTopMenuDotted(); 5264 } catch (e) { 5265 } finally { 5266 ignoreScroll.pop(); 5267 } 5268}); 5269 5270BX.addCustomEvent("onWindowResize", function (eventdata) { 5271 try { 5272 ignoreResize.push(true); 5273 5274 CheckHeaderFixedMenu(); 5275 CheckTopMenuDotted(); 5276 CheckTopVisibleMenu(); 5277 CheckFlexSlider(); 5278 CheckMainBannerSliderVText($(".banners-big .flexslider")); 5279 CheckObjectsSizes(); 5280 5281 if (funcDefined("CoverPlayer")) { 5282 CoverPlayer(); 5283 } 5284 5285 verticalAlign(); 5286 CheckTabActive(); 5287 setTimeout(function () { 5288 createTableCompare( 5289 $(".main-block .items .title-block:not(.clone) .item"), 5290 $(".prop_title_table"), 5291 $(".main-block .prop_title_table .item.clone") 5292 ); 5293 }, 100); 5294 SliceHeightBlocks(); 5295 5296 if (funcDefined("checkMobileFilter")) { 5297 checkMobileFilter(); 5298 } 5299 5300 if (window.matchMedia("(min-width: 992px)").matches) { 5301 CloseMobileMenu(); 5302 CloseMobilePhone(); 5303 } 5304 5305 if (window.matchMedia("(min-width:768px)").matches) { 5306 closeFullscreenMap(); 5307 } 5308 } catch (e) { 5309 } finally { 5310 ignoreResize.pop(); 5311 } 5312}); 5313 5314BX.addCustomEvent("onSlide", function (eventdata) { 5315 try { 5316 ignoreResize.push(true); 5317 5318 if (eventdata) { 5319 var slider = eventdata.slider; 5320 var slideClass = ".banners-big__item"; 5321 var jsDots = $(slider).siblings(".owl-carousel__dots--line"); 5322 if (jsDots.length) { 5323 if (eventdata.data) { 5324 if (eventdata.data.relatedTarget) { 5325 var dotScroll = jsDots.find(".owl-carousel__dot-scroll"); 5326 var dotsWidth = jsDots.width(); 5327 if (dotScroll.length) { 5328 var owlOptions = eventdata.data.relatedTarget; 5329 5330 if (owlOptions) { 5331 var itemsCount = owlOptions._items.length; 5332 var itemsInRow = owlOptions.settings.items; 5333 var currentItem = owlOptions._current; // + 1; 5334 5335 //orig old 5336 //currentItem = currentItem < itemsInRow ? itemsCount + itemsInRow - 1 : currentItem; 5337 //var offset = ((currentItem - itemsInRow) / itemsCount) * dotsWidth; 5338 5339 //new by use count clones in slider 5340 var clonesInStart = Math.ceil(itemsCount / 2); 5341 currentItem = currentItem < clonesInStart ? itemsCount + clonesInStart - 1 : currentItem; 5342 currentItem = currentItem === itemsCount + clonesInStart ? clonesInStart : currentItem; 5343 var offset = ((currentItem - clonesInStart) / itemsCount) * dotsWidth; 5344 5345 var styles = { 5346 width: dotsWidth / itemsCount + "px", 5347 display: "block", 5348 left: offset, 5349 }; 5350 5351 dotScroll.css(styles); 5352 } 5353 } 5354 } 5355 } 5356 } 5357 if (slider) { 5358 // add classes .curent & .shown to slide 5359 slider.find(slideClass).removeClass("current"); 5360 var curSlideIndex = eventdata.data.item.index; 5361 var curSlide = slider.find(".owl-item:eq(" + curSlideIndex + ")" + " " + slideClass); 5362 5363 curSlide.addClass("current"); 5364 curSlide.addClass("shown"); 5365 slider.resize(); 5366 5367 if (slider.closest(".blocks").length) 5368 slider.closest(".blocks").find(".flex-direction-nav li").addClass("initied"); 5369 5370 if (slider.closest(".wraps").length) 5371 slider.closest(".wraps").find(".flex-direction-nav li").addClass("initied"); 5372 5373 if (!slider.find(".flex-control-nav li").length && slider.hasClass("normal")) { 5374 slider.find(".flex-direction-nav li a").addClass("flex-disabled"); 5375 } 5376 5377 if (slider.closest(".banners-big").length) { 5378 //nav flex color 5379 slider.find(".flex-control-nav li").removeClass(); 5380 5381 // header color 5382 $("header").removeClass("light dark"); 5383 if (typeof curSlide.data("color") != "undefined") { 5384 $("header").addClass(curSlide.data("color")); 5385 } 5386 5387 // logo color 5388 if (typeof window.headerLogo !== 'undefined') { 5389 window.headerLogo.setColorOfBanner(curSlide[0]); 5390 } 5391 } 5392 5393 if (
5394 !slider.hasClass("flexslider-init-slice") && 5395 slider.hasClass("nav-title") && 5396 $(".gallery-block").closest(".tab-pane").hasClass("active") 5397 ) { 5398 slider.find(".item").sliceHeight({ lineheight: -3 }); 5399 slider.addClass("flexslider-init-slice"); 5400 } 5401 5402 if (slider.find(".flex-direction-nav").length) { 5403 if (slider.find(".flex-direction-nav").find("a.flex-disabled").length) 5404 slider.find(".flex-direction-nav").removeClass("opacity1").addClass("opacity0"); 5405 else slider.find(".flex-direction-nav").removeClass("opacity0").addClass("opacity1"); 5406 } 5407 } 5408 } 5409 } catch (e) { 5410 } finally { 5411 ignoreResize.pop(); 5412 } 5413}); 5414 5415BX.addCustomEvent("onSlideBefore", function (eventdata) { 5416 try { 5417 ignoreResize.push(true); 5418 if (eventdata) { 5419 var slider = eventdata.slider; 5420 if (slider) { 5421 if (slider.closest(".banners-big").length) { 5422 setTimeout(function () { 5423 var curSlide = slider.find(".banners-big__item.current"); 5424 5425 //nav flex color 5426 slider.find(".flex-control-nav li").removeClass(); 5427 5428 // header color 5429 $("header").removeClass("light dark"); 5430 if (typeof curSlide.data("color") != "undefined") { 5431 slider.find(".flex-control-nav li").addClass(curSlide.data("color")); 5432 $("header").addClass(curSlide.data("color")); 5433 } 5434 5435 // logo color 5436 if (typeof window.headerLogo !== 'undefined') { 5437 window.headerLogo.setColorOfBanner(curSlide[0]); 5438 } 5439 }, 100); 5440 } else if (slider.hasClass("top-bigs")) { 5441 setTimeout(function () { 5442 var index = slider.find(".item.flex-active-slide").data("slide_key"); 5443 $(".bxSlider.top-small .slides").data("bxSlider").goToSlide(index); 5444 $(".bxSlider.top-small .slides li").removeClass("flex-active-slide"); 5445 $('.bxSlider.top-small .slides li[data-slide_key="' + index + '"]').addClass("flex-active-slide"); 5446 }, 100); 5447 } 5448 } 5449 } 5450 } catch (e) { 5451 } finally { 5452 ignoreResize.pop(); 5453 } 5454}); 5455 5456BX.addCustomEvent("onSlideEnd", function (eventdata) { 5457 try { 5458 ignoreResize.push(true); 5459 if (eventdata) { 5460 var slider = eventdata.slider; 5461 } 5462 } catch (e) { 5463 } finally { 5464 ignoreResize.pop(); 5465 } 5466}); 5467 5468var onCaptchaVerifyinvisible = function (response) { 5469 $(".g-recaptcha:last").each(function () { 5470 var id = $(this).attr("data-widgetid"); 5471 if (typeof id !== "undefined" && response) { 5472 if (!$(this).closest("form").find(".g-recaptcha-response").val()) 5473 $(this).closest("form").find(".g-recaptcha-response").val(response); 5474 if ($("iframe[src*=recaptcha]").length) { 5475 $("iframe[src*=recaptcha]").each(function () { 5476 var block = $(this).parent().parent(); 5477 if (!block.hasClass("grecaptcha-badge")) block.css("width", "100%"); 5478 }); 5479 } 5480 if ($(this).closest("form").attr("name") == "form_comment") BX.submit(BX("form_comment")); 5481 else $(this).closest("form").submit(); 5482 } 5483 }); 5484}; 5485 5486var onCaptchaVerifynormal = function (response) { 5487 $(".g-recaptcha").each(function () { 5488 var id = $(this).attr("data-widgetid"); 5489 if (typeof id !== "undefined") { 5490 if (grecaptcha.getResponse(id) != "") { 5491 $(this).closest("form").find(".recaptcha").valid(); 5492 } 5493 } 5494 }); 5495}; 5496 5497BX.addCustomEvent("onSubmitForm", function (eventdata) { 5498 try { 5499 if (!window.renderRecaptchaById || !window.asproRecaptcha || !window.asproRecaptcha.key) { 5500 eventdata.form.submit(); 5501 $(eventdata.form).closest(".form").addClass("sending"); 5502 return true; 5503 } 5504 if (window.asproRecaptcha.params.recaptchaSize == "invisible" && typeof grecaptcha != "undefined") { 5505 if ($(eventdata.form).find(".g-recaptcha-response").val()) { 5506 eventdata.form.submit(); 5507 $(eventdata.form).closest(".form").addClass("sending"); 5508 } else { 5509 grecaptcha.execute($(eventdata.form).find(".g-recaptcha").data("widgetid")); 5510 return false;
5511 } 5512 } else { 5513 eventdata.form.submit(); 5514 $(eventdata.form).closest(".form").addClass("sending"); 5515 } 5516 5517 return true; 5518 } catch (e) { 5519 console.error(e); 5520 return true; 5521 } 5522}); 5523 5524const fileInputInit = function(message, reviews = 'N') { 5525 $("input[type=file]").uniform({ 5526 fileButtonHtml: BX.message("JS_FILE_BUTTON_NAME"), 5527 fileDefaultHtml: message 5528 }); 5529 5530 $(document).on("change", "input[type=file]", function () { 5531 if ($(this).val()) { 5532 $(this).closest(".uploader").addClass("files_add"); 5533 $(this).valid(); 5534 } else { 5535 $(this).closest(".uploader").removeClass("files_add"); 5536 } 5537 }); 5538 5539 $(".form .add_file").on("click", function () { 5540 const index = $(this).closest(".input").find("input[type=file]").length + 1; 5541 5542 if (reviews === 'Y') { 5543 $('<input type="file" class="form-control inputfile" tabindex="3" id="comment_images_n' + index + '" name="comment_images[]" value="" />').insertBefore(this); 5544 } else { 5545 $('<input type="file" id="POPUP_FILE' + index + '" name="FILE_n' + index + '" class="inputfile" value="" />').inserBefore(this); 5546 } 5547 5548 $("input[type=file]").uniform({ 5549 fileButtonHtml: BX.message("JS_FILE_BUTTON_NAME"), 5550 fileDefaultHtml: message, 5551 }); 5552 }); 5553}
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.