PageSourceSearch

https://searchgo.ru/assets/js/front.js?v=20260908-public-scroll-1

js searchgo.ru collected 2026-10-09 23:44:43 UTC 2,471 bytes, 50 lines download raw bytes

1function syncHeaderNavigation() {
2  const desktopLinks = [...document.querySelectorAll('.main-nav .nav-link')];
3  const inCatalog = window.location.pathname.startsWith('/catalog/');
4  const categoriesActive = inCatalog && window.location.hash === '#categories';
5  desktopLinks.forEach((link) => {
6    if (inCatalog && ['/catalog/', '/catalog/#categories'].includes(link.getAttribute('href'))) {
7      link.classList.toggle('is-active', link.hash === '#categories' ? categoriesActive : !categoriesActive);
8    }
9    if (link.classList.contains('is-active')) link.setAttribute('aria-current', link.hash ? 'location' : 'page');
10    else link.removeAttribute('aria-current');
11  });
12  document.querySelectorAll('.mobile-menu .nav-link').forEach((link) => {
13    const desktop = desktopLinks.find((item) => item.getAttribute('href') === link.getAttribute('href'));
14    const active = desktop?.classList.contains('is-active') ?? false;
15    link.classList.toggle('is-active', active);
16    if (active) link.setAttribute('aria-current', desktop.getAttribute('aria-current'));
17    else link.removeAttribute('aria-current');
18  });
19}
20
21// Public pages always keep the document itself scrollable. Native dialogs own
22// their backdrop and focus without changing the root scrolling element.
23document.documentElement.classList.remove('complaint-open');
24window.addEventListener('pageshow', () => document.documentElement.classList.remove('complaint-open'));
25syncHeaderNavigation();
26window.addEventListener('hashchange', syncHeaderNavigation);
27
28document.querySelectorAll('form[data-static-search]').forEach((form) => {
29  form.addEventListener('submit', (event) => {
30    event.preventDefault();
31    const value = form.querySelector('input[type="search"]')?.value.trim();
32    window.location.href = value ? `/search/?q=${encodeURIComponent(value)}` : '/search/';
33  });
34});
35
36const params = new URLSearchParams(window.location.search);
37const query = params.get('q');
38if (query) {
39  document.querySelectorAll('[data-query]').forEach((input) => { input.value = query; });
40}
41
42document.querySelectorAll('[data-password-toggle]').forEach((button) => {
43  button.addEventListener('click', () => {
44    const input = document.getElementById(button.dataset.passwordToggle);
45    if (!input) return;
46    const show = input.type === 'password';
47    input.type = show ? 'text' : 'password';
48    button.setAttribute('aria-label', show ? 'Скрыть пароль' : 'Показать пароль');
49  });
50});

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.