author | Dan |
Mon, 30 Jul 2007 10:46:17 -0400 | |
changeset 79 | 5faff33a6580 |
parent 0 | 902822492a68 |
child 80 | cb7dde69c301 |
permissions | -rw-r--r-- |
79
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
1 |
/* |
0 | 2 |
var menuClicked = false; |
3 |
var menuID = false; |
|
4 |
var menuParent = false; |
|
5 |
function adminOpenMenu(menu, parent) |
|
6 |
{ |
|
7 |
menuParent = parent; |
|
8 |
if ( typeof(menu) == 'string' ) |
|
9 |
{ |
|
10 |
menu = document.getElementById(menu); |
|
11 |
} |
|
12 |
if(!menu) |
|
13 |
{ |
|
14 |
alert('Menu object is invalid'); |
|
15 |
return false; |
|
16 |
} |
|
17 |
var off = fetch_offset(parent); |
|
18 |
var dim = fetch_dimensions(parent); |
|
19 |
var w = 200; |
|
20 |
var top = off['top'] + dim['h']; |
|
21 |
var left = off['left'] + dim['w'] - w; |
|
22 |
menu.style.top = top + 'px'; |
|
23 |
menu.style.left = left + 'px'; |
|
24 |
menu.style.display = 'block'; |
|
25 |
menuID = menu.id; |
|
26 |
setTimeout('setMenuoffEvents();', 500); |
|
27 |
//if(!IE) |
|
28 |
// parent.onclick = eval('(function() { this.onclick = function() { adminOpenMenu(\'' + menu.id + '\', this); return false; }; return false; } )'); |
|
29 |
} |
|
30 |
||
31 |
function adminMenuOff() |
|
32 |
{ |
|
33 |
if ( menuID ) |
|
34 |
{ |
|
35 |
menu = document.getElementById(menuID); |
|
36 |
menu.style.display = 'none'; |
|
37 |
menu.onmousedown = false; |
|
38 |
menu.onmouseup = false; |
|
39 |
menuID = false; |
|
40 |
document.onclick = false; |
|
41 |
//menuParent.onclick(); |
|
42 |
//menuParent = false; |
|
43 |
} |
|
44 |
} |
|
45 |
||
46 |
function setMenuoffEvents() |
|
47 |
{ |
|
48 |
menu = document.getElementById(menuID); |
|
49 |
menu.onmousedown = function() { menuClicked = true; } |
|
50 |
menu.onmouseup = function() { setTimeout('menuClicked = false;', 100); } |
|
51 |
document.onclick = function() { if ( menuClicked ) return false; adminMenuOff(); } |
|
52 |
} |
|
79
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
53 |
*/ |
0 | 54 |
|
79
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
55 |
function admin_expand() |
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 |
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
|
58 |
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
|
59 |
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
|
60 |
if ( content.style.display == 'table' ) |
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 |
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
|
63 |
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
|
64 |
} |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
65 |
else |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
66 |
{ |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
67 |
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
|
68 |
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
|
69 |
} |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
70 |
} |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
71 |
|
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
72 |
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
|
73 |
{ |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
74 |
expander.className = 'collapsed'; |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
75 |
content.style.display = 'none'; |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
76 |
holder.style.width = '0px'; |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
77 |
holder.style.paddingRight = '12px'; |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
78 |
holder.style.paddingLeft = '0px'; |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
79 |
} |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
80 |
|
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
81 |
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
|
82 |
{ |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
83 |
expander.className = 'expanded'; |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
84 |
content.style.display = 'table'; |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
85 |
holder.style.width = '230px'; |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
86 |
holder.style.paddingLeft = '12px'; |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
87 |
holder.style.paddingRight = '0px'; |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
88 |
} |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
89 |
|
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
90 |
function expander_set_height() |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
91 |
{ |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
92 |
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
|
93 |
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
|
94 |
var height = getHeight(); |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
95 |
var exheight = height - magic; |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
96 |
expander.style.height = exheight + 'px'; |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
97 |
expander.style.top = magic + 'px'; |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
98 |
} |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
99 |
|
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
100 |
function expander_onload() |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
101 |
{ |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
102 |
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
|
103 |
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
|
104 |
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
|
105 |
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
|
106 |
{ |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
107 |
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
|
108 |
} |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
109 |
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
|
110 |
{ |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
111 |
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
|
112 |
} |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
113 |
} |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
114 |
|
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
115 |
addOnloadHook(expander_set_height); |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
116 |
addOnloadHook(expander_onload); |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
117 |
window.onresize = expander_set_height; |
5faff33a6580
Admin theme now uses a collapsable sidebar instead of that ugly menu (WiP)
Dan
parents:
0
diff
changeset
|
118 |