remove debugging code
[roojs1] / ux / Slideshow.js
index 0d100f5..eef3f62 100644 (file)
@@ -24,12 +24,16 @@ Roo.namespace('Roo.ux');
 Roo.ux.Slideshow = function(cfg ) 
 {
     Roo.apply(this, cfg);
-    if ( this.slides ) {
-        this.numOfImages       = this.slides.length;
-        if ( !this.numOfImages ) {
-            alert('No slides?');
-        }
+    if ( !this.slides || !this.slides.length) {
+        return;
+    }
+    if (this.slides.length == 1) {
+        this.slides[0].setVisibilityMode(Roo.Element.DISPLAY);
+        this.slides[0].show();
+        return;
+        
     }
+    
     this.playButton = Roo.get(this.playButton);
     this.pauseButton = Roo.get(this.pauseButton);
     this.counter = Roo.get(this.counter);
@@ -95,7 +99,9 @@ Roo.apply(Roo.ux.Slideshow.prototype, {
                this.pauseButton && this.pauseButton.show();
      
                this.updatecounter();
-               this.play();                                                    
+        this.slides[0].setStyle({ opacity : 1.0 });
+        this.slides[0].show();
+           this.play.defer(this.wait, this);                           
        },
        
        play: function () {
@@ -105,7 +111,7 @@ Roo.apply(Roo.ux.Slideshow.prototype, {
                imageShow = this.iImageId+1;
                imageHide = this.iImageId;
                
-               if (imageShow == this.numOfImages) {
+               if (imageShow+1  > this.slides.length) {
                        this.swapImage(0,imageHide);
             
                        this.iImageId = 0;                                      
@@ -114,11 +120,9 @@ Roo.apply(Roo.ux.Slideshow.prototype, {
                        this.iImageId++;
                }
                
-               this.textIn = this.iImageId+1 + ' of ' + this.numOfImages;
+               this.textIn = this.iImageId+1 + ' of ' + this.slides.length;
                this.updatecounter();
-        if (this.images.length == 1) {
-            return;
-           }
+        
         if (this.running) {
             this.play.defer(this.wait, this);
         }
@@ -182,7 +186,7 @@ Roo.apply(Roo.ux.Slideshow.prototype, {
         if (!this.counter) {
             return;
         }
-               var textIn = this.iImageId+1 + ' of ' + this.numOfImages;
+               var textIn = this.iImageId+1 + ' of ' + this.slides.length;
                this.counter.update( textIn );
         var oNewCaption = this.slides[this.iImageId].select('.image-caption', true);
                if ( this.caption &&  oNewCaption.length ) {