Administrator
2023-04-19 eeb08a586132f489c10e12551c6479b13c9def5e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/**
 * 
 */
var basic=getpath();
jQuery(document).ready(function($) {
    metromenus()
});
 
function metromenus(){
    var path=window.document.location.pathname;
    jQuery.post(basic+'/admin/bmenucon/ftmenu.htm', {title:'lftmenus'}, function(data, textStatus, xhr) {
        if(data==null)
            return;
        var navlist=$('ul#menuulroot');
        var startflg=false;
        var li_parent=null;
        var ul_child=null;
        var li_child=null;
        var li_parent_lft=0;
        var li_parent_rgt=0;
        jQuery.each(data, function(index, val) {
          var lft=val.lft;
          var rgt=val.rgt;
          if(lft<li_parent_rgt)
          {
              li_child=jQuery('<li> <a href="'+val.url+'">'+val.title+' </a> </li>').appendTo(ul_child); 
          }else{
              li_parent=jQuery('<li></li>').appendTo(navlist);
              if(startflg==false)
              {
                  li_parent.addClass('start');
                  startflg=true;
              }
              ul_child=null;
              var a=jQuery('<a href="javascript:void(0);" class="dropdown-toggle"></a>').appendTo(li_parent);
              var i=jQuery('<i class="'+val.icon+'"></i>').appendTo(a);
              var span=jQuery('<span class="menu-text">'+val.title+'</span>').appendTo(a);
              var b=jQuery('<b class="arrow icon-angle-down"></b>').appendTo(a);
              li_parent_lft=lft;
              li_parent_rgt=rgt;
              if(rgt-lft>1)
              {
                  ul_child=jQuery('<ul class="sub-menu"></ul>').appendTo(li_parent);
              }else{
                  a.removeClass('dropdown-toggle');
                  if(val.url!=null&&val.url!='')
                  {
                      a.attr('href',val.url);
                  }
              }
          }
          if(val.url!=null&&val.url.indexOf(path)>=0)
          {
              li_parent.addClass('active');
              li_parent.addClass('open');
              if(li_child!=null)
                  li_child.addClass('active');
          }
        });
    },'json');
}