'+esc(x.title)+'
'+esc(x.description||'')+'
(()=>{document.addEventListener('DOMContentLoaded',()=>{ document.querySelectorAll('form[role="search"]').forEach(f=>{f.action='/search/';f.method='get'}); document.querySelectorAll('.load-more-slots').forEach(b=>{b.addEventListener('click',e=>{e.preventDefault();e.stopImmediatePropagation();b.textContent='Все материалы загружены';b.setAttribute('disabled','disabled')},true)}); const box=document.querySelector('[data-static-search-results]');if(!box)return; const q=new URLSearchParams(location.search).get('s')||new URLSearchParams(location.search).get('q')||''; const input=document.querySelector('input[name="s"],input[name="q"]');if(input)input.value=q; if(!q.trim()){box.innerHTML='
Введите запрос в строке поиска.
';return} fetch('/static-data/search-index.json').then(r=>r.json()).then(rows=>{const words=q.toLocaleLowerCase('ru').split(/\\s+/).filter(Boolean);const found=rows.filter(x=>words.every(w=>(x.title+' '+x.description).toLocaleLowerCase('ru').includes(w)));box.innerHTML=found.length?found.map(x=>''+esc(x.description||'')+'
Ничего не найдено.
'}).catch(()=>{box.innerHTML='Не удалось загрузить индекс поиска.
'}); function esc(s){const d=document.createElement('div');d.textContent=s;return d.innerHTML} })})();