Javascript for: Start implementation for Showing only Level-1 of subsites

<!-- Start implementation for Showing only Level-1 of subsites -->	
						 <script type="text/javascript" >
							//Calling your script
							ReplaceElementsClass("menu vertical menu-vertical",null,"div","menu vertical menu-vertical","root static");

							function ReplaceElementsClass(searchClass,node,tag,newClassName,elementToHideClass) {
								var classElements = new Array();
								if ( node == null )
									node = document;

								if ( tag == null )
									tag = '*';

								var els = node.getElementsByTagName(tag);

								var elsLen = els.length;

								var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");

								for (i = 0, j = 0; i < elsLen; i++) {
									if ( pattern.test(els[i].className) ) {
                                       var children = els[i].getElementsByTagName('UL');
										for (k = 0; k < children.length; k++) 
										{   
											var pattern1 = new RegExp("(^|\\s)"+elementToHideClass+"(\\s|$)");
											if (!pattern1.test(children[k].className) ) 
											{
												children[k].style.display = "none";
											}
										} 
									   j++;
									}
								}
							}
						 </script>
					<!-- End implementation for Showing only Level-1 of subsites -->
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s