From bbd47dfdc3268aa6d2d5270d479ffee1f115def0 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Thu, 29 Oct 2009 21:28:18 +0000 Subject: [PATCH] - LSinfosBox : - Added function isOpened() - Improvement of the function addInfo() --- trunk/includes/js/LSinfosBox.js | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/trunk/includes/js/LSinfosBox.js b/trunk/includes/js/LSinfosBox.js index f4a3427b..6f83c7e2 100644 --- a/trunk/includes/js/LSinfosBox.js +++ b/trunk/includes/js/LSinfosBox.js @@ -60,6 +60,10 @@ var LSinfosBox = new Class({ this.core.inject(document.body,'top'); }, + isOpened: function() { + return this.opened; + }, + open: function() { this.core.setStyle('top',getScrollTop()+10); @@ -97,23 +101,27 @@ var LSinfosBox = new Class({ }, addInfo: function(html) { - if (this.content.innerHTML=='') { - this.content.set('html',html); - } - else { - var ul = this.content.getLast("ul"); - if (!$type(ul)) { - ul = new Element('ul'); + var ul = this.content.getLast("ul"); + var add = 0; + if (!$type(ul)) { + ul = new Element('ul'); + if (this.content.innerHTML!="") { var c_li = new Element('li'); c_li.set('html',this.content.innerHTML); c_li.injectInside(ul); - this.content.empty(); - ul.injectInside(this.content); + add=1; } - var li = new Element('li'); - li.set('html',html); - li.injectInside(ul); + this.content.empty(); + ul.injectInside(this.content); } + if (add) { + var b_li = new Element('li'); + b_li.set('html','
'); + b_li.injectInside(ul); + } + var li = new Element('li'); + li.set('html',html); + li.injectInside(ul); this.open(); },