author | Dan |
Fri, 15 May 2009 19:52:12 -0400 | |
changeset 989 | 79d558a94798 |
parent 958 | 3dafe0969e5a |
child 1300 | 1f97ee3ec614 |
permissions | -rw-r--r-- |
955
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
1 |
// Sidebar collapse |
958 | 2 |
function enanium_toggle_sidebar(side) |
955
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
3 |
{ |
958 | 4 |
if ( document.getElementById('enanium_sidebar_' + side).style.display == 'none' ) |
955
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
5 |
{ |
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
6 |
// show |
958 | 7 |
document.getElementById('enanium_sidebar_' + side).style.display = 'block'; |
8 |
document.getElementById('enanium_sidebar_' + side + '_hidden').style.display = 'none'; |
|
9 |
createCookie(side + '_sidebar', 'open', 365); |
|
955
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
10 |
} |
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
11 |
else |
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
12 |
{ |
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
13 |
// hide |
958 | 14 |
document.getElementById('enanium_sidebar_' + side).style.display = 'none'; |
15 |
document.getElementById('enanium_sidebar_' + side + '_hidden').style.display = 'block'; |
|
16 |
createCookie(side + '_sidebar', 'collapsed', 365); |
|
955
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
17 |
} |
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
18 |
} |
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
19 |
|
958 | 20 |
function enanium_toggle_sidebar_right() |
21 |
{ |
|
22 |
enanium_toggle_sidebar('right'); |
|
23 |
} |
|
24 |
||
25 |
function enanium_toggle_sidebar_left() |
|
26 |
{ |
|
27 |
enanium_toggle_sidebar('left'); |
|
28 |
} |
|
29 |
||
955
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
30 |
addOnloadHook(function() |
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
31 |
{ |
958 | 32 |
if ( readCookie('left_sidebar') == 'collapsed' ) |
33 |
{ |
|
34 |
document.getElementById('enanium_sidebar_left').style.display = 'none'; |
|
35 |
document.getElementById('enanium_sidebar_left_hidden').style.display = 'block'; |
|
36 |
} |
|
37 |
||
955
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
38 |
if ( readCookie('right_sidebar') == 'collapsed' ) |
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
39 |
{ |
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
40 |
document.getElementById('enanium_sidebar_right').style.display = 'none'; |
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
41 |
document.getElementById('enanium_sidebar_right_hidden').style.display = 'block'; |
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
42 |
} |
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
43 |
}); |
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
44 |
|
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
45 |
// Inline rename |
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
46 |
|
921 | 47 |
function ajaxRenameInline() |
48 |
{ |
|
49 |
if ( KILL_SWITCH || IE ) |
|
50 |
return false; |
|
51 |
// This trick is _so_ vBulletin... |
|
52 |
elem = document.getElementById('h2PageName'); |
|
53 |
if(!elem) return; |
|
54 |
elem.style.display = 'none'; |
|
55 |
name = elem.firstChild.nodeValue; |
|
56 |
textbox = document.createElement('input'); |
|
57 |
textbox.type = 'text'; |
|
58 |
textbox.value = name; |
|
59 |
textbox.id = 'pageheading'; |
|
60 |
textbox.size = name.length + 7; |
|
61 |
textbox.onkeyup = function(e) { if(!e) return; if(e.keyCode == 13) ajaxRenameInlineSave(); if(e.keyCode == 27) ajaxRenameInlineCancel(); }; |
|
62 |
textbox.oldname = name; |
|
63 |
elem.parentNode.insertBefore(textbox, elem); |
|
64 |
document.onclick = ajaxRenameInlineCancel; |
|
65 |
||
66 |
load_component(['l10n', 'fadefilter', 'messagebox']); |
|
67 |
textbox.focus(); |
|
68 |
textbox.select(); |
|
69 |
} |
|
70 |
||
71 |
function ajaxRenameInlineSave() |
|
72 |
{ |
|
73 |
elem1 = document.getElementById('h2PageName'); |
|
74 |
elem2 = document.getElementById('pageheading'); |
|
75 |
if(!elem1 || !elem2) return; |
|
76 |
value = elem2.value; |
|
77 |
elem2.parentNode.removeChild(elem2); // just destroy the thing |
|
78 |
elem1.removeChild(elem1.firstChild); |
|
79 |
elem1.appendChild(document.createTextNode(value)); |
|
80 |
elem1.style.display = 'block'; |
|
81 |
if(!value || value=='' || value==elem2.oldname) return; |
|
82 |
setAjaxLoading(); |
|
83 |
ajaxPost(stdAjaxPrefix+'&_mode=rename', 'newtitle='+ajaxEscape(value), function() { |
|
84 |
if ( ajax.readyState == 4 ) |
|
85 |
{ |
|
86 |
unsetAjaxLoading(); |
|
87 |
var response = String(ajax.responseText); |
|
88 |
if ( !check_json_response(response) ) |
|
89 |
{ |
|
90 |
handle_invalid_json(response); |
|
91 |
return false; |
|
92 |
} |
|
93 |
response = parseJSON(response); |
|
94 |
if ( response.success ) |
|
95 |
{ |
|
96 |
new MessageBox( MB_OK|MB_ICONINFORMATION, $lang.get('ajax_rename_success_title'), $lang.get('ajax_rename_success_body', { page_name_new: value }) ); |
|
97 |
} |
|
98 |
else |
|
99 |
{ |
|
100 |
alert(response.error); |
|
101 |
} |
|
102 |
} |
|
103 |
}); |
|
104 |
} |
|
105 |
||
106 |
function ajaxRenameInlineCancel(e) |
|
107 |
{ |
|
108 |
if ( typeof(e) != 'object' && IE ) |
|
109 |
e = window.event; |
|
110 |
elem1 = document.getElementById('h2PageName'); |
|
111 |
elem2 = document.getElementById('pageheading'); |
|
112 |
if(!elem1 || !elem2) return; |
|
113 |
if ( typeof(e) == 'object' && e.target ) |
|
114 |
{ |
|
115 |
if(e.target == elem2) |
|
116 |
return; |
|
117 |
} |
|
118 |
//value = elem2.value; |
|
119 |
elem2.parentNode.removeChild(elem2); // just destroy the thing |
|
120 |
//elem1.innerHTML = value; |
|
121 |
elem1.style.display = 'block'; |
|
122 |
document.onclick = null; |
|
123 |
} |
|
124 |
||
955
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
125 |
if ( window.auth_rename ) |
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
126 |
{ |
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
127 |
addOnloadHook(function() |
921 | 128 |
{ |
955
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
129 |
var h2 = document.getElementById('h2PageName'); |
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
130 |
if ( h2 ) |
921 | 131 |
{ |
955
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
132 |
h2.ondblclick = function() |
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
133 |
{ |
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
134 |
ajaxRenameInline(); |
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
135 |
} |
921 | 136 |
} |
955
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
137 |
}); |
de4f81abc5e3
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
Dan
parents:
921
diff
changeset
|
138 |
} |