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