1function ready(fn) { 2 if (document.readyState != 'loading') { 3 fn(); 4 } else { 5 document.addEventListener('DOMContentLoaded', fn); 6 } 7} 8 9function makeSnow(el) { 10 var ctx = el.getContext('2d'); 11 var width = 0; 12 var height = 0; 13 var particles = []; 14 15 var Particle = function () { 16 this.x = this.y = this.dx = this.dy = 0; 17 this.reset(); 18 }; 19 20 Particle.prototype.reset = function () { 21 this.y = Math.random() * height; 22 this.x = Math.random() * width; 23 this.dx = Math.random() * 1 - 0.5; 24 this.dy = Math.random() * 0.5 + 0.5; 25 }; 26 27 function createParticles(count) { 28 if (count != particles.length) { 29 particles = []; 30 for (var i = 0; i < count; i++) { 31 particles.push(new Particle()); 32 } 33 } 34 } 35 36 function onResize() { 37 width = window.innerWidth; 38 height = document.body.clientHeight; 39 el.width = width - 18; 40 el.height = height; 41 42 createParticles((width * height) / 10000); 43 } 44 45 function updateParticles() { 46 ctx.clearRect(0, 0, width, height); 47 ctx.fillStyle = '#f6f9fa'; 48 49 particles.forEach(function (particle) { 50 particle.y += particle.dy; 51 particle.x += particle.dx; 52 53 if (particle.y > height) { 54 particle.y = 0; 55 } 56 57 if (particle.x > width) { 58 particle.reset(); 59 particle.y = 0; 60 } 61 62 ctx.beginPath(); 63 ctx.arc(particle.x, particle.y, 5, 0, Math.PI * 2, false); 64 ctx.fill(); 65 }); 66 67 window.requestAnimationFrame(updateParticles); 68 } 69 70 onResize(); 71 updateParticles(); 72 73 window.addEventListener('resize', onResize); 74} 75var now = new Date(); 76var season = now.getMonth(); 77 78// ready(function() { 79// var canvas = document.getElementById('snow'); 80// makeSnow(canvas); 81// }); 82 83var menu_selector = '.nav'; 84 85function onScroll() { 86 var scroll_top = $(document).scrollTop(); 87 $(menu_selector + ' a').each(function () { 88 var hash = $(this).attr('href'); 89 var target = $(hash); 90 if ( 91 target.position().top - 70 <= scroll_top && 92 target.position().top - 70 + target.outerHeight() > scroll_top 93 ) { 94 $(menu_selector + ' a.active').removeClass('active'); 95 $(this).addClass('active'); 96 } else { 97 $(this).removeClass('active'); 98 } 99 }); 100} 101 102function gid() { 103 var match = document.cookie.match('(?:^|;)\\s*_ga=([^;]*)'); 104 var raw = match ? decodeURIComponent(match[1]) : null; 105 if (raw) { 106 match = raw.match(/(\d+\.\d+)$/); 107 } 108 var gacid = match ? match[1] : null; 109 if (gacid) { 110 return gacid; 111 } 112} 113var gacid; 114window.onload = () => { 115 gacid = gid(); 116}; 117 118// ФÑнкÑÐ¸Ñ Ð¿ÑеобÑÐ°Ð·Ð¾Ð²Ð°Ð½Ð¸Ñ Ð½Ð¾Ð¼ÐµÑа в ÑоÑÐ¼Ð°Ñ +7 (000) 000-00-00 119function phoneLocal(phone) { 120 return phone.replace( 121 /(\d{1})(\d{3})(\d{3})(\d{2})(\d{2})/, 122 '$1 ($2) $3-$4-$5' 123 ); 124} 125 126// ÐÐ¾Ð¼Ð¿Ð¾Ð½ÐµÐ½Ñ Ñаблона вÑÑавки ÑелеÑоннного номеÑа везде (каÑÑомнÑй Ñег <my-phone>) 127Vue.component('my-phone', { 128 template: 129 '<span><a class="call_phone_1 phone" href="tel:' + 130 sets.phone + 131 '" title="ÐозвониÑÑ Ð¿Ð¾ ' + 132 phoneLocal(sets.phone) + 133 '">' + 134 phoneLocal(sets.phone) + 135 '</a></span>', 136}); 137 138Vue.directive('input-mask', { 139 bind: function (el, obj, vModel) { 140 $(el).inputmask(); 141 }, 142}); 143 144// Шаблон ЯндекÑ-меÑÑики (ÐºÐ¾Ð½ÐµÑ ÑкÑипÑа) 145/*new Vue({ 146 el: '#ya-metrika', 147 data: { 148 ya_metrika: sets.ya_metrika, 149 }, 150 template: 151 '<noscript v-if="ya_metrika != 0"><div><img src="https://mc.yandex.ru/watch/' + 152 sets.ya_metrika + 153 '" style="position:absolute; left:-9999px;" alt="" /></div></noscript>', 154});*/ 155 156new Vue({ 157 el: '#app', 158 data: { 159 data: sets, 160 phoneSended: 'not', 161 inputtedPhone: '', 162 inputtedName: '', 163 inputtedEmail: '', 164 placeholderPhone: 'ÐведиÑе Ð½Ð¾Ð¼ÐµÑ ÑелеÑона', 165 placeholderName: 'ÐведиÑе ваÑе имÑ', 166 placeholderEmail: '', 167 popupIsOpen: false, 168 workingHours: false, 169 popupAgreement: false, 170 popupRegistr: false, 171 popupCall: false, 172 toggleBlock: false, 173 counter: true, //true - вклÑÑиÑÑ , false - вÑклÑÑиÑÑ 174 counterH: 0, 175 counterM: 0, 176 counterS: 0, 177 counterD: 0, 178 timerMode: 1, // 0 - ÑиклиÑнÑ, 1 до опÑеделенной даÑÑ, 2 - каждÑе 3 Ð´Ð½Ñ 179 }, 180 methods: { 181 showCars: function () { 182 this.visibleCards = this.data.cars[this.pickedModelKey].models.length; 183 }, 184 zeroNumber: function (n) { 185 n = String(n); 186 if (n.length < 2) { 187 return '0' + n; 188 } else { 189 return n; 190 } 191 }, 192 complChange: function (car, key) { 193 // $('select#compl_' + car).index(); 194 195 var compl = document.getElementById('compl_' + car).value; 196 var optionsHTML = '<option value="">ÐÑбеÑиÑе двигаÑелÑ</options>'; 197 if (compl != '') { 198 for (var i = sets.cars[key].compl.length - 1; i >= 0; i--) { 199 if (sets.cars[key].compl[i].name == compl) { 200 for ( 201 var l = sets.cars[key].compl[i].engines.length - 1; 202 l >= 0; 203 l-- 204 ) { 205 optionsHTML += 206 '<option value="' + 207 sets.cars[key].compl[i].engines[l] + 208 '">' + 209 sets.cars[key].compl[i].engines[l] + 210 '</options>'; 211 } 212 document.getElementById('power_' + car).innerHTML = optionsHTML; 213 document.getElementById('power_' + car).disabled = false;
214 } 215 } 216 } else { 217 document.getElementById('power_' + car).disabled = true; 218 document.getElementById('power_' + car).innerHTML = optionsHTML; 219 } 220 }, 221 222 initMap: function () { 223 if (this.screenSize().x < 760) { 224 sets.mapCenter = sets.mapCenterMobile; 225 sets.mapZoom = sets.mapZoomMobile; 226 } 227 228 var map = new ymaps.Map( 229 'map', 230 { 231 center: sets.mapCenter, 232 // controls: [], 233 zoom: sets.mapZoom, 234 }, 235 { 236 searchControlProvider: 'yandex#search', 237 balloonPanelMaxMapArea: 0, 238 } 239 ); 240 241 map.behaviors.disable('scrollZoom'); 242 243 map.geoObjects.add( 244 new ymaps.Placemark(sets.iconCenter, { 245 balloonContent: '', 246 }) 247 ); 248 map.geoObjects.add( 249 new ymaps.Placemark(sets.iconCenter2, { 250 balloonContent: '', 251 }) 252 ); 253 // map.geoObjects 254 // .add(new ymaps.Placemark(sets.iconCenter3, { 255 // balloonContent: '' 256 // })); 257 }, 258 //ÐеÑеклÑÑение Ñлайда по ÑÑÑлке 259 slideTo: function (slided) { 260 $('#slider').flickity('selectCell', '#' + slided, false, true); 261 // Снимем focus Ñ ÐºÐ»Ð¸ÐºÐ½ÑÑого ÑлеменÑа 262 document.activeElement.blur(); 263 this.closeMenu(); 264 }, 265 //СкÑÐ¸Ð¿Ñ Ð¿Ð»Ð°Ð²Ð½Ð¾Ð³Ð¾ пеÑÐµÑ Ð¾Ð´Ð° к нÑÐ¶Ð½Ð¾Ð¼Ñ Ð±Ð»Ð¾ÐºÑ 266 scrollTo: function (link) { 267 //СкÑÐ¸Ð¿Ñ Ð¿Ð»Ð°Ð²Ð½Ð¾Ð³Ð¾ пеÑÐµÑ Ð¾Ð´Ð° к нÑÐ¶Ð½Ð¾Ð¼Ñ Ð±Ð»Ð¾ÐºÑ 268 //Ñзнаем вÑÑоÑÑ Ð¾Ñ Ð½Ð°Ñала ÑÑÑаниÑÑ Ð´Ð¾ блока на коÑоÑÑй ÑÑÑлаеÑÑÑ ÑкоÑÑ 269 var top = this.getCoords(document.getElementById(link)).top; 270 var head = $('#header').height(); 271 //анимиÑÑем пеÑÐµÑ Ð¾Ð´ на ÑаÑÑÑоÑние - top за 1500 Ð¼Ñ 272 $('body,html').animate( 273 { 274 scrollTop: top - 70, 275 }, 276 300 277 ); 278 // Снимем focus Ñ ÐºÐ»Ð¸ÐºÐ½ÑÑого ÑлеменÑа 279 document.activeElement.blur(); 280 this.closeMenu(); 281 }, 282 screenSize: function () { 283 var w = window, 284 d = document, 285 e = d.documentElement, 286 g = d.getElementsByTagName('body')[0], 287 x = w.innerWidth || e.clientWidth || g.clientWidth, 288 y = w.innerHeight || e.clientHeight || g.clientHeight; 289 return { 290 x: x, 291 y: y, 292 }; 293 }, 294 changeColor: function (cardIndex, colorIndex, colorName) { 295 $('.card:eq(' + cardIndex + ') .image img').attr( 296 'src', 297 'img/cars/colors/' + 298 this.pickedModel + 299 '/' + 300 this.data.cars[this.pickedModelKey].models[cardIndex].colors[ 301 colorIndex 302 ] + 303 '.png' 304 ); 305 $('.card:eq(' + cardIndex + ') p.colorName span').text(colorName); 306 }, 307 changeModel: function (key, model) { 308 if (model !== this.pickedModel) { 309 this.pickedCarKey = ''; 310 this.pickedModel = model; 311 this.pickedModelKey = key; 312 var self = this; 313 for (var i = this.data.cars[key].models.length - 1; i >= 0; i--) { 314 $('.card:eq(' + i + ') p.colorName span').text( 315 self.colorName(self.data.cars[key].models[i].colors[0]) 316 ); 317 } 318 } 319 }, 320 colorCode: function (colorId) { 321 for (var i = 0; i < this.data.colors.length; i++) { 322 if (this.data.colors[i].id === colorId) return this.data.colors[i].code; 323 } 324 }, 325 colorName: function (colorId) { 326 for (var i = 0; i < this.data.colors.length; i++) { 327 if (this.data.colors[i].id === colorId) return this.data.colors[i].name; 328 } 329 }, 330 changeInfo: function (index) { 331 var carName = document.getElementById('car-name'); 332 var carBenefit = document.getElementById('car-benefit'); 333 carName.innerHTML = this.data.cars[index].name; 334 carBenefit.innerHTML = this.localeNumber( 335 this.maximum(this.data.cars[index].models, 'benefit') 336 ); 337 }, 338 // УÑÑаÑевÑий меÑод полÑÑÐµÐ½Ð¸Ñ ÐºÐ¾Ð¾ÑÐ´Ð¸Ð½Ð°Ñ ÑлеменÑа в докÑменÑе, Ð
338½Ðµ конÑликÑÑÐµÑ Ñ ÑÑÑбкой CallKeeper на моб. ÑÑÑÑ-Ð²Ð°Ñ 339 getCoords: function (elem) { 340 var top = 0, 341 left = 0; 342 343 while (elem) { 344 top = top + parseInt(elem.offsetTop); 345 left = left + parseInt(elem.offsetLeft); 346 elem = elem.offsetParent; 347 } 348 349 return { 350 top: top, 351 left: left, 352 }; 353 }, 354 minimum: function (array, parameter) { 355 var min = 99999999; 356 $.each(array, function (key, data) { 357 $.each(data, function (index, value) { 358 if (index == parameter && value < min) { 359 min = value; 360 } 361 }); 362 }); 363 return min; 364 }, 365 // ÐÐ°Ñ Ð¾Ð´Ð¸Ð¼ макÑималÑное из ÑиÑел 366 maximum: function (array, parameter) { 367 var max = Number(array[0][parameter]); 368 $.each(array, function (key, data) { 369 $.each(data, function (index, value) { 370 if (index == parameter && Number(value) > max) { 371 max = Number(value); 372 } 373 }); 374 }); 375 return max; 376 }, 377 // ÐобавлÑем пÑÐ¾Ð±ÐµÐ»Ñ Ð² ÑазÑÑÐ´Ñ ÑиÑел 378 localeNumber: function (number) { 379 output = Number(number); 380 return output.toLocaleString(); 381 }, 382 openPopup: function (type) { 383 this.ios(); 384 const scrollY = 385 document.documentElement.style.getPropertyValue('--scroll-y'); 386 if (type === 'agreement') { 387 this.popupAgreement = true; 388 } 389 if (type === 'registr') { 390 this.popupRegistr = true; 391 } 392 if (type === 'Call') { 393 this.popupCall = true; 394 } 395 this.popupIsOpen = true; 396 397 $('#popup').css('overflow', 'hidden'); 398 if (type !== 'agreement') { 399 setTimeout(function () { 400 $('#popup input[type="tel"]').focus(); 401 }, 500); 402 403 document.body.style.overflow = 'hidden'; 404 405 document.ontouchmove = function (e) { 406 e.preventDefault(); 407 }; 408 409 //Ð¦ÐµÐ»Ñ Ð¾ÑпÑавки заÑвки 410 /*if (sets.ya_metrika !== 0 && this.phoneSended === 'not') { 411 // Fix Ð´Ð»Ñ Ñежима инкогниÑо Mozilla 412 if (window['yaCounter' + sets.ya_metrika] !== undefined) { 413 window['yaCounter' + sets.ya_metrika].reachGoal('lead'); 414 } 415 }*/ 416 } 417 var popupBody = document.getElementById('popup'); 418 var self = this; 419 popupBody.addEventListener('mouseup', function (e) { 420 if (e.target === popupBody) { 421 self.closePopup(); 422 } 423 }); 424 }, 425 closePopup: function () { 426 this.popupIsOpen = false; 427 this.popupAgreement = false; 428 this.popupCall = false; 429 this.popupRegistr = false; 430 var popupBody = document.getElementById('popup'); 431 document.body.style.overflow = 'inherit'; 432 document.body.style.overflowX = 'hidden'; 433 434 document.ontouchmove = function (e) { 435 return true; 436 }; 437 var el = document.getElementsByTagName('html')[0]; 438 el.classList.remove('ios'); 439 el = document.getElementsByTagName('body')[0]; 440 el.classList.remove('ios'); 441 this.phoneSended = 'not'; 442 }, 443 ios: function () { 444 // ÐÑовеÑка на iOS 445 var iOS = 446 /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; 447 if (iOS == true) { 448 var el = document.getElementsByTagName('html')[0]; 449 el.className += ' ios'; 450 el = document.getElementsByTagName('body')[0]; 451 el.className += ' ios'; 452 } 453 }, 454 toggleMenu: function () { 455 if ($('div.burger').hasClass('open')) { 456 this.closeMenu(); 457 } else { 458 this.openMenu(); 459 } 460 }, 461 openMenu: function () { 462 $('div.burger').addClass('open'); 463 $('.nav').addClass('open'); 464 $('div.x, div.y, div.z').addClass('collapse'); 465 466 setTimeout(function () { 467 $('div.y').hide(); 468 $('div.x').addClass('rotate30'); 469 $('div.z').addClass('rotate150'); 470 }, 70); 471 setTimeout(function () { 472 $('div.x').addClass('rotate45'); 473 $('div.z').addClass('rotate135'); 474 }, 120); 475 }, 476 closeMenu: function () { 477 $('div.burger').removeClass('open'); 478 $('.nav').removeClass('open'); 479 $('div.x').removeClass('rotate45').addClass('rotate30'); 480 $('div.z').removeClass('rotate135').addClass('rotate150'); 481 482 setTimeout(function () { 483 $('div.x').removeClass('rotate30'); 484 $('div.z').removeClass('rotate150'); 485 }, 50); 486 setTimeout(function () {
487 $('div.y').show(); 488 $('div.x, div.y, div.z').removeClass('collapse'); 489 }, 70); 490 }, 491 //ÐеÑод оÑпÑавки ÑоÑÐ¼Ñ 492 /*sendForm: function () { 493 $('.circle-loader').removeClass('checking'); 494 495 //console.log(this.inputtedPhone); 496 497 var phoneCheck = this.checkForm(this.inputtedPhone); 498 //console.log(phoneCheck); 499 500 if (phoneCheck['check'] != false) { 501 this.placeholderPhone = '+7 (___) ___-__-__'; 502 this.phoneSended = 'sending'; 503 //Ð¦ÐµÐ»Ñ Ð¾ÑпÑавки заÑвки 504 if (sets.ya_metrika != 0) { 505 // Fix Ð´Ð»Ñ Ñежима инкогниÑо Mozilla 506 if (window['yaCounter' + sets.ya_metrika] !== undefined) { 507 window['yaCounter' + sets.ya_metrika].reachGoal('final_lead'); 508 } 509 } 510 511 try { 512 ym(999999999, 'reachGoal', 'zayavka'); 513 ga('send', 'event', 'form', 'send'); 514 } catch (error) {} 515 516 var phone = phoneCheck['number']; 517 //console.log('phone to cbh: ' + phone); 518 519 // ÐвÑозвонок CallBackHunter 520 // try { 521 // CBHCore.api.sendCall({ 522 // phone: phone, 523 // call_asap: 1 524 // }); 525 // } catch (e) { 526 // CBHCore.helpers.logError('CATCH JS ERROR: ' + e.name + '; ' + e.message); 527 // } 528 //var cookiesBasket = window.CallKeeper ? 529 // CallKeeper.f.justCookies() : 530 // encodeURIComponent('current:::typ=utm|||src=actioncall|||mdm=cpc|||cmp=lpnoscript|||cnt=(none)|||trm=(none)^#^#session:::cpg=http://petrovskiy-renault.ru/^#^#'); 531 //var url = 'https://api.callkeeper.ru/formReceiver?isSend&widgetHash=951da5c6f9906535f19c54c48602b4b2&phone=' + phone + '&backUrl=http://petrovskiy-renault.ru/send.php&cookiesBasket=' + cookiesBasket; 532 533 var utm_type; 534 if ( 535 window.params['utm_medium'] && 536 window.params['utm_medium'].indexOf('cpc') == 0 537 ) { 538 utm_type = 'undefined'; 539 } else { 540 if (document.referrer != '') { 541 if ( 542 document.referrer == 'https://yandex.ru/' || 543 document.referrer == 'https://www.google.com/' 544 ) { 545 utm_type = 'organic'; 546 } else { 547 utm_type = 'referral'; 548 } 549 } else { 550 utm_type = 'typein'; 551 } 552 } 553 554 var myURL = document.referrer.replace(/(^\w+:|^)\/\//, ''); 555 myURL = myURL.substr(0, myURL.lastIndexOf('/')); 556 var utm_source = window.params['utm_source']; 557 if (utm_type == 'organic' || utm_type == 'referral') { 558 utm_source = myURL; 559 } 560 561 var fd = new FormData(); 562 fd.append('gacid', gacid); 563 fd.append('utm_source', utm_source); 564 fd.append('utm_medium', window.params['utm_medium']); 565 fd.append('utm_campaign', window.params['utm_campaign']); 566 fd.append('utm_content', window.params['utm_content']); 567 fd.append('utm_term', window.params['utm_term']); 568 fd.append('utm_type', utm_type); 569 fd.append('entry_point', myURL); 570 fd.append('user_agent', window.navigator.userAgent); 571 fd.append('phone', phoneCheck['number']); 572 fd.append('name', this.inputtedName); 573 if (this.inputtedEmail != undefined && this.inputtedEmail != '') { 574 fd.append('email', this.inputtedEmail); 575 console.log(this.inputtedEmail); 576 } 577 fd.append('referrer', document.referrer); 578 fd.append('email_title', this.data.email_title); 579 fd.append('email_addresses', this.data.email_addresses); 580 fd.append('call_value', window.call_value); 581 console.log(this.data.email_addresses); 582 var self = this; 583 try { 584 var phone_ct = phoneCheck['number'], 585 cb_phone = ''; 586 if (!!phone_ct) { 587 phone_ct = phone_ct.replace(/[^0-9]/gim, ''); 588 cb_phone = 589 phone_ct.length == 10 590 ? '7' + phone_ct 591 : phone_ct.length == 11 592 ? '7' + phone_ct.substring(1) 593 : false;
594 window.ctw.createRequest( 595 'frm_pr', 596 cb_phone, 597 [], 598 function (success, data) { 599 console.log(success, data); 600 } 601 ); 602 } 603 } catch (e) {} 604 $.ajax({ 605 type: 'POST', 606 url: './send.php', 607 data: fd, 608 processData: false, 609 contentType: false, 610 dataType: 'json', 611 complete: function (msg) { 612 location.href="form-ok.php";return; 613 // СкÑоем клавиаÑÑÑÑ Ð½Ð° мобилÑном ÑÑÑÑойÑÑве 614 document.activeElement.blur(); 615 616 setTimeout(function () { 617 if (!self.popupIsOpen) { 618 self.openPopup('Call'); 619 } 620 self.phoneSended = 'sended'; 621 }, 3000); 622 // self.phoneSended = 'sended'; 623 }, 624 }); 625 } else { 626 this.placeholderPhone = 'УкажиÑе ÐÐ°Ñ ÑелеÑон'; 627 this.inputtedPhone = ''; 628 } 629 return false; 630 },*/ 631 checkForm: function (phone) { 632 var checker = true; 633 634 console.log(phone); 635 if (phone.substring(0, 1) != '+') { 636 phone = '+7' + phone; 637 } 638 639 console.log(phone); 640 641 var checkResult = phoneNumberParser(phone); 642 643 console.log(checkResult['parsingResult']); 644 //console.log(checkResult['errorDescription']); 645 //console.log(checkResult['isPossibleNumber']); 646 //console.log(checkResult['isValidNumber']); 647 //console.log(checkResult['eFormat']); 648 649 if ( 650 checkResult['parsingResult'] == 'error' || 651 checkResult['isPossibleNumber'] == false || 652 checkResult['isValidNumber'] == false || 653 checkResult['eFormat'] == 'invalid' 654 ) { 655 // $form.find("input[name='phone']").addClass("redput"); 656 // $form.find("input[name='phone']").val(""); 657 // $form.find("input[name='phone']").attr("placeholder", "УкажиÑе ÐÐ°Ñ ÑелеÑон"); 658 // $form.find("input[name='phone']").closest('#popup').removeClass("flipInY"); 659 // $form.find("input[name='phone']").closest('#popup').addClass("shake"); 660 // setTimeout(function() { 661 // $form.find("input[name='phone']").closest('#popup').removeClass("shake"); 662 // }, 3000); 663 checker = false; 664 var errorData = new FormData(); 665 errorData.append('inputtedData', phone); 666 errorData.append('email_title', sets.email_title); 667 errorData.append('parsingResult', checkResult['parsingResult']); 668 errorData.append('errorDescription', checkResult['errorDescription']); 669 errorData.append('isPossibleNumber', checkResult['isPossibleNumber']); 670 errorData.append('notPossibleReason', checkResult['notPossibleReason']); 671 errorData.append('isValidNumber', checkResult['isValidNumber']); 672 errorData.append('eFormat', checkResult['eFormat']); 673 // ÐÑÑÑлаем пиÑÑмо о ÑезÑлÑÑаÑе ÑеÑÑа ÑолÑко, еÑли ÑÑо-Ñо ввели, а не пÑоÑÑо нажали ÐºÐ½Ð¾Ð¿ÐºÑ 674 if (checkResult['parsingResult'] != 'error') { 675 $.ajax({ 676 type: 'POST', 677 url: 'send.php', 678 data: errorData, 679 processData: false, 680 contentType: false, 681 dataType: 'json', 682 complete: function () { 683 location.href="form-ok.php";return; 684 //console.log('ÐиÑÑмо об оÑибке оÑпÑавлено ÑÑпеÑно'); 685 }, 686 }); 687 } 688 } else { 689 $("input[name='phone']").removeClass('red'); 690 } 691 692 if (checker != true) { 693 return { 694 check: false, 695 }; 696 } else { 697 return { 698 check: true, 699 number: checkResult['eFormat'], 700 }; 701 } 702 }, 703 }, 704 computed: { 705 maxBenefit: function () { 706 var benefits = []; 707 for (var i = 0; i < this.data.cars.length; i++) { 708 benefits.push(this.maximum(this.data.cars[i].models, 'benefit')); 709 } 710 var max = benefits[0]; 711 for (i = 1; i < benefits.length; ++i) { 712 if (benefits[i] > max) max = benefits[i]; 713 } 714 return max; 715 }, 716 year: function () { 717 var currentDate = new Date(); 718 return currentDate.getFullYear(); 719 }, 720 month: function () { 721 var currentDate = new Date(); 722 return sets.months[currentDate.getMonth()]; 723 }, 724 month_2: function () { 725 var currentDate = new Date(); 726 return sets.months_2[currentDate.getMonth()]; 727 }, 728 lastday: function () { 729 var t = new Date(); 730 var l = new Date(t.getFullYear(), t.getMonth() + 1, 0); 731 return l.getDate(); 732 }, 733 // Ð Ð°Ð·Ð¼ÐµÑ ÑкÑана 734 screenSize: function () { 735 var w = window, 736 d = document, 737 e = d.documentElement, 738 g = d.getElementsByTagName('body')[0], 739 x = w.innerWidth || e.clientWidth || g.clientWidth, 740 y = w.innerHeight || e.clientHeight || g.clientHeight; 741 return { 742 x: x, 743 y: y, 744 }; 745 }, 746 }, 747 created: function () { 748 // Узнаем ÑекÑÑий ÑÐ°Ñ Ð´Ð½Ñ Ð´Ð»Ñ ÑекÑÑа Ñ Ð±Ð»Ð°Ð³Ð¾Ð´Ð°ÑноÑÑÑÑ 749 var h = new Date().getHours(); 750 if (h >= this.data.time_work_from && h <= this.data.time_work_to) { 751 this.workingHours = true; 752 } 753 754 // ÐозÑмÑм GET-паÑамеÑÑÑ ÑÑÑаниÑÑ Ð² глобаÐ
754»ÑнÑй маÑÑив params (бÑÐ´ÐµÑ Ð´Ð¾ÑÑÑпен из лÑбой ÑÑнкÑии) 755 var strGET = window.location.search.replace('?', ''); 756 window.params = window.location.search 757 .replace('?', '') 758 .split('&') 759 .reduce(function (p, e) { 760 var a = e.split('='); 761 p[decodeURIComponent(a[0])] = decodeURIComponent(a[1]); 762 return p; 763 }, {}); 764 765 var self = this; 766 if (window.params != undefined) { 767 for (var i = self.data.cars.length - 1; i >= 0; i--) { 768 if (self.data.cars[i].id == window.params['car']) { 769 var obj = self.data.cars[i]; 770 self.data.cars.splice(i, 1); 771 self.data.cars.unshift(obj); 772 } 773 } 774 } 775 }, 776 mounted: function () { 777 //СкÑипÑÑ Ð´Ð»Ñ desktop 778 var self = this; 779 if (window.params.car && window.params.scroll) { 780 self.scrollTo('cars'); 781 } 782 if (self.counter) { 783 // Counter START 784 var canvasH = document.getElementById('hours'), 785 canvasM = document.getElementById('minutes'), 786 canvasS = document.getElementById('seconds'), 787 canvasD = document.getElementById('days'), 788 width = canvasH.width, 789 height = canvasH.height, 790 hours = canvasH.getContext('2d'), 791 minutes = canvasM.getContext('2d'), 792 days = canvasD.getContext('2d'), 793 seconds = canvasS.getContext('2d'); 794 // ТолÑина и ÑÐ²ÐµÑ Ð´Ñги 795 var lineWidths; 796 if (self.screenSize().x > 760) { 797 lineWidths = 5; 798 } else { 799 lineWidths = 2; 800 } 801 802 hours.lineWidth = lineWidths; 803 hours.strokeStyle = '#b91b23'; 804 days.lineWidth = lineWidths; 805 days.strokeStyle = '#b91b23'; 806 minutes.lineWidth = lineWidths; 807 minutes.strokeStyle = '#b91b23'; 808 seconds.lineWidth = lineWidths; 809 seconds.strokeStyle = '#b91b23'; 810 811 // Создаем пеÑеменнÑе Ð´Ð»Ñ Ñ ÑÐ°Ð½ÐµÐ½Ð¸Ñ Ð¸Ð½ÑоÑмаÑии о дÑге 812 var centerX = 45, 813 centerY = 45, 814 radius = 42.5, 815 startingAngle = 0 * Math.PI, 816 endingAngle = 2 * Math.PI; 817 818 // РиÑÑем дÑÐ³Ñ Ð½Ð° оÑнове ÑÑой инÑоÑмаÑии 819 hours.arc(centerX, centerY, radius, startingAngle, endingAngle, false); 820 hours.lineCap = 'round'; 821 hours.stroke(); 822 days.arc(centerX, centerY, radius, startingAngle, endingAngle, false); 823 days.lineCap = 'round'; 824 days.stroke(); 825 minutes.arc(centerX, centerY, radius, startingAngle, endingAngle, false); 826 minutes.lineCap = 'round'; 827 minutes.stroke(); 828 seconds.arc(centerX, centerY, radius, startingAngle, endingAngle, false); 829 seconds.lineCap = 'round'; 830 seconds.stroke(); 831 832 setInterval(function () { 833 var now = new Date(); 834 835 var countDownDate = new Date(); 836 countDownDate.setHours(24); 837 countDownDate.setMinutes(0); 838 countDownDate.setSeconds(0); 839 840 var distance = countDownDate.getTime() - now.getTime(); 841 842 let initDate = new Date(); // ÐниÑиализиÑÑем меÑод Date() 843 let getMaxMonthDays = new Date( 844 initDate.getFullYear(), 845 initDate.getMonth() + 1, 846 0 847 ).getDate(); // Узнаем колиÑеÑÑво дней в ÑекÑÑем меÑÑÑе 848 // let newDate; // ÐеÑÐµÐ¼ÐµÐ½Ð½Ð°Ñ Ð´Ð»Ñ Ð´Ð°ÑÑ Ð¾ÐºÐ¾Ð½ÑÐ°Ð½Ð¸Ñ ÑаймеÑа 849 // console.log(self.timerMode); 850 851 if (self.timerMode === 0) { 852 // newDate = new Date(initDate.getFullYear(), initDate.getMonth(), getMaxMonthDays, 23, 59); 853 self.counterD = getMaxMonthDays - now.getDate(); 854 855 // console.log(self.counterD); 856 } 857 if (self.timerMode === 1) { 858 // let newYear = 2019; // Ðод 859 // let newMonth = 0; // ÐеÑÑÑ, знаÑÐµÐ½Ð¸Ñ Ð¾Ñ 0 до 11. 0 - ÑнваÑÑ, 11 - декабÑÑ 860 let newDays = now.getDate() + 2; //15 ÐенÑ, знаÑÐµÐ½Ð¸Ñ Ð¾Ñ 0 до 31 861 862 // newDate = new Date(newYear, newMonth, newDays, 23, 59); 863 self.counterD = newDays - now.getDate(); 864 865 // console.log(self.counterD); 866 } 867 if (self.timerMode === 2) { 868 if ( 869 now.getDate() == 1 || 870 now.getDate() == 4 || 871 now.getDate() == 7 || 872 now.getDate() == 10 || 873 now.getDate() == 13 || 874 now.getDate() == 16 || 875 now.getDate() == 19 || 876 now.getDate() == 22 || 877 now.getDate() == 25 || 878 now.getDate() == 28 || 879 now.getDate() == 31 880 ) { 881 self.counterD = self.zeroNumber(2); 882 } else if ( 883 now.getDate() == 2 || 884 now.getDate() == 5 || 885 now.getDate() == 8 || 886 now.getDate() == 11 || 887 now.getDate() == 14 || 888 now.getDate() == 17 || 889 now.getDate() == 20 || 890 now.getDate() == 23 || 891 now.getDate() == 26 || 892 now.getDate() == 29 893 ) { 894 self.counterD = self.zeroNumber(1); 895 } else if ( 896 now.getDate() == 3 || 897 now.getDate() == 6 || 898 now.getDate() == 9 || 899 now.getDate() == 12 || 900 now.getDate() == 15 || 901 now.getDate() == 18 || 902 now.getDate() == 21 || 903 now.getDate() == 24 || 904 now.getDate() == 27 || 905 now.getDate() == 30 906 ) { 907 self.counterD = self.zeroNumber(0); 908 } 909 910 // console.log(self.counterD); 911 } 912 913 var l = new Date(now.getFullYear(), now.getMonth() + 1, 0); 914 915 // if (now.getDate() > 11) { 916 // console.log(now.getDate()); 917 // self.counterD = 12; 918 // } else { 919 // self.counterD = 9 920 // } 921 922 // self.counterD = self.daysForMonth - now.getDate(); 923 // self.counterD = self.daysForMonth - now.getDate(); 924 // console.log(now.getDate()) 925 // self.counterD = self.zeroNumber(2); 926 self.counterH = self.zeroNumber( 927 Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)) 928 ); 929 self.counterM = self.zeroNumber( 930 Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)) 931 ); 932 self.counterS = self.zeroNumber( 933 Math.floor((distance % (1000 * 60)) / 1000) 934 ); 935 936 days.clearRect(0, 0, width, height); 937 days.beginPath(); 938 days.arc( 939 centerX, 940 centerY, 941 radius, 942 startingAngle, 943 (self.counterH * Math.PI) / 12, 944 false 945 ); 946 days.stroke(); 947 948 hours.clearRect(0, 0, width, height); 949 hours.beginPath(); 950 hours.arc( 951 centerX, 952 centerY, 953 radius, 954 startingAngle, 955 (self.counterH * Math.PI) / 12, 956 false 957 ); 958 hours.stroke(); 959 960 minutes.clearRect(0, 0, width, height); 961 minutes.beginPath(); 962 minutes.arc( 963 centerX, 964 centerY, 965 radius, 966 startingAngle, 967 (self.counterM * Math.PI) / 30, 968 false 969 ); 970 minutes.stroke(); 971 972 seconds.clearRect(0, 0, width, height); 973 seconds.beginPath(); 974 seconds.arc( 975 centerX, 976 centerY, 977 radius, 978 startingAngle, 979 (self.counterS * Math.PI) / 30, 980 false 981 ); 982 seconds.stroke(); 983 }, 1000); 984 // Counter END 985 } 986 987 ymaps.ready(this.initMap); 988 989 // var $slider = $('.slider-top').flickity({ 990 // // options 991 // pageDots: true, 992 // draggable: true, 993 // content: true, 994 // wrapAround: true, 995 // arrowShape: { 996 // x0: 20, 997 // x1: 65, 998 // y1: 40, 999 // x2: 75,
1000 // y2: 30, 1001 // x3: 45 1002 // }, 1003 // on: { 1004 // // ready: function() {}, 1005 // change: function(index) { 1006 // self.changeInfo(index); 1007 // } 1008 // } 1009 // }); 1010 // var $tabs = $('.tabs').flickity({ 1011 // // options 1012 // pageDots: false, 1013 // draggable: true, 1014 // content: true, 1015 // wrapAround: true, 1016 // arrowShape: { 1017 // x0: 10, 1018 // x1: 60, 1019 // y1: 50, 1020 // x2: 65, 1021 // y2: 45, 1022 // x3: 20 1023 // }, 1024 // on: { 1025 // // ready: function() {}, 1026 // change: function(index) { 1027 // setTimeout(function() { 1028 // var model = $('.tabs .is-selected').attr('data-model') 1029 // self.changeModel(index, model) 1030 // }, 300) 1031 1032 // } 1033 // } 1034 // }); 1035 // var $credit = $('.credit_slider').flickity({ 1036 // // options 1037 // pageDots: false, 1038 // draggable: true, 1039 // content: true, 1040 // wrapAround: true, 1041 // arrowShape: { 1042 // x0: 20, 1043 // x1: 65, 1044 // y1: 40, 1045 // x2: 75, 1046 // y2: 30, 1047 // x3: 45 1048 // }, 1049 // on: { 1050 // // ready: function() {}, 1051 // change: function(index) {} 1052 // } 1053 // }); 1054 // $('.tab').click(function() { 1055 // var index = $(this).attr('data-index') 1056 // console.log(index) 1057 // $('.tabs').flickity('select', index) 1058 // }) 1059 1060 //ÐвÑомаÑиÑеÑкое пеÑеклÑÑение пÑнкÑов Ð¼ÐµÐ½Ñ Ð¿Ñи пÑокÑÑÑке ÑÑÑаниÑÑ 1061 // $(document).on("scroll", onScroll); 1062 //ЦенÑÑ ÐºÐ°ÑÑÑ 1063 1064 //ÐниÑиализаÑÐ¸Ñ wowjs 1065 // wow = new WOW({ 1066 // boxClass: 'wow', 1067 // animateClass: 'animated', 1068 // offset: 50, 1069 // mobile: false, 1070 // live: true 1071 // }); 1072 // wow.init(); 1073 //Utm ÑÑÑлки на ÑÐ»Ð°Ð¹Ð´Ñ 1074 if (window.params['model'] != undefined) { 1075 for (var i = 0; i < sets.cars.length; i++) { 1076 if (window.params['model'] == sets.cars[i].id) { 1077 $('#desktop #cars .wrapper .tabs').flickity( 1078 'selectCell', 1079 '[data-model="' + window.params['model'] + '"]', 1080 false, 1081 true 1082 ); 1083 break; 1084 } 1085 setTimeout(function () { 1086 var top = self.getCoords(document.getElementById('cars')).top; 1087 $('body,html').animate( 1088 { 1089 scrollTop: top - 70, 1090 }, 1091 300 1092 ); 1093 }, 300); 1094 } 1095 } 1096 1097 /*$('.phone').on('click', function () { 1098 if (sets.ya_metrika != 0) { 1099 // Fix Ð´Ð»Ñ Ñежима инкогниÑо Mozilla 1100 if (window['yaCounter' + sets.ya_metrika] !== undefined) { 1101 window['yaCounter' + sets.ya_metrika].reachGoal('call_number'); 1102 } 1103 } 1104 });*/ 1105 1106 // ÐнимаÑÐ¸Ñ Ð²Ð°Ð»Ð¸Ð´Ð°Ñии номеÑа по меÑе его ввода 1107 /*$('form input[type="tel"]').keyup(function () { 1108 var vInput = this.value; 1109 $('.circle-loader').addClass('checking'); 1110 if (vInput.indexOf('_') != -1) { 1111 $('.checkmark').removeClass('checked'); 1112 $('.circle-loader').removeClass('load-complete'); 1113 $('.circle-loader').removeClass('wrong'); 1114 $('form .btn').removeClass('right'); 1115 } else { 1116 var checkResult = phoneNumberParser(vInput); 1117 if ( 1118 checkResult['parsingResult'] == 'error' || 1119 checkResult['isPossibleNumber'] == false || 1120 checkResult['isValidNumber'] == false || 1121 checkResult['eFormat'] == 'invalid' 1122 ) { 1123 $('.circle-loader').addClass('load-complete'); 1124 $('.checkmark').removeClass('checked'); 1125 $('.circle-loader').addClass('wrong'); 1126 $('form .btn').removeClass('right'); 1127 $('.circle-loader.wrong').click(function () { 1128 $(this).parent().find('input').val(''); 1129 document.activeElement.blur(); 1130 $(this).parent().find('input').focus(); 1131 }); 1132 } else { 1133 $('.circle-loader').addClass('load-complete'); 1134 $('.checkmark').addClass('checked'); 1135 $('.circle-loader').removeClass('wrong'); 1136 $('form .btn').addClass('right'); 1137 $("input[name='phone']").removeClass('redput'); 1138 } 1139 } 1140 });*/ 1141 $('form .phone').focusout(function () { 1142 $('.circle-loader').removeClass('checking'); 1143 }); 1144 }, 1145}); 1146 1147// try { 1148// var l = document.body.appendChild(document.createElement('canvas')), 1149// c = l.getContext('2d'),
1150// p = new Array(0 | (137.4 * Math.abs(innerWidth / innerHeight))).fill({}); 1151// addEventListener('resize', function () { 1152// (l.width = innerWidth), (l.height = innerHeight); 1153// }), 1154// (l.style.position = 'fixed'), 1155// (l.style.left = l.style.top = 0), 1156// (l.style.pointerEvents = 'none'), 1157// (l.width = innerWidth), 1158// (l.height = innerHeight), 1159// (p = p.map(function (e) { 1160// return { 1161// x: 0 | (Math.random() * l.width), 1162// y: 0 | (Math.random() * l.height), 1163// size: 2 * Math.random() + 1, 1164// speed: Math.random() + 0.5, 1165// opacity: 0.5 * Math.random() + 0.3, 1166// velX: 0, 1167// velY: 0, 1168// step: 0, 1169// stepSize: Math.random() / 160, 1170// }; 1171// })), 1172// (function e() { 1173// requestAnimationFrame(e), 1174// c.clearRect(0, 0, l.width, l.height), 1175// p.forEach(function (e) { 1176// !e.velX && (e.velX = e.speed), 1177// (e.velX *= 0.98), 1178// e.velY <= e.speed && (e.velY = e.speed), 1179// (e.velX += Math.cos((e.step += 0.05)) * e.stepSize), 1180// c.save(), 1181// (c.fillStyle = 'rgba(255,255,255,' + e.opacity + ')'), 1182// (e.x += e.velX), 1183// (e.y += e.velY), 1184// (e.y >= l.height || e.x >= l.width) && 1185// ((e.x = 0 | (Math.random() * l.width)), 1186// (e.y = 0), 1187// (e.size = 2 * Math.random() + 1), 1188// (e.speed = Math.random() + 0.5), 1189// (e.velY = e.speed), 1190// (e.velX = 0), 1191// (e.opacity = 0.5 * Math.random() + 0.3)), 1192// c.beginPath(), 1193// c.arc(e.x, e.y, e.size, 0, 2 * Math.PI), 1194// c.fill(), 1195// c.restore(); 1196// }); 1197// })(); 1198// } catch (e) {}
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.