1document.addEventListener('DOMContentLoaded', function () { 2 if (window.gsap && window.ScrollTrigger) { 3 gsap.registerPlugin(ScrollTrigger); 4 } 5 let $body = document.body; 6 let $main = document.querySelector('.main'); 7 let documentWidth = document.documentElement.clientWidth + 17; 8 let masks = { 9 init: function () { 10 this.phoneMask() 11 }, 12 phoneMask: function (t) { 13 var n = void 0 !== t ? t : $('input.phone'), 14 i = !1, 15 a = {}; 16 n.each(function () { 17 var t = $(this); 18 t.mask && (t.on("paste drop", function () { 19 var t = $(this), 20 n = !t.val(), 21 a = t.get(0), 22 e = a.selectionEnd - a.selectionStart; 23 (n || t.val().length === e) && (i = !0) 24 }), 25 t.on("input", function (t) { 26 var n = $(this), 27 a = n.val(); 28 if (a.startsWith("8")) { 29 if (i && 11 !== a.length) 30 return void (i = !1); 31 i = !1, 32 t.stopPropagation(), 33 a = a.replace("8", "+7"), 34 n.val(a) 35 } 36 }), 37 t.mask("+7(000)000-00-00", a) 38 ) 39 }) 40 } 41 }; 42 masks.init(); 43 44 function submenu() { 45 let $submenu = document.querySelectorAll('.submenu__js>a'); 46 $submenu.forEach(function ($item, indx) { 47 $item.addEventListener('click', function (e) { 48 $item.parentElement.classList.toggle('_active'); 49 e.preventDefault(); 50 }) 51 }) 52 } 53 function headerSubmenu() { 54 let toggles = document.querySelectorAll('.header-submenu-toggle__js'); 55 56 toggles.forEach(function (toggle) { 57 toggle.addEventListener('click', function (e) { 58 let item = toggle.closest('.header-menu__item_has-submenu, .mob-menu__item_has-submenu'); 59 let menu = toggle.closest('.header-menu, .mob-menu'); 60 61 if (!item) { 62 return; 63 } 64 65 document.querySelectorAll('.header-menu__item_has-submenu._active, .mob-menu__item_has-submenu._active').forEach(function (activeItem) { 66 if (activeItem !== item && activeItem.closest('.header-menu, .mob-menu') === menu) { 67 activeItem.classList.remove('_active'); 68 activeItem.querySelector('.header-submenu-toggle__js').setAttribute('aria-expanded', 'false'); 69 } 70 }); 71 72 item.classList.toggle('_active'); 73 toggle.setAttribute('aria-expanded', item.classList.contains('_active') ? 'true' : 'false'); 74 e.preventDefault(); 75 }); 76 }); 77 78 document.addEventListener('click', function (e) { 79 if (e.target.closest('.header-menu__item_has-submenu, .mob-menu__item_has-submenu')) { 80 return; 81 } 82 83 document.querySelectorAll('.header-menu__item_has-submenu._active, .mob-menu__item_has-submenu._active').forEach(function (item) { 84 item.classList.remove('_active'); 85 item.querySelector('.header-submenu-toggle__js').setAttribute('aria-expanded', 'false'); 86 }); 87 }); 88 89 document.addEventListener('keydown', function (e) { 90 if (e.key !== 'Escape') { 91 return; 92 } 93 94 document.querySelectorAll('.header-menu__item_has-submenu._active, .mob-menu__item_has-submenu._active').forEach(function (item) { 95 item.classList.remove('_active'); 96 item.querySelector('.header-submenu-toggle__js').setAttribute('aria-expanded', 'false'); 97 }); 98 }); 99 } 100 function tooltip() { 101 let $tooltip = document.querySelectorAll('.tooltip'); 102 if ($tooltip.length) { 103 $tooltip.forEach(function ($item, indx) { 104 $item.addEventListener('click', function (e) { 105 let $this = e.target; 106 if ($this.classList.contains('toggle-tooltip__js')) { 107 setClass(getSiblings($item), 'remove', '_active'); 108 $this.closest('.tooltip').classList.toggle('_active'); 109 } 110 if ($this.classList.contains('close-tooltip__js')) { 111 $this.closest('.tooltip').classList.remove('_active'); 112 } 113 }) 114 }) 115 } 116 } 117 function accordion() { 118 let $accordions = document.querySelectorAll('.accordions'); 119 if ($accordions.length) { 120 $accordions.forEach(function ($accordion, indx) { 121 if ($accordion.classList.contains('mob')) { 122 if (documentWidth < 1024) { 123 $accordion.addEventListener('click', function (e) { 124 let _this = e.target; 125 126 if (_this.closest('.toggle-accordion-item__js')) { 127 let $item = _this.closest('.toggle-accordion-item__js'); 128 $item.closest('.accordion-item').classList.toggle('_active'); 129 if ($item.closest('.accordion-item').classList.contains('_active')) { 130 $item.closest('.accordion-item').querySelector('.accordion-item__body').style.height = $item.closest('.accordion-item').querySelector('.accordion-item__content').offsetHeight + 'px'; 131 } else { 132 $item.closest('.accordion-item').querySelector('.accordion-item__body').style.height = 0; 133 } 134 } 135 }); 136 } 137 } else { 138 $accordion.addEventListener('click', function (e) { 139 let _this = e.target; 140 141 if (_this.closest('.toggle-accordion-item__js')) { 142 let $item = _this.closest('.toggle-accordion-item__js'); 143 $item.closest('.accordion-item').classList.toggle('_active'); 144 if ($item.closest('.accordion-item').classList.contains('_active')) { 145 $item.closest('.accordion-item').querySelector('.accordion-item__body').style.height = $item.closest('.accordion-item').querySelector('.accordion-item__content').offsetHeight + 'px'; 146 } else { 147 $item.closest('.accordion-item').querySelector('.accordion-item__body').style.height = 0; 148 } 149 } 150 }); 151 } 152 153 }) 154 } 155 } 156 function tabs() { 157 let $tabs = document.querySelectorAll('.tabs'); 158 if ($tabs.length) {
159 $tabs.forEach(function ($tab, indx) { 160 $tab.addEventListener('click', function (e) { 161 let _this = e.target; 162 if (_this.closest('.click-tab-item__js')) { 163 let item = _this.closest('.click-tab-item__js'); 164 let i = getIndex(item, $tab.querySelectorAll('.click-tab-item__js')); 165 siblingsClass(item, 'remove', '_active'); 166 item.classList.add('_active'); 167 setClass($tab.querySelectorAll('.tab-item-block'), 'remove', '_active'); 168 $tab.querySelectorAll('.tab-item-block')[i].classList.add('_active'); 169 } 170 }) 171 }); 172 } 173 } 174 function customSelectBox() { 175 let $items = document.querySelectorAll('.select-box__js'); 176 $items.forEach(function ($item, indx) { 177 $item.addEventListener('click', function (e) { 178 if (e.target.closest('.select-box__head')) { 179 $item.classList.toggle('_active'); 180 if ($item.classList.contains('_active')) { 181 if ($item.classList.contains('sb-anim-height')) { 182 $item.querySelector('.select-box__body').style.height = $item.querySelector('.select-box__content').clientHeight + 'px'; 183 } 184 } else { 185 if ($item.classList.contains('sb-anim-height')) { 186 $item.querySelector('.select-box__body').style.height = 0; 187 } 188 } 189 } 190 if (e.target.closest('.select-box-item__js')) { 191 let $this = e.target.closest('.select-box-item__js'); 192 siblingsClass($this, 'remove', '_active'); 193 $item.querySelector('.select-box__label').textContent = $this.textContent; 194 $this.classList.add('_active'); 195 $item.classList.remove('_active'); 196 if ($item.classList.contains('sb-anim-height')) { 197 $item.querySelector('.select-box__body').style.height = 0; 198 } 199 } 200 }) 201 }) 202 } 203 function burgerMenu() { 204 $('.burger-menu__js').on('click', function () { 205 $(this).toggleClass('_active'); 206 if ($(this).hasClass('_active')) { 207 $('body').addClass('_overflow'); 208 $('.mob-menu').addClass('_active'); 209 } else { 210 $('body').removeClass('_overflow'); 211 $('.mob-menu').removeClass('_active'); 212 } 213 }) 214 } 215 function loadLazyImages(scope) { 216 let lazyImages = []; 217 218 if (scope && scope.matches && scope.matches('img[data-src]')) { 219 lazyImages = [scope]; 220 } else { 221 lazyImages = (scope || document).querySelectorAll('img[data-src]'); 222 } 223 224 lazyImages.forEach(function (img) { 225 if (img.dataset.loaded === 'true') { 226 return; 227 } 228 229 img.src = img.dataset.src; 230 231 if (img.dataset.srcset) { 232 img.srcset = img.dataset.srcset; 233 } 234 235 img.dataset.loaded = 'true'; 236 img.removeAttribute('data-src'); 237 img.removeAttribute('data-srcset'); 238 }); 239 } 240 function initLazyImages() { 241 let lazyImages = document.querySelectorAll('img[data-src]'); 242 if (!lazyImages.length) { 243 return; 244 } 245 246 if (!('IntersectionObserver' in window)) { 247 loadLazyImages(document); 248 return; 249 } 250 251 let roomObserver = new IntersectionObserver(function (entries) { 252 entries.forEach(function (entry) { 253 if (entry.isIntersecting) { 254 loadLazyImages(entry.target); 255 roomObserver.unobserve(entry.target); 256 } 257 }); 258 }, { 259 rootMargin: '500px 0px', 260 threshold: 0.01 261 }); 262 263 let imageObserver = new IntersectionObserver(function (entries) { 264 entries.forEach(function (entry) { 265 if (entry.isIntersecting) { 266 loadLazyImages(entry.target); 267 imageObserver.unobserve(entry.target); 268 } 269 }); 270 }, { 271 rootMargin: '300px 0px', 272 threshold: 0.01 273 }); 274 275 document.querySelectorAll('.our-service-item').forEach(function (item) { 276 if (item.querySelector('img[data-src]')) { 277 roomObserver.observe(item); 278 } 279 }); 280 281 lazyImages.forEach(function (img) { 282 if (!img.closest('.our-service-item')) { 283 imageObserver.observe(img); 284 } 285 }); 286 } 287 288 submenu(); 289 headerSubmenu(); 290 tooltip(); 291 accordion(); 292 tabs(); 293 customSelectBox(); 294 burgerMenu(); 295 initLazyImages(); 296 297 function firstScreen() { 298 let animMedia = document.querySelector('.anim-media__js'); 299 if (animMedia && window.gsap && window.ScrollTrigger) { 300 animMedia.querySelectorAll('.first-screen__img').forEach(function (item, indx) { 301 gsap.to(item.querySelector('img'), { 302 scrollTrigger: { 303 trigger: animMedia.closest('.first-screen'), 304 start: '0% 0%', 305 end: '50% 0%', 306 scrub: 1, 307 pinSpacing: false, 308 onUpdate(self) { 309 item.querySelector('img').style.transform = 'scale(' + self.progress + ')'; 310 if (self.progress < 0.46) { 311 animMedia.querySelectorAll('.first-screen__img')[0].classList.add('_active'); 312 siblingsClass(animMedia.querySelectorAll('.first-screen__img')[0], 'remove', '_active'); 313 } 314 315 if (self.progress >= 0.47) { 316 animMedia.querySelectorAll('.first-screen__img')[1].classList.add('_active'); 317 siblingsClass(animMedia.querySelectorAll('.first-screen__img')[1], 'remove', '_active'); 318 } 319 /* 320 if (self.progress >= 0.46) { 321 animMedia.querySelectorAll('.first-screen__img')[2].classList.add('_active'); 322 siblingsClass(animMedia.querySelectorAll('.first-screen__img')[2], 'remove', '_active'); 323 } 324 if (self.progress >= 0.6) { 325 animMedia.querySelectorAll('.first-screen__img')[3].classList.add('_active'); 326 siblingsClass(animMedia.querySelectorAll('.first-screen__img')[3], 'remove', '_active'); 327 } 328 if (self.progress >= 0.76) { 329 animMedia.querySelectorAll('.first-screen__img')[4].classList.add('_active'); 330 siblingsClass(animMedia.querySelectorAll('.first-screen__img')[4], 'remove', '_active'); 331 } 332 if (self.progress >= 0.92) { 333 animMedia.querySelectorAll('.first-screen__img')[5].classList.add('_active'); 334 siblingsClass(animMedia.querySelectorAll('.first-screen__img')[5], 'remove', '_active'); 335 } 336 */ 337 } 338 } 339 }) 340 }) 341 } 342 343 } 344 function mainBanner(){ 345 let endPosition 346 if (documentWidth > 1024) { 347 endPosition = '50% 0%' 348 } else { 349 endPosition = 'bottom 42%' 350 } 351 // let tl = gsap.timeline({ 352 // scrollTrigger: { 353 // trigger: ".main-banner", 354 // // start: "bottom 90%", 355 // // end: "+=" + remToPx, 356 // start: '0% 0%', 357 // end: endPosition, 358 // scrub: true, 359 // } 360 // }).to(".main-banner-text", {y: "0", ease: "linear" }) 361 } 362 mainBanner() 363 function ourServices() { 364 if (!window.Swiper || !document.querySelector('.our-service-item__slider')) { 365 return; 366 } 367 const swiper = new Swiper('.our-service-item__slider', { 368 loop: false, 369 slidesPerView: 1, 370 spaceBetween: 0, 371 preloadImages: false, 372 // Navigation arrows 373 navigation: { 374 nextEl: '.our-service-item__arrow.right', 375 prevEl: '.our-service-item__arrow.left', 376 }, 377 on: { 378 slideChange: function () { 379 loadLazyImages(this.el.querySelector('.swiper-slide-active')); 380 } 381 }, 382 }); 383 } 384 if (window.Fancybox) { 385 $('.fancy-gallery').each(function (index, item) { 386 Fancybox.bind('[data-fancybox="gallery-' + (index + 1) + '"]', { 387 // '[data-fancybox="gallery-1"]' 388 animated: false,
389 showClass: false, 390 hideClass: false, 391 392 click: false, 393 394 Thumbs: false, 395 Toolbar: false, 396 397 dragToClose: false, 398 399 Image: { 400 zoom: false, 401 }, 402 403 Toolbar: { 404 display: [{ id: "counter", position: "center" }, "close"], 405 }, 406 }); 407 }); 408 } 409 function priceList() { 410 let items = document.querySelectorAll('.price-list-item__value'); 411 items.forEach(function (item, indx) { 412 if (documentWidth >= 1024) { 413 item.addEventListener('mouseenter', function () { 414 document.querySelector('.date-item-' + item.getAttribute('data-id-date')).classList.add('_hover'); 415 item.closest('.price-list__table').querySelectorAll('.price-list-item__value[data-id-date="' + item.getAttribute('data-id-date') + '"]').forEach(function (el, i) { 416 el.classList.add('_hover'); 417 }); 418 }); 419 item.addEventListener('mouseleave', function () { 420 document.querySelector('.date-item-' + item.getAttribute('data-id-date')).classList.remove('_hover'); 421 item.closest('.price-list__table').querySelectorAll('.price-list-item__value[data-id-date="' + item.getAttribute('data-id-date') + '"]').forEach(function (el, i) { 422 el.classList.remove('_hover'); 423 }); 424 }); 425 } 426 427 }) 428 // let cells = document.querySelectorAll('.price-list__cell'); 429 // cells.forEach(function (item, indx) { 430 // if (documentWidth >= 1024) { 431 // item.addEventListener('mouseenter', function () { 432 // item.classList.add('_hover'); 433 // }); 434 // item.addEventListener('mouseleave', function () { 435 // item.classList.remove('_hover'); 436 // }); 437 // } 438 439 // }) 440 441 let openGallegy = document.querySelectorAll('.open-room-gallery__js'); 442 openGallegy.forEach(function (item, indx) { 443 item.addEventListener('click', function () { 444 item.closest('.price-list-item').querySelector('.fancy-gallery a').click(); 445 }); 446 }) 447 448 $('.select-box-item__js').on('click', function () { 449 $('.price-list__date').removeClass('_active'); 450 $('.price-list__date.date-item-' + $(this).data('idDate')).addClass('_active'); 451 452 $('.price-list-item__value').removeClass('_active'); 453 $('.price-list-item__value[data-id-date="' + $(this).data('idDate') + '"]').addClass('_active'); 454 }); 455 456 $('.click-reservation-room__js').on('click', function () { 457 let _idRoom = $(this).data('idRoom'); 458 459 $('.make-reservation-form__select').find('[data-id-room="' + _idRoom + '"]').prop('selected', true); 460 }) 461 } 462 function ourReviews() { 463 if (documentWidth >= 1024) { 464 $('.read-all-review__js').on('click', function () { 465 $(this).closest('.our-reviews-item').find('.our-reviews-item__text').css('max-height', $(this).closest('.our-reviews-item').find('.our-reviews-item__text-body').outerHeight() + 'px') 466 $(this).parent().addClass('hidden'); 467 }); 468 } 469 if (documentWidth < 1024) { 470 $('.read-all-review__js').on('click', function () { 471 let _photo = $(this).closest('.our-reviews-item').find('.our-reviews-item__photo img').attr('src'); 472 let _name = $(this).closest('.our-reviews-item').find('.our-reviews-item__name').text(); 473 let _comment = $(this).closest('.our-reviews-item').find('.our-reviews-item-text-hide').text(); 474 475 if (_photo) { 476 $('.review-popup__photo img').attr('src', _photo); 477 $('.review-popup__photo').removeClass('hidden'); 478 } else { 479 $('.review-popup__photo img').removeAttr('src'); 480 $('.review-popup__photo').addClass('hidden'); 481 } 482 $('.review-popup__name').text(_name); 483 $('.review-popup__text').text(_comment); 484 $('.review-popup').addClass('_active'); 485 $('body').addClass('_overflow'); 486 }); 487 } 488 489 if (!window.Swiper || !document.querySelector('.our-reviews__slider')) { 490 return; 491 } 492 const swiper = new Swiper('.our-reviews__slider', { 493 loop: false, 494 slidesPerView: 'auto', 495 spaceBetween: 0, 496 // Navigation arrows 497 navigation: { 498 nextEl: '.our-reviews__slider-arrow.right', 499 prevEl: '.our-reviews__slider-arrow.left', 500 }, 501 }); 502 503 }
504 function calendar() { 505 let startDay = new Date(); 506 507 $('.toggle-calendar__js').on('click', function () { 508 $('.toggle-calendar__js').removeClass('_active'); 509 $('.calendar').removeClass('_active'); 510 $(this).addClass('_active'); 511 if ($(this).hasClass('_active')) { 512 $(this).siblings('.calendar').addClass('_active') 513 } 514 }) 515 let calendars = document.querySelectorAll('.calendar'); 516 if (!window.VanillaCalendar || !calendars.length) { 517 return; 518 } 519 calendars.forEach(function (item, indx) { 520 const calendarInfoDate = item.querySelector('.vanilla-calendar-info-date'); 521 let _minStart = startDay.getFullYear() + '-' + (startDay.getMonth() + 1 < 10 ? '0' + (startDay.getMonth() + 1) : (startDay.getMonth() + 1)) + '-' + (startDay.getDate() < 10 ? '0' + startDay.getDate() : startDay.getDate()); 522 const calendar = new VanillaCalendar(item, { 523 settings: { 524 lang: 'ru', 525 iso8601: true, 526 visibility: { 527 weekNumbers: true, 528 }, 529 range: { 530 min: _minStart, 531 }, 532 }, 533 actions: { 534 clickDay(e, dates) { 535 let currentDate = new Date(dates[0]) 536 // calendarInfoDate.innerText = dates[0] ? currentDate.toLocaleDateString() : '«Day not selected»'; 537 $(item).siblings('.toggle-calendar__js').val(dates[0] ? currentDate.toLocaleDateString() : '--.--.--'); 538 $(item).removeClass('_active'); 539 $(item).siblings('.toggle-calendar__js').removeClass('_active'); 540 }, 541 }, 542 DOMTemplates: { 543 default: ` 544 <div class="vanilla-calendar-header"> 545 <div class="vanilla-calendar-header__content "> 546 <#Month /> | <#Year /> 547 </div> 548 <#ArrowPrev /> 549 <#ArrowNext /> 550 </div> 551 <div class="vanilla-calendar-wrapper"> 552 <#WeekNumbers /> 553 <div class="vanilla-calendar-content"> 554 <#Week /> 555 <#Days /> 556 </div> 557 </div> 558 <#ControlTime /> 559 `, 560 month: ` 561 <div class="vanilla-calendar-header"> 562 <div class="vanilla-calendar-header__content"> 563 <#Month /> | <#Year /> 564 </div> 565 </div> 566 <div class="vanilla-calendar-wrapper"> 567 <div class="vanilla-calendar-content"> 568 <#Months /> 569 </div> 570 </div> 571 `, 572 year: ` 573 <div class="vanilla-calendar-header"> 574 <div class="vanilla-calendar-header__content"> 575 <#Month /> | <#Year /> 576 </div> 577 <#ArrowPrev /> 578 <#ArrowNext /> 579 </div> 580 <div class="vanilla-calendar-wrapper"> 581 <div class="vanilla-calendar-content"> 582 <#Years /> 583 </div> 584 </div> 585 `, 586 }, 587 }); 588 calendar.init(); 589 590 }) 591 592 const divСalendarIn = document.querySelector('.field-formreservation-date_in'); 593 const divСalendarOut = document.querySelector('.field-formreservation-date_out'); 594 document.addEventListener('click', (e) => { 595 const withinBoundariesIn = e.composedPath().includes(divСalendarIn); 596 const withinBoundariesOut = e.composedPath().includes(divСalendarOut); 597 598 if (!withinBoundariesIn) { 599 $(divСalendarIn).find('.toggle-calendar__js').removeClass('_active'); 600 $(divСalendarIn).find('.vanilla-calendar_default').removeClass('_active'); 601 } 602 if (!withinBoundariesOut) { 603 $(divСalendarOut).find('.toggle-calendar__js').removeClass('_active'); 604 $(divСalendarOut).find('.vanilla-calendar_default').removeClass('_active'); 605 } 606 }) 607 } 608 function ourInfrastructure() { 609 if (!window.Swiper || !document.querySelector('.our-infrastructure__slider')) { 610 return; 611 } 612 const swiper = new Swiper('.our-infrastructure__slider', { 613 loop: false, 614 speed: 1000, 615 effect: 'slider', 616 slidesPerView: 'auto', 617 spaceBetween: 0, 618 centeredSlides: false, 619 initialSlide: 0, 620 // Navigation arrows 621 navigation: { 622 nextEl: '.our-infrastructure__slider-arrow.right', 623 prevEl: '.our-infrastructure__slider-arrow.left', 624 }, 625 breakpoints: { 626 1024: { 627 centeredSlides: true, 628 allowTouchMove: false, 629 }, 630 }, 631 632 633 634 }); 635 636 637 if (documentWidth < 1024) { 638 const sliderPlaces = new Swiper('.infrastructure-places__slider', { 639 loop: false, 640 slidesPerView: 'auto', 641 spaceBetween: 0, 642 centeredSlides: false, 643 644 645 }); 646 } 647 648 $('.info-about-place__js').on('click', function () {
649 $('.popup-infrastructure-place__way').remove(); 650 let _srcImg = $(this).find('.infrastructure-place-item__img img').attr('src'); 651 let _name = $(this).find('.infrastructure-place-item__name').text(); 652 653 $('.popup-infrastructure-place__name').text(_name); 654 $(this).find('.infrastructure-place-item__way').each(function (indx, item) { 655 $('.popup-infrastructure-place__location').append('<div class="popup-infrastructure-place__way">' + $(item).html() + '</div>'); 656 }) 657 658 $('.popup-infrastructure-place__desc').html($(this).closest('.infrastructure-place-item').find('.infrastructure-place-item-info').html()) 659 660 $('.popup-infrastructure-place__img img').attr('src', _srcImg); 661 if ($('.popup-infrastructure-place__img img').outerHeight() <= 400 && documentWidth >= 1024) { 662 $('.popup-infrastructure-place__content').css('grid-template-columns', '1fr'); 663 } else { 664 $('.popup-infrastructure-place__content').css('grid-template-columns', ''); 665 } 666 667 $('.popup-infrastructure-place').addClass('_active'); 668 $('body').addClass('_overflow'); 669 }); 670 } 671 $('.close-popup__js').on('click', function () { 672 $('.popup').removeClass('_active'); 673 $('body').removeClass('_overflow'); 674 }); 675 $('.open-callback-popup__js').on('click', function () { 676 $('.callback-popup').addClass('_active'); 677 $('body').addClass('_overflow'); 678 $('.header').removeClass('anim-hide'); 679 }); 680 $('.open-popup-write-review__js').on('click', function () { 681 $('.popup-write-review').addClass('_active'); 682 $('body').addClass('_overflow'); 683 }) 684 var getUrlParameter = function getUrlParameter(sParam) { 685 let sPageURL = decodeURIComponent(window.location.search.substring(1)), 686 sURLVariables = sPageURL.split('&'), 687 sParameterName, 688 i; 689 690 for (i = 0; i < sURLVariables.length; i++) { 691 sParameterName = sURLVariables[i].split('='); 692 693 if (sParameterName[0] === sParam) { 694 return sParameterName[1] === undefined ? true : sParameterName[1]; 695 } 696 } 697 }; 698 function scrollToLoad() { 699 let getScroll = getUrlParameter('scroll'); 700 if (getScroll) { 701 $('html, body').animate({ scrollTop: $('#' + getScroll).offset().top - 100 }, 1000); 702 } 703 } 704 setTimeout(scrollToLoad, 1000); 705 $(".click-scrollto__js").on('click', function () { 706 let elementClick; 707 let orderQty; 708 let minMarginTop = 70; 709 if ($(this).closest('.mob-menu')) { 710 $('.burger-menu__js').removeClass('_active'); 711 $('.mob-menu').removeClass('_active'); 712 $('body').removeClass('_overflow'); 713 } 714 if ($(this).data('offset')) { 715 minMarginTop = $(this).data('offset'); 716 } 717 if ($(this).data('idScroll')) { 718 elementClick = '#' + $(this).data('idScroll'); 719 } else { 720 elementClick = $(this).attr("href"); 721 } 722 let destination = $(elementClick).offset().top - minMarginTop; 723 $('html,body').stop().animate({ scrollTop: destination }, 1000); 724 return false; 725 }); 726 727 let scrollPos = 0; 728 $(window).scroll(function () { 729 let st = $(this).scrollTop(); 730 if (st > scrollPos++) { 731 // if (st + 100 > ($('.footer').offset().top)) { 732 // $('.header').removeClass('anim-hide'); 733 734 // } else { 735 // $('.header').addClass('anim-hide'); 736 737 // } 738 // $('.header').addClass('anim-hide'); 739 740 } else if (st < scrollPos--) { 741 $('.header').removeClass('anim-hide'); 742 } 743 if (st === 0) { 744 $('.header').removeClass('anim-hide'); 745 746 } 747 scrollPos = st; 748 }); 749 750 firstScreen(); 751 ourServices(); 752 priceList(); 753 ourReviews();
754 calendar(); 755 ourInfrastructure(); 756 757 758 let popup = $('.popup'); 759 $(document).mouseup(function (e) { 760 if (popup.has(e.target).length === 0) { 761 popup.removeClass('_active'); 762 $('body').removeClass('_overflow'); 763 } 764 }); 765 let ESC = 27; 766 $(window).on('keydown', function (e) { 767 if (e.keyCode === ESC) { 768 popup.removeClass('_active'); 769 $('body').removeClass('_overflow'); 770 } 771 }); 772 773 774 function oAjax(url, $item) { 775 let oAjaxCollections = new XMLHttpRequest(); 776 oAjaxCollections.open("POST", url, true); 777 oAjaxCollections.setRequestHeader('Content-type', 'application/x-www-form-urlecoded; charset=utf-8') 778 779 function getData() { 780 if ((oAjaxCollections.readyState === 4) && (oAjaxCollections.status === 200)) { 781 $item.insertAdjacentHTML('beforeEnd', oAjaxCollections.responseText) 782 } 783 } 784 785 oAjaxCollections.addEventListener('readystatechange', getData); 786 787 oAjaxCollections.send(); 788 } 789 function strToHtml(str) { 790 return new DOMParser().parseFromString(str, "text/html").body.children; 791 } 792 function getSiblings(elem) { 793 let siblings = []; 794 let sibling = elem; 795 while (sibling.previousSibling) { 796 sibling = sibling.previousSibling; sibling.nodeType == 1 && siblings.push(sibling); 797 } 798 sibling = elem; 799 while (sibling.nextSibling) { 800 sibling = sibling.nextSibling; sibling.nodeType == 1 && siblings.push(sibling); 801 } return siblings; 802 } 803 function getSiblingsLeft(elem) { 804 let siblings = []; 805 let sibling = elem; 806 while (sibling.previousSibling) { 807 sibling = sibling.previousSibling; sibling.nodeType == 1 && siblings.push(sibling); 808 } return siblings; 809 } 810 function getSiblingsRight(elem) { 811 let siblings = []; 812 let sibling = elem; 813 while (sibling.nextSibling) { 814 sibling = sibling.nextSibling; sibling.nodeType == 1 && siblings.push(sibling); 815 } return siblings; 816 } 817 function siblingsClass(item, action, nameClass) { 818 getSiblings(item).forEach(function (el, indx) { 819 if (action === 'remove') { 820 el.classList.remove(nameClass); 821 } else if (action === 'add') { 822 el.classList.add(nameClass); 823 } else { 824 el.classList.toggle(nameClass); 825 } 826 }) 827 } 828 function setClass($items, action, nameClass) { 829 $items.forEach(function (el, indx) { 830 if (action === 'remove') { 831 el.classList.remove(nameClass); 832 } else if (action === 'add') { 833 el.classList.add(nameClass); 834 } else { 835 el.classList.toggle(nameClass); 836 } 837 }) 838 } 839 function reverseArr(input) { 840 let ret = new Array; 841 for (var i = input.length - 1; i >= 0; i--) { 842 ret.push(input[i]); 843 } 844 return ret; 845 } 846 function dynamicAdaptive(size) { 847 // ex: data-da="where, size, position" 848 let $items = document.querySelectorAll('[data-da]'); 849 $items.forEach(function ($item, indx) { 850 let _data = $item.getAttribute('data-da').split(','); 851 let _where = _data[0].trim(); 852 let _sizeScreen = _data[1].trim(); 853 let _pos = _data[2].trim(); 854 855 if (size === 'max' && documentWidth <= _sizeScreen) { 856 moveItem(); 857 } 858 if (size === 'min' && documentWidth >= _sizeScreen) { 859 moveItem(); 860 } 861 862 function moveItem() { 863 if (_pos === 'first') { 864 document.querySelectorAll(_where)[indx].insertAdjacentElement('afterbegin', $item); 865 } 866 if (_pos === 'last') { 867 document.querySelectorAll(_where)[indx].insertAdjacentElement('beforeEnd', $item); 868 869 } 870 } 871 }) 872 } 873 dynamicAdaptive('max'); 874 875 function heightNull($items) { 876 $items.forEach(function ($item, indx) { 877 $item.style.height = 0; 878 }) 879 } 880 function maxHeightBlock($items) { 881 let maxHeight = 0; 882 $items.forEach(function ($item, indx) { 883 let _height = $item.offsetHeight; 884 if (maxHeight < _height) { 885 maxHeight = _height; 886 } 887 }); 888 setTimeout(() => { 889 $items.forEach(function ($item, indx) { 890 $item.style.height = maxHeight + 'px'; 891 }) 892 }, 50); 893 } 894 function numberWithSpaces(x) { 895 return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " "); 896 } 897 function getIndex(_this, items) { 898 let i; 899 items.forEach(function (item, indx) { 900 if (_this === item) { 901 i = indx; 902 } 903 }) 904 return i; 905 } 906 function getCoords(elem) { 907 let box = elem.getBoundingClientRect(); 908 909 let body = document.body; 910 let docEl = document.documentElement; 911 912 let scrollTop = window.pageYOffset || docEl.scrollTop || body.scrollTop; 913 let scrollLeft = window.pageXOffset || docEl.scrollLeft || body.scrollLeft; 914 915 let clientTop = docEl.clientTop || body.clientTop || 0; 916 let clientLeft = docEl.clientLeft || body.clientLeft || 0; 917 918 let top = box.top + scrollTop - clientTop; 919 let left = box.left + scrollLeft - clientLeft; 920 921 return { 922 top: top, 923 left: left 924 }; 925 } 926 927 function elHover(item) { 928 929 item.addEventListener('mouseenter', function (e) { 930 item.classList.add('_hover'); 931 }) 932 item.addEventListener('mouseleave', function (e) { 933 item.classList.remove('_hover'); 934 }); 935 } 936
937 $(document).on('click', function () { 938 if (window.ScrollTrigger) { 939 setTimeout(() => { 940 ScrollTrigger.refresh(); 941 }, 300); 942 } 943 }); 944 945 if (window.SmoothScroll) { 946 SmoothScroll({ 947 // ÐÑÐµÐ¼Ñ ÑкÑолла 400 = 0.4 ÑекÑÐ½Ð´Ñ 948 animationTime: 900, 949 // Ð Ð°Ð·Ð¼ÐµÑ Ñага в пикÑелÑÑ 950 stepSize: 50, 951 // ÐополниÑелÑнÑе наÑÑÑойки: 952 // УÑкоÑение 953 accelerationDelta: 130, 954 // ÐакÑималÑное ÑÑкоÑение 955 accelerationMax: 1, 956 // ÐоддеÑжка клавиаÑÑÑÑ 957 keyboardSupport: true, 958 // Шаг ÑкÑолла ÑÑÑелками на клавиаÑÑÑе в пикÑелÑÑ 959 arrowScroll: 50, 960 // Pulse (less tweakable) 961 // ratio of "tail" to "acceleration" 962 pulseAlgorithm: false, 963 pulseScale: 4, 964 pulseNormalize: 1, 965 // ÐоддеÑжка ÑаÑпада 966 touchpadSupport: true, 967 }) 968 } 969}); 970 971 function getCookie(name) { 972 const matches = document.cookie.match( 973 new RegExp('(?:^|; )' + name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '=([^;]*)') 974 ); 975 return matches ? decodeURIComponent(matches[1]) : undefined; 976 } 977 978 function setCookie(name, value, options = {}) { 979 options = { 980 path: '/', 981 ...options 982 }; 983 984 if (options.expires instanceof Date) { 985 options.expires = options.expires.toUTCString(); 986 } 987 988 let updatedCookie = encodeURIComponent(name) + "=" + encodeURIComponent(value); 989 990 for (let optionKey in options) { 991 updatedCookie += "; " + optionKey; 992 let optionValue = options[optionKey]; 993 if (optionValue !== true) { 994 updatedCookie += "=" + optionValue; 995 } 996 } 997 998 document.cookie = updatedCookie; 999 } 1000 1001 function cookiePopup() { 1002 const block = document.querySelector('.cookies-warn'); 1003 const acceptButton = document.querySelector('.js_accept_cookies'); 1004 if (!block || !acceptButton) { 1005 return; 1006 } 1007 1008 // ð еÑли cookie Ð½ÐµÑ â показÑваем 1009 if (getCookie('cookieConsent') !== 'on') { 1010 block.classList.add('_active'); 1011 } 1012 1013 // ð клик 1014 acceptButton.addEventListener('click', function () { 1015 let date = new Date(); 1016 date.setTime(date.getTime() + (30 * 24 * 60 * 60 * 1000)); 1017 1018 setCookie('cookieConsent', 'on', { expires: date }); 1019 1020 block.classList.remove('_active'); 1021 }); 1022 } 1023 1024 document.addEventListener('DOMContentLoaded', cookiePopup);
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.