themes/enanium/js/inlinerename.js
changeset 955 de4f81abc5e3
parent 921 a71de5e21423
child 958 3dafe0969e5a
--- a/themes/enanium/js/inlinerename.js	Tue May 05 08:36:38 2009 -0400
+++ b/themes/enanium/js/inlinerename.js	Tue May 05 21:53:48 2009 -0400
@@ -1,3 +1,33 @@
+// Sidebar collapse
+function enanium_toggle_sidebar_right()
+{
+  if ( document.getElementById('enanium_sidebar_right').style.display == 'none' )
+  {
+    // show
+    document.getElementById('enanium_sidebar_right').style.display = 'block';
+    document.getElementById('enanium_sidebar_right_hidden').style.display = 'none';
+    createCookie('right_sidebar', 'open', 365);
+  }
+  else
+  {
+    // hide
+    document.getElementById('enanium_sidebar_right').style.display = 'none';
+    document.getElementById('enanium_sidebar_right_hidden').style.display = 'block';
+    createCookie('right_sidebar', 'collapsed', 365);
+  }
+}
+
+addOnloadHook(function()
+  {
+    if ( readCookie('right_sidebar') == 'collapsed' )
+    {
+      document.getElementById('enanium_sidebar_right').style.display = 'none';
+      document.getElementById('enanium_sidebar_right_hidden').style.display = 'block';
+    }
+  });
+
+// Inline rename
+
 function ajaxRenameInline()
 {
   if ( KILL_SWITCH || IE )
@@ -76,14 +106,17 @@
   document.onclick = null;
 }
 
-addOnloadHook(function()
-  {
-    var h2 = document.getElementById('h2PageName');
-    if ( h2 )
+if ( window.auth_rename )
+{
+  addOnloadHook(function()
     {
-      h2.ondblclick = function()
+      var h2 = document.getElementById('h2PageName');
+      if ( h2 )
       {
-        ajaxRenameInline();
+        h2.ondblclick = function()
+        {
+          ajaxRenameInline();
+        }
       }
-    }
-  });
+    });
+}