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