1var stopScrollBasket = false, 2 arStatusBasketPhoenix = {}, 3 contentSideHeight = 0, 4 menuSideHeight = 0, 5 basketPoolQuantity = {}, 6 cur_pos = 0, 7 cart_page = "N", 8 customEvent = false, 9 layerPopup = 0, 10 windowWidth = document.documentElement.clientWidth, 11 windowHeight = document.documentElement.clientHeight; 12 13 14 15var paramsLazy = { 16 scrollDirection: 'vertical', 17 threshold: 500, 18 visibleOnly: true, 19 effect: 'fadeIn' 20}; 21 22 23function generateMaps(container) { 24 var mapBlock = $(".iframe-map-area", container); 25 26 if (mapBlock.length > 0) { 27 mapBlock.each( 28 function (index, element) { 29 $(element).after($(element).attr("data-src")); 30 $(element).remove(); 31 } 32 ); 33 } 34 35} 36 37function generateVideos(container) { 38 39 var videoBlock = $(".iframe-video-area", container); 40 41 if (videoBlock.length > 0) { 42 videoBlock.each( 43 function (index, element) { 44 $(element).after($(element).attr("data-src")); 45 $(element).remove(); 46 } 47 ); 48 } 49} 50 51 52function showWaitSearch(form) { 53 form.find(".circleG-area").addClass('active'); 54} 55 56function hideWaitSearch(form) { 57 form.find(".circleG-area").removeClass('active'); 58} 59 60function openCart() { 61 $('.no-click-block').addClass('on'); 62 $('div.cart-parent').addClass('open'); 63 startBlurWrapperContainer(); 64 var openCartOut = setTimeout(function () { 65 $('div.cart-parent').addClass('on'); 66 clearTimeout(openCartOut); 67 }, 200); 68 69} 70 71function closeCart() { 72 stopBlurWrapperContainer(); 73 $('div.cart-parent').removeClass('on'); 74 $('.no-click-block').removeClass('on'); 75 var closeCartOut = setTimeout(function () { 76 $('div.cart-parent').removeClass('open'); 77 clearTimeout(closeCartOut); 78 }, 700); 79 80 81} 82 83function showFormOrder() { 84 if ($(window).width() <= 767) 85 $(".right-p", ".basket-style.page").removeClass('d-none'); 86} 87 88function hideFormOrder() { 89 if ($(window).width() <= 767) 90 $(".right-p", ".basket-style.page").addClass('d-none'); 91} 92 93function showTabContent(arParams) { 94 var curUrlParam = "-1"; 95 var urlParams = getUrlParams(); 96 arParams = arParams || {}; 97 98 99 if (urlParams['url-tab'] !== undefined) { 100 curUrlParam = urlParams['url-tab']; 101 102 if (curUrlParam == "products" && arParams.products) 103 curUrlParam = "products"; 104 105 else if (curUrlParam == "delayed" && arParams.delay) 106 curUrlParam = "delayed"; 107 108 else if (arParams.products) 109 curUrlParam = "products"; 110 111 else if (arParams.delay) 112 curUrlParam = "delayed"; 113 } 114 115 116 if ($(".url-tab[data-url-tab='" + curUrlParam + "']").length > 0) { 117 118 $(".url-tab[data-url-tab='" + curUrlParam + "']").parents(".url-tab-parent") 119 .find(".url-tab").removeClass('active').parents(".url-tab-parent").find(".url-tab-content").removeClass('active'); 120 121 $(".url-tab[data-url-tab='" + curUrlParam + "']").addClass('active'); 122 $(".url-tab-content[data-url-tab='" + curUrlParam + "']").addClass('active'); 123 124 if (curUrlParam == "delayed") 125 hideFormOrder(); 126 127 } 128 129} 130 131function getChar(evt) { 132 evt = (evt) ? evt : window.event; 133 var charCode = (evt.which) ? evt.which : evt.keyCode; 134 if (charCode >
134 31 && (charCode < 46 || charCode > 57)) { 135 return null; 136 } 137 return true; 138} 139 140function menuOffset(li) { 141 var mainPosition = $(li).parents('.main-menu-inner').width() + $(li).parents( 142 '.main-menu-inner').offset().left; 143 var liPosition = $(li).children('ul').offset().left + $(li).children('ul').width(); 144 if (liPosition >= mainPosition) $(li).addClass('reverse'); 145} 146 147function mobileMenuPositionFooter() { 148 if ($('.open-menu-mobile').height() > ($( 149 'div.open-menu-mobile div.menu-mobile-inner').outerHeight() + $( 150 'div.open-menu-mobile div.foot-wrap').outerHeight(true))) $( 151 'div.open-menu-mobile div.foot-wrap').addClass('absolute'); 152 else { 153 $('div.open-menu-mobile div.foot-wrap').removeClass('absolute'); 154 } 155} 156 157function openMenuFooterPos() { 158 var totalHeight = $('.open-menu .head-menu-wrap').outerHeight(true) + $( 159 '.open-menu .body-menu').outerHeight(true) + $( 160 '.open-menu .footer-menu-wrap').outerHeight(true); 161 var needHeight = $('.open-menu').height() - totalHeight + $( 162 '.open-menu .body-menu').outerHeight(); 163 if ($(window).height() > totalHeight) $('.open-menu .body-menu').css( 164 'min-height', needHeight + 'px'); 165} 166 167function phoenixResizeVideo() { 168 var win_height = $('div.video-modal').height(); 169 var modal = 590; 170 if ($(window).width() > 767) { 171 if (win_height > modal) $("div.video-modal div.phoenix-modal-dialog").addClass( 172 'pos-absolute'); 173 else { 174 $("div.video-modal div.phoenix-modal-dialog").removeClass('pos-absolute'); 175 } 176 } else { 177 $("div.video-modal div.phoenix-modal-dialog").addClass('pos-absolute'); 178 } 179} 180 181function scrollToBlock(dist, elem, offset) { 182 var moreDist = 0; 183 184 offset = offset || 0; 185 elem = elem || 0; 186 187 if ($('header').hasClass("fixed")) 188 moreDist = 69; 189 190 if ($("div.catalog-card-wrap").length > 0 || $("div.catalog-list-wrap").length > 0) { 191 moreDist = 0; 192 193 if ($('header').hasClass("fixed")) moreDist = 80; 194 if (elem) { 195 if (elem.hasClass('review')) moreDist = 100; 196 } 197 } 198 var destinationhref = parseInt($(dist).offset().top - moreDist - offset); 199 200 201 $("html:not(:animated),body:not(:animated)").animate({ 202 scrollTop: destinationhref 203 }, 1000, "linear", function () { 204 205 setTimeout( 206 function () { 207 208 if (100 < Math.abs(parseInt($(dist).offset().top - moreDist - offset) - destinationhref)) { 209 $("html:not(:animated),body:not(:animated)").animate({ 210 scrollTop: parseInt($(dist).offset().top - moreDist - offset) 211 }, 300, "linear"); 212 } 213 }, 300 214 ); 215 }); 216} 217 218 219function timerCookie(form) { 220 var timeout = true; 221 var timer = form.find('input.timerVal').val(); 222 var forCookieTime = parseFloat(form.find('input.forCookieTime').val()); 223 var totalTime = 0; 224 var mainTime = new Date().getTime(); 225 var idElem = form.find("input[name='element']").val(); 226 var idSect = form.find('input.idSect').val(); 227 var firstEnter = BX.getCookie($(".domen-url-for-cookie").val() + '_phoenixFirstEnter' + idSect + idElem); 228 var firstEnterVal = BX.getCookie($(".domen-url-for-cookie").val() + '_phoenixFirstEnterVal' + idSect + idElem); 229 setTimeout(function () { 230 form.css('min-height', form.outerHeight()); 231 }, 100); 232 233 if (forCookieTime <= 0) 234 forCookieTime = 1; 235 236 form.find('.phoenixtimer').addClass('active'); 237 if (typeof (firstEnter) == "undefined" || firstEnterVal != timer) { 238 BX.setCookie($(".domen-url-for-cookie").val() + '_phoenixFirstEnter' + idSect + idElem, mainTime, { 239 expires: forCookieTime * 60 * 60 240 }); 241 BX.setCookie($(".domen-url-for-cookie").val() + '_phoenixFirstEnterVal' + idSect + idElem, timer, { 242 expires: forCookieTime * 60 * 60 243 }); 244 firstEnter = BX.getCookie($(".domen-url-for-cookie").val() + '_phoenixFirstEnter' + idSect + idElem); 245 firstEnterVal = BX.getCookie($(".domen-url-for-cookie").val() + '_phoenixFirstEnterVal' + idSect + idElem); 246 } 247 totalTime = ((mainTime - firstEnter) / 1000).toFixed(); 248 if (totalTime < timer * 60) timer = timer * 60 - totalTime; 249 else { 250 timeout = false;
251 } 252 if (timeout) form.find('.phoenixtimer').countdown({ 253 until: timer, 254 format: 'HMS', 255 onExpiry: liftOff, 256 layout: form.find('.phoenixtimer').html() 257 }, $.countdown.regionalOptions['ru']); 258 else { 259 form.find('.questions').removeClass('active'); 260 form.find('.timeout_text').addClass('active'); 261 } 262 263 function liftOff() { 264 form.find('.questions').removeClass('active'); 265 form.find('.timeout_text').addClass('active'); 266 } 267} 268 269function parseCount(newVal, ratio, minVal) { 270 271 var ost = newVal % ratio; 272 var ratio_ = ratio - ost; 273 274 275 276 newVal = newVal - minVal; 277 newVal -= (newVal % ratio); 278 279 if (ratio_ >= ost) { 280 newVal += minVal; 281 } else { 282 newVal += minVal + ratio; 283 } 284 285 286 if (newVal <= minVal || isNaN(newVal)) 287 newVal = minVal; 288 289 return newVal; 290 291} 292 293function formatNum(val) { 294 val = String(val).replace(/(\d)(?=(\d{3})+([^\d]|$))/g, '$1 '); 295 return val; 296} 297 298function formAttentionScroll(dist, parent) { 299 $(parent).animate({ 300 scrollTop: dist 301 }, 700); 302} 303 304 305function setHeaderBgImg(attr) { 306 if (typeof attr !== 'undefined') 307 $('header').css({ 308 "background-image": "url('" + attr + "')" 309 }); 310} 311 312var lazyController = false, 313 parentContainerSlide = {}, 314 parent = {}, 315 arImagesLazyload = {}; 316 317 318 319 320function updateLazyLoad() { 321 322 $('.lazyload').Lazy({ 323 scrollDirection: 'vertical', 324 threshold: 500, 325 visibleOnly: true, 326 effect: 'fadeIn', 327 328 afterLoad: function (element) { 329 if (contentSideHeight > 0) 330 contentSideHeight = $(".parent-fixedSrollBlock").outerHeight(true); 331 332 parent = $(element).parent(); 333 parentContainerSlide = parent.find('.parent-slider-item-js'); 334 335 if ($(element).hasClass("slider-start")) { 336 337 if (typeof arImagesLazyload["id" + $(element).attr("data-id")] === "undefined") 338 arImagesLazyload["id" + $(element).attr("data-id")] = { 339 "s": 0, 340 "f": 0, 341 "type": null 342 }; 343 344 arImagesLazyload["id" + $(element).attr("data-id")].s = 1; 345 346 347 arImagesLazyload["id" + $(element).attr("data-id")].type = parentContainerSlide; 348 349 } 350 351 352 if ($(element).hasClass('slider-finish')) { 353 354 if (typeof arImagesLazyload["id" + $(element).attr("data-id")] === "undefined") 355 arImagesLazyload["id" + $(element).attr("data-id")] = { 356 "s": 0, 357 "f": 0, 358 "type": null 359 }; 360 361 arImagesLazyload["id" + $(element).attr("data-id")].f = 1; 362 arImagesLazyload["id" + $(element).attr("data-id")].type = parentContainerSlide; 363 364 } 365 366 if ($(element).hasClass('slider-finish') || $(element).hasClass("slider-start")) { 367 for (key in arImagesLazyload) { 368 369 if (arImagesLazyload[key].s == 1 && arImagesLazyload[key].f == 1) { 370 371 /*if( arImagesLazyload[key].type.hasClass('first-slider') && !arImagesLazyload[key].type.hasClass('slider-init')) 372 initFSlider(arImagesLazyload[key].type);*/ 373 374 controllerSliders(arImagesLazyload[key].type); 375 376 377 delete arImagesLazyload[key]; 378 } 379 } 380 } 381 382 383 if ($(element).parents(".parent-video-bg").find(".videoBG").length > 0) 384 correctSizeVideoBg($(element).parents(".parent-video-bg").find(".videoBG")); 385 386 387 if ($(element).hasClass('map-start')) 388 generateMaps($(element).parents("div.block")); 389 390 if ($(element).hasClass('video-start')) 391 generateVideos($(element).parents("div.block")); 392 393 if ($(element).hasClass('video-start-js')) 394 generateVideos($(element).parents("div.video-start-parent")); 395 396 if ($(element).hasClass('videoBG-start')) 397 generateVideoBG($(element).parents("div.block")); 398 399 if ($(element).hasClass('videoBG-start-fb')) 400 generateVideoBG($(element).parents("div.first-block")); 401 402 } 403 }); 404 405} 406 407function initMobileSideMenu() { 408 409 if ($(window).width() <= 991 && $(".menu-navigation-inner").length > 0) { 410 var clone = $(".menu-navigation-inner").clone(); 411 $(".menu-navigation-inner").remove(); 412 clone.addClass('wr-transform-to-dialog-by-mob d-none container-close-from-scroll').children().addClass('transform-to-dialog-by-mob').find(".scroll").addClass('from-modal'); 413 clone.appendTo("body"); 414 } 415 416} 417 418 419function setSharesValues() { 420 421 if ($(".public_shares").length > 0) { 422 423 var title = "", 424 description = "", 425 image = "", 426 url = ""; 427 428 if ($("meta[property=\"og:title\"]").length) 429 title = $("meta[property=\"og:title\"]").attr("content"); 430 431 if ($("meta[property=\"og:description\"]").length) 432 description = $("meta[property=\"og:description\"]").attr("content"); 433 434 if ($("meta[property=\"og:image\"]").length) 435 image = $("meta[property=\"og:image\"]").attr("content"); 436 437 if ($("meta[property=\"og:url\"]").length) 438 url = $("meta[property=\"og:url\"]").attr("content"); 439 440 441 $(".public_shares a.vkontakte").attr("onclick", "Share.vkontakte('" + url + "','" + title + "','" + image
441+ "', '" + description + "')"); 442 $(".public_shares a.facebook").attr("onclick", "Share.facebook('" + url + "','" + title + "','" + image + "', '" + description + "')"); 443 $(".public_shares a.twitter").attr("onclick", "Share.twitter('" + url + "','" + title + "')"); 444 445 } 446} 447 448 449function ShowApplyRegion() { 450 451 if ($(".popup-block.region-apply").length > 0) { 452 setTimeout(function () { 453 $(".popup-block.region-apply").removeClass('d-none'); 454 $(".popup-block.region-apply").addClass('fadeInUp'); 455 456 457 if ($(window).width() < 768) { 458 startBlurWrapperContainer(); 459 } 460 }, 2000); 461 462 } 463} 464 465function controllerSliders(obj) 466{ 467 if(obj) 468 { 469 if(!obj.hasClass('slider-init')) 470 { 471 472 if (obj.hasClass('block-slider-list')) 473 initSlider(obj); 474 475 if (obj.hasClass('slider')) 476 initOpSlider(obj); 477 478 if (obj.hasClass('slider-mini')) 479 initOpMiniSlider(obj); 480 481 if (obj.hasClass('slider_catalog_big_items')) 482 initCSlider(obj); 483 484 if (obj.hasClass('partners-slider-list')) 485 initPartnersSlider(obj); 486 487 if (obj.hasClass('slider-gallery')) 488 initGallerySlider(obj); 489 490 if (obj.hasClass('big-advantages-slide')) 491 initAdvantagesBigSlider(obj); 492 493 if (obj.hasClass('small-advantages-slide')) 494 initAdvantagesSmallSlider(obj); 495 496 if (obj.hasClass('slider-news-big')) 497 initNewsBigSlider(obj); 498 499 if (obj.hasClass('slider-news-small')) 500 initNewsSmallSlider(obj); 501 502 if (obj.hasClass('menu-banner-slider')) 503 initBannersSlider(obj); 504 505 if (obj.hasClass('slider-news-detail')) 506 initNewsDetailSlider(obj); 507 508 if (obj.hasClass('catalog-list-slider')) 509 initCatalogDetailSlider(obj); 510 511 if (obj.hasClass('section-items-slider')) 512 initCatalogSubSectionsSlider(obj); 513 } 514 } 515} 516 517function setChangerBlocks() { 518 $("div.changer-blocks").each( 519 function() 520 { 521 var block = $(this); 522 523 $("div.changer-link-js", block).each( 524 function(index, value) 525 { 526 var arIds = $(this).attr("data-id").split(","); 527 528 if(arIds) 529 { 530 for (var i = 0; i < arIds.length; i++) { 531 532 if($(this).hasClass("active")) 533 { 534 $("div#block"+arIds[i]).removeClass("d-none"); 535 $('.lazyload').Lazy(paramsLazy); 536 537 var obj = $("div#block"+arIds[i]).find(".parent-slider-item-js"); 538 539 controllerSliders(obj); 540 } 541 542 } 543 } 544 545 } 546 ); 547 } 548 ); 549 550 551 $("div.changer-link-js").click( 552 function() 553 { 554 var block = $(this).parents("div.changer-blocks"); 555 556 $("div.changer-link-js", block).removeClass("active"); 557 $(this).addClass("active"); 558 559 $("div.changer-link-js", block).each( 560 function(index, value) 561 { 562 var arIds = $(this).attr("data-id").split(","); 563 564 if(arIds) 565 { 566 for (var i = 0; i < arIds.length; i++) { 567 $("div#block"+arIds[i]).addClass("d-none"); 568 } 569 } 570 571 } 572 ); 573 574 var arIds = $(this).attr("data-id").split(","); 575 576 if(arIds) 577 { 578 for (var i = 0; i < arIds.length; i++) { 579 $("div#block"+arIds[i]).removeClass("d-none"); 580 $('.lazyload').Lazy(paramsLazy); 581 var obj = $("div#block"+arIds[i]).find(".parent-slider-item-js"); 582 controllerSliders(obj); 583 } 584 } 585 586 587 588 589 } 590 ); 591} 592 593$(document).ready(function () { 594 595 setSharesValues(); 596 initMobileSideMenu(); 597 598 if ($(window).width() >= 991) 599 $(".slide-hidden-lg").remove(); 600 601 else { 602 $(".slide-hidden-xs").remove(); 603 } 604 605 if ($(window).width() >= 768) 606 setHeaderBgImg($('header').attr('data-src-lg')); 607 608 609 610 if ($(window).width() < 768) { 611 setHeaderBgImg($('header').attr('data-src-xs')); 612 613 if ($(".error-404").length > 0) 614 $("div.wrapper").addClass('overflow-visible'); 615 616 } 617 618 619 updateLazyLoad(); 620 621 if (window.frameCacheVars !== undefined) { 622 BX.addCustomEvent("onFrameDataReceived", function (json) { 623 customEvent = true; 624 }); 625 } 626 627 initZoomer($('.zoom')); 628 629 $('.date-group').datetimepicker({ 630 timepicker: false, 631 format: 'd.m.Y',
632 scrollMonth: false, 633 scrollInput: false, 634 dayOfWeekStart: 1 635 636 }); 637 638 getCatalogStories(); 639 setChangerBlocks(); 640 641 setComments(); 642 643}); 644 645function ajaxGetComments(params) { 646 var path = "/bitrix/tools/concept.phoenix/ajax/comments/comments_block.php"; 647 params = params || 0; 648 649 showProcessLoadBlock($(".block-comments-js")); 650 651 $.post(path, { 652 site_id: $("input.site_id").val(), 653 id: $(".block-comments-js").attr("data-element-id"), 654 mode: params.mode, 655 page: params.pageNum 656 657 }, 658 function (html) { 659 closeProcessLoadBlock($(".block-comments-js")); 660 661 if(params.this) 662 { 663 if (params.this.hasClass('get-comments-js')) { 664 $(".block-comments-js .comments-set-js").append(html); 665 params.this.remove(); 666 } 667 } 668 else 669 { 670 $('.comments-set-js').append(html); 671 } 672 673 674 if(params.newItem) 675 { 676 677 678 $.ajax({ 679 url: "/bitrix/tools/concept.phoenix/ajax/ajax_hit_page.php", 680 method: 'POST', 681 success: function(json) {} 682 }); 683 684 685 var otherHeight = 0; 686 if ($('header').hasClass('fixed')) 687 otherHeight = 100; 688 689 var newItem = $('.comments-set-js').find('.review-item.first'); 690 newItem.addClass('new'); 691 formAttentionScroll(newItem.offset().top - otherHeight, "html:not(:animated), body:not(:animated)"); 692 setTimeout(function() { 693 newItem.removeClass('new'); 694 }, 2000); 695 } 696 } 697 ); 698} 699 700function setComments(newItem){ 701 if($('.block-comments-js').length>0) 702 { 703 newItem = newItem || ''; 704 var params = { 705 newItem: newItem, 706 mode: "full" 707 }; 708 709 ajaxGetComments(params); 710 } 711} 712 713$(document).on("click", ".get-comments-js", function () { 714 var params = { 715 "this": $(this), 716 "pageNum": $(this).attr("data-page"), 717 "mode": "list" 718 }; 719 ajaxGetComments(params); 720}); 721 722function deleteComment(params) { 723 var path = "/bitrix/tools/concept.phoenix/ajax/comments/delete.php"; 724 params = params || 0; 725 726 showProcessLoadBlock($(".block-comments-js")); 727 728 $.post( 729 path, { 730 site_id: $("input.site_id").val(), 731 ELEMENT_ID: params.ELEMENT_ID 732 }, 733 function (data) { 734 closeProcessLoadBlock($(".block-comments-js")); 735 736 if (data.OK == "Y") { 737 $(".review-item[data-review-id='"+params.ELEMENT_ID+"']").remove(); 738 } 739 else 740 { 741 $('.comments-set-js').html(''); 742 setComments(); 743 } 744 }, 745 "json" 746 ); 747} 748 749$(document).on("click", ".comment-delete-js", function () { 750 var params = { 751 "ELEMENT_ID": $(this).attr("data-review-id") 752 }; 753 deleteComment(params); 754}); 755 756 757function sendComments(that, fields) 758{ 759 fields = fields || null; 760 761 var form = that.parents("form"), 762 load = form.find(".loader-simple"), 763 question = form.find(".question-js"), 764 thank = form.find(".thank-js"), 765 text = form.find("textarea[name=TEXT]"), 766 btn = that; 767 768 if(text.val()<=5) 769 { 770 text.addClass('has-error'); 771 formAttentionScroll(text.offset().top - form.offset().top, "html:not(:animated), body:not(:animated)"); 772 return false; 773 } 774 else 775 { 776 load.removeClass('d-none'); 777 btn.addClass('d-none'); 778 779 780 var formSendAll = buildFormValues(form); 781 782 formSendAll.append("send", "Y"); 783 formSendAll.append("site_id", $("input.site_id").val()); 784 785 if(fields) 786 { 787 if(fields.captchaToken) 788 formSendAll.append("captchaToken", fields.captchaToken); 789 } 790 791 792 var path = "/bitrix/tools/concept.phoenix/ajax/comments/add.php"; 793 794 795 $.ajax({ 796 url: path, 797 method: 'POST', 798 contentType: false, 799 processData: false, 800 data: formSendAll, 801 dataType: 'json', 802 success: function (json) { 803 if (json.OK == "Y") { 804 805 thank.html(json.MESSAGE); 806 question.addClass('d-none'); 807 thank.removeClass('d-none'); 808 809 setTimeout(function() { 810 811 if(json.NEW === 'Y') 812 { 813 $('.comments-set-js').html(''); 814 setComments(json.NEW); 815 } 816 question.removeClass('d-none'); 817 thank.addClass('d-none'); 818 load.addClass('d-none'); 819 btn.removeClass('d-none'); 820 821 text.val(''); 822 text.parent().removeClass('in-focus'); 823 824 }, 2000); 825 826 $.ajax({ 827 url: "/bitrix/tools/concept.phoenix/ajax/ajax_hit_page.php", 828 method: 'POST', 829 success: function (json) {} 830 }); 831 832 /*setTimeout(function() { 833 834 location.href = location.href; 835 }, 3000);*/ 836 837 838 839 840 } else if (json.OK == "N") { 841 question.removeClass('d-none'); 842 thank.addClass('d-none'); 843 load.addClass('d-none'); 844 btn.removeClass('d-none'); 845 } 846 847 console.log(json.CAPTCHA_SCORE); 848 849 } 850 }); 851 852 853 } 854} 855 856$(document).on("click", ".btn-submit-comments-js", function () { 857 858 var that = $(this); 859 if($("body").hasClass('captcha')) 860 { 861 grecaptcha.execute($(".captcha-site-key").val(), {action: 'homepage'}).then(function(token) { 862 863 sendComments(that, {captchaToken:token}); 864 }); 865 } 866 else 867 { 868 sendComments(that); 869 } 870 871 872}); 873 874 875 876function initZoomer(obj) { 877 if ($(window).width() > 1024) 878 obj.zoom(); 879} 880 881 882function correctBgStyle(obj) { 883 $('div.lazyload', obj).each( 884 function (index, element) { 885 if (typeof $(element).attr("src") != "undefined") { 886 $(element).attr("style", "background-image: url(" + $(element).attr("src") + ");"); 887 $(element).removeAttr("src"); 888 889 } 890 } 891 892 ); 893} 894 895function correctLazyloadInSlider(obj) { 896 if ($('.lazyload', obj).length) { 897 $('.lazyload', obj).each( 898 function (index, element) { 899 $(element).attr("src", $(element).attr("data-src")); 900 $(element).removeAttr("data-src"); 901 } 902 903 ); 904 905 if ($('div.lazyload', obj).length) 906 correctBgStyle(obj); 907 908 } 909} 910 911function initNewsDetailSlider(obj) { 912 obj.on('init', function (event, slick) { 913 obj.find(".slick-slide").removeClass('noactive-slide-lazyload'); 914 obj.addClass("slider-init"); 915 correctLazyloadInSlider(obj); 916 if (obj.parents(".parent-video-bg").find(".videoBG").length > 0) { 917 correctSizeVideoBg(obj.parents(".parent-video-bg").find(".videoBG")); 918 } 919 }); 920 921 obj.slick({ 922 slidesToShow: 3, 923 slidesToScroll: 1, 924 dots: false, 925 infinite: true, 926 centerPadding: 0, 927 arrows: true, 928 responsive: [{ 929 breakpoint: 991, 930 settings: { 931 slidesToShow: 2 932 } 933 }, { 934 breakpoint: 575.98, 935 settings: { 936 slidesToShow: 1 937 } 938 }, 939 { 940 breakpoint: 0, 941 settings: "unslick" 942 } 943 ] 944 }); 945} 946 947function initCatalogSubSectionsSlider(obj) { 948 949 if ($(window).width() < 768) { 950 obj.on('init', function (event, slick) { 951 obj.find(".slick-slide").removeClass('noactive-slide-lazyload'); 952 obj.addClass("slider-init"); 953 correctLazyloadInSlider(obj); 954 }); 955 956 obj.slick({
957 arrows: false, 958 slidesToShow: 3, 959 slidesToScroll: 3, 960 centerMode: false, 961 variableWidth: true, 962 infinite: false, 963 }); 964 965 } 966} 967 968function initCatalogDetailSlider(obj) { 969 obj.on('init', function (event, slick) { 970 obj.find(".slick-slide").removeClass('noactive-slide-lazyload'); 971 obj.addClass("slider-init"); 972 if (obj.parents(".parent-video-bg").find(".videoBG").length > 0) { 973 correctSizeVideoBg(obj.parents(".parent-video-bg").find(".videoBG")); 974 } 975 976 correctLazyloadInSlider(obj); 977 }); 978 979 var count = 3; 980 981 982 if(obj.attr('data-count')) 983 count = obj.attr('data-count'); 984 985 986 obj.slick({ 987 slidesToShow: count, 988 slidesToScroll: 1, 989 dots: false, 990 infinite: true, 991 centerPadding: 0, 992 arrows: true, 993 responsive: [{ 994 breakpoint: 991, 995 settings: { 996 slidesToShow: (count - 1) 997 } 998 }, { 999 breakpoint: 575.98, 1000 settings: { 1001 slidesToShow: 2, 1002 adaptiveHeight: true 1003 } 1004 }, 1005 { 1006 breakpoint: 0, 1007 settings: "unslick" 1008 } 1009 ] 1010 }); 1011} 1012 1013function initNewsBigSlider(obj) { 1014 obj.on('init', function (event, slick) { 1015 obj.find(".slick-slide").removeClass('noactive-slide-lazyload'); 1016 obj.addClass("slider-init"); 1017 correctLazyloadInSlider(obj); 1018 if (obj.parents(".parent-video-bg").find(".videoBG").length > 0) { 1019 correctSizeVideoBg(obj.parents(".parent-video-bg").find(".videoBG")); 1020 } 1021 }); 1022 1023 obj.slick({ 1024 slidesToShow: 4, 1025 slidesToScroll: 1, 1026 dots: false, 1027 infinite: true, 1028 centerPadding: 0, 1029 centerMode: false, 1030 adaptiveHeight: false, 1031 focusOnSelect: false, 1032 arrows: true, 1033 responsive: [{ 1034 breakpoint: 1200, 1035 settings: { 1036 slidesToShow: 3, 1037 } 1038 }, { 1039 breakpoint: 991, 1040 settings: { 1041 slidesToShow: 2 1042 } 1043 }, { 1044 breakpoint: 767, 1045 settings: { 1046 slidesToShow: 2 1047 } 1048 }, { 1049 breakpoint: 575.98, 1050 settings: { 1051 slidesToShow: 1, 1052 adaptiveHeight: true, 1053 } 1054 }, 1055 { 1056 breakpoint: 0, 1057 settings: "unslick" 1058 } 1059 ] 1060 }); 1061} 1062 1063function initNewsSmallSlider(obj) { 1064 obj.on('init', function (event, slick) { 1065 obj.find(".slick-slide").removeClass('noactive-slide-lazyload'); 1066 obj.addClass("slider-init"); 1067 correctLazyloadInSlider(obj); 1068 if (obj.parents(".parent-video-bg").find(".videoBG").length > 0) { 1069 correctSizeVideoBg(obj.parents(".parent-video-bg").find(".videoBG")); 1070 } 1071 }); 1072 1073 obj.slick({ 1074 slidesToShow: 3, 1075 slidesToScroll: 1, 1076 dots: false, 1077 infinite: true, 1078 centerPadding: 0, 1079 centerMode: false, 1080 adaptiveHeight: false, 1081 focusOnSelect: false, 1082 arrows: true, 1083 responsive: [{ 1084 breakpoint: 1200, 1085 settings: { 1086 slidesToShow: 2, 1087 } 1088 }, { 1089 breakpoint: 767, 1090 settings: { 1091 slidesToShow: 2 1092 } 1093 }, { 1094 breakpoint: 575.98, 1095 settings: { 1096 slidesToShow: 1 1097 } 1098 }, 1099 { 1100 breakpoint: 0, 1101 settings: "unslick" 1102 } 1103 ] 1104 }); 1105} 1106 1107function initAdvantagesBigSlider(obj) { 1108 obj.on('init', function (event, slick) { 1109 obj.find(".slick-slide").removeClass('noactive-slide-lazyload'); 1110 obj.addClass("slider-init"); 1111 correctLazyloadInSlider(obj); 1112 if (obj.parents(".parent-video-bg").find(".videoBG").length > 0) { 1113 correctSizeVideoBg(obj.parents(".parent-video-bg").find(".videoBG")); 1114 } 1115 }); 1116 1117 obj.slick({ 1118 slidesToShow: 3, 1119 slidesToScroll: 1, 1120 dots: false, 1121 infinite: true, 1122 centerPadding: 0, 1123 centerMode: false, 1124 adaptiveHeight: false, 1125 focusOnSelect: false, 1126 responsive: [{ 1127 breakpoint: 1200, 1128 settings: { 1129 slidesToShow: 3, 1130 } 1131 }, { 1132 breakpoint: 991, 1133 settings: { 1134 slidesToShow: 2 1135 } 1136 }, { 1137 breakpoint: 575.98, 1138 settings: { 1139 slidesToShow: 1 1140 } 1141 }, { 1142 breakpoint: 0, 1143 settings: "unslick" 1144 }] 1145 }); 1146} 1147 1148function initBannersSlider(obj) { 1149 obj.on('init', function (event, slick) { 1150 obj.find(".slick-slide").removeClass('noactive-slide-lazyload'); 1151 obj.addClass("slider-init"); 1152 correctLazyloadInSlider(obj); 1153 1154 if (obj.parents(".parent-video-bg").find(".videoBG").length > 0) { 1155 correctSizeVideoBg(obj.parents(".parent-video-bg").find(".videoBG")); 1156 } 1157 }); 1158 1159 obj.slick({ 1160 slidesToShow: 1, 1161 slidesToScroll: 1, 1162 autoplay: true, 1163 autoplaySpeed: 5000, 1164 dots: false, 1165 infinite: true, 1166 adaptiveHeight: false, 1167 speed: 500,
1168 arrows: false 1169 }); 1170} 1171 1172 1173function initAdvantagesBigSlider(obj) { 1174 obj.on('init', function (event, slick) { 1175 obj.find(".slick-slide").removeClass('noactive-slide-lazyload'); 1176 obj.addClass("slider-init"); 1177 correctLazyloadInSlider(obj); 1178 if (obj.parents(".parent-video-bg").find(".videoBG").length > 0) { 1179 correctSizeVideoBg(obj.parents(".parent-video-bg").find(".videoBG")); 1180 } 1181 }); 1182 1183 obj.slick({ 1184 dots: true, 1185 adaptiveHeight: false 1186 }); 1187} 1188 1189function initAdvantagesSmallSlider(obj) { 1190 obj.on('init', function (event, slick) { 1191 obj.find(".slick-slide").removeClass('noactive-slide-lazyload'); 1192 obj.addClass("slider-init"); 1193 correctLazyloadInSlider(obj); 1194 1195 if (obj.parents(".parent-video-bg").find(".videoBG").length > 0) { 1196 correctSizeVideoBg(obj.parents(".parent-video-bg").find(".videoBG")); 1197 } 1198 }); 1199 1200 obj.slick({ 1201 dots: true, 1202 slidesToShow: 2, 1203 adaptiveHeight: false, 1204 slidesToScroll: 2, 1205 responsive: [{ 1206 breakpoint: 767, 1207 settings: { 1208 slidesToShow: 2, 1209 slidesToScroll: 2 1210 } 1211 }, { 1212 breakpoint: 575.98, 1213 settings: { 1214 slidesToShow: 1, 1215 slidesToScroll: 1 1216 } 1217 }, { 1218 breakpoint: 0, 1219 settings: "unslick" 1220 }] 1221 }); 1222} 1223 1224function initOpMiniSlider(obj) { 1225 obj.on('init', function (event, slick) { 1226 obj.find(".slick-slide").removeClass('noactive-slide-lazyload'); 1227 obj.addClass("slider-init"); 1228 correctLazyloadInSlider(obj); 1229 if (obj.parents(".parent-video-bg").find(".videoBG").length > 0) { 1230 correctSizeVideoBg(obj.parents(".parent-video-bg").find(".videoBG")); 1231 } 1232 }); 1233 1234 obj.slick({ 1235 dots: true, 1236 infinite: true, 1237 adaptiveHeight: true, 1238 arrows: true 1239 }); 1240} 1241 1242function initOpSlider(obj) { 1243 obj.on('init', function (event, slick) { 1244 obj.find(".slick-slide").removeClass('noactive-slide-lazyload'); 1245 obj.addClass("slider-init"); 1246 correctLazyloadInSlider(obj); 1247 if (obj.parents(".parent-video-bg").find(".videoBG").length > 0) { 1248 correctSizeVideoBg(obj.parents(".parent-video-bg").find(".videoBG")); 1249 } 1250 }); 1251 1252 var count = obj.attr('data-count'); 1253 1254 if (count == 1) { 1255 $('.slider-for', obj).slick({ 1256 slidesToShow: 1, 1257 arrows: false, 1258 asNavFor: obj.find('.slider-nav'), 1259 appendArrows: obj.find('.slider-nav-wrap') 1260 }); 1261 $('.slider-nav', obj).slick({ 1262 slidesToShow: 1, 1263 asNavFor: obj.find('.slider-for'), 1264 centerPadding: 0, 1265 dots: false, 1266 centerMode: true, 1267 focusOnSelect: true, 1268 }); 1269 obj.addClass("one-slide"); 1270 } else if (count == 2) { 1271 $('.slider-for', obj).slick({ 1272 slidesToShow: 1, 1273 slidesToScroll: 1, 1274 speed: 300, 1275 fade: true, 1276 adaptiveHeight: true, 1277 arrows: false, 1278 asNavFor: obj.find('.slider-nav'), 1279 appendArrows: obj.find('.slider-nav-wrap') 1280 }); 1281 $('.slider-nav', obj).slick({ 1282 slidesToShow: 2, 1283 slidesToScroll: 1, 1284 speed: 300, 1285 asNavFor: obj.find('.slider-for'), 1286 centerPadding: 0, 1287 dots: false, 1288 centerMode: true, 1289 focusOnSelect: true, 1290 responsive: [{ 1291 breakpoint: 1200, 1292 settings: { 1293 slidesToShow: 2 1294 } 1295 }, { 1296 breakpoint: 991, 1297 settings: { 1298 slidesToShow: 1 1299 } 1300 }, { 1301 breakpoint: 0, 1302 settings: "unslick" 1303 }] 1304 }); 1305 } else { 1306 $('.slider-for', obj).slick({ 1307 slidesToShow: 1, 1308 slidesToScroll: 1, 1309 speed: 300, 1310 fade: true, 1311 adaptiveHeight: true,
1312 arrows: false, 1313 asNavFor: obj.find('.slider-nav'), 1314 appendArrows: obj.find('.slider-nav-wrap') 1315 }); 1316 $('.slider-nav', obj).slick({ 1317 slidesToShow: 3, 1318 slidesToScroll: 1, 1319 speed: 300, 1320 asNavFor: obj.find('.slider-for'), 1321 centerPadding: 0, 1322 dots: false, 1323 centerMode: true, 1324 focusOnSelect: true, 1325 responsive: [{ 1326 breakpoint: 1200, 1327 settings: { 1328 slidesToShow: 3 1329 } 1330 }, { 1331 breakpoint: 991, 1332 settings: { 1333 slidesToShow: 1 1334 } 1335 }, { 1336 breakpoint: 0, 1337 settings: "unslick" 1338 }] 1339 }); 1340 } 1341} 1342 1343function initCSlider(obj) { 1344 1345 var sliderCount = 0; 1346 1347 if (obj.attr("data-count")) 1348 sliderCount = parseInt(obj.attr("data-count")); 1349 1350 1351 1352 if (sliderCount > 1) { 1353 obj.on('init', function (event, slick) { 1354 obj.find(".slick-slide").removeClass('noactive-slide-lazyload'); 1355 obj.addClass("slider-init"); 1356 1357 correctLazyloadInSlider(obj); 1358 if (obj.parents(".parent-video-bg").find(".videoBG").length > 0) { 1359 correctSizeVideoBg(obj.parents(".parent-video-bg").find(".videoBG")); 1360 } 1361 }); 1362 1363 obj.on('beforeChange', function (event, slick, currentSlide, nextSlide) { 1364 correctLazyloadInSlider(obj); 1365 }); 1366 1367 obj.addClass("slider-init"); 1368 1369 obj.slick({ 1370 slidesToShow: 1, 1371 slidesToScroll: 1, 1372 autoplay: false, 1373 dots: true, 1374 infinite: false, 1375 adaptiveHeight: true, 1376 speed: 500, 1377 arrows: true, 1378 responsive: [{ 1379 breakpoint: 767.98, 1380 settings: { 1381 dots: false 1382 } 1383 }] 1384 }); 1385 } else { 1386 obj.find(".slick-slide").removeClass('noactive-slide-lazyload'); 1387 obj.addClass("slider-init"); 1388 } 1389 1390 1391} 1392 1393function initGallerySlider(obj) { 1394 1395 var count = parseInt(obj.attr("data-slide-visible")); 1396 1397 obj.on('init', function (event, slick) { 1398 obj.find(".slick-slide").removeClass('noactive-slide-lazyload'); 1399 obj.addClass("slider-init"); 1400 correctLazyloadInSlider(obj); 1401 if (obj.parents(".parent-video-bg").find(".videoBG").length > 0) { 1402 correctSizeVideoBg(obj.parents(".parent-video-bg").find(".videoBG")); 1403 } 1404 }); 1405 1406 obj.slick({ 1407 dots: true, 1408 adaptiveHeight: true, 1409 slidesToScroll: count, 1410 slidesToShow: count, 1411 responsive: [{ 1412 breakpoint: 767, 1413 settings: { 1414 slidesToShow: 1, 1415 slidesToScroll: 1, 1416 } 1417 }, { 1418 breakpoint: 0, 1419 settings: "unslick" 1420 }] 1421 }); 1422} 1423 1424function initPartnersSlider(obj) { 1425 1426 obj.on('init', function (event, slick) { 1427 obj.find(".slick-slide").removeClass('noactive-slide-lazyload'); 1428 obj.addClass("slider-init"); 1429 correctLazyloadInSlider(obj); 1430 if (obj.parents(".parent-video-bg").find(".videoBG").length > 0) { 1431 correctSizeVideoBg(obj.parents(".parent-video-bg").find(".videoBG")); 1432 } 1433 }); 1434 1435 1436 obj.slick({ 1437 slidesToShow: 6, 1438 slidesToScroll: 1, 1439 dots: false, 1440 infinite: true, 1441 adaptiveHeight: false, 1442 speed: 500, 1443 arrows: true, 1444 responsive: [{ 1445 breakpoint: 1200, 1446 settings: { 1447 slidesToShow: 4, 1448 } 1449 }, { 1450 breakpoint: 767, 1451 settings: { 1452 slidesToShow: 1, 1453 } 1454 }, { 1455 breakpoint: 0, 1456 settings: "unslick" 1457 }] 1458 }); 1459} 1460 1461 1462function setHeightForFirstSlider() { 1463 1464 if ($(window).width() >= 768 || ($(window).width() < 768 && $(".wrap-first-slider").attr("data-full-height") == "Y")) { 1465 1466 var height1 = 0, 1467 height2 = 0, 1468 sizeSlides = $('div.first-slider div.first-block').length; 1469 1470 1471 $('div.first-slider div.first-block').each( 1472 function (index) { 1473 1474 1475 if ($(this).outerHeight() > height2) { 1476 height1 = $(this).height(); 1477 height2 = $(this).outerHeight(); 1478 } 1479 1480 1481 if (sizeSlides == index + 1) { 1482 1483 if (sizeSlides > 1) 1484 $('div.first-slider div.first-block-container').css("height", height1); 1485 1486 if ($(".wrap-first-slider").attr("data-full-height") == "Y") { 1487 if ($(window).height() > $(".wrap-first-slider").height()) 1488 $(".wrap-first-slider").find(".slick-track").css("height", $(window).height() + 1489 "px"); 1490 } 1491 1492 if (($(window).width() < 768 && $(".wrap-first-slider").attr("data-full-height") == "Y")) { 1493 if ($(window).height() > $(".wrap-first-slider").height()) 1494 $(".wrap-first-slider").find(".slick-track").css("height", $(window).height() + 1495 "px"); 1496 } 1497 1498 if ($('div.first-slider div.first-block').find(".videoBG").length > 0) { 1499 $($('div.first-slider div.first-block').find(".videoBG")).each( 1500 function (index) { 1501 correctSizeVideoBg($(this)); 1502 } 1503 ); 1504 } 1505 1506 } 1507 1508 } 1509 ); 1510 1511 } 1512 1513} 1514 1515function initFSlider(obj, size) { 1516 var adaptiveMob = ($(window).width() < 768 && $(".wrap-first-slider").attr("data-full-height") == "Y") ? false : true, 1517 sizeSlides = $('div.first-slider div.first-block').length, 1518 params = {}; 1519 1520 if (size == "lg") { 1521 params = { 1522 dots: false, 1523 infinite: true, 1524 adaptiveHeight: false, 1525 speed: 500, 1526 pauseOnFocus: false, 1527 pauseOnHover: false 1528 }; 1529 } else if (size == "xs") { 1530 params = { 1531 dots: false, 1532 infinite: true, 1533 adaptiveHeight: false, 1534 speed: 500, 1535 pauseOnFocus: false, 1536 pauseOnHover: false, 1537 responsive: [{ 1538 1539 breakpoint: 767, 1540 settings: { 1541 adaptiveHeight: adaptiveMob, 1542 1543 } 1544 1545 }, 1546 { 1547 1548 breakpoint: 0, 1549 settings: "unslick" 1550 1551 } 1552 ] 1553 }; 1554 } 1555 1556 obj.on('init', function (event, slick) { 1557 obj.find(".first-block").removeClass('noactive-slide-lazyload'); 1558 setHeightForFirstSlider(); 1559 1560 }); 1561 1562 1563 if ($(".wrap-first-slider").attr("data-autoslide") == "Y") { 1564 params["autoplaySpeed"] = $(".wrap-first-slider").attr("data-autoslide-time"); 1565 params["autoplay"] = true; 1566 } 1567 1568 obj.slick(params); 1569 1570} 1571 1572function initSlider(obj) { 1573 var speed = 0, 1574 params = { 1575 autoplay: false, 1576 autoplaySpeed: 0, 1577 slidesToShow: 1, 1578 slidesToScroll: 1, 1579 infinite: true, 1580 dots: true, 1581 infinite: true, 1582 adaptiveHeight: false, 1583 speed: 500, 1584 arrows: true, 1585 responsive: [{ 1586 breakpoint: 991, 1587 settings: { 1588 adaptiveHeight: true 1589 } 1590 }, { 1591 breakpoint: 767, 1592 settings: { 1593 dots: false 1594 } 1595 }, { 1596 breakpoint: 0, 1597 settings: "unslick" 1598 }] 1599 }; 1600 1601 if (typeof (obj.attr("data-scroll-speed")) != 'undefined') 1602 speed = +(obj.attr("data-scroll-speed")); 1603 1604 1605 if (obj.attr("data-count") == "1") 1606 params["dots"] = false;
1607 1608 params["autoplay"] = false; 1609 params["autoplaySpeed"] = 0; 1610 1611 if (speed > 0) { 1612 params["autoplay"] = true; 1613 params["autoplaySpeed"] = speed * 1000; 1614 } 1615 1616 obj.on('init', function (event, slick) { 1617 obj.find(".block-slider-item").removeClass('noactive-slide-lazyload'); 1618 obj.addClass("slider-init"); 1619 correctLazyloadInSlider(obj); 1620 if (obj.parents(".parent-video-bg").find(".videoBG").length > 0) { 1621 correctSizeVideoBg(obj.parents(".parent-video-bg").find(".videoBG")); 1622 } 1623 }); 1624 1625 obj.slick(params); 1626} 1627 1628 1629 1630var contentSidePosTop = 0, 1631 contentSidePosBot = 0, 1632 contentSidePosBot = 0, 1633 currentPosTop = 0, 1634 currentPosBot = 0, 1635 headerHeight = 0; 1636 1637 1638function setParamsScrollSide() { 1639 contentSideHeight = $(".parent-fixedSrollBlock").outerHeight(true); 1640 menuSideHeight = $(".selector-fixedSrollBlock-real-height").outerHeight(true); 1641 contentSidePosTop = $(".parent-fixedSrollBlock").offset().top; 1642 contentSidePosBot = contentSidePosTop + contentSideHeight; 1643 currentPosTop = $(document).scrollTop() + headerHeight; 1644 currentPosBot = currentPosTop + menuSideHeight; 1645} 1646 1647 1648function setPositionScrollSide() { 1649 1650 setParamsScrollSide(); 1651 1652 1653 if (contentSideHeight > menuSideHeight && !$(".selector-fixedSrollBlock").hasClass('fixed-finish')) { 1654 1655 if (currentPosTop >= contentSidePosTop && currentPosBot <= contentSidePosBot) { 1656 $(".selector-fixedSrollBlock").removeClass('fixed-stop fixed-start'); 1657 $(".selector-fixedSrollBlock").addClass('fixed-move'); 1658 } else if (currentPosBot >= contentSidePosBot) { 1659 $(".selector-fixedSrollBlock").removeClass('fixed-move fixed-start'); 1660 $(".selector-fixedSrollBlock").addClass('fixed-stop'); 1661 } else { 1662 $(".selector-fixedSrollBlock").removeClass('fixed-move fixed-stop'); 1663 $(".selector-fixedSrollBlock").addClass('fixed-start'); 1664 } 1665 } else { 1666 $(".selector-fixedSrollBlock").removeClass('fixed-move fixed-stop'); 1667 $(".selector-fixedSrollBlock").addClass('fixed-start fixed-finish'); 1668 } 1669} 1670 1671 1672function setHeaderHeight() { 1673 if ($(".fix-board").length > 0) 1674 headerHeight = 69; 1675} 1676 1677function setStartParamsScrollSide() { 1678 $(".selector-fixedSrollBlock").css({ 1679 "width": $(".wrapperWidthFixedSrollBlock").width() + "px", 1680 "top": headerHeight + "px" 1681 }); 1682} 1683 1684function scrollSideInit() { 1685 1686 if ($(".parent-fixedSrollBlock").length && $(window).width() > 1023) { 1687 setStartParamsScrollSide(); 1688 setPositionScrollSide(); 1689 1690 $(window).scroll( 1691 function () { 1692 if ($(".parent-fixedSrollBlock").length) 1693 setPositionScrollSide(); 1694 } 1695 ); 1696 } 1697 1698} 1699 1700 1701function initblueimp() { 1702 setTimeout(function () { 1703 $("body").append('<div class="blueimp-gallery blueimp-gallery-controls" id="blueimp-gallery">' + 1704 '<div class="slides"></div>' + 1705 '<h3 class="title bold"></h3>' + 1706 '<a class="prev"></a>' + 1707 '<a class="next"></a>' + 1708 '<a class="close"></a>' + 1709 '</div>'); 1710 }, 2000); 1711} 1712 1713 1714$(document).ready(function () { 1715 initblueimp(); 1716 setHeaderHeight(); 1717 scrollSideInit(); 1718 correctColsHead(); 1719 1720}); 1721 1722function correctColsHead() { 1723 if ($(".correct-cols-head").length > 0) { 1724 var cols = "", 1725 selector = ""; 1726 1727 $(".correct-cols-head").each(function (index) { 1728 cols = $(this).attr("data-head-cols"); 1729 selector = $(this).attr("data-head-target"); 1730 1731 $("." + selector).addClass(cols); 1732 }); 1733 } 1734} 1735 1736 1737function markProductAddBasket(id) { 1738 arStatusBasketPhoenix = {}; 1739 setInfoBasket("add2Basket"); 1740} 1741 1742function markProductDelayBasket(id, action) { 1743 if (action == 'active') 1744 $('.add2delay[data-item=' + id + ']').addClass('active'); 1745 1746 if (action == 'delete') 1747 $('.add2delay[data-item=' + id + ']').removeClass('active'); 1748 1749 1750 arStatusBasketPhoenix = {}; 1751 setInfoBasket(); 1752} 1753 1754 1755function markProductCompareBasket(id, action) { 1756 if (action == 'active') 1757 $('.add2compare[data-item=' + id + ']').addClass('active'); 1758 1759 if (action == 'delete') 1760 $('.add2compare[data-item=' + id + ']').removeClass('active'); 1761 1762 arStatusBasketPhoenix = {}; 1763 setInfoBasket(); 1764} 1765 1766 1767function delParamURL(url, param) { 1768 var a = url.split('?'); 1769 var re = new RegExp('(\\?|&)' + param + '=[^&]+', 'g'); 1770 1771 if (url == "undefined") 1772 url = ""; 1773 1774 url = ('?' + a[1]).replace(re, ''); 1775 url = url.replace(/^&|\?/, ''); 1776 1777 if (url == "undefined") 1778 url = ""; 1779 1780 var dlm = (url == '') ? '' : '?'; 1781 1782 return a[0] + dlm + url; 1783} 1784 1785function addParam2URL(param, value) { 1786 var url = window.location.href; 1787 1788 if (history.replaceState) { 1789 var baseUrl = delParamURL(url, param); 1790 baseUrl += (baseUrl.split('?')[1] ? '&' : '?') + param + "=" + value; 1791 history.replaceState(null, null, baseUrl); 1792 } else { 1793 console.warn('History API don`t support'); 1794 } 1795} 1796 1797 1798function deleteProduct(id, params) { 1799 1800 params = params || null; 1801 1802 showProcessLoad(); 1803 1804 if (params !== null) { 1805 var productsCount = $("input#products_count"), 1806 delayedCount = $("input#delayed_count"); 1807 1808 if (params.action == "product" && productsCount) 1809 addParam2URL("url-tab", "products"); 1810 1811 else if (params.action == "delayed" && delayedCount) 1812 addParam2URL("url-tab", "delayed"); 1813 1814 else { 1815 addParam2URL("url-tab", "-1"); 1816 } 1817 1818 } 1819 1820 $.ajax({ 1821 url: '/bitrix/tools/concept.phoenix/ajax/basket/delete_product_basket.php', 1822 method: 'POST', 1823 data: { 1824 site_id: $("input.site_id").val(), 1825 id: id 1826 }, 1827 success: function (data) { 1828 1829 closeProcessLoad(); 1830 1831 if (data.OK == "Y") { 1832 arStatusBasketPhoenix = {}; 1833 setInfoBasket(); 1834 } 1835 } 1836 }); 1837} 1838 1839function clearBasket() { 1840 showProcessLoad(); 1841 $.ajax({ 1842 url: '/bitrix/tools/concept.phoenix/ajax/basket/clear_basket.php', 1843 method: 'POST', 1844 data: { 1845 site_id: $("input.site_id").val() 1846 }, 1847 success: function (data) { 1848 closeProcessLoad(); 1849 closeCart(); 1850 arStatusBasketPhoenix = {}; 1851 setInfoBasket(); 1852 } 1853 }); 1854} 1855 1856$(document).on("click", ".basket-item-actions-remove", function () { 1857 arStatusBasketPhoenix = {}; 1858 setInfoBasket(); 1859}); 1860 1861$(document).on("click", ".clear-cart", function () { 1862 1863 clearBasket(); 1864 arStatusBasketPhoenix = {}; 1865 setInfoBasket(); 1866}); 1867 1868 1869function setCountBasket(count, classValue, classParent) { 1870 count = count || 0; 1871 1872 if (count) 1873 $(classParent).addClass('active'); 1874 1875 1876 else { 1877 $(classParent).removeClass('active'); 1878 } 1879 1880 1881 $(classValue).text(count); 1882 1883} 1884 1885function setCountMiniBasket(count) { 1886 count = count || 0; 1887 1888 if (count) 1889 $(".open-cart").removeClass('cart-empty').addClass('no-empty'); 1890 1891 1892 1893 else { 1894 $(".open-cart").removeClass('no-empty').addClass('cart-empty'); 1895 } 1896 1897 1898 $(".open-cart span.count").text(count); 1899 1900} 1901 1902 1903function updateBasket(params) { 1904 1905 /*if($("input#shop-mode").val()!="Y") 1906 return false;*/ 1907 1908 basketPoolQuantity = new BasketPoolQuantity(); 1909 1910 if (params.type_mode == "fly") { 1911 $.post( 1912 '/bitrix/tools/concept.phoenix/ajax/basket/' + params.path, { 1913 site_id: $("input.site_id").val() 1914 }, 1915 function (html) { 1916 $(params.selector).html(html); 1917 basketPoolQuantity = new BasketPoolQuantity(); 1918 } 1919 ); 1920 } else if (params.type_mode == "page") { 1921 var productsCount = 0, 1922 delayed_count = 0; 1923 1924 1925 function updateBasketProductsInfo() { 1926 1927 if ($("#products_count").length > 0) 1928 productsCount = parseInt($("#products_count").val()); 1929 1930 if ($("#delayed_count").length > 0) 1931 delayed_count = parseInt($("#delayed_count").val()); 1932 1933 1934 if (productsCount > 0) 1935 $(".clear-basket-node-control").removeClass("d-none"); 1936 1937 1938 else { 1939 $(".clear-basket-node-control").addClass("d-none"); 1940 } 1941 1942 if (productsCount > 0 || delayed_count > 0) { 1943 $(".basket-style.page .cart-advantage").removeClass('hidden'); 1944 $(".basket-page-header-btn").removeClass('d-none'); 1945 } else { 1946 $(".basket-style.page .cart-advantage").addClass('hidden') 1947 } 1948 1949 1950 if ($("input.basketOrder").length > 0) { 1951 if (productsCount > 0) 1952 $(".basketOrder-body").removeClass('d-none'); 1953 else { 1954 $(".basketOrder-body").addClass('d-none'); 1955 } 1956 } 1957 1958 if (productsCount <= 0 && delayed_count <= 0) { 1959 $(".basket-page-header-btn").addClass('d-none'); 1960 $(".clear-basket-node-control").addClass('d-none'); 1961 1962 if ($("input.basketOrder").length > 0) 1963 $(".basketOrder-side").addClass('d-none'); 1964 1965 } 1966 1967 closeProcessLoad(); 1968 1969 if (params.firstLoad != "Y") { 1970 if ($("input.basketOrder").length > 0 && (productsCount > 0 || delayed_count > 0)) 1971 BX.Sale.OrderAjaxComponent.sendRequest("refreshOrderAjax", "noRedirect"); 1972 } 1973 1974 } 1975 1976 if (params.firstLoad != "Y") { 1977 1978 showProcessLoad(); 1979 $.post( 1980 "/bitrix/tools/concept.phoenix/ajax/basket/" + params.path, { 1981 "site_id": $("input.site_id").val(), 1982 "ajax_content": "products" 1983 }, 1984 function (html) { 1985 1986 $(".body-basket-ajax-left").html(html); 1987 1988 1989 basketPoolQuantity = new BasketPoolQuantity(); 1990 1991 1992 updateBasketProductsInfo(); 1993 1994 1995 1996 1997 $.post( 1998 "/bitrix/tools/concept.phoenix/ajax/basket/" + params.path, { 1999 "site_id": $("input.site_id").val(), 2000 "ajax_content": "side" 2001 }, 2002 function (html) { 2003 2004 $(".body-basket-ajax-right").html(html); 2005 2006 scrollSideInit(); 2007 closeProcessLoad(); 2008 2009 } 2010 ); 2011 2012 } 2013 ); 2014 2015 } else { 2016 2017 updateBasketProductsInfo(); 2018 } 2019 2020 } 2021 2022 2023} 2024 2025function setInfoBasket(param) { 2026 2027 2028 /*if($("input#shop-mode").val()!="Y") 2029 return false;*/ 2030 2031 param = param || ""; 2032 2033 if ($("input#basketPage").length > 0) 2034 showProcessLoad(); 2035 2036 $.ajax({ 2037 url: '/bitrix/tools/concept.phoenix/ajax/basket/get_ajax_basket.php', 2038 method: 'POST', 2039 data: { 2040 iblockID: $("input#catalogIblockID").val(), 2041 site_id: $("input.site_id").val() 2042 }, 2043 success: function (data) { 2044 2045 arStatusBasketPhoenix = data; 2046 setItemButtonStatus(arStatusBasketPhoenix); 2047 setCountMiniBasket(arStatusBasketPhoenix.BASKET_COUNT); 2048 setCountBasket(arStatusBasketPhoenix.BASKET_COUNT, '.count-basket', '.count-basket-items-parent'); 2049 setCountBasket(arStatusBasketPhoenix.DELAY_COUNT, '.count-delay', '.count-delay-parent'); 2050 setCountBasket(arStatusBasketPhoenix.COMPARE_COUNT, '.count-compare', '.count-compare-parent'); 2051 2052 2053 var optBasket = {}; 2054 2055 if ($("input#basketPage").length > 0) { 2056 optBasket = { 2057 "type_mode": "page", 2058 "path": "get_basket_items.php", 2059 "selector": ".body-basket-ajax", 2060 }; 2061 } else { 2062 optBasket = { 2063 "type_mode": "fly", 2064 "path": "get_fly_basket.php", 2065 "selector": ".body-fly-basket-ajax", 2066 }; 2067 } 2068 2069 if (param == "firstLoad") 2070 optBasket["firstLoad"] = "Y"; 2071 2072 updateBasket(optBasket); 2073 2074 if ( 2075 param == "add2Basket" && 2076 $("input#showBasketAfterFirstAdd").val() == "Y" && 2077 arStatusBasketPhoenix.BASKET_COUNT == 1 && 2078 $("input#basketPage").val() != "basket_page" && 2079 $(window).width() > 767 2080 ) { 2081 openCart(); 2082 } 2083 2084 if (arStatusBasketPhoenix.BASKET_COUNT == 0 && param != "firstLoad") 2085 closeCart(); 2086 } 2087 }); 2088} 2089 2090function setItemButtonStatus(data, parent, inBasket, inDelay, inCompare) { 2091 2092 if (inBasket || inDelay || inCompare) { 2093 parent = parent || ''; 2094 2095 if (parent.length > 0) 2096 parent = "#" + parent; 2097 2098 $(parent + ' .add2basket').parents('.catalog-item').removeClass('in-cart'); 2099 $(parent + ' .add2delay').removeClass('active'); 2100 $(parent + ' .add2compare').removeClass('active'); 2101 2102 if (inBasket) 2103 $(parent + ' .add2basket[data-item=' + data + ']').parents('.catalog-item').addClass('in-cart'); 2104 2105 2106 if (inDelay) 2107 $(parent + ' .add2delay[data-item=' + data + ']').addClass('active'); 2108 2109 2110 if (inCompare) 2111 $(parent + ' .add2compare[data-item=' + data + ']').addClass('active'); 2112 2113 2114 } else { 2115 $('.add2basket').parents('.catalog-item').removeClass('in-cart'); 2116 $('.add2delay').removeClass('active'); 2117 $('.add2compare').removeClass('active'); 2118 $('.common-btn-basket-style').removeClass('added'); 2119 2120 2121 if (data.BASKET) { 2122 for (var i in data.BASKET) { 2123 var id = data.BASKET[i]; 2124 if (typeof id === 'number' || typeof id === 'string') { 2125 $('.add2basket[data-item=' + id + ']').parents('.catalog-item').addClass('in-cart'); 2126 $('.common-btn-basket-style[data-item=' + id + ']').addClass('added'); 2127 } 2128 } 2129 } 2130 2131 if (data.DELAY) { 2132 for (var i in data.DELAY) { 2133 var id = data.DELAY[i]; 2134 if (typeof id === 'number' || typeof id === 'string') { 2135 $('.add2delay[data-item=' + id + ']').addClass('active'); 2136 } 2137 } 2138 } 2139 2140 if (data.COMPARE) { 2141 for (var i in data.COMPARE) { 2142 var id = data.COMPARE[i]; 2143 if (typeof id === 'number' || typeof id === 'string') { 2144 $('.add2compare[data-item=' + id + ']').addClass('active'); 2145 } 2146 } 2147 } 2148 } 2149} 2150 2151 2152$(document).ready(function () { 2153 2154 if (device.ios()) 2155 $('div.block.parallax-attachment').removeClass('parallax-attachment'); 2156 2157 2158 if ($('div.first-slider.slider-lg').length > 0) 2159 initFSlider($('div.first-slider.slider-lg'), "lg"); 2160 2161 if ($('div.first-slider.slider-xs').length > 0) 2162 initFSlider($('div.first-slider.slider-xs'), "xs"); 2163 2164 if ($("form.timer_form").length > 0) { 2165 $("form.timer_form").each(function (index) { 2166 timerCookie($(this)); 2167 }); 2168 } 2169 2170 if ($(window).width() > 1024) { 2171 $('.services').find('.service-item').hover(function () { 2172 var element_height = $(this).find('.service-element').height(); 2173 var element_bot_height = $(this).find('.bot-wrap').height(); 2174 var need_height = element_height - element_bot_height; 2175 $(this).css({ 2176 'height': need_height + 'px' 2177 }); 2178 }, function () { 2179 $(this).css({ 2180 'height': 'auto' 2181 }); 2182 }); 2183 } else { 2184 $('.services').find('.service-item').hover(function () { 2185 $(this).css({ 2186 'height': 'auto' 2187 }); 2188 }); 2189 } 2190 2191 if ($("div.expired-page").length) 2192 $("div.expired-page").height($(document).height()); 2193 2194 if ($("div.error-404").length) { 2195 $("html").addClass('height-100'); 2196 $("div.error-404").height($(document).height()); 2197 } 2198 2199 2200 if ($(window).width() > 1199) { 2201 $(document).on({ 2202 mouseenter: fun
2202ction () { 2203 var th = $(this); 2204 $.data(this, 'timer', setTimeout($.proxy(function () { 2205 $(th).parents(".parent-show-board-contact-js").find('.list-contacts').stop(true, 2206 true).addClass('open'); 2207 }, this), 300)); 2208 }, 2209 2210 mouseleave: function () { 2211 clearTimeout($.data(this, 'timer')); 2212 }, 2213 }, 2214 ".show-board-contact-js" 2215 ); 2216 2217 $(document).on({ 2218 mouseleave: function () { 2219 $(this).removeClass('open'); 2220 }, 2221 }, 2222 "header .list-contacts" 2223 ); 2224 2225 2226 $('nav.main-menu > li.parent.view_1').hover(function () { 2227 2228 var th = $(this); 2229 2230 jQuery.data(this, 'timer', setTimeout(jQuery.proxy(function () { 2231 2232 if (th.find("ul.child").length > 0) { 2233 $('ul.child', this).stop(true, true).addClass("show-open"); 2234 menuOffset(this); 2235 if ($('ul.child', this).width() < th.width()) 2236 $('ul.child', this).css('width', th.width()); 2237 } 2238 2239 if (th.hasClass('catalog-view-flat')) { 2240 2241 th.find(".wrapper-catalog-menu-board").addClass('on'); 2242 setTimeout(function () { 2243 th.find(".wrapper-catalog-menu-board").addClass('active'); 2244 $('.lazyload').Lazy(paramsLazy); 2245 }, 100); 2246 2247 } 2248 2249 2250 }, this), 350)); 2251 2252 2253 }, function () { 2254 var th = $(this); 2255 2256 clearTimeout(jQuery.data(this, 'timer')); 2257 2258 if (th.find("ul.child").length > 0) 2259 $('ul.child', this).stop(true, true).removeClass("show-open"); 2260 2261 if (th.hasClass('catalog-view-flat')) { 2262 th.find(".wrapper-catalog-menu-board").removeClass('active'); 2263 setTimeout(function () { 2264 th.find(".wrapper-catalog-menu-board").removeClass('on'); 2265 }, 100); 2266 } 2267 2268 $('.lazyload').Lazy(paramsLazy); 2269 2270 }); 2271 2272 $('nav.main-menu > li.parent.view_2').hover(function () { 2273 2274 var th = $(this); 2275 2276 menuLvls4Selected(th); 2277 2278 jQuery.data(this, 'timer', setTimeout(jQuery.proxy(function () { 2279 2280 th.find(".dropdown-menu-view-2").addClass('on'); 2281 setTimeout(function () { 2282 th.find(".dropdown-menu-view-2").addClass('active'); 2283 $('.lazyload').Lazy(paramsLazy); 2284 }, 100); 2285 2286 2287 }, this), 200)); 2288 2289 2290 }, function () { 2291 var th = $(this); 2292 2293 clearTimeout(jQuery.data(this, 'timer')); 2294 2295 th.find(".dropdown-menu-view-2").removeClass('active'); 2296 setTimeout(function () { 2297 th.find(".dropdown-menu-view-2").removeClass('on'); 2298 }, 100); 2299 2300 2301 }); 2302 2303 2304 2305 $('nav.main-menu ul.child > li.parent2').hover(function () { 2306 jQuery.data(this, 'timer', setTimeout(jQuery.proxy(function () { 2307 $('ul.child2', this).stop(true, true).addClass("show-open"); 2308 menuOffset(this); 2309 }, this), 100)); 2310 }, function () { 2311 clearTimeout(jQuery.data(this, 'timer')); 2312 $('ul.child2', this).stop(true, true).removeClass("show-open"); 2313 }); 2314 } 2315 2316 2317 $('body').append( 2318 '<div class="modalArea modalAreaEmployee"></div><div class="modalArea modalAreaDetail"></div><div class="modalArea modalAreaVideo"></div><div class="modalArea modalAreaForm"></div><div class="modalArea modalAreaWindow"></div><div class="modalArea modalAreaAgreement"></div>' 2319 ); 2320 2321 $.datetimepicker.setLocale('ru'); 2322 $('form.form .date').datetimepicker({ 2323 timepicker: false, 2324 format: 'd/m/Y', 2325 scrollMonth: false, 2326 scrollInput: false, 2327 dayOfWeekStart: 1 2328 }); 2329 if ($(window).width() < 767) { 2330 var anim_callmob_in = setTimeout(function () { 2331 $("#callphone-mob .callphone-desc").show().addClass('active'); 2332 clearTimeout(anim_callmob_in); 2333 }, 5000); 2334 var anim_callmob_out = setTimeout(function () { 2335 $("#callphone-mob .callphone-desc").removeClass('active'); 2336 clearTimeout(anim_callmob_out); 2337 }, 12000); 2338 var anim_callmob_out2 = setTimeout(function () { 2339 $("#callphone-mob .callphone-desc").hide(); 2340 clearTimeout(anim_callmob_out2); 2341 }, 12500); 2342 2343 } 2344 2345 if ($(window).width() > 767) { 2346 $(window).enllax(); 2347 2348 new WOW().init(); 2349 var wow = new WOW({ 2350 boxClass: 'parent-animate', 2351 animateClass: 'animated', 2352 offset: 0, 2353 mobile: true, 2354 live: true, 2355 callback: function (box) { 2356 var sec = 0; 2357 if ($(box).attr("data-delay")) 2358 sec = parseFloat($(box).attr("data-delay")) * 1000; 2359 2360 $("div.child-animate", box).each(function () { 2361 var elem = $(this); 2362 setTimeout(function () { 2363 elem.removeClass("opacity-zero").addClass("animated fadeIn"); 2364 }, sec); 2365 sec += 500; 2366 }); 2367 }, 2368 scrollContainer: null 2369 }); 2370 wow.init(); 2371 } 2372 2373 $('[data-toggle="tooltip"]').tooltip({ 2374 html: true 2375 }); 2376 2377 $('[data-toggle="filter-tooltip"]').tooltip({ 2378 html: true, 2379 container: ".bx-filter-section" 2380 }); 2381 2382 $('[data-toggle="sku-tooltip"]').tooltip({ 2383 html: true 2384 }); 2385 2386 $('[data-toggle="prop-tooltip"]').tooltip({ 2387 html: true 2388 }); 2389 2390 if ($(window).width() > 767) { 2391 setTimeout(function () { 2392 $('div.wrap-scroll-down').addClass('active'); 2393 }, 3000); 2394 } 2395 2396 2397 2398 var url = location.href; 2399 url = url.split("#"); 2400 2401 if (typeof (url[1]) != "undefined" && url[1].length > 0 && url[1].length < 20) { 2402 var urlRes = url[1]; 2403 2404 if (url[1].indexOf('?') !== -1) { 2405 url = url[1].split("?"); 2406 urlRes = url[0]; 2407 } 2408 2409 if ($("#" + urlRes).length > 0) 2410 scrollToBlock("#" + urlRes, false); 2411 } 2412}); 2413 2414$(document).on("click", "div.switcher-wrap div.switcher-title", function () { 2415 var block = $(this).parents("div.switcher-wrap"); 2416 if (!block.hasClass("active")) { 2417 $("div.switcher-content", block).slideDown(200, function () { 2418 block.addClass("active"); 2419 }); 2420 } else { 2421 $("div.switcher-content", block).slideUp(200, function () { 2422 block.removeClass("active"); 2423 }); 2424 } 2425}); 2426 2427function correctSizeVideoBg(obj) { 2428 2429 var height = obj.parents('.parent-video-bg').outerHeight(); 2430 var videoThis = obj.find(".video-bg-display"); 2431 var width = $(window).width(); 2432 var video_w = 0; 2433 var video_h = 0; 2434 var add = 4; 2435 2436 if (width / height < 16 / 9) { 2437 video_w = height * 16 / 9 + add; 2438 video_h = height + add; 2439 } else { 2440 video_w = width + add; 2441 video_h = width * 9 / 16 + add; 2442 } 2443 2444 videoThis.width(video_w).height(video_h); 2445 videoThis.addClass('active'); 2446} 2447 2448 2449 2450function generateVideoBG(container) { 2451 if ($(window).width() >= 1200 || ($(window).width() >= 768 && $(window).width() < 1200 && !device.android() && !device.ios())) { 2452 var videoBG = $(".videoBG", container), 2453 iframeType = videoBG.attr("data-type"), 2454 srcMP4 = videoBG.attr("data-srcMP4"), 2455 srcWEBM = videoBG.attr("data-srcWEBM"), 2456 srcOGG = videoBG.attr("data-srcOGG"), 2457 srcYB = videoBG.attr("data-srcYB"), 2458 html = ""; 2459 2460 2461 2462 if (iframeType == "file") { 2463 if (videoBG.children('video').length <= 0) { 2464 if (srcMP4) 2465 html += '<source src="' + srcMP4 + '" type="video/mp4">'; 2466 2467 if (srcWEBM) 2468 html += '<source src="' + srcWEBM + '" type="video/webm">'; 2469 2470 if (srcOGG) 2471 html += '<source src="' + srcOGG + '" type="video/ogg">'; 2472 2473 2474 html = '<video class="video-bg-display" autoplay="autoplay" loop="loop" preload="auto" muted="muted">' + html + '</video>'; 2475 } 2476 } else if (iframeType == "iframe") { 2477 2478 if (videoBG.children('iframe').length <= 0) { 2479 if (srcYB) 2480 html += '<iframe src="' + srcYB + '" class="video-bg-display" allowfullscreen="" frameborder="0" height="100%" width="100%"></iframe>'; 2481 } 2482 } 2483 2484 if (html)
2485 videoBG.prepend(html); 2486 2487 correctSizeVideoBg(videoBG); 2488 2489 } 2490} 2491 2492function updateMainMenu(menu) { 2493 2494 if (menu.length > 0) { 2495 menu.removeClass('full'); 2496 menu.find('li.lvl1').removeClass('visible'); 2497 menu.parents(".wrap-main-menu").removeClass('ready'); 2498 var totalWidth = menu.parents("td.wrapper-menu").width(); 2499 2500 if ($(document).width() > 767) { 2501 var visible = 0; 2502 var size = menu.find('li.lvl1').length; 2503 2504 menu.find('li.lvl1').each(function (index) { 2505 2506 if (visible > 4) { 2507 menu.addClass('full'); 2508 } 2509 2510 if (totalWidth > ($(this).width())) { 2511 totalWidth = totalWidth - $(this).width(); 2512 2513 $(this).addClass('visible'); 2514 visible++; 2515 2516 if (size == (index + 1)) 2517 menu.parents(".wrap-main-menu").addClass('ready'); 2518 } else { 2519 menu.parents(".wrap-main-menu").addClass('ready'); 2520 return false; 2521 } 2522 }); 2523 } 2524 } 2525} 2526 2527$(document).ready(function () { 2528 updateMainMenu($('nav.main-menu')); 2529}); 2530 2531 2532 2533$(window).on("load", function () { 2534 setInfoBasket("firstLoad"); 2535 2536 if ($(".hide-adv").length > 0) { 2537 setTimeout(function () { 2538 $.post( 2539 "/bitrix/tools/concept.phoenix/ajax/hide_adv.php", { 2540 "check": "Y", 2541 "USER_ID": $(".hide-adv").attr("data-user") 2542 }, 2543 function (data) { 2544 if (data.OK == "Y") { 2545 $("body").append('<script type="text/javascript">
vendor: 287 bytes, line 2545
2545 (function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)}; m[i].l=1*new Date();k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)}) (window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym"); ym(
254554591493
vendor: 76 bytes, line 2545
2545, "init", { clickmap:false, trackLinks:false, accurateTrackBounce:false });
2545</script> <noscript><div><img src="https://mc.yandex.ru/watch/54591493" style="position:absolute; left:-9999px;" alt="" /></div></noscript><script>ym(54591493, "reachGoal", "hide_phoenix");</script>'); 2546 } 2547 }, 2548 "json" 2549 ); 2550 2551 }, 20000); 2552 } 2553 2554}); 2555 2556 2557 2558$(window).scroll(function () { 2559 2560 if ($('header').hasClass('fixed')) { 2561 var headerBotPos = $('header').outerHeight(true) + 150; 2562 2563 if ($(window).scrollTop() >= headerBotPos) { 2564 $('header').addClass('top'); 2565 setTimeout(function () { 2566 $('header').addClass('on'); 2567 }, 100); 2568 } else { 2569 $('header').removeClass('top'); 2570 setTimeout(function () { 2571 $('header').removeClass('on'); 2572 }, 50); 2573 } 2574 } 2575 2576 var top = $(document).scrollTop(); 2577 var height = $('header').height(); 2578 2579 if (top >= height) 2580 $('a.up').addClass('on'); 2581 else { 2582 $('a.up').removeClass('on'); 2583 } 2584 2585 2586 2587}); 2588 2589 2590 2591 2592var windowWidth = $(window).width(); 2593 2594$(window).resize(function () { 2595 phoenixResizeVideo(); 2596 2597 if (windowWidth != $(window).width()) { 2598 mobileMenuPositionFooter(); 2599 updateMainMenu($('nav.main-menu')); 2600 } 2601}); 2602 2603if ($(window).width() < 1199) { 2604 $(document).on("click", "header .open-list-contact", function () { 2605 $("header div.list-contacts").addClass('open'); 2606 }); 2607 $(document).mouseup(function (e) { 2608 var div = $("header div.list-contacts"); 2609 if (!div.is(e.target) && div.has(e.target).length === 0) div.removeClass( 2610 'open'); 2611 }); 2612 2613 $(document).on("click", "nav.main-menu li.parent.view_1", function () { 2614 var menu = $(this).parents('nav.main-menu'); 2615 if (!$(this).children('a').hasClass("open")) { 2616 $('li.parent', menu).find("ul.child").removeClass("show-open").find( 2617 "ul.child2").removeClass("show-open"); 2618 $('li.parent > a', menu).removeClass("open"); 2619 $(this).find("ul.child").addClass("show-open"); 2620 $(this).children('a').addClass("open"); 2621 menuOffset(this); 2622 return false; 2623 } 2624 }); 2625 2626 2627 $(document).on("click", "nav.main-menu li.parent.view_2", function () { 2628 2629 if (!$(this).children('a').hasClass("open")) { 2630 $(this).children('a').addClass("open"); 2631 2632 var th = $(this); 2633 2634 menuLvls4Selected(th); 2635 2636 $('.lazyload').Lazy(paramsLazy); 2637 $(this).find(".dropdown-menu-view-2").addClass('on'); 2638 setTimeout(function () { 2639 th.find(".dropdown-menu-view-2").addClass('active'); 2640 }, 100); 2641 2642 return false; 2643 } 2644 }); 2645 $(document).on("click", "nav.main-menu li.parent2", function () { 2646 2647 var menu = $(this).parents('nav.main-menu'); 2648 var menu_list = $("ul.child > li.parent2", menu); 2649 2650 2651 2652 if (!$(this).children('a').hasClass("open")) { 2653 2654 if ($(this).find("ul.child").length > 0) { 2655 menu.find("ul.child2").removeClass("show-open"); 2656 $(this).find("ul.child2").addClass("show-open"); 2657 menuOffset(this); 2658 } 2659 2660 2661 $("a", menu_list).removeClass("open"); 2662 $(this).children('a').addClass("open"); 2663 2664 2665 return false; 2666 } 2667 }); 2668 $(document).mouseup(function (e) { 2669 var div = $("nav.main-menu"); 2670 if (!div.is(e.target) && div.has(e.target).length === 0) { 2671 $('li.parent > a', div).removeClass("open"); 2672 $("ul.child", div).removeClass("show-open"); 2673 $('li.parent2 > a', div).removeClass("open"); 2674 $("ul.child2", div).removeClass("show-open"); 2675 2676 if ($("li.parent", div).hasClass('catalog-view-flat')) { 2677 $("li.parent", div).find(".wrapper-catalog-menu-board").removeClass('active'); 2678 setTimeout(function () { 2679 $("li.parent", div).find(".wrapper-catalog-menu-board").removeClass('on'); 2680 }, 100); 2681 2682 } 2683 } 2684 }); 2685} 2686 2687 2688 2689$(document).on("click", ".universal-arrows-mini .arrow-prev", function () { 2690 $(this).parents(".universal-parent-slider").find('.universal-slider').slick("slickPrev"); 2691}); 2692$(document).on("click", ".universal-arrows-mini .arrow-next", function () { 2693 $(this).parents('.universal-parent-slider').find('.universal-slider').slick("slickNext"); 2694}); 2695 2696$(document).on("click", ".cart-show", function () { 2697 2698 if ($(this).hasClass('cart-empty')) 2699 return false;
2700 2701 openCart(); 2702}); 2703 2704$(document).on("click", ".cart-close", function () { 2705 closeCart(); 2706}); 2707 2708$(document).on("keypress", "input.count-val", function (e) { 2709 e = e || event; 2710 2711 if (e.ctrlKey || e.altKey || e.metaKey) return; 2712 2713 var chr = getChar(e); 2714 2715 if (chr == null) return false; 2716}); 2717 2718 2719$(document).on('click', 'ul.switcher-tab li:not(.active)', function () { 2720 $(this).addClass('active').siblings().removeClass('active').closest( 2721 'div.switcher').find('div.switcher-wrap').removeClass('active').eq($(this) 2722 .index()).addClass('active'); 2723}); 2724 2725$(document).on('click', 'a.map-show', function () { 2726 $(this).parent().hide(); 2727 $(this).parents('div.map-block').find(".map-height").show(); 2728}); 2729 2730 2731 2732$(document).on("click", ".bl-txt .wr-tabs li:not(.active)", function () { 2733 2734 var img = $(this).closest('.wr-tabs').find('img').eq($(this).index()); 2735 2736 $(this).addClass('active').siblings().removeClass('active').closest( 2737 '.wr-tabs').find('img').removeClass( 2738 'active').eq($(this).index()).addClass('active'); 2739 2740 if (img.attr("data-src")) 2741 $(img).Lazy(); 2742 2743 2744}); 2745 2746$(document).on("click", ".bl-txt .wr-tabs .title-mobile", function () { 2747 2748 var block = $(this).parent(".item"); 2749 2750 if (!$(this).hasClass("active")) { 2751 2752 if ($("img", block).attr("data-src")) { 2753 var _this = $(this); 2754 2755 $("img", block).Lazy({ 2756 afterLoad: function (element) { 2757 $("img", block).removeAttr('style'); 2758 2759 _this.addClass("active"); 2760 2761 $("img", block).slideDown(200, function () { 2762 $(this).addClass("active"); 2763 }); 2764 2765 2766 } 2767 }); 2768 } else { 2769 $(this).addClass("active"); 2770 $("img", block).slideDown(200, function () { 2771 $(this).addClass("active"); 2772 }); 2773 } 2774 2775 } else { 2776 $(this).removeClass("active"); 2777 $("img", block).slideUp(200, function () { 2778 $(this).removeClass("active"); 2779 }); 2780 } 2781 2782}); 2783 2784$(document).on("click", "div.wrap-scroll-down .scroll-down", function () { 2785 var s_b = $(this).parents('div.parent-scroll-down').next(), 2786 heightOut = 70, 2787 destination = null; 2788 2789 while (s_b.hasClass('hidden-lg')) { 2790 s_b = s_b.next(); 2791 } 2792 2793 destination = $(s_b).offset().top - heightOut; 2794 2795 $("html:not(:animated),body:not(:animated)").animate({ 2796 scrollTop: destination 2797 }, 700); 2798}); 2799 2800$(document).on('click', '.open-main-menu', function () { 2801 if ($(window).width() <= 767) { 2802 $('div.open-menu-mobile').addClass('show-open'); 2803 setTimeout(function () { 2804 $('div.open-menu-mobile.show-open').addClass('on'); 2805 }, 50); 2806 setTimeout(function () { 2807 $('a.close-menu.mobile').addClass('on'); 2808 }, 1000); 2809 setTimeout(function () { 2810 mobileMenuPositionFooter(); 2811 }, 100); 2812 $('body').addClass('modal-open'); 2813 } else { 2814 $('div.open-menu').addClass('show-open'); 2815 setTimeout(function () { 2816 openMenuFooterPos(); 2817 }, 100); 2818 setTimeout(function () { 2819 $('div.open-menu').addClass('on'); 2820 }, 150); 2821 $('div.wrapper').addClass('blur'); 2822 $('div.menu-shadow').addClass('show-open'); 2823 $('body').addClass('modal-open'); 2824 $(".open-cart").addClass('off'); 2825 } 2826 2827 $('.lazyload').Lazy(paramsLazy); 2828}); 2829 2830$(document).on('click', '.close-menu', function () { 2831 if ($(window).width() <= 767) { 2832 $('div.open-menu-mobile').removeClass('on'); 2833 $('body').removeClass('modal-open'); 2834 $('a.close-menu.mobile').removeClass('on'); 2835 setTimeout(function () { 2836 $('div.open-menu-mobile.show-open').removeClass('show-open'); 2837 }, 500); 2838 } else { 2839 $('div.wrapper').removeClass('blur'); 2840 $('div.open-menu').removeClass('show-open'); 2841 $('div.menu-shadow').removeClass('show-open'); 2842 $('body').removeClass('modal-open'); 2843 $(".open-cart").removeClass('off'); 2844 } 2845}); 2846 2847$(document).on('click', '.close-menu-js.open', function () { 2848 2849 $('div.wrapper').removeClass('blur'); 2850 $('div.open-menu').removeClass('show-open'); 2851 $('div.menu-shadow').removeClass('show-open'); 2852 $('body').removeClass('modal-open'); 2853 $(".open-cart").removeClass('off'); 2854 2855}); 2856 2857$(document).on('click', '.close-menu-mobile-js', function () { 2858 2859 $('div.open-menu-mobile').removeClass('on'); 2860 $('body').removeClass('modal-open'); 2861 $('a.close-menu.mobile').removeClass('on'); 2862 setTimeout(function () { 2863 $('div.open-menu-mobile.show-open').removeClass('show-open'); 2864 }, 500); 2865 2866}); 2867 2868 2869$(document).on("click", "div.list-menu li.parent", function () { 2870 var menu = $(this).parents('div.list-menu'); 2871 var Li = $(this); 2872 menu.find('ul.child2').slideUp(200); 2873 if (!$(this).children('a').hasClass("open")) { 2874 $('li.parent > a', menu).removeClass("open"); 2875 $("ul.child2", Li).slideDown(200); 2876 $(this).children('a').addClass("open"); 2877 return false;
2878 } else if ($(this).children('a').hasClass("empty-link")) { 2879 menu.find('ul.child2').slideUp(200); 2880 $('li.parent > a', menu).removeClass("open"); 2881 } 2882}); 2883 2884$(document).on('click', 'a.open-mobile-list', function () { 2885 $('ul.mobile-menu-list').removeClass('show-open'); 2886 $("ul.mobile-menu-list[data-menu-list='" + $(this).attr('data-menu-list') + 2887 "']").addClass('show-open'); 2888 mobileMenuPositionFooter(); 2889}); 2890 2891$(document).on('click', 'div.open-menu-mobile div.open-list-contact', function () { 2892 var btn = $(this); 2893 2894 btn.parents('div.contacts').find('div.list-contacts').addClass('open'); 2895 btn.hide(); 2896 2897 if (btn.parents('div.contacts').find(".iframe-map-area").length > 0) 2898 generateMaps(btn.parents('div.contacts').find(".contact-wrap.map")); 2899 2900 mobileMenuPositionFooter(); 2901}); 2902 2903$(document).on("click", ".scroll-after", function () { 2904 var elementClick = $(this).attr("href"); 2905 2906 setTimeout(function () { 2907 scrollToBlock(elementClick, $(this)); 2908 }, 200); 2909 return false; 2910}); 2911 2912$(document).on("click", "a.scroll", function () { 2913 var elementClick = $(this).attr("href"); 2914 scrollToBlock(elementClick, $(this)); 2915 2916 if ($(this).hasClass('from-modal')) { 2917 $('div.no-click-block').removeClass('on'); 2918 $('body').removeClass('modal-open'); 2919 $('div.wrapper').removeClass('blur'); 2920 if (device.ios()) { 2921 window.scrollTo(0, cur_pos); 2922 $("body").removeClass("modal-ios"); 2923 } 2924 2925 if ($(this).parents(".container-close-from-scroll").length > 0) 2926 $(this).parents(".container-close-from-scroll").addClass('d-none'); 2927 2928 } 2929 2930 return false; 2931}); 2932 2933$(document).on('click', 'div.tab-child:not(.active)', function () { 2934 $(this).addClass('active').siblings().removeClass('active').closest( 2935 'div.tab-parent').find('div.tab-content').removeClass('active').eq($(this) 2936 .index()).addClass('active'); 2937}); 2938 2939$(document).on('click', '.select-list-choose', function () { 2940 $(this).parents('.form-select').addClass('open'); 2941}); 2942 2943$(document).on('click', '.ar-down', function () { 2944 if ($(this).parents('.form-select').hasClass('open')) $(this).parents( 2945 '.form-select').removeClass('open'); 2946 else { 2947 $(this).parents('.form-select').addClass('open'); 2948 } 2949}); 2950 2951$(document).on('click', '.form-select .name', function () { 2952 $(this).parents('.form-select').find('.select-list-choose').removeClass( 2953 'first').find(".list-area").text($(this).text()); 2954 $(this).parents('.form-select').removeClass('open'); 2955}); 2956 2957 2958function callModal(arParams) { 2959 showProcessLoad(); 2960 2961 2962 $.post("/bitrix/tools/concept.phoenix/ajax/popup/" + arParams.path, { 2963 arParams: arParams, 2964 platform: arParams["platform"], 2965 site_id: $("input.site_id").val() 2966 }, 2967 function (html) { 2968 closeProcessLoad(); 2969 2970 startBlurWrapperContainer(); 2971 2972 $('div.' + arParams.container).html(html); 2973 2974 setTimeout(function () { 2975 $('div.' + arParams.container).find('.phoenix-modal').addClass('active'); 2976 }, 100); 2977 2978 2979 if (arParams.from_modal == "Y") { 2980 $('div.' + arParams.container).find('.close-modal').addClass('remove-blur-container').attr('data-blur-container', arParams.element_id); 2981 } 2982 2983 if (arParams.container == 'modalAreaForm') { 2984 /*$('div.' + arParams.container).find("form input[name='url']").val(location.href);*/ 2985 2986 $('div.modalAreaForm form.form .date').datetimepicker({ 2987 timepicker: false, 2988 format: 'd/m/Y', 2989 scrollMonth: false, 2990 scrollInput: false, 2991 dayOfWeekStart: 1 2992 }); 2993 } 2994 2995 2996 2997 if (typeof (arParams.header) != "undefined") { 2998 if (arParams.header.length > 0) { 2999 $('div.' + arParams.container).find('input[name="header"]').val(arParams.header); 3000 } 3001 3002 } 3003 3004 }); 3005 3006} 3007 3008$(document).on('click', '.call-modal', function () { 3009 var arParams = {}, 3010 element_id = $(this).attr("data-call-modal"), 3011 platform = $(this).attr("data-video-platform"), 3012 all_id = $(this).attr("data-all-id"); 3013 3014 3015 if ($(this).hasClass('callform')) {
3016 arParams["path"] = "formmodal.php"; 3017 arParams["element_id"] = element_id.replace("form", ""); 3018 arParams["container"] = "modalAreaForm"; 3019 } 3020 3021 else if ($(this).hasClass('callvideo')) { 3022 arParams["path"] = "videomodal.php"; 3023 arParams["element_id"] = element_id; 3024 arParams["container"] = "modalAreaVideo"; 3025 arParams["platform"] = platform; 3026 } 3027 3028 else if ($(this).hasClass('callmodal')) { 3029 arParams["path"] = "windowmodal.php"; 3030 arParams["element_id"] = element_id.replace("modal", ""); 3031 arParams["container"] = "modalAreaWindow"; 3032 } 3033 else if ($(this).hasClass('callagreement')) { 3034 arParams["path"] = "agreemodal.php"; 3035 arParams["element_id"] = element_id.replace("agreement", ""); 3036 arParams["container"] = "modalAreaAgreement"; 3037 } 3038 else if ($(this).hasClass('callemployee')) { 3039 arParams["path"] = "employee.php"; 3040 arParams["element_id"] = element_id; 3041 arParams["container"] = "modalAreaEmployee"; 3042 if(all_id) 3043 arParams["all_id"] = all_id; 3044 } 3045 3046 3047 if ($(this).hasClass("element-item")) { 3048 arParams["element_item_id"] = $(this).attr("data-element-item-id"); 3049 arParams["element_item_type"] = $(this).attr("data-element-item-type"); 3050 arParams["element_item_name"] = $(this).attr("data-element-item-name"); 3051 arParams["element_item_price"] = $(this).attr("data-element-item-price"); 3052 } 3053 3054 3055 3056 if (typeof ($(this).attr("data-header")) != "undefined") { 3057 if ($(this).attr("data-header").length > 0) { 3058 arParams["header"] = $(this).attr("data-header"); 3059 } 3060 3061 } 3062 3063 3064 arParams["from_modal"] = "N"; 3065 3066 if ($(this).hasClass("from-modal")) { 3067 arParams["from_modal"] = "Y"; 3068 $(this).parents(".blur-container").addClass('blur-active').attr("data-blur-container", arParams["element_id"]); 3069 } 3070 3071 3072 callModal(arParams); 3073 3074}); 3075 3076function resetCustomDynamicInputs(){ 3077 for (var i = 1; i <= 3; i++) { 3078 $('#custom-dynamic-input-'+i).val(''); 3079 } 3080} 3081 3082 3083$(document).on('click', '.close-modal', function () { 3084 $('div.modalAreaForm form.form .date').datetimepicker('destroy'); 3085 3086 if ($(this).hasClass('remove-blur-container')) { 3087 $(".blur-container[data-blur-container='" + $(this).attr("data-blur-container") + "']").removeClass('blur-active'); 3088 } else { 3089 stopBlurWrapperContainer(); 3090 } 3091 3092 3093 if ($(this).hasClass('wind-close')) 3094 $(this).parents("div.shadow-modal-wind-contact").removeClass('on'); 3095 else { 3096 $(this).parents("div.modalArea").children().remove(); 3097 } 3098 3099 resetCustomDynamicInputs(); 3100 3101}); 3102 3103$(document).on('click', '.open_modal_contacts', function () { 3104 $('div.shadow-modal-wind-contact').addClass('on'); 3105 3106 startBlurWrapperContainer(); 3107}); 3108 3109$(document).on('click', '.tab-menu', function () { 3110 $(this).parents('.tab-control').find('.tab-menu').removeClass('active'); 3111 $(this).parents('.tab-control').find('.tabb-content').removeClass('active'); 3112 $(this).addClass('active'); 3113 $('.tabb-content[data-tab="' + $(this).attr("data-tab") + '"]').addClass( 3114 'active'); 3115}); 3116 3117 3118$(document).on('click', '.show-hidden', function () { 3119 3120 if ($(this).parent().hasClass('off')) { 3121 $(this).parents('.show-hidden-parent').find('.show-hidden-child').addClass( 3122 'hidden'); 3123 $(this).parent().removeClass('off'); 3124 } else { 3125 $(this).parents('.show-hidden-parent').find('.show-hidden-child').removeClass( 3126 'hidden'); 3127 $(this).parent().addClass('off'); 3128 } 3129}); 3130 3131$(document).on("click", ".click-slide-show", function () { 3132 var block = $(this).parent(".parent-slide-show"); 3133 if (!$(this).hasClass("active")) { 3134 $(this).addClass("active"); 3135 $(".content-slide-show", block).slideDown(200, function () { 3136 $(this).addClass("active"); 3137 }); 3138 } else { 3139 $(this).removeClass("active"); 3140 $(".content-slide-show", block).slideUp(200, function () { 3141 $(this).removeClass("active"); 3142 }); 3143 } 3144}); 3145 3146Share = { 3147 vkontakte: function (purl, ptitle, pimg, text) { 3148 url = 'http://vkontakte.ru/share.php?'; 3149 url += 'url=' + encodeURIComponent(purl); 3150 url += '&title=' + encodeURIComponent(ptitle); 3151 url += '&description=' + encodeURIComponent(text); 3152 url += '&image=' + encodeURIComponent(pimg); 3153 url += '&noparse=true'; 3154 Share.popup(url); 3155 }, 3156 facebook: function (purl, ptitle, pimg, text) { 3157 url = 'https://www.facebook.com/sharer/sharer.php?'; 3158 url += '&title=' + encodeURIComponent(ptitle); 3159 url += '&description=' + encodeURIComponent(text); 3160 url += '&u=' + encodeURIComponent(purl); 3161 url += '&picture=' + encodeURIComponent(pimg); 3162 Share.popup(url); 3163 }, 3164 twitter: function (purl, ptitle) { 3165 url = 'http://twitter.com/share?'; 3166 url += 'text=' + encodeURIComponent(ptitle); 3167 url += '&url=' + encodeURIComponent(purl); 3168 url += '&counturl=' + encodeURIComponent(purl); 3169 Share.popup(url); 3170 }, 3171 3172 ok: function (purl, ptitle) { 3173 url = 'https://connect.ok.ru/dk?st.cmd=WidgetSharePreview'; 3174 url += '&st.title=' + encodeURIComponent(ptitle); 3175 url += '&st.shareUrl=' + encodeURIComponent(purl); 3176 Share.popup(url); 3177 }, 3178 3179 mailRu: function (purl, ptitle) { 3180 url = 'https://connect.mail.ru/share?'; 3181 url += '&url=' + encodeURIComponent(purl); 3182 url += '&title=' + encodeURIComponent(ptitle); 3183 Share.popup(url); 3184 }, 3185 3186 wtsApp: function (purl, ptitle) {
3187 url = 'https://api.whatsapp.com/send?'; 3188 url += '&text=' + encodeURIComponent(ptitle) + ' ' + encodeURIComponent(purl); 3189 Share.popup(url); 3190 }, 3191 3192 telegram: function (purl, ptitle) { 3193 url = 'https://telegram.me/share/url?'; 3194 url += 'url=' + encodeURIComponent(purl); 3195 url += '&text=' + encodeURIComponent(ptitle); 3196 Share.popup(url); 3197 }, 3198 skype: function (purl) { 3199 url = 'https://web.skype.com/share?'; 3200 url += 'url=' + encodeURIComponent(purl); 3201 Share.popup(url); 3202 }, 3203 gPlus: function (purl) { 3204 url = 'https://plus.google.com/share?'; 3205 url += 'url=' + encodeURIComponent(purl); 3206 Share.popup(url); 3207 }, 3208 3209 reddit: function (purl) { 3210 url = 'https://www.reddit.com/submit?'; 3211 url += 'url=' + encodeURIComponent(purl); 3212 Share.popup(url); 3213 }, 3214 3215 popup: function (url) { 3216 window.open(url, '', 'toolbar=0,status=0,width=626,height=436'); 3217 } 3218}; 3219 3220$(document).on('click', '.click-show-pic', function () { 3221 $(this).parents('.parent-show-pic').find('.item-show-pic').removeClass( 3222 'active'); 3223 $(this).parents('.parent-show-pic').find('.click-show-pic').removeClass( 3224 'active'); 3225 $(this).parents('.parent-show-pic').find('.item-show-pic[data-show-pic="' + 3226 $(this).attr("data-show-pic") + '"]').addClass('active'); 3227 $(this).addClass('active'); 3228}); 3229 3230$(document).on('click', '.scroll-next', function () { 3231 var dist = $(this).parents('.scroll-next-parent').next().offset().top - 40; 3232 if ($("header").hasClass("fixed")) dist -= 70; 3233 $("html:not(:animated),body:not(:animated)").animate({ 3234 scrollTop: dist 3235 }, 700); 3236}); 3237 3238$(document).on("click", ".phoenix-alert-btn", function () { 3239 $("div.alert-block div.phoenix-alert-btn").addClass("on"); 3240 $("div.alert-block div.alert-block-content").addClass("on"); 3241}); 3242 3243$(document).on("click", "a.alert-close", function () { 3244 $("div.alert-block div.phoenix-alert-btn").removeClass("on"); 3245 $("div.alert-block div.alert-block-content").removeClass("on"); 3246}); 3247 3248 3249 3250var mouseUp = (device.ios()) ? "touchend" : "mouseup"; 3251 3252$(document).on(mouseUp, function (e) { 3253 3254 var div = $(".form-select"); 3255 if (!div.is(e.target) && div.has(e.target).length === 0) 3256 div.removeClass('open'); 3257 3258 3259 var div2 = $(".search-list"); 3260 if (!div2.is(e.target) && div2.hasClass("active")) 3261 div2.removeClass('active'); 3262 3263 3264 var search_top_js = $(".search-top-js"); 3265 3266 if (!search_top_js.is(e.target) && search_top_js.has(e.target).length === 0) { 3267 if (search_top_js.hasClass("active")) { 3268 search_top_js.removeClass('active'); 3269 $(".no-click-block").removeClass('on'); 3270 3271 if (!$('.open-menu').hasClass('show-open')) 3272 stopBlurWrapperContainer(); 3273 3274 if ($('.open-menu').hasClass('show-open')) 3275 $('.open-menu').removeClass('blur-active'); 3276 3277 var st = setTimeout(function () { 3278 search_top_js.removeClass('fixed'); 3279 clearTimeout(st); 3280 }, 100); 3281 3282 $(".ajax-search-results").hide(); 3283 } 3284 } 3285 3286 var bxFilterSearch = $(".bx-filter-popup-result"); 3287 if (!bxFilterSearch.is(e.target)) 3288 bxFilterSearch.hide(); 3289 3290 3291 var selectInputSku = $(".wrapper-select-input"); 3292 if (!selectInputSku.is(e.target) && selectInputSku.has(e.target).length === 0) 3293 selectInputSku.removeClass('open'); 3294 3295 var checboxReq = $(".check-require.has-error"); 3296 if (!checboxReq.is(e.target)) 3297 checboxReq.removeClass('has-error'); 3298 3299 3300 var selectReq = $(".form-select.has-error"); 3301 if (!selectReq.is(e.target)) 3302 selectReq.removeClass('has-error'); 3303 3304}); 3305 3306 3307 3308 3309$(document).on('change', ".cart-choose-select", function () { 3310 $(this).parents(".parent-choose-select").find(".inp-show-js").removeClass( 3311 'active'); 3312 $(this).parents(".parent-choose-select").find( 3313 ".inp-show-js[data-choose-select='" + $(this).attr("data-choose-select") + 3314 "']").addClass('active'); 3315}); 3316 3317 3318$(document).on("click", ".search-icon-js", function () { 3319 $(this).parents(".search-input-box").find(".search-js").focus(); 3320 scrollToBlock($(this).parents(".search-input-box").find(".search-scroll-focus"), '', 40); 3321}); 3322 3323$(document).on("click", ".show-search-list", function () { 3324 $(this).parents(".show-search-list-parent").find(".search-list").addClass('active'); 3325}); 3326 3327 3328 3329 3330 3331 3332function checkInput(input) { 3333 if (input.val().length > 0) { 3334 input.parents('.search-panel-js').find('.hint-area').hide(); 3335 input.parents('.search-panel-js').find('.search-btns-box').addClass('before-active'); 3336 3337 var timeOut = setTimeout( 3338 function () { 3339 input.parents('.search-panel-js').find('.search-btns-box').addClass('active'); 3340 clearTimeout(timeOut); 3341 }, 100); 3342 } else { 3343 input.parents('.search-panel-js').find('.search-btns-box').removeClass('before-active active'); 3344 input.parents('.search-panel-js').find('.hint-area').show(); 3345 } 3346 3347} 3348$(document).on("keyup", "form.search-form input.search-js", 3349 function () { 3350 checkInput($(this)); 3351 } 3352); 3353 3354$('form.search-form input.search-js').focusout(function () { 3355 checkInput($(this)); 3356}); 3357 3358$(document).on("click", "input.search-scroll-focus", function () { 3359 scrollToBlock($(this), '', 40); 3360}); 3361 3362$(document).on("focus", "form.search-form.fix-header input.search-js", function () { 3363 $(this).parents("form.search-form.fix-header").addClass('focus'); 3364}); 3365 3366$(document).on("focusout", 'form.search-form.fix-header input.search-js', function () { 3367 if ($(this).val().length <= 0) 3368 $(this).parents("form.search-form.fix-header").removeClass('focus'); 3369}); 3370 3371 3372 3373 3374$(document).on("click", ".open-search-top", function () { 3375 $(".search-top-js").addClass('fixed'); 3376 3377 if ($('.open-menu').hasClass('show-open')) 3378 $('.open-menu').addClass('blur-active'); 3379 3380 else { 3381 startBlurWrapperContainer(); 3382 } 3383 3384 var st = setTimeout(function () { 3385 $(".no-click-block").addClass('on'); 3386 $(".search-top-js").addClass('active'); 3387 $(".search-top-js").find('input.search-js').focus(); 3388 clearTimeout(st); 3389 }, 100); 3390}); 3391$(document).on("click", ".close-search-top", function () { 3392 $(this).parents(".search-top-js").removeClass('active'); 3393 var th = $(this); 3394 $(".no-click-block").removeClass('on'); 3395 3396 if ($('.open-menu').hasClass('show-open')) 3397 $('.open-menu').removeClass('blur-active'); 3398 else { 3399 stopBlurWrapperContainer(); 3400 } 3401 3402 var st = setTimeout(function () { 3403 th.parents(".search-top-js").removeClass('fixed'); 3404 clearTimeout(st); 3405 }, 100); 3406 $(".ajax-search-results").hide(); 3407}); 3408 3409 3410 3411 3412 3413function showContentCtTab(th, param, blockID) { 3414 if (typeof param != 'undefined') { 3415 3416 if (param.length > 0) { 3417 th = th || ""; 3418 3419 if (th.length > 0) { 3420 th.parents(".parent-tab").find(".tab-section").removeClass('active'); 3421 th.addClass('active'); 3422 3423 th.parents(".parent-tab").find(".tab-element").removeClass('active'); 3424 th.parents(".parent-tab").find(".tab-element." + th.attr("data-tab")).addClass('active'); 3425 } else { 3426 var head = ""; 3427 3428 3429 if (param.length > 0) { 3430 blockID = blockID || ""; 3431 3432 head = $("#" + blockID).find(".parent-tab"); 3433 } else { 3434 head = $(".parent-tab"); 3435 } 3436 3437 head.find(".tab-section").removeClass('active'); 3438 head.find(".tab-section[data-tab=" + param + "]").addClass('active'); 3439 3440 head.find(".tab-element").removeClass('active'); 3441 head.find(".tab-element." + param).addClass('active'); 3442 } 3443 3444 $('.lazyload').Lazy(paramsLazy); 3445 3446 } 3447 } 3448} 3449$(document).on("click", ".tab-section", 3450 function () { 3451 showContentCtTab($(this), $(this).attr("data-tab")); 3452 } 3453); 3454 3455function getUrlParams() { 3456 var params = window 3457 .location 3458 .search 3459 .replace('?', '') 3460 .split('&') 3461 .reduce( 3462 function (p, e) { 3463 var a = e.split('='); 3464 p[a[0]] = a[1]; 3465 return p; 3466 }, {} 3467 ); 3468 3469 return params; 3470} 3471 3472$(document).ready(function () { 3473 3474 var params = getUrlParams(); 3475 3476 showContentCtTab("", params["ct_tab"], params["ct_tab_blockID"]); 3477 3478}); 3479 3480(function (window) { 3481 3482 3483 window.JCCatalogElement = function (arParams) {
3484 this.element = arParams; 3485 this.nodes = {}; 3486 this.currentElement = {}; 3487 this.oldElement = {}; 3488 this.errorCode = 0; 3489 this.firstLoad = true; 3490 this.selectedValues = {}; 3491 3492 if (typeof arParams === 'object') { 3493 this.initConfig(); 3494 3495 switch (this.element.PRODUCT_TYPE) { 3496 case 0: 3497 case 1: 3498 case 2: 3499 this.initProductData(); 3500 break; 3501 case 3: 3502 this.initOffersData(); 3503 break; 3504 default: 3505 this.errorCode = -1; 3506 } 3507 } 3508 3509 if (this.errorCode === 0) 3510 BX.ready(BX.delegate(this.init, this)); 3511 3512 }; 3513 3514 window.JCCatalogElement.prototype = { 3515 initConfig: function () { 3516 this.nodes.obProduct = BX(this.element.VISUAL.ID); 3517 3518 3519 if (!this.nodes.obProduct) 3520 this.errorCode = -1; 3521 3522 3523 this.element.PRODUCT_TYPE = parseInt(this.element.PRODUCT_TYPE, 10); 3524 3525 this.nodes.obBigSlider = BX(this.element.VISUAL.BIG_SLIDER); 3526 this.nodes.obBasketActions = BX(this.element.VISUAL.BASKET_ACTIONS); 3527 this.nodes.obPreorderBtn = BX(this.element.VISUAL.PREORDER); 3528 this.nodes.obWrPreorderBtn = this.nodes.obPreorderBtn.parentNode; 3529 this.nodes.obPreorderBtn && BX.bind(this.nodes.obPreorderBtn, 'click', BX.proxy(this.preOrder, this)); 3530 3531 this.nodes.obMeasure = BX(this.element.VISUAL.QUANTITY_MEASURE); 3532 3533 this.nodes.obPreviewText = BX(this.element.VISUAL.PREVIEW_TEXT); 3534 3535 this.nodes.obWrSubscribe = BX(this.element.VISUAL.SUBSCRIBE); 3536 3537 3538 this.nodes.obBlockChars = this.nodes.obProduct.querySelector("#chars"); 3539 this.nodes.obSkuChars = BX(this.element.VISUAL.SKU_CHARS); 3540 3541 if (this.nodes.obBasketActions) { 3542 this.nodes.obWrBuyBtn = this.nodes.obBasketActions.querySelector('.wr-btn-fast-order'); 3543 this.nodes.obWrBasketBtn = this.nodes.obBasketActions.querySelector('.wr-btn-basket'); 3544 3545 /*if (this.element.SHOW_BUY_BTN === "Y") {*/ 3546 this.nodes.obFastOrder = BX(this.element.VISUAL.FAST_ORDER); 3547 this.nodes.obFastOrder && BX.bind(this.nodes.obFastOrder, 'click', BX.proxy(this.fastOrder, this)); 3548 /*}*/ 3549 3550 /*if (this.element.SHOW_BTN_BASKET === "Y") {*/ 3551 this.nodes.obAdd2BasketBtn = BX(this.element.VISUAL.ADD2BASKET); 3552 this.nodes.obMove2Basket = BX(this.element.VISUAL.MOVE2BASKET); 3553 this.nodes.obAdd2BasketBtn && BX.bind(this.nodes.obAdd2BasketBtn, 'click', BX.proxy(this.add2Basket, this)); 3554 /*}*/ 3555 } 3556 3557 this.nodes.obPriceMatrix = BX(this.element.VISUAL.PRICE_MATRIX); 3558 3559 this.nodes.obArticleAvailable = BX(this.element.VISUAL.ARTICLE_AVAILABLE); 3560 3561 if (this.element.VISUAL.CALL_FORM_BETTER_PRICE) { 3562 this.nodes.obCallFormBetterPrice = BX(this.element.VISUAL.CALL_FORM_BETTER_PRICE); 3563 BX.bind(this.nodes.obCallFormBetterPrice, 'click', BX.delegate(this.callFormBetterPrice, this)); 3564 } 3565 3566 if (this.element.CONFIG.USE_DELAY === "Y") { 3567 this.nodes.obDelay = BX(this.element.VISUAL.DELAY); 3568 this.nodes.obDelay && BX.bind(this.nodes.obDelay, 'click', BX.proxy(this.add2Delay, this)); 3569 } 3570 3571 if (this.element.CONFIG.USE_COMPARE === "Y") { 3572 this.nodes.obCompare = BX(this.element.VISUAL.COMPARE); 3573 this.nodes.obCompare && BX.bind(this.nodes.obCompare, 'click', BX.proxy(this.add2Compare, this)); 3574 } 3575 3576 3577 if (this.element.CONFIG.SHOW_PRICE === "Y") { 3578 this.nodes.obPrice = { 3579 wrapper: null, 3580 price: null, 3581 old: null, 3582 discount: null, 3583 percent: null, 3584 total: null 3585 }; 3586 3587 this.nodes.obPrice.price = BX(this.element.VISUAL.PRICE); 3588 3589 3590 if (!this.nodes.obPrice.price) { 3591 this.errorCode = -16; 3592 } else { 3593 this.nodes.obPrice.total = BX(this.element.VISUAL.PRICE_TOTAL); 3594 this.nodes.obPrice.old = BX(this.element.VISUAL.OLD_PRICE); 3595 this.nodes.obPrice.discount = BX(this.element.VISUAL.DISCOUNT_PRICE); 3596 this.nodes.obPrice.percent = BX(this.element.VISUAL.DISCOUNT_PERCENT); 3597 } 3598 3599 } 3600 3601 if (this.element.CONFIG.SHOW_QUANTITY === "Y") { 3602 this.nodes.obQuantity = BX(this.element.VISUAL.QUANTITY); 3603 this.nodes.quantity = this.nodes.obProduct.querySelector('.quantity-block'); 3604 3605 if (this.element.VISUAL.QUANTITY_UP) { 3606 this.nodes.obQuantityUp = BX(this.element.VISUAL.QUANTITY_UP); 3607 BX.bind(this.nodes.obQuantityUp, 'click', BX.delegate(this.quantityUp, this)); 3608 3609 } 3610 3611 if (this.element.VISUAL.QUANTITY_DOWN) { 3612 this.nodes.obQuantityDown = BX(this.element.VISUAL.QUANTITY_DOWN); 3613 BX.bind(this.nodes.obQuantityDown, 'click', BX.delegate(this.quantityDown, this)); 3614 } 3615 3616 if (this.nodes.obQuantity) 3617 BX.bind(this.nodes.obQuantity, 'change', BX.delegate(this.quantityChange, this)); 3618 3619 3620 this.element.precisionFactor = Math.pow(10, this.element.CONFIG.PRECISION); 3621 } 3622 3623 3624 }, 3625 3626 initProductData: function () { 3627 this.currentElement = this.element; 3628 3629 this.oldElement = this.currentElement; 3630 3631 this.currentElement.MAX_QUANTITY = this.currentElement.QUANTITY_FLOAT ? 3632 parseFloat(this.element.MAX_QUANTITY) : 3633 parseInt(this.element.MAX_QUANTITY, 10); 3634 this.currentElement.STEP_QUANTITY = this.currentElement.QUANTITY_FLOAT ? 3635 parseFloat(this.currentElement.STEP_QUANTITY) : 3636 parseInt(this.currentElement.STEP_QUANTITY, 10); 3637 3638 this.currentElement.MIN_QUANTITY = this.currentElement.ITEM_PRICE_MODE === 'Q' ? parseFloat(this.currentElement.ITEM_PRICES[this.currentElement.ITEM_PRICE_SELECTED].MIN_QUANTITY) : this.currentElement.STEP_QUANTITY; 3639 3640 if (this.currentElement.QUANTITY_FLOAT) 3641 this.currentElement.STEP_QUANTITY = Math.round(this.currentElement.STEP_QUANTITY * this.element.precisionFactor) / this.element.precisionFactor; 3642 3643 this.setPrice(); 3644 this.setQuantityHtml(); 3645 this.btnsControl(); 3646 3647 if (this.nodes.obPriceMatrix && this.currentElement.PRICE_MATRIX_RESULT.HTML) 3648 this.setPriceMatrix(this.currentElement.PRICE_MATRIX_RESULT.HTML); 3649 }, 3650 3651 setQuantityHtml: function () { 3652 if (this.currentElement.QUANTITY.HTML) { 3653 var productAvailableValue = this.nodes.obProduct.querySelector(".product-available-js"); 3654 3655 productAvailableValue.innerHTML = this.currentElement.QUANTITY.HTML; 3656 productAvailableValue.classList.add("active"); 3657 } 3658 }, 3659 3660 changeDetailUrl: function (ID) { 3661 var arNames = this.nodes.obProduct.querySelectorAll("a.product-name"); 3662 3663 if (arNames) { 3664 for (i = 0; i < arNames.length; i++) { 3665 arNames[i].href = this.currentElement.DETAIL_PAGE_URL; 3666 } 3667 } 3668 3669 }, 3670 3671 3672 init: function () { 3673 var i = 0, 3674 j = 0, 3675 treeItems = null; 3676 3677 3678 if (this.errorCode === 0) { 3679 3680 switch (this.element.PRODUCT_TYPE) { 3681 case 0: 3682 case 1: 3683 case 2: 3684
3685 this.checkQuantityControls(); 3686 getHtmlStoreList(this.currentElement.ID, this.element.STORE, this.currentElement.MEASURE); 3687 break; 3688 3689 case 3: 3690 3691 treeItems = this.nodes.obTree.querySelectorAll('li'); 3692 3693 for (i = 0; i < treeItems.length; i++) { 3694 BX.bind(treeItems[i], 'click', BX.delegate(this.selectOfferProp, this)); 3695 } 3696 3697 3698 this.setCurrent(); 3699 break; 3700 } 3701 3702 } 3703 }, 3704 3705 getEntities: function (parent, entity, additionalFilter) { 3706 if (!parent || !entity) 3707 return { 3708 length: 0 3709 }; 3710 3711 additionalFilter = additionalFilter || ''; 3712 3713 return parent.querySelectorAll(additionalFilter + '[data-entity="' + entity + '"]'); 3714 }, 3715 3716 initOffersData: function () { 3717 3718 if (this.element.CONFIG.SHOW_OFFERS) { 3719 3720 this.currentElement = this.element.OFFERS[this.element.OFFER_ID_SELECTED]; 3721 3722 if (this.element.CONFIG.USE_OID === 'Y') 3723 this.addParameterToURL("oID", this.currentElement.ID); 3724 3725 this.nodes.obTree = BX(this.element.VISUAL.TREE); 3726 3727 3728 3729 if (!this.nodes.obTree) 3730 this.errorCode = -256; 3731 } else { 3732 this.errorCode = -1; 3733 } 3734 3735 }, 3736 3737 preOrder: function () { 3738 var arParams = { 3739 path: "formmodal.php", 3740 element_id: this.element.FORM_PREORDER_ID, 3741 container: "modalAreaForm", 3742 element_item_type: "PREORDER", 3743 element_item_name: this.element.NAME 3744 }, 3745 element_id = $(this).attr("data-call-modal"), 3746 header = $(this).attr("data-header"); 3747 3748 3749 arParams["element_item_id"] = this.currentElement.ID.toString(); 3750 arParams["ARTICLE"] = this.currentElement.ARTICLE; 3751 arParams["PHOTO"] = this.currentElement.PHOTO; 3752 3753 3754 switch (this.element.PRODUCT_TYPE) { 3755 case 1: 3756 case 2: 3757 arParams["element_item_input"] = this.element.NAME; 3758 break; 3759 case 3: 3760 arParams["element_item_offers"] = this.currentElement.TREE_INFO; 3761 arParams["element_item_input"] = getStringNameItem(this.element.NAME, this.currentElement.TREE_INFO); 3762 break; 3763 3764 default: 3765 break; 3766 } 3767 3768 3769 callModal(arParams); 3770 }, 3771 3772 callFormBetterPrice: function () { 3773 3774 var arParams = { 3775 path: "formmodal.php", 3776 element_id: this.element.FORM_BETTER_PRICE_ID, 3777 container: "modalAreaForm", 3778 element_item_type: "BETTER_PRICE", 3779 element_item_name: this.element.NAME 3780 }, 3781 element_id = $(this).attr("data-call-modal"), 3782 header = $(this).attr("data-header"); 3783 3784 3785 arParams["element_item_id"] = this.currentElement.ID.toString(); 3786 arParams["ARTICLE"] = this.currentElement.ARTICLE; 3787 arParams["PHOTO"] = this.currentElement.PHOTO; 3788 3789 switch (this.element.PRODUCT_TYPE) { 3790 case 1: 3791 case 2: 3792 arParams["element_item_input"] = this.element.NAME; 3793 break; 3794 case 3: 3795 3796 arParams["element_item_offers"] = this.currentElement.TREE_INFO; 3797 arParams["element_item_input"] = getStringNameItem(this.element.NAME, this.currentElement.TREE_INFO); 3798 break; 3799 3800 default: 3801 break; 3802 } 3803 3804 3805 callModal(arParams); 3806 3807 }, 3808 3809 fastOrder: function () { 3810 if (!this.currentElement.CAN_BUY) 3811 return; 3812 3813 3814 var productID = '', 3815 value = 1, 3816 productItem = {}; 3817 3818 3819 if (this.nodes.obQuantity) 3820 value = this.nodes.obQuantity.value; 3821 3822 productItem = { 3823 "QUANTITY": value, 3824 "PRICE": this.currentElement.ITEM_PRICES[this.currentElement.ITEM_PRICE_SELECTED], 3825 "NAME": this.currentElement.NAME_HTML 3826 }; 3827 3828 productItem["PRODUCT_ID"] = this.currentElement.ID.toString(); 3829 productItem["ARTICLE"] = this.currentElement.ARTICLE; 3830 productItem["PHOTO"] = this.currentElement.PHOTO; 3831 3832 3833 switch (this.element.PRODUCT_TYPE) { 3834 case 1: 3835 case 2: 3836 break; 3837 case 3: 3838 productItem["element_item_offers"] = this.currentElement.TREE_INFO; 3839 break; 3840 3841 default: 3842 break; 3843 } 3844 3845 showProcessLoad(); 3846 3847 BX.ajax({ 3848 method: 'POST', 3849 dataType: 'html', 3850 url: '/bitrix/tools/concept.phoenix/ajax/basket/call_form_fast_order.php', 3851 data: { 3852 productItem: productItem, 3853 site_id: $("input.site_id").val() 3854 }, 3855 onsuccess: BX.proxy(this.callFormResult, this) 3856 }); 3857 }, 3858 3859 3860 3861 callFormResult: function (html) { 3862 closeProcessLoad(); 3863 startModalMode("div.modalAreaForm"); 3864 $('div.modalAreaForm').html(html); 3865 $('div.modalAreaForm form.form .date').datetimepicker({ 3866 timepicker: false, 3867 format: 'd/m/Y',
3868 scrollMonth: false, 3869 scrollInput: false, 3870 dayOfWeekStart: 1 3871 }); 3872 }, 3873 3874 3875 add2Delay: function () { 3876 var productID = '', 3877 value = 1; 3878 3879 if (this.nodes.obQuantity) 3880 value = this.nodes.obQuantity.value; 3881 3882 3883 BX.ajax({ 3884 method: 'POST', 3885 dataType: 'json', 3886 url: '/bitrix/tools/concept.phoenix/ajax/basket/wishlist.php', 3887 data: { 3888 product_id: this.currentElement.ID, 3889 price_id: this.currentElement.ITEM_PRICES[this.currentElement.ITEM_PRICE_SELECTED].ID, 3890 price: this.currentElement.ITEM_PRICES[this.currentElement.ITEM_PRICE_SELECTED].PRICE, 3891 name: this.currentElement.NAME, 3892 detail_page: this.currentElement.DETAIL_PAGE_URL, 3893 can_buy: this.currentElement.CAN_BUY, 3894 quantity: value, 3895 currency: this.currentElement.ITEM_PRICES[this.currentElement.ITEM_PRICE_SELECTED].CURRENCY, 3896 site_id: $("input.site_id").val() 3897 }, 3898 onsuccess: BX.proxy(this.delayResult, this) 3899 }); 3900 }, 3901 3902 delayResult: function (arResult) { 3903 if (arResult["OK"] == "Y") { 3904 if (this.element.PRODUCT_TYPE == 3) { 3905 if (arResult["ACTION"] == 'active') 3906 this.currentElement.IN_DELAY = true; 3907 3908 if (arResult["ACTION"] == 'delete') 3909 this.currentElement.IN_DELAY = false; 3910 } 3911 3912 markProductDelayBasket(this.currentElement.ID, arResult["ACTION"]); 3913 } else { 3914 console.log(arResult["OK"]); 3915 } 3916 }, 3917 3918 add2Compare: function () { 3919 3920 var checked = false; 3921 3922 if (!BX.hasClass(this.nodes.obCompare, "active")) 3923 checked = true; 3924 3925 var url = checked ? this.element.CONFIG.COMPARE_URL + '?action=ADD_TO_COMPARE_LIST&id=#ID#' : this.element.CONFIG.COMPARE_URL + '?action=DELETE_FROM_COMPARE_LIST&id=#ID#', 3926 compareLink; 3927 3928 if (url) { 3929 3930 compareLink = url.replace('#ID#', this.currentElement.ID); 3931 3932 3933 3934 BX.ajax({ 3935 method: 'POST', 3936 dataType: checked ? 'json' : 'html', 3937 url: compareLink + (compareLink.indexOf('?') !== -1 ? '&' : '?') + 'ajax_action=Y', 3938 onsuccess: checked ? 3939 BX.proxy(this.compareResult, this) : BX.proxy(this.compareDeleteResult, this) 3940 }); 3941 } 3942 }, 3943 3944 compareResult: function (arResult) { 3945 /*if (!BX.type.isPlainObject(arResult)) 3946 return; 3947 3948 3949 3950 if (arResult.STATUS === 'OK') 3951 {*/ 3952 if (this.element.OFFERS.length > 0) 3953 this.currentElement.IN_COMPARE = true; 3954 3955 3956 markProductCompareBasket(this.currentItemId, 'active'); 3957 /*}*/ 3958 }, 3959 3960 compareDeleteResult: function (arResult) { 3961 3962 if (this.element.OFFERS.length > 0) 3963 this.currentElement.IN_COMPARE = false; 3964 3965 3966 markProductCompareBasket(this.currentItemId, 'delete'); 3967 3968 }, 3969 3970 add2Basket: function () { 3971 3972 if (!this.currentElement.CAN_BUY) 3973 return; 3974 3975 var productID = '', 3976 value = 1; 3977 3978 if (this.nodes.obQuantity) 3979 value = this.nodes.obQuantity.value; 3980 3981 3982 productItem = { 3983 PRODUCT_ID: this.currentElement.ID, 3984 QUANTITY: value, 3985 PRICE_ID: this.currentElement.ITEM_PRICES[this.currentElement.ITEM_PRICE_SELECTED].ID 3986 }; 3987 3988 $(this.nodes.obAdd2BasketBtn).addClass("btn-processing"); 3989 3990 BX.ajax({ 3991 method: 'POST', 3992 dataType: 'json', 3993 url: '/bitrix/tools/concept.phoenix/ajax/basket/add2basket.php', 3994 data: { 3995 productItem: productItem, 3996 site_id: $("input.site_id").val() 3997 }, 3998 onsuccess: BX.proxy(this.basketResult, this) 3999 }); 4000 }, 4001 4002 basketResult: function (arResult) { 4003 if (arResult["OK"] == "Y") { 4004 if (this.element.PRODUCT_TYPE === 3) 4005 this.element.OFFERS[this.element.OFFER_ID_SELECTED].IN_BASKET = true; 4006 4007 markProductAddBasket(this.currentElement.ID); 4008 4009 4010 4011 if (arResult["SCRIPTS"]) 4012 $('body').append(arResult["SCRIPTS"]); 4013 } 4014 4015 $(this.nodes.obAdd2BasketBtn).removeClass("btn-processing"); 4016 }, 4017 4018 deleteParameterURL: function (url, param) { 4019 var a = url.split('?'); 4020 var re = new RegExp('(\\?|&)' + param + '=[^&]+', 'g'); 4021 4022 if (url == "undefined") 4023 url = ""; 4024 4025 url = ('?' + a[1]).replace(re, ''); 4026 url = url.replace(/^&|\?/, ''); 4027 4028 if (url == "undefined") 4029 url = ""; 4030 4031 var dlm = (url == '') ? '' : '?'; 4032 return a[0] + dlm + url; 4033 }, 4034 4035 addParameterToURL: function (param, value) { 4036 4037 var url = window.location.href; 4038 4039 4040 if (history.replaceState) { 4041 var baseUrl = this.deleteParameterURL(url, param); 4042 baseUrl += (baseUrl.split('?')[1] ? '&' : '?') + param + "=" + value; 4043 history.replaceState(null, null, baseUrl); 4044 } else { 4045 console.warn('History API don`t support'); 4046 } 4047 }, 4048 4049 selectOfferProp: function () { 4050 var i = 0, 4051 strTreeValue = '', 4052 arTreeItem = [], 4053 rowItems = null, 4054 target = BX.proxy_context, 4055 smallCardItem; 4056 4057 4058 if (target && target.hasAttribute('data-treevalue')) { 4059 if (BX.hasClass(target, 'active')) 4060 return; 4061 4062 4063 4064 if (typeof document.activeElement === 'object') { 4065 document.activeElement.blur(); 4066 } 4067 4068 4069 4070 strTreeValue = target.getAttribute('data-treevalue'); 4071 arTreeItem = strTreeValue.split('_'); 4072 4073 this.searchOfferPropIndex(arTreeItem[0], arTreeItem[1]); 4074 4075 4076 rowItems = BX.findChildren(target.parentNode, { 4077 tagName: 'li' 4078 }, false); 4079 4080 4081 if (rowItems && rowItems.length) { 4082 for (i = 0; i < rowItems.length; i++) { 4083 BX.removeClass(rowItems[i], 'active'); 4084 } 4085 } 4086 4087 4088 BX.addClass(target, 'active'); 4089 4090 } 4091 }, 4092 4093 4094 searchOfferPropIndex: function (strPropID, strPropValue) { 4095 var strName = '', 4096 arShowValues = false, 4097 arCanBuyValues = [], 4098 allValues = [], 4099 index = -1, 4100 i, j, 4101 arFilter = {}, 4102 tmpFilter = []; 4103 4104 4105 4106 for (i = 0; i < this.element.TREE_PROPS.length; i++) { 4107 if (this.element.TREE_PROPS[i].ID === strPropID) { 4108 index = i; 4109 break; 4110 } 4111 } 4112 4113 if (index > -1) { 4114 for (i = 0; i < index; i++) { 4115 strName = 'PROP_' + this.element.TREE_PROPS[i].ID; 4116 arFilter[strName] = this.selectedValues[strName]; 4117 } 4118 4119 4120 strName = 'PROP_' + this.element.TREE_PROPS[index].ID; 4121 arFilter[strName] = strPropValue; 4122 4123 4124 4125 for (i = index + 1; i < this.element.TREE_PROPS.length; i++) { 4126 4127 strName = 'PROP_' + this.element.TREE_PROPS[i].ID; 4128 arShowValues = this.getRowValues(arFilter, strName); 4129 4130 4131 4132 if (!arShowValues) 4133 break; 4134 4135 allValues = []; 4136 4137 if (this.element.CONFIG.SHOW_ABSENT === 'Y') { 4138 4139 arCanBuyValues = []; 4140 tmpFilter = []; 4141 tmpFilter = BX.clone(arFilter, true); 4142 4143 for (j = 0; j < arShowValues.length; j++) { 4144 tmpFilter[strName] = arShowValues[j]; 4145 allValues[allValues.length] = arShowValues[j]; 4146 if (this.getCanBuy(tmpFilter)) 4147 arCanBuyValues[arCanBuyValues.length] = arShowValues[j]; 4148 } 4149 } else { 4150 arCanBuyValues = arShowValues; 4151 } 4152 4153 4154 4155 4156 if (this.selectedValues[strName] && BX.util.in_array(this.selectedValues[strName], arC
4156anBuyValues)) { 4157 arFilter[strName] = this.selectedValues[strName]; 4158 4159 } else { 4160 4161 if (this.element.CONFIG.SHOW_ABSENT === 'Y') { 4162 arFilter[strName] = (arCanBuyValues.length ? arCanBuyValues[0] : allValues[0]); 4163 } else { 4164 arFilter[strName] = arCanBuyValues[0]; 4165 } 4166 } 4167 4168 4169 this.updateRow(i, arFilter[strName], arShowValues, arCanBuyValues); 4170 4171 } 4172 4173 4174 this.selectedValues = arFilter; 4175 4176 4177 this.changeInfo(); 4178 4179 } 4180 4181 if (this.element.CONFIG.USE_OID === 'Y') 4182 this.addParameterToURL("oID", this.currentElement.ID); 4183 4184 4185 4186 }, 4187 4188 setCurrent: function () { 4189 var i, 4190 j = 0, 4191 strName = '', 4192 arShowValues = false, 4193 arCanBuyValues = [], 4194 arFilter = {}, 4195 tmpFilter = [], 4196 current = this.currentElement.TREE; 4197 4198 4199 4200 for (i = 0; i < this.element.TREE_PROPS.length; i++) { 4201 strName = 'PROP_' + this.element.TREE_PROPS[i].ID; 4202 arShowValues = this.getRowValues(arFilter, strName); 4203 4204 4205 if (!arShowValues) 4206 break; 4207 4208 if (BX.util.in_array(current[strName], arShowValues)) { 4209 arFilter[strName] = current[strName]; 4210 } else { 4211 arFilter[strName] = arShowValues[0]; 4212 this.element.OFFER_ID_SELECTED = 0; 4213 } 4214 4215 if (this.element.CONFIG.SHOW_ABSENT === 'Y') { 4216 arCanBuyValues = []; 4217 tmpFilter = []; 4218 tmpFilter = BX.clone(arFilter, true); 4219 4220 for (j = 0; j < arShowValues.length; j++) { 4221 tmpFilter[strName] = arShowValues[j]; 4222 4223 if (this.getCanBuy(tmpFilter)) { 4224 arCanBuyValues[arCanBuyValues.length] = arShowValues[j]; 4225 } 4226 } 4227 } else { 4228 arCanBuyValues = arShowValues; 4229 } 4230 4231 4232 this.updateRow(i, arFilter[strName], arShowValues, arCanBuyValues); 4233 } 4234 4235 this.selectedValues = arFilter; 4236 4237 this.changeInfo(); 4238 }, 4239 4240 getRowValues: function (arFilter, index) { 4241 var arValues = [], 4242 i = 0, 4243 j = 0, 4244 boolSearch = false, 4245 boolOneSearch = true; 4246 4247 4248 4249 if (arFilter.length === 0) { 4250 for (i = 0; i < this.element.OFFERS.length; i++) { 4251 if (!BX.util.in_array(this.element.OFFERS[i].TREE[index], arValues)) { 4252 arValues[arValues.length] = this.element.OFFERS[i].TREE[index]; 4253 4254 } 4255 } 4256 boolSearch = true; 4257 } else { 4258 for (i = 0; i < this.element.OFFERS.length; i++) { 4259 boolOneSearch = true; 4260 4261 for (j in arFilter) { 4262 if (arFilter[j] !== this.element.OFFERS[i].TREE[j]) { 4263 boolOneSearch = false; 4264 break; 4265 } 4266 } 4267 4268 if (boolOneSearch) { 4269 if (!BX.util.in_array(this.element.OFFERS[i].TREE[index], arValues)) { 4270 arValues[arValues.length] = this.element.OFFERS[i].TREE[index]; 4271 4272 } 4273 4274 boolSearch = true; 4275 } 4276 } 4277 } 4278 4279 4280 4281 return (boolSearch ? arValues : false); 4282 }, 4283 4284 updateRow: function (intNumber, activeId, showId, canBuyId) { 4285 4286 var i = 0, 4287 value = '', 4288 isCurrent = false, 4289 rowItems = null; 4290 4291 4292 var lineContainer = this.nodes.obTree.querySelectorAll('.wrapper-sku-props'); 4293 4294 4295 if (intNumber > -1 && intNumber < lineContainer.length) { 4296 rowItems = lineContainer[intNumber].querySelectorAll('li'); 4297 4298 for (i = 0; i < rowItems.length; i++) { 4299 value = rowItems[i].getAttribute('data-onevalue'); 4300 isCurrent = value === activeId; 4301 4302 4303 if (isCurrent) { 4304 BX.addClass(rowItems[i], 'active'); 4305 } else { 4306 BX.removeClass(rowItems[i], 'active'); 4307 } 4308 4309 if (BX.util.in_array(value, canBuyId)) { 4310 BX.removeClass(rowItems[i], 'notallowed'); 4311 } else { 4312 BX.addClass(rowItems[i], 'notallowed'); 4313 } 4314 4315 rowItems[i].style.display = BX.util.in_array(value, showId) ? '' : 'none'; 4316 4317 if (isCurrent) { 4318 lineContainer[intNumber].style.display = (value == 0) ? 'none' : ''; 4319 } 4320 } 4321 } 4322 }, 4323 4324 changeInfo: function () { 4325 var index = -1, 4326 j = 0, 4327 boolOneSearch = true, 4328 descTitle = null, 4329 rowItems = null; 4330 4331 var i; 4332 4333 for (i = 0; i < this.element.OFFERS.length; i++) { 4334 boolOneSearch = true; 4335 4336 for (j in this.selectedValues) { 4337 4338 if (this.selectedValues[j] !== this.element.OFFERS[i].TREE[j]) { 4339 boolOneSearch = false;
4340 break; 4341 } 4342 4343 } 4344 4345 if (boolOneSearch) { 4346 index = i; 4347 break; 4348 } 4349 } 4350 4351 this.oldElement = this.currentElement; 4352 4353 this.element.OFFER_ID_SELECTED = index; 4354 this.currentElement = this.element.OFFERS[this.element.OFFER_ID_SELECTED]; 4355 4356 this.changeCharsBlock(); 4357 4358 if (index > -1) { 4359 4360 if (this.nodes.obPriceMatrix && this.currentElement.PRICE_MATRIX_RESULT.HTML) 4361 this.setPriceMatrix(this.currentElement.PRICE_MATRIX_RESULT.HTML); 4362 4363 this.updateInfoBasketOffer(this.currentElement.ID, this.element.VISUAL.ID); 4364 4365 4366 for (i = 0; i < this.element.OFFERS.length; i++) { 4367 if (this.element.CONFIG.OFFER_GROUP) { 4368 if (offerGroupNode = BX(this.element.VISUAL.OFFER_GROUP + this.element.OFFERS[i].ID)) 4369 offerGroupNode.style.display = (i == index ? '' : 'none'); 4370 4371 } 4372 } 4373 4374 4375 $("input.product-" + this.currentElement.ID + "-picture-src-small").val(this.currentElement.MORE_PHOTOS[0].SMALL.SRC); 4376 4377 if (this.element.CONFIG.ZOOM) { 4378 $(this.nodes.obProduct).find('.zoom-offer').trigger('zoom
4378-offer.destroy'); 4379 initZoomer($(this.nodes.obProduct).find(".zoom-offer")); 4380 } 4381 4382 4383 if (this.currentElement.IN_BASKET == true || 4384 this.currentElement.IN_DELAY == true || 4385 this.currentElement.IN_COMPARE == true 4386 ) { 4387 4388 setItemButtonStatus( 4389 this.currentElement.ID, 4390 '', 4391 this.currentElement.IN_BASKET, 4392 this.currentElement.IN_DELAY, 4393 this.currentElement.IN_COMPARE 4394 ); 4395 4396 4397 setItemButtonStatus(this.currentElement.ID, '', 'offer_delay_added'); 4398 setItemButtonStatus(this.currentElement.ID, '', 'compare_added'); 4399 4400 } else { 4401 setItemButtonStatus(arStatusBasketPhoenix); 4402 } 4403 } 4404 4405 this.quantitySet(); 4406 this.setPrice(); 4407 this.setQuantityHtml(); 4408 this.btnsControl(); 4409 4410 if (!this.firstLoad) { 4411 this.drawImages(this.currentElement.MORE_PHOTOS); 4412 4413 if (this.element.CONFIG.USE_OID !== 'Y') 4414 this.changeDetailUrl(this.currentElement.ID); 4415 4416 var previewText = this.nodes.obPreviewText.querySelector('.detail-description'); 4417 4418 if (previewText) 4419 this.changeText(previewText, this.currentElement.PREVIEW_TEXT_HTML); 4420 4421 4422 this.showArticleStoreQuantity(); 4423 } 4424 4425 getHtmlStoreList(this.currentElement.ID, this.element.STORE, this.currentElement.MEASURE); 4426 4427 this.firstLoad = false; 4428 }, 4429 4430 changeText: function (ob, text) { 4431 if (text.length > 0) { 4432 4433 ob.innerHTML = text; 4434 ob.classList.remove('d-none'); 4435 4436 } else { 4437 ob.classList.add('d-none'); 4438 ob.innerHTML = ''; 4439 } 4440 }, 4441 4442 4443 hideBtns: function () { 4444 4445 if (this.currentElement.SHOW_BUY_BTN === 'Y') { 4446 this.nodes.obWrBuyBtn.classList.add('d-none'); 4447 this.nodes.obWrBuyBtn.classList.remove('active'); 4448 } 4449 4450 4451 if (this.currentElement.SHOW_BTN_BASKET === 'Y') { 4452 this.nodes.obWrBasketBtn.classList.add('d-none'); 4453 this.nodes.obWrBasketBtn.classList.remove('active'); 4454 } 4455 4456 4457 4458 this.nodes.obBasketActions.classList.add('d-none'); 4459 this.nodes.quantity.classList.add('d-none'); 4460 this.nodes.obBasketActions.classList.remove('active'); 4461 this.nodes.quantity.classList.remove('active'); 4462 }, 4463 4464 showBtns: function () { 4465 4466 this.nodes.obBasketActions.classList.remove('d-none'); 4467 this.nodes.obBasketActions.classList.add('active'); 4468 4469 if (this.currentElement.SHOW_BUY_BTN === 'Y') { 4470 this.nodes.obWrBuyBtn.classList.remove('d-none'); 4471 this.nodes.obWrBuyBtn.classList.add('active'); 4472 } else { 4473 this.nodes.obWrBuyBtn.classList.add('d-none'); 4474 this.nodes.obWrBuyBtn.classList.remove('active'); 4475 } 4476 4477 if (this.currentElement.SHOW_BTN_BASKET === 'Y') { 4478 this.nodes.obWrBasketBtn.classList.remove('d-none'); 4479 this.nodes.quantity.classList.remove('d-none'); 4480 this.nodes.obWrBasketBtn.classList.add('active'); 4481 this.nodes.quantity.classList.add('active'); 4482 } 4483 else 4484 { 4485 this.nodes.quantity.classList.add('d-none'); 4486 this.nodes.quantity.classList.remove('active'); 4487 } 4488 }, 4489 4490 btnsControl: function () { 4491 var show = false; 4492 4493 if (this.currentElement.SHOWPREORDERBTN || this.currentElement.MODE_ARCHIVE) { 4494 if (this.currentElement.SHOWPREORDERBTN) { 4495 this.nodes.obWrPreorderBtn.classList.remove('d-none'); 4496 this.nodes.obWrPreorderBtn.classList.add('active'); 4497 } else { 4498 this.nodes.obWrPreorderBtn.classList.add('d-none'); 4499 this.nodes.obWrPreorderBtn.classList.remove('active'); 4500 } 4501 4502 4503 } else { 4504 this.nodes.obWrPreorderBtn.classList.add('d-none'); 4505 this.nodes.obWrPreorderBtn.classList.remove('active'); 4506 4507 if (this.currentElement.CAN_BUY && this.currentElement.MODE_DISALLOW_ORDER != "Y") 4508 show = true; 4509 } 4510 4511 if (this.currentElement.SUBSCRIBE === "Y" && this.currentElement.MAX_QUANTITY <= 0) { 4512 this.nodes.obWrSubscribe.classList.add("active"); 4513 4514 if(this.nodes.obWrSubscribe.firstElementChild) 4515 this.nodes.obWrSubscribe.firstElementChild.style.display = ""; 4516 4517 } else { 4518 this.nodes.obWrSubscribe.classList.add("d-none"); 4519 } 4520 4521 if (this.currentElement.SHOW_BTNS === 'Y' && this.currentElement.CAN_BUY) 4522 show = true; 4523 else 4524 { 4525 show = false;
4526 } 4527 4528 if (show) 4529 this.showBtns(); 4530 else{ 4531 this.hideBtns(); 4532 } 4533 4534 4535 4536 }, 4537 4538 updateInfoBasketOffer: function (id, parent) { 4539 parent = parent || ''; 4540 4541 if (parent.length > 0) 4542 parent = "#" + parent; 4543 4544 4545 $(parent + ' .add2basket').attr('data-item', id); 4546 $(parent + ' .move2basket').attr('data-item', id); 4547 $(parent + ' .quantity-block').attr('data-item', id); 4548 $(parent + ' .delay').attr('data-item', id); 4549 $(parent + ' .compare').attr('data-item', id); 4550 }, 4551 4552 setPriceMatrix: function (sPriceMatrix) { 4553 if (sPriceMatrix.length > 0) { 4554 this.nodes.obPriceMatrix.classList.remove('d-none'); 4555 this.nodes.obPriceMatrix.innerHTML = sPriceMatrix; 4556 } else { 4557 this.nodes.obPriceMatrix.classList.add('d-none'); 4558 this.nodes.obPriceMatrix.innerHTML = ''; 4559 } 4560 }, 4561 4562 changeCharsBlock: function () { 4563 4564 var html = ""; 4565 4566 4567 4568 if (this.nodes.obSkuChars) { 4569 4570 if (this.currentElement.SKU_LIST_CHARS.length) { 4571 for (i = 0; i < this.currentElement.SKU_LIST_CHARS.length; i++) { 4572 html += "<table class='cart-char-table mobile-break show-hidden-child'>"; 4573 html += "<tbody>"; 4574 html += "<tr>"; 4575 html += "<td class='left'>" + this.currentElement.SKU_LIST_CHARS[i].NAME + "</td>"; 4576 html += "<td class='dotted'>"; 4577 html += "<div class='dotted'></div>"; 4578 html += "</td>"; 4579 html += "<td class='sku-value right bold'>" + this.currentElement.SKU_LIST_CHARS[i].VALUE + "</td>"; 4580 html += "</tr>"; 4581 html += "</tbody>"; 4582 html += "</table>"; 4583 } 4584 4585 $("#chars").removeClass('d-none'); 4586 4587 } else { 4588 $(".chars-link").addClass("d-none"); 4589 } 4590 4591 BX.adjust(this.nodes.obSkuChars, { 4592 html: html 4593 }); 4594 4595 if ($(".cart-char-table").length <= 0 && $(".cart-char-col-right").length <= 0) 4596 { 4597 $("#chars").addClass('d-none'); 4598 $(".chars-link").addClass("d-none"); 4599 } 4600 else 4601 { 4602 $("#chars").removeClass('d-none'); 4603 $(".chars-link").removeClass("d-none"); 4604 } 4605 4606 4607 if (html.length <= 0 && $(this.nodes.obSkuChars).parents(".cart-char-col-left").find(".cart-char-table").length <= 0) 4608 $(this.nodes.obSkuChars).parents(".cart-char-col-left").hide(); 4609 4610 else { 4611 $(this.nodes.obSkuChars).parents(".cart-char-col-left").show(); 4612 } 4613 } 4614 4615 4616 }, 4617 4618 showArticleStoreQuantity: function () { 4619 var showArticle = false, 4620 showQuantity = false, 4621 html = ""; 4622 4623 var showArticle = false, 4624 showQuantity = false, 4625 html = ""; 4626 4627 var obAvailable = this.nodes.obArticleAvailable.querySelector(".product-available-js"), 4628 obArticle = this.nodes.obArticleAvailable.querySelector(".detail-article"); 4629 4630 if (this.currentElement.QUANTITY.HTML.length > 0) { 4631 obAvailable.innerHTML = this.currentElement.QUANTITY.HTML; 4632 obAvailable.classList.remove('d-none'); 4633 showQuantity = true; 4634 } else { 4635 obAvailable.classList.add('d-none'); 4636 } 4637 4638 if (this.currentElement.ARTICLE) { 4639 obArticle.innerHTML = BX.message("ARTICLE") + this.currentElement.ARTICLE; 4640 obArticle.title = obArticle.innerHTML; 4641 obArticle.classList.remove('d-none'); 4642 showArticle = true; 4643 } else { 4644 obArticle.classList.add('d-none'); 4645 } 4646 4647 4648 if (showArticle || showQuantity) { 4649 this.nodes.obArticleAvailable.classList.remove('d-none'); 4650 } else { 4651 this.nodes.obArticleAvailable.classList.add('d-none'); 4652 } 4653 4654 }, 4655 4656 setPrice: function () { 4657 var price; 4658 4659 if (this.nodes.obQuantity) 4660 this.checkPriceRange(this.nodes.obQuantity.value); 4661
4662 this.checkQuantityControls(); 4663 4664 price = this.currentElement.ITEM_PRICES[this.currentElement.ITEM_PRICE_SELECTED]; 4665 4666 var blockPrice = this.nodes.obProduct.querySelector('.block-price'); 4667 4668 /*if(typeof price == "undefined") 4669 price = this.currentElement.PRICE;*/ 4670 4671 if (this.nodes.obPrice.price) { 4672 var showPrice = true; 4673 4674 if (this.currentElement.MODE_ARCHIVE === 'Y' || price.PRICE == "-1") 4675 showPrice = false; 4676 4677 if (showPrice) { 4678 this.nodes.obPrice.price.innerHTML = price.PRINT_PRICE; 4679 blockPrice.classList.remove('d-none'); 4680 4681 var nameTypePrice = this.nodes.obProduct.querySelector(".name-type-price"); 4682 4683 if (price.NAME && !this.currentElement.PRICE_MATRIX_RESULT.EXTRA_PRICE) { 4684 nameTypePrice.innerHTML = price.NAME; 4685 nameTypePrice.classList.remove('d-none'); 4686 } else { 4687 nameTypePrice.innerHTML = ''; 4688 nameTypePrice.classList.add('d-none'); 4689 } 4690 4691 if (price && price.RATIO_PRICE !== price.RATIO_BASE_PRICE) {
4692 if (this.element.CONFIG.SHOW_OLD_PRICE === "Y") { 4693 this.nodes.obPrice.old.classList.remove("d-none"); 4694 this.nodes.obPrice.old.innerHTML = price.PRINT_BASE_PRICE; 4695 4696 4697 if (this.nodes.obPrice.discount) { 4698 this.nodes.obPrice.discount.querySelector('.product-price-discount-js').innerHTML = price.PRINT_DISCOUNT; 4699 4700 if (this.element.CONFIG.SHOW_DISCOUNT_PERCENT === "Y" && price.PERCENT > 0) { 4701 this.nodes.obPrice.percent.innerHTML = (-price.PERCENT) + "%"; 4702 this.nodes.obPrice.percent.classList.remove('d-none'); 4703 } else { 4704 this.nodes.obPrice.percent.classList.add('d-none'); 4705 } 4706 4707 4708 this.nodes.obPrice.discount.classList.remove('d-none'); 4709 } else { 4710 this.nodes.obPrice.discount.classList.add('d-none'); 4711 } 4712 } 4713 } else { 4714 this.nodes.obPrice.old.classList.add("d-none"); 4715 this.nodes.obPrice.discount.classList.add('d-none'); 4716 this.nodes.obPrice.percent.classList.add('d-none'); 4717 } 4718 4719 if (this.nodes.obPrice.total) { 4720 4721 if (price && this.nodes.obQuantity && this.nodes.obQuantity.value != this.currentElement.STEP_QUANTITY) { 4722 var sum = BX.Currency.currencyFormat(price.PRICE * this.nodes.obQuantity.value, price.CURRENCY, true); 4723 this.nodes.obPrice.total.classList.remove('d-none'); 4724 this.nodes.obPrice.total.querySelector('.total-value').innerHTML = sum; 4725 this.nodes.obPrice.total.querySelector('.total-value').title = sum; 4726 } else { 4727 this.nodes.obPrice.total.classList.add('d-none'); 4728 } 4729 4730 } 4731 } else { 4732 this.nodes.obPrice.price.innerHTML = ""; 4733 blockPrice.classList.add("d-none"); 4734 } 4735 } 4736 4737 4738 }, 4739 4740 checkQuantityControls: function () { 4741 if (!this.nodes.obQuantity) 4742 return; 4743 4744 4745 var reachedTopLimit = this.element.CONFIG.SHOW_QUANTITY === "Y" && parseFloat(this.nodes.obQuantity.value) + this.currentElement.STEP_QUANTITY > this.currentElement.MAX_QUANTITY, 4746 reachedBottomLimit = parseFloat(this.nodes.obQuantity.value) - this.currentElement.STEP_QUANTITY < this.currentElement.MIN_QUANTITY; 4747 4748 4749 if (reachedTopLimit) 4750 BX.addClass(this.nodes.obQuantityUp, 'product-item-amount-field-btn-disabled'); 4751 4752 else if (BX.hasClass(this.nodes.obQuantityUp, 'product-item-amount-field-btn-disabled')) { 4753 BX.removeClass(this.nodes.obQuantityUp, 'product-item-amount-field-btn-disabled'); 4754 } 4755 4756 if (reachedBottomLimit) 4757 BX.addClass(this.nodes.obQuantityDown, 'product-item-amount-field-btn-disabled'); 4758 4759 else if (BX.hasClass(this.nodes.obQuantityDown, 'product-item-amount-field-btn-disabled')) { 4760 BX.removeClass(this.nodes.obQuantityDown, 'product-item-amount-field-btn-disabled'); 4761 } 4762 4763 if (reachedTopLimit && reachedBottomLimit) 4764 this.nodes.obQuantity.setAttribute('disabled', 'disabled'); 4765 4766 else { 4767 this.nodes.obQuantity.removeAttribute('disabled'); 4768 } 4769 }, 4770 4771 checkPriceRange: function (quantity) { 4772 if (typeof quantity === 'undefined' || this.currentElement.ITEM_PRICE_MODE !== 'Q') 4773 return; 4774 4775 4776 var range, found = false; 4777 4778 for (var i in this.currentElement.ITEM_QUANTITY_RANGES) { 4779 if (this.currentElement.ITEM_QUANTITY_RANGES.hasOwnProperty(i)) { 4780 range = this.currentElement.ITEM_QUANTITY_RANGES[i]; 4781 4782 4783 if ( 4784 parseFloat(quantity) >= parseFloat(range.SORT_FROM) && 4785 ( 4786 range.SORT_TO === 'INF' || 4787 parseFloat(quantity) <= parseFloat(range.SORT_TO) 4788 ) 4789 ) { 4790 found = true; 4791 this.currentElement.ITEM_QUANTITY_RANGE_SELECTED = range.HASH; 4792 break; 4793 } 4794 } 4795 } 4796 4797 if (!found && (range = this.getMinPriceRange())) { 4798 this.currentElement.ITEM_QUANTITY_RANGE_SELECTED = range.HASH; 4799 } 4800 4801 for (var k in this.currentElement.ITEM_PRICES) { 4802 if (this.currentElement.ITEM_PRICES.hasOwnProperty(k)) { 4803 if (this.currentElement.ITEM_PRICES[k].QUANTITY_HASH == this.currentElement.ITEM_QUANTITY_RANGE_SELECTED) { 4804 this.currentElement.ITEM_PRICE_SELECTED = k; 4805 break; 4806 } 4807 } 4808 } 4809 }, 4810 4811 checkQuantityRange: function (quantity, direction) { 4812 if (typeof quantity === 'undefined' || this.currentElement.ITEM_PRICE_MODE !== 'Q') { 4813 return quantity; 4814 } 4815 4816 quantity = parseFloat(quantity); 4817 4818 var nearestQuantity = quantity; 4819 var range, diffFrom, absDiffFrom, diffTo, absDiffTo, shortestDiff; 4820 4821 for (var i in this.currentElement.ITEM_QUANTITY_RANGES) { 4822 if (this.currentElement.ITEM_QUANTITY_RANGES.hasOwnProperty(i)) { 4823 range = this.currentElement.ITEM_QUANTITY_RANGES[i]; 4824 4825 if ( 4826 parseFloat(quantity) >= parseFloat(range.SORT_FROM) && 4827 ( 4828 range.SORT_TO === 'INF' || 4829 parseFloat(quantity) <= parseFloat(range.SORT_TO) 4830 ) 4831 ) { 4832 nearestQuantity = quantity; 4833 break; 4834 } else { 4835 diffFrom = parseFloat(range.SORT_FROM) - quantity; 4836 absDiffFrom = Math.abs(diffFrom); 4837 diffTo = parseFloat(range.SORT_TO) - quantity; 4838 absDiffTo = Math.abs(diffTo); 4839 4840 if (shortestDiff === undefined || shortestDiff > absDiffFrom) { 4841 if ( 4842 direction === undefined || 4843 (direction === 'up' && diffFrom > 0) || 4844 (direction === 'down' && diffFrom < 0) 4845 ) { 4846 shortestDiff = absDiffFrom; 4847 nearestQuantity = parseFloat(range.SORT_FROM); 4848 } 4849 } 4850 4851 if (shortestDiff === undefined || shortestDiff > absDiffTo) { 4852 if ( 4853 direction === undefined || 4854 (direction === 'up' && diffFrom > 0) || 4855 (direction === 'down' && diffFrom < 0) 4856 ) { 4857 shortestDiff = absDiffTo; 4858 nearestQuantity = parseFloat(range.SORT_TO); 4859 } 4860 } 4861 } 4862 } 4863 } 4864 4865 return nearestQuantity; 4866 }, 4867 4868 getMinPriceRange: function () { 4869 var range; 4870 4871 for (var i in this.currentElement.ITEM_QUANTITY_RANGES) { 4872 if (this.currentElement.ITEM_QUANTITY_RANGES.hasOwnProperty(i)) { 4873 if ( 4874 !range || 4875 parseInt(this.currentElement.ITEM_QUANTITY_RANGES[i].SORT_FROM) < parseInt(range.SORT_FROM) 4876 ) { 4877 range = this.currentElement.ITEM_QUANTITY_RANGES[i]; 4878 } 4879 } 4880 } 4881 4882 return range; 4883 }, 4884 4885 4886 startQuantityInterval: function () { 4887 var target = BX.proxy_context; 4888 var func = target.id === this.element.VISUAL.QUANTITY_DOWN ? 4889 BX.proxy(this.quantityDown, this) : 4890 BX.proxy(this.quantityUp, this); 4891 4892 4893 4894 this.quantityDelay = setTimeout( 4895 BX.delegate(function () { 4896 this.quantityTimer = setInterval(func, 150); 4897 }, this), 4898 300 4899 ); 4900 }, 4901 4902 clearQuantityInterval: function () { 4903 clearTimeout(this.quantityDelay); 4904 clearInterval(this.quantityTimer); 4905 }, 4906 4907 quantityUp: function () { 4908 4909 var curValue = 0, 4910 boolSet = true; 4911 4912 if (this.errorCode === 0 && this.element.CONFIG.SHOW_QUANTITY === "Y" && this.currentElement.CAN_BUY) { 4913 4914 curValue = this.currentElement.QUANTITY_FLOAT ? parseFloat(this.nodes.obQuantity.value) : parseInt(this.nodes.obQuantity.value, 10); 4915 4916 4917 if (!isNaN(curValue)) { 4918 4919 curValue += this.currentElement.STEP_QUANTITY; 4920 4921 curValue = this.checkQuantityRange(curValue, 'up'); 4922 4923 if (this.currentElement.CHECK_QUANTITY && curValue > this.currentElement.MAX_QUANTITY) { 4924 boolSet = false;
4925 } 4926 4927 if (boolSet) { 4928 if (this.currentElement.QUANTITY_FLOAT) { 4929 curValue = Math.round(curValue * this.element.precisionFactor) / this.element.precisionFactor; 4930 } 4931 4932 4933 4934 this.nodes.obQuantity.value = curValue; 4935 4936 this.setPrice(); 4937 } 4938 } 4939 } 4940 }, 4941 4942 quantityDown: function () { 4943 var curValue = 0, 4944 boolSet = true; 4945 4946 if (this.errorCode === 0 && this.element.CONFIG.SHOW_QUANTITY === "Y" && this.currentElement.CAN_BUY) { 4947 curValue = this.currentElement.QUANTITY_FLOAT ? parseFloat(this.nodes.obQuantity.value) : parseInt(this.nodes.obQuantity.value, 10); 4948 4949 if (!isNaN(curValue)) { 4950 curValue -= this.currentElement.STEP_QUANTITY; 4951 4952 curValue = this.checkQuantityRange(curValue, 'down'); 4953 4954 if (curValue < this.currentElement.MIN_QUANTITY) { 4955 boolSet = false; 4956 } 4957 4958 if (boolSet) { 4959 if (this.currentElement.QUANTITY_FLOAT) { 4960 curValue = Math.round(curValue * this.element.precisionFactor) / this.element.precisionFactor; 4961 } 4962 4963 this.nodes.obQuantity.value = curValue; 4964 4965 this.setPrice(); 4966 } 4967 } 4968 } 4969 }, 4970 4971 quantityChange: function () { 4972 var curValue = 0, 4973 intCount; 4974 4975 4976 if (this.errorCode === 0 && this.element.CONFIG.SHOW_QUANTITY === "Y") { 4977 4978 if (this.currentElement.CAN_BUY) { 4979 4980 curValue = this.currentElement.QUANTITY_FLOAT ? parseFloat(this.nodes.obQuantity.value) : Math.round(this.nodes.obQuantity.value); 4981 4982 4983 if (!isNaN(curValue)) { 4984 curValue = this.checkQuantityRange(curValue); 4985 4986 if (this.currentElement.CHECK_QUANTITY) { 4987 if (curValue > this.currentElement.MAX_QUANTITY) { 4988 curValue = this.currentElement.MAX_QUANTITY; 4989 } 4990 } 4991 4992 this.checkPriceRange(curValue); 4993 4994 if (curValue < this.currentElement.MIN_QUANTITY) { 4995 curValue = this.currentElement.MIN_QUANTITY; 4996 } else { 4997 intCount = Math.round( 4998 Math.round(curValue * this.element.precisionFactor / this.currentElement.STEP_QUANTITY) / this.element.precisionFactor 4999 ) || 1; 5000 5001 5002 curValue = (intCount <= 1 ? this.currentElement.STEP_QUANTITY : intCount * this.currentElement.STEP_QUANTITY); 5003 5004 curValue = Math.round(curValue * this.element.precisionFactor) / this.element.precisionFactor; 5005 5006 } 5007 5008 5009 this.nodes.obQuantity.value = curValue; 5010 } else { 5011 this.nodes.obQuantity.value = this.currentElement.MIN_QUANTITY; 5012 } 5013 } else { 5014 this.nodes.obQuantity.value = this.currentElement.MIN_QUANTITY; 5015 } 5016 5017 this.setPrice(); 5018 } 5019 5020 }, 5021 5022 quantitySet: function () { 5023 5024 var strLimit, resetQuantity; 5025 5026 var newOffer = this.currentElement, 5027 oldOffer = this.oldElement; 5028 5029 if (this.errorCode === 0) { 5030 5031 this.currentElement.CAN_BUY = newOffer.CAN_BUY; 5032 5033 if (this.currentElement.CAN_BUY) { 5034 this.nodes.quantity.classList.remove('d-none'); 5035 this.nodes.obBasketActions.classList.remove('d-none'); 5036 this.nodes.obWrSubscribe.classList.add('d-none'); 5037 } else { 5038 this.nodes.quantity.classList.add('d-none'); 5039 5040 if (this.nodes.obWrSubscribe) { 5041 5042 if (newOffer.CATALOG_SUBSCRIBE === 'Y') { 5043 this.nodes.obWrSubscribe.classList.remove('d-none'); 5044 this.nodes.obWrSubscribe.setAttribute('data-item', newOffer.ID); 5045 BX(this.element.VISUAL.SUBSCRIBE_LINK + '_hidden').click(); 5046 } else { 5047 this.nodes.obWrSubscribe.classList.add('d-none'); 5048 } 5049 } 5050 } 5051 5052 this.currentElement.QUANTITY_FLOAT = newOffer.QUANTITY_FLOAT; 5053 this.element.CHECK_QUANTITY = newOffer.CHECK_QUANTITY; 5054 5055 5056 5057 if (this.currentElement.QUANTITY_FLOAT) { 5058 this.currentElement.STEP_QUANTITY = Math.round(parseFloat(newOffer.STEP_QUANTITY) * this.element.precisionFactor) / this.element.precisionFactor; 5059 this.currentElement.MAX_QUANTITY = parseFloat(newOffer.MAX_QUANTITY); 5060 this.currentElement.MIN_QUANTITY = this.currentElement.ITEM_PRICE_MODE === 'Q' ? parseFloat(this.currentElement.ITEM_PRICES[this.currentElement.ITEM_PRICE_SELECTED].MIN_QUANTITY) : this.currentElement.STEP_QUANTITY; 5061 } else { 5062 this.currentElement.STEP_QUANTITY = parseInt(newOffer.STEP_QUANTITY, 10); 5063 this.currentElement.MAX_QUANTITY = parseInt(newOffer.MAX_QUANTITY, 10); 5064 this.currentElement.MIN_QUANTITY = this.currentElement.ITEM_PRICE_MODE === 'Q' ? parseInt(this.currentElement.ITEM_PRICES[this.currentElement.ITEM_PRICE_SELECTED].MIN_QUANTITY) : this.currentElement.STEP_QUANTITY; 5065 } 5066 5067 5068 5069 if (this.element.CONFIG.SHOW_QUANTITY) { 5070 var isDifferentMinQuantity = oldOffer.ITEM_PRICES.length && 5071 oldOffer.ITEM_PRICES[oldOffer.ITEM_PRICE_SELECTED] && 5072 oldOffer.ITEM_PRICES[oldOffer.ITEM_PRICE_SELECTED].MIN_QUANTITY != this.currentElement.MIN_QUANTITY; 5073 5074 if (this.currentElement.QUANTITY_FLOAT) { 5075 resetQuantity = Math.round(parseFloat(oldOffer.STEP_QUANTITY) * this.element.precisionFactor) / this.element.precisionFactor !== this.currentElement.STEP_QUANTITY || 5076 isDifferentMinQuantity || 5077 oldOffer.MEASURE !== newOffer.MEASURE || 5078 ( 5079 this.currentElement.CHECK_QUANTITY && 5080 parseFloat(oldOffer.MAX_QUANTITY) > this.currentElement.MAX_QUANTITY && 5081 parseFloat(this.nodes.obQuantity.value) > this.currentElement.MAX_QUANTITY 5082 ); 5083 } else { 5084 resetQuantity = parseInt(oldOffer.STEP_QUANTITY, 10) !== this.currentElement.STEP_QUANTITY || 5085 isDifferentMinQuantity || 5086 oldOffer.MEASURE !== newOffer.MEASURE || 5087 ( 5088 this.currentElement.CHECK_QUANTITY && 5089 parseInt(oldOffer.MAX_QUANTITY, 10) > this.currentElement.MAX_QUANTITY && 5090 parseInt(this.nodes.obQuantity.value, 10) > this.currentElement.MAX_QUANTITY 5091 ); 5092 } 5093 5094 this.nodes.obQuantity.disabled = !this.currentElement.CAN_BUY; 5095 5096 if (resetQuantity) { 5097 this.nodes.obQuantity.value = this.currentElement.MIN_QUANTITY; 5098 } 5099 } 5100 5101 if (this.nodes.obMeasure) { 5102 5103 if (newOffer.MEASURE_HTML) { 5104 BX.adjust(this.nodes.obMeasure, { 5105 html: newOffer.MEASURE_HTML, 5106 style: { 5107 display: '' 5108 } 5109 }); 5110 } else { 5111 BX.adjust(this.nodes.obMeasure, { 5112 html: '', 5113 style: { 5114 display: 'none' 5115 } 5116 }); 5117 } 5118 } 5119 5120 } 5121 }, 5122 5123 getCanBuy: function (arFilter) { 5124 var i, 5125 j = 0, 5126 boolOneSearch = true, 5127 boolSearch = false;
5128 5129 for (i = 0; i < this.element.OFFERS.length; i++) { 5130 boolOneSearch = true; 5131 5132 for (j in arFilter) { 5133 if (arFilter[j] !== this.element.OFFERS[i].TREE[j]) { 5134 boolOneSearch = false; 5135 break; 5136 } 5137 } 5138 5139 if (boolOneSearch) { 5140 if (this.element.OFFERS[i].CAN_BUY) { 5141 boolSearch = true; 5142 break; 5143 } 5144 } 5145 } 5146 5147 return boolSearch; 5148 }, 5149 5150 5151 5152 drawImages: function (images) { 5153 5154 var nodeControlPics = $(this.nodes.obBigSlider).find(".controls-pictures"), 5155 nodeBigPics = $(this.nodes.obBigSlider).find(".wrapper-big-picture"), 5156 nodeControlPicsParent = nodeControlPics.parent(), 5157 nodeBigPicsParent = nodeBigPics.parent(), 5158 listControl = "", 5159 listBigPic = "", 5160 imagesIsset = images && BX.type.isArray(images), 5161 countMoreImages = 0, 5162 countImages = 0; 5163 5164 5165 nodeControlPics.removeClass('one-photo').html(""); 5166 nodeBigPics.html(""); 5167 5168 5169 if (imagesIsset) { 5170 countImages = images.length; 5171 5172 if (countImages > 0) { 5173 5174 for (i = 0; i < images.length; i++) { 5175 5176 if (i < 3) { 5177 listControl += "<div data-value='" + images[i].ID + "'"; 5178 listControl += "class='small-picture"; 5179 5180 if (i == 0) { 5181 listControl += " active"; 5182 } 5183 listControl += "'>"; 5184 5185 5186 listControl += "<img src='" + images[i].SMALL.SRC + "' alt = '"; 5187 5188 if (images[i].DESC) 5189 listControl += images[i].DESC; 5190 5191 listControl += "'/>"; 5192 5193 listControl += "</div>"; 5194 } 5195 5196 5197 5198 listBigPic += "<div data-id='" + images[i].ID + "'"; 5199 listBigPic += "class='big-picture"; 5200 5201 if (i == 0) { 5202 listBigPic += " active"; 5203 } 5204 listBigPic += "'>"; 5205 5206 listBigPic += "<a class='cursor-loop d-block open-popup-gallery " + this.element.CONFIG.ZOOM + "-offer' data-popup-gallery='" + this.currentElement.ID + "_" + this.element.OBJ_ID + "'>"; 5207 5208 listBigPic += "<img class='d-block mx-auto img-fluid open-popup-gallery-item' data-src='" + images[i].BIG.SRC + "' src='" + images[i].BIG.SRC + "' title='" + this.element.TITLE + "'"; 5209 listBigPic += " data-popup-gallery='" + this.currentElement.ID + "_" + this.element.OBJ_ID + "'"; 5210 listBigPic += " data-small-src = '" + images[i].SMALL.SRC + "'"; 5211 listBigPic += " data-big-src = '" + images[i].BIG.SRC + "'"; 5212 listBigPic += " data-desc ='" + images[i].DESC + "'"; 5213 listBigPic += " alt ='" + images[i].DESC + "'"; 5214 listBigPic += ">"; 5215 5216 5217 listBigPic += "</a>"; 5218 5219 listBigPic += "</div>"; 5220 5221 } 5222 5223 if (images.length > 3) { 5224 countMoreImages = images.length - 3; 5225 listControl += "<div class='more open-popup-gallery' data-popup-gallery='" + this.currentElement.ID + "_" + this.element.OBJ_ID + "'><a>" + BX.message('MORE_PHOTOS') + ' ' + (images.length - 3) + "</a></div>"; 5226 } 5227 } 5228 5229 } else { 5230 listBigPic += "<div"; 5231 listBigPic += "class='big-picture active'>"; 5232 5233 5234 listBigPic += "<img src='" + this.no_photo_src + "' title='" + this.config.title + "'>"; 5235 5236 5237 5238 listBigPic += "</div>"; 5239 } 5240 5241 nodeBigPics.html(listBigPic); 5242 nodeControlPics.html(listControl); 5243 5244 5245 if (countImages > 1 || nodeControlPicsParent.hasClass('video')) { 5246 5247 nodeControlPicsParent.removeClass('d-none'); 5248 5249 nodeControlPicsParent.addClass('col-2'); 5250 nodeBigPicsParent.removeClass('col-12'); 5251 nodeBigPicsParent.addClass('col-10'); 5252 5253 } else { 5254 nodeControlPicsParent.addClass('d-none'); 5255 nodeBigPicsParent.removeClass('col-10'); 5256 nodeBigPicsParent.addClass('col-12'); 5257 } 5258 5259 } 5260 5261 }; 5262 5263 window.JCCatalogItem = function (arParams) {
5264 this.element = arParams; 5265 this.nodes = {}; 5266 this.currentElement = {}; 5267 this.oldElement = {}; 5268 this.firstLoad = true; 5269 this.errorCode = 0; 5270 this.selectedValues = {}; 5271 5272 5273 5274 if (typeof arParams === 'object') { 5275 this.initConfig(); 5276 5277 switch (this.element.PRODUCT_TYPE) { 5278 case 0: 5279 case 1: 5280 case 2: 5281 this.initProductData(); 5282 break; 5283 case 3: 5284 this.initOffersData(); 5285 break; 5286 default: 5287 this.errorCode = -1; 5288 } 5289 5290 } 5291 5292 if (this.errorCode === 0) 5293 BX.ready(BX.delegate(this.init, this)); 5294 }; 5295 5296 window.JCCatalogItem.prototype = { 5297 5298 initConfig: function () { 5299 this.nodes.obProduct = BX(this.element.VISUAL.ID); 5300 5301 if (!this.nodes.obProduct) 5302 this.errorCode = -1; 5303 5304 5305 this.element.PRODUCT_TYPE = parseInt(this.element.PRODUCT_TYPE, 10); 5306 5307 this.nodes.obPriceMatrix = BX(this.element.VISUAL.PRICE_MATRIX); 5308 this.nodes.obMeasure = BX(this.element.VISUAL.QUANTITY_MEASURE); 5309 this.nodes.obPreviewText = BX(this.element.VISUAL.PREVIEW_TEXT); 5310 this.nodes.obShortDescription = BX(this.element.VISUAL.SHORT_DESCRIPTION); 5311 this.nodes.obArticleAvailable = BX(this.element.VISUAL.ARTICLE_AVAILABLE); 5312 this.nodes.obSkuChars = BX(this.element.VISUAL.SKU_CHARS); 5313 this.nodes.obPict = BX(this.element.VISUAL.PICT); 5314 5315 this.nodes.obBasketActions = BX(this.element.VISUAL.BASKET_ACTIONS); 5316 5317 this.nodes.obWrAdd2BasketBtn = BX(this.element.VISUAL.WR_ADD2BASKET); 5318 5319 5320 this.nodes.obAdd2BasketBtn = BX(this.element.VISUAL.ADD2BASKET); 5321 this.nodes.obMove2Basket = BX(this.element.VISUAL.MOVE2BASKET); 5322 this.nodes.obAdd2BasketBtn && BX.bind(this.nodes.obAdd2BasketBtn, 'click', BX.proxy(this.add2Basket, this)); 5323 5324 5325 this.nodes.obDetailUrlImg = BX(this.element.VISUAL.DETAIL_URL_IMG); 5326 this.nodes.obName = BX(this.element.VISUAL.NAME); 5327 5328 this.nodes.obBtn2pageProduct = BX(this.element.VISUAL.BTN2DETAIL_PAGE_PRODUCT); 5329 5330 5331 5332 if (this.element.CONFIG.USE_DELAY === "Y") { 5333 this.nodes.obDelay = BX(this.element.VISUAL.DELAY); 5334 this.nodes.obDelay && BX.bind(this.nodes.obDelay, 'click', BX.proxy(this.add2Delay, this)); 5335 } 5336 5337 if (this.element.CONFIG.USE_COMPARE === "Y") { 5338 this.nodes.obCompare = BX(this.element.VISUAL.COMPARE); 5339 this.nodes.obCompare && BX.bind(this.nodes.obCompare, 'click', BX.proxy(this.add2Compare, this)); 5340 } 5341 5342 if (this.element.CONFIG.SHOW_PRICE === "Y") { 5343 this.nodes.obPrice = { 5344 price: null, 5345 old: null, 5346 percent: null 5347 }; 5348 5349 this.nodes.obPrice.price = BX(this.element.VISUAL.PRICE); 5350 5351 if (!this.nodes.obPrice.price) { 5352 this.errorCode = -16; 5353 } else { 5354 this.nodes.obPrice.old = BX(this.element.VISUAL.OLD_PRICE); 5355 this.nodes.obPrice.percent = BX(this.element.VISUAL.DISCOUNT_PERCENT); 5356 } 5357 5358 } 5359 5360 if (this.element.CONFIG.SHOW_QUANTITY === "Y") { 5361 this.nodes.obQuantity = BX(this.element.VISUAL.QUANTITY); 5362 this.nodes.quantity = this.nodes.obProduct.querySelector('.quantity-block'); 5363 5364 5365 5366 if (this.element.VISUAL.QUANTITY_UP) { 5367 this.nodes.obQuantityUp = BX(this.element.VISUAL.QUANTITY_UP); 5368 BX.bind(this.nodes.obQuantityUp, 'click', BX.delegate(this.quantityUp, this)); 5369 5370 } 5371 5372 if (this.element.VISUAL.QUANTITY_DOWN) { 5373 this.nodes.obQuantityDown = BX(this.element.VISUAL.QUANTITY_DOWN); 5374 BX.bind(this.nodes.obQuantityDown, 'click', BX.delegate(this.quantityDown, this)); 5375 } 5376 5377 if (this.nodes.obQuantity) 5378 BX.bind(this.nodes.obQuantity, 'change', BX.delegate(this.quantityChange, this)); 5379 5380 5381 this.element.precisionFactor = Math.pow(10, this.element.CONFIG.PRECISION); 5382 } 5383 5384 }, 5385 5386 initProductData: function () { 5387 this.currentElement = this.element; 5388 5389 this.oldElement = this.currentElement; 5390 5391 this.currentElement.MAX_QUANTITY = this.currentElement.QUANTITY_FLOAT ? 5392 parseFloat(this.element.MAX_QUANTITY) : 5393 parseInt(this.element.MAX_QUANTITY, 10); 5394 this.currentElement.STEP_QUANTITY = this.currentElement.QUANTITY_FLOAT ? 5395 parseFloat(this.currentElement.STEP_QUANTITY) : 5396 parseInt(this.currentElement.STEP_QUANTITY, 10); 5397 5398 this.currentElement.MIN_QUANTITY = this.currentElement.ITEM_PRICE_MODE === 'Q' ? parseFloat(this.currentElement.ITEM_PRICES[this.currentElement.ITEM_PRICE_SELECTED].MIN_QUANTITY) : this.currentElement.STEP_QUANTITY; 5399 5400 if (this.currentElement.QUANTITY_FLOAT) 5401 this.currentElement.STEP_QUANTITY = Math.round(this.currentElement.STEP_QUANTITY * this.element.precisionFactor) / this.element.precisionFactor; 5402 5403 this.setPrice(); 5404 this.setQuantityHtml(); 5405 this.btnsControl(); 5406 5407 if (this.nodes.obPriceMatrix && this.currentElement.PRICE_MATRIX_RESULT.HTML) 5408 this.setPriceMatrix(this.currentElement.PRICE_MATRIX_RESULT.HTML); 5409 }, 5410 5411 initOffersData: function () { 5412 5413 if (this.element.CONFIG.SHOW_OFFERS) { 5414 this.currentElement = this.element.OFFERS[this.element.OFFER_ID_SELECTED]; 5415 this.nodes.obTree = BX(this.element.VISUAL.TREE); 5416 5417 if (!this.nodes.obTree) 5418 this.errorCode = -256; 5419 } else { 5420 this.hideBtns(); 5421 this.errorCode = -1; 5422 } 5423 5424 5425 }, 5426 5427 init: function () { 5428 var i = 0, 5429 j = 0, 5430 treeItems = null; 5431 5432 5433 if (this.errorCode === 0) { 5434 5435 switch (this.element.PRODUCT_TYPE) { 5436 case 0: 5437 case 1: 5438 case 2: 5439
5440 this.checkQuantityControls(); 5441 break; 5442 5443 case 3: 5444 5445 treeItems = this.nodes.obTree.querySelectorAll('li'); 5446 5447 for (i = 0; i < treeItems.length; i++) { 5448 BX.bind(treeItems[i], 'click', BX.delegate(this.selectOfferProp, this)); 5449 } 5450 5451 5452 this.setCurrent(); 5453 break; 5454 } 5455 5456 } 5457 5458 5459 }, 5460 5461 add2Basket: function () { 5462 5463 if (!this.currentElement.CAN_BUY) 5464 return; 5465 5466 var productID = '', 5467 value = 1; 5468 5469 if (this.nodes.obQuantity) 5470 value = this.nodes.obQuantity.value; 5471 5472 5473 productItem = { 5474 PRODUCT_ID: this.currentElement.ID, 5475 QUANTITY: value, 5476 PRICE_ID: this.currentElement.ITEM_PRICES[this.currentElement.ITEM_PRICE_SELECTED].ID 5477 }; 5478 5479 $(this.nodes.obAdd2BasketBtn).addClass("btn-processing"); 5480 5481 BX.ajax({ 5482 method: 'POST', 5483 dataType: 'json', 5484 url: '/bitrix/tools/concept.phoenix/ajax/basket/add2basket.php', 5485 data: { 5486 productItem: productItem, 5487 site_id: $("input.site_id").val() 5488 }, 5489 onsuccess: BX.proxy(this.basketResult, this) 5490 }); 5491 }, 5492 5493 basketResult: function (arResult) { 5494 if (arResult["OK"] == "Y") { 5495 if (this.element.PRODUCT_TYPE === 3) 5496 this.element.OFFERS[this.element.OFFER_ID_SELECTED].IN_BASKET = true; 5497 5498 markProductAddBasket(this.currentElement.ID); 5499 5500 if (arResult["SCRIPTS"]) 5501 $('body').append(arResult["SCRIPTS"]); 5502 } 5503 5504 $(this.nodes.obAdd2BasketBtn).removeClass("btn-processing"); 5505 }, 5506 5507 add2Delay: function () { 5508 var productID = '', 5509 value = 1; 5510 5511 if (this.nodes.obQuantity) 5512 value = this.nodes.obQuantity.value; 5513 5514 5515 BX.ajax({ 5516 method: 'POST', 5517 dataType: 'json', 5518 url: '/bitrix/tools/concept.phoenix/ajax/basket/wishlist.php', 5519 data: { 5520 product_id: this.currentElement.ID, 5521 price_id: this.currentElement.ITEM_PRICES[this.currentElement.ITEM_PRICE_SELECTED].ID, 5522 price: this.currentElement.ITEM_PRICES[this.currentElement.ITEM_PRICE_SELECTED].PRICE, 5523 name: this.currentElement.NAME, 5524 detail_page: this.currentElement.DETAIL_PAGE_URL, 5525 can_buy: this.currentElement.CAN_BUY, 5526 quantity: value, 5527 currency: this.currentElement.ITEM_PRICES[this.currentElement.ITEM_PRICE_SELECTED].CURRENCY, 5528 site_id: $("input.site_id").val() 5529 }, 5530 onsuccess: BX.proxy(this.delayResult, this) 5531 }); 5532 }, 5533 5534 delayResult: function (arResult) { 5535 if (arResult["OK"] == "Y") { 5536 if (this.element.PRODUCT_TYPE == 3) { 5537 if (arResult["ACTION"] == 'active') 5538 this.currentElement.IN_DELAY = true; 5539 5540 if (arResult["ACTION"] == 'delete') 5541 this.currentElement.IN_DELAY = false; 5542 } 5543 5544 markProductDelayBasket(this.currentElement.ID, arResult["ACTION"]); 5545 } else { 5546 console.log(arResult["OK"]); 5547 } 5548 }, 5549 5550 add2Compare: function () { 5551 5552 var checked = false; 5553 5554 if (!BX.hasClass(this.nodes.obCompare, "active")) 5555 checked = true; 5556 5557 var url = checked ? this.element.CONFIG.COMPARE_URL + '?action=ADD_TO_COMPARE_LIST&id=#ID#' : this.element.CONFIG.COMPARE_URL + '?action=DELETE_FROM_COMPARE_LIST&id=#ID#', 5558 compareLink; 5559 5560 if (url) { 5561 5562 compareLink = url.replace('#ID#', this.currentElement.ID); 5563 5564 5565 5566 BX.ajax({ 5567 method: 'POST', 5568 dataType: checked ? 'json' : 'html', 5569 url: compareLink + (compareLink.indexOf('?') !== -1 ? '&' : '?') + 'ajax_action=Y', 5570 onsuccess: checked ? 5571 BX.proxy(this.compareResult, this) : BX.proxy(this.compareDeleteResult, this) 5572 }); 5573 } 5574 }, 5575 5576 compareResult: function (arResult) { 5577 5578 if (this.element.OFFERS.length > 0) 5579 this.currentElement.IN_COMPARE = true; 5580 5581 5582 markProductCompareBasket(this.currentItemId, 'active'); 5583 5584 }, 5585 5586 compareDeleteResult: function (arResult) { 5587 5588 if (this.element.OFFERS.length > 0) 5589 this.currentElement.IN_COMPARE = false;
5590 5591 5592 markProductCompareBasket(this.currentItemId, 'delete'); 5593 5594 }, 5595 5596 showArticleStoreQuantity: function () { 5597 var showArticle = false, 5598 showQuantity = false, 5599 html = ""; 5600 5601 var obAvailable = this.nodes.obArticleAvailable.querySelector(".product-available-js"), 5602 obArticle = this.nodes.obArticleAvailable.querySelector(".detail-article"); 5603 5604 if (this.currentElement.QUANTITY.HTML.length > 0) { 5605 obAvailable.innerHTML = this.currentElement.QUANTITY.HTML; 5606 obAvailable.classList.remove('d-none'); 5607 showQuantity = true; 5608 } else { 5609 obAvailable.classList.add('d-none'); 5610 } 5611 5612 if (this.currentElement.ARTICLE) { 5613 obArticle.innerHTML = BX.message("ARTICLE") + this.currentElement.ARTICLE; 5614 obArticle.title = obArticle.innerHTML; 5615 obArticle.classList.remove('d-none'); 5616 showArticle = true; 5617 } else { 5618 obArticle.classList.add('d-none'); 5619 } 5620 5621 5622 if (showArticle || showQuantity) { 5623 this.nodes.obArticleAvailable.classList.remove('d-none'); 5624 } else { 5625 this.nodes.obArticleAvailable.classList.add('d-none'); 5626 } 5627 5628 }, 5629 5630 selectOfferProp: function () { 5631 var i = 0, 5632 strTreeValue = '', 5633 arTreeItem = [], 5634 rowItems = null, 5635 target = BX.proxy_context, 5636 smallCardItem; 5637 5638 5639 if (target && target.hasAttribute('data-treevalue')) { 5640 if (BX.hasClass(target, 'active')) 5641 return; 5642 5643 5644 5645 if (typeof document.activeElement === 'object') { 5646 document.activeElement.blur(); 5647 } 5648 5649 5650 5651 strTreeValue = target.getAttribute('data-treevalue'); 5652 arTreeItem = strTreeValue.split('_'); 5653 5654 this.searchOfferPropIndex(arTreeItem[0], arTreeItem[1]); 5655 5656 5657 rowItems = BX.findChildren(target.parentNode, { 5658 tagName: 'li' 5659 }, false); 5660 5661 5662 if (rowItems && rowItems.length) { 5663 for (i = 0; i < rowItems.length; i++) { 5664 BX.removeClass(rowItems[i], 'active'); 5665 } 5666 } 5667 5668 5669 BX.addClass(target, 'active'); 5670 5671 } 5672 }, 5673 5674 searchOfferPropIndex: function (strPropID, strPropValue) { 5675 var strName = '', 5676 arShowValues = false, 5677 arCanBuyValues = [], 5678 allValues = [], 5679 index = -1, 5680 i, j, 5681 arFilter = {}, 5682 tmpFilter = []; 5683 5684 5685 5686 for (i = 0; i < this.element.TREE_PROPS.length; i++) { 5687 if (this.element.TREE_PROPS[i].ID === strPropID) { 5688 index = i; 5689 break; 5690 } 5691 } 5692 5693 if (index > -1) { 5694 for (i = 0; i < index; i++) { 5695 strName = 'PROP_' + this.element.TREE_PROPS[i].ID; 5696 arFilter[strName] = this.selectedValues[strName]; 5697 } 5698 5699 5700 strName = 'PROP_' + this.element.TREE_PROPS[index].ID; 5701 arFilter[strName] = strPropValue; 5702 5703 5704 5705 for (i = index + 1; i < this.element.TREE_PROPS.length; i++) { 5706 5707 strName = 'PROP_' + this.element.TREE_PROPS[i].ID; 5708 arShowValues = this.getRowValues(arFilter, strName); 5709 5710 5711 5712 if (!arShowValues) 5713 break; 5714 5715 allValues = []; 5716 5717 if (this.element.CONFIG.SHOW_ABSENT === 'Y') { 5718 5719 arCanBuyValues = []; 5720 tmpFilter = []; 5721 tmpFilter = BX.clone(arFilter, true); 5722 5723 for (j = 0; j < arShowValues.length; j++) { 5724 tmpFilter[strName] = arShowValues[j]; 5725 allValues[allValues.length] = arShowValues[j]; 5726 if (this.getCanBuy(tmpFilter)) 5727 arCanBuyValues[arCanBuyValues.length] = arShowValues[j]; 5728 } 5729 } else { 5730 arCanBuyValues = arShowValues; 5731 } 5732 5733 5734 5735 5736 if (this.selectedValues[strName] && BX.util.in_array(this.selectedValues[strName], arC
5736anBuyValues)) { 5737 arFilter[strName] = this.selectedValues[strName]; 5738 5739 } else { 5740 5741 if (this.element.CONFIG.SHOW_ABSENT === 'Y') { 5742 arFilter[strName] = (arCanBuyValues.length ? arCanBuyValues[0] : allValues[0]); 5743 } else { 5744 arFilter[strName] = arCanBuyValues[0]; 5745 } 5746 } 5747 5748 5749 this.updateRow(i, arFilter[strName], arShowValues, arCanBuyValues); 5750 5751 } 5752 5753 5754 this.selectedValues = arFilter; 5755 5756 this.changeInfo(); 5757 5758 } 5759 5760 }, 5761 5762 setCurrent: function () { 5763 var i, 5764 j = 0, 5765 strName = '', 5766 arShowValues = false, 5767 arCanBuyValues = [], 5768 arFilter = {}, 5769 tmpFilter = [], 5770 current = this.currentElement.TREE; 5771 5772 5773 for (i = 0; i < this.element.TREE_PROPS.length; i++) { 5774 strName = 'PROP_' + this.element.TREE_PROPS[i].ID; 5775 arShowValues = this.getRowValues(arFilter, strName); 5776 5777 5778 if (!arShowValues) 5779 break; 5780 5781 if (BX.util.in_array(current[strName], arShowValues)) { 5782 arFilter[strName] = current[strName]; 5783 } else { 5784 arFilter[strName] = arShowValues[0]; 5785 this.element.OFFER_ID_SELECTED = 0; 5786 } 5787 5788 if (this.element.CONFIG.SHOW_ABSENT === 'Y') { 5789 arCanBuyValues = []; 5790 tmpFilter = []; 5791 tmpFilter = BX.clone(arFilter, true); 5792 5793 for (j = 0; j < arShowValues.length; j++) { 5794 tmpFilter[strName] = arShowValues[j]; 5795 5796 if (this.getCanBuy(tmpFilter)) { 5797 arCanBuyValues[arCanBuyValues.length] = arShowValues[j]; 5798 } 5799 } 5800 } else { 5801 arCanBuyValues = arShowValues; 5802 } 5803 5804 5805 this.updateRow(i, arFilter[strName], arShowValues, arCanBuyValues); 5806 } 5807 5808 this.selectedValues = arFilter; 5809 5810 this.changeInfo(); 5811 }, 5812 5813 getRowValues: function (arFilter, index) { 5814 var arValues = [], 5815 i = 0, 5816 j = 0, 5817 boolSearch = false, 5818 boolOneSearch = true; 5819 5820 5821 5822 if (arFilter.length === 0) { 5823 for (i = 0; i < this.element.OFFERS.length; i++) { 5824 if (!BX.util.in_array(this.element.OFFERS[i].TREE[index], arValues)) { 5825 arValues[arValues.length] = this.element.OFFERS[i].TREE[index]; 5826 5827 } 5828 } 5829 boolSearch = true; 5830 } else { 5831 for (i = 0; i < this.element.OFFERS.length; i++) { 5832 boolOneSearch = true; 5833 5834 for (j in arFilter) { 5835 if (arFilter[j] !== this.element.OFFERS[i].TREE[j]) { 5836 boolOneSearch = false; 5837 break; 5838 } 5839 } 5840 5841 if (boolOneSearch) { 5842 if (!BX.util.in_array(this.element.OFFERS[i].TREE[index], arValues)) { 5843 arValues[arValues.length] = this.element.OFFERS[i].TREE[index]; 5844 5845 } 5846 5847 boolSearch = true; 5848 } 5849 } 5850 } 5851 5852 5853 5854 return (boolSearch ? arValues : false); 5855 }, 5856 5857 updateRow: function (intNumber, activeId, showId, canBuyId) { 5858 5859 var i = 0, 5860 value = '', 5861 isCurrent = false, 5862 rowItems = null; 5863 5864 5865 var lineContainer = this.nodes.obTree.querySelectorAll('.wrapper-sku-props'); 5866 5867 5868 if (intNumber > -1 && intNumber < lineContainer.length) { 5869 rowItems = lineContainer[intNumber].querySelectorAll('li'); 5870 5871 5872 5873 for (i = 0; i < rowItems.length; i++) { 5874 value = rowItems[i].getAttribute('data-onevalue'); 5875 isCurrent = value === activeId; 5876 5877 if (isCurrent) { 5878 BX.addClass(rowItems[i], 'active'); 5879 } else { 5880 BX.removeClass(rowItems[i], 'active'); 5881 } 5882 5883 if (BX.util.in_array(value, canBuyId)) { 5884 BX.removeClass(rowItems[i], 'notallowed'); 5885 } else { 5886 BX.addClass(rowItems[i], 'notallowed'); 5887 } 5888 5889 rowItems[i].style.display = BX.util.in_array(value, showId) ? '' : 'none'; 5890 5891 if (isCurrent) { 5892 lineContainer[intNumber].style.display = (value == 0) ? 'none' : ''; 5893 } 5894 } 5895 } 5896 }, 5897 5898 changeInfo: function () { 5899 var index = -1, 5900 j = 0, 5901 boolOneSearch = true, 5902 descTitle = null, 5903 rowItems = null; 5904 5905 var i; 5906 5907 for (i = 0; i < this.element.OFFERS.length; i++) { 5908 boolOneSearch = true; 5909 5910 for (j in this.selectedValues) { 5911 5912 if (this.selectedValues[j] !== this.element.OFFERS[i].TREE[j]) { 5913 boolOneSearch = false;
5914 break; 5915 } 5916 5917 } 5918 5919 if (boolOneSearch) { 5920 index = i; 5921 break; 5922 } 5923 } 5924 5925 this.oldElement = this.currentElement; 5926 5927 this.element.OFFER_ID_SELECTED = index; 5928 this.currentElement = this.element.OFFERS[this.element.OFFER_ID_SELECTED]; 5929 5930 this.changeCharsBlock(); 5931 5932 if (index > -1) { 5933 5934 if (this.nodes.obPriceMatrix && this.currentElement.PRICE_MATRIX_RESULT.HTML) 5935 this.setPriceMatrix(this.currentElement.PRICE_MATRIX_RESULT.HTML); 5936 5937 this.updateInfoBasketOffer(this.currentElement.ID, this.element.VISUAL.ID); 5938 5939 5940 for (i = 0; i < this.element.OFFERS.length; i++) { 5941 if (this.element.CONFIG.OFFER_GROUP && this.element.OFFERS[i].OFFER_GROUP) { 5942 if (offerGroupNode = BX(this.element.VISUAL.OFFER_GROUP + this.element.OFFERS[i].ID)) 5943 offerGroupNode.style.display = (i == index ? '' : 'none'); 5944 5945 } 5946 } 5947 5948 $("input.product-" + this.currentElement.ID + "-picture-src-small").val(this.currentElement.PHOTO); 5949 5950 if (this.element.CONFIG.ZOOM) { 5951 $(this.nodes.obProduct).find('.zoom-offer').trigger('zoom
5951-offer.destroy'); 5952 initZoomer($(this.nodes.obProduct).find(".zoom-offer")); 5953 } 5954 5955 5956 if (this.currentElement.IN_BASKET == true || 5957 this.currentElement.IN_DELAY == true || 5958 this.currentElement.IN_COMPARE == true 5959 ) { 5960 5961 setItemButtonStatus( 5962 this.currentElement.ID, 5963 '', 5964 this.currentElement.IN_BASKET, 5965 this.currentElement.IN_DELAY, 5966 this.currentElement.IN_COMPARE 5967 ); 5968 5969 5970 setItemButtonStatus(this.currentElement.ID, '', 'offer_delay_added'); 5971 setItemButtonStatus(this.currentElement.ID, '', 'compare_added'); 5972 5973 } else { 5974 setItemButtonStatus(arStatusBasketPhoenix); 5975 } 5976 } 5977 5978 this.quantitySet(); 5979 this.setPrice(); 5980 this.btnsControl(); 5981 this.setQuantityHtml(); 5982 5983 if (!this.firstLoad) { 5984 this.drawPicture(); 5985 5986 this.changeDetailUrl(this.currentElement.ID); 5987 5988 if (this.nodes.obShortDescription) 5989 this.changeText(this.nodes.obShortDescription, this.currentElement.SHORT_DESCRIPTION_HTML); 5990 5991 if (this.nodes.obPreviewText) 5992 this.changeText(this.nodes.obPreviewText, this.currentElement.PREVIEW_TEXT_HTML); 5993 5994 this.showArticleStoreQuantity(); 5995 } 5996 5997 5998 this.firstLoad = false; 5999 this.updateInfoBasketOffer(this.currentElement.ID, this.element.VISUAL.ID); 6000 }, 6001 6002 setQuantityHtml: function () { 6003 6004 var productAvailableValue = this.nodes.obProduct.querySelector(".product-available-js"); 6005 6006 if (this.currentElement.QUANTITY.HTML && productAvailableValue) { 6007 productAvailableValue.innerHTML = this.currentElement.QUANTITY.HTML; 6008 productAvailableValue.classList.add("active"); 6009 } 6010 }, 6011 6012 setPrice: function () { 6013 var price; 6014 6015 6016 if (this.nodes.obQuantity) 6017 this.checkPriceRange(this.nodes.obQuantity.value); 6018 6019 this.checkQuantityControls(); 6020 6021 price = this.currentElement.ITEM_PRICES[this.currentElement.ITEM_PRICE_SELECTED]; 6022 6023 6024 var blockPrice = this.nodes.obProduct.querySelector('.block-price'); 6025 6026 if (this.nodes.obPrice.price) { 6027 var showPrice = true; 6028 6029 if (this.currentElement.MODE_ARCHIVE === 'Y' || price.PRICE == "-1") 6030 showPrice = false; 6031 6032 if (showPrice) { 6033 this.nodes.obPrice.price.innerHTML = price.PRINT_PRICE; 6034 blockPrice.classList.remove("d-none"); 6035 6036 var nameTypePrice = this.nodes.obProduct.querySelector(".name-type-price"); 6037 6038 if (price.NAME && !this.currentElement.PRICE_MATRIX_RESULT.EXTRA_PRICE) { 6039 nameTypePrice.innerHTML = price.NAME; 6040 nameTypePrice.classList.remove('d-none'); 6041 } else { 6042 nameTypePrice.innerHTML = ''; 6043 nameTypePrice.classList.add('d-none'); 6044 } 6045 6046 if (price && price.RATIO_PRICE !== price.RATIO_BASE_PRICE) {
6047 if (this.element.CONFIG.SHOW_OLD_PRICE === "Y") { 6048 this.nodes.obPrice.old.classList.remove("d-none"); 6049 this.nodes.obPrice.old.innerHTML = price.PRINT_BASE_PRICE; 6050 6051 if (this.element.CONFIG.SHOW_DISCOUNT_PERCENT === "Y" && price.PERCENT > 0) { 6052 this.nodes.obPrice.percent.innerHTML = (-price.PERCENT) + "%"; 6053 this.nodes.obPrice.percent.classList.remove('d-none'); 6054 } else { 6055 this.nodes.obPrice.percent.classList.add('d-none'); 6056 } 6057 } 6058 } else { 6059 this.nodes.obPrice.old.classList.add("d-none"); 6060 this.nodes.obPrice.percent.classList.add('d-none'); 6061 } 6062 } else { 6063 this.nodes.obPrice.price.innerHTML = ""; 6064 blockPrice.classList.add("d-none"); 6065 } 6066 } 6067 }, 6068 6069 checkPriceRange: function (quantity) { 6070 if (typeof quantity === 'undefined' || this.currentElement.ITEM_PRICE_MODE !== 'Q') 6071 return; 6072 6073 6074 var range, found = false; 6075 6076 for (var i in this.currentElement.ITEM_QUANTITY_RANGES) { 6077 if (this.currentElement.ITEM_QUANTITY_RANGES.hasOwnProperty(i)) { 6078 range = this.currentElement.ITEM_QUANTITY_RANGES[i]; 6079 6080 6081 if ( 6082 parseFloat(quantity) >= parseFloat(range.SORT_FROM) && 6083 ( 6084 range.SORT_TO === 'INF' || 6085 parseFloat(quantity) <= parseFloat(range.SORT_TO) 6086 ) 6087 ) { 6088 found = true; 6089 this.currentElement.ITEM_QUANTITY_RANGE_SELECTED = range.HASH; 6090 break; 6091 } 6092 } 6093 } 6094 6095 if (!found && (range = this.getMinPriceRange())) { 6096 this.currentElement.ITEM_QUANTITY_RANGE_SELECTED = range.HASH; 6097 } 6098 6099 for (var k in this.currentElement.ITEM_PRICES) { 6100 if (this.currentElement.ITEM_PRICES.hasOwnProperty(k)) { 6101 if (this.currentElement.ITEM_PRICES[k].QUANTITY_HASH == this.currentElement.ITEM_QUANTITY_RANGE_SELECTED) { 6102 this.currentElement.ITEM_PRICE_SELECTED = k; 6103 break; 6104 } 6105 } 6106 } 6107 }, 6108 6109 getMinPriceRange: function () { 6110 var range; 6111 6112 for (var i in this.currentElement.ITEM_QUANTITY_RANGES) { 6113 if (this.currentElement.ITEM_QUANTITY_RANGES.hasOwnProperty(i)) { 6114 if ( 6115 !range || 6116 parseInt(this.currentElement.ITEM_QUANTITY_RANGES[i].SORT_FROM) < parseInt(range.SORT_FROM) 6117 ) { 6118 range = this.currentElement.ITEM_QUANTITY_RANGES[i]; 6119 } 6120 } 6121 } 6122 6123 return range; 6124 }, 6125 6126 checkQuantityControls: function () { 6127 if (!this.nodes.obQuantity) 6128 return; 6129 6130 6131 var reachedTopLimit = this.element.CONFIG.SHOW_QUANTITY === "Y" && parseFloat(this.nodes.obQuantity.value) + this.currentElement.STEP_QUANTITY > this.currentElement.MAX_QUANTITY, 6132 reachedBottomLimit = parseFloat(this.nodes.obQuantity.value) - this.currentElement.STEP_QUANTITY < this.currentElement.MIN_QUANTITY; 6133 6134 6135 if (reachedTopLimit) 6136 BX.addClass(this.nodes.obQuantityUp, 'product-item-amount-field-btn-disabled'); 6137 6138 else if (BX.hasClass(this.nodes.obQuantityUp, 'product-item-amount-field-btn-disabled')) { 6139 BX.removeClass(this.nodes.obQuantityUp, 'product-item-amount-field-btn-disabled'); 6140 } 6141 6142 if (reachedBottomLimit) 6143 BX.addClass(this.nodes.obQuantityDown, 'product-item-amount-field-btn-disabled'); 6144 6145 else if (BX.hasClass(this.nodes.obQuantityDown, 'product-item-amount-field-btn-disabled')) { 6146 BX.removeClass(this.nodes.obQuantityDown, 'product-item-amount-field-btn-disabled'); 6147 } 6148 6149 if (reachedTopLimit && reachedBottomLimit) 6150 this.nodes.obQuantity.setAttribute('disabled', 'disabled'); 6151 6152 else { 6153 this.nodes.obQuantity.removeAttribute('disabled'); 6154 } 6155 }, 6156 6157 quantityUp: function () { 6158 6159 var curValue = 0, 6160 boolSet = true; 6161 6162 if (this.errorCode === 0 && this.element.CONFIG.SHOW_QUANTITY === "Y" && this.currentElement.CAN_BUY) { 6163 6164 curValue = this.currentElement.QUANTITY_FLOAT ? parseFloat(this.nodes.obQuantity.value) : parseInt(this.nodes.obQuantity.value, 10); 6165 6166 6167 if (!isNaN(curValue)) { 6168 6169 curValue += this.currentElement.STEP_QUANTITY; 6170 6171 curValue = this.checkQuantityRange(curValue, 'up'); 6172 6173 if (this.currentElement.CHECK_QUANTITY && curValue > this.currentElement.MAX_QUANTITY) { 6174 boolSet = false;
6175 } 6176 6177 if (boolSet) { 6178 if (this.currentElement.QUANTITY_FLOAT) { 6179 curValue = Math.round(curValue * this.element.precisionFactor) / this.element.precisionFactor; 6180 } 6181 6182 6183 6184 this.nodes.obQuantity.value = curValue; 6185 6186 this.setPrice(); 6187 } 6188 } 6189 } 6190 }, 6191 6192 quantityDown: function () { 6193 var curValue = 0, 6194 boolSet = true; 6195 6196 if (this.errorCode === 0 && this.element.CONFIG.SHOW_QUANTITY === "Y" && this.currentElement.CAN_BUY) { 6197 curValue = this.currentElement.QUANTITY_FLOAT ? parseFloat(this.nodes.obQuantity.value) : parseInt(this.nodes.obQuantity.value, 10); 6198 6199 if (!isNaN(curValue)) { 6200 curValue -= this.currentElement.STEP_QUANTITY; 6201 6202 curValue = this.checkQuantityRange(curValue, 'down'); 6203 6204 if (curValue < this.currentElement.MIN_QUANTITY) { 6205 boolSet = false; 6206 } 6207 6208 if (boolSet) { 6209 if (this.currentElement.QUANTITY_FLOAT) { 6210 curValue = Math.round(curValue * this.element.precisionFactor) / this.element.precisionFactor; 6211 } 6212 6213 this.nodes.obQuantity.value = curValue; 6214 6215 this.setPrice(); 6216 } 6217 } 6218 } 6219 }, 6220 6221 quantityChange: function () { 6222 var curValue = 0, 6223 intCount; 6224 6225 6226 if (this.errorCode === 0 && this.element.CONFIG.SHOW_QUANTITY === "Y") { 6227 6228 if (this.currentElement.CAN_BUY) { 6229 6230 curValue = this.currentElement.QUANTITY_FLOAT ? parseFloat(this.nodes.obQuantity.value) : Math.round(this.nodes.obQuantity.value); 6231 6232 6233 if (!isNaN(curValue)) { 6234 curValue = this.checkQuantityRange(curValue); 6235 6236 if (this.currentElement.CHECK_QUANTITY) { 6237 if (curValue > this.currentElement.MAX_QUANTITY) { 6238 curValue = this.currentElement.MAX_QUANTITY; 6239 } 6240 } 6241 6242 this.checkPriceRange(curValue); 6243 6244 if (curValue < this.currentElement.MIN_QUANTITY) { 6245 curValue = this.currentElement.MIN_QUANTITY; 6246 } else { 6247 intCount = Math.round( 6248 Math.round(curValue * this.element.precisionFactor / this.currentElement.STEP_QUANTITY) / this.element.precisionFactor 6249 ) || 1; 6250 6251 6252 curValue = (intCount <= 1 ? this.currentElement.STEP_QUANTITY : intCount * this.currentElement.STEP_QUANTITY); 6253 6254 curValue = Math.round(curValue * this.element.precisionFactor) / this.element.precisionFactor; 6255 6256 } 6257 6258 6259 this.nodes.obQuantity.value = curValue; 6260 } else { 6261 this.nodes.obQuantity.value = this.currentElement.MIN_QUANTITY; 6262 } 6263 } else { 6264 this.nodes.obQuantity.value = this.currentElement.MIN_QUANTITY; 6265 } 6266 6267 this.setPrice(); 6268 } 6269 6270 }, 6271 6272 checkQuantityRange: function (quantity, direction) { 6273 if (typeof quantity === 'undefined' || this.currentElement.ITEM_PRICE_MODE !== 'Q') { 6274 return quantity; 6275 } 6276 6277 quantity = parseFloat(quantity); 6278 6279 var nearestQuantity = quantity; 6280 var range, diffFrom, absDiffFrom, diffTo, absDiffTo, shortestDiff; 6281 6282 for (var i in this.currentQuantityRanges) { 6283 if (this.currentQuantityRanges.hasOwnProperty(i)) { 6284 range = this.currentQuantityRanges[i]; 6285 6286 if ( 6287 parseFloat(quantity) >= parseFloat(range.SORT_FROM) && 6288 ( 6289 range.SORT_TO === 'INF' || 6290 parseFloat(quantity) <= parseFloat(range.SORT_TO) 6291 ) 6292 ) { 6293 nearestQuantity = quantity; 6294 break; 6295 } else { 6296 diffFrom = parseFloat(range.SORT_FROM) - quantity; 6297 absDiffFrom = Math.abs(diffFrom); 6298 diffTo = parseFloat(range.SORT_TO) - quantity; 6299 absDiffTo = Math.abs(diffTo); 6300 6301 if (shortestDiff === undefined || shortestDiff > absDiffFrom) { 6302 if ( 6303 direction === undefined || 6304 (direction === 'up' && diffFrom > 0) || 6305 (direction === 'down' && diffFrom < 0) 6306 ) { 6307 shortestDiff = absDiffFrom; 6308 nearestQuantity = parseFloat(range.SORT_FROM); 6309 } 6310 } 6311 6312 if (shortestDiff === undefined || shortestDiff > absDiffTo) { 6313 if ( 6314 direction === undefined || 6315 (direction === 'up' && diffFrom > 0) || 6316 (direction === 'down' && diffFrom < 0) 6317 ) { 6318 shortestDiff = absDiffTo; 6319 nearestQuantity = parseFloat(range.SORT_TO); 6320 } 6321 } 6322 } 6323 } 6324 } 6325 6326 return nearestQuantity; 6327 }, 6328 6329 getCanBuy: function (arFilter) { 6330 var i, 6331 j = 0, 6332 boolOneSearch = true, 6333 boolSearch = false;
6334 6335 for (i = 0; i < this.element.OFFERS.length; i++) { 6336 boolOneSearch = true; 6337 6338 for (j in arFilter) { 6339 if (arFilter[j] !== this.element.OFFERS[i].TREE[j]) { 6340 boolOneSearch = false; 6341 break; 6342 } 6343 } 6344 6345 if (boolOneSearch) { 6346 if (this.element.OFFERS[i].CAN_BUY) { 6347 boolSearch = true; 6348 break; 6349 } 6350 } 6351 } 6352 6353 return boolSearch; 6354 }, 6355 6356 updateInfoBasketOffer: function (id, parent) { 6357 parent = parent || ''; 6358 6359 if (parent.length > 0) 6360 parent = "#" + parent; 6361 6362 6363 $(parent + ' .add2basket').attr('data-item', id); 6364 $(parent + ' .move2basket').attr('data-item', id); 6365 $(parent + ' .quantity-block').attr('data-item', id); 6366 $(parent + ' .delay').attr('data-item', id); 6367 $(parent + ' .compare').attr('data-item', id); 6368 }, 6369 6370 setPriceMatrix: function (sPriceMatrix) { 6371 if (sPriceMatrix.length > 0) { 6372 this.nodes.obPriceMatrix.classList.remove('d-none'); 6373 this.nodes.obPriceMatrix.innerHTML = sPriceMatrix; 6374 } else { 6375 this.nodes.obPriceMatrix.classList.add('d-none'); 6376 this.nodes.obPriceMatrix.innerHTML = ''; 6377 } 6378 }, 6379 6380 quantitySet: function () { 6381 var strLimit, resetQuantity; 6382 6383 var newOffer = this.currentElement, 6384 oldOffer = this.oldElement; 6385 6386 if (this.errorCode === 0) { 6387 6388 this.currentElement.CAN_BUY = newOffer.CAN_BUY; 6389 6390 this.currentElement.QUANTITY_FLOAT = newOffer.QUANTITY_FLOAT; 6391 this.element.CHECK_QUANTITY = newOffer.CHECK_QUANTITY; 6392 6393 6394 6395 if (this.currentElement.QUANTITY_FLOAT) { 6396 this.currentElement.STEP_QUANTITY = Math.round(parseFloat(newOffer.STEP_QUANTITY) * this.element.precisionFactor) / this.element.precisionFactor; 6397 this.currentElement.MAX_QUANTITY = parseFloat(newOffer.MAX_QUANTITY); 6398 this.currentElement.MIN_QUANTITY = this.currentElement.ITEM_PRICE_MODE === 'Q' ? parseFloat(this.currentElement.ITEM_PRICES[this.currentElement.ITEM_PRICE_SELECTED].MIN_QUANTITY) : this.currentElement.STEP_QUANTITY; 6399 } else { 6400 this.currentElement.STEP_QUANTITY = parseInt(newOffer.STEP_QUANTITY, 10); 6401 this.currentElement.MAX_QUANTITY = parseInt(newOffer.MAX_QUANTITY, 10); 6402 this.currentElement.MIN_QUANTITY = this.currentElement.ITEM_PRICE_MODE === 'Q' ? parseInt(this.currentElement.ITEM_PRICES[this.currentElement.ITEM_PRICE_SELECTED].MIN_QUANTITY) : this.currentElement.STEP_QUANTITY; 6403 } 6404 6405 6406 6407 if (this.element.CONFIG.SHOW_QUANTITY) { 6408 var isDifferentMinQuantity = oldOffer.ITEM_PRICES.length && 6409 oldOffer.ITEM_PRICES[oldOffer.ITEM_PRICE_SELECTED] && 6410 oldOffer.ITEM_PRICES[oldOffer.ITEM_PRICE_SELECTED].MIN_QUANTITY != this.currentElement.MIN_QUANTITY; 6411 6412 if (this.currentElement.QUANTITY_FLOAT) { 6413 resetQuantity = Math.round(parseFloat(oldOffer.STEP_QUANTITY) * this.element.precisionFactor) / this.element.precisionFactor !== this.currentElement.STEP_QUANTITY || 6414 isDifferentMinQuantity || 6415 oldOffer.MEASURE !== newOffer.MEASURE || 6416 ( 6417 this.currentElement.CHECK_QUANTITY && 6418 parseFloat(oldOffer.MAX_QUANTITY) > this.currentElement.MAX_QUANTITY && 6419 parseFloat(this.nodes.obQuantity.value) > this.currentElement.MAX_QUANTITY 6420 ); 6421 } else { 6422 resetQuantity = parseInt(oldOffer.STEP_QUANTITY, 10) !== this.currentElement.STEP_QUANTITY || 6423 isDifferentMinQuantity || 6424 oldOffer.MEASURE !== newOffer.MEASURE || 6425 ( 6426 this.currentElement.CHECK_QUANTITY && 6427 parseInt(oldOffer.MAX_QUANTITY, 10) > this.currentElement.MAX_QUANTITY && 6428 parseInt(this.nodes.obQuantity.value, 10) > this.currentElement.MAX_QUANTITY 6429 ); 6430 } 6431 6432 this.nodes.obQuantity.disabled = !this.currentElement.CAN_BUY; 6433 6434 if (resetQuantity) { 6435 this.nodes.obQuantity.value = this.currentElement.MIN_QUANTITY; 6436 } 6437 } 6438 6439 if (this.nodes.obMeasure) { 6440 6441 if (newOffer.MEASURE_HTML) { 6442 BX.adjust(this.nodes.obMeasure, { 6443 html: newOffer.MEASURE_HTML, 6444 style: { 6445 display: '' 6446 } 6447 }); 6448 } else { 6449 BX.adjust(this.nodes.obMeasure, { 6450 html: '', 6451 style: { 6452 display: 'none' 6453 } 6454 }); 6455 } 6456 } 6457 6458 } 6459 }, 6460 6461 changeText: function (ob, text) { 6462 if (text.length > 0) { 6463 6464 ob.innerHTML = text; 6465 ob.classList.remove('d-none'); 6466 6467 } else { 6468 ob.classList.add('d-none'); 6469 ob.innerHTML = ''; 6470 } 6471 }, 6472 6473 setCompared: function (state) { 6474 if (!this.nodes.obCompare) 6475 return; 6476 6477 var checkbox = this.nodes.obCompare.querySelector('[data-entity="compare-checkbox"]'); 6478 if (checkbox) { 6479 checkbox.checked = state; 6480 } 6481 }, 6482 6483 drawPicture: function () { 6484 if (this.nodes.obPict) { 6485 BX.adjust(this.nodes.obPict, { 6486 6487 props: { 6488 src: this.currentElement.PHOTO, 6489 alt: this.element.ALT 6490 }, 6491 6492 }); 6493 } 6494 }, 6495 6496 changeCharsBlock: function () { 6497 var html = "", 6498 showChars = false;
6499 6500 6501 if (this.nodes.obSkuChars) { 6502 if (this.currentElement.SKU_LIST_CHARS.length) { 6503 if (this.element.VIEW == "LIST") { 6504 for (i = 0; i < this.currentElement.SKU_LIST_CHARS.length; i++) { 6505 html += "<div class='characteristics-item'>"; 6506 html += "<span class='characteristics-item-name'>" + this.currentElement.SKU_LIST_CHARS[i].NAME + " - </span>"; 6507 html += "<span class='characteristics-item-value'>" + this.currentElement.SKU_LIST_CHARS[i].VALUE + "</span>"; 6508 html += "</div>"; 6509 } 6510 } else { 6511 for (i = 0; i < this.currentElement.SKU_LIST_CHARS.length; i++) { 6512 html += "<div class='characteristics-item'>"; 6513 html += "<span class='characteristics-item-name bold'>" + this.currentElement.SKU_LIST_CHARS[i].NAME + ": </span>"; 6514 html += "<span class='characteristics-item-value'>" + this.currentElement.SKU_LIST_CHARS[i].VALUE + "</span>"; 6515 html += "</div>"; 6516 } 6517 } 6518 6519 6520 html = "<div class='characteristics'>" + html + "</div>"; 6521 } 6522 6523 BX.adjust(this.nodes.obSkuChars, { 6524 html: html 6525 }); 6526 } 6527 6528 if (this.element.PROPS_CHARS.length > 0 || this.element.PROP_CHARS.length > 0 || this.currentElement.SKU_LIST_CHARS.length > 0) { 6529 showChars = true; 6530 } 6531 6532 var wrChars = this.nodes.obProduct.querySelector('.wrapper-characteristics'); 6533 6534 6535 if (wrChars) { 6536 6537 if (showChars) 6538 wrChars.classList.remove('hidden'); 6539 6540 else { 6541 wrChars.classList.add('hidden'); 6542 } 6543 } 6544 6545 }, 6546 6547 changeDetailUrl: function (ID) { 6548 6549 if (this.nodes.obDetailUrlImg) 6550 this.nodes.obDetailUrlImg.href = this.currentElement.DETAIL_PAGE_URL; 6551 6552 if (this.nodes.obName) 6553 this.nodes.obName.href = this.currentElement.DETAIL_PAGE_URL; 6554 6555 }, 6556 6557 hideBtns: function () { 6558 this.nodes.obWrAdd2BasketBtn.classList.remove('active'); 6559 this.nodes.obWrAdd2BasketBtn.classList.add('d-none'); 6560 this.nodes.obBtn2pageProduct.classList.remove('d-none'); 6561 6562 }, 6563 6564 showBtns: function () { 6565 this.nodes.obWrAdd2BasketBtn.classList.add('active'); 6566 this.nodes.obWrAdd2BasketBtn.classList.remove('d-none'); 6567 this.nodes.obBtn2pageProduct.classList.add('d-none'); 6568 }, 6569 6570 btnsControl: function () { 6571 var show = false; 6572 6573 6574 6575 if ((this.currentElement.CAN_BUY && this.currentElement.MODE_DISALLOW_ORDER != "Y") && (this.currentElement.SHOWPREORDERBTN || this.currentElement.MODE_ARCHIVE)) 6576 show = true; 6577 6578 if (this.currentElement.SHOW_BTN_BASKET === 'Y' && this.currentElement.CAN_BUY) 6579 show = true; 6580 else 6581 { 6582 show = false; 6583 } 6584 6585 if(this.currentElement.ISOFFERS && this.currentElement.VIEW === 'FLAT SLIDER') 6586 show = false; 6587 6588 6589 if (show) 6590 this.showBtns(); 6591 else 6592 { 6593 this.hideBtns(); 6594 } 6595 }, 6596 6597 }; 6598 6599})(window); 6600 6601 6602$(document).on('click', '.small-picture', function () { 6603 $(this).parents(".wrapper-picture").find(".big-picture").removeClass('active'); 6604 $(this).parents(".wrapper-picture").find(".small-picture").removeClass('active'); 6605 6606 $(this).addClass('active'); 6607 $(this).parents(".wrapper-picture").find(".big-picture[data-id='" + $(this).attr("data-value") + "']").addClass('active'); 6608 6609 if ($(this).hasClass('popup-control')) { 6610 $('#sliderPopup').attr('data-current-image', $(this).attr("data-value")); 6611 } 6612}); 6613 6614var popupGalleryCollection = []; 6615 6616function popupGallery(id) { 6617 6618 if (typeof ($(".open-popup-gallery-item[data-popup-gallery='" + id + "']")) != "undefined") { 6619 6620 if ($(".open-popup-gallery-item[data-popup-gallery='" + id + "']").length > 0) { 6621 6622 $(".open-popup-gallery-item[data-popup-gallery='" + id + "']").each( 6623 function (index) { 6624 popupGalleryCollection[index] = { 6625 "smallSrc": $(this).attr("data-small-src"), 6626 "bigSrc": $(this).attr("data-big-src"), 6627 "desc": $(this).attr("data-desc"), 6628 }; 6629 6630 if ($(this).parents(".big-picture").hasClass('active')) 6631 popupGalleryCollection[index]["active"] = "Y"; 6632 6633 6634 } 6635 ); 6636 6637 sliderPopup(popupGalleryCollection); 6638 6639 } 6640 } 6641 6642} 6643 6644function sliderPopup(images) { 6645 if (images && BX.type.isArray(images)) { 6646 6647 var nodeControlPics = $("#sliderPopup").find(".controls-pictures"), 6648 nodeBigPics = $("#sliderPopup").find(".wrapper-big-picture"), 6649 nodeControlPicsParent = nodeControlPics.parent(), 6650 nodeBigPicsParent = nodeBigPics.parent(), 6651 listControl = "", 6652 listBigPic = ""; 6653 6654 nodeControlPics.html(""); 6655 nodeBigPics.html(""); 6656 6657 if (images.length > 0) { 6658 6659 for (i = 0; i < images.length; i++) { 6660 6661 listControl += "<div data-value='" + i + "'"; 6662 listControl += "class='small-picture popup-control"; 6663 6664 if (images[i].active == "Y") { 6665 listControl += " active"; 6666 $("#sliderPopup").attr("data-current-image", i); 6667 } 6668 listControl += "'>"; 6669 6670 6671 listControl += "<img src='" + images[i].smallSrc + "' alt = '"; 6672 6673 if (images[i].desc) 6674 listControl += images[i].desc; 6675 6676 listControl += "'/>"; 6677 6678 listControl += "</div>"; 6679 6680 6681 listBigPic += "<div data-id='" + i + "'"; 6682 listBigPic += "class='big-picture"; 6683 6684 if (images[i].active == "Y") 6685 listBigPic += " active"; 6686 6687 if (images[i].desc) 6688 listBigPic += " with-desc"; 6689 6690 listBigPic += "'>"; 6691 6692 6693 listBigPic += "<img src='" + images[i].bigSrc + "' class='d-block mx-auto img-fluid' alt = '"; 6694 6695 if (images[i].desc) 6696 listBigPic += images[i].desc; 6697 6698 listBigPic += "'/>"; 6699 6700 if (images[i].desc) 6701 listBigPic += "<div class='desc-img'>" + images[i].desc + "</div>"; 6702 6703 6704 listBigPic += "</div>"; 6705 6706 } 6707 6708 } 6709 6710 nodeBigPics.html(listBigPic); 6711 nodeControlPics.html(listControl); 6712 6713 6714 } 6715} 6716 6717function destroyPopupGallery() { 6718 popupGalleryCollection = []; 6719 $('#sliderPopup').removeClass('active'); 6720 $('body').removeClass('modal-open'); 6721 6722 $('#sliderPopup').find(".wrapper-big-picture").children().remove(); 6723 $('#sliderPopup').find(".controls-pictures").children().remove(); 6724 6725 6726} 6727 6728$(document).on('click', '.open-popup-gallery', function () { 6729 $('.popup-slider').addClass('active'); 6730 $('body').addClass('modal-open'); 6731 popupGallery($(this).attr("data-popup-gallery")); 6732 6733}); 6734 6735 6736$(document).on('click', '.wrapper-select-input', function () { 6737 if (!$(this).hasClass('open')) 6738 $(this).addClass('open'); 6739 6740 else { 6741 $(this).removeClass('open'); 6742 } 6743 6744}); 6745 6746 6747 6748 6749 6750 6751
6752function setCurrentPopupSlide(slideID) { 6753 $('#sliderPopup').find(".small-picture").removeClass('active'); 6754 $('#sliderPopup').find(".big-picture").removeClass('active'); 6755 6756 $('#sliderPopup').find(".small-picture[data-value='" + slideID + "']").addClass('active'); 6757 $('#sliderPopup').find(".big-picture[data-id='" + slideID + "']").addClass('active'); 6758 6759 $('#sliderPopup').attr("data-current-image", slideID); 6760} 6761 6762function slidePopupControl(btn, action) { 6763 var arSlider = $('#sliderPopup').find(".controls-pictures").children(), 6764 curSlide = $('#sliderPopup').attr("data-current-image"); 6765 6766 6767 for (var i = 0; arSlider.length > i; i++) { 6768 if (i == curSlide) { 6769 if (action == "prev") { 6770 curSlide = i - 1; 6771 } 6772 6773 if (action == "next") { 6774 curSlide = i + 1; 6775 } 6776 6777 if (curSlide > arSlider.length - 1) { 6778 curSlide = 0; 6779 } 6780 if (curSlide < 0) { 6781 curSlide = arSlider.length - 1; 6782 } 6783 6784 if (typeof curSlide !== "undefined") { 6785 setCurrentPopupSlide(curSlide); 6786 } 6787 6788 return; 6789 } 6790 } 6791} 6792 6793$(document).on('click', '.nav-item.action_prev', function () { 6794 slidePopupControl($(this), 'prev'); 6795}); 6796$(document).on('click', '.nav-item.action_next', function () { 6797 slidePopupControl($(this), 'next'); 6798}); 6799 6800 6801$(document).on('click', '.btn-open-hidden-board', function () { 6802 $(".content-hidden-board[data-content=" + $(this).attr("data-open") + "]").addClass('active'); 6803 $(".catalog-list-wrap.z-index-99").removeClass('z-index-99'); 6804}); 6805 6806$(document).on('click', '.btn-close-hidden-board', function () { 6807 $(".content-hidden-board[data-content=" + $(this).attr("data-close") + "]").removeClass('active'); 6808}); 6809 6810$(document).mouseup(function (e) { 6811 var div = $(".content-hidden-board.active"); 6812 6813 if (!div.is(e.target) && div.has(e.target).length === 0) { 6814 div.removeClass('active'); 6815 } 6816}); 6817 6818if ($(window).width() > 1200) { 6819 $(document).on({ 6820 mouseenter: function () { 6821 6822 var total = parseInt($(this).find('.elem-hover-height-more').css( 6823 'margin-bottom')) + $(this).find('.elem-hover-height').outerHeight( 6824 true); 6825 6826 $(this).css({ 6827 'height': total + 'px' 6828 }); 6829 $(this).find('div.elem-hover-show').slideDown(250); 6830 }, 6831 6832 mouseleave: function () {
6833 $(this).find('div.elem-hover-show').slideUp(0); 6834 }, 6835 }, 6836 ".elem-hover" 6837 ); 6838 6839} 6840 6841$(document).on('click', '.section-with-hidden-items .head-filter', 6842 function () { 6843 var btn = $(this); 6844 var content = $(".content-animate-slide-down[data-show ='" + btn.attr("data-show") + "']"); 6845 var btns = $(".click-animate-slide-down[data-show ='" + btn.attr("data-show") + "']"); 6846 6847 content.slideUp(400, function () { 6848 btns.addClass('noactive-mob').removeClass('active-mob'); 6849 content.addClass('noactive-mob').removeClass('active-mob'); 6850 }); 6851 } 6852); 6853 6854$(document).on('click', '.click-animate-slide-down', 6855 function () { 6856 var btn = $(this); 6857 var content = $(".content-animate-slide-down[data-show ='" + btn.attr("data-show") + "']"); 6858 6859 if ($(window).width() > 768) { 6860 6861 if (!btn.hasClass('active')) { 6862 content.slideDown(400, function () { 6863 btn.addClass('active').removeClass('noactive'); 6864 content.addClass('active').removeClass('noactive'); 6865 }); 6866 BX.setCookie($(".domen-url-for-cookie").val() + '_phoenix_catalog_tab_' + btn.attr("data-show") + $("input.site_id").val(), 'active', { 6867 expires: 60 * 60 * 60 * 60, 6868 path: "/" 6869 }); 6870 } else { 6871 content.slideUp(400, function () { 6872 btn.addClass('noactive').removeClass('active'); 6873 content.addClass('noactive').removeClass('active'); 6874 }); 6875 BX.setCookie($(".domen-url-for-cookie").val() + '_phoenix_catalog_tab_' + btn.attr("data-show") + $("input.site_id").val(), 'noactive', { 6876 expires: 60 * 60 * 60 * 60, 6877 path: "/" 6878 }); 6879 } 6880 6881 } else { 6882 if (!btn.hasClass('active-mob')) { 6883 content.addClass('active-mob').removeClass('noactive-mob'); 6884 content.slideDown(400, function () { 6885 btn.addClass('active-mob').removeClass('noactive-mob'); 6886 }); 6887 6888 } else { 6889 content.slideUp(400, function () { 6890 btn.addClass('noactive-mob').removeClass('active-mob'); 6891 content.addClass('noactive-mob').removeClass('active-mob'); 6892 }); 6893 } 6894 } 6895 6896 } 6897); 6898 6899$(document).on('click', '.btn-hide-column', 6900 function () { 6901 6902 if (!$(this).hasClass('active')) { 6903 6904 if ($('div.menu-banner-slider').hasClass('slick-initialized')) 6905 $('div.menu-banner-slider').slick('unslick'); 6906 6907 $('div.menu-banner-slider').slick({ 6908 slidesToShow: 1, 6909 slidesToScroll: 1, 6910 autoplay: true, 6911 autoplaySpeed: 5000, 6912 dots: false, 6913 infinite: true, 6914 adaptiveHeight: false, 6915 speed: 500, 6916 arrows: false 6917 }); 6918 6919 $(this).addClass('active'); 6920 $('.parent-hide-column').removeClass('hide'); 6921 /*$('.catalog-list-wrap .catalog-list').addClass('three-col').removeClass('four-col');*/ 6922 BX.setCookie($(".domen-url-for-cookie").val() + '_phoenix_catalog_side_column_' + $("input.site_id").val(), 'Y', { 6923 expires: 60 * 60 * 60 * 60, 6924 path: "/" 6925 }); 6926 } else { 6927 6928 if ($('div.menu-banner-slider').hasClass('slick-initialized')) 6929 $('div.menu-banner-slider').slick('unslick'); 6930 6931 $(this).removeClass('active'); 6932 $('.parent-hide-column').addClass('hide'); 6933 /*$('.catalog-list-wrap .catalog-list').removeClass('three-col').addClass('four-col');*/ 6934 BX.setCookie($(".domen-url-for-cookie").val() + '_phoenix_catalog_side_column_' + $("input.site_id").val(), 'N', { 6935 expires: 60 * 60 * 60 * 60, 6936 path: "/" 6937 }); 6938 } 6939 6940 showProcessLoad(); 6941
6942 updateCatalogList(); 6943 } 6944); 6945 6946function updateCatalogList($params) { 6947 $params = $params || { 6948 "ajax_action": "Y" 6949 }; 6950 showProcessLoad(); 6951 6952 $('.element-list-wrap').removeClass("active"); 6953 6954 $.post( 6955 location.href, 6956 $params, 6957 function (html) { 6958 closeProcessLoad(); 6959 6960 $('.element-list-wrap').html(html); 6961 $('.element-list-wrap').addClass("active"); 6962 $('.lazyload').Lazy(paramsLazy); 6963 setInfoBasket("firstLoad"); 6964 } 6965 ); 6966 6967} 6968 6969$(document).on('click', '.sort_btn_js', 6970 function () { 6971 var sort = $(this).attr("data-sort"), 6972 order = $(this).attr("data-order"), 6973 _th = $(this), 6974 available = null; 6975 6976 _th.parents(".element-sort").find(".sort_btn_js").removeClass('active'); 6977 _th.addClass('active'); 6978 6979 if (_th.hasClass('asc')) { 6980 _th.removeClass('asc').addClass('desc'); 6981 _th.attr("data-order", "asc"); 6982 } else if (_th.hasClass('desc')) { 6983 _th.removeClass('desc').addClass('asc'); 6984 _th.attr("data-order", "desc"); 6985 } 6986 6987 if($('.sort-available-js').length>0) 6988 { 6989 if ($('.sort-available-js').attr("data-available") == "Y") { 6990 available = 'N'; 6991 } else { 6992 available = 'Y'; 6993 } 6994 } 6995 6996 6997 var $params = { 6998 "ajax_action": "Y", 6999 "sort": sort, 7000 "order": order, 7001 }; 7002 7003 if(available) 7004 $params['available'] = available; 7005 7006 updateCatalogList($params); 7007 7008 } 7009); 7010 7011$(document).on('click', '.sort-available-js', 7012 function () { 7013 var $params = { 7014 "ajax_action": "Y", 7015 "available": $(this).attr("data-available") 7016 }; 7017 7018 7019 if ($(this).attr("data-available") == "Y") { 7020 $(this).attr("data-available", "N"); 7021 $(this).addClass("active"); 7022 } else { 7023 $(this).attr("data-available", "Y"); 7024 $(this).removeClass("active"); 7025 } 7026 7027 7028 updateCatalogList($params); 7029 } 7030); 7031 7032$(document).on('click', '.display-view-js', 7033 function () { 7034 7035 if (!$(this).hasClass('active')) { 7036 var $params = { 7037 "ajax_action": "Y", 7038 "view": $(this).attr("data-view") 7039 }; 7040 7041 $(this).parents('.view-list').find('.display-view-js').removeClass('active'); 7042 $(this).addClass('active'); 7043 7044 updateCatalogList($params); 7045 7046 } 7047 7048 } 7049); 7050 7051$(document).on('click', '.toogle-animate-click', 7052 function () { 7053 var block = $(this).parents(".toogle-animate-parent"); 7054 if (!block.hasClass("active")) { 7055 $(".toogle-animate-content", block).slideDown(200, function () { 7056 block.addClass("active"); 7057 }); 7058 } else { 7059 $(".toogle-animate-content", block).slideUp(200, function () { 7060 block.removeClass("active"); 7061 }); 7062 } 7063 } 7064); 7065 7066$(document).on('click', 'div.bx_sort_container ul.tabs-head li', 7067 function () { 7068 if (!$(this).hasClass("current")) 7069 location.href = $(this).find("span").attr("data-href"); 7070 } 7071); 7072 7073 7074 7075BasketPoolQuantity = function () { 7076 this.processing = false; 7077 this.poolQuantity = {}; 7078 this.updateTimer = null; 7079 this.currentQuantity = {}; 7080 this.lastStableQuantities = {}; 7081 7082 this.updateQuantity(); 7083}; 7084 7085 7086BasketPoolQuantity.prototype.updateQuantity = function () { 7087 7088 if (BX('basket_items')) { 7089 var items = BX('basket_items').querySelectorAll('div.product'); 7090 7091 if (!!items && items.length > 0) { 7092 for (var i = 0; items.length > i; i++) { 7093 var itemId = items[i].id; 7094 this.currentQuantity[itemId] = BX('QUANTITY_' + itemId).value; 7095 } 7096 } 7097 7098 7099 this.lastStableQuantities = BX.clone(this.currentQuantity, true); 7100 } 7101 7102 7103}; 7104 7105BasketPoolQuantity.prototype.changeQuantity = function (itemId) { 7106 var quantity = BX('QUANTITY_' + itemId).value; 7107 var isPoolEmpty = this.isPoolEmpty(); 7108 7109 if (this.currentQuantity[itemId] && this.currentQuantity[itemId] != quantity) { 7110 this.poolQuantity[itemId] = this.currentQuantity[itemId] = quantity; 7111 } 7112 7113 if (!isPoolEmpty) { 7114 this.enableTimer(true); 7115 } else { 7116 this.trySendPool(); 7117 } 7118}; 7119 7120 7121BasketPoolQuantity.prototype.trySendPool = function () { 7122 7123 if (!this.isPoolEmpty() && !this.isProcessing()) { 7124 this.enableTimer(false); 7125 7126 recalcBasketAjax({}); 7127 7128 } 7129}; 7130 7131BasketPoolQuantity.prototype.isPoolEmpty = function () { 7132 return (Object.keys(this.poolQuantity).length == 0); 7133}; 7134 7135BasketPoolQuantity.prototype.clearPool = function () { 7136 this.poolQuantity = {}; 7137}; 7138 7139BasketPoolQuantity.prototype.isProcessing = function () { 7140 return (this.processing === true); 7141}; 7142 7143BasketPoolQuantity.prototype.setProcessing = function (value) { 7144 this.processing = (value === true); 7145}; 7146 7147BasketPoolQuantity.prototype.enableTimer = function (value) { 7148 clearTimeout(this.updateTimer); 7149 if (value === false) 7150 return; 7151 7152 this.updateTimer = setTimeout(function () { 7153 basketPoolQuantity.trySendPool(); 7154 }, 1500); 7155}; 7156 7157function updateQuantity(controlId, basketId, ratio, bUseFloatQuantity) { 7158 clearTimeout($.data(this, 'timer-quantity')); 7159 7160 $.data(this, 'timer-quantity', setTimeout($.proxy(function () { 7161 7162 var oldVal = BX(controlId).defaultValue, 7163 newVal = parseFloat(BX(controlId).value) || 0, 7164 bIsCorrectQuantityForRatio = false, 7165 autoCalculate = ((BX("auto_calculation") && BX("auto_calculation").value == "Y") || !BX("auto_calculation")); 7166 7167 7168 7169 7170 if (ratio === 0 || ratio == 1) { 7171 bIsCorrectQuantityForRatio = true; 7172 } else { 7173 7174 var newValInt = newVal * 10000, 7175 ratioInt = ratio * 10000, 7176 reminder = newValInt % ratioInt, 7177 newValRound = parseInt(newVal); 7178 7179 if (reminder === 0) { 7180 bIsCorrectQuantityForRatio = true; 7181 } 7182 } 7183 7184 var bIsQuantityFloat = false;
7185 7186 if (parseInt(newVal) != parseFloat(newVal)) { 7187 bIsQuantityFloat = true; 7188 } 7189 7190 newVal = (bUseFloatQuantity === false && bIsQuantityFloat === false) ? parseInt(newVal) : parseFloat(newVal).toFixed(4); 7191 newVal = correctQuantity(newVal); 7192 7193 7194 7195 if (bIsCorrectQuantityForRatio) { 7196 BX(controlId).defaultValue = newVal; 7197 7198 BX("QUANTITY_INPUT_" + basketId).value = newVal; 7199 7200 BX("QUANTITY_" + basketId).value = newVal; 7201 7202 if (autoCalculate) { 7203 basketPoolQuantity.changeQuantity(basketId); 7204 } 7205 } else { 7206 newVal = getCorrectRatioQuantity(newVal, ratio, bUseFloatQuantity); 7207 newVal = correctQuantity(newVal); 7208 7209 if (newVal != oldVal) { 7210 BX("QUANTITY_INPUT_" + basketId).value = newVal; 7211 BX("QUANTITY_" + basketId).value = newVal; 7212 7213 if (autoCalculate) { 7214 basketPoolQuantity.changeQuantity(basketId); 7215 } 7216 } else { 7217 BX(controlId).value = oldVal; 7218 } 7219 } 7220 7221 7222 7223 }, this), 700)); 7224 7225 7226} 7227 7228function correctQuantity(quantity) { 7229 return parseFloat((quantity * 1).toString()); 7230} 7231 7232 7233function recalcBasketAjax(params) { 7234 7235 7236 if (basketPoolQuantity.isProcessing()) { 7237 return false; 7238 } 7239 7240 /*BX.showWait();*/ 7241 7242 7243 var property_values = {}, 7244 action_var = 'recalculate', 7245 delayedItems = '', 7246 items = BX('basket_items').querySelectorAll('div.product'), 7247 postData, 7248 i; 7249 7250 if (BX('delayed_items')) 7251 delayedItems = BX('delayed_items').querySelectorAll('div.product'); 7252 7253 7254 postData = { 7255 'sessid': BX.bitrix_sessid(), 7256 'site_id': $("input.site_id").val(), 7257 'action_var': action_var, 7258 'quantity_float': BX('quantity_float').value 7259 }; 7260 7261 postData[action_var] = 'recalculate'; 7262 7263 if (!!params && typeof params === 'object') { 7264 for (i in params) { 7265 if (params.hasOwnProperty(i)) 7266 postData[i] = params[i]; 7267 } 7268 } 7269 7270 7271 7272 if (!!items && items.length > 0) { 7273 for (i = 0; items.length > i; i++) { 7274 postData['QUANTITY_' + items[i].id] = BX('QUANTITY_' + items[i].id).value; 7275 } 7276 } 7277 7278 if (!!delayedItems && delayedItems.length > 0) { 7279 $('.show_items[data-items="delayed"]').css({ 7280 "display": "" 7281 }); 7282 7283 for (i = 1; delayedItems.length > i; i++) 7284 postData['DELAY_' + delayedItems[i].id] = 'Y'; 7285 } else { 7286 $('.show_items[data-items="delayed"]').css({ 7287 "display": "none" 7288 }); 7289 showFormOrder(); 7290 } 7291 7292 7293 7294 basketPoolQuantity.setProcessing(true); 7295 basketPoolQuantity.clearPool(); 7296 7297 7298 if ($("input.basketOrder").length <= 0) 7299 showProcessLoadTopRight(); 7300 7301 BX.ajax({ 7302 url: '/bitrix/components/bitrix/sale.basket.basket/ajax.php', 7303 method: 'POST', 7304 data: postData, 7305 dataType: 'json', 7306 onsuccess: function (result) { 7307 7308 7309 /*BX.closeWait();*/ 7310 if ($("input.basketOrder").length <= 0) 7311 closeProcessLoadTopRight(); 7312 7313 if ($("input.basketOrder").length > 0 && params.action != "stopRefreshOrder") 7314 BX.Sale.OrderAjaxComponent.sendRequest("refreshOrderAjax", "noRedirect"); 7315 7316 7317 7318 basketPoolQuantity.setProcessing(false); 7319 7320 if (basketPoolQuantity.isPoolEmpty()) { 7321 updateBasketTable(null, result); 7322 basketPoolQuantity.updateQuantity(); 7323 } else { 7324 basketPoolQuantity.enableTimer(true); 7325 } 7326 7327 } 7328 }); 7329} 7330 7331function setQuantity(basketId, ratio, sign, bUseFloatQuantity) { 7332 var curVal = parseFloat(BX("QUANTITY_INPUT_" + basketId).value), 7333 newVal; 7334 7335 newVal = (sign == 'up') ? curVal + ratio : curVal - ratio; 7336 7337 if (newVal < 0) 7338 newVal = 0; 7339 7340 if (bUseFloatQuantity) { 7341 newVal = parseFloat(newVal).toFixed(4); 7342 } 7343 newVal = correctQuantity(newVal); 7344 7345 if (ratio > 0 && newVal < ratio) { 7346 newVal = ratio; 7347 } 7348 7349 if (!bUseFloatQuantity && newVal != newVal.toFixed(4)) { 7350 newVal = parseFloat(newVal).toFixed(4); 7351 } 7352 7353 newVal = getCorrectRatioQuantity(newVal, ratio, bUseFloatQuantity); 7354 newVal = correctQuantity(newVal); 7355 7356 BX("QUANTITY_INPUT_" + basketId).value = newVal; 7357 BX("QUANTITY_INPUT_" + basketId).defaultValue = newVal; 7358 7359 updateQuantity('QUANTITY_INPUT_' + basketId, basketId, ratio, bUseFloatQuantity); 7360} 7361 7362function getCorrectRatioQuantity(quantity, ratio, bUseFloatQuantity) { 7363 var newValInt = quantity * 10000, 7364 ratioInt = ratio * 10000, 7365 reminder = (quantity / ratio - ((quantity / ratio).toFixed(0))).toFixed(6), 7366 result = quantity, 7367 bIsQuantityFloat = false, 7368 i; 7369 ratio = parseFloat(ratio); 7370 7371 if (reminder == 0) { 7372 return result; 7373 } 7374 7375 if (ratio !== 0 && ratio != 1) { 7376 for (i = ratio, max = parseFloat(quantity) + parseFloat(ratio); i <= max; i = parseFloat(parseFloat(i) + parseFloat(ratio)).toFixed(4)) { 7377 result = i; 7378 } 7379 7380 } else if (ratio === 1) { 7381 result = quantity | 0; 7382 } 7383 7384 if (parseInt(result, 10) != parseFloat(result)) { 7385 bIsQuantityFloat = true; 7386 } 7387 7388 result = (bUseFloatQuantity === false && bIsQuantityFloat === false) ? parseInt(result, 10) : parseFloat(result).toFixed(4); 7389 result = correctQuantity(result); 7390 return result; 7391} 7392 7393function correctQuantity(quantity) { 7394 return parseFloat((quantity * 1).toString()); 7395} 7396 7397 7398 7399function updateBasketTable(basketItemId, res) { 7400 7401 var table = BX("basket_items"), 7402 rows, 7403 newBasketItemId, 7404 arItem, 7405 lastRow, 7406 newRow, 7407 arColumns,
7408 bShowDeleteColumn = false, 7409 bShowDelayColumn = false, 7410 bShowPropsColumn = false, 7411 bShowPriceType = false, 7412 bUseFloatQuantity, 7413 origBasketItem, 7414 oCellMargin, 7415 i, 7416 oCellName, 7417 imageURL, 7418 cellNameHTML, 7419 oCellItem, 7420 cellItemHTML, 7421 bSkip, 7422 j, 7423 val, 7424 propId, 7425 arProp, 7426 bIsImageProperty, 7427 countValues, 7428 full, 7429 fullWidth, 7430 itemWidth, 7431 arVal, 7432 valId, 7433 arSkuValue, 7434 selected, 7435 valueId, 7436 k, 7437 arItemProp, 7438 oCellQuantity, 7439 oCellQuantityHTML, 7440 ratio, 7441 isUpdateQuantity, 7442 oldQuantity, 7443 oCellPrice, 7444 fullPrice, 7445 id, 7446 oCellDiscount, 7447 oCellWeight, 7448 oCellCustom, 7449 customColumnVal, 7450 propsMap, 7451 selectedIndex, 7452 counter, 7453 marginLeft, 7454 createNewItem; 7455 7456 7457 7458 7459 7460 if (!table || typeof res !== 'object') { 7461 return; 7462 } 7463 7464 rows = table.querySelectorAll('div.product'); 7465 lastRow = rows[rows.length - 1]; 7466 bUseFloatQuantity = (res.PARAMS.QUANTITY_FLOAT === 'Y'); 7467 7468 7469 if (!!res.BASKET_DATA) { 7470 for (id in res.BASKET_DATA.GRID.ROWS) { 7471 if (res.BASKET_DATA.GRID.ROWS.hasOwnProperty(id)) { 7472 var item = res.BASKET_DATA.GRID.ROWS[id]; 7473 7474 if (BX('discount_value_' + id)) 7475 BX('discount_value_' + id).innerHTML = item.DISCOUNT_PRICE_PERCENT_FORMATED; 7476 7477 if (BX('current_price_' + id)) 7478 BX('current_price_' + id).innerHTML = item.PRICE_FORMATED; 7479 7480 if (BX('old_price_' + id)) { 7481 7482 7483 if (item.DISCOUNT_PRICE_PERCENT > 0) { 7484 BX('old_price_' + id).innerHTML = item.SUM_FULL_PRICE_FORMATED; 7485 $('#old_price_' + id).css({ 7486 "display": "" 7487 }); 7488 } else { 7489 $('#old_price_' + id).css({ 7490 "display": "none" 7491 }); 7492 } 7493 } 7494 7495 if (BX('sum_' + id)) 7496 BX('sum_' + id).innerHTML = item.SUM; 7497 7498 7499 /* if the quantity was set by user to 0 or was too much, we need to show corrected quantity value from ajax response*/ 7500 if (BX('QUANTITY_' + id)) { 7501 BX('QUANTITY_INPUT_' + id).value = item.QUANTITY; 7502 BX('QUANTITY_INPUT_' + id).defaultValue = item.QUANTITY; 7503 7504 BX('QUANTITY_' + id).value = item.QUANTITY; 7505 } 7506 } 7507 } 7508 } 7509 7510 7511 if (!!res.BASKET_DATA) 7512 couponListUpdate(res.BASKET_DATA); 7513 7514 7515 /* 7516 if (res.hasOwnProperty('WARNING_MESSAGE')) 7517 { 7518 var warningText = ''; 7519 7520 for (i = res['WARNING_MESSAGE'].length - 1; i >= 0; i--) 7521 warningText += res['WARNING_MESSAGE'][i] + '<br/>'; 7522 7523 BX('warning_message').innerHTML = warningText; 7524 } 7525 */ 7526 7527 if (!!res.BASKET_DATA) { 7528 if (BX('allSum_FORMATED')) 7529 BX('allSum_FORMATED').innerHTML = res['BASKET_DATA']['allSum_FORMATED']; 7530 7531 if (BX('DISCOUNT_PRICE_ALL')) { 7532 if (res['BASKET_DATA']['DISCOUNT_PRICE_ALL'] > 0) { 7533 $('.basket-style').find(".dynamic-show-hide-discount").css({ 7534 "display": "" 7535 }); 7536 $('.basket-style').find(".dynamic-show-hide-total-title").css({ 7537 "display": "none" 7538 }); 7539 BX('DISCOUNT_PRICE_ALL').innerHTML = res['BASKET_DATA']['DISCOUNT_PRICE_FORMATED']; 7540 } else { 7541 $('.basket-style').find(".dynamic-show-hide-total-title").css({ 7542 "display": "" 7543 }); 7544 $('.basket-style').find(".dynamic-show-hide-discount").css({ 7545 "display": "none" 7546 }); 7547 } 7548 7549 } 7550 7551 if ($("input#min_sum").length > 0) { 7552 if ($("input#min_sum").val().length) { 7553 var minSum = $("input#min_sum").val(); 7554 minSum = +minSum; 7555 7556 7557 if (res['BASKET_DATA']['allSum'] <= minSum) { 7558 $(".alert-message-min-sum").css({ 7559 "display": "" 7560 }); 7561 $(".basket-buttons").css({ 7562 "display": "none" 7563 }); 7564 $(".clear-basket-node-control").addClass('hidden'); 7565 } else { 7566 $(".alert-message-min-sum").css({ 7567 "display": "none" 7568 }); 7569 $(".basket-buttons").css({ 7570 "display": "" 7571 }); 7572 $(".clear-basket-node-control").removeClass('hidden'); 7573 } 7574 7575 } 7576 } 7577 } 7578} 7579 7580function couponListUpdate(res) { 7581 if (!!res && typeof res !== 'object') 7582 return; 7583 7584 7585 var couponBlock = $('.coupons_block'); 7586 7587 7588 7589 if (couponBlock.length > 0) { 7590 7591 if (!!res.COUPON_LIST && BX.type.isArray(res.COUPON_LIST)) { 7592 7593 if ($('.input-coupon').length > 0) { 7594 $('.input-coupon').val(""); 7595 $('.input-coupon').parents(".in-focus").removeClass('in-focus'); 7596 } 7597 7598 7599 couponsCollection = $(".coupons_block").find(".coupon-one"); 7600 7601 if (couponsCollection.length > 0) { 7602 for (i = 0; i < res.COUPON_LIST.length; i++) { 7603 couponFound = false;
7604 key = -1; 7605 7606 for (j = 0; j < couponsCollection.length; j++) { 7607 7608 if ($(couponsCollection[j]).find(".coupon-close").attr("data-coupon") === res.COUPON_LIST[i].COUPON) { 7609 couponFound = true; 7610 key = j; 7611 couponsCollection[j].couponUpdate = true; 7612 break; 7613 } 7614 } 7615 7616 7617 if (couponFound) { 7618 7619 couponClass = 'disabled'; 7620 if (res.COUPON_LIST[i].JS_STATUS === 'BAD') 7621 couponClass = 'bad'; 7622 else if (res.COUPON_LIST[i].JS_STATUS === 'APPLYED') 7623 couponClass = 'good'; 7624 7625 7626 $(couponsCollection[key]).removeClass("disabled bad good").addClass(couponClass) 7627 7628 /*BX.adjust(couponsCollection[key], {props: {className: couponClass}}); 7629 BX.adjust(couponsCollection[key].nextSibling, {props: {className: couponClass}}); 7630 BX.adjust(couponsCollection[key].nextSibling.nextSibling, {html: res.COUPON_LIST[i].JS_CHECK_CODE});*/ 7631 7632 } else { 7633 couponCreate(res.COUPON_LIST[i]); 7634 } 7635 7636 } 7637 7638 for (j = 0; j < couponsCollection.length; j++) { 7639 if (typeof (couponsCollection[j].couponUpdate) === 'undefined' || !couponsCollection[j].couponUpdate) { 7640 $(couponsCollection[j]).remove(); 7641 couponsCollection[j] = null; 7642 } else { 7643 couponsCollection[j].couponUpdate = null; 7644 } 7645 } 7646 7647 } else { 7648 for (i = 0; i < res.COUPON_LIST.length; i++) { 7649 couponCreate(res.COUPON_LIST[i]); 7650 } 7651 } 7652 } 7653 7654 } 7655} 7656 7657 7658function couponCreate(oneCoupon, order) { 7659 var couponClass = 'disabled', 7660 removeClass = 'remove-coupon'; 7661 order = order || false; 7662 7663 if ($(".coupons_block").length <= 0) 7664 return; 7665 7666 if (oneCoupon.JS_STATUS === 'BAD') 7667 couponClass = 'bad'; 7668 else if (oneCoupon.JS_STATUS === 'APPLYED') 7669 couponClass = 'good'; 7670 7671 if (order) 7672 removeClass = 'remove-order-coupon'; 7673 7674 7675 html = "<div class=\"coupon-one " + couponClass + "\">" + 7676 "<span class=\"coupon-name\">" + oneCoupon.COUPON + "</span><span class=\"coupon-close " + removeClass + "\" data-coupon=\"" + oneCoupon.COUPON + "\"></span>" + 7677 "</div>"; 7678 7679 7680 $(html).appendTo(".coupons_block"); 7681} 7682 7683 7684 7685$(document).on("click", ".remove-coupon", function () { 7686 var target = this, 7687 value; 7688 7689 if (BX.type.isElementNode(target) && target.hasAttribute('data-coupon')) { 7690 value = target.getAttribute('data-coupon'); 7691 if (BX.type.isNotEmptyString(value)) { 7692 recalcBasketAjax({ 7693 'delete_coupon': value 7694 }); 7695 } 7696 } 7697}); 7698 7699 7700$(document).on("click", ".remove-order-coupon", function () { 7701 var target = this, 7702 value; 7703 7704 if (BX.type.isElementNode(target) && target.hasAttribute('data-coupon')) { 7705 value = target.getAttribute('data-coupon'); 7706 if (BX.type.isNotEmptyString(value)) { 7707 BX.Sale.OrderAjaxComponent.sendRequest("removeCoupon", value); 7708 } 7709 } 7710}); 7711 7712$(document).on("click", ".show_items", function () { 7713 $(".show_items").removeClass('active'); 7714 $(this).addClass('active'); 7715 $(".basket_items_list").removeClass('active'); 7716 $(".basket_items_list[data-items='" + $(this).attr("data-items") + "']").addClass('active'); 7717 7718 if ($(this).attr("data-items") == "delayed") 7719 hideFormOrder(); 7720 7721 if ($(this).attr("data-items") == "items") 7722 showFormOrder(); 7723 7724 BasketFilter($("input.basket-filter").val()); 7725 7726}
7726); 7727 7728function enterCoupon() { 7729 7730 if ($('.input-coupon').length > 0) 7731 recalcBasketAjax({ 7732 'coupon': $('.input-coupon').val() 7733 }); 7734} 7735 7736function enterOrderCoupon() { 7737 7738 if ($('.input-coupon').length > 0) 7739 BX.Sale.OrderAjaxComponent.sendRequest("enterCoupon", $('.input-coupon').val()); 7740} 7741 7742function add2Basket(productItem, target) { 7743 productItem = productItem || ""; 7744 target = target || ""; 7745 7746 7747 if (productItem) { 7748 if (target.length > 0) 7749 target.addClass('btn-processing'); 7750 7751 7752 BX.ajax({ 7753 method: 'POST', 7754 dataType: 'json', 7755 url: '/bitrix/tools/concept.phoenix/ajax/basket/add2basket.php', 7756 data: { 7757 productItem: productItem, 7758 site_id: $("input.site_id").val() 7759 }, 7760 onsuccess: function (arResult) { 7761 /*if (!BX.type.isPlainObject(arResult)) 7762 return;*/ 7763 7764 if (arResult["OK"] == "Y") { 7765 markProductAddBasket(productItem["PRODUCT_ID"]); 7766 7767 if (arResult["SCRIPTS"]) 7768 $('body').append(arResult["SCRIPTS"]); 7769 } else { 7770 if (target.length > 0) 7771 target.removeClass('btn-processing'); 7772 } 7773 } 7774 }); 7775 } 7776 7777} 7778 7779function showProcessLoadBlock(obj) { 7780 obj.find('.loading-block').addClass('active'); 7781} 7782 7783function closeProcessLoadBlock(obj) { 7784 obj.find('.loading-block').removeClass('active'); 7785} 7786 7787function showProcessLoad() { 7788 $('.loading').addClass('active'); 7789} 7790 7791function closeProcessLoad() { 7792 $('.loading').removeClass('active'); 7793} 7794 7795function showProcessLoadItem(id) { 7796 $('.preloader-item[data-preload="' + id + '"]').addClass('active'); 7797} 7798 7799function closeProcessLoadItem(id) { 7800 $('.preloader-item[data-preload="' + id + '"]').removeClass('active'); 7801} 7802 7803function showProcessLoadTopRight() { 7804 $('.loading-top-right').addClass('active'); 7805} 7806 7807function closeProcessLoadTopRight() { 7808 $('.loading-top-right').removeClass('active'); 7809} 7810 7811 7812function startBlurWrapperContainer(params) { 7813 params = params || { 7814 "blur": true 7815 }; 7816 7817 7818 if (!$("body").hasClass('modal-open')) { 7819 7820 if (params.blur) 7821 $('.wrapper').addClass('blur'); 7822 7823 7824 $("body").addClass("modal-open"); 7825 7826 if (device.ios()) { 7827 cur_pos = $(document).scrollTop(); 7828 $("body").addClass("modal-ios"); 7829 } 7830 7831 7832 } 7833 7834} 7835 7836function stopBlurWrapperContainer() { 7837 if ($("body").hasClass('modal-open')) { 7838 $("body").removeClass("modal-open"); 7839 $('.wrapper').removeClass('blur'); 7840 7841 if (device.ios()) { 7842 $("body").removeClass("modal-ios"); 7843 window.scrollTo(0, cur_pos); 7844 } 7845 } 7846} 7847 7848function startModalMode(selectorArea) { 7849 7850 startBlurWrapperContainer(); 7851 closeProcessLoad(); 7852 7853 setTimeout(function () { 7854 $(selectorArea).find('.phoenix-modal').addClass('active'); 7855 }, 100); 7856} 7857 7858function callFastOrderForm(fromBasket, productItem) { 7859 fromBasket = fromBasket || ""; 7860 productItem = productItem || ""; 7861 7862 7863 $.ajax({ 7864 method: 'POST', 7865 dataType: 'html', 7866 url: '/bitrix/tools/concept.phoenix/ajax/basket/call_form_fast_order.php', 7867 data: { 7868 site_id: $("input.site_id").val(), 7869 fromBasket: fromBasket, 7870 productItem: productItem 7871 }, 7872 success: function (html) { 7873 7874 closeProcessLoad(); 7875 startModalMode("div.modalAreaForm"); 7876 $('div.modalAreaForm').html(html); 7877 $('div.modalAreaForm form.form .date').datetimepicker({ 7878 timepicker: false, 7879 format: 'd/m/Y', 7880 scrollMonth: false, 7881 scrollInput: false, 7882 dayOfWeekStart: 1 7883 }); 7884 } 7885 }); 7886} 7887 7888function getStringNameItem(name, offers) { 7889 var input = name; 7890 7891 for (var i in offers) { 7892 input += offers[i].SKU_NAME + ": " + offers[i].NAME + "; "; 7893 } 7894 7895 return input; 7896} 7897 7898$(document).on("click", ".callFastOrder", 7899 function () { 7900 var callDialog = "N"; 7901 7902 if ($(".callFastOrder").hasClass("callDialog")) 7903 callDialog = "Y"; 7904 7905 if ($(this).attr("data-param-product")) 7906 var productItem = eval("(" + $(this).attr("data-param-product") + ")"); 7907 7908 callFastOrderForm(callDialog, productItem); 7909 } 7910); 7911 7912$(document).on("click", ".btn-add2basket", 7913 function () { 7914 var productItem = eval("(" + $(this).attr("data-param-product") + ")"); 7915 add2Basket(productItem, $(this)); 7916 } 7917); 7918 7919 7920 7921function AjaxQuickSearch(arParams) { 7922 var _this = this; 7923 this.arParams = {
7924 'CONTAINER_ID': arParams.CONTAINER_ID, 7925 'INPUT_ID': arParams.INPUT_ID, 7926 'SHOW_RESULTS': arParams.SHOW_RESULTS, 7927 'LINE_VIEW_SIZE': "" 7928 }; 7929 7930 if (arParams.LINE_VIEW_SIZE) 7931 this.arParams.LINE_VIEW_SIZE = arParams.LINE_VIEW_SIZE; 7932 7933 7934 this.arParams.AJAX_PAGE = "/bitrix/tools/concept.phoenix/ajax/search.php"; 7935 this.arParams.MIN_QUERY_LEN = 3; 7936 7937 this.cache = []; 7938 this.cache_key = null; 7939 7940 this.startText = ''; 7941 this.running = false; 7942 this.searchWait = 0; 7943 this.currentRow = -1; 7944 this.RESULT = null; 7945 this.RESULT_WRAPPER = null; 7946 this.CONTAINER = null; 7947 this.INPUT = null; 7948 this.WAIT = null; 7949 this.HINT_BTN = null; 7950 this.SEARCH_IN_BTN = null; 7951 this.FOCUS = false; 7952 this.searchIn = null; 7953 this.searchInOld = null; 7954 7955 7956 this.ShowResult = function (result) { 7957 if (BX.type.isString(result)) 7958 _this.RESULT.innerHTML = result; 7959 7960 if ($.trim(_this.RESULT.innerHTML).length > 0) { 7961 setTimeout(function () { 7962 _this.RESULT_WRAPPER.style.display = 'block'; 7963 var pos = _this.adjustResultNode(); 7964 }, 450); 7965 } else { 7966 _this.RESULT_WRAPPER.style.display = 'none'; 7967 } 7968 7969 }; 7970 7971 this.onKeyPress = function (keyCode) { 7972 7973 switch (keyCode) { 7974 case 27: 7975 _this.RESULT_WRAPPER.style.display = 'none'; 7976 _this.currentRow = -1; 7977 _this.UnSelectAll(); 7978 return true; 7979 } 7980 7981 return false; 7982 }; 7983 7984 this.onTimeout = function () { 7985 _this.onChange(function () { 7986 setTimeout(_this.onTimeout, 500); 7987 }); 7988 }; 7989 7990 this.onChange = function (callback) { 7991 7992 if ($(window).width() >= 1199) { 7993 if (this.arParams.SHOW_RESULTS != "Y") 7994 return; 7995 7996 if (_this.running) { 7997 _this.runningCall = true; 7998 return; 7999 } 8000 8001 _this.running = true; 8002 8003 if (_this.INPUT.value != _this.oldValue || _this.searchIn != _this.searchInOld) { 8004 _this.oldValue = _this.INPUT.value; 8005 _this.searchInOld = _this.searchIn; 8006 8007 if (_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN) { 8008 showWaitSearch($("#" + _this.arParams.CONTAINER_ID)); 8009 clearTimeout(_this.searchWait); 8010 8011 _this.searchWait = setTimeout( 8012 function () { 8013 _this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value + '|' + _this.searchIn; 8014 8015 if (_this.cache[_this.cache_key] == null) { 8016 if (_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN) { 8017 BX.ajax.post( 8018 _this.arParams.AJAX_PAGE, { 8019 'q': _this.INPUT.value, 8020 'searchIn': _this.searchIn, 8021 'LINE_VIEW_SIZE': _this.arParams.LINE_VIEW_SIZE, 8022 'ajax_mode': "Y", 8023 'site_id': $("input.site_id").val() 8024 }, 8025 function (result) { 8026 8027 _this.cache[_this.cache_key] = result; 8028 _this.ShowResult(result); 8029 if (_this.WAIT) 8030 _this.WAIT.style.display = 'none'; 8031 8032 hideWaitSearch($("#" + _this.arParams.CONTAINER_ID)); 8033 8034 if (!!callback) 8035 callback(); 8036 8037 _this.running = false; 8038 8039 if (_this.runningCall) { 8040 _this.runningCall = false;
8041 _this.onChange(); 8042 } 8043 } 8044 ); 8045 8046 return; 8047 } else { 8048 hideWaitSearch($("#" + _this.arParams.CONTAINER_ID)); 8049 } 8050 8051 } else { 8052 _this.ShowResult(_this.cache[_this.cache_key]); 8053 _this.currentRow = -1; 8054 _this.EnableMouseEvents(); 8055 hideWaitSearch($("#" + _this.arParams.CONTAINER_ID)); 8056 } 8057 }, 900); 8058 } else { 8059 _this.RESULT_WRAPPER.style.display = 'none'; 8060 _this.RESULT.innerHTML = ""; 8061 _this.currentRow = -1; 8062 _this.UnSelectAll(); 8063 } 8064 8065 8066 } 8067 8068 if (!!callback) 8069 callback(); 8070 8071 8072 _this.running = false; 8073 } 8074 8075 }; 8076 8077 this.onScroll = function () { 8078 if (BX.type.isElementNode(_this.RESULT_WRAPPER) && _this.RESULT_WRAPPER.style.display !== "none" && _this.RESULT.innerHTML !== '') 8079 _this.adjustResultNode(); 8080 8081 }; 8082 8083 this.UnSelectAll = function () { 8084 var tbl = BX.findChild(_this.RESULT, { 8085 'tag': 'table', 8086 'class': 'title-search-result' 8087 }, true); 8088 if (tbl) { 8089 var cnt = tbl.rows.length; 8090 for (var i = 0; i < cnt; i++) 8091 tbl.rows[i].className = ''; 8092 } 8093 }; 8094 8095 this.EnableMouseEvents = function () { 8096 8097 }; 8098 8099 this.onFocusLost = function (hide) { 8100 setTimeout(function () { 8101 if (!_this.FOCUS) 8102 _this.RESULT_WRAPPER.style.display = 'none'; 8103 }, 250); 8104 8105 _this.FOCUS = false; 8106 }; 8107 8108 this.onFocusGain = function () { 8109 if ($.trim(_this.RESULT.innerHTML).length) 8110 _this.ShowResult(); 8111 }; 8112 8113 this.onKeyDown = function (e) { 8114 if (!e) 8115 e = window.event; 8116 8117 if (_this.RESULT_WRAPPER.style.display == 'block') { 8118 if (_this.onKeyPress(e.keyCode)) 8119 return BX.PreventDefault(e); 8120 } 8121 }; 8122 8123 this.adjustResultNode = function () { 8124 if (!(BX.type.isElementNode(_this.RESULT_WRAPPER) && 8125 BX.type.isElementNode(_this.CONTAINER))) 8126 return { 8127 top: 0, 8128 right: 0, 8129 bottom: 0, 8130 left: 0, 8131 width: 0, 8132 height: 0 8133 }; 8134 8135 8136 var pos = BX.pos(_this.CONTAINER); 8137 var bxpanel = document.getElementById("bx-panel"); 8138 var bxheight = 0; 8139 8140 if (bxpanel != null && !$("#" + this.arParams.CONTAINER_ID).hasClass('outside-div')) 8141 bxheight = parseInt(bxpanel.clientHeight); 8142 8143 8144 _this.RESULT_WRAPPER.style.position = 'absolute'; 8145 _this.RESULT_WRAPPER.style.top = (pos.bottom - bxheight) + 'px'; 8146 _this.RESULT_WRAPPER.style.left = (pos.left - 15) + 'px'; 8147 _this.RESULT_WRAPPER.style.width = (pos.width + 30) + 'px'; 8148 8149 8150 if ($("#" + this.arParams.CONTAINER_ID).hasClass('outside-div')) 8151 _this.RESULT_WRAPPER.style.height = ($(window).height() - pos.height - 40) + 'px'; 8152 8153 return pos; 8154 }; 8155 8156 this._onContainerLayoutChange = function () { 8157 if (BX.type.isElementNode(_this.RESULT_WRAPPER) && _this.RESULT_WRAPPER.style.display !== "none" && _this.RESULT.innerHTML !== '') 8158 _this.adjustResultNode(); 8159 8160 }; 8161 8162 this.SetSearchIn = function () { 8163 searchGet = $(BX.proxy_context); 8164 8165 searchGet.parents(".show-search-list-parent").find(".search-cur").text(searchGet.text()); 8166 searchGet.parents(".search-list").find('span.search-get').removeClass("active"); 8167 searchGet.parents(".search-list").removeClass('active'); 8168 searchGet.addClass('active'); 8169 searchGet.parents("form.search-form").attr("action", searchGet.attr("data-url")); 8170 8171 _this.searchIn = searchGet.attr("data-id"); 8172 8173 _this.onChange(); 8174 }; 8175 8176 this.Init = function () { 8177 8178 var parent = document.getElementById("phoenix-container"); 8179 8180 if ($("#" + this.arParams.CONTAINER_ID).hasClass('outside-div')) 8181 parent = document.getElementById("body"); 8182 8183 8184 this.searchIn = $("#" + this.arParams.CONTAINER_ID).find(".search-get.active").attr("data-id"); 8185 8186 this.RESULT_WRAPPER = parent.appendChild(document.createElement("DIV")); 8187 8188 this.RESULT_WRAPPER.className = 'ajax-search-results'; 8189 8190 if ($("#" + this.arParams.CONTAINER_ID).hasClass('outside-div')) 8191 this.RESULT_WRAPPER.className = 'ajax-search-results outside'; 8192 8193 8194 this.RESULT = this.RESULT_WRAPPER.appendChild(document.createElement("DIV")); 8195 this.RESULT.className = 'ajax-search-results-inner'; 8196 8197 8198 this.INPUT = BX(this.arParams.INPUT_ID); 8199 this.startText = this.oldValue = this.INPUT.value; 8200 8201 BX.bind(this.INPUT, 'focus', function () { 8202 _this.onFocusGain() 8203 }); 8204 BX.bind(this.INPUT, 'blur', function () { 8205 _this.onFocusLost() 8206 }); 8207 8208 this.INPUT.onkeydown = this.onKeyDown; 8209 BX.bind(this.INPUT, 'bxchange', function () { 8210 _this.onChange() 8211 }); 8212 8213 this.CONTAINER = BX(this.arParams.CONTAINER_ID); 8214 BX.addCustomEvent(this.CONTAINER, "OnNodeLayoutChange", this._onContainerLayoutChange); 8215 8216 this.HINT_BTN = BX(this.arParams.CONTAINER_ID + "_hint"); 8217 8218 8219 BX.bind(this.HINT_BTN, 'click', function () { 8220 8221 _this.FOCUS = true; 8222 BX.focus(_this.INPUT); 8223 8224 _this.INPUT.value = _this.HINT_BTN.innerHTML; 8225 8226 if (!$("#" + _this.arParams.CONTAINER_ID).find(".search-panel-js").hasClass('top-panel')) 8227 scrollToBlock($("#" + _this.arParams.INPUT_ID).parents(".search-panel-js").find(".search-scroll-focus"), '', 40); 8228 8229 checkInput($("#" + _this.arParams.INPUT_ID)); 8230 8231 _this.onChange(); 8232 8233 setTimeout(function () { 8234 _this.FOCUS = false;
8235 }, 1000); 8236 }); 8237 8238 8239 var searchGet = this.CONTAINER.querySelectorAll('.search-get'); 8240 8241 if (searchGet.length) { 8242 for (var i = 0; i < searchGet.length; i++) 8243 BX.bind(searchGet[i], 'click', BX.delegate(this.SetSearchIn, this)); 8244 } 8245 8246 8247 8248 var fixedParent = BX.findParent(this.CONTAINER, BX.is_fixed); 8249 8250 if (BX.type.isElementNode(fixedParent)) { 8251 BX.bind(window, 'scroll', BX.throttle(this.onScroll, 100, this)); 8252 } 8253 }; 8254 8255 8256 BX.ready( 8257 function () { 8258 _this.Init(arParams) 8259 } 8260 ); 8261 8262} 8263 8264$(document).on("click", ".show-dialog-map", function () { 8265 showProcessLoad(); 8266 $.post( 8267 '/bitrix/tools/concept.phoenix/ajax/popup/dialog_map.php', { 8268 site_id: $("input.site_id").val() 8269 }, 8270 function (html) { 8271 closeProcessLoad(); 8272 startBlurWrapperContainer(); 8273 8274 $("div.modalAreaWindow").html(html); 8275 8276 setTimeout(function () { 8277 $("div.modalAreaWindow").find('.phoenix-modal').addClass('active'); 8278 }, 100); 8279 8280 } 8281 ); 8282}); 8283 8284$(window).on("load", function () { 8285 8286 8287 if (customEvent) { 8288 updateLazyLoad(); 8289 } else { 8290 var counter = 0; 8291 8292 var timerId = setInterval( 8293 function () { 8294 if (counter > 5) 8295 clearInterval(timerId); 8296 8297 updateLazyLoad(); 8298 counter++; 8299 }, 8300 1000 8301 ); 8302 8303 8304 } 8305}); 8306 8307$(document).on("click", ".show-fast-order-form", function () { 8308 $(".form-order[data-target='" + $(this).attr("data-target") + "']").addClass('active'); 8309 $(".info-table[data-target='" + $(this).attr("data-target") + "']").removeClass('active'); 8310 $(".hide-fast-order-form[data-target='" + $(this).attr("data-target") + "']").addClass('active'); 8311 $('.date-group').datetimepicker({ 8312 timepicker: false, 8313 format: 'd.m.Y', 8314 scrollMonth: false, 8315 scrollInput: false, 8316 dayOfWeekStart: 1 8317 8318 }); 8319}); 8320 8321$(document).on("click", ".hide-fast-order-form", function () { 8322 $(this).removeClass('active'); 8323 $(".form-order[data-target='" + $(this).attr("data-target") + "']").removeClass('active'); 8324 $(".info-table[data-target='" + $(this).attr("data-target") + "']").addClass('active'); 8325}); 8326 8327$(document).on("click", ".btn-show-sort-board", function () { 8328 $(this).children('.sort-dialog-content').addClass('active'); 8329}); 8330$(document).mouseup(function (e) { 8331 var div = $(".sort-dialog-content"); 8332 if (!div.is(e.target) && div.has(e.target).length === 0) div.removeClass( 8333 'active'); 8334}); 8335 8336$(document).on("click", ".show-side-menu", function () { 8337 $(".wr-transform-to-dialog-by-mob").removeClass('d-none'); 8338 startBlurWrapperContainer(); 8339}); 8340$(document).on("click", ".close-side-menu", function () { 8341 $(".wr-transform-to-dialog-by-mob").addClass('d-none'); 8342 stopBlurWrapperContainer(); 8343}); 8344 8345if ($(window).width() <= 1024) { 8346 $(document).on({ 8347 click: function () { 8348 $(".soc-groups-in-menu").removeClass('d-none'); 8349 } 8350 8351 }, 8352 ".show-soc-groups" 8353 ); 8354} 8355$(document).on({ 8356 click: function () { 8357 $(".soc-groups-in-menu").addClass('d-none'); 8358 } 8359 8360 }, 8361 ".close-soc-groups" 8362); 8363 8364$(document).mouseup(function (e) { 8365 var div = $(".soc-groups-in-menu"); 8366 if (!div.is(e.target) && div.has(e.target).length === 0) div.addClass( 8367 'd-none'); 8368}); 8369 8370 8371 8372 8373 8374var ratingProducts = {}, 8375 ratingProductsParse = {}; 8376 8377$(document).ready(function () { 8378 getRatingCookie(); 8379 setVoteItems(); 8380}); 8381 8382function setVoteItems() { 8383 for (key in ratingProductsParse) { 8384 8385 var collectVote = $(".simple-rating[data-item-id='" + key + "']").children(), 8386 currentPoint = parseInt(ratingProductsParse[key]); 8387 8388 $(".simple-rating[data-item-id='" + key + "']").addClass("disabled"); 8389 8390 $(collectVote).each( 8391 function (index, element) { 8392 if (parseInt($(element).attr("data-point")) <= currentPoint) 8393 $(element).addClass('voted'); 8394 } 8395 ); 8396 8397 } 8398} 8399 8400function setVoteItem(id, vote) { 8401 8402 var collectVote = $(".simple-rating[data-item-id='vote-block-" + id + "']").children(), 8403 currentPoint = parseInt(vote); 8404 8405 $(".simple-rating[data-item-id='vote-block-" + id + "']").addClass("disabled"); 8406 collectVote.removeClass('voted'); 8407 8408 $(collectVote).each( 8409 function (index, element) { 8410 if (parseInt($(element).attr("data-point")) <= currentPoint) 8411 $(element).addClass('voted'); 8412 } 8413 ); 8414} 8415 8416function issetRatingCookie(id) { 8417 return !(ratingProductsParse[id] === undefined); 8418} 8419
8420function getRatingCookie() { 8421 ratingProducts = BX.getCookie($(".domen-url-for-cookie").val() + '_phoenix_rating_products'); 8422 8423 if (ratingProducts) 8424 ratingProductsParse = JSON.parse(ratingProducts); 8425} 8426 8427function setRatingCookie(id, vote) { 8428 ratingProductsParse["vote-block-" + id] = vote; 8429 BX.setCookie($(".domen-url-for-cookie").val() + '_phoenix_rating_products', JSON.stringify(ratingProductsParse), { 8430 expires: 60 * 60 * 60 * 60, 8431 path: "/" 8432 }); 8433} 8434 8435function setReviewsCountProduct(id, review) { 8436 $(".reviews-count[data-item-id=\"" + id + "\"]").html(review); 8437} 8438 8439function setRatingProduct(id, rating, selector) { 8440 8441 selector = selector || ""; 8442 var collectVote = $(selector + ".stars_container[data-item-id='vote-block-" + id + "']").children(), 8443 currentPoint = parseInt(rating); 8444 8445 $(selector + ".stars_container[data-item-id='vote-block-" + id + "']").attr("data-rating", rating); 8446 8447 8448 8449 if (currentPoint > 5) 8450 currentPoint = 5; 8451 8452 else if (currentPoint < 0) 8453 return false; 8454 8455 collectVote.removeClass('active'); 8456 8457 $(collectVote).each( 8458 function (index, element) { 8459 if (parseInt($(element).attr("data-point")) <= currentPoint) 8460 $(element).addClass('active'); 8461 } 8462 ); 8463 8464 return true; 8465} 8466 8467function showMessageSuccessVote() { 8468 8469 $('#alert-vote').show(); 8470 8471 var voteAlertTimer = setTimeout(function () { 8472 $('#alert-vote').hide(); 8473 clearTimeout(voteAlertTimer); 8474 }, 2000); 8475} 8476 8477function updateRatingProduct(id, vote) { 8478 8479 $.ajax({ 8480 url: '/bitrix/tools/concept.phoenix/ajax/update/rating.php', 8481 method: 'POST', 8482 data: { 8483 site_id: $("input.site_id").val(), 8484 id: id.replace('vote-block-', ''), 8485 vote: vote 8486 }, 8487 success: function (data) { 8488 if (data.OK == "Y") { 8489 setRatingProduct(data.PRODUCT.ID, data.PRODUCT.RATING); 8490 setRatingCookie(data.PRODUCT.ID, data.PRODUCT.VOTE); 8491 setVoteItem(data.PRODUCT.ID, data.PRODUCT.VOTE); 8492 showMessageSuccessVote(); 8493 } 8494 8495 } 8496 }); 8497} 8498 8499$(document).on({ 8500 mouseenter: function () { 8501 8502 if ($(this).parent().hasClass('simple-rating') && issetRatingCookie($(this).parent().attr("data-item-id"))) 8503 return false; 8504 8505 var collectVote = $(this).parent().children(), 8506 currentPoint = parseInt($(this).attr("data-point")); 8507 8508 collectVote.removeClass('hover'); 8509 8510 $(collectVote).each( 8511 function (index, element) { 8512 if (parseInt($(element).attr("data-point")) <= currentPoint) 8513 $(element).addClass('hover'); 8514 } 8515 8516 ); 8517 }, 8518 8519 mouseleave: function () { 8520 $(this).parent().children().removeClass('hover'); 8521 } 8522 }, 8523 ".stars_container.hover .star" 8524); 8525 8526 8527$(document).on("click", ".stars_container.simple-rating .star", function () { 8528 getRatingCookie(); 8529 8530 if (!issetRatingCookie($(this).parent().attr("data-item-id"))) 8531 updateRatingProduct($(this).parent().attr("data-item-id"), $(this).attr("data-point")); 8532}); 8533 8534$(document).on("click", ".stars_container.full-rating .star", function () { 8535 setRatingProduct($(this).parent().attr("data-item-id").replace('vote-block-', ''), $(this).attr("data-point"), ".full-rating"); 8536 8537 8538 if ($(this).parents(".wr-rating").length > 0) 8539 $(this).parents(".wr-rating").removeClass('has-error'); 8540 8541 if ($("input[name='review-vote'][data-item-id='" + $(this).parent().attr("data-item-id") + "']").length > 0) 8542 $("input[name='review-vote'][data-item-id='" + $(this).parent().attr("data-item-id") + "']").val($(this).attr("data-point")); 8543 8544}); 8545 8546 8547function setRatingProgress(id, rating) { 8548 8549 var circleParent = $("svg.circle-progress-bar[data-item-id='" + id + "']"), 8550 circle = circleParent.find("circle.rating-progress-bar"), 8551 radius = parseInt(circle.css("r")), 8552 circumference = 2 * Math.PI * radius, 8553 offset = 0, 8554 rating = parseFloat(rating).toFixed(1) || 0; 8555 8556 var color = ""; 8557 8558 if (rating == 0) 8559 color = "rating-0"; 8560 8561 else if (rating < 1) 8562 return false;
8563 8564 else if (rating > 5) 8565 rating = 5.0; 8566 8567 8568 8569 if (1 <= rating && rating <= 1.8) 8570 color = "rating-1"; 8571 8572 if (1.8 < rating && rating <= 2.8) 8573 color = "rating-2"; 8574 8575 if (2.8 < rating && rating <= 3.8) 8576 color = "rating-3"; 8577 8578 if (3.8 < rating && rating <= 4.8) 8579 color = "rating-4"; 8580 8581 if (4.8 < rating && rating <= 5) 8582 color = "rating-5"; 8583 8584 8585 offset = circumference - rating / 5 * circumference; 8586 8587 circle[0].style.strokeDasharray = circumference + " " + circumference; 8588 circle[0].style.strokeDashoffset = offset; 8589 8590 circleParent.removeClass('rating-0 rating-1 rating-2 rating-3 rating-4 rating-5'); 8591 circleParent.addClass(color); 8592 8593 8594 $(".rating-value[data-item-id='" + id + "']").text(rating); 8595 8596 return true; 8597} 8598 8599 8600 8601 8602 8603 8604 8605 8606var noClickLayer = 0; 8607 8608function openFlyBlock(id) { 8609 if (noClickLayer == 0) 8610 startBlurWrapperContainer(); 8611 8612 noClickLayer++; 8613 8614 $('body').append('<div class="click-ghost-area" data-fly-block-id="' + id + '"></div>'); 8615 8616 $('.fly-block[data-fly-block-id="' + id + '"]').addClass('active'); 8617 8618 var tOutShow = setTimeout(function () { 8619 $('.fly-block[data-fly-block-id="' + id + '"]').addClass('on'); 8620 8621 clearTimeout(tOutShow); 8622 }, 200); 8623} 8624 8625function closeFlyBlock(id) { 8626 if (noClickLayer == 1) 8627 stopBlurWrapperContainer(); 8628 8629 noClickLayer--; 8630 8631 $('.click-ghost-area[data-fly-block-id="' + id + '"]').remove(); 8632 $('.fly-block[data-fly-block-id="' + id + '"]').removeClass('on'); 8633 8634 8635 var tOutHide = setTimeout(function () { 8636 $('.fly-block[data-fly-block-id="' + id + '"]').removeClass('active'); 8637 8638 clearTimeout(tOutHide); 8639 }, 700); 8640} 8641 8642$(document).on("click", ".click-ghost-area", function () { 8643 8644 if (typeof ($(this).attr("data-fly-block-id")) != "undefined") 8645 closeFlyBlock($(this).attr("data-fly-block-id")); 8646}); 8647 8648function setFlyBlockParams(_this) { 8649 params = null; 8650 8651 if (_this.hasClass('fly-block-review')) { 8652 params = { 8653 "PRODUCT_ID": _this.attr("data-product-id"), 8654 "NAME": $("input.product-" + _this.attr("data-product-id") + "-name").val(), 8655 "PICTURE_SRC": $("input.product-" + _this.attr("data-product-id") + "-picture-src-small").val(), 8656 "PATH": "/bitrix/tools/concept.phoenix/ajax/reviews/fly_block_review_html.php" 8657 }; 8658 } 8659 8660 8661 return params; 8662} 8663 8664 8665 8666var loadingFlyReviewFlag = false; 8667 8668function loadingFlyReview() { 8669 loadingFlyReviewFlag = true; 8670} 8671 8672function completedFlyReview() { 8673 loadingFlyReviewFlag = false; 8674} 8675 8676function createFlyBlock(id, params) { 8677 8678 if (loadingFlyReviewFlag) 8679 return false; 8680 8681 showProcessLoad(); 8682 8683 params = params || null; 8684 8685 loadingFlyReview(); 8686 8687 $.post( 8688 params.PATH, { 8689 site_id: $("input.site_id").val(), 8690 params: params 8691 }, 8692 function (html) { 8693 closeProcessLoad(); 8694 $('body').append(html); 8695 8696 setRatingProduct(params.PRODUCT_ID, $(".stars_container.full-rating[data-item-id='vote-block-" + params.PRODUCT_ID + "']").attr("data-rating"), ".full-rating"); 8697 openFlyBlock(id); 8698 completedFlyReview(); 8699 8700 $('[data-toggle="tooltip-ajax"]').tooltip({ 8701 html: true 8702 }); 8703 } 8704 ); 8705 8706} 8707 8708$(document).on("click", ".open-fly-block", function () { 8709 var id = $(this).attr("data-fly-block-id"); 8710 8711 if ($('.fly-block[data-fly-block-id="' + id + '"]').length <= 0) { 8712 var params = setFlyBlockParams($(this)); 8713 8714 createFlyBlock(id, params); 8715 } else { 8716 openFlyBlock(id); 8717 } 8718 8719}); 8720 8721$(document).on("click", ".close-fly-block", function () { 8722 closeFlyBlock($(this).attr("data-fly-block-id")); 8723}); 8724 8725 8726$(document).on({ 8727 click: function () { 8728 var label = $(this).parent(); 8729 8730 if (label.hasClass("selected")) { 8731 label.removeClass("selected"); 8732 $(this).prop('checked', false); 8733 } else { 8734 $("input[type='radio'][name='" + $(this).attr("name") + "']").parent().removeClass("selected"); 8735 label.addClass("selected"); 8736 } 8737 }, 8738 }, 8739 ".btn-radio-simple:not(.disabled) input[type='radio']" 8740); 8741 8742 8743$(document).on('change', "input.load-file-simple[type='file']", 8744 function () { 8745 8746 var inp = $(this); 8747 var file_list_name = ""; 8748 8749 $(inp[0].files).each( 8750 function (key) { 8751 8752 if (key == 10) 8753 return false;
8754 8755 if (key != 0) 8756 file_list_name += ", "; 8757 8758 file_list_name += "<span>" + inp[0].files[key].name + "</span>"; 8759 } 8760 ); 8761 8762 8763 if (!file_list_name.length) 8764 return; 8765 8766 inp.parents('form').addClass('file-download'); 8767 inp.parents('label').find('.area-files-name').html(file_list_name); 8768 inp.closest('.load-file').removeClass("has-error"); 8769 8770 } 8771); 8772 8773 8774 8775$(document).on("focus", ".text-require, .input-simple input[type='email']", function () { 8776 $(this).removeClass("has-error"); 8777}); 8778 8779function validForm(form, params) { 8780 8781 var valid = true; 8782 params = params || null; 8783 8784 if (typeof ($("input.agreecheck", form).val()) != "undefined") { 8785 if (!$("input.agreecheck", form).prop("checked")) { 8786 $("input.agreecheck", form).parents("div.wrap-agree").addClass("has-error"); 8787 valid = false; 8788 } 8789 } 8790 8791 $("input[type='email'], input[type='text'], input[type='password'], textarea", form).each( 8792 function (key, value) { 8793 if ($(this).hasClass("text-require")) { 8794 if ($(this).val().trim().length <= 0) { 8795 $(this).val(""); 8796 $(this).addClass("has-error"); 8797 valid = false; 8798 } 8799 } else if ($(this).attr("type") == "email" && $(this).val().length > 0) { 8800 8801 if (!( 8802 /^([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]{2,15}$/i 8803 ).test($(this).val())) { 8804 $(this).addClass("has-error"); 8805 valid = false; 8806 } 8807 } 8808 } 8809 ); 8810 8811 $(".file-require", form).each(function (key, value) { 8812 if ($(this).parents('.label-require-file').find('span.area-file').hasClass( 8813 'area-file')) { 8814 $(this).parents('.label-require-file').addClass("has-error"); 8815 valid = false; 8816 } 8817 }); 8818 8819 if (params !== null) { 8820 8821 for (key in params) { 8822 8823 if (params[key].selector.length > 0) { 8824 params[key].selector.removeClass('has-error'); 8825 8826 if (params[key].value.length <= 0) { 8827 params[key].selector.addClass('has-error'); 8828 valid = false; 8829 } 8830 } 8831 } 8832 } 8833 8834 8835 return valid; 8836} 8837 8838 8839function buildFormValues(form, params) { 8840 8841 params = params || null; 8842 8843 var formSendAll = new FormData(); 8844 8845 8846 if (params) { 8847 for (key in params) { 8848 formSendAll.append(key, params[key]); 8849 } 8850 } 8851 8852 form_arr = form.find(':input,select,textarea').serializeArray(); 8853 8854 8855 for (var i = 0; i < form_arr.length; i++) { 8856 if (form_arr[i].value.length > 0) 8857 formSendAll.append(form_arr[i].name, form_arr[i].value); 8858 8859 8860 }; 8861 8862 if (form.hasClass('file-download')) { 8863 form.find('input[type=file]').each(function (key) { 8864 8865 var inp = $(this); 8866 var file_list_name = ""; 8867 8868 $(inp[0].files).each( 8869 function (k) { 8870 formSendAll.append(inp.attr('name'), inp[0].files[k], inp[0].files[k].name); 8871 } 8872 ); 8873 8874 }); 8875 } 8876 8877 return formSendAll; 8878} 8879 8880$(document).on("click", ".btn-submit-review", function () { 8881 var form = $(this).parents("form.form-review"), 8882 load = form.find(".preloader-simple"), 8883 btn = $(this), 8884 moderateMode = $("input.review-moderate-mode").val(), 8885 panelProcess = $(".wr-panel-process", form), 8886 panelSuccess = $(".wr-panel-success", form), 8887 footer = $("div.footer", form); 8888 8889 paramsValid = { 8890 "rating": { 8891 "selector": $(".wr-rating", form), 8892 "value": $(".stars_container", form).attr('data-rating') 8893 } 8894 }; 8895 8896 8897 if (!validForm(form, paramsValid)) { 8898 formAttentionScroll(form.find('.has-error:first').offset().top - form.offset().top, ".fly-block"); 8899 return false; 8900 } else { 8901 load.addClass('active'); 8902 btn.removeClass('active'); 8903 8904 var params = { 8905 "send": "Y", 8906 "site_id": $("input.site_id").val(), 8907 "VOTE": $(".stars_container", form).attr('data-rating') 8908 }; 8909 var formSendAll = buildFormValues(form, params); 8910 8911 var path = "/bitrix/tools/concept.phoenix/ajax/reviews/add.php"; 8912 8913 8914 $.ajax({ 8915 url: path, 8916 method: 'POST', 8917 contentType: false, 8918 processData: false, 8919 data: formSendAll, 8920 dataType: 'json', 8921 success: function (json) { 8922 if (json.OK == "Y") { 8923 panelProcess.addClass('d-none'); 8924 footer.addClass('d-none'); 8925 panelSuccess.removeClass('d-none'); 8926 8927 $.ajax({ 8928 url: "/bitrix/tools/concept.phoenix/ajax/ajax_hit_page.php", 8929 method: 'POST', 8930 success: function (json) {} 8931 }); 8932 8933 /*setTimeout(function() { 8934 8935 location.href = location.href; 8936 }, 3000);*/ 8937 8938 8939 } else if (json.OK == "N") { 8940 load.removeClass('active'); 8941 btn.addClass('active'); 8942 } 8943 8944 } 8945 }); 8946 } 8947 8948 return true; 8949 8950}); 8951 8952var reviewsLike = {}, 8953 reviewsLikeParse = {}; 8954 8955function setReviewsLike() { 8956 8957 for (key in reviewsLikeParse) { 8958 $(".review-item[data-review-id='" + key.replace("like-", "") + "']").find(".review-like").addClass('selected'); 8959 } 8960 8961} 8962 8963function getReviewsLikeCookie() { 8964 reviewsLike = BX.getCookie($(".domen-url-for-cookie").val() + '_phoenix_reviewsLike'); 8965 8966 if (reviewsLike) 8967 reviewsLikeParse = JSON.parse(reviewsLike); 8968} 8969 8970function setReviewsLikeCookie(id, value) { 8971 reviewsLikeParse["like-" + id] = value; 8972 BX.setCookie($(".domen-url-for-cookie").val() + '_phoenix_reviewsLike', JSON.stringify(reviewsLikeParse), { 8973 expires: 60 * 60 * 60 * 60, 8974 path: "/" 8975 }); 8976} 8977 8978function deleteReviewsLikeCookie(id) { 8979 delete reviewsLikeParse["like-" + id]; 8980 BX.setCookie($(".domen-url-for-cookie").val() + '_phoenix_reviewsLike', JSON.stringify(reviewsLikeParse), { 8981 expires: 60 * 60 * 60 * 60, 8982 path: "/" 8983 }); 8984} 8985 8986 8987var likeProcess = false;
8988 8989$(document).on("click", ".review-like", function () { 8990 if (likeProcess) 8991 return false; 8992 8993 var count = 0, 8994 btn = $(this), 8995 reviewNode = $(this).parents(".review-item"), 8996 reviewID = reviewNode.attr("data-review-id"), 8997 countLikeNode = reviewNode.find(".review-like-count"), 8998 countLikeValue = parseInt(countLikeNode.attr("data-count")); 8999 9000 if ($(this).hasClass('selected')) { 9001 count = -1; 9002 } else { 9003 count = 1; 9004 } 9005 9006 9007 var path = "/bitrix/tools/concept.phoenix/ajax/reviews/update_like.php"; 9008 9009 var formSendAll = new FormData(); 9010 formSendAll.append("REVIEW_ID", reviewID); 9011 formSendAll.append("LIKE_COUNT", count); 9012 formSendAll.append("site_id", $("input.site_id").val()); 9013 9014 $.ajax({ 9015 url: path, 9016 method: 'POST', 9017 contentType: false, 9018 processData: false, 9019 data: formSendAll, 9020 dataType: 'json', 9021 success: function (json) { 9022 likeProcess = false; 9023 9024 if (json.OK == "Y") { 9025 if (btn.hasClass('selected')) { 9026 btn.removeClass('selected'); 9027 deleteReviewsLikeCookie(reviewID); 9028 } else { 9029 btn.addClass('selected'); 9030 setReviewsLikeCookie(reviewID, count); 9031 } 9032 9033 if (parseInt(json.LIKE_COUNT) > 0) { 9034 countLikeNode.html("+" + json.LIKE_COUNT); 9035 countLikeNode.addClass('plus'); 9036 } else { 9037 countLikeNode.html(0); 9038 countLikeNode.removeClass('plus'); 9039 } 9040 9041 countLikeNode.attr("data-count", json.LIKE_COUNT); 9042 9043 } 9044 9045 } 9046 }); 9047}); 9048 9049 9050 9051function ajaxGetReviews(params) { 9052 var path = "/bitrix/tools/concept.phoenix/ajax/reviews/reviews_block.php"; 9053 params = params || 0; 9054 9055 showProcessLoad(); 9056 9057 if (params.this.hasClass('btn-filter')) 9058 params.this.parents(".group-list-simple").find(".btn-filter").removeClass('selected'); 9059 9060 9061 $.post(path, { 9062 site_id: $("input.site_id").val(), 9063 id: $(".review-block-ajax").attr("data-product-id"), 9064 page: params.pageNum, 9065 filter: params.filter, 9066 mode: "list" 9067 9068 }, 9069 function (html) { 9070 closeProcessLoad(); 9071 9072 getReviewsLikeCookie(); 9073 9074 setTimeout(function () { 9075 setReviewsLike(); 9076 }, 700); 9077 9078 9079 if (params.this.hasClass('getReviews')) { 9080 $(".review-block-ajax .wr-review-list").append(html); 9081 params.this.remove(); 9082 } else if (params.this.hasClass('btn-filter')) { 9083 $(".review-block-ajax .wr-review-list").html(html); 9084 params.this.addClass('selected'); 9085 } 9086 } 9087 ); 9088} 9089 9090$(document).on("click", ".getReviews", function () { 9091 var params = { 9092 "this": $(this), 9093 "pageNum": $(this).attr("data-page"), 9094 "filter": $(this).attr("data-filter"), 9095 }; 9096 ajaxGetReviews(params); 9097}); 9098 9099$(document).on("click", ".btn-filter.active:not(.selected)", function () { 9100 var params = { 9101 "this": $(this), 9102 "pageNum": 0, 9103 "filter": $(this).attr("data-filter"), 9104 9105 }; 9106 ajaxGetReviews(params); 9107}); 9108 9109 9110 9111function ajaxReviewsBlock() { 9112 9113 if ($(".review-block-ajax").length > 0) { 9114 var path = "/bitrix/tools/concept.phoenix/ajax/reviews/reviews_block.php"; 9115 9116 $.post(path, { 9117 site_id: $("input.site_id").val(), 9118 id: $(".review-block-ajax").attr("data-product-id"), 9119 mode: "full" 9120 }, 9121 function (html) { 9122 $(".review-block-ajax").html(html); 9123 getReviewsLikeCookie(); 9124 setReviewsLike(); 9125 $('[data-toggle="tooltip-ajax"]').tooltip({ 9126 html: true 9127 }); 9128 } 9129 ); 9130 } 9131} 9132 9133$(document).ready(function () { 9134 ajaxReviewsBlock(); 9135}); 9136 9137$(document).on("click", ".btn-show-container", function () { 9138 $(this).parents(".wr-hidden-container").find(".hidden-container").removeClass('d-none'); 9139 $(this).remove(); 9140}); 9141 9142 9143 9144var arrBasketFilter = {}, 9145 arrDelayFilter = {}; 9146 9147 9148function BasketFilter(query) { 9149 query = query || ""; 9150 9151 if (query.length <= 0) 9152 $(".basket-items-search-clear-btn").addClass('d-none'); 9153 else { 9154 $(".basket-items-search-clear-btn").removeClass('d-none'); 9155 } 9156 9157 query = query.toLowerCase(); 9158 9159 var realKey = "", 9160 productName = "", 9161 arrSearchBasket = {}, 9162 selector = ""; 9163 9164 9165 if ($(".tab_item[data-items='items']").hasClass('active')) { 9166 arrSearchBasket = arrBasketFilter; 9167 selector = $("#basket_items"); 9168 } 9169 9170 9171 if ($(".tab_item[data-items='delayed']").hasClass('active')) { 9172 arrSearchBasket = arrDelayFilter; 9173 selector = $("#delayed_items"); 9174 } 9175 9176 for (key in arrSearchBasket) { 9177 9178 realKey = key.replace('id_', ''); 9179 9180 if (!(arrSearchBasket[key].QUERY.indexOf(query) !== -1)) 9181 selector.find(".product#" + realKey).addClass('d-none').find(".product-name").html(arrSearchBasket[key].NAME); 9182 9183 9184 else { 9185 9186 productName = arrSearchBasket[key].NAME.slice(arrSearchBasket[key].QUERY.indexOf(query), arrSearchBasket[key].QUERY.indexOf(query) + query.length); 9187 productName = arrSearchBasket[key].NAME.replace(productName, "<span class='highlight'>" + productName + "</span>"); 9188 9189 selector.find(".product#" + realKey).removeClass('d-none').find(".product-name").html(productName); 9190 } 9191 } 9192 9193 delete arrSearchBasket; 9194 9195 9196} 9197 9198 9199$(document).on({ 9200 keyup: function () { 9201 BasketFilter($(this).val()); 9202 }, 9203 9204 paste: function () { 9205 BasketFilter($(this).val()); 9206 }, 9207 9208 cut: function () { 9209 BasketFilter($(this).val()); 9210 }, 9211 9212 blur: function () { 9213 BasketFilter($(this).val()); 9214 }, 9215 }, 9216 "input.basket-filter" 9217); 9218 9219 9220function clearInput(input) { 9221 input.val("").attr("placeholder", input.attr("data-placeholder")); 9222} 9223 9224$(document).on({ 9225 click: function () { 9226 BasketFilter(""); 9227 clearInput($("input.basket-filter")); 9228 }, 9229 }, 9230 ".basket-items-search-clear-btn" 9231); 9232 9233function initPhoneMask() { 9234 $(document).on("focus", "form input.phone", 9235 function () { 9236 /*if (!device.android())*/ 9237 $(this).mask($("input.mask-phone").val()); 9238 } 9239 ); 9240} 9241 9242 9243function getTermination(num, array) { 9244 num = num.toString(); 9245 var number = num.substring(num.length, -2); 9246 var term = ""; 9247 9248 if (number > 10 && number < 15) { 9249 term = array[3]; 9250 } else { 9251 9252 number = num.substring(num.length, -1); 9253 9254 if (number == 0) { 9255 term = array[0]; 9256 } 9257 if (number == 1) { 9258 term = array[1]; 9259 } 9260 if (number > 1) { 9261 term = array[2]; 9262 } 9263 if (number > 4) { 9264 term = array[3]; 9265 } 9266 } 9267 9268 return term; 9269} 9270 9271 9272$(document).on('click', '.open-dialog-window', 9273 function () { 9274 9275 if ($(this).attr("data-typename")) { 9276 var params = { 9277 "typeName": $(this).attr("data-typename"), 9278 "elementID": $(this).attr("data-elementid"), 9279 "blockTitle": $(this).attr("data-blocktitle"), 9280 "iblockID": $("input#LAND_iblockID").val(), 9281 "iblockTypeID": $("input#LAND_iblockTypeID").val(), 9282 "site_id": $("input.site_id").val() 9283 }; 9284 9285 callDialogWindow(params); 9286 } 9287 9288 } 9289); 9290 9291function callDialogWindow(params) { 9292 9293 params = params || null; 9294 9295 if (params) { 9296 showProcessLoad(); 9297 startBlurWrapperContainer(); 9298 9299 $.post("/bitrix/tools/concept.phoenix/ajax/popup/modal.php", params, 9300 function (html) { 9301 closeProcessLoad(); 9302 $(".modalAreaDetail").html(html); 9303 9304 setTimeout(function () { 9305 $('div.modalAreaDetail').find('.phoenix-modal').addClass('active'); 9306 }, 100); 9307 }); 9308 } 9309} 9310 9311 9312function getHtmlStoreList(PRODUCT_ID, STORE, MEASURE) { 9313 if ($("input.tab-store").length > 0) { 9314 9315 if (STORE.length <= 0) { 9316 $(".ajax_store_area").html(""); 9317 return true; 9318 } 9319 9320 clearTimeout($.data(this, 'store_block')); 9321 9322 $.data(this, 'store_block', setTimeout($.proxy(function () { 9323 9324 showProcessLoadItem("store_block"); 9325 $.ajax({ 9326 url: '/bitrix/tools/concept.phoenix/ajax/store_list.php', 9327 method: 'POST', 9328 data: { 9329 site_id: $("input.site_id").val(), 9330 TAB: $("input.tab-store").val(), 9331 PRODUCT_ID: PRODUCT_ID, 9332 STORE: STORE, 9333 MEASURE: MEASURE 9334 }, 9335 success: function (data) { 9336 9337 setTimeout(function () { 9338 closeProcessLoadItem("store_block"); 9339 $(".ajax_store_area").html(data); 9340 }, 300); 9341 9342 9343 } 9344 }); 9345 }, this), 700)); 9346 } 9347} 9348 9349$(document).on("click", ".bx_storege .btn-tab", function () { 9350 $(".bx_storege").find(".btn-tab").removeClass('active'); 9351 $(".bx_storege").find(".tab-content").addClass('d-none'); 9352 $(this).addClass('active'); 9353 $(".tab-content[data-content='" + $(this).attr("data-content") + "']").removeClass('d-none'); 9354}); 9355 9356$(document).on("click", ".bx_storege .list-item.flat", function () { 9357 9358 $(".bx_storege").find(".back2list").removeClass('d-none'); 9359 $(".bx_storege").find(".list-item.flat").addClass('d-none'); 9360 $(".bx_storege").find(".detail-item.flat").addClass('d-none'); 9361 9362 $(".detail-item.flat[data-content='" + $(this).attr("data-content") + "']").removeClass('d-none'); 9363}); 9364 9365 9366$(document).on("click", ".bx_storege .back2list", function () { 9367 $(this).addClass('d-none'); 9368 $(".bx_storege").find(".list-item.flat").removeClass('d-none'); 9369 $(".bx_storege").find(".detail-item.flat").addClass('d-none'); 9370}); 9371 9372function preparePopupBlockStore() { 9373 if ($(".popup-block[data-popup='store-block']").length > 0) { 9374 var clone = $(".popup-block[data-popup='store-block']").clone(); 9375 $(".popup-block[data-popup='store-block']").remove(); 9376 clone.appendTo('body'); 9377 } 9378} 9379 9380$(document).ready(function () { 9381 preparePopupBlockStore(); 9382}); 9383 9384 9385PopupWindow = { 9386 9387 init: function (container, params) { 9388 9389 if (container.length <= 0) 9390 return false;
9391 9392 params = params || {}; 9393 9394 if (params.ajax) { 9395 console.log('ajax'); 9396 } else { 9397 PopupWindow.show(container, params); 9398 } 9399 }, 9400 show: function (container, params) { 9401 9402 if (container.hasClass('animated')) { 9403 9404 } else { 9405 container.removeClass("d-none"); 9406 9407 var cartOut = setTimeout(function () { 9408 container.addClass('active'); 9409 clearTimeout(cartOut); 9410 }, 300); 9411 9412 } 9413 9414 9415 startBlurWrapperContainer({ 9416 "blur": params.blur 9417 }); 9418 9419 9420 if (params.hideContainer) 9421 $(params.hideContainer).addClass('d-none'); 9422 9423 9424 }, 9425 hide: function (container, params) { 9426 var timeHide = 300; 9427 9428 if (container.hasClass('animated')) { 9429 if (container.hasClass('fadeInUp')) { 9430 container.removeClass('fadeInUp'); 9431 if (typeof container.attr("data-animate-out") != "undefined") { 9432 var animateOut = container.attr("data-animate-out"); 9433 container.addClass(animateOut); 9434 9435 timeHide = 1500; 9436 } 9437 9438 } 9439 } else { 9440 container.removeClass('active'); 9441 } 9442 9443 var cartOut = setTimeout(function () { 9444 container.addClass('d-none'); 9445 clearTimeout(cartOut); 9446 }, timeHide); 9447 9448 if (params.blur) 9449 stopBlurWrapperContainer(); 9450 } 9451 9452}; 9453 9454 9455$(document).on('click', '.show-popup-block', function () { 9456 var container = $('.popup-block[data-popup="' + $(this).attr("data-popup") + '"]'), 9457 params = { 9458 "blur": false, 9459 "hideContainer": false 9460 }; 9461 9462 if (typeof $(this).attr("data-hide-container") != 'undefined') 9463 params.hideContainer = $(this).attr("data-hide-container"); 9464 9465 9466 PopupWindow.init(container, params); 9467}); 9468 9469$(document).on('click', '.info-right-side .show-popup-block-store', function () { 9470 var container = $('.popup-block[data-popup="store-block"]'), 9471 params = { 9472 "blur": false 9473 }; 9474 9475 PopupWindow.init(container, params); 9476}); 9477 9478 9479 9480$(document).on('click', '.hide-popup-block-js', function () { 9481 9482 var container = $(this).parents(".popup-block"), 9483 params = { 9484 "blur": true 9485 }; 9486 PopupWindow.hide(container, params); 9487 9488 if ($(this).hasClass('set-first-region-values')) 9489 setFirstRegionValues(); 9490 9491}); 9492 9493function setFirstRegionValues() { 9494 setTimeout(function () { 9495 $(".value-region").text($("input.region-name").val()); 9496 }, 1000); 9497 9498 9499 if ($("input.region-image").val().length > 0) { 9500 $("input.region-image-default").val($("input.region-image").val()); 9501 $(".region-popup").find(".left-side").css({ 9502 "background-image": "url(" + $("input.region-image-default").val() + ")" 9503 }); 9504 $(".region-popup").find(".right-side").css({ 9505 "background-image": "url(" + $("input.region-image-default").val() + ")" 9506 }); 9507 } 9508 9509 $("input.region-id").val($("input.region-id-current").val()); 9510 9511 9512 $("input.region-id-default").val($("input.region-id-current").val()); 9513 $("input.region-name-default").val($("input.region-name").val()); 9514 9515 if ($("input[name='region-value'][value='" + $("input.region-id-current").val() + "']").length > 0) 9516 $("input[name='region-value'][value='" + $("input.region-id-current").val() + "']").prop("checked", true); 9517 else { 9518 var favorites = $(".region-popup input[type='radio']"); 9519 9520 if (favorites.length > 0) { 9521 $(favorites).each( 9522 function (index, element) { 9523 element.checked = false; 9524 } 9525 9526 ); 9527 } 9528 } 9529} 9530 9531function autocompleteRegionAreaSelected(th, ui) { 9532 th.parents(".mode-select").addClass('ok'); 9533 9534 9535 var favorites = th.parents("form").find("input[type='radio']"); 9536 9537 if (favorites.length > 0) { 9538 $(favorites).each( 9539 function (index, element) { 9540 element.checked = false; 9541 } 9542 9543 ); 9544 } 9545 9546 9547 var arRegionsValues = ui.item.value.split(';'); 9548 var regionID = arRegionsValues[0]; 9549 var regionHref = arRegionsValues[1]; 9550 var regionName = arRegionsValues[2]; 9551 9552 th.val(ui.item.label); 9553 9554 if (regionName.length > 0) 9555 $(".value-region").text(regionName); 9556 else { 9557 $(".value-region").text(ui.item.label); 9558 } 9559 9560 $("input.region-id").val(regionID); 9561 $(".region-popup .error-input").addClass('d-none'); 9562 9563 $(".region-popup").find(".left-side").removeAttr('style'); 9564 $(".region-popup").find(".right-side").removeAttr('style'); 9565 9566 9567 if (ui.item.icon.length > 0) { 9568 $(".region-popup").find(".left-side").css({ 9569 "background-image": "url(" + ui.item.icon + ")" 9570 }); 9571 $(".region-popup").find(".right-side").css({ 9572 "background-image": "url(" + ui.item.icon + ")" 9573 }); 9574 9575 } 9576 9577} 9578 9579 9580function autocompleteRegionAreaChange(th, flag) { 9581 9582 if (flag) { 9583 $("input.autocompleteRegion").parents(".mode-select").addClass('ok'); 9584 $(".region-popup .error-input").addClass('d-none'); 9585 9586 var favorites = th.parents("form").find("input[type='radio']"); 9587 9588 if (favorites.length > 0) { 9589 $(favorites).each( 9590 function (index, element) { 9591 element.checked = false;
9592 } 9593 9594 ); 9595 } 9596 } else { 9597 9598 $("input.autocompleteRegion").val(""); 9599 9600 $(".region-popup .error-input").removeClass('d-none'); 9601 9602 $("input.autocompleteRegion").parents(".mode-select").removeClass('ok'); 9603 $("input.region-id").val($("input.region-id-default").val()); 9604 9605 if ($("input[name='region-value'][value='" + $("input.region-id").val() + "']").length > 0) 9606 $("input[name='region-value'][value='" + $("input.region-id").val() + "']").prop("checked", true); 9607 9608 9609 9610 $(".value-region").html($("input.region-name-default").val()); 9611 9612 $(".region-popup").find(".right-side").removeAttr('style'); 9613 $(".region-popup").find(".left-side").removeAttr('style'); 9614 9615 if ($("input.region-image-default").val().length > 0) { 9616 $(".region-popup").find(".left-side").css({ 9617 "background-image": "url(" + $("input.region-image-default").val() + ")" 9618 }); 9619 $(".region-popup").find(".right-side").css({ 9620 "background-image": "url(" + $("input.region-image-default").val() + ")" 9621 }); 9622 } 9623 } 9624 9625} 9626 9627 9628$(document).on('click', '.region-popup input[type="radio"]', function () { 9629 9630 var form = $(this).parents("form"); 9631 $("input.region-id").val($(this).val()); 9632 $(".value-region").text($(this).attr("data-label")); 9633 $(".region-popup .error-input").addClass('d-none'); 9634 9635 9636 if ($(window).width() <= 767) { 9637 $("input.autocompleteRegion").val($(this).parent().find("span.text").html()); 9638 form.find(".mode-select").addClass('ok'); 9639 } else { 9640 $("input.autocompleteRegion").val(""); 9641 form.find(".mode-select").removeClass('ok'); 9642 } 9643 9644 $(".region-popup").find(".right-side").removeAttr('style'); 9645 if ($(this).attr("data-icon").length > 0) 9646 $(".region-popup").find(".right-side").css({ 9647 "background-image": "url(" + $(this).attr("data-icon") + ")" 9648 }); 9649 9650 $(".region-popup").find(".left-side").removeAttr('style'); 9651 if ($(this).attr("data-icon").length > 0) 9652 $(".region-popup").find(".left-side").css({ 9653 "background-image": "url(" + $(this).attr("data-icon") + ")" 9654 }); 9655 9656 9657}); 9658 9659 9660$(document).on("focus", "input.autocompleteRegion", function () { 9661 if ($(this).val().length <= 0) { 9662 $(this).parents(".mode-select").removeClass('ok'); 9663 } 9664}); 9665$(document).on("blur", "input.autocompleteRegion", function () { 9666 if ($(this).val().length <= 0) { 9667 $(this).parents(".mode-select").removeClass('ok'); 9668 } 9669}); 9670 9671 9672 9673function setCookieRegion(regionID, submit) { 9674 submit = submit || ""; 9675 9676 $.ajax({ 9677 url: '/bitrix/tools/concept.phoenix/ajax/update/region_set_cookie.php', 9678 method: 'POST', 9679 data: { 9680 site_id: $("input.site_id").val(), 9681 serverName: $("input.serverName").val(), 9682 curPageUrl: $("input.curPageUrl").val(), 9683 submit: submit, 9684 id: regionID 9685 }, 9686 success: function (data) { 9687 if (data.HREF.length > 0) { 9688 setTimeout(function () { 9689 location.href = data.HREF; 9690 }, 1000); 9691 } 9692 else 9693 { 9694 $('.value-region').html(data.NAME_LOCATION); 9695 $('.value-region-main').html(data.NAME_LOCATION); 9696 9697 var favorites = $(".region-popup input[type='radio']"); 9698 9699 if (favorites.length > 0) { 9700 $(favorites).each( 9701 function (index, element) { 9702 element.checked = false; 9703 } 9704 9705 ); 9706 } 9707 9708 $('input[name="region-value"][value='+data.ID_LOCATION+']').prop("checked", true); 9709 9710 } 9711 }, 9712 error: function () { 9713 $(".submit-region").removeClass("hide-text"); 9714 $(".submit-region-load").removeClass('d-block'); 9715 } 9716 }); 9717} 9718 9719$(document).on("click", ".submit-region", function () { 9720 9721 var regionID = $("input.region-id").val(), 9722 regionDefaultID = $("input.region-id-default").val(), 9723 container = $(this).parents(".popup-block"),
9724 params = { 9725 "blur": true 9726 }; 9727 9728 9729 regionID = regionID || regionDefaultID; 9730 9731 $(this).addClass("hide-text"); 9732 $(".submit-region-load").addClass('d-block'); 9733 9734 setCookieRegion(regionID, "Y"); 9735}); 9736 9737 9738var subMenuLvl2 = null; 9739 9740document.addEventListener("DOMContentLoaded", function() { 9741 subMenuLvl2 = document.querySelectorAll(".sub-menu-lvl-2-item-js"); 9742 9743 if(subMenuLvl2) 9744 { 9745 9746 if (windowWidth <= 1024) 9747 { 9748 for (var i = 0; i < subMenuLvl2.length; i++) 9749 { 9750 subMenuLvl2[i].addEventListener('click', function() 9751 { 9752 var target = event.target.closest(".sub-menu-lvl-2-item-js"); 9753 9754 if(!target.classList.contains('active')) 9755 { 9756 event.preventDefault(); 9757 } 9758 9759 showSubMenuLvl2Items(target); 9760 9761 9762 }); 9763 } 9764 } 9765 else 9766 { 9767 9768 9769 for (var i = 0; i < subMenuLvl2.length; i++) 9770 { 9771 subMenuLvl2[i].addEventListener('mouseenter', function() 9772 { 9773 var target = event.target.closest(".sub-menu-lvl-2-item-js"); 9774 9775 $.data(this, 'timer-'+i, setTimeout($.proxy(function () { 9776 showSubMenuLvl2Items(target); 9777 }, this), 100)); 9778 9779 }); 9780 9781 subMenuLvl2[i].addEventListener('mouseleave', function() 9782 { 9783 clearTimeout($.data(this, 'timer-'+i)); 9784 }); 9785 } 9786 } 9787 } 9788}); 9789 9790 9791 9792function clearSubMenuLvl2Items() 9793{ 9794 var subMenuLvl2Items = document.querySelectorAll(".sub-menu-wr-lvl-3-item-js"); 9795 9796 if(subMenuLvl2Items) 9797 { 9798 for (var i = 0; i < subMenuLvl2Items.length; i++) 9799 { 9800 subMenuLvl2Items[i].classList.remove('active'); 9801 } 9802 } 9803 if(subMenuLvl2) 9804 { 9805 for (var i = 0; i < subMenuLvl2.length; i++) 9806 { 9807 subMenuLvl2[i].classList.remove('active'); 9808 } 9809 } 9810} 9811 9812function showSubMenuLvl2Items(target){ 9813 var attr = target.getAttribute('data-sub-menu-lvl-2'), 9814 groupItems = document.querySelector(".sub-menu-wr-lvl-3-item-js[data-sub-menu-lvl-2='"+attr+"']"); 9815 9816 clearSubMenuLvl2Items(); 9817 9818 if(groupItems) 9819 groupItems.classList.add('active'); 9820 9821 target.classList.add('active'); 9822 $('.lazyload').Lazy(paramsLazy); 9823} 9824 9825 9826function menuLvls4Selected(th){ 9827 var itemSelected = th.find('.sub-menu-lvl-2-item-js.selected'), 9828 items = th.find('.sub-menu-lvl-2-item-js'); 9829 9830 clearSubMenuLvl2Items(); 9831 9832 9833 if(itemSelected.length<=0 && items.length>0){ 9834 items[0].classList.add('active'); 9835 $(".sub-menu-wr-lvl-3-item-js[data-sub-menu-lvl-2="+items[0].getAttribute('data-sub-menu-lvl-2')+"]").addClass('active'); 9836 } 9837 else if(itemSelected.length>0) 9838 { 9839 itemSelected[0].classList.add('active'); 9840 $(".sub-menu-wr-lvl-3-item-js[data-sub-menu-lvl-2="+itemSelected[0].getAttribute('data-sub-menu-lvl-2')+"]").addClass('active'); 9841 } 9842} 9843 9844 9845 9846function getCatalogStories(){ 9847 9848 if($(".catalog-stories-ajax").length>0) 9849 { 9850 9851 $.ajax({ 9852 url: '/bitrix/tools/concept.phoenix/ajax/catalog_stories.php', 9853 method: 'POST', 9854 data: { 9855 site_id: $("input.site_id").val(), 9856 COUNT: $(".catalog-stories-ajax").attr('data-count'), 9857 }, 9858 success: function (data) { 9859 $(".catalog-stories-ajax").append(data); 9860 } 9861 }); 9862 } 9863} 9864 9865(function (window) { 9866 9867if (!!window.JCSaleGiftBasket) 9868{ 9869 return; 9870} 9871 9872window.JCSaleGiftBasket = function (arParams) 9873{ 9874 this.element = arParams; 9875 this.nodes = {}; 9876 this.currentElement = {}; 9877 this.oldElement = {}; 9878 this.errorCode = 0; 9879 this.firstLoad = true; 9880 this.selectedValues = {}; 9881 this.firstLoad = false; 9882 9883 9884 if (typeof arParams === 'object') { 9885 this.initConfig(); 9886 9887 switch (this.element.PRODUCT_TYPE) { 9888 case 0: 9889 case 1: 9890 case 2: 9891 9892 this.initProductData(); 9893 break; 9894 case 3: 9895 this.initOffersData(); 9896 break; 9897 default: 9898 this.errorCode = -1; 9899 } 9900 } 9901 9902 9903 if (this.errorCode === 0) 9904 BX.ready(BX.delegate(this.init, this)); 9905}; 9906 9907window.JCSaleGiftBasket.prototype = {
9908 initConfig: function () { 9909 this.element.PRODUCT_TYPE = parseInt(this.element.PRODUCT_TYPE, 10); 9910 this.nodes.obProduct = document.querySelector("#"+this.element.VISUAL.ID); 9911 this.nodes.obProductItem = this.nodes.obProduct.querySelector('.gift-item-js'); 9912 this.nodes.obImg = this.nodes.obProduct.querySelector('.gift-item-img-js'); 9913 this.nodes.obImgLink = this.nodes.obProduct.querySelector('.gift-item-img-link-js'); 9914 this.nodes.obPrice = this.nodes.obProduct.querySelector('.gift-item-price-js'); 9915 this.nodes.obName = this.nodes.obProduct.querySelector('.gift-item-name-js'); 9916 this.nodes.obSku = this.nodes.obProduct.querySelector('.sku-container-js'); 9917 this.nodes.obBtn = this.nodes.obProduct.querySelector('.gift-item-btn-js'); 9918 9919 this.nodes.obBtn && BX.bind(this.nodes.obBtn, 'click', BX.proxy(this.SendToBasket, this)); 9920 9921 }, 9922 9923 initProductData: function () { 9924 9925 this.currentElement = this.element; 9926 this.oldElement = this.currentElement; 9927 9928 this.setPrice(); 9929 9930 if(this.currentElement.CAN_BUY) 9931 { 9932 this.nodes.obProduct.classList.remove('d-none'); 9933 } 9934 else 9935 { 9936 this.nodes.obProduct.remove(); 9937 } 9938 9939 9940 9941 }, 9942 9943 initOffersData: function () { 9944 9945 if (this.element.CONFIG.SHOW_OFFERS) 9946 { 9947 this.currentElement = this.element.OFFERS[this.element.OFFER_ID_SELECTED]; 9948 9949 var treeItems = this.nodes.obSku.querySelectorAll('li'); 9950 9951 for (i = 0; i < treeItems.length; i++) { 9952 BX.bind(treeItems[i], 'click', BX.delegate(this.selectOfferProp, this)); 9953 } 9954 9955 this.setCurrent(); 9956 9957 } 9958 }, 9959 9960 selectOfferProp: function () { 9961 var i = 0, 9962 strTreeValue = '', 9963 arTreeItem = [], 9964 rowItems = null, 9965 target = BX.proxy_context, 9966 smallCardItem; 9967 9968 9969 if (target && target.hasAttribute('data-treevalue')) { 9970 if (BX.hasClass(target, 'active')) 9971 return; 9972 9973 9974 9975 if (typeof document.activeElement === 'object') { 9976 document.activeElement.blur(); 9977 } 9978 9979 9980 9981 strTreeValue = target.getAttribute('data-treevalue'); 9982 arTreeItem = strTreeValue.split('_'); 9983 9984 this.searchOfferPropIndex(arTreeItem[0], arTreeItem[1]); 9985 9986 9987 rowItems = BX.findChildren(target.parentNode, { 9988 tagName: 'li' 9989 }, false); 9990 9991 9992 if (rowItems && rowItems.length) { 9993 for (i = 0; i < rowItems.length; i++) { 9994 BX.removeClass(rowItems[i], 'active'); 9995 } 9996 } 9997 9998 9999 BX.addClass(target, 'active'); 10000 10001 } 10002 }, 10003 10004 searchOfferPropIndex: function (strPropID, strPropValue) { 10005 var strName = '', 10006 arShowValues = false, 10007 arCanBuyValues = [], 10008 allValues = [], 10009 index = -1, 10010 i, j, 10011 arFilter = {}, 10012 tmpFilter = []; 10013 10014 10015 10016 for (i = 0; i < this.element.TREE_PROPS.length; i++) { 10017 if (this.element.TREE_PROPS[i].ID === strPropID) { 10018 index = i; 10019 break; 10020 } 10021 } 10022 10023 if (index > -1) { 10024 for (i = 0; i < index; i++) { 10025 strName = 'PROP_' + this.element.TREE_PROPS[i].ID; 10026 arFilter[strName] = this.selectedValues[strName]; 10027 } 10028 10029 10030 strName = 'PROP_' + this.element.TREE_PROPS[index].ID; 10031 arFilter[strName] = strPropValue; 10032 10033 10034 10035 for (i = index + 1; i < this.element.TREE_PROPS.length; i++) { 10036 10037 strName = 'PROP_' + this.element.TREE_PROPS[i].ID; 10038 arShowValues = this.getRowValues(arFilter, strName); 10039 10040 10041 10042 if (!arShowValues) 10043 break; 10044 10045 allValues = []; 10046 10047 if (this.element.SHOW_ABSENT === 'Y') { 10048 10049 arCanBuyValues = []; 10050 tmpFilter = []; 10051 tmpFilter = BX.clone(arFilter, true); 10052 10053 for (j = 0; j < arShowValues.length; j++) { 10054 tmpFilter[strName] = arShowValues[j]; 10055 allValues[allValues.length] = arShowValues[j]; 10056 if (this.getCanBuy(tmpFilter)) 10057 arCanBuyValues[arCanBuyValues.length] = arShowValues[j]; 10058 } 10059 } else { 10060 arCanBuyValues = arShowValues; 10061 } 10062 10063 10064 10065 10066 if (this.selectedValues[strName] && BX.util.in_array(this.selectedValues[strName], arC
10066anBuyValues)) { 10067 arFilter[strName] = this.selectedValues[strName]; 10068 10069 } else { 10070 10071 if (this.element.SHOW_ABSENT === 'Y') { 10072 arFilter[strName] = (arCanBuyValues.length ? arCanBuyValues[0] : allValues[0]); 10073 } else { 10074 arFilter[strName] = arCanBuyValues[0]; 10075 } 10076 } 10077 10078 10079 10080 this.updateRow(i, arFilter[strName], arShowValues, arCanBuyValues); 10081 10082 } 10083 10084 10085 this.selectedValues = arFilter; 10086 10087 this.changeInfo(); 10088 10089 } 10090 10091 }, 10092 10093 setCurrent: function () { 10094 var i, 10095 j = 0, 10096 strName = '', 10097 arShowValues = false, 10098 arCanBuyValues = [], 10099 arFilter = {}, 10100 tmpFilter = [], 10101 current = this.currentElement.TREE; 10102 10103 10104 for (i = 0; i < this.element.TREE_PROPS.length; i++) { 10105 strName = 'PROP_' + this.element.TREE_PROPS[i].ID; 10106 arShowValues = this.getRowValues(arFilter, strName); 10107 10108 10109 if (!arShowValues) 10110 break; 10111 10112 if (BX.util.in_array(current[strName], arShowValues)) { 10113 arFilter[strName] = current[strName]; 10114 } else { 10115 arFilter[strName] = arShowValues[0]; 10116 this.element.OFFER_ID_SELECTED = 0; 10117 } 10118 10119 10120 if (this.element.CONFIG.SHOW_ABSENT === 'Y') { 10121 arCanBuyValues = []; 10122 tmpFilter = []; 10123 tmpFilter = BX.clone(arFilter, true); 10124 10125 for (j = 0; j < arShowValues.length; j++) { 10126 tmpFilter[strName] = arShowValues[j]; 10127 10128 if (this.getCanBuy(tmpFilter)) { 10129 arCanBuyValues[arCanBuyValues.length] = arShowValues[j]; 10130 } 10131 } 10132 } else { 10133 arCanBuyValues = arShowValues; 10134 } 10135 10136 this.updateRow(i, arFilter[strName], arShowValues, arCanBuyValues); 10137 } 10138 10139 this.selectedValues = arFilter; 10140 10141 this.changeInfo(); 10142 }, 10143 getCanBuy: function (arFilter) { 10144 var i, 10145 j = 0, 10146 boolOneSearch = true, 10147 boolSearch = false; 10148 10149 for (i = 0; i < this.element.OFFERS.length; i++) { 10150 boolOneSearch = true; 10151 10152 for (j in arFilter) { 10153 if (arFilter[j] !== this.element.OFFERS[i].TREE[j]) { 10154 boolOneSearch = false; 10155 break; 10156 } 10157 } 10158 10159 if (boolOneSearch) { 10160 10161 if (this.element.OFFERS[i].CAN_BUY) { 10162 boolSearch = true; 10163 break; 10164 } 10165 } 10166 } 10167 10168 return boolSearch; 10169 }, 10170 10171 getRowValues: function (arFilter, index) { 10172 var arValues = [], 10173 i = 0, 10174 j = 0, 10175 boolSearch = false, 10176 boolOneSearch = true; 10177 10178 10179 10180 if (arFilter.length === 0) { 10181 for (i = 0; i < this.element.OFFERS.length; i++) { 10182 if (!BX.util.in_array(this.element.OFFERS[i].TREE[index], arValues)) { 10183 arValues[arValues.length] = this.element.OFFERS[i].TREE[index]; 10184 10185 } 10186 } 10187 boolSearch = true; 10188 } else { 10189 for (i = 0; i < this.element.OFFERS.length; i++) { 10190 boolOneSearch = true; 10191 10192 for (j in arFilter) { 10193 if (arFilter[j] !== this.element.OFFERS[i].TREE[j]) { 10194 boolOneSearch = false; 10195 break; 10196 } 10197 } 10198 10199 if (boolOneSearch) { 10200 if (!BX.util.in_array(this.element.OFFERS[i].TREE[index], arValues)) { 10201 arValues[arValues.length] = this.element.OFFERS[i].TREE[index]; 10202 10203 } 10204 10205 boolSearch = true; 10206 } 10207 } 10208 } 10209 10210 10211 10212 return (boolSearch ? arValues : false); 10213 }, 10214 10215 updateRow: function (intNumber, activeId, showId, canBuyId) { 10216 10217 var i = 0, 10218 value = '', 10219 isCurrent = false, 10220 rowItems = null; 10221 10222 10223 var lineContainer = this.nodes.obSku.querySelectorAll('.wr-sku-props'); 10224 10225 10226 if (intNumber > -1 && intNumber < lineContainer.length) { 10227 rowItems = lineContainer[intNumber].querySelectorAll('li'); 10228 10229 for (i = 0; i < rowItems.length; i++) { 10230 value = rowItems[i].getAttribute('data-onevalue'); 10231 isCurrent = value === activeId; 10232 10233 if (isCurrent) { 10234 BX.addClass(rowItems[i], 'active'); 10235 } else { 10236 BX.removeClass(rowItems[i], 'active'); 10237 } 10238 10239 if (BX.util.in_array(value, canBuyId)) { 10240 BX.removeClass(rowItems[i], 'notallowed'); 10241 } else { 10242 BX.addClass(rowItems[i], 'notallowed'); 10243 } 10244 10245 rowItems[i].style.display = BX.util.in_array(value, showId) ? '' : 'none'; 10246 10247 if (isCurrent) { 10248 lineContainer[intNumber].style.display = (value == 0) ? 'none' : ''; 10249 } 10250 } 10251 } 10252 }, 10253 10254 changeInfo: function () { 10255 10256 var index = -1, 10257 j = 0, 10258 boolOneSearch = true, 10259 descTitle = null, 10260 rowItems = null; 10261 10262 var i; 10263 10264 for (i = 0; i < this.element.OFFERS.length; i++) { 10265 boolOneSearch = true; 10266 10267 for (j in this.selectedValues) { 10268 10269 if (this.selectedValues[j] !== this.element.OFFERS[i].TREE[j]) { 10270 boolOneSearch = false;
10271 break; 10272 } 10273 10274 } 10275 10276 if (boolOneSearch) { 10277 index = i; 10278 break; 10279 } 10280 } 10281 10282 this.oldElement = this.currentElement; 10283 10284 this.element.OFFER_ID_SELECTED = index; 10285 this.currentElement = this.element.OFFERS[this.element.OFFER_ID_SELECTED]; 10286 10287 this.setPrice(); 10288 10289 if (!this.firstLoad) { 10290 this.drawPicture(); 10291 this.changeDetailUrl(this.currentElement.ID); 10292 } 10293 }, 10294 drawPicture: function (){ 10295 this.nodes.obImg.src = this.currentElement.PHOTO; 10296 this.nodes.obImg.alt = this.element.ALT; 10297 10298 }, 10299 changeDetailUrl: function (){ 10300 this.nodes.obName.href = this.nodes.obImgLink.href = this.currentElement.DETAIL_PAGE_URL; 10301 }, 10302 10303 setPrice: function (){ 10304 this.nodes.obPrice.innerHTML = this.currentElement.PRICE.PRINT_VALUE; 10305 this.nodes.obPrice.title=this.currentElement.PRICE.VALUE; 10306 10307 if (!this.currentElement.CAN_BUY){ 10308 this.nodes.obBtn.parentNode.classList.add('hidden'); 10309 } 10310 else 10311 { 10312 this.nodes.obBtn.parentNode.classList.remove('hidden'); 10313 } 10314 }, 10315 SendToBasket: function (){ 10316 10317 if (!this.currentElement.CAN_BUY) 10318 return; 10319 10320 var productID = '', 10321 value = 1; 10322 10323 if (this.nodes.obQuantity) 10324 value = this.nodes.obQuantity.value; 10325 10326 productItem = { 10327 PRODUCT_ID: this.currentElement.ID, 10328 QUANTITY: value, 10329 PRICE_ID: this.currentElement.PRICE.PRICE_ID 10330 }; 10331 10332 showProcessLoad(); 10333 BX.ajax({ 10334 method: 'POST', 10335 dataType: 'json', 10336 url: '/bitrix/tools/concept.phoenix/ajax/basket/add2basket.php', 10337 data: { 10338 productItem: productItem, 10339 site_id: $("input.site_id").val() 10340 }, 10341 onsuccess: BX.proxy(this.basketResult, this) 10342 }); 10343 }, 10344 basketResult: function (arResult) { 10345 closeProcessLoad(); 10346 if (arResult["OK"] == "Y") { 10347 setInfoBasket(); 10348 } 10349 10350 10351 }, 10352}; 10353 10354})(window);
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.