themes/admin/js/menu.js
author Dan
Wed, 01 Aug 2007 13:39:27 -0400
changeset 80 cb7dde69c301
parent 79 5faff33a6580
child 81 d7fc25acd3f3
permissions -rw-r--r--
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 79
diff changeset
     1
var TBL_SHOW = ( IE ) ? 'block' : 'table';
79
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
     2
function admin_expand()
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
     3
{
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
     4
  var expander = document.getElementById('sidebar-hide');
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
     5
  var content  = document.getElementById('sidebar-show');
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
     6
  var holder  = document.getElementById('td-sidebar');
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 79
diff changeset
     7
  if ( content.style.display == TBL_SHOW )
79
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
     8
  {
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 79
diff changeset
     9
    admin_collapse_real(expander, content, holder);
79
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    10
    createCookie('theme_admin_sidebar', 'collapsed', 3650);
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    11
  }
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    12
  else
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    13
  {
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 79
diff changeset
    14
    admin_expand_real(expander, content, holder);
79
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    15
    createCookie('theme_admin_sidebar', 'expanded', 3650);
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    16
  }
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    17
}
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    18
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    19
function admin_collapse_real(expander, content, holder)
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    20
{
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    21
  expander.className = 'collapsed';
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    22
  content.style.display = 'none';
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    23
  holder.style.width = '0px';
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    24
  holder.style.paddingRight = '12px';
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    25
  holder.style.paddingLeft = '0px';
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    26
}
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    27
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    28
function admin_expand_real(expander, content, holder)
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    29
{
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    30
  expander.className = 'expanded';
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 79
diff changeset
    31
  content.style.display = TBL_SHOW;
79
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    32
  holder.style.width = '230px';
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    33
  holder.style.paddingLeft = '12px';
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    34
  holder.style.paddingRight = '0px';
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    35
}
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    36
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    37
function expander_set_height()
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    38
{
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    39
  var expander = document.getElementById('sidebar-hide');
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    40
  var magic = $('header').Height() + $('pagebar_main').Height();
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    41
  var height = getHeight();
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    42
  var exheight = height - magic;
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    43
  expander.style.height = exheight + 'px';
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    44
  expander.style.top = magic + 'px';
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    45
}
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    46
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    47
function expander_onload()
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    48
{
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    49
  var expander = document.getElementById('sidebar-hide');
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    50
  var content  = document.getElementById('sidebar-show');
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    51
  var holder  = document.getElementById('td-sidebar');
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    52
  if ( readCookie('theme_admin_sidebar') == 'collapsed' )
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    53
  {
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    54
    admin_collapse_real(expander, content, holder);
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    55
  }
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    56
  else if ( readCookie('theme_admin_sidebar') == 'expanded' )
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    57
  {
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    58
    admin_expand_real(expander, content, holder);
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    59
  }
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    60
}
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    61
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    62
addOnloadHook(expander_set_height);
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    63
addOnloadHook(expander_onload);
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    64
window.onresize = expander_set_height;
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    65