PageSourceSearch

https://dorco.ru/head-foot/head-foot.js?17779287287063

js dorco.ru collected 2026-10-08 03:13:48 UTC 7,063 bytes, 247 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function() {
2
3	function siteScroller() {
4		const html = document.querySelector('.html');
5
6		return {
7			scrollOff() {
8				// console.log(body.scrollWidth);
9				// console.log(window.innerWidth);
10				
11				// document.querySelector('.html').style.width = body.scrollWidth + 'px'
12				html.classList.add('html_no-scroll');
13			},
14			scrollOn() {
15				// document.querySelector('.html').style.width = ''
16				html.classList.remove('html_no-scroll');
17			},
18		}
19	}
20
21
22	let siteScroll = siteScroller();
23	
24	let targetLink = null;
25	let targetDropdown = null;
26
27	let hideTimeout = null;
28	
29	const headerDisable = function() {
30		document.querySelector('.header-new').classList.remove('header-new_active');
31		document.querySelector('.header-new').classList.remove('header-new_menu');
32		document.querySelector('.header-new').classList.remove('header-new_search');
33		document.querySelector('.header-new').classList.remove('header-new_burger');
34
35		targetLink?.classList.remove('header-new__menu-link_active');
36		targetDropdown?.classList.remove('header-new__dropdown_active');
37
38		targetLink = null;
39		targetDropdown = null;
40
41		siteScroll.scrollOn();
42		document.querySelector('.fixed-menu_active')?.classList.remove('fixed-menu_active')
43		document.querySelector('.header-new__burger_active')?.classList.remove('header-new__burger_active')
44	}
45
46	function activateItem(link, dropdown) {
47			if (hideTimeout) clearTimeout(hideTimeout);
48			headerDisable();
49
50			link.classList.add('header-new__menu-link_active')
51			dropdown.classList.add('header-new__dropdown_active')
52			targetLink = link;
53			targetDropdown = dropdown;
54
55			const menu = dropdown.querySelector('.header-new__dropdown-menu');
56
57			if (menu) {
58				menu.style.left = link.getBoundingClientRect().left + 'px';
59			}
60	}
61
62	const btnSearch = function() {
63		const el = document.querySelector('.header-new__btn-search') 
64		if (!el) return
65		el.addEventListener('click', function() {
66			if (!document.querySelector('.header-new_active')) {
67				// document.querySelector('.header-new').classList.toggle('header-new_active')
68				document.querySelector('.header-new').classList.toggle('header-new_search')
69				document.querySelector('.header-new__search-input').focus()
70				
71			}
72			else {
73				headerDisable();
74			}
75		})
76	}();
77
78	const headerNewMenuLinks = function() {
79		document.querySelectorAll('.header-new__menu-link').forEach(item => {
80
81			const attr = item.getAttribute('data-for');
82
83			// console.log(attr);
84			
85
86			if (!attr) return;
87
88			targetLink = item;
89			targetDropdown = document.querySelector('#' + attr)
90
91			// console.log(targetLink);
92			// console.log(targetDropdown);
93			
94
95			item.addEventListener('mouseenter', function(e) {
96				if (hideTimeout) clearTimeout(hideTimeout);
97
98				targetLink = item;
99				targetDropdown = document.querySelector('#' + attr)
100
101				activateItem(targetLink, targetDropdown);
102			});
103
104			targetDropdown.addEventListener('mouseenter', () => {
105					if (hideTimeout) clearTimeout(hideTimeout);
106					if (targetLink !== item) {
107
108						// targetLink = item;
109						// targetDropdown = document.querySelector('#' + attr)
110
111						activateItem(targetLink, targetDropdown);
112					}
113			});
114
115			item.addEventListener('mouseleave', function(e) {
116				hideTimeout = setTimeout(() => {
117					if (targetLink === item) {
118						headerDisable();
119					}
120				}, 10);
121			});
122
123			targetDropdown.addEventListener('mouseleave', () => {
124				hideTimeout = setTimeout(() => {
125					if (targetLink === item) {
126						headerDisable();
127					}
128				}, 10);
129			});
130		})
131	}();
132
133	// const dropdowns = function() {
134	// 	// const el = document.querySelector('.header-new') 
135	// 	// if (!el) return
136
137	// 	// el.addEventListener('mouseleave', function(e) {
138	// // 		if (document.querySelector('.header-new_active')) {
139	// // 			headerDisable();
140	// // 		}
141	// // 	})
142	// 	document.querySelectorAll('.header-new__dropdown').forEach(item => {
143	// 		item.addEventListener('mouseenter', function(e) {
144	// 			if (hideTimeout) clearTimeout(hideTimeout);
145	// 			if (targetItem !== item) {
146	// 				activateItem(item, targetBlock);
147	// 			}
148	// 		})
149
150	// 		item.addEventListener('mouseleave', function(e) {
151	// 			targetDropdown?.classList.remove('header-new__dropdown_active');
152	// 			targetDropdown?.classList.remove('header-new__dropdown_hover');
153
154	// 			if (!targetLink?.classList.contains('header-new__menu-link_active')) {
155	// 				headerDisable();
156	// 			}
157	// 		})
158	// 	})
159	// // 	document.querySelectorAll('.header-new__menu-sub').forEach(item => {
160	// // 		item.addEventListener('mouseleave', function(e) {
161	// // 			if ((document.querySelector('.header-new_active')) && (!e.toElement.classList.contains('header-new__menu-link'))) {
162	// // 				headerDisable();
163	// // 			}
164	// // 		})
165	// 	// })
166	// }();
167
168	const btnBurger = function() {
169		const el = document.querySelector('.header-new__burger') 
170		if (!el) return
171
172		const fixedMenu = document.querySelector('.fixed-menu')
173		let isActive = false;
174
175		el.addEventListener('click', function() {
176			isActive = !isActive;
177
178			if (isActive) {
179				siteScroll.scrollOff()
180				fixedMenu.classList.add('fixed-menu_active')
181				el.classList.add('header-new__burger_active')
182			}
183			else {
184				siteScroll.scrollOn()
185				fixedMenu.classList.remove('fixed-menu_active')
186				el.classList.remove('header-new__burger_active')
187				headerDisable();
188			}
189		})
190	}();
191
192	const btnMobileSearch = function() {
193		const el = document.querySelector('.fixed-menu__btn-search') 
194		if (!el) return
195
196		el.addEventListener('click', function() {
197			headerDisable();
198			// document.querySelector('.header-new').classList.toggle('header-new_active')
199			document.querySelector('.header-new').classList.add('header-new_search')
200			document.querySelector('.header-new__search-input').focus()
201			document.querySelector('.header-new__burger').classList.add('header-new__burger_active')
202		})
203	}();
204
205	const fixedMenu = function() {
206		const els = document.querySelectorAll('.fixed-menu__menu-item_has-child');
207
208		if (!els.length) return
209		
210
211		els.forEach(el => {
212			const link = el.querySelector('.fixed-menu__menu-link');
213			
214			el.addEventListener('click', () => {
215				el.classList.toggle('fixed-menu__menu-item_active')
216			})
217
218			link.addEventListener('click', e => {
219				e.preventDefault();
220			})
221		})
222	}();
223
224	// const functionOnResize = function(myfunc) {
225	// 	let _win_width = window.innerWidth;
226	// 	let timeout;
227	// 	window.addEventListener('resize', () => {
228	// 		clearTimeout(timeout);
229
230	// 		timeout = setTimeout(() => {
231	// 			if (_win_width != window.innerWidth){
232	// 				myfunc();
233	// 			}
234	// 		}, 100);
235	// 	})
236	// }
237
238	// const realVH = function(myfunc) {
239	// 	let vh = window.innerHeight * 0.01;
240	// 	document.documentElement.style.setProperty('--vh', `${vh}px`);
241	// }
242
243	// realVH()
244
245	// functionOnResize(()=>{realVH()})
246
247})

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.