1// Set fixed elements that need padding-right when locking the scroll 2window.paddingRightItems = '#page-header'; 3 4 5var bodyScrollOptions = { 6 reserveScrollBarGap: true 7}; 8 9function openModal(hrefModal) { 10 11 if ($(hrefModal).length > 0) { 12 $(hrefModal).trigger('beforeOpenModal').addClass('active'); 13 14 setTimeout(function () { 15 $(hrefModal).addClass('fadeIn').trigger('afterOpenModal'); 16 }, 50); 17 18 bodyScrollLock.clearAllBodyScrollLocks(); 19 bodyScrollLock.disableBodyScroll(hrefModal, bodyScrollOptions); 20 } 21} 22 23var $inputs = $('input:not([type="tel"])'); 24$inputs.on('blur', function () { 25 this.scrollTo(0, 0); 26}) 27 28function closeModals() { 29 $('.popup-block.active').trigger('beforeCloseModal').removeClass('fadeIn'); 30 31 setTimeout(function () { 32 $('.popup-block.active').removeClass('active', function () { 33 bodyScrollLock.clearAllBodyScrollLocks(); 34 }).trigger('afterCloseModal'); 35 36 bodyScrollLock.clearAllBodyScrollLocks(); 37 }, 200); 38} 39 40$(document).keydown(function (event) { 41 if (event.keyCode == 27) { 42 closeModals(); 43 } 44}); 45 46 47$(document.body).on('click', '[data-toggle="switch-modal"]', function (e) { 48 e.preventDefault(); 49 50 var hrefModal = $(this).attr('data-target'); 51 52 $('.popup-block:not(:hidden)').fadeOut(200); 53 54 $(hrefModal).fadeIn(200); 55 56 bodyScrollLock.disableBodyScroll(hrefModal, bodyScrollOptions); 57 58}); 59 60// Basic open modal 61$(document.body).on('click', '[data-toggle="modal"]', function (e) { 62 e.preventDefault(); 63 64 var hrefModal = $(this).attr('data-target'); 65 66 openModal(hrefModal); 67}); 68 69// Close modals if clicked on popup overlay 70$(document.body).on('click', '.popup-block__overlay', function (e) { 71 var closeButton = $(this).children('[data-toggle="modal-dismiss"]'); 72 73 if (!(e.target != this)) { 74 closeModals(); 75 } 76}); 77 78 79$(document.body).on('click', '[data-toggle="modal-dismiss"]', function (e) { 80 e.preventDefault(); 81 82 closeModals(); 83}); 84 85$(document).off('cut copy paste', '.no-paste').on('cut copy paste', '.no-paste', function (e) { 86 e.preventDefault(); 87}); 88 89$('input, textarea').each(function (e) { 90 if ($(this).val() != '') { 91 $(this).addClass('not-empty').parent().addClass('not-empty'); 92 } else { 93 $(this).removeClass('not-empty').parent().removeClass('not-empty'); 94 } 95}); 96 97 98$(document).off('change focusout keydown keypress input', 'input, textarea').on('change focusout keydown keypress input', 'input, textarea', function (e) { 99 if ($(this).val() != '') { 100 $(this).addClass('not-empty').parent().addClass('not-empty'); 101 } else { 102 $(this).removeClass('not-empty').parent().removeClass('not-empty'); 103 } 104}); 105 106$(document).off('focusin', 'input, textarea').on('focusin', 'input, textarea', function (e) { 107 $(this).parent().addClass('focused'); 108}); 109 110$(document).off('focusout', 'input, textarea').on('focusout', 'input, textarea', function (e) { 111 $(this).parent().removeClass('focused'); 112}); 113 114$(document).off('keypress keyup blur', '.only-digits').on('keypress keyup blur', '.only-digits', function (event) { 115 $(this).val($(this).val().replace(/[^0-9]/g, '')); 116 117 if ((event.which < 48 || event.which > 57)) { 118 event.preventDefault(); 119 } 120}); 121 122function isNumberKey(evt) { 123 var charCode = (evt.which) ? evt.which : event.keyCode 124 if (charCode != 43 && charCode > 31 && (charCode < 48 || charCode > 57)) 125 return false; 126 return true; 127} 128 129$(document).off('keypress keyup blur', 'input[type="tel"]').on('keypress keyup blur', 'input[type="tel"]', function (event) { 130 $(this).val($(this).val().replace(/[^0-9\+]/g, '')); 131 132 if (!isNumberKey(event)) { 133 event.preventDefault(); 134 } 135}); 136 137$(document).off('keypress keyup blur', '.only-floats').on('keypress keyup blur', '.only-floats', function (event) { 138 $(this).val($(this).val().replace(/[^0-9\,.]/g, '')); 139 140 if ((($(this).val().indexOf('.') != -1 || $(this).val().indexOf(',') != -1)) && (event.which < 48 || event.which > 57)) { 141 event.preventDefault(); 142 } 143}); 144 145$(document).off('click', '[data-toggle="clear-input"]').on('click', '[data-toggle="clear-input"]', function (e) { 146 e.preventDefault(); 147 148 $(this).parent().find('input').val('').trigger('change'); 149}); 150 151$('[data-toggle="scroll-to-top"]').click(function (e) { 152 e.preventDefault(); 153 154 $('html,body').animate({ 155 scrollTop: 0 156 }, 600); 157}); 158 159$('[data-toggle="anchor"]').click(function (e) { 160 e.preventDefault(); 161 162 var dataTarget = $(this).attr('data-target'), 163 targetPos = $(dataTarget).offset().top - 150; 164 165 $('html,body').animate({ 166 scrollTop: targetPos 167 }, 400); 168}); 169 170$('[data-toggle="tab"]').click(function (e) { 171 e.preventDefault(); 172 173 var dataTarget = $(this).attr('data-target'); 174 175 if ($(this).parent().is('li')) { 176 $(this).addClass('active').parent().addClass('active').siblings().removeClass('active').children().removeClass('active'); 177 } else { 178 $(this).addClass('active').siblings().removeClass('active'); 179 } 180 181 $(dataTarget).addClass('active').siblings().removeClass('active'); 182}); 183 184$('[data-toggle="find-start-tab"]').click(function (e) { 185 e.preventDefault(); 186 187 var dataTarget = $(this).attr('data-target'); 188 189 $(this).addClass('active').siblings().removeClass('active'); 190 191 $(dataTarget).addClass('active').siblings().removeClass('active'); 192}); 193 194$('[data-toggle="find-start-swap"]').click(function (e) { 195 e.preventDefault(); 196 197 var dataTarget = $(this).parent().find('[data-toggle="find-start-tab"]').not('.active'); 198 199 $(dataTarget).trigger('click'); 200}); 201 202$('input[type="number"]').on('keydown', function (e) { 203 -1 !== $.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) || (/65|67|86|88/.test(e.keyCode) && (e.ctrlKey === true || e.metaKey === true)) && (!0 === e.ctrlKey || !0 === e.metaKey) || 35 <= e.keyCode && 40 >= e.keyCode || (e.shiftKey || 48 > e.keyCode || 57 < e.keyCode) && (96 > e.keyCode || 105 < e.keyCode) && e.preventDefault(); 204}); 205 206$('.agree-checkbox').each(function () { 207 var thisCheckbox = $(this); 208 var thisButton = $(this).parents('form').find('button[type="submit"]'); 209 210 $(thisCheckbox).on('change', function () { 211 if (!$(thisCheckbox).is(':checked')) { 212 $(thisButton).addClass('disabled'); 213 } else { 214 $(thisButton).removeClass('disabled'); 215 } 216 }); 217 218 if (!$(thisCheckbox).is(':checked')) { 219 $(thisButton).addClass('disabled'); 220 } 221}); 222 223// Form Validation 224$.extend($.validator.messages, { 225 required: "This field is required", 226 email: "Enter the correct E-mail format", 227 url: "Enter the correct URL format", 228 date: "Enter the correct date format", 229 number: "Enter numbers", 230 digits: "Enter numbers", 231 creditcard: "Enter valid credit card data", 232 equalTo: "The fields must match", 233 maxlength: jQuery.validator.format("Max length - {0} signs"), 234 minlength: jQuery.validator.format("Min lenght - {0} signs"), 235 rangelength: jQuery.validator.format("Length must be from {0} to {1} signs"), 236 range: jQuery.validator.format("Enter number from {0} to {1}"), 237 max: jQuery.validator.format("Max allowed value - {0}."), 238 min: jQuery.validator.format("Min allowed value - {0}.") 239}); 240 241$.validator.methods.email = function (value, element) { 242 var trimmedValue = value.trim(); 243 return this.optional(element) || /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(trimmedValue); 244} 245 246$.validator.addMethod('lettersonly', function (value, element) { 247 return this.optional(element) || /^[a-zа-ÑÑ\-\s]+$/iu.test(value); 248}, 'Only letters can be entered'); 249 250$.validator.methods.number = function (value, element) { 251 return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:[\s\.,]\d{3})+)(?:[\.,]\d+)?$/.test(value); 252}; 253 254$.validator.methods.range = function (value, element, param) { 255 var globalizedValue = value.replace(",", "."); 256 return this.optional(element) || (globalizedValue >= param[0] && globalizedValue <= param[1]); 257}; 258 259$.validator.methods.min = function (value, element, param) { 260 value = value.replace(",", "."); 261 return this.optional(element) || value >= param; 262}; 263 264$.validator.methods.max = function (value, element, param) { 265 value = value.replace(",", "."); 266 return this.optional(element) || value <= param; 267}; 268 269$(document).ready(function () { 270 271 $(".form-validate").each(function () {
272 $(this).validate({ 273 validateDelegate: function () { }, 274 onsubmit: true, 275 errorElement: "div", 276 errorPlacement: function (error, element) { 277 error.addClass('invalid-feedback'); 278 279 var elementType = element.prop('type'); 280 281 switch (elementType) { 282 case 'select-one': 283 error.appendTo(element.parent()); 284 break; 285 286 case 'checkbox': 287 error.insertAfter(element.parent()); 288 289 break; 290 291 case 'radio': 292 if (element.parents('.type-transport-change-order')) { 293 error.insertAfter(element.parents('.type-transport-change-order').prev().find('h6')); 294 } else { 295 error.insertAfter(element.parent()); 296 } 297 298 break; 299 300 default: 301 error.insertAfter(element); 302 303 break; 304 305 } 306 307 }, 308 highlight: function (element, errorClass, validClass) { 309 $(element).addClass("is-invalid").parent().addClass("is-invalid"); 310 }, 311 unhighlight: function (element, errorClass, validClass) { 312 $(element).removeClass("is-invalid").parent().removeClass("is-invalid"); 313 }, 314 focusInvalid: false, 315 invalidHandler: function (form, validator) { 316 317 if (!validator.numberOfInvalids()) 318 return; 319 320 var scrollToElement = $(validator.errorList[0].element); 321 322 if ($(scrollToElement).prop('type') === 'select-one' || $(scrollToElement).prop('type') === 'radio' || $(scrollToElement).prop('type') === 'checkbox') { 323 scrollToElement = $(scrollToElement).parent(); 324 } 325 326 if ($(scrollToElement).parents('.popup-block').length > 0) { 327 var thisModal = $(this).parents('.popup-block'); 328 329 var scrollTopValue = $(thisModal).scrollTop() + $(scrollToElement).offset().top - 120; 330 331 $(thisModal).animate({ 332 scrollTop: scrollTopValue 333 }, 400); 334 335 } else { 336 var scrollTopValue = $(scrollToElement).offset().top - 120; 337 338 if ($(window).width() > 768) { 339 scrollTopValue = $(scrollToElement).offset().top - 220; 340 } 341 342 $('html, body').animate({ 343 scrollTop: scrollTopValue 344 }, 400); 345 } 346 347 }, 348 ignore: '.tab-pane:hidden *, :disabled, .no-validate' 349 }); 350 351 setTimeout(function () { 352 $(this).find('.num-input').each(function () { 353 $(this).rules('add', { 354 required: true, 355 number: true 356 }); 357 }); 358 359 $(this).find('[type="email"]').each(function () { 360 $(this).rules('add', { 361 required: true, 362 email: true 363 }); 364 }); 365 }, 0); 366 }); 367 368}); 369 370 371$(document).ready(function () { 372 $.fn.select2.defaults.set('language', 'ru'); 373 374 $('select:not(.autocomplete-select)').not($('.d-none').find('select')).select2({ 375 minimumResultsForSearch: -1, 376 locale: 'ru', 377 dropdownAutoWidth: true, 378 width: '100%', 379 allowClear: true, 380 placeholder: function () { 381 $(this).attr('data-placeholder'); 382 } 383 }); 384 385 $('#form-ad-add').find('[name="type_price_sell"]').select2({ 386 minimumResultsForSearch: -1, 387 locale: 'ru', 388 dropdownAutoWidth: true, 389 width: '100%', 390 allowClear: true, 391 placeholder: function () { 392 $(this).attr('data-placeholder'); 393 } 394 }); 395 396 $('#form-ad-add').find('[name="type_price_sell"]').on('select2:select', function (e) { 397 $(e.currentTarget).parent().removeClass('is-invalid'); 398 $(e.currentTarget).parent().find('.error').css('display', 'none'); 399 }); 400 401 402 $('select:not(.autocomplete-select)').not($('.d-none').find('select')).on('select2:select', function (e) { 403 $(e.currentTarget).parent().removeClass('is-invalid'); 404 $(e.currentTarget).parent().find('.error').css('display', 'none'); 405 }); 406 407 var target = document.getElementById('location-wrapper'); 408 409 if (target) { 410 var observer = new MutationObserver(function (mutations) { 411 mutations.forEach(function (mutation) { 412 if (mutation && $(mutation.addedNodes).find('[name="price_type[]"]').length > 0) { 413 $(mutation.addedNodes).find('[name="price_type[]"]').select2({ 414 minimumResultsForSearch: -1, 415 locale: 'ru', 416 dropdownAutoWidth: true, 417 width: '100%', 418 allowClear: true, 419 placeholder: function () { 420 $(this).attr('data-placeholder'); 421 } 422 }); 423 } 424 }); 425 }); 426 427 observer.observe(target, { 428 childList: true, 429 subtree: true 430 }); 431 } 432 433 /* 434 var autoCompleteOptions = { 435 data: [ 436 {"name": "Afghanistan", "code": "AF"}, 437 {"name": "Aland Islands", "code": "AX"}, 438 {"name": "Albania", "code": "AL"}, 439 {"name": "Algeria", "code": "DZ"}, 440 {"name": "American Samoa", "code": "AS"} 441 ], 442 getValue: "name", 443 list: { 444 match: { 445 enabled: true 446 } 447 }, 448 theme: "square" 449 }; 450 451 $('.autocomplete-select').easyAutocomplete(autoCompleteOptions); 452 */ 453 454 $('.checkselect').checkselect(); 455}); 456 457 458$(window).on('scroll load orientationchange', function () { 459 var scrolledHeight = 100; 460 461 if ($(this).scrollTop() > scrolledHeight && !($('body').hasClass("scrolled"))) { 462 $('body').addClass("scrolled"); 463 } else if ($(this).scrollTop() <= scrolledHeight && $('body').hasClass("scrolled")) { 464 $('body').removeClass("scrolled"); 465 } 466}); 467 468 469$('.first-block__login-slider').slick({ 470 slidesToShow: 1, 471 infinite: true, 472 arrows: true, 473 centerMode: true, 474 centerPadding: '0px', 475 variableWidth: true, 476 prevArrow: '<a href="javascript:;" class="first-block__arrow prev"><i class="icon-chevron-slider"></i></a>', 477 nextArrow: '<a href="javascript:;" class="first-block__arrow next"><i class="icon-chevron-slider"></i></a>', 478 dots: true, 479 adaptiveHeight: true 480}); 481 482$('.work-process-block__slider').slick({ 483 slidesToShow: 3, 484 infinite: false, 485 arrows: true, 486 variableWidth: true, 487 prevArrow: '<a href="javascript:;" class="work-process-block__arrow prev"><i class="icon-arrow"></i></a>', 488 nextArrow: '<a href="javascript:;" class="work-process-block__arrow next"><i class="icon-arrow"></i></a>', 489 dots: true, 490 responsive: [ 491 { 492 breakpoint: 1200, 493 settings: { 494 slidesToShow: 2 495 } 496 }, 497 { 498 breakpoint: 768, 499 settings: { 500 slidesToShow: 1, 501 centerMode: true, 502 centerPadding: '0px',
503 arrows: false 504 } 505 } 506 ] 507}); 508 509$('.rating-block').barrating({ 510 theme: 'css-stars', 511 allowEmpty: true, 512 readonly: true 513}); 514 515$('.rate-select').barrating({ 516 theme: 'css-stars', 517 allowEmpty: true, 518 onSelect: function (value, text, event) { 519 if (typeof (event) !== 'undefined') { 520 if ($(event.target).parents('.form-validate').length > 0) { 521 $(event.target).parents('.br-wrapper').find('select').valid(); 522 } 523 } 524 } 525}); 526 527$('[data-tooltip]').tooltipster({ 528 delay: 0, 529 trigger: 'custom', 530 contentAsHTML: true, 531 triggerOpen: { 532 mouseenter: true, 533 touchstart: true, 534 click: true, 535 tap: true 536 }, 537 triggerClose: { 538 click: true, 539 scroll: true, 540 tap: true, 541 mouseleave: true 542 } 543}); 544 545$('.date-mask').inputmask({ 546 alias: "datetime", 547 placeholder: "__-__-____", 548 separator: "-", 549 inputFormat: 'dd-mm-yyyy' 550}); 551 552// if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1){ 553// $('input').not('[type="tel"]').on('focusout', function () { 554// }) 555// } 556 557function is_touch_device() { 558 try { 559 document.createEvent("TouchEvent"); 560 return true; 561 } catch (e) { 562 return false; 563 } 564} 565 566if (is_touch_device()) { 567 $('[data-toggle="expand"]').next().hide(); 568 $('[data-toggle="expand"]').on('touchstart', function (e) { 569 e.preventDefault(); 570 if ($(this).hasClass('find-contractor__addit-preferences-toggle')) { 571 $(this).toggleClass('active'); 572 } 573 $(this).parent().toggleClass('hover'); 574 $(this).next().stop().slideToggle(200); 575 }); 576 if ($('.cabinet-post-form .input-block .images-container .images-middle-container .img-wrapper').length > 0) { 577 var observerImg = new MutationObserver(function (mutations) { 578 mutations.forEach(function (mutation) { 579 mutation.addedNodes.forEach(function (node) { 580 if (!$(node).hasClass('img-wrapper__empty') && node !== mutation.addedNodes[0]) { 581 $(node).on('touchstart', function (e) { 582 if (!$(node).hasClass('text-shown')) { 583 e.stopPropagation(); 584 } 585 $(mutation.addedNodes).removeClass('hover'); 586 $(node).addClass('hover'); 587 }) 588 $(node).on('touchend', function (e) { 589 $(mutation.addedNodes).removeClass('text-shown'); 590 $(node).addClass('text-shown'); 591 }) 592 } 593 }) 594 $(document.body).on('click', function (e) { 595 if (!$(e.target).hasClass('label-image') && !$(e.target).hasClass('overlay-text')) { 596 e.preventDefault(); 597 $(mutation.addedNodes).removeClass('text-shown'); 598 $(mutation.addedNodes).removeClass('hover'); 599 } 600 }); 601 }); 602 }); 603 604 observerImg.observe($('.cabinet-post-form .input-block .images-container .images-middle-container')[0], { 605 childList: true, 606 subtree: true 607 }); 608 } 609 610} else { 611 $('[data-toggle="expand"]').on('click', function (e) { 612 e.preventDefault(); 613 614 $(this).toggleClass('active').parent().toggleClass('active'); 615 $(this).next().stop().slideToggle(200); 616 }); 617} 618 619$('#header_menu_toggle').on('click', function (e) { 620 e.preventDefault(); 621 622 $('#header-menu').addClass('active'); 623 bodyScrollLock.clearAllBodyScrollLocks(); 624 bodyScrollLock.disableBodyScroll('#header-menu', bodyScrollOptions); 625}); 626 627$('#header_menu_close').on('click', function (e) { 628 e.preventDefault(); 629 630 $('#header-menu').removeClass('active'); 631 bodyScrollLock.clearAllBodyScrollLocks(); 632}); 633 634$('.about-block__team-slider').slick({ 635 slidesToShow: 4, 636 infinite: false, 637 arrows: true, 638 variableWidth: true, 639 prevArrow: '<a href="javascript:;" class="about-block__arrow prev"><i class="icon-arrow"></i></a>', 640 nextArrow: '<a href="javascript:;" class="about-block__arrow next"><i class="icon-arrow"></i></a>', 641 dots: true, 642 responsive: [ 643 { 644 breakpoint: 1200, 645 settings: { 646 slidesToShow: 3 647 } 648 }, 649 { 650 breakpoint: 768, 651 settings: { 652 slidesToShow: 1, 653 centerMode: true, 654 centerPadding: '0px',
655 arrows: false 656 } 657 } 658 ] 659}); 660 661$('.articles-block__proposal-slider').slick({ 662 slidesToShow: 4, 663 infinite: true, 664 arrows: true, 665 prevArrow: '<a href="javascript:;" class="articles-block__arrow prev"><i class="icon-arrow"></i></a>', 666 nextArrow: '<a href="javascript:;" class="articles-block__arrow next"><i class="icon-arrow"></i></a>', 667 dots: true, 668 responsive: [ 669 { 670 breakpoint: 1000, 671 settings: { 672 slidesToShow: 3 673 } 674 }, 675 { 676 breakpoint: 768, 677 settings: { 678 slidesToShow: 1, 679 centerMode: true, 680 centerPadding: '0px', 681 arrows: false, 682 variableWidth: true 683 } 684 } 685 ] 686}); 687 688if ($('.offers-banners__slider').length > 0) { 689 690 $('.offers-banners__slider').each(function () { 691 var thisElem = $(this); 692 693 var thisElemSlidesCount = $(this).children().length; 694 695 var thisAllCountBlock = $(this).parents('.offers-banners').find('.offers-banners__quant').find('.all-count'); 696 var thisCurrentCountBlock = $(this).parents('.offers-banners').find('.offers-banners__quant').find('.current'); 697 698 $(thisCurrentCountBlock).text('1'); 699 $(thisAllCountBlock).text(thisElemSlidesCount); 700 701 $(thisElem).slick({ 702 slidesToShow: 1, 703 infinite: true, 704 arrows: true, 705 prevArrow: '<a href="javascript:;" class="offers-banners__arrow prev"><i class="icon-chevron"></i></a>', 706 nextArrow: '<a href="javascript:;" class="offers-banners__arrow next"><i class="icon-chevron"></i></a>', 707 dots: false, 708 responsive: [ 709 { 710 breakpoint: 768, 711 settings: { 712 arrows: false, 713 dots: true, 714 adaptiveHeight: true 715 } 716 } 717 ] 718 }); 719 720 $(thisElem).on('afterChange', function (e, slick, currentSlide) { 721 $(thisCurrentCountBlock).text(currentSlide + 1); 722 }); 723 }); 724} 725 726 727$('[data-toggle="railways_table_expand"]').on('click', function (e) { 728 e.preventDefault(); 729 730 var thisTarget = $(this).parents('.railways-block__tr').next(); 731 732 $(this).toggleClass('active'); 733 $(thisTarget).slideToggle(200); 734}); 735 736$('[data-toggle="sort-toggle"]').on('click', function (e) { 737 e.preventDefault(); 738 739 if ($(this).hasClass('asc-sorting') || $(this).hasClass('desc-sorting') || $(this).hasClass('active')) { 740 $(this).toggleClass('asc-sorting desc-sorting').siblings().removeClass('asc-sorting desc-sorting active'); 741 } else { 742 $(this).addClass('active asc-sorting').siblings().removeClass('asc-sorting desc-sorting active'); 743 } 744}); 745 746$('[data-toggle="view-mode-toggle"]').on('click', function (e) { 747 e.preventDefault(); 748 749 var thisTarget = $(this).attr('data-target'); 750 var thisMode = $(this).attr('data-mode'); 751 752 $(this).addClass('active').siblings().removeClass('active'); 753 754 if (thisMode == 'grid') { 755 $(thisTarget).removeClass('list-view').addClass('grid-view'); 756 } else { 757 $(thisTarget).removeClass('grid-view').addClass('list-view'); 758 } 759 760}); 761 762// ÑаÑÑÑжение textarea 763$('textarea[data-autoresize]').autosize(); 764 765// оÑкÑÑÑие и закÑÑÑие Ð¼ÐµÐ½Ñ ÐаÑалог ÑÐµÑ Ð½Ð¸ÐºÐ¸ по ÐºÐ»Ð¸ÐºÑ Ð²Ð½Ðµ окна 766if ($('.catalog-tech__nav').length > 0) { 767 $(document).on('click', function (e) { 768 if (!($(e.target).hasClass('catalog-tech__nav') || $(e.target).parents().hasClass('catalog-tech__nav') || $(e.target).hasClass('catalog-tech__link'))) { 769 $('[data-toggle="catalog-tech-nav"]').removeClass('active'); 770 $('.catalog-tech__nav').removeClass('active'); 771 } 772 }); 773 774 $('.catalog-tech__link').on('click', function (e) { 775 e.preventDefault(); 776 $(this).toggleClass('active'); 777 $('.catalog-tech__nav').toggleClass('active'); 778 }); 779} 780 781// ÑÐ»Ð°Ð¹Ð´ÐµÑ Ð½Ð° ÑÑÑаниÑе - СÑÑаниÑа Ñаздела 782if ($('.hot-offers__slider').length > 0) { 783 $('.hot-offers__slider').slick({ 784 slidesToShow: 4, 785 infinite: false, 786 arrows: true, 787 prevArrow: '<a href="javascript:;" class="hot-offers__arrow prev"><i class="icon-arrow"></i></a>', 788 nextArrow: '<a href="javascript:;" class="hot-offers__arrow next"><i class="icon-arrow"></i></a>', 789 dots: true, 790 responsive: [ 791 { 792 breakpoint: 1200, 793 settings: { 794 slidesToShow: 3 795 } 796 }, 797 { 798 breakpoint: 1000, 799 settings: { 800 slidesToShow: 2 801 } 802 }, 803 { 804 breakpoint: 768, 805 settings: { 806 slidesToShow: 2, 807 centerMode: true, 808 centerPadding: '0px', 809 variableWidth: true 810 } 811 }, 812 { 813 breakpoint: 500, 814 settings: { 815 slidesToShow: 1,
816 arrows: false 817 } 818 } 819 ] 820 }); 821} 822 823// ÑаÑкÑÑÑие блоков на ÑÑÑаниÑе - СÑÑаниÑа Ñаздела 824$('.subsection-block__header-js').on('click', function (e) { 825 e.preventDefault(); 826 $(this).toggleClass('active').next().slideToggle(200); 827}); 828 829 830if ($('.product-block__slider').length > 0) { 831 832 $('.product-block__slider').each(function () { 833 var thisElem = $(this); 834 835 var thisElemSlidesCount = $(this).children().length; 836 837 var thisAllCountBlock = $(this).parents('.product-block__slider-wrapper').find('.product-block__slider-quant').find('.all-count'); 838 var thisCurrentCountBlock = $(this).parents('.product-block__slider-wrapper').find('.product-block__slider-quant').find('.current'); 839 840 $(thisCurrentCountBlock).text('1'); 841 $(thisAllCountBlock).text(thisElemSlidesCount); 842 843 $(thisElem).slick({ 844 slidesToShow: 1, 845 infinite: true, 846 arrows: true, 847 prevArrow: '<a href="javascript:;" class="product-block__arrow prev"><i class="icon-chevron"></i></a>', 848 nextArrow: '<a href="javascript:;" class="product-block__arrow next"><i class="icon-chevron"></i></a>', 849 dots: false, 850 responsive: [ 851 { 852 breakpoint: 768, 853 settings: { 854 arrows: false, 855 dots: true, 856 adaptiveHeight: true 857 } 858 } 859 ] 860 }); 861 862 $(thisElem).on('afterChange', function (e, slick, currentSlide) { 863 $(thisCurrentCountBlock).text(currentSlide + 1); 864 }); 865 }); 866} 867console.log($('.compare-block__items-slider')) 868 869 870$('.compare-block__items-slider').slick({ 871 infinite: false, 872 arrows: false, 873 prevArrow: '<a href="javascript:;" class="compare-block__arrow prev"><i class="icon-chevron"></i></a>', 874 nextArrow: '<a href="javascript:;" class="compare-block__arrow next"><i class="icon-chevron"></i></a>', 875 dots: true, 876 slidesToShow: 4, 877 adaptiveHeight: true, 878 responsive: [ 879 { 880 breakpoint: 992, 881 settings: { 882 slidesToShow: 3 883 } 884 }, 885 { 886 breakpoint: 768, 887 settings: { 888 arrows: true, 889 centerMode: false, 890 centerPadding: '0px', 891 variableWidth: true, 892 slidesToShow: 1 893 } 894 } 895 ] 896}); 897 898// $('.single-datepicker').each(function () { 899 900// if ($(this).val() == "") { 901// $(this).datepicker({ 902// language: 'en', 903// minDate: new Date(), 904// range: false, 905// autoClose: true, 906// multipleDatesSeparator: " - ", 907// onSelect: function (formattedDate, date, inst) { 908// if ($(inst.el).attr('name') === 'date_from') { 909// var minSelectedDate = $(inst.el).val().split('.'); 910// $('input[name="date_to"]').datepicker({ 911// language: 'en', 912// minDate: new Date(minSelectedDate[2], minSelectedDate[1] - 1, minSelectedDate[0]), 913// range: false, 914// autoClose: true, 915// multipleDatesSeparator: " - " 916// }) 917// } 918// if ($(inst.el).attr('name') === 'date_to') { 919// var minSelectedDate = $(inst.el).val().split('.'); 920// $('input[name="date_from"]').datepicker({ 921// language: 'en', 922// minDate: new Date(minSelectedDate[2], minSelectedDate[1] - 1, minSelectedDate[0]), 923// range: false, 924// autoClose: true, 925// multipleDatesSeparator: " - " 926// }) 927// } 928// } 929// }); 930// } else { 931// var datearr = ($(this).val()).split('.'); 932// var datestr = datearr[1] + '/' + datearr[0] + '/' + datearr[2]; 933// $(this).datepicker({ 934// language: 'en', 935// defaultDate: new Date(datestr), 936// range: false, 937// autoClose: true, 938// multipleDatesSeparator: " - ", 939// onSelect: function (formattedDate, date, inst) { 940// } 941// }); 942// } 943// }); 944 945$('.from-to-datepicker').each(function () { 946 947 $(this).datepicker({ 948 language: 'en', 949 minDate: new Date(), 950 range: true, 951 autoClose: true, 952 multipleDatesSeparator: " - " 953 }); 954}); 955 956$('button[type="reset"]').on('click', function () { 957 958 $(this).parents('form').find('select').each(function () { 959 $(this).val('').trigger('change'); 960 }); 961}); 962 963$('[data-toggle="add-to-compare"]').on('click', function (e) { 964 e.preventDefault(); 965 966 $(this).parent().toggleClass('active'); 967}); 968 969$('.textarea-count-chars').bind('input propertychange keypress', function () { 970 var thisTarget = $(this).attr('data-target'); 971 972 $(thisTarget).html(this.value.length); 973}); 974 975$('[data-toggle="find-contractor-show-more"]').on('click', function (e) { 976 e.preventDefault(); 977 978 $(this).toggleClass('active').parent().toggleClass('active'); 979}); 980 981$('.table-sort').tablesort(); 982 983var checkselekts = document.querySelectorAll('.checkselect-wrapper'); 984 985// if (checkselekts) {
986// checkselekts.forEach(function(element) { 987// element.addEventListener('click', function() { 988// var popUp = element.querySelector('.checkselect-popup'); 989// var arrow = element.querySelector('.checkselect-arrow'); 990// if (popUp.style.display === 'block') { 991// arrow.classList.toggle('checkselect-arrow--inverted'); 992// } 993// }); 994// }); 995// } 996 997$(".js-only-number").keypress(function (e) { 998 var charCode = (e.which) ? e.which : e.keyCode; 999 if (charCode > 31 && (charCode < 48 || charCode > 57)) { 1000 return false; 1001 } 1002}); 1003 1004if ($('#form-cargo-search').length > 0) { 1005 $(document).on('change', 'input[name=price_param]',function () { 1006 if($(this).attr('id')!="price_param1") { 1007 $(this).parent().parent().next().addClass('visually-hidden'); 1008 } else { 1009 $(this).parent().parent().next().removeClass('visually-hidden'); 1010 } 1011 }); 1012} 1013 1014if ($('input[name^="type_cargo"]')) { 1015 $('input[name^="type_cargo"]').on('click', function () { 1016 if ($(this).parent().hasClass('is-checked')) { 1017 $(this).parent().removeClass('is-checked'); 1018 $(this).prop('checked', false) 1019 } else { 1020 $(this).prop('checked', true); 1021 $('input[name^="type_cargo"]').parent().removeClass('is-checked'); 1022 $(this).parent().addClass('is-checked'); 1023 } 1024 }) 1025} 1026 1027 1028$(document).ready(function () { 1029 1030 var target = document.getElementById('location-wrapper'); 1031 1032 if (target) { 1033 var observerCargo = new MutationObserver(function (mutations) { 1034 mutations.forEach(function (mutation) { 1035 if (mutation && $(mutation.addedNodes).find('[name^="type_cargo"]').length > 0) { 1036 $(mutation.addedNodes).find('[name^="type_cargo"]').on('click', function () { 1037 if ($(this).parent().hasClass('is-checked')) { 1038 $(this).parent().removeClass('is-checked'); 1039 $(this).prop('checked', false) 1040 } else { 1041 $(this).prop('checked', true); 1042 $('input[name^="type_cargo"]').parent().removeClass('is-checked'); 1043 $(this).parent().addClass('is-checked'); 1044 } 1045 }) 1046 $(mutation.addedNodes).find('.checkselect').checkselect(); 1047 } 1048 }); 1049 }); 1050 1051 observerCargo.observe(target, { 1052 childList: true, 1053 subtree: true 1054 }); 1055 } 1056}) 1057 1058var dropdownInputs = document.querySelectorAll('.dropdown'); 1059var dropdownList = document.querySelectorAll('.dropdown-menu'); 1060 1061dropdownInputs.forEach(function(input) { 1062 input.addEventListener('input', function() { 1063 input.nextElementSibling.style.display = 'block'; 1064 1065 if (input.value === '') { 1066 input.nextElementSibling.style.display = 'none'; 1067 } 1068 }); 1069}); 1070 1071dropdownList.forEach(function(list) { 1072 list.addEventListener('click', function(evt) { 1073 list.previousElementSibling.value = evt.target.dataset.value; 1074 list.style.display = 'none'; 1075 }); 1076}); 1077 1078document.addEventListener('click', function(evt) { 1079 if (!evt.target.classList.contains('dropdown-menu')) { 1080 dropdownList.forEach(function(list) { 1081 list.style.display = 'none'; 1082 }); 1083 } 1084}); 1085 1086$(function(){ 1087 $("input[name='price_sell']").on('input', function (e) { 1088 $(this).val($(this).val().replace(/[^0-9]/g, '')); 1089 }); 1090}); 1091 1092 1093$(document).ready(function () { 1094 //Ð¤Ð¸ÐºÑ ÐºÐ°Ð»ÐµÐ½Ð´Ð°ÑÑ Ñ Ð´Ð°Ñой из value 1095 var datepickerFixDate = function (input) { 1096 if (input) { 1097 input.value = input.defaultValue; 1098 console.log(input.value); 1099 } 1100 }; 1101 1102 var DATE_FROM = document.querySelector('input[name="date_from"]'); 1103 var DATE_TO = document.querySelector('input[name="date_to"]'); 1104 datepickerFixDate(DATE_FROM); 1105 datepickerFixDate(DATE_TO); 1106});
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.