PageSourceSearch

https://gstou.ru/js/head-menu.js?1790924192

js gstou.ru collected 2026-10-02 06:57:05 UTC 2,829 bytes, 77 lines download raw bytes

1const roots = document.querySelectorAll('[data-toogle-list-root]');
2const closeBlockInMobile = document.querySelector('#exit-from-head-all-block');
3
4for (let i = 0; i < roots.length; i++) {
5	const rootDiv = roots[i];
6	const navList = rootDiv.querySelector('[data-toogle-list-nav]');
7	const blockList = rootDiv.querySelector('[data-toogle-list-blocks]');
8
9	// Без списка навигации/блоков этот корень бесполезен — пропускаем,
10	// но НЕ прерываем весь скрипт (иначе ломается всё меню).
11	if (!navList || !blockList) continue;
12
13	if (closeBlockInMobile) {
14		closeBlockInMobile.addEventListener('click', (e) => {
15			if (navList.querySelector('.active[data-nav-id]') && blockList.querySelector('.active[data-block-id]')) {
16				navList.querySelector('.active[data-nav-id]').classList.remove('active');
17				blockList.querySelector('.active[data-block-id]').classList.remove('active');
18				closeBlockInMobile.classList.remove('active');
19			}
20		});
21	}
22
23	if (window.innerWidth < 992) {
24		if (navList.querySelector('.active[data-nav-id]') && blockList.querySelector('.active[data-block-id]')) {
25			navList.querySelector('.active[data-nav-id]').classList.remove('active');
26			blockList.querySelector('.active[data-block-id]').classList.remove('active');
27		}
28	}
29
30	navList.addEventListener('click', (e) => {
31		let id = null;
32		const navItemWithId = e.target.closest('[data-nav-id]');
33		if (navItemWithId) {
34			id = navItemWithId.dataset.navId;
35			if (id) {
36				if (navList.querySelector('.active[data-nav-id]') && blockList.querySelector('.active[data-block-id]')) {
37					navList.querySelector('.active[data-nav-id]').classList.remove('active');
38					blockList.querySelector('.active[data-block-id]').classList.remove('active');
39				}
40				const blockItemWithId = blockList.querySelector(`[data-block-id="${id}"]`);
41				if (blockItemWithId) {
42					navItemWithId.classList.add('active');
43					blockItemWithId.classList.add('active');
44					if (window.innerWidth < 992 && closeBlockInMobile) {
45						closeBlockInMobile.classList.add('active');
46					}
47				}
48			}
49		}
50	});
51}
52
53
54///////////////////////////
55
56const hamburger = document.getElementById('new-header-bottom-hamburger');
57const allMenu = document.getElementById('new-header-all-menu');
58const closeBtn = document.getElementById('new-header-all-menu-close-btn');
59const closeBtn2 = closeBtn ? closeBtn.querySelector('.close-menu-btn') : null;
60
61if (hamburger && allMenu) {
62	hamburger.addEventListener('click', (e) => {
63		allMenu.classList.add('active');
64	});
65}
66
67if (closeBtn && allMenu) {
68	closeBtn.addEventListener('click', (e) => {
69		allMenu.classList.remove('active');
70	});
71}
72
73if (closeBtn2 && allMenu) {
74	closeBtn2.addEventListener('click', (e) => {
75		allMenu.classList.remove('active');
76	});
77}

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.