public static void AssignSubMenu(List <Element> Links, RawMenu ParentMenu) { var commonparent = DomService.FindParent(Links); foreach (var item in Links) { var menu = new RawMenu(); menu.Parent = ParentMenu; menu.LinkElement = item; menu.ContainerElement = FindLinkContainer(item, Links, commonparent); menu.Parent = ParentMenu; ParentMenu.Children.Add(menu); } foreach (var item in ParentMenu.Children) { var sublinks = FindSubLinks(item); if (sublinks != null && sublinks.Count() > 0) { var itemcontainer = DomService.FindParent(sublinks); AssignSubMenu(sublinks, item); } } return; }
public static List <Element> FindSubLinks(RawMenu menu) { var Sublinks = GetDirectSubLinks(menu.LinkElement, menu.ContainerElement); if (Sublinks != null && Sublinks.Count() > 0) { return(Sublinks); } return(GetSiblingSubLinks(menu.ContainerElement, menu.NextContainer())); }
public static RawMenu FindRawMenu(Element element) { var alllinks = element.getElementsByTagName("a").item; if (alllinks != null && alllinks.Count() > 0) { var groupby = SimpleGroupBy(alllinks); RawMenu menu = new RawMenu(); AssignSubMenu(groupby[0], menu); menu.SubItemContainer = element; return(menu); } return(null); }