themes/admin/js/menu.js
author Dan
Sun, 05 Aug 2007 17:10:17 -0400
changeset 82 03c7f5ec1e4c
parent 81 d7fc25acd3f3
child 86 c162ca39db8f
permissions -rw-r--r--
Fixed IE6 + Admin theme, version typo in installer, and paginator + IE6
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';
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
    45
  expander_set_pos();
79
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
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    48
function expander_onload()
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    49
{
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    50
  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
    51
  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
    52
  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
    53
  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
    54
  {
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    55
    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
    56
  }
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    57
  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
    58
  {
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    59
    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
    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
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
    63
function expander_set_pos()
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
    64
{
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
    65
  var winheight = getHeight();
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
    66
  var magic = $('header').Height() + $('pagebar_main').Height();
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
    67
  var top = getScrollOffset();
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
    68
  if ( typeof(top) != 'number' )
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
    69
  {
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
    70
    return null;
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
    71
  }
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
    72
  magic = magic - top;
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
    73
  if ( magic < 0 )
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
    74
    magic = 0;
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
    75
  var bartop = magic + top;
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
    76
  var barheight = winheight - magic;
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
    77
  var expander = document.getElementById('sidebar-hide');
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
    78
  expander.style.top = bartop + 'px';
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
    79
  expander.style.height = barheight + 'px';
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
    80
}
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
    81
79
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    82
addOnloadHook(expander_set_height);
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    83
addOnloadHook(expander_onload);
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    84
window.onresize = expander_set_height;
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
    85
window.onscroll = expander_set_pos;