1(function(){ 2 function qs(sel,ctx){return (ctx||document).querySelector(sel)} 3 function qsa(sel,ctx){return Array.prototype.slice.call((ctx||document).querySelectorAll(sel))} 4 5 function openModal(){ 6 var m=qs('#ovkc-spec-modal'); 7 if(!m)return; 8 m.classList.add('is-open'); 9 m.setAttribute('aria-hidden','false'); 10 document.body.classList.add('ovkc-modal-lock'); 11 setTimeout(initForm14Consent,50) 12 } 13 14 function closeModal(){ 15 var m=qs('#ovkc-spec-modal'); 16 if(!m)return; 17 m.classList.remove('is-open'); 18 m.setAttribute('aria-hidden','true'); 19 document.body.classList.remove('ovkc-modal-lock') 20 } 21 22 function selectMapPoint(link){ 23 var address=link.getAttribute('data-ovkc-map-address'); 24 if(!address)return; 25 26 var route=qs('#ovkc-route-link'); 27 var open=qs('#ovkc-map-open'); 28 var external='https://yandex.ru/maps/?mode=search&text='+encodeURIComponent(address); 29 30 if(route)route.href=external; 31 if(open)open.href=external; 32 33 qsa('[data-ovkc-place]').forEach(function(item){ 34 item.classList.toggle('is-active',item.getAttribute('data-address')===address) 35 }) 36 } 37 38 function addConsent(form){ 39 if(!form || form.getAttribute('data-ovk-form14-consent')==='1')return; 40 41 var idField=form.querySelector('input[name="WEB_FORM_ID"]'); 42 if(!idField || String(idField.value)!=='14')return; 43 44 var submit=form.querySelector('input[type="submit"],button[type="submit"]'); 45 if(!submit)return; 46 47 var consent=document.createElement('div'); 48 consent.className='ovk-form14-consent'; 49 consent.innerHTML='<label class="ovk-form14-consent__label"><input class="ovk-form14-consent__input" type="checkbox" name="OVK_PRIVACY_CONSENT" value="Y" required checked><span class="ovk-form14-consent__box" aria-hidden="true"></span><span class="ovk-form14-consent__text">ÐÑодолжаÑ, Ð²Ñ ÑоглаÑаеÑеÑÑ Ñ <a href="/include/licenses_detail.php" target="_blank" rel="noopener">полиÑикой конÑиденÑиалÑноÑÑи</a></span></label>'; 50 51 var submitRow=submit.closest('tr'); 52 53 if(submitRow && submitRow.parentNode){ 54 var row=document.createElement('tr'); 55 row.className='ovk-form14-consent-row'; 56 57 var cell=document.createElement('td'); 58 cell.colSpan=2; 59 cell.appendChild(consent); 60 row.appendChild(cell); 61 62 submitRow.parentNode.insertBefore(row,submitRow) 63 }else{ 64 var parent=submit.parentNode; 65 if(parent)parent.insertBefore(consent,submit) 66 } 67 68 var checkbox=consent.querySelector('.ovk-form14-consent__input'); 69 70 checkbox.addEventListener('change',function(){ 71 checkbox.setCustomValidity('') 72 }); 73 74 form.addEventListener('submit',function(e){ 75 if(!checkbox.checked){ 76 e.preventDefault(); 77 e.stopImmediatePropagation(); 78 checkbox.setCustomValidity('ÐÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ ÑоглаÑиÑÑÑÑ Ñ Ð¿Ð¾Ð»Ð¸Ñикой конÑиденÑиалÑноÑÑи'); 79 checkbox.reportValidity(); 80 return false 81 } 82 checkbox.setCustomValidity('') 83 },true); 84 85 submit.addEventListener('click',function(e){ 86 if(!checkbox.checked){ 87 e.preventDefault(); 88 e.stopImmediatePropagation(); 89 checkbox.setCustomValidity('ÐÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ ÑоглаÑиÑÑÑÑ Ñ Ð¿Ð¾Ð»Ð¸Ñикой конÑиденÑиалÑноÑÑи'); 90 checkbox.reportValidity(); 91 checkbox.focus() 92 } 93 },true); 94 95 form.setAttribute('data-ovk-form14-consent','1') 96 } 97 98 function initForm14Consent(){ 99 qsa('#ovkc-spec-modal form,.ovkc-bitrix-form form').forEach(addConsent) 100 } 101 102 document.addEventListener('click',function(e){ 103 if(e.target.closest('[data-ovkc-open-spec]')){ 104 e.preventDefault(); 105 openModal() 106 } 107 108 if(e.target.closest('[data-ovkc-close-spec]')){ 109 e.preventDefault(); 110 closeModal() 111 } 112 113 var mapLink=e.target.closest('[data-ovkc-map-address]'); 114 if(mapLink)selectMapPoint(mapLink) 115 }); 116 117 document.addEventListener('keydown',function(e){ 118 if(e.key==='Escape')closeModal() 119 }); 120 121 if(document.readyState==='loading'){ 122 document.addEventListener('DOMContentLoaded',initForm14Consent) 123 }else{ 124 initForm14Consent() 125 } 126 127 var observer=new MutationObserver(function(){ 128 initForm14Consent() 129 }); 130 131 observer.observe(document.documentElement,{childList:true,subtree:true}) 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.