PageSourceSearch

https://www.villafarese.com/modules/csmegamenu/js/csmegamenu_addmore.js

js villafarese.com collected 2026-10-08 17:10:44 UTC 5,441 bytes, 183 lines download raw bytes

1function isIpad() 
2	{
3		if(navigator.userAgent.match(/iPad/i))
4		{
5				return true;
6		}
7		else
8		{
9			return false;
10		}
11	}
12function detectIPadOrientation ()
13	{
14		var orientation = window.orientation;
15		if (orientation == 0 ||orientation == 180) {
16			return 0;
17		}
18		else if ( orientation == 90 || orientation == -90) {
19			return 90;
20		}
21	 }
22 function getHtmlHide1(moreInsert1,numLiItem) 
23 {
24	var htmlLiHide="";
25	if($("#cs_megamenu_more").length==0)
26	{
27		for(var i=(moreInsert1+1);i<=numLiItem;i++)
28		{
29			$liclass=$('#menu ul li.level-1:nth-child('+i+')').attr('class');
30			$liclass=$liclass.replace("level-1","level-2");
31			htmlLiHide+='<li class="'+$liclass+'">'+$('#menu ul li.level-1:nth-child('+i+')').html()+'</li>';
32		}
33	}
34	return htmlLiHide;
35 }
36	 
37 function getHtmlHide2(moreInsert2,numLiItem) 
38 {
39	var htmlLiHide="";
40	if($("#cs_megamenu_more").length==0)
41	{
42		for(var i=(moreInsert2+1);i<=numLiItem;i++)
43		{
44			$liclass=$('#menu ul li.level-1:nth-child('+i+')').attr('class');
45			$liclass=$liclass.replace("level-1","level-2");
46			htmlLiHide+='<li class="'+$liclass+'">'+$('#menu ul li.level-1:nth-child('+i+')').html()+'</li>';
47		}
48	}
49	return htmlLiHide;
50 }
51 function refeshMenuIpad(moreInsert1,moreInsert2,htmlLiHide1,htmlLiHide2)
52	{
53		if($("#cs_megamenu_more").length>=0)
54		{
55			$("ul li#cs_megamenu_more").remove();
56			if(isIpad()&&detectIPadOrientation()==90)
57			{
58				$(htmlLiHide2).insertAfter('#menu ul li:nth-child('+moreInsert2+').menu_item');
59			}
60			if(isIpad()&&detectIPadOrientation()==0)
61			{	
62				$(htmlLiHide1).insertAfter('#menu ul li:nth-child('+moreInsert1+').menu_item');
63			}
64		}
65	}
66function refeshMenuRespon(htmlMenu)
67{
68	if($("#cs_megamenu_more").length>=0)
69	{
70		$("#menu ul.ul_mega_menu li.level-1").remove();
71		$("#menu ul.ul_mega_menu").html(htmlMenu);
72		$("li a.title_menu_parent").hover(
73		  function () {
74		  $(this).next().slideDown('fast');
75		  },function () {
76			$(this).parent().mouseleave(function() {
77				$(".options_list").slideUp('fast');
78			});
79		  });
80	}
81}
82function addMoreOnLoad(moreInsert1,moreInsert2,numLiItem,htmlLiHide1,htmlLiHide2) 
83 {
84	if(moreInsert1<numLiItem && moreInsert2<moreInsert1)
85	{
86
87		if((isIpad()&& detectIPadOrientation()==90 ) ||($(window).width() > 992 && $(window).width()<1280) )//ipad ngang
88		{
89			refeshMenuRespon(htmlMenu);
90			if($("#cs_megamenu_more").length==0)
91			{
92				$('<li id="cs_megamenu_more" class="menu_item menu_last level-1 parent"><a href="#" class="more title_menu_parent">More</a><div class="options more-menu" style="width:auto"><ul class="column cms">'+htmlLiHide1+'</ul></div>').insertAfter('#menu ul li.level-1:nth-child('+moreInsert1+')');
93				
94			}
95		
96			if($("#cs_megamenu_more").length>0)
97			{
98				for(var j=(moreInsert1+2);j<=(numLiItem+1);j++)
99				{
100					var delItem=moreInsert1+2;
101					$("#menu ul li:nth-child("+delItem+").menu_item").remove();
102				}
103			}
104		}
105		if((isIpad()&& detectIPadOrientation()==0) || ($(window).width() >= 768 && $(window).width()<992))
106		{
107			if($("#cs_megamenu_more").length==0)
108			{
109				$('<li id="cs_megamenu_more" class="menu_item menu_last level-1 parent"><a href="#" class="more title_menu_parent">More</a><div class="options more-menu" style="width:auto"><ul class="column cms">'+htmlLiHide2+'</ul></div>').insertAfter('#menu ul li.level-1:nth-child('+moreInsert2+')');
110				
111			}
112		
113			if($("#cs_megamenu_more").length>0)
114			{
115				for(var j=(moreInsert2+2);j<=(numLiItem+1);j++)
116				{
117					var delItem=moreInsert2+2;
118					$("#menu ul li:nth-child("+delItem+").menu_item").remove();
119				}
120			}
121		}
122	}
123	
124 }
125	 
126function addMoreResponsive(moreInsert1,moreInsert2,numLiItem,htmlLiHide1,htmlLiHide2) 
127 {
128	if(moreInsert1<numLiItem && moreInsert2 <moreInsert1)
129	{
130		$(window).resize(function(){
131			
132			if(!isIpad())
133			{	
134				
135				if($(window).width() >= 768 && $(window).width()<=992)//ipad doc
136				{	
137					refeshMenuRespon(htmlMenu);
138					if($("#cs_megamenu_more").length==0)
139					{
140						$('<li id="cs_megamenu_more" class="menu_item menu_last level-1 parent"><a href="#" class="more title_menu_parent">More</a><div class="options more-menu" style="width:auto;"><ul class="column cms">'+htmlLiHide2+'</ul></div>').insertAfter('#menu ul li.level-1:nth-child('+moreInsert2+')');
141						
142					}
143					if($("#cs_megamenu_more").length>0)
144					{
145						for(var j=(moreInsert2+2);j<=(numLiItem+1);j++)
146						{
147							var delItem=moreInsert2+2;
148							$("#menu ul li:nth-child("+delItem+").menu_item").remove();
149							$("#menu ul li:nth-child("+j+").menu_item").remove();
150						}
151					}
152				}
153				else if($(window).width() >
153= 992 && $(window).width()<1280)//ipad ngang
154				{	
155					refeshMenuRespon(htmlMenu);
156					if($("#cs_megamenu_more").length==0)
157					{
158						$('<li id="cs_megamenu_more" class="menu_item menu_last level-1 parent"><a href="#" class="more title_menu_parent">More</a><div class="options more-menu" style="width:auto;"><ul class="column cms">'+htmlLiHide1+'</ul></div>').insertAfter('#menu ul li.level-1:nth-child('+moreInsert1+')');
159						
160					}
161					if($("#cs_megamenu_more").length>0)
162					{
163						for(var j=(moreInsert1+2);j<=(numLiItem+1);j++)
164						{
165							var delItem=moreInsert1+2;
166							$("#menu ul li:nth-child("+delItem+").menu_item").remove();
167							$("#menu ul li:nth-child("+j+").menu_item").remove();
168						}
169					}
170				}
171				else if($(window).width()>1279)
172				{
173					if($("#cs_megamenu_more").length>0)
174					{
175						refeshMenuRespon(htmlMenu);
176					}
177				}
178			}
179		});
180		
181	}
182}
183

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.