PageSourceSearch

https://ds383samara.ru/templates/vt_farm/vtemtools/menus/vtem_menu.js

js ds383samara.ru collected 2026-10-04 09:34:21 UTC 9,094 bytes, 331 lines download raw bytes

1if(window.addEventListener){
2    window.addEventListener("load",mladdevents,false);
3}
4else if(window.attachEvent){
5    window.attachEvent("onload",mladdevents);
6}
7else{
8	window.onload = mladdevents;
9}
10function mladdevents(){
11	if(!window.mlrunShim){
12		window.mlrunShim = false;
13	}
14	if(window.mlrunShim == true){
15		var Iframe = document.createElement("iframe");
16		Iframe.setAttribute("src","about:blank");
17		Iframe.setAttribute("scrolling","no");
18		Iframe.setAttribute("frameBorder","0");
19	}
20	var effects_a = new Array();
21	var divs = document.getElementsByTagName('div');
22	for(var j=0;j<divs.length;j++){
23		if(divs[j].className.indexOf('mlmenu') != -1){
24			divs[j].className = divs[j].className.replace('mlmenu','mlmenujs menu_vtem_nav');
25			divs[j].getElementsByTagName('ul')[0].className = divs[j].className;//just for reference
26			var lis = divs[j].getElementsByTagName('li');
27			for(var i =0;i<lis.length;i++){
28				lis[i].onmouseover = mlover;
29				lis[i].onmouseout = mloutSetTimeout;
30				if(window.mlrunShim == true){
31					lis[i].appendChild(Iframe.cloneNode(false));
32				}
33				if(lis[i].parentNode.getElementsByTagName('li')[0] == lis[i]){
34					lis[i].getElementsByTagName('a')[0].className += 'first';
35					if(lis[i].parentNode.className.indexOf('mlmenujs') != -1){
36						lis[i].className += ' pixelfix';
37					}
38				}
39				
40				if(lis[i] == findLast(lis[i].parentNode)){
41					lis[i].className += ' last';
42				}
43				if(lis[i].getElementsByTagName('ul').length > 0){
44					lis[i].className += ' haschild';
45					lis[i].getElementsByTagName('ul')[0].innerHTML += '<li class="vtem_ul_arrow"> &nbsp; </li>';
46					if(divs[j].className.indexOf('arrow') != -1){
47						if(divs[j].className.indexOf('vertical') != -1 || lis[i].parentNode.parentNode.nodeName != 'DIV'){
48							lis[i].getElementsByTagName('a')[0].innerHTML += '<span class="vtem_menu_vert">&rarr;</span>';
49						}
50						else{
51							lis[i].getElementsByTagName('a')[0].innerHTML += '<span class="vtem_menu_horiz">&darr;</span>';
52						}
53					}
54					else if(divs[j].className.indexOf('plus') != -1){
55						lis[i].getElementsByTagName('a')[0].innerHTML += '<span class="vtem_menu_plus">+</span>';
56					}
57				}
58				else{
59					if(divs[j].className.indexOf('arrow') != -1){
60						//This accounts for a wierd IE-specific bug in horizontal menus. CSS will set visibility: hidden;. This keeps the menu level(in IE)
61						lis[i].getElementsByTagName('a')[0].innerHTML += '<span class="noshow">&darr;</span>';
62					}
63				}
64				var uls = lis[i].getElementsByTagName('ul');
65				for(var k=0;k<uls.length;k++){
66					var found = 'no';
67					for(var z=0;z<effects_a.length;z++){
68						if(effects_a[z] == uls[k]){
69							found = 'yes';
70						}
71					}
72					if(found == 'no'){
73						effects_a[effects_a.length] = uls[k];
74						uls[k].style.zIndex = '100';
75						mlEffectLoad(uls[k]);
76					}
77				}
78			}
79		}
80	}
81}
82function mloutSetTimeout(e){
83	if(!e){
84		var the_e = window.event;
85	}
86	else{
87		var the_e = e;
88	}
89	var reltg = (the_e.relatedTarget) ? the_e.relatedTarget : the_e.toElement;
90	if(reltg){
91		var under = ancestor(reltg,this);
92		if(under === false && reltg != this){
93			window.mlLast = this;
94			var parent = this.parentNode;
95			while(parent.parentNode && parent.className.indexOf('mlmenujs') == -1){
96				parent = parent.parentNode;
97			}
98			if(parent.className.indexOf('delay') != -1){
99				window.mlTimeout = setTimeout(function(){mlout()},1000);
100			}
101			else{
102				mlout();
103			}
104		}
105	}
106}
107function mlout(){
108	if(window.mlLast==null)return false;
109	var links = window.mlLast.getElementsByTagName('a');
110	for(var i = 0;i<links.length;i++){
111		links[i].className = links[i].className.replace('hover','');
112	}
113	var uls = window.mlLast.getElementsByTagName('ul');
114	var sib;
115	for(var i=0;i<uls.length;i++){
116		mlEffectOut(uls[i]);
117		window.mlLast.className += ' hide';
118		window.mlLast.className = window.mlLast.className.replace('hide hide','hide');
119		if(window.mlrunShim == true){
120			sib = uls[i];							
121			while(sib.nextSibling && sib.nodeName != 'IFRAME'){
122				sib = sib.nextSibling
123			}
124			sib.style.display = 'none';
125		}
126	}
127	window.lastover = null;
128	return true;
129}
130function mlover(e){
131	if(!e){
132		var the_e = window.event;
133	}
134	else{
135		var the_e = e;
136	}
137	the_e.cancelBubble = true;
138	if(the_e.stopPropagation){
139		the_e.stopPropagation();
140	}
141	clearTimeout(window.mlTimeout);
142	if(window.mlLast && window.mlLast != this && ancestor(this,window.mlLast) === false){
143		mlout();
144	}
145	else{
146		window.mlLast = null;
147	}
148	var reltg = (the_e.relatedTarget) ? the_e.relatedTarget : the_e.from
148Element;
149	var under = ancestor(reltg,this);
150	if(under == false){
151		var hovered = byClass(this.parentNode,'hover','a');
152		for(var i=0;i<hovered.length;i++){
153			if(ancestor(this,hovered[i].parentNode) == false){
154				window.mlLast = hovered[i].parentNode;
155				mlout();
156			}
157		}
158		var ob = this.getElementsByTagName('ul');
159		var link = this.getElementsByTagName('a')[0];
160		link.className += ' hover';
161		if(ob[0]){
162			if(window.lastover != ob[0]){
163				if(window.mlrunShim == true){
164					var sib = ob[0];
165					while(sib.nextSibling && sib.nodeName != 'IFRAME'){
166						sib = sib.nextSibling
167					}
168					ob[0].style.display = 'block';
169					sib.style.top = ob[0].offsetTop+'px';
170					sib.style.left = ob[0].offsetLeft-2+'px';
171					sib.style.width = ob[0].offsetWidth+2+'px';
172					sib.style.height = ob[0].offsetHeight-2+'px';
173					sib.style.display = 'block';
174				}
175				this.className = this.className.replace(/hide/g,'');
176				mlEffectOver(ob[0],this);
177				window.lastover = ob[0];
178			}
179		}
180	}
181}
182function mlSetOpacity(ob,level){
183	if(ob){
184		var standard = level/10;
185		var ie = level*10;
186		ob.style.opacity = standard;
187		ob.style.filter = "alpha(opacity="+ie+")"
188	}
189}
190function mlIncreaseOpacity(ob){
191	var current = ob.style.opacity;
192	current = current * 10;
193	var upone = current + 1;
194	mlSetOpacity(ob,upone);
195}
196function mlIncreaseHeight(ob){
197	var current = parseInt(ob.style.height);
198	if(!isNaN(current)){
199		var newh = current + 1;
200		ob.style.height = newh+'px';
201	}
202}
203function mlIncreaseWidth(ob){
204	var current = parseInt(ob.style.width);
205	if(!isNaN(current)){
206		var newh = current + 1;
207		ob.style.width = newh+'px';
208	}
209}
210function mlShake(ob){
211	var newp = '5px';
212	var old = '';
213	if(ob.style.paddingLeft==old){
214		ob.style.paddingLeft=newp;
215	}
216	else{
217		ob.style.paddingLeft=old;
218	}
219}
220function mlEffectOver(ob,parent){
221	switch(ob.className){
222	case 'fade':
223		ob.style.display = 'block';
224		for(var i = 1;i<=10;i++){
225			window.fadeTime = setTimeout(function(){mlIncreaseOpacity(ob)},i*50);
226		}
227		setTimeout(function(){ob.style.filter = ''},500);
228		break;
229	case 'shake':
230		ob.style.display = 'block';
231		var shake = setInterval(function(){mlShake(ob)},50);
232		setTimeout(function(){clearInterval(shake)},510);
233		break;
234	case 'blindv':
235		ob.style.display = 'block';
236		if(ob.offsetHeight){
237			var height = ob.offsetHeight
238			ob.style.height = '0px';
239			ob.style.overflow = 'hidden';
240			for(var i=0;i<height;i++){
241				setTimeout(function(){mlIncreaseHeight(ob)},i*1);
242			}
243			setTimeout(function(){ob.style.overflow='';ob.style.height='auto'},(height-1)*1)//-1 for IE
244		}
245		break;
246	case 'blindh':
247		ob.style.display = 'block';
248		if(ob.offsetWidth){
249			var width = ob.offsetWidth;
250			ob.style.width = '0px';
251			ob.style.overflow = 'hidden';
252			for(var i=0;i<width;i++){
253				setTimeout(function(){mlIncreaseWidth(ob)},i*1);
254			}
255			setTimeout(function(){ob.style.overflow='visible';},width*1)
256		}
257		break;
258	default:
259		ob.style.display = 'block';
260		break;
261	}
262}
263function mlEffectOut(ob){
264	switch(ob.className){
265	case 'fade':
266		clearTimeout(window.fadeTime);
267		mlSetOpacity(ob,0);
268		ob.style.display = 'none';
269		break;
270	case 'shake':
271		ob.style.paddingLeft = '';
272		ob.style.display = 'none';
273		break;
274	default:
275		ob.style.display = 'none';
276		break;
277	}
278}
279function mlEffectLoad(ob){
280	var parent = ob.parentNode;
281	while(parent.parentNode && parent.className.indexOf('mlmenu') == -1){
282		parent = parent.parentNode;
283	}
284	if(parent.className.indexOf('fade') != -1){
285		ob.style.display = 'none';
286		ob.className = 'fade';
287		mlSetOpacity(ob,0);
288	}
289	else if(parent.className.indexOf('shake') != -1){
290		ob.className = 'shake';
291	}
292	else if(parent.className.indexOf('blindv') != -1){
293		ob.className = 'blindv';
294	}
295	else if(parent.className.indexOf('blindh') != -1){
296		ob.className = 'blindh';
297	}
298	else if(parent.className.indexOf('box') != -1){
299		ob.className = 'box';
300	}
301	ob.style.display = 'none';
302}
303function ancestor(child, parent){
304	try{
305		if(child==null)return false;//Saves checking elsewhere
306		for(; child.parentNode; child = child.parentNode){
307				if(child.parentNode === parent) return true;
308			}
309		return false;
310	}
311	catch(error){
312		//Mozilla bug, it  must be a text control which can not be in the menu so we will foolishly assume false
313		return false;
314	}
315}
316function byClass(parent,c,tag){
317	var all = parent.getElementsByTagName(tag);
318	var returna = new Array();
319	for(var i=0;i<all.length;i++){
320		if(all[i].className.indexOf(c) != -1){
321			returna[returna.length] = all[i]
322		}
323	}
324	return returna;
325}
326function findLast(ob){
327	if(ob.lastChild.nodeType == 1){
328		return ob.lastChild
329	}
330	return ob.lastChild.previousSibling;
331}

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.