1function showSticker() { 2 var count = $('.atmosphere .sticker').length, 3 rand = Math.round(Math.random() * count); 4 $('.atmosphere .sticker:eq(' + rand + ')').each(function() { 5 var t = $(this); 6 if (!t.hasClass('active')) { 7 t.addClass('active'); 8 setTimeout(function() { 9 $(t).removeClass('active'); 10 }, 2000); 11 } 12 }); 13} 14 15function checkRadios() { 16 $('input[type=\'radio\'], input[type=\'checkbox\']').each(function() { 17 $(this).closest('label').removeClass('checked'); 18 if ($(this).is(':checked')) { 19 $(this).closest('label').addClass('checked'); 20 } 21 }); 22} 23 24var tickets_city = 'Ìîñêâà', 25 totalPrice = 0, 26 maxCount = 20; 27 28function changeTicketCount() { 29 var count_ticket = Number($('input[name=\'count_ticket\']').val()), 30 count_pack = Number($('input[name=\'count_pack\']').val()), 31 count_parking = Number($('input[name=\'count_parking\']').val()), 32 i = 0; 33 34 if (discountPrice) { 35 ticketPrice = discountPrice; 36 } else { 37 ticketPrice = normalTicketPrice; 38 } 39 40 if (discountAutoPrice) { 41 autoparkPrice = discountAutoPrice; 42 } else { 43 autoparkPrice = normalAutoparkPrice; 44 } 45 46 if (discountMotoPrice) { 47 motoparkPrice = discountMotoPrice; 48 } else { 49 motoparkPrice = normalMotoparkPrice; 50 } 51 52 if($(".tickets__options input[name='parking']:checked").val() === 'moto') { 53 parkPrice = motoparkPrice 54 } else { 55 parkPrice = autoparkPrice 56 } 57 58 if (count_parking < 0) { 59 count_parking = 0; 60 } 61 if (count_parking > maxCount) { 62 count_parking = maxCount; 63 } 64 if (count_parking > parking_free_places) { 65 count_parking = parking_free_places; 66 } 67 68 if (count_ticket < 0) { 69 count_ticket = 0; 70 } 71 if (count_ticket > maxCount) { 72 count_ticket = maxCount; 73 } 74 75 if (count_pack < 0) { 76 count_pack = 0; 77 } 78 if (count_pack > maxCount) { 79 count_pack = maxCount; 80 } 81 82 $('input[name=\'count_parking\']').val(count_parking); 83 $('input[name=\'count_ticket\']').val(count_ticket); 84 $('input[name=\'count_pack\']').val(count_pack); 85 86 $('.tickets__form-size').hide(); 87 for (i = 0; i < count_pack; i++) { 88 $('.tickets__form-size:eq(' + i + ')').show(); 89 } 90 91 if (count_pack) { 92 // $(".pack-text").slideDown(500); 93 } else { 94 // $(".pack-text").slideUp(500); 95 } 96 97 if (count_pack > 0) { 98 $('[data-price-pack]').html(count_pack * packPrice + ' ðóá.'); 99 $('[data-price-pack]').addClass('active'); 100 } else { 101 $('[data-price-pack]').html(packPrice + ' ðóá. çà ïàêåò'); 102 $('[data-price-pack]').removeClass('active'); 103 } 104 105 if (count_ticket > 0) { 106 $('[data-price-ticket]').html(count_ticket * ticketPrice + ' ðóá.'); 107 $('[data-price-ticket]').addClass('active'); 108 } else { 109 $('[data-price-ticket]').html(ticketPrice + ' ðóá. çà àáîíåìåíò'); 110 $('[data-price-ticket]').removeClass('active'); 111 } 112 113 if (count_parking > 0) { 114 $('[data-price-parking]').html(count_parking * parkPrice + ' ðóá.'); 115 $('[data-price-parking]').addClass('active'); 116 } else { 117 $('[data-price-parking]').html(parkPrice + ' ðóá. çà ìåñòî'); 118 $('[data-price-parking]').removeClass('active'); 119 } 120 121 totalPrice = 0; 122 if (count_pack) { 123 totalPrice += count_pack * packPrice; 124 } 125 if (count_ticket) { 126 totalPrice += count_ticket * ticketPrice; 127 } 128 if (count_parking) { 129 totalPrice += count_parking * parkPrice; 130 } 131 132 if (!totalPrice) { 133 $('.tickets__form button[type=\'submit\']').attr('disabled', 'disabled'); 134 } else { 135 $('.tickets__form button[type=\'submit\']').attr('disabled', false); 136 } 137 138 $('.tickets__total-price').html(totalPrice + ' ðóá.'); 139} 140 141function checkPhoneFields() { 142 143 $('[data-js-smsphone] input').each(function() { 144 var 145 $sendCodeBtn = $(this).closest('form').find('[data-js-send-code]'), 146 $alterBtn = $(this).closest('form').find('[data-js-forget-alt]'); 147 $sendCodeBtn.attr('disabled', true); 148 $alterBtn.removeClass('hidden'); 149 if ($(this).val().replace(/[^\d]/gim, '').length > 10) { 150 $sendCodeBtn.attr('disabled', false); 151 $alterBtn.addClass('hidden'); 152 } 153 }); 154 155} 156 157/**
158 * ïåðåïèñûâàåò ãëîáàëüíóþ ïåðåìåííóþ discountPrice - öåíà ñî ñêèäêîé, 159 * ïåðåïèñûâàåò maxCount, êîòîðûé âñåãäà 20 160 * çàïèñûâàåò ñîïðîâîæäàþùåå ïðîìîêîä ñîîáùåíèå èç checkCode.php â 161 * .tickets__code-note 162 * 163 * @param that 164 */ 165 166function checkCoupon(that) { 167 if(!that.val()) { 168 return; 169 } 170 171 var $ticketsCodeNote = $('.tickets__code-note'); 172 173 $ticketsCodeNote.removeClass('tickets__code-note--warning'); 174 175 discountPrice = 0; 176 discountAutoPrice = 0; 177 discountMotoPrice = 0; 178 179 if (that.val().length >= 10 || true) { 180 $('.tickets__form').stop().animate({opacity: 0.5}, 300); 181 182 $.post('/tickets/checkCode.php', { 183 coupon: that.val(), 184 amount: $('input[name="count_ticket"]').val(), 185 }, function(data) { 186 187 if (data.reason !== '') { 188 $ticketsCodeNote.html(data.reason); 189 } else { 190 $ticketsCodeNote.html( 191 'Ìîæíî ïîëó÷èòü èç <a href="/club/" target="_blank">êëóáà Äîáðîôåñòà</a> èëè îò àòòàøå ôåñòèâàëÿ'); 192 } 193 194 if (data.successText !== '') { 195 $('.input-wrapper-success').html(data.successText); 196 } else { 197 $('.input-wrapper-success').html(''); 198 } 199 200 if (data.isWarning) { 201 $ticketsCodeNote.addClass('tickets__code-note--warning'); 202 } 203 204 maxCount = data.maxCount; 205 206 if (data.price) { 207 discountPrice = data.price; 208 } 209 if (data.priceAuto) { 210 discountAutoPrice = data.priceAuto; 211 } 212 if (data.priceMoto) { 213 discountMotoPrice = data.priceMoto; 214 } 215 216 changeTicketCount(); 217 218 $('.tickets__form').stop().animate({opacity: 1}, 0); 219 220 }, 'json'); 221 } else { 222 $ticketsCodeNote.html( 223 'Ìîæíî ïîëó÷èòü èç <a href="/club/" target="_blank">êëóáà Äîáðîôåñòà</a> èëè îò àòòàøå ôåñòèâàëÿ'); 224 changeTicketCount(); 225 } 226} 227 228var stickers_interval, 229 stickers_active = false; 230var countryMask = 'ru'; 231var countriesMasks = { 232 'ru': '+7 (999) 999-99-99', 233 'by': '+375 (99) 999-99-99', 234 'uk': '+380 (99) 999-99-99', 235 'kz': '+7 (999) 999-99-99', 236 'lt': '+370 (99) 999-99-99', 237 'lv': '+371 (99) 999-99-99', 238 'ee': '+372 (99) 999-99-99', 239}; 240$(document).ready(function() { 241 prepareSuggestions(); 242 243 $(document).on('click', '[data-resend-sms]', function(e) { 244 e.preventDefault(); 245 246 var el = $(this), 247 phoneInput = $('[data-js-smsphone] input'); 248 249 el.attr('disabled', true) 250 $.post('/local/ajax/auth/?js_request', { 251 action: 'resendCode', 252 phone: phoneInput.val(), 253 }, function (data) { 254 el.attr('disabled', false) 255 }, 'json') 256 }) 257 258 $.fancybox.defaults.touch = false; 259 $.fancybox.defaults.afterShow = function() { 260 checkPopups(); 261 }; 262 263 $(window).resize(function() { 264 if (this.resizeTO) { 265 clearTimeout(this.resizeTO); 266 } 267 this.resizeTO = setTimeout(function() { 268 $(this).trigger('resizeEnd'); 269 }, 500); 270 }).bind('resizeEnd', function() { 271 checkPartnersVerticalList(); 272 pageFill(); 273 }); 274 onScroll(); 275 $('select').chosen({ 276 disable_search_threshold: 20, 277 width: '100%', 278 }); 279 280 $('[data-js-owl]') 281 .addClass('owl-carousel') 282 .owlCarousel({ 283 items: 4, 284 nav: true, 285 responsive: { 286 0: { 287 items: 1, 288 }, 289 560: { 290 items: 2, 291 }, 292 820: { 293 items: 3, 294 }, 295 1100: { 296 items: 4, 297 }, 298 }, 299 dots: false, 300 navText: ['', ''], 301 }); 302 303 $('[data-js-owl-columns]') 304 .addClass('owl-carousel') 305 .owlCarousel({ 306 items: 3, 307 margin: 30, 308 nav: true, 309 responsive: { 310 0: { 311 items: 1, 312 }, 313 560: { 314 items: 2, 315 }, 316 820: { 317 items: 3, 318 }, 319 }, 320 dots: false, 321 navText: ['', ''], 322 }); 323 324 $('[data-owl-tickets-main]').owlCarousel({ 325 loop: true, 326 items: 5, 327 width: 350, 328 margin: 30, 329 nav: true, 330 dots: false, 331 startPosition: $(window).width() < 768 ? -2 : -1, 332 onInitialized: function(e) { 333 var t = $(e.target); 334 t.find('.owl-nav').appendTo(t.closest('.tickets-main-holder')); 335 }, 336 }); 337 338 $('[data-owl-responses-main]').owlCarousel({ 339 loop: true, 340 items: 3, 341 width: 350, 342 margin: 30, 343 nav: true, 344 dots: true, 345 responsive: { 346 0: { 347 items: 1, 348 }, 349 560: { 350 items: 1, 351 }, 352 820: { 353 items: 2, 354 }, 355 1100: { 356 items: 3, 357 }, 358 }, 359 onInitialized: function(e) { 360 var t = $(e.target); 361 t.find('.owl-nav').appendTo(t.closest('.tickets-main-holder')); 362 363 }, 364 }); 365 366 if ($('.tickets__form').length) { 367 $('body') 368 .on('click', '.tickets__form-minus, .tickets__form-plus', function(e) { 369 e.preventDefault(); 370 var input = $(this).closest('.tickets__form-count').find('input'); 371 var c = input.val(); 372 if ($(this).hasClass('tickets__form-minus')) { 373 c--; 374 } else { 375 c++; 376 } 377 input.val(c); 378 changeTicketCount(); 379 380 $(document).trigger('ticketsFormPlusMinus', $(this)); 381 382 }) 383 .on('click', '.parking-type-switch', function(e) { 384 if ($('.tickets__options input[name=\'parking\']:checked').val() == 385 'moto') { 386 $('.parking-type--auto input') 387 .prop('checked', true) 388 .trigger('change'); 389 } else { 390 $('.parking-type--moto input') 391 .prop('checked', true) 392 .trigger('change'); 393 } 394 }) 395 .on('change', '.tickets__options input[name=\'parking\']', function(e) { 396 397 $('.parking-type').removeClass('active'); 398 if ($('.tickets__options input[name=\'parking\']:checked').val() == 399 'moto') { 400 $('.tickets__options-parking') 401 .removeClass('active-auto') 402 .addClass('active-moto'); 403 $('.parking-type--moto').addClass('active'); 404 parkPrice = motoparkPrice; 405 } else { 406 $('.tickets__options-parking') 407 .addClass('active-auto') 408 .removeClass('active-moto'); 409 $('.parking-type--auto').addClass('active'); 410 parkPrice = autoparkPrice; 411 } 412 changeTicketCount(); 413 414 }) 415 .on('change', '.tickets__form-sizes-text input[name*=\'TEXT_ME[\']', 416 function(e) { 417 418 if ($(this).is(':checked')) { 419 $(this) 420 .closest('.tickets__form-sizes-text') 421 .find('input[name*="TEXT["]') 422 .val('me'); 423 } else { 424 $(this) 425 .closest('.tickets__form-sizes-text') 426 .find('input[name*="TEXT["]') 427 .val(''); 428 } 429 430 }) 431 .on('click', '.packet-more', function(e) { 432 e.preventDefault(); 433 $('.packet').slideToggle(); 434 // $(".packet").toggleClass("packet--more"); 435 436 }) 437 .on('click', '.tickets__options-more-trigger', function(e) { 438 e.preventDefault(); 439 $('.tickets__options-more').slideToggle(); 440 441 }) 442 .on('change', 'input[type=\'checkbox\'], input[type=\'radio\']', 443 function(e) { 444 checkRadios(); 445 }) 446 .on('change', '.tickets__form input', function(e) { 447 console.log('change'); 448 if (typeof VK !== 'undefined') { 449 if (!tickets_landing) { 450 VK.Retargeting.Add(25522182); 451 } else { 452 VK.Retargeting.Add(26883979); 453 } 454 } 455 if (typeof yaCounter12487354 !== 'undefined') { 456 yaCounter12487354.reachGoal('2018-FORM-TOUCH'); 457 } 458 if (typeof yaCounter48952244 !== 'undefined') { 459 yaCounter48952244.reachGoal('2018-FORM-TOUCH'); 460 } 461 }) 462 .on('change', 'input[name=\'want-pack\']', function(e) { 463 checkCoupon($('input[name="coupon"]')); 464 }) 465 .on('keyup', 'input[name="coupon"]', function(e) { 466 checkCoupon($(this)); 467 }) 468 .on('blur', 'input[name="coupon"]', function(e) { 469 checkCoupon($(this)); 470 }) 471 .on('change', 'input[name=\'count\']', function(e) { 472 changeTicketCount(); 473 }); 474 475 $(document) 476 .on('ticketsFormPlusMinus', function(e, f) { 477 if ($(f).siblings('input[name="count_ticket"]').length) { 478 checkCoupon($('input[name="coupon"]')); 479 } 480 }); 481 482 changeTicketCount(); 483 checkPopups(); 484 checkRadios(); 485 checkCoupon($('input[name="coupon"]')); 486 487 $('.tickets__form form').submit(function(event) { 488 $('.tickets__form') 489 .find('button[type=\'submit\']') 490 .attr('disabled', 'disabled'); 491 event.preventDefault(); 492 493 let form = $(this); 494 495 $('.popup__error').text(''); 496 $.post(form.attr('action'), form.serialize(), function(data) { 497 $('input[name="fio"], input[name="phone"], input[name="sms"]') 498 .removeClass('input--error'); 499 if (data.result == 'ok') { 500 if(data.call) { 501 $('input[name=call_to]').val(data.call_to); 502 $('.input-wrapper__call').text('+'+data.call_to).attr('href', 'tel:+'+data.call_to); 503 $('input[name=call_from]').val(data.call_from); 504 $('.popup__text span').text(data.call_from); 505 $('.auth__qr img').attr('src', data.qr); 506 } 507 508 $('.tickets__form-button').stop().fadeOut(100); 509 if ($('.sms-wrapper').css('display') == 'none') { 510 $('.sms-wrapper').fadeIn(300); 511 $('input[name=\'send-sms\']').val('Y'); 512 $('input[name=\'sms\']').attr('required', 'required'); 513 $('.tickets__form') 514 .find('button[type=\'submit\']') 515 .attr('disabled', false); 516 $(document).scrollTop($('.sms-wrapper').offset().top); 517 if (typeof yaCounter12487354 !== 'undefined') { 518 yaCounter12487354.reachGoal('2018-GET-SMS'); 519 } 520 if (typeof yaCounter48952244 !== 'undefined') { 521 yaCounter48952244.reachGoal('2018-GET-SMS'); 522 } 523 if (typeof VK !== 'undefined') { 524 if (!tickets_landing) { 525 VK.Retargeting.Add(25522184); 526 } else { 527 VK.Retargeting.Add(26883986); 528 } 529 } 530 fbq('track', 'Lead', {currency: 'RUB', value: totalPrice}); 531 532 checkPopups() 533 } else { 534 $.post('/tickets/processing.php', 535 $('.tickets__form form').serialize(), function(data) { 536 537 if (data.result == 'error') { 538 window.location.reload(); 539 } else if ((data.result == 'ok') && data.url) { 540 if (typeof VK !== 'undefined') { 541 if (!tickets_landing) { 542 VK.Retargeting.Add(25522187); 543 } else { 544 VK.Retargeting.Add(26883993); 545 } 546 } 547 if (typeof yaCounter12487354 !== 'undefined') { 548 yaCounter12487354.reachGoal('2018-GO-TO-PAY'); 549 } 550 if (typeof yaCounter48952244 !== 'undefined') { 551 yaCounter48952244.reachGoal('2018-GO-TO-PAY'); 552 } 553 554 window.location.href = data.url; 555 } 556 }, 'json'); 557 } 558 } else { 559 $('.tickets__form') 560 .find('button[type=\'submit\']') 561 .attr('disabled', false); 562 if (data.errors.fio == 'Y') { 563 $('input[name="fio"]').addClass('input--error'); 564 $('.submit-form').fadeIn(100); 565 } 566 if (data.errors.phone == 'Y') { 567 $('input[name="phone"]').addClass('input--error'); 568 $('.submit-form').fadeIn(100); 569 } 570 if (data.errors.sms == 'Y') { 571 $('input[name="sms"]').addClass('input--error'); 572 } 573 if (data.errors.call == 'Y') { 574 $('.popup__error').text('Çâîíîê åùå íå ïîñòóïèë'); 575 } 576 } 577 }, 'json'); 578 }); 579 } 580 $(document).on('submit', 'form[name="club_questionnaire"]', function(e) { 581 e.preventDefault(); 582 submitOldForm($(this)); 583 }).on('click', 'a[data-man]', function(e) { 584 e.preventDefault(); 585 $('a[data-man]').addClass('active'); 586 $('a[data-woman]').removeClass('active'); 587 $('div[data-man], table[data-man]').show(); 588 $('div[data-woman], table[data-woman]').hide(); 589 }).on('click', 'a[data-woman]', function(e) { 590 e.preventDefault(); 591 $('a[data-woman]').addClass('active'); 592 $('a[data-man]').removeClass('active'); 593 $('div[data-man], table[data-man]').hide(); 594 $('div[data-woman], table[data-woman]').show(); 595 }).on('scroll', function() { 596 onScroll(); 597 }).on('click', '.main__down', function(e) { 598 $('html, body').animate({ 599 scrollTop: ($('.main').height()), 600 }, 1000); 601 }).on('submit', '[data-js-form]', function(e) { 602 e.preventDefault(); 603 var f = $(this); 604 $.post(f.attr('action'), f.serialize(), function(data) { 605 f.html(data); 606 }); 607 }) 608 .on('submit', '[data-ajax-form]', function(e) { 609 e.preventDefault(); 610 var f = $(this); 611 $.post(f.attr('action'), f.serialize(), function(data) { 612 f.html($(data).find('[data-ajax-form]').html()); 613 }); 614 })
615 .on('click', '[data-promocode-trigger]', function(e) { 616 e.preventDefault(); 617 $(this).hide(); 618 $('.data-promocode').slideDown(); 619 }).on('click', '.main-video-link', function(e) { 620 e.preventDefault(); 621 $('.main-video-link').fadeOut(1000); 622 var iframe = $('.main-video iframe'); 623 iframe.attr('src', iframe.data('url') + '?autoplay=1'); 624 if (stickers_active) { 625 $('[data-js-cutout]').click(); 626 } 627 }).on('keyup', 'input[data-back-shirt-text]', function(e) { 628 if ($(this).val().search(/[^a-zA-Z1234567890_\-#]/i) !== -1) { 629 $(this).val($(this).val().replace(/[^a-zA-Z1234567890_\-#]/i, '')); 630 } 631 if ($(this).val().length > 10) { 632 $(this).val($(this).val().substr(0, 10)); 633 } 634 635 if ($(this).val() == 'me') { 636 $(this) 637 .closest('.tickets__form-sizes-text') 638 .find('input[data-back-shirt-text]') 639 .prop('checked', true); 640 } else { 641 $(this) 642 .closest('.tickets__form-sizes-text') 643 .find('input[data-back-shirt-text]') 644 .prop('checked', false); 645 } 646 647 }).on('click', '[data-js-menu]', function(e) { 648 e.preventDefault(); 649 $('.menu-holder').toggleClass('active'); 650 }).on('click', '[data-js-cutout]', function(e) { 651 e.preventDefault(); 652 if (stickers_active) { 653 $('.atmosphere').removeClass('atmosphere--active'); 654 $('.cutout').removeClass('active'); 655 document.getElementById('comeon').pause(); 656 clearInterval(stickers_interval); 657 stickers_active = false; 658 } else { 659 $('.atmosphere').addClass('atmosphere--active'); 660 $('.cutout').addClass('active'); 661 $('.main-video-link').fadeIn(1000); 662 var iframe = $('.main-video iframe'); 663 iframe.attr('src', iframe.data('url')); 664 document.getElementById('comeon').play(); 665 stickers_interval = setInterval(function() { 666 showSticker(); 667 }, 500); 668 stickers_active = true; 669 } 670 var phrase = $('.cutout span').html(); 671 $('.cutout span').html($(this).data('phrase')); 672 $(this).data('phrase', phrase); 673 674 }).on('click', '[data-js-question-top]', function() { 675 $(this).closest('.questions__item').toggleClass('active'); 676 }).on('click', '[data-js-show-questionnaire]', function() { 677 $('[data-js-questionnaire]').slideDown(500); 678 setTimeout(function() { 679 $('html, body').animate({ 680 scrollTop: ($('[data-js-questionnaire]').offset().top - 100), 681 }, 1000); 682 }, 100); 683 }).on('click', '[data-new-popup]', function(e) { 684 e.preventDefault(); 685 $.fancybox.close(true); 686 $.post($(this).attr('href'), function(res) { 687 $.fancybox.open(res); 688 checkPopups(); 689 }); 690 }) 691 .on('submit', '[data-js-ajax-form]', function(e) { 692 e.preventDefault(); 693 var $that = $(this); 694 695 if ($that.data('js-ajax-form') == 'souvenir') { 696 $.post($(this).attr('action'), $(this).serialize(), function(res) { 697 if (res.status == 'ok') { 698 $.fancybox.open(res.html, { 699 beforeClose: function(instance, current) { 700 window.location.href = '/club/'; 701 }, 702 }); 703 } else { 704 $.fancybox.open(res.html); 705 } 706 // $that.closest('[data-js-hide-on-submit]').slideUp(300); 707 }, 'json'); 708 } else { 709 $.post($(this).attr('action'), $(this).serialize(), function(res) { 710 $.fancybox.open(res); 711 $that.closest('[data-js-hide-on-submit]').slideUp(300); 712 }); 713 } 714 }) 715 .on('submit', '[data-js-ajax-submit]', function(e) { 716 e.preventDefault(); 717 $.fancybox.close(true); 718 $.post($(this).attr('action'), $(this).serialize(), function(res) { 719 $.fancybox.open(res); 720 checkPopups(); 721 }); 722 }).on('click', '[data-js-send-code]', function(e) { 723 e.preventDefault(); 724 var 725 prAuthRequest = false, 726 $codeInput = $('[data-js-smscode] input'), 727 $phoneInput = $('[data-js-smsphone] input'), 728 handler = $(this).attr('data-js-send-code'); 729 730 if (!$codeInput.val()) { 731 prAuthRequest = { 732 action: 'sendCode', 733 phone: $phoneInput.val(), 734 }; 735 $('.input-wrapper--smscode').fadeIn(300); 736 $('.input-wrapper--smscode input').focus(); 737 $(this).html('Îòïðàâèòü ïîâòîðíî'); 738 $('.sms-notice--club').show(); 739 } else { 740 prAuthRequest = { 741 action: 'checkCode', 742 phone: $phoneInput.val(), 743 code: $codeInput.val(), 744 }; 745 746 if (parseInt($('input[name=groupId]').val()) > 0) { 747 prAuthRequest['groupId'] = $('input[name=groupId]').val(); 748 } 749 } 750 $.post(handler + '?js_request', prAuthRequest, function(res) { 751 res = JSON.parse(res); 752 if (res.status === 'ok' && res.action === 'redirect') { 753 window.location.href = res.body; 754 } 755 if (res.status === 'error' && res.action === 'close') { 756 $.fancybox.close(); 757 } 758 if (res.status === 'error' && res.action === 'showInPopup') { 759 $('.popup').html(res.body); 760 } 761 if (res.status === 'error' && res.action === 'showInForm') { 762 var $popupError = $('.popup__error'); 763 if (!$popupError.length) { 764 $('.popup__name') 765 .after('<div class="popup__error">' + res.body + '</div>'); 766 } else { 767 $popupError.html(res.body); 768 } 769 } 770 }); 771 }) 772 .on('input', '[data-js-smscode] input', function() { 773 $('[data-js-send-code]').html('Îòïðàâèòü êîä'); 774 if ($(this).val()) { 775 $('[data-js-send-code]').html('Ïðîäîëæèòü'); 776 } 777 }) 778 .on('keyup', '[data-js-smsphone] input', function() { 779 checkPhoneFields(); 780 })
781 .on('click', '[data-type="ajax"][data-fancybox]', function() { 782 checkPopups(); 783 }) 784 .on('click', '[data-js-change-country]', function() { 785 $(this).siblings('.countries__items').toggleClass('active'); 786 }) 787 .on('click', '.countries__items.active .countries__item', function() { 788 $('.countries__item').removeClass('active'); 789 $(this).addClass('active'); 790 $('.countries__items').removeClass('active'); 791 countryMask = $(this).data('js-mask-change'); 792 checkPopups(); 793 }) 794 .on('mouseover', '.countries__item', function() { 795 $('.countries__item').removeClass('hover'); 796 $(this).addClass('hover'); 797 }) 798 .on('mouseout', '.countries__item', function() { 799 $('.countries__item').removeClass('hover'); 800 }) 801 .on('click', '[data-toggle-block]', function(e) { 802 e.preventDefault(); 803 $(this).parent().find('[data-toggle-dest]').toggle(); 804 }) 805 .on('click', '[data-get-coupon]', function(e) { 806 e.preventDefault(); 807 var el = $(this), 808 promoId = el.attr('data-get-coupon'), 809 wait = BX.showWait('promo-' + promoId); 810 811 $.post('/local/ajax/promocode/', {id: promoId}, function(response) { 812 if (response.result === 'fail') { 813 $.fancybox.open(response.text); 814 } else { 815 el.replaceWith(function() { 816 return $('<div class="promocode__button">' + response.promocode + 817 '</div>'); 818 }); 819 copyToClipboard(response.promocode); 820 } 821 822 BX.closeWait('promo-' + promoId, wait); 823 }, 'json'); 824 }) 825 .on('click', '[data-refund]', function(e) { 826 e.preventDefault(); 827 828 if (confirm('Âû óâåðåíû?')) { 829 $.post('/local/ajax/refund/', {id: $(this).attr('data-id')}, 830 function(response) { 831 $.post(window.location.href, function(data) { 832 $('.club__tickets') 833 .html($(data).find('.club__tickets').html()); 834 $.fancybox.open('<div class="popup"><h4>' + response.text+'</h4></div>'); 835 }); 836 }, 'json'); 837 } 838 }) 839 840 ; 841 842 var $loadOnScrollBody = $('[data-js-gallery-load]'); 843 844 if ($loadOnScrollBody.length) { 845 var 846 nextPage = 2, 847 allowLoad = true, 848 totalPages = $loadOnScrollBody.data('js-gallery-load'); 849 850 $(document).on('scroll', function() { 851 if ((($loadOnScrollBody.outerHeight() + $loadOnScrollBody.offset().top) - 852 ($(document).scrollTop() + $(window).height())) < 500) { 853 if (allowLoad) { 854 allowLoad = false; 855 856 $.get('?PAGEN_1=' + nextPage, function(res) { 857 var newItems = $(res).find('.gallery__items').html(); 858 859 if (newItems && (nextPage <= totalPages)) { 860 $('.gallery__items').append(newItems); 861 862 nextPage++; 863 allowLoad = true; 864 } 865 }); 866 } 867 } 868 }); 869 } 870 871 if ($('.program').length) { 872 873 $(document).on('click', '.js-program-switch', function(e) { 874 e.preventDefault(); 875 876 $('.js-program-switch').removeClass('active'); 877 $(this).addClass('active'); 878 879 var $programBody = $('.program__body'); 880 881 $programBody 882 .stop() 883 .animate({opacity: .3}, 500); 884 885 $.post($(this).attr('href'), function(res) { 886 $programBody 887 .html($(res).find('.program__body').html()) 888 .stop() 889 .animate({opacity: 1}, 500); 890 891 programItemsHeight(); 892 }); 893 }); 894 895 programItemsHeight(); 896 897 // ýëåìåíòû â ïðîãðàììå íå áóäóò ìåíüøå ñîáñòâåííîé âûñîòû, 898 // åñëè íàçâàíèå äëèííåå îäíîé ñòðîêè 899 function programItemsHeight() { 900 $('.program__item').each(function() { 901 var thisInnerHeight = $(this).find('.program__name').outerHeight() 902 + $(this).find('.program__hours').outerHeight() + 30; 903 904 if ($(this).height() < thisInnerHeight) { 905 // $(this).height(thisInnerHeight); 906 } 907 }); 908 } 909 } 910 911 if ($('.volunteers').length) { 912 $(document) 913 .on('change', 'input[type=\'checkbox\'], input[type=\'radio\']', 914 function(e) { 915 checkRadios(); 916 }); 917 checkRadios(); 918 } 919 voteRadio(); 920 checkPartnersVerticalList(); 921 pageFill(); 922 if ($('#route-map').length) { 923 ymaps.ready(function() { 924 myMap = new ymaps.Map('route-map', { 925 center: [57.645733, 39.905820], 926 zoom: 11, 927 type: 'yandex#publicMap', 928 }); 929 myMap.controls.add('zoomControl', {left: 5, top: 5}); 930 var pointOptions = { 931 iconLayout: 'default#image', 932 iconImageHref: '/bitrix/templates/new/images/icon-pin.svg?1', 933 iconImageSize: [19, 27], 934 iconImageOffset: [-9, -27], 935 }; 936 myMap.geoObjects.add(new ymaps.Placemark([57.592797, 39.861844], 937 {balloonContent: 'Àâòîâîêçàë'}, pointOptions)); 938 myMap.geoObjects.add(new ymaps.Placemark([57.600396, 39.872202], 939 {balloonContent: 'ÆÄ-âîêçàë ßðîñëàâëü-Ìîñêîâñêèé'}, pointOptions)); 940 myMap.geoObjects.add(new ymaps.Placemark([57.625823, 39.835252], 941 {balloonContent: 'ÆÄ-âîêçàë ßðîñëàâëü-Ãëàâíûé'}, pointOptions)); 942 myMap.geoObjects.add(new ymaps.Placemark([57.638424, 39.883361], 943 {balloonContent: 'Îêòÿáðüñêàÿ ïëîùàäü'}, pointOptions)); 944 myMap.geoObjects.add(new ymaps.Placemark([57.702198, 39.998024], 945 {balloonContent: 'Îòâîðîòêà «Àýðîïîðò»'}, pointOptions)); 946 myMap.geoObjects.add(new ymaps.Placemark([57.727963, 40.053320], 947 {balloonContent: 'Àýðîäðîì «Ëåâöîâî»'}, pointOptions)); 948 }); 949 } 950 if ($('#map_away').length) { 951 ymaps.ready(function() { 952 myMap = new ymaps.Map('map_away', { 953 center: [57.645733, 39.905820], 954 zoom: 11, 955 type: 'yandex#publicMap', 956 }); 957 myMap.behaviors.disable('scrollZoom'); 958 myMap.controls.add('zoomControl', {left: 5, top: 5}); 959 var pointOptions = { 960 iconLayout: 'default#image', 961 iconImageHref: '/bitrix/templates/new/images/icon-pin.svg?1', 962 iconImageSize: [19, 27], 963 iconImageOffset: [-9, -27], 964 }; 965 myMap.geoObjects.add(new ymaps.Placemark([57.592797, 39.861844], 966 {balloonContent: 'Àâòîâîêçàë'}, pointOptions)); 967 myMap.geoObjects.add(new ymaps.Placemark([57.600396, 39.872202], 968 {balloonContent: 'ÆÄ-âîêçàë ßðîñëàâëü-Ìîñêîâñêèé'}, pointOptions)); 969 myMap.geoObjects.add(new ymaps.Placemark([57.625823, 39.835252], 970 {balloonContent: 'ÆÄ-âîêçàë ßðîñëàâëü-Ãëàâíûé'}, pointOptions)); 971 myMap.geoObjects.add(new ymaps.Placemark([57.638424, 39.883361], 972 {balloonContent: 'Îêòÿáðüñêàÿ ïëîùàäü'}, pointOptions)); 973 myMap.geoObjects.add(new ymaps.Placemark([57.702198, 39.998024], 974 {balloonContent: 'Îòâîðîòêà «Àýðîïîðò»'}, pointOptions)); 975 myMap.geoObjects.add(new ymaps.Placemark([57.727963, 40.053320], 976 {balloonContent: 'Àýðîäðîì «Ëåâöîâî»'}, pointOptions)); 977
978 $('#tickets_city').html(tickets_city); 979 980 ymaps.route([ 981 tickets_city, 982 {type: 'wayPoint', point: [57.727963, 40.053320]}, 983 ], { 984 mapStateAutoApply: true, 985 }).then(function(route) { 986 route.getPaths().options.set({ 987 strokeColor: '6a9802ff', 988 opacity: 0.7, 989 }); 990 route.getWayPoints().options.set({ 991 visible: false, 992 }); 993 route.getViaPoints().options.set({ 994 visible: false, 995 }); 996 myMap.geoObjects.add(route); 997 $('#tickets_distance').html(route.getHumanLength()); 998 }); 999 1000 }); 1001 } 1002 1003 $.post('/local/ajax/am/'); 1004}); 1005 1006/** 1007 * äâèæåíèå ðàçíûõ ïî âûñîòå êîëîíîê ïðè ñêðîëëå 1008 */ 1009 1010$(window).on('load', function() { 1011 var $stickColumns = $('[data-js-stick].column'); 1012 1013 if ($stickColumns.length && $(window).width() > 700) { 1014 var 1015 $columnsWrapper = $stickColumns.closest('.columns'), 1016 $columnsWrapperHeight = $columnsWrapper.height(), 1017 columnsToMove = [], 1018 topScrollPoint = $columnsWrapper.offset().top, 1019 bottomScrollPoint = ($columnsWrapper.offset().top + 1020 $columnsWrapperHeight) - $(window).height(), 1021 scrollOnePercent = (bottomScrollPoint - topScrollPoint) / 100; 1022 1023 $stickColumns.each(function() { 1024 if ($(this).outerHeight() !== $columnsWrapperHeight) { 1025 columnsToMove.push({ 1026 object: $(this), 1027 diff: $columnsWrapperHeight - $(this).outerHeight(), 1028 }); 1029 } 1030 }); 1031 1032 $(document).on('scroll', function() { 1033 var scrollTop = $(document).scrollTop(); 1034 1035 if (scrollTop > topScrollPoint && scrollTop < bottomScrollPoint) { 1036 var scrollPercent = (scrollTop - topScrollPoint) / scrollOnePercent; 1037 1038 columnsToMove.forEach(function(item) { 1039 item.object.css('margin-top', 1040 ((item.diff / 100) * scrollPercent) + 'px'); 1041 }); 1042 } else if (scrollTop < topScrollPoint) { 1043 $stickColumns.css('margin-top', 0); 1044 } else if (scrollTop > bottomScrollPoint) { 1045 columnsToMove.forEach(function(item) { 1046 item.object.css('margin-top', item.diff + 'px'); 1047 }); 1048 } 1049 }); 1050 } 1051 1052 $('body').on('click', '[data-like]', function(e) { 1053 e.preventDefault(); 1054 $(this).toggleClass('active'); 1055 $.post('/local/ajax/like/', {id: $(this).data('like')}, function() { 1056 1057 }); 1058 }); 1059 // if ($(".program__heart").length) { 1060 // setInterval(function () { 1061 // $(".program__heart.active").addClass("beat"); 1062 // setTimeout(function () { 1063 // $(".program__heart.active").removeClass("beat"); 1064 // setTimeout() 1065 // }, 500) 1066 // }, 1000); 1067 // } 1068 1069 if ($('.program__columns').length > 0) { 1070 setTimeout(function() { 1071 $('.program__columns').animate({scrollLeft: 100}, 500, function() { 1072 $('.program__columns').animate({scrollLeft: 0}, 500); 1073 }); 1074 }, 1000); 1075 } 1076 1077 setTimeout(function() { 1078 $('.main__slide[data-pic]').each(function() { 1079 $(this).css('background-image', 'url(' + $(this).attr('data-pic') + ')'); 1080 }); 1081 1082 $('.main__slides') 1083 .addClass('owl-carousel') 1084 .owlCarousel({ 1085 items: 1, 1086 animateOut: 'fadeOut', 1087 loop: true, 1088 nav: false, 1089 dots: false, 1090 autoplay: true, 1091 autoplayTimeout: 3000, 1092 }); 1093 1094 }, 3000); 1095 1096}); 1097 1098function checkPopups() { 1099 var $phoneInput = $('[data-js-smsphone] input'); 1100 $phoneInput.mask(countriesMasks[countryMask], { 1101 placeholder: ' ', 1102 autoclear: false, 1103 }); 1104 $('[data-js-saved-phone]').each(function() { 1105 $(this) 1106 .val($(this).data('js-saved-phone')) 1107 .trigger('keyup'); 1108 }); 1109 1110 let countdown = $('[data-countdown]'); 1111 if(countdown.length && countdown.is(':visible')) { 1112 let start = countdown.attr('data-countdown') ? countdown.attr('data-countdown') : 0; 1113 let interval = setInterval(function() { 1114 --start; 1115 countdown.text(start); 1116 1117 if(start === 0) { 1118 clearInterval(interval) 1119 if(countdown.attr('data-end')) { 1120 if(typeof window[countdown.attr('data-end')] === "function") { 1121 window[countdown.attr('data-end')](); 1122 countdown.parent().hide(); 1123 } 1124 } 1125 } 1126 }, 1000); 1127 } 1128} 1129 1130function resetCall() { 1131 $('[data-make-call]').html('<a href="/local/ajax/auth/" data-new-popup class="button button--wide">Çàïðîñèòü ïîâòîðíî</a>') 1132} 1133 1134function pageFill() { 1135 var $footer = $('.footer'); 1136 $footer.css('position', 'static'); 1137 if (($footer.offset().top + $footer.outerHeight()) < $(window).height()) { 1138 $footer 1139 .css('position', 'absolute') 1140 .css('bottom', 0) 1141 .css('left', 0) 1142 .css('right', 0); 1143 } 1144} 1145 1146function onScroll() { 1147 var st = $(window).scrollTop(); 1148 if (st > 82) { 1149 $('.menu').addClass('menu--fixed'); 1150 } else { 1151 $('.menu').removeClass('menu--fixed'); 1152 } 1153 1154 if ($('.tickets-button-holder').length) { 1155 if (st > $('.tickets-button-holder').offset().top) { 1156 $('.tickets-button-holder span').addClass('fixed'); 1157 } else { 1158 $('.tickets-button-holder span').removeClass('fixed'); 1159 } 1160 } 1161 1162} 1163 1164function checkPartnersVerticalList() { 1165 if ($('.partners-block--list-vertical').length) { 1166 $('.partners-block__info') 1167 .removeClass('partners-block__info--static') 1168 .each(function() { 1169 if ($(this).outerHeight() > 1170 $(this).closest('.partners-block__row').outerHeight()) { 1171 $(this).addClass('partners-block__info--static'); 1172 } 1173 }); 1174 } 1175} 1176 1177function voteRadio() { 1178 if ($('.voting-form-box').length) { 1179 $('.vote-answer-item-radio input[type="radio"]:checked').each(function() { 1180 $(this).closest('.vote-answer-item-radio').addClass('checked'); 1181 }); 1182 $(document).on('click', '.vote-answer-item-radio', function() { 1183 $(this) 1184 .closest('.vote-answers-list') 1185 .find('.vote-answer-item-radio') 1186 .removeClass('checked'); 1187 $(this).addClass('checked'); 1188 }); 1189 } 1190} 1191 1192function submitOldForm(form) { 1193 if (validateOldForm(form)) { 1194 $.post(form.attr('action'), {data: form.serialize()}, function(res) { 1195 if (res === 'ok') { 1196 $.fancybox.open( 1197 '<div class="popup"><h4>Àíêåòà îòïðàâëåíà. Áëàãîäàðèì çà ó÷àñòèå!</h4></div>');
1198 $('[data-js-questionnaire]').slideUp(500); 1199 } else { 1200 $.fancybox.open( 1201 '<div class="popup"><h4>Ïðîèçîøëà îøèáêà, ïîïðîáóéòå åùå ðàç ïîçæå</h4></div>'); 1202 } 1203 }); 1204 } 1205} 1206 1207function validateOldForm(form) { 1208 var 1209 question = form.find('.input-wrapper'), 1210 errorCnt = 0, 1211 dest, 1212 fieldOther; 1213 form.find('.req').remove(); 1214 question.each(function() { 1215 var q = $(this); 1216 if (!q.find('textarea, select').length) { 1217 fieldOther = q.find('input[type=text]'); 1218 if (!q.find('input:checked').length) { 1219 if (($.trim(fieldOther.val()) == '' && fieldOther.length) || 1220 !fieldOther.length) { 1221 q.find('.input-wrapper__title') 1222 .after('<div class="req">Âûáåðèòå õîòÿ áû îäèí âàðèàíò</div>'); 1223 errorCnt++; 1224 } 1225 } 1226 } 1227 }); 1228 if (errorCnt) { 1229 dest = form.find('.req:first').offset().top - 100; 1230 $('html, body').animate({scrollTop: dest}, 500); 1231 } 1232 return (errorCnt) ? false : true; 1233} 1234 1235function prepareSuggestions() { 1236 var token = '51a014e8b7dab7fa2f98d9e2e25e7d09a05778ed'; 1237 var $city = $('[data-suggest-city]'); 1238 var $street = $('[data-suggest-street]'); 1239 var $house = $('[data-suggest-house]'); 1240 1241 $city.suggestions({ 1242 token: token, 1243 type: 'ADDRESS', 1244 hint: false, 1245 bounds: 'city-settlement', 1246 }); 1247 1248 $street.suggestions({ 1249 token: token, 1250 type: 'ADDRESS', 1251 hint: false, 1252 bounds: 'street', 1253 constraints: $city, 1254 count: 15, 1255 }); 1256 1257 $house.suggestions({ 1258 token: token, 1259 type: 'ADDRESS', 1260 hint: false, 1261 noSuggestionsHint: false, 1262 bounds: 'house', 1263 constraints: $street, 1264 }); 1265} 1266 1267function copyToClipboard(text) { 1268 var $temp = $('<input>'); 1269 $('body').append($temp); 1270 $temp.val(text).select(); 1271 document.execCommand('copy'); 1272 $temp.remove(); 1273}
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.