themes/admin/js/menu.js
author Dan
Fri, 21 Aug 2009 15:39:23 -0400
changeset 1096 86feb1c7ca3f
parent 1049 9bf901e1de42
permissions -rw-r--r--
Wiki formatter: heading IDs are now name based ("head:" . sanitize_page_id($text)) instead of tocN.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
86
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 81
diff changeset
     1
/*
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 81
diff changeset
     2
 * IE doesn't like display: table.
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 81
diff changeset
     3
 */
c162ca39db8f Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents: 81
diff changeset
     4
79
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
     5
function admin_expand()
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
     6
{
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
     7
  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
     8
  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
     9
  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
    10
  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
    11
  {
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
    12
    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
    13
    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
    14
  }
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    15
  else
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    16
  {
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
    17
    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
    18
    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
    19
  }
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
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    22
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
    23
{
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    24
  expander.className = 'collapsed';
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    25
  content.style.display = 'none';
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    26
  holder.style.width = '0px';
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    27
  holder.style.paddingRight = '12px';
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    28
  holder.style.paddingLeft = '0px';
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
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    31
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
    32
{
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    33
  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
    34
  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
    35
  holder.style.width = '230px';
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    36
  holder.style.paddingLeft = '12px';
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    37
  holder.style.paddingRight = '0px';
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
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    40
function expander_set_height()
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    41
{
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    42
  var expander = document.getElementById('sidebar-hide');
699
c7d737202d59 Removed Adobe Spry and replaced with jQuery. Please report any new bugs on the forums or via IRC. In a related note, auto-completion should work now at least for usernames. Still hacking away at page name completion...
Dan
parents: 86
diff changeset
    43
  var magic = $dynano('header').Height() + $dynano('pagebar_main').Height();
79
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    44
  var height = getHeight();
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    45
  var exheight = height - magic;
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    46
  expander.style.height = exheight + 'px';
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    47
  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
    48
  expander_set_pos();
79
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
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    51
function expander_onload()
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    52
{
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    53
  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
    54
  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
    55
  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
    56
  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
    57
  {
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    58
    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
    59
  }
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    60
  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
    61
  {
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    62
    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
    63
  }
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    64
}
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    65
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
    66
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
    67
{
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
  var winheight = getHeight();
699
c7d737202d59 Removed Adobe Spry and replaced with jQuery. Please report any new bugs on the forums or via IRC. In a related note, auto-completion should work now at least for usernames. Still hacking away at page name completion...
Dan
parents: 86
diff changeset
    69
  var magic = $dynano('header').Height() + $dynano('pagebar_main').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
    70
  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
    71
  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
    72
  {
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
    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
    74
  }
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
  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
    76
  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
    77
    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
    78
  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
    79
  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
    80
  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
    81
  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
    82
  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
    83
}
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
    84
1049
9bf901e1de42 Admin theme: fixed onload behavior of collapsible menu
Dan
parents: 699
diff changeset
    85
addOnloadHook(function()
9bf901e1de42 Admin theme: fixed onload behavior of collapsible menu
Dan
parents: 699
diff changeset
    86
  {
9bf901e1de42 Admin theme: fixed onload behavior of collapsible menu
Dan
parents: 699
diff changeset
    87
    window.TBL_SHOW = ( IE ) ? 'block' : 'table';
9bf901e1de42 Admin theme: fixed onload behavior of collapsible menu
Dan
parents: 699
diff changeset
    88
  });
79
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    89
addOnloadHook(expander_set_height);
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    90
addOnloadHook(expander_onload);
5faff33a6580 Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents: 0
diff changeset
    91
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
    92
window.onscroll = expander_set_pos;