BipadTaranMahato / slideshow

Automatically exported from code.google.com/p/slideshow
0 stars 0 forks source link

null data array and thumbnails set to false throws an error #60

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. null data array (parse from html)
2. thumbnails set to false
3. html contains no <div class="slideshow-thumbnails">

What is the expected output? 
Parse from html structure
Expect slideshow with no thumbnails. 

What do you see instead?
A quick image flash before the error registers, then a blank screen.

Firebug error report:
thumbnails[i] is undefined
var thumbnail = thumbnails[i].get('src') || '';

What version of the product are you using? On what operating system and
browser?
Mac os x 10.5.5
Firefox 3.0.4
Slideshow2 v2r133 
Mootools 1.2
I have been testing this error for many days, looking for an options
conflict but to no avail.

I have attached an html file to demonstrate this issue.

Original issue reported on code.google.com by daiv.mow...@gmail.com on 2 Dec 2008 at 10:21

Attachments:

GoogleCodeExporter commented 9 years ago
My temporary sollution is to deactivate the thumbnail line. This works for my 
situation.
//var thumbnail = thumbnails[i].get('src') || '';
data[src] = {'caption': caption, 'href': href};//, 'thumbnail': thumbnail

Original comment by daiv.mow...@gmail.com on 2 Dec 2008 at 10:32

GoogleCodeExporter commented 9 years ago
Afraid the above temp solution only avoids the error, it leaves thumbnails out 
of service regardless of the option 
thumbnails true or false. 

Original comment by daiv.mow...@gmail.com on 4 Dec 2008 at 9:09

GoogleCodeExporter commented 9 years ago
I have a solution which seams to work. If anyone can confirm the fix, thanx.
I have added a conditional if to the if(!data) zone: 

Changed this:
if (!data){
            this.options.hu = '';
            data = {};
            var thumbnails = this.slideshow.getElements(this.classes.get('thumbnails') + ' img');
            this.slideshow.getElements(this.classes.get('images') + ' img').each(function(img, i){
                var src = img.get('src');
                var caption = img.get('alt') || img.get('title') || '';
                var href = img.getParent().get('href') || '';
                var thumbnail = thumbnails[i].get('src') || '';
                data[src] = {'caption': caption, 'href': href, 'thumbnail': thumbnail};
            });
        }

To:
if (!data){
            this.options.hu = '';
            data = {};
            if (this.options.thumbnails) { 
            var thumbnails = this.slideshow.getElements(this.classes.get('thumbnails') + ' img');}
            this.slideshow.getElements(this.classes.get('images') + ' img').each(function(img, i){
                var src = img.get('src');
                var caption = img.get('alt') || img.get('title') || '';
                var href = img.getParent().get('href') || '';
                if (thumbnails) var thumbnail = thumbnails[i].get('src') || '';
                data[src] = {'caption': caption, 'href': href, 'thumbnail': thumbnail};
            });
        }

Original comment by daiv.mow...@gmail.com on 4 Dec 2008 at 9:29

GoogleCodeExporter commented 9 years ago

Original comment by aeron.gl...@gmail.com on 27 Dec 2008 at 2:39

GoogleCodeExporter commented 9 years ago
This has been fixed in SVN. Thanks for your bug report!

Original comment by aeron.gl...@gmail.com on 17 Jan 2009 at 3:56