1var basketTimeoutSlide; 2var resizeEventTimer; 3 4var clicked_tab = 0; 5 6if (typeof arAsproOptions === "undefined") { 7 var arAsproOptions = { 8 SITE_DIR: "/", 9 }; 10 if ($("body").data("site") !== undefined) arAsproOptions["SITE_DIR"] = $("body").data("site"); 11} 12 13function readyDOM(callback) { 14 if (document.readyState !== "loading") callback(); 15 else document.addEventListener("DOMContentLoaded", callback); 16} 17 18var typeofExt = function (item) { 19 const _toString = Object.prototype.toString; 20 return _toString.call(item).slice(8, -1).toLowerCase(); 21}; 22 23function loadScripts(scripts, cb) { 24 function addVersionToScripts(scripts) { 25 const version = '?v=' + arAsproOptions['MODULE_VERSION']; 26 if (Array.isArray(scripts)) { 27 scripts.forEach(function (item, i, arr) { 28 arr[i] += version; 29 }); 30 } else if (typeof scripts === 'string') { 31 scripts += version 32 } 33 return scripts 34 } 35 36 scripts = addVersionToScripts(scripts) 37 BX.loadScript(scripts, function () { 38 if (typeof cb === "function") { 39 cb(); 40 } 41 }); 42} 43 44function loadJQM(cb) { 45 if (typeof $.fn.jqm === "function") { 46 cb(); 47 } else { 48 BX.loadScript(arAsproOptions["SITE_TEMPLATE_PATH"] + "/js/jqModal.js?v=2.2.5", () => cb()); 49 } 50} 51 52var InitLazyLoad = function () {}; 53 54$(document).on("change", ".uploader input[type=file]", function () { 55 if (!$(this).next().length || !$(this).next().hasClass("resetfile")) { 56 $( 57 '<span class="resetfile"><svg xmlns="http://www.w3.org/2000/svg" width="11" height="11" viewB
57ox="0 0 11 11"><path d="M1345.19,376.484l4.66,4.659a0.492,0.492,0,0,1,0,.707,0.5,0.5,0,0,1-.71,0l-4.66-4.659-4.65,4.659a0.5,0.5,0,0,1-.71,0,0.492,0.492,0,0,1,0-.707l4.66-4.659-4.66-4.659a0.492,0.492,0,0,1,0-.707,0.5,0.5,0,0,1,.71,0l4.65,4.659,4.66-4.659a0.5,0.5,0,0,1,.71,0,0.492,0.492,0,0,1,0,.707Z" transform="translate(-1339 -371)"/></svg></span>' 58 ).insertAfter($(this)); 59 } 60}); 61 62$(document).on("click", ".uploader.files_add input[type=file] + .resetfile", function () { 63 var $input = $(this).prev(); 64 $input.val(""); 65 $.uniform.update($input); 66 $(this).remove(); 67}); 68 69$(document).on("click", ".top_block h3", function () { 70 if (window.matchMedia("(max-width: 550px)").matches) { 71 var $this = $(this); 72 var a = $this.siblings("a"); 73 if (a.length) { 74 a[0].click(); 75 } 76 } 77}); 78 79$(document).on("click", ".bx-yandex-view-layout .yandex-map__mobile-opener", function () { 80 if ($(this).hasClass("closer")) { 81 closeYandexMap(); 82 } else { 83 openYandexMap(this); 84 } 85}); 86 87function openYandexMap(element) { 88 var $this = $(element); 89 if ($this.hasClass("closer")) return; 90 var currentMap = $this.parents(".bx-yandex-view-layout"); 91 var mapId = currentMap.find(".bx-yandex-map").attr("id"); 92 window.openedYandexMapFrame = mapId;
93 var mapContainer = $('<div data-mapId="' + mapId + '"></div>'); 94 if (!$("div[data-mapId=" + mapId + "]").length) { 95 currentMap.after(mapContainer); 96 } 97 var yandexMapFrame = $('<div class="yandex-map__frame"></div>'); 98 $("body .wrapper1").append(yandexMapFrame); 99 currentMap.appendTo(yandexMapFrame); 100 currentMap.find(".yandex-map__mobile-opener").addClass("closer"); 101 window.map.container.fitToViewport(); 102} 103 104function closeYandexMap() { 105 var yandexMapFrame = $(".yandex-map__frame"); 106 if (yandexMapFrame.length) { 107 var currentMap = yandexMapFrame.find(".bx-yandex-view-layout"); 108 var yandexMapContainer = $("div[data-mapId=" + window.openedYandexMapFrame + "]"); 109 110 currentMap.appendTo(yandexMapContainer); 111 yandexMapFrame.remove(); 112 currentMap.find(".yandex-map__mobile-opener").removeClass("closer"); 113 if (window.map) { 114 window.map.container.fitToViewport(); 115 } 116 } 117} 118 119function throttle(f, t) { 120 let throttled, saveThis, saveArgs; 121 const wrapper = function () { 122 if (throttled) { 123 saveThis = this; 124 saveArgs = arguments; 125 return; 126 } 127 throttled = true; 128 f.apply(this, arguments); 129 setTimeout(function () { 130 throttled = false; 131 if (saveArgs) { 132 wrapper.apply(saveThis, saveArgs); 133 saveThis = saveArgs = null; 134 } 135 }, t); 136 }; 137 return wrapper; 138} 139 140function debounce(f, t) { 141 return function (args) { 142 var previousCall = this.lastCall; 143 this.lastCall = Date.now(); 144 if (previousCall && this.lastCall - previousCall <= t) { 145 clearTimeout(this.lastCallTimer); 146 } 147 this.lastCallTimer = setTimeout(function () { 148 f(args); 149 }, t); 150 }; 151} 152 153$.fn.iAppear = function (callback, options) { 154 if (typeof $.fn.iAppear.useObserver === "undefined") { 155 $.fn.iAppear.useObserver = typeof window["IntersectionObserver"] === "function"; 156 157 if (!$.fn.iAppear.useObserver && typeof $.fn.appear !== "function") { 158 $.fn.iAppear.queue = []; 159 BX.loadScript(arAsproOptions.SITE_TEMPLATE_PATH + "/vendor/js/jquery.appear.js", function () { 160 if (typeof $.fn.iAppear.queue === "object") { 161 $.fn.iAppear.queue.forEach(function (queueItem) { 162 $(queueItem.items).iAppear(queueItem.callback, queueItem.options); 163 }); 164 } 165 }); 166 167 return; 168 } 169 } 170 171 if ($.fn.iAppear.useObserver) { 172 var options = $.extend( 173 { 174 root: null, 175 rootMargin: "150px 0px 150px 0px", 176 threshold: 0.0, 177 }, 178 options 179 ); 180 181 $(this).each(function (i, appearBlock) { 182 var observer = new IntersectionObserver(function (entries, observer) { 183 entries.forEach(function (element) { 184 if (element.intersectionRatio > 0 && !element.target.dataset.iAppeared) { 185 element.target.dataset.iAppeared = true; 186 187 if (typeof callback === "function") { 188 callback.call(element.target); 189 } 190 } 191 }); 192 }, options); 193 194 observer.observe(appearBlock); 195 }); 196 } else { 197 if (typeof $.fn.appear !== "function") { 198 if ($(this).length) { 199 $.fn.iAppear.queue.push({ 200 items: this, 201 callback: callback, 202 options: options, 203 }); 204 } 205 206 return; 207 } else { 208 if ($(this).length) { 209 $(this).each(function (i, appearBlock) { 210 $(appearBlock).appear(function () { 211 if (typeof callback === "function") { 212 callback.call(appearBlock); 213 } 214 }, options); 215 }); 216 } 217 } 218 } 219}; 220 221$(document).on("click", ".flex-control-nav.flex-control-js-click li a:not(.flex-active)", function (e) { 222 var _this = $(this); 223 var itemIndex = _this.data("index") ? _this.data("index") : _this.closest("li").index(); 224 225 var block = ""; 226 var blocks = _this.closest(".items").find("> .item"); 227 var activeBlock = _this.closest(".items").find(".item.active"); 228 229 var activeLi = _this.closest(".flex-control-nav").find(".flex-active"); 230 231 activeBlock.fadeOut(function () { 232 activeBlock.removeClass("active"); 233 234 block = blocks.eq(itemIndex); 235 if (block.length) { 236 block.fadeIn(function () { 237 block.addClass("active"); 238 }); 239 } 240 241 _this.addClass("flex-active"); 242 activeLi.removeClass("flex-active"); 243 }); 244 245 e.preventDefault(); 246}); 247 248$(document).on("mouseenter", "#headerfixed .menu-item.wide_menu", function () { 249 var _this = $(this); 250 setTimeout(function () { 251 var dropdownMenu = _this.find(".wrap > .dropdown-menu"); 252 var menuOffset = dropdownMenu[0].getBoundingClientRect(); 253 var headerOffset = document.getElementById("headerfixed").getBoundingClientRect(); 254 var windowHeight = document.documentElement.clientHeight; 255 256 if (menuOffset.height + headerOffset.height > windowHeight) { 257 var maxHeight = windowHeight - headerOffset.height; 258 dropdownMenu.css({ 259 "max-height": maxHeight, 260 }); 261 dropdownMenu.find(".menu-navigation").css({ "max-height": maxHeight }); 262 dropdownMenu.find(".customScrollbar").css({ "max-height": maxHeight }); 263 dropdownMenu.find(".menu-wrapper.menu-type-4 > li").css({ "min-height": "auto" }); 264 } else { 265 dropdownMenu.css({ 266 "max-height": "", 267 }); 268 dropdownMenu.find(".menu-navigation").css({ "max-height": "" }); 269 dropdownMenu.find(".customScrollbar").css({ "max-height": "" }); 270 dropdownMenu.find(".menu-wrapper.menu-type-4 > li").css({ "min-height": "" }); 271 } 272 }, 300); 273}); 274 275BX.addCustomEvent("onAjaxSuccess", function (data) { 276 if (typeof data === "object" && data !== null) { 277 if ( 278 typeof data.BASKET_REFRESHED !== undefined && 279 data.BASKET_REFRESHED === true && 280 typeof data.BASKET_DATA === "object" && 281 data.BASKET_DATA 282 ) { 283 var basketCounts = data.BASKET_DATA.BASKET_ITEMS_COUNT; 284 reloadBasketCounters(basketCounts); 285 } 286 } 287}); 288 289BX.addCustomEvent("onHeaderProgressBarChange", function (data) { 290 if (typeof updateProgressBar === "function") { 291 updateProgressBar(); 292 } 293}); 294 295if (!funcDefined("parseUrlQuery")) { 296 parseUrlQuery = function () { 297 var data = {}; 298 if (location.search) { 299 var pair = location.search.substr(1).split("&"); 300 for (var i = 0; i < pair.length; i++) { 301 var param = pair[i].split("="); 302 data[param[0]] = param[1]; 303 } 304 } 305 return data; 306 }; 307} 308 309if (!funcDefined("setLocationSKU")) { 310 function setLocationSKU(ID, urlParam) { 311 if (urlParam === undefined) urlParam = "oid"; 312 313 var objUrl = parseUrlQuery(), 314 j = 0, 315 prefix = "", 316 query_string = "", 317 url = ""; 318 319 objUrl[urlParam] = ID; 320 321 for (var i in objUrl) { 322 if (parseInt(j) > 0) prefix = "&"; 323 query_string = query_string + prefix + i + "=" + objUrl[i]; 324 j++; 325 } 326 if (query_string) { 327 url = location.pathname + "?" + query_string + location.hash; 328 } 329 try { 330 //history.pushState(null, null, url); 331 history.replaceState(null, null, url); 332 return; 333 } catch (e) {} 334 location.hash = "#" + url.substr(1); 335 } 336} 337 338if (!funcDefined("ShowOverlay")) { 339 ShowOverlay = function () { 340 $('<div class="jqmOverlay waiting"></div>').appendTo("body"); 341 }; 342} 343 344if (!funcDefined("HideOverlay")) { 345 HideOverlay = function () { 346 $(".jqmOverlay").detach(); 347 }; 348} 349 350if (!funcDefined("trimPrice")) { 351 var trimPrice = function trimPrice(s) { 352 s = s.split(" ").join(""); 353 s = s.split(" ").join(""); 354 return s; 355 }; 356} 357 358if (!funcDefined("pauseYmObserver")) { 359 // pause ya metrika webvisor MutationObserver callback (DOM indexer) 360 // use before insert html with some animation 361 pauseYmObserver = function () { 362 if ( 363 typeof MutationObserver === "function" && 364 typeof MutationObserver.observers === "object" && 365 typeof MutationObserver.observers.ym === "object" 366 ) { 367 if (typeof pauseYmObserver.cnt === "undefined") { 368 pauseYmObserver.cnt = 0; 369 } 370 371 ++pauseYmObserver.cnt; 372 373 if (!MutationObserver.observers.ym.paused) { 374 MutationObserver.observers.ym.pause(); 375 } 376 } 377 }; 378} 379 380if (!funcDefined("resumeYmObserver")) { 381 // resume ya metrika webvisor MutationObserver callback 382 // use when animation finished 383 resumeYmObserver = function () { 384 if ( 385 typeof MutationObserver === "function" && 386 typeof MutationObserver.observers === "object" && 387 typeof MutationObserver.observers.ym === "object" 388 ) { 389 if (typeof pauseYmObserver.cnt === "undefined") { 390 pauseYmObserver.cnt = 1; 391 } 392 393 pauseYmObserver.cnt -= pauseYmObserver.cnt > 0 ? 1 : 0; 394 395 if (!pauseYmObserver.cnt && MutationObserver.observers.ym.paused) { 396 MutationObserver.observers.ym.resume(); 397 } 398 } 399 }; 400} 401 402if (!funcDefined("markProductRemoveBasket")) { 403 var markProductRemoveBasket = function markProductRemoveBasket(id) { 404 $(".in-cart[data-item=" + id + "]").hide(); 405 $(".to-cart[data-item=" + id + "]").show(); 406 if ( 407 $(".to-cart[data-item=" + id + "]") 408 .closest(".counter_wrapp") 409 .find(".counter_block").length 410 ) { 411 $(".to-cart[data-item=" + id + "]") 412 .closest(".button_block") 413 .removeClass("wide"); 414 } 415 $(".to-cart[data-item=" + id + "]") 416 .closest(".counter_wrapp") 417 .find(".counter_block") 418 .show(); 419 $(".counter_block[data-item=" + id + "]") 420 .closest(".counter_block_inner") 421 .show(); 422 $(".counter_block[data-item=" + id + "]").show(); 423 $(".in-subscribe[data-item=" + id + "]").hide(); 424 $(".to-subscribe[data-item=" + id + "]").show(); 425 426 $(".banner_buttons.with_actions .wraps_buttons[data-id=" + id + "] .basket_item_add").removeClass("added"); 427 428 if ($("#headerfixed .but-cell .type_block").length) { 429 $("#headerfixed .but-cell .type_block span").text(BX.message("MORE_INFO_SKU")); 430 $("#headerfixed .but-cell .type_block .svg-inline-fw").remove(); 431 } 432 }; 433} 434 435if (!funcDefined("markProductAddBasket")) { 436 var markProductAddBasket = function markProductAddBasket(id) { 437 $(".to-cart[data-item=" + id + "]").hide(); 438 $(".to-cart[data-item=" + id + "]") 439 .closest(".counter_wrapp") 440 .find(".counter_block_inner") 441 .hide(); 442 $(".to-cart[data-item=" + id + "]") 443 .closest(".counter_wrapp") 444 .find(".counter_block") 445 .hide(); 446 $(".to-cart[data-item=" + id + "]") 447 .closest(".button_block") 448 .addClass("wide"); 449 $(".in-cart[data-item=" + id + "]").show(); 450 451 $(".banner_buttons.with_actions .wraps_buttons[data-id=" + id + "] .basket_item_add").addClass("added"); 452 453 if ($("#headerfixed .but-cell .type_block").length) { 454 $("#headerfixed .but-cell .type_block").html($(".in-cart[data-item=" + id + "]").html()); 455 } 456 }; 457} 458 459if (!funcDefined("markProductDelay")) {
460 var markProductDelay = function markProductDelay(id) { 461 $(".in-cart[data-item=" + id + "]").hide(); 462 $(".to-cart[data-item=" + id + "]").show(); 463 $(".to-cart[data-item=" + id + "]") 464 .closest(".counter_wrapp") 465 .find(".counter_block_inner") 466 .show(); 467 $(".to-cart[data-item=" + id + "]") 468 .closest(".counter_wrapp") 469 .find(".counter_block") 470 .show(); 471 if ( 472 $(".to-cart[data-item=" + id + "]") 473 .closest(".counter_wrapp") 474 .find(".counter_block").length 475 ) { 476 $(".to-cart[data-item=" + id + "]") 477 .closest(".button_block") 478 .removeClass("wide"); 479 } 480 481 if ($("#headerfixed .but-cell .type_block").length) { 482 $("#headerfixed .but-cell .type_block span").text(BX.message("MORE_INFO_SKU")); 483 $("#headerfixed .but-cell .type_block .svg-inline-fw").remove(); 484 } 485 }; 486} 487 488if (!funcDefined("markProductSubscribe")) { 489 var markProductSubscribe = function markProductSubscribe(id) { 490 $(".to-subscribe[data-item=" + id + "]").hide(); 491 $(".in-subscribe[data-item=" + id + "]").css("display", "block"); 492 }; 493} 494 495if (!funcDefined("updateBottomIconsPanel")) { 496 var updateBottomIconsPanel = function updateBottomIconsPanel(options) { 497 if (options && $(".bottom-icons-panel").length) { 498 var bBasketUpdate = "READY" in options || "BASKET_COUNT" in options; 499 var basketCount = "READY" in options ? options.READY.COUNT : "BASKET_COUNT" in options ? options.BASKET_COUNT : 0; 500 var basketTitle = 501 "READY" in options ? options.READY.TITLE : "BASKET_SUMM_TITLE" in options ? options.BASKET_SUMM_TITLE : ""; 502 var bDelayUpdate = "DELAY" in options || "DELAY_COUNT" in options; 503 var delayCount = "FAVORITE" in options ? options.FAVORITE.COUNT : 0; 504 var delayTitle = 505 "DELAY" in options ? options.DELAY.TITLE : "DELAY_SUMM_TITLE" in options ? options.DELAY_SUMM_TITLE : ""; 506 var bCompareUpdate = "COMPARE" in options; 507 var compareCount = 508 "COMPARE" in options 509 ? typeof options.COMPARE === "object" && "COUNT" in options.COMPARE 510 ? options.COMPARE.COUNT 511 : Object.keys(options.COMPARE).length 512 : 0; 513 514 //basket 515 if (bBasketUpdate) { 516 if (+basketCount > 0) { 517 $(".bottom-icons-panel .basket.counter-state").removeClass("counter-state--empty"); 518 } else { 519 $(".bottom-icons-panel .basket.counter-state").addClass("counter-state--empty"); 520 } 521 $(".bottom-icons-panel .basket .counter-state__content-item-value").text(basketCount); 522 $(".bottom-icons-panel .basket") 523 .closest(".bottom-icons-panel__content-link") 524 .attr("title", $("<div/>").html(basketTitle).text()); 525 } 526 // 527 528 //delay 529 if (bDelayUpdate && bBasketUpdate) { 530 if (+delayCount > 0) { 531 $(".bottom-icons-panel .delay.counter-state").removeClass("counter-state--empty"); 532 } else { 533 $(".bottom-icons-panel .delay.counter-state").addClass("counter-state--empty"); 534 } 535 $(".bottom-icons-panel .delay .counter-state__content-item-value").text(delayCount); 536 } 537 // 538 539 //compare 540 if (bCompareUpdate) { 541 if (compareCount > 0) { 542 $(".bottom-icons-panel .compare.counter-state").removeClass("counter-state--empty"); 543 } else { 544 $(".bottom-icons-panel .compare.counter-state").addClass("counter-state--empty"); 545 } 546 $(".bottom-icons-panel .compare .counter-state__content-item-value").text(compareCount); 547 } 548 } 549 }; 550} 551if (!funcDefined("basketFly")) { 552 var basketFly = function basketFly(action, opener) { 553 if (typeof obMaxPredictions === "object") { 554 obMaxPredictions.updateAll(); 555 } 556 557 /*if(arAsproOptions['PAGES']['BASKET_PAGE']) 558 return;*/ 559 $.post( 560 arAsproOptions["SITE_DIR"] + "ajax/basket_fly.php", 561 "PARAMS=" + $("#basket_form").find("input#fly_basket_params").val(), 562 $.proxy(function (data) { 563 var small = $(".opener .basket_count").hasClass("small"), 564 basket_count = $(data).find(".basket_count").find(".items div").text(); 565 $("#basket_line .basket_fly").addClass("loaded").html(data); 566 567 if (action == "refresh") $("li[data-type=AnDelCanBuy]").trigger("click"); 568 569 if (typeof opener == "undefined" || $("#basket_line .basket_fly").hasClass("loading")) { 570 if (window.matchMedia("(min-width: 769px)").matches) { 571 if (action == "open") { 572 if (small) { 573 if (arAsproOptions["THEME"]["SHOW_BASKET_ONADDTOCART"] !== "N") { 574 $(".opener .basket_count").click(); 575 } 576 } else { 577 $(".opener .basket_count").removeClass("small"); 578 $('.tabs_content.basket li[item-section="AnDelCanBuy"]').addClass("cur"); 579 $('#basket_line ul.tabs li[item-section="AnDelCanBuy"]').addClass("cur"); 580 581 $("#basket_line .basket_fly .opener > div:eq(0)").addClass("cur"); 582 } 583 } else { 584 if (arAsproOptions["THEME"]["SHOW_BASKET_ONADDTOCART"] !== "N") { 585 $(".opener .basket_count").click(); 586 } 587 } 588 } 589 } else if (opener === "SHOW") { 590 if (window.matchMedia("(min-width: 769px)").matches) { 591 $(".opener .basket_count").removeClass("small"); 592 $('.tabs_content.basket li[item-section="AnDelCanBuy"]').addClass("cur"); 593 $('#basket_line ul.tabs li[item-section="AnDelCanBuy"]').addClass("cur"); 594 $("#basket_line .basket_fly .opener > div:eq(0)").addClass("cur"); 595 } 596 } 597 }) 598 ); 599 }; 600} 601 602if (!funcDefined("basketTop")) { 603 var basketTop = function basketTop(action, hoverBlock) { 604 if (action == "reload") { 605 if ($(".basket_hover_block:hover").length) { 606 hoverBlock = $(".basket_hover_block:hover"); 607 } 608 } 609 610 if (action == "open") { 611 if (arAsproOptions["THEME"]["SHOW_BASKET_ONADDTOCART"] !== "N") { 612 if ($("#headerfixed").hasClass("fixed")) { 613 hoverBlock = $("#headerfixed .basket_hover_block"); 614 } else { 615 hoverBlock = $(".top_basket .basket_hover_block"); 616 } 617 } 618 } 619 620 if (hoverBlock === undefined) { 621 console.log("Undefined hoverBlock"); 622 console.trace(); 623 return false;
624 } 625 626 if (action == "close") { 627 if (hoverBlock.length) { 628 hoverBlock.css({ 629 opacity: "", 630 visibility: "", 631 }); 632 return true; 633 } 634 } 635 636 hoverBlock.removeClass("loaded"); 637 var firstTime = hoverBlock.find("div").length ? "false" : "true"; 638 var params = $("#basket_form").find("input#fly_basket_params").val(); 639 var postData = { 640 firstTime: firstTime, 641 }; 642 if (params !== undefined) { 643 postData.PARAMS = params; 644 } 645 646 $.post( 647 arAsproOptions["SITE_DIR"] + "ajax/showBasketHover.php", 648 postData, 649 $.proxy(function (data) { 650 var ob = BX.processHTML(data); 651 652 // inject 653 $("#headerfixed .basket_hover_block, .top_basket .basket_hover_block").html(ob.HTML); 654 BX.ajax.processScripts(ob.SCRIPT); 655 656 if (window.matchMedia("(min-width: 992px)").matches) { 657 hoverBlock.addClass("loaded"); 658 659 if (action == "open") { 660 if (arAsproOptions["THEME"]["SHOW_BASKET_ONADDTOCART"] !== "N") { 661 if ($("#headerfixed").hasClass("fixed")) { 662 hoverBlock = $("#headerfixed .basket_hover_block"); 663 } else { 664 hoverBlock = $(".top_basket .basket_hover_block"); 665 } 666 667 hoverBlock.css({ 668 opacity: "1", 669 visibility: "visible", 670 }); 671 672 setTimeout(function () { 673 hoverBlock.css({ 674 opacity: "", 675 visibility: "", 676 }); 677 }, 2000); 678 } 679 } 680 } 681 }) 682 ); 683 }; 684} 685 686$(document).on("click", "#basket_toolbar_button", function () { 687 if (lastHash) location.hash = "cart"; 688}); 689$(document).on("click", "#basket_toolbar_button_delayed", function () { 690 if (lastHash) location.hash = "delayed"; 691}); 692if (location.hash) { 693 var hash = location.hash; 694} 695//work with hash end 696 697$(document).on("click", "#basket_line .basket_fly .opener > div.clicked", function () { 698 if (arAsproOptions["PAGES"]["BASKET_PAGE"]) return; 699 function onOpenFlyBasket(_this) { 700 $("#basket_line .basket_fly .tabs li").removeClass("cur"); 701 $("#basket_line .basket_fly .tabs_content li").removeClass("cur"); 702 // $("#basket_line .basket_fly .remove_all_basket").removeClass("cur"); 703 if (!$(_this).is(".wish_count.empty")) { 704 $("#basket_line .basket_fly .tabs_content li[item-section=" + $(_this).data("type") + "]").addClass("cur"); 705 $("#basket_line .basket_fly .tabs li:eq(" + $(_this).index() + ")").addClass("cur"); 706 // $("#basket_line .basket_fly .remove_all_basket."+$(_this).data("type")).addClass("cur"); 707 } else { 708 $("#basket_line .basket_fly .tabs li").first().addClass("cur").siblings().removeClass("cur"); 709 $("#basket_line .basket_fly .tabs_content li").first().addClass("cur").siblings().removeClass("cur"); 710 // $("#basket_line .basket_fly .remove_all_basket").first().addClass("cur"); 711 } 712 $("#basket_line .basket_fly .opener > div.clicked").removeClass("small"); 713 714 $("#basket_line .basket_fly .opener > div").siblings().removeClass("cur"); 715 $("#basket_line .basket_fly .opener > div:eq(" + $(_this).index() + ")").addClass("cur"); 716 } 717 718 if (window.matchMedia("(min-width: 769px)").matches) { 719 var _this = this; 720 721 $(_this).siblings().removeClass("cur"); 722 $(_this).addClass("cur"); 723 724 if (parseInt($("#basket_line .basket_fly").css("right")) < 0) { 725 $("#basket_line .basket_fly") 726 .stop() 727 .addClass("loading") 728 .animate({ right: "0" }, 333, function () { 729 if ($(_this).closest(".basket_fly.loaded").length) { 730 onOpenFlyBasket(_this); 731 } else { 732 $.ajax({ 733 url: arAsproOptions["SITE_DIR"] + "ajax/basket_fly.php", 734 type: "post", 735 success: function (html) { 736 $("#basket_line .basket_fly").removeClass("loading").addClass("loaded").html(html); 737 onOpenFlyBasket(_this); 738 }, 739 }); 740 } 741 }); 742 $("#basket_line .basket_fly").addClass("swiped"); 743 } else if ( 744 $(this).is(".wish_count:not(.empty)") && 745 !$("#basket_line .basket_fly .basket_sort ul.tabs li.cur").is("[item-section=DelDelCanBuy]") 746 ) { 747 $("#basket_line .basket_fly .tabs li").removeClass("cur"); 748 $("#basket_line .basket_fly .tabs_content li").removeClass("cur"); 749 // $("#basket_line .basket_fly .remove_all_basket").removeClass("cur"); 750 $("#basket_line .basket_fly .tabs_content li[item-section=" + $(this).data("type") + "]").addClass("cur"); 751 $("#basket_line .basket_fly .tabs li:eq(" + $(this).index() + ")") 752 .first() 753 .addClass("cur"); 754 // $("#basket_line .basket_fly .remove_all_basket."+$(this).data("type")).first().addClass("cur"); 755 } else if ( 756 $(this).is(".basket_count") && 757 $("#basket_line .basket_fly .basket_sort ul.tabs li.cur").length && 758 !$("#basket_line .basket_fly .basket_sort ul.tabs li.cur").is("[item-section=AnDelCanBuy]") 759 ) { 760 $("#basket_line .basket_fly .tabs li").removeClass("cur"); 761 $("#basket_line .basket_fly .tabs_content li").removeClass("cur"); 762 // $("#basket_line .basket_fly .remove_all_basket").removeClass("cur"); 763 $("#basket_line .basket_fly .tabs_content li:eq(" + $(this).index() + ")").addClass("cur"); 764 $("#basket_line .basket_fly .tabs li:eq(" + $(this).index() + ")") 765 .first() 766 .addClass("cur"); 767 // $("#basket_line .basket_fly .remove_all_basket."+$(this).data("type")).first().addClass("cur"); 768 } else { 769 $("#basket_line .basket_fly") 770 .stop() 771 .animate({ right: -$("#basket_line .basket_fly").outerWidth() }, 150); 772 $("#basket_line .basket_fly .opener > div.clicked").addClass("small"); 773 $("#basket_line .basket_fly").removeClass("swiped"); 774 $("#basket_line .basket_fly .opener > div").removeClass("cur"); 775 } 776 } 777}); 778 779if (!funcDefined("clearViewedProduct")) { 780 function clearViewedProduct() { 781 try { 782 var siteID = arAsproOptions.SITE_ID; 783 var localKey = "MAX_VIEWED_ITEMS_" + siteID; 784 var cookieParams = { path: "/", expires: 30 }; 785 if (typeof BX.localStorage !== "undefined") { 786 // remove local storage 787 BX.localStorage.set(localKey, {}, 0); 788 } 789 // remove cookie 790 $.removeCookie(localKey, cookieParams); 791 } catch (e) { 792 console.error(e); 793 } 794 } 795} 796
797if (!funcDefined("setViewedProduct")) { 798 function setViewedProduct(id, arData) { 799 try { 800 // save $.cookie option 801 var bCookieJson = $.cookie.json; 802 $.cookie.json = true; 803 804 var siteID = arAsproOptions.SITE_ID; 805 var localKey = "MAX_VIEWED_ITEMS_" + siteID; 806 var cookieParams = { path: "/", expires: 30 }; 807 808 if (typeof BX.localStorage !== "undefined" && typeof id !== "undefined" && typeof arData !== "undefined") { 809 var PRODUCT_ID = typeof arData.PRODUCT_ID !== "undefined" ? arData.PRODUCT_ID : id; 810 var arViewedLocal = BX.localStorage.get(localKey) ? BX.localStorage.get(localKey) : {}; 811 var arViewedCookie = $.cookie(localKey) ? $.cookie(localKey) : {}; 812 var count = 0; 813 814 // delete some items (sync cookie & local storage) 815 for (var _id in arViewedLocal) { 816 arViewedLocal[_id].IS_LAST = false; 817 if (typeof arViewedCookie[_id] === "undefined") { 818 delete arViewedLocal[_id]; 819 } 820 } 821 for (var _id in arViewedCookie) { 822 if (typeof arViewedLocal[_id] === "undefined") { 823 delete arViewedCookie[_id]; 824 } 825 } 826 827 for (var _id in arViewedCookie) { 828 count++; 829 } 830 831 // delete item if other item (offer) of that PRODUCT_ID is exists 832 if (typeof arViewedLocal[PRODUCT_ID] !== "undefined") { 833 if (arViewedLocal[PRODUCT_ID].ID != id) { 834 delete arViewedLocal[PRODUCT_ID]; 835 delete arViewedCookie[PRODUCT_ID]; 836 } 837 } 838 839 var time = new Date().getTime(); 840 arData.ID = id; 841 arData.ACTIVE_FROM = time; 842 arData.IS_LAST = true; 843 arViewedLocal[PRODUCT_ID] = arData; 844 arViewedCookie[PRODUCT_ID] = [time.toString(), arData.PICTURE_ID]; 845 846 $.cookie(localKey, arViewedCookie, cookieParams); 847 BX.localStorage.set(localKey, arViewedLocal, 2592000); // 30 days 848 } 849 } catch (e) { 850 console.error(e); 851 } finally { 852 // restore $.cookie option 853 $.cookie.json = bCookieJson; 854 } 855 } 856} 857 858if (!funcDefined("initSelects")) { 859 function initSelects(target) { 860 if (!$.fn.ikSelect) return; 861 var iOS = navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false; 862 if (iOS && !$(".wrapper1.iks-on-ios").length) return; 863 if ($("#bx-soa-order").length || $("#bx-soa-order-main").length) return; 864 865 if (!$(".wrapper1.iks-ignore").length) { 866 const $target = $(target).find( 867 ".wrapper1 select:visible:not(.iks-ignore), .jqmWindow select:visible:not(.iks-ignore)" 868 ); 869 870 if ($target.length) { 871 // SELECT STYLING 872 $target.ikSelect({ 873 syntax: 874 '<div class="ik_select_link"> \ 875 <span class="ik_select_link_text"></span> \ 876 <div class="trigger"></div> \ 877 </div> \ 878 <div class="ik_select_dropdown"> \ 879 <div class="ik_select_list"> \ 880 </div> \ 881 </div>', 882 dynamicWidth: true, 883 ddMaxHeight: 112, 884 customClass: "common_select", 885 //equalWidths: true, 886 onShow: function (inst) { 887 inst.$dropdown.css("top", parseFloat(inst.$dropdown.css("top")) - 5 + "px"); 888 if (inst.$dropdown.outerWidth() < inst.$link.outerWidth()) { 889 inst.$dropdown.css("width", inst.$link.outerWidth()); 890 } 891 if (inst.$dropdown.outerWidth() > inst.$link.outerWidth()) { 892 inst.$dropdown.css("width", inst.$link.outerWidth()); 893 } 894 var count = 0, 895 client_height = 0; 896 inst.$dropdown.css("left", inst.$link.offset().left); 897 $(inst.$listInnerUl) 898 .find("li") 899 .each(function () { 900 if (!$(this).hasClass("ik_select_option_disabled")) { 901 ++count; 902 client_height += $(this).outerHeight(); 903 } 904 }); 905 if (client_height < 112) { 906 inst.$listInner.css("height", "auto"); 907 } else { 908 inst.$listInner.css("height", "112px"); 909 } 910 inst.$link.addClass("opened"); 911 inst.$listInner.addClass("scroller scrollblock"); 912 if ($(".confirm_region").length) $(".confirm_region").remove(); 913 }, 914 onHide: function (inst) { 915 inst.$link.removeClass("opened"); 916 }, 917 }); 918 // END OF SELECT STYLING 919 920 var timeout; 921 $(window).on("resize", function () { 922 ignoreResize.push(true); 923 clearTimeout(timeout); 924 timeout = setTimeout(function () { 925 //$('select:visible').ikSelect('redraw'); 926 var inst = ""; 927 if ((inst = $(".common_select-link.opened + select").ikSelect().data("plugin_ikSelect"))) { 928 inst.$dropdown.css("left", inst.$link.offset().left + "px"); 929 } 930 }, 20); 931 ignoreResize.pop(); 932 }); 933 } 934 } 935 } 936} 937 938if (!funcDefined("CheckTopMenuFullCatalogSubmenu")) { 939 CheckTopMenuFullCatalogSubmenu = function () { 940 if (window.matchMedia("(max-width: 991px)").matches) return; 941 942 if (arAsproOptions["THEME"] && arAsproOptions["THEME"]["MENU_TYPE_VIEW"] != "HOVER") return; 943 944 var $menu = $(".left_block .menu_top_block"); 945 if ($menu.length) { 946 var $wrapmenu = $menu.parents(".wrap_menu"); 947 948 var wrapMenuWidth = $menu.closest(".wrapper_inner").actual("width"); 949 if (!wrapMenuWidth) wrapMenuWidth = $menu.closest(".wraps").actual("width"); 950 951 var bCatalogFirst = $menu.hasClass("catalogfirst"); 952 var findMenuLi = $(".left_block .menu_top_block:visible li.full"); 953 var parentSubmenuWidth = $menu.actual("outerWidth"); 954 var wrapMenuLeft = 0; 955 var wrapMenuRight = 0; 956 957 if ($wrapmenu.length) { 958 wrapMenuWidth = $wrapmenu.actual("outerWidth"); 959 wrapMenuLeft = $wrapmenu.offset().left; 960 wrapMenuRight = wrapMenuLeft + wrapMenuWidth; 961 } 962 963 if ($(".left_block .catalog_block.menu_top_block").length) { 964 if ($(".left_block .catalog_block.menu_top_block").is(":visible")) 965 findMenuLi = $(".left_block .menu_top_block.catalog_block li.full"); 966 } 967 findMenuLi.each(function () { 968 var $this = $(this); 969 var $submenu = $this.find(">.dropdown"); 970 971 if ($submenu.length) { 972 // $submenu.css({left: parentSubmenuWidth + 'px', width: (wrapMenuWidth - parentSubmenuWidth) + 'px', 'padding-left': '0px', 'padding-right': '0px', 'opacity': 1}); 973 //$submenu.css({ width: wrapMenuWidth - parentSubmenuWidth + "px" }); 974 975 if (!isOnceInited && arAsproOptions["THEME"]["MENU_POSITION"] == "TOP") { 976 $this.on("mouseenter", function () { 977 $submenu.css("min-height", $this.closest(".dropdown").actual("outerHeight") + "px"); 978 }); 979 } 980 } 981 }); 982 } 983 }; 984} 985 986$.fn.getMaxHeights = function (outer, classNull, minHeight) { 987 var maxHeight = this.map(function (i, e) { 988 var calc_height = 0; 989 $(e).css("height", ""); 990 991 if (outer == true) calc_height = $(e).actual("outerHeight"); 992 else calc_height = $(e).actual("height"); 993 994 return calc_height; 995 }).get(); 996 for (var i = 0, c = maxHeight.length; i < c; ++i) { 997 if (maxHeight[i] % 2) --maxHeight[i]; 998 } 999 return Math.max.apply(this, maxHeight); 1000}; 1001 1002$.fn.equalizeHeights = function (outer, classNull, options) { 1003 var maxHeight = []; 1004 var items = []; 1005 1006 for (var i = 0, itemKey = 0; i < this.length; itemKey++) { 1007 var item = this[itemKey], 1008 _item = $(item), 1009 minus_height = 0, 1010 calc_height = 0; 1011 1012 i++; 1013 1014 if (options.blockNull !== undefined) { 1015 if (options.blockNull.class !== undefined) { 1016 if (_item.hasClass(options.blockNull.class) || _item.closest("." + options.blockNull.class).length) { 1017 continue; 1018 } 1019 } 1020 } 1021 1022 items.push(this[itemKey]); 1023 1024 if (classNull !== false) { 1025 if (!isMobile) { 1026 var nulled = _item.find(classNull); 1027 if (nulled.length) { 1028 minus_height = parseInt(nulled[0].offsetHeight); 1029 //minus_height=parseInt(_item.find(classNull).outerHeight(false)); 1030 //minus_height=parseInt(_item.find(classNull).actual('outerHeight')); 1031 } 1032 } 1033 } 1034 1035 if (minus_height) minus_height += 12; 1036 1037 _item.css("height", ""); 1038 1039 calc_height = item.offsetHeight - minus_height; 1040 1041 if (options.minHeight !== false) { 1042 if (calc_height < options.minHeight) calc_height += options.minHeight - calc_height; 1043 1044 if (window.matchMedia("(max-width: 520px)").matches) calc_height = 300; 1045 1046 if (window.matchMedia("(max-width: 400px)").matches) calc_height = 200; 1047 } 1048
1049 if (!calc_height) calc_height = 0; 1050 1051 maxHeight.push(calc_height); 1052 } 1053 1054 for (var i = 0, c = maxHeight.length; i < c; ++i) { 1055 if (maxHeight[i] % 2) { 1056 --maxHeight[i]; 1057 } 1058 } 1059 1060 var result = $(items).height(Math.max.apply(this, maxHeight)); 1061 1062 return result; 1063}; 1064 1065$.fn.getFloatWidth = function () { 1066 var width = 0; 1067 if ($(this).length) { 1068 var rect = $(this)[0].getBoundingClientRect(); 1069 if (!(width = rect.width)) width = rect.right - rect.left; 1070 } 1071 1072 $(this).data("floatWidth", width); 1073 1074 return width; 1075}; 1076 1077function extendDepthObject(target, FromObj) { 1078 var to = Object.assign({}, target); 1079 for (var key in FromObj) { 1080 if (typeof FromObj[key] == "object") { 1081 to[key] = extendDepthObject(to[key], FromObj[key]); 1082 } else { 1083 to[key] = FromObj[key]; 1084 } 1085 } 1086 1087 return to; 1088} 1089 1090$.fn.sliceHeight = function (options) { 1091 function _slice(el) { 1092 var arBreakpoints = Object.keys(options.breakpoint); 1093 var resizeOptionsTmp = {}; 1094 if (arBreakpoints.length) { 1095 for (var key in arBreakpoints) { 1096 if (window.matchMedia(arBreakpoints[key].toString()).matches) { 1097 resizeOptionsTmp = options.breakpoint[arBreakpoints[key]]; 1098 } 1099 } 1100 } 1101 1102 var resizeOptions = extendDepthObject(options, resizeOptionsTmp); 1103 1104 var blockNullClass = 1105 resizeOptions.blockNull !== undefined && resizeOptions.blockNull.class !== undefined 1106 ? resizeOptions.blockNull.class 1107 : false; 1108 var parent = 1109 typeof resizeOptions.row !== "undefined" && resizeOptions.row.length 1110 ? el.first().parents(resizeOptions.row) 1111 : el.first().parents(".items"); 1112 var item = ""; 1113 1114 if (typeof resizeOptions.item !== "undefined" && resizeOptions.item.length) { 1115 if (blockNullClass) { 1116 $(resizeOptions.item).each(function (i, element) { 1117 _element = $(element); 1118 if (!_element.hasClass(blockNullClass)) { 1119 item = _element; 1120 } 1121 }); 1122 if (!item) 1123 // if only ignored blocks 1124 return false; 1125 } else { 1126 item = $(resizeOptions.item).first(); 1127 } 1128 } else { 1129 if (el.first().hasClass("item")) { 1130 item = el.first(); 1131 } else { 1132 item = el.first().parents(".item"); 1133 } 1134 } 1135 1136 if (typeof resizeOptions.autoslicecount == "undefined" || resizeOptions.autoslicecount !== false) { 1137 var elsw = parent.getFloatWidth(), 1138 elw = item.getFloatWidth(); 1139 if (!elsw) { 1140 elsw = el.first().parents(".row").getFloatWidth(); 1141 } 1142 if (!elw) { 1143 if (typeof resizeOptions.item !== "undefined" && resizeOptions.item.length) 1144 elw = $(resizeOptions.item + ":eq(1)").getFloatWidth() 1145 ? $(resizeOptions.item + ":eq(1)").getFloatWidth() 1146 : $(resizeOptions.item + ":eq(2)").getFloatWidth(); 1147 else elw = $(el[1]).getFloatWidth() ? $(el[1]).getFloatWidth() : $(el[2]).getFloatWidth(); 1148 } 1149 if (elw && resizeOptions.fixWidth) elw -= resizeOptions.fixWidth; 1150 1151 elw = parseInt(elw * 100) / 100; 1152 1153 if (elsw && elw) { 1154 resizeOptions.slice = Math.floor(elsw / elw); 1155 } 1156 } 1157 1158 if (resizeOptions.customSlice) { 1159 //manual slice count 1160 var bSliceNext = false; 1161 if (resizeOptions.length) { 1162 elw = 1163 typeof resizeOptions.item !== "undefined" && resizeOptions.item.length 1164 ? $(resizeOptions.item).last().getFloatWidth() 1165 : el.last().hasClass("item") 1166 ? el.last().getFloatWidth() 1167 : el.last().parents(".item").getFloatWidth(); 1168 if (elw) resizeOptions.sliceNext = Math.floor(elsw / elw); 1169 1170 bSliceNext = true; 1171 } 1172 } 1173 1174 elements = []; 1175 if (resizeOptions.classes !== undefined && resizeOptions.classes.length) { 1176 for (var i = 0; i < resizeOptions.classes.length; i++) { 1177 var items = $(resizeOptions.item).find(resizeOptions.classes[i]); 1178 elements.push(items); 1179 } 1180 } 1181 var elIndex = elements.push(el) - 1; 1182 1183 if (resizeOptions.mobile == true) { 1184 if (window.matchMedia("(max-width: 500px)").matches) { 1185 for (var block = 0; block < elements.length; block++) { 1186 var items = $(elements[block]); 1187 items.css({ 1188 "line-height": "", 1189 height: "", 1190 }); 1191 } 1192 return; 1193 } 1194 } 1195 1196 if (typeof resizeOptions.typeResize == "undefined" || resizeOptions.typeResize == false) { 1197 if (resizeOptions.slice) { 1198 for (var block = 0; block < elements.length; block++) { 1199 if (resizeOptions.currentRow) { 1200 var itemNumber = el.index(resizeOptions.currentItem); 1201 var rowCount = resizeOptions.slice; 1202 var rowNumber = Math.floor(itemNumber / rowCount); 1203 1204 var items = $(elements[block].slice(rowNumber * rowCount, rowNumber * rowCount + rowCount)); 1205 var classNull = block == elIndex ? resizeOptions.classNull : false;
1206 items.css({ 1207 "line-height": "", 1208 height: "", 1209 }); 1210 items.equalizeHeights(resizeOptions.outer, classNull, resizeOptions); 1211 } else { 1212 for (var i = 0; i < elements[block].length; ) { 1213 if (resizeOptions.customSlice && resizeOptions.sliceNext && bSliceNext && i) 1214 //manual slice count 1215 resizeOptions.slice = resizeOptions.sliceNext; 1216 1217 var slice = resizeOptions.slice; 1218 var items = $(elements[block].slice(i, i + slice)); 1219 if (resizeOptions.blockNull !== undefined) { 1220 if (resizeOptions.blockNull.class !== undefined) { 1221 var counts = 0; 1222 items.each(function (i, item) { 1223 var _item = $(item); 1224 if ( 1225 _item.hasClass(resizeOptions.blockNull.class) || 1226 _item.closest("." + resizeOptions.blockNull.class).length 1227 ) { 1228 counts++; 1229 } 1230 }); 1231 } 1232 } 1233 if (counts) { 1234 slice -= (resizeOptions.blockNull.width - 1) * counts; 1235 } 1236 1237 items = $(elements[block].slice(i, i + slice)); 1238 if (items) { 1239 var classNull = block == elIndex ? resizeOptions.classNull : false; 1240 1241 items.css({ 1242 "line-height": "", 1243 height: "", 1244 }); 1245 items.equalizeHeights(resizeOptions.outer, classNull, resizeOptions); 1246 } 1247 i += slice || 1; 1248 } 1249 } 1250 } 1251 } 1252 if (resizeOptions.lineheight) { 1253 var lineheightAdd = parseInt(resizeOptions.lineheight); 1254 if (isNaN(lineheightAdd)) { 1255 lineheightAdd = 0; 1256 } 1257 el.each(function () { 1258 $(this).css("line-height", $(this).actual("height") + lineheightAdd + "px"); 1259 }); 1260 } 1261 } 1262 } 1263 var options = $.extend( 1264 { 1265 slice: null, 1266 sliceNext: null, 1267 outer: false, 1268 lineheight: false, 1269 autoslicecount: true, 1270 classNull: false, 1271 minHeight: false, 1272 row: false, 1273 item: false, 1274 typeResize: false, 1275 typeValue: false, 1276 fixWidth: 0, 1277 resize: true, 1278 mobile: false, 1279 customSlice: false, 1280 breakpoint: {}, 1281 classes: [], 1282 }, 1283 options 1284 ); 1285 1286 var el = $(this); 1287 1288 ignoreResize.push(true); 1289 _slice(el); 1290 ignoreResize.pop(); 1291 1292 if (options.resize) { 1293 BX.addCustomEvent("onWindowResize", function (eventdata) { 1294 try { 1295 ignoreResize.push(true); 1296 _slice(el); 1297 } catch (e) { 1298 } finally { 1299 ignoreResize.pop(); 1300 } 1301 }); 1302 } else { 1303 if (!ignoreResize.length) { 1304 // ignoreResize.push(true); 1305 _slice(el); 1306 // ignoreResize.pop(); 1307 } 1308 } 1309}; 1310 1311$.fn.sliceHeightNoResize = function (options) { 1312 function _slice(el) { 1313 el.each(function () { 1314 $(this).css("line-height", ""); 1315 $(this).css("height", ""); 1316 }); 1317 if (options.mobile == true) { 1318 if (window.matchMedia("(max-width: 550px)").matches) return; 1319 } 1320 if (typeof options.autoslicecount == "undefined" || options.autoslicecount !== false) { 1321 var elsw = 1322 typeof options.row !== "undefined" && options.row.length 1323 ? el.first().parents(options.row).getFloatWidth() 1324 : el.first().parents(".items").getFloatWidth(), 1325 elw = 1326 typeof options.item !== "undefined" && options.item.length 1327 ? $(options.item).first().getFloatWidth() 1328 : el.first().hasClass("item") 1329 ? el.first().getFloatWidth() 1330 : el.first().parents(".item").getFloatWidth(); 1331 1332 if (!elsw) { 1333 elsw = el.first().parents(".row").getFloatWidth(); 1334 } 1335 if (elw && options.fixWidth) elw -= options.fixWidth; 1336 1337 if (elsw && elw) { 1338 options.slice = Math.floor(elsw / elw); 1339 } 1340 } 1341 if (options.customSlice) { 1342 //manual slice count 1343 var arBreakpoints = Object.keys(options.breakpoint),
1344 bSliceNext = false; 1345 if (arBreakpoints.length) { 1346 elw = 1347 typeof options.item !== "undefined" && options.item.length 1348 ? $(options.item).last().getFloatWidth() 1349 : el.last().hasClass("item") 1350 ? el.last().getFloatWidth() 1351 : el.last().parents(".item").getFloatWidth(); 1352 if (elw) options.sliceNext = Math.floor(elsw / elw); 1353 for (var key in arBreakpoints) { 1354 if (window.matchMedia(arBreakpoints[key].toString()).matches) { 1355 bSliceNext = true; 1356 options.slice = options.breakpoint[arBreakpoints[key]]; 1357 } 1358 } 1359 } 1360 } 1361 if (typeof options.typeResize == "undefined" || options.typeResize == false) { 1362 if (options.slice) { 1363 for (var i = 0; i < el.length; i += options.slice) { 1364 if (options.customSlice && options.sliceNext && bSliceNext && i) 1365 //manual slice count 1366 options.slice = options.sliceNext; 1367 $(el.slice(i, i + options.slice)).equalizeHeights( 1368 options.outer, 1369 options.classNull, 1370 options.minHeight, 1371 options.typeResize, 1372 options.typeValue 1373 ); 1374 } 1375 } 1376 if (options.lineheight) { 1377 var lineheightAdd = parseInt(options.lineheight); 1378 if (isNaN(lineheightAdd)) { 1379 lineheightAdd = 0; 1380 } 1381 el.each(function () { 1382 $(this).css("line-height", $(this).actual("height") + lineheightAdd + "px"); 1383 }); 1384 } 1385 } 1386 } 1387 var options = $.extend( 1388 { 1389 slice: null, 1390 sliceNext: null, 1391 outer: false, 1392 lineheight: false, 1393 autoslicecount: true, 1394 classNull: false, 1395 minHeight: false, 1396 row: false, 1397 item: false, 1398 typeResize: false, 1399 typeValue: false, 1400 fixWidth: 0, 1401 resize: true, 1402 mobile: false, 1403 customSlice: false, 1404 breakpoint: {}, 1405 }, 1406 options 1407 ); 1408 1409 var el = $(this); 1410 1411 ignoreResize.push(true); 1412 _slice(el); 1413 ignoreResize.pop(); 1414}; 1415 1416if (!funcDefined("initHoverBlock")) { 1417 function initHoverBlock(target) { 1418 /*$(target).find('.catalog_item.item_wrap').on('mouseenter', function(){ 1419 $(this).addClass('hover'); 1420 }) 1421 $(target).find('.catalog_item.item_wrap').on('mouseleave', function(){ 1422 $(this).removeClass('hover'); 1423 })*/ 1424 } 1425} 1426if (!funcDefined("setStatusButton")) { 1427 function setStatusButton() { 1428 if (!funcDefined("setItemButtonStatus")) { 1429 setItemButtonStatus = function (data) { 1430 if (data.BASKET) { 1431 for (var i in data.BASKET) { 1432 var id = data.BASKET[i]; 1433 if (typeof id === "number" || typeof id === "string") { 1434 $(".to-cart[data-item=" + id + "]").hide(); 1435 $(".counter_block[data-item=" + id + "]") 1436 .closest(".counter_block_inner") 1437 .hide(); 1438 $(".counter_block[data-item=" + id + "]").hide(); 1439 $(".in-cart[data-item=" + id + "]").show(); 1440 $(".in-cart[data-item=" + id + "]") 1441 .closest(".button_block") 1442 .addClass("wide"); 1443 } 1444 } 1445 } 1446 if (data.SUBSCRIBE) { 1447 for (var i in data.SUBSCRIBE) { 1448 var id = data.SUBSCRIBE[i]; 1449 if (typeof id === "number" || typeof id === "string") { 1450 $(".to-subscribe[data-item=" + id + "]").hide(); 1451 $(".in-subscribe[data-item=" + id + "]").show(); 1452 } 1453 } 1454 } 1455 if (data.COMPARE) { 1456 for (var i in data.COMPARE) { 1457 var id = data.COMPARE[i]; 1458 if (typeof id === "number" || typeof id === "string") { 1459 $(".compare_item.to[data-item=" + id + "]").hide(); 1460 $(".compare_item.in[data-item=" + id + "]").show(); 1461 if ($(".compare_item[data-item=" + id + "]").find(".value.added").length) { 1462 $(".compare_item[data-item=" + id + "]") 1463 .find(".value") 1464 .hide(); 1465 $(".compare_item[data-item=" + id + "]") 1466 .find(".value.added") 1467 .show(); 1468 } 1469 } 1470 } 1471 } 1472 1473 BX.onCustomEvent("onSetItemButtonStatus", []); 1474 }; 1475 } 1476 if (!Object.keys(arStatusBasketAspro).length) { 1477 if (typeof arAsproOptions === "undefined") { 1478 var arAsproOptions = { 1479 SITE_DIR: "/", 1480 }; 1481 if ($("body").data("site") !== undefined) arAsproOptions["SITE_DIR"] = $("body").data("site"); 1482 } 1483 $.ajax({ 1484 url: arAsproOptions["SITE_DIR"] + "ajax/getAjaxBasket.php", 1485 type: "POST", 1486 success: function (data) { 1487 arStatusBasketAspro = data; 1488 setItemButtonStatus(arStatusBasketAspro); 1489 }, 1490 }); 1491 } else setItemButtonStatus(arStatusBasketAspro); 1492 } 1493} 1494 1495if (!funcDefined("onLoadjqm")) { 1496 var onLoadjqm = function (name, hash, requestData, selector, requestTitle, isButton, thButton) { 1497 hash.w.attr('data-jqm-loaded', '1'); 1498 1499 if (hash.c.noOverlay === undefined || (hash.c.noOverlay !== undefined && !hash.c.noOverlay)) { 1500 $("body").addClass("jqm-initied"); 1501 } 1502 if (window.matchMedia("(min-width: 768px)").matches) { 1503 $("body").addClass("swipeignore"); 1504 } 1505 1506 //marketings 1507 if (name == "dyn_mp_jqm") { 1508 var eventdata = { hash: hash }; 1509 BX.onCustomEvent("onMarketingPopupShow", [eventdata]); 1510 } 1511 1512 //show password eye 1513 if (hash.w.hasClass("auth_frame")) { 1514 hash.w.find(".form-control:not(.eye-password-ignore) [type=password]").each(function (item) { 1515 $(this).closest(".form-control").addClass("eye-password"); 1516 }); 1517 } 1518 1519 $.each($(hash.t).get(0).attributes, function (index, attr) { 1520 if (/^data\-autoload\-(.+)$/.test(attr.nodeName)) { 1521 var key = attr.nodeName.match(/^data\-autoload\-(.+)$/)[1]; 1522 var el = $('input[data-sid="' + key.toUpperCase() + '"]'); 1523 var value = $(hash.t).data("autoload-" + key);
1524 value = String(value).replace(/%99/g, "\\"); // replace symbol \ 1525 el.val(BX.util.htmlspecialcharsback(value)).attr("readonly", "readonly"); 1526 el.closest(".form-group").addClass("input-filed"); 1527 el.attr("title", el.val()); 1528 } 1529 }); 1530 1531 //show gift block 1532 if (hash.w.hasClass("send_gift_frame")) { 1533 var imgHtml = (priceHtml = propsHtml = ""); 1534 if ($(".offers_img a").length) imgHtml = $(".offers_img a").html(); 1535 else if ($(".product-detail-gallery__container .first_sku_picture").length) 1536 imgHtml = "<img src=" + $(".product-detail-gallery__container link.first_sku_picture").attr("href") + " />"; 1537 else if ($(".product-detail-gallery__container").length) 1538 imgHtml = "<img src=" + $('.product-detail-gallery__container link[itemprop="image"]').attr("href") + " />"; 1539 1540 if ($('.product-container *[itemprop="offers"]').length) { 1541 //show price 1542 if ($(".sku-view").length) { 1543 if ($(".prices_block .price").length) 1544 priceHtml = $(".prices_block .cost.prices").html().replace("id", "data-id"); 1545 } else { 1546 var mainContainer = $(hash.t).closest(".product-main"); 1547 if (mainContainer.find(".prices_block .js_price_wrapper").length) { 1548 if (mainContainer.find(".prices_block .js_price_wrapper .with_matrix").length) { 1549 priceHtml = 1550 '<div class="with_matrix">' + 1551 mainContainer.find(".prices_block .js_price_wrapper .with_matrix").html() + 1552 "</div>"; 1553 } else if (mainContainer.find(".prices_block .with_matrix:visible").length) { 1554 priceHtml = 1555 '<div class="with_matrix">' + mainContainer.find(".prices_block .with_matrix").html() + "</div>"; 1556 } else if (mainContainer.find(".prices_block .price_group.min").length) { 1557 priceHtml = 1558 '<div class="with_matrix">' + mainContainer.find(".prices_block .price_group.min").html() + "</div>"; 1559 } else { 1560 priceHtml = 1561 '<div class="with_matrix">' + mainContainer.find(".prices_block .js_price_wrapper").html() + "</div>"; 1562 } 1563 } else if (mainContainer.find(".prices_block .with_matrix").length) 1564 priceHtml = 1565 '<div class="with_matrix">' + mainContainer.find(".prices_block .with_matrix").html() + "</div>"; 1566 else if (mainContainer.find(".prices_block .price_group.min").length) 1567 priceHtml = mainContainer.find(".prices_block .price_group.min").html(); 1568 else if (mainContainer.find(".prices_block .price_matrix_wrapper").length) 1569 priceHtml = mainContainer.find(".prices_block .price_matrix_wrapper").html(); 1570 } 1571 } 1572 1573 if ($(".buy_block .sku_props").length) { 1574 propsHtml = '<div class="props_item">'; 1575 $(".buy_block .sku_props .bx_catalog_item_scu > div").each(function () { 1576 var title = $(this).find(".bx_item_section_name > span").html(); 1577 var props = ""; 1578 var ikSelect = $(this).find(".ik_select_link_text"); 1579 if (ikSelect.length) { 1580 props = ikSelect.text(); 1581 } else { 1582 var activeSku = $(this).find("ul li.active"); 1583 var isPicture = activeSku.find(" > i"); 1584 if (isPicture.length && isPicture.attr("title")) { 1585 var propTitle = isPicture.attr("title").split(":"); 1586 if (propTitle.length) { 1587 propTitle = propTitle[1].trim(); 1588 } else { 1589 propTitle = isPicture.attr("title"); 1590 } 1591 props = propTitle; 1592 } else { 1593 props = activeSku.find(" > span").text(); 1594 } 1595 } 1596 1597 propsHtml += 1598 '<div class="prop_item">' + 1599 "<span>" + 1600 title + 1601 // '<span class="val">' + 1602 // props + 1603 // "</span>" + 1604 "</span>" + 1605 "</div>"; 1606 }); 1607 propsHtml += "</div>"; 1608 } 1609 $( 1610 '<div class="custom_block">' + 1611 '<div class="title">' + 1612 BX.message("POPUP_GIFT_TEXT") + 1613 "</div>" + 1614 '<div class="item_block">' + 1615 '<table class="item_list"><tr>' + 1616 '<td class="image">' + 1617 "<div>" + 1618 imgHtml + 1619 "</div>" + 1620 "</td>" + 1621 '<td class="text">' + 1622 '<div class="name">' + 1623 $("h1").text() + 1624 "</div>" + 1625 priceHtml + 1626 propsHtml + 1627 "</td>" + 1628 "</tr></table>" + 1629 "</div>" + 1630 "</div>" 1631 ).prependTo(hash.w.find(".form_body")); 1632 } 1633 1634 if ( 1635 arAsproOptions["THEME"]["REGIONALITY_SEARCH_ROW"] == "Y" && 1636 (hash.w.hasClass("city_chooser_frame") || hash.w.hasClass("city_chooser_small_frame")) 1637 ) {
1638 hash.w.addClass("small_popup_regions"); 1639 hash.w.addClass("no_scroll"); 1640 } 1641 1642 if (name == "fast_view" && $(".smart-filter-filter").length) { 1643 var navButtons = 1644 '<div class="navigation-wrapper-fast-view">' + 1645 '<div class="fast-view-nav prev colored_theme_hover_bg" data-fast-nav="prev">' + 1646 '<i class="svg left">' + 1647 '<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>' + 1648 "</i>" + 1649 "</div>" + 1650 '<div class="fast-view-nav next colored_theme_hover_bg" data-fast-nav="next">' + 1651 '<i class="svg right">' + 1652 '<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>' + 1653 "</i>" + 1654 "</div>" + 1655 "</div>"; 1656 1657 hash.w.closest("#popup_iframe_wrapper").append(navButtons); 1658 } 1659 1660 hash.w.addClass("scrollblock"); 1661 hash.w.addClass("show").css({ 1662 // 'top': (($(window).height() > hash.w.height()) ? Math.floor(($(window).height() - hash.w.height()) / 2) : 0) + 'px', 1663 // 'margin-left': ($(window).width() > hash.w.outerWidth() ? '-' + hash.w.outerWidth() / 2 + 'px' : '-' + $(window).width() / 2 + 'px'), 1664 opacity: 1, 1665 }); 1666 1667 if (hash.c.noOverlay === undefined || (hash.c.noOverlay !== undefined && !hash.c.noOverlay)) { 1668 let scrollbarWidth = window.innerWidth - document.documentElement.clientWidth + 'px'; 1669 $("body").css({ "padding-right": scrollbarWidth, overflow: "hidden", height: "100vh" }); 1670 hash.w.closest("#popup_iframe_wrapper").css({ "z-index": 3000, display: "flex" }); 1671 } 1672 1673 if (hash.c.noOverlay !== undefined && hash.c.noOverlay) { 1674 hash.w.closest("#body_iframe_wrapper").css({ "z-index": 2999, display: "flex" }); 1675 } 1676 1677 var eventdata = { action: "loadForm" }; 1678 let _this = $(hash.t)[0]; 1679 if (thButton) { 1680 _this = thButton; 1681 } 1682 BX.onCustomEvent("onCompleteAction", [eventdata, _this]); 1683 1684 if (typeof requestData == "undefined") { 1685 requestData = ""; 1686 } 1687 if (typeof selector == "undefined") { 1688 selector = false; 1689 } 1690 1691 // var width = $("." + name + "_frame").width(); 1692 //$('.'+name+'_frame').css('margin-left', '-'+width/2+'px'); 1693 1694 if (name == "order-popup-call") { 1695 } else if (name == "order-button") { 1696 $(".order-button_frame") 1697 .find("div[product_name]") 1698 .find("input") 1699 .val(hash.t.title) 1700 .attr("readonly", "readonly") 1701 .css({ overflow: "hidden", "text-overflow": "ellipsis" }); 1702 } else if (name == "basket_error") { 1703 $(".basket_error_frame .pop-up-title").text(requestTitle); 1704 $(".basket_error_frame .ajax_text").html(requestData); 1705 1706 if (window.matchMedia("(max-width: 991px)").matches) { 1707 $("body").addClass("all_viewed"); 1708 } 1709 1710 initSelects(document); 1711 if (isButton == "Y" && thButton) 1712 $( 1713 "<div class='popup_button_basket_wr'><span class='popup_button_basket big_btn button' data-item=" + 1714 thButton.data("item") + 1715 "><span class='btn btn-default'>" + 1716 BX.message("ERROR_BASKET_BUTTON") + 1717 "</span></span></div>" 1718 ).insertAfter($(".basket_error_frame .ajax_text")); 1719 } else if (name === "fast_view") { 1720 initSelects(document); 1721 } 1722 1723 $("." + name + "_frame").show(); 1724 }; 1725} 1726 1727if (!funcDefined("onHidejqm")) { 1728 var onHidejqm = function (name, hash) { 1729 if (hash.w.find(".one_click_buy_result_success").is(":visible") && name == "one_click_buy_basket") { 1730 window.location.href = window.location.href; 1731 } 1732 1733 if (name == "dyn_mp_jqm") { 1734 var eventdata = { hash: hash }; 1735 BX.onCustomEvent("onMarketingPopupClose", [eventdata]); 1736 } 1737 1738 if ($(".xzoom-source").length) $(".xzoom-source").remove(); 1739 if ($(".xzoom-preview").length) $(".xzoom-preview").remove(); 1740 1741 // hash.w.css('opacity', 0).hide(); 1742 hash.w.animate({ opacity: 0 }, 200, function () { 1743 hash.w.hide(); 1744 hash.w.empty(); 1745 hash.o.remove(); 1746 hash.w.removeClass("show"); 1747 1748 1749 if (!hash.w.closest("#popup_iframe_wrapper").find(".jqmOverlay").length) { 1750 $("body").css({ "padding-right": "", overflow: "", height: "" }); 1751 hash.w.closest("#popup_iframe_wrapper").css({ "z-index": "", display: "" }); 1752 } 1753 1754 if (!hash.w.closest("#body_iframe_wrapper").find(".jqmWindow.show").length) { 1755 hash.w.closest("#body_iframe_wrapper").css({ "z-index": "", display: "" }); 1756 } 1757 1758 if (window.matchMedia("(max-width: 991px)").matches) { 1759 $("body").removeClass("all_viewed"); 1760 } 1761 if (!$(".jqmOverlay:not(.mobp)").length || $(".jqmOverlay.waiting").length) { 1762 $("body").removeClass("jqm-initied"); 1763 } 1764 1765 if (window.matchMedia("(min-width: 768px)").matches) { 1766 $("body").removeClass("swipeignore"); 1767 } 1768 1769 if (name == "fast_view") { 1770 $(".fast_view_popup").remove(); 1771 1772 var navButtons = hash.w.closest("#popup_iframe_wrapper").find(".navigation-wrapper-fast-view"); 1773 navButtons.remove(); 1774 } 1775 }); 1776 1777 window.b24form = false;
1778 1779 // hide bx calc 1780 let items = document.querySelectorAll(".bx-calendar"); 1781 if (items) { 1782 items.forEach(item => { 1783 item.closest(".popup-window").style.display = "none"; 1784 }); 1785 } 1786 }; 1787} 1788 1789$.fn.jqmEx = function () { 1790 // $(this).each(function(){ 1791 var _this = $(this); 1792 var name = _this.data("name"); 1793 1794 if (name.length && _this.attr("disabled") != "disabled") { 1795 var extClass = "", 1796 paramsStr = "", 1797 trigger = ""; 1798 1799 // call counter 1800 if (typeof $.fn.jqmEx.counter === "undefined") { 1801 $.fn.jqmEx.counter = 0; 1802 } else { 1803 ++$.fn.jqmEx.counter; 1804 } 1805 1806 // trigger attrs and params 1807 $.each(_this.get(0).attributes, function (index, attr) { 1808 var attrName = attr.nodeName; 1809 var attrValue = _this.attr(attrName); 1810 if (attrName !== "onclick") { 1811 trigger += "[" + attrName + '="' + attrValue + '"]'; 1812 } 1813 if (/^data\-param\-(.+)$/.test(attrName)) { 1814 var key = attrName.match(/^data\-param\-(.+)$/)[1]; 1815 paramsStr += key + "=" + attrValue + "&"; 1816 } 1817 }); 1818 1819 // popup url 1820 var script = arAsproOptions["SITE_DIR"] + "ajax/form.php"; 1821 if (name == "auth") { 1822 script += "?" + paramsStr + "auth=Y"; 1823 } else { 1824 script += "?" + paramsStr; 1825 } 1826 1827 // ext frame class 1828 if (_this.closest("#fast_view_item").length) { 1829 extClass = "fast_view_popup"; 1830 } 1831 1832 // use overlay? 1833 var noOverlay = _this.data("noOverlay") == "Y"; 1834 1835 // unique frame to each trigger 1836 if (noOverlay) { 1837 var frame = $( 1838 '<div class="' + 1839 name + 1840 "_frame " + 1841 extClass + 1842 ' jqmWindow popup" data-popup="' + 1843 $.fn.jqmEx.counter + 1844 '"></div>' 1845 ).appendTo("#body_iframe_wrapper"); 1846 } else { 1847 var frame = $( 1848 '<div class="' + 1849 name + 1850 "_frame " + 1851 extClass + 1852 ' jqmWindow popup" data-popup="' + 1853 $.fn.jqmEx.counter + 1854 '"></div>' 1855 ).appendTo("#popup_iframe_wrapper"); 1856 } 1857 1858 let overlayClass = 'jqmOverlay'; 1859 if (_this.data("jqm-overlay-class")) { 1860 overlayClass += " " + _this.data("jqm-overlay-class"); 1861 } 1862 1863 loadJQM(() => { 1864 if (frame.attr('data-jqm-loaded') === '1') { 1865 return; 1866 } 1867 frame.jqm({ 1868 ajax: script, 1869 trigger: trigger, 1870 noOverlay: noOverlay, 1871 overlayClass: overlayClass, 1872 onLoad: function (hash) { 1873 onLoadjqm(name, hash); 1874 }, 1875 onHide: function (hash) { 1876 if (hash.w.hasClass('jqm-lock-close')) { 1877 return false; 1878 } 1879 onHidejqm(name, hash); 1880 }, 1881 }); 1882 _this.trigger("click"); 1883 }); 1884 } 1885 // }); 1886}; 1887 1888window.addEventListener("keydown", function (e) { 1889 if (e.keyCode == 27) { 1890 let jqmPopup = $(".jqm-init.show").last(); 1891 if (!jqmPopup.hasClass('jqm-lock-close')) { 1892 jqmPopup.jqmHide(); 1893 } 1894 1895 // hide fixed search panel with overlay 1896 if ($(".inline-search-block.show").length) { 1897 $(".inline-search-block").toggleClass("show"); 1898 $(".jqmOverlay.search").detach(); 1899 } 1900 1901 // hide already visible search results 1902 $(".title-search-result").hide(); 1903 1904 // unfocus title.search input 1905 $(".search .search-input").trigger("blur"); 1906 1907 $(".mega_fixed_menu").fadeOut(animationTime); 1908 } 1909}); 1910 1911if (!funcDefined("scroll_block")) { 1912 function scroll_block(block, clickedItem) { 1913 if (block.length) { 1914 if (clickedItem !== undefined && clickedItem.length) { 1915 clickedItem.trigger("click"); 1916 } else { 1917 $(".prices_tab").addClass("active").siblings().removeClass("active"); 1918 if ($(".prices_tab .opener").length && !$(".prices_tab .opener .opened").length) { 1919 let item = $(".prices_tab .opener").first(); 1920 item.find(".opener_icon").addClass("opened"); 1921 item.parents("tr").addClass("nb"); 1922 item.parents("tr").next(".offer_stores").find(".stores_block_wrap").slideDown(200); 1923 } 1924 } 1925 let topPos = block.offset().top, 1926 headerOffsetTop = $("#headerfixed").outerHeight(true, true); 1927 1928 let $tabFixed = document.querySelector(".product-item-detail-tabs-container-fixed"); 1929 if ($tabFixed) { 1930 topPos -= $tabFixed.offsetHeight; 1931 } 1932 $("html,body").animate({ scrollTop: topPos - headerOffsetTop }, 150); 1933 } 1934 } 1935} 1936 1937if (!funcDefined("jqmEd")) { 1938 var jqmEd = function (name, form_id, open_trigger, requestData, selector, requestTitle, isButton, thButton) { 1939 if (typeof requestData == "undefined") { 1940 requestData = ""; 1941 } 1942 if (typeof selector == "undefined") { 1943 selector = false;
1944 } 1945 $("body #popup_iframe_wrapper") 1946 .find("." + name + "_frame") 1947 .remove(); 1948 $("body #popup_iframe_wrapper").append('<div class="' + name + '_frame jqmWindow popup"></div>'); 1949 1950 loadJQM(() => { 1951 if (typeof open_trigger == "undefined") { 1952 $("." + name + "_frame").jqm({ 1953 trigger: "." + name + "_frame.popup", 1954 onHide: function (hash) { 1955 onHidejqm(name, hash); 1956 }, 1957 onLoad: function (hash) { 1958 onLoadjqm(name, hash, requestData, selector); 1959 }, 1960 ajax: 1961 arAsproOptions["SITE_DIR"] + 1962 "ajax/form.php?form_id=" + 1963 form_id + 1964 (requestData.length ? "&" + requestData : ""), 1965 }); 1966 } else { 1967 if (name == "enter") { 1968 $("." + name + "_frame").jqm({ 1969 trigger: open_trigger, 1970 onHide: function (hash) { 1971 onHidejqm(name, hash); 1972 }, 1973 onLoad: function (hash) { 1974 onLoadjqm(name, hash, requestData, selector); 1975 }, 1976 ajax: arAsproOptions["SITE_DIR"] + "ajax/auth.php", 1977 }); 1978 } else if (name == "basket_error") { 1979 $("." + name + "_frame").jqm({ 1980 trigger: open_trigger, 1981 onHide: function (hash) { 1982 onHidejqm(name, hash); 1983 }, 1984 onLoad: function (hash) { 1985 onLoadjqm(name, hash, requestData, selector, requestTitle, isButton, thButton); 1986 }, 1987 ajax: arAsproOptions["SITE_DIR"] + "ajax/basket_error.php", 1988 }); 1989 } else { 1990 $("." + name + "_frame").jqm({ 1991 trigger: open_trigger, 1992 onHide: function (hash) { 1993 onHidejqm(name, hash); 1994 }, 1995 onLoad: function (hash) { 1996 onLoadjqm(name, hash, requestData, selector); 1997 }, 1998 ajax: 1999 arAsproOptions["SITE_DIR"] + 2000 "ajax/form.php?form_id=" + 2001 form_id + 2002 (requestData.length ? "&" + requestData : ""), 2003 }); 2004 } 2005 $(open_trigger).dblclick(function () { 2006 return false; 2007 }); 2008 } 2009 2010 $(open_trigger).click(); 2011 $(open_trigger).remove(); 2012 }); 2013 return true; 2014 }; 2015} 2016 2017if (!funcDefined("replaceBasketPopup")) { 2018 function replaceBasketPopup(hash) { 2019 if (typeof hash != "undefined") { 2020 hash.w.hide(); 2021 hash.o.hide(); 2022 } 2023 } 2024} 2025 2026if (!funcDefined("waitLayer")) { 2027 function waitLayer(delay, callback) { 2028 if (typeof dataLayer !== "undefined" && typeof callback === "function") { 2029 callback(); 2030 } else { 2031 setTimeout(function () { 2032 waitLayer(delay, callback); 2033 }, delay); 2034 } 2035 } 2036} 2037 2038if (!funcDefined("checkCounters")) { 2039 function checkCounters(name) { 2040 if (typeof name !== "undefined") { 2041 if ( 2042 name == "google" && 2043 arAsproOptions["COUNTERS"]["GOOGLE_ECOMERCE"] == "Y" && 2044 arAsproOptions["COUNTERS"]["GOOGLE_COUNTER"] > 0 2045 ) { 2046 return true; 2047 } else if ( 2048 name == "yandex" && 2049 arAsproOptions["COUNTERS"]["YANDEX_ECOMERCE"] == "Y" && 2050 arAsproOptions["COUNTERS"]["YANDEX_COUNTER"] > 0 2051 ) { 2052 return true; 2053 } else { 2054 return false; 2055 } 2056 } else if ( 2057 (arAsproOptions["COUNTERS"]["YANDEX_ECOMERCE"] == "Y" && arAsproOptions["COUNTERS"]["YANDEX_COUNTER"] > 0) || 2058 (arAsproOptions["COUNTERS"]["GOOGLE_ECOMERCE"] == "Y" && arAsproOptions["COUNTERS"]["GOOGLE_COUNTER"] > 0) 2059 ) { 2060 return true; 2061 } else { 2062 return false; 2063 } 2064 } 2065} 2066 2067if (!funcDefined("addBasketCounter")) { 2068 function addBasketCounter(id) { 2069 if (arAsproOptions["COUNTERS"]["USE_BASKET_GOALS"] !== "N") { 2070 var eventdata = { goal: "goal_basket_add", params: { id: id } }; 2071 BX.onCustomEvent("onCounterGoals", [eventdata]); 2072 } 2073 if (checkCounters()) { 2074 $.ajax({ 2075 url: arAsproOptions["SITE_DIR"] + "ajax/goals.php", 2076 dataType: "json", 2077 type: "POST", 2078 data: { ID: id }, 2079 success: function (item) { 2080 if (!!item && !!item.ID) { 2081 let ecommerce = { 2082 items: [ 2083 { 2084 item_name: item.NAME, // Name or ID is required. 2085 item_id: item.ID, 2086 price: parseFloat(item.PRICE), 2087 item_brand: item.BRAND, 2088 item_category: item.CATEGORY, 2089 item_list_name: "List Results", 2090 item_list_id: item.IBLOCK_SECTION_ID, 2091 affiliation: item.SHOP_NAME, 2092 index: 1, 2093 quantity: parseFloat(item.QUANTITY), 2094 }, 2095 ], 2096 }; 2097 if (arAsproOptions["COUNTERS"]["GA_VERSION"] === "v3") { 2098 ecommerce = { 2099 currencyCode: item.CURRENCY, 2100 add: { 2101 products: [ 2102 { 2103 id: item.ID, 2104 name: item.NAME, 2105 price: parseFloat(item.PRICE), 2106 brand: item.BRAND, 2107 category: item.CATEGORY, 2108 quantity: parseFloat(item.QUANTITY), 2109 }, 2110 ], 2111 }, 2112 }; 2113 } 2114 waitLayer(100, function () { 2115 dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object. 2116 dataLayer.push({ 2117 // event: 'add_to_cart', 2118 event: arAsproOptions["COUNTERS"]["GOOGLE_EVENTS"]["ADD2BASKET"], 2119 currency: item.CURRENCY, 2120 value: parseFloat(item.PRICE), 2121 ecommerce: ecommerce, 2122 }); 2123 }); 2124 } 2125 }, 2126 }); 2127 } 2128 } 2129} 2130 2131if (!funcDefined("purchaseCounter")) { 2132 function purchaseCounter(order_id, type, callback) { 2133 if (checkCounters()) { 2134 $.ajax({ 2135 url: arAsproOptions["SITE_DIR"] + "ajax/goals.php", 2136 dataType: "json", 2137 type: "POST", 2138 data: { ORDER_ID: order_id, TYPE: type }, 2139 success: function (order) { 2140 var products = []; 2141 const items = []; 2142 if (order.ITEMS) { 2143 for (var i in order.ITEMS) { 2144 products.push({ 2145 id: order.ITEMS[i].ID, 2146 sku: order.ITEMS[i].ID, 2147 name: order.ITEMS[i].NAME, 2148 price: order.ITEMS[i].PRICE, 2149 brand: order.ITEMS[i].BRAND, 2150 category: order.ITEMS[i].CATEGORY, 2151 quantity: order.ITEMS[i].QUANTITY, 2152 }); 2153 items.push({ 2154 item_id: order.ITEMS[i].ID, 2155 item_name: order.ITEMS[i].NAME, 2156 price: parseFloat(order.ITEMS[i].PRICE), 2157 item_brand: order.ITEMS[i].BRAND, 2158 item_category: order.ITEMS[i].CATEGORY, 2159 affiliation: order.SHOP_NAME, 2160 quantity: parseFloat(order.ITEMS[i].QUANTITY), 2161 }); 2162 } 2163 } 2164 if (order.ID) { 2165 let ecommerce = { 2166 transaction_id: order.ACCOUNT_NUMBER, 2167 affiliation: order.SHOP_NAME, 2168 value: order.PRICE, 2169 tax: order.TAX_VALUE, 2170 shipping: order.PRICE_DELIVERY, 2171 currency: order.CURRENCY, 2172 items: items, 2173 }; 2174 if (arAsproOptions["COUNTERS"]["GA_VERSION"] === "v3") { 2175 ecommerce = { 2176 purchase: { 2177 actionField: { 2178 id: order.ACCOUNT_NUMBER, 2179 shipping: order.PRICE_DELIVERY, 2180 tax: order.TAX_VALUE, 2181 list: type, 2182 revenue: order.PRICE, 2183 }, 2184 products: products, 2185 }, 2186 }; 2187 } 2188 waitLayer(100, function () { 2189 dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object. 2190 dataLayer.push({ 2191 event: arAsproOptions["COUNTERS"]["GOOGLE_EVENTS"]["PURCHASE"], 2192 ecommerce: ecommerce, 2193 }); 2194 2195 if (typeof callback !== "undefined") { 2196 callback(ecommerce); 2197 } 2198 }); 2199 } else { 2200 if (typeof callback !== "undefined") { 2201 callback(); 2202 } 2203 } 2204 }, 2205 error: function () { 2206 if (typeof callback !== "undefined") { 2207 callback(); 2208 } 2209 }, 2210 }); 2211 } 2212 } 2213} 2214 2215if (!funcDefined("viewItemCounter")) { 2216 function viewItemCounter(id, price_id) { 2217 if (checkCounters()) { 2218 $.ajax({ 2219 url: arAsproOptions["SITE_DIR"] + "ajax/goals.php", 2220 dataType: "json", 2221 type: "POST", 2222 data: { PRODUCT_ID: id, PRICE_ID: price_id }, 2223 success: function (item) { 2224 if (item.ID) { 2225 let ecommerce = { 2226 items: [ 2227 { 2228 item_name: item.NAME, // Name or ID is required. 2229 item_id: item.ID, 2230 price: parseFloat(item.PRICE), 2231 item_brand: item.BRAND, 2232 item_category: item.CATEGORY, 2233 item_list_name: "List Results", 2234 item_list_id: item.IBLOCK_SECTION_ID, 2235 affiliation: item.SHOP_NAME, 2236 index: 1, 2237 quantity: parseFloat(item.QUANTITY), 2238 }, 2239 ], 2240 }; 2241 if (arAsproOptions["COUNTERS"]["GA_VERSION"] === "v3") { 2242 ecommerce = { 2243 detail: { 2244 products: [ 2245 { 2246 id: item.ID, 2247 name: item.NAME, 2248 price: parseFloat(item.PRICE), 2249 brand: item.BRAND, 2250 category: item.CATEGORY, 2251 }, 2252 ], 2253 }, 2254 }; 2255 } 2256 waitLayer(100, function () { 2257 dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object. 2258 dataLayer.push({ 2259 event: "view_item", 2260 currency: item.CURRENCY, 2261 value: parseFloat(item.PRICE), 2262 ecommerce: ecommerce, 2263 }); 2264 }); 2265 } 2266 }, 2267 }); 2268 } 2269 } 2270} 2271 2272if (!funcDefined("checkoutCounter")) { 2273 function checkoutCounter(step, option, callback) { 2274 if (checkCounters("google")) { 2275 $.ajax({ 2276 url: arAsproOptions["SITE_DIR"] + "ajax/goals.php", 2277 dataType: "json", 2278 type: "POST", 2279 data: { BASKET: "Y" }, 2280 success: function (basket) { 2281 var products = []; 2282 const items = []; 2283 let summ = 0; 2284 let currency = "RUB"; 2285 if (basket.ITEMS) { 2286 for (var i in basket.ITEMS) { 2287 products.push({ 2288 id: basket.ITEMS[i].ID, 2289 name: basket.ITEMS[i].NAME, 2290 price: basket.ITEMS[i].PRICE, 2291 brand: basket.ITEMS[i].BRAND, 2292 category: basket.ITEMS[i].CATEGORY, 2293 quantity: basket.ITEMS[i].QUANTITY, 2294 }); 2295 items.push({ 2296 item_id: basket.ITEMS[i].ID, 2297 item_name: basket.ITEMS[i].NAME, 2298 price: parseFloat(basket.ITEMS[i].PRICE), 2299 item_brand: basket.ITEMS[i].BRAND, 2300 item_category: basket.ITEMS[i].CATEGORY, 2301 affiliation: basket.SHOP_NAME, 2302 quantity: parseFloat(basket.ITEMS[i].QUANTITY), 2303 }); 2304 summ += basket.ITEMS[i].PRICE; 2305 currency = basket.ITEMS[i].CURRENCY; 2306 } 2307 } 2308 if (products) { 2309 let ecommerce = { 2310 items: items, 2311 }; 2312 if (arAsproOptions["COUNTERS"]["GA_VERSION"] === "v3") { 2313 ecommerce = { 2314 checkout: { 2315 actionField: { 2316 step: step, 2317 option: option, 2318 }, 2319 products: products, 2320 }, 2321 }; 2322 } 2323 waitLayer(100, function () { 2324 dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object. 2325 dataLayer.push({ 2326 event: arAsproOptions["COUNTERS"]["GOOGLE_EVENTS"]["CHECKOUT_ORDER"], 2327 currency: currency, 2328 value: parseFloat(summ), 2329 ecommerce: ecommerce, 2330 /*"eventCallback": function() { 2331 if((typeof callback !== 'undefined') && (typeof callback === 'function')){ 2332 callback(); 2333 } 2334 }*/ 2335 }); 2336 if (typeof callback !== "undefined" && typeof callback === "function") { 2337 callback(); 2338 } 2339 }); 2340 } 2341 }, 2342 }); 2343 } 2344 } 2345} 2346 2347if (!funcDefined("delFromBasketCounter")) { 2348 function delFromBasketCounter(id, callback) { 2349 if (checkCounters()) { 2350 $.ajax({ 2351 url: arAsproOptions["SITE_DIR"] + "ajax/goals.php", 2352 dataType: "json", 2353 type: "POST", 2354 data: { ID: id }, 2355 success: function (item) { 2356 if (item.ID) { 2357 let ecommerce = { 2358 items: [ 2359 { 2360 item_name: item.NAME, // Name or ID is required. 2361 item_id: item.ID, 2362 price: parseFloat(item.PRICE), 2363 item_brand: item.BRAND, 2364 item_category: item.CATEGORY, 2365 affiliation: item.SHOP_NAME, 2366 item_list_name: "List Results", 2367 }, 2368 ], 2369 }; 2370 if (arAsproOptions["COUNTERS"]["GA_VERSION"] === "v3") { 2371 ecommerce = { 2372 remove: { 2373 products: [ 2374 { 2375 id: item.ID, 2376 name: item.NAME, 2377 category: item.CATEGORY, 2378 }, 2379 ], 2380 }, 2381 }; 2382 } 2383 waitLayer(100, function () { 2384 dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object. 2385 dataLayer.push({ 2386 event: arAsproOptions["COUNTERS"]["GOOGLE_EVENTS"]["REMOVE_BASKET"], 2387 currency: item.CURRENCY, 2388 value: parseFloat(item.PRICE), 2389 ecommerce: ecommerce, 2390 }); 2391 if (typeof callback == "function") { 2392 callback(); 2393 } 2394 }); 2395 } 2396 }, 2397 }); 2398 } 2399 } 2400} 2401 2402if (!funcDefined("setHeightCompany")) { 2403 function setHeightCompany() { 2404 $(".md-50.img").height($(".md-50.big").outerHeight() - 35); 2405 } 2406} 2407 2408if (!funcDefined("initSly")) { 2409 function initSly() { 2410 /*var $frame = $(document).find('.frame'); 2411 var $slidee = $frame.children('ul').eq(0); 2412 var $wrap = $frame.parent(); 2413 2414 if(arAsproOptions["PAGES"]["CATALOG_PAGE"] && $frame.length){ 2415 $frame.sly({ 2416 horizontal: 1, 2417 itemNav: 'basic', 2418 smart: 1, 2419 mouseDragging: 0, 2420 touchDragging: 0, 2421 releaseSwing: 0, 2422 startAt: 0, 2423 scrollBar: $wrap.find('.scrollbar'), 2424 scrollBy: 1, 2425 speed: 300, 2426 elasticBounds: 0, 2427 easing: 'swing', 2428 dragHandle: 1, 2429 dynamicHandle: 1, 2430 clickBar: 1, 2431 2432 // Buttons 2433 forward: $wrap.find('.forward'), 2434 backward: $wrap.find('.backward'), 2435 }); 2436 $frame.sly('reload'); 2437 }*/ 2438 } 2439} 2440 2441if (!funcDefined("createTableCompare")) { 2442 function createTableCompare(originalTable, appendDiv, cloneTable) { 2443 try { 2444 var clone = originalTable.clone().removeAttr("id").addClass("clone"); 2445 if (cloneTable.length) { 2446 cloneTable.remove(); 2447 appendDiv.html(""); 2448 appendDiv.html(clone); 2449 } else { 2450 appendDiv.append(clone); 2451 } 2452 } catch (e) { 2453 } finally { 2454 } 2455 } 2456} 2457 2458if (!funcDefined("fillBasketPropsExt")) { 2459 fillBasketPropsExt = function (that, prop_code, basket_prop_div) { 2460 var i = 0, 2461 propCollection = null, 2462 foundValues = false, 2463 basketParams = {}, 2464 obBasketProps = null; 2465 2466 obBasketProps = BX(basket_prop_div); 2467 if (!obB
2467asketProps && that.closest(".item").find(".basket_props_block").length && that.data("offers") !== "Y") 2468 obBasketProps = that.closest(".item").find(".basket_props_block")[0]; 2469 2470 if (!!obBasketProps) { 2471 propCollection = obBasketProps.getElementsByTagName("select"); 2472 if (!!propCollection && !!propCollection.length) { 2473 for (i = 0; i < propCollection.length; i++) { 2474 if (!propCollection[i].disabled) { 2475 switch (propCollection[i].type.toLowerCase()) { 2476 case "select-one": 2477 basketParams[propCollection[i].name] = propCollection[i].value; 2478 foundValues = true; 2479 break; 2480 default: 2481 break; 2482 } 2483 } 2484 } 2485 } 2486 propCollection = obBasketProps.getElementsByTagName("input"); 2487 if (!!propCollection && !!propCollection.length) { 2488 for (i = 0; i < propCollection.length; i++) { 2489 if (!propCollection[i].disabled) { 2490 switch (propCollection[i].type.toLowerCase()) { 2491 case "hidden": 2492 basketParams[propCollection[i].name] = propCollection[i].value; 2493 foundValues = true; 2494 break; 2495 case "radio": 2496 if (propCollection[i].checked) { 2497 basketParams[propCollection[i].name] = propCollection[i].value; 2498 foundValues = true; 2499 } 2500 break; 2501 default: 2502 break; 2503 } 2504 } 2505 } 2506 } 2507 } 2508 if (!foundValues) { 2509 basketParams[prop_code] = []; 2510 basketParams[prop_code][0] = 0; 2511 } 2512 return basketParams; 2513 }; 2514} 2515if (!funcDefined("showBasketError")) { 2516 showBasketError = function (mess, title, addButton, th, callback) { 2517 var title_set = title ? title : BX.message("ERROR_BASKET_TITLE"), 2518 isButton = "N", 2519 thButton = ""; 2520 if (typeof addButton !== undefined) { 2521 isButton = "Y"; 2522 } 2523 if (typeof th !== undefined) { 2524 thButton = th; 2525 } 2526 $("body").append("<span class='add-error-bakset' style='display:none;'></span>"); 2527 jqmEd("basket_error", "error-bakset", ".add-error-bakset", mess, this, title_set, isButton, thButton); 2528 2529 if (typeof callback === "function") { 2530 callback(); 2531 } 2532 }; 2533} 2534 2535CheckTopVisibleMenu = function (that) { 2536 var dropdownMenu = $(".dropdown-menu:visible"); 2537 if (that !== undefined) { 2538 dropdownMenu.push(that); 2539 } 2540 2541 if (dropdownMenu.length) { 2542 dropdownMenu.each(function (i, el) { 2543 var dropdownMenuCurrent = $(el); 2544 dropdownMenuCurrent.find("a").css("white-space", ""); 2545 dropdownMenuCurrent.css("left", ""); 2546 dropdownMenuCurrent.css("right", ""); 2547 dropdownMenuCurrent.removeClass("toright"); 2548 2549 var dropdownMenuCurrent_left = dropdownMenuCurrent.offset().left; 2550 2551 if (typeof dropdownMenuCurrent_left != "undefined") { 2552 var menu = dropdownMenuCurrent.parents(".mega-menu"); 2553 if (!menu.length) menu = dropdownMenuCurrent.closest(".logo-row"); 2554 var menu_width = menu.outerWidth(); 2555 var menu_left = menu.offset().left; 2556 var menu_right = menu_left + menu_width; 2557 var isToRight = dropdownMenuCurrent.parents(".toright").length > 0; 2558 var parentsdropdownMenuCurrents = dropdownMenuCurrent.parents(".dropdown-menu"); 2559 var isHasParentdropdownMenuCurrent = parentsdropdownMenuCurrents.length > 0; 2560 if (isHasParentdropdownMenuCurrent) { 2561 var parentdropdownMenuCurrent_width = parentsdropdownMenuCurrents.first().outerWidth(); 2562 var parentdropdownMenuCurrent_left = parentsdropdownMenuCurrents.first().offset().left; 2563 var parentdropdownMenuCurrent_right = parentdropdownMenuCurrent_width + parentdropdownMenuCurrent_left; 2564 } 2565 2566 if (parentdropdownMenuCurrent_right + dropdownMenuCurrent.outerWidth() > menu_right) { 2567 dropdownMenuCurrent.find("a").css("white-space", "normal"); 2568 } 2569 2570 var dropdownMenuCurrent_width = dropdownMenuCurrent.outerWidth(); 2571 var dropdownMenuCurrent_right = dropdownMenuCurrent_left + dropdownMenuCurrent_width; 2572 2573 if (dropdownMenuCurrent_right > menu_right || isToRight) { 2574 var addleft = 0; 2575 addleft = menu_right - dropdownMenuCurrent_right; 2576 if (isHasParentdropdownMenuCurrent || isToRight) { 2577 dropdownMenuCurrent.css("left", "auto"); 2578 dropdownMenuCurrent.css("right", "100%"); 2579 dropdownMenuCurrent.addClass("toright"); 2580 } else { 2581 var dropdownMenuCurrent_curLeft = parseInt(dropdownMenuCurrent.css("left")); 2582 dropdownMenuCurrent.css("left", dropdownMenuCurrent_curLeft + addleft + "px"); 2583 } 2584 } 2585 } 2586 }); 2587 } 2588}; 2589 2590if (!funcDefined("isRealValue")) { 2591 function isRealValue(obj) { 2592 return obj && obj !== "null" && obj !== "undefined"; 2593 } 2594} 2595 2596if (!funcDefined("rightScroll")) { 2597 function rightScroll(prop, id) { 2598 var el = BX("prop_" + prop + "_" + id); 2599 if (el) { 2600 var curVal = parseInt(el.style.marginLeft); 2601 if (curVal >= 0) el.style.marginLeft = curVal - 20 + "%"; 2602 } 2603 } 2604} 2605 2606if (!funcDefined("leftScroll")) { 2607 function leftScroll(prop, id) { 2608 var el = BX("prop_" + prop + "_" + id); 2609 if (el) { 2610 var curVal = parseInt(el.style.marginLeft); 2611 if (curVal < 0) el.style.marginLeft = curVal + 20 + "%"; 2612 } 2613 } 2614} 2615 2616if (!funcDefined("InitOrderCustom")) { 2617 InitOrderCustom = function () { 2618 $(".ps_logo img").wrap('<div class="image"></div>'); 2619 2620 $("#bx-soa-order .radio-inline").each(function () { 2621 if ($(this).find("input").attr("checked") == "checked") { 2622 $(this).addClass("checked"); 2623 } 2624 }); 2625 2626 $("#bx-soa-order .checkbox input[type=checkbox]").each(function () { 2627 if ($(this).attr("checked") == "checked") $(this).parent().addClass("checked"); 2628 }); 2629 2630 $("#bx-soa-order .bx-authform-starrequired").each(function () { 2631 var html = $(this).html(); 2632 $(this) 2633 .closest("label") 2634 .append('<span class="bx-authform-starrequired"> ' + html + "</span>"); 2635 $(this).detach(); 2636 }); 2637 $(".bx_ordercart_coupon").each(function () { 2638 if ($(this).find(".bad").length) $(this).addClass("bad"); 2639 else if ($(this).find(".good").length) $(this).addClass("good"); 2640 }); 2641 /*if (typeof(propsMap) !== 'undefined') { 2642 $(propsMap).on('click', function () { 2643 var value = $('#orderDescription').val(); 2644 if ($('#orderDescription')) { 2645 if (value != '') { 2646 $('#orderDescription').closest('.form-group').addClass('value_y'); 2647 } 2648 } 2649 }); 2650 }*/ 2651 }; 2652} 2653 2654if (!funcDefined("InitLabelAnimation")) { 2655 InitLabelAnimation = function (className) { 2656 // Fix order labels 2657 if (!$(className).length) { 2658 return; 2659 } 2660 $(className) 2661 .find(".form-group") 2662 .each(function () { 2663 if ( 2664 $(this).find("input[type=text], textarea").length && 2665 !$(this).find(".dropdown-block").length && 2666 $(this).find("input[type=text], textarea").val() != "" 2667 ) { 2668 $(this).addClass("value_y"); 2669 } 2670 }); 2671 2672 $(document).on("click", className + " .form-group:not(.bx-soa-pp-field) label", function () { 2673 $(this).parent().find("input, textarea").focus(); 2674 }); 2675 2676 $(document).on( 2677 "focusout", 2678 className + 2679 " .form-group:not(.bx-soa-pp-field) input, " + 2680 className + 2681 " .form-group:not(.bx-soa-pp-field) textarea", 2682 function () { 2683 var value = $(this).val(); 2684 if ( 2685 value != "" && 2686 !$(this).closest(".form-group").find(".dropdown-block").length && 2687 !$(this).closest(".form-group").find("#profile_change").length 2688 ) { 2689 $(this).closest(".form-group").addClass("value_y"); 2690 } else { 2691 $(this).closest(".form-group").removeClass("value_y"); 2692 } 2693 } 2694 ); 2695 2696 $(document).on( 2697 "focus", 2698 className + 2699 " .form-group:not(.bx-soa-pp-field) input, " + 2700 className + 2701 " .form-group:not(.bx-soa-pp-field) textarea", 2702 function () { 2703 if ( 2704 !$(this).closest(".form-group").find(".dropdown-block").length && 2705 !$(this).closest(".form-group").find("#profile_change").length && 2706 !$(this).closest(".form-group").find("[name=PERSON_TYPE_OLD]").length 2707 ) { 2708 $(this).closest(".form-group").addClass("value_y"); 2709 } 2710 } 2711 ); 2712 }; 2713} 2714 2715function loadScrollTabs(selector, callback) { 2716 $(selector).iAppear(() => { 2717 BX.loadScript([arAsproOptions["SITE_TEMPLATE_PATH"] + "/js/scrollTabs.js?v=1"], function () { 2718 callback(); 2719 }); 2720 }); 2721} 2722 2723checkCaptchaWidth = function () { 2724 $(".captcha-row").each(function () { 2725 var width = $(this).actual("width"); 2726 if ($(this).hasClass("b")) { 2727 if (width > 320) { 2728 $(this).removeClass("b"); 2729 } 2730 } else { 2731 if (width <= 320) { 2732 $(this).addClass("b"); 2733 } 2734 } 2735 }); 2736}; 2737 2738checkFormWidth = function () { 2739 $(".form .form_left").each(function () { 2740 var form = $(this).parents(".form"); 2741 var width = form.actual("width"); 2742 if (form.hasClass("b")) { 2743 if (width > 417) { 2744 form.removeClass("b"); 2745 } 2746 } else { 2747 if (width <= 417) { 2748 form.addClass("b"); 2749 } 2750 } 2751 }); 2752}; 2753 2754checkFormControlWidth = function () { 2755 $(".form-control").each(function () { 2756 var width = $(this).actual("width"); 2757 var labelWidth = $(this).find("label:not(.error) > span").actual("width"); 2758 var errorWidth = $(this).find("label.error").actual("width"); 2759 if (errorWidth > 0) { 2760 if ($(this).hasClass("h")) { 2761 if (width > labelWidth + errorWidth + 5) { 2762 $(this).removeClass("h"); 2763 } 2764 } else { 2765 if (width <= labelWidth + errorWidth + 5) { 2766 $(this).addClass("h"); 2767 } 2768 } 2769 } else { 2770 $(this).removeClass("h"); 2771 } 2772 }); 2773}; 2774 2775scrollToTop = function () { 2776 if (arAsproOptions["THEME"]["SCROLLTOTOP_TYPE"] !== "NONE") { 2777 var _isScrolling = false;
2778 // Append Button 2779 $("body").append( 2780 $("<a />") 2781 .addClass( 2782 "scroll-to-top " + 2783 arAsproOptions["THEME"]["SCROLLTOTOP_TYPE"] + 2784 " " + 2785 arAsproOptions["THEME"]["SCROLLTOTOP_POSITION"] 2786 ) 2787 .attr({ href: "#", id: "scrollToTop" }) 2788 ); 2789 2790 if (arAsproOptions["THEME"]["SCROLLTOTOP_POSITION_BOTTOM"]) { 2791 $("#scrollToTop").css("bottom", +arAsproOptions["THEME"]["SCROLLTOTOP_POSITION_BOTTOM"] + "px"); 2792 } 2793 2794 if (arAsproOptions["THEME"]["SCROLLTOTOP_POSITION_RIGHT"]) { 2795 $("#scrollToTop").css("right", +arAsproOptions["THEME"]["SCROLLTOTOP_POSITION_RIGHT"] + "px"); 2796 } 2797 2798 $("#scrollToTop").click(function (e) { 2799 e.preventDefault(); 2800 $("body, html").animate({ scrollTop: 0 }, 500); 2801 return false; 2802 }); 2803 // Show/Hide Button on Window Scroll event. 2804 $(window).scroll(function () { 2805 if (!_isScrolling) { 2806 _isScrolling = true; 2807 if (documentScrollTopLast > 150) { 2808 $("#scrollToTop").stop(true, true).addClass("visible"); 2809 _isScrolling = false; 2810 } else { 2811 $("#scrollToTop").stop(true, true).removeClass("visible"); 2812 _isScrolling = false; 2813 } 2814 checkScrollToTop(); 2815 } 2816 }); 2817 } 2818}; 2819 2820checkScrollToTop = function () { 2821 if (arAsproOptions["THEME"] && arAsproOptions["THEME"]["SCROLLTOTOP_POSITION_BOTTOM"]) 2822 var bottom = +arAsproOptions["THEME"]["SCROLLTOTOP_POSITION_BOTTOM"]; 2823 else var bottom = 55; 2824 2825 var scrollVal = documentScrollTopLast, 2826 windowHeight = document.documentElement.offsetHeight, 2827 footerOffset = 0; 2828 if ($("footer").length) footerOffset = $("footer .footer-inner").offset().top; 2829 2830 if (arAsproOptions["THEME"] && arAsproOptions["THEME"]["SCROLLTOTOP_POSITION"] == "CONTENT") { 2831 warpperWidth = $("body > .wrapper > .wrapper_inner").width(); 2832 $("#scrollToTop").css("margin-left", Math.ceil(warpperWidth / 2) + 23); 2833 } 2834 2835 if (scrollVal + windowHeight > footerOffset) { 2836 $("#scrollToTop").css("bottom", Math.round(bottom + scrollVal + windowHeight - footerOffset) + "px"); 2837 } else if (parseInt($("#scrollToTop").css("bottom")) > bottom) { 2838 $("#scrollToTop").css("bottom", Math.round(bottom)); 2839 } 2840}; 2841 2842CheckObjectsSizes = function () { 2843 $(".container iframe,.container object,.container video").each(function () { 2844 var height_attr = $(this).attr("height"); 2845 var width_attr = $(this).attr("width"); 2846 if (height_attr && width_attr) { 2847 $(this).css("height", ($(this).outerWidth() * height_attr) / width_attr); 2848 } 2849 }); 2850}; 2851 2852if (!funcDefined("reloadTopBasket")) { 2853 var reloadTopBasket = function reloadTopBasket(action, basketWindow, speed, delay, slideDown, item, sync) { 2854 var obj = { 2855 PARAMS: $("#top_basket_params").val(), 2856 ACTION: action, 2857 }; 2858 if (typeof item !== "undefined" && item) { 2859 obj.delete_top_item = "Y"; 2860 obj.delete_top_item_id = item.data("id"); 2861 } 2862 // $.post( arAsproOptions['SITE_DIR']+"ajax/show_basket_popup.php", obj, $.proxy(function( data ){ 2863 $.post( 2864 arAsproOptions["SITE_DIR"] + "ajax/show_basket_actual.php", 2865 obj, 2866 $.proxy(function (data) { 2867 $(basketWindow).html(data); 2868 2869 //getActualBasket('', '', sync); 2870 2871 getActualBasket("", "Compare", sync); //need for actual compare count when do opt action 2872 2873 var eventdata = { action: "loadBasket" }; 2874 BX.onCustomEvent("onCompleteAction", [eventdata]); 2875 }) 2876 ); 2877 }; 2878} 2879 2880CheckTabActive = function () { 2881 if (typeof clicked_tab && clicked_tab) { 2882 if (window.matchMedia("(min-width: 768px)").matches) { 2883 clicked_tab--; 2884 $(".nav.nav-tabs li").each(function () { 2885 if ($(this).index() == clicked_tab) $(this).addClass("active"); 2886 }); 2887 // $('.nav.nav-tabs li:eq('+clicked_tab+')').addClass('active'); 2888 $(".catalog_detail .tab-content .tab-pane:eq(" + clicked_tab + ")").addClass("active"); 2889 $(".catalog_detail .tab-content .tab-pane .title-tab-heading").next().removeAttr("style"); 2890 clicked_tab = 0; 2891 } 2892 } 2893}; 2894 2895/*countdown start*/ 2896if (!funcDefined("initCountdown")) { 2897 var initCountdown = function initCountdown() { 2898 if (typeof $.fn.countdown !== 'function') 2899 return;
2900 if ($(".view_sale_block").length) { 2901 $(".view_sale_block").each(function () { 2902 var _this = $(this); 2903 if (_this.hasClass("init-if-visible") && !_this.is(":visible")) return; 2904 2905 var activeTo = _this.find(".active_to").text(), 2906 dateTo = new Date(activeTo.replace(/(\d+)\.(\d+)\.(\d+)/, "$3/$2/$1")); 2907 if (_this.hasClass("compact")) 2908 _this.find(".countdown").countdown( 2909 { 2910 until: dateTo, 2911 format: "dHMS", 2912 compact: true, 2913 padZeroes: true, 2914 layout: 2915 '{d<}<span class="days item">{dn}<div class="text">{dl}</div></span>{d>} <span class="hours item">{hn}<div class="text">{hl}</div></span> <span class="minutes item">{mn}<div class="text">{ml}</div></span> <span class="sec item">{sn}<div class="text">{sl}</div></span>', 2916 }, 2917 $.countdown.regionalOptions["ru"] 2918 ); 2919 else 2920 _this.find(".countdown").countdown( 2921 { 2922 until: dateTo, 2923 format: "dHMS", 2924 padZeroes: true, 2925 layout: 2926 '{d<}<span class="days item">{dnn}<div class="text">{dl}</div></span>{d>} <span class="hours item">{hnn}<div class="text">{hl}</div></span> <span class="minutes item">{mnn}<div class="text">{ml}</div></span> <span class="sec item">{snn}<div class="text">{sl}</div></span>', 2927 }, 2928 $.countdown.regionalOptions["ru"] 2929 ); 2930 }); 2931 } 2932 }; 2933} 2934 2935if (!funcDefined("initCountdownTime")) { 2936 var initCountdownTime = function initCountdownTime(block, time) { 2937 if (typeof $.fn.countdown !== 'function') 2938 return; 2939 if (time) { 2940 var dateTo = new Date(time.replace(/(\d+)\.(\d+)\.(\d+)/, "$3/$2/$1")); 2941 block.find(".countdown").countdown("destroy"); 2942 if (block.hasClass("compact")) 2943 block.find(".countdown").countdown( 2944 { 2945 until: dateTo, 2946 format: "dHM", 2947 compact: true, 2948 padZeroes: true, 2949 layout: 2950 '{d<}<span class="days item">{dn}<div class="text">{dl}</div></span>{d>} <span class="hours item">{hn}<div class="text">{hl}</div></span> <span class="minutes item">{mn}<div class="text">{ml}</div></span> <span class="sec item">{sn}<div class="text">{sl}</div></span>', 2951 }, 2952 $.countdown.regionalOptions["ru"] 2953 ); 2954 else 2955 block.find(".countdown").countdown( 2956 { 2957 until: dateTo, 2958 format: "dHMS", 2959 padZeroes: true, 2960 layout: 2961 '{d<}<span class="days item">{dnn}<div class="text">{dl}</div></span>{d>} <span class="hours item">{hnn}<div class="text">{hl}</div></span> <span class="minutes item">{mnn}<div class="text">{ml}</div></span> <span class="sec item">{snn}<div class="text">{sl}</div></span>', 2962 }, 2963 $.countdown.regionalOptions["ru"] 2964 ); 2965 block.find(".view_sale_block").show(); 2966 } else { 2967 block.find(".view_sale_block").hide(); 2968 } 2969 }; 2970} 2971/*countdown end*/ 2972 2973waitCounter = function (idCounter, delay, callback) { 2974 var obCounter = window["yaCounter" + idCounter]; 2975 if (typeof obCounter == "object") { 2976 if (typeof callback == "function") callback(); 2977 } else { 2978 setTimeout(function () { 2979 waitCounter(idCounter, delay, callback); 2980 }, delay); 2981 } 2982}; 2983 2984var isOnceInited = (insertFilter = false); 2985var animationTime = 200; 2986var delayTime = 200; 2987var topMenuEnterTimer = false; 2988var previewMode = window != window.top; 2989var isMobile = window.matchMedia("(max-width:991px)").matches; 2990if (isMobile) document.documentElement.className += " mobile"; 2991if (previewMode) document.documentElement.className += " previewMode"; 2992 2993if (navigator.userAgent.indexOf("Edge") != -1) document.documentElement.className += " bx-ie-edge"; 2994 2995/*filter start*/ 2996if (!funcDefined("checkVerticalMobileFilter")) { 2997 var checkVerticalMobileFilter = function checkVerticalMobileFilter() { 2998 /*if($('.right_block1.catalog.vertical').length && !$('.left_block.filter_ajax').length) 2999 { 3000 if(typeof window['trackBarOptions'] !== 'undefined') 3001 { 3002 window['trackBarValues'] = {} 3003 for(key in window['trackBarOptions']) 3004 { 3005 window['trackBarValues'][key] = { 3006 'leftPercent': window['trackBar' + key].leftPercent, 3007 'leftValue': window['trackBar' + key].minInput.value, 3008 'rightPercent': window['trackBar' + key].rightPercent, 3009 'rightValue': window['trackBar' + key].maxInput.value, 3010 } 3011 } 3012 } 3013 3014 if(window.matchMedia('(max-width: 991px)').matches) 3015 { 3016 if(!insertFilter) 3017 { 3018 $('.js_filter .bx_filter.bx_filter_vertical').html($('.left_block .bx_filter.bx_filter_vertical').html()); 3019 $('.left_block .bx_filter.bx_filter_vertical .bx_filter_section').remove(); 3020 insertFilter=true; 3021 } 3022 } 3023 else 3024 { 3025 if(insertFilter) 3026 { 3027 $('.left_block .bx_filter.bx_filter_vertical').html($('.js_filter .bx_filter.bx_filter_vertical').html()); 3028 $('.js_filter .bx_filter.bx_filter_vertical .bx_filter_section').remove(); 3029 insertFilter=false; 3030 } 3031 } 3032 3033 if(typeof window['trackBarOptions'] !== 'undefined') 3034 { 3035 for(key in window['trackBarOptions']) 3036 { 3037 window['trackBarOptions'][key].leftPercent = window['trackBarValues'][key].leftPercent; 3038 window['trackBarOptions'][key].rightPercent = window['trackBarValues'][key].rightPercent; 3039 window['trackBarOptions'][key].curMinPrice = window['trackBarValues'][key].leftValue; 3040 window['trackBarOptions'][key].curMaxPrice = window['trackBarValues'][key].rightValue; 3041 window['trackBar' + key] = new BX.Iblock.SmartFilter(window['trackBarOptions'][key]); 3042 window['trackBar' + key].minInput.value = window['trackBarValues'][key].leftValue; 3043 window['trackBar' + key].maxInput.value = window['trackBarValues'][key].rightValue; 3044 } 3045 } 3046 } 3047 else if($('.visible_mobile_filter').length) 3048 { 3049 var posTopBlock = BX.pos($('.detail.partners')[0]), 3050 posBlock = $('.ajax_load').position(); 3051 // $('.visible_mobile_filter').css('top', posBottomBlock.top-posTopBlock.top); 3052 $('.visible_mobile_filter').css('top', posBlock.top); 3053 3054 }*/ 3055 }; 3056} 3057/*filter end*/ 3058 3059// ONE CLICK 3060if (!funcDefined("oneClickBuy")) { 3061 var oneClickBuy = function (elementID, iblockID, that) { 3062 var name = "one_click_buy"; 3063 var elementQuantity = 1; 3064 var offerProps = false;
3065 var buy_btn = $(that).closest(".buy_block").find(".to-cart"); 3066 var buy_btn2 = $(that).closest("tr").find(".to-cart"); 3067 var buy_btn3 = $(that).closest(".item").find(".to-cart"); 3068 3069 if (typeof that !== "undefined") { 3070 elementQuantity = $(that).attr("data-quantity"); 3071 offerProps = $(that).attr("data-props"); 3072 } 3073 3074 if (elementQuantity < 0) { 3075 elementQuantity = 1; 3076 } 3077 3078 var tmp_props = buy_btn.data("props") || buy_btn2.data("props") || buy_btn3.data("props"), 3079 props = "", 3080 part_props = "", 3081 add_props = "N", 3082 fill_prop = {}, 3083 iblockid = buy_btn.data("iblockid"), 3084 item = buy_btn.attr("data-item"); 3085 3086 if (tmp_props) { 3087 props = tmp_props.split(";"); 3088 } 3089 if (buy_btn.data("part_props")) { 3090 part_props = buy_btn.data("part_props"); 3091 } 3092 if (buy_btn.data("add_props")) { 3093 add_props = buy_btn.data("add_props"); 3094 } 3095 3096 fill_prop = fillBasketPropsExt(buy_btn, "prop", buy_btn.data("bakset_div")); 3097 fill_prop.iblockID = iblockid; 3098 fill_prop.part_props = part_props; 3099 fill_prop.add_props = add_props; 3100 fill_prop.props = JSON.stringify(props); 3101 fill_prop.item = item; 3102 fill_prop.ocb_item = "Y"; 3103 3104 // if (!isMobile) { 3105 if (!$(that).hasClass("clicked")) { 3106 $(that).addClass("clicked"); 3107 $("body") 3108 .find("." + name + "_frame") 3109 .remove(); 3110 $("body") 3111 .find("." + name + "_trigger") 3112 .remove(); 3113 $("body #popup_iframe_wrapper").append('<div class="' + name + '_frame popup"></div>'); 3114 $("body #popup_iframe_wrapper").append('<div class="' + name + '_trigger"></div>'); 3115 3116 loadJQM(() => { 3117 $("." + name + "_frame").jqm({ 3118 trigger: "." + name + "_trigger", 3119 onHide: function (hash) { 3120 onHidejqm(name, hash); 3121 }, 3122 toTop: false, 3123 onLoad: function (hash) { 3124 onLoadjqm(name, hash, "", false, false, false, that); 3125 }, 3126 ajax: 3127 arAsproOptions["SITE_DIR"] + 3128 "ajax/one_click_buy.php?ELEMENT_ID=" + 3129 elementID + 3130 "&IBLOCK_ID=" + 3131 iblockID + 3132 "&ELEMENT_QUANTITY=" + 3133 elementQuantity + 3134 "&OFFER_PROPS=" + 3135 fill_prop.props, 3136 }); 3137 3138 $("." + name + "_trigger").click(); 3139 }); 3140 } 3141 }; 3142} 3143 3144if (!funcDefined("oneClickBuyBasket")) { 3145 var oneClickBuyBasket = function () { 3146 const name = "one_click_buy_basket"; 3147 if (!$(".fast_order").hasClass("clicked")) { 3148 $(".fast_order").addClass("clicked"); 3149 $("body ." + name + "_frame").remove(); 3150 $("body ." + name + "_trigger").remove(); 3151 $("body #popup_iframe_wrapper").append( 3152 '<div class="' + name + '_frame popup"></div>', 3153 '<div class="' + name + '_trigger"></div>' 3154 ); 3155 3156 loadJQM(() => { 3157 $("." + name + "_frame").jqm({ 3158 trigger: "." + name + "_trigger", 3159 onHide: function (hash) { 3160 onHidejqm(name, hash); 3161 }, 3162 onLoad: function (hash) { 3163 onLoadjqm(name, hash); 3164 }, 3165 ajax: arAsproOptions["SITE_DIR"] + "ajax/one_click_buy_basket.php", 3166 }); 3167 3168 $("." + name + "_trigger").click(); 3169 }); 3170 } 3171 }; 3172} 3173 3174// TOP MENU ANIMATION 3175$(document).on("click", ".menu_top_block>li .more a", function () { 3176 $this = $(this); 3177 $this.parents(".dropdown").first().find(">.hidden").removeClass("hidden"); 3178 $this.parent().addClass("hidden"); 3179 setTimeout(function () { 3180 $this.parent().remove(); 3181 }, 500); 3182}); 3183 3184$(document).on("mouseenter", ".menu_top_block.catalogfirst>li>.dropdown>li.full", function () { 3185 var $submenu = $(this).find(">.dropdown"); 3186 3187 if ($submenu.length) { 3188 if (topMenuEnterTimer) { 3189 clearTimeout(topMenuEnterTimer); 3190 topMenuEnterTimer = false; 3191 } 3192 } 3193}); 3194 3195$(document).on("mouseenter", ".menu_top_block>li:not(.full)", function () { 3196 var $submenu = $(this).find(">.dropdown"); 3197 3198 if ($submenu.length && !$submenu.hasClass("visible")) { 3199 var $menu = $(this).parents(".menu"); 3200 var $wrapmenu = $menu.parents(".wrap_menu"); 3201 var wrapMenuWidth = $wrapmenu.actual("outerWidth"); 3202 var wrapMenuLeft = $wrapmenu.offset().left; 3203 var wrapMenuRight = wrapMenuLeft + wrapMenuWidth; 3204 var left = wrapMenuRight - ($(this).offset().left + $submenu.actual("outerWidth")); 3205 if ( 3206 window.matchMedia("(min-width: 951px)").matches && 3207 $(this).hasClass("catalog") && 3208 ($(".banner_auto").hasClass("catalog_page") || $(".banner_auto").hasClass("front_page")) 3209 ) { 3210 return; 3211 } 3212 if (left < 0) { 3213 $submenu.css({ left: left + "px" }); 3214 } 3215 $submenu.stop().slideDown(animationTime, function () { 3216 $submenu.css({ height: "", overflow: "visible" }); 3217 }); 3218 3219 $(this).on("mouseleave", function () { 3220 var leaveTimer = setTimeout(function () { 3221 $submenu.stop().slideUp(animationTime, function () { 3222 $submenu.css({ left: "" }); 3223 }); 3224 }, delayTime); 3225 3226 $(this).on("mouseenter", function () { 3227 if (leaveTimer) { 3228 clearTimeout(leaveTimer); 3229 leaveTimer = false;
3230 } 3231 }); 3232 }); 3233 } 3234}); 3235 3236$(document).on("mouseenter", ".menu_top_block>li .dropdown>li", function () { 3237 var $this = $(this); 3238 var $submenu = $this.find(">.dropdown"); 3239 3240 if ( 3241 $submenu.length && 3242 ((!$this.parents(".full").length && !$this.hasClass("full")) || $this.parents(".more").length) 3243 ) { 3244 var $menu = $this.parents(".menu"); 3245 var $wrapmenu = $menu.parents(".wrap_menu"); 3246 var arParentSubmenuForOpacity = []; 3247 topMenuEnterTimer = setTimeout(function () { 3248 var wrapMenuWidth = $wrapmenu.actual("outerWidth"); 3249 var wrapMenuLeft = $wrapmenu.offset().left; 3250 var wrapMenuRight = wrapMenuLeft + wrapMenuWidth; 3251 var $parentSubmenu = $this.parent(); 3252 var bToLeft = $parentSubmenu.hasClass("toleft") ? true : false; 3253 if (!bToLeft) { 3254 bToLeft = $this.offset().left + $this.actual("outerWidth") + $submenu.actual("outerWidth") > wrapMenuRight; 3255 } else { 3256 bToLeft = $this.offset().left + $this.actual("outerWidth") - $submenu.actual("outerWidth") < wrapMenuLeft; 3257 } 3258 3259 if (bToLeft) { 3260 $this.find(">.dropdown").addClass("toleft").show(); 3261 } else { 3262 $this.find(">.dropdown").removeClass("toleft").show(); 3263 } 3264 var submenuLeft = $submenu.offset().left; 3265 var submenuRight = submenuLeft + $submenu.actual("outerWidth"); 3266 3267 $this.parents(".dropdown").each(function () { 3268 var $this = $(this); 3269 var leftOffset = $this.offset().left; 3270 var rightOffset = leftOffset + $this.actual("outerWidth"); 3271 if ( 3272 (leftOffset >= submenuLeft && leftOffset < submenuRight - 1) || 3273 (rightOffset > submenuLeft + 1 && rightOffset <= submenuRight) 3274 ) { 3275 arParentSubmenuForOpacity.push($this); 3276 $this.find(">li>a").css({ opacity: "0.1" }); 3277 } 3278 }); 3279 }, delayTime); 3280 3281 $this.unbind("mouseleave"); 3282 $this.on("mouseleave", function () { 3283 var leaveTimer = setTimeout(function () { 3284 $this.find(".dropdown").removeClass("toleft").hide(); 3285 if (arParentSubmenuForOpacity.length) { 3286 for (i in arParentSubmenuForOpacity) { 3287 arParentSubmenuForOpacity[i].find(">li>a").css({ opacity: "" }); 3288 } 3289 } 3290 }, delayTime); 3291 3292 $this.unbind("mouseenter"); 3293 $this.on("mouseenter", function () { 3294 if (leaveTimer) { 3295 clearTimeout(leaveTimer); 3296 leaveTimer = false; 3297 } 3298 }); 3299 }); 3300 } 3301});
3302CheckFlexSlider = function () {}; 3303 3304InitScrollBar = function (el, initOptions) {}; 3305InitCustomScrollBar = function (el) {}; 3306 3307/* slider gallery for fancybox */ 3308const InitFancyboxThumbnailsGallery = function (instance) { 3309 if ( 3310 $(".fancybox-thumbs") && 3311 $(".fancybox-thumbs__list a").length > 1 && 3312 !$(".fancybox-thumbs .swiper").length && 3313 typeof initSwiperSlider === "function" 3314 ) { 3315 // update preview when lazyloaded 3316 3317 instance.Thumbs.$grid.find(".fancybox-thumbs__list a").each(function (i, el) { 3318 const path = instance.group[i].thumb || instance.group[i].src; 3319 3320 $(el).css("background-image", "url('" + encodeURI(path) + "')"); 3321 }); 3322 const SLIDER_RESIZE_BREAKPOINT = 600; 3323 const $swiperSlides = $(".fancybox-thumbs__list a"); 3324 const $swiperWrapper = $(".fancybox-thumbs__list"); 3325 const sliderDirection = window.innerWidth >= SLIDER_RESIZE_BREAKPOINT ? "vertical" : "horizontal"; 3326 3327 const options = { 3328 centerInsufficientSlides: true, 3329 direction: sliderDirection, 3330 mousewheelControl: true, 3331 setWrapperSize: true, 3332 slidesPerView: 3, 3333 spaceBetween: 16, 3334 breakpoints: { 3335 400: { 3336 slidesPerView: 5, 3337 }, 3338 }, 3339 }; 3340 3341 if ($swiperSlides.length > 5) { 3342 options.navigation = { 3343 nextEl: ".fancybox-thumbs__wrapper .swiper-button-next", 3344 prevEl: ".fancybox-thumbs__wrapper .swiper-button-prev", 3345 }; 3346 } 3347 3348 $(".fancybox-thumbs").wrapInner( 3349 "<div class='fancybox-thumbs__wrapper'><div class='swiper' data-plugin-options='" + 3350 JSON.stringify(options) + 3351 "' /></div>" 3352 ); 3353 const $swiperContainerWrapper = $(".fancybox-thumbs__wrapper"); 3354 3355 if ($swiperSlides.length > 5) { 3356 $swiperContainerWrapper.append( 3357 "<div class='swiper-button-next'><i class='svg right'><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)'></path></svg></i></div>" 3358 ); 3359 $swiperContainerWrapper.prepend( 3360 "<div class='swiper-button-prev'><i class='svg left'><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)'></path></svg></i></div>" 3361 ); 3362 } 3363 $swiperWrapper.addClass("swiper-wrapper"); 3364 $swiperSlides.addClass("swiper-slide"); 3365 3366 initSwiperSlider(".fancybox-thumbs .swiper"); 3367 3368 const swiper = $(".fancybox-thumbs .swiper").data("swiper"); 3369 3370 swiper.slideTo(instance.curPos, 10); 3371 swiper.on("resize", function () { 3372 if (window.innerWidth >= SLIDER_RESIZE_BREAKPOINT && options.direction === "horizontal") { 3373 options.direction = "vertical"; 3374 swiper.changeDirection(options.direction, false); 3375 $swiperWrapper.css("width", "auto"); 3376 swiper.update(); 3377 } else if (window.innerWidth < SLIDER_RESIZE_BREAKPOINT && options.direction === "vertical") { 3378 options.direction = "horizontal"; 3379 swiper.changeDirection(options.direction, false); 3380 $swiperWrapper.css("height", "auto"); 3381 swiper.update(); 3382 } 3383 }); 3384 } 3385}; 3386/** */ 3387InitFancyBox = function () { 3388 if (typeof $.fn.fancybox !== "function") { 3389 return; 3390 } 3391 3392 if (!$(".fancy").length) { 3393 return; 3394 } 3395 $(".fancy").fancybox({ 3396 padding: [40, 40, 64, 40], 3397 openEffect: "fade", 3398 closeEffect: "fade", 3399 nextEffect: "fade", 3400 prevEffect: "fade", 3401 opacity: true, 3402 tpl: { 3403 closeBtn: 3404 '<span title="' + 3405 BX.message("FANCY_CLOSE") + 3406 '" class="fancybox-item fancybox-close inline svg"><svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2 24L24 2M2 2L24 24" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg></span>', 3407 next: 3408 '<a title="' + 3409 BX.message("FANCY_NEXT") + 3410 '" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>', 3411 prev: 3412 '<a title="' + 3413 BX.message("FANCY_PREV") + 3414 '" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>', 3415 }, 3416 btnTpl: { 3417 close: 3418 '<button data-fancybox-close class="fancybox-button fancybox-button--close" title="{{CLOSE}}">' + 3419 '<i class="svg"><svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M2 24L24 2M2 2L24 24" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" /></svg></i>' + 3420 "</button>", 3421 3422 arrowLeft: 3423 '<button data-fancybox-prev class="fancybox-button fancybox-button--arrow_left" title="{{PREV}}">' + 3424 '<div><i class="svg left"><svg width="16" height="26" viewBox="0 0 15 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2 13L0.585787 14.4142C-0.195262 13.6332 -0.195262 12.3668 0.585787 11.5858L2 13ZM11.5858 0.585786C12.3668 -0.195262 13.6332 -0.195262 14.4142 0.585786C15.1953 1.36683 15.1953 2.63317 14.4142 3.41421L11.5858 0.585786ZM14.4142 22.5858C15.1953 23.3668 15.1953 24.6332 14.4142 25.4142C13.6332 26.1953 12.3668 26.1953 11.5858 25.4142L14.4142 22.5858ZM0.585787 11.5858L11.5858 0.585786L14.4142 3.41421L3.41421 14.4142L0.585787 11.5858ZM3.41421 11.5858L14.4142 22.5858L11.5858 25.4142L0.585787 14.4142L3.41421 11.5858Z" fill="#999999"/></svg></i></div>' + 3425 "</button>", 3426 3427 arrowRight: 3428 '<button data-fancybox-next class="fancybox-button fancybox-button--arrow_right" title="{{NEXT}}">' + 3429 '<div><i class="svg right"><svg width="16" height="26" viewBox="0 0 15 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13 13L14.4142 14.4142C15.1953 13.6332 15.1953 12.3668 14.4142 11.5858L13 13ZM3.41421 0.585786C2.63317 -0.195262 1.36683 -0.195262 0.585786 0.585786C-0.195262 1.36683 -0.195262 2.63317 0.585786 3.41421L3.41421 0.585786ZM0.585786 22.5858C-0.195262 23.3668 -0.195262 24.6332 0.585786 25.4142C1.36683 26.1953 2.63317 26.1953 3.41421 25.4142L0.585786 22.5858ZM14.4142 11.5858L3.41421 0.585786L0.585786 3.41421L11.5858 14.4142L14.4142 11.5858ZM11.5858 11.5858L0.585786 22.5858L3.41421 25.4142L14.4142 14.4142L11.5858 11.5858Z" fill="white"/></svg></i></div>' + 3430 "</button>", 3431 }, 3432 touch: "enabled", 3433 buttons: ["close"], 3434 thumbs: { 3435 autoStart: true, 3436 }, 3437 backFocus: false, 3438 onActivate: function (instance) { 3439 InitFancyboxThumbnailsGallery(instance); 3440 }, 3441 beforeShow: function (instance, current) { 3442 if ($(".fancybox-thumbs .swiper").length) { 3443 const swiper = $(".fancybox-thumbs .swiper").data("swiper"); 3444 3445 swiper.slideTo(current.index); 3446 } 3447 var $video_block = $(".company-block .video")[0]; 3448 if ($video_block && !$video_block.nextElementSibling) { 3449 $videoContent = $video_block.content.cloneNode(true); 3450 $source = $videoContent.querySelector(".video-block"); 3451 $source.setAttribute("src", $source.dataset["src"]); 3452 $video_block.parentNode.insertBefore($videoContent, $video_block.nextSibling); 3453 } 3454 var video_block_frame = $(".company-block #company_video_iframe"); 3455 if (video_block_frame.length) { 3456 var data_src_iframe = video_block_frame.attr("data-src"); 3457 video_block_frame.attr("src", data_src_iframe); 3458 video_block_frame.attr("allow", "autoplay"); 3459 } 3460 }, 3461 afterShow: function () { 3462 if ($(".fancybox-overlay").css("opacity") == 0) { 3463 setTimeout(function () { 3464 $(".fancybox-overlay").css("opacity", 1); 3465 $("html").addClass("overflow_html"); 3466 }, 200); 3467 } 3468 3469 $(".fancybox-nav").css("opacity", 0); 3470 setTimeout(function () { 3471 $(".fancybox-nav").css("opacity", 1); 3472 }, 150); 3473 if ($(".fancybox-inner #company_video").length) { 3474 // var fancyHeight = $('.fancybox-wrap').height(); 3475 // $('.fancybox-inner').height(fancyHeight); 3476 setTimeout(function () { 3477 $(".fancybox-wrap video").resize(); 3478 setTimeout(function () { 3479 $(".fancybox-wrap").addClass("show_video"); 3480 document.getElementById("company_video").currentTime = 0; 3481 document.getElementById("company_video").play(); 3482 }, 300); 3483 }, 150); 3484 } else if ($(".fancybox-wrap iframe").length) { 3485 $(".fancybox-inner").height("100%"); 3486 } 3487 }, 3488 beforeClose: function () { 3489 $(".fancybox-overlay").fadeOut(); 3490 if ($("#company_video").length) { 3491 document.getElementById("company_video").currentTime = 0; 3492 } 3493 $("html").removeClass("overflow_html"); 3494 var video_block_frame = $(".company-block .video-block"); 3495 if (video_block_frame.length) { 3496 $("#company_video_iframe").attr("src", ""); 3497 } 3498 }, 3499 onClosed: function () { 3500 if ($(".fancybox-wrap #company_video").length) { 3501 document.getElementById("company_video").pause(); 3502 } 3503 }, 3504 }); 3505}; 3506 3507InitFancyBoxVideo = function () { 3508 if (typeof $.fn.fancybox !== "function") { 3509 return; 3510 } 3511 3512 if (!$(".video_link").length) { 3513 return; 3514 } 3515 $(".video_link").fancybox({ 3516 type: "iframe", 3517 maxWidth: 800, 3518 maxHeight: 600, 3519 fitToView: false, 3520 width: "70%", 3521 height: "70%", 3522 autoSize: false, 3523 closeClick: false, 3524 opacity: true, 3525 tpl: { 3526 closeBtn: 3527 '<span title="' + 3528 BX.message("FANCY_CLOSE") + 3529 '" 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>', 3530 next: 3531 '<a title="' + 3532 BX.message("FANCY_NEXT") + 3533 '" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>', 3534 prev: 3535 '<a title="' + 3536 BX.message("FANCY_PREV") + 3537 '" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>', 3538 }, 3539 afterShow: function () { 3540 if ($(".fancybox-overlay").css("opacity") == 0) { 3541 setTimeout(function () { 3542 $(".fancybox-overlay").css("opacity", 1); 3543 $("html").addClass("overflow_html"); 3544 }, 200); 3545 } 3546 3547 $(".fancybox-nav").css("opacity", 0); 3548 setTimeout(function () { 3549 $(".fancybox-nav").css("opacity", 1); 3550 }, 150); 3551 if ($(".fancybox-wrap iframe").length) { 3552 $(".fancybox-inner").height("100%"); 3553 } 3554 }, 3555 beforeClose: function () { 3556 $(".fancybox-overlay").fadeOut(); 3557 $("html").removeClass("overflow_html"); 3558 }, 3559 }); 3560}; 3561 3562InitStickySideBar = function (el, container_el) { 3563 var block = ".sticky-sidebar",
3564 container_catalog = ".wraps .wrapper_inner .container_inner .main-catalog-wrapper", 3565 container = ".wraps .wrapper_inner .container_inner"; 3566 if (typeof el !== "undefined") block = el; 3567 3568 if ($(container_catalog).length) container = container_catalog; 3569 3570 if (typeof container_el !== "undefined") container = container_el; 3571 3572 if ($(block).length && arAsproOptions["THEME"]["STICKY_SIDEBAR"] != "N") { 3573 if (typeof window["stickySidebar"] !== "undefined") { 3574 window["stickySidebar"].destroy(); 3575 } 3576 3577 window["stickySidebar"] = new StickySidebar(block, { 3578 topSpacing: 60, 3579 bottomSpacing: 20, 3580 containerSelector: container, 3581 resizeSensor: true, 3582 innerWrapperSelector: ".sticky-sidebar__inner", 3583 }); 3584 3585 if ($(".sticky-sidebar .sticky-sidebar__inner .banner img").length) { 3586 $(".sticky-sidebar .sticky-sidebar__inner .banner img")[0].onload = function () { 3587 if (typeof window["stickySidebar"] !== "undefined") { 3588 window["stickySidebar"].updateSticky(); 3589 } 3590 }; 3591 } 3592 } 3593}; 3594 3595InitOwlSlider = function () { 3596 if (typeof $.fn.owlCarousel !== "function") { 3597 return; 3598 } 3599 $(".owl-carousel:not(.owl-loaded):not(.appear-block)").each(function () { 3600 var slider = $(this); 3601 var options; 3602 var svg = 3603 '<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>'; 3604 var defaults = { 3605 navText: [ 3606 '<i class="svg left colored_theme_hover_text">' + svg + "</i>", 3607 '<i class="svg right colored_theme_hover_text">' + svg + "</i>", 3608 ], 3609 }; 3610 var config = $.extend({}, defaults, options, slider.data("plugin-options")); 3611 3612 slider.on("initialized.owl.carousel", function (event) { 3613 var eventdata = { slider: event }; 3614 BX.onCustomEvent("onSliderInitialized", [eventdata]); 3615 3616 $(event.target).removeClass("loading-state"); 3617 $(event.target).find(".owl-item:first").addClass("current"); 3618 3619 if ($(event.target).hasClass("catalog_block")) { 3620 if (typeof sliceItemBlockSlide === "function") { 3621 sliceItemBlockSlide(); 3622 } 3623 } 3624 3625 if (typeof window["stickySidebar"] !== "undefined") { 3626 window["stickySidebar"].updateSticky(); 3627 } 3628 }); 3629 slider.owlCarousel(config); 3630 3631 slider.on("change.owl.carousel", function (event) { 3632 var eventdata = { slider: event }; 3633 BX.onCustomEvent("onSlideChange", [eventdata]); 3634 }); 3635 slider.on("resized.owl.carousel", function (event) { 3636 if (typeof sliceItemBlockSlide === "function") { 3637 sliceItemBlockSlide({ resize: false }); 3638 } 3639 }); 3640 3641 slider.on("changed.owl.carousel", function (event) { 3642 var eventdata = { slider: event }; 3643 BX.onCustomEvent("onSlideChanged", [eventdata]); 3644 3645 if ($(event.target).data("pluginOptions")) { 3646 if ("index" in $(event.target).data("pluginOptions")) { 3647 if ($(".switch-item-block").length) { 3648 $(".switch-item-block__count-wrapper--big .switch-item-block__count-value").text( 3649 event.item.index + 1 + "/" + event.item.count 3650 ); 3651 } 3652 } 3653 3654 if ("relatedTo" in $(event.target).data("pluginOptions")) { 3655 var relatedClass = $(event.target).data("pluginOptions").relatedTo, 3656 relatedBlock = $(relatedClass); 3657 3658 if (relatedBlock.length && $(event.target).data("owl.carousel")) { 3659 if (!$(event.target).data("owl.carousel").loop) { 3660 var current = event.item.index; 3661 } else { 3662 var count = event.item.count - 1; 3663 var current = Math.round(event.item.index - event.item.count / 2 - 0.5); 3664 3665 if (current < 0) current = count; 3666 3667 if (current > count) current = 0; 3668 } 3669 3670 relatedBlock.find(".owl-item").removeClass("current").eq(current).addClass("current"); 3671 3672 var onscreen = relatedBlock.find(".owl-item.active").length - 1; 3673 var start = relatedBlock.find(".owl-item.active").first().index(); 3674 var end = relatedBlock.find(".owl-item.active").last().index(); 3675 3676 if (current > end) relatedBlock.data("owl.carousel").to(current, 100, true); 3677 3678 if (current < start) relatedBlock.data("owl.carousel").to(current - onscreen, 100, true); 3679 // $(".owl-slider-"+id).trigger('to.owl.carousel', [itemCarousel]) 3680 } 3681 } 3682 } 3683 }); 3684 3685 slider.on("translated.owl.carousel", function (event) {}); 3686 3687 if ("clickTo" in config) { 3688 var relatedClass = config.clickTo, 3689 magnifier = "magnifier" in config; 3690 3691 slider.on("click", ".owl-item", function (e) { 3692 e.preventDefault(); 3693 var _this = $(this), 3694 number = _this.index(); 3695 3696 if (magnifier) { 3697 const $parent = $(relatedClass).closest(".product-container"); 3698 if ($parent.find(".zoom_picture").length) { 3699 const $zoomImg = $parent.find(".zoom_picture"); 3700 const $galleryImg = _this.find(".product-detail-gallery__item img"); 3701 3702 const bigImage = _this.find(".product-detail-gallery__item").data("big"), 3703 srcImage = $galleryImg.attr("src"); 3704 3705 $zoomImg.attr("data-large", bigImage || srcImage); 3706 $zoomImg.attr("xoriginal", bigImage || srcImage); 3707 $zoomImg.attr("src", bigImage || srcImage); 3708 $zoomImg.attr("data-xoriginalwidth", $galleryImg.attr("data-xoriginalwidth")); 3709 $zoomImg.attr("data-xoriginalheight", $galleryImg.attr("data-xoriginalheight")); 3710 $parent.find(".product-detail-gallery__link").attr("href", srcImage); 3711 } 3712 _this.siblings("").removeClass("current"); 3713 _this.addClass("current"); 3714 } else { 3715 $(relatedClass).data("owl.carousel").to(number, 300, true); 3716 } 3717 }); 3718 } 3719 }); 3720}; 3721 3722InitFlexSlider = function () { 3723 //todo need remove 3724}; 3725 3726inIframe = function () { 3727 try { 3728 return window.self !== window.top; 3729 } catch (e) { 3730 return true; 3731 } 3732}; 3733 3734InitZoomPict = function (el) { 3735 const zoomer = typeof el !== "undefined" ? el : $(".zoom_picture"); 3736 3737 if (zoomer.length) { 3738 var options; 3739 const defaults = { 3740 title: false, 3741 scroll: false, 3742 Xoffset: 15, 3743 tint: "#333", 3744 defaultScale: -1, 3745 }; 3746 3747 const config = $.extend({}, defaults, options, zoomer.data("plugin-options")); 3748 zoomer.xzoom(config); 3749 3750 // checks if zoomer doesn't have the event listenners
3751 const zoomerEventsListeners = $._data(zoomer.get(0), "events"); 3752 3753 if (!zoomerEventsListeners.mouseout && !zoomerEventsListeners.load) { 3754 zoomer.on("mouseleave", function () { 3755 zoomer.data("xzoom").movezoom; 3756 let mObjWidth = parseInt(zoomer.attr("data-xoriginalwidth")); 3757 let mObHeight = parseInt(zoomer.attr("data-xoriginalheight")); 3758 let imgObjWidth = Math.round(zoomer.width()); 3759 let imgObjheight = Math.round(zoomer.height()); 3760 if (mObjWidth === imgObjWidth && imgObjheight === mObHeight) { 3761 $(".xzoom-preview").addClass("hidden"); 3762 $(".xzoom-source > div").addClass("hidden"); 3763 } else { 3764 $(".xzoom-preview").removeClass("hidden"); 3765 $(".xzoom-source > div").removeClass("hidden"); 3766 } 3767 }); 3768 3769 zoomer.on("load", function () { 3770 const zoomerParentWidth = Math.round(zoomer.parent().width()); 3771 const zoomerHeight = Math.round(zoomer.height()); 3772 const zoomerWidth = Math.round(zoomer.width()); 3773 const sizeMultiplier = 1.5; 3774 3775 const zoomWidth = 3776 zoomerWidth < zoomerParentWidth / 2 && zoomerHeight > zoomerWidth ? zoomerWidth * sizeMultiplier : "auto"; 3777 3778 zoomer.data("xzoom").destroy(); 3779 zoomer.removeData("xzoom"); 3780 zoomer.width("auto"); 3781 3782 config.zoomWidth = zoomWidth; 3783 zoomer.xzoom(config); 3784 }); 3785 } 3786 } 3787}; 3788 3789var arBasketAsproCounters = (arStatusBasketAspro = arBasketPrices = {}); 3790SetActualBasketFlyCounters = function (sync) { 3791 if (arBasketAsproCounters.DEFAULT == true) { 3792 $.ajax({ 3793 url: arAsproOptions["SITE_DIR"] + "ajax/basket_fly.php", 3794 type: "post", 3795 success: function (html) { 3796 $("#basket_line .basket_fly").removeClass("loaded").html(html); 3797 3798 if (typeof sync !== "undefined") { 3799 $.ajax({ 3800 type: "GET", 3801 url: arAsproOptions["SITE_DIR"] + "ajax/actualBasket.php", 3802 // data:data, 3803 success: function (data) { 3804 if (!$(".js_ajax").length) $("body").append('<div class="js_ajax"></div>'); 3805 $(".js_ajax").html(data); 3806 3807 setBasketStatusBtn(true); 3808 }, 3809 }); 3810 } 3811 }, 3812 }); 3813 } else { 3814 // insert currency ₽ by this hack!: $('<div/>').html(arBasketAsproCounters.READY.TITLE).text() 3815 $(".basket_fly .opener .basket_count .count") 3816 .attr("class", "count" + (arBasketAsproCounters.READY.COUNT > 0 ? "" : " empty_items")) 3817 .find(".items span") 3818 .text(arBasketAsproCounters.READY.COUNT); 3819 $(".basket_fly .opener .basket_count + a").attr("href", arBasketAsproCounters["READY"]["HREF"]); 3820 $(".basket_fly .opener .basket_count") 3821 .attr("title", $("<div/>").html(arBasketAsproCounters.READY.TITLE).text()) 3822 .attr( 3823 "class", 3824 "colored_theme_hover_text basket_count small clicked" + (arBasketAsproCounters.READY.COUNT > 0 ? "" : " empty") 3825 ); 3826 3827 $(".basket_fly .opener .wish_count .count").find(".items span").text(arBasketAsproCounters.FAVORITE.COUNT); 3828 3829 $(".basket_fly .opener .compare_count .wraps_icon_block").attr( 3830 "class", 3831 "wraps_icon_block compare" + (arBasketAsproCounters.COMPARE.COUNT > 0 ? "" : " empty_block") 3832 ); 3833 $(".basket_fly .opener .compare_count .count") 3834 .attr("class", "count" + (arBasketAsproCounters.COMPARE.COUNT > 0 ? "" : " empty_items")) 3835 .find(".items span") 3836 .text(arBasketAsproCounters.COMPARE.COUNT); 3837 $(".basket_fly .opener .compare_count + a").attr("href", arBasketAsproCounters.COMPARE.HREF); 3838 3839 updateBottomIconsPanel(arBasketAsproCounters); 3840 } 3841}; 3842 3843CheckHeaderFixed = function () { 3844 var header = $("header, body.simple_basket_mode #header").first(), 3845 header_fixed = $("#headerfixed, body.simple_basket_mode #header"), 3846 header_simple = $("body.simple_basket_mode #header"); 3847 3848 if (header_fixed.length) { 3849 if (header.length) { 3850 var isHeaderFixed = false, 3851 isTabsFixed = false, 3852 headerCanFix = true, 3853 headerFixedHeight = header_fixed.actual("outerHeight"), 3854 headerNormalHeight = header.actual("outerHeight"), 3855 headerDiffHeight = headerNormalHeight - headerFixedHeight, 3856 mobileBtnMenu = $(".btn.btn-responsive-nav"), 3857 headerTop = $("#panel:visible").actual("outerHeight"), 3858 topBlock = $(".TOP_HEADER").first(), 3859 $headerFixedNlo = header_fixed.find("[data-nlo]"), 3860 isNloLoaded = !$headerFixedNlo.length, 3861 OnHeaderFixedScrollHandler; 3862 3863 if (headerDiffHeight <= 0) headerDiffHeight = 0; 3864 3865 if (topBlock.length) headerTop += topBlock.actual("outerHeight"); 3866 3867 $(window).scroll( 3868 (OnHeaderFixedScrollHandler = function () { 3869 var tabs_fixed = $(".product-item-detail-tabs-container-fixed"); 3870 3871 if (window.matchMedia("(min-width:992px)").matches) { 3872 var scrollTop = documentScrollTopLast, 3873 current_is = $(".search-wrapper .search-input:visible"), 3874 tabs = $(".ordered-block .nav.nav-tabs"), 3875 headerCanFix = !mobileBtnMenu.is(":visible"); /* && !$('.dropdown-menu:visible').length*/ 3876 3877 if (!isHeaderFixed) { 3878 if (headerCanFix && scrollTop > headerNormalHeight + headerTop) { 3879 if (!isNloLoaded) { 3880 if (!$headerFixedNlo.hasClass("nlo-loadings")) { 3881 $headerFixedNlo.addClass("nlo-loadings"); 3882 setTimeout(function () { 3883 $.ajax({ 3884 data: { nlo: $headerFixedNlo.attr("data-nlo") }, 3885 success: function (response) { 3886 // stop ya metrika webvisor DOM indexer 3887 pauseYmObserver(); 3888 3889 isNloLoaded = true; 3890 $headerFixedNlo[0].insertAdjacentHTML("beforebegin", $.trim(response)); 3891 $headerFixedNlo.remove(); 3892 3893 InitMenuNavigationAim(); 3894 OnHeaderFixedScrollHandler(); 3895 3896 // resume ya metrika webvisor 3897 // (300ms transition) + (100ms scroll handler) 3898 setTimeout(resumeYmObserver, 400); 3899 }, 3900 error: function () { 3901 $headerFixedNlo.removeClass("nlo-loadings"); 3902 }, 3903 }); 3904 }, 300); 3905 } 3906 } else { 3907 isHeaderFixed = true; 3908 if (header_simple.length) { 3909 headerSimpleHeight = header_simple.actual("outerHeight"); 3910 header_simple.closest(".header_wrap").css({ "margin-top": headerSimpleHeight }); 3911 } 3912 header_fixed.addClass("fixed"); 3913 3914 $("nav.mega-menu.sliced.initied").removeClass("initied"); 3915 CheckTopMenuDotted(); 3916 } 3917 } 3918 } 3919 if (isHeaderFixed || !headerCanFix) { 3920 if (!headerCanFix || scrollTop <= headerDiffHeight + headerTop) { 3921 isHeaderFixed = false;
3922 header_fixed.removeClass("fixed"); 3923 if (header_simple.length) { 3924 header_simple.closest(".header_wrap").css({ "margin-top": "" }); 3925 } 3926 } 3927 } 3928 3929 //fixed tabs 3930 if (tabs_fixed.length && tabs.length) { 3931 var tabs_offset = $(".ordered-block .nav.nav-tabs").offset(); 3932 if (scrollTop + headerFixedHeight > tabs_offset.top) { 3933 tabs_fixed.css({ top: header_fixed.actual("outerHeight") }); 3934 tabs_fixed.addClass("fixed"); 3935 3936 header_fixed.addClass("tabs-fixed"); 3937 } else if (tabs_fixed.hasClass("fixed")) { 3938 tabs_fixed.removeAttr("style"); 3939 tabs_fixed.removeClass("fixed"); 3940 3941 header_fixed.removeClass("tabs-fixed"); 3942 } 3943 } 3944 } 3945 }) 3946 ); 3947 } 3948 } 3949 3950 //mobile fixed 3951 var headerSimple = $("body.simple_basket_mode .wrapper1.mfixed_Y #header"); 3952 var mfixed = headerSimple.length ? headerSimple : $(".wrapper1.mfixed_Y #mobileheader"); 3953 if (mfixed.length && isMobile) { 3954 var isMHeaderFixed = false, 3955 mheaderCanFix = true, 3956 mheaderFixedHeight = mfixed.actual("outerHeight"), 3957 // mheaderFixedHeight = 0, 3958 mheaderTop = $("#panel:visible").actual("outerHeight"), 3959 mHeaderScrollTop = $(".wrapper1").hasClass("mfixed_view_scroll_top"); 3960 $(window).scroll(function () { 3961 var scrollTop = documentScrollTopLast; 3962 if (window.matchMedia("(max-width:991px)").matches) { 3963 if (mHeaderScrollTop) { 3964 if (scrollTop > startScroll) { 3965 if (!$("#mobilePhone.show").length) { 3966 mfixed.removeClass("fixed"); 3967 if (headerSimple.length) { 3968 headerSimple.closest(".header_wrap").css({ "margin-top": "" }); 3969 } 3970 } 3971 } else if (scrollTop > mheaderFixedHeight + mheaderTop) { 3972 mfixed.addClass("fixed"); 3973 if (headerSimple.length) { 3974 headerSimple.closest(".header_wrap").css({ "margin-top": mheaderFixedHeight }); 3975 } 3976 } else if (scrollTop <= mheaderFixedHeight + mheaderTop) { 3977 mfixed.removeClass("fixed"); 3978 if (headerSimple.length) { 3979 headerSimple.closest(".header_wrap").css({ "margin-top": "" }); 3980 } 3981 } 3982 startScroll = scrollTop; 3983 } else { 3984 if (!isMHeaderFixed) { 3985 if (scrollTop > mheaderFixedHeight + mheaderTop) { 3986 isMHeaderFixed = true; 3987 mfixed.addClass("fixed"); 3988 if (headerSimple.length) { 3989 headerSimple.closest(".header_wrap").css({ "margin-top": mheaderFixedHeight }); 3990 } 3991 } 3992 } else if (isMHeaderFixed) { 3993 if (scrollTop <= mheaderFixedHeight + mheaderTop) { 3994 isMHeaderFixed = false; 3995 mfixed.removeClass("fixed"); 3996 if (headerSimple.length) { 3997 headerSimple.closest(".header_wrap").css({ "margin-top": "" }); 3998 } 3999 } 4000 } 4001 } 4002 } else { 4003 mfixed.removeClass("fixed"); 4004 if (headerSimple.length) { 4005 headerSimple.closest(".header_wrap").css({ "margin-top": "" }); 4006 } 4007 } 4008 }); 4009 } 4010}; 4011 4012CheckHeaderFixedMenu = function () { 4013 if ( 4014 arAsproOptions["THEME"] && 4015 arAsproOptions["THEME"]["HEADER_FIXED"] == 2 && 4016 $("#headerfixed .js-nav").length && 4017 window.matchMedia("(min-width: 992px)").matches 4018 ) { 4019 $("#headerfixed .js-nav").css("width", "0"); 4020 var all_width = 0, 4021 cont_width = $("#headerfixed .maxwidth-theme").actual("width"), 4022 padding_menu = 4023 $("#headerfixed .logo-row.v2 .menu-block").actual("outerWidth") - 4024 $("#headerfixed .logo-row.v2 .menu-block").actual("width"); 4025 $("#headerfixed .logo-row.v2 > .inner-table-block").each(function () { 4026 if (!$(this).hasClass("menu-block")) all_width += $(this).actual("outerWidth"); 4027 }); 4028 $("#headerfixed .js-nav").width(cont_width - all_width - padding_menu); 4029 } 4030}; 4031 4032CheckSearchWidth = function () { 4033 if ($(".logo_and_menu-row .search_wrap").length) { 4034 var searchPosition = $(".logo_and_menu-row .search_wrap").position().left, 4035 maxWidth = $(".logo_and_menu-row .maxwidth-theme").width() - 2; 4036 width = 0; 4037 if ($(".logo_and_menu-row .subtop .search_wrap").length) { 4038 maxWidth = $(".logo_and_menu-row .subtop").width() - 2; 4039 $(".logo_and_menu-row .subtop > .row >div >div") 4040 .each(function () { 4041 if (!$(this).hasClass("search_wrap")) { 4042 var elementWidth = $(this).outerWidth(); 4043 if (!$(this).is(":visible") || !$(this).height()) elementWidth = 0; 4044 width = width ? width - elementWidth : maxWidth - elementWidth; 4045 } 4046 }) 4047 .promise() 4048 .done(function () { 4049 if ($(".logo_and_menu-row .search_wrap.wide_search").length) 4050 $(".logo_and_menu-row .search_wrap .search-block").outerWidth(width); 4051 else $(".logo_and_menu-row .search_wrap").outerWidth(width); 4052 $(".logo_and_menu-row .search_wrap").css({ opacity: 1, visibility: "visible" }); 4053 }); 4054 } else {
4055 if ($(".logo_and_menu-row .subbottom .search_wrap").length) { 4056 maxWidth = $(".logo_and_menu-row .subbottom").width() - 2; 4057 $(".logo_and_menu-row .subbottom >div") 4058 .each(function () { 4059 if (!$(this).hasClass("search_wrap")) { 4060 var elementWidth = $(this).outerWidth(); 4061 if (!$(this).is(":visible") || !$(this).height()) elementWidth = 0; 4062 width = width ? width - elementWidth : maxWidth - elementWidth; 4063 } 4064 }) 4065 .promise() 4066 .done(function () { 4067 if ($(".logo_and_menu-row .search_wrap.wide_search").length) 4068 $(".logo_and_menu-row .search_wrap .search-block").outerWidth(width); 4069 else $(".logo_and_menu-row .search_wrap").outerWidth(width); 4070 $(".logo_and_menu-row .search_wrap").css({ opacity: 1, visibility: "visible" }); 4071 }); 4072 } else { 4073 $(".logo_and_menu-row .maxwidth-theme > .row >div >div") 4074 .each(function () { 4075 if (!$(this).hasClass("search_wrap")) { 4076 var elementWidth = $(this).outerWidth(); 4077 if (!$(this).is(":visible") || !$(this).height()) elementWidth = 0; 4078 width = width ? width - elementWidth : maxWidth - elementWidth; 4079 } 4080 }) 4081 .promise() 4082 .done(function () { 4083 if ($(".logo_and_menu-row .search_wrap.wide_search").length) 4084 $(".logo_and_menu-row .search_wrap .search-block").outerWidth(width); 4085 else $(".logo_and_menu-row .search_wrap").outerWidth(width); 4086 $(".logo_and_menu-row .search_wrap").css({ opacity: 1, visibility: "visible" }); 4087 }); 4088 } 4089 } 4090 } 4091}; 4092 4093if (!funcDefined("showItemStoresAmount")) { 4094 var showItemStoresAmount = function () { 4095 let blocks = $(".item-stock .status-amount--stores:not(.status-amount--loaded)"); 4096 if (blocks.length) { 4097 let stores = []; 4098 let ids = []; 4099 4100 for (let i = 0, cnt = blocks.length; i < cnt; ++i) { 4101 $(blocks[i]).addClass("status-amount--loaded"); 4102 4103 var data = $(blocks[i]).data("param-amount"); 4104 if (typeof data === "object" && data) { 4105 ids.push(data.ID); 4106 stores = data.STORES; 4107 } 4108 } 4109 4110 if (ids) { 4111 let data = { 4112 ids: ids, 4113 stores: stores, 4114 }; 4115 4116 $.ajax({ 4117 url: arAsproOptions.SITE_DIR + "ajax/amount.php", 4118 type: "POST", 4119 data: data, 4120 dataType: "json", 4121 success: function (result) { 4122 if (typeof result === "object" && result && result.success && result.amount) { 4123 for (let i = 0, cnt = blocks.length; i < cnt; ++i) { 4124 var data = $(blocks[i]).data("param-amount"); 4125 if (typeof data === "object" && data) { 4126 if (result.amount[data.ID]) { 4127 $(blocks[i]).html(result.amount[data.ID]); 4128 } 4129 4130 $(blocks[i]).addClass("status-amount--visible"); 4131 } 4132 } 4133 } 4134 }, 4135 }); 4136 } 4137 } 4138 }; 4139} 4140 4141lazyLoadPagenBlock = function () { 4142 setTimeout(function () { 4143 if ($(".with-load-block .ajax_load_btn:not(.appear-block)").length) { 4144 $(".with-load-block .ajax_load_btn:not(.appear-block)").iAppear( 4145 function () { 4146 var $this = $(this); 4147 $this.addClass("appear-block").trigger("click"); 4148 }, 4149 { rootMargin: "200px 0px 200px 0px", accX: 0, accY: 200 } 4150 ); 4151 } 4152 }, 200); 4153}; 4154 4155scrollPreviewBlock = function () { 4156 if (typeof $.cookie("scroll_block") != "undefined" && $.cookie("scroll_block")) { 4157 var scroll_block = $($.cookie("scroll_block")); 4158 if (scroll_block.length) { 4159 let position = scroll_block.offset().top; 4160 let $fixedHeader = null; 4161 if (($fixedHeader = document.getElementById("headerfixed"))) { 4162 position -= $fixedHeader.clientHeight; 4163 } 4164 $("body, html").animate({ scrollTop: position }, 500); 4165 } 4166 $.cookie("scroll_block", null); 4167 } 4168}; 4169 4170scrollToBlock = function (block) { 4171 if ($(block).length) { 4172 var offset = $(block).offset().top; 4173 if (typeof $(block).data("toggle") != "undefined") $(block).click(); 4174 4175 if (typeof $(block).data("offset") != "undefined") offset += $(block).data("offset"); 4176 4177 $("body, html").animate({ scrollTop: offset }, 500); 4178 } 4179}; 4180 4181checkMenuLines = function () { 4182 if ($(".front_page .menu-row .left_border").length || $(".front_page .menu-row .right_border").length) { 4183 var positionMenu = $(".centered .menu-row .mega-menu table").length 4184 ? $(".centered .menu-row .mega-menu table").offset().left 4185 : 0, 4186 varFixLineWidth = 4187 $("body").hasClass("with_decorate") && window.matchMedia("(min-width: 1100px)").matches ? 126 : 7; 4188 4189 $(".menu-row .left_border, .menu-row .right_border").css("width", positionMenu - varFixLineWidth); 4190 } 4191}; 4192 4193SetFixedAskBlock = function () { 4194 if ($(".ask_a_question_wrapper").length) { 4195 var offset = $(".ask_a_question_wrapper").offset(), 4196 footer_offset = 0, 4197 block = $(".ask_a_question_wrapper").find(".ask_a_question"), 4198 block_offset = BX.pos(block[0]), 4199 block_height = block_offset.bottom - block_offset.top, 4200 diff_top_scroll = $("#headerfixed").height() + 20; 4201 4202 if ($("footer").length) footer_offset = $("footer").offset().top; 4203 4204 if ($(".banner.CONTENT_BOTTOM").length) footer_offset = $(".banner.CONTENT_BOTTOM").offset().top; 4205 4206 /* removed for ISSUE NEXT-414 4207 if(block_height+130 > block.closest('.fixed_wrapper').height()) 4208 block.addClass('nonfixed'); 4209 else 4210 block.removeClass('nonfixed'); 4211 */ 4212 4213 if (block_height + diff_top_scroll + documentScrollTopLast + 130 > footer_offset) { 4214 block.removeClass("fixed").css({ top: "auto", width: "auto", bottom: 0 }); 4215 block.parent().css("position", "static"); 4216 block.parent().parent().css("position", "static"); 4217 } else { 4218 block.parent().removeAttr("style"); 4219 block.parent().parent().removeAttr("style"); 4220 4221 if (documentScrollTopLast + diff_top_scroll > offset.top) { 4222 var fixed_width = $(".fixed_block_fix").width(); 4223 block.addClass("fixed").css({ top: diff_top_scroll, bottom: "auto" }); 4224 if (fixed_width) block.css({ width: $(".fixed_block_fix").width() }); 4225 } else block.removeClass("fixed").css({ top: 0, width: "auto" }); 4226 } 4227 } 4228}; 4229 4230MegaMenuFixed = function () { 4231 var animationTime = 150, 4232 $megaFixedNlo = $(".mega_fixed_menu").find("[data-nlo]"); 4233 4234 $("header .burger, #headerfixed .burger").on("click", function () { 4235 if ($megaFixedNlo.length) { 4236 if (!$megaFixedNlo.hasClass("nlo-loadings")) { 4237 $megaFixedNlo.addClass("nlo-loadings"); 4238 setTimeout(function () { 4239 $.ajax({ 4240 data: { nlo: $megaFixedNlo.attr("data-nlo") }, 4241 success: function (response) { 4242 $megaFixedNlo[0].insertAdjacentHTML("beforebegin", $.trim(response)); 4243 $megaFixedNlo.remove(); 4244 }, 4245 error: function () { 4246 $megaFixedNlo.removeClass("nlo-loadings"); 4247 }, 4248 }); 4249 }, 300); 4250 } 4251 } 4252 4253 $(".mega_fixed_menu").fadeIn(animationTime); 4254 }); 4255 4256 $(".mega_fixed_menu .svg.svg-close").on("click", function () { 4257 $(this).closest(".mega_fixed_menu").fadeOut(animationTime); 4258 //$('.header_wrap').toggleClass('zindexed'); 4259 }); 4260 4261 $(".mega_fixed_menu .dropdown-menu .arrow").on("click", function (e) { 4262 e.preventDefault(); 4263 e.stopPropagation(); 4264 $(this).closest(".dropdown-submenu").find(".dropdown-menu").slideToggle(animationTime); 4265 $(this).closest(".dropdown-submenu").addClass("opened"); 4266 }); 4267}; 4268 4269CheckPopupTop = function () {}; 4270 4271AjaxClickLink = function (e) { 4272 var _this = "", 4273 container = $(".js-load-wrapper"), 4274 container_inner = $(".js-load-wrapper").find(".ajax_load"), 4275 dopAction = ""; 4276 url = ""; 4277 if ("preventDefault" in e) { 4278 e.preventDefault();
4279 _this = $(e.target).hasClass("js-load-link") ? $(e.target) : $(e.target).closest(".js-load-link"); 4280 } else { 4281 _this = $(e); 4282 dopAction = "Y"; 4283 } 4284 4285 if (container.length) { 4286 var objUrl = parseUrlQuery(), 4287 obGetData = { ajax_get_filter: "Y", control_ajax: "Y" }; 4288 4289 obGetData.bitrix_include_areas = "N"; 4290 4291 if ("clear_cache" in objUrl) { 4292 if (objUrl.clear_cache == "Y") { 4293 obGetData.clear_cache = "Y"; 4294 } 4295 } 4296 4297 if (container_inner.length) { 4298 container_inner.addClass("loading-state"); 4299 } else { 4300 container.addClass("loading-state"); 4301 } 4302 4303 if (_this.data("url")) { 4304 url = _this.data("url"); 4305 } 4306 4307 if (_this.data("click_block") && $(_this.data("click_block")).length) { 4308 if ($(_this.data("click_block")).data("url")) { 4309 url = $(_this.data("click_block")).data("url"); 4310 } 4311 } 4312 4313 if (dopAction) { 4314 BX.PopupWindowManager.getCurrentPopup().close(); 4315 $(".bx_filter_select_popup ul li .sort_btn").removeClass("current"); 4316 _this.addClass("current"); 4317 _this.closest(".bx_filter_block").find(".bx_filter_select_text").text(_this.text()); 4318 } 4319 4320 $(".bx_filter .bx_sort_filter .bx_filter_select_text").text(_this.text()); 4321 $(".bx_filter .bx_sort_filter .bx_filter_select_popup ul li span.current").removeClass("current"); 4322 $(".bx_filter .bx_sort_filter .bx_filter_select_popup ul li") 4323 .eq(_this.parent().index()) 4324 .find("span") 4325 .addClass("current"); 4326 4327 $.ajax({ 4328 url: url, 4329 data: obGetData, 4330 success: function (html) { 4331 container.html(html); 4332 4333 if (container_inner.length) container_inner.removeClass("loading-state"); 4334 else container.removeClass("loading-state"); 4335 4336 initAnimateLoad(); 4337 4338 var eventdata = { action: "jsLoadBlock" }; 4339 BX.onCustomEvent("onCompleteAction", [eventdata, _this]); 4340 4341 BX.onCustomEvent("onHeaderProgressBarChange", [{}]); 4342 4343 initSelects(document); 4344 // InitCustomScrollBar(); 4345 // InitScrollBar(); 4346 4347 if (window.FilterHelper !== undefined) { 4348 FilterHelper.resultDiv = $("#filter-helper"); 4349 FilterHelper.show(); 4350 } 4351 }, 4352 }); 4353 } 4354}; 4355 4356initCalculatePreview = function (removeAppearAttr) { 4357 $(".calculate-delivery.with_preview:not(.inited)").each(function () { 4358 if (removeAppearAttr) { 4359 $(this).attr("data-i-appeared", ""); 4360 } 4361 var $this = $(this); 4362 var $calculateSpan = $this.find("span[data-event=jqm]"); 4363 var $preview = $this.find(".calculate-delivery-preview"); 4364 4365 $this.addClass("inited"); 4366 $this.iAppear( 4367 function () { 4368 if ($calculateSpan.length) { 4369 if (typeof window["calculate-delivery-preview-index"] === "undefined") { 4370 window["calculate-delivery-preview-index"] = 1001; 4371 } else { 4372 ++window["calculate-delivery-preview-index"]; 4373 } 4374 4375 var productId = $calculateSpan.attr("data-param-product_id") * 1; 4376 var quantity = $calculateSpan.attr("data-param-quantity") * 1; 4377 4378 if (productId > 0) { 4379 var areaIndexSended = window["calculate-delivery-preview-index"]; 4380 $calculateSpan.data({ areaIndex: areaIndexSended }); 4381 4382 $.ajax({ 4383 url: arAsproOptions["SITE_DIR"] + "ajax/delivery.php", 4384 type: "POST", 4385 data: { 4386 is_preview: "Y", 4387 index: areaIndexSended, 4388 product_id: productId, 4389 quantity: quantity, 4390 }, 4391 beforeSend: function () { 4392 $this.addClass("loadings"); 4393 }, 4394 success: function (response) { 4395 var areaIndex = $calculateSpan.data("areaIndex"); 4396 if (typeof areaIndex !== "undefined" && areaIndex == areaIndexSended) { 4397 $calculateSpan.hide(); 4398 $preview.html(response); 4399 if (!$preview.find(".catalog-delivery-preview").length) { 4400 $preview.empty(); 4401 $calculateSpan.show(); 4402 } 4403 } 4404 }, 4405 error: function (xhr, ajaxOptions, thrownError) {}, 4406 complete: function () { 4407 var areaIndex = $calculateSpan.data("areaIndex"); 4408 if (typeof areaIndex !== "undefined" && areaIndex == areaIndexSended) { 4409 $this.removeClass("loadings"); 4410 } 4411 }, 4412 }); 4413 } 4414 } 4415 }, 4416 { accX: 0, accY: 0 } 4417 ); 4418 }); 4419}; 4420 4421/*set price item*/ 4422if (!funcDefined("setPriceItem")) { 4423 var setPriceItem = function setPriceItem( 4424 main_block, 4425 quantity, 4426 rewrite_price, 4427 check_quantity, 4428 is_sku, 4429 show_percent, 4430 percent 4431 ) { 4432 var old_quantity = main_block.find(".to-cart").attr("data-ratio"), 4433 value = 4434 typeof rewrite_price !== "undefined" && rewrite_price 4435 ? rewrite_price 4436 : main_block.find(".to-cart").attr("data-value"), 4437 currency = main_block.find(".to-cart").attr("data-currency"), 4438 total_block = 4439 '<div class="total_summ" style="display:none;"><div>' +
4440 BX.message("TOTAL_SUMM_ITEM") + 4441 "<span></span></div></div>", 4442 price_block = main_block.find(".cost.prices"), 4443 use_percent = typeof show_percent !== "undefined" && show_percent == "Y", 4444 percent_number = typeof percent !== "undefined" && percent, 4445 sku_checked = main_block.find(".has_offer_prop").length ? "Y" : "N", 4446 check = typeof check_quantity !== "undefined" && check_quantity; 4447 4448 if (main_block.find(".counter_wrapp + .wrapp-one-click").length) { 4449 if (!main_block.find(".wrapp-one-click .total_summ").length && !is_sku) 4450 $(total_block).appendTo(main_block.find(".counter_wrapp + .wrapp-one-click")); 4451 } else if (main_block.find(".buy_block").length) { 4452 if (!main_block.find(".buy_block .total_summ").length && !is_sku) 4453 $(total_block).appendTo(main_block.find(".buy_block")); 4454 } else if (main_block.find(".counter_wrapp").length) { 4455 if (!main_block.find(".counter_wrapp .total_summ").length && !is_sku) 4456 $(total_block).appendTo(main_block.find(".counter_wrapp:first")); 4457 } 4458 if (main_block.find(".total_summ").length) { 4459 if (value && currency) { 4460 if ((1 == quantity && old_quantity == quantity) || (typeof is_sku !== "undefined" && is_sku && !check)) { 4461 main_block.find(".total_summ").slideUp(50); 4462 } else { 4463 main_block.find(".total_summ span").html(BX.Currency.currencyFormat(value * quantity, currency, true)); 4464 if (main_block.find(".total_summ").is(":hidden") /* || sku_checked == 'Y'*/) 4465 main_block.find(".total_summ").slideDown(100); 4466 } 4467 } else { 4468 main_block.find(".total_summ").slideUp(100); 4469 } 4470 } 4471 }; 4472} 4473 4474if (!funcDefined("getCurrentPrice")) { 4475 var getCurrentPrice = function getCurrentPrice(price, currency, print_price) { 4476 var val = ""; 4477 var format_value = BX.Currency.currencyFormat(price, currency); 4478 if (print_price.indexOf(format_value) >= 0) { 4479 val = print_price.replace( 4480 format_value, 4481 '<span class="price_value">' + format_value + '</span><span class="price_currency">' 4482 ); 4483 val += "</span>"; 4484 } else { 4485 val = print_price; 4486 } 4487 4488 return val; 4489 }; 4490} 4491 4492if (!funcDefined("initAnimateLoad")) { 4493 var initAnimateLoad = function initAnimateLoad() { 4494 $(".animate-load").click(function () { 4495 if (!jQuery.browser.mobile) { 4496 $(this).parent().addClass("loadings"); 4497 } 4498 }); 4499 }; 4500} 4501 4502if (!funcDefined("showBasketShareBtn")) { 4503 var showBasketShareBtn = function () { 4504 if (arAsproOptions["THEME"]["SHOW_SHARE_BASKET"] === "Y") { 4505 if (!document.querySelector(".basket-checkout-block-btns")) { 4506 var checkout = document.querySelector(".basket-checkout-section-inner"); 4507 if (checkout) { 4508 var btns = BX.create({ 4509 tag: "div", 4510 attrs: { 4511 class: "basket-checkout-block basket-checkout-block-btns", 4512 }, 4513 html: '<div class="basket-checkout-block-btns-wrap"></div>', 4514 }); 4515 4516 BX.insertAfter(btns, BX.lastChild(checkout)); 4517 var btnsWrap = btns.querySelector(".basket-checkout-block-btns-wrap"); 4518 4519 var btnCheckout = checkout.querySelector(".basket-checkout-block-btn"); 4520 if (btnCheckout) { 4521 btnsWrap.appendChild(btnCheckout); 4522 } 4523 4524 var btnFastOrder = checkout.querySelector(".fastorder"); 4525 if (btnFastOrder) { 4526 btnsWrap.appendChild(btnFastOrder); 4527 } 4528 4529 if ($(".basket-btn-checkout").length && !$(".basket-btn-checkout").hasClass("disabled")) { 4530 var btnShareBasket = BX.create({ 4531 tag: "div", 4532 attrs: { 4533 class: "basket-checkout-block basket-checkout-block-share colored_theme_hover_bg-block", 4534 title: arAsproOptions["THEME"]["EXPRESSION_FOR_SHARE_BASKET"], 4535 }, 4536 html: 4537 '<span class="animate-load" data-event="jqm" data-param-form_id="share_basket" data-name="share_basket"><i class="svg colored_theme_hover_bg-el-svg"><svg class="svg svg-share" xmlns="http://www.w3.org/2000/svg" width="14" height="16" viewB
4537ox="0 0 14 16"><path data-name="Ellipse 223 copy 8" d="M1613,203a2.967,2.967,0,0,1-1.86-.661l-3.22,2.01a2.689,2.689,0,0,1,0,1.3l3.22,2.01A2.961,2.961,0,0,1,1613,207a3,3,0,1,1-3,3,3.47,3.47,0,0,1,.07-0.651l-3.21-2.01a3,3,0,1,1,0-4.678l3.21-2.01A3.472,3.472,0,0,1,1610,200,3,3,0,1,1,1613,203Zm0,8a1,1,0,1,0-1-1A1,1,0,0,0,1613,211Zm-8-7a1,1,0,1,0,1,1A1,1,0,0,0,1605,204Zm8-5a1,1,0,1,0,1,1A1,1,0,0,0,1613,199Z" transform="translate(-1602 -197)" fill="#B8B8B8"></path></svg></i><span class="title">' + 4538 arAsproOptions["THEME"]["EXPRESSION_FOR_SHARE_BASKET"] + 4539 "</span></span>", 4540 }); 4541 4542 btnsWrap.appendChild(btnShareBasket); 4543 initAnimateLoad(); 4544 } 4545 } 4546 } 4547 } 4548 }; 4549} 4550 4551if (!funcDefined("showBasketHeadingBtn")) { 4552 var showBasketHeadingBtn = function () { 4553 if (document.querySelector(".page-top h1")) { 4554 var topicHeading = document.querySelector(".page-top .topic .topic__heading"); 4555 if (topicHeading) { 4556 if (arAsproOptions["THEME"]["SHOW_BASKET_PRINT"] === "Y") { 4557 if (!document.querySelector(".btn_basket_heading--print")) { 4558 var btnPrintBasket = BX.create({ 4559 tag: "div", 4560 attrs: { 4561 class: "btn_basket_heading btn_basket_heading--print print-link colored_theme_hover_bg-block", 4562 title: arAsproOptions["THEME"]["EXPRESSION_FOR_PRINT_PAGE"], 4563 }, 4564 html: '<i class="svg colored_theme_hover_bg-el-svg"><svg class="svg svg-print" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path id="Rectangle_665_copy_4" data-name="Rectangle 665 copy 4" class="cls-print" d="M1570,210h-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,1570,210Zm-8,1h4v-4h-4v4Zm4-12h-4v2h4v-2Zm4,4h-12v5h2v-3h8v3h2v-5Z" transform="translate(-1556 -197)"></path></svg></i>', 4565 }); 4566 BX.insertBefore(btnPrintBasket, topicHeading); 4567 } 4568 } 4569 4570 if ($(".basket-btn-checkout").length && !$(".basket-btn-checkout").hasClass("disabled")) { 4571 // if(arAsproOptions['THEME']['SHOW_SEND_BASKET_2EMAIL'] === 'Y'){ 4572 // if(!document.querySelector('.btn_basket_heading--send2email')){ 4573 // var btnSendBasket2Email = BX.create({ 4574 // tag: 'div', 4575 // attrs: { 4576 // class: 'btn_basket_heading btn_basket_heading--with_title btn_basket_heading--send2email colored_theme_hover_bg-block', 4577 // title: arAsproOptions['THEME']["EXPRESSION_FOR_SEND_BASKET_2EMAIL"], 4578 // }, 4579 // html: '<i class="svg colored_theme_hover_bg-el-svg"><svg class="svg" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3 0H4H12H13V1V3.125L15.06 4.4125C15.6448 4.77798 16 5.41892 16 6.1085V6.98162C16.0002 6.99325 16.0002 7.00488 16 7.01649V14C16 15.1046 15.1046 16 14 16H2C0.895429 16 -1.43918e-06 15.1046 -1.43918e-06 14V7.01644C-0.000202747 7.00486 -0.000203195 6.99327 -1.43918e-06 6.98167V6.1085C-1.43918e-06 5.41892 0.355238 4.77798 0.940001 4.4125L3 3.125V1V0ZM5 4.2335L5 2H11V7L11 8.23381L9.62943 9.05615L8.64018 8.23178C8.26934 7.92274 7.73066 7.92274 7.35981 8.23178L6.37057 9.05615L5 8.23381V4.2335ZM2 6.1085L3 5.4835V7.03381L2 6.43381V6.1085ZM14 6.1085L13 5.4835V7.03381L14 6.43381V6.1085ZM12.4379 14L8 10.3017L3.56205 14H12.4379ZM14 12.6983V8.76619L11.2567 10.4122L14 12.6983ZM2 8.76619V12.6983L4.74333 10.4122L2 8.76619Z" fill="#B8B8B8"/></svg></i><span class="title">' + arAsproOptions['THEME']["EXPRESSION_FOR_SEND_BASKET_2EMAIL"] + '</span>', 4580 // }); 4581 // BX.insertBefore(btnSendBasket2Email, topicHeading); 4582 // } 4583 // } 4584 4585 if (arAsproOptions["THEME"]["SHOW_DOWNLOAD_BASKET"] === "Y") { 4586 if (!document.querySelector(".btn_basket_heading--download")) { 4587 var btnDownloadBasket = BX.create({ 4588 tag: "div", 4589 attrs: { 4590 class: 4591 "btn_basket_heading btn_basket_heading--with_title btn_basket_heading--download colored_theme_hover_bg-block", 4592 title: arAsproOptions["THEME"]["EXPRESSION_FOR_DOWNLOAD_BASKET"], 4593 }, 4594 events: { 4595 click: BX.proxy(function (e) { 4596 if (!e) { 4597 e = window.event; 4598 } 4599 4600 BX.PreventDefault(e); 4601 4602 var button = e.target.closest(".btn_basket_heading"); 4603 if (button) { 4604 if (BX.hasClass(button, "loadings")) { 4605 return; 4606 } 4607 4608 BX.addClass(button, "loadings"); 4609 setTimeout(function () { 4610 BX.removeClass(button, "loadings"); 4611 }, 2000); 4612 } 4613 4614 location.href = 4615 arAsproOptions["SITE_DIR"] + "ajax/download_basket.php?params[type]=" + 4616 arAsproOptions["THEME"]["BASKET_FILE_DOWNLOAD_TEMPLATE"]; 4617 }, this), 4618 }, 4619 html: 4620 '<i class="svg colored_theme_hover_bg-el-svg">
4620<svg class="svg" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M5 14H14L14 6H11H10V5V2H5V6H7H9V8V10V12H7H5V14ZM13.6716 4L12 2.32843V4H13.6716ZM6 8H7V10H6H5H3H2V8H3H5H6ZM3 6H2H0V8V10V12H2H3V14V16H5H14H16V14V4.32843C16 3.79799 15.7893 3.28929 15.4142 2.91421L13.0858 0.585786C12.7107 0.210714 12.202 0 11.6716 0H5H3V2V6Z" fill="#B8B8B8"/></svg></i><span class="title">' + 4621 arAsproOptions["THEME"]["EXPRESSION_FOR_DOWNLOAD_BASKET"] + 4622 "</span>", 4623 }); 4624 BX.insertBefore(btnDownloadBasket, topicHeading); 4625 } 4626 } 4627 } else { 4628 BX.remove(document.querySelector(".btn_basket_heading--send2email")); 4629 BX.remove(document.querySelector(".btn_basket_heading--download")); 4630 } 4631 4632 var eventdata = { parent: topicHeading }; 4633 BX.onCustomEvent("onShowBasketHeadingBtn", [eventdata]); 4634 } 4635 } 4636 }; 4637} 4638 4639$(window).on("load", function () { 4640 //check width for menu and search 4641 //CheckSearchWidth(); 4642}); 4643 4644$(document).ready(function () { 4645 MegaMenuFixed(); 4646 // InitScrollBar(); 4647 4648 /*ripple effect for buttons*/ 4649 $.ripple(".btn", { 4650 debug: false, // Turn Ripple.js logging on/off 4651 on: "mouseenter", // The event to trigger a ripple effect 4652 4653 opacity: 0.4, // The opacity of the ripple 4654 color: "auto", // Set the background color. If set to "auto", it will use the text color 4655 multi: true, // Allow multiple ripples per element 4656 4657 duration: 0.6, // The duration of the ripple 4658 4659 easing: "linear", // The CSS3 easing function of the ripple 4660 }); 4661 /**/ 4662 4663 //ecommerce order 4664 if (arAsproOptions["PAGES"]["ORDER_PAGE"]) { 4665 var arUrl = parseUrlQuery(); 4666 if ("ORDER_ID" in arUrl) { 4667 var _id = arUrl["ORDER_ID"]; 4668 if (arAsproOptions["COUNTERS"]["USE_FULLORDER_GOALS"] !== "N") { 4669 var eventdata = { goal: "goal_order_success", result: _id }; 4670 BX.onCustomEvent("onCounterGoals", [eventdata]); 4671 } 4672 if (checkCounters()) { 4673 if (typeof localStorage !== "undefined") { 4674 var val = localStorage.getItem("gtm_e_" + _id), 4675 d = ""; 4676 try { 4677 d = JSON.parse(val); 4678 } catch (e) { 4679 d = val; 4680 } 4681 if (typeof d === "object") { 4682 window.dataLayer = window.dataLayer || []; 4683 dataLayer.push({ event: arAsproOptions["COUNTERS"]["GOOGLE_EVENTS"]["PURCHASE"], ecommerce: d }); 4684 } 4685 4686 if (typeof localStorage !== "undefined") { 4687 localStorage.removeItem("gtm_e_" + _id); 4688 } 4689 } 4690 } 4691 } 4692 } 4693 var bSafary = false; 4694 if (typeof jQuery.browser == "object") bSafary = jQuery.browser.safari; 4695 else if (typeof browser == "object") bSafary = browser.safari; 4696 if (!bSafary) { 4697 CheckTopMenuDotted(); 4698 CheckHeaderFixed(); 4699 checkMenuLines(); 4700 } else { 4701 setTimeout(function () { 4702 $(window).resize(); // need to check resize flexslider & menu 4703 setTimeout(function () { 4704 CheckTopMenuDotted(); 4705 CheckHeaderFixed(); 4706 checkMenuLines(); 4707 4708 setTimeout(function () { 4709 $(window).scroll(); 4710 }, 50); 4711 }, 50); 4712 }, 350); 4713 } 4714 4715 showItemStoresAmount(); 4716 4717 if (arAsproOptions["THEME"]["USE_DEBUG_GOALS"] === "Y") $.cookie("_ym_debug", 1, { path: "/" }); 4718 else $.cookie("_ym_debug", null, { path: "/" }); 4719 4720 /* change type2 menu for fixed */ 4721 if ($("#headerfixed .js-nav").length) { 4722 setTimeout(function () { 4723 $("#headerfixed .js-nav").addClass("opacity1"); 4724 }, 350); 4725 } 4726 4727 // -- scroll after apply option 4728 if ($(".instagram_ajax").length) { 4729 BX.addCustomEvent("onCompleteAction", function (eventdata) { 4730 if (eventdata.action === "instagrammLoaded") scrollPreviewBlock(); 4731 }); 4732 } else scrollPreviewBlock(); 4733 4734 scrollToTop(); 4735 checkVerticalMobileFilter(); 4736 4737 $("[data-scroll-block]").click(function () { 4738 var _this = $(this); 4739 if (_this.data("scrollBlock")) { 4740 var target = $(_this.data("scrollBlock")); 4741 if (target.length) { 4742 scroll_block(target); 4743 } 4744 } 4745 }); 4746 4747 $.extend($.validator.messages, { 4748 required: BX.message("JS_REQUIRED"), 4749 email: BX.message("JS_FORMAT"), 4750 equalTo: BX.message("JS_PASSWORD_COPY"), 4751 minlength: BX.message("JS_PASSWORD_LENGTH"), 4752 remote: BX.message("JS_ERROR"),
4753 }); 4754 4755 $.validator.addMethod( 4756 "regexp", 4757 function (value, element, regexp) { 4758 var re = new RegExp(regexp); 4759 return this.optional(element) || re.test(value); 4760 }, 4761 BX.message("JS_FORMAT") 4762 ); 4763 4764 $.validator.addMethod( 4765 "filesize", 4766 function (value, element, param) { 4767 return this.optional(element) || element.files[0].size <= param; 4768 }, 4769 BX.message("JS_FILE_SIZE") 4770 ); 4771 4772 $.validator.addMethod( 4773 "date", 4774 function (value, element, param) { 4775 var status = false; 4776 if (!value || value.length <= 0) { 4777 status = false; 4778 } else { 4779 // html5 date allways yyyy-mm-dd 4780 var re = new RegExp("^([0-9]{4})(.)([0-9]{2})(.)([0-9]{2})$"); 4781 var matches = re.exec(value); 4782 if (matches) { 4783 var composedDate = new Date(matches[1], matches[3] - 1, matches[5]); 4784 status = 4785 composedDate.getMonth() == matches[3] - 1 && 4786 composedDate.getDate() == matches[5] && 4787 composedDate.getFullYear() == matches[1]; 4788 } else { 4789 // firefox 4790 var re = new RegExp("^([0-9]{2})(.)([0-9]{2})(.)([0-9]{4})$"); 4791 var matches = re.exec(value); 4792 if (matches) { 4793 var composedDate = new Date(matches[5], matches[3] - 1, matches[1]); 4794 status = 4795 composedDate.getMonth() == matches[3] - 1 && 4796 composedDate.getDate() == matches[1] && 4797 composedDate.getFullYear() == matches[5]; 4798 } 4799 } 4800 } 4801 return status; 4802 }, 4803 BX.message("JS_DATE") 4804 ); 4805 4806 $.validator.addMethod( 4807 "extension", 4808 function (value, element, param) { 4809 param = typeof param === "string" ? param.replace(/,/g, "|") : "png|jpe?g|gif"; 4810 return this.optional(element) || value.match(new RegExp(".(" + param + ")$", "i")); 4811 }, 4812 BX.message("JS_FILE_EXT") 4813 ); 4814 4815 $.validator.addMethod( 4816 "captcha", 4817 function (value, element, params) { 4818 return $.validator.methods.remote.call(this, value, element, { 4819 url: arAsproOptions["SITE_DIR"] + "ajax/check-captcha.php", 4820 type: "post", 4821 data: { 4822 captcha_word: value, 4823 captcha_sid: function () { 4824 return $(element).closest("form").find('input[name="captcha_sid"]').val(); 4825 }, 4826 }, 4827 }); 4828 }, 4829 BX.message("JS_ERROR") 4830 ); 4831 4832 $.validator.addMethod( 4833 "recaptcha", 4834 function (value, element, param) { 4835 var id = $(element).closest("form").find(".g-recaptcha").attr("data-widgetid"); 4836 if (typeof id !== "undefined") { 4837 return grecaptcha.getResponse(id) != ""; 4838 } else { 4839 return true; 4840 } 4841 }, 4842 BX.message("JS_RECAPTCHA_ERROR") 4843 ); 4844 4845 $.validator.addClassRules({ 4846 /*phone: { 4847 regexp: arAsproOptions["THEME"]["VALIDATE_PHONE_MASK"], 4848 },*/ 4849 confirm_password: { 4850 equalTo: 'input[name="REGISTER[PASSWORD]"]', 4851 minlength: 6, 4852 }, 4853 password: { 4854 minlength: 6, 4855 }, 4856 inputfile: { 4857 extension: arAsproOptions["THEME"]["VALIDATE_FILE_EXT"], 4858 filesize: 5000000, 4859 }, 4860 captcha: { 4861 captcha: "", 4862 }, 4863 recaptcha: { 4864 recaptcha: "", 4865 }, 4866 }); 4867 4868 // init calculate delivery with preview 4869 initCalculatePreview(); 4870 4871 // fix calendar popup zIndex 4872 BX.addCustomEvent("onPopupShow", function (popup) { 4873 if ( 4874 typeof popup !== "undefined" && 4875 popup && 4876 popup.zIndexComponent && 4877 popup.popupContainer && 4878 popup.popupContainer.querySelector(".bx-calendar") 4879 ) { 4880 popup.zIndexComponent.setZIndex(3000); 4881 } 4882 }); 4883 4884 /*city*/ 4885 $("select.region").on("change", function () { 4886 var val = parseInt($(this).val()); 4887 if ($("select.city").length) { 4888 if (val) { 4889 $("select.city option").hide(); 4890 $("select.city option").prop("disabled", "disabled"); 4891 $("select.city option[data-parent_section=" + val + "]").prop("disabled", ""); 4892 $("select.city option:eq(0)").prop("disabled", ""); 4893 $("select.city").ikSelect("reset"); 4894 $("select.city option[data-parent_section=" + val + "]").show(); 4895 } else $("select.city option").prop("disabled", "disabled"); 4896 $("select.city option:eq(0)").prop("disabled", ""); 4897 $("select.city").ikSelect("reset"); 4898 } 4899 }); 4900 4901 $("select.city, select.region").on("change", function () { 4902 var _this = $(this), 4903 val = parseInt(_this.val()); 4904 if (_this.hasClass("region")) { 4905 $("select.city option:eq(0)").show(); 4906 $("select.city").val(0); 4907 } 4908 4909 if ((_this.hasClass("region") && !val) || _this.hasClass("city")) { 4910 $.ajax({ 4911 type: "POST", 4912 data: { ID: val }, 4913 success: function (html) { 4914 var ob = BX.processHTML(html); 4915 $(".ajax_items")[0].innerHTML = ob.HTML; 4916 BX.ajax.processScripts(ob.SCRIPT); 4917 }, 4918 }); 4919 } 4920 }); 4921 4922 $(document).on("mouseenter", ".section-gallery-wrapper .section-gallery-wrapper__item", function () { 4923 $(this).siblings().removeClass("_active"); 4924 $(this).addClass("_active"); 4925 }); 4926 4927 $(document).on("mouseleave", ".image_wrapper_block", function () { 4928 const $elements = $(this).find(".section-gallery-wrapper .section-gallery-wrapper__item"); 4929 if ($elements.length) { 4930 $elements.removeClass("_active"); 4931 $($elements[0]).addClass("_active"); 4932 } 4933 }); 4934 4935 $(document).on("click", ".hint .icon", function (e) {
4936 var tooltipWrapp = $(this).closest(".hint"); 4937 4938 if (tooltipWrapp.hasClass("active")) { 4939 tooltipWrapp.removeClass("active").find(".tooltip").slideUp(200); 4940 } else { 4941 tooltipWrapp.addClass("active"); 4942 tooltipWrapp.find(".tooltip").slideDown(200); 4943 tooltipWrapp.find(".tooltip_close").click(function (e) { 4944 e.stopPropagation(); 4945 tooltipWrapp.removeClass("active").find(".tooltip").slideUp(100); 4946 }); 4947 } 4948 e.stopPropagation(); 4949 }); 4950 4951 /* toggle */ 4952 var $this = this, 4953 previewParClosedHeight = 25; 4954 4955 $("section.toggle > label").prepend($("<i />").addClass("fa fa-plus")); 4956 $("section.toggle > label").prepend($("<i />").addClass("fa fa-minus")); 4957 $("section.toggle.active > p").addClass("preview-active"); 4958 $("section.toggle.active > div.toggle-content").slideDown(350, function () {}); 4959 4960 $("section.toggle > label").click(function (e) { 4961 var parentSection = $(this).parent(), 4962 parentWrapper = $(this).parents("div.toogle"), 4963 previewPar = false, 4964 isAccordion = parentWrapper.hasClass("toogle-accordion"); 4965 4966 if (isAccordion && typeof e.originalEvent != "undefined") { 4967 parentWrapper.find("section.toggle.active > label").trigger("click"); 4968 } 4969 4970 parentSection.toggleClass("active"); 4971 4972 // Preview Paragraph 4973 if (parentSection.find("> p").get(0)) { 4974 previewPar = parentSection.find("> p"); 4975 var previewParCurrentHeight = previewPar.css("height"); 4976 previewPar.css("height", "auto"); 4977 var previewParAnimateHeight = previewPar.css("height"); 4978 previewPar.css("height", previewParCurrentHeight); 4979 } 4980 4981 // Content 4982 var toggleContent = parentSection.find("> div.toggle-content"); 4983 4984 if (parentSection.hasClass("active")) { 4985 $(previewPar).animate( 4986 { 4987 height: previewParAnimateHeight, 4988 }, 4989 350, 4990 function () { 4991 $(this).addClass("preview-active"); 4992 } 4993 ); 4994 toggleContent.slideDown(350, function () {}); 4995 } else { 4996 $(previewPar).animate( 4997 { 4998 height: previewParClosedHeight, 4999 }, 5000 350, 5001 function () { 5002 $(this).removeClass("preview-active"); 5003 } 5004 ); 5005 toggleContent.slideUp(350, function () {}); 5006 } 5007 }); 5008 5009 if (typeof $.fn.footable == "function") { 5010 $(".tables-responsive .responsive").footable(); //responsive table 5011 } 5012 5013 $("a[rel=tooltip]").tooltip(); 5014 $("span[data-toggle=tooltip]").tooltip(); 5015 5016 $(document).on("click", ".toggle .more_items", function () { 5017 $(this).closest(".toggle").find(".collapsed").removeClass("collapsed"); 5018 $(this).remove(); 5019 if (typeof $(this).data("resize") !== "undefined" && $(this).data("resize")) $(window).resize(); 5020 }); 5021 $(document).on("click", ".toggle_menu .more_items", function () { 5022 $(this).closest(".toggle_menu").find(".collapsed").addClass("clicked_exp"); 5023 $(this).remove(); 5024 }); 5025 5026 /* search sync */ 5027 $(document).on("keyup", ".search-input-div input", function (e) { 5028 var inputValue = $(this).val(); 5029 $(".search-input-div input:not(:focus").val(inputValue); 5030 5031 if ($(this).closest("#headerfixed").length) { 5032 if (e.keyCode == 13) $(".search form").submit(); 5033 } 5034 }); 5035 $(document).on("click", ".search-button-div button", function (e) { 5036 if ($(this).closest("#headerfixed").length) $(".search form").submit(); 5037 }); 5038 5039 $(".inline-search-show, .inline-search-hide").on("click", function (e) { 5040 CloseMobilePhone(); 5041 // Closing hint list of items after search input loses focus 5042 if (e.target.closest(".inline-search-hide")) { 5043 if (typeof jsControl === "object" && jsControl && "onFocusLost" in jsControl) { 5044 jsControl.onFocusLost(); 5045 } 5046 } 5047 if (typeof $(this).data("type_search") != "undefined" && $(this).data("type_search") == "fixed") 5048 $(".inline-search-block").addClass("fixed"); 5049 5050 if (arAsproOptions["THEME"]["TYPE_SEARCH"] == "fixed") { 5051 /*setTimeout(function(){ 5052 $('.inline-search-block.fixed.big .search-input').focus(); 5053 }, 200);*/ 5054 $(".inline-search-block.fixed.big .search-input").focus(); 5055 } 5056 if (arAsproOptions["THEME"]["TYPE_SEARCH"] != "fixed") { 5057 $("#title-search-input").focus(); 5058 } 5059 5060 $(".inline-search-block").toggleClass("show"); 5061 if ($(".top-block").length) { 5062 if ($(".inline-search-block").hasClass("show")) 5063 $(".inline-search-block").css("background", $(".top-block").css("background-color")); 5064 else $(".inline-search-block").css("background", "#fff"); 5065 } 5066 if (arAsproOptions["THEME"]["TYPE_SEARCH"] == "fixed") {
5067 if ($(".inline-search-block").hasClass("show")) $('<div class="jqmOverlay search"></div>').appendTo("body"); 5068 else { 5069 $("#title-search-input").blur(); 5070 $(".jqmOverlay").detach(); 5071 } 5072 } 5073 // } 5074 // else 5075 // location.href = arAsproOptions['PAGES']['CATALOG_PAGE_URL']+'?q'; 5076 }); 5077 5078 /* close search block */ 5079 $("html, body").on("mousedown", function (e) { 5080 if (typeof e.target.className == "string" && e.target.className.indexOf("adm") < 0) { 5081 e.stopPropagation(); 5082 5083 var search_target = $(e.target).closest(".title-search-result"); 5084 if ( 5085 !$(e.target).closest("inline-search-block").length && 5086 !$(e.target).closest(".dropdown-select.searchtype").length && 5087 !$(e.target).hasClass("svg") && 5088 !search_target.length 5089 ) { 5090 $(".inline-search-block").removeClass("show"); 5091 $(".title-search-result").hide(); 5092 if (arAsproOptions["THEME"]["TYPE_SEARCH"] == "fixed") $(".jqmOverlay.search").detach(); 5093 } 5094 5095 if ($("#mobilePhone").length) { 5096 CloseMobilePhone(); 5097 } 5098 5099 if ($("#basket_line .basket_fly").length && parseInt($("#basket_line .basket_fly").css("right")) >= 0) { 5100 if (!$(e.target).closest(".basket_wrapp").length) { 5101 $("#basket_line .basket_fly") 5102 .stop() 5103 .animate({ right: -$("#basket_line .basket_fly").outerWidth() }, 150); 5104 $("#basket_line .basket_fly .opener > div").removeClass("cur"); 5105 $("#basket_line .basket_fly").removeClass("swiped"); 5106 } 5107 } 5108 5109 if (isMobile) { 5110 if (search_target.length) location.href = search_target.attr("href"); 5111 } 5112 5113 if (!$(e.target).closest(".js-info-block").length && !$(e.target).closest(".js-show-info-block").length) { 5114 $(".js-show-info-block").removeClass("opened"); 5115 $(".js-info-block").fadeOut(); 5116 } 5117 5118 if (!$(e.target).closest(".hint.active").length) { 5119 $(".hint.active .icon").trigger("click"); 5120 } 5121 5122 var class_name = $(e.target).attr("class"); 5123 if (typeof class_name == "undefined" || class_name.indexOf("tooltip") < 0) 5124 //tooltip link 5125 $(".tooltip-link").tooltip("hide"); 5126 } 5127 }); 5128 $(".inline-search-block") 5129 .find("*") 5130 .on("mousedown", function (e) { 5131 e.stopPropagation(); 5132 }); 5133 5134 initAnimateLoad(); 5135 5136 /*check all opt table items*/ 5137 $(document).on("change", "input#select_all_items", function () { 5138 var _this = $(this); 5139 var notOfferCount = 0; 5140 var bComplect = _this.closest(".complect_main_wrap").length; 5141 if (bComplect) { 5142 notOfferCount = _this 5143 .closest(".complect_main_wrap") 5144 .find(".catalog-block-view__item .counter_wrapp:not(.ce_cmp_visible) .button_block .to-cart").length; 5145 } else { 5146 notOfferCount = $( 5147 ".table-view__item:not([data-product_type=3]), .table-view-offer-tree .table-view__item[data-product_type=3] .counter_wrapp:not(.ce_cmp_visible)" 5148 ).find(".button_block .to-cart").length; 5149 } 5150 var wishCount = $( 5151 ".table-view__item:not([data-product_type=3]), .table-view-offer-tree .table-view__item[data-product_type=3]" 5152 ).find(".item-icons .wish_item_button .wish_item.to").length; 5153 var allGoodsCount = $(".table-view__item").length; 5154 5155 if (_this.is(":checked")) { 5156 //buy && wish 5157 if (notOfferCount != 0) { 5158 $(".opt_action:not([data-action=compare])").removeClass("no-action"); 5159 } 5160 5161 //compare 5162 $(".opt_action[data-action=compare]").removeClass("no-action"); 5163 5164 $(".opt_action").addClass("animate-load"); 5165 $(".opt_action .text").remove(); 5166 5167 //buy 5168 $('<div class="text">(<span>' + notOfferCount + "</span>)</div>").appendTo($(".opt_action[data-action=buy]")); 5169 5170 //wish 5171 $('<div class="text muted">(<span>' + wishCount + "</span>)</div>").appendTo($(".opt_action[data-action=wish]")); 5172 5173 //compare 5174 $('<div class="text muted">(<span>' + allGoodsCount + "</span>)</div>").appendTo( 5175 $(".opt_action[data-action=compare]") 5176 ); 5177 5178 $('input[name="chec_item"]').prop("checked", "checked"); 5179 } else { 5180 $(".opt_action").addClass("no-action"); 5181 $(".opt_action").removeClass("animate-load"); 5182 $(".opt_action .text").remove(); 5183 5184 $('input[name="chec_item"]').removeAttr("checked"); 5185 } 5186 5187 if (_this.closest(".complect_header_block").length && typeof setNewPriceComplect === "function") { 5188 setNewPriceComplect(); 5189 } 5190 }); 5191 5192 /*check opt table item*/ 5193 $(document).on("change", "input[name='chec_item']", function () { 5194 var _this = $(this); 5195 5196 var canBuy = 5197 _this.closest(".table-view__item").find(".button_block .to-cart").length || 5198 _this.closest(".catalog-block-view__item").find(".button_block .to-cart").length; 5199 var isOffer = _this.closest(".main_item_wrapper").attr("data-product_type") == "3" && !canBuy; 5200 5201 if (_this.is(":checked")) { 5202 $(".opt_action").each(function () { 5203 var _this = $(this); 5204 5205 var isBuyAction = _this.attr("data-action") == "buy"; 5206 var isFavoriteAction = _this.attr("data-action") == "favorite"; 5207 5208 /* if (isFavoriteAction) { 5209 if (JItemAction.checkItemAction && JItemAction.checkItemAction(_this[0])) { 5210 JItemAction.getItemAction(_this[0]).data = 5211 itemaction.data = basketParams["items"] 5212 console.log(_this.attr('itemaction')); 5213 } 5214 } */ 5215 5216 if (isOffer && (isBuyAction || isFavoriteAction)) { 5217 return true; 5218 } 5219 5220 if (isBuyAction && !canBuy) { 5221 return true; 5222 } 5223 5224 if (_this.find(".text").length) { 5225 var count = parseInt(_this.find(".text span").text()); 5226 _this.find(".text span").text(++count); 5227 } else { 5228 _this.removeClass("no-action"); 5229 _this.addClass("animate-load"); 5230 $('<div class="text muted">(<span>1</span>)</div>').appendTo(_this); 5231 } 5232 }); 5233 } else { 5234 $(".opt_action").each(function () { 5235 var _this = $(this); 5236 5237 var isBuyAction = _this.attr("data-action") == "buy"; 5238 var isFavoriteAction = _this.attr("data-action") == "favorite"; 5239 5240 if (isOffer && (isBuyAction || isFavoriteAction)) { 5241 return true; 5242 } 5243 5244 if (isBuyAction && !canBuy) { 5245 return true; 5246 } 5247 5248 if (_this.find(".text").length) { 5249 var count = parseInt(_this.find(".text span").text()); 5250 --count; 5251 _this.find(".text span").text(count); 5252 5253 if (!count) { 5254 _this.addClass("no-action"); 5255 _this.removeClass("animate-load"); 5256 _this.find(".text").remove(); 5257 } 5258 } 5259 }); 5260 } 5261 }); 5262 5263 /*buy|wish|compare opt table items*/ 5264 $(document).on("click", ".opt_action", function (event) { 5265 var _this = $(this), 5266 action = _this.data("action"), 5267 itemsAll = [], 5268 basketParams = { 5269 type: "multiple", 5270 iblock_id: _this.data("iblock_id"), 5271 action: action, 5272 items: {}, 5273 }; 5274 5275 if (!_this.hasClass("no-action")) { 5276 $(".opt_action").addClass("no-action"); 5277 _this.removeClass("no-action"); 5278 5279 $(".table-view__item, .catalog-block-view__item").each(function () { 5280 var _this = $(this); 5281 var canBuy = _this.find(".button_block .to-cart").length; 5282 var add = _this.find('input[name="chec_item"]').is(":checked") && (canBuy || action != "buy"); 5283 var addOffer = _this.data("product_type") == "3" && _this.find(".button_block .to-cart").length; 5284 if (add) { 5285 var itemId = addOffer ? _this.find(".button_block .to-cart").data("item") : _this.data("id"); 5286 itemsAll.push(_this[0]); 5287 basketParams["items"][itemId] = {}; 5288 basketParams["items"][itemId]["id"] = itemId; 5289 basketParams["items"][itemId]["product_type"] = _this.data("product_type"); 5290 basketParams["items"][itemId]["quantity"] = _this.find('input[name="quantity"]').val(); 5291 if (addOffer) { 5292 basketParams["items"][itemId]["add_offer"] = "Y"; 5293 } 5294 } 5295 }); 5296 5297 if (basketParams.action === "favorite") { 5298 let itemAction = JItemAction.factory(this, { bindEvents: false, changeState: false, fireGoals: false }); 5299 itemAction.data = basketParams; 5300 itemAction.onCompleteEvent = () => { 5301 itemAction.showNotice(itemsAll); 5302 } 5303 itemAction.fireEvent(event); 5304 5305 $(".opt_action").removeClass("no-action"); 5306 5307 return; 5308 } 5309 5310 $.ajax({ 5311 type: "POST", 5312 url: arAsproOptions["SITE_DIR"] + "ajax/item.php", 5313 data: basketParams, 5314 dataType: "json", 5315 success: function (data) { 5316 if ("STATUS" in data) { 5317 if (data.STATUS !== "OK") { 5318 showBasketError(BX.message(data.MESSAGE) + " <br/>" + data.MESSAGE_EXT); 5319 } 5320 5321 //js notice
5322 if (typeof JNoticeSurface !== "undefined") { 5323 switch (action) { 5324 case "buy": 5325 JNoticeSurface.get().onAdd2cart(itemsAll); 5326 break; 5327 case "wish": 5328 JNoticeSurface.get().onAdd2Delay(itemsAll); 5329 break; 5330 case "compare": 5331 JNoticeSurface.get().onAdd2Compare(itemsAll); 5332 break; 5333 default: 5334 console.log("nothing"); 5335 } 5336 } 5337 // 5338 5339 if ($(".header-cart.fly").length) { 5340 arBasketAsproCounters.DEFAULT = true; 5341 SetActualBasketFlyCounters(true); 5342 } else { 5343 if ($("#ajax_basket").length) { 5344 reloadTopBasket("add", $("#ajax_basket"), 200, 5000, "N", "", true); 5345 } else { 5346 reloadBasketCounters("", true); 5347 } 5348 } 5349 } 5350 _this.parent().removeClass("loadings"); 5351 $(".opt_action").removeClass("no-action"); 5352 }, 5353 }); 5354 } 5355 }); 5356 5357 //fix opt checked for back in browser 5358 setTimeout(function () { 5359 if ($('.with-opt-buy input[name="chec_item"], .with-opt-buy input[name="select_all_items"]').length) { 5360 $('.with-opt-buy input[name="chec_item"], .with-opt-buy input[name="select_all_items"]').prop("checked", false); 5361 } 5362 }, 1); 5363 5364 5365 $(document).on("click", '*[data-event="jqm"]', function (e) { 5366 e.preventDefault(); 5367 e.stopPropagation(); 5368 5369 var _this = $(this); 5370 var name = _this.data("name"); 5371 if (previewMode && ((name.length && name == "auth") || window.matchMedia("(max-width:400px)").matches)) { 5372 var script = arAsproOptions["SITE_DIR"] + "form/"; 5373 var paramsStr = ""; 5374 $.each(_this.get(0).attributes, function (index, attr) { 5375 var attrName = attr.nodeName; 5376 var attrValue = _this.attr(attrName);
5377 if (/^data\-param\-(.+)$/.test(attrName)) { 5378 var key = attrName.match(/^data\-param\-(.+)$/)[1]; 5379 paramsStr += key + "=" + attrValue + "&"; 5380 } 5381 }); 5382 5383 script += "?name=" + name + "&" + paramsStr; 5384 5385 if (_this.attr("href") !== undefined) { 5386 script = _this.attr("href"); 5387 } 5388 5389 location.href = script; 5390 } else { 5391 if (!$(this).hasClass("clicked")) { 5392 $(this).addClass("clicked"); 5393 $(this).jqmEx(); 5394 // $(this).trigger("click"); 5395 } 5396 } 5397 5398 return false; 5399 }); 5400 // } 5401 5402 BX.addCustomEvent("onCompleteAction", function (eventdata, _this) { 5403 try { 5404 if (eventdata.action === "loadForm") { 5405 $(_this).parent().removeClass("loadings"); 5406 $(_this).removeClass("clicked"); 5407 5408 if ($(_this).hasClass("one_click_buy_trigger")) { 5409 $(".wrapp_one_click > span").removeClass("clicked"); 5410 $(".one_click").removeClass("clicked"); 5411 } else if ($(_this).hasClass("one_click_buy_basket_trigger")) { 5412 $(".fast_order").removeClass("clicked"); 5413 } 5414 } else if (eventdata.action === "loadBasket") { 5415 $(".basket-link.basket").attr("title", $("<div/>").html(arBasketPrices.BASKET_SUMM_TITLE).text()); 5416 5417 if (arBasketPrices.BASKET_COUNT > 0) { 5418 $(".basket-link.basket").addClass("basket-count"); 5419 $(".basket-link.basket .count").removeClass("empted"); 5420 if ($(".basket-link.basket .prices").length) 5421 $(".basket-link.basket .prices").html(arBasketPrices.BASKET_SUMM); 5422 } else { 5423 $(".basket-link.basket").removeClass("basket-count"); 5424 $(".basket-link.basket .count").addClass("empted"); 5425 if ($(".basket-link.basket .prices").length) 5426 $(".basket-link.basket .prices").html(arBasketPrices.BASKET_SUMM_TITLE_SMALL); 5427 } 5428 $(".basket-link.basket .count").text(arBasketPrices.BASKET_COUNT); 5429 5430 updateBottomIconsPanel(arBasketPrices); 5431 } else if (eventdata.action === "loadActualBasketCompare") { 5432 var compare_count = Object.keys(arBasketAspro.COMPARE).length; 5433 if (compare_count > 0) { 5434 $(".basket-link.compare").addClass("basket-count"); 5435 $(".basket-link.compare .count").removeClass("empted"); 5436 if ($("#compare_fly").length) $("#compare_fly").removeClass("empty_block"); 5437 } else { 5438 $(".basket-link.compare").removeClass("basket-count"); 5439 $(".basket-link.compare .count").addClass("empted"); 5440 if ($("#compare_fly").length) $("#compare_fly").addClass("empty_block"); 5441 } 5442 $(".basket-link.compare .count").text(compare_count); 5443 5444 updateBottomIconsPanel(arBasketAspro); 5445 } else if (eventdata.action === "loadRSS") { 5446 } else if (eventdata.action === "ajaxContentLoaded") { 5447 } else if (eventdata.action === "jsLoadBlock") { 5448 // initCountdown(); 5449 setStatusButton(); 5450 setTimeout(function () { 5451 InitOwlSlider(); 5452 }, 200); 5453 if (typeof initSwiperSlider === "function") { 5454 initSwiperSlider(); 5455 } 5456 InitFancyBox(); 5457 5458 checkLinkedArticles(); 5459 checkLinkedBlocks(".linked-banners-list"); 5460 lazyLoadPagenBlock(); 5461 5462 if (typeof window["stickySidebar"] !== "undefined") { 5463 window["stickySidebar"].updateSticky(); 5464 } 5465 } 5466 } catch (e) { 5467 console.error(e); 5468 } 5469 }); 5470 5471 /*slices*/ 5472 if ($(".banners-small .item.normal-block").length) $(".banners-small .item.normal-block").sliceHeight(); 5473 if ($(".teasers .item").length) $(".teasers .item").sliceHeight(); 5474 if ($(".wrap-portfolio-front .row.items > div").length) 5475 $(".wrap-portfolio-front .row.items > div").sliceHeight({ row: ".row.items", item: ".item1" }); 5476 5477 /* bug fix in ff*/ 5478 $("img").removeAttr("draggable"); 5479 5480 $(".title-tab-heading").on("click", function () { 5481 var container = $(this).parent(), 5482 slide_block = $(this).next(), 5483 bReviewTab = container.hasClass("media_review"); 5484 5485 clicked_tab = container.index() + 1; 5486 5487 container.siblings().removeClass("active"); 5488 5489 $(".nav.nav-tabs li").removeClass("active"); 5490 5491 if (container.hasClass("active")) { 5492 if (bReviewTab) { 5493 $("#reviews_content").slideUp(200, function () { 5494 container.removeClass("active"); 5495 }); 5496 } else {
5497 slide_block.slideUp(200, function () { 5498 container.removeClass("active"); 5499 }); 5500 } 5501 } else { 5502 container.addClass("active"); 5503 if (bReviewTab) { 5504 $("#reviews_content").slideDown(); 5505 } else { 5506 if ($(".tabs_section + #reviews_content").length) $(".tabs_section + #reviews_content").slideUp(); 5507 slide_block.slideDown(); 5508 if (typeof container.attr("id") !== "undefined" && container.attr("id") == "descr") { 5509 var $gallery = $(".galerys-block"); 5510 if ($gallery.length) { 5511 var bTypeBig = $gallery.find(".big_slider").length; 5512 var $slider = bTypeBig ? $gallery.find(".big_slider") : $gallery.find(".small_slider"); 5513 var interval = setInterval(function () { 5514 if ($slider.find(".slides .item").attr("style").indexOf("height") === -1) { 5515 $(window).resize(); 5516 } else { 5517 clearInterval(interval); 5518 } 5519 }, 100); 5520 } 5521 } 5522 } 5523 } 5524 }); 5525 5526 InitOwlSlider(); 5527 InitStickySideBar(); 5528 InitFancyBox(); 5529 InitFancyBoxVideo(); 5530 5531 setTimeout(function () { 5532 InitTopestMenuGummi(); 5533 isOnceInited = true; 5534 $(".menu.topest").closest(".dotted-flex-1").addClass("dotted-complete"); 5535 }, 50); 5536 5537 InitZoomPict(); 5538 5539 $(document).on("click", ".captcha_reload", function (e) { 5540 var captcha = $(this).parents(".captcha-row"); 5541 e.preventDefault(); 5542 $.ajax({ 5543 url: arAsproOptions["SITE_DIR"] + "ajax/captcha.php", 5544 success: function (text) { 5545 captcha.find("input[name=captcha_sid],input[name=captcha_code]").val(text); 5546 captcha.find("img").attr("src", "/bitrix/tools/captcha.php?captcha_sid=" + text); 5547 captcha.find("input[name=captcha_word]").val("").removeClass("error"); 5548 captcha.find(".captcha_input").removeClass("error").find(".error").remove(); 5549 }, 5550 }); 5551 }); 5552 5553 /* show print */ 5554 if (arAsproOptions["PAGES"]["BASKET_PAGE"]) { 5555 showBasketHeadingBtn(); 5556 } else { 5557 if (arAsproOptions["THEME"]["PRINT_BUTTON"] === "Y") { 5558 setTimeout(function () { 5559 var topicHeading = document.querySelector(".period_wrapper.in-detail-news1 .period_wrapper_inner") 5560 ? document.querySelector(".detail-news1 .period_wrapper .period_wrapper_inner") 5561 : document.querySelector(".page-top .topic .topic__heading") 5562 ? document.querySelector(".page-top .topic .topic__heading") 5563 : null; 5564 if (topicHeading) { 5565 var btnPrint = BX.create({ 5566 tag: "div", 5567 attrs: { 5568 class: "print-link colored_theme_hover_bg-block", 5569 title: arAsproOptions["THEME"]["EXPRESSION_FOR_PRINT_PAGE"], 5570 }, 5571 html: '<i class="svg colored_theme_hover_bg-el-svg"><svg class="svg svg-print" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path id="Rectangle_665_copy_4" data-name="Rectangle 665 copy 4" class="cls-print" d="M1570,210h-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,1570,210Zm-8,1h4v-4h-4v4Zm4-12h-4v2h4v-2Zm4,4h-12v5h2v-3h8v3h2v-5Z" transform="translate(-1556 -197)"></path></svg></i>', 5572 }); 5573 BX.insertBefore(btnPrint, topicHeading); 5574 } 5575 }, 150); 5576 } 5577 } 5578 5579 $(document).on("click", ".print-link", function () { 5580 window.print(); 5581 }); 5582 5583 $(".head-block .item-link").on("click", function () { 5584 var _this = $(this); 5585 _this.siblings().removeClass("active"); 5586 _this.addClass("active"); 5587 }); 5588 5589 $("table.table").each(function () { 5590 var _this = $(this), 5591 first_td = _this.find("thead tr th"); 5592 if (!first_td.length) first_td = _this.find("thead tr td"); 5593 if (first_td.length) { 5594 var j = 0; 5595 _this.find("tbody tr td").each(function (i) { 5596 if (j > first_td.length - 1) j = 0; 5597 $('<div class="th-mobile">' + first_td[j].textContent + "</div>").appendTo($(this)); 5598 j++; 5599 }); 5600 } 5601 }); 5602 5603 if (window.matchMedia("(min-width: 768px)").matches) $(".wrapper_middle_menu.wrap_menu").removeClass("mobile"); 5604 5605 if (window.matchMedia("(max-width: 767px)").matches) $(".wrapper_middle_menu.wrap_menu").addClass("mobile"); 5606 5607 $(document).on("click", ".menu_top_block .v_bottom a", function (e) { 5608 if ($(e.target).hasClass("toggle_block")) e.preventDefault(); 5609 }); 5610 $(document).on("click", ".menu_top_block .v_bottom a .toggle_block", function (e) { 5611 var _this = $(this), 5612 menu = _this.closest(".has-child").find("> .dropdown"), 5613 bVisibleMeu = menu.is(":visible"), 5614 animate = bVisibleMeu ? "slideUp" : "slideDown"; 5615 5616 if (!_this.hasClass("clicked")) { 5617 _this.addClass("clicked"); 5618 5619 menu.stop().slideToggle({ 5620 duration: 150, 5621 start: function () { 5622 _this.toggleClass("closed"); 5623 }, 5624 complete: function () { 5625 _this.removeClass("clicked"); 5626 5627 if (typeof window["stickySidebar"] !== "undefined") { 5628 window["stickySidebar"].updateSticky(); 5629 } 5630 }, 5631 }); 5632 } 5633 5634 $(this).closest(".has-child").toggleClass("opened"); 5635 }); 5636 5637 $(document).on("click", ".show_props", function () { 5638 $(this).prev().stop().slideToggle(333); 5639 $(this).find(".char_title").toggleClass("opened"); 5640 }); 5641 5642 $(".see_more").on("click", function (e) { 5643 e.preventDefault(); 5644 var see_more = $(this).is(".see_more") ? $(this) : $(this).parents(".see_more").first(); 5645 var see_moreText = see_more.find("> a").length ? see_more.find("> a") : see_more; 5646 var see_moreHiden = see_more.parent().find("> .d"); 5647 if (see_more.hasClass("open")) { 5648 see_moreText.text(BX.message("CATALOG_VIEW_MORE")); 5649 see_more.removeClass("open"); 5650 see_moreHiden.hide(); 5651 } else { 5652 see_moreText.text(BX.message("CATALOG_VIEW_LESS")); 5653 see_more.addClass("open"); 5654 see_moreHiden.show(); 5655 } 5656 return false;
5657 }); 5658 5659 $(".button.faq_button").click(function (e) { 5660 e.preventDefault(); 5661 $(this).toggleClass("opened"); 5662 $(".faq_ask .form").slideToggle(); 5663 }); 5664 5665 $(".staff.list .staff_section .staff_section_title a").click(function (e) { 5666 e.preventDefault(); 5667 $(this).parents(".staff_section").toggleClass("opened"); 5668 $(this).parents(".staff_section").find(".staff_section_items").stop().slideToggle(600); 5669 $(this).parents(".staff_section_title").find(".opener_icon").toggleClass("opened"); 5670 }); 5671 5672 $(".jobs_wrapp .item .name").click(function (e) { 5673 $(this).closest(".item").toggleClass("opened"); 5674 $(this).closest(".item").find(".description_wrapp").stop().slideToggle(600); 5675 $(this).closest(".item").find(".opener_icon").toggleClass("opened"); 5676 }); 5677 5678 $(".faq.list .item .q a").on("click", function (e) { 5679 e.preventDefault(); 5680 $(this).parents(".item").toggleClass("opened"); 5681 $(this).parents(".item").find(".a").stop().slideToggle(); 5682 $(this).parents(".item").find(".q .opener_icon").toggleClass("opened"); 5683 }); 5684 5685 $(".opener_icon").click(function (e) { 5686 e.preventDefault(); 5687 $(this).parent().find("a").trigger("click"); 5688 }); 5689 5690 $(".more_block span").on("click", function () { 5691 var content_offset = $(".catalog_detail .tabs_section").offset(); 5692 $("html, body").animate({ scrollTop: content_offset.top - 43 }, 400); 5693 }); 5694 5695 $(document).on("click", ".counter_block:not(.basket) .plus", function () { 5696 if (!$(this).parents(".basket_wrapp").length || $(this).parents(".services_in_basket").length) { 5697 if ($(this).parent().data("offers") != "Y") { 5698 var isDetailSKU2 = $(this).parents(".counter_block_wr").length; 5699 input = $(this).parents(".counter_block").find("input[type=text]"); 5700 (tmp_ratio = !isDetailSKU2 5701 ? $(this).parents(".counter_wrapp").find(".to-cart").data("ratio") 5702 : $(this).parents("tr").first().find("td.buy .to-cart").data("ratio")), 5703 (isDblQuantity = !isDetailSKU2 5704 ? $(this).parents(".counter_wrapp").find(".to-cart").data("float_ratio") 5705 : $(this).parents("tr").first().find("td.buy .to-cart").data("float_ratio")), 5706 (ratio = isDblQuantity ? parseFloat(tmp_ratio) : parseInt(tmp_ratio, 10)), 5707 (max_value = ""); 5708 currentValue = input.val(); 5709 5710 if (isDblQuantity) 5711 ratio = 5712 Math.round(ratio * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / 5713 arAsproOptions.JS_ITEM_CLICK.precisionFactor; 5714 5715 curValue = isDblQuantity ? parseFloat(currentValue) : parseInt(currentValue, 10); 5716 5717 curValue += ratio; 5718 if (isDblQuantity) { 5719 curValue = 5720 Math.round(curValue * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / 5721 arAsproOptions.JS_ITEM_CLICK.precisionFactor; 5722 } 5723 5724 if (parseFloat($(this).data("max")) > 0) { 5725 if (input.val() < $(this).data("max")) { 5726 if (curValue <= $(this).data("max")) input.val(curValue); 5727 5728 input.change(); 5729 } 5730 } else { 5731 input.val(curValue); 5732 input.change(); 5733 } 5734 } 5735 } 5736 }); 5737 $(document).on("click", ".counter_block:not(.basket) .minus", function () { 5738 if (!$(this).parents(".basket_wrapp").length || $(this).parents(".services_in_basket").length) { 5739 if ($(this).parent().data("offers") != "Y") { 5740 var isDetailSKU2 = $(this).parents(".counter_block_wr").length; 5741 input = $(this).parents(".counter_block").find("input[type=text]"); 5742 (tmp_ratio = !isDetailSKU2 5743 ? $(this).parents(".counter_wrapp").find(".to-cart").data("ratio") 5744 : $(this).parents("tr").first().find("td.buy .to-cart").data("ratio")), 5745 (isDblQuantity = !isDetailSKU2 5746 ? $(this).parents(".counter_wrapp").find(".to-cart").data("float_ratio") 5747 : $(this).parents("tr").first().find("td.buy .to-cart").data("float_ratio")), 5748 (ratio = isDblQuantity ? parseFloat(tmp_ratio) : parseInt(tmp_ratio, 10)), 5749 (max_value = ""); 5750 currentValue = input.val(); 5751 5752 if (isDblQuantity) 5753 ratio = 5754 Math.round(ratio * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / 5755 arAsproOptions.JS_ITEM_CLICK.precisionFactor; 5756 5757 curValue = isDblQuantity ? parseFloat(currentValue) : parseInt(currentValue, 10); 5758 5759 curValue -= ratio; 5760 if (isDblQuantity) { 5761 curValue = 5762 Math.round(curValue * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / 5763 arAsproOptions.JS_ITEM_CLICK.precisionFactor; 5764 } 5765 const minValue = parseFloat($(this).parents(".counter_block").find(".minus").data("min")); 5766 if (minValue) { 5767 ratio = minValue; 5768 } 5769 5770 if (parseFloat($(this).parents(".counter_block").find(".plus").data("max")) > 0) { 5771 if (currentValue > ratio) { 5772 if (curValue < ratio) { 5773 input.val(ratio); 5774 } else { 5775 input.val(curValue); 5776 } 5777 input.change(); 5778 } 5779 } else { 5780 if (curValue > ratio) { 5781 input.val(curValue); 5782 } else { 5783 if (ratio) { 5784 input.val(ratio); 5785 } else if (currentValue > 1) { 5786 input.val(curValue); 5787 } 5788 } 5789 input.change(); 5790 } 5791 } 5792 } 5793 }); 5794 5795 $(".counter_block input[type=text]").numeric({ allow: "." }); 5796 5797 $(document).on("focus", ".counter_block input[type=text]", function (e) { 5798 $(this).addClass("focus"); 5799 }); 5800 5801 $(document).on("blur", ".counter_block input[type=text]", function (e) { 5802 $(this).removeClass("focus"); 5803 }); 5804 5805 var timerInitCalculateDelivery = false;
5806 $(document).on("change", ".counter_block input[type=text]", function (e) { 5807 if (!$(this).parents(".basket_wrapp").length) { 5808 var val = $(this).val(), 5809 tmp_ratio = $(this).parents(".counter_wrapp").find(".to-cart").data("ratio") 5810 ? $(this).parents(".counter_wrapp").find(".to-cart").data("ratio") 5811 : $(this).parents("tr").first().find("td.buy .to-cart").data("ratio"), 5812 isDblQuantity = $(this).parents(".counter_wrapp").find(".to-cart").data("float_ratio") 5813 ? $(this).parents(".counter_wrapp").find(".to-cart").data("float_ratio") 5814 : $(this).parents("tr").first().find("td.buy .to-cart").data("float_ratio"), 5815 ratio = isDblQuantity ? parseFloat(tmp_ratio) : parseInt(tmp_ratio, 10), 5816 diff = val % ratio; 5817 5818 if (isDblQuantity) { 5819 ratio = 5820 Math.round(ratio * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / 5821 arAsproOptions.JS_ITEM_CLICK.precisionFactor; 5822 if ( 5823 Math.round(diff * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / 5824 arAsproOptions.JS_ITEM_CLICK.precisionFactor == 5825 ratio 5826 ) 5827 diff = 0; 5828 } 5829 5830 if ($(this).hasClass("focus")) { 5831 intCount = 5832 Math.round( 5833 Math.round((val * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / ratio) / 5834 arAsproOptions.JS_ITEM_CLICK.precisionFactor 5835 ) || 1; 5836 val = intCount <= 1 ? ratio : intCount * ratio; 5837 // val -= diff; 5838 val = 5839 Math.round(val * arAsproOptions.JS_ITEM_CLICK.precisionFactor) / arAsproOptions.JS_ITEM_CLICK.precisionFactor; 5840 } 5841 5842 if (parseFloat($(this).parents(".counter_block").find(".plus").data("max")) > 0) { 5843 if (val > parseFloat($(this).parents(".counter_block").find(".plus").data("max"))) { 5844 val = parseFloat($(this).parents(".counter_block").find(".plus").data("max")); 5845 // val -= (val % ratio); 5846 } 5847 } 5848 if (parseFloat($(this).parents(".counter_block").find(".minus").data("min")) > 0) { 5849 if (val < parseFloat($(this).parents(".counter_block").find(".minus").data("min"))) { 5850 val = parseFloat($(this).parents(".counter_block").find(".minus").data("min")); 5851 // val -= (val % ratio); 5852 } 5853 } 5854 if (val < ratio) { 5855 val = ratio; 5856 } else if (!parseFloat(val)) { 5857 val = 1; 5858 } 5859 5860 $(this).parents(".counter_block").parent().parent().find(".to-cart").attr("data-quantity", val); 5861 $(this).parents(".counter_block").parent().parent().parent().find(".one_click").attr("data-quantity", val); 5862 $(this) 5863 .parents(".counter_block") 5864 .parent() 5865 .parent() 5866 .parent() 5867 .parent() 5868 .find(".one_click") 5869 .attr("data-quantity", val); //for offers in list 5870 $(this).parents(".catalog_item_wrapp").find(".inner_wrap.TYPE_1 .one_click").attr("data-quantity", val); //for first type buttons in catalog_block 5871 5872 $(this).val(val); 5873 5874 var $calculate = $(this).closest(".item").length 5875 ? $(this).closest(".item").find(".calculate-delivery") 5876 : $(this).closest(".catalog_detail").find(".calculate-delivery"); 5877 if ($calculate.length && !$(this).closest(".buy_services_wrap").length) { 5878 $calculate.each(function () { 5879 var $calculateSpan = $(this).find("span[data-event=jqm]").first(); 5880 5881 if ($calculateSpan.length) { 5882 var $clone = $calculateSpan.clone(); 5883 $clone.attr("data-param-quantity", val).removeClass("clicked"); 5884 $clone.insertAfter($calculateSpan).on("click", function () { 5885 if (!jQuery.browser.mobile) { 5886 $(this).parent().addClass("loadings"); 5887 } 5888 }); 5889 $calculateSpan.remove(); 5890 } 5891 5892 if ($(this).hasClass("with_preview")) { 5893 $(this).removeClass("inited"); 5894 5895 if (timerInitCalculateDelivery) { 5896 clearTimeout(timerInitCalculateDelivery); 5897 } 5898 5899 timerInitCalculateDelivery = setTimeout(function () { 5900 initCalculatePreview(true); 5901 timerInitCalculateDelivery = false;
5902 }, 1000); 5903 } 5904 }); 5905 } 5906 5907 var eventdata = { type: "change", params: { id: $(this), value: val } }; 5908 BX.onCustomEvent("onCounterProductAction", [eventdata]); 5909 5910 if ($(this).closest(".complect-block").length && typeof setNewPriceComplect === "function") { 5911 setNewPriceComplect(); 5912 } 5913 } 5914 }); 5915 5916 BX.addCustomEvent("onCounterProductAction", function (eventdata) { 5917 if (typeof eventdata != "object") { 5918 eventdata = { type: "undefined" }; 5919 } 5920 try { 5921 if (typeof eventdata.type != "undefined") { 5922 if (!eventdata.params.id.closest(".gifts").length) { 5923 // no gift 5924 var obProduct = eventdata.params.id.data("product"); 5925 if (eventdata.params.id.closest(".has_offer_prop").length) { 5926 // type1 for offers in element list 5927 if (typeof window["obSkuQuantys"] === "undefined") window["obSkuQuantys"] = {}; 5928 5929 // if(typeof window['obOffers'] === 'undefined') 5930 window["obSkuQuantys"][eventdata.params.id.closest(".offer_buy_block").find(".to-cart").data("item")] = 5931 eventdata.params.value; 5932 } 5933 if (typeof window[obProduct] == "object") { 5934 if (obProduct == "obOffers") setPriceAction("", "", "Y"); 5935 else window[obProduct].setPriceAction("Y"); 5936 if ($(".detail_page").length) { 5937 setNewHeader(); 5938 } 5939 } else if (eventdata.params.id.length) { 5940 if ( 5941 eventdata.params.id.closest(".main_item_wrapper").length && 5942 !eventdata.params.id.closest(".services-item__buy").length && 5943 arAsproOptions["THEME"]["SHOW_TOTAL_SUMM"] == "Y" 5944 ) { 5945 setPriceItem(eventdata.params.id.closest(".main_item_wrapper"), eventdata.params.value); 5946 } 5947 } 5948 BX.onCustomEvent("onCounterProductActionResize"); 5949 } 5950 } 5951 } catch (e) { 5952 console.error(e); 5953 } 5954 }); 5955 5956 /*show basket on hover */ 5957 $(document).on("mouseenter", ".wrap_icon.top_basket, #headerfixed .basket-link.basket", function () { 5958 var _this = $(this); 5959 var parent = _this.closest("header, #headerfixed"); 5960 var hover_block = parent.find(".basket_hover_block"); 5961 5962 if (!hover_block.hasClass("loaded")) { 5963 basketTop("", hover_block); 5964 } 5965 }); 5966 5967 /*show basket on click mobile */ 5968 $(document).on("click", ".wrap_icon.wrap_basket.top_basket, #headerfixed .basket-link.basket", function (e) { 5969 var _this = $(this); 5970 if (isMobile) { 5971 if (!_this.hasClass("clicked")) { 5972 e.preventDefault(); 5973 _this.addClass("clicked"); 5974 setTimeout(function () { 5975 _this.removeClass("clicked"); 5976 }, 3000); 5977 } 5978 } 5979 }); 5980 5981 /*slide cart*/ 5982 $(document).on("mouseenter", "#basket_line .basket_normal:not(.empty_cart):not(.bcart) .basket_block ", function () { 5983 $(this).closest(".basket_normal").find(".popup").addClass("block"); 5984 $(this).closest(".basket_normal").find(".basket_popup_wrapp").stop(true, true).slideDown(150); 5985 }); 5986 $(document).on("mouseleave", "#basket_line .basket_normal .basket_block ", function () { 5987 var th = $(this); 5988 $(this) 5989 .closest(".basket_normal") 5990 .find(".basket_popup_wrapp") 5991 .stop(true, true) 5992 .slideUp(150, function () { 5993 th.closest(".basket_normal").find(".popup").removeClass("block"); 5994 }); 5995 }); 5996 5997 $(document).on("click", ".popup_button_basket", function () { 5998 var th = $(".to-cart[data-item=" + $(this).data("item") + "]"); 5999 6000 var val = th.attr("data-quantity"); 6001 6002 if (!val) $val = 1; 6003 6004 var tmp_props = th.data("props"), 6005 props = "", 6006 part_props = "", 6007 add_props = "N", 6008 fill_prop = {}, 6009 iblockid = th.data("iblockid"), 6010 offer = th.data("offers"), 6011 rid = "", 6012 basket_props = "", 6013 item = th.attr("data-item"); 6014 6015 if (offer != "Y") { 6016 offer = "N"; 6017 } else { 6018 basket_props = th.closest(".prices_tab").find(".bx_sku_props input").val(); 6019 } 6020 if (tmp_props) { 6021 props = tmp_props.split(";"); 6022 } 6023 if (th.data("part_props")) { 6024 part_props = th.data("part_props"); 6025 } 6026 if (th.data("add_props")) { 6027 add_props = th.data("add_props"); 6028 } 6029 if ($(".rid_item").length) { 6030 rid = $(".rid_item").data("rid"); 6031 } else if (th.data("rid")) { 6032 rid = th.data("rid"); 6033 } 6034 6035 fill_prop = fillBasketPropsExt(th, "prop", "bx_ajax_text"); 6036 6037 fill_prop.quantity = val; 6038 fill_prop.add_item = "Y"; 6039 fill_prop.rid = rid; 6040 fill_prop.offers = offer; 6041 fill_prop.iblockID = iblockid; 6042 fill_prop.part_props = part_props; 6043 fill_prop.add_props = add_props; 6044 fill_prop.props = JSON.stringify(props); 6045 fill_prop.item = item; 6046 fill_prop.basket_props = basket_props; 6047 6048 var isDetail = th.closest(".product-action").length || th.closest("#headerfixed.with-product"); 6049 var isSku2 = th.closest(".list-offers").length; 6050 var bIsService = th.closest(".buy_services_wrap").length; 6051 6052 if (!bIsService && (isDetail || isSku2)) { 6053 //var allServicesOn = th.closest('.product-container').find('.buy_services_wrap .services-item [name="buy_switch_services"]:checked'); 6054 var allServicesOn = []; 6055 if (isSku2) { 6056 allServicesOn = th 6057 .closest(".product-container") 6058 .find('.buy_services_wrap .services-item [name="buy_switch_services"]:checked'); 6059 } else { 6060 allServicesOn = $(".product-container").find( 6061 '.buy_services_wrap[data-parent_product="' + item + '"] .services-item [name="buy_switch_services"]:checked' 6062 ); 6063 } 6064 var servicesNeedAdd = []; 6065 allServicesOn.each(function () { 6066 var _this = $(this); 6067 var buttonCart = _this.closest(".services-item").find(".to-cart"); 6068 6069 servicesNeedAdd[buttonCart.data("item")] = {}; 6070 servicesNeedAdd[buttonCart.data("item")]["id"] = buttonCart.data("item"); 6071 servicesNeedAdd[buttonCart.data("item")]["quantity"] = buttonCart.attr("data-quantity"); 6072 servicesNeedAdd[buttonCart.data("item")]["iblock_id"] = buttonCart.data("iblockid"); 6073 }); 6074 servicesNeedAdd = array_values_js(servicesNeedAdd); 6075 fill_prop.services = servicesNeedAdd; 6076 } 6077 6078 $.ajax({ 6079 type: "POST", 6080 url: arAsproOptions["SITE_DIR"] + "ajax/item.php", 6081 data: fill_prop, 6082 dataType: "json", 6083 success: function (data) { 6084 $(".basket_error_frame").jqmHide(); 6085 if ("STATUS" in data) { 6086 getActualBasket(fill_prop.iblockID); 6087 if (data.STATUS === "OK") { 6088 th.hide(); 6089 th.closest(".counter_wrapp").find(".counter_block_inner").hide(); 6090 th.closest(".counter_wrapp").find(".counter_block").hide(); 6091 th.parents("tr").find(".counter_block_wr .counter_block").hide(); 6092 th.closest(".button_block").addClass("wide"); 6093 th.parent().find(".in-cart").show(); 6094 6095 addBasketCounter(item); 6096 6097 if ($("#ajax_basket").length) reloadTopBasket("add", $("#ajax_basket"), 200, 5000, "Y"); 6098 6099 if ($("#basket_line .basket_fly").length) { 6100 if (th.closest(".fast_view_frame").length || window.matchMedia("(max-width: 767px)").matches) 6101 basketFly("open", "N"); 6102 else basketFly("open"); 6103 } 6104 } else { 6105 showBasketError(BX.message(data.MESSAGE)); 6106 } 6107 } else { 6108 showBasketError(BX.message("CATALOG_PARTIAL_BASKET_PROPERTIES_ERROR")); 6109 } 6110 }, 6111 }); 6112 }); 6113 6114 $(document).on("click", ".to-cart:not(.read_more), .basket_item_add", function (e) { 6115 e.preventDefault(); 6116 var th = $(this); 6117 if (!th.hasClass("clicked")) { 6118 th.addClass("clicked"); 6119 var val = $(this).attr("data-quantity"); 6120 var tmp_props = $(this).data("props"), 6121 props = "", 6122 part_props = "", 6123 add_props = "N", 6124 fill_prop = {}, 6125 iblockid = $(this).data("iblockid"), 6126 offer = $(this).data("offers"), 6127 rid = "", 6128 bBannerAction = false, 6129 basket_props = "", 6130 item = $(this).attr("data-item"); 6131 if (th.closest(".but-cell").length) { 6132 if ($('.counter_block[data-item="' + item + '"]').length) 6133 val = $('.counter_block[data-item="' + item + '"] input').val(); 6134 } 6135 6136 if (th.closest(".banner_buttons.with_actions").length) { 6137 //banner action 6138 var wrapper_btns = th.closest(".wraps_buttons"); 6139 item = wrapper_btns.data("id"); 6140 bBannerAction = true; 6141 } 6142 6143 if (!val) val = 1; 6144 if (offer != "Y") { 6145 offer = "N"; 6146 } else { 6147 basket_props = $(this).closest(".prices_tab").find(".bx_sku_props input").val(); 6148 } 6149 if (tmp_props) { 6150 props = tmp_props.split(";"); 6151 } 6152 if ($(this).data("part_props")) { 6153 part_props = $(this).data("part_props"); 6154 } 6155 if ($(this).data("add_props")) { 6156 add_props = $(this).data("add_props"); 6157 } 6158 if ($(".rid_item").length) { 6159 rid = $(".rid_item").data("rid"); 6160 } else if ($(this).data("rid")) { 6161 rid = $(this).data("rid"); 6162 } 6163 6164 fill_prop = fillBasketPropsExt(th, "prop", th.data("bakset_div")); 6165 6166 fill_prop.quantity = val; 6167 fill_prop.add_item = "Y"; 6168 fill_prop.rid = rid; 6169 fill_prop.offers = offer; 6170 fill_prop.iblockID = iblockid; 6171 fill_prop.part_props = part_props; 6172 fill_prop.add_props = add_props; 6173 fill_prop.props = JSON.stringify(props); 6174 fill_prop.item = item; 6175 fill_prop.basket_props = basket_props; 6176 6177 var isDetail = th.closest(".product-action").length || th.closest("#headerfixed.with-product"); 6178 var isSku2 = th.closest(".list-offers").length; 6179 var bIsService = th.closest(".buy_services_wrap").length; 6180 6181 if (!bIsService && (isDetail || isSku2)) { 6182 var allServicesOn = []; 6183 if (isSku2) { 6184 allServicesOn = th 6185 .closest(".product-container") 6186 .find('.buy_services_wrap .services-item [name="buy_switch_services"]:checked'); 6187 } else { 6188 allServicesOn = $(".product-container").find( 6189 '.buy_services_wrap[data-parent_product="' + item + '"] .services-item [name="buy_switch_services"]:checked' 6190 ); 6191 } 6192 var servicesNeedAdd = []; 6193 allServicesOn.each(function () { 6194 var _this = $(this); 6195 var buttonCart = _this.closest(".services-item").find(".to-cart"); 6196 servicesNeedAdd[buttonCart.data("item")] = {}; 6197 servicesNeedAdd[buttonCart.data("item")]["id"] = buttonCart.data("item"); 6198 servicesNeedAdd[buttonCart.data("item")]["quantity"] = buttonCart.attr("data-quantity"); 6199 servicesNeedAdd[buttonCart.data("item")]["iblock_id"] = buttonCart.data("iblockid"); 6200 }); 6201 servicesNeedAdd = array_values_js(servicesNeedAdd); 6202 fill_prop.services = servicesNeedAdd; 6203 } 6204 6205 var servicesWrap = $(this).closest(".buy_services_wrap"); 6206 if (bIsService) { 6207 var parent_product = servicesWrap.attr("data-parent_product"); 6208 fill_prop["prop[BUY_PRODUCT_PROP]"] = parent_product; 6209 fill_prop["prop[ASPRO_BUY_PRODUCT_ID]"] = parent_product; 6210 } 6211 6212 if (bBannerAction) { 6213 if (th.hasClass("added")) { 6214 location.href = th.data("href"); 6215 return false;
6216 } else { 6217 th.attr("title", th.data("title2")); 6218 th.toggleClass("added"); 6219 } 6220 } 6221 6222 if (th.data("empty_props") == "N" /* && fill_prop.part_props != 'Y'*/) { 6223 var basket_popup_html = $("#" + th.data("bakset_div")).html(); 6224 if (!basket_popup_html && th.closest(".item").find(".basket_props_block").length) 6225 basket_popup_html = th.closest(".item").find(".basket_props_block").html(); 6226 6227 showBasketError(basket_popup_html, BX.message("ERROR_BASKET_PROP_TITLE"), "Y", th); 6228 BX.addCustomEvent("onCompleteAction", function (e) { 6229 if (!e.ignoreSelf) { 6230 var eventdata = { action: "loadForm", ignoreSelf: true }; 6231 BX.onCustomEvent("onCompleteAction", [eventdata, th[0]]); 6232 } 6233 }); 6234 } else { 6235 $.ajax({ 6236 type: "POST", 6237 url: arAsproOptions["SITE_DIR"] + "ajax/item.php", 6238 data: fill_prop, 6239 dataType: "json", 6240 success: function (data) { 6241 getActualBasket(fill_prop.iblockID); 6242 6243 var eventdata = { action: "loadForm" }; 6244 BX.onCustomEvent("onCompleteAction", [eventdata, th[0]]); 6245 arStatusBasketAspro = {}; 6246 6247 if (data !== null) { 6248 if ("STATUS" in data) { 6249 if (data.MESSAGE_EXT === null) data.MESSAGE_EXT = ""; 6250 if (data.STATUS === "OK") { 6251 // th.hide(); 6252 $(".to-cart[data-item=" + item + "]").hide(); 6253 $(".to-cart[data-item=" + item + "]") 6254 .closest(".counter_wrapp") 6255 .find(".counter_block_inner") 6256 .hide(); 6257 $(".to-cart[data-item=" + item + "]") 6258 .closest(".counter_wrapp") 6259 .find(".counter_block") 6260 .hide(); 6261 $(".to-cart[data-item=" + item + "]") 6262 .parents("tr") 6263 .find(".counter_block_wr .counter_block") 6264 .hide(); 6265 $(".to-cart[data-item=" + item + "]") 6266 .closest(".button_block") 6267 .addClass("wide"); 6268 // th.parent().find('.in-cart').show(); 6269 $(".in-cart[data-item=" + item + "]").show(); 6270 6271 addBasketCounter(item); 6272 6273 //js notice 6274 $bDontOpenBasket = false; 6275 if (typeof JNoticeSurface !== "undefined") { 6276 JNoticeSurface.get().onAdd2cart([th[0]]); 6277 $bDontOpenBasket = true; 6278 } 6279 // 6280 6281 if ($("#ajax_basket").length) reloadTopBasket("add", $("#ajax_basket"), 200, 5000, "Y"); 6282 6283 if ($("#basket_line .basket_fly").length) { 6284 if (th.closest(".services_in_basket").length && !window.matchMedia("(max-width: 767px)").matches) { 6285 basketFly("open", "SHOW"); //need for buy services in basket_fly 6286 } else if ( 6287 th.closest(".fast_view_frame").length || 6288 window.matchMedia("(max-width: 767px)").matches || 6289 $("#basket_line .basket_fly.loaded").length 6290 ) 6291 basketFly("open", "N"); 6292 else { 6293 if ($bDontOpenBasket) basketFly("open", "N"); 6294 else basketFly("open"); 6295 } 6296 } 6297 6298 //need for services on basket_page 6299 if (th.closest(".services_in_basket_page").length) { 6300 BX.Sale.BasketComponent.sendRequest("refreshAjax", { 6301 fullRecalculation: "Y", 6302 otherParams: { 6303 param: "N", 6304 }, 6305 }); 6306 } 6307 6308 if ($(".top_basket").length) { 6309 basketTop($bDontOpenBasket ? "" : "open", $(".top_basket").find(".basket_hover_block")); 6310 } 6311 6312 if ( 6313 $("#headerfixed .wproducts .ajax_load .btn").length && 6314 th.closest(".product-action").length &&
6315 !th.closest(".js-item-analog").length && 6316 th.next(".in-cart").length 6317 ) { 6318 var buttonHtml = 6319 //'<span class="buy_block"><span class="btn btn-default btn-sm slide_offer more type_block">' + 6320 '<span class="buy_block"><span class="btn btn-default btn-sm more type_block">' + 6321 th.next(".in-cart").html() + 6322 "</span></span>"; 6323 $("#headerfixed .wproducts .ajax_load .item-buttons .but-cell").html(buttonHtml); 6324 } 6325 } else { 6326 showBasketError(BX.message(data.MESSAGE) + " <br/>" + data.MESSAGE_EXT); 6327 } 6328 } else { 6329 showBasketError(BX.message("CATALOG_PARTIAL_BASKET_PROPERTIES_ERROR")); 6330 } 6331 } else { 6332 // th.hide(); 6333 $(".to-cart[data-item=" + item + "]").hide(); 6334 $(".to-cart[data-item=" + item + "]") 6335 .closest(".counter_wrapp") 6336 .find(".counter_block_inner") 6337 .hide(); 6338 $(".to-cart[data-item=" + item + "]") 6339 .closest(".counter_wrapp") 6340 .find(".counter_block") 6341 .hide(); 6342 $(".to-cart[data-item=" + item + "]") 6343 .parents("tr") 6344 .find(".counter_block_wr .counter_block") 6345 .hide(); 6346 $(".to-cart[data-item=" + item + "]") 6347 .closest(".button_block") 6348 .addClass("wide"); 6349 // th.parent().find('.in-cart').show(); 6350 $(".in-cart[data-item=" + item + "]").show(); 6351 6352 addBasketCounter(item); 6353 6354 if ($("#ajax_basket").length) reloadTopBasket("add", $("#ajax_basket"), 200, 5000, "Y"); 6355 6356 if ($("#basket_line .basket_fly").length) { 6357 if ( 6358 th.closest(".fast_view_frame").length || 6359 window.matchMedia("(max-width: 767px)").matches || 6360 $("#basket_line .basket_fly.loaded").length 6361 ) 6362 basketFly("open", "N"); 6363 else basketFly("open"); 6364 } 6365 } 6366 }, 6367 }); 6368 } 6369 } 6370 }); 6371 6372 $(document).on("click", ".to-subscribe", function (e) { 6373 e.preventDefault(); 6374 var th = $(this); 6375 if (!th.hasClass("clicked")) { 6376 th.addClass("clicked"); 6377 if ($(this).is(".auth")) { 6378 if ($(this).hasClass("nsubsc")) { 6379 $(this).jqmEx(); 6380 // $(this).trigger("click"); 6381 } else { 6382 location.href = arAsproOptions["SITE_DIR"] + "auth/?backurl=" + location.pathname; 6383 } 6384 } else { 6385 var item = $(this).attr("data-item"), 6386 iblockid = $(this).attr("data-iblockid"); 6387 // $(this).hide(); 6388 $(".to-subscribe[data-item=" + item + "]").hide(); 6389 $(".to-subscribe[data-item=" + item + "]") 6390 .parent() 6391 .find(".in-subscribe") 6392 .show(); 6393 $.get( 6394 arAsproOptions["SITE_DIR"] + "ajax/item.php?item=" + item + "&subscribe_item=Y", 6395 $.proxy(function (data) { 6396 arStatusBasketAspro = {}; 6397 getActualBasket(iblockid); 6398 }) 6399 ); 6400 th.removeClass("clicked"); 6401 } 6402 } 6403 }); 6404 6405 $(document).on("click", ".in-subscribe", function (e) { 6406 e.preventDefault(); 6407 var item = $(this).attr("data-item"), 6408 iblockid = $(this).attr("data-iblockid"); 6409 // $(this).hide(); 6410 $(".in-subscribe[data-item=" + item + "]").hide(); 6411 $(".in-subscribe[data-item=" + item + "]") 6412 .parent() 6413 .find(".to-subscribe") 6414 .removeClass("clicked"); 6415 $(".in-subscribe[data-item=" + item + "]") 6416 .parent() 6417 .find(".to-subscribe") 6418 .show(); 6419 $.get( 6420 arAsproOptions["SITE_DIR"] + "ajax/item.php?item=" + item + "&subscribe_item=Y", 6421 $.proxy(function (data) { 6422 getActualBasket(iblockid); 6423 arStatusBasketAspro = {}; 6424 }) 6425 ); 6426 }); 6427 6428 $(document).on("click", ".item_main_info .item_slider .flex-direction-nav li span", function (e) { 6429 if ($(".inner_slider .slides_block").length) { 6430 if ($(this).parent().hasClass("flex-nav-next")) $(".inner_slider .slides_block li.current").next().click(); 6431 else $(".inner_slider .slides_block li.current").prev().click(); 6432 } 6433 }); 6434 6435 $(document).on("click", ".compare_item, .compare_item_add", function (e) { 6436 e.preventDefault(); 6437 var item = $(this).attr("data-item"); 6438 var iblockID = $(this).attr("data-iblock"),
6439 bBannerAction = false, 6440 th = $(this); 6441 6442 if (th.closest(".banner_buttons.with_actions").length) { 6443 //banner action 6444 var wrapper_btns = th.closest(".wraps_buttons"); 6445 item = wrapper_btns.data("id"); 6446 iblockID = wrapper_btns.data("iblockid"); 6447 bBannerAction = true; 6448 6449 th.toggleClass("added"); 6450 6451 if (th.hasClass("added")) th.attr("title", th.data("title2")); 6452 else th.attr("title", th.data("title")); 6453 } 6454 6455 if (!th.hasClass("clicked")) { 6456 th.addClass("clicked"); 6457 if (!$(this).hasClass("text")) { 6458 if ($(this).hasClass("added")) { 6459 if (!bBannerAction) { 6460 $(this).hide(); 6461 $(this).closest(".compare_item_button").find(".to").show(); 6462 } 6463 6464 /*sync other button*/ 6465 $(".like_icons").each(function () { 6466 if ($(this).find('.compare_item.text[data-item="' + item + '"]').length) { 6467 $(this) 6468 .find('.compare_item.text[data-item="' + item + '"]') 6469 .removeClass("added"); 6470 $(this) 6471 .find('.compare_item.text[data-item="' + item + '"]') 6472 .find(".value") 6473 .show(); 6474 $(this) 6475 .find('.compare_item.text[data-item="' + item + '"]') 6476 .find(".value.added") 6477 .hide(); 6478 } 6479 if ($(this).find(".compare_item_button").length) { 6480 /*$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').removeClass('added'); 6481 $(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value').show(); 6482 $(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value.added').hide();*/ 6483 $(this) 6484 .find(".compare_item_button") 6485 .find('.compare_item[data-item="' + item + '"].in') 6486 .hide(); 6487 $(this) 6488 .find(".compare_item_button") 6489 .find('.compare_item[data-item="' + item + '"].to') 6490 .show(); 6491 } 6492 }); 6493 } else { 6494 if (!bBannerAction) { 6495 $(this).hide(); 6496 $(this).closest(".compare_item_button").find(".in").show(); 6497 } 6498 6499 /*sync other button*/ 6500 $(".like_icons").each(function () { 6501 if ($(this).find('.compare_item.text[data-item="' + item + '"]').length) { 6502 $(this) 6503 .find('.compare_item.text[data-item="' + item + '"]') 6504 .addClass("added"); 6505 $(this) 6506 .find('.compare_item.text[data-item="' + item + '"]') 6507 .find(".value") 6508 .hide(); 6509 $(this) 6510 .find('.compare_item.text[data-item="' + item + '"]') 6511 .find(".value.added") 6512 .css({ display: "block" }); 6513 } 6514 if ($(this).find(".compare_item_button").length) { 6515 /*$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').addClass('added'); 6516 $(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value.added').show(); 6517 $(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value').hide();*/ 6518 $(this) 6519 .find(".compare_item_button") 6520 .find('.compare_item[data-item="' + item + '"].to') 6521 .hide(); 6522 $(this) 6523 .find(".compare_item_button") 6524 .find('.compare_item[data-item="' + item + '"].in') 6525 .show(); 6526 } 6527 }); 6528 } 6529 } else { 6530 if (!$(this).hasClass("added")) { 6531 $(".compare_item[data-item=" + item + "]").addClass("added"); 6532 $(".compare_item[data-item=" + item + "]") 6533 .find(".value") 6534 .hide(); 6535 $(".compare_item[data-item=" + item + "]") 6536 .find(".value.added") 6537 .css("display", "block"); 6538 6539 /*sync other button*/ 6540 $(".like_icons").each(function () { 6541 if ($(this).find(".compare_item_button").length) { 6542 $(this) 6543 .find(".compare_item_button") 6544 .find('.compare_item[data-item="' + item + '"]') 6545 .addClass("added"); 6546 $(this) 6547 .find(".compare_item_button") 6548 .find('.compare_item[data-item="' + item + '"]') 6549 .find(".value.added") 6550 .show(); 6551 $(this) 6552 .find(".compare_item_button") 6553 .find('.compare_item[data-item="' + item + '"]') 6554 .find(".value") 6555 .hide(); 6556 } 6557 }); 6558 } else { 6559 $(".compare_item[data-item=" + item + "]").removeClass("added"); 6560 $(".compare_item[data-item=" + item + "]") 6561 .find(".value") 6562 .show(); 6563 $(".compare_item[data-item=" + item + "]") 6564 .find(".value.added") 6565 .hide(); 6566 6567 /*sync other button*/ 6568 $(".like_icons").each(function () { 6569 if ($(this).find(".compare_item_button").length) { 6570 $(this) 6571 .find(".compare_item_button") 6572 .find('.compare_item[data-item="' + item + '"]') 6573 .removeClass("added"); 6574 $(this) 6575 .find(".compare_item_button") 6576 .find('.compare_item[data-item="' + item + '"]') 6577 .find(".value") 6578 .show(); 6579 $(this) 6580 .find(".compare_item_button") 6581 .find('.compare_item[data-item="' + item + '"]') 6582 .find(".value.added") 6583 .hide(); 6584 } 6585 }); 6586 } 6587 } 6588 6589 $.get( 6590 arAsproOptions["SITE_DIR"] + "ajax/item.php?item=" + item + "&compare_item=Y&iblock_id=" + iblockID, 6591 $.proxy(function (data) { 6592 getActualBasket(iblockID, "Compare"); 6593 arStatusBasketAspro = {}; 6594 6595 // js notice 6596 if (
6597 typeof JNoticeSurface !== "undefined" && 6598 ((!bBannerAction && !th.hasClass("added")) || (bBannerAction && th.hasClass("added"))) 6599 ) { 6600 JNoticeSurface.get().onAdd2Compare([th[0]]); 6601 } 6602 // 6603 6604 if ($("#compare_fly").length) { 6605 jsAjaxUtil.InsertDataToNode( 6606 arAsproOptions["SITE_DIR"] + "ajax/show_compare_preview_fly.php", 6607 "compare_fly", 6608 false 6609 ); 6610 } 6611 th.removeClass("clicked"); 6612 }) 6613 ); 6614 } 6615 }); 6616 6617 $(document).on("click", ".tabs>li", function () { 6618 var parent = $(this).parent(); 6619 if (!$(this).hasClass("active")) { 6620 var sliderIndex = $(this).index(), 6621 curLiNav = $(this) 6622 .closest(".top_block") 6623 .find(".slider_navigation") 6624 .find(">li:eq(" + sliderIndex + ")"), 6625 curLi = $(this) 6626 .closest(".top_block") 6627 .siblings(".tabs_content") 6628 .find(">li:eq(" + sliderIndex + ")"); 6629 $(this).addClass("active").addClass("cur").siblings().removeClass("active").removeClass("cur"); 6630 curLi.addClass("cur").siblings().removeClass("cur"); 6631 curLiNav.addClass("cur").siblings().removeClass("cur"); 6632 6633 if (parent.hasClass("ajax")) { 6634 // front tabs 6635 if (!$(this).hasClass("clicked")) { 6636 $.ajax({ 6637 url: arAsproOptions["SITE_DIR"] + "include/mainpage/comp_catalog_ajax.php", 6638 type: "POST", 6639 data: { 6640 AJAX_POST: "Y", 6641 FILTER_HIT_PROP: $(this).data("code"), 6642 AJAX_PARAMS: $(this).closest(".tab_slider_wrapp").find(".request-data").data("value"), 6643 GLOBAL_FILTER: curLi.data("filter"), 6644 }, 6645 success: function (html) { 6646 curLi.find(".tabs_slider").html(html); 6647 var container = curLi.closest(".content_wrapper_block"); 6648 if (container.length) { 6649 var bNav = curLi.find(".bottom_nav .module-pagination").length > 0; 6650 if (bNav) { 6651 container.removeClass("without-border"); 6652 } else { 6653 container.addClass("without-borded"); 6654 } 6655 } 6656 setTimeout(function () { 6657 curLi.addClass("opacity1"); 6658 }, 100); 6659 6660 BX.onCustomEvent("onAjaxResponesTabs", [eventdata]); 6661 }, 6662 }); 6663 $(this).addClass("clicked"); 6664 } else { 6665 var container = curLi.closest(".content_wrapper_block"); 6666 if (container.length) { 6667 var bNav = curLi.find(".bottom_nav .module-pagination").length > 0; 6668 if (bNav) { 6669 container.removeClass("without-border"); 6670 } else { 6671 container.addClass("without-borded"); 6672 } 6673 } 6674 } 6675 } 6676 6677 var eventdata = { index: sliderIndex, target: $(this) }; 6678 BX.onCustomEvent("clickedTabsLi", [eventdata]); 6679 } 6680 }); 6681 6682 /*search click*/ 6683 $(".search_block .icon").on("click", function () { 6684 var th = $(this); 6685 if ($(this).hasClass("open")) { 6686 $(this).closest(".center_block").find(".search_middle_block").removeClass("active"); 6687 $(this).removeClass("open"); 6688 $(this).closest(".center_block").find(".search_middle_block").find(".noborder").hide(); 6689 } else { 6690 setTimeout(function () { 6691 th.closest(".center_block").find(".search_middle_block").find(".noborder").show(); 6692 }, 100); 6693 $(this).closest(".center_block").find(".search_middle_block").addClass("active"); 6694 $(this).addClass("open"); 6695 } 6696 }); 6697 6698 $(document).on("click", ".no_goods .button", function () { 6699 $(".bx_filter .smartfilter .bx_filter_search_reset").trigger("click"); 6700 }); 6701 6702 $(document).on("click", ".js-load-link", function (e) { 6703 AjaxClickLink(e); 6704 }); 6705 6706 $(document).on("click", ".svg-inline-bottom_nav-icon", function () { 6707 $(this).next().trigger("click"); 6708 }); 6709 $(document).on("click", ".ajax_load_btn", function () { 6710 var _this = $(this), 6711 url = _this.closest(".container").find(".module-pagination .flex-direction-nav .flex-next").attr("href"), 6712 th = _this.find(".more_text_ajax"), 6713 bottom_nav = _this.closest(".bottom_nav"), 6714 mobileBottomNav = bottom_nav.hasClass("mobile_slider"), 6715 bLoadingState = _this.closest(".animate-load-state").length; 6716 6717 if (!th.hasClass("loading")) { 6718 th.addClass("loading"); 6719 if (mobileBottomNav) { 6720 var icon = bottom_nav.find(".svg-inline-bottom_nav-icon"); 6721 icon.css("display", "none"); 6722 } 6723 if (bLoadingState) _this.addClass("loadings"); 6724 6725 var objUrl = parseUrlQuery(), 6726 add_url = ""; 6727 obGetData = { ajax_get: "Y", AJAX_REQUEST: "Y" }; 6728 6729 if (_this.closest(".wrapper_inner.front").length) { 6730 //index page 6731 var class_block = th.closest(".drag-block").data("class").replace("_drag", ""); 6732 class_block = class_block.replace(/\s/g, ""); 6733 obGetData.BLOCK = class_block; 6734 } 6735 6736 if (_this.closest(".tab").length) { 6737 //tabs block 6738 var parentTab = th.closest(".tab"); 6739 obGetData.FILTER_HIT_PROP = parentTab.data("code"); 6740 obGetData.GLOBAL_FILTER = parentTab.data("filter"); 6741 url = _this.closest(".bottom_nav").find(".module-pagination .flex-direction-nav .flex-next").attr("href"); 6742 } 6743 6744 if (_this.closest(".content_linked_goods").length) { 6745 //linked_goods block in content 6746 var filterSections = th.closest(".content_linked_goods").attr("data-sections-ids"); 6747 obGetData.ajax_section_id = decodeURIComponent(filterSections); 6748 6749 url = _this.closest(".bottom_nav").find(".module-pagination .flex-direction-nav .flex-next").attr("href"); 6750 } 6751 6752 if ("clear_cache" in objUrl) { 6753 if (objUrl.clear_cache == "Y") add_url = "&clear_cache=Y"; 6754 } 6755 if (_this.hasClass("ajax")) obGetData.ajax = "y"; 6756
6757 if (th.closest(".goods-block.ajax_load")) obGetData.bitrix_include_areas = "N"; 6758 6759 if (_this.closest(".nav-data_block").length) { 6760 //need data-block 6761 obGetData.data_block = _this.closest(".nav-data_block").attr("data-block"); 6762 obGetData.pagen_data_block = "Y"; 6763 url = _this.closest(".bottom_nav").find(".module-pagination .flex-direction-nav .flex-next").attr("href"); 6764 } 6765 6766 $.ajax({ 6767 url: url + add_url, 6768 data: obGetData, 6769 success: function (html) { 6770 pasteAjaxPagination(html, th, bottom_nav, bLoadingState, _this); 6771 }, 6772 error: function (html) { 6773 pasteAjaxPagination(html.responseText, th, bottom_nav, bLoadingState, _this); 6774 }, 6775 }); 6776 } 6777 }); 6778 6779 function pasteAjaxPagination(html, th, bottom_nav, bLoadingState, _this) { 6780 var mobileBottomClicked = bottom_nav.hasClass("mobile_slider"); 6781 var hasMobileBottomNav = $(html).find(".bottom_nav.mobile_slider"); 6782 var bottomNav = hasMobileBottomNav.length ? hasMobileBottomNav : $(html).find(".bottom_nav"); 6783 var bottomNavHtml = bottomNav.html(); 6784 var bottomNavScrollClass = bottomNav.data("scroll-class"); 6785 var hasBottomNav = $(html).find(".ajax_load_btn").length; 6786 6787 if (th.closest(".ajax_load").length && !mobileBottomClicked) { 6788 th.removeClass("loading"); 6789 if (th.closest(".ajax_load").find(".js_append").length) { 6790 if (_this.closest(".catalog_in_content").length) { 6791 th.closest(".ajax_load").find(".js_append").append($(".inner_wrapper .js_wrapper_items>", html)); //need for brands & landings 6792 } else if (_this.closest(".catalog.search").length) { 6793 th.closest(".ajax_load").find(".js_append").append($(".js_append>", html)); 6794 } else { 6795 th.closest(".ajax_load").find(".js_append").append(html); 6796 } 6797 th.closest(".ajax_load").find(".bottom_nav_wrapper").remove(); 6798 } else { 6799 if ($(".display_list").length) { 6800 $(".display_list").append(html); 6801 th.closest(".display_list").find(".bottom_nav_wrapper").remove(); 6802 } else if ($(".block_list").length) { 6803 $(".block_list").append(html); 6804 touchItemBlock(".catalog_item a"); 6805 th.closest(".block_list").find(".bottom_nav_wrapper").remove(); 6806 } else if ($(".module_products_list").length) { 6807 $(".module_products_list > tbody").append(html); 6808 th.closest(".module_products_list > tbody").find(".bottom_nav_wrapper").remove(); 6809 } 6810 } 6811 6812 setStatusButton(); 6813 checkLinkedArticles(); 6814 checkLinkedBlocks(".linked-banners-list"); 6815 6816 var eventdata = { action: "ajaxContentLoadedTab" }; 6817 BX.onCustomEvent("onAjaxSuccess", [eventdata]); 6818 _this.closest(".bottom_nav").html(bottomNavHtml); 6819 } else { 6820 var eventdata = { action: "ajaxContentLoaded" }; 6821 6822 if ($(".banners-small.front").length) { 6823 $(".banners-small .items.row").append(html); 6824 $(".bottom_nav").html($(".banners-small .items.row .bottom_nav").html()); 6825 $(".banners-small .items.row .bottom_nav").remove(); 6826 if (hasBottomNav) { 6827 $(".banners-small .items.row").addClass("has-bottom-nav"); 6828 } else { 6829 $(".banners-small .items.row").removeClass("has-bottom-nav"); 6830 } 6831 } else { 6832 if (bottom_nav.data("append") !== undefined && bottom_nav.data("parent") !== undefined) { 6833 var target = html; 6834 if (bottom_nav.data("target") !== undefined) { 6835 target = $(html).find(bottom_nav.data("target")); 6836 } 6837 if (mobileBottomClicked || hasMobileBottomNav.length) { 6838 var mobileSliderNav = th.closest(bottom_nav.data("parent")).find(".bottom_nav.mobile_slider"); 6839 if (mobileSliderNav.length) { 6840 mobileSliderNav.before(target); 6841 } else { 6842 bottom_nav.before(target); 6843 } 6844 } else { 6845 th.closest(bottom_nav.data("parent")).find(bottom_nav.data("append")).append(target); 6846 } 6847 th.closest(bottom_nav.data("parent")).find(bottom_nav.data("append")).find(".bottom_nav_wrapper").remove(); 6848 6849 if (hasBottomNav) { 6850 if (bottomNavScrollClass !== undefined) { 6851 th.closest(bottom_nav.data("parent")).find(bottomNavScrollClass).addClass("has-bottom-nav"); 6852 } 6853 th.closest(bottom_nav.data("parent")).find(bottom_nav.data("append")).addClass("has-bottom-nav"); 6854 } else { 6855 if (bottomNavScrollClass !== undefined) { 6856 th.closest(bottom_nav.data("parent")).find(bottomNavScrollClass).removeClass("has-bottom-nav"); 6857 } 6858 th.closest(bottom_nav.data("parent")).find(bottom_nav.data("append")).removeClass("has-bottom-nav"); 6859 } 6860 6861 bottom_nav = th.closest(bottom_nav.data("parent")).find(".bottom_nav"); 6862 bottom_nav.html(bottomNavHtml); 6863 var icon = bottom_nav.find(".svg-inline-bottom_nav-icon"); 6864 icon.css("display", ""); 6865 6866 eventdata.container = th.closest(bottom_nav.data("parent")); 6867 } else { 6868 if (th.closest(".item-views").find(".items").length) { 6869 th.closest(".item-views").find(".items").append(html); 6870 } else { 6871 $(html).insertBefore($(".blog .bottom_nav")); 6872 } 6873 6874 bottom_nav.html($(".bottom_nav:hidden").html()); 6875 if (hasBottomNav) { 6876 th.closest(".item-views").find(".items").addClass("has-bottom-nav"); 6877 } else { 6878 th.closest(".item-views").find(".items").removeClass("has-bottom-nav"); 6879 } 6880 _this.closest(".item-views").find(".bottom_nav:hidden").remove(); 6881 } 6882 } 6883 6884 eventdata.content = html; 6885 eventdata.container = th; 6886 BX.onCustomEvent("onCompleteAction", [eventdata, th[0]]); 6887 6888 setTimeout(function () { 6889 $(".banners-small .item.normal-block").sliceHeight({ resize: false }); 6890 if ($(".item.slice-item").length) { 6891 $(".item.slice-item .title").sliceHeight({ resize: false }); 6892 $(".item.slice-item").sliceHeight({ resize: false }); 6893 } 6894 th.removeClass("loading"); 6895 if (bLoadingState) _this.removeClass("loadings"); 6896 }, 100); 6897 } 6898 BX.onCustomEvent("onHeaderProgressBarChange", [{}]); 6899 // initCountdown(); 6900 } 6901 6902 // form rating 6903 $(document).on("mouseenter", ".form .votes_block.with-text .item-rating", function () { 6904 var $this = $(this), 6905 index = $this.index(),
6906 ratingValue = $this.data("rating_value"), 6907 ratingMessage = $this.data("message"); 6908 6909 $(this).addClass("filed"); 6910 $this.siblings().each(function () { 6911 if ($(this).index() <= index) $(this).addClass("filed"); 6912 else $(this).removeClass("filed"); 6913 }); 6914 $this.closest(".votes_block").find(".rating_message").text(ratingMessage); 6915 }); 6916 6917 $(document).on("mouseleave", ".form .votes_block.with-text", function () { 6918 var $this = $(this), 6919 index = $this.data("rating"), 6920 ratingMessage = $this.closest(".votes_block").find(".rating_message").data("message"); 6921 6922 $this.find(".item-rating").each(function () { 6923 if ($(this).index() < index && index !== undefined) $(this).addClass("filed"); 6924 else $(this).removeClass("filed"); 6925 }); 6926 $this.closest(".votes_block").find(".rating_message").text(ratingMessage); 6927 }); 6928 6929 $(document).on("click", ".form .votes_block.with-text .item-rating", function () { 6930 var $this = $(this), 6931 rating = $this.closest(".votes_block").data("rating"), 6932 index = $this.index() + 1, 6933 ratingMessage = $this.data("message"); 6934 6935 $this.closest(".votes_block").data("rating", index); 6936 if ($this.closest(".form-control").find("input[name=RATING]").length) { 6937 $this.closest(".form-control").find("input[name=RATING]").val(index); 6938 } else { 6939 $this.closest(".form-control").find("input[data-sid=RATING]").val(index); 6940 } 6941 $this.closest(".votes_block").find(".rating_message").data("message", ratingMessage); 6942 6943 $this.closest(".form").find(".error").remove(); 6944 }); 6945 6946 $(document).on("paste, change, keyup", ".form.blog-comment-fields input[required]", function () { 6947 let value = $(this).val(); 6948 6949 if (value.length) { 6950 $(this).closest(".form-group").find("label.error").remove(); 6951 } 6952 }); 6953 6954 //set cookie for basket link click 6955 $(document).on( 6956 "click", 6957 ".bx_ordercart_order_table_container .control > a, .basket-item-actions-remove, a[data-entity=basket-item-remove-delayed]", 6958 function (e) { 6959 $.removeCookie("click_basket", { path: "/" }); 6960 $.cookie("click_basket", "Y", { path: "/" }); 6961 } 6962 ); 6963 6964 $(document).on("click", ".bx_compare .tabs-head li", function () { 6965 var url = $(this).find(".sortbutton").data("href"); 6966 BX.showWait(BX("bx_catalog_compare_block")); 6967 $.ajax({ 6968 url: url, 6969 data: { ajax_action: "Y" }, 6970 success: function (html) { 6971 history.pushState(null, null, url); 6972 $("#bx_catalog_compare_block").html(html); 6973 BX.closeWait(); 6974 }, 6975 }); 6976 }); 6977 var hoveredTrs; 6978 $(document).on( 6979 { 6980 mouseover: function (e) { 6981 var _ = $(this); 6982 var tbodyIndex = _.closest("tbody").index() + 1; //+1 for nth-child 6983 var trIndex = _.index() + 1; // +1 for nth-child 6984 hoveredTrs = $(e.delegateTarget) 6985 .find(".data_table_props") 6986 .children(":nth-child(" + tbodyIndex + ")") 6987 .children(":nth-child(" + trIndex + ")") 6988 .addClass("hovered"); 6989 }, 6990 mouseleave: function (e) { 6991 if (hoveredTrs) hoveredTrs.removeClass("hovered"); 6992 }, 6993 }, 6994 ".bx_compare .data_table_props tbody>tr" 6995 ); 6996 $(document).on("click", ".fancy_zoom", function (e) { 6997 e.preventDefault(); 6998 var arPict = [], 6999 index = 0; 7000 $(this) 7001 .closest(".product-detail-gallery__container") 7002 .find(".gallery-slider-thumb__container .gallery__item--thumb") 7003 .each(function () { 7004 var obImg = {}; 7005 obImg = { 7006 src: $(this).data("big"), 7007 thumb: $(this).find("img").data("src") || $(this).find("img").attr("src"), 7008 // opts: { 7009 // caption: $(this).find("img").attr("alt"), 7010 // }, 7011 }; 7012 if ($(this).hasClass("swiper-slide-thumb-active")) { 7013 index = $(this).index(); 7014 } 7015 arPict.push(obImg); 7016 }); 7017 if (!arPict.length) { 7018 arPict.push({ 7019 src: $(this).closest(".product-detail-gallery__container").find(".zoom_picture").data("xoriginal"), 7020 }); 7021 } 7022 if (typeof $.fn.fancybox !== "function") { 7023 return; 7024 } 7025 $.fancybox.open( 7026 arPict, 7027 { 7028 tpl: { 7029 closeBtn: 7030 '<span title="' + 7031 BX.message("FANCY_CLOSE") + 7032 '" class="fancybox-item fancybox-close inline svg"><svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2 24L24 2M2 2L24 24" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg></span>', 7033 next: 7034 '<a title="' + 7035 BX.message("FANCY_NEXT") + 7036 '" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>', 7037 prev: 7038 '<a title="' + 7039 BX.message("FANCY_PREV") + 7040 '" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>', 7041 }, 7042 btnTpl: { 7043 close: 7044 '<button data-fancybox-close class="fancybox-button fancybox-button--close" title="{{CLOSE}}">' + 7045 '<i class="svg"><svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M2 24L24 2M2 2L24 24" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" /></svg></i>' + 7046 "</button>", 7047 7048 arrowLeft: 7049 '<button data-fancybox-prev class="fancybox-button fancybox-button--arrow_left" title="{{PREV}}">' + 7050 '<div><i class="svg left"><svg width="16" height="26" viewBox="0 0 15 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2 13L0.585787 14.4142C-0.195262 13.6332 -0.195262 12.3668 0.585787 11.5858L2 13ZM11.5858 0.585786C12.3668 -0.195262 13.6332 -0.195262 14.4142 0.585786C15.1953 1.36683 15.1953 2.63317 14.4142 3.41421L11.5858 0.585786ZM14.4142 22.5858C15.1953 23.3668 15.1953 24.6332 14.4142 25.4142C13.6332 26.1953 12.3668 26.1953 11.5858 25.4142L14.4142 22.5858ZM0.585787 11.5858L11.5858 0.585786L14.4142 3.41421L3.41421 14.4142L0.585787 11.5858ZM3.41421 11.5858L14.4142 22.5858L11.5858 25.4142L0.585787 14.4142L3.41421 11.5858Z" fill="#999999"/></svg></i></div>' + 7051 "</button>", 7052 7053 arrowRight: 7054 '<button data-fancybox-next class="fancybox-button fancybox-button--arrow_right" title="{{NEXT}}">' + 7055 '<div><i class="svg right"><svg width="16" height="26" viewBox="0 0 15 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13 13L14.4142 14.4142C15.1953 13.6332 15.1953 12.3668 14.4142 11.5858L13 13ZM3.41421 0.585786C2.63317 -0.195262 1.36683 -0.195262 0.585786 0.585786C-0.195262 1.36683 -0.195262 2.63317 0.585786 3.41421L3.41421 0.585786ZM0.585786 22.5858C-0.195262 23.3668 -0.195262 24.6332 0.585786 25.4142C1.36683 26.1953 2.63317 26.1953 3.41421 25.4142L0.585786 22.5858ZM14.4142 11.5858L3.41421 0.585786L0.585786 3.41421L11.5858 14.4142L14.4142 11.5858ZM11.5858 11.5858L0.585786 22.5858L3.41421 25.4142L14.4142 14.4142L11.5858 11.5858Z" fill="white"/></svg></i></div>' + 7056 "</button>", 7057 }, 7058 touch: "enabled", 7059 loop: false, 7060 buttons: [ 7061 // "zoom", 7062 //"share", 7063 // "slideShow", 7064 //"fullScreen", 7065 //"download", 7066 // "thumbs", 7067 "close", 7068 ], 7069 thumbs: { 7070 autoStart: true, 7071 }, 7072 onActivate: function (instance) { 7073 InitFancyboxThumbnailsGallery(instance); 7074 }, 7075 beforeShow: function (instance, current) { 7076 if ($(".fancybox-thumbs .swiper").length) { 7077 const swiper = $(".fancybox-thumbs .swiper").data("swiper"); 7078 swiper.slideTo(current.index); 7079 } 7080 }, 7081 }, 7082 index 7083 ); 7084 }); 7085 7086 /*tabs*/ 7087 $(".tabs_section .tabs-head li").on("click", function () { 7088 if (!$(this).is(".current")) { 7089 $(".tabs_section .tabs-head li").removeClass("current"); 7090 $(this).addClass("current"); 7091 $(".tabs_section ul.tabs_content li").removeClass("current"); 7092 if ($(this).attr("id") == "product_reviews_tab") { 7093 $(".shadow.common").hide(); 7094 $("#reviews_content").show(); 7095 } else { 7096 $(".shadow.common").show(); 7097 $("#reviews_content").hide(); 7098 $(".tabs_section ul.tabs_content > li:eq(" + $(this).index() + ")").addClass("current"); 7099 } 7100 } 7101 }); 7102 7103 /*open first section slide*/ 7104 setTimeout(function () { 7105 $(".jobs_wrapp .item:first .name tr").trigger("click"); 7106 }, 300); 7107 7108 $(".choise").on("click", function () { 7109 var _this = $(this); 7110 if (typeof _this.attr("data-block") != "undefined") { 7111 if ($(_this.attr("data-block")).closest(".tab-pane").length) { 7112 $('.ordered-block a[href="#' + $(_this.attr("data-block")).closest(".tab-pane").attr("id") + '"]').click(); 7113 _this.data("block", ".ordered-block.tabs-block"); 7114 $(_this.data("block")).data("offset", -100); 7115 } else { 7116 $(_this.data("block")).data("offset", -100); 7117 } 7118 scrollToBlock(_this.data("block")); 7119 } 7120 }); 7121 7122 $(document).on("click", ".buy_block .slide_offer", function () { 7123 scroll_block($(".js-offers-scroll")); 7124 }); 7125 $(".share > .share_wrapp .text").on("click", function () { 7126 var block = $(this).parent().find(".shares"); 7127 if (!block.is(":visible") && !$(this).closest(".share.top").length) $("#content").css("z-index", 3); 7128 block.fadeToggle(100, function () { 7129 if (!block.is(":visible")) $("#content").css("z-index", 2); 7130 }); 7131 }); 7132 $("html, body").on("mousedown", function (e) { 7133 if (typeof e.target.className == "string" && e.target.className.indexOf("adm") < 0) { 7134 e.stopPropagation(); 7135 $("div.shares").fadeOut(100, function () { 7136 $("#content").css("z-index", 2); 7137 $(".price_txt .share_wrapp").removeClass("opened"); 7138 }); 7139 $(".search_middle_block").removeClass("active_wide"); 7140 } 7141 }); 7142 $(".share_wrapp") 7143 .find("*") 7144 .on("mousedown", function (e) { 7145 e.stopPropagation(); 7146 }); 7147 7148 $(".price_txt .share_wrapp .text").click(function () { 7149 $(this).parent().toggleClass("opened"); 7150 $(this).parent().find(".shares").fadeToggle(); 7151 }); 7152 7153 $(document).on("click", ".reviews-collapse-link", function () { 7154 $(".reviews-reply-form").slideToggle(); 7155 }); 7156 7157 /* accordion action*/ 7158 $(".panel-collapse").on("hidden.bs.collapse", function () { 7159 $(this).parent().toggleClass("opened"); 7160 }); 7161 $(".panel-collapse").on("show.bs.collapse", function () { 7162 $(this).parent().toggleClass("opened"); 7163 }); 7164 7165 /* accordion */ 7166 $(".accordion-head").on("click", function (e) { 7167 e.preventDefault(); 7168 if (!$(this).next().hasClass("collapsing")) { 7169 $(this).toggleClass("accordion-open"); 7170 $(this).toggleClass("accordion-close"); 7171 } 7172 }); 7173 7174 /* progress bar */ 7175 $("[data-appear-progress-animation]").iAppear( 7176 function () { 7177 var $this = $(this);
7178 var delay = $this.attr("data-appear-animation-delay") ? $this.attr("data-appear-animation-delay") : 1; 7179 if (delay > 1) $this.css("animation-delay", delay + "ms"); 7180 $this.addClass($this.attr("data-appear-animation")); 7181 7182 setTimeout(function () { 7183 $this.animate( 7184 { 7185 width: $this.attr("data-appear-progress-animation"), 7186 }, 7187 1500, 7188 "easeOutQuad", 7189 function () { 7190 $this.find(".progress-bar-tooltip").animate( 7191 { 7192 opacity: 1, 7193 }, 7194 500, 7195 "easeOutQuad" 7196 ); 7197 } 7198 ); 7199 }, delay); 7200 }, 7201 { 7202 rootMargin: "-50px 0px -50px 0px", 7203 accX: 0, 7204 accY: -50, 7205 } 7206 ); 7207 7208 // initCountdown(); 7209 7210 /* portfolio item */ 7211 if ($(".item.animated-block").length) { 7212 $(".item.animated-block").iAppear( 7213 function () { 7214 var $this = $(this); 7215 7216 $this.addClass($this.data("animation")).addClass("visible"); 7217 }, 7218 { accX: 0, accY: 150 } 7219 ); 7220 } 7221 7222 /* flexslider appear */ 7223 if ($(".appear-block").length) { 7224 $(".appear-block").iAppear( 7225 function () { 7226 var $this = $(this); 7227 $this.removeClass("appear-block"); 7228 $this.find(".appear-block").removeClass("appear-block"); 7229 InitOwlSlider(); 7230 if (typeof initSwiperSlider === "function") { 7231 initSwiperSlider(); 7232 } 7233 }, 7234 { 7235 rootMargin: "150px 0px 150px 0px", 7236 accX: 0, 7237 accY: 150, 7238 } 7239 ); 7240 } 7241 7242 /* js-load-block appear */ 7243 if ($(".js-load-block").length) { 7244 var objUrl = parseUrlQuery(); 7245 var bClearCache = false; 7246 if ("clear_cache" in objUrl) { 7247 if (objUrl.clear_cache == "Y") { 7248 bClearCache = true; 7249 } 7250 } 7251 7252 var items = []; 7253 var bIdle = true; 7254 var insertNextBlockContent = function () { 7255 if (bIdle && items.length) { 7256 bIdle = false; 7257 const item = items.pop(); 7258 7259 // get content 7260 $.get(item.url).done(function (html) { 7261 item.content = html; 7262 item.content = $.trim(item.content); 7263 7264 // remove /bitrix/js/main/core/core_window.js if it was loaded already 7265 if (item.content.indexOf("/bitrix/js/main/core/core_window.") !== -1 && BX.WindowManager) { 7266 item.content = item.content.replace( 7267 /<script src="\/bitrix\/js\/main\/core\/core_window\.[^>]*><\/script>/gm, 7268 "" 7269 ); 7270 } 7271 7272 // remove /bitrix/js/currency/core_currency.js if it was loaded already 7273 if ( 7274 item.content.indexOf("/bitrix/js/currency/core_currency.") !== -1 && 7275 typeof BX.Currency === "object" && 7276 BX.Currency.defaultFormat 7277 ) { 7278 item.content = item.content.replace( 7279 /<script src="\/bitrix\/js\/currency\/core_currency\.[^>]*><\/script>/gm, 7280 "" 7281 ); 7282 } 7283 7284 // remove /bitrix/js/main/pageobject/pageobject.js if it was loaded already 7285 if (item.content.indexOf("/bitrix/js/main/pageobject/pageobject.") !== -1 && BX.PageObject) { 7286 item.content = item.content.replace( 7287 /<script src="\/bitrix\/js\/main\/pageobject\/pageobject\.[^>]*><\/script>/gm, 7288 "" 7289 ); 7290 } 7291 7292 // remove /bitrix/js/main/polyfill/promise/js/promise.js if it not need 7293 if ( 7294 item.content.indexOf("/bitrix/js/main/polyfill/promise/js/promise.") !== -1 && 7295 typeof window.Promise !== "undefined" && 7296 window.Promise.toString().indexOf("[native code]") !== -1 7297 ) { 7298 item.content = item.content.replace( 7299 /<script src="\/bitrix\/js\/main\/polyfill\/promise\/js\/promise\.[^>]*><\/script>/gm, 7300 "" 7301 ); 7302 } 7303 7304 if ( 7305 typeof MutationObserver === "function" && 7306 document.querySelector("body").classList.contains("detail_page") 7307 ) { 7308 const observer = new MutationObserver(function (list, observer) { 7309 const $curBlock = list[0].target; 7310 const curBlockBounds = $curBlock.getBoundingClientRect(); 7311 7312 if ($curBlock.parentElement.classList.contains("complect-block")) { 7313 $curBlock.parentElement.classList.add("loaded"); 7314 } 7315 7316 if (curBlockBounds.top < 0 && curBlockBounds.bottom >= 0) { 7317 const offsetTop = window.scrollY + Math.round($curBlock.offsetHeight) - 100; 7318 window.scrollTo(0, offsetTop); 7319 } 7320 7321 observer.disconnect(); 7322 }); 7323 7324 observer.observe(item.$context[0], { 7325 childList: true, 7326 }); 7327 } 7328 7329 const ob = BX.processHTML(item.content); 7330 7331 // stop ya metrika webvisor DOM indexer 7332 pauseYmObserver(); 7333 7334 item.$context.removeAttr("data-file").removeClass("loader_circle"); 7335 item.$target.innerHTML = ob.HTML; 7336 7337 BX.ajax.processScripts(ob.SCRIPT); 7338 7339 var eventdata = { action: "jsLoadBlock" }; 7340 BX.onCustomEvent("onCompleteAction", [eventdata, item.$context]); 7341 7342 BX.onCustomEvent("onHeaderProgressBarChange", [{}]); 7343 7344 // resume ya metrika webvisor 7345 // 500ms 7346 setTimeout(resumeYmObserver, 500); 7347 7348 bIdle = true; 7349 insertNextBlockContent(); 7350 }); 7351 } 7352 }; 7353 7354 $(".js-load-block").iAppear( 7355 function () { 7356 var $this = $(this); 7357 7358 if ($this.data("file")) { 7359 const add_url = new URL(location.origin + $this.data("file")); 7360 7361 if (bClearCache) add_url.searchParams.set("clear_cache", "Y"); 7362 if ($this.data("block")) add_url.searchParams.set("BLOCK", $this.data("block")); 7363 if ($this.data("show_all")) add_url.searchParams.set("SHOW_ALL", "Y"); 7364 7365 const $target = $this.data("appendTo") 7366 ? $this.find($this.data("appendTo"))[0] 7367 : $this.find('> div[id*="bx_incl_"]').length 7368 ? $this.find('> div[id*="bx_incl_"]')[0] 7369 : $this[0]; 7370 7371 items.unshift({ 7372 $target: $target, 7373 $context: $this, 7374 url: add_url, 7375 }); 7376 insertNextBlockContent(); 7377 } 7378 }, 7379 { 7380 rootMargin: isMobile ? "300px 0px 300px 0px" : "150px 0px 150px 0px", 7381 accX: 0, 7382 accY: isMobile ? 300 : 150, 7383 } 7384 ); 7385 } 7386 7387 /*show ajax store amount product*/ 7388 $(document).on("click", ".js-show-info-block", function (e) { 7389 var $this = $(this); 7390 7391 //check on ".cost.prices" need for popup price in mobile 7392 if (window.matchMedia("(max-width: 500px)").matches && !$this.closest(".cost.prices").length) { 7393 return; 7394 } 7395 7396 e.stopPropagation(); 7397 $(".js-info-block").fadeOut(); 7398 7399 if ($this.hasClass("opened")) { 7400 $(".js-show-info-block").removeClass("opened"); 7401 } else { 7402 $(".js-show-info-block").removeClass("opened"); 7403 $this.addClass("opened"); 7404 } 7405 7406 if (!$this.siblings(".js-info-block").length) { 7407 var dataFields = $this.closest(".sa_block").data("fields"); 7408 dataFields = dataFields == "null" || dataFields === undefined ? "" : dataFields; 7409 var dataUserFields = $this.closest(".sa_block").data("user-fields"); 7410 dataUserFields = dataUserFields == "null" || dataUserFields === undefined ? "" : dataUserFields; 7411 var objUrl = parseUrlQuery(), 7412 add_url = ""; 7413 if ("clear_cache" in objUrl) { 7414 if (objUrl.clear_cache == "Y") add_url += "?clear_cache=Y"; 7415 } 7416 7417 var obPostParams = { 7418 ajax: "Y", 7419 ELEMENT_ID: $this.data("id"), 7420 FIELDS: dataFields, 7421 USER_FIELDS: dataUserFields, 7422 STORES: $this.closest(".sa_block").data("stores") || "", 7423 }; 7424 7425 $this.addClass("loadings"); 7426 $.post(arAsproOptions["SITE_DIR"] + "ajax/productStoreAmountCompact.php" + add_url, obPostParams).done(function ( 7427 html 7428 ) { 7429 $this.removeClass("loadings"); 7430 $(html).appendTo($this.closest(".sa_block")); 7431 7432 $this 7433 .siblings(".js-info-block") 7434 .find(".more-btn a") 7435 .attr("href", $this.closest(".item_info").find("a").attr("href")); 7436 // InitScrollBar(); 7437 7438 var eventdata = { action: "jsShowStores" }; 7439 BX.onCustomEvent("onCompleteAction", [eventdata, $this]); 7440 }); 7441 } else { 7442 if ($this.hasClass("opened")) { 7443 $this 7444 .siblings(".js-info-block") 7445 .find(".more-btn a") 7446 .attr("href", $this.closest(".item_info").find("a").attr("href")); 7447 $this.siblings(".js-info-block").fadeIn(); 7448 // InitScrollBar(); 7449 } else { 7450 $this.siblings(".js-info-block").fadeOut(); 7451 } 7452 } 7453 }); 7454 $(document).on("click", ".js-info-block .svg-inline-close", function () { 7455 $(".js-show-info-block").removeClass("opened");
7456 $(this).closest(".js-info-block").fadeOut(); 7457 }); 7458 /**/ 7459 7460 /*adaptive menu start*/ 7461 $(".menu.adaptive").on("click", function () { 7462 $(this).toggleClass("opened"); 7463 if ($(this).hasClass("opened")) { 7464 $(".mobile_menu").toggleClass("opened").slideDown(); 7465 } else { 7466 $(".mobile_menu").toggleClass("opened").slideUp(); 7467 } 7468 }); 7469 $(".mobile_menu .has-child >a").on("click", function (e) { 7470 var parentLi = $(this).parent(); 7471 e.preventDefault(); 7472 parentLi.toggleClass("opened"); 7473 parentLi.find(".dropdown").slideToggle(); 7474 }); 7475 7476 $(".mobile_menu .search-input-div input").on("keyup", function (e) { 7477 var inputValue = $(this).val(); 7478 $(".center_block .stitle_form input").val(inputValue); 7479 if (e.keyCode == 13) { 7480 $(".center_block .stitle_form form").submit(); 7481 } 7482 }); 7483 7484 $(".center_block .stitle_form input").on("keyup", function (e) { 7485 var inputValue = $(this).val(); 7486 $(".mobile_menu .search-input-div input").val(inputValue); 7487 if (e.keyCode == 13) { 7488 $(".center_block .stitle_form form").submit(); 7489 } 7490 }); 7491 7492 $(".mobile_menu .search-button-div button").on("click", function (e) { 7493 e.preventDefault(); 7494 var inputValue = $(this).parents().find("input").val(); 7495 $(".center_block .stitle_form input").val(inputValue); 7496 $(".center_block .stitle_form form").submit(); 7497 }); 7498 /*adaptive menu end*/ 7499 7500 $(document).on("click", ".mega-menu .dropdown-menu", function (e) { 7501 e.stopPropagation(); 7502 }); 7503 7504 $(document).on("click", ".mega-menu .dropdown-toggle.more-items", function (e) { 7505 e.preventDefault(); 7506 }); 7507 7508 $(document).on("mouseenter", "#headerfixed .table-menu .dropdown-menu .dropdown-submenu", function () { 7509 setTimeout(function () { 7510 CheckTopVisibleMenu(); 7511 }, 275); 7512 }); 7513 7514 $(".mega-menu .search-item .search-icon, .menu-row #title-search .fa-close").on("click", function (e) { 7515 e.preventDefault(); 7516 $(".menu-row #title-search").toggleClass("hide"); 7517 }); 7518 7519 $(".mega-menu ul.nav .search input").on("keyup", function (e) { 7520 var inputValue = $(this).val(); 7521 $(".menu-row > .search input").val(inputValue); 7522 if (e.keyCode == 13) { 7523 $(".menu-row > .search form").submit(); 7524 } 7525 }); 7526 7527 $(".menu-row > .search input").on("keyup", function (e) { 7528 var inputValue = $(this).val(); 7529 $(".mega-menu ul.nav .search input").val(inputValue); 7530 if (e.keyCode == 13) { 7531 $(".menu-row > .search form").submit(); 7532 } 7533 }); 7534 7535 $(".mega-menu ul.nav .search button").on("click", function (e) { 7536 e.preventDefault(); 7537 var inputValue = $(this).parents(".search").find("input").val(); 7538 $(".menu-and-search .search input").val(inputValue); 7539 $(".menu-row > .search form").submit(); 7540 }); 7541 7542 $(".btn.btn-add").on("click", function () { 7543 $.ajax({ 7544 type: "GET", 7545 url: arAsproOptions["SITE_DIR"] + "ajax/clearBasket.php", 7546 success: function (data) {}, 7547 }); 7548 }); 7549 7550 $(".sort_display a").on("click", function () { 7551 $(this).siblings().removeClass("current"); 7552 $(this).addClass("current"); 7553 }); 7554 7555 /*detail order show payments*/ 7556 $(".sale-order-detail-payment-options-methods-info-change-link").on("click", function () { 7557 $(this).closest(".sale-order-detail-payment-options-methods-info").addClass("opened").siblings().addClass("opened"); 7558 }); 7559 7560 /*expand/hide filter values*/ 7561 $(document).on("click", ".expand_block", function () { 7562 togglePropBlock($(this)); 7563 }); 7564 7565 /*touch event*/ 7566 document.addEventListener( 7567 "touchend", 7568 function (event) { 7569 if (!$(event.target).closest(".menu-item").length && !$(event.target).hasClass("menu-item")) { 7570 $(".menu-row .dropdown-menu").css({ display: "none", opacity: 0 }); 7571 $(".menu-item").removeClass("hover"); 7572 $(".bx-breadcrumb-item.drop").removeClass("hover"); 7573 } 7574 if (!$(event.target).closest(".menu.topest").length) { 7575 if (window.matchMedia("(max-width: 991px)").matches) { 7576 $(".menu.topest").css({ overflow: "hidden" }); 7577 } 7578 $(".menu.topest > li").removeClass("hover"); 7579 } 7580 if (!$(event.target).closest(".full.has-child").length) { 7581 $(".menu_top_block.catalog_block li").removeClass("hover"); 7582 } 7583 if (!$(event.target).closest(".basket_block").length) { 7584 $(".basket_block .link").removeClass("hover");
7585 $(".basket_block .basket_popup_wrapp").slideUp(); 7586 } 7587 if (!$(event.target).closest(".catalog_item").length) { 7588 var tabsContentUnhoverHover = $(".tab:visible").attr("data-unhover") * 1; 7589 $(".tab:visible").stop().animate({ height: tabsContentUnhoverHover }, 100); 7590 $(".tab:visible").find(".catalog_item").removeClass("hover"); 7591 $(".tab:visible").find(".catalog_item .buttons_block").stop().fadeOut(233); 7592 if ($(".catalog_block").length) { 7593 $(".catalog_block").find(".catalog_item_wrapp").removeClass("hover"); 7594 $(".catalog_block").find(".catalog_item").removeClass("hover"); 7595 } 7596 } 7597 //togglePropBlock($(event.target)); 7598 }, 7599 false 7600 ); 7601 7602 touchMenu(".menu-row .menu-item"); 7603 touchTopMenu(".menu.topest li"); 7604 touchLeftMenu(".menu_top_block:not(.in-search) li.full"); 7605 touchBreadcrumbs(".bx-breadcrumb-item.drop"); 7606 7607 $(document).on("keyup", ".coupon .input_coupon input", function () { 7608 if ($(this).val().length) { 7609 $(this).removeClass("error"); 7610 $(this).closest(".input_coupon").find(".error").remove(); 7611 } else { 7612 $(this).addClass("error"); 7613 $("<label class='error'>" + BX.message("INPUT_COUPON") + "</label>").insertBefore($(this)); 7614 } 7615 }); 7616 // showPhoneMask("input[autocomplete=tel]"); 7617 BX.addCustomEvent(window, "onAjaxSuccessFilter", function (e) { 7618 setBasketStatusBtn(); 7619 checkLinkedArticles(); 7620 checkLinkedBlocks(".linked-banners-list"); 7621 }); 7622 7623 $(document).on("click", ".block_container .items .item.initied", function () { 7624 var _this = $(this), 7625 itemID = _this.data("id"), 7626 animationTime = 200; 7627 7628 _this.closest(".items").fadeOut(animationTime, function () { 7629 _this.closest(".block_container").find(".detail_items").fadeIn(animationTime); 7630 _this 7631 .closest(".block_container") 7632 .find(".detail_items .item[data-id=" + itemID + "]") 7633 .fadeIn(animationTime); 7634 7635 var arCoordinates = _this.data("coordinates").split(","); 7636 7637 if (typeof map !== "undefined") map.setCenter([arCoordinates[0], arCoordinates[1]], 15); 7638 }); 7639 }); 7640 7641 $(document).on("click", ".block_container .top-close", function () { 7642 var _this = $(this).closest(".block_container").find(".detail_items .item:visible"), 7643 animationTime = 200; 7644 _this.fadeOut(animationTime); 7645 _this 7646 .closest(".block_container") 7647 .find(".detail_items") 7648 .fadeOut(animationTime, function () { 7649 _this.closest(".block_container").find(".items").fadeIn(animationTime); 7650 7651 if (typeof map !== "undefined" && typeof clusterer !== "undefined") { 7652 map.setBounds(clusterer.getBounds(), { 7653 zoomMargin: 40, 7654 // checkZoomRange: true 7655 }); 7656 } 7657 }); 7658 }); 7659 7660 BX.addCustomEvent(window, "onAjaxSuccess", function (e) { 7661 if (e != "OK") { 7662 initSelects(document); 7663 InitOrderCustom(); 7664 // showPhoneMask("input[autocomplete=tel]"); 7665 7666 if (arAsproOptions["PAGES"]["CATALOG_PAGE"] && $(".catalog_detail").length && !$(".fast_view_frame").length) { 7667 const leftBlock = $(".main-catalog-wrapper > .left_block"); 7668 const rightBlock = $(".right_block"); 7669 7670 if (!leftBlock.length && rightBlock.hasClass("wide_N")) { 7671 rightBlock.removeClass("wide_N").addClass("wide_Y"); 7672 } else if (leftBlock.length && rightBlock.hasClass("wide_Y")) { 7673 rightBlock.removeClass("wide_Y").addClass("wide_N"); 7674 } 7675 7676 $(".bx_filter").remove(); 7677 InitOwlSlider(); 7678 } 7679 7680 if (arAsproOptions["PAGES"]["CATALOG_PAGE"]) { 7681 // initCountdown(); 7682 7683 if (typeof window["stickySidebar"] !== "undefined") window["stickySidebar"].updateSticky(); 7684 } 7685 7686 if (typeof orderActions === "function") { 7687 orderActions(e); 7688 } 7689 7690 if (e && typeof e === "object" && "action" in e && e.action === "ajaxContentLoadedTab") { 7691 lazyLoadPagenBlock(); 7692 } 7693 7694 InitStickySideBar(); 7695 } 7696 }); 7697 7698 //event for default basket quantity change 7699 BX.addCustomEvent(window, "OnBasketChange", function (e) { 7700 if (arAsproOptions["PAGES"]["BASKET_PAGE"]) { 7701 var summ = 0, 7702 title = ""; 7703 7704 if (typeof BX.Sale !== "undefined") { 7705 if (typeof BX.Sale.BasketComponent !== "undefined") { 7706 summ = BX.Sale.BasketComponent.result.allSum; 7707 title = BX.message("JS_BASKET_COUNT_TITLE").replace("SUMM", summ); 7708 } 7709 } else { 7710 summ = $("#allSum_FORMATED") 7711 .html() 7712 .replace(/ /g, " "); 7713 title = BX.message("JS_BASKET_COUNT_TITLE").replace("SUMM", summ); 7714 } 7715 7716 if ($(".js-basket-block .wrap .prices").length) $(".js-basket-block .wrap .prices").html(summ); 7717 if ($("a.basket-link.basket").length) $("a.basket-link.basket").attr("title", title); 7718 if ($(".basket_fly .opener .basket_count").length) $(".basket_fly .opener .basket_count").attr("title", title); 7719 } 7720 }); 7721}); 7722 7723if (!funcDefined("setBasketStatusBtn")) { 7724 setBasketStatusBtn = function (type) { 7725 var bSync = typeof type !== undefined; 7726 if (typeof arBasketAspro !== "undefined") { 7727 if ("BASKET" in arBasketAspro) { 7728 // basket items 7729 if (arBasketAspro.BASKET) { 7730 for (var i in arBasketAspro.BASKET) { 7731 $(".to-cart[data-item=" + i + "]").hide(); 7732 $(".counter_block[data-item=" + i + "]") 7733 .closest(".counter_block_inner") 7734 .hide(); 7735 $(".counter_block[data-item=" + i + "]").hide(); 7736 $(".in-cart[data-item=" + i + "]").show(); 7737 $(".in-cart[data-item=" + i + "]") 7738 .closest(".button_block") 7739 .addClass("wide"); 7740 7741 if ($(".banner_buttons.with_actions .wraps_buttons[data-id=" + i + "] .basket_item_add").length) { 7742 $(".banner_buttons.with_actions .wraps_buttons[data-id=" + i + "] .basket_item_add").addClass("added"); 7743 $(".banner_buttons.with_actions .wraps_buttons[data-id=" + i + "] .basket_item_add").attr( 7744 "title", 7745 $(".banner_buttons.with_actions .wraps_buttons[data-id=" + i + "] .basket_item_add").data("title2") 7746 ); 7747 } 7748 } 7749 } 7750 } 7751 7752 /*services*/ 7753 if ("SERVICES" in arBasketAspro) { 7754 // services items 7755 $needFillServices = $(".buy_services_wrap[data-parent_product]").length; 7756 if (arBasketAspro.SERVICES && $needFillServices) { 7757 for (var i in arBasketAspro.SERVICES) { 7758 var serviceItem = $( 7759 ".buy_services_wrap[data-parent_product=" + 7760 arBasketAspro.SERVICES[i].link_id + 7761 "] .services-item[data-item_id=" + 7762 arBasketAspro.SERVICES[i].item_id + 7763 "]" 7764 ); 7765 serviceItem.find('input[name="buy_switch_services"]').prop("checked", true); 7766 serviceItem.find('.counter_block input[name="quantity"]').val(arBasketAspro.SERVICES[i].quantity); 7767 serviceItem.addClass("services_on"); 7768 } 7769 } 7770 } 7771 /**/ 7772 7773 if ("SUBSCRIBE" in arBasketAspro) { 7774 // subscribe items 7775 if (arBasketAspro.SUBSCRIBE) { 7776 for (var i in arBasketAspro.SUBSCRIBE) { 7777 $(".to-subscribe[data-item=" + i + "]").hide(); 7778 $(".in-subscribe[data-item=" + i + "]").show(); 7779 } 7780 } 7781 } 7782 7783 if ("COMPARE" in arBasketAspro) { 7784 // compare items 7785 if (arBasketAspro.COMPARE) { 7786 for (var i in arBasketAspro.COMPARE) { 7787 $(".compare_item.to[data-item=" + i + "]").hide(); 7788 $(".compare_item.in[data-item=" + i + "]").show(); 7789 if ($(".compare_item[data-item=" + i + "]").find(".value.added").length) { 7790 //$('.compare_item[data-item='+i+']').addClass("added"); 7791 $(".compare_item[data-item=" + i + "]") 7792 .find(".value") 7793 .hide(); 7794 $(".compare_item[data-item=" + i + "]") 7795 .find(".value.added") 7796 .css("display", "block"); 7797 } 7798 7799 if ($(".banner_buttons.with_actions .wraps_buttons[data-id=" + i + "] .compare_item_add").length) { 7800 $(".banner_buttons.with_actions .wraps_buttons[data-id=" + i + "] .compare_item_add").addClass("added"); 7801 $(".banner_buttons.with_actions .wraps_buttons[data-id=" + i + "] .compare_item_add").attr( 7802 "title", 7803 $(".banner_buttons.with_actions .wraps_buttons[data-id=" + i + "] .compare_item_add").data("title2") 7804 ); 7805 } 7806 } 7807 } 7808 } 7809 } 7810 7811 BX.onCustomEvent("onSetBasketStatusBtn", []); 7812 }; 7813} 7814 7815if (!funcDefined("togglePropBlock")) { 7816 togglePropBlock = function (className) { 7817 var all_props_block = className.closest(".bx_filter_parameters_box_container").find(".hidden_values"); 7818 if (all_props_block.length && (className.hasClass("inner_text") || className.hasClass("expand_block"))) { 7819 if (all_props_block.is(":visible")) { 7820 className.text(BX.message("FILTER_EXPAND_VALUES")); 7821 all_props_block.hide(); 7822 } else { 7823 className.text(BX.message("FILTER_HIDE_VALUES")); 7824 all_props_block.show(); 7825 } 7826 } 7827 }; 7828} 7829 7830if (!funcDefined("showPhoneMask")) { 7831 showPhoneMask = function (className) { 7832 console.log('showPhoneMask'); 7833 if (typeof appAspro === "object" && appAspro && appAspro.phone) { 7834 appAspro.phone.init($(className)); 7835 } 7836 // $(className).inputmask("mask", { mask: arAsproOptions["THEME"]["PHONE_MASK"], showMaskOnHover: false }); 7837 }; 7838} 7839 7840if (!funcDefined("getActualBasket")) { 7841 getActualBasket = function (iblockID, type, sync) { 7842 var data = ""; 7843 if (typeof iblockID !== "undefined" && iblockID) { 7844 data = { iblockID: iblockID }; 7845 } 7846 $.ajax({ 7847 type: "GET", 7848 url: arAsproOptions["SITE_DIR"] + "ajax/actualBasket.php", 7849 data: data, 7850 success: function (data) { 7851 if (!$(".js_ajax").length) $("body").append('<div class="js_ajax"></div>'); 7852 $(".js_ajax").html(data); 7853 7854 if (typeof sync !== "undefined") { 7855 setBasketStatusBtn(true); 7856 } 7857 7858 if (typeof type !== undefined) { 7859 var eventdata = { action: "loadActualBasket" + type }; 7860 BX.onCustomEvent("onCompleteAction", [eventdata]); 7861 } 7862 }, 7863 }); 7864 }; 7865} 7866 7867if (!funcDefined("reloadBasketCounters")) { 7868 reloadBasketCounters = function (count, sync) { 7869 var data = ""; 7870 if (count) { 7871 $(".basket-link.basket .count, .wraps_icon_block.basket .count .items > span").text(count); 7872 } else { 7873 $.ajax({ 7874 type: "GET", 7875 url: arAsproOptions["SITE_DIR"] + "ajax/actualBasket.php", 7876 data: data, 7877 success: function (data) { 7878 if (!$(".js_ajax").length) $("body").append('<div class="js_ajax"></div>'); 7879 $(".js_ajax").html(data); 7880 var countServices = 7881 typeof arBasketAspro.SERVICES !== "undefined" ? Object.keys(arBasketAspro.SERVICES).length : 0; 7882 $(".basket-link.basket .count, .wraps_icon_block.basket .count .items > span").text( 7883 Object.keys(arBasketAspro.BASKET).length + countServices 7884 ); 7885 $(".basket-link.delay .count, .wraps_icon_block.delay .count .items > span").text( 7886 arBasketAspro.FAVORITE.COUNT 7887 ); 7888 $(".basket-link.compare .count, .wraps_icon_block.compare .count .items > span").text( 7889 Object.keys(arBasketAspro.COMPARE).length 7890 ); 7891 7892 if (typeof sync !== "undefined") { 7893 setBasketStatusBtn(true); 7894 } 7895 }, 7896 }); 7897 } 7898 }; 7899} 7900 7901function touchMenu(selector) { 7902 if (isMobile) { 7903 if ($(selector).length) { 7904 $(selector).each(function () { 7905 var th = $(this); 7906 th.on("touchend", function (e) { 7907 var _th = $(e.target).closest(".menu-item"); 7908 7909 $(".menu.topest > li").removeClass("hover"); 7910 $(".menu_top_block.catalog_block li").removeClass("hover"); 7911 $(".bx-breadcrumb-item.drop").removeClass("hover"); 7912 7913 if (_th.find(".dropdown-menu").length && !_th.hasClass("hover")) { 7914 e.preventDefault(); 7915 e.stopPropagation(); 7916 _th.siblings().removeClass("hover"); 7917 _th.addClass("hover"); 7918 $(".menu-row .dropdown-menu").css({ display: "none", opacity: 0 }); 7919 if (_th.hasClass("menu-item")) { 7920 _th.closest(".dropdown-menu").css({ display: "block", opacity: 1 }); 7921 } 7922 if (_th.find("> .wrap > .dropdown-menu")) { 7923 _th.find("> .wrap > .dropdown-menu").css({ display: "block", opacity: 1 }); 7924 } else if (_th.find("> .dropdown-menu")) { 7925 _th.find("> .dropdown-menu").css({ display: "block", opacity: 1 }); 7926 } 7927 CheckTopVisibleMenu(); 7928 } else { 7929 var href = $(e.target).attr("href") ? $(e.target).attr("href") : $(e.target).closest("a").attr("href"); 7930 if (href && href !== "undefined") location.href = href; 7931 } 7932 }); 7933 }); 7934 } 7935 } else { 7936 $(selector).off(); 7937 } 7938} 7939 7940function touchTopMenu(selector) { 7941 if (isMobile) { 7942 if ($(selector).length) { 7943 $(selector).each(function () { 7944 var th = $(this); 7945 th.on("touchend", function (e) { 7946 var _th = $(e.target).closest("li"); 7947 7948 $(".menu-item").removeClass("hover"); 7949 $(".menu_top_block.catalog_block li").removeClass("hover"); 7950 $(".bx-breadcrumb-item.drop").removeClass("hover"); 7951 7952 if (_th.hasClass("more") && !_th.hasClass("hover")) { 7953 e.preventDefault(); 7954 e.stopPropagation(); 7955 _th.siblings().removeClass("hover"); 7956 _th.addClass("hover"); 7957 $(".menu.topest").css({ overflow: "visible" }); 7958 } else { 7959 var href = $(e.target).attr("href") ? $(e.target).attr("href") : $(e.target).closest("a").attr("href"); 7960 if (href && href !== "undefined") location.href = href; 7961 } 7962 }); 7963 }); 7964 } 7965 } else { 7966 $(selector).off(); 7967 } 7968} 7969 7970function touchLeftMenu(selector) { 7971 if (isMobile) { 7972 if ($(selector).length) { 7973 $(selector).each(function () { 7974 var th = $(this); 7975 th.on("touchend", function (e) { 7976 var _th = $(e.target).closest("li"); 7977 7978 $(".menu-item").removeClass("hover"); 7979 $(".bx-breadcrumb-item.drop").removeClass("hover"); 7980 $(".menu.topest > li").removeClass("hover"); 7981 7982 if (_th.hasClass("has-child") && !_th.hasClass("hover")) { 7983 e.preventDefault(); 7984 e.stopPropagation(); 7985 _th.siblings().removeClass("hover"); 7986 _th.addClass("hover"); 7987 } else { 7988 var href = $(e.target).attr("href") ? $(e.target).attr("href") : $(e.target).closest("a").attr("href"); 7989 if (href && href !== "undefined") location.href = href; 7990 } 7991 }); 7992 }); 7993 } 7994 } else { 7995 $(selector).off(); 7996 } 7997} 7998 7999function touchBreadcrumbs(selector) { 8000 if (isMobile) { 8001 if ($(selector).length) { 8002 $(selector).each(function () { 8003 var th = $(this); 8004 th.on("touchend", function (e) { 8005 var _th = $(e.target).closest(".bx-breadcrumb-item"); 8006 8007 $(".menu-item").removeClass("hover"); 8008 $(".menu.topest > li").removeClass("hover"); 8009 $(".menu_top_block.catalog_block li").removeClass("hover"); 8010 8011 if (!_th.hasClass("hover")) { 8012 e.preventDefault(); 8013 e.stopPropagation(); 8014 _th.siblings().removeClass("hover"); 8015 _th.addClass("hover"); 8016 } else { 8017 _th.removeClass("hover"); 8018 var href = $(e.target).attr("href") ? $(e.target).attr("href") : $(e.target).closest("a").attr("href"); 8019 if (href && href !== "undefined") location.href = href; 8020 } 8021 }); 8022 }); 8023 } 8024 } else { 8025 $(selector).off(); 8026 } 8027} 8028 8029function touchItemBlock(selector) {} 8030function touchBasket(selector) { 8031 if (arAsproOptions["THEME"]["SHOW_BASKET_ONADDTOCART"] !== "N") { 8032 if ($(window).outerWidth() > 600) { 8033 $(document) 8034 .find(selector) 8035 .on("touchend", function (e) { 8036 if ($(this).parent().find(".basket_popup_wrapp").length && !$(this).hasClass("hover")) { 8037 e.preventDefault(); 8038 e.stopPropagation(); 8039 $(thi
8039s).addClass("hover"); 8040 $(this).parent().find(".basket_popup_wrapp").slideDown(); 8041 } 8042 }); 8043 } else { 8044 $(selector).off(); 8045 } 8046 } 8047} 8048 8049function showTotalSummItem(popup) { 8050 //show total summ 8051 if ( 8052 arAsproOptions["THEME"]["SHOW_TOTAL_SUMM_TYPE"] == "ALWAYS" && 8053 arAsproOptions["THEME"]["SHOW_TOTAL_SUMM"] == "Y" 8054 ) { 8055 var parent = "body "; 8056 if (typeof popup === "string" && popup == "Y") parent = ".popup "; 8057 $(parent + ".counter_wrapp .counter_block input.text").each(function () { 8058 var _th = $(this); 8059 if (_th.data("product")) { 8060 var obProduct = _th.data("product"); 8061 if (typeof window[obProduct] == "object") window[obProduct].setPriceAction("Y"); 8062 else setPriceItem(_th.closest(".main_item_wrapper"), _th.val()); 8063 } else setPriceItem(_th.closest(".main_item_wrapper"), _th.val()); 8064 }); 8065 } 8066} 8067 8068function initFull() { 8069 initSelects(document); 8070 initHoverBlock(document); 8071 touchItemBlock(".catalog_item a"); 8072 InitOrderCustom(); 8073 showTotalSummItem(); 8074 basketActions(); 8075 8076 if (typeof orderActions === "function") { 8077 orderActions(); 8078 } 8079 8080 checkMobileRegion(); 8081} 8082 8083checkMobileRegion = function () { 8084 if ($(".confirm_region").length) { 8085 if (!$(".top_mobile_region").length) 8086 $( 8087 '<div class="top_mobile_region"><div class="confirm_wrapper"><div class="confirm_region"></div></div></div>' 8088 ).insertBefore($("#mobileheader")); 8089 $(".top_mobile_region .confirm_region").html($(".confirm_region").html()); 8090 } 8091}; 8092 8093if (!funcDefined("basketActions")) { 8094 basketActions = function () { 8095 if (arAsproOptions["PAGES"]["BASKET_PAGE"]) { 8096 checkMinPrice(); 8097 8098 //remove4Cart 8099 if (typeof BX.Sale !== "undefined" && typeof BX.Sale === "object") { 8100 if (typeof BX.Sale.BasketComponent !== "undefined" && typeof BX.Sale.BasketComponent === "object") { 8101 $(document).on("click", ".basket-item-actions-remove", function () { 8102 var basketID = $(this).closest(".basket-items-list-item-container").data("id"); 8103 if (BX.Sale.BasketComponent.items && BX.Sale.BasketComponent.items[basketID]) { 8104 delFromBasketCounter(BX.Sale.BasketComponent.items[basketID].PRODUCT_ID); 8105 } 8106 }); 8107 } 8108 } 8109 8110 if (location.hash) { 8111 var hash = location.hash.substring(1); 8112 if ($("#basket_toolbar_button_" + hash).length) $("#basket_toolbar_button_" + hash).trigger("click"); 8113 8114 if ($('.basket-items-list-header-filter a[data-filter="' + hash + '"]').length) 8115 $('.basket-items-list-header-filter a[data-filter="' + hash + '"]')[0].click(); 8116 } 8117 var svg_cross = 8118 '<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><path id="Rounded_Rectangle_568_copy_13" data-name="Rounded Rectangle 568 copy 13" class="cls-1" d="M1615.4,589l2.32,2.315a0.987,0.987,0,0,1,0,1.4,1,1,0,0,1-1.41,0L1614,590.4l-2.31,2.315a1,1,0,0,1-1.41,0,0.987,0.987,0,0,1,0-1.4L1612.6,589l-2.32-2.314a0.989,0.989,0,0,1,0-1.4,1,1,0,0,1,1.41,0l2.31,2.315,2.31-2.315a1,1,0,0,1,1.41,0,0.989,0.989,0,0,1,0,1.4Z" transform="translate(-1610 -585)"/></svg>'; 8119 8120 $(".bx_sort_container").append( 8121 '<div class="top_control basket_action"><span style="opacity:0;" class="delete_all colored_theme_hover_text remove_all_basket">' + 8122 svg_cross + 8123 BX.message("BASKET_CLEAR_ALL_BUTTON") + 8124 "</span></div>" 8125 ); 8126 if ($(".basket-items-list-header-filter").length) { 8127 $(".basket-items-list-header-filter").append( 8128 '<div class="top_control basket_action"><span style="opacity:1;" class="delete_all colored_theme_hover_text remove_all_basket">' + 8129 svg_cross + 8130 BX.message("BASKET_CLEAR_ALL_BUTTON") + 8131 "</span></div>" 8132 ); 8133 8134 var cur_index = $(".basket-items-list-header-filter > a.active").index(); 8135 //fix delayed 8136 if (cur_index == 3) cur_index = 2; 8137 8138 if ($(".basket-items-list-header-filter > a.active").data("filter") == "all") cur_index = "all"; 8139 8140 $(".basket-items-list-header-filter .top_control .delete_all").data("type", cur_index); 8141 8142 $(".basket-items-list-header-filter > a").on("click", function () { 8143 var index = $(this).index(); 8144 8145 //fix delayed 8146 if (index == 3) index = 2; 8147 8148 if ($(this).data("filter") == "all") index = "all"; 8149 8150 $(".basket-items-list-header-filter .top_control .delete_all").data("type", index); 8151 }); 8152 } else { 8153 var cur_index = $(".bx_sort_container a.current").index(); 8154 $(".bx_sort_container .top_control .delete_all").data("type", cur_index); 8155 if ($(".bx_ordercart > div:eq(" + cur_index + ") table tbody tr td.item").length) 8156 $(".bx_sort_container .top_control .delete_all").css("opacity", 1); 8157 8158 $(".bx_ordercart .bx_ordercart_coupon #coupon").wrap('<div class="input"></div>'); 8159 8160 $(".bx_sort_container > a").on("click", function () { 8161 var index = $(this).index(); 8162 $(".bx_sort_container .top_control .delete_all").data("type", index); 8163 8164 if ($(".bx_ordercart > div:eq(" + index + ") table tbody tr td.item").length) 8165 $(".bx_sort_container .top_control .delete_all").css("opacity", 1); 8166 else $(".bx_sort_container .top_control .delete_all").css("opacity", 0); 8167 }); 8168 } 8169 8170 $(".basket_print").on("click", function () { 8171 // window.open(location.pathname+"?print=Y",'_blank'); 8172 window.print(); 8173 }); 8174 8175 $(".delete_all").on("click", function () { 8176 if (arAsproOptions["COUNTERS"]["USE_BASKET_GOALS"] !== "N") { 8177 var eventdata = { goal: "goal_basket_clear", params: { type: $(this).data("type") } }; 8178 BX.onCustomEvent("onCounterGoals", [eventdata]); 8179 } 8180 $.post( 8181 arAsproOptions["SITE_DIR"] + "ajax/action_basket.php", 8182 "TYPE=" + $(this).data("type") + "&CLEAR_ALL=Y", 8183 $.proxy(function (data) { 8184 location.reload(); 8185 }) 8186 ); 8187 }); 8188 8189 $(".bx_item_list_section .bx_catalog_item").sliceHeight({ row: ".bx_item_list_slide", item: ".bx_catalog_item" }); 8190 8191 BX.addCustomEvent("onAjaxSuccess", function (e) { 8192 checkMinPrice(); 8193 8194 var errorText = $.trim($("#warning_message").text()); 8195 $("#basket_items_list .error_text").detach(); 8196 if (errorText != "") { 8197 $("#warning_message").hide().text(""); 8198 $("#basket_items_list").prepend('<div class="error_text">' + errorText + "</div>"); 8199 } 8200 8201 if (typeof e === "object" && e && "BASKET_DATA" in e) { 8202 if ($("#ajax_basket").length) { 8203 reloadTopBasket("add", $("#ajax_basket"), 200, 5000, "Y"); 8204 } 8205 if ($("#basket_line .basket_fly").length) { 8206 basketFly("open", "N"); 8207 } 8208 } 8209 if (checkCounters("google")) { 8210 BX.unbindAll( 8211 BX.Sale.BasketComponent.getEntity( 8212 BX.Sale.BasketComponent.getCacheNode(BX.Sale.BasketComponent.ids.basketRoot), 8213 "basket-checkout-button" 8214 ) 8215 ); 8216 } 8217 }); 8218 if (checkCounters("google")) { 8219 BX.unbindAll( 8220 BX.Sale.BasketComponent.getEntity( 8221 BX.Sale.BasketComponent.getCacheNode(BX.Sale.BasketComponent.ids.basketRoot), 8222 "basket-checkout-button" 8223 ) 8224 ); 8225 } 8226 $(document).on( 8227 "click", 8228 ".bx_ordercart_order_pay_center .checkout, .basket-checkout-section-inner .basket-btn-checkout", 8229 function () { 8230 if (checkCounters("google")) { 8231 const gotoOrder = function () { 8232 BX.Sale.BasketComponent.checkOutAction(); 8233 }; 8234 checkoutCounter(1, "start order", gotoOrder); 8235 } 8236 } 8237 ); 8238 } 8239 }; 8240} 8241 8242if (!funcDefined("checkMinPrice")) { 8243 checkMinPrice = function () { 8244 if (arAsproOptions["PAGES"]["BASKET_PAGE"]) { 8245 var summ_raw = 0, 8246 summ = 0; 8247 if ($("#allSum_FORMATED").length) { 8248 summ_raw = $("#allSum_FORMATED") 8249 .text() 8250 .replace(/[^0-9\.,]/g, ""); 8251 summ = parseFloat(summ_raw); 8252 if ($("#basket_items").length) { 8253 var summ = 0; 8254 $("#basket_items tr").each(function () { 8255 if (typeof $(this).data("item-price") !== "undefined" && $(this).data("item-price")) 8256 summ += 8257 $(this).data("item-price") * 8258 $(this) 8259 .find("#QUANTITY_INPUT_" + $(this).attr("id")) 8260 .val(); 8261 }); 8262 } 8263 if (!$(".catalog_back").length) 8264 $(".bx_ordercart_order_pay_center").prepend( 8265 '<a href="' + 8266 arAsproOptions["PAGES"]["CATALOG_PAGE_URL"] + 8267 '" class="catalog_back btn btn-default btn-lg white grey">' + 8268 BX.message("BASKET_CONTINUE_BUTTON") + 8269 "</a>" 8270 ); 8271 } 8272 8273 if (arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y") 8274 $(".basket-coupon-section").addClass("smallest"); 8275 8276 if (typeof BX.Sale !== "undefined") { 8277 if (typeof BX.Sale.BasketComponent !== "undefined" && typeof BX.Sale.BasketComponent.result !== "undefined") 8278 summ = BX.Sale.BasketComponent.result.allSum; 8279 } 8280 8281 if (arAsproOptions["PRICES"]["MIN_PRICE"]) { 8282 if (arAsproOptions["PRICES"]["MIN_PRICE"] > summ) { 8283 var svgMinPrice = 8284 '<i class="svg svg-inline-price colored_theme_svg" aria-hidden="true"><svg id="Group_278_copy" data-name="Group 278 copy" xmlns="http://www.w3.org/2000/svg" width="38" height="38" viewBox="0 0 38 38"><path id="Ellipse_305_copy_2" data-name="Ellipse 305 copy 2" class="clswm-1" d="M1851,561a19,19,0,1,1,19-19A19,19,0,0,1,1851,561Zm0-36a17,17,0,1,0,17,17A17,17,0,0,0,1851,525Zm3.97,10.375-0.03.266c-0.01.062-.02,0.127-0.03,0.188l-0.94,7.515h0a2.988,2.988,0,0,1-5.94,0H1848l-0.91-7.525c-0.01-.041-0.01-0.086-0.02-0.128l-0.04-.316h0.01c-0.01-.
8284125-0.04-0.246-0.04-0.375a4,4,0,0,1,8,0c0,0.129-.03.25-0.04,0.375h0.01ZM1851,533a2,2,0,0,0-2,2,1.723,1.723,0,0,0,.06.456L1850,543a1,1,0,0,0,2,0l0.94-7.544A1.723,1.723,0,0,0,1853,535,2,2,0,0,0,1851,533Zm0,14a3,3,0,1,1-3,3A3,3,0,0,1,1851,547Zm0,4a1,1,0,1,0-1-1A1,1,0,0,0,1851,551Z" transform="translate(-1832 -523)"></path> <path class="clswm-2 op-cls" d="M1853,543l-1,1h-2l-1-1-1-8,1-2,1-1h2l1,1,1,2Zm-1,5,1,1v2l-1,1h-2l-1-1v-2l1-1h2Z" transform="translate(-1832 -523)"></path></svg></i>'; 8285 if ($(".oneclickbuy.fast_order").length) $(".oneclickbuy.fast_order").remove(); 8286 8287 if ($(".basket-checkout-container").length) { 8288 if (!$(".icon_error_wrapper").length) { 8289 $(".basket-checkout-block.basket-checkout-block-btn").html( 8290 '<div class="icon_error_wrapper"><div class="icon_error_block">' + 8291 svgMinPrice + 8292 BX.message("MIN_ORDER_PRICE_TEXT").replace( 8293 "#PRICE#", 8294 jsPriceFormat(arAsproOptions["PRICES"]["MIN_PRICE"]) 8295 ) + 8296 "</div></div>" 8297 ); 8298 } 8299 } else { 8300 if (!$(".icon_error_wrapper").length && typeof jsPriceFormat !== "undefined") { 8301 $(".bx_ordercart_order_pay_center").prepend( 8302 '<div class="icon_error_wrapper"><div class="icon_error_block">' + 8303 svgMinPrice + 8304 BX.message("MIN_ORDER_PRICE_TEXT").replace( 8305 "#PRICE#", 8306 jsPriceFormat(arAsproOptions["PRICES"]["MIN_PRICE"]) 8307 ) + 8308 "</div></div>" 8309 ); 8310 } 8311 if ($(".bx_ordercart_order_pay .checkout").length) $(".bx_ordercart_order_pay .checkout").remove(); 8312 } 8313 } else { 8314 if ($(".icon_error_wrapper").length) $(".icon_error_wrapper").remove(); 8315 8316 if ($(".basket-checkout-container").length) { 8317 if ( 8318 !$(".oneclickbuy.fast_order").length && 8319 arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y" && 8320 !$(".basket-btn-checkout.disabled").length 8321 ) 8322 $(".basket-checkout-section-inner").append( 8323 '<div class="fastorder"><span class="oneclickbuy btn btn-lg fast_order btn-transparent-border-color" onclick="oneClickBuyBasket()">' + 8324 BX.message("BASKET_QUICK_ORDER_BUTTON") + 8325 "</span></div>" 8326 ); 8327 } else { 8328 if ($(".bx_ordercart_order_pay .checkout").length) 8329 $(".bx_ordercart .bx_ordercart_order_pay .checkout").css("opacity", "1"); 8330 else 8331 $(".bx_ordercart_order_pay_center").append( 8332 '<a href="javascript:void(0)" onclick="checkOut();" class="checkout" style="opacity: 1;">' + 8333 BX.message("BASKET_ORDER_BUTTON") + 8334 "</a>" 8335 ); 8336 if ( 8337 !$(".oneclickbuy.fast_order").length && 8338 arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y" 8339 ) 8340 $(".bx_ordercart_order_pay_center").append( 8341 '<span class="oneclickbuy btn btn-lg fast_order btn-transparent-border-color" onclick="oneClickBuyBasket()">' + 8342 BX.message("BASKET_QUICK_ORDER_BUTTON") + 8343 "</span>" 8344 ); 8345 } 8346 } 8347 } else { 8348 if ($(".basket-checkout-container").length) { 8349 if ( 8350 !$(".oneclickbuy.fast_order").length && 8351 arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y" && 8352 !$(".basket-btn-checkout.disabled").length 8353 ) 8354 $(".basket-checkout-section-inner").append( 8355 '<div class="fastorder"><span class="oneclickbuy btn btn-lg fast_order btn-transparent-border-color" onclick="oneClickBuyBasket()">' + 8356 BX.message("BASKET_QUICK_ORDER_BUTTON") + 8357 "</span></div>" 8358 ); 8359 } else { 8360 $(".bx_ordercart .bx_ordercart_order_pay .checkout").css("opacity", "1"); 8361 if (!$(".oneclickbuy.fast_order").length && arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y") 8362 $(".bx_ordercart_order_pay_center").append( 8363 '<span class="oneclickbuy btn btn-lg fast_order btn-trans
8363parent-border-color" onclick="oneClickBuyBasket()">' + 8364 BX.message("BASKET_QUICK_ORDER_BUTTON") + 8365 "</span>" 8366 ); 8367 } 8368 } 8369 8370 showBasketShareBtn(); 8371 showBasketHeadingBtn(); 8372 8373 $("#basket-root .basket-checkout-container .basket-checkout-section .basket-checkout-block .basket-btn-checkout"); 8374 $("#basket-root .basket-checkout-container").addClass("visible"); 8375 } 8376 }; 8377} 8378 8379var isFrameDataReceived = false; 8380if (typeof window.frameCacheVars !== "undefined") { 8381 BX.addCustomEvent(window, "onFrameDataRequestFail", function (response) { 8382 console.log(response); 8383 }); 8384 8385 BX.addCustomEvent("onFrameDataReceivedBefore", function () { 8386 // stop ya metrika webvisor DOM indexer 8387 pauseYmObserver(); 8388 }); 8389 8390 BX.addCustomEvent("onFrameDataReceived", function (json) { 8391 initFull(); 8392 8393 CheckTopMenuDotted(); 8394 8395 checkLinkedArticles(); 8396 checkLinkedBlocks(".linked-banners-list"); 8397 8398 if ($(".logo-row.v2").length) { 8399 $(window).resize(); // need to check resize flexslider & menu 8400 setTimeout(function () { 8401 CheckTopMenuDotted(); 8402 }, 100); 8403 } 8404 8405 if (funcDefined("setNewHeader")) { 8406 if (typeof BX === "object" && (BX.message("TYPE_SKU") != "TYPE_1" || BX.message("HAS_SKU_PROPS") != "Y")) { 8407 setNewHeader(); 8408 } else { 8409 var objNameWrapper = $(".bx_catalog_item_scu[id]"); 8410 if (objNameWrapper.length) { 8411 var id = "ob" + objNameWrapper.attr("id").replace("_skudiv", ""); 8412 if (id && window[id] !== undefined) { 8413 var obj = window[id].offers[window[id].offerNum]; 8414 if (obj !== undefined) { 8415 setNewHeader(obj); 8416 } 8417 } 8418 } 8419 } 8420 } 8421 8422 // resume ya metrika webvisor 8423 // (100ms sliceHeight) + (200ms mCustomScroll) + (100ms lazyload) 8424 setTimeout(resumeYmObserver, 400); 8425 8426 isFrameDataReceived = true; 8427 }); 8428} else { 8429 $(document).ready(initFull); 8430} 8431 8432if (!funcDefined("setHeightBlockSlider")) { 8433 setHeightBlockSlider = function () { 8434 /*$(document).find(".specials.tab_slider_wrapp .tabs_content > li.cur").equalize({ children: ".item-title" }); 8435 $(document).find(".specials.tab_slider_wrapp .tabs_content > li.cur").equalize({ children: ".item_info" }); 8436 $(document).find(".specials.tab_slider_wrapp .tabs_content > li.cur").equalize({ children: ".catalog_item" }); 8437 8438 var sliderWidth = $(document).find(".specials.tab_slider_wrapp").outerWidth(); 8439 8440 var iCountTabs = $(document).find(".specials.tab_slider_wrapp .tabs_content > li.cur").length; 8441 8442 if (iCountTabs <= 1) { 8443 $(document).find(".specials.tab_slider_wrapp .tabs_content > li.cur").css("height", ""); 8444 8445 var itemsButtonsHeight = 0; 8446 if ($(document).find(".specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button").length) { 8447 $(document) 8448 .find(".specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button") 8449 .css("height", "auto"); 8450 itemsButtonsHeight = $(document) 8451 .find(".specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button") 8452 .height(); 8453 $(document) 8454 .find(".specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button") 8455 .css("height", ""); 8456 } 8457 var tabsContentUnhover = $(document).find(".specials.tab_slider_wrapp .tabs_content .tab.cur").height() * 1; 8458 var tabsContentHover = tabsContentUnhover + itemsButtonsHeight + 50; 8459 $(document).find(".specials.tab_slider_wrapp .tabs_content .tab.cur").attr("data-unhover", tabsContentUnhover); 8460 $(document).find(".specials.tab_slider_wrapp .tabs_content .tab.cur").attr("data-hover", tabsContentHover); 8461 $(document).find(".specials.tab_slider_wrapp .tabs_content").height(tabsContentUnhover); 8462 $(document).find(".specials.tab_slider_wrapp .tabs_content .tab.cur .flex-viewport").height(tabsContentUnhover); 8463 } else { 8464 $(document) 8465 .find(".specials.tab_slider_wrapp .tabs_content > li.cur") 8466 .each(function () { 8467 var _th = $(this); 8468 _th.css("height", ""); 8469 8470 var itemsButtonsHeight = 0; 8471 if (_th.find(".tabs_slider li .footer_button").length) { 8472 _th.find(".tabs_slider li .footer_button").css("height", "auto"); 8473 itemsButtonsHeight = _th.find(".tabs_slider li .footer_button").height(); 8474 _th.find(".tabs_slider li .footer_button").css("height", ""); 8475 } 8476 8477 var tabsContentUnhover = _th.height() * 1; 8478 var tabsContentHover = tabsContentUnhover + itemsButtonsHeight + 50; 8479 _th.attr("data-unhover", tabsContentUnhover); 8480 _th.attr("data-hover", tabsContentHover); 8481 _th.parent().height(tabsContentUnhover); 8482 _th.find(".flex-viewport").height(tabsContentUnhover); 8483 }); 8484 }*/ 8485 }; 8486} 8487 8488if (!funcDefined("checkTopFilter")) { 8489 checkTopFilter = function () {}; 8490} 8491 8492if (!funcDefined("checkStickyFooter")) { 8493 checkStickyFooter = function () {}; 8494} 8495 8496if (!funcDefined("checkLinkedArticles")) { 8497 checkLinkedArticles = function () { 8498 try { 8499 if ($(".linked-blog-list.content .item-views").length) { 8500 var mobileRow = $(".linked-blog-list").data("mobile_row"), 8501 desktopRow = $(".linked-blog-list").data("desktop_row"), 8502 parentBlock = $(".ajax_load .js_append"), 8503 widthRow = parentBlock.getFloatWidth(), 8504 elementWidthRow = parentBlock.find("> .item:eq(0)").getFloatWidth(), 8505 elementsCount = parentBlock.find("> .item").length, 8506 slice = Math.floor(widthRow / elementWidthRow), 8507 rowInsertCount = Math.floor(elementsCount / slice), 8508 bCalculateRows = false;
8509 if (window.matchMedia("(max-width: 767px)").matches) { 8510 if (!mobileRow && desktopRow) { 8511 mobileRow = desktopRow; 8512 } 8513 if (mobileRow && mobileRow <= rowInsertCount) { 8514 rowInsertCount = slice * mobileRow; 8515 bCalculateRows = true; 8516 } 8517 } else { 8518 if (desktopRow && desktopRow <= rowInsertCount) { 8519 rowInsertCount = slice * desktopRow; 8520 bCalculateRows = true; 8521 } 8522 } 8523 if (!bCalculateRows) { 8524 rowInsertCount = elementsCount; 8525 } 8526 8527 var linkedBlock = ".linked-blog-list"; 8528 var blockInItems = parentBlock.find(linkedBlock); 8529 if (blockInItems.length) { 8530 $(blockInItems).insertAfter(parentBlock.find("> .item:eq(" + (rowInsertCount - 1) + ")")); 8531 setTimeout(function () { 8532 $(blockInItems).addClass("visible"); 8533 }, 0); 8534 } else { 8535 var cloneBlock = $(linkedBlock).clone(); 8536 var owlBlock = cloneBlock.find(".owl-carousel-wait"); 8537 cloneBlock.insertAfter(parentBlock.find("> .item:eq(" + (rowInsertCount - 1) + ")")); 8538 owlBlock.removeClass("owl-carousel-wait").addClass("owl-carousel"); 8539 setTimeout(function () { 8540 cloneBlock.addClass("visible"); 8541 InitOwlSlider(); 8542 owlBlock.removeClass("loader_circle"); 8543 }, 1); 8544 } 8545 } 8546 } catch (e) { 8547 console.error(e); 8548 } 8549 }; 8550} 8551 8552if (!funcDefined("checkLinkedBlocks")) { 8553 checkLinkedBlocks = function (linkedBlock) { 8554 if (!linkedBlock) linkedBlock = ".linked-banners-list"; 8555 8556 try { 8557 if ($(linkedBlock + ".content" + " div").length) { 8558 var mobileRow = $(linkedBlock).data("mobile_row"), 8559 desktopRow = $(linkedBlock).data("desktop_row"), 8560 wrapperBlock = $(".ajax_load .js_wrapper_items"), 8561 parentBlock = $(".ajax_load .js_append"), 8562 widthRow = wrapperBlock.getFloatWidth(), 8563 elementWidthRow = parentBlock.find("> .item:eq(0)").getFloatWidth(), 8564 elementsCount = parentBlock.find("> .item").length, 8565 slice = Math.floor(widthRow / elementWidthRow), 8566 rowInsertCount = Math.floor(elementsCount / slice), 8567 bCalculateRows = false; 8568 if (window.matchMedia("(max-width: 767px)").matches) { 8569 if (!mobileRow && desktopRow) { 8570 mobileRow = desktopRow; 8571 } 8572 if (mobileRow && mobileRow <= rowInsertCount) { 8573 rowInsertCount = slice * mobileRow; 8574 bCalculateRows = true; 8575 } 8576 } else { 8577 if (desktopRow && desktopRow <= rowInsertCount) { 8578 rowInsertCount = slice * desktopRow; 8579 bCalculateRows = true; 8580 } 8581 } 8582 if (!bCalculateRows) { 8583 rowInsertCount = elementsCount; 8584 } 8585 var blockInItems = parentBlock.find(linkedBlock); 8586 if (blockInItems.length) { 8587 $(blockInItems).insertAfter(parentBlock.find("> .item:eq(" + (rowInsertCount - 1) + ")")); 8588 setTimeout(function () { 8589 $(blockInItems).addClass("visible"); 8590 }, 0); 8591 } else { 8592 var cloneBlock = $(linkedBlock).clone(); 8593 var owlBlock = cloneBlock.find(".owl-carousel-wait"); 8594 cloneBlock.insertAfter(parentBlock.find("> .item:eq(" + (rowInsertCount - 1) + ")")); 8595 owlBlock.removeClass("owl-carousel-wait").addClass("owl-carousel"); 8596 setTimeout(function () { 8597 cloneBlock.addClass("visible"); 8598 InitOwlSlider(); 8599 owlBlock.removeClass("loader_circle"); 8600 }, 1); 8601 } 8602 } 8603 } catch (e) { 8604 console.error(e); 8605 } 8606 }; 8607} 8608 8609/* EVENTS */ 8610var timerResize = false, 8611 ignoreResize = []; 8612$(window).resize(function () { 8613 checkLinkedArticles(); 8614 checkLinkedBlocks(".linked-banners-list"); 8615 8616 // here immediate functions 8617 if (!ignoreResize.length) { 8618 if (timerResize) { 8619 clearTimeout(timerResize); 8620 timerResize = false; 8621 } 8622 timerResize = setTimeout(function () { 8623 // here delayed functions in event 8624 BX.onCustomEvent("onWindowResize", false); 8625 }, 50); 8626 } 8627}); 8628 8629var timerScroll = false, 8630 ignoreScroll = [], 8631 documentScrollTopLast = window.pageYOffset, 8632 startScroll = 0; 8633$(window).scroll(function () { 8634 // here immediate functions 8635 documentScrollTopLast = window.pageYOffset; 8636 SetFixedAskBlock(); 8637 8638 if (!ignoreScroll.length) { 8639 if (timerScroll) { 8640 clearTimeout(timerScroll); 8641 timerScroll = false;
8642 } 8643 timerScroll = setTimeout(function () { 8644 // here delayed functions in event 8645 BX.onCustomEvent("onWindowScroll", false); 8646 }, 50); 8647 } 8648}); 8649 8650BX.addCustomEvent("onWindowResize", function (eventdata) { 8651 try { 8652 ignoreResize.push(true); 8653 8654 CheckTabActive(); 8655 CheckTopMenuFullCatalogSubmenu(); 8656 8657 if (window.matchMedia("(min-width:768px)").matches) { 8658 closeYandexMap(); 8659 } 8660 8661 if ($("nav.mega-menu.sliced").length) $("nav.mega-menu.sliced").removeClass("initied"); 8662 CheckTopMenuDotted(); 8663 8664 CheckTopVisibleMenu(); 8665 8666 checkScrollToTop(); 8667 CheckObjectsSizes(); 8668 8669 initSly(); 8670 8671 // checkVerticalMobileFilter(); 8672 if (typeof checkMobilePhone === "function") { 8673 checkMobilePhone(); 8674 } 8675 checkTopFilter(); 8676 if (typeof checkMobileFilter === "function") { 8677 checkMobileFilter(); 8678 } 8679 8680 if (typeof window["stickySidebar"] !== "undefined") { 8681 if (window.matchMedia("(max-width: 991px)").matches) { 8682 window["stickySidebar"].destroy(); 8683 } else { 8684 window["stickySidebar"].bindEvents(); 8685 } 8686 } 8687 8688 if ($(".flexslider.wsmooth").length) { 8689 $(".flexslider.wsmooth").each(function () { 8690 $(this).data("flexslider").smoothHeight(); 8691 }); 8692 } 8693 8694 if (window.matchMedia("(min-width: 767px)").matches) $(".wrapper_middle_menu.wrap_menu").removeClass("mobile"); 8695 8696 if (window.matchMedia("(max-width: 767px)").matches) $(".wrapper_middle_menu.wrap_menu").addClass("mobile"); 8697 8698 if ($("#basket_form").length && $(window).outerWidth() <= 600) { 8699 $("#basket_form .tabs_content.basket > li.cur td").each(function () { 8700 $(this).css("width", ""); 8701 }); 8702 } 8703 8704 $(".bx_filter_section .bx_filter_select_container").each(function () { 8705 var prop_id = $(this).closest(".bx_filter_parameters_box").attr("property_id"); 8706 if ($("#smartFilterDropDown" + prop_id).length) { 8707 $("#smartFilterDropDown" + prop_id).css("max-width", $(this).width()); 8708 } 8709 }); 8710 } catch (e) { 8711 console.log(e); 8712 } finally { 8713 ignoreResize.pop(); 8714 } 8715}); 8716 8717BX.addCustomEvent("onWindowScroll", function (eventdata) { 8718 try { 8719 ignoreScroll.push(true); 8720 } catch (e) { 8721 } finally { 8722 ignoreScroll.pop(); 8723 } 8724}); 8725 8726BX.addCustomEvent("onSlideInit", function (eventdata) { 8727 try { 8728 ignoreResize.push(true); 8729 if (eventdata) { 8730 var slider = eventdata.slider; 8731 if (slider) { 8732 if (slider.hasClass("small-gallery")) $(window).resize(); 8733 // add classes .curent & .shown to slide 8734 slider.find(".item").removeClass("current"); 8735 var curSlide = slider.find(".item.flex-active-slide"), 8736 curSlideId = curSlide.attr("id"), 8737 nav = slider.find(".flex-direction-nav"); 8738 8739 curSlide.addClass("current"); 8740 8741 slider.find(".visible").css("opacity", "1"); 8742 slider.find(".height0").css("height", "auto"); 8743 8744 if (curSlide.hasClass("shown")) { 8745 slider.find(".item.clone[id=" + curSlideId + "_clone]").addClass("shown"); 8746 } 8747 8748 curSlide.addClass("shown"); 8749 } 8750 } 8751 } catch (e) { 8752 } finally { 8753 ignoreResize.pop(); 8754 } 8755}); 8756 8757BX.addCustomEvent("onCounterGoals", function (eventdata) { 8758 if (arAsproOptions["THEME"]["YA_GOALS"] == "Y" && arAsproOptions["THEME"]["YA_COUNTER_ID"]) { 8759 var idCounter = arAsproOptions["THEME"]["YA_COUNTER_ID"]; 8760 idCounter = parseInt(idCounter); 8761 8762 if (typeof eventdata != "object") eventdata = { goal: "undefined" }; 8763 8764 if (typeof eventdata.goal != "string") eventdata.goal = "undefined"; 8765 8766 if (idCounter) { 8767 try { 8768 waitCounter(idCounter, 50, function () { 8769 var obCounter = window["yaCounter" + idCounter]; 8770 if (typeof obCounter == "object") { 8771 obCounter.reachGoal(eventdata.goal); 8772 } 8773 }); 8774 } catch (e) { 8775 console.error(e); 8776 } 8777 } else { 8778 console.info("Bad counter id!", idCounter); 8779 } 8780 } 8781}); 8782 8783var onCaptchaVerifyinvisible = function (response) { 8784 $(".g-recaptcha:last").each(function () { 8785 var id = $(this).attr("data-widgetid"); 8786 if (typeof id !== "undefined" && response) { 8787 if (!$(this).closest("form").find(".g-recaptcha-response").val()) 8788 $(this).closest("form").find(".g-recaptcha-response").val(response); 8789 if ($("iframe[src*=recaptcha]").length) { 8790 $("iframe[src*=recaptcha]").each(function () { 8791 var block = $(this).parent().parent(); 8792 if (!block.hasClass("grecaptcha-badge")) block.css("width", "100%"); 8793 }); 8794 } 8795 $(this).closest("form").submit(); 8796 } 8797 }); 8798}; 8799 8800var onCaptchaVerifynormal = function (response) { 8801 $(".g-recaptcha").each(function () { 8802 var id = $(this).attr("data-widgetid"); 8803 if (typeof id !== "undefined") { 8804 if (grecaptcha.getResponse(id) != "") { 8805 $(this).closest("form").find(".recaptcha").valid(); 8806 } 8807 } 8808 }); 8809}; 8810 8811BX.addCustomEvent("onSubmitForm", function (eventdata) { 8812 try { 8813 if (!window.renderRecaptchaById || !window.asproRecaptcha || !window.asproRecaptcha.key) { 8814 eventdata.form.submit(); 8815 $(eventdata.form).closest(".form").addClass("sending"); 8816 return true; 8817 } 8818 8819 if (window.asproRecaptcha.params.recaptchaSize == "invisible" && $(eventdata.form).find(".g-recaptcha").length) { 8820 if ($(eventdata.form).find(".g-recaptcha-response").val()) { 8821 eventdata.form.submit(); 8822 $(eventdata.form).closest(".form").addClass("sending"); 8823 return true; 8824 } else { 8825 if (typeof grecaptcha != "undefined") { 8826 grecaptcha.execute($(eventdata.form).find(".g-recaptcha").data("widgetid")); 8827 } else { 8828 return false;
8829 } 8830 } 8831 } else { 8832 eventdata.form.submit(); 8833 $(eventdata.form).closest(".form").addClass("sending"); 8834 return true; 8835 } 8836 } catch (e) { 8837 console.error(e); 8838 return true; 8839 } 8840}); 8841 8842$(document).on("click", ".catalog_reviews_extended span.dropdown-select__list-link", function () { 8843 var _this = $(this); 8844 var ajaxData = _this.data("review_sort_ajax"); 8845 var container = _this.closest(".blog-comments"); 8846 containerId = container.attr("id"); 8847 if (containerId !== undefined && containerId) { 8848 ajaxData.containerId = containerId; 8849 } 8850 if (ajaxData !== undefined) { 8851 container.addClass("blur"); 8852 $.ajax({ 8853 type: "post", 8854 data: ajaxData, 8855 success: function (html) { 8856 $("#reviews_sort_continer").html(html); 8857 container.removeClass("blur"); 8858 }, 8859 }); 8860 } 8861}); 8862 8863$(document).on("change", ".filter-panel__sort-form input", function () { 8864 const _this = $(this); 8865 const $form = _this.closest("form")[0]; 8866 const $container = _this.closest(".blog-comments"); 8867 const method = $form.method; 8868 const formData = new FormData($form); 8869 8870 if ($container.length) { 8871 $container.addClass("blur"); 8872 formData.append("containerId", $container.attr("id")); 8873 } 8874 8875 $.ajax({ 8876 data: formData, 8877 type: method, 8878 processData: false, 8879 contentType: false, 8880 success: function (html) { 8881 $("#reviews_sort_continer").html(html); 8882 $container.removeClass("blur"); 8883 }, 8884 }); 8885}); 8886 8887$(document).on("click", ".rating_vote:not(.disable)", function () { 8888 var _this = $(this); 8889 var action = _this.data("action"); 8890 var parent = _this.closest(".rating-vote"); 8891 var commentId = parent.data("comment_id"); 8892 var userId = parent.data("user_id"); 8893 var ajaxUrl = parent.data("ajax_url"); 8894 $.ajax({ 8895 url: ajaxUrl, 8896 dataType: "json", 8897 data: { commentId: commentId, action: action, userId: userId }, 8898 success: function (data) { 8899 if (data.LIKE !== undefined) { 8900 _this.siblings(".rating-vote-result.like").text(data.LIKE); 8901 } 8902 if (data.DISLIKE !== undefined) { 8903 _this.siblings(".rating-vote-result.dislike").text(data.DISLIKE); 8904 } 8905 if (data.SET_ACTIVE_LIKE !== undefined) { 8906 parent.find(".rating_vote.plus").toggleClass("active"); 8907 } 8908 if (data.SET_ACTIVE_DISLIKE !== undefined) { 8909 parent.find(".rating_vote.minus").toggleClass("active"); 8910 } 8911 }, 8912 }); 8913}); 8914 8915function fileInputInit(message, reviews = "N") { 8916 $('input[type=file]:not(".uniform-ignore")').uniform({ 8917 fileButtonHtml: BX.message("JS_FILE_BUTTON_NAME"), 8918 fileDefaultHtml: message, 8919 }); 8920 $(document).on("change", "input[type=file]", function () { 8921 if ($(this).val()) { 8922 $(this).closest(".uploader").addClass("files_add"); 8923 } else { 8924 $(this).closest(".uploader").removeClass("files_add"); 8925 } 8926 }); 8927 $(".form .add_file").on("click", function () { 8928 var index = $(this).closest(".form-group").find("input[type=file]").length; 8929 let inputFormGroup = $(this).closest(".form-group").find(".input"); 8930 if (reviews === "Y") { 8931 inputFormGroup.append( 8932 '<input type="file" class="form-control" tabindex="3" id="comment_images" name="comment_images[]" value="" />' 8933 ); 8934 } else { 8935 inputFormGroup.append( 8936 '<input type="file" id="POPUP_FILE' + index + '" name="FILE_n' + index + '" class="inputfile" value="" />' 8937 ); 8938 } 8939 8940 $('input[type=file]:not(".uniform-ignore")').uniform({ 8941 fileButtonHtml: BX.message("JS_FILE_BUTTON_NAME"), 8942 fileDefaultHtml: message, 8943 }); 8944 }); 8945} 8946 8947/*custom event for sku prices*/ 8948 8949/*BX.addCustomEvent('onAsproSkuSetPrice', function(eventdata){ 8950 console.log(eventdata); 8951})*/ 8952 8953/*BX.addCustomEvent('onAsproSkuSetPriceMatrix', function(eventdata){ 8954 console.log(eventdata); 8955})*/ 8956 8957function declOfNum(number, titles) { 8958 var cases = [2, 0, 1, 1, 1, 2]; 8959 return number + " " + titles[number % 100 > 4 && number % 100 < 20 ? 2 : cases[Math.min(number % 10, 5)]]; 8960} 8961 8962function array_values_js(input) { 8963 var tmp_arr = new Array(), 8964 cnt = 0; 8965 for (key in input) { 8966 tmp_arr[cnt] = input[key]; 8967 cnt++; 8968 } 8969 8970 return tmp_arr; 8971} 8972 8973$(document).on("input", ".bx_filter_parameters_box_container input[type=text], .inputdecimal", function() { 8974 this.value = this.value.replace(/[^\d\.\-]/g, ''); 8975})
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.