- LSinfosBox : fix bug in addInfo() and add displayInUl() and displayOrAdd() functions
authorBenjamin Renard <brenard@easter-eggs.com>
Thu, 29 Oct 2009 21:56:10 +0000 (21:56 +0000)
committerBenjamin Renard <brenard@easter-eggs.com>
Thu, 29 Oct 2009 21:56:10 +0000 (21:56 +0000)
trunk/includes/js/LSinfosBox.js

index 6f83c7e..c6f0442 100644 (file)
@@ -102,8 +102,9 @@ var LSinfosBox = new Class({
     
     addInfo: function(html) {
       var ul = this.content.getLast("ul");
-      var add = 0;
+      var add = 1;
       if (!$type(ul)) {
+        add=0;
         ul = new Element('ul');
         if (this.content.innerHTML!="") {
           var c_li = new Element('li');
@@ -131,5 +132,24 @@ var LSinfosBox = new Class({
         this.content.set('html',html);
       }
       this.open();
+    },
+    
+    displayInUl: function(html) {
+      if ($type(html)) {
+        ul = new Element('ul');
+        this.content.empty();
+        ul.set('html',html);
+        ul.inject(this.content);
+      }
+      this.open();
+    },
+    
+    displayOrAdd: function(html) {
+      if (this.isOpened()) {
+        this.addInfo(html);
+      }
+      else {
+        this.displayInUl(html);
+      }
     }
 });