From dd7b4dec558dfb48cf2cd4520cad2a7c9a66f119 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Wed, 28 Jan 2015 17:42:14 +0000 Subject: [PATCH] Add two options to blueimp gallery plugin: - thumbnailsTagIndicators: in order to set custom tag as indicator element. Default value: 'li' - thumbnailWithImgTag: in order to set indicator with img child as thumbnail. Default value: false --- .../blueimp/js/blueimp-gallery-indicator.js | 26 +++++++++++++++---- .../jquery/blueimp/js/blueimp-gallery.min.js | 4 +-- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/phpgwapi/js/jquery/blueimp/js/blueimp-gallery-indicator.js b/phpgwapi/js/jquery/blueimp/js/blueimp-gallery-indicator.js index cd0cf7d5ea..7f69d851bf 100644 --- a/phpgwapi/js/jquery/blueimp/js/blueimp-gallery-indicator.js +++ b/phpgwapi/js/jquery/blueimp/js/blueimp-gallery-indicator.js @@ -38,7 +38,11 @@ // used as alternative to a thumbnail child element: thumbnailProperty: 'thumbnail', // Defines if the gallery indicators should display a thumbnail: - thumbnailIndicators: true + thumbnailIndicators: true, + // The tag name of thumbnails indicators + thumbnailsTagIndicators: 'li', + //thumbnail with image tag + thumbnailWithImgTag: false }); var initSlides = Gallery.prototype.initSlides, @@ -51,7 +55,7 @@ $.extend(Gallery.prototype, { createIndicator: function (obj) { - var indicator = this.indicatorPrototype.cloneNode(false), + var indicator = this.indicatorPrototype.cloneNode(this.options.thumbnailWithImgTag), title = this.getItemProperty(obj, this.options.titleProperty), thumbnailProperty = this.options.thumbnailProperty, thumbnailUrl, @@ -64,7 +68,18 @@ thumbnailUrl = this.getItemProperty(obj, thumbnailProperty); } if (thumbnailUrl) { - indicator.style.backgroundImage = 'url("' + thumbnailUrl + '")'; + if (this.options.thumbnailsTagIndicators == 'img') + { + indicator.src = thumbnailUrl; + } + else if (this.options.thumbnailWithImgTag) + { + indicator.children[0].src = thumbnailUrl; + } + else + { + indicator.style.backgroundImage = 'url("' + thumbnailUrl + '")'; + } } } if (title) { @@ -100,8 +115,9 @@ this.options.indicatorContainer ); if (this.indicatorContainer.length) { - this.indicatorPrototype = document.createElement('li'); - this.indicators = this.indicatorContainer[0].children; + this.indicatorPrototype = document.createElement(this.options.thumbnailsTagIndicators); + if (this.options.thumbnailWithImgTag) this.indicatorPrototype.appendChild(document.createElement('img')); + this.indicators = this.indicatorContainer[0].children; } } initSlides.call(this, reload); diff --git a/phpgwapi/js/jquery/blueimp/js/blueimp-gallery.min.js b/phpgwapi/js/jquery/blueimp/js/blueimp-gallery.min.js index 648c3fa74b..1d36dbd698 100644 --- a/phpgwapi/js/jquery/blueimp/js/blueimp-gallery.min.js +++ b/phpgwapi/js/jquery/blueimp/js/blueimp-gallery.min.js @@ -1,2 +1,2 @@ -(function(factory){"use strict";if(typeof define==="function"&&define.amd){define(["./blueimp-helper"],factory)}else{window.blueimp=window.blueimp||{};window.blueimp.Gallery=factory(window.blueimp.helper||window.jQuery)}})(function($){"use strict";function Gallery(list,options){if(document.body.style.maxHeight===undefined){return null}if(!this||this.options!==Gallery.prototype.options){return new Gallery(list,options)}if(!list||!list.length){this.console.log("blueimp Gallery: No or empty list provided as first argument.",list);return}this.list=list;this.num=list.length;this.initOptions(options);this.initialize()}$.extend(Gallery.prototype,{options:{container:"#blueimp-gallery",slidesContainer:"div",titleElement:"h3",displayClass:"blueimp-gallery-display",controlsClass:"blueimp-gallery-controls",singleClass:"blueimp-gallery-single",leftEdgeClass:"blueimp-gallery-left",rightEdgeClass:"blueimp-gallery-right",playingClass:"blueimp-gallery-playing",slideClass:"slide",slideLoadingClass:"slide-loading",slideErrorClass:"slide-error",slideContentClass:"slide-content",toggleClass:"toggle",prevClass:"prev",nextClass:"next",closeClass:"close",playPauseClass:"play-pause",fullscreenClass:"fullscreen",typeProperty:"type",titleProperty:"title",urlProperty:"href",displayTransition:true,clearSlides:true,stretchImages:false,toggleControlsOnReturn:true,toggleSlideshowOnSpace:true,toggleFullscreenOnSlideShow:true,enableKeyboardNavigation:true,closeOnEscape:true,closeOnSlideClick:true,closeOnSwipeUpOrDown:true,emulateTouchEvents:true,stopTouchEventsPropagation:false,hidePageScrollbars:true,disableScroll:true,carousel:false,continuous:true,unloadElements:true,startSlideshow:false,slideshowInterval:5e3,index:0,preloadRange:2,transitionSpeed:400,slideshowTransitionSpeed:undefined,event:undefined,onopen:undefined,onopened:undefined,onslide:undefined,onslideend:undefined,onslidecomplete:undefined,onclose:undefined,onclosed:undefined},carouselOptions:{hidePageScrollbars:false,toggleControlsOnReturn:false,toggleSlideshowOnSpace:false,enableKeyboardNavigation:false,closeOnEscape:false,closeOnSlideClick:false,closeOnSwipeUpOrDown:false,disableScroll:false,startSlideshow:true},console:window.console&&typeof window.console.log==="function"?window.console:{log:function(){}},support:function(element){var support={touch:window.ontouchstart!==undefined||window.DocumentTouch&&document instanceof DocumentTouch},transitions={webkitTransition:{end:"webkitTransitionEnd",prefix:"-webkit-"},MozTransition:{end:"transitionend",prefix:"-moz-"},OTransition:{end:"otransitionend",prefix:"-o-"},transition:{end:"transitionend",prefix:""}},elementTests=function(){var transition=support.transition,prop,translateZ;document.body.appendChild(element);if(transition){prop=transition.name.slice(0,-9)+"ransform";if(element.style[prop]!==undefined){element.style[prop]="translateZ(0)";translateZ=window.getComputedStyle(element).getPropertyValue(transition.prefix+"transform");support.transform={prefix:transition.prefix,name:prop,translate:true,translateZ:!!translateZ&&translateZ!=="none"}}}if(element.style.backgroundSize!==undefined){support.backgroundSize={};element.style.backgroundSize="contain";support.backgroundSize.contain=window.getComputedStyle(element).getPropertyValue("background-size")==="contain";element.style.backgroundSize="cover";support.backgroundSize.cover=window.getComputedStyle(element).getPropertyValue("background-size")==="cover"}document.body.removeChild(element)};(function(support,transitions){var prop;for(prop in transitions){if(transitions.hasOwnProperty(prop)&&element.style[prop]!==undefined){support.transition=transitions[prop];support.transition.name=prop;break}}})(support,transitions);if(document.body){elementTests()}else{$(document).on("DOMContentLoaded",elementTests)}return support}(document.createElement("div")),requestAnimationFrame:window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame,initialize:function(){this.initStartIndex();if(this.initWidget()===false){return false}this.initEventListeners();this.onslide(this.index);this.ontransitionend();if(this.options.startSlideshow){this.play()}},slide:function(to,speed){window.clearTimeout(this.timeout);var index=this.index,direction,naturalDirection,diff;if(index===to||this.num===1){return}if(!speed){speed=this.options.transitionSpeed}if(this.support.transform){if(!this.options.continuous){to=this.circle(to)}direction=Math.abs(index-to)/(index-to);if(this.options.continuous){naturalDirection=direction;direction=-this.positions[this.circle(to)]/this.slideWidth;if(direction!==naturalDirection){to=-direction*this.num+to}}diff=Math.abs(index-to)-1;while(diff){diff-=1;this.move(this.circle((to>index?to:index)-diff-1),this.slideWidth*direction,0)}to=this.circle(to);this.move(index,this.slideWidth*direction,speed);this.move(to,0,speed);if(this.options.continuous){this.move(this.circle(to-direction),-(this.slideWidth*direction),0)}}else{to=this.circle(to);this.animate(index*-this.slideWidth,to*-this.slideWidth,speed)}this.onslide(to)},getIndex:function(){return this.index},getNumber:function(){return this.num},prev:function(){if(this.options.continuous||this.index){this.slide(this.index-1)}},next:function(){if(this.options.continuous||this.index1){this.timeout=this.setTimeout(!this.requestAnimationFrame&&this.slide||function(to,speed){that.animationFrameId=that.requestAnimationFrame.call(window,function(){that.slide(to,speed)})},[this.index+1,this.options.slideshowTransitionSpeed],this.interval)}this.container.addClass(this.options.playingClass)},pause:function(){window.clearTimeout(this.timeout);this.interval=null;this.container.removeClass(this.options.playingClass)},add:function(list){var i;if(!list.concat){list=Array.prototype.slice.call(list)}if(!this.list.concat){this.list=Array.prototype.slice.call(this.list)}this.list=this.list.concat(list);this.num=this.list.length;if(this.num>2&&this.options.continuous===null){this.options.continuous=true;this.container.removeClass(this.options.leftEdgeClass)}this.container.removeClass(this.options.rightEdgeClass).removeClass(this.options.singleClass);for(i=this.num-list.length;ispeed){that.slidesContainer[0].style.left=to+"px";that.ontransitionend();window.clearInterval(timer);return}that.slidesContainer[0].style.left=(to-from)*(Math.floor(timeElap/speed*100)/100)+from+"px"},4)},preventDefault:function(event){if(event.preventDefault){event.preventDefault()}else{event.returnValue=false}},stopPropagation:function(event){if(event.stopPropagation){event.stopPropagation()}else{event.cancelBubble=true}},onresize:function(){this.initSlides(true)},onmousedown:function(event){if(event.which&&event.which===1&&event.target.nodeName!=="VIDEO"){event.preventDefault();(event.originalEvent||event).touches=[{pageX:event.pageX,pageY:event.pageY}];this.ontouchstart(event)}},onmousemove:function(event){if(this.touchStart){(event.originalEvent||event).touches=[{pageX:event.pageX,pageY:event.pageY}];this.ontouchmove(event)}},onmouseup:function(event){if(this.touchStart){this.ontouchend(event);delete this.touchStart}},onmouseout:function(event){if(this.touchStart){var target=event.target,related=event.relatedTarget;if(!related||related!==target&&!$.contains(target,related)){this.onmouseup(event)}}},ontouchstart:function(event){if(this.options.stopTouchEventsPropagation){this.stopPropagation(event)}var touches=(event.originalEvent||event).touches[0];this.touchStart={x:touches.pageX,y:touches.pageY,time:Date.now()};this.isScrolling=undefined;this.touchDelta={}},ontouchmove:function(event){if(this.options.stopTouchEventsPropagation){this.stopPropagation(event)}var touches=(event.originalEvent||event).touches[0],scale=(event.originalEvent||event).scale,index=this.index,touchDeltaX,indices;if(touches.length>1||scale&&scale!==1){return}if(this.options.disableScroll){event.preventDefault()}this.touchDelta={x:touches.pageX-this.touchStart.x,y:touches.pageY-this.touchStart.y};touchDeltaX=this.touchDelta.x;if(this.isScrolling===undefined){this.isScrolling=this.isScrolling||Math.abs(touchDeltaX)0||index===this.num-1&&touchDeltaX<0?Math.abs(touchDeltaX)/this.slideWidth+1:1);indices=[index];if(index){indices.push(index-1)}if(index20||Math.abs(this.touchDelta.x)>slideWidth/2,isPastBounds=!index&&this.touchDelta.x>0||index===this.num-1&&this.touchDelta.x<0,isValidClose=!isValidSlide&&this.options.closeOnSwipeUpOrDown&&(isShortDuration&&Math.abs(this.touchDelta.y)>20||Math.abs(this.touchDelta.y)>this.slideHeight/2),direction,indexForward,indexBackward,distanceForward,distanceBackward;if(this.options.continuous){isPastBounds=false}direction=this.touchDelta.x<0?-1:1;if(!this.isScrolling){if(isValidSlide&&!isPastBounds){indexForward=index+direction;indexBackward=index-direction;distanceForward=slideWidth*direction;distanceBackward=-slideWidth*direction;if(this.options.continuous){this.move(this.circle(indexForward),distanceForward,0);this.move(this.circle(index-2*direction),distanceBackward,0)}else if(indexForward>=0&&indexForwardthis.container[0].clientHeight){target.style.maxHeight=this.container[0].clientHeight}if(this.interval&&this.slides[this.index]===parent){this.play()}this.setTimeout(this.options.onslidecomplete,[index,parent])},onload:function(event){this.oncomplete(event)},onerror:function(event){this.oncomplete(event)},onkeydown:function(event){switch(event.which||event.keyCode){case 13:if(this.options.toggleControlsOnReturn){this.preventDefault(event);this.toggleControls()}break;case 27:if(this.options.closeOnEscape){this.close()}break;case 32:if(this.options.toggleSlideshowOnSpace){this.preventDefault(event);this.toggleSlideshow()}break;case 37:if(this.options.enableKeyboardNavigation){this.preventDefault(event);this.prev()}break;case 39:if(this.options.enableKeyboardNavigation){this.preventDefault(event);this.next()}break}},handleClick:function(event){var options=this.options,target=event.target||event.srcElement,parent=target.parentNode,isTarget=function(className){return $(target).hasClass(className)||$(parent).hasClass(className)};if(isTarget(options.toggleClass)){this.preventDefault(event);this.toggleControls()}else if(isTarget(options.prevClass)){this.preventDefault(event);this.prev()}else if(isTarget(options.nextClass)){this.preventDefault(event);this.next()}else if(isTarget(options.closeClass)){this.preventDefault(event);this.close()}else if(isTarget(options.playPauseClass)){this.preventDefault(event);this.toggleSlideshow()}else if(isTarget(options.fullscreenClass)){this.preventDefault(event);this.toggleFullscreen()}else if(parent===this.slidesContainer[0]){this.preventDefault(event);if(options.closeOnSlideClick){this.close()}else{this.toggleControls()}}else if(parent.parentNode&&parent.parentNode===this.slidesContainer[0]){this.preventDefault(event);this.toggleControls()}},onclick:function(event){if(this.options.emulateTouchEvents&&this.touchDelta&&(Math.abs(this.touchDelta.x)>20||Math.abs(this.touchDelta.y)>20)){delete this.touchDelta;return}return this.handleClick(event)},updateEdgeClasses:function(index){if(!index){this.container.addClass(this.options.leftEdgeClass)}else{this.container.removeClass(this.options.leftEdgeClass)}if(index===this.num-1){this.container.addClass(this.options.rightEdgeClass)}else{this.container.removeClass(this.options.rightEdgeClass)}},handleSlide:function(index){if(!this.options.continuous){this.updateEdgeClasses(index)}this.loadElements(index);if(this.options.unloadElements){this.unloadElements(index)}this.setTitle(index)},onslide:function(index){this.index=index;this.handleSlide(index);this.setTimeout(this.options.onslide,[index,this.slides[index]])},setTitle:function(index){var text=this.slides[index].firstChild.title,titleElement=this.titleElement;if(titleElement.length){this.titleElement.empty();if(text){titleElement[0].appendChild(document.createTextNode(text))}}},setTimeout:function(func,args,wait){var that=this;return func&&window.setTimeout(function(){func.apply(that,args||[])},wait||0)},imageFactory:function(obj,callback){var that=this,img=this.imagePrototype.cloneNode(false),url=obj,backgroundSize=this.options.stretchImages,called,element,callbackWrapper=function(event){if(!called){event={type:event.type,target:element};if(!element.parentNode){return that.setTimeout(callbackWrapper,[event])}called=true;$(img).off("load error",callbackWrapper);if(backgroundSize){if(event.type==="load"){element.style.background='url("'+url+'") center no-repeat';element.style.backgroundSize=backgroundSize}}callback(event)}},title;if(typeof url!=="string"){url=this.getItemProperty(obj,this.options.urlProperty);title=this.getItemProperty(obj,this.options.titleProperty)}if(backgroundSize===true){backgroundSize="contain"}backgroundSize=this.support.backgroundSize&&this.support.backgroundSize[backgroundSize]&&backgroundSize;if(backgroundSize){element=this.elementPrototype.cloneNode(false)}else{element=img;img.draggable=false}if(title){element.title=title}$(img).on("load error",callbackWrapper);img.src=url;return element},createElement:function(obj,callback){var type=obj&&this.getItemProperty(obj,this.options.typeProperty),factory=type&&this[type.split("/")[0]+"Factory"]||this.imageFactory,element=obj&&factory.call(this,obj,callback);if(!element){element=this.elementPrototype.cloneNode(false);this.setTimeout(callback,[{type:"error",target:element}])}$(element).addClass(this.options.slideContentClass);return element},loadElement:function(index){if(!this.elements[index]){if(this.slides[index].firstChild){this.elements[index]=$(this.slides[index]).hasClass(this.options.slideErrorClass)?3:2}else{this.elements[index]=1;$(this.slides[index]).addClass(this.options.slideLoadingClass);this.slides[index].appendChild(this.createElement(this.list[index],this.proxyListener))}}},loadElements:function(index){var limit=Math.min(this.num,this.options.preloadRange*2+1),j=index,i;for(i=0;ithis.options.preloadRange&&diff+this.options.preloadRangeindex?-this.slideWidth:this.indexindex?to:index)-diff-1),this.slideWidth*direction,0)}to=this.circle(to);this.move(index,this.slideWidth*direction,speed);this.move(to,0,speed);if(this.options.continuous){this.move(this.circle(to-direction),-(this.slideWidth*direction),0)}}else{to=this.circle(to);this.animate(index*-this.slideWidth,to*-this.slideWidth,speed)}this.onslide(to)},getIndex:function(){return this.index},getNumber:function(){return this.num},prev:function(){if(this.options.continuous||this.index){this.slide(this.index-1)}},next:function(){if(this.options.continuous||this.index1){this.timeout=this.setTimeout(!this.requestAnimationFrame&&this.slide||function(to,speed){that.animationFrameId=that.requestAnimationFrame.call(window,function(){that.slide(to,speed)})},[this.index+1,this.options.slideshowTransitionSpeed],this.interval)}this.container.addClass(this.options.playingClass)},pause:function(){window.clearTimeout(this.timeout);this.interval=null;this.container.removeClass(this.options.playingClass)},add:function(list){var i;if(!list.concat){list=Array.prototype.slice.call(list)}if(!this.list.concat){this.list=Array.prototype.slice.call(this.list)}this.list=this.list.concat(list);this.num=this.list.length;if(this.num>2&&this.options.continuous===null){this.options.continuous=true;this.container.removeClass(this.options.leftEdgeClass)}this.container.removeClass(this.options.rightEdgeClass).removeClass(this.options.singleClass);for(i=this.num-list.length;ispeed){that.slidesContainer[0].style.left=to+"px";that.ontransitionend();window.clearInterval(timer);return}that.slidesContainer[0].style.left=(to-from)*(Math.floor(timeElap/speed*100)/100)+from+"px"},4)},preventDefault:function(event){if(event.preventDefault){event.preventDefault()}else{event.returnValue=false}},stopPropagation:function(event){if(event.stopPropagation){event.stopPropagation()}else{event.cancelBubble=true}},onresize:function(){this.initSlides(true)},onmousedown:function(event){if(event.which&&event.which===1&&event.target.nodeName!=="VIDEO"){event.preventDefault();(event.originalEvent||event).touches=[{pageX:event.pageX,pageY:event.pageY}];this.ontouchstart(event)}},onmousemove:function(event){if(this.touchStart){(event.originalEvent||event).touches=[{pageX:event.pageX,pageY:event.pageY}];this.ontouchmove(event)}},onmouseup:function(event){if(this.touchStart){this.ontouchend(event);delete this.touchStart}},onmouseout:function(event){if(this.touchStart){var target=event.target,related=event.relatedTarget;if(!related||related!==target&&!$.contains(target,related)){this.onmouseup(event)}}},ontouchstart:function(event){if(this.options.stopTouchEventsPropagation){this.stopPropagation(event)}var touches=(event.originalEvent||event).touches[0];this.touchStart={x:touches.pageX,y:touches.pageY,time:Date.now()};this.isScrolling=undefined;this.touchDelta={}},ontouchmove:function(event){if(this.options.stopTouchEventsPropagation){this.stopPropagation(event)}var touches=(event.originalEvent||event).touches[0],scale=(event.originalEvent||event).scale,index=this.index,touchDeltaX,indices;if(touches.length>1||scale&&scale!==1){return}if(this.options.disableScroll){event.preventDefault()}this.touchDelta={x:touches.pageX-this.touchStart.x,y:touches.pageY-this.touchStart.y};touchDeltaX=this.touchDelta.x;if(this.isScrolling===undefined){this.isScrolling=this.isScrolling||Math.abs(touchDeltaX)0||index===this.num-1&&touchDeltaX<0?Math.abs(touchDeltaX)/this.slideWidth+1:1);indices=[index];if(index){indices.push(index-1)}if(index20||Math.abs(this.touchDelta.x)>slideWidth/2,isPastBounds=!index&&this.touchDelta.x>0||index===this.num-1&&this.touchDelta.x<0,isValidClose=!isValidSlide&&this.options.closeOnSwipeUpOrDown&&(isShortDuration&&Math.abs(this.touchDelta.y)>20||Math.abs(this.touchDelta.y)>this.slideHeight/2),direction,indexForward,indexBackward,distanceForward,distanceBackward;if(this.options.continuous){isPastBounds=false}direction=this.touchDelta.x<0?-1:1;if(!this.isScrolling){if(isValidSlide&&!isPastBounds){indexForward=index+direction;indexBackward=index-direction;distanceForward=slideWidth*direction;distanceBackward=-slideWidth*direction;if(this.options.continuous){this.move(this.circle(indexForward),distanceForward,0);this.move(this.circle(index-2*direction),distanceBackward,0)}else if(indexForward>=0&&indexForwardthis.container[0].clientHeight){target.style.maxHeight=this.container[0].clientHeight}if(this.interval&&this.slides[this.index]===parent){this.play()}this.setTimeout(this.options.onslidecomplete,[index,parent])},onload:function(event){this.oncomplete(event)},onerror:function(event){this.oncomplete(event)},onkeydown:function(event){switch(event.which||event.keyCode){case 13:if(this.options.toggleControlsOnReturn){this.preventDefault(event);this.toggleControls()}break;case 27:if(this.options.closeOnEscape){this.close()}break;case 32:if(this.options.toggleSlideshowOnSpace){this.preventDefault(event);this.toggleSlideshow()}break;case 37:if(this.options.enableKeyboardNavigation){this.preventDefault(event);this.prev()}break;case 39:if(this.options.enableKeyboardNavigation){this.preventDefault(event);this.next()}break}},handleClick:function(event){var options=this.options,target=event.target||event.srcElement,parent=target.parentNode,isTarget=function(className){return $(target).hasClass(className)||$(parent).hasClass(className)};if(isTarget(options.toggleClass)){this.preventDefault(event);this.toggleControls()}else if(isTarget(options.prevClass)){this.preventDefault(event);this.prev()}else if(isTarget(options.nextClass)){this.preventDefault(event);this.next()}else if(isTarget(options.closeClass)){this.preventDefault(event);this.close()}else if(isTarget(options.playPauseClass)){this.preventDefault(event);this.toggleSlideshow()}else if(isTarget(options.fullscreenClass)){this.preventDefault(event);this.toggleFullscreen()}else if(parent===this.slidesContainer[0]){this.preventDefault(event);if(options.closeOnSlideClick){this.close()}else{this.toggleControls()}}else if(parent.parentNode&&parent.parentNode===this.slidesContainer[0]){this.preventDefault(event);this.toggleControls()}},onclick:function(event){if(this.options.emulateTouchEvents&&this.touchDelta&&(Math.abs(this.touchDelta.x)>20||Math.abs(this.touchDelta.y)>20)){delete this.touchDelta;return}return this.handleClick(event)},updateEdgeClasses:function(index){if(!index){this.container.addClass(this.options.leftEdgeClass)}else{this.container.removeClass(this.options.leftEdgeClass)}if(index===this.num-1){this.container.addClass(this.options.rightEdgeClass)}else{this.container.removeClass(this.options.rightEdgeClass)}},handleSlide:function(index){if(!this.options.continuous){this.updateEdgeClasses(index)}this.loadElements(index);if(this.options.unloadElements){this.unloadElements(index)}this.setTitle(index)},onslide:function(index){this.index=index;this.handleSlide(index);this.setTimeout(this.options.onslide,[index,this.slides[index]])},setTitle:function(index){var text=this.slides[index].firstChild.title,titleElement=this.titleElement;if(titleElement.length){this.titleElement.empty();if(text){titleElement[0].appendChild(document.createTextNode(text))}}},setTimeout:function(func,args,wait){var that=this;return func&&window.setTimeout(function(){func.apply(that,args||[])},wait||0)},imageFactory:function(obj,callback){var that=this,img=this.imagePrototype.cloneNode(false),url=obj,backgroundSize=this.options.stretchImages,called,element,callbackWrapper=function(event){if(!called){event={type:event.type,target:element};if(!element.parentNode){return that.setTimeout(callbackWrapper,[event])}called=true;$(img).off("load error",callbackWrapper);if(backgroundSize){if(event.type==="load"){element.style.background='url("'+url+'") center no-repeat';element.style.backgroundSize=backgroundSize}}callback(event)}},title;if(typeof url!=="string"){url=this.getItemProperty(obj,this.options.urlProperty);title=this.getItemProperty(obj,this.options.titleProperty)}if(backgroundSize===true){backgroundSize="contain"}backgroundSize=this.support.backgroundSize&&this.support.backgroundSize[backgroundSize]&&backgroundSize;if(backgroundSize){element=this.elementPrototype.cloneNode(false)}else{element=img;img.draggable=false}if(title){element.title=title}$(img).on("load error",callbackWrapper);img.src=url;return element},createElement:function(obj,callback){var type=obj&&this.getItemProperty(obj,this.options.typeProperty),factory=type&&this[type.split("/")[0]+"Factory"]||this.imageFactory,element=obj&&factory.call(this,obj,callback);if(!element){element=this.elementPrototype.cloneNode(false);this.setTimeout(callback,[{type:"error",target:element}])}$(element).addClass(this.options.slideContentClass);return element},loadElement:function(index){if(!this.elements[index]){if(this.slides[index].firstChild){this.elements[index]=$(this.slides[index]).hasClass(this.options.slideErrorClass)?3:2}else{this.elements[index]=1;$(this.slides[index]).addClass(this.options.slideLoadingClass);this.slides[index].appendChild(this.createElement(this.list[index],this.proxyListener))}}},loadElements:function(index){var limit=Math.min(this.num,this.options.preloadRange*2+1),j=index,i;for(i=0;ithis.options.preloadRange&&diff+this.options.preloadRangeindex?-this.slideWidth:this.index