PageSourceSearch

http://shahrdari-absard.ir/JavaScripts/Modules/SimpleMenu/menu-vertical.js

js shahrdari-absard.ir collected 2026-10-02 23:45:59 UTC 7,932 bytes, 233 lines download raw bytes

1/* www.menucool.com/vertical/vertical-menu.*/
2let createMenu = function(JSON,id,menuBorderColor,menuBorderStyle,menuBorderWidth,subBorderColor,subBorderStyle,subBorderWidth,bkColor,txtColor,hoverBkColor,hoverTxtColor,subBkColor,subTxtColor,hoverSubBkColor,hoverSubTxtColor,fontSizeMenu,fontSizeSub,fontFamilyMenu,fontFamilySub,menuDirection,isHorizontal,isAccordion){
3if (!isAccordion) {
4let mcVM_options={menuId:id,alignWithMainMenu:true,menuDir:menuDirection};
5let $menu = $("ul#" + id);
6if (isHorizontal)
7{
8	$menu.addClass("menuH decor1");
9	$menu.addClass( (menuDirection)? 'menuH-rtl' : 'menuH-ltr' );
10}
11else
12{
13	$menu.addClass("menu-v");
14	$menu.addClass( (menuDirection)? 'menu-v-rtl' : 'menu-v-ltr' );
15}
16$menu.html("");
17/*************************************/
18		    let getMenuItem = function (itemData) {
19			    let item = $("<li>")
20				    .append(
21					    $("<a>", {
22						    href: itemData.link,
23						    html: itemData.name,
24							'class': (itemData.sub.length>0 && isHorizontal)?'arrow':''
25					    })
26				    );
27			    if (itemData.sub.length>0) {
28				    let subList = $("<ul>");
29				    if(!isHorizontal){subList.addClass("sub");}
30				    $.each(itemData.sub, function () {
31					    subList.append(getMenuItem(this));
32				    });
33				    item.append(subList);
34			    }
35			    return item;
36		    };
37		    $.each(JSON.menu, function () {
38			    $menu.append(
39				    getMenuItem(this)
40			    );
41		    });
42	        $menu.closest("div.dp-module-content").css("overflow", "visible");
43			$menu.closest("div.dp-module-content").addClass("sm-module-content");
44			if(!isHorizontal){$("ul#" + id + " li a").css({"padding": "5px"});}
45/*************************************/
46if(isHorizontal)
47{
48	$menu.css({
49		'background': bkColor,
50		'border': menuBorderWidth + "px " + menuBorderStyle + " " + menuBorderColor
51	});
52	$('ul#' + id + ' li a').css({
53		'color': txtColor,
54		'background-color': bkColor,
55	});
56	$('ul#' + id + ' li').css({
57		'font': fontSizeMenu + "px '" + fontFamilyMenu + "'"
58	});
59	$('ul#' + id + ' li ul li').css({
60		'font': fontSizeSub + "px '" + fontFamilySub + "'"
61	});
62	$('ul#' + id + ' li a').hover(function(){
63		$(this).css({
64			'background-color': hoverBkColor,
65			color: hoverTxtColor
66		});
67	}, function(){
68		$(this).css({
69			'color': txtColor,
70			'background-color': bkColor
71		});
72	});
73	/**************/
74	$('ul#' + id + ' li ul').css({
75		'background-color': subBkColor,
76		'border': subBorderWidth + "px " + subBorderStyle + " " + subBorderColor
77	});	
78	$('ul#' + id + ' li ul li a').css({
79		'color': subTxtColor,
80		'background-color': subBkColor
81	});
82	$('ul#' + id + ' li ul li a').hover(function(){
83		$(this).css({
84			'background-color': hoverSubBkColor,
85			color: hoverSubTxtColor
86		});
87	}, function(){
88		$(this).css({
89			'color': subTxtColor,
90			'background-color': subBkColor
91		});
92	});
93}
94else
95{
96	$('ul#' + id).css({
97		'border': menuBorderWidth + "px " + menuBorderStyle + " " + menuBorderColor,
98		'border-top': 'none'
99	});
100	$('ul#' + id + ' li').css({
101		'background': bkColor
102	});
103	$('ul#' + id + ' li a').css({
104		'color': txtColor,
105		'font': fontSizeMenu + "px '" + fontFamilyMenu + "'",
106		'border-top': menuBorderWidth + "px " + menuBorderStyle + " " + menuBorderColor
107	});
108	$('ul#' + id + ' li a').hover(function(){
109		$(this).css({
110			'color': hoverTxtColor,
111			'background-color': hoverBkColor
112		});
113		}, function(){
114		$(this).css({
115			'color': txtColor,
116			'background-color': bkColor
117		});
118	});
119	$('ul#' + id + ' li ul.sub li').css('background', subBkColor);
120	$('ul#' + id + ' li ul.sub').css({
121		'border': subBorderWidth + "px " + subBorderStyle + " " + subBorderColor,
122		'border-top': 'none'
123	});
124	$('ul#' + id + ' li ul.sub li a').css({
125		'color': subTxtColor,
126		'font': fontSizeSub + "px '" + fontFamilySub + "'",
127		'border-top': subBorderWidth + "px " + subBorderStyle + " " + subBorderColor
128	});
129	$('ul#' + id + ' li ul.sub li a').hover(function(){
130		$(this).css({
131			'color': hoverSubTxtColor,
132			'background-color': hoverSubBkColor
133		});
134		}, function(){
135		$(this).css({
136			'color': subTxtColor,
137			'background-color': subBkColor
138		});
139	});
140start_v_menu(mcVM_options);function start_v_menu(i){let e=document.getElementById(i.menuId),j=e.offsetHeight,b=e.getElementsByTagName("ul"),g=/msie|MSIE 6/.test(navigator.userAgent);if(g)for(let h=e.getElementsByTagName("li"),a=0,l=h.length;a<l;a++){h[a].onmouseover=function(){this.className="onhover"};h[a].onmouseout=function(){this.className=""}}for(let k=function(a,b){if(a.id==i.menuId)return b;else{b+=a.offsetTop;return k(a.parentNode.parentNode,b)}},a=0;a<b.length;
140a++){let c=b[a].parentNode;c.getElementsByTagName("a")[0].className+=" arrow";(i.menuDir)?b[a].style.right=c.offsetWidth+"px":b[a].style.left=c.offsetWidth+"px";b[a].style.top=c.offsetTop+"px";if(i.alignWithMainMenu){let d=k(c.parentNode,0);if(b[a].offsetTop+b[a].offsetHeight+d>j){let f;if(b[a].offsetHeight>j)f=-d;else f=j-b[a].offsetHeight-d;b[a].style.top=f+"px"}}c.onmouseover=function(){if(g)this.className="onhover";let a=this.getElementsByTagName("ul")[0];if(a){a.style.visibility="visible";a.style.display="block"}};c.onmouseout=function(){if(g)this.className="";this.getElementsByTagName("ul")[0].style.visibility="hidden";this.getElementsByTagName("ul")[0].style.display="none"}}for(let a=b.length-1;a>-1;a--)b[a].style.display="none"}
141}//End !isHorizontal
142}//End !isAccordion
143else {
144	let $menu = $("ul#" + id);
145	$menu.html("");
146	$menu.addClass( (menuDirection)? 'accordion-menu-rtl' : 'accordion-menu-ltr' );
147
148	let getMenuItem = function (itemData) {
149		let item = $("<li>")
150			.append(
151				$("<a>", {
152					href: itemData.link,
153					html: itemData.name,
154					'class': (itemData.sub.length>0)?'arrow':''
155				})
156			);
157		if (itemData.sub.length>0) {
158			let subList = $("<ul>");
159			if(!isHorizontal){subList.addClass("sub");}
160			$.each(itemData.sub, function () {
161				subList.append(getMenuItem(this));
162			});
163			item.append(subList);
164		}
165		return item;
166	};
167	$.each(JSON.menu, function () {
168		$menu.append(
169			getMenuItem(this)
170		);
171	});
172	
173		let divMaster = $("<div>");
174		divMaster.attr("id", "accordion-div" + id);
175		divMaster.addClass("accordion-menu");
176		$("#" + id).wrap(divMaster);
177
178		$("#accordion-div" + id + " .arrow").on("click", function(e) {
179			e.preventDefault();
180			e.stopPropagation();
181			$(this).parent().children(".sub").slideToggle(200);
182			if (!$(this).hasClass("active")) {
183				$(this).addClass("active");
184			} else {
185				$(this).removeClass("active");
186			}
187		});
188	}
189/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
190let divID = '#accordion-div' + id;
191	$(divID + ' ul > li').css({
192		'border': menuBorderWidth + "px " + menuBorderStyle + " " + menuBorderColor,
193		'border-top': 'none'
194	});
195	$(divID).css({
196		'border-top': menuBorderWidth + "px " + menuBorderStyle + " " + menuBorderColor
197	});
198	$(divID + ' li').css({
199		'background': bkColor
200	});
201	$(divID + ' ul li a').css({
202		'color': txtColor,
203		'font': fontSizeMenu + "px '" + fontFamilyMenu + "'",
204	});
205	$(divID + ' ul li a').hover(function(){
206		$(this).css({
207			'color': hoverTxtColor,
208			'background-color': hoverBkColor
209		});
210		}, function(){
211		$(this).css({
212			'color': txtColor,
213			'background-color': bkColor
214		});
215	});
216	$(divID + ' ul li ul.sub li').css({'background': subBkColor, 'border': 'none' });
217	$(divID + ' ul li ul.sub').css({/**/});
218	$(divID + ' ul li ul.sub li a').css({
219		'color': subTxtColor,
220		'font': fontSizeSub + "px '" + fontFamilySub + "'"
221	});
222	$(divID + ' ul li ul.sub li a').hover(function(){
223		$(this).css({
224			'color': hoverSubTxtColor,
225			'background-color': hoverSubBkColor
226		});
227		}, function(){
228		$(this).css({
229			'color': subTxtColor,
230			'background-color': subBkColor
231		});
232	});
233}

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.