1jQuery(function($) { 2 3 $('.form').on('changed, keydown, blur, focusout', 'input, textarea', function(e){ 4 if(this.value /*&& !this.value.includes('_')*/){ 5 $(this).parent().find('.placeholder').addClass('placeholder_up'); 6 $(this).parent().find('.b24-form-control-label').addClass('placeholder_up'); 7 $(this).addClass('input_up'); 8 } 9 else{ 10 $(this).parent().find('.placeholder').removeClass('placeholder_up'); 11 $(this).parent().find('.b24-form-control-label').removeClass('placeholder_up'); 12 $(this).removeClass('input_up'); 13 } 14 }); 15 $('.form').on('focus', 'input, textarea', function(e){ 16 $(this).parent().find('.placeholder').addClass('placeholder_up'); 17 $(this).parent().find('.b24-form-control-label').addClass('placeholder_up'); 18 $(this).addClass('input_up'); 19 }); 20 21}); 22 23 24 25 26// вÑплÑваÑÑÐ°Ñ ÑоÑма 27let modalShown = false; 28const modal = document.getElementById('modal-cta'); 29 30const showModal = () => { 31 if (!modalShown && modal) { 32 // ÐÑовеÑка на оÑкÑÑÑÑе модалÑнÑе окна 33 const openModals = document.querySelectorAll('.modal.show'); 34 if (openModals.length > 0) { 35 return; 36 } 37 // ÐÑовеÑка, Ð½Ð°Ñ Ð¾Ð´Ð¸ÑÑÑ Ð»Ð¸ ÑокÑÑ Ð² input внÑÑÑи ÑоÑÐ¼Ñ Ñ ÐºÐ»Ð°ÑÑом .form 38 const activeElement = document.activeElement; 39 const isFormInputFocused = activeElement && activeElement.closest('.form') && activeElement.tagName === 'INPUT'; 40 if (isFormInputFocused) { 41 return; 42 } 43 modalShown = true; 44 new bootstrap.Modal(modal).show(); 45 } 46}; 47 48setTimeout(showModal, 50000); 49 50window.addEventListener('mouseout', function (e) { 51 if (e.clientY < 0) { 52 showModal(); 53 } 54}); 55 56 57// маÑка Ð¿Ð¾Ð»Ñ ÑелеÑона ÐиÑÑикÑ24 58document.addEventListener('DOMContentLoaded', function () { 59 const MAX_PHONE_LENGTH = 18; 60 61 function setupPhoneInput(input) { 62 if (input.dataset.masked) return; 63 64 input.dataset.masked = true; 65 input.setAttribute('maxlength', MAX_PHONE_LENGTH); 66 67 input.addEventListener('input', function (e) { 68 let value = e.target.value; 69 70 // УдалÑем недопÑÑÑимÑе ÑÐ¸Ð¼Ð²Ð¾Ð»Ñ 71 value = value.replace(/[^0-9+()\-\s]/g, ''); 72 73 // РегÑлÑÑное вÑÑажение Ð´Ð»Ñ ÑоÑÑийÑÐºÐ¸Ñ Ð½Ð¾Ð¼ÐµÑов: +7 (код) XXX-XXXX или 8 (код) XXX-XXXX 74 const phoneRegex = /^(\+7|8)\s\(\d{0,3}\)\s\d{0,3}-\d{0,4}$/; 75 76 if (value.length > MAX_PHONE_LENGTH) { 77 e.target.value = value.slice(0, MAX_PHONE_LENGTH); 78 } else if (!phoneRegex.test(value) && value !== '') { 79 // ÐÑли ввод наÑинаеÑÑÑ Ð½Ðµ Ñ +7 или 8, пÑинÑдиÑелÑно добавлÑем +7 80 if (!value.startsWith('+7') && !value.startsWith('8')) { 81 e.target.value = '+7 ' + value.replace(/^\+?\d?/, '').trim(); 82 } else { 83 e.target.value = value; 84 } 85 } 86 }); 87 88 input.addEventListener('paste', function (e) { 89 e.preventDefault(); 90 const pastedData = (e.clipboardData || window.clipboardData).getData('text'); 91 let cleanedData = pastedData.replace(/[^0-9+()\-\s]/g, '').slice(0, MAX_PHONE_LENGTH); 92 // ÐÑли вÑÑавленнÑй ÑекÑÑ Ð½Ðµ наÑинаеÑÑÑ Ñ +7 или 8, добавлÑем +7 93 if (!cleanedData.startsWith('+7') && !cleanedData.startsWith('8')) { 94 cleanedData = '+7 ' + cleanedData.replace(/^\+?\d?/, '').trim(); 95 } 96 e.target.value = cleanedData; 97 }); 98 99 } 100 101 const telInputs = document.querySelectorAll('.b24-form input[type="tel"]'); 102 telInputs.forEach(setupPhoneInput); 103 104 const observer = new MutationObserver(function (mutations) { 105 mutations.forEach(function (mutation) { 106 if (mutation.addedNodes.length) { 107 mutation.addedNodes.forEach(node => { 108 if (node.nodeType === 1) { 109 const inputs = node.matches('.b24-form input[type="tel"]') 110 ? [node] 111 : node.querySelectorAll('.b24-form input[type="tel"]'); 112 inputs.forEach(setupPhoneInput); 113 } 114 }); 115 } 116 }); 117 }); 118 119 observer.observe(document.body, { 120 childList: true, 121 subtree: true 122 }); 123}); 124 125 126 127 128 129 130 131 132
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.