1 2const $key = '6LctXesjAAAAAJ31wwHADp-_WW--Q0f8dZhlMLIe'; 3 4function scrollToElement(el, offset) 5{ 6 if (offset === undefined) 7 offset = 0; 8 9 var duration = 600; 10 var element = $(el).offset(); 11 var pos = element.top + offset; 12 console.log(pos); 13 $('html, body').animate({scrollTop: pos}, duration); 14} 15 16function scrollToElement2(el, offset) 17{ 18 if (offset === undefined) 19 offset = 0; 20 21 var duration = 600; 22 23 document.querySelector(el).scrollIntoView({ 24 behavior: 'smooth', 25 block: 'start' 26 }); 27 28 /*var element = document.getElementById(el).offsetTop; 29 var pos = element + offset; 30 console.log(element); 31 $('html, body').animate({scrollTop: pos}, duration);*/ 32} 33 34document.addEventListener( 35 "DOMContentLoaded", () => { 36 new Mmenu( "#menu", { 37 "navbar": { 38 "title": 'ÐенÑ' 39 } 40 } ); 41 } 42); 43 44//let dt = new DataTransfer(); 45if(document.querySelector('input[type="file"]') != null) { 46 let inputImg = document.querySelector('input[type="file"]'); 47 48 inputImg.addEventListener("change", function(event) { 49 50 if(inputImg.files[0]['size'] < 5000000) { 51 $('.error_text').hide(); 52 return false; 53 } else { 54 $('.error_text').show(); 55 return false; 56 } 57 58 }); 59} 60 61function checkPass() { 62 let $val1 = $('#password').val(); 63 let $val2 = $('#repeat_password').val(); 64 let strength = 0; 65 66 if ($val1 != $val2) { 67 $('.ismatch').show(); 68 $("#savebutton").prop('disabled', true); 69 } else { 70 $('.ismatch').hide(); 71 $("#savebutton").prop('disabled', false); 72 } 73 74 var arr = [/.{8,}/, /[a-z]+/, /[0-9]+/, /[A-Z]+/, /([!,%,&,@,#,$,^,*,?,_,~])/, /(.*[!,%,&,@,#,$,^,*,?,_,~].*[!,%,&,@,#,$,^,*,?,_,~])/]; 75 76 jQuery.map(arr, function(regexp) { 77 if($val1.match(regexp)) 78 strength++; 79 }); 80 81 if (strength < 5 && $val1.length != '') { 82 $err = 1; 83 $('.strongpass').html('<strong>ТÑÐµÐ±Ð¾Ð²Ð°Ð½Ð¸Ñ Ðº паÑолÑ</strong><br/>Ðлина более 8 Ñимволов<br/>ÐинимÑм одна пÑопиÑÐ½Ð°Ñ Ð±Ñква<br/>ÐинимÑм одна ÑиÑÑа<br/>ÐинимÑм один ÑпеÑÑимвол'); 84 $('.strongpass').show(); 85 $("#savebutton").prop('disabled', true); 86 ///return false; 87 } else { 88 $('.strongpass').hide(); 89 $("#savebutton").prop('disabled', false); 90 } 91} 92 93$(document).ready(function(){ 94 95 $('.hreflab').click(function(){ 96 //$('.hrefchecks').hide(); 97 //$('.hreflab').removeClass('opened'); 98 if(!$(this).hasClass('opened')) { 99 $(this).closest('.lpcombs').find('.hrefchecks').show(); 100 $(this).addClass('opened'); 101 } else { 102 $(this).closest('.lpcombs').find('.hrefchecks').hide(); 103 $(this).removeClass('opened'); 104 } 105 }); 106 107 $('.query_ticket').click(function(){ 108 $.ajax({ 109 url : '/forms/add_chb.php', 110 method:'POST', 111 data: {}, 112 dataType : "html", 113 success : function(res) { 114 $('#qchb').html('ÐапÑоÑен ÑиÑаÑелÑÑкий билеÑ'); 115 }, error: function(h1,h2,h3){ 116 console.log(h1); 117 console.log(h2); 118 console.log(h3); 119 } 120 }); 121 }); 122 123 $('.check_all').click(function(){ 124 const checked = $(this).find('input[type="checkbox"]').prop('checked'); 125 126 $(this).closest('.lpcombs').find('input[type="checkbox"]').each(function(index){ 127 console.log('checked', checked); 128 if (index > 0) { 129 $(this).prop('checked', checked); 130 } 131 }) 132 }); 133 134 $('.theme-link').click(function(){ 135 $('.theme-link').removeClass('active'); 136 $(this).addClass('active'); 137 const $clickVal = $(this).data('value') 138 $('.layer3').find('.faq-list-item').show(); 139 140 $('.layer3').find('.faq-list-item').each(function(index, item){ 141 const $val = $(this).data('value'); 142 console.log($val); 143 console.log($clickVal); 144 if($val.toString().indexOf($clickVal.toString()) == -1) { 145 $(this).hide(); 146 } 147 }) 148 }) 149 150 $('.spoiler-link').click(function(){ 151 $(this).closest('.spoiler').find('.spoiler_data').toggle(); 152 }) 153 154 $('.want').change(function(){ 155 if($(this).val() == 124){ 156 $('.email').prop('required', false); 157 } else { 158 $('.email').prop('required', true); 159 } 160 }); 161 162 163 $('body').on('input','#password',function(){ 164 checkPass(); 165 }).on('input','#repeat_password',function(){ 166 checkPass(); 167 }); 168 169 $('#totop').click(function(e){
170 e.preventDefault(); 171 $("html, body").animate({ 172 scrollTop: 0 173 }); 174 }); 175 176 $('.agree').click(function(){ 177 let $check = $(this).prop('checked'); 178 let $button = $(this).closest('.form-button').find('button'); 179 if ($check) { 180 $button.attr('disabled', false); 181 } else { 182 $button.attr('disabled', true); 183 } 184 }); 185 186 if($('#history2').length > 0) { 187 let $href = document.location.href; 188 console.log(document.querySelector('#history2').getBoundingClientRect()); 189 if ($href.indexOf('#history') != -1) { 190 $('#spoil').addClass('razvern'); 191 $('.spoil-link').html('СкÑÑÑÑ'); 192 //scrollToElement2('#history2', 50); 193 } 194 } 195 196 $('.btn-block').find('label').click(function(){ 197 let $form = $(this).data('form'); 198 $('.btn-block').find('label').find('input').prop('checked', false); 199 $(this).find('input').prop('checked', true); 200 //$('.btn-block').find('a').removeClass('btn-dark'); 201 //$(this).addClass('btn-dark'); 202 203 $('.forms-block').find('form').hide(); 204 $('.forms-block').find('.' + $form).show(); 205 206 }); 207 208 $('.close-page-alert').click(function(){ 209 $('.page-alert').hide(); 210 }); 211 212 $('.spoil-link').click(function(){ 213 $('#spoil').toggleClass('razvern'); 214 if ($('#spoil').hasClass('razvern')){ 215 $(this).html('СкÑÑÑÑ'); 216 } else { 217 $(this).html('ÐоказаÑÑ Ð¿Ð¾Ð»Ð½Ð¾ÑÑÑÑ'); 218 } 219 }); 220 221 $('.spoil-link-about').click(function(){ 222 $(this).parent().find('.preview_text').toggleClass('razvern'); 223 if ($(this).parent().find('.preview_text').hasClass('razvern')){ 224 $(this).html('СкÑÑÑÑ'); 225 } else { 226 $(this).html('ÐоказаÑÑ Ð¿Ð¾Ð»Ð½Ð¾ÑÑÑÑ'); 227 } 228 }); 229 230 //$('a.maplink').colorbox({innerWidth:'80%', innerHeight:'80%', inline:true}); 231 232 $('a.media-item.iframe').colorbox({innerWidth:'90%', innerHeight:'90%', iframe:true}); 233 $('a.media-item.inline').colorbox({innerWidth:'90%', inline:true}); 234 235 $('a.colorbox').colorbox({innerWidth:'90%', innerHeight:'90%', rel:'gal'}); 236 237 $('.icon-instagram').parent().remove(); 238 $('.icon-facebook').parent().remove(); 239 240 $('.custom-slide-image').find('img').lazyload(); 241 242 /*$(document).on('input', '#NAME', function() { 243 let $that = $(this); 244 let $author = $('#AUTHOR').val(); 245 246 let $data = {}; 247 $data['NAME'] = $that.val(); 248 $data['AUTHOR'] = $author; 249 250 $.ajax({ 251 url : '/forms/search_irbis.php', 252 method:'POST', 253 data: $data, 254 dataType : "json", 255 success : function(res) { 256 console.log(res); 257 258 259 }, error: function(h1,h2,h3){ 260 console.log(h1); 261 console.log(h2); 262 console.log(h3); 263 } 264 }); 265 });*/ 266 267 268 $('.personal-res-form').submit(function(e) { 269 e.preventDefault(); 270 e.stopPropagation(); 271 272 let $that = $(this); 273 let $action = $that.attr('action'); 274 formData = new FormData($that.get(0)); // Ñоздаем новÑй ÑкземплÑÑ Ð¾Ð±ÑекÑа и пеÑедаем ÐµÐ¼Ñ Ð½Ð°ÑÑ ÑоÑÐ¼Ñ (*) 275 276 $.ajax({ 277 url : $action, 278 method:'POST', 279 contentType: false, // важно - ÑбиÑаем ÑоÑмаÑиÑование даннÑÑ Ð¿Ð¾ ÑмолÑÐ°Ð½Ð¸Ñ 280 processData: false, // важно - ÑбиÑаем пÑеобÑазование ÑÑÑок по ÑмолÑÐ°Ð½Ð¸Ñ 281 data: formData, 282 dataType : "html", 283 success : function(res) { 284 285 console.log(res); 286 287 288 $('#modal-res').find('.modal-body').html('ÐÐ°Ñ Ð·Ð°Ð¿ÑÐ¾Ñ ÑÑпеÑно оÑпÑавлен! ÐоÑле пÑедоÑÑÐ°Ð²Ð»ÐµÐ½Ð¸Ñ Ð´Ð¾ÑÑÑпа даннÑе можно ÑвидеÑÑ Ð²Ð¾ вкладке ÐлекÑÑоннÑе ÑеÑÑÑÑÑ'); 289 $('#modal-res').modal('show'); 290 //$('#faq-my-layer').html(res); 291 292 293 }, error: function(h1,h2,h3){ 294 console.log(h1); 295 console.log(h2); 296 console.log(h3); 297 } 298 }); 299 }); 300 301 $('.aform').submit(function(e) { 302 e.preventDefault(); 303 e.stopPropagation(); 304 305 let $that = $(this); 306 307 grecaptcha.ready(function() { 308 grecaptcha.execute($key,{action: 'feedback'}).then( 309 function(token) { 310 $('form input[name="g_recaptcha_response"]').val(token); 311 312 let inputImg = document.querySelector('input[type="file"]'); 313 if (inputImg.files.length > 0) { 314 if(inputImg.files[0]['size'] > 5000000) { 315 $('.error_text').show(); 316 return false; 317 } 318 } 319 let $data = {}; 320 321 /*$(this).find ('input, textarea, select').each(function() { 322 $data[this.name] = $(this).val(); 323 });*/ 324 325 let $action = $that.attr('action'); 326 formData = new FormData($that.get(0)); // Ñоздаем новÑй ÑкземплÑÑ Ð¾Ð±ÑекÑа и пеÑедаем ÐµÐ¼Ñ Ð½Ð°ÑÑ ÑоÑÐ¼Ñ (*) 327 console.log(formData); 328 329 $.ajax({
330 url : $action, 331 method:'POST', 332 contentType: false, // важно - ÑбиÑаем ÑоÑмаÑиÑование даннÑÑ Ð¿Ð¾ ÑмолÑÐ°Ð½Ð¸Ñ 333 processData: false, // важно - ÑбиÑаем пÑеобÑазование ÑÑÑок по ÑмолÑÐ°Ð½Ð¸Ñ 334 data: formData, 335 dataType : "html", 336 success : function(res) { 337 338 console.log(res); 339 340 $that.find ('input, textarea, select').each(function() { 341 $(this).val(''); 342 }); 343 344 if ($that.hasClass('vac-form')) { 345 $('#modal-res').find('.modal-body').html('ÐÐ°Ñ Ð·Ð°Ð¿ÑÐ¾Ñ Ð½Ð° ваканÑÐ¸Ñ Ð¾ÑпÑавлен наÑим ÑпеÑиалиÑÑам! Ðа ÑказаннÑй вами адÑÐµÑ ÑлекÑÑонной поÑÑÑ Ð±ÑÐ´ÐµÑ Ð¾ÑпÑавлено пиÑÑмо Ñ Ð¾ÑвеÑом и комменÑаÑиÑми'); 346 } else if ($that.hasClass('reviews-form')){ 347 //$('#modal-res').find('.modal-body').html('ÐÐ°Ñ Ð¾ÑзÑв ÑÑпеÑно оÑпÑавлен. ÐоÑле пÑовеÑки его модеÑаÑоÑом он бÑÐ´ÐµÑ ÑазмеÑен на ÑайÑе'); 348 $('#modal-res').find('.modal-body').html(''); 349 } else { 350 //$('#modal-res').find('.modal-body').html('ÐÐ°Ñ Ð·Ð°Ð¿ÑÐ¾Ñ Ð½Ð° ÑÑаÑÑие в конкÑÑÑе оÑпÑавлен наÑим ÑпеÑиалиÑÑам! Ðа ÑказаннÑй вами адÑÐµÑ ÑлекÑÑонной поÑÑÑ Ð±ÑÐ´ÐµÑ Ð¾ÑпÑавлено пиÑÑмо Ñ Ð¾ÑвеÑом и комменÑаÑиÑми'); 351 $('#modal-res').find('.modal-body').html('СпаÑибо за ваÑÑ Ð·Ð°ÑвкÑ!'); 352 } 353 $('#modal-res').modal('show'); 354 //$('#faq-my-layer').html(res); 355 356 357 }, error: function(h1,h2,h3){ 358 console.log(h1); 359 console.log(h2); 360 console.log(h3); 361 } 362 }); 363 } 364 ); 365 }); 366 367 return false; 368 369 }); 370 371 372 $('.order_form').submit(function(e){ 373 e.preventDefault(); 374 e.stopPropagation(); 375 376 377 let $that = $(this); 378 let $data = {}; 379 let $action = $that.attr('action'); 380 381 $that.find ('input, textarea, select').each(function() { 382 383 if ($(this).attr('type') != 'checkbox') { 384 $data[this.name] = $(this).val(); 385 } else { 386 if($(this).prop('checked') === true) { 387 $data[this.name] = $(this).val(); 388 } 389 } 390 }); 391 392 393 //console.log($data); 394 395 $.ajax({ 396 url : $action, 397 method:'POST', 398 data: $data, 399 dataType : "html", 400 success : function(res) { 401 console.log($action); 402 console.log(res); 403 404 $('#modal-bron2').modal('show'); 405 406 $that.find ('input, textarea, select').each(function() { 407 if ($(this).attr('type') == 'checkbox') { 408 $(this).prop('checked', false); 409 } 410 }); 411 412 setTimeout(function(){ 413 document.location.href = "/catalog/search/"; 414 },5000); 415 416 }, error: function(h1,h2,h3){ 417 console.log(h1); 418 console.log(h2); 419 console.log(h3); 420 } 421 }); 422 423 424 return false; 425 }); 426 427 $('.personal-help-form').submit(function(e) { 428 e.preventDefault(); 429 e.stopPropagation(); 430 431 432 let $that = $(this); 433 434 let $data = {}; 435 436 $(this).find ('input, textarea, select').each(function() { 437 $data[this.name] = $(this).val(); 438 }); 439 440 let $action = $that.attr('action'); 441 442 443 $.ajax({ 444 url : $action, 445 method:'POST', 446 data: $data, 447 dataType : "html", 448 success : function(res) { 449 450 451 $that.find ('input, textarea, select').each(function() { 452 $(this).val(''); 453 }); 454 455 $('#modal-res').find('.modal-body').html('ÐÐ°Ñ Ð²Ð¾Ð¿ÑÐ¾Ñ Ð¾ÑпÑавлен наÑим ÑпеÑиалиÑÑам! Ðа ÑказаннÑй вами адÑÐµÑ ÑлекÑÑонной поÑÑÑ Ð±ÑÐ´ÐµÑ Ð¾ÑпÑавлено пиÑÑмо Ñ Ð¾ÑвеÑом и комменÑаÑиÑми'); 456 $('#modal-res').modal('show'); 457 //$('#faq-my-layer').html(res); 458 459 460 }, error: function(h1,h2,h3){ 461 console.log(h1); 462 console.log(h2); 463 console.log(h3); 464 } 465 }); 466 467 468 return false; 469 470 }); 471 472 473 $('.event-form-bottom').submit(function(e){
474 e.preventDefault(); 475 e.stopPropagation(); 476 477 let $that = $(this); 478 grecaptcha.ready(function() { 479 grecaptcha.execute($key,{action: 'feedback'}).then( 480 function(token) { 481 $('form input[name="g_recaptcha_response"]').val(token); 482 483 let $data = {}; 484 485 $that.find ('input, textarea, select').each(function() { 486 $data[this.name] = $(this).val(); 487 }); 488 489 let $action = $that.attr('action'); 490 491 492 $.ajax({ 493 url : $action, 494 method:'POST', 495 data: $data, 496 dataType : "html", 497 success : function(res) { 498 //console.log(res); 499 /*$('.event-form-bottom-b2').show(); 500 $('.event-form-bottom-b2').html('ÐапиÑÑ Ð½Ð° меÑопÑиÑÑие ÑÑпеÑно добавлена');*/ 501 502 $('#modal-res').find('.modal-body').html('ÐапиÑÑ Ð½Ð° меÑопÑиÑÑие ÑÑпеÑно добавлена'); 503 $('#modal-res').modal('show'); 504 505 $('.event-form-bottom').find ('input, textarea, select').each(function() { 506 $(this).val(''); 507 }); 508 509 }, error: function(h1,h2,h3){ 510 console.log(h1); 511 console.log(h2); 512 console.log(h3); 513 } 514 }); 515 } 516 ); 517 }); 518 519 return false; 520 }); 521 522 $('.page-form').submit(function(e){ 523 e.preventDefault(); 524 e.stopPropagation(); 525 let $data = {}; 526 let $that = $(this); 527 528 grecaptcha.ready(function() { 529 grecaptcha.execute($key,{action: 'feedback'}).then( 530 function(token) { 531 $('form input[name="g_recaptcha_response"]').val(token); 532 $that.find ('input, textarea, select').each(function() { 533 if (this.name != '') { 534 $data[this.name] = $(this).val(); 535 } 536 }); 537 538 let $action = $that.attr('action'); 539 console.log($action); 540 console.log($data); 541 542 543 $.ajax({
544 url : $action, 545 method:'POST', 546 data: $data, 547 dataType : "html", 548 success : function(res) { 549 console.log(res); 550 551 if ($that.hasClass('reviews-form')){ 552 $('#modal-res').find('.modal-body').html('ÐÐ°Ñ Ð¾ÑзÑв ÑÑпеÑно оÑпÑавлен. <br/>ÐоÑле пÑовеÑки его модеÑаÑоÑом он бÑÐ´ÐµÑ ÑазмеÑен на ÑайÑе'); 553 } else { 554 $('#modal-res').find('.modal-body').html('ÐÐ°Ñ Ð·Ð°Ð¿ÑÐ¾Ñ Ð´Ð»Ñ Ð±Ð¸Ð±Ð»Ð¸Ð¾Ð³ÑаÑа ÑÑпеÑно оÑпÑавлен!'); 555 } 556 557 $('#modal-res').modal('show'); 558 559 $('.page-form').find ('input, textarea, select').each(function() { 560 $(this).val(''); 561 }); 562 563 }, error: function(h1,h2,h3){ 564 console.log(h1); 565 console.log(h2); 566 console.log(h3); 567 } 568 }); 569 } 570 ); 571 }); 572 573 return false; 574 }); 575 576 $('.bron_form').submit(function(e){ 577 e.preventDefault(); 578 e.stopPropagation(); 579 580 let $data = {}; 581 let $that = $(this); 582 583 $that.find ('input, textarea, select').each(function() { 584 $data[this.name] = $(this).val(); 585 }); 586 587 let $action = $that.attr('action'); 588 let $id = $(this).find('.id').val(); 589 $data['STATE_TEXT'] = $that.find('select').find('option:selected').html(); 590 591 console.log($data); 592 593 $.ajax({ 594 url : $action, 595 method:'POST', 596 data: $data, 597 dataType : "html", 598 success : function(res) { 599 console.log(res); 600 //console.log($that.find('select').find('option:selected').html()); 601 //console.log('#status-'.$id); 602 603 $('#status-' + $id).html($that.find('select').find('option:selected').html()); 604 605 }, error: function(h1,h2,h3){ 606 console.log(h1); 607 console.log(h2); 608 console.log(h3); 609 } 610 }); 611 612 return false; 613 }); 614 615 $('.pers-events a').click(function(e){ 616 e.preventDefault(); 617 e.stopPropagation(); 618 let $layer = $(this).data('layer'); 619 $('.pers-events a').removeClass('active'); 620 $(this).addClass('active'); 621 $('.pers-event').hide(); 622 $('#' + $layer).show(); 623 }); 624 625 $('.cabinet-catalog a').click(function(e){ 626 e.preventDefault(); 627 e.stopPropagation(); 628 let $layer = $(this).data('layer'); 629 $('.cabinet-catalog a').removeClass('active'); 630 $(this).addClass('active'); 631 $('.personal-books-list').hide(); 632 $('#' + $layer).show(); 633 }); 634 635 $('.cabinet-faq a').click(function(e){ 636 e.preventDefault(); 637 e.stopPropagation(); 638 let $layer = $(this).data('layer'); 639 $('.cabinet-faq a').removeClass('active'); 640 $(this).addClass('active'); 641 $('.personal-help').hide(); 642 $('#' + $layer).show(); 643 }); 644 645 $('.page-sub-menu-list a').click(function(e){ 646 e.preventDefault(); 647 e.stopPropagation(); 648 let $layer = $(this).data('layer'); 649 $('.page-sub-menu-list a').removeClass('active'); 650 $(this).addClass('active'); 651 $('.page-sub-menu-item').hide(); 652 $('#' + $layer).show(); 653 }); 654 655 $('.personal-top-nav a').click(function(){ 656 let $layer = $(this).data('layer'); 657 $('.personal-top-nav a').removeClass('active'); 658 $(this).addClass('active'); 659 $('.personal-content-bottom').hide(); 660 $('#' + $layer).show(); 661 }); 662 663 664 $.datepicker.setDefaults( $.datepicker.regional[ "ru" ] ); 665 $( ".datepicker" ).datepicker({ 666 onSelect: function(dateText) { 667 $('.filter_form').submit(); 668 } 669 }); 670 671 $('.search-book-form').submit(function(e){ 672 e.preventDefault(); 673 e.stopPropagation(); 674 675 676 return false; 677 }); 678 679 $('.auth-form-nav a').click(function(){ 680 let $layer = $(this).data('layer'); 681 682 $('.auth-form-nav a').removeClass('active'); 683 $(this).addClass('active'); 684 $('.auth-layer').hide(); 685 $('#' + $layer).show(); 686 }); 687 688 $('.faq-menu-list a').click(function(){ 689 let $layer = $(this).data('layer'); 690 691 $('.faq-menu-list a').removeClass('active'); 692 $(this).addClass('active'); 693 $('.d-layer').hide(); 694 $('.' + $layer).show(); 695 }); 696 697 $('.libhref a').click(function(){ 698 let $that = $(this); 699 let $id = $(this).data('show'); 700 $('.libtype').slideUp(function(){ 701 $('.' + $id).slideDown(); 702 703 $('.libhref a').removeClass('active'); 704 $that.addClass('active'); 705 }); 706 }); 707 708 $('.contacts-sub li a').click(function(){ 709 let $that = $(this); 710 let $id = $(this).data('show');
711 $('.zaklad').slideUp(function(){ 712 $('.contacts-sub li a').removeClass('active'); 713 $that.addClass('active'); 714 715 setTimeout(function(){ 716 $('#' + $id).slideDown(); 717 }, 500); 718 719 }); 720 }); 721 722 723 $('.vac-form').submit(function(e){ 724 /*e.preventDefault(); 725 e.stopPropagation(); 726 727 let $that = $(this); 728 let formData = new FormData(); 729 */ 730 /*formData.append('name', $('input#fname').val()); 731 formData.append('phone', $('input#fphone').val()); 732 formData.append('name', $('input#fname').val()); 733 formData.append('phone', $('input#fphone').val());*/ 734 735 736 }); 737 738 739 var fxdHeader = document.querySelector("header"); 740 var headroom = new Headroom(fxdHeader,{ 741 offset : 80, 742 tolerance : { 743 up : 10, 744 down : 5 745 }, 746 }); 747 headroom.init(); 748 749 750 $('body').on('click','.anchor-link',function(e){ 751 e.preventDefault(); 752 targ = $(this).attr('href'); 753 scrollToElement(targ, -40) 754 }) 755 .on('click',function(e){ 756 /*if( !$(e.target).closest('.modal-content').length && !$(e.target).closest('[data-toggle="modal"]').length){ 757 $('.modal').modal('hide') 758 }*/ 759 if( !$(e.target).closest('.header-search').length) { 760 $('body').removeClass('search-active'); 761 } 762 }) 763 .on('click', '.search-toggle', function(e) 764 { 765 //$('body').addClass('search-active'); 766 }) 767 .on('click', '.row-field-toggle', function(e) 768 { 769 e.preventDefault(); 770 $(this).parents('.expert-form-rating-row').toggleClass('active'); 771 }) 772 .on('click', '.dropdown-select .dropdown-menu a', function(e) 773 { 774 e.preventDefault(); 775 $(this).parents('.dropdown-menu').find('li').removeClass('active'); 776 $(this).parent('li').addClass('active'); 777 $(this).parents('.dropdown-select').find('input[type=hidden]').val($(this).data('val')); 778 $(this).parents('.dropdown-select').find('[data-toggle="dropdown"]').html( $(this).html() ); 779 }).on('click', '.libtypes a', function(e) 780 { 781 e.preventDefault(); 782 let $layer = $(this).data('toggle'); 783 $('.libtypes a').removeClass('active'); 784 $(this).addClass('active'); 785 $('.libtype').hide(); 786 $('.' + $layer).show(); 787 }); 788 789 $('[data-fancybox]').fancybox(); 790 791 $(".phone").inputmask("+7 999-999-99-99"); 792 $(".uf_ticket").inputmask("99 999999"); 793 $(".year").inputmask("9999"); 794 795 $('.birthday').datepicker({ 796 changeMonth: true, 797 changeYear: true, 798 closeText: 'ÐакÑÑÑÑ', 799 prevText: '<ÐÑед', 800 nextText: 'След>', 801 currentText: 'СегоднÑ', 802 monthNames: ['ЯнваÑÑ','ФевÑалÑ','ÐаÑÑ','ÐпÑелÑ','Ðай','ÐÑнÑ', 803 'ÐÑлÑ','ÐвгÑÑÑ','СенÑÑбÑÑ','ÐкÑÑбÑÑ','ÐоÑбÑÑ','ÐекабÑÑ'], 804 monthNamesShort: ['Янв','Фев','ÐаÑ','ÐпÑ','Ðай','ÐÑн', 805 'ÐÑл','Ðвг','Сен','ÐкÑ','ÐоÑ','Ðек'], 806 dayNames: ['воÑкÑеÑенÑе','понеделÑник','вÑоÑник','ÑÑеда','ÑеÑвеÑг','пÑÑниÑа','ÑÑббоÑа'], 807 dayNamesShort: ['вÑк','пнд','вÑÑ','ÑÑд','ÑÑв','пÑн','ÑбÑ'], 808 dayNamesMin: ['ÐÑ','Ðн','ÐÑ','СÑ','ЧÑ','ÐÑ','Сб'], 809 weekHeader: 'Ðед', 810 dateFormat: 'dd.mm.yy', 811 firstDay: 1, 812 isRTL: false, 813 showMonthAfterYear: false, 814 yearSuffix: '', 815 yearRange: "-100:+0" 816 }); 817 818 819 $('.datepicker-input').datepicker({ 820 language: "ru", 821 todayHighlight: true, 822 autoclose: true, 823 format: 'dd.yyyy.mm', 824 container: '.datepicker-container' 825 }) 826 827 $('.custom-select').chosen({ 828 width: "100%", 829 disable_search: true, 830 allow_single_deselect: true 831 }); 832 833 const swiper = new Swiper('.main-slider', { 834 autoplay: { 835 delay: 20000, 836 }, 837 spaceBetween: 0, 838 slidesPerView: 'auto', 839 autoHeight: true, 840 loop: false, 841 pagination: { 842 el: ".main-slider-pagination", 843 type: "fraction", 844 }, 845 navigation: { 846 nextEl: ".main-slider-next", 847 prevEl: ".main-slider-prev", 848 }, 849 breakpoints: { 850 1000: { 851 spaceBetween: 20, 852 } 853 } 854 }); 855 const swiperAbout = new Swiper('.about-slider', { 856 spaceBetween: 20, 857 centeredSlides: true, 858 slidesPerView: 'auto', 859 autoHeight: true, 860 loop: true, 861 pagination: { 862 el: ".main-slider-pagination", 863 type: "fraction", 864 }, 865 navigation: { 866 nextEl: ".main-slider-next", 867 prevEl: ".main-slider-prev", 868 } 869 }); 870 const swiperDetail = new Swiper('.detail-gallery-swiper', { 871 spaceBetween: 0, 872 slidesPerView: '1', 873 loop: true, 874 autoHeight: true, 875 pagination: { 876 el: ".main-slider-pagination", 877 type: "fraction", 878 }, 879 navigation: { 880 nextEl: ".detail-gallery-next", 881 prevEl: ".detail-gallery-prev", 882 }, 883 }); 884 885 var libraryThumbs = new Swiper(".library-thumbs", { 886 loop: true, 887 spaceBetween: 25, 888 slidesPerView: 4, 889 freeMode: true, 890 autoHeight: true, 891 watchSlidesProgress: true, 892 navigation: { 893 nextEl: ".thumbs-slider-next", 894 prevEl: ".thumbs-slider-prev", 895 }, 896 }); 897 var libraryGal = new Swiper(".library-gallery", { 898 loop: true, 899 spaceBetween: 10, 900 autoHeight: true, 901 navigation: { 902 nextEl: ".main-slider-next", 903 prevEl: ".main-slider-prev", 904 }, 905 pagination: { 906 el: ".main-slider-pagination", 907 type: "fraction", 908 }, 909 thumbs: { 910 swiper: libraryThumbs, 911 }, 912 }); 913 914 915 $('[data-toggle="tolltip"]').tooltip(); 916 917 if ($('.share-buttons').size() > 0){ 918 window.Sharer.init(); 919 } 920 921 $('.rating-value').each(function () { 922 var start = $(this).data('value') ? $(this).data('value') : 0, 923 ro = $(this).data('readonly') ? true : false, 924 elem = $(this); 925 if (ro) 926 elem.addClass('readonly') 927 $(this).starrr({ 928 max: 10, 929 rating: start, 930 readOnly: ro, 931 change: function(e, value){ 932 console.log(value) 933 $(this).parents('.rating-container').find('.star-input').val(value) 934 } 935 }) 936 }); 937 938 939 $(".custom-swiper").each(function(index, element){ 940 var $this = $(this)[0]; 941 var arrPrev = $(this).parents('.swiper-section-container').find('.swiper-prev')[0]; 942 var arrNext = $(this).parents('.swiper-section-container').find('.swiper-next')[0]; 943 var paging = $(this).parents('.swiper-section-container').find('.swiper-pagination')[0]; 944 var perView = $(this).data('per_view') ? $(this).data('per_view') : 'auto'; 945 var b_580 = $(this).data('b_580') ? $(this).data('b_580') : perView; 946 var b_760 = $(this).data('b_760') ? $(this).data('b_760') : perView; 947 var b_1000 = $(this).data('b_1000') ? $(this).data('b_1000') : b_760; 948 949 950 var slider = new Swiper($this, { 951 loop: false, 952 threshold: 20, 953 spaceBetween: 20, 954 autoHeight: true, 955 slidesPerView: perView, 956 pagination: { 957 el: paging, 958 clickable: true 959 }, 960 navigation: { 961 nextEl: arrNext, 962 prevEl: arrPrev, 963 disabledClass: 'disabled', 964 }, 965 breakpoints: { 966 1000: { 967 slidesPerView: b_1000, 968 }, 969 760: { 970 slidesPerView: b_760, 971 freeMode: false, 972 }, 973 600: { 974 slidesPerView: b_580, 975 freeMode: false, 976 } 977 } 978 979 }); 980 981 }); 982 983 $('.input-file input[type=file]').on('change', function(){ 984 let $files_list = $(this).closest('.input-file').next(); 985 $files_list.empty(); 986 987 for(var i = 0; i < this.files.length; i++){ 988 let file = this.files.item(i); 989 dt.items.add(file); 990 991 let reader = new FileReader();
992 reader.readAsDataURL(file); 993 reader.onloadend = function(){ 994 let new_file_input = '<div class="input-file-list-item">' + 995 '<img class="input-file-list-img" src="' + reader.result + '">' + 996 '<span class="input-file-list-name">' + file.name + '</span>' + 997 '<a href="#" onclick="removeFilesItem(this); return false;" class="input-file-list-remove">x</a>' + 998 '</div>'; 999 $files_list.append(new_file_input); 1000 } 1001 }; 1002 this.files = dt.files; 1003 }); 1004 1005}); 1006 1007function removeFilesItem(target){ 1008 let name = $(target).prev().text(); 1009 let input = $(target).closest('.input-file-row').find('input[type=file]'); 1010 $(target).closest('.input-file-list-item').remove(); 1011 for(let i = 0; i < dt.items.length; i++){ 1012 if(name === dt.items[i].getAsFile().name){ 1013 dt.items.remove(i); 1014 } 1015 } 1016 input[0].files = dt.files; 1017} 1018 1019$( function() { 1020 function log( message ) { 1021 $( "<div>" ).text( message ).prependTo( "#log" ); 1022 $( "#log" ).scrollTop( 0 ); 1023 } 1024 1025 $( "#birds" ).autocomplete({ 1026 source: function( request, response ) { 1027 $.ajax( { 1028 url: "search.php", 1029 dataType: "jsonp", 1030 data: { 1031 term: request.term 1032 }, 1033 success: function( data ) { 1034 response( data ); 1035 } 1036 } ); 1037 }, 1038 minLength: 2, 1039 select: function( event, ui ) { 1040 log( "Selected: " + ui.item.value + " aka " + ui.item.id ); 1041 } 1042 } ); 1043 } );
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.