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