1var RECAPTCHA_KEY = '6Lez1qQpAAAAALeZ9SYv7o-SJmqVmKnP6xDMChRB'; 2var googleAddress = []; 3var client_message; 4 5function resizeIframe(obj) { 6 obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px'; 7 alert(obj.style.height); 8} 9 10$('iframe.configurator').on('load', resizeIframe); 11 12function showPreloader() 13{ 14 var fadeBox = $('#fade-box'); 15 if (fadeBox.length < 1) 16 { 17 fadeBox = $('<div>').attr('id', 'fade-box'); 18 fadeBox.css({ 19 'width' : '100%', 20 'height' : $(document).height() +'px', 21 'position' : 'absolute', 22 'top' : '0', 23 'left' : '0', 24 'z-index' : '99998', 25 'background' : 'none repeat scroll 0 0 black', 26 'opacity' : '0.5', 27 }); 28 fadeBox.appendTo('body'); 29 } 30 31 var preloader = $('#loader'); 32 if (preloader.length < 1) 33 { 34 preloader = $('<div>').attr('id', 'loader'); 35 preloader.appendTo('body'); 36 } 37 38 var brabusLogo = $('#loader-blogo'); 39 if (brabusLogo.length < 1) 40 { 41 brabusLogo = $('<div>').attr('id', 'loader-blogo'); 42 brabusLogo.appendTo('body'); 43 } 44} 45 46function hidePreloader() 47{ 48 $('#loader').remove(); 49 $('#loader-blogo').remove(); 50 $('#fade-box').remove(); 51} 52 53function instagramPhotos(c_accessToken, c_clientID) 54{ 55 if (typeof Instafeed === 'undefined') 56 { 57 console.log('Instafeed not Defined.'); 58 return true; 59 } 60 61 var $instagramPhotosEl = $('.instagram-photos'); 62 if ($instagramPhotosEl.length > 0 ) 63 { 64 $instagramPhotosEl.each(function() 65 { 66 var element = $(this), 67 instaGramTarget = element.attr('id'), 68 instaGramUserId = element.attr('data-user'), 69 instaGramTag = element.attr('data-tag'), 70 instaGramLocation = element.attr('data-location'), 71 instaGramCount = element.attr('data-count'), 72 instaGramType = element.attr('data-type'), 73 instaGramSortBy = element.attr('data-sortBy'), 74 instaGramRes = element.attr('data-resolution'); 75 76 if (!instaGramCount ) { instaGramCount = 9; } 77 if (!instaGramSortBy ) { instaGramSortBy = 'none'; } 78 if (!instaGramRes ) { instaGramRes = 'thumbnail'; } 79 80 if (instaGramType == 'user') 81 { 82 var feed = new Instafeed({ 83 target: instaGramTarget, 84 get: instaGramType, 85 userId: Number(instaGramUserId), 86 limit: Number(instaGramCount), 87 sortBy: instaGramSortBy, 88 resolution: instaGramRes, 89 accessToken: c_accessToken, 90 clientId: c_clientID 91 }); 92 } 93 else if (instaGramType == 'tagged') 94 { 95 var feed = new Instafeed({ 96 target: instaGramTarget, 97 get: instaGramType, 98 tagName: instaGramTag, 99 limit: Number(instaGramCount), 100 sortBy: instaGramSortBy, 101 resolution: instaGramRes, 102 clientId: c_clientID 103 }); 104 } 105 else if (instaGramType == 'location') 106 { 107 var feed = new Instafeed({ 108 target: instaGramTarget, 109 get: instaGramType, 110 locationId: Number(instaGramUserId), 111 limit: Number(instaGramCount), 112 sortBy: instaGramSortBy, 113 resolution: instaGramRes, 114 clientId: c_clientID 115 }); 116 } 117 else 118 { 119 var feed = new Instafeed({ 120 target: instaGramTarget, 121 get: 'popular', 122 limit: Number(instaGramCount), 123 sortBy: instaGramSortBy, 124 resolution: instaGramRes, 125 clientId: c_clientID 126 }); 127 } 128 129 feed.run(); 130 }); 131 } 132} 133 134function isVideoPlaing(video) 135{ 136 return !!(video.currentTime > 0 && !video.paused && !video.ended && video.readyState > 2); 137} 138 139function initVideoSlides(headerSlider) 140{ 141 /*console.log('headerSlider', headerSlider);*/ 142 if (!headerSlider) { 143 /*setTimeout("initVideoSlides("+headerSlider+")", 50);*/ 144 return false; 145 } 146 147 var videoSlides = $(headerSlider.slides).find('.header__item--video').find('video'); 148 videoSlides.trigger('pause'); 149 videoSlides.each(function(){ 150 $(this)[0].currentTime = 0; 151 }); 152 153 $(headerSlider.slides).find('.header__item--video') 154 .find('.icon') 155 .show(); 156 157 var activeSlideIndex = headerSlider.activeIndex; 158 var activeSlideId = headerSlider.slides[activeSlideIndex].id; 159 160 if (activeSlideId.length) { 161 var videoInSlide = $('#' + activeSlideId).find('video'); 162 /*console.log('videoInSlide.length', videoInSlide.length);*/ 163 164 if (videoInSlide.length) { 165 var isAutoplay = (typeof $(videoInSlide).attr('autoplay') != 'undefined' || $(videoInSlide).data('autoplay') == 'true'); 166 //console.log('isAutoplay', isAutoplay); 167 168 if (isAutoplay) { 169 //videoInSlide.trigger('play'); 170 console.log('activeSlideId', activeSlideId); 171 playVideo(videoInSlide, headerSlider); 172 } 173 } 174 } 175} 176 177/** обновление позиÑи видео пÑи ÑеÑайзе */ 178function updatePosition() { 179 return false;
180 var videoW = $('header .header__item--video') 181 .find('video') 182 .width(); 183 184 var documentW = $(document).width(); 185 186 $('header .header__item--video') 187 .find('video') 188 .css('left', -(videoW - documentW) / 2.2); 189} 190 191/** пÑоигÑÑвание видео Ñ Ð°Ð²ÑовоÑпÑоизведением 192 * на вÑÐµÐ¼Ñ Ð¿ÑоигÑÑÐ²Ð°Ð½Ð¸Ñ Ð²Ð¸Ð´ÐµÐ¾ ÑÐ»Ð°Ð¹Ð´ÐµÑ Ð¾ÑÑанавливаеÑÑÑ 193 * поÑле оконÑÐ°Ð½Ð¸Ñ Ð²Ð¾ÑпÑÐ¾Ð¸Ð·Ð²ÐµÐ´ÐµÐ½Ð¸Ñ Ð¿ÑÐ¾Ð´Ð¾Ð»Ð¶Ð°ÐµÑ Ð¿ÑокÑÑÑиваÑÑÑÑ 194 */ 195function playVideoSlide(video, headerSlider) 196{ 197 /*console.log('video', video[0]); 198 console.log('isVideoPlaing', isVideoPlaing(video[0])); 199 console.log('currentTime', video[0].currentTime); 200 console.log('paused', video[0].paused); 201 console.log('ended', video[0].ended); 202 console.log('readyState', video[0].readyState);*/ 203 setTimeout(function(){ 204 if (video[0].readyState < 4) { 205 setTimeout(function(){playVideo(video, headerSlider);},300); 206 } else if (isVideoPlaing(video[0])) { 207 playVideoSlide(video, headerSlider); 208 } else if (typeof $(video).attr('loop') == 'undefined') { 209 stopVideo(video, headerSlider); 210 } 211 }, 250); 212} 213 214function playVideo(videoElement, headerSlider) 215{ 216 headerSlider.autoplay.pause(); 217 headerSlider.autoplay.stop(); 218 videoElement.trigger('play'); 219 220 var video = videoElement.get(0); 221 video.muted = true; 222 video.playsInline = true; 223 video.play(); 224 225 videoElement.addClass('is-visible'); 226 videoElement.closest( ".header__item--video" ) 227 .find('.icon') 228 .hide(); 229 230 playVideoSlide(videoElement, headerSlider); 231} 232 233function stopVideo(videoElement, headerSlider) 234{ 235 console.log('stopped', videoElement); 236 headerSlider.autoplay.start(); 237 videoElement.trigger('pause'); 238 var video = videoElement.get(0); 239 video.pause(); 240 videoElement.removeClass('is-visible'); 241 videoElement.closest( ".header__item--video" ) 242 .find('.icon') 243 .show(); 244 245 /*if (videoElement[0].readyState > 2) { 246 setTimeout(function(){ 247 if (isVideoPlaing(videoElement[0])) { 248 return false; 249 } 250 251 headerSlider.slideNext(); 252 headerSlider.autoplay.start(); 253 }, 1500); 254 }*/ 255} 256 257/** пÑоигÑоваÑÐµÐ»Ñ Ð²Ð¸Ð´ÐµÐ¾ */ 258function play(headerSlider) { 259 $(headerSlider.slides).each(function(){ 260 $(this).find('.header__item--video').each(function(){ 261 $(this).bind('click', function() { 262 var videoElement = $(this).find('video'); 263 264 if (videoElement[0].paused) { 265 playVideo(videoElement, headerSlider); 266 } else { 267 stopVideo(videoElement, headerSlider); 268 } 269 }); 270 }); 271 }); 272} 273 274/** глвнаÑ, ÑÐ´Ð°Ð¹Ð´ÐµÑ */ 275/*var headerSlider;*/ 276function mainSlider() { 277 if (document.querySelector('.header__slider')) { 278 var headerSlider = new Swiper('.header__slider', { 279 speed: 800, 280 autoplay: { 281 delay: 6000 282 }, 283 loop: false, 284 slidesPerView: 1, 285 parallax: true, 286 effect: 'fade', 287 pagination: { 288 el: '.header__slider-pagination', 289 type: 'bullets', 290 clickable: true, 291 bulletActiveClass: 'is-active', 292 bulletClass: 'item', 293 renderBullet: function(index, className) { 294 return '<span class="' + className + '"></span>'; 295 } 296 }, 297 on: { 298 init: function() { 299 var slider = this; 300 setTimeout(function(){ 301 initVideoSlides(slider); 302 play(slider); 303 }, 300); 304 }, 305 slideChangeTransitionStart: function() { 306 initVideoSlides(this); 307 } 308 } 309 }); 310 311 /*headerSlider.on('slideChangeTransitionStart', function() { 312 initVideoSlides(this); 313 });*/ 314 } 315 $(window).on('scroll', function() { 316 if (window.innerWidth > 767) { 317 var scrollT = $(this).scrollTop(); 318 $('.header__slider:not(.header__slider_mini) .header__item-bg').each(function() { 319 /*var elTop = $(this).parent().offset(); 320 if (scrollT < elTop.top) { 321 return false;
322 } 323 console.log($(this), elTop.top + ' > ' + scrollT);*/ 324 $(this).css('transform', 'translateY(' + scrollT / 2 + 'px)'); 325 $(this) 326 .next() 327 .css({ 328 transform: 'translateY(' + scrollT / 4 + 'px)', 329 opacity: 100 / scrollT 330 }); 331 }); 332 } 333 }); 334 335 336 337 function playSlide() { 338 339 } 340 341 /** */ 342 function resizeVideo() { 343 var timer; 344 345 $(window).on('resize', function() { 346 clearTimeout(timer); 347 timer = setTimeout(function() { 348 updatePosition(); 349 }, 500); 350 }); 351 } 352 353 /** */ 354 function scrollBtn() { 355 $('.header__btn').on('click', function() { 356 $('html, body').animate( 357 { 358 scrollTop: $('.header').outerHeight() 359 }, 360 600 361 ); 362 }); 363 } 364 365 scrollBtn(); 366 updatePosition(); 367 resizeVideo(); 368} 369 370 371/** */ 372function navBar() { 373 /** */ 374 function openSubMenu() { 375 $('.js-open-sub').on('click', function() { 376 $(this).toggleClass('is-open'); 377 $(this) 378 .next() 379 .slideToggle(300); 380 }); 381 } 382 383 /** */ 384 function burger() { 385 var opened = false;var timer; 386 function openMenu() { 387 opened === false ? opened = true : opened = false; 388 $('.js-mobile').toggleClass('is-active'); 389 $('.burger').toggleClass('is-active'); 390 $('body').toggleClass('fancybox-active compensate-for-scrollbar'); 391 } 392 $(document).on('click', '.menu__header, .burger', function() { 393 openMenu(); 394 }); 395 $(window).on('resize', function() { 396 clearTimeout(timer); 397 timer = setTimeout(function() { 398 if (opened) { 399 openMenu(); 400 } 401 }, 400); 402 }); 403 } 404 405 /** */ 406 function toggleMenu() { 407 $('.menu__toggle').on('click', function() { 408 $(this) 409 .prev() 410 .toggleClass('is-visible'); 411 $(this).toggleClass('is-active'); 412 }); 413 } 414 415 /** */ 416 function headerScroll() { 417 $(window).on('scroll', function() { 418 if ($(this).scrollTop() > 20) { 419 $('.nav').addClass('is-scrolled'); 420 } else { 421 $('.nav').removeClass('is-scrolled'); 422 } 423 }); 424 } 425 426 var openStatus = false; 427 428 /*$('#search-button').change(function() { 429 alert('wtf'); 430 if (openStatus) { 431 openStatus = false; 432 } 433 else { 434 openStatus = true; 435 $('#search').focus() 436 } 437 });*/ 438 $('#search-button,#telephone').change(function(event) { 439 event.preventDefault(); 440 if($(this).is(":checked")) { 441 $('body').addClass('forcemenu_visible'); 442 $(this).next().addClass('visible'); 443 if($(this).attr('id') == 'search-button') { 444 $('#search').focus(); 445 } 446 } else { 447 $('body').removeClass('forcemenu_visible'); 448 $(this).next().removeClass('visible'); 449 } 450 }); 451 452 453 headerScroll(); 454 openSubMenu(); 455 burger(); 456 toggleMenu(); 457} 458 459/** новоÑÑи (гÑидÑ) */ 460function newsGrid() { 461 $('.news__list').masonry({ 462 itemSelector: '.news__item' 463 }); 464} 465 466/** */ 467function modalInput() { 468 $('.modal input').on('keydown', function(e) { 469 if ($(this).val().length > 0) { 470 $(this) 471 .next() 472 .addClass('value'); 473 474 $(this) 475 .next().next() 476 .addClass('value'); 477 } 478 if (e.keyCode == 8 && $(this).val().length < 2) { 479 $(this) 480 .next() 481 .removeClass('value'); 482 483 $(this) 484 .next().next() 485 .removeClass('value'); 486 } 487 }); 488} 489 490/** */ 491function hide() { 492 text('.content-wrapper'); 493 var opened; 494 $('.hide__button').on('click', function() { 495 var contentH = $(this) 496 .parents('.info') 497 .find('.content') 498 .height(); 499 var status = $(this).parents('.info').attr('data-status'); 500 501 if (status == 'close') { 502 $(this).parents('.info').attr('data-status', 'open') 503 $(this) 504 .parents('.info') 505 .find('.content-wrapper') 506 .height(contentH); 507 } 508 if (status == 'open') { 509 $(this).parents('.info').attr('data-status', 'close') 510 $(this) 511 .parents('.info') 512 .find('.content-wrapper') 513 .height(150); 514 } 515 $(this) 516 .parent() 517 .toggleClass('is-hide'); 518 $(this) 519 .parents('.info__content') 520 .find('.content-wrapper') 521 .toggleClass('is-hide'); 522 }); 523 524 var timer; 525 $(window).on('resize', function() { 526 clearTimeout(timer); 527 timer = setTimeout(function() { 528 if(document.querySelector('.submodel__tab.is-active')) { 529 text('.submodel__tab.is-active .content-wrapper') 530 } 531 else { 532 text('.content-wrapper'); 533 } 534 }, 400); 535 }); 536} 537 538/** */ 539function filterToggle() { 540 $('.filter__toggle').on('click', function() { 541 $(this) 542 .prev() 543 .toggleClass('is-active'); 544 $(this).toggleClass('is-active'); 545 }); 546} 547 548/** */ 549var productSliderVar; 550var productSliderTimer; 551function productSlider() { 552 if (document.querySelector('.product-card__slider')) { 553 if (typeof productSliderVar != 'undefined') { 554 productSliderVar.destroy(); 555 productSliderVar = undefined; 556 $('.product-card__slider .swiper-wrapper').removeAttr('style'); 557 $('.product-card__slider .swiper-slide').removeAttr('style'); 558 559 clearTimeout(productSliderTimer); 560 } 561 562 productSliderVar = new Swiper('.product-card__slider', {
563 speed: 800, 564 autoplay: { 565 delay: 5000 566 }, 567 slidesPerColumn: 2, 568 slidesPerView: 2, 569 spaceBetween: 5, 570 loop: false, 571 observer: true, 572 pagination: { 573 el: '.product-card__slider-pagination', 574 type: 'bullets', 575 clickable: true, 576 bulletActiveClass: 'is-active', 577 bulletClass: 'item', 578 renderBullet: function(index, className) { 579 return '<span class="' + className + '"></span>'; 580 } 581 }, 582 breakpoints: { 583 767: { 584 slidesPerView: 1, 585 slidesPerColumn: 1 586 } 587 }, 588 on: { 589 init: function(slider) { 590 if (typeof this.slides != 'undefined') { 591 if (this.slides.length > 1) { 592 $('.product-card__slider-pagination').show(); 593 } else { 594 $('.product-card__slider-pagination').hide(); 595 } 596 } 597 }, 598 resize: function() { 599 var _self = this; 600 601 clearTimeout(productSliderTimer); 602 productSliderTimer = setTimeout(function() { 603 if (window.innerWidth < 768) { 604 _self.$el[0].classList.remove( 605 'swiper-container-multirow' 606 ); 607 } else { 608 _self.$el[0].classList.add( 609 'swiper-container-multirow' 610 ); 611 } 612 }); 613 } 614 } 615 }); 616 } 617} 618 619/** */ 620function productScroll() { 621 $('.scrollbar-inner').scrollbar(); 622 623 /** */ 624 function newHeight() { 625 var padding; 626 if (window.innerWidth < 1600 && window.innerWidth > 767) { 627 padding = 68; 628 } 629 if (window.innerWidth >= 1600) { 630 padding = 80; 631 } 632 var contentWidth = $('.product-card__slider-container').width(); 633 $('.product-card__content').css('max-height', contentWidth - padding); 634 } 635 636 newHeight(); 637 638 var timer; 639 $(window).on('resize', function() { 640 clearTimeout(timer); 641 timer = setTimeout(function() { 642 if (window.innerWidth >= 768) { 643 newHeight(); 644 } else { 645 $('.product-card__content').css('max-height', 'auto'); 646 } 647 }, 400); 648 }); 649} 650 651/** */ 652function modelScroll() { 653 $('.card-full').each(function(i, v) { 654 var self = $(this); 655 self.find('.scrollbar-inner').scrollbar(); 656 657 /** */ 658 function newHeight() { 659 var contentWidth = self.find('.card-full__slider').height(); 660 self.find('.card-full__info').css('height', contentWidth); 661 } 662 663 if (window.innerWidth >= 768) { 664 newHeight(); 665 } else { 666 self.find('.card-full__info').css('height', 'auto'); 667 } 668 669 var timer; 670 $(window).on('resize', function() { 671 clearTimeout(timer); 672 timer = setTimeout(function() { 673 if (window.innerWidth >= 768) { 674 newHeight(); 675 } else { 676 self.find('.card-full__info').css('height', 'auto'); 677 } 678 }, 400); 679 }); 680 }); 681} 682 683/** */ 684function count() { 685 $('.counter__in').each(function() { 686 if ($(this).val() === '1') { 687 $(this) 688 .parent() 689 .find('.counter__btn--decrease') 690 .attr('disabled', true); 691 } 692 }); 693 $('.counter__in').keyup(function() { 694 var quantityIn = $(this); 695 var quantity = quantityIn.val(); 696 697 if (quantity > 1) { 698 $(this) 699 .parent() 700 .find('.counter__btn--decrease') 701 .attr('disabled', false); 702 } 703 if (quantity == 1) { 704 $(this) 705 .parent() 706 .find('.counter__btn--decrease') 707 .attr('disabled', true); 708 } 709 if (quantity == '' || quantity < 1) { 710 quantityIn.val(1); 711 } 712 }); 713 /* 714 $('.counter__btn--increase').on('click', function() { 715 var quantityIn = $(this) 716 .parent() 717 .find('.counter__in'); 718 var quantity = parseInt(quantityIn.val()); 719 quantityIn.val(quantity + 1); 720 $(this) 721 .parent() 722 .find('.counter__btn--decrease') 723 .attr('disabled', false); 724 }); 725 $('.counter__btn--decrease').on('click', function() { 726 var quantityIn = $(this) 727 .parent() 728 .find('.counter__in'); 729 var quantity = parseInt(quantityIn.val()); 730 if (quantity > 1) { 731 quantityIn.val(quantity - 1); 732 } 733 if (quantity < 3) { 734 $(this).attr('disabled', true); 735 } 736 }); 737 */ 738} 739 740/** */ 741var clearBasketInitialized = false; 742function basketClearAll() { 743 if (clearBasketInitialized) { 744 return false; 745 } 746 747 clearBasketInitialized = true; 748 showPreloader(); 749 750 $.ajax({ 751 type : 'POST', 752 url: '/ajax/clearBasket.php', 753 dataType: "json", 754 success: function(out){ 755 $('.small-basket__label').fadeOut(300).empty(); 756 $('.basket__product').slideUp(300, function(){ $(this).remove(); }); 757 $('.basket__price').slideUp(300, function(){ $(this).remove(); }); 758 $('.form__without_price_container').slideUp(300, function(){ $(this).remove(); }); 759 $('.clear-basket').fadeOut(300, function(){ $(this).remove(); }); 760 $('.checkout').slideUp(300, function(){ 761 $('#basket_form').prepend( '<div class="basket__product"><p class="basket__product-none" style="display:block">ÐаÑа коÑзина пÑÑÑа</p></div>' ); 762 }); 763 764 clearBasketInitialized = false;
765 hidePreloader(); 766 //console.log(out); 767 }, 768 error: function(out){ 769 console.log(out); 770 clearBasketInitialized = false; 771 hidePreloader(); 772 } 773 }); 774} 775 776function basketRemoveItem(el) { 777 var elParentBlock = $(el).parent().parent().parent().parent(); 778 var itemSum = parseInt($(el).parent().find('.basket__product-price').data('itemsum')); 779 780 if (itemSum > 0) { 781 $(el).parent().parent().find('.basket__advservice-price').each(function(){ 782 itemSum += parseInt($(this).html().replace(/[^0-9\.]/g, '')); 783 }); 784 785 var currentSum = parseInt($('#cart-allsum').data('itemsum')); 786 var newSum = currentSum - itemSum; 787 $('#cart-allsum').data('itemsum', newSum); 788 $('#cart-allsum').html(new Intl.NumberFormat('ru-RU').format(newSum) + ' Ñ.'); 789 } 790 791 $.get($(el).attr('href')); 792 793 $(el) 794 .parent() 795 .parent() 796 .parent() 797 .fadeOut(300, function(){ 798 $(this).remove(); 799 800 if ($(elParentBlock).find('.basket__product-item').length < 1) { 801 $(elParentBlock).fadeOut(300, function(){ 802 $(this).remove(); 803 }); 804 805 if (elParentBlock.hasClass('basket__product')) { 806 $('.basket__price').slideUp(300); 807 } 808 } 809 810 if ($('.basket__product-item').length < 1) { 811 $('#basket_form').prepend( '<div class="basket__product"><p class="basket__product-none" style="display:block">ÐаÑа коÑзина пÑÑÑа</p></div>' ); 812 $('.checkout').slideUp(300); 813 $('.small-basket__label').empty().fadeOut(300); 814 $('.clear-basket').fadeOut(300, function(){ $(this).remove(); }); 815 } else { 816 var totalCount = parseInt($('.small-basket__label').html()) - 1; 817 $('.small-basket__label').html(totalCount); 818 } 819 }); 820 821 //location.assign($(el).attr('href')); 822} 823 824var removeBasketInitialized = false; 825function basketRemoveServiceItem(el) { 826 if (removeBasketInitialized) { 827 return false; 828 } 829 830 removeBasketInitialized = true; 831 showPreloader(); 832 833 var itemId = $(el).data('itemId'); 834 var serviceId = $(el).data('serviceId'); 835 //console.log('itemId', itemId); 836 //console.log('serviceId', serviceId); 837 838 $.ajax({ 839 type : 'POST', 840 data : { 841 itemId : itemId, 842 serviceId : serviceId 843 }, 844 url: '/ajax/removeItemServiceBasket.php', 845 dataType: "json", 846 success: function(out){ 847 removeBasketInitialized = false; 848 hidePreloader(); 849 document.location.reload(); 850 }, 851 error: function(out){ 852 console.log(out); 853 removeBasketInitialized = false; 854 hidePreloader(); 855 } 856 }); 857} 858 859$(document).ready(function(){ 860 $(document).on('click', 'a[href*="wa.me"]', function(e) { 861 if (typeof Comagic != 'undefined') { 862 e.preventDefault(); 863 Comagic.omni.forwardWhatsApp('79770890980'); 864 window.open($(this).attr('href'), '_blank'); 865 return false; 866 } 867 }); 868 869 $(document).on('click', 'a[href*="t.me"]', function(e) { 870 if (typeof Comagic != 'undefined') { 871 e.preventDefault(); 872 Comagic.omni.forwardTelegram('leadgen3000_bot'); 873 window.open($(this).attr('href'), '_blank') 874 return false; 875 } 876 }); 877 878 $('.clear-basket button').on('click', function(e){ 879 e.preventDefault(); 880 881 basketClearAll(); 882 }); 883 884 $('.basket__product-remove').on('click', function(e){ 885 e.preventDefault(); 886 887 basketRemoveItem($(this)); 888 }); 889 890 $('.basket__advservice-remove').on('click', function(e){ 891 e.preventDefault(); 892 893 basketRemoveServiceItem($(this)); 894 }); 895 var lastScroll = $(window).scrollTop(); 896 var timer; 897 $(window).on('scroll', function(event) { 898 clearTimeout(timer); 899 if(lastScroll < $(window).scrollTop()) { 900 timer = setTimeout(function() { 901 $('nav').removeClass('hideondown'); 902 },30) 903 } else { 904 timer = setTimeout(function() { 905 $('nav').addClass('hideondown'); 906 },30) 907 } 908 lastScroll = $(this).scrollTop(); 909 }); 910}); 911 912/** */ 913function gallery() { 914 $().fancybox({ 915 selector: '[data-fancybox="gallery"]', 916 loop: true, 917 infobar: false, 918 //toolbar: false, 919 backFocus: false, 920 margin: [44, 0, 22, 0], 921 thumbs: { 922 autoStart: true, 923 axis: 'x' 924 }, 925 buttons : ['close'], 926 btnTpl: { 927 arrowLeft: 928 '<a data-fancybox-prev class="fancybox-button fancybox-button--arrow_left" title="{{PREV}}" href="javascript:;">' + 929 '<div class="circle"> <svg class="icon arrow"> <use xlink:href="/local/templates/brabus/icon/sprite.svg#icon-arrow"></use> </svg> </div>' +
930 '</a>', 931 932 arrowRight: 933 '<a data-fancybox-next class="fancybox-button fancybox-button--arrow_right" title="{{NEXT}}" href="javascript:;">' + 934 '<div class="circle"> <svg class="icon arrow"> <use xlink:href="/local/templates/brabus/icon/sprite.svg#icon-arrow"></use> </svg> </div>' + 935 '</a>' 936 } 937 }); 938 $('.gallery').justifiedGallery({ 939 rowHeight: 300, 940 //lastRow: 'hide', 941 margins: 0, 942 captions: false 943 }); 944 945 $('[data-fancybox^="itemGallery"]').fancybox({ 946 loop: true, 947 infobar: false, 948 //toolbar: false, 949 backFocus: false, 950 margin: [44, 0, 22, 0], 951 thumbs: { 952 autoStart: true, 953 axis: 'x' 954 }, 955 buttons : ['close'], 956 btnTpl: { 957 arrowLeft: 958 '<a data-fancybox-prev class="fancybox-button fancybox-button--arrow_left" title="{{PREV}}" href="javascript:;">' + 959 '<div class="circle"> <svg class="icon arrow"> <use xlink:href="/local/templates/brabus/icon/sprite.svg#icon-arrow"></use> </svg> </div>' + 960 '</a>', 961 962 arrowRight: 963 '<a data-fancybox-next class="fancybox-button fancybox-button--arrow_right" title="{{NEXT}}" href="javascript:;">' + 964 '<div class="circle"> <svg class="icon arrow"> <use xlink:href="/local/templates/brabus/icon/sprite.svg#icon-arrow"></use> </svg> </div>' + 965 '</a>' 966 } 967 }); 968} 969 970function popupForms() { 971 /* 972 $('#feedback .modal__submit button').click(function(e){ 973 e.preventDefault(); 974 975 $form = $(this).closest('form'); 976 977 var client_name = $form.find('#feedback-name').val(); 978 var client_phone = $form.find('#feedback-tel').val(); 979 980 $.ajax({ 981 url : '/ajax/feedback_form.php', 982 type : 'POST', 983 data : { 984 'client_name' : client_name, 985 'client_phone' : client_phone, 986 }, 987 async : false, 988 dataType : 'json', 989 }) 990 .done(function(){ 991 $('.fancybox-container.fancybox-is-open .fancybox-close-small').click(); 992 $('.success-modal').click(); 993 }); 994 995 return false; 996 }); 997 998 $('#personal .modal__submit button').click(function(e){ 999 e.preventDefault(); 1000 1001 $form = $(this).closest('form'); 1002 1003 var element_id = $form.find('#element_id').val(); 1004 var client_name = $form.find('#personal-name').val(); 1005 var client_phone = $form.find('#personal-tel').val(); 1006 var client_comment = $form.find('#personal-text').val(); 1007 1008 $.ajax({ 1009 url : '/ajax/personal_form.php', 1010 type : 'POST', 1011 data : { 1012 'element_id' : element_id, 1013 'client_name' : client_name, 1014 'client_phone' : client_phone, 1015 'client_comment' : client_comment, 1016 }, 1017 async : false, 1018 dataType : 'json', 1019 }) 1020 .done(function(){ 1021 $('.fancybox-container.fancybox-is-open .fancybox-close-small').click(); 1022 $('.success-modal').click(); 1023 }); 1024 1025 return false; 1026 }); 1027 */ 1028 1029 choiseService(); 1030 1031 $('.fancybox-container .close-btn, .fancybox-container .close-btn span').click(function(){ 1032 $('.fancybox-container.fancybox-is-open .fancybox-close-small').click(); 1033 }); 1034 1035 buy_btns = $('a[href*="ADD2BASKET"], button[href*="ADD2BASKET"]'); 1036 buy_btns.each( 1037 function(){ 1038 $(this).attr("rel", $(this).attr("href")); 1039 } 1040 ); 1041 buy_btns.attr("href","javascript:void(0);"); 1042 1043 $('a[rel*="ADD2BASKET"], button[rel*="ADD2BASKET"]').click( 1044 function(){ 1045 if (addToBasketInitialized) { 1046 return false; 1047 } else { 1048 addToBasketInitialized = true; 1049 showPreloader(); 1050 } 1051 1052 var currentUrl = location.protocol + '//' + location.hostname + $(this).attr("rel"); 1053 const url = new URL( 1054 currentUrl 1055 ); 1056 1057 //console.log('currentUrl', currentUrl); 1058 1059 var productId = url.searchParams.get('id'); 1060 var sectionId = url.searchParams.get('section'); 1061 addToBasketWithProps(productId, {}, sectionId); 1062 return false; 1063 1064 /*var productPrice = parseInt($(this).data('price')); 1065 1066 /if (productPrice <= 0) { 1067 $.fancybox.open( { src : '#warning-price' } ); 1068 return false; 1069 }/ 1070 1071 $.ajax({ 1072 type: "GET", 1073 url: $(this).attr("rel"), 1074 dataType: "html", 1075 success: function(out){ 1076 var currentCount = parseInt($(".small-basket__label").html()); 1077 $(".small-basket__label").html(currentCount + 1).removeClass('label0'); 1078 $('.success-add').click(); 1079 } 1080 });*/ 1081 } 1082 ); 1083 1084 $('#success_modal .modal__submit button, .modal__submit button.close').click(function(e){ 1085 e.preventDefault(); 1086 $('.fancybox-container.fancybox-is-open .fancybox-close-small').click(); 1087 return false;
1088 }); 1089 1090 $('#success_sub_modal .modal__submit button').click(function(e){ 1091 e.preventDefault(); 1092 $('.fancybox-container.fancybox-is-open .fancybox-close-small').click(); 1093 return false; 1094 }); 1095 1096 $('.badge[data-fancybox], .product-card .button[data-fancybox], .card-full .button[data-fancybox]').fancybox({ 1097 // TODO на beforeShow поÑÑавиÑÑ Ð¾ÑиÑÑÐºÑ ÑоÑÐ¼Ñ Ð¸ Ñдаление ÑообÑений об ÑÑпеÑной оÑпÑавке пÑедÑдÑÑей заÑвки 1098 afterShow : function(instance, current) { 1099 jcf.replaceAll(); 1100 var clickedElementId = current.opts.$orig.closest('.card-full').data('element_id'); 1101 1102 if (!clickedElementId) { 1103 clickedElementId = current.opts.$orig.data('element_id'); 1104 } 1105 1106 $openedForm = current.$content; 1107 $openedForm.find('#element_id').val(clickedElementId); 1108 } 1109 }); 1110} 1111 1112/** */ 1113function cardSlider() { 1114 if (document.querySelectorAll('.card--slider')) { 1115 var sliders = document.querySelectorAll('.card--slider'); 1116 [].slice.call(sliders).map(function(v, i) { 1117 var paginations = v.querySelector('.card__slider-paginations'); 1118 paginations.classList.add('card__slider-paginations' + i); 1119 new Swiper(v.querySelector('.card__slider'), { 1120 speed: 400, 1121 effect: 'fade', 1122 fadeEffect: { 1123 crossFade: true 1124 }, 1125 pagination: { 1126 el: '.card__slider-paginations' + i, 1127 type: 'bullets', 1128 clickable: true, 1129 renderBullet: function(index, className) { 1130 var photo = this.$el[0].swiper.slides[ 1131 index 1132 ].getAttribute('data-img'); 1133 return ( 1134 '<span class="' + 1135 className + 1136 '" style="background-image: url(' + 1137 photo + 1138 ')"></span>' 1139 ); 1140 } 1141 } 1142 }); 1143 }); 1144 1145 $('.card__slider-paginations .swiper-pagination-bullet').on( 1146 'mouseover', 1147 function() { 1148 $(this).click(); 1149 } 1150 ); 1151 } 1152} 1153 1154/** */ 1155function cardFullSlider() { 1156 if (document.querySelectorAll('.card-full__slider')) { 1157 $('.card-full__slider').each(function(v) { 1158 $(this) 1159 .find('.swiper-slide') 1160 .attr('data-fancybox', 'card-gallery' + v); 1161 $().fancybox({ 1162 selector: '[data-fancybox="card-gallery' + v + '"]', 1163 loop: true, 1164 infobar: false, 1165 //toolbar: false, 1166 backFocus: false, 1167 margin: [44, 0, 22, 0], 1168 thumbs: { 1169 autoStart: true, 1170 axis: 'x' 1171 }, 1172 buttons : ['close'], 1173 btnTpl: { 1174 arrowLeft: 1175 '<a data-fancybox-prev class="fancybox-button fancybox-button--arrow_left" title="{{PREV}}" href="javascript:;">' + 1176 '<div class="circle"> <svg class="icon arrow"> <use xlink:href="/local/templates/brabus/icon/sprite.svg#icon-arrow"></use> </svg> </div>' + 1177 '</a>', 1178 1179 arrowRight: 1180 '<a data-fancybox-next class="fancybox-button fancybox-button--arrow_right" title="{{NEXT}}" href="javascript:;">' + 1181 '<div class="circle"> <svg class="icon arrow"> <use xlink:href="/local/templates/brabus/icon/sprite.svg#icon-arrow"></use> </svg> </div>' + 1182 '</a>' 1183 } 1184 }); 1185 }); 1186 1187 var container = document.querySelector('.section__row.submodel__tab.is-active'); 1188 if ($(container).length) 1189 { 1190 var sliders = container.querySelectorAll('.card-full, .card'); 1191 [].slice.call(sliders).map(function(v, i) { 1192 new Swiper(v.querySelector('.card-full__slider'), { 1193 speed: 400, 1194 //simulateTouch: false, 1195 navigation: { 1196 nextEl: '.card-full__photo-hover--next', 1197 prevEl: '.card-full__photo-hover--prev' 1198 } 1199 }); 1200 }); 1201 } 1202 } 1203} 1204 1205function filterTab() { 1206 $('.submodel__tab-filter .filter__link').each(function(i) { 1207 $(this).on('click', function() { 1208 $('.submodel__tab-filter .filter__link').removeClass('is-active'); 1209 $(this).addClass('is-active'); 1210 $('.submodel__list-tab').removeClass('is-active'); 1211 $('.submodel__list-tab').each(function(n) { 1212 if (n === i) { 1213 $(this).addClass('is-active'); 1214 //modelScroll(); 1215 cardFullSlider(); 1216 } 1217 }); 1218 }); 1219 }); 1220} 1221 1222var addToBasketInitialized = false; 1223 1224/** ÐниÑиализаÑÐ¸Ñ Ð´Ð¾Ð¿Ð¾Ð»Ð½Ð¸ÑелÑнÑÑ ÑÑлÑг пÑи добавлении в коÑÐ·Ð¸Ð½Ñ Ð² ТÑнинге */ 1225function choiseService() { 1226 $('.button--service').on('click', function(e) 1227 { 1228 e.preventDefault(); 1229 1230 var productId = $(this).data('productId'); 1231 var productPrice = parseInt($(this).data('price')); 1232 var sectionId = parseInt($(this).data('sectionId')); 1233 1234 /*if (productPrice <= 0) { 1235 $.fancybox.open( { src : '#warning-price' } ); 1236 return false;
1237 }*/ 1238 1239 $('#choice-service .modal__submit .button').data('productId', productId); 1240 $('#choice-service .modal__submit .button').data('sectionId', sectionId); 1241 1242 $('#service-montage').prop({ checked: false, disabled: true }); 1243 $('#service-montage').data('cost', -1); 1244 $('#service-montage').removeAttr('checked'); 1245 $('#service-montage-group').hide(); 1246 $('#service-montage-cost').html(''); 1247 1248 $('#service-painting').prop({ checked: false, disabled: true }); 1249 $('#service-painting').data('cost', -1); 1250 $('#service-painting').removeAttr('checked'); 1251 $('#service-painting-group').hide(); 1252 $('#service-painting-cost').html(''); 1253 1254 var montage = $(this).data('montage'); 1255 var painting = $(this).data('painting'); 1256 1257 /*console.log('productId', productId); 1258 console.log('montage', montage); 1259 console.log('painting', painting);*/ 1260 1261 var costRequestText = 'Ñена по запÑоÑÑ'; 1262 1263 if (typeof montage != 'undefined') { 1264 $('#service-montage').prop({ disabled: false }); 1265 $('#service-montage-cost').data('cost', montage); 1266 $('#service-montage-cost').html( ( montage == '0' ? costRequestText : '+' + montage ) ); 1267 $('#service-montage-group').show(); 1268 } 1269 1270 if (typeof painting != 'undefined') { 1271 $('#service-painting').prop({ disabled: false }); 1272 $('#service-painting-cost').data('cost', painting); 1273 $('#service-painting-cost').html( ( painting == '0' ? costRequestText : '+' + painting ) ); 1274 $('#service-painting-group').show(); 1275 } 1276 1277 $.fancybox.open( { src : '#choice-service' } ); 1278 1279 return false; 1280 }); 1281 1282 $('#choice-service .modal__submit .button').on('click', function(e) 1283 { 1284 e.preventDefault(); 1285 1286 if (addToBasketInitialized) { 1287 return false; 1288 } else { 1289 addToBasketInitialized = true; 1290 showPreloader(); 1291 } 1292 1293 var productId = $(this).data('productId'); 1294 var sectionId = $(this).data('sectionId'); 1295 var props = {}; 1296 1297 if ($('#service-montage').prop('checked')) { 1298 props.montage = $('#service-montage-cost').data('cost'); 1299 } 1300 1301 if ($('#service-painting').prop('checked')) { 1302 props.painting = $('#service-painting-cost').data('cost'); 1303 } 1304 1305 addToBasketWithProps(productId, props, sectionId); 1306 1307 return false; 1308 }); 1309} 1310 1311function addToBasketWithProps(productId, params, sectionId) 1312{ 1313 $.ajax({ 1314 type : 'POST', 1315 data : { 1316 productId : productId, 1317 sectionId : sectionId, 1318 action : 'add', 1319 props : params 1320 }, 1321 url: '/ajax/add2basket.php', 1322 dataType: "json", 1323 success: function(out){ 1324 $.fancybox.close(); 1325 1326 if (out.STATUS == 1) { 1327 var currentCount = parseInt($(".small-basket__label").html()); 1328 $(".small-basket__label").html(currentCount + 1).removeClass('label0'); 1329 } 1330 1331 $('.success-add').click(); 1332 addToBasketInitialized = false; 1333 hidePreloader(); 1334 }, 1335 error: function(out){ 1336 console.log(out); 1337 addToBasketInitialized = false; 1338 hidePreloader(); 1339 } 1340 }); 1341} 1342 1343function addToBasketSku(productId, sectionId, offer) 1344{ 1345 $.ajax({ 1346 type : 'POST', 1347 data : { 1348 productId : productId, 1349 sectionId : sectionId, 1350 offer : offer, 1351 action : 'add' 1352 }, 1353 url: '/ajax/add2basketSku.php', 1354 dataType: "json", 1355 success: function(out){ 1356 console.log(out); 1357 $.fancybox.close(); 1358 1359 if (out.STATUS == 1) { 1360 var currentCount = parseInt($(".small-basket__label").html()); 1361 $(".small-basket__label").html(currentCount + 1).removeClass('label0'); 1362 } 1363 1364 $('.success-add').click(); 1365 addToBasketInitialized = false; 1366 hidePreloader(); 1367 }, 1368 error: function(out){ 1369 console.log(out); 1370 addToBasketInitialized = false; 1371 hidePreloader(); 1372 } 1373 }); 1374} 1375 1376function addToBasketWithPropsViaConfigurator(products) 1377{ 1378 if (addToBasketInitialized) { 1379 return false; 1380 } else { 1381 addToBasketInitialized = true; 1382 showPreloader(); 1383 } 1384 1385 $.ajax({ 1386 type : 'POST', 1387 data : { 1388 products : products, 1389 action : 'add' 1390 }, 1391 url: '/ajax/add2basketConfigurator.php', 1392 dataType: "json", 1393 success: function(out){ 1394 if (out.STATUS == 1) { 1395 var currentCount = parseInt($(".small-basket__label").html()); 1396 $(".small-basket__label").html(currentCount + 1).removeClass('label0'); 1397 } 1398 1399 addToBasketInitialized = false;
1400 document.location.href = '/cart/'; 1401 }, 1402 error: function(out){ 1403 console.log(out); 1404 addToBasketInitialized = false; 1405 hidePreloader(); 1406 } 1407 }); 1408} 1409 1410/** ÑабÑлÑÑÐ¸Ñ (подмодели) */ 1411function modelTab() { 1412 gallery(); 1413 filterTab(); 1414 cardFullSlider(); 1415 1416 $('.submodel__menu-link').each(function(i) 1417 { 1418 $(this).on('click', function(e) 1419 { 1420 e.preventDefault(); 1421 1422 clickedHREF = $(this).attr('href'); 1423 1424 $('.submodel__menu-link').removeClass('is-active'); 1425 $(this).addClass('is-active'); 1426 $('.submodel__tab').removeClass('is-active'); 1427 $('.submodel__tab').each(function(n) 1428 { 1429 if (n === i) 1430 { 1431 showPreloader(); 1432 1433 $(this).addClass('is-active'); 1434 1435 if (1 || !$(this).children().length) { 1436 $.ajax({ 1437 url : clickedHREF, 1438 type : 'POST', 1439 data : { 1440 AJAX_CALL : 'Y', 1441 action : 'get_tab' 1442 }, 1443 async : true, 1444 dataType : 'html', 1445 }) 1446 .done(function(result) 1447 { 1448 if (typeof history.pushState == 'function') 1449 { 1450 history.pushState(null, null, clickedHREF); 1451 } 1452 1453 $res = $(result); 1454 $('#tuning_detail_wrapper .submodel__tab.is-active').replaceWith($res.find('.submodel__tab.is-active')); 1455 filterTab(); 1456 cardFullSlider(); 1457 gallery(); 1458 popupForms(); 1459 text('.submodel__tab.is-active .content-wrapper'); 1460 1461 hidePreloader(); 1462 }); 1463 } else { 1464 if (typeof history.pushState == 'function') { 1465 history.pushState(null, null, clickedHREF); 1466 } 1467 hidePreloader(); 1468 } 1469 } 1470 }); 1471 1472 filterTab(); 1473// modelScroll(); 1474 cardFullSlider(); 1475 gallery(); 1476 1477 text('.submodel__tab.is-active .content-wrapper'); 1478 1479 return false; 1480 }); 1481 }); 1482} 1483 1484function isEmpty( el ){ 1485 return !$.trim(el.html()) 1486} 1487 1488/** */ 1489function feedback() { 1490 var feedback = $('.fixed-button.feedback, .fixed-button.whatsapp, .fixed-button.callout, .fixed-button.add2seo'); 1491 1492 $(window).on('scroll', function() { 1493 feedback.fadeOut(100); 1494 clearTimeout($.data(this, 'scrollCheck')); 1495 $.data( 1496 this, 1497 'scrollCheck', 1498 setTimeout(function() { 1499 feedback.fadeIn(100); 1500 }, 250) 1501 ); 1502 }); 1503} 1504 1505/** */ 1506function animationTop() { 1507 $('.animation-top').on('click', function() { 1508 $('html, body').animate( 1509 { 1510 scrollTop: 0 1511 }, 1512 600 1513 ); 1514 }); 1515 var footer = $('footer'); 1516 1517 var status = false; 1518 1519 $(window).on('scroll', function() { 1520 if ($(this).scrollTop() > footer.offset().top - innerHeight) { 1521 status = true; 1522 } 1523 1524 if ($(this).scrollTop() < 20) { 1525 status = false; 1526 } 1527 1528 if (status === true) { 1529 $('.animation-top').fadeIn(100); 1530 } 1531 if (status === false) { 1532 $('.animation-top').fadeOut(100); 1533 } 1534 }); 1535} 1536 1537function text(params) { 1538 $(params).each(function() { 1539 var status = $(this).parents('.info').attr('data-status'); 1540 console.log(status); 1541 var contentH = $(this).find('.content').height(); 1542 if (status == 'open') { 1543 $(this).height(contentH); 1544 } 1545 else { 1546 if($(this).find('.content').height() > 150) { 1547 $(this).height(150); 1548 } 1549 else { 1550 $(this).parents('.info').attr('data-status', 'open'); 1551 $(this).removeClass('is-hide'); 1552 $(this).next().remove(); 1553 } 1554 } 1555 }); 1556} 1557 1558$(function() { 1559 svg4everybody(); 1560 jcf.replaceAll(); 1561 mainSlider(); 1562 newsGrid(); 1563 hide(); 1564 animationTop(); 1565 modalInput(); 1566 navBar(); 1567 filterToggle(); 1568 productSlider(); 1569 productScroll(); 1570 count(); 1571 basketRemoveItem(); 1572 cardSlider(); 1573// cardFullSlider(); 1574// modelScroll(); 1575 modelTab(); 1576 gallery(); 1577 popupForms(); 1578 feedback(); 1579 1580 if (window.innerWidth > 1200) { 1581 new WOW().init({ 1582 mobile: false 1583 }); 1584 } 1585}); 1586 1587jQuery.validator.setDefaults({ 1588 debug: false, 1589 success: 'valid' 1590}); 1591 1592jQuery.validator.addMethod( 1593 'email', 1594 function(value, element) { 1595 return ( 1596 this.optional(element) || 1597 /^([a-z0-9_\.-])+@[a-z0-9-]+\.([a-z]{2,6}\.)?[a-z]{2,6}$/i.test( 1598 value 1599 ) 1600 ); 1601 }, 1602 'Please enter a valid email address.' 1603); 1604 1605/*jQuery.validator.addMethod( 1606 'tel', 1607 function(value, element) { 1608 return ( 1609 this.optional(element) || 1610 /^\+\d{1} \(\d{3}\) \d{3}-\d{2}-\d{2}$/i.test(value) 1611 ); 1612 }, 1613 'Please enter a valid phone.' 1614);*/ 1615 1616var touchStart; 1617$(document).ready(function() 1618{ 1619 $('.filter > .filter__item > a').on('click', function () { 1620 var el = $(this); 1621 el.parent().toggleClass('menu-active'); 1622 el.parent().siblings('.menu-active').removeClass('menu-active'); 1623 }); 1624 1625 /*modelTab();*/ 1626 1627 var inputFeedbackInline = document.querySelector("#feedback-tel-inline"); 1628 if (inputFeedbackInline) { 1629 var itiFeedbackInline = applyCountryPhoneMask(inputFeedbackInline); 1630 } 1631 1632 var inputFeedback = document.querySelector("#feedback-tel"); 1633 if (inputFeedback) { 1634 var itiFeedback = applyCountryPhoneMask(inputFeedback); 1635 } 1636 1637 var inputRequest = document.querySelector("#request-phone"); 1638 if (inputRequest) { 1639 var itiRequest = applyCountryPhoneMask(inputRequest); 1640 } 1641 1642 var inputPersonal = document.querySelector("#personal-tel"); 1643 if (inputPersonal) { 1644 var itiPersonal = applyCountryPhoneMask(inputPersonal); 1645 } 1646 1647 var inputCheckout = document.querySelector("#checkout-tel"); 1648 if (inputCheckout) { 1649 var itiCheckout = applyCountryPhoneMask(inputCheckout); 1650 } 1651 1652 var inputRequestGeneral= document.querySelector("#request-tel"); 1653 if (inputRequestGeneral) { 1654 var itiRequestGeneral = applyCountryPhoneMask(inputRequestGeneral); 1655 } 1656 1657 function applyCountryPhoneMask(input) 1658 { 1659 if (input) { 1660 var iti = window.intlTelInput(input, { 1661 preferredCountries: ["ru", "by", "ua", "kz"], 1662 separateDialCode: true, 1663 /*utilsScript: "/bitrix/templates/landings/js/intlTelInput/utils.js?1603274336113"*/ 1664 }); 1665 1666 if (typeof iti.telInput == 'undefined') { 1667 iti.telInput = input; 1668 } 1669 1670 iti.promise.then(function() { 1671 setItiMask(iti); 1672 1673 if ($(iti.telInput).parents('.modal').length) { 1674 $(iti.telInput).css('paddingLeft', '77px'); 1675 } 1676 }); 1677 1678 input.addEventListener("countrychange", function(el) { 1679 setItiMask(iti); 1680 }); 1681 } 1682 1683 return iti; 1684 } 1685 1686 function setItiMask(iti) 1687 { 1688 var countryData = iti.getSelectedCountryData(); 1689 1690 if (!countryData.mask) { 1691 countryData.mask = "999999999{1,3}"; 1692 } 1693 1694 if (countryData.mask) { 1695 $(iti.telInput).inputmask('unmaskedvalue'); 1696 setTimeout(function(){ 1697 $(iti.telInput).inputmask(countryData.mask); 1698 }, 20); 1699 } else { 1700 $(iti.telInput).inputmask('unmaskedvalue'); 1701 setTimeout(function(){ 1702 var curVal = iti.telInput.value.replace(/[^0-9]/g, ""); 1703 $(iti.telInput).val(curVal); 1704 }, 20); 1705 } 1706 } 1707 1708 $('.videoplay-on-hover') 1709 .mouseenter(function() 1710 { 1711 if ($(this).find('video').length > 0) 1712 { 1713 $(this).find('.news__link-bg').fadeOut(); 1714 $(this).find('video').fadeIn(); 1715 $(this).find('video').get(0).play(); 1716 } 1717 }) 1718 .mouseleave(function() 1719 { 1720 if ($(this).find('video').length > 0 ) 1721 { 1722 $(this).find('video').fadeOut(); 1723 $(this).find('.news__link-bg').fadeIn(); 1724 $(this).find('video').get(0).pause(); 1725 } 1726 }); 1727 1728 $(document).on("touchstart", ".videoplay-on-hover", function(event) { 1729 //оÑменÑем "вÑплÑÑие ÑообÑений", ÑÑÐ¾Ð±Ñ Ð½Ðµ вÑзÑвалÑÑ ÐºÐ»Ð¸Ðº на ÑаÑ-ÑÑÑÑойÑÑÐ²Ð°Ñ . 1730 event.stopPropagation(); 1731 event.preventDefault(); 1732 1733 if ($(this).find('video').length > 0) 1734 { 1735 var touch = event.originalEvent.touches[0] || event.originalEvent.changedTouches[0]; 1736 touchStart = touch.clientX+''+touch.clientY; 1737 $(this).find('.news__link-bg').fadeOut(); 1738 $(this).find('video').fadeIn(); 1739 $(this).find('video').get(0).play(); 1740 } 1741 }); 1742 $(document).on("touchend", ".videoplay-on-hover", function(event) { 1743 var touch = event.originalEvent.touches[0] || event.originalEvent.changedTouches[0]; 1744 var touchEnd = touch.clientX+''+touch.clientY; 1745 1746 if (touchStart != touchEnd) { 1747 //оÑменÑем "вÑплÑÑие ÑообÑений", ÑÑÐ¾Ð±Ñ Ð½Ðµ вÑзÑвалÑÑ ÐºÐ»Ð¸Ðº на ÑаÑ-ÑÑÑÑойÑÑÐ²Ð°Ñ . 1748 event.stopPropagation(); 1749 event.preventDefault(); 1750 1751 if ($(this).find('video').length > 0) 1752 { 1753 $(this).find('video').fadeOut(); 1754 $(this).find('.news__link-bg').fadeIn(); 1755 $(this).find('video').get(0).pause(); 1756 } 1757 } 1758 }); 1759 1760 $('#request-form') 1761 .submit(function(e) { e.preventDefault(); }) 1762 .validate( 1763 { 1764 rules: { 1765 'request-name': { 1766 required: true 1767 }, 1768 'request-tel': { 1769 required: true 1770 }, 1771 'agree_policy': { 1772 required: true 1773 } 1774 }, 1775 messages: { 1776 'request-name': 'ÐведиÑе имÑ', 1777 'request-tel': { 1778 required: 'ÐведиÑе ÑелеÑон' 1779 }, 1780 'agree_policy': $(this).find('input[name="agree_policy"]').data('tippy-content') 1781 }, 1782 submitHandler: function(form) 1783 { 1784 $form = $(form); 1785 1786 var countryData = itiRequestGeneral.getSelectedCountryData(); 1787 var countryCode = "+" + countryData.dialCode + " "; 1788 1789 var client_name = $form.find('#request-name').val(); 1790 var client_phone = countryCode + $form.find('#request-tel').val(); 1791 var client_comment = $form.find('#request-comment').val(); 1792 var agree_sms = $form.find('input[name="agree_sms"]').is(':checked'); 1793 var agree_email = $form.find('input[name="agree_email"]').is(':checked'); 1794 var page_title = $form.find('#page-title').val(); 1795 1796 grecaptcha.ready(function() { 1797 grecaptcha.execute(RECAPTCHA_KEY, {action: 'submit'}).then(function(token) { 1798 $.ajax({ 1799 url : '/ajax/request_form.php', 1800 type : 'POST', 1801 data : { 1802 'client_name' : client_name, 1803 'client_phone' : client_phone, 1804 'client_comment' : client_comment, 1805 'page_title' : page_title, 1806 'recaptcha_token' : token, 1807 'agree_sms' : agree_sms, 1808 'agree_email' : agree_email 1809 }, 1810 async : false, 1811 dataType : 'json', 1812 }) 1813 .done(function(result){ 1814 if (result.SUCCESS == true) 1815 { 1816 $form.slideUp(); 1817 $form.trigger("reset"); 1818 $('.request-form .requestResult').slideDown(); 1819 1820 $form.find('#request-name').trigger("blur").removeClass('valid'); 1821 $form.find('#request-tel').trigger("blur").removeClass('valid'); 1822 $form.find('#request-comment').trigger("blur").removeClass('valid'); 1823 1824 if (typeof Comagic != 'undefined') { 1825 var client_message = 'СÑÑаниÑа ÑайÑа: ' + document.location.href + "\n" + client_comment; 1826 if (agree_sms) { client_message += "\nСоглаÑен на SMS-ÑаÑÑÑлки"; } 1827 if (agree_email) { client_message += "\nСоглаÑен на EMAIL-ÑаÑÑÑлки"; }
1828 Comagic.addOfflineRequest({ 1829 name: client_name, 1830 phone: client_phone, 1831 message: client_message 1832 }, function(o) {console.log(o);}); 1833 } 1834 1835 setTimeout(function(){ 1836 $form.slideDown(); 1837 $('.request-form .requestResult').slideUp(); 1838 }, 6000); 1839 } else if (result.ERROR) { 1840 alert(result.ERROR); 1841 } else { 1842 alert('ÐÑи оÑпÑавке ÑоÑÐ¼Ñ Ð²Ð¾Ð·Ð½Ð¸ÐºÐ»Ð° неизвеÑÑÐ½Ð°Ñ Ð¾Ñибка. ÐопÑобÑйÑе повÑоÑиÑÑ Ð¿Ð¾Ð¿ÑÑÐºÑ ÑеÑез неÑколÑко минÑÑ.'); 1843 } 1844 }); 1845 }); 1846 }); 1847 1848 return false; 1849 } 1850 }); 1851 1852 $('#feedback-form') 1853 .submit(function(e) { e.preventDefault(); }) 1854 .validate( 1855 { 1856 rules: { 1857 'feedback-name': { 1858 required: true 1859 }, 1860 'feedback-tel': { 1861 required: true 1862 }, 1863 'agree_policy': { 1864 required: true 1865 } 1866 }, 1867 messages: { 1868 'feedback-name': 'ÐведиÑе имÑ', 1869 'feedback-tel': { 1870 required: 'ÐведиÑе ÑелеÑон' 1871 }, 1872 'agree_policy': $(this).find('input[name="agree_policy"]').data('tippy-content') 1873 }, 1874 submitHandler: function(form) 1875 { 1876 $form = $(form); 1877 1878 var countryData = itiFeedback.getSelectedCountryData(); 1879 var countryCode = "+" + countryData.dialCode + " "; 1880 1881 var client_name = $form.find('#feedback-name').val(); 1882 var client_phone = countryCode + $form.find('#feedback-tel').val(); 1883 var agree_sms = $form.find('input[name="agree_sms"]').is(':checked'); 1884 var agree_email = $form.find('input[name="agree_email"]').is(':checked'); 1885 /*var contact_filial = $form.find('select[name="contact_filial"]').val();*/ 1886 grecaptcha.ready(function() { 1887 grecaptcha.execute(RECAPTCHA_KEY, {action: 'submit'}).then(function(token) { 1888 $.ajax({ 1889 url : '/ajax/feedback_form.php', 1890 type : 'POST', 1891 data : { 1892 'client_name' : client_name, 1893 'client_phone' : client_phone, 1894 'recaptcha_token' : token, 1895 'agree_sms' : agree_sms, 1896 'agree_email' : agree_email/*, 1897 'contact_filial' : contact_filial*/ 1898 }, 1899 async : false, 1900 dataType : 'json', 1901 }) 1902 .done(function(result){ 1903 if (result.SUCCESS == true) 1904 { 1905 if (typeof Comagic != 'undefined') { 1906 var client_message = 'СÑÑаниÑа ÑайÑа: ' + document.location.href; 1907 if (agree_sms) { client_message += "\nСоглаÑен на SMS-ÑаÑÑÑлки"; } 1908 if (agree_email) { client_message += "\nСоглаÑен на EMAIL-ÑаÑÑÑлки"; } 1909 Comagic.addOfflineRequest({ 1910 name: client_name, 1911 phone: client_phone, 1912 message: client_message 1913 }, function(o) {console.log(o);}); 1914 } 1915 1916 $('.fancybox-container.fancybox-is-open .fancybox-close-small').click(); 1917 $('.success-modal').click(); 1918 }
1918 else if (result.ERROR) { 1919 alert(result.ERROR); 1920 } else { 1921 alert('ÐÑи оÑпÑавке ÑоÑÐ¼Ñ Ð²Ð¾Ð·Ð½Ð¸ÐºÐ»Ð° неизвеÑÑÐ½Ð°Ñ Ð¾Ñибка. ÐопÑобÑйÑе повÑоÑиÑÑ Ð¿Ð¾Ð¿ÑÑÐºÑ ÑеÑез неÑколÑко минÑÑ.'); 1922 } 1923 }); 1924 }); 1925 }); 1926 1927 return false; 1928 } 1929 }); 1930 1931 $('#feedback-form-inline') 1932 .submit(function(e) { e.preventDefault(); }) 1933 .validate( 1934 { 1935 rules: { 1936 'feedback-name': { 1937 required: true 1938 }, 1939 'feedback-tel': { 1940 required: true 1941 }, 1942 'agree_policy': { 1943 required: true 1944 } 1945 }, 1946 messages: { 1947 'feedback-name': 'ÐведиÑе имÑ', 1948 'feedback-tel': { 1949 required: 'ÐведиÑе ÑелеÑон' 1950 }, 1951 'agree_policy': $(this).find('input[name="agree_policy"]').data('tippy-content') 1952 }, 1953 submitHandler: function(form) 1954 { 1955 $form = $(form); 1956 1957 var countryData = itiFeedbackInline.getSelectedCountryData(); 1958 var countryCode = "+" + countryData.dialCode + " "; 1959 1960 var client_name = $form.find('#feedback-name-inline').val(); 1961 var client_phone = countryCode + $form.find('#feedback-tel-inline').val(); 1962 var agree_sms = $form.find('input[name="agree_sms"]').is(':checked'); 1963 var agree_email = $form.find('input[name="agree_email"]').is(':checked'); 1964 /*var contact_filial = $form.find('select[name="contact_filial"]').val();*/ 1965 1966 grecaptcha.ready(function() { 1967 grecaptcha.execute(RECAPTCHA_KEY, {action: 'submit'}).then(function(token) { 1968 $.ajax({ 1969 url : '/ajax/feedback_form.php', 1970 type : 'POST', 1971 data : { 1972 'client_name' : client_name, 1973 'client_phone' : client_phone, 1974 'recaptcha_token' : token, 1975 'agree_sms' : agree_sms, 1976 'agree_email' : agree_email/*, 1977 'contact_filial' : contact_filial*/ 1978 }, 1979 async : false, 1980 dataType : 'json', 1981 }) 1982 .done(function(result){ 1983 if (result.SUCCESS == true) 1984 { 1985 if (typeof Comagic != 'undefined') { 1986 var client_message = 'СÑÑаниÑа ÑайÑа: ' + document.location.href; 1987 if (agree_sms) { client_message += "\nСоглаÑен на SMS-ÑаÑÑÑлки"; } 1988 if (agree_email) { client_message += "\nСоглаÑен на EMAIL-ÑаÑÑÑлки"; } 1989 Comagic.addOfflineRequest({ 1990 name: client_name, 1991 phone: client_phone, 1992 message: client_message 1993 }, function(o) {console.log(o);}); 1994 } 1995 1996 //$('.fancybox-container.fancybox-is-open .fancybox-close-small').click(); 1997 $('.success-modal').click(); 1998 } else if (result.ERROR) { 1999 alert(result.ERROR); 2000 } else { 2001 alert('ÐÑи оÑпÑавке ÑоÑÐ¼Ñ Ð²Ð¾Ð·Ð½Ð¸ÐºÐ»Ð° неизвеÑÑÐ½Ð°Ñ Ð¾Ñибка. ÐопÑобÑйÑе повÑоÑиÑÑ Ð¿Ð¾Ð¿ÑÑÐºÑ ÑеÑез неÑколÑко минÑÑ.'); 2002 } 2003 }); 2004 }); 2005 }); 2006 2007 return false;
2008 } 2009 }); 2010 2011 $('#marine-request') 2012 .submit(function(e) { e.preventDefault(); }) 2013 .validate( 2014 { 2015 rules: { 2016 'request-name': { 2017 required: true 2018 }, 2019 'request-phone': { 2020 required: true 2021 }, 2022 'request-email': { 2023 required: false, 2024 email: true 2025 }, 2026 'request-message': { 2027 required: true 2028 }, 2029 'agree_policy': { 2030 required: true 2031 } 2032 }, 2033 messages: { 2034 'request-name': 'ÐведиÑе имÑ', 2035 'request-phone': { 2036 required: 'ÐведиÑе ÑелеÑон' 2037 }, 2038 'request-email': { 2039 email: 'Email Ñказан некоÑÑекÑно' 2040 }, 2041 'request-message' : 'ÐведиÑе ÑообÑение', 2042 'agree_policy': $(this).find('input[name="agree_policy"]').data('tippy-content') 2043 }, 2044 submitHandler: function(form) 2045 { 2046 $form = $(form); 2047 2048 var countryData = itiRequest.getSelectedCountryData(); 2049 var countryCode = "+" + countryData.dialCode + " "; 2050 2051 var element_id = $form.find('#element_id').val(); 2052 var client_name = $form.find('#request-name').val(); 2053 var client_phone = countryCode + $form.find('#request-phone').val(); 2054 var client_email = $form.find('#request-email').val(); 2055 var client_message = $form.find('#request-message').val(); 2056 var agree_sms = $form.find('input[name="agree_sms"]').is(':checked'); 2057 var agree_email = $form.find('input[name="agree_email"]').is(':checked'); 2058 2059 grecaptcha.ready(function() { 2060 grecaptcha.execute(RECAPTCHA_KEY, {action: 'submit'}).then(function(token) { 2061 $.ajax({ 2062 url : '/ajax/order_marine.php', 2063 type : 'POST', 2064 data : { 2065 'element_id' : element_id, 2066 'client_name' : client_name, 2067 'client_phone' : client_phone, 2068 'client_email' : client_email, 2069 'client_message' : client_message, 2070 'recaptcha_token' : token, 2071 'agree_sms' : agree_sms, 2072 'agree_email' : agree_email 2073 }, 2074 async : false, 2075 dataType : 'json' 2076 }) 2077 .done(function(result){ 2078 if (result.SUCCESS == true) 2079 { 2080 $('#marine-request').slideUp(); 2081 $('#marine-request').trigger("reset"); 2082 $('#request-contact').slideUp(); 2083 $('#requestResult').slideDown(); 2084 2085 $('#marine-request').find('#request-name').trigger("blur"); 2086 $('#marine-request').find('#request-phone').trigger("blur"); 2087 $('#marine-request').find('#request-email').trigger("blur"); 2088 $('#marine-request').find('#request-message').trigger("blur"); 2089 2090 if (typeof Comagic != 'undefined') { 2091 client_message = 'СÑÑаниÑа ÑайÑа: ' + document.location.href + "\n" + client_message; 2092 if (agree_sms) { client_message += "\nСоглаÑен на SMS-ÑаÑÑÑлки"; } 2093 if (agree_email) { client_message += "\nСоглаÑен на EMAIL-ÑаÑÑÑлки"; }
2094 Comagic.addOfflineRequest({ 2095 name: client_name, 2096 email: client_email, 2097 phone: client_phone, 2098 message: client_message 2099 }, function(o) {console.log(o);}); 2100 } 2101 2102 setTimeout(function(){ 2103 $('#marine-request').slideDown(); 2104 $('#request-contact').slideDown(); 2105 $('#requestResult').slideUp(); 2106 }, 6000); 2107 } else if (result.ERROR) { 2108 alert(result.ERROR); 2109 } else { 2110 alert('ÐÑи оÑпÑавке ÑоÑÐ¼Ñ Ð²Ð¾Ð·Ð½Ð¸ÐºÐ»Ð° неизвеÑÑÐ½Ð°Ñ Ð¾Ñибка. ÐопÑобÑйÑе повÑоÑиÑÑ Ð¿Ð¾Ð¿ÑÑÐºÑ ÑеÑез неÑколÑко минÑÑ.'); 2111 } 2112 }) 2113 .fail(function(result){ 2114 console.log(result); 2115 }); 2116 }); 2117 }); 2118 2119 return false; 2120 } 2121 }); 2122 2123 $('#cars4sale-request') 2124 .submit(function(e) { e.preventDefault(); }) 2125 .validate( 2126 { 2127 rules: { 2128 'request-name': { 2129 required: true 2130 }, 2131 'request-phone': { 2132 required: true 2133 }, 2134 'request-email': { 2135 required: false, 2136 email: true 2137 }, 2138 'request-message': { 2139 required: true 2140 }, 2141 'agree_policy': { 2142 required: true 2143 } 2144 }, 2145 messages: { 2146 'request-name': 'ÐведиÑе имÑ', 2147 'request-phone': { 2148 required: 'ÐведиÑе ÑелеÑон' 2149 }, 2150 'request-email': { 2151 email: 'Email Ñказан некоÑÑекÑно' 2152 }, 2153 'request-message' : 'ÐведиÑе ÑообÑение', 2154 'agree_policy': $(this).find('input[name="agree_policy"]').data('tippy-content') 2155 }, 2156 submitHandler: function(form) 2157 { 2158 $form = $(form); 2159 2160 var countryData = itiRequest.getSelectedCountryData(); 2161 var countryCode = "+" + countryData.dialCode + " "; 2162 2163 var element_id = $form.find('#element_id').val(); 2164 var client_name = $form.find('#request-name').val(); 2165 var client_phone = countryCode + $form.find('#request-phone').val(); 2166 var client_email = $form.find('#request-email').val(); 2167 var client_message = $form.find('#request-message').val(); 2168 var agree_sms = $form.find('input[name="agree_sms"]').is(':checked'); 2169 var agree_email = $form.find('input[name="agree_email"]').is(':checked'); 2170 2171 grecaptcha.ready(function() { 2172 grecaptcha.execute(RECAPTCHA_KEY, {action: 'submit'}).then(function(token) { 2173 $.ajax({ 2174 url : '/ajax/order_cars4sale.php', 2175 type : 'POST', 2176 data : { 2177 'element_id' : element_id, 2178 'client_name' : client_name, 2179 'client_phone' : client_phone, 2180 'client_email' : client_email, 2181 'client_message' : client_message, 2182 'recaptcha_token' : token, 2183 'agree_sms' : agree_sms, 2184 'agree_email' : agree_email 2185 }, 2186 async : false, 2187 dataType : 'json' 2188 }) 2189 .done(function(result){ 2190 if (result.SUCCESS == true) 2191 { 2192 $('#cars4sale-request').slideUp(); 2193 $('#cars4sale-request').trigger("reset"); 2194 $('#request-contact').slideUp(); 2195 $('#requestResult').slideDown(); 2196 2197 $('#cars4sale-request').find('#request-name').trigger("blur"); 2198 $('#cars4sale-request').find('#request-phone').trigger("blur"); 2199 $('#cars4sale-request').find('#request-email').trigger("blur"); 2200 $('#cars4sale-request').find('#request-message').trigger("blur"); 2201 2202 if (typeof Comagic != 'undefined') { 2203 client_message = 'СÑÑаниÑа ÑайÑа: ' + document.location.href + "\n" + client_message; 2204 if (agree_sms) { client_message += "\nСоглаÑен на SMS-ÑаÑÑÑлки"; } 2205 if (agree_email) { client_message += "\nСоглаÑен на EMAIL-ÑаÑÑÑлки"; }
2206 Comagic.addOfflineRequest({ 2207 name: client_name, 2208 email: client_email, 2209 phone: client_phone, 2210 message: client_message 2211 }, function(o) {console.log(o);}); 2212 } 2213 2214 setTimeout(function(){ 2215 $('#cars4sale-request').slideDown(); 2216 $('#request-contact').slideDown(); 2217 $('#requestResult').slideUp(); 2218 }, 6000); 2219 } else if (result.ERROR) { 2220 alert(result.ERROR); 2221 } else { 2222 alert('ÐÑи оÑпÑавке ÑоÑÐ¼Ñ Ð²Ð¾Ð·Ð½Ð¸ÐºÐ»Ð° неизвеÑÑÐ½Ð°Ñ Ð¾Ñибка. ÐопÑобÑйÑе повÑоÑиÑÑ Ð¿Ð¾Ð¿ÑÑÐºÑ ÑеÑез неÑколÑко минÑÑ.'); 2223 } 2224 }) 2225 .fail(function(result){ 2226 console.log(result); 2227 }); 2228 }); 2229 }); 2230 2231 return false; 2232 } 2233 }); 2234 2235 $('#classics-request') 2236 .submit(function(e) { e.preventDefault(); }) 2237 .validate( 2238 { 2239 rules: { 2240 'request-name': { 2241 required: true 2242 }, 2243 'request-phone': { 2244 required: true 2245 }, 2246 'request-email': { 2247 required: false, 2248 email: true 2249 }, 2250 'request-message': { 2251 required: true 2252 }, 2253 'agree_policy': { 2254 required: true 2255 } 2256 }, 2257 messages: { 2258 'request-name': 'ÐведиÑе имÑ', 2259 'request-phone': { 2260 required: 'ÐведиÑе ÑелеÑон' 2261 }, 2262 'request-email': { 2263 email: 'Email Ñказан некоÑÑекÑно' 2264 }, 2265 'request-message' : 'ÐведиÑе ÑообÑение', 2266 'agree_policy': $(this).find('input[name="agree_policy"]').data('tippy-content') 2267 }, 2268 submitHandler: function(form) 2269 { 2270 $form = $(form); 2271 2272 var countryData = itiRequest.getSelectedCountryData(); 2273 var countryCode = "+" + countryData.dialCode + " "; 2274 2275 var element_id = $form.find('#element_id').val(); 2276 var client_name = $form.find('#request-name').val(); 2277 var client_phone = countryCode + $form.find('#request-phone').val(); 2278 var client_email = $form.find('#request-email').val(); 2279 var client_message = $form.find('#request-message').val(); 2280 var agree_sms = $form.find('input[name="agree_sms"]').is(':checked'); 2281 var agree_email = $form.find('input[name="agree_email"]').is(':checked'); 2282 2283 grecaptcha.ready(function() { 2284 grecaptcha.execute(RECAPTCHA_KEY, {action: 'submit'}).then(function(token) { 2285 $.ajax({ 2286 url : '/ajax/order_classics.php', 2287 type : 'POST', 2288 data : { 2289 'element_id' : element_id, 2290 'client_name' : client_name, 2291 'client_phone' : client_phone, 2292 'client_email' : client_email, 2293 'client_message' : client_message, 2294 'recaptcha_token' : token, 2295 'agree_sms' : agree_sms, 2296 'agree_email' : agree_email 2297 }, 2298 async : false, 2299 dataType : 'json' 2300 }) 2301 .done(function(result){ 2302 if (result.SUCCESS == true) 2303 { 2304 $('#classics-request').slideUp(); 2305 $('#classics-request').trigger("reset"); 2306 $('#request-contact').slideUp(); 2307 $('#requestResult').slideDown(); 2308 2309 $('#classics-request').find('#request-name').trigger("blur"); 2310 $('#classics-request').find('#request-phone').trigger("blur"); 2311 $('#classics-request').find('#request-email').trigger("blur"); 2312 $('#classics-request').find('#request-message').trigger("blur"); 2313 2314 if (typeof Comagic != 'undefined') { 2315 client_message = 'СÑÑаниÑа ÑайÑа: ' + document.location.href + "\n" + client_message; 2316 if (agree_sms) { client_message += "\nСоглаÑен на SMS-ÑаÑÑÑлки"; } 2317 if (agree_email) { client_message += "\nСоглаÑен на EMAIL-ÑаÑÑÑлки"; }
2318 Comagic.addOfflineRequest({ 2319 name: client_name, 2320 email: client_email, 2321 phone: client_phone, 2322 message: client_message 2323 }, function(o) {console.log(o);}); 2324 } 2325 2326 setTimeout(function(){ 2327 $('#classics-request').slideDown(); 2328 $('#request-contact').slideDown(); 2329 $('#requestResult').slideUp(); 2330 }, 6000); 2331 } else if (result.ERROR) { 2332 alert(result.ERROR); 2333 } else { 2334 alert('ÐÑи оÑпÑавке ÑоÑÐ¼Ñ Ð²Ð¾Ð·Ð½Ð¸ÐºÐ»Ð° неизвеÑÑÐ½Ð°Ñ Ð¾Ñибка. ÐопÑобÑйÑе повÑоÑиÑÑ Ð¿Ð¾Ð¿ÑÑÐºÑ ÑеÑез неÑколÑко минÑÑ.'); 2335 } 2336 }) 2337 .fail(function(result){ 2338 console.log(result); 2339 }); 2340 }); 2341 }); 2342 2343 return false; 2344 } 2345 }); 2346 2347 $('#personal-form') 2348 .submit(function(e) { e.preventDefault(); }) 2349 .validate({ 2350 rules: { 2351 'personal-name': { 2352 required: true 2353 }, 2354 'personal-tel': { 2355 required: true 2356 }, 2357 'personal-comment': { 2358 required: true 2359 }, 2360 'contact_filial' : { 2361 required: true 2362 }, 2363 'agree_policy': { 2364 required: true 2365 } 2366 }, 2367 messages: { 2368 'personal-name': 'ÐведиÑе имÑ', 2369 'personal-tel': { 2370 required: 'ÐведиÑе ÑелеÑон' 2371 }, 2372 'personal-comment': 'ÐведиÑе комменÑаÑий', 2373 'contact_filial' : 'ÐÑбеÑиÑе Ñилиал', 2374 'agree_policy': $(this).find('input[name="agree_policy"]').data('tippy-content') 2375 }, 2376 submitHandler: function(form) 2377 { 2378 $form = $(form); 2379 2380 var countryData = itiPersonal.getSelectedCountryData(); 2381 var countryCode = "+" + countryData.dialCode + " "; 2382 2383 var element_id = $form.find('#element_id').val(); 2384 var client_name = $form.find('#personal-name').val(); 2385 var client_phone = countryCode + $form.find('#personal-tel').val(); 2386 var client_comment = $form.find('#personal-text').val(); 2387 var contact_filial = $form.find('select[name="contact_filial"]').val(); 2388 var agree_sms = $form.find('input[name="agree_sms"]').is(':checked'); 2389 var agree_email = $form.find('input[name="agree_email"]').is(':checked'); 2390 2391 grecaptcha.ready(function() { 2392 grecaptcha.execute(RECAPTCHA_KEY, {action: 'submit'}).then(function(token) { 2393 $.ajax({ 2394 url : '/ajax/personal_form.php', 2395 type : 'POST', 2396 data : { 2397 'element_id' : element_id, 2398 'client_name' : client_name, 2399 'client_phone' : client_phone, 2400 'client_comment' : client_comment, 2401 'contact_filial' : contact_filial, 2402 'recaptcha_token' : token, 2403 'agree_sms' : agree_sms, 2404 'agree_email' : agree_email 2405 }, 2406 async : false, 2407 dataType : 'json', 2408 }) 2409 .done(function(){ 2410 $('.fancybox-container.fancybox-is-open .fancybox-close-small').click(); 2411 $('.success-modal').click(); 2412 2413 if (typeof Comagic != 'undefined') { 2414 client_message = 'СÑÑаниÑа ÑайÑа: ' + document.location.href + "\n" + client_comment; 2415 if (agree_sms) { client_message += "\nСоглаÑен на SMS-ÑаÑÑÑлки"; } 2416 if (agree_email) { client_message += "\nСоглаÑен на EMAIL-ÑаÑÑÑлки"; } 2417 Comagic.addOfflineRequest({ 2418 name: client_name, 2419 phone: client_phone, 2420 message: client_message 2421 }, function(o) {console.log(o);}); 2422 } 2423 2424 $form.trigger('reset'); 2425 }); 2426 }); 2427 }); 2428 2429 return false;
2430 } 2431 }); 2432 2433 $(document).on('click touchstart', 'label.error', function(e){ 2434 e.preventDefault(); 2435 let forInput = $(this).attr('for'); 2436 $(this).parent().find('[name="' + forInput + '"]').focus(); 2437 $(this).fadeOut(100, function() { 2438 $(this).remove(); 2439 }); 2440 }); 2441 2442 $('#subscription') 2443 .submit(function(e) { e.preventDefault(); }) 2444 .validate({ 2445 rules: { 2446 'subscription-mail': { 2447 required: true, 2448 email: true 2449 }, 2450 'agree_policy': { 2451 required: true 2452 } 2453 }, 2454 messages: { 2455 'subscription-mail': { 2456 required: 'ÐведиÑе email', 2457 email: 'ÐепÑавилÑнÑй ÑоÑÐ¼Ð°Ñ email' 2458 }, 2459 'agree_policy': $(this).find('input[name="agree_policy"]').data('tippy-content') 2460 }, 2461 submitHandler: function(form) 2462 { 2463 $form = $(form); 2464 var agree_sms = $form.find('input[name="agree_sms"]').is(':checked'); 2465 var agree_email = $form.find('input[name="agree_email"]').is(':checked'); 2466 2467 grecaptcha.ready(function() { 2468 grecaptcha.execute(RECAPTCHA_KEY, {action: 'submit'}).then(function(token) { 2469 $('<input>').attr({ type: 'hidden', name: 'recaptcha_token', value: token }).appendTo($form); 2470 $.ajax({ 2471 url : '/ajax/subscription.php', 2472 type : 'POST', 2473 data : $form.serialize(), 2474 async : false, 2475 dataType : 'json', 2476 }) 2477 .done(function(result) 2478 { 2479 if (result.SUCCESS == true) 2480 { 2481 if (typeof Comagic != 'undefined') { 2482 client_message = 'СÑÑаниÑа ÑайÑа: ' + document.location.href + "\nФоÑма: ÐодпиÑка на ÑаÑÑÑлкÑ\n"; 2483 if (agree_sms) { client_message += "\nСоглаÑен на SMS-ÑаÑÑÑлки"; } 2484 if (agree_email) { client_message += "\nСоглаÑен на EMAIL-ÑаÑÑÑлки"; } 2485 Comagic.addOfflineRequest({ 2486 email: $('#subscription-mail').val(), 2487 message: client_message 2488 }, function(o) {console.log(o);}); 2489 } 2490 $('.success-sub-modal').click(); 2491 $form.trigger('reset'); 2492 } 2493 else 2494 { 2495 console.log(result); 2496 } 2497 }); 2498 }); 2499 }); 2500 2501 return false; 2502 } 2503 }); 2504 2505 $('#get_offer').click(function(e) 2506 { 2507 e.preventDefault(); 2508 window.open('/personal/pdf.php', '_blank'); 2509 return false; 2510 }); 2511 2512 $('#get_dealer_offer').click(function(e) 2513 { 2514 e.preventDefault(); 2515 window.open('/personal/pdf.php?type=dealer', '_blank'); 2516 return false; 2517 }); 2518 2519 $('#get_offer_hrrp').click(function(e) 2520 { 2521 e.preventDefault(); 2522 window.open('/personal/pdf.php?type=hiderrp', '_blank'); 2523 return false; 2524 }); 2525 2526 $('#get_dealer_offer_hrrp').click(function(e) 2527 { 2528 e.preventDefault(); 2529 window.open('/personal/pdf.php?type=dealer_hiderrp', '_blank'); 2530 return false; 2531 }); 2532 2533 $('#get_dealer_offer_opt').click(function(e) 2534 { 2535 e.preventDefault(); 2536 window.open('/personal/pdf.php?type=dealer_opt', '_blank'); 2537 return false; 2538 }); 2539 2540 $('#checkout') 2541 .submit(function(e) { e.preventDefault(); }) 2542 .validate({ 2543 rules: { 2544 'checkout-first-name': { 2545 required: true 2546 }, 2547 'checkout-last-name': { 2548 required: false 2549 }, 2550 'checkout-tel': { 2551 required: false, 2552 }, 2553 'checkout-email': { 2554 required: true, 2555 email: true 2556 }, 2557 'checkout-comment': { 2558 required: false 2559 }, 2560 'checkout-hellotext': { 2561 required: false 2562 } 2563 }, 2564 messages: { 2565 'checkout-first-name': 'ÐведиÑе имÑ', 2566 'checkout-last-name': 'ÐведиÑе ÑамилиÑ', 2567 'checkout-tel': { 2568 required: 'ÐведиÑе ÑелеÑон' 2569 }, 2570 'checkout-email': { 2571 required: 'ÐведиÑе email', 2572 email: 'ÐепÑавилÑнÑй ÑоÑÐ¼Ð°Ñ email' 2573 }, 2574 'checkout-hellotext': 'УкажиÑе ÑекÑÑ Ð¿ÑивеÑÑÑвиÑ', 2575 'checkout-comment': 'ÐведиÑе комменÑаÑий' 2576 }, 2577 submitHandler: function(form) 2578 { 2579 var orderTypes = ['mini', 'manager']; 2580 var orderType = $('#basket_type').val(); 2581 2582 if ($.inArray( orderType, orderTypes ) == -1) { 2583 orderType = 'mini'; 2584 } 2585 2586 var countryData = itiCheckout.getSelectedCountryData(); 2587 $('#tel_code').val("+" + countryData.dialCode + " "); 2588 2589 $.ajax({ 2590 url : '/ajax/order_'+orderType+'.php', 2591 type : 'POST', 2592 data : $('#checkout').serialize(), 2593 async : false, 2594 dataType : 'json', 2595 }) 2596 .done(function(result) 2597 { 2598 if (result.SUCCESS == true) 2599 { 2600 location.assign(document.location.pathname + '?success=Y&order_id='+result.ORDER_ID); 2601 } 2602 else 2603 { 2604 console.log(result); 2605 } 2606 }) 2607 .always(function(result) 2608 { 2609 console.log(result.responseText); 2610 }); 2611 2612 return false;
2613 } 2614 }); 2615 2616 if ($('.cookie').length) 2617 { 2618 $('.cookie button').click(function(e) 2619 { 2620 e.preventDefault(); 2621 $('.cookie').hide(); 2622 BX.setCookie('COOKIE_USAGE_AGREE', 'Y', {expires: 2592000, path: '/'}); 2623 return false; 2624 }); 2625 } 2626 2627 $('#product_addtobasket').click(function(e) 2628 { 2629 e.preventDefault(); 2630 location.assign($(this).attr('href')); 2631 return false; 2632 }); 2633 2634 pageHash = location.hash; 2635 if (pageHash.length) 2636 { 2637 if ($('.submodel__menu-link[href="'+pageHash+'"]').length) 2638 { 2639 setTimeout(function() 2640 { 2641 $('.submodel__menu-link[href="'+pageHash+'"]').click(); 2642 },1000); 2643 } 2644 } 2645 2646 $('.card-full__photo').each(function(v) { 2647 $().fancybox({ 2648 selector: '.article_items__list .card-full__photo', 2649 loop: true, 2650 infobar: false, 2651 //toolbar: false, 2652 backFocus: false, 2653 margin: [44, 0, 22, 0], 2654 thumbs: { 2655 autoStart: true, 2656 axis: 'x' 2657 }, 2658 buttons : ['close'], 2659 btnTpl: { 2660 arrowLeft: 2661 '<a data-fancybox-prev class="fancybox-button fancybox-button--arrow_left" title="{{PREV}}" href="javascript:;">' + 2662 '<div class="circle"> <svg class="icon arrow"> <use xlink:href="/local/templates/brabus/icon/sprite.svg#icon-arrow"></use> </svg> </div>' + 2663 '</a>', 2664 2665 arrowRight: 2666 '<a data-fancybox-next class="fancybox-button fancybox-button--arrow_right" title="{{NEXT}}" href="javascript:;">' + 2667 '<div class="circle"> <svg class="icon arrow"> <use xlink:href="/local/templates/brabus/icon/sprite.svg#icon-arrow"></use> </svg> </div>' + 2668 '</a>' 2669 } 2670 }); 2671 }); 2672});
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.