themes/admin/js/menu.js
changeset 79 5faff33a6580
parent 0 902822492a68
child 80 cb7dde69c301
equal deleted inserted replaced
78:4df25dfdde63 79:5faff33a6580
       
     1 /*
     1 var menuClicked = false;
     2 var menuClicked = false;
     2 var menuID = false;
     3 var menuID = false;
     3 var menuParent = false;
     4 var menuParent = false;
     4 function adminOpenMenu(menu, parent)
     5 function adminOpenMenu(menu, parent)
     5 {
     6 {
    47   menu = document.getElementById(menuID);
    48   menu = document.getElementById(menuID);
    48   menu.onmousedown = function() { menuClicked = true; }
    49   menu.onmousedown = function() { menuClicked = true; }
    49   menu.onmouseup   = function() { setTimeout('menuClicked = false;', 100); }
    50   menu.onmouseup   = function() { setTimeout('menuClicked = false;', 100); }
    50   document.onclick = function() { if ( menuClicked ) return false; adminMenuOff(); }
    51   document.onclick = function() { if ( menuClicked ) return false; adminMenuOff(); }
    51 }
    52 }
       
    53 */
    52 
    54 
       
    55 function admin_expand()
       
    56 {
       
    57   var expander = document.getElementById('sidebar-hide');
       
    58   var content  = document.getElementById('sidebar-show');
       
    59   var holder  = document.getElementById('td-sidebar');
       
    60   if ( content.style.display == 'table' )
       
    61   {
       
    62     createCookie('theme_admin_sidebar', 'collapsed', 3650);
       
    63     admin_collapse_real(expander, content, holder);
       
    64   }
       
    65   else
       
    66   {
       
    67     createCookie('theme_admin_sidebar', 'expanded', 3650);
       
    68     admin_expand_real(expander, content, holder);
       
    69   }
       
    70 }
       
    71 
       
    72 function admin_collapse_real(expander, content, holder)
       
    73 {
       
    74   expander.className = 'collapsed';
       
    75   content.style.display = 'none';
       
    76   holder.style.width = '0px';
       
    77   holder.style.paddingRight = '12px';
       
    78   holder.style.paddingLeft = '0px';
       
    79 }
       
    80 
       
    81 function admin_expand_real(expander, content, holder)
       
    82 {
       
    83   expander.className = 'expanded';
       
    84   content.style.display = 'table';
       
    85   holder.style.width = '230px';
       
    86   holder.style.paddingLeft = '12px';
       
    87   holder.style.paddingRight = '0px';
       
    88 }
       
    89 
       
    90 function expander_set_height()
       
    91 {
       
    92   var expander = document.getElementById('sidebar-hide');
       
    93   var magic = $('header').Height() + $('pagebar_main').Height();
       
    94   var height = getHeight();
       
    95   var exheight = height - magic;
       
    96   expander.style.height = exheight + 'px';
       
    97   expander.style.top = magic + 'px';
       
    98 }
       
    99 
       
   100 function expander_onload()
       
   101 {
       
   102   var expander = document.getElementById('sidebar-hide');
       
   103   var content  = document.getElementById('sidebar-show');
       
   104   var holder  = document.getElementById('td-sidebar');
       
   105   if ( readCookie('theme_admin_sidebar') == 'collapsed' )
       
   106   {
       
   107     admin_collapse_real(expander, content, holder);
       
   108   }
       
   109   else if ( readCookie('theme_admin_sidebar') == 'expanded' )
       
   110   {
       
   111     admin_expand_real(expander, content, holder);
       
   112   }
       
   113 }
       
   114 
       
   115 addOnloadHook(expander_set_height);
       
   116 addOnloadHook(expander_onload);
       
   117 window.onresize = expander_set_height;
       
   118