]> code.citadel.org Git - citadel.git/blobdiff - webcit/static/wclib.js
Initial HTML/JS work for expandable roomlist
[citadel.git] / webcit / static / wclib.js
index 01057a82b3672fed3c1509bbd8e5cc436220ae65..2d15e7e19417045548b926a2d3e45495f79a3e90 100644 (file)
@@ -47,6 +47,19 @@ function strcmp ( str1, str2 ) {
     return ( ( str1 == str2 ) ? 0 : ( ( str1 > str2 ) ? 1 : -1 ) );
 }
 
+
+
+function ToggleVisibility ($Which)
+{
+       if (document.getElementById)
+       {
+               if (document.getElementById($Which).style.display  == "none")
+                       document.getElementById($Which).style.display  = "inline";
+               else
+                       document.getElementById($Which).style.display  = "none";
+       }
+}
+
 function emptyElement(element) {
   childNodes = element.childNodes;
   for(var i=0; i<childNodes.length; i++) {
@@ -897,11 +910,34 @@ function switch_to_lang(new_lang) {
 }
 
 
-function toggle_wholist() 
+function toggle_roomlist() 
 {
-       d = $('online_users').style.display;
+       /* WARNING: VILE, SLEAZY HACK.  We determine the state of the box based on the image loaded. */
+       if ( $('expand_roomlist').src.substring($('expand_roomlist').src.length - 12) == "collapse.gif" ) {
+               $('roomlist').style.display = 'none';
+               $('expand_roomlist').src = 'static/expand.gif';
+               wstate=0;
+       }
+
+       else {
+               $('roomlist').style.display = 'block';
+               $('expand_roomlist').src = 'static/collapse.gif';
+               /* activate_iconbar_roomlist_populat0r(); */
+               wstate=1;
+       }
 
-       if (d == 'block') {
+       // tell the server what I did
+       p = 'toggle_roomlist_expanded_state?wstate=' + wstate + '?rand=' + Math.random() ;
+       new Ajax.Request(p, { method: 'get' } );
+
+       return false;   /* this prevents the click from registering as a roomlist button press */
+}
+
+
+function toggle_wholist() 
+{
+       /* WARNING: VILE, SLEAZY HACK.  We determine the state of the box based on the image loaded. */
+       if ( $('expand_wholist').src.substring($('expand_wholist').src.length - 12) == "collapse.gif" ) {
                $('online_users').style.display = 'none';
                $('expand_wholist').src = 'static/expand.gif';
                wstate=0;
@@ -919,5 +955,6 @@ function toggle_wholist()
        new Ajax.Request(p, { method: 'get' } );
 
        return false;   /* this prevents the click from registering as a wholist button press */
-
 }
+
+