1//cookie 2window.initCookieBanner = function (config) { 3 const banner = document.getElementById('cookie-banner') 4 const textEl = document.getElementById('cookie-text') 5 const acceptBtn = document.getElementById('cookie-accept') 6 7 textEl.textContent = config.text 8 acceptBtn.textContent = config.buttonText 9 banner.style.background = config.styles.background 10 acceptBtn.style.background = config.styles.buttonColor 11 textEl.style.color = config.styles.textColor 12 13 const storageKey = 'cookieConsent_v' + (config.version || '1.0') 14 15 if (!localStorage.getItem(storageKey)) { 16 banner.style.display = 'flex' 17 setTimeout(() => banner.classList.add('show'), 300) 18 } 19 20 acceptBtn.addEventListener('click', () => { 21 localStorage.setItem(storageKey, 'true') 22 banner.classList.remove('show') 23 setTimeout(() => (banner.style.display = 'none'), 300) 24 }) 25} 26 27const fallbackConfig = { 28 text: 'ÐÐ»Ñ ÑлÑÑÑÐµÐ½Ð¸Ñ ÑабоÑÑ ÑайÑа и его взаимодейÑÑÐ²Ð¸Ñ Ñ Ð¿Ð¾Ð»ÑзоваÑелÑми Ð¼Ñ Ð¸ÑполÑзÑем ÑÐ°Ð¹Ð»Ñ cookie. ÐÑÐ¾Ð´Ð¾Ð»Ð¶Ð°Ñ ÑабоÑÑ Ñ ÑайÑом, Ð²Ñ ÑазÑеÑаеÑе иÑполÑзование cookie-Ñайлов. ÐÑ Ð¼Ð¾Ð¶ÐµÑе оÑклÑÑиÑÑ ÑÐ°Ð¹Ð»Ñ cookie в наÑÑÑÐ¾Ð¹ÐºÐ°Ñ Ð²Ð°Ñего бÑаÑзеÑа.', 29 buttonText: 'ÐÑинÑÑÑ', 30 styles: { 31 background: 'rgba(0, 0, 0, 0.7)', 32 buttonColor: '#2ecc71', 33 textColor: '#ffffff', 34 }, 35} 36 37const loadConfig = () => { 38 const script = document.createElement('script') 39 script.src = 40 'https://alyans-auto.ru/webmaster/cookie-banner-config.js?t=' + Date.now() 41 script.onerror = () => { 42 console.warn('Ðе ÑдалоÑÑ Ð·Ð°Ð³ÑÑзиÑÑ ÐºÐ¾Ð½Ñиг, иÑполÑзÑем fallback') 43 window.initCookieBanner(fallbackConfig) 44 } 45 document.head.appendChild(script) 46} 47 48document.addEventListener('DOMContentLoaded', loadConfig) 49 50//плаÑка ÐÐ 51 52let ations_params = new URLSearchParams(document.location.search) 53let ations_brand = ations_params.get('brand') 54let ations_type = ations_params.get('type') 55if (ations_type) actions_change(ations_type == 'sales' ? 1 : 2, ations_brand) 56document.addEventListener('DOMContentLoaded', function () { 57 $('.markbut[data-mark="Solaris"]').click() 58}) 59if ($(window).width() < 960) { 60 document.addEventListener('DOMContentLoaded', function () { 61 var panel = document.querySelector('.app-notification'), 62 panelButton = panel.querySelector('.app-notification-btn') 63 64 if (localStorage['cookie-app-message'] == undefined) { 65 setTimeout(function () { 66 panel.classList.remove('hidden') 67 }, 2000) 68 } 69 70 panelButton.addEventListener('click', function () { 71 localStorage['cookie-app-message'] = true 72 panel.classList.add('hidden') 73 }) 74 }) 75} else { 76 $(document).ready(function () { 77 if (!$.cookie('hb-closed')) { 78 setTimeout(function () { 79 $('.header-banner').slideDown() 80 }, 1500) 81 } 82 }) 83 84 $('.marks-tabs > .marks__item').eq(1).click() 85 86 $('.hb-close').click(function () { 87 $.cookie('hb-closed', '1', { 88 expires: new Date(+new Date() + 60 * 60 * 1000), 89 }) 90 $('.header-banner').slideUp() 91 }) 92} 93 94//Ð¡Ð»Ð°Ð¹Ð´ÐµÑ Ð½Ð¾Ð²Ð¾ÑÑей 95 96if ($('.news-page-slider').length) { 97 $( 98 '.news-page-slider .swiper-button-next, .news-page-slider .swiper-button-prev', 99 ) 100 .removeClass('in') 101 .removeClass('out') 102 new Swiper('.news-page-slider', { 103 direction: 'horizontal', 104 slidesPerView: 'auto', 105 //centeredSlides: true, 106 spaceBetween: 30, 107 //spaceBetween: 15, 108 //slidesPerView: 1, 109 navigation: { 110 nextEl: '.swiper-button-next', 111 prevEl: '.swiper-button-prev', 112 }, 113 speed: 600, 114 breakpoints: { 115 1024: { 116 slidesPerView: 2, 117 spaceBetween: 30, 118 }, 119 800: { 120 slidesPerView: 1, 121 }, 122 400: { 123 slidesPerView: 1, 124 }, 125 }, 126 }) 127} 128 129//Ð¼ÐµÐ½Ñ Ð½Ð° аÑенде 130if ($('.menuclose').length) { 131 $('.menuclose').click(function () { 132 $('.burger').removeClass('act') 133 $('.menumobile').removeClass('act').scrollTop(0).removeAttr('style') 134 $('.menumobile__submenu').removeClass('act') 135 }) 136} 137 138// ÑилÑÑÑ Ð°Ñенда авÑо 139if ($('#arendaFilterElement').length) { 140 $('body').on('change', '#arendaFilterElement', function () {
141 const kpp = $(this).val() 142 if (kpp === 'x') { 143 $('.arendaElement').each(function (idx) { 144 $('.arendaElement')[idx].hidden = false 145 }) 146 } else { 147 $('.arendaElement').each(function (idx) { 148 $('.arendaElement')[idx].dataset.kpp === kpp 149 ? ($('.arendaElement')[idx].hidden = false) 150 : ($('.arendaElement')[idx].hidden = true) 151 }) 152 } 153 }) 154} 155 156// ÑилÑÑÑ Ð¾ÑзÑÐ²Ñ 157if ($('#reviewsFilterElement').length) { 158 $('body').on('change', '#reviewsFilterElement', function () { 159 const salon = $(this).val() 160 if (salon === 'x') { 161 $('#reviewsArea > div').each(function (idx) { 162 $('#reviewsArea > div')[idx].hidden = false 163 }) 164 } else { 165 $('#reviewsArea > div').each(function (idx) { 166 $('#reviewsArea > div')[idx].dataset.salon === salon 167 ? ($('#reviewsArea > div')[idx].hidden = false) 168 : ($('#reviewsArea > div')[idx].hidden = true) 169 }) 170 } 171 }) 172} 173 174// ÑилÑÑÑ ÑпеÑ. пÑедложений по бÑÐµÐ½Ð´Ñ 175// if ($('#specialActionsFilterElement').length) { 176// $('body').on('change', '#specialActionsFilterElement', function () { 177// const brand = $(this).val() 178// const type = $('#specialActionsFilterElementType').val() 179// if (brand === 'x') { 180// $('.actions-block').each(function (idx) { 181// if (type && type !== 'x') { 182// if ($('.actions-block')[idx].dataset.type === type) { 183// $('.actions-block')[idx].hidden = false 184// } 185// } else { 186// $('.actions-block')[idx].hidden = false 187// } 188// }) 189// } else { 190// specialSalonInit(brand) 191// $('.actions-block').each(function (idx) { 192// if (type && type !== 'x') { 193// ;($('.actions-block')[idx].dataset.brand === brand || 194// $('.actions-block')[idx].dataset.brand === 'all') && 195// $('.actions-block')[idx].dataset.type === type 196// ? ($('.actions-block')[idx].hidden = false) 197// : ($('.actions-block')[idx].hidden = true) 198// } else { 199// $('.actions-block')[idx].dataset.brand === brand || 200// $('.actions-block')[idx].dataset.brand === 'all' 201// ? ($('.actions-block')[idx].hidden = false) 202// : ($('.actions-block')[idx].hidden = true) 203// } 204// }) 205// } 206// }) 207// } 208 209// ÑилÑÑÑ ÑпеÑ. пÑедложений по ÑÐ°Ð»Ð¾Ð½Ñ 210// if ($('#specialActionsFilterElementSalon').length) { 211// $('body').on('change', '#specialActionsFilterElementSalon', function () { 212// const salon = $(this).val() 213// const type = $('#specialActionsFilterElementType').val() 214// const brand = $('#specialActionsFilterElement').val() 215// if (salon === 'x') { 216// $('.actions-block').each(function (idx) { 217// if (brand && brand !== 'x') { 218// if ( 219// $('.actions-block')[idx].dataset.brand === brand || 220// $('.actions-block')[idx].dataset.brand === 'all' 221// ) { 222// $('.actions-block')[idx].hidden = false 223// } 224// } else { 225// $('.actions-block')[idx].hidden = false 226// } 227// }) 228// } else { 229// $('.actions-block').each(function (idx) { 230// if (brand && brand !== 'x') { 231// ;($('.actions-block')[idx].dataset.brand === brand || 232// $('.actions-block')[idx].dataset.brand === 'all') && 233// $('.actions-block')[idx].dataset.salon.indexOf(':' + salon + ':') !== 234// -1 235// ? ($('.actions-block')[idx].hidden = false) 236// : ($('.actions-block')[idx].hidden = true) 237// } else { 238// $('.actions-block')[idx].dataset.salon.indexOf(':' + salon + ':') !== 239// -1 240// ? ($('.actions-block')[idx].hidden = false) 241// : ($('.actions-block')[idx].hidden = true) 242// } 243// }) 244// } 245// }) 246// } 247 248// ÑилÑÑÑ ÑпеÑ. пÑедложений по ÑÐ¸Ð¿Ñ 249// if ($('#specialActionsFilterElementType').length) { 250// $('body').on('change', '#specialActionsFilterElementType', function () { 251// const type = $(this).val() 252// const brand = $('#specialActionsFilterElement').val()
253// const salon = $('#specialActionsFilterElementSalon').val() 254// if (type === 'x') { 255// $('.actions-block').each(function (idx) { 256// if (brand && brand !== 'x' && (!salon || salon === 'x')) { 257// if ( 258// $('.actions-block')[idx].dataset.brand === brand || 259// $('.actions-block')[idx].dataset.brand === 'all' 260// ) { 261// $('.actions-block')[idx].hidden = false 262// } 263// } else if (brand && brand !== 'x' && salon && salon !== 'x') { 264// if ( 265// ($('.actions-block')[idx].dataset.brand === brand || 266// $('.actions-block')[idx].dataset.brand === 'all') && 267// $('.actions-block')[idx].dataset.salon.indexOf( 268// ':' + salon + ':' 269// ) !== -1 270// ) { 271// $('.actions-block')[idx].hidden = false 272// } 273// } else { 274// $('.actions-block')[idx].hidden = false 275// } 276// }) 277// } else { 278// $('.actions-block').each(function (idx) { 279// if (brand && brand !== 'x' && (!salon || salon === 'x')) { 280// $('.actions-block')[idx].dataset.type === type && 281// ($('.actions-block')[idx].dataset.brand === brand || 282// $('.actions-block')[idx].dataset.brand === 'all') 283// ? ($('.actions-block')[idx].hidden = false) 284// : ($('.actions-block')[idx].hidden = true) 285// } else if (brand && brand !== 'x' && salon && salon !== 'x') { 286// $('.actions-block')[idx].dataset.type === type && 287// ($('.actions-block')[idx].dataset.brand === brand || 288// $('.actions-block')[idx].dataset.brand === 'all') && 289// $('.actions-block')[idx].dataset.salon.indexOf(':' + salon + ':') !== 290// -1 291// ? ($('.actions-block')[idx].hidden = false) 292// : ($('.actions-block')[idx].hidden = true) 293// } else { 294// if (brand && brand !== 'x') { 295// $('.actions-block')[idx].dataset.type === type && 296// ($('.actions-block')[idx].dataset.brand === brand || 297// $('.actions-block')[idx].dataset.brand === 'all') 298// ? ($('.actions-block')[idx].hidden = false) 299// : ($('.actions-block')[idx].hidden = true) 300// } else { 301// $('.actions-block')[idx].dataset.type === type 302// ? ($('.actions-block')[idx].hidden = false) 303// : ($('.actions-block')[idx].hidden = true) 304// } 305// } 306// }) 307// } 308// }) 309// } 310 311//загÑÑзка ÑлеменÑов вÑбоÑа Ñалона 312function specialSalonInit(brand) { 313 let options = '' 314 var $select = $( 315 document.getElementById('specialActionsFilterElementSalon'), 316 ).selectize(options) 317 var selectize = $select[0].selectize 318 selectize.destroy() 319 console.log(brand) 320 switch (brand) { 321 case 'lada': 322 options = [ 323 { 324 text: 'LADA ÐиалâÐвÑо', 325 value: 2, 326 }, 327 { 328 text: 'LADA ÐвÑоÑегион', 329 value: 3, 330 }, 331 ] 332 break 333 case 'volkswagen': 334 options = [ 335 { 336 text: 'VOLKSWAGEN ФеÑдинанд ÐоÑоÑÑ', 337 value: 4, 338 }, 339 { 340 text: 'VOLKSWAGEN Рейн ÐоÑоÑÑ', 341 value: 10, 342 }, 343 ] 344 break 345 } 346 if (options) { 347 $('#salonElementArea').show() 348 var $select = $( 349 document.getElementById('specialActionsFilterElementSalon'), 350 ).selectize(options) 351 var selectize = $select[0].selectize 352 options.push({ 353 text: 'ÐÑбой', 354 value: 'x', 355 }) 356 options.forEach((salon) => { 357 selectize.addOption({ value: salon.value, text: salon.text }) 358 }) 359 selectize.refreshOptions() 360 } else { 361 $('#salonElementArea').hide() 362 } 363} 364 365// ÑилÑÑÑ ÑпеÑ. пÑедложений - Ð½Ð¾Ð²Ð°Ñ Ð²ÐµÑÑÐ¸Ñ ÑеÑез Ajax без коÑÑÑлей 366if ($('#specialActionsFilterElement').length) { 367 $('body').on( 368 'change', 369 '#specialActionsFilterElement, #specialActionsFilterElementSalon, #specialActionsFilterElementType', 370 function (e) { 371 id = $(this).attr('id') 372 // ÑбÑÐ¾Ñ Ð²ÑбоÑа ÐЦ и Ñипа пÑи Ñмене бÑенда 373 if ( 374 id === 'specialActionsFilterElement' && 375 ($('#specialActionsFilterElementSalon').val() || 376 $('#specialActionsFilterElementType').val()) 377 ) { 378 $( 379 '#specialActionsFilterElementSalon, #specialActionsFilterElementType', 380 ).val('') 381 } 382 actions_change() 383 }, 384 ) 385} 386 387function actions_change(type = '', brand = '') { 388 $('.specActionsArea').hide() 389 const form = $('form.actionFilter') 390 $.ajax({
391 type: 'POST', 392 url: '/?get_actions&type=' + type + '&brand=' + brand, 393 data: form.serialize(), 394 success: function (data) { 395 $('.specActionsArea').html(data).fadeIn() 396 }, 397 }) 398} 399 400// ÑилÑÑÑ ÑпеÑ. пÑедложений - Ñмена бÑенда, вÑÐ±Ð¾Ñ ÐЦ 401$('body').on('change', '#specialActionsFilterElement', function () { 402 specialSalonInit($('#specialActionsFilterElement').val()) 403}) 404 405//Ñдаление лиÑÐ½Ð¸Ñ ÑлеменÑов - TODO: не ÑабоÑÐ°ÐµÑ 406function actionsFilterType(data = '') { 407 if ($('select').length) { 408 var selectize = $('select').selectize({ 409 hideSelected: true, 410 }) 411 } 412 const options = [] 413 for (let select of selectize) { 414 if (select.getAttribute('id') === 'specialActionsFilterElementType') { 415 select.selectize.destroy() 416 $('#specialActionsFilterElementType option').remove() 417 if (data.indexOf(' data-type="1" ') !== -1) { 418 console.log(1) 419 options.push({ 420 text: 'ÐÑдел пÑодаж', 421 value: '1', 422 }) 423 } 424 if (data.indexOf(' data-type="2" ') !== -1) { 425 console.log(2) 426 options.push({ 427 text: 'СеÑвиÑ', 428 value: '2', 429 }) 430 } 431 if (options.length > 1) 432 options.push({ 433 text: 'ÐÑбой', 434 value: 'x', 435 }) 436 console.log(options) 437 options.forEach((option) => { 438 $('#specialActionsFilterElementType').append( 439 `<option value="${option.value}">${option.text}</option>`, 440 ) 441 }) 442 } 443 } 444} 445 446// ÑилÑÑÑ Ð½Ð¾Ð²Ð¾ÑÑей 447if ($('#newsFilterElement').length) { 448 $('body').on('change', '#newsFilterElement', function () { 449 const brand = $(this).val() 450 if (brand === 'x') { 451 // $('.pagination').show() 452 $('.news-item').each(function (idx) { 453 $('.news-item')[idx].hidden = false 454 }) 455 } else { 456 // $('.pagination').hide() 457 $('.news-item').each(function (idx) { 458 $('.news-item')[idx].dataset.brand === brand || 459 $('.news-item')[idx].dataset.brand === `:${brand}:` 460 ? ($('.news-item')[idx].hidden = false) 461 : ($('.news-item')[idx].hidden = true) 462 }) 463 } 464 }) 465} 466 467// ÑилÑÑÑ Ð°Ñенда авÑо 468if ($('#colorFilterElement').length) { 469 $('body').on('change', '#colorFilterElement', function () { 470 const color = $(this).val() 471 if (color === 'x') { 472 $('.arendaElement').each(function (idx) { 473 $('.arendaElement')[idx].hidden = false 474 }) 475 } else { 476 $('.arendaElement').each(function (idx) { 477 $('.arendaElement')[idx].dataset.color === color 478 ? ($('.arendaElement')[idx].hidden = false) 479 : ($('.arendaElement')[idx].hidden = true) 480 }) 481 } 482 }) 483} 484 485if ($('.calcSelect').length) { 486 $('body').on('change', 'select.calcSelect', function () { 487 $('input.' + $(this).data('group')).removeAttr('checked') 488 $('#boxservice' + $(this).val()).attr('checked', 'checked') 489 checkservice() 490 }) 491} 492 493if ($('.avn-slider').length) { 494 $('.avn-slider .swiper-button-next, .avn-slider .swiper-button-prev') 495 .removeClass('in') 496 .removeClass('out') 497 new Swiper('.avn-slider', { 498 direction: 'horizontal', 499 //slidesPerView: 1, 500 //centeredSlides: true, 501 //spaceBetween: 15, 502 //slidesPerView: 1, 503 pagination: { 504 el: '.swiper-pagination', 505 type: 'progressbar', 506 }, 507 navigation: { 508 nextEl: '.swiper-button-next', 509 prevEl: '.swiper-button-prev', 510 }, 511 speed: 600, 512 }) 513} 514 515// одиноÑное нажаÑие на ÑилÑÑÑ ÑÐµÐ½Ñ â оÑиÑÑка Ð¿Ð¾Ð»Ñ 516$('body').on('click', '.priceInput', function () { 517 $(this).val('') 518}) 519 520//возвÑажение ÑÐµÐ½Ñ Ð½Ð° меÑÑо еÑли введено некоÑÑекÑно 521$('input.priceInput').focusout(function () { 522 if ( 523 $(this).val() == '' || 524 $(this).val() < 0 || 525 !Number($(this).val().replace(/\s/g, '')) 526 ) { 527 $(this).val($(this).data('value')) 528 } 529}) 530 531//ÑоÑмаÑиÑование ÑиÑлен в ÑилÑÑÑе Ñен пеÑед оÑпÑавкой ÑоÑÐ¼Ñ 532$('div.mainform > form').on('submit', function () { 533 $('input.priceInput[data-type="price_from"]').val( 534 Number( 535 $('input.priceInput[data-type="price_from"]').val().replace(/\s/g, ''), 536 ), 537 ) 538 $('input.priceInput[data-type="price_to"]').val( 539 Number( 540 $('input.priceInput[data-type="price_to"]').val().replace(/\s/g, ''), 541 ), 542 ) 543 $('input.priceInput').attr('type', 'number') 544}) 545 546function tradeInData(price = false) { 547 const tradeinData = JSON.parse(localStorage.getItem('tradein')) 548 if (tradeinData) { 549 const tradeInPrice = new Intl.NumberFormat('ru-RU').format( 550 (tradeinData.prices_from + tradeinData.prices_to) / 2, 551 ) 552 const tradeInResult = { 553 mark: tradeinData.markTitle, 554 model: tradeinData.modelTitle, 555 price: tradeInPrice, 556 } 557 if (tradeInPrice) { 558 return !price ? tradeInResult : tradeInPrice 559 } 560 } 561} 562 563function getTradeIn() { 564 const data = tradeInData() 565 if (data) { 566 $('#tradeInWelcome').remove() 567 $('#tradeInAction').html('ÐÑениÑÑ Ð´ÑÑгой авÑомобилÑ') 568 $('#tradeInNext').html('Ðалее') 569 const tradeInPrice = document.querySelector('#tradeInPrice') 570 const tradeInPriceNum = document.querySelectorAll('.tradeInPriceNum') 571 if (tradeInPrice && data.mark && data.model && data.price) { 572 tradeInPrice.innerHTML = 573 'СÑоимоÑÑÑ ÐаÑего авÑÐ¾Ð¼Ð¾Ð±Ð¸Ð»Ñ <b>' + 574 data.mark + 575 ' ' + 576 data.model + 577 ': ~' + 578 data.price + 579 ' ÑÑб.</b>' 580 } 581 if (tradeInPriceNum && data.price) { 582 tradeInPriceNum.forEach((element) => { 583 element.innerHTML = data.price + ' ÑÑб.' 584 }) 585 } 586 } 587} 588 589window.addEventListener( 590 'message', 591 function (e) { 592 if ( 593 e.origin === 'https://alyans-auto.ru' || 594 e.origin === 'https://alyans-auto.site' 595 ) { 596 const eventName = e.data[0] 597 const data = e.data[1] 598 switch (eventName) { 599 case 'tradein': 600 localStorage.setItem('tradein', data) 601 getTradeIn() 602 break 603 } 604 } 605 }, 606 false, 607) 608 609if ($('.equipment__menu').children().length > 0) { 610 $('.equipment__btn').each(function () { 611 const type = $(this).data('type') 612 if ($('.equipment__item[data-type=' + '"' + type + '"' + ']').length < 1) { 613 type !== 'all' ? $(this).hide() : '' 614 } 615 }) 616} 617 618$('body').on('click', 'button.inWork', function () { 619 Swal.fire('Ð ÑазÑабоÑке', 'СкоÑо даннÑй Ñ
619ÑнкÑионал бÑÐ´ÐµÑ Ð³Ð¾Ñов', 'info') 620 return false 621}) 622 623function saveData() { 624 if ( 625 $('.itogtable .itogtable__params[data-param="service"] .itogtable__param') 626 .length 627 ) { 628 const services = [] 629 $( 630 '.itogtable .itogtable__params[data-param="service"] .itogtable__param', 631 ).each(function () { 632 let caption = $(this).find('span').eq(0).html().trim() 633 let info = $(this).find('span').eq(1).html().trim() 634 services.push(caption + (info ? ' ' + info : '')) 635 }) 636 $('#request_auto_service').val(services.join('\r\n')) 637 } 638 639 if ( 640 $('.itogtable .itogtable__params[data-param="equipment"] .itogtable__param') 641 .length 642 ) { 643 const equipment = [] 644 $( 645 '.itogtable .itogtable__params[data-param="equipment"] .itogtable__param', 646 ).each(function () { 647 let caption = $(this).find('span').eq(0).html().trim() 648 let info = $(this).find('span').eq(1).html().trim() 649 equipment.push(caption + (info ? ' ' + info : '')) 650 }) 651 $('#request_auto_equipment').val(equipment.join('\r\n')) 652 } 653} 654 655$('[data-fancybox-600]').fancybox({ 656 iframe: { 657 css: { 658 width: '600px', 659 height: '500px', 660 }, 661 }, 662}) 663 664$('[data-fancybox-1024]').fancybox({ 665 iframe: { 666 css: { 667 width: '1024px', 668 height: '768px', 669 }, 670 }, 671}) 672 673$('[data-fancybox="gallery"]').fancybox({ 674 thumbs: { 675 autoStart: true, 676 }, 677}) 678 679//пÑокÑÑÑка к наÑÐ°Ð»Ñ ÑÑÑаниÑÑ 680if ($('#scroll__top').length) { 681 const scrollTop = $('#scroll__top') 682 $(window).scroll(function () { 683 const topPos = $(this).scrollTop() 684 if (topPos > 100) { 685 $(scrollTop).css('opacity', '1') 686 } else { 687 $(scrollTop).css('opacity', '0') 688 } 689 }) 690 $(scrollTop).click(function () { 691 $('html, body').animate( 692 { 693 scrollTop: 0, 694 }, 695 800, 696 ) 697 return false 698 }) 699} 700 701$('a.scrollto').on('click', function () { 702 let href = $(this).attr('href') 703 $('html, body').animate( 704 { 705 scrollTop: $(href).offset().top, 706 }, 707 { 708 duration: 350, // Ð ÑÐ Ñ Ð¡ÑÐ ÑÐ ÑР»Сâ¡Ð °РРРÑСРЫ400л 709 easing: 'linear', // Ð ÑÐ Ñ Ð¡ÑÐ ÑÐ ÑР»Сâ¡Ð °РРРÑСРЫswingл 710 }, 711 ) 712 return false 713}) 714 715$.fancybox.defaults.i18n.ru = { 716 CLOSE: 'ÐакÑÑÑÑ', 717 NEXT: 'СледÑÑÑий', 718 PREV: 'ÐÑедÑдÑÑий', 719 ERROR: 720 'ÐапÑоÑенное ÑодеÑжимое не Ð¼Ð¾Ð¶ÐµÑ Ð±ÑÑÑ Ð·Ð°Ð³ÑÑжено. <br/> ÐожалÑйÑÑа, повÑоÑиÑе попÑÑÐºÑ Ð¿Ð¾Ð·Ð¶Ðµ.', 721 PLAY_START: 'ÐапÑÑк Ñлайд-ÑоÑ', 722 PLAY_STOP: 'ÐÑÑановиÑÑ Ñлайд-ÑоÑ', 723 FULL_SCREEN: 'Ðа веÑÑ ÑкÑан', 724 THUMBS: 'ÐалеÑеÑ', 725 DOWNLOAD: 'СкаÑаÑÑ', 726 SHARE: 'ÐоделиÑÑÑÑ', 727 ZOOM: 'ÐÑиблизиÑÑ', 728} 729 730$.fancybox.defaults.lang = 'ru' 731 732function avnGalleryCorrent() { 733 //полÑÑение бÑаÑзеÑа 734 var ua = detect.parse(navigator.userAgent) 735 //Ñдаление галеÑеи Ð´Ð»Ñ Ð´ÐµÑкÑоп веÑÑии (на моб. веÑÑии) 736 if (ua.device.type === 'Mobile' && $('.avn-slider').length) { 737 $('.avn-slider-mobile').html($('.avn-slider').html()) 738 // $('.avn-slider').remove() 739 new Swiper('.avn-slider-mobile', { 740 direction: 'horizontal', 741 pagination: { 742 el: '.swiper-pagination', 743 type: 'progressbar', 744 }, 745 navigation: { 746 nextEl: '.swiper-button-next', 747 prevEl: '.swiper-button-prev', 748 }, 749 speed: 600, 750 }) 751 } 752} 753 754$(document).ready(function () { 755 if (window.location.hostname === 'alyans-auto.ru') { 756 // ÑабоÑа Ñ Ð¯Ð½Ð´ÐµÐºÑ ÐеÑÑикой - полÑÑение clientID и ÑÐ¾Ñ Ñанение даннÑÑ 757 var clientID = 758 typeof yaCounter33676964 !== 'undefined' 759 ? yaCounter33676964.getClientID() 760 : false 761 if ($('.yaClientID').length && clientID) $('.yaClientID').val(clientID) 762 } 763 //ÑоÑÑиÑовка каÑалога - Ñдаление пÑÑÑÑÑ Ð¸Ð»Ð¸ не изменивÑÐ¸Ñ ÑÑ ÑоÑм 764 $('#catalogForm').submit(function (e) { 765 // e.preventDefault() 766 $(this).children(':input[value=""]').attr('disabled', 'disabled') 767 768 if ($('#catalogFormKPP').val() == '') 769 $('#catalogFormKPP').attr('disabled', 'disabled') 770 if ( 771 $('#catalogFormMinPrice').val() == 772 $('#catalogFormMinPriceCurrent').val().replace(' ', '') 773 ) 774 $('#catalogFormMinPrice, #catalogFormMinPriceCurrent').attr( 775 'disabled', 776 'disabled', 777 ) 778 if ( 779 $('#catalogFormMaxPrice').val() == 780 $('#catalogFormMaxPriceCurrent').val().replace(' ', '') 781 ) { 782 $('#catalogFormMaxPrice, #catalogFormMaxPriceCurrent').attr( 783 'disabled', 784 'disabled', 785 ) 786 } 787 788 if ($('#catalogFormModel').val() == '') 789 $('#catalogFormModel').attr('disabled', 'disabled') 790 791 return true 792 }) 793 //изменение ÑазмеÑа ÑкÑана 794 $(window).on('resize', function () {
795 //коÑÑекÑÐ¸Ñ Ð³Ð°Ð»ÐµÑеи авÑо 796 avnGalleryCorrent() 797 }) 798 //коÑÑекÑÐ¸Ñ Ð³Ð°Ð»ÐµÑеи авÑо 799 avnGalleryCorrent() 800 //полÑÑение пÑедÑдÑÑего ÑаÑÑеÑа ÑÑейд-ин 801 getTradeIn() 802 // СобÑÑие меÑÑики - полÑÑиÑе одобÑение кÑедиÑа онлайн 803 $('body').on('click', 'button#fi-hub-element-1', function () { 804 if (typeof ym !== 'undefined') 805 ym(33676964, 'reachGoal', 'AUTO_CREDIT_ONLINE') 806 }) 807 //кÑÑки ÑанÑи 808 $('.fancypay').fancybox({ 809 maxHeight: 600, 810 autoSize: true, 811 helpers: { 812 overlay: { 813 closeClick: false, 814 }, // overlay 815 }, // helpers 816 }) 817 $('.fancypay2').fancybox({ 818 maxHeight: 600, 819 autoSize: true, 820 helpers: { 821 overlay: { 822 closeClick: false, 823 }, // overlay 824 }, // helpers 825 }) 826}) 827 828//оÑпÑавка ÑоÑÐ¼Ñ Ð¾Ð±ÑаÑеой ÑвÑзи 829if ($('form#feedbackForm').length) { 830 $('form#feedbackForm').submit(function (e) { 831 e.preventDefault() 832 $('input[type=submit]', this).attr('disabled', 'disabled') 833 if ($('#feedbackForm #agree').length) { 834 if (!$('#feedbackForm #agree').is(':checked')) { 835 $('#feedbackForm .form__error') 836 .html('ТÑебÑеÑÑÑ ÑоглаÑие на обÑабоÑÐºÑ Ð¿ÐµÑÑоналÑнÑÑ Ð´Ð°Ð½Ð½ÑÑ ') 837 .fadeIn() 838 return 839 } else { 840 $('#feedbackForm .form__error').html('').fadeOut() 841 } 842 } 843 if ($('#feedbackForm #salon').length) { 844 if ($('#feedbackForm #salon').val() === 'ÐÑбеÑиÑе Ñалон') { 845 $('#feedbackForm .form__error').html('УкажиÑе название Ñалона').fadeIn() 846 return 847 } else { 848 $('#feedbackForm .form__error').html('').fadeOut() 849 } 850 } 851 if ($('#feedbackForm #type').length) { 852 if ($('#feedbackForm #type').val() === 'ÐÑбеÑиÑе Ñип') { 853 $('#feedbackForm .form__error') 854 .html('ÐÑбеÑиÑе Ñип обÑлÑживаниÑ') 855 .fadeIn() 856 return 857 } else { 858 $('#feedbackForm .form__error').html('').fadeOut() 859 } 860 } 861 var form = $(this) 862 var url = form.attr('action') 863 var method = form.attr('method') 864 $.ajax({
865 type: method, 866 url: url, 867 data: form.serialize(), 868 success: function (data) { 869 if (data === 'success') { 870 form.trigger('reset') 871 $('#feedbackForm .form__error').html('').fadeOut() 872 $('#sendModalForm').length ? $('#sendModalForm').hide() : '' 873 opensuccess() 874 $('input[type=submit]', form).removeAttr('disabled') 875 } else { 876 console.log(data) 877 $('#feedbackForm .form__error') 878 .html('ÐаполниÑе ÑоÑÐ¼Ñ ÐºÐ¾ÑÑекÑно') 879 .fadeIn() 880 return 881 } 882 }, 883 error: function (jqXHR, exception) { 884 var msg = '' 885 if (jqXHR.status === 0) { 886 msg = 'Not connect.\n Verify Network.' 887 } else if (jqXHR.status == 404) { 888 msg = 'Requested page not found. [404]' 889 } else if (jqXHR.status == 500) { 890 msg = 'Internal Server Error [500]' 891 } else if (exception === 'parsererror') { 892 msg = 'Requested JSON parse failed.' 893 } else if (exception === 'timeout') { 894 msg = 'Time out error.' 895 } else if (exception === 'abort') { 896 msg = 'Ajax request aborted.' 897 } else { 898 msg = 'Uncaught Error.\n' + jqXHR.responseText 899 } 900 if ($('#feedbackForm .form__error').length) { 901 $('#feedbackForm .form__error').html(msg).fadeIn() 902 } else { 903 console.log(msg) 904 } 905 }, 906 }) 907 }) 908} 909 910//оÑпÑавка пÑоизволÑной (динамиÑеÑкой) ÑоÑÐ¼Ñ Ð¾Ð±ÑаÑной ÑвÑзи 911if ($('form.requestForm').length) { 912 $('form.requestForm').submit(function (e) { 913 e.preventDefault() 914 $('input[type=submit]', this).attr('disabled', 'disabled') 915 var form = $(this) 916 if ( 917 form.find('input[data-mask=phone]').length && 918 form.find('input[data-mask=phone]').val().replace(/\D+/g, '').length !== 919 11 920 ) { 921 form.find('.form__error').text('ÐекоÑÑекÑнÑй номеÑ').show() 922 form.find('input[data-mask=phone]').addClass('error') 923 return false 924 } 925 if (form.find('.agree').length) { 926 if (!form.find('.agree').is(':checked')) { 927 form 928 .find('.form__error') 929 .html('ТÑебÑеÑÑÑ ÑоглаÑие на обÑабоÑÐºÑ Ð¿ÐµÑÑоналÑнÑÑ Ð´Ð°Ð½Ð½ÑÑ ') 930 .fadeIn() 931 return 932 } else { 933 form.find('.form__error').html('').fadeOut() 934 } 935 } 936 if (form.find('#salon').length) { 937 if (form.find('#salon').val() === 'ÐÑбеÑиÑе Ñалон') { 938 form.find('.form__error').html('УкажиÑе название Ñалона').fadeIn() 939 return 940 } else { 941 form.find('.form__error').html('').fadeOut() 942 } 943 } 944 if (form.find('#type').length) { 945 if (form.find('#type').val() === 'ÐÑбеÑиÑе Ñип') { 946 form.find('.form__error').html('ÐÑбеÑиÑе Ñип обÑлÑживаниÑ').fadeIn() 947 return 948 } else { 949 form.find('.form__error').html('').fadeOut() 950 } 951 } 952 var form = $(this) 953 var url = form.attr('action') 954 var method = form.attr('method') 955 var form_id = form.attr('id') 956 // заÑиÑа Ð¾Ñ Ñпама 957 if ( 958 form_id === 'request_auto_avn' || 959 form_id === 'bug_report' || 960 form_id === 'bug_report_orphus' 961 ) { 962 // ÐаÑвка Ñ ÑайÑа alyans-auto.ru (ÐÐРи ÑÐµÑ Ð½Ð¸ÑеÑкие) 963 $.ajax({
964 type: method, 965 url: url, 966 data: form.serialize(), 967 success: function (data) { 968 if (data === 'success') { 969 form.trigger('reset') 970 opensuccess() 971 if ($ && $.fancybox) $.fancybox.close() 972 form.find('.form__error').html('').fadeOut() 973 $('#sendModalForm').length ? $('#sendModalForm').hide() : '' 974 $('input[type=submit]', form).removeAttr('disabled') 975 } else { 976 console.log(data) 977 form.find('.form__error').html('ÐаполниÑе ÑоÑÐ¼Ñ ÐºÐ¾ÑÑекÑно').fadeIn() 978 return 979 } 980 }, 981 error: function (jqXHR, exception) { 982 $('input[type=submit]', form).removeAttr('disabled') 983 const msg = form__error(jqXHR, exception) 984 if (form.find('.form__error').length) { 985 form.find('.form__error').html(msg).fadeIn() 986 } else { 987 console.log(msg) 988 } 989 }, 990 }) 991 } else if (form_id === 'shopcart' || form_id === 'shopcart__modal') { 992 // пÑовеÑка Ð¿Ð¾Ð»Ñ Ð¸Ñоговой ÑÑоимоÑÑи: не оÑпÑавлÑÑÑ ÑоÑÐ¼Ñ ÐµÑли пÑÑÑо или Ð½Ð¾Ð»Ñ 993 if ($('input[name="request[ÐÑÐ¾Ð³Ð¾Ð²Ð°Ñ ÑÑоимоÑÑÑ]"]').length) { 994 var total_cost_field = form.find( 995 'input[name="request[ÐÑÐ¾Ð³Ð¾Ð²Ð°Ñ ÑÑоимоÑÑÑ]"]', 996 ) 997 var total_cost_value = (total_cost_field.val() || '').trim() 998 var numeric_total = parseFloat(total_cost_value.replace(/\D/g, '')) || 0 999 if (!total_cost_value || numeric_total <= 0) { 1000 form 1001 .find('.form__error') 1002 .html('ÐÑÐ¾Ð³Ð¾Ð²Ð°Ñ ÑÑоимоÑÑÑ Ð½Ðµ Ð¼Ð¾Ð¶ÐµÑ Ð±ÑÑÑ Ð¿ÑÑÑой или Ñавной нÑлÑ') 1003 .fadeIn() 1004 $('input[type=submit]', form).removeAttr('disabled') 1005 return 1006 } else { 1007 form.find('.form__error').html('').fadeOut() 1008 } 1009 } 1010 1011 // ÐаÑвка Ñ ÑайÑа shop.alyans-auto.ru (магазин) или arenda 1012 $.ajax({
1013 type: method, 1014 url: url, 1015 data: form.serialize(), 1016 success: function (data) { 1017 if (data === 'success') { 1018 form.trigger('reset') 1019 if (form_id === 'shopcart') { 1020 resetCart('open') 1021 } else { 1022 if ($ && $.fancybox) $.fancybox.close() 1023 opensuccess() 1024 } 1025 form.find('.form__error').html('').fadeOut() 1026 $('#sendModalForm').length ? $('#sendModalForm').hide() : '' 1027 $('input[type=submit]', form).removeAttr('disabled') 1028 } else { 1029 console.log(data) 1030 form.find('.form__error').html('ÐаполниÑе ÑоÑÐ¼Ñ ÐºÐ¾ÑÑекÑно').fadeIn() 1031 return 1032 } 1033 }, 1034 error: function (jqXHR, exception) { 1035 $('input[type=submit]', form).removeAttr('disabled') 1036 const msg = form__error(jqXHR, exception) 1037 if (form.find('.form__error').length) { 1038 form.find('.form__error').html(msg).fadeIn() 1039 } else { 1040 console.log(msg) 1041 } 1042 }, 1043 }) 1044 } else { 1045 $.ajax({
1046 type: method, 1047 url: url, 1048 data: form.serialize(), 1049 success: function (data) { 1050 if (data === 'success') { 1051 if (window.location.href.indexOf('arenda') > -1) { 1052 if (typeof ym !== 'undefined') 1053 ym(85855651, 'reachGoal', 'arendalead') 1054 } 1055 form.trigger('reset') 1056 if ($ && $.fancybox) $.fancybox.close() 1057 form.find('.form__error').html('').fadeOut() 1058 $('#sendModalForm').length ? $('#sendModalForm').hide() : '' 1059 $('input[type=submit]', form).removeAttr('disabled') 1060 opensuccess() 1061 } else { 1062 console.log(data) 1063 form.find('.form__error').html('ÐаполниÑе ÑоÑÐ¼Ñ ÐºÐ¾ÑÑекÑно').fadeIn() 1064 return 1065 } 1066 }, 1067 error: function (jqXHR, exception) { 1068 $('input[type=submit]', form).removeAttr('disabled') 1069 const msg = form__error(jqXHR, exception) 1070 if (form.find('.form__error').length) { 1071 form.find('.form__error').html(msg).fadeIn() 1072 } else { 1073 console.log(msg) 1074 } 1075 }, 1076 }) 1077 } 1078 }) 1079} 1080 1081// вÑвод оÑибок ÑоÑм 1082function form__error(jqXHR, exception) { 1083 let msg = '' 1084 if (jqXHR.status === 0) { 1085 msg = 'ÐÐµÑ ÑÐ¾ÐµÐ´Ð¸Ð½ÐµÐ½Ð¸Ñ Ñ ÑеÑÑÑ' 1086 } else if (jqXHR.status == 404) { 1087 msg = 'СÑÑаниÑа не найдена [404]' 1088 } else if (jqXHR.status == 500) { 1089 msg = 'ÐнÑÑÑеннÑÑ Ð¾Ñибка ÑеÑвеÑа [500]' 1090 } else if (exception === 'parsererror') { 1091 msg = 'ÐÑибка ÑÑÐµÐ½Ð¸Ñ Ð²Ñ Ð¾Ð´ÑÑÐ¸Ñ Ð´Ð°Ð½Ð½ÑÑ ' 1092 } else if (exception === 'timeout') { 1093 msg = 'ÐÑÐµÐ¼Ñ Ð¸ÑÑекло, Ð½ÐµÑ Ð¾ÑвеÑа ÑеÑвеÑа' 1094 } else if (exception === 'abort') { 1095 msg = 'ÐапÑÐ¾Ñ Ð¾Ñменен' 1096 } else { 1097 msg = jqXHR.responseJSON.description 1098 ? jqXHR.responseJSON.description 1099 : 'ÐеизвеÑÑÐ½Ð°Ñ Ð¾Ñибка: ' + jqXHR.responseText 1100 } 1101 return msg 1102} 1103 1104// бÑониÑование ÐÐÐ 1105if ($('form#avn_reservation').length) { 1106 $('form#avn_reservation').submit(function (e) { 1107 $('#form__error').html('').fadeOut() 1108 $('#avn_reservation_submit').fadeOut() 1109 e.preventDefault() 1110 $('button[type=submit]', this).attr('disabled', 'disabled') 1111 var form = $(this) 1112 var url = form.attr('action') 1113 var method = form.attr('method') 1114 $.ajax({
1115 type: method, 1116 url: url, 1117 data: form.serialize(), 1118 success: function (response) { 1119 if (response.result === 'success') { 1120 if (response.data.link) { 1121 $('#form_result').html( 1122 `<strong>СÑÑлка на оплаÑÑ:</strong><br><br> 1123 <a href="${response.data.link}" target="_blank">${response.data.link}</a><br> 1124 <div class="goods__btns"><div class="goods__btn but butborder" id="close_avn_reservation">ÐакÑÑÑÑ</div></div>`, 1125 ) 1126 window.open(response.data.link, '_blank') 1127 } else { 1128 $('#avn_reservation_submit').fadeIn() 1129 $('button[type=submit]', form).removeAttr('disabled') 1130 } 1131 } else { 1132 $('#avn_reservation_submit').fadeIn() 1133 $('button[type=submit]', form).removeAttr('disabled') 1134 console.log(response) 1135 $('#form__error').html(response.error).fadeIn() 1136 return 1137 } 1138 }, 1139 error: function (jqXHR, exception) { 1140 $('#avn_reservation_submit').fadeIn() 1141 $('input[type=submit]', form).removeAttr('disabled') 1142 const msg = form__error(jqXHR, exception) 1143 if (form.find('.form__error').length) { 1144 form.find('.form__error').html(msg).fadeIn() 1145 } else { 1146 console.log(msg) 1147 } 1148 }, 1149 }) 1150 }) 1151} 1152 1153// закÑÑÑие окна бÑониÑÐ¾Ð²Ð°Ð½Ð¸Ñ 1154$('body').on('click', '#close_avn_reservation', function () { 1155 if ($('.modal .modal__cont iframe').length) { 1156 $('.modal .modal__cont iframe').each(function () { 1157 this.contentWindow.postMessage( 1158 '{"event":"command","func":"stopVideo","args":""}', 1159 '*', 1160 ) 1161 }) 1162 } 1163 $('.headerbg').stop().fadeOut(200) 1164 $('.modal').removeClass('showmodal') 1165 setTimeout(function () { 1166 $('.modal').addClass('hidemodal') 1167 $('.calc').removeClass('act') 1168 $('body').removeAttr('style') 1169 }, 10) 1170 setTimeout(function () { 1171 $('.modal').hide() 1172 $('.headerbg').removeClass('bgmodal') 1173 }, 200) 1174}) 1175 1176//оÑпÑавка пÑоизволÑной (динамиÑеÑкой) ÑоÑÐ¼Ñ Ð¾Ð±ÑаÑной ÑвÑзи 1177if ($('form.feedbackForm').length) { 1178 $('form.feedbackForm').submit(function (e) { 1179 e.preventDefault() 1180 $('input[type=submit]', this).attr('disabled', 'disabled') 1181 var form = $(this) 1182 if ( 1183 form.find('input[data-mask=phone]').length && 1184 form.find('input[data-mask=phone]').val().replace(/\D+/g, '').length !== 1185 11 1186 ) { 1187 form.find('.form__error').text('ÐекоÑÑекÑнÑй номеÑ').show() 1188 form.find('input[data-mask=phone]').addClass('error') 1189 return false 1190 } 1191 if ($('.feedbackForm #agree').length) { 1192 if (!$('.feedbackForm #agree').is(':checked')) { 1193 $('.feedbackForm .form__error') 1194 .html('ТÑебÑеÑÑÑ ÑоглаÑие на обÑабоÑÐºÑ Ð¿ÐµÑÑоналÑнÑÑ Ð´Ð°Ð½Ð½ÑÑ ') 1195 .fadeIn() 1196 return 1197 } else { 1198 $('.feedbackForm .form__error').html('').fadeOut() 1199 } 1200 } 1201 if ($('.feedbackForm #salon').length) { 1202 if ($('.feedbackForm #salon').val() === 'ÐÑбеÑиÑе Ñалон') { 1203 $('.feedbackForm .form__error').html('УкажиÑе название Ñалона').fadeIn() 1204 return 1205 } else { 1206 $('.feedbackForm .form__error').html('').fadeOut() 1207 } 1208 } 1209 if ($('.feedbackForm #type').length) { 1210 if ($('.feedbackForm #type').val() === 'ÐÑбеÑиÑе Ñип') { 1211 $('.feedbackForm .form__error') 1212 .html('ÐÑбеÑиÑе Ñип обÑлÑживаниÑ') 1213 .fadeIn() 1214 return 1215 } else { 1216 $('.feedbackForm .form__error').html('').fadeOut() 1217 } 1218 } 1219 var form = $(this) 1220 var url = form.attr('action') 1221 var method = form.attr('method') 1222 $.ajax({
1223 type: method, 1224 url: url, 1225 data: form.serialize(), 1226 success: function (data) { 1227 if (data === 'success') { 1228 form.trigger('reset') 1229 $('.feedbackForm .form__error').html('').fadeOut() 1230 $('#sendModalForm').length ? $('#sendModalForm').hide() : '' 1231 opensuccess() 1232 $('input[type=submit]', form).removeAttr('disabled') 1233 } else { 1234 console.log(data) 1235 $('.feedbackForm .form__error') 1236 .html('ÐаполниÑе ÑоÑÐ¼Ñ ÐºÐ¾ÑÑекÑно') 1237 .fadeIn() 1238 return 1239 } 1240 }, 1241 error: function (jqXHR, exception) { 1242 $('input[type=submit]', form).removeAttr('disabled') 1243 const msg = form__error(jqXHR, exception) 1244 if (form.find('.form__error').length) { 1245 form.find('.form__error').html(msg).fadeIn() 1246 } else { 1247 console.log(msg) 1248 } 1249 }, 1250 }) 1251 }) 1252} 1253 1254//пÑовеÑка оÑÑогÑаÑии 1255if ($('#orphus-modal').length) { 1256 jQuery(function ($) { 1257 // оÑлавливаем ÑобÑÑие нажаÑÐ¸Ñ ctrl + enter 1258 $('body').keydown(function (e) { 1259 if (e.ctrlKey && e.keyCode == 13) { 1260 // как ÑолÑко полÑзоваÑÐµÐ»Ñ Ð½Ð°Ð¶Ð¸Ð¼Ð°ÐµÑ Ð·Ð°Ð²ÐµÑнÑе Ctrl+Enter, показÑваем модалÑное окно 1261 $('#orphusLink').click() 1262 if (window.getSelection) { 1263 text = window.getSelection() 1264 } else if (document.getSelection) { 1265 text = document.getSelection() 1266 } else if (document.selection) { 1267 text = document.selection.createRange().text 1268 } 1269 // вÑÑавлÑем вÑделеннÑй ÑекÑÑ Ð² подгоÑовленное поле 1270 $('.orphus-text').text(text) 1271 $('#orphusError').val(text) 1272 } 1273 }) 1274 }) 1275} 1276 1277$('body').on('click', '.calc #finalStep, .butorange', function () { 1278 if ($('input[name=f_phone],input[data-mask=phone]').length) { 1279 $('input[name=f_phone],input[data-mask=phone]').inputmask('mask', { 1280 mask: '+7(*99) 999-99-99', 1281 clearIncomplete: true, 1282 showMaskOnHover: true, 1283 showMaskOnFocus: false, 1284 definitions: { '*': { validator: '[0-69]' } }, 1285 }) 1286 } 1287}) 1288 1289$('body').on('click', '.calc .butactionorder', function () { 1290 const form = $('#adminForm') 1291 const error = form.find('.form__error') 1292 console.log($(".form__agree input[type='checkbox']:checked").is(':checked')) 1293 1294 if ( 1295 form.find('input[name=f_name3]').length && 1296 form.find('input[name=f_name3]').val().length < 2 1297 ) { 1298 form.find('.form__error').text('УкажиÑе ÑамилиÑ').show() 1299 form.find('input[name=f_name3]').addClass('error') 1300 return false 1301 } 1302 1303 if ( 1304 form.find('input[name=f_name1]').length && 1305 form.find('input[name=f_name1]').val().length < 2 1306 ) { 1307 form.find('.form__error').text('УкажиÑе имÑ').show() 1308 form.find('input[name=f_name1]').addClass('error') 1309 return false 1310 } 1311 1312 if ( 1313 form.find('input[name=f_name2]').length && 1314 form.find('input[name=f_name2]').val().length < 2 1315 ) { 1316 form.find('.form__error').text('УкажиÑе оÑÑеÑÑво').show() 1317 form.find('input[name=f_name2]').addClass('error') 1318 return false 1319 } 1320 1321 if ( 1322 form.find('input[name=f_phone]').length && 1323 form.find('input[name=f_phone]').val().replace(/\D+/g, '').length !== 11 1324 ) { 1325 form 1326 .find('.form__error') 1327 .text( 1328 'ТелеÑон Ñказан невеÑно. Ðолжно бÑÑÑ 11 ÑиÑÑ, напÑимеÑ: +7 (901) 123-45-67', 1329 ) 1330 .show() 1331 form.find('input[name=f_phone]').addClass('error') 1332 return false 1333 } 1334 1335 if ( 1336 form.find('input[name=f_email]').length && 1337 form.find('input[name=f_email]').val().length < 2 1338 ) { 1339 form.find('.form__error').text('УкажиÑе e-mail адÑеÑ').show() 1340 form.find('input[name=f_email]').addClass('error') 1341 return false 1342 } 1343 if (!$(".form__agree input[type='checkbox']:checked").is(':checked')) { 1344 error.text('ТÑебÑеÑÑÑ ÑоглаÑие на обÑабоÑÐºÑ Ð¿ÐµÑÑоналÑнÑÑ Ð´Ð°Ð½Ð½ÑÑ ').show() 1345 return false 1346 } 1347}) 1348 1349/* if ($('.goods__specification .goods__btns .butborder').length) { 1350 1351 $('.goods__specification .goods__btns .butborder') 1352 .text('УÑоÑниÑÑ ÑÑоимоÑÑÑ')
1353 .css('margin-bottom', '30px') 1354 .addClass('butred') 1355 .removeClass('butborder') 1356} */ 1357 1358// if ($('.openmodal').length) { 1359// $('body').on('click', '.openmodal', function () { 1360// $('select').selectize({ 1361// create: true, 1362// sortField: 'text', 1363// }) 1364// }) 1365// } 1366 1367if ($('h1').length) { 1368 const h1 = $('h1').html() 1369 if (h1 === 'ÐÑездной ÑиномонÑаж' || h1 === 'СлÑжба забоÑÑ ÐлÑÑнÑ-ÐвÑо') { 1370 $('h1').append(`<br><a href="tel:88003337010">8 800 333 70 10</a>`) 1371 } 1372} 1373 1374//кÑÑÑÑе ÑаÑки пиÑкÑновой (VOLKSWAGEN Ñ Ð¿Ñобегом) - обÑабоÑÑик клика 1375$('body').on('click', '.piskynova', function () { 1376 $('#piskynova_auto').val($(this).attr('data-auto')) 1377 $('#piskynova_vin').val($(this).attr('data-vin')) 1378}) 1379 1380//оÑпÑвка пÑоизволÑной (динамиÑеÑкой) ÑоÑÐ¼Ñ Ð¾Ð±ÑаÑной ÑвÑзи 1381if ($('form.fileForm').length) { 1382 $('form.fileForm').submit(function (e) { 1383 e.preventDefault() 1384 $('input[type=submit]', this).attr('disabled', 'disabled') 1385 const __ = $(this) 1386 if ($(this).find('.agree').length) { 1387 if (!$(this).find('.agree').is(':checked')) { 1388 $(this) 1389 .find('.form__error') 1390 .html('ТÑебÑеÑÑÑ ÑоглаÑие на обÑабоÑÐºÑ Ð¿ÐµÑÑоналÑнÑÑ Ð´Ð°Ð½Ð½ÑÑ ') 1391 .fadeIn() 1392 return 1393 } else { 1394 $(this).find('.form__error').html('').fadeOut() 1395 } 1396 } 1397 if ( 1398 $(this).find('input[data-mask=phone]').length && 1399 $(this).find('input[data-mask=phone]').val().replace(/\D+/g, '') 1400 .length !== 11 1401 ) { 1402 $(this).find('.form__error').text('ÐекоÑÑекÑнÑй номеÑ').show() 1403 $(this).find('input[data-mask=phone]').addClass('error') 1404 return false 1405 } 1406 1407 var form = $(this) 1408 var btn = $(this).find('.but') 1409 var url = form.attr('action') 1410 var method = form.attr('method') 1411 1412 btn.removeAttr('style') 1413 var btn_old = btn.html() 1414 1415 btn 1416 .addClass('disable') 1417 .css('width', btn.outerWidth() + 'px') 1418 .css('height', btn.outerHeight() + 'px') 1419 .html( 1420 '<div class="lds-ellipsis"><div></div><div></div><div></div><div></div></div>', 1421 ) 1422 1423 $.ajax({
1424 type: method, 1425 url: url, 1426 data: new FormData(this), 1427 cache: false, 1428 contentType: false, 1429 processData: false, 1430 success: function (data) { 1431 if (data === 'success') { 1432 form.trigger('reset') 1433 $(this).find('.form__error').html('').hide() 1434 opensuccess() 1435 form.trigger('reset') 1436 form.find('.form__label').removeClass('act') 1437 btn.removeClass('disable').html(btn_old) 1438 $('input[type=submit]', form).removeAttr('disabled') 1439 } else { 1440 $(this) 1441 .find('.form__error') 1442 .html('ÐаполниÑе ÑоÑÐ¼Ñ ÐºÐ¾ÑÑекÑно') 1443 .fadeIn() 1444 btn.removeClass('disable').html(btn_old) 1445 return 1446 } 1447 }, 1448 error: function (jqXHR, exception) { 1449 let msg = '' 1450 if (jqXHR.status === 0) { 1451 msg = 'Not connect.\n Verify Network.' 1452 } else if (jqXHR.status == 404) { 1453 msg = 'Requested page not found. [404]' 1454 } else if (jqXHR.status == 500) { 1455 msg = 1456 'ÐекоÑÑекÑнÑй Ñайл, допÑÑÑимÑе ÑоÑмаÑÑ: PDF, DOC, XLS, JPG, ZIP, RAR' 1457 } else if (exception === 'parsererror') { 1458 msg = 'Requested JSON parse failed.' 1459 } else if (exception === 'timeout') { 1460 msg = 'Time out error.' 1461 } else if (exception === 'abort') { 1462 msg = 'Ajax request aborted.' 1463 } else { 1464 msg = 'Uncaught Error.\n' + jqXHR.responseText 1465 } 1466 if (form.find('.form__error').length) { 1467 form.find('.form__error').html(msg).fadeIn() 1468 btn.removeClass('disable').html(btn_old) 1469 return 1470 } else { 1471 console.log(msg) 1472 return 1473 } 1474 }, 1475 }) 1476 }) 1477} 1478 1479//кнопка Ð°Ð½ÐºÐµÑ 1480$(document).on('click', '.anchor-btn', function () { 1481 const anchorElement = $(this).attr('data-block') 1482 const anchorScrollElement = $( 1483 '.anchor-block[data-block=' + anchorElement + ']', 1484 ) 1485 $('html, body').animate( 1486 { 1487 scrollTop: anchorScrollElement.offset().top, 1488 }, 1489 1000, 1490 ) 1491}) 1492 1493// ÑкÑÑÑÑ Ð°ÐºÑеÑÑÑаÑÑ ÐµÑли Ð¸Ñ Ð½ÐµÑ 1494if ($('.animopacity').length) { 1495 if (!$('.boxequipment').length) $('.acs').remove() 1496} 1497 1498//маÑка ÑелеÑона Ð´Ð»Ñ ÑоÑм ÐÐ ÐÐ 1499if ($('input[data-type="phone"]').length) { 1500 $('input[data-type="phone"]').inputmask('mask', { 1501 mask: '+7(*99) 999-99-99', 1502 clearIncomplete: true, 1503 showMaskOnHover: true, 1504 showMaskOnFocus: false, 1505 definitions: { '*': { validator: '[0-69]' } }, 1506 }) 1507} 1508 1509function onloadFunction() { 1510 if (!window.smartCaptcha) return false 1511 window.smartCaptcha.render('captcha-container', { 1512 sitekey: 'ysc1_CPJOpiRfrrOJBEDR0slmrOH8Osgl9DRvlTEXXjhg8355a798', 1513 invisible: true, 1514 callback: callback, 1515 }) 1516} 1517 1518function callback(token) { 1519 if (!token) return false 1520 if ($('#g-recaptcha-response').length) $('#g-recaptcha-response').val(token) 1521 if ($('.g-recaptcha-response').length) $('.g-recaptcha-response').val(token) 1522} 1523 1524// конеÑ
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.