1const NAME = 'security'; 2const VALUE = '1'; 3var f_hotels_place = ''; 4var f_hotels_type = ''; 5 6var f_food_place = ''; 7var f_food_kitchen = ''; 8var f_food_type = ''; 9 10var f_tours_season = ''; 11var f_tours_type = ''; 12var f_tours_long = ''; 13var f_tours_price_from = ''; 14var f_tours_price_to = ''; 15 16var f_tours_season2 = ''; 17var f_tours_long2 = ''; 18var f_tours_price_from2 = ''; 19var f_tours_price_to2 = ''; 20 21var f_events_date = ''; 22var f_events_cats = ''; 23 24var stars = 0; 25 26var lastScrollTop = 0; 27window.addEventListener('scroll', function() { 28 if (pageYOffset > lastScrollTop){ 29 if(60 < pageYOffset){ 30 if(100 > pageYOffset){ 31 var opacity = (100 - (pageYOffset/5))/100; 32 document.querySelector('header').style.opacity = opacity; 33 } else { 34 document.querySelector('header').style.opacity = 1; 35 document.querySelector('header').classList.add('opacity'); 36 } 37 } else { 38 document.querySelector('header').style.opacity = 1; 39 document.querySelector('header').classList.add('scroll'); 40 document.querySelector('header').classList.remove('opacity'); 41 } 42 } else { 43 document.querySelector('header').style.opacity = 1; 44 document.querySelector('header').classList.remove('opacity'); 45 } 46 if (pageYOffset == 0){ 47 document.querySelector('header').classList.remove('scroll'); 48 document.querySelector('header').style.opacity = 1; 49 document.querySelector('header').classList.remove('opacity'); 50 } 51 lastScrollTop = pageYOffset <= 0 ? 0 : pageYOffset; 52}); 53 54/* 55document.querySelector('.covid-block__cross').addEventListener('click', function() { 56 document.querySelector('.covid-container').style.display = 'none'; 57 document.querySelector('.header__menu').classList.add('small'); 58}); 59*/ 60 61function filterOperators(){ 62 var ids = ''; 63 document.querySelectorAll('.filter-block__input-block.active').forEach(function (item) { 64 if('' != ids){ 65 ids = ids + ','; 66 } 67 ids = ids + item.dataset.id; 68 }); 69 70 var request = new XMLHttpRequest(); 71 request.onreadystatechange = function() { 72 if (this.readyState == 4 && this.status == 200) { 73 document.getElementById('operators_list').innerHTML = this.responseText; 74 document.querySelectorAll('.tour-operators__block').forEach(function (item) { 75 item.addEventListener('click', function () { 76 let selected_mail = this.dataset.mail; 77 document.querySelector('.tour-operators-popup').classList.add('active'); 78 document.getElementById('touroper-'+item.dataset.id).classList.add('active'); 79 }) 80 }); 81 82 document.querySelectorAll('.tour-operators-popup__cross').forEach(function (item) { 83 item.addEventListener('click', function () { 84 document.querySelector('.tour-operators-popup').classList.remove('active'); 85 document.querySelectorAll('.tour-operators-popup__block').forEach(function (item) { 86 item.classList.remove('active'); 87 }); 88 }) 89 }); 90 } 91 }; 92 request.open('GET', '/ajax/operators.php?ids='+ids); 93 request.send(); 94} 95 96if(document.querySelector('.estimate__button')){ 97 document.querySelectorAll('.estimate__stars .estimate__star').forEach(function(item) { 98 item.addEventListener('click', function() { 99 stars = item.dataset.val; 100 for(i = 1; i < 6; i++){ 101 if(i < parseInt(stars)+1){ 102 document.querySelector('.es' + i + ' .estimate__star-empty').style.display = 'none'; 103 document.querySelector('.es' + i + ' .estimate__star-full').style.display = 'block'; 104 } else { 105 document.querySelector('.es' + i + ' .estimate__star-full').style.display = 'none'; 106 document.querySelector('.es' + i + ' .estimate__star-empty').style.display = 'block'; 107 } 108 } 109 }); 110 }); 111 112 document.querySelector('.estimate__button').addEventListener('click', function() { 113 var xmlHttp = new XMLHttpRequest(); 114 xmlHttp.open("GET", "/ajax/vote.php?id="+voteid+"&stars="+stars, false); 115 xmlHttp.send(null); 116 document.querySelector('.estimate__cross').click(); 117 document.querySelector('.rating__estimate').remove(); 118 document.cookie = "vote_"+voteid+"=voted; expires=Sat, 01 Dec 2035 12:00:00 UTC; path=/"; 119 }); 120 121 document.querySelector('.feedback__form').addEventListener("submit", function(event) { 122 event.preventDefault(); 123 124 const XHR = new XMLHttpRequest(); 125 const FD = new FormData(document.querySelector(".feedback__form")); 126
127 XHR.open('POST', "/ajax/review.php?id="+voteid); 128 XHR.send(FD); 129 130 document.querySelector('.feedback__cross').click(); 131 }); 132 133 document.querySelector('.rating__feedback').addEventListener('click', function() { 134 document.querySelector('.rating__popup-filter').classList.add('active'); 135 document.querySelector('.feedback').classList.add('active'); 136 }); 137 138 document.querySelector('.feedback__cross').addEventListener('click', function() { 139 document.querySelector('.rating__popup-filter').classList.remove('active'); 140 document.querySelector('.feedback').classList.remove('active'); 141 }); 142 143 document.querySelector('.rating__estimate').addEventListener('click', function() { 144 document.querySelector('.rating__popup-filter').classList.add('active'); 145 document.querySelector('.estimate').classList.add('active'); 146 }); 147 148 document.querySelector('.estimate__cross').addEventListener('click', function() { 149 document.querySelector('.rating__popup-filter').classList.remove('active'); 150 document.querySelector('.estimate').classList.remove('active'); 151 }); 152} 153 154if(document.querySelector('.header__lang')){ 155 document.querySelector('.header__lang').addEventListener('click', function() { 156 document.querySelector('.header__lang').classList.toggle('active'); 157 }); 158} 159 160document.querySelector('.header__burger').addEventListener('click', function() { 161 document.querySelector('header').classList.toggle('active'); 162}); 163 164if(document.querySelector('.header__burger') && 1220 > window.innerWidth){ 165 document.querySelector('.header__menu-item-tourist').addEventListener('click', function() { 166 document.querySelector('.header__menu-item-tourist').classList.toggle('active'); 167 }); 168} 169 170document.querySelector('.header__search').addEventListener('click', function() { 171 document.querySelector('.search__popup').classList.add('active'); 172}); 173 174document.querySelectorAll('.search__checkbox-type').forEach(function(item) { 175 item.addEventListener('click', function() { 176 item.classList.toggle('active'); 177 document.querySelectorAll('.search__result-block').forEach(function(item2) { 178 item2.classList.remove('active'); 179 }); 180 document.querySelectorAll('.search__filter-checkbox-block').forEach(function(item3) { 181 if (item3.classList.contains('active')){ 182 document.querySelector('.search__checkbox-all').classList.remove('active'); 183 var className = item3.dataset.type; 184 if(className != ''){ 185 document.querySelectorAll('.search__result-block-' + className).forEach(function(item4) { 186 item4.classList.add('active'); 187 }); 188 } 189 } 190 }); 191 }); 192}); 193 194document.querySelector('.search__checkbox-all').addEventListener('click', function() { 195 document.querySelector('.search__checkbox-all').classList.toggle('active'); 196 document.querySelectorAll('.search__result-block').forEach(function(item) { 197 if (document.querySelector('.search__checkbox-all.active')){ 198 item.classList.add('active'); 199 document.querySelectorAll('.search__filter-checkbox-block').forEach(function(item2) { 200 item2.classList.remove('active'); 201 document.querySelector('.search__checkbox-all').classList.add('active'); 202 }); 203 } 204 }); 205}); 206 207if(document.querySelector('.search__filter-mob')){ 208 document.querySelectorAll('.search__filter-mob').forEach(function(item) { 209 item.addEventListener('click', function() { 210 item.classList.toggle('active'); 211 }); 212 }); 213 document.querySelectorAll('.search__filter-mob-list-item').forEach(function(item) { 214 item.addEventListener('click', function() { 215 this.parentNode.querySelectorAll('.search__filter-mob-list-item').forEach(function(item2) { 216 item2.classList.remove('hidden'); 217 }); 218 item.classList.add('hidden'); 219 this.parentNode.parentNode.childNodes[1].innerHTML = item.innerHTML; 220 this.parentNode.parentNode.classList.add('fixed'); 221 document.querySelectorAll('.search__result-block').forEach(function(item2) { 222 item2.classList.remove('active'); 223 }); 224 var className = item.dataset.type; 225 if(className == 'all'){ 226 document.querySelectorAll('.search__result-block').forEach(function(item2) { 227 item2.classList.add('active'); 228 }); 229 } else { 230 document.querySelectorAll('.search__result-block-' + className).forEach(function(item3) { 231 item3.classList.add('active'); 232 }); 233 } 234 }); 235 }); 236} 237 238function renderFilters() { 239 //Ñзнаем кол-во вÑÐµÑ Ð±Ð»Ð¾ÐºÐ¾Ð² и возвÑаÑаем ÑиÑло в html 240 var i = 0; 241 document.querySelectorAll('.search__result-block').forEach(function(item) { 242 i++; 243 }); 244 document.querySelector('.search__checkbox-all .search__filter-checkbox-number').innerHTML = i; 245 //Ñзнаем кол-во oпÑеделеннÑÑ Ð±Ð»Ð¾ÐºÐ¾Ð² и возвÑаÑаем ÑиÑло в html 246 document.querySelectorAll('.search__checkbox-type').forEach(function(item3) { 247 var j = 0; 248 var className = item3.dataset.type; 249 document.querySelectorAll('.search__result-block-' + className).forEach(function(item) { 250 j++; 251 }); 252 document.querySelector('.search__checkbox-number-' + className).innerHTML = j; 253 }); 254} 255 256function doSearch() { 257 var request = new XMLHttpRequest(); 258 request.onreadystatechange = function() { 259 if (this.readyState == 4 && this.status == 200) { 260 document.querySelector('.search__start-block').classList.remove('active'); 261 if (this.responseText != '0') { 262 document.querySelector('.search__results-block').classList.add('active'); 263 document.querySelector('.search__results').innerHTML = this.responseText; 264 renderFilters(); 265 } else { 266 document.querySelector('.search__error-block').classList.add('active'); 267 } 268 } 269 }; 270 request.open('GET', 'https://visitkamchatka.ru/ajax/search.php?q='+document.getElementById('search_q').value); 271 request.send(); 272} 273 274document.querySelector('.search__block-serch').addEventListener('click', function() { 275 doSearch(); 276}); 277 278document.getElementById("search_q").addEventListener("keypress", function(event) { 279 if (event.key === "Enter") { 280 doSearch(); 281 } 282}); 283 284document.querySelectorAll('.search__options a').forEach(function(item) { 285 item.addEventListener('click', function() { 286 document.getElementById('search_q').value = item.dataset.id; 287 doSearch(); 288 }); 289}); 290 291/* 292document.querySelector('.search__checkbox-activities').addEventListener('click', function() { 293 document.querySelectorAll('.search__result-block').forEach(function(item) { 294 if (document.querySelector('.search__checkbox-activities.active')){ 295 document.querySelector('.search__checkbox-all').classList.remove('active'); 296 item.classList.remove('active'); 297 document.querySelectorAll('.search__result-block-activities').forEach(function(item2) { 298 item2.classList.add('active'); 299 300 }); 301 } else { 302 document.querySelectorAll('.search__result-block-activities').forEach(function(item2) { 303 item2.classList.remove('active'); 304 }); 305 } 306 }); 307}); 308*/ 309 310document.querySelector(".video-slider") && new Glide(".video-slider", { 311 type: "carousel", 312 perView: 2, 313 gap: 20, 314 breakpoints: { 315 768: { 316 perView: 1, 317 peek: 30 318 } 319 } 320}).mount(); 321 322document.querySelector(".fly-kamchatka__slider") && new Glide(".fly-kamchatka__slider", { 323 type: "carousel", 324 perView: 4, 325 gap: 20, 326 breakpoints: { 327 1024: { 328 perView: 2, 329 peek: 30 330 }, 331 540: { 332 perView: 1, 333 peek: 30 334 } 335 } 336}).mount(); 337 338document.querySelector(".fly-kamchatka__slider2") && new Glide(".fly-kamchatka__slider2", { 339 type: "carousel", 340 perView: 4, 341 gap: 20, 342 breakpoints: { 343 1024: { 344 perView: 2, 345 peek: 30 346 }, 347 540: { 348 perView: 1, 349 peek: 30 350 } 351 } 352}).mount(); 353 354if(document.querySelector('.classes__switch')){ 355 document.querySelectorAll('.classes__switch-item').forEach(function(item) { 356 item.addEventListener('click', function() { 357 document.querySelectorAll('.classes__switch-item').forEach(function(item2) { 358 item2.classList.remove('active'); 359 }); 360 document.querySelectorAll('.classes__container').forEach(function(item2) { 361 item2.classList.remove('active'); 362 }); 363 document.getElementById('switch-'+item.dataset.id).classList.add('active'); 364 item.classList.add('active'); 365 }); 366 }); 367} 368 369if(document.querySelector('.to-switch')){ 370 document.querySelectorAll('.to-switch__item').forEach(function(item) { 371 item.addEventListener('click', function() { 372 document.querySelectorAll('.to-switch__item').forEach(function(item2) { 373 item2.classList.remove('active'); 374 }); 375 document.querySelectorAll('.to-container').forEach(function(item2) { 376 item2.classList.remove('active'); 377 }); 378 document.getElementById('switch-'+item.dataset.id).classList.add('active'); 379 item.classList.add('active'); 380 }); 381 }); 382} 383 384if(document.querySelector('.passports-switch')){ 385 document.querySelectorAll('.passports-switch__item').forEach(function(item) { 386 item.addEventListener('click', function() { 387 document.querySelectorAll('.passports-switch__item').forEach(function(item2) { 388 item2.classList.remove('active'); 389 }); 390 document.querySelectorAll('.passports-block').forEach(function(item2) { 391 item2.classList.remove('active'); 392 });
393 document.getElementById('passports-switch-'+item.dataset.id).classList.add('active'); 394 item.classList.add('active'); 395 }); 396 }); 397} 398 399if(document.querySelector('.article__slider')){ 400 401 var count = 0; 402 document.querySelectorAll('.article__additional-slide').forEach(function(item3) { 403 count++; 404 }); 405 406 if (count > 5){ 407 count = 5; 408 } 409 410 var as1 = new Glide('.article__slider', { type: 'carousel', animationDuration: 1000, perView: 1, gap: 100 }).mount(); 411 var as2 = new Glide('.article__additional-slider', { type: 'carousel', animationDuration: 1000, perView: count, gap: 20 }).mount(); 412 413 as1.on('run', (e) => { 414 if("=" != e.direction){ 415 as2.go(e.direction); 416 } 417 }); 418 419 as2.on('run', (e) => { 420 if("=" != e.direction){ 421 as1.go(e.direction); 422 } 423 }); 424 425 document.querySelectorAll('.article__additional-slide').forEach(function(item) { 426 item.addEventListener('click', function() { 427 as1.go('='+item.dataset.id); 428 as2.go('='+(item.dataset.id)); 429 }); 430 }); 431} 432 433if(document.querySelector('.tours__container')){ 434 document.querySelector('.news__show').addEventListener('click', function() { 435 var i = 0; 436 document.querySelectorAll('.tours-block.hidden').forEach(function(item) { 437 if (i < 12){ 438 item.classList.add('active'); 439 item.classList.remove('hidden'); 440 i++; 441 } 442 }); 443 document.querySelectorAll('.tours-block.hidden').forEach(function(item) { 444 j++; 445 }); 446 if (i == 0 || i != 12 || j == 0){ 447 document.querySelector('.news__show').style.display = 'none'; 448 } 449 }); 450} 451 452if(document.querySelector('.food__container')){ 453 document.querySelector('.news__show').addEventListener('click', function() { 454 var i = 0; 455 document.querySelectorAll('.food-block.hidden').forEach(function(item) { 456 if (i < 12){ 457 item.classList.add('active'); 458 item.classList.remove('hidden'); 459 i++; 460 } 461 }); 462 document.querySelectorAll('.food-block.hidden').forEach(function(item) { 463 j++; 464 }); 465 if (i == 0 || i != 12 || j == 0){ 466 document.querySelector('.news__show').style.display = 'none'; 467 } 468 }); 469} 470 471if(document.querySelector('.hotels__container')){ 472 document.querySelector('.news__show').addEventListener('click', function() { 473 var i = 0; 474 document.querySelectorAll('.hotels-block.hidden').forEach(function(item) { 475 if (i < 12){ 476 item.classList.add('active'); 477 item.classList.remove('hidden'); 478 i++; 479 } 480 }); 481 document.querySelectorAll('.hotels-block.hidden').forEach(function(item) { 482 j++; 483 }); 484 if (i == 0 || i != 12 || j == 0){ 485 document.querySelector('.news__show').style.display = 'none'; 486 } 487 }); 488} 489 490if(document.querySelector('.travel-ideas-container')){ 491 document.querySelector('.news__show').addEventListener('click', function() { 492 var i = 0; 493 document.querySelectorAll('.travel-ideas__block.hidden').forEach(function(item) { 494 if (i < 12){ 495 item.classList.add('active'); 496 item.classList.remove('hidden'); 497 i++; 498 } 499 }); 500 if (i == 0 || i != 12){ 501 document.querySelector('.news__show').style.display = 'none'; 502 } 503 }); 504} 505 506if(document.querySelector('.video-container')){ 507 document.querySelector('.news__show').addEventListener('click', function() { 508 var i = 0; 509 var j = 0; 510 document.querySelectorAll('.video-block.hidden').forEach(function(item) { 511 if (i < 10){ 512 item.classList.add('active'); 513 item.classList.remove('hidden'); 514 i++; 515 } 516 }); 517 document.querySelectorAll('.video-block.hidden').forEach(function(item) { 518 j++; 519 }); 520 if (i == 0 || i != 10 || j == 0){ 521 document.querySelector('.news__show').style.display = 'none'; 522 } 523 }); 524} 525 526if(document.querySelector('.events__container')){ 527 document.querySelector('.news__show').addEventListener('click', function() { 528 var i = 0; 529 document.querySelectorAll('.developments-block.hidden').forEach(function(item) { 530 if (i < 12){ 531 item.classList.add('active'); 532 item.classList.remove('hidden'); 533 i++; 534 } 535 }); 536 document.querySelectorAll('.developments-block.hidden').forEach(function(item) { 537 j++; 538 }); 539 if (i == 0 || i != 12 || j == 0){ 540 document.querySelector('.news__show').style.display = 'none'; 541 } 542 }); 543} 544 545if(document.querySelector('.museum__container')){ 546 document.querySelector('.news__show').addEventListener('click', function() { 547 var i = 0; 548 document.querySelectorAll('.museum-block.hidden').forEach(function(item) { 549 if (i < 12){ 550 item.classList.remove('hidden'); 551 i++; 552 } 553 }); 554 document.querySelectorAll('.museum-block.hidden').forEach(function(item) { 555 j++; 556 }); 557 if (i == 0 || i != 12 || j == 0){ 558 document.querySelector('.news__show').style.display = 'none'; 559 } 560 }); 561} 562 563if(document.querySelector('.news__container')){ 564 document.querySelector('.news__show').addEventListener('click', function() { 565 document.querySelectorAll('.news__block.hidden').forEach(function(item) { 566 item.classList.add('active'); 567 item.classList.remove('hidden'); 568 }); 569 document.querySelector('.news__show').style.display = 'none'; 570 }); 571} 572 573if(document.querySelector('.registry-container')){ 574 document.querySelectorAll('.news__show').forEach(function(item) { 575 item.addEventListener('click', function() { 576 document.querySelectorAll('.registryG-block.hidden').forEach(function(item2) { 577 item2.classList.remove('hidden'); 578 }); 579 document.querySelectorAll('.news__show').forEach(function(item2) { 580 item2.style.display = 'none'; 581 }); 582 }); 583 }); 584} 585 586if(document.querySelector('.map-slider')){ 587 var half = Math.round(window.outerWidth / 7) 588 var mapSlider = new Glide('.map-slider', { type: 'carousel', animationDuration: 1000, startAt: 1, perView: 3, peek: half, focusAt: 'center', gap: 20, breakpoints: { 589 768: { 590 perView: 1, 591 peek: 30 592 } 593 } 594}).mount(); 595} 596 597if(document.querySelector('.routes-slider')){ 598 var half = Math.round(window.outerWidth / 7) 599 var routesSlider = new Glide('.routes-slider', { type: 'carousel', animationDuration: 1000, startAt: 1, perView: 3, peek: half, focusAt: 'center', gap: 20, breakpoints: { 600 768: { 601 perView: 1, 602 peek: 30 603 } 604 } 605}).mount(); 606} 607 608function filterHotels() { 609 var request = new XMLHttpRequest(); 610 request.onreadystatechange = function() { 611 if (this.readyState == 4 && this.status == 200) { 612 document.querySelector('.hotels__container').innerHTML = this.responseText; 613// document.querySelector('.news__show').remove(); 614 } 615 }; 616 request.open('GET', 'https://visitkamchatka.ru/ajax/hotels.php?place='+f_hotels_place+'&type='+f_hotels_type); 617 request.send(); 618} 619 620if(document.querySelector('#f_hotels_place')){ 621 document.querySelectorAll('#f_hotels_place a').forEach(function(item) { 622 item.addEventListener('click', function() { 623 f_hotels_place = item.dataset.id; 624 filterHotels(); 625 }); 626 }); 627} 628 629if(document.querySelector('#f_hotels_type')){ 630 document.querySelectorAll('#f_hotels_type a').forEach(function(item) { 631 item.addEventListener('click', function() { 632 f_hotels_type = item.dataset.id; 633 filterHotels(); 634 }); 635 }); 636} 637 638function filterFood() { 639 var request = new XMLHttpRequest(); 640 request.onreadystatechange = function() { 641 if (this.readyState == 4 && this.status == 200) { 642 document.querySelector('.food__container').innerHTML = this.responseText; 643// document.querySelector('.news__show').remove(); 644 } 645 }; 646 request.open('GET', 'https://visitkamchatka.ru/ajax/food.php?place='+f_food_place+'&type='+f_food_type+'&kitchen='+f_food_kitchen); 647 request.send(); 648} 649 650if(document.querySelector('#f_food_place')){ 651 document.querySelectorAll('#f_food_place a').forEach(function(item) { 652 item.addEventListener('click', function() { 653 f_food_place = item.dataset.id; 654 filterFood(); 655 }); 656 }); 657} 658 659if(document.querySelector('#f_food_kitchen')){ 660 document.querySelectorAll('#f_food_kitchen a').forEach(function(item) { 661 item.addEventListener('click', function() { 662 f_food_kitchen = item.dataset.id; 663 filterFood(); 664 }); 665 }); 666} 667 668if(document.querySelector('#f_food_type')){ 669 document.querySelectorAll('#f_food_type a').forEach(function(item) { 670 item.addEventListener('click', function() { 671 f_food_type = item.dataset.id; 672 filterFood(); 673 }); 674 }); 675} 676 677function filterTours() { 678 var request = new XMLHttpRequest(); 679 request.onreadystatechange = function() { 680 if (this.readyState == 4 && this.status == 200) { 681 document.querySelector('.tours__container').innerHTML = this.responseText; 682// document.querySelector('.news__show').remove(); 683 } 684 }; 685 //console.log('https://visitkamchatka.ru/ajax/tours.php?season='+f_tours_season+'&type='+f_tours_type+'&long='+f_tours_long+'&price_from='+f_tours_price_from+'&price_to='+f_tours_price_to); 686 request.open('GET', 'https://visitkamchatka.ru/ajax/tours.php?season='+f_tours_season+'&type='+f_tours_type+'&long='+f_tours_long+'&price_from='+f_tours_price_from+'&price_to='+f_tours_price_to); 687 request.send(); 688} 689 690function filterTours2() { 691 document.querySelectorAll('#tours .tour-block').forEach(function(item) { 692 item.style.display = "flex"; 693 if(f_tours_season2 != ''){ 694 if(f_tours_season2 != item.dataset.season){ 695 item.style.display = "none"; 696 } 697 } 698 if(f_tours_long2 != ''){ 699 if(f_tours_long2 != item.dataset.duration){ 700 item.style.display = "none"; 701 } 702 } 703 if(f_tours_price_from2 != '' || f_tours_price_to2 != ''){ 704 if(f_tours_price_from2 > item.dataset.price || f_tours_price_to2 < item.dataset.price){ 705 item.style.display = "none"; 706 } 707 } 708 }); 709} 710 711if(document.querySelector('#f_tours_season2')){ 712 document.querySelectorAll('#f_tours_season2 a').forEach(function(item) { 713 item.addEventListener('click', function() { 714 f_tours_season2 = item.dataset.id; 715 filterTours2(); 716 }); 717 }); 718} 719 720if(document.querySelector('#f_tours_long2')){ 721 document.querySelectorAll('#f_tours_long2 a').forEach(function(item) { 722 item.addEventListener('click', function() { 723 f_tours_long2 = item.dataset.id; 724 filterTours2(); 725 }); 726 }); 727} 728 729if(document.querySelector('#f_tours_season')){ 730 document.querySelectorAll('#f_tours_season a').forEach(function(item) { 731 item.addEventListener('click', function() { 732 f_tours_season = item.dataset.id; 733 filterTours(); 734 }); 735 }); 736} 737 738if(document.querySelector('#f_tours_type')){ 739 document.querySelectorAll('#f_tours_type a').forEach(function(item) { 740 item.addEventListener('click', function() { 741 f_tours_type = item.dataset.id; 742 filterTours(); 743 }); 744 }); 745} 746 747if(document.querySelector('#f_tours_long')){ 748 document.querySelectorAll('#f_tours_long a').forEach(function(item) { 749 item.addEventListener('click', function() { 750 f_tours_long = item.dataset.id; 751 filterTours(); 752 }); 753 }); 754} 755 756function filterEvents() { 757 var request = new XMLHttpRequest(); 758 request.onreadystatechange = function() { 759 if (this.readyState == 4 && this.status == 200) { 760 document.querySelector('.events__container').innerHTML = this.responseText; 761// document.querySelector('.news__show').remove(); 762 } 763 }; 764 request.open('GET', 'https://visitkamchatka.ru/ajax/events.php?date='+f_events_date+'&type='+f_events_cats); 765 request.send(); 766} 767 768if(document.querySelector('#events-cats')){ 769 document.querySelectorAll('#events-cats label').forEach(function(item) { 770 item.addEventListener('click', function() { 771 f_events_cats = ''; 772 document.querySelectorAll('#events-cats label').forEach(function(item2) { 773 if(item2.querySelector('input').checked){ 774 if(f_events_cats == ''){ 775 f_events_cats = item2.querySelector('input').dataset.id; 776 } else { 777 f_events_cats = f_events_cats + ',' + item2.querySelector('input').dataset.id; 778 } 779 } 780 }); 781 filterEvents(); 782 }); 783 }); 784} 785 786if(document.querySelector('.filter-block__select')){ 787 document.querySelectorAll('.filter-block__select').forEach(function(item) { 788 item.addEventListener('click', function() { 789 item.classList.toggle('active'); 790 }); 791 }); 792 793 document.querySelectorAll('.filter-block__select-list-item').forEach(function(item) { 794 item.addEventListener('click', function() { 795 this.parentNode.querySelectorAll('.filter-block__select-list-item').forEach(function(item2) { 796 item2.classList.remove('hidden'); 797 }); 798// item.classList.add('hidden'); 799 this.parentNode.parentNode.childNodes[1].innerHTML = item.innerHTML; 800 this.parentNode.parentNode.classList.add('fixed'); 801 }); 802 }); 803} 804 805if(document.getElementById('datepicker')){ 806 const picker = new easepick.create({ 807 element: document.getElementById('datepicker'), 808 css: [ 809 'https://cdn.jsdelivr.net/npm/@easepick/[email protected]/dist/index.css', 810 'https://visitkamchatka.ru/local/templates/2022/css/calendar-style.css', 811 ], 812 lang: 'ru-RU', 813 format: "DD.MM.YYYY", 814 setup(picker) { 815 picker.on('select', (e) => { 816 f_events_date = document.getElementById('datepicker').value; 817 filterEvents(); 818 }); 819 }, 820 }); 821} 822 823if(document.getElementById('range')){ 824 var slider = document.getElementById('range'); 825 var input0 = document.getElementById('price_from'); 826 var input1 = document.getElementById('price_to'); 827 var inputs = [input0, input1]; 828 829 noUiSlider.create(slider, { 830 start: [0, 500000], 831 connect: true, 832 range: { 833 'min': 0, 834 'max': 500000 835 }, 836 format: wNumb({ 837 decimals: 0 838 }) 839 }); 840 841 slider.noUiSlider.on('update', function (values, handle) { 842 inputs[handle].value = values[handle]; 843 f_tours_price_from = document.getElementById('price_from').value; 844 f_tours_price_to = document.getElementById('price_to').value; 845 filterTours(); 846 }); 847 848 document.getElementById('price_from').addEventListener('keyup', function() { 849 if(0 < parseInt(document.getElementById('price_from').value)){ 850 slider.noUiSlider.set([document.getElementById('price_from').value, document.getElementById('price_to').value]); 851 } 852 }); 853 854 document.getElementById('price_to').addEventListener('keyup', function() { 855 slider.noUiSlider.set([document.getElementById('price_from').value, document.getElementById('price_to').value]); 856 }); 857} 858 859if(document.getElementById('range2')){ 860 var slider = document.getElementById('range2'); 861 var input0 = document.getElementById('price_from2'); 862 var input1 = document.getElementById('price_to2'); 863 var inputs = [input0, input1]; 864 865 noUiSlider.create(slider, { 866 start: [0, 500000], 867 connect: true, 868 range: { 869 'min': 0, 870 'max': 500000 871 }, 872 format: wNumb({ 873 decimals: 0 874 }) 875 }); 876 877 slider.noUiSlider.on('update', function (values, handle) { 878 inputs[handle].value = values[handle]; 879 f_tours_price_from2 = document.getElementById('price_from2').value; 880 f_tours_price_to2 = document.getElementById('price_to2').value; 881 filterTours2(); 882 }); 883 884 document.getElementById('price_from2').addEventListener('keyup', function() { 885 if(0 < parseInt(document.getElementById('price_from2').value)){ 886 slider.noUiSlider.set([document.getElementById('price_from2').value, document.getElementById('price_to2').value]); 887 } 888 }); 889 890 document.getElementById('price_to2').addEventListener('keyup', function() { 891 slider.noUiSlider.set([document.getElementById('price_from2').value, document.getElementById('price_to2').value]); 892 }); 893} 894 895if(document.querySelector('.faq-block__question')){ 896 document.querySelectorAll('.faq-block__question').forEach(function(item) { 897 item.addEventListener('click', function() { 898 this.parentNode.classList.toggle('active'); 899 }); 900 }); 901} 902 903if(document.querySelector('.tours-slider')){ 904 document.querySelector(".tours-slider") && new Glide(".tours-slider", { 905 type: "carousel", 906 perView: 3, 907 gap: 25, 908 breakpoints: { 909 1000: { 910 perView: 2 911 }, 912 768: { 913 perView: 1 914 } 915 } 916 }
916).mount(); 917} 918 919if(document.querySelector('.cruises__slider')){ 920 document.querySelectorAll('.cruises__slider').forEach(function(item) { 921 new Glide(item, { type: "carousel", perView: 1 }).mount(); 922 }); 923} 924 925if(document.querySelector('.route-slider')){ 926 document.querySelectorAll('.route-slider').forEach(function(item) { 927 new Glide(item, { type: "carousel", perView: 1 }).mount(); 928 }); 929} 930 931if(document.querySelector('.clusters-slider')){ 932 var half = Math.round(window.outerWidth / 7) 933 var clusterSlider = new Glide('.clusters-slider', { type: 'carousel', animationDuration: 1000, startAt: 1, perView: 3, peek: half, focusAt: 'center', gap: 20, breakpoints: { 934 768: { 935 perView: 1, 936 peek: 30 937 } 938 } 939}).mount(); 940} 941 942if (document.querySelector(".beringia-slider") && document.querySelector(".beringia-img-slider")){ 943 let gl1 = new Glide(".beringia-slider", { type: "carousel", perView: 1 }).mount(); 944 let gl2 = new Glide(".beringia-img-slider", { type: "carousel", perView: 7, gap: 24 }).mount(); 945 gl2.on("run", e => { gl1.go(e.direction) }); 946} 947 948if(document.querySelector(".news-slider")){ 949 console.log(window.innerWidth); 950 let perView = 3; 951 if(window.innerWidth < 480){ 952 perView = 1; 953 } 954 document.querySelector(".news-slider") && new Glide(".news-slider", { 955 type: "carousel", 956 perView: perView, 957 gap: 32 958 }).mount(); 959} 960 961if(document.querySelector('.clusters-zone')){ 962 document.querySelectorAll('.clusters-zone>svg').forEach(function(item) { 963 item.addEventListener('click', function() { 964 document.querySelectorAll('.clusters-zone').forEach(function(item2) { 965 item2.classList.remove('active'); 966 }); 967 document.querySelectorAll('.clusters-zone__point').forEach(function(item2) { 968 item2.classList.remove('active'); 969 }); 970 console.log(this.parentNode); 971 this.parentNode.classList.add('active'); 972 this.parentNode.childNodes[3].classList.add('active'); 973 clusterSlider.go('='+this.parentNode.childNodes[3].dataset.id); 974 975 }); 976 }); 977} 978 979if(document.querySelector('.clusters-zone__point')){ 980 document.querySelectorAll('.clusters-zone__point img').forEach(function(item) { 981 item.addEventListener('click', function() { 982 document.querySelectorAll('.clusters-zone').forEach(function(item2) { 983 item2.classList.remove('active'); 984 }); 985 document.querySelectorAll('.clusters-zone__point').forEach(function(item2) { 986 item2.classList.remove('active'); 987 }); 988 this.parentNode.classList.add('active'); 989 this.parentNode.parentNode.classList.add('active'); 990 clusterSlider.go('='+this.parentNode.dataset.id); 991 992 }); 993 }); 994 995 document.querySelectorAll('.clusters-zone__cross').forEach(function(item) { 996 item.addEventListener('click', function() { 997 console.log(this.parentNode.parentNode); 998 this.parentNode.parentNode.classList.remove('active'); 999 this.parentNode.parentNode.parentNode.classList.remove('active'); 1000 }); 1001 }); 1002} 1003 1004if(document.querySelector('.cluster-view__map-pin')){ 1005 document.querySelectorAll('.cluster-view__map-pin img').forEach(function(item) { 1006 item.addEventListener('click', function() { 1007 document.querySelectorAll('.cluster-view__map-pin').forEach(function(item2) { 1008 item2.classList.remove('active'); 1009 }); 1010 this.parentNode.classList.add('active'); 1011 }); 1012 }); 1013 1014 document.querySelectorAll('.clusters-pin__cross').forEach(function(item2) { 1015 item2.addEventListener('click', function() { 1016 console.log(this.parentNode.parentNode); 1017 this.parentNode.parentNode.classList.remove('active'); 1018 }); 1019 }); 1020} 1021 1022if(document.querySelector('.clusters-zone__mob-point')){ 1023 document.querySelectorAll('.clusters-zone__mob-point img').forEach(function(item) { 1024 item.addEventListener('click', function() { 1025 document.querySelectorAll('.clusters-zone__mob-point').forEach(function(item2) { 1026 item2.classList.remove('active'); 1027 }); 1028 this.parentNode.classList.add('active'); 1029 clusterSlider.go('='+this.parentNode.dataset.id); 1030 }); 1031 }); 1032 1033 document.querySelectorAll('.clusters-pin__cross').forEach(function(item2) { 1034 item2.addEventListener('click', function() { 1035 console.log(this.parentNode.parentNode); 1036 this.parentNode.parentNode.classList.remove('active'); 1037 }); 1038 }); 1039} 1040 1041if(document.querySelector('.tour-operators-popup')){ 1042 document.querySelectorAll('.tour-operators__block').forEach(function (item) { 1043 item.addEventListener('click', function () { 1044 let selected_mail = this.dataset.mail; 1045 document.querySelector('.tour-operators-popup').classList.add('active'); 1046 document.getElementById('touroper-'+item.dataset.id).classList.add('active'); 1047 }) 1048 }); 1049 1050 document.querySelectorAll('.tour-operators-popup__cross').forEach(function (item) { 1051 item.addEventListener('click', function () { 1052 document.querySelector('.tour-operators-popup').classList.remove('active'); 1053 document.querySelectorAll('.tour-operators-popup__block').forEach(function (item) { 1054 item.classList.remove('active'); 1055 }); 1056 }) 1057 }); 1058} 1059 1060if(document.querySelector('.filter-block__select-touroperators')){ 1061 document.querySelectorAll('.tour-operators__input-block').forEach(function (item) { 1062 item.addEventListener('click', function () { 1063 item.classList.toggle('active'); 1064 document.querySelectorAll('.filter-block__input-close').forEach(function (item2) { 1065 item2.classList.remove('active'); 1066 }); 1067 document.querySelectorAll('.filter-block__input-block.active').forEach(function (item2) { 1068 document.getElementById('touroperator-'+item2.dataset.id).classList.add('active'); 1069 }); 1070 filterOperators(); 1071 }) 1072 }); 1073 1074 document.querySelectorAll('.filter-block__input-close svg').forEach(function (item) { 1075 item.addEventListener('click', function () { 1076 item.parentNode.classList.remove('active'); 1077 document.getElementById('tourfilter-'+item.parentNode.dataset.id).classList.remove('active'); 1078 filterOperators(); 1079 }) 1080 }); 1081} 1082 1083if(document.querySelector('.tour-operators__container')){ 1084 document.querySelector('.tour-operators__more').addEventListener('click', function() { 1085 if(document.querySelector('.tour-operators__container-column:nth-child(3n + 2).active')) { 1086 document.querySelector('.tour-operators__container-column:last-child').classList.add('active'); 1087 document.querySelector('.tour-operators__more').style.display = 'none'; 1088 } else { 1089 document.querySelector('.tour-operators__container-column:nth-child(3n + 2)').classList.add('active'); 1090 } 1091 }); 1092} 1093 1094/* 1095пеÑÐµÐ½ÐµÑ Ð² компоненÑÑ 1096if(document.querySelector('.food-hotel-map')){ 1097 ymaps.ready(init);
1098 function init(){ 1099 var map = new ymaps.Map("main-map", { 1100 center: [53.037589, 158.655921], 1101 zoom: 18, 1102 }); 1103 BalloonContentLayout = ymaps.templateLayoutFactory.createClass('<div class="map_baloon">ÐдеÑÑ</div>', {}); 1104 1105 var pin1 = new ymaps.Placemark([53.037589, 158.655921], { name: 'ÐдеÑÑ' }, { iconLayout: 'default#image', iconImageHref: '/local/templates/2022/img/map-pin.png', iconImageSize: [24, 36], iconImageOffset: [-12, -36], hideIconOnBalloonOpen: false, balloonContentLayout: BalloonContentLayout, balloonPanelMaxMapArea: 0, balloonOffset: [0, -36] }); 1106map.geoObjects.add(pin1); 1107 } 1108}*/ 1109 1110 1111 1112function validateInput(input_type, input_data) { 1113 var isInputValid = true; 1114 if (input_type == "email") { 1115 let regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; 1116 isInputValid = regex.test(input_data); 1117 } 1118 if (input_type == "text") { 1119 if (input_data.length == 0){ 1120 isInputValid = false; 1121 } 1122 } 1123 return isInputValid; 1124} 1125 1126if(document.getElementById('questionForm')){ 1127 document.getElementById('questionForm').addEventListener('submit', function (e) { 1128 e.preventDefault(); 1129 let form_action = this.getAttribute("action"); 1130 let formData = new FormData(); 1131 let errors = false; 1132 1133 document.querySelectorAll('#questionForm *[data-validate]').forEach(function (item) { 1134 formData.append(item.name, item.value); 1135 if (!validateInput(item.dataset.validate, item.value)) { 1136 errors = true; 1137 item.parentNode.classList.add("error"); 1138 } 1139 }); 1140 1141 if (!errors) { 1142 fetch(form_action, { 1143 method: 'POST', 1144 headers: { 1145 'Content-Type': 'application/json', 1146 }, 1147 body: formData, 1148 }) 1149 .then(data => { 1150 document.getElementById('questionForm').style.display = 'none'; 1151 document.getElementById('questionForm').reset(); 1152 document.querySelector('.question-form__closure').classList.add('active'); 1153 document.querySelector('.question-form__img').style.display = 'none'; 1154 document.querySelector('.question-form__block').style.display = 'none'; 1155 /* 1156 document.querySelector('.popup-form-to-book__title').style.display = 'none'; 1157 document.querySelector('.form-to-book-submitted').style.display = 'block'; 1158 */ 1159 }) 1160 .catch((error) => { 1161 alert(error); 1162 }); 1163 } 1164 }); 1165} 1166 1167// const buttonSecurity = document.querySelector('.security-block-main-page__button'); 1168// const consentBlock = document.querySelector('.security-block-main-page__consent'); 1169// const inputConsent = consentBlock.querySelector('input'); 1170// const securityBlockMainPage = document.querySelector('.security-block-main-page'); 1171// const bodyPage = document.querySelector('body'); 1172// 1173// if(securityBlockMainPage){ 1174// bodyPage.style.overflow = 'hidden'; 1175// } 1176// 1177// buttonSecurity.addEventListener("click", function(){ 1178// if(inputConsent.checked){ 1179// let UTCDate = new Date(new Date().setFullYear(new Date().getFullYear() + 1)).toUTCString(); 1180// securityBlockMainPage.style.display = "none"; 1181// bodyPage.style.overflow = 'auto'; 1182// document.cookie = `${NAME}=${VALUE}; expires=${UTCDate}`; 1183// } 1184// }); 1185 1186if(document.querySelector('#book-tour')){ 1187 let tourslimit = false; 1188 let tourscount = 0; 1189 if(document.querySelector('#book-tour-index')){ 1190 tourslimit = true; 1191 } 1192 1193 function shuffle(array) { 1194 var currentIndex = array.length, temporaryValue, randomIndex; 1195 while (0 !== currentIndex) { 1196 randomIndex = Math.floor(Math.random() * currentIndex); 1197 currentIndex -= 1; 1198 temporaryValue = array[currentIndex]; 1199 array[currentIndex] = array[randomIndex]; 1200 array[randomIndex] = temporaryValue; 1201 } 1202 return array; 1203 } 1204 1205 fetch('/cron/tours.json').then(response => response.json()).then(tours => { 1206 let parsedTours = []; 1207 tours.tour_schedules.forEach((tour) => { 1208 console.log(tour); 1209 let desc = ''; 1210 1211 let places = '';
1212 tour.tour.tour_countries.forEach((p) => { 1213 places = p.name; 1214 }); 1215 tour.tour.tour_states.forEach((p) => { 1216 places = places + ', ' + p.name; 1217 }); 1218 tour.tour.tour_cities.forEach((p) => { 1219 places = places + ', ' + p.name; 1220 }); 1221 1222 let img = '/local/templates/2022/img/tour_placeholder.jpg'; 1223 if(tour.tour.gallery !== null) { 1224 tour.tour.gallery.forEach((image) => { 1225 if('/local/templates/2022/img/tour_placeholder.jpg' == img){ 1226 img = image.medium; 1227 } 1228 }); 1229 } 1230 1231 let duration = ''; 1232 if(null != tour.tour.duration_days){ 1233 duration = tour.tour.duration_days + ' дней'; 1234 } else if(null != tour.tour.duration_nights){ 1235 duration = tour.tour.duration_nights + ' ноÑей'; 1236 } else if(null != tour.tour.duration_hours){ 1237 duration = tour.tour.duration_hours+ ' ÑаÑов'; 1238 } 1239 1240 let price = 0; 1241 if(null != tour.min_adult_main_price && 0 < parseInt(tour.min_adult_main_price.value)){ 1242 price = tour.min_adult_main_price.value; 1243 } else if(null != tour.tour.min_individual_price && 0 < parseInt(tour.tour.min_individual_price.value)){ 1244 price = tour.tour.min_individual_price.value; 1245 } 1246 1247 let fSeason = 'winter'; 1248 let fMonth = parseInt(tour.date.substring(3, 5)); 1249 if(5 < fMonth && 12 > fMonth){ 1250 fSeason = 'summer'; 1251 } 1252 1253 let fDuration = 'many'; 1254 if('ÐднодневнÑй' == tour.tour.duration_type){ 1255 fDuration = 'one'; 1256 } 1257 1258 let el = '<div class="tour-block" data-season="' + fSeason + '" data-duration="' + fDuration + '" data-price="' + price + '"><a href="/atoms/' + tour.tour_id + '/" class="tour-block__img-link"><div class="tour-block__img" style="background: url(' + img + ')"></div></a><div class="tour-block__text"><a href="/atoms/' + tour.tour_id + '/" class="tour-block__title">' + tour.tour.name + '</a><p>' + desc + '</p><div><div><span class="tour-block__black">ÐеÑÑа показа: </span><span class="tour-block__city">' + places + '</span></div><div><span class="tour-block__black">ÐопÑÑÑимÑй возÑаÑÑ: </span><span>' + tour.tour.age_limit + '+</span></div><div><span class="tour-block__black">ÐлижайÑÐ°Ñ Ð´Ð°Ñа: </span><span class="tour-block__city">' + tour.date + ' </span><a href="">ÐÑе даÑÑ</a></div><div><span class="tour-block__black">ТÑÑопеÑаÑоÑ: </span><span>' + tour.org + '</span></div></div></div><div class="tour-block__characteristics"><div class="tour-block__duration"><span>ÐÑодолжиÑелÑноÑÑÑ</span><span class="tour-block__black">' + duration 1259 + '</span></div><div class="tour-block__duration"><span>Цена за Ñеловека Ð¾Ñ </span><span class="tour-block__prise">' + price + ' RUB</span></div><a href="/atoms/' + tour.tour_id + '/" class="tour-block__link">ÐоÑмоÑÑеÑÑ ÑÑÑ</a></div></div>'; 1260 parsedTours.push(el); 1261 }); 1262 1263 if(tourslimit){ 1264 shuffle(parsedTours); 1265 } 1266 1267 parsedTours.forEach((el) => { 1268 tourscount++; 1269 if(!tourslimit || tourscount < 4){ 1270 document.getElementById('tours').innerHTML = document.getElementById('tours').innerHTML + el; 1271 } 1272 }); 1273 }); 1274} 1275 1276if(document.querySelector('.route-map__tabs-links')){ 1277 document.querySelectorAll('.route-map__tabs-link').forEach(function(item) { 1278 item.addEventListener('click', function() { 1279 document.querySelectorAll('.route-map__tabs-link').forEach(function(item) { 1280 item.classList.remove("active"); 1281 }); 1282 this.classList.add("active"); 1283 document.querySelectorAll('.route-map__tabs-body').forEach(function(item) { 1284 item.classList.remove("active"); 1285 }); 1286 const target_id = this.getAttribute("data-id"); 1287 document.getElementById(target_id).classList.add("active"); 1288 }); 1289 }); 1290} 1291 1292if(document.getElementById('routeAccBtn')){ 1293 document.getElementById('routeAccBtn').addEventListener('click', function() { 1294 this.classList.toggle("active"); 1295 document.getElementById('routeAccBody').classList.toggle("active"); 1296 }); 1297} 1298 1299if(document.querySelector(".fishing-card__slider")){ 1300 document.querySelectorAll('.fishing-card__slider').forEach(function(item) { 1301 new Glide(item, { type: "carousel", perView: 1, gap: 0 }).mount(); 1302 }); 1303} 1304 1305if(document.querySelector('.route__popup')){ 1306 document.querySelectorAll('.route__popup').forEach(function(slider) { 1307 var count = 0; 1308 slider.querySelectorAll('.route__additional-slide').forEach(function(item3) { 1309 count++; 1310 }); 1311 1312 if (count > 5){ 1313 count = 5; 1314 } 1315 1316 var as1 = new Glide(slider.querySelector('.route__slider'), { type: 'carousel', animationDuration: 1000, perView: 1, gap: 100 }
1316).mount(); 1317 var as2 = new Glide(slider.querySelector('.route__additional-slider'), { type: 'carousel', animationDuration: 1000, perView: count, gap: 20 }).mount(); 1318 1319 as1.on('run', (e) => { 1320 if("=" != e.direction){ 1321 as2.go(e.direction); 1322 } 1323 }); 1324 1325 as2.on('run', (e) => { 1326 if("=" != e.direction){ 1327 as1.go(e.direction); 1328 } 1329 }); 1330 1331 slider.querySelectorAll('.route__additional-slide').forEach(function(item) { 1332 item.addEventListener('click', function() { 1333 as1.go('='+item.dataset.id); 1334 as2.go('='+(item.dataset.id)); 1335 }); 1336 }); 1337 }); 1338 // var count = 0; 1339 // document.querySelectorAll('.route__additional-slide').forEach(function(item3) { 1340 // count++; 1341 // }); 1342 1343 // if (count > 5){ 1344 // count = 5; 1345 // } 1346 1347 // var as1 = new Glide('.route__slider', { type: 'carousel', animationDuration: 1000, perView: 1, gap: 100 }).mount(); 1348 // var as2 = new Glide('.route__additional-slider', { type: 'carousel', animationDuration: 1000, perView: count, gap: 20 }).mount(); 1349 1350 // as1.on('run', (e) => { 1351 // if("=" != e.direction){ 1352 // as2.go(e.direction); 1353 // } 1354 // }); 1355 1356 // as2.on('run', (e) => { 1357 // if("=" != e.direction){ 1358 // as1.go(e.direction); 1359 // } 1360 // }); 1361 1362 // document.querySelectorAll('.route__additional-slide').forEach(function(item) { 1363 // item.addEventListener('click', function() { 1364 // as1.go('='+item.dataset.id); 1365 // as2.go('='+(item.dataset.id)); 1366 // }); 1367 // }); 1368} 1369 1370function showRoutePopup(id){ 1371 document.getElementById('route_popup_'+id).classList.add('active'); 1372} 1373 1374function hidePopups(){ 1375 document.querySelectorAll('.route__popup-cross').forEach(function(item) { 1376 document.querySelector('.route__popup.active').classList.remove('active'); 1377 }); 1378} 1379 1380if(document.querySelector('.route-map-wrap')){ 1381 document.querySelectorAll('.route-map-wrap .item').forEach(function (item) { 1382 item.addEventListener('click', function () { 1383 1384 document.querySelectorAll('.route-map-wrap .item').forEach(function (item2) { 1385 item2.classList.remove('active'); 1386 }); 1387 item.classList.add('active'); 1388 1389 document.querySelectorAll('.route-map-wrap .right-info').forEach(function (item2) { 1390 item2.classList.remove('active'); 1391 }); 1392 1393 document.getElementById('dot_'+item.dataset.id).classList.add('active'); 1394 new Glide(document.getElementById('rs_slider_'+item.dataset.id), { type: 'carousel', animationDuration: 1000, perView: 1, gap: 100 }).mount(); 1395 }) 1396 }); 1397 1398 // document.querySelectorAll('.route-map-wrap .route__slider').forEach(function (item) { 1399 // new Glide(item, { type: 'carousel', animationDuration: 1000, perView: 1, gap: 100 }).mount(); 1400 // }); 1401} 1402 1403//поведение пÑи нажаÑии nav 1404function scrollToTargetAdjusted(e) { 1405 console.log("console" + e); 1406 var t = document.getElementById(e).getBoundingClientRect().top + window.scrollY - 145; 1407 window.scrollTo({ 1408 top: t, 1409 behavior: "smooth" 1410 }) 1411} 1412const anchors = document.querySelectorAll('a[href*="#"]'); 1413for (let e of anchors) e.addEventListener("click", function(t) { 1414 t.preventDefault(), scrollToTargetAdjusted(e.getAttribute("href").substr(1)) 1415}); 1416 1417function setCookie(name, value, days) { 1418 let expires = ""; 1419 if (days) { 1420 const date = new Date(); 1421 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 1422 expires = "; expires=" + date.toUTCString(); 1423 } 1424 document.cookie = name + "=" + (value || "") + expires + "; path=/"; 1425} 1426 1427const googleTranslateConfig = { lang: "ru" }; 1428 1429document.addEventListener("DOMContentLoaded", (event)=>{ 1430 let script = document.createElement("script"); 1431 script.src = `//translate.google.com/translate_a/element.js?cb=TranslateWidgetIsLoaded`; 1432 document.getElementsByTagName("head")[0].appendChild(script); 1433}); 1434 1435function TranslateWidgetIsLoaded() { 1436 TranslateInit(googleTranslateConfig); 1437} 1438 1439function TranslateInit(config) { 1440 if (config.langFirstVisit && !Cookies.get("googtrans")) { 1441 TranslateCookieHandler("/auto/" + config.langFirstVisit); 1442 } 1443 1444 let code = TranslateGetCode(config); 1445 1446 TranslateHtmlHandler(code); 1447 1448 if (code == config.lang) { 1449 TranslateCookieHandler(null, config.domain); 1450 } 1451 1452 if (config.testWord) 1453 TranslateMutationObserver(config.testWord, code == config.lang); 1454 1455 new google.translate.TranslateElement({ 1456 pageLanguage: config.lang, 1457 multilanguagePage: true, 1458 },'google-translate-container'); 1459 1460 TranslateEventHandler("click", "[data-google-lang]", function(e) { 1461 setCookie('lang', e.dataset.googleLang); 1462 TranslateCookieHandler("/" + config.lang + "/" + e.getAttribute("data-google-lang"), config.domain); 1463 window.location.reload(); 1464 }); 1465} 1466 1467function TranslateGetCode(config) { 1468 let lang = Cookies.get("googtrans") != undefined && Cookies.get("googtrans") != "null" ? Cookies.get("googtrans") : config.lang; 1469 return lang.match(/(?!^\/)[^\/]*$/gm)[0]; 1470} 1471 1472function TranslateCookieHandler(val, domain) { 1473 Cookies.set("googtrans", val, { 1474 domain: document.domain, 1475 path: '/' 1476 }); 1477 Cookies.set("googtrans", val, { 1478 domain: "." + document.domain, 1479 path: '/' 1480 }); 1481 1482 if (domain == "undefined") 1483 return; 1484 Cookies.set("googtrans", val, { 1485 domain: domain, 1486 path: '/' 1487 }); 1488 1489 Cookies.set("googtrans", val, { 1490 domain: "." + domain, 1491 path: '/' 1492 }); 1493} 1494 1495function TranslateEventHandler(event, selector, handler) { 1496 document.addEventListener(event, function(e) { 1497 let el = e.target.closest(selector); 1498 if (el) 1499 handler(el); 1500 }); 1501} 1502 1503function TranslateHtmlHandler(code) { 1504 const activeButtons = Array.from(document.querySelectorAll('[data-google-lang="' + code + '"]')) 1505 1506 activeButtons.forEach(button=>button.classList.add('lang-toggle-btn_active')) 1507} 1508 1509function TranslateMutationObserver(word, isOrigin) { 1510 if (isOrigin) { 1511 document.dispatchEvent(new CustomEvent("FinishTranslate")); 1512 } else { 1513 let div = document.createElement('div'); 1514 div.id = 'googleTranslateTestWord'; 1515 div.innerHTML = word; 1516 div.style.display = 'none'; 1517 document.body.prepend(div); 1518 1519 let observer = new MutationObserver(()=>{ 1520 document.dispatchEvent(new CustomEvent("FinishTranslate")); 1521 observer.disconnect(); 1522 } 1523 ); 1524 1525 observer.observe(div, { 1526 childList: false, 1527 subtree: true, 1528 characterDataOldValue: true 1529 }); 1530 } 1531} 1532 1533if(document.querySelector('.tours-popup')){ 1534 document.querySelectorAll('.tours-popup__active').forEach(function (item) { 1535 item.addEventListener('click', function () { 1536 document.querySelector('.tours-popup').classList.add('active'); 1537 }) 1538 }); 1539 1540 document.querySelector('.tours-popup__cross').addEventListener('click', function() { 1541 document.querySelector('.tours-popup').classList.remove('active'); 1542 }); 1543} 1544 1545if(document.querySelector('.gastrofest-part__block-arrow')){ 1546 document.querySelector('.gastrofest-part__block-arrow').addEventListener('click', function() { 1547 document.querySelector('.gastrofest-part__block-arrow').classList.toggle('active'); 1548 document.querySelector('.gastrofest-part__block-close').classList.toggle('active'); 1549 }); 1550} 1551 1552if(document.querySelector('.gastrofest-more__button')){ 1553 document.querySelector('.gastrofest-more__button').addEventListener('click', function() { 1554 document.querySelector('.gastrofest-more__button').classList.toggle('active'); 1555 document.querySelector('.gastrofest-more').classList.toggle('active'); 1556 }); 1557} 1558 1559if(document.querySelector('.main-slider')){ 1560 new Glide('.main-slider', { type: 'carousel', animationDuration: 1000, perView: 1, gap: 0 }).mount(); 1561}
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.