diff U3 S:/wamp/www/subdomains/eval/ad-gallery/jquery.ad-gallery.js E:/Downloads/AD Gallery 1.2.7(2)/lib/jquery.ad-gallery.js
--- S:/wamp/www/subdomains/eval/ad-gallery/jquery.ad-gallery.js Tue Jul 23 12:31:20 2013
+++ E:/Downloads/AD Gallery 1.2.7(2)/lib/jquery.ad-gallery.js Tue Jul 23 13:54:30 2013
@@ -9,7 +9,7 @@
*/
(function($) {
$.fn.adGallery = function(options) {
- var defaults = { loader_image: './ad-gallery/loader.gif',
+ var defaults = { loader_image: 'loader.gif',
start_at_index: 0,
update_window_hash: true,
description_wrapper: false,
@@ -64,12 +64,11 @@
function VerticalSlideAnimation(img_container, direction, desc) {
var current_top = parseInt(img_container.css('top'), 10);
- var old_image_top;
if(direction == 'left') {
- old_image_top = '-'+ this.image_wrapper_height +'px';
+ var old_image_top = '-'+ this.image_wrapper_height +'px';
img_container.css('top', this.image_wrapper_height +'px');
} else {
- old_image_top = this.image_wrapper_height +'px';
+ var old_image_top = this.image_wrapper_height +'px';
img_container.css('top', '-'+ this.image_wrapper_height +'px');
};
if(desc) {
@@ -84,13 +83,12 @@
};
function HorizontalSlideAnimation(img_container, direction, desc) {
- var current_left = parseInt(img_container.css('left'), 10);
- var old_image_left;
+ var current_left = parseInt(img_container.css('left'), 10);
if(direction == 'left') {
- old_image_left = '-'+ this.image_wrapper_width +'px';
+ var old_image_left = '-'+ this.image_wrapper_width +'px';
img_container.css('left',this.image_wrapper_width +'px');
} else {
- old_image_left = this.image_wrapper_width +'px';
+ var old_image_left = this.image_wrapper_width +'px';
img_container.css('left','-'+ this.image_wrapper_width +'px');
};
if(desc) {
@@ -283,7 +281,7 @@
// If the browser tells us that the image is loaded, but the width
// is still 0 for some reason, we default to 100px width.
// It's not very nice, but it's better than 0.
- width = 50;
+ width = 100;
};
context.thumbs_wrapper_width += width;
thumbs_loaded++;
@@ -300,28 +298,26 @@
clearInterval(inter);
};
},
- 300
+ 100
);
},
_setThumbListWidth: function(wrapper_width) {
- wrapper_width += 25;
- var list = this.nav.find('.ad-thumb-list');
- list.css('width', wrapper_width +'px');
-// var list = this.nav.find('.ad-thumb-list');
-// list.css('width', wrapper_width +'px');
-// var i = 1;
-// var last_height = list.height();
-// while(i < 201) {
-// list.css('width', (wrapper_width + i) +'px');
-// if(last_height != list.height()) {
-// break;
-// };
-// last_height = list.height();
-// i++;
-// };
-// if(list.width() < this.nav.width()) {
-// list.width(this.nav.width());
-// };
+ wrapper_width -= 100;
+ var list = this.nav.find('.ad-thumb-list');
+ list.css('width', wrapper_width +'px');
+ var i = 1;
+ var last_height = list.height();
+ while(i < 201) {
+ list.css('width', (wrapper_width + i) +'px');
+ if(last_height != list.height()) {
+ break;
+ };
+ last_height = list.height();
+ i++;
+ };
+ if(list.width() < this.nav.width()) {
+ list.width(this.nav.width());
+ };
},
_initLink: function(link) {
var context = this;
@@ -518,14 +514,13 @@
// We don't want to jump the whole width, since an image
// might be cut at the edge
var width = context.nav_display_width - 50;
- var left;
if(context.settings.scroll_jump > 0) {
- width = context.settings.scroll_jump;
+ var width = context.settings.scroll_jump;
};
if($(this).is('.ad-forward')) {
- left = context.thumbs_wrapper.scrollLeft() + width;
+ var left = context.thumbs_wrapper.scrollLeft() + width;
} else {
- left = context.thumbs_wrapper.scrollLeft() - width;
+ var left = context.thumbs_wrapper.scrollLeft() - width;
};
if(context.settings.slideshow.stop_on_scroll) {
context.slideshow.stop();
@@ -608,10 +603,6 @@
* it in the middle anyway
*/
_centerImage: function(img_container, image_width, image_height) {
- //console.log(' Image width :' + image_width);
- //console.log(' Image height :' + image_height);
- //console.log(' Image wrapper width :' + this.image_wrapper_width);
- //console.log(' Image wrapper height:' + this.image_wrapper_height);
img_container.css('top', '0px');
if(image_height < this.image_wrapper_height) {
var dif = this.image_wrapper_height - image_height;
@@ -621,16 +612,16 @@
if(image_width < this.image_wrapper_width) {
var dif = this.image_wrapper_width - image_width;
img_container.css('left', (dif / 2) +'px');
- };
+ };
},
_getDescription: function(image) {
- var desc = '';
+ var desc = false;
if(image.desc.length || image.title.length) {
var title = '';
if(image.title.length) {
title = ''+ image.title +'';
};
- desc = '';
+ var desc = '';
if(image.desc.length) {
desc = ''+ image.desc +'';
};
@@ -679,8 +670,6 @@
var size = this._getContainedImageSize(image.size.width, image.size.height);
img.attr('width', size.width);
img.attr('height', size.height);
- //console.log(' Image width :' + size.width);
- //console.log(' Image height :' + size.height);
img_container.css({width: size.width +'px', height: size.height +'px'});
this._centerImage(img_container, size.width, size.height);
var desc = this._getDescription(image);
@@ -744,14 +733,13 @@
};
},
nextIndex: function() {
- var next;
if(this.current_index == (this.images.length - 1)) {
if(!this.settings.cycle) {
return false;
};
- next = 0;
+ var next = 0;
} else {
- next = this.current_index + 1;
+ var next = this.current_index + 1;
};
return next;
},
@@ -763,14 +751,13 @@
return true;
},
prevIndex: function() {
- var prev;
if(this.current_index == 0) {
if(!this.settings.cycle) {
return false;
};
- prev = this.images.length - 1;
+ var prev = this.images.length - 1;
} else {
- prev = this.current_index - 1;
+ var prev = this.current_index - 1;
};
return prev;
},
@@ -873,6 +860,7 @@
running: false,
countdown_interval: false,
init: function(nextimage_callback, settings) {
+ var context = this;
this.nextimage_callback = nextimage_callback;
this.settings = settings;
},
@@ -927,6 +915,7 @@
},
start: function() {
if(this.running || !this.enabled) return false;
+ var context = this;
this.running = true;
this.controls.addClass('ad-slideshow-running');
this._next();
@@ -943,7 +932,7 @@
return true;
},
_next: function() {
- var context = this;
+ var context = this;
var pre = this.settings.countdown_prefix;
var su = this.settings.countdown_sufix;
clearInterval(context.countdown_interval);