Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
authorDan
Tue, 05 May 2009 21:53:48 -0400
changeset 955 de4f81abc5e3
parent 954 995d36f39ba3
child 956 25b1bdce985b
child 957 6b7644fec887
Enanium: Set right sidebar as collapsible. Whether I will do the left one I do not know.
themes/enanium/css/babygrand.css
themes/enanium/footer.tpl
themes/enanium/header.tpl
themes/enanium/js/inlinerename.js
--- a/themes/enanium/css/babygrand.css	Tue May 05 08:36:38 2009 -0400
+++ b/themes/enanium/css/babygrand.css	Tue May 05 21:53:48 2009 -0400
@@ -215,6 +215,33 @@
   background-color: #292929;
 }
 
+div.sidebar.right a.closebtn {
+  display: block;
+  float: right;
+  margin-right: 10px;
+  color: #456798;
+  background-color: #f0f0f0;
+  padding: 0 8px;
+  -moz-border-radius: 0 0 4px 4px;
+  cursor: pointer;
+}
+
+div.right-sidebar-hidden {
+  margin-left: 10px;
+  display: none;
+}
+
+div.right-sidebar-hidden a.openbtn {
+  display: block;
+  float: right;
+  margin-right: -20px;
+  color: #456798;
+  background-color: #f0f0f0;
+  padding: 5px 8px;
+  -moz-border-radius: 4px 0 0 4px;
+  cursor: pointer;
+}
+
 div.slider {
   margin-bottom: 7px;
 }
--- a/themes/enanium/footer.tpl	Tue May 05 08:36:38 2009 -0400
+++ b/themes/enanium/footer.tpl	Tue May 05 21:53:48 2009 -0400
@@ -1,10 +1,14 @@
           </div> <!-- div#ajaxEditContainer -->
           </td>
           <!-- BEGIN right_sidebar -->
-          <td valign="top">
-            <div class="right sidebar">
+          <td valign="top" class="td-right-sidebar">
+            <div class="right sidebar" id="enanium_sidebar_right">
+              <a class="closebtn" onclick="enanium_toggle_sidebar_right(); return false;">&raquo;</a>
               {SIDEBAR_RIGHT}
             </div>
+            <div class="right-sidebar-hidden" id="enanium_sidebar_right_hidden">
+              <a class="openbtn" onclick="enanium_toggle_sidebar_right(); return false;">&laquo;</a>
+            </div>
             <!-- HOOK sidebar_right_post -->
           </td>
           <!-- END right_sidebar -->
--- a/themes/enanium/header.tpl	Tue May 05 08:36:38 2009 -0400
+++ b/themes/enanium/header.tpl	Tue May 05 21:53:48 2009 -0400
@@ -8,9 +8,11 @@
     <link id="mdgCss" rel="stylesheet" type="text/css" href="{CDNPATH}/themes/{THEME_ID}/css/{STYLE_ID}.css" />
     {JS_HEADER}
     {ADDITIONAL_HEADERS}
-    <!-- BEGIN auth_rename -->
+    <script type="text/javascript">//<![CDATA[
+    var auth_rename = <!-- BEGIN auth_rename -->true<!-- BEGINELSE auth_rename -->false<!-- END auth_rename -->;
+    // ]]>
+    </script>
     <script type="text/javascript" src="{CDNPATH}/themes/{THEME_ID}/js/inlinerename.js"></script>
-    <!-- END auth_rename -->
   </head>
   <body>
     <div id="header">
--- 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();
+        }
       }
-    }
-  });
+    });
+}