статичный вариант с докером

This commit is contained in:
denzel committed 2026-11-12 00:39:07 -05:00
commit 96fdbeb3df
12 files changed
+387

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
const input = document.querySelector('#search');
const sections = [...document.querySelectorAll('article section')];
const status = document.querySelector('#search-status');
const links = [...document.querySelectorAll('nav a')];
input.addEventListener('input', () => {
const query = input.value.trim().toLocaleLowerCase('ru');
let count = 0;
sections.forEach((section, index) => {
const matches = section.textContent.toLocaleLowerCase('ru').includes(query);
section.hidden = !matches;
links[index].hidden = !matches;
if (matches) count++;
});
status.hidden = !query;
status.textContent = count ? `Найдено разделов: ${count}` : 'Ничего не найдено. Попробуйте другой запрос.';
});
document.addEventListener('keydown', (event) => {
if (event.key === '/' && !event.ctrlKey && !event.metaKey && !['INPUT', 'TEXTAREA'].includes(document.activeElement.tagName) && !document.activeElement.isContentEditable) {
event.preventDefault();
input.focus();
}
if (event.key === 'Escape' && document.activeElement === input) {
input.value = '';
input.dispatchEvent(new Event('input'));
}
});
function updateNavigation() {
links.forEach(link => {
if (link.hash === location.hash) link.setAttribute('aria-current', 'location');
else link.removeAttribute('aria-current');
});
}
window.addEventListener('hashchange', updateNavigation);
updateNavigation();