diff --git a/bower.json b/bower.json index e4a4a62..b953a63 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "desoslide", - "version": "2.0.1", + "version": "2.1.0", "homepage": "https://github.com/sylouuu/desoslide", "description": "Take control of your slideshow with this powerful jQuery plugin", "keywords": [ @@ -17,4 +17,4 @@ "animate.css": "~3.1.0", "magic": "~1.0.0" } -} \ No newline at end of file +} diff --git a/desoslide.jquery.json b/desoslide.jquery.json index ba2af20..3e1bc1d 100644 --- a/desoslide.jquery.json +++ b/desoslide.jquery.json @@ -1,7 +1,7 @@ { "name": "desoslide", "title": "desoSlide", - "version": "2.0.1", + "version": "2.1.0", "description": "Take control of your slideshow with this powerful jQuery plugin", "keywords": [ "slider", diff --git a/dist/css/jquery.desoslide.css b/dist/css/jquery.desoslide.css index f0c25cc..6c4f9e7 100644 --- a/dist/css/jquery.desoslide.css +++ b/dist/css/jquery.desoslide.css @@ -1,5 +1,5 @@ /*! -* Version 2.0.1 +* Version 2.1.0 * jQuery: desoSlide plugin * Copyright - 2014 - https://github.com/sylouuu/desoslide * This source code is under the MIT License diff --git a/dist/css/jquery.desoslide.min.css b/dist/css/jquery.desoslide.min.css index a4875b5..403c27e 100644 --- a/dist/css/jquery.desoslide.min.css +++ b/dist/css/jquery.desoslide.min.css @@ -1,5 +1,5 @@ /*! -* Version 2.0.1 +* Version 2.1.0 * jQuery: desoSlide plugin * Copyright - 2014 - https://github.com/sylouuu/desoslide * This source code is under the MIT License diff --git a/dist/js/jquery.desoslide.js b/dist/js/jquery.desoslide.js index a7d7e7d..7e0ff4a 100644 --- a/dist/js/jquery.desoslide.js +++ b/dist/js/jquery.desoslide.js @@ -1,5 +1,5 @@ /*! -* Version 2.0.1 +* Version 2.1.0 * jQuery: desoSlide plugin * Copyright - 2014 - https://github.com/sylouuu/desoslide * This source code is under the MIT License diff --git a/dist/js/jquery.desoslide.min.js b/dist/js/jquery.desoslide.min.js index 3100587..3cd061b 100644 --- a/dist/js/jquery.desoslide.min.js +++ b/dist/js/jquery.desoslide.min.js @@ -1,7 +1,7 @@ /*! -* Version 2.0.1 +* Version 2.1.0 * jQuery: desoSlide plugin * Copyright - 2014 - https://github.com/sylouuu/desoslide * This source code is under the MIT License */ -!function(t,e,s,i){"use strict";function o(e,s){this.elem=e,this.options=t.extend(!0,{},n,s),this._defaults=n,this._name=r,this._namespace=r.toLowerCase(),this.props={thumbs:[],effect:{provider:null,name:null,list:{animate:{css:"animated",bounce:{"in":"bounceInLeft",out:"bounceOutRight"},fade:{"in":"fadeIn",out:"fadeOut"},flipX:{"in":"flipInX",out:"flipOutX"},flipY:{"in":"flipInY",out:"flipOutY"},fun:{"in":"rubberBand",out:"hinge"},light:{"in":"lightSpeedIn",out:"lightSpeedOut"},roll:{"in":"rollIn",out:"rollOut"},rotate:{"in":"rotateIn",out:"rotateOut"},rotateBig:{"in":"rotateInDownLeft",out:"rotateOutUpRight"},sideFade:{"in":"fadeInLeft",out:"fadeOutRight"},sideFadeBig:{"in":"fadeInLeftBig",out:"fadeOutRightBig"},slide:{"in":"slideInLeft",out:"slideOutRight"}},magic:{css:"magictime",foolish:{"in":"foolishIn",out:"foolishOut"},perspective:{"in":"perspectiveLeftRetourn",out:"perspectiveLeft"},puff:{"in":"puffIn",out:"puffOut"},swap:{"in":"swap",out:"magic"},swash:{"in":"swashIn",out:"swashOut"},tin:{"in":"tinLeftIn",out:"tinRightOut"},twister:{"in":"twisterInDown",out:"holeOut"}}}},img:{$elem:null,$overlay:null,to_show:this.options.first,timer:null},controls:{$wrapper:null},is_transition_supported:!1,plugin_status:null},this._init()}var r="desoSlide",n={thumbs:null,imageClass:"img-responsive",auto:{load:!0,start:!1},first:0,interval:3e3,effect:{provider:"animate",name:"fade"},overlay:"always",controls:{show:!0,keys:!1},events:{onThumbClick:null,onImageShow:null,onImageShown:null,onImageHide:null,onImageHidden:null,onImageClick:null,onPrev:null,onPause:null,onPlay:null,onNext:null,onError:null,onWarning:null,onSuccess:null}};o.prototype={_init:function(){var e=this;null===this.options.thumbs?this._errorHandler("error","The `thumbs` option doesn't exist."):0===t(this.options.thumbs).length&&this._errorHandler("error","The `thumbs` selector ("+t(this.options.thumbs).selector+") doesn't exist.");var s=["always","hover","none"];-1===s.indexOf(this.options.overlay)&&(this._errorHandler("error","Incorrect value for the `overlay` option. Default value is used."),this.options.overlay=this._defaults.overlay),t(this.options.thumbs).each(function(s,o){t(o).attr("href")!==i?t(o).find("img").length?(e.props.thumbs.push({src:t(o).attr("href"),alt:t(o).find("img").attr("alt")||null,caption_title:t(o).find("img").data(e._namespace+"-caption-title")||null,caption_link:t(o).find("img").data(e._namespace+"-caption-link")||null}),t(o).find("img").attr("alt")===i&&e._errorHandler("warning","The `alt` attribute is missing on the "+s+"-indexed thumb, it's mandatory on tags."),t(o).attr("data-"+e._namespace+"-index",s)):e._errorHandler("error","Your link on the "+s+"-indexed thumb must have an `` tag as a child."):e._errorHandler("error","The `href` attribute is missing on the "+s+"-indexed thumb, it's mandatory on `` tags.")}),this.options.first>=this.props.thumbs.length&&(this._errorHandler("error","The `first` option must be between 0 and "+(this.props.thumbs.length-1)+". Default value is used."),this.options.first=this._defaults.first,this.props.img.to_show=this._defaults.first),e.props.is_transition_supported=e._supportsTransitions(),e._preloading(),e._wrapper(),e.props.is_transition_supported===!0&&e.setEffect({provider:e.options.effect.provider,name:e.options.effect.name}),this.props.thumbs[this.props.img.to_show]!==i&&e._showImage(),e._events()},rebuild:function(){return this._init(),t(this.elem)},getThumbs:function(t){var e;return e=t!==i?this._isThumbExists(t)===!0?this.props.thumbs[t]:null:this.props.thumbs},setEffect:function(t){var e={provider:null,name:null};return t!==i&&null!==t.provider&&null!==t.name?this.props.effect.list.hasOwnProperty(t.provider)?"random"===t.name?(e.provider=t.provider,e.name=this._getRandomEffect(t.provider)):this.props.effect.list[t.provider].hasOwnProperty(t.name)?(e.provider=t.provider,e.name=t.name):(e.provider=this._defaults.effect.provider,e.name=this._defaults.effect.name,this._errorHandler("error","Incorrect value for the `effect.name` option. Default value is used.")):(e.provider=this._defaults.effect.provider,e.name=this._defaults.effect.name,this._errorHandler("error","Incorrect value for the `effect.provider` option. Default value is used.")):(e.provider=this._defaults.effect.provider,e.name=this._defaults.effect.name,this._errorHandler("error","Incorrect values for `effect.provider` and `effect.name` option. Default value is used.")),this.props.effect.provider=e.provider,this.props.effect.name=e.name,e},isPlaying:function(){return this.options.auto.start},pause:function(){return t(this.options.thumbs).length>1&&this.options.auto.start===!0&&this.props.img.timer&&(this.options.auto.start=!1,this._stopAnimation(),clearTimeout(this.props.img.timer),this.props.controls.$wrapper&&this.props.controls.$wrapper.find('a[href="#pause"]').hide().parent().find('a[href="#play"]').show(),this._triggerEvent("pause")),t(this.elem)},play:function(){return t(this.options.thumbs).length>1&&(this.options.auto.start===!1&&(this.options.auto.start=!0,this.goNext(!0),this.props.controls.$wrapper&&this.props.controls.$wrapper.find('a[href="#play"]').hide().parent().find('a[href="#pause"]').show()),this._triggerEvent("play")),t(this.elem)},goPrev:function(e){if(t(this.options.thumbs).length>1){var s=this;e||this.options.auto.start!==!0||this.pause(),this._hideOverlay(),this.props.img.to_show--,this.props.img.to_show<0&&(this.props.img.to_show=t(this.options.thumbs).length-1),this._hideImage(function(){s._showImage()}),this._triggerEvent("prev")}return t(this.elem)},goNext:function(e){if(t(this.options.thumbs).length>1){var s=this;e||this.options.auto.start!==!0||this.pause(),this._hideOverlay(),this.props.img.to_show++,this.props.img.to_show>=t(this.options.thumbs).length&&(this.props.img.to_show=0),this._hideImage(function(){s._showImage()}),this._triggerEvent("next")}return t(this.elem)},goTo:function(e){if(t(this.options.thumbs).length>1&&this._isThumbExists(e)===!0){var s=this;this.options.auto.start===!0&&this.pause(),e!==this.props.img.to_show&&(this._stopAnimation(),this._hideOverlay(),s.props.img.to_show=e,this._hideImage(function(){s._showImage()}))}return t(this.elem)},_supportsTransitions:function(){var t=s.body||s.documentElement,e=t.style,i="transition",o=["Moz","webkit","Webkit","Khtml","O","ms"],r=0;if("string"==typeof e[i])return!0;for(i=i.charAt(0).toUpperCase()+i.substr(1),r;r",{src:s.src,alt:s.alt}).hide().appendTo("body")})},_wrapper:function(){var e=t("").attr("alt",this._name).addClass(this.options.imageClass);t(this.elem).html(e).wrapInner(t("
",{"class":this._namespace+"-wrapper"})),this.props.img.$elem=t(this.elem).find("img:first")},_clearEffectClass:function(){var t,e,s=this;if(this.props.img.$elem.attr("class")!==i){var o=this.props.img.$elem.attr("class").split(/\s+/);for(t in s.props.effect.list)if(s.props.effect.list.hasOwnProperty(t))for(e in s.props.effect.list[t])s.props.effect.list[t].hasOwnProperty(e)&&(-1!==o.indexOf(s.props.effect.list[t][e])&&this.props.img.$elem.removeClass(s.props.effect.list[t][e]),s.props.effect.list[t][e].in&&-1!==o.indexOf(s.props.effect.list[t][e].in)&&this.props.img.$elem.removeClass(s.props.effect.list[t][e].in),s.props.effect.list[t][e].out&&-1!==o.indexOf(s.props.effect.list[t][e].out)&&this.props.img.$elem.removeClass(s.props.effect.list[t][e].out))}},_getRandomEffect:function(t){var e,s,i=0;for(s in this.props.effect.list[t])this.props.effect.list[t].hasOwnProperty(s)&&"css"!==s&&Math.random()<1/++i&&(e=s);return e},_showImage:function(){var e=this;null===this.props.plugin_status&&this._errorHandler(),this._triggerEvent("imageShow"),this.props.img.$elem.attr("src",this.props.thumbs[this.props.img.to_show].src).attr("alt",this.props.thumbs[this.props.img.to_show].alt).one("load",function(){e.props.is_transition_supported===!0?t(this).removeClass(e.props.effect.list[e.props.effect.provider].css+" "+e.props.effect.list[e.props.effect.provider][e.props.effect.name].out).addClass(e.props.effect.list[e.props.effect.provider].css+" "+e.props.effect.list[e.props.effect.provider][e.props.effect.name].in).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){e._overlay(),e._triggerEvent("imageShown")}):t(this).css("opacity",0).animate({opacity:1},1e3,function(){e._overlay(),e._triggerEvent("imageShown")}),e.options.auto.start===!0&&(e.props.img.timer=setTimeout(function(){e.goNext(!0)},e.options.interval<1500?1500:e.options.interval))})},_hideImage:function(t){var e=this;this._triggerEvent("imageHide"),e.props.is_transition_supported===!0?(this._clearEffectClass(),this.props.img.$elem.removeClass(this.props.effect.list[this.props.effect.provider].css+" "+this.props.effect.list[this.props.effect.provider][this.props.effect.name].in).addClass(this.props.effect.list[this.props.effect.provider].css+" "+this.props.effect.list[this.props.effect.provider][this.props.effect.name].out).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){e._triggerEvent("imageHidden"),t&&t()})):this.props.img.$elem.animate({opacity:0},1e3,function(){e._triggerEvent("imageHidden"),t&&t()})},_overlay:function(){if("none"!==this.options.overlay){var e=this.props.img.$elem.position(),s=parseInt(this.props.img.$elem.css("border-left-width"),10),i=this.props.img.$elem.width()+2*s,o=this.props.img.$elem.height();0===t(this.elem).find("."+this._namespace+"-overlay").length&&t("
",{"class":this._namespace+"-overlay"}).appendTo(t(this.elem).find("."+this._namespace+"-wrapper")),this.props.img.$overlay=t(this.elem).find("."+this._namespace+"-overlay");var r=parseInt(this.props.img.$overlay.css("padding-top"),10),n=parseInt(this.props.img.$overlay.css("padding-bottom"),10),a=parseInt(this.props.img.$overlay.css("padding-left"),10),p=parseInt(this.props.img.$overlay.css("padding-right"),10),h=parseInt(this.props.img.$overlay.css("height"),10)-(a+p);h=parseInt(o,10)-h-(r+n);var l=e.top+h+2*s,f=e.left;this.props.img.$overlay.css({left:f+"px",top:l+"px",width:i+"px","border-bottom-left-radius":this.props.img.$elem.css("border-radius"),"border-bottom-right-radius":this.props.img.$elem.css("border-radius")}),"always"===this.options.overlay&&this.props.img.$overlay.animate({opacity:.7},500),this._caption(),this.options.controls.show===!0&&this.props.thumbs.length>1&&this._controls()}},_hideOverlay:function(){null!==this.props.img.$overlay&&this.props.img.$overlay.animate({opacity:0})},_controls:function(){t(this.elem).find("."+this._namespace+"-controls-wrapper").remove();var e='',s='',i='',o='',r=t("
",{"class":this._namespace+"-controls-wrapper"}).append(e+s+i+o);r.appendTo(this.props.img.$overlay.find("a:first").length>0?this.props.img.$overlay.find("a:first"):this.props.img.$overlay),this.props.controls.$wrapper=t(this.elem).find("."+this._namespace+"-controls-wrapper"),this.props.controls.$wrapper.length&&(this.options.auto.start===!0?this.props.controls.$wrapper.find('a[href="#play"]').hide().parent().find('a[href="#pause"]').show():this.props.controls.$wrapper.find('a[href="#pause"]').hide().parent().find('a[href="#play"]').show())},_caption:function(){if(null!==this.props.thumbs[this.props.img.to_show].caption_title){this.props.img.$overlay.html(''+this.props.thumbs[this.props.img.to_show].caption_title+"");var e=this.props.img.$overlay.find("a:first").length>0?!0:!1,s=null!==this.props.thumbs[this.props.img.to_show].caption_link?!0:!1,i='';if(e===!0&&s===!0)this.props.img.$overlay.find("a:first").attr("href",this.props.thumbs[this.props.img.to_show].caption_link);else if(e===!0&&s===!1){var o=this.props.img.$overlay.find("a:first"),r=o.children().clone(),n=o.parent();o.remove(),r.appendTo(n),this.props.img.$overlay.find("span:first").empty()}else e===!1&&s===!0&&t(this.elem).find("."+this._namespace+"-overlay span:first").wrap(i)}},_stopAnimation:function(){t(this.elem).stop()},_triggerEvent:function(e){t(this.elem).triggerHandler(e+"."+this._namespace);var s=e.charAt(0).toUpperCase()+e.slice(1);this.options.events["on"+s]&&this.options.events["on"+s](this.props.img.$elem)},_events:function(){var i=this;t(this.options.thumbs).on("click",function(e){e.preventDefault(),i.goTo(t(this).data(i._namespace+"-index")),i._triggerEvent("thumbClick")}),this.props.img.$elem.on("click",function(t){t.preventDefault(),i._triggerEvent("imageClick")}),t(this.elem).on("click","."+this._namespace+"-controls-wrapper a",t(this.elem),function(e){switch(e.preventDefault(),t(this).attr("href")){case"#prev":i.goPrev();break;case"#pause":i.pause();break;case"#play":i.play();break;case"#next":i.goNext()}}),t(this.elem).find("."+this._namespace+"-wrapper").on({mouseover:function(){"hover"===i.options.overlay&&null!==i.props.img.$overlay&&i.props.img.$overlay.stop().animate({opacity:.7},400)},mouseleave:function(){"hover"===i.options.overlay&&null!==i.props.img.$overlay&&i.props.img.$overlay.stop().animate({opacity:0},400)}}),this.options.controls.keys===!0&&t(s).on("keydown",function(t){switch(t.which){case 37:i.goPrev();break;case 39:i.goNext();break;case 32:t.preventDefault(),i.options.auto.start===!0?i.pause():i.play()}});var o=function(){var t=0;return function(e,s){clearTimeout(t),t=setTimeout(e,s)}}();"none"!==this.options.overlay&&t(e).bind("resize",function(){o(function(){i._overlay()},100)})},_errorHandler:function(t,e){switch(t){case"error":console!==i&&console.error(this._name+": "+e+" Check out the documentation."),this._triggerEvent("error"),this.props.plugin_status=t;break;case"warning":console!==i&&console.warn(this._name+": "+e),this._triggerEvent("warning"),this.props.plugin_status=t;break;default:this._triggerEvent("success"),this.props.plugin_status=t}}},t.fn[r]=function(e){var s,n,a=arguments;return e===i||"object"==typeof e?n=this.each(function(){t.data(this,"plugin_"+r)||t.data(this,"plugin_"+r,new o(this,e))}):"string"==typeof e&&"_"!==e[0]?(s=t.data(this[0],"plugin_"+r),s[e]!==i&&(n=s[e].apply(s,Array.prototype.slice.call(a,1)))):n=this.each(function(){s=t.data(this,"plugin_"+r),s instanceof o&&"function"==typeof s[e]&&s[e].apply(s,Array.prototype.slice.call(a,1))}),n}}(jQuery,window,document); \ No newline at end of file +!function(t,e,s,i){"use strict";function o(e,s){this.elem=e,this.options=t.extend(!0,{},n,s),this._defaults=n,this._name=r,this._namespace=r.toLowerCase(),this.props={thumbs:[],effect:{provider:null,name:null,list:{animate:{css:"animated",bounce:{"in":"bounceInLeft",out:"bounceOutRight"},fade:{"in":"fadeIn",out:"fadeOut"},flipX:{"in":"flipInX",out:"flipOutX"},flipY:{"in":"flipInY",out:"flipOutY"},fun:{"in":"rubberBand",out:"hinge"},light:{"in":"lightSpeedIn",out:"lightSpeedOut"},roll:{"in":"rollIn",out:"rollOut"},rotate:{"in":"rotateIn",out:"rotateOut"},rotateBig:{"in":"rotateInDownLeft",out:"rotateOutUpRight"},sideFade:{"in":"fadeInLeft",out:"fadeOutRight"},sideFadeBig:{"in":"fadeInLeftBig",out:"fadeOutRightBig"},slide:{"in":"slideInLeft",out:"slideOutRight"}},magic:{css:"magictime",foolish:{"in":"foolishIn",out:"foolishOut"},perspective:{"in":"perspectiveLeftRetourn",out:"perspectiveLeft"},puff:{"in":"puffIn",out:"puffOut"},swap:{"in":"swap",out:"magic"},swash:{"in":"swashIn",out:"swashOut"},tin:{"in":"tinLeftIn",out:"tinRightOut"},twister:{"in":"twisterInDown",out:"holeOut"}}}},img:{$elem:null,$overlay:null,to_show:this.options.first,timer:null},controls:{$wrapper:null},is_transition_supported:!1,plugin_status:null},this._init()}var r="desoSlide",n={thumbs:null,imageClass:"img-responsive",auto:{load:!0,start:!1},first:0,interval:3e3,effect:{provider:"animate",name:"fade"},overlay:"always",controls:{show:!0,keys:!1},events:{onThumbClick:null,onImageShow:null,onImageShown:null,onImageHide:null,onImageHidden:null,onImageClick:null,onPrev:null,onPause:null,onPlay:null,onNext:null,onError:null,onWarning:null,onSuccess:null}};o.prototype={_init:function(){var e=this;null===this.options.thumbs?this._errorHandler("error","The `thumbs` option doesn't exist."):0===t(this.options.thumbs).length&&this._errorHandler("error","The `thumbs` selector ("+t(this.options.thumbs).selector+") doesn't exist.");var s=["always","hover","none"];-1===s.indexOf(this.options.overlay)&&(this._errorHandler("error","Incorrect value for the `overlay` option. Default value is used."),this.options.overlay=this._defaults.overlay),t(this.options.thumbs).each(function(s,o){t(o).attr("href")!==i?t(o).find("img").length?(e.props.thumbs.push({src:t(o).attr("href"),alt:t(o).find("img").attr("alt")||null,caption_title:t(o).find("img").data(e._namespace+"-caption-title")||null,caption_link:t(o).find("img").data(e._namespace+"-caption-link")||null}),t(o).find("img").attr("alt")===i&&e._errorHandler("warning","The `alt` attribute is missing on the "+s+"-indexed thumb, it's mandatory on tags."),t(o).attr("data-"+e._namespace+"-index",s)):e._errorHandler("error","Your link on the "+s+"-indexed thumb must have an `` tag as a child."):e._errorHandler("error","The `href` attribute is missing on the "+s+"-indexed thumb, it's mandatory on `` tags.")}),this.options.first>=this.props.thumbs.length&&(this._errorHandler("error","The `first` option must be between 0 and "+(this.props.thumbs.length-1)+". Default value is used."),this.options.first=this._defaults.first,this.props.img.to_show=this._defaults.first),e.props.is_transition_supported=e._supportsTransitions(),e._preloading(),e._wrapper(),e.props.is_transition_supported===!0&&e.setEffect(e.options.effect),this.props.thumbs[this.props.img.to_show]!==i&&e._showImage(),e._events()},rebuild:function(){return this._init(),t(this.elem)},getThumbs:function(t){var e;return e=t!==i?this._isThumbExists(t)===!0?this.props.thumbs[t]:null:this.props.thumbs},setEffect:function(t){var e={provider:null,name:null};return t!==i&&null!==t.provider&&null!==t.name?this.props.effect.list.hasOwnProperty(t.provider)?"random"===t.name?(e.provider=t.provider,e.name=this._getRandomEffect(t.provider)):this.props.effect.list[t.provider].hasOwnProperty(t.name)?(e.provider=t.provider,e.name=t.name):(e.provider=this._defaults.effect.provider,e.name=this._defaults.effect.name,this._errorHandler("error","Incorrect value for the `effect.name` option. Default value is used.")):"none"===t?e.name="none":(e.provider=this._defaults.effect.provider,e.name=this._defaults.effect.name,this._errorHandler("error","Incorrect value for the `effect.provider` option. Default value is used.")):(e.provider=this._defaults.effect.provider,e.name=this._defaults.effect.name,this._errorHandler("error","Incorrect values for `effect.provider` and `effect.name` option. Default value is used.")),this.props.effect.provider=e.provider,this.props.effect.name=e.name,e},isPlaying:function(){return this.options.auto.start},pause:function(){return t(this.options.thumbs).length>1&&this.options.auto.start===!0&&this.props.img.timer&&(this.options.auto.start=!1,this._stopAnimation(),clearTimeout(this.props.img.timer),this.props.controls.$wrapper&&this.props.controls.$wrapper.find('a[href="#pause"]').hide().parent().find('a[href="#play"]').show(),this._triggerEvent("pause")),t(this.elem)},play:function(){return t(this.options.thumbs).length>1&&(this.options.auto.start===!1&&(this.options.auto.start=!0,this.goNext(!0),this.props.controls.$wrapper&&this.props.controls.$wrapper.find('a[href="#play"]').hide().parent().find('a[href="#pause"]').show()),this._triggerEvent("play")),t(this.elem)},goPrev:function(e){if(t(this.options.thumbs).length>1){var s=this;e||this.options.auto.start!==!0||this.pause(),this._hideOverlay(),this.props.img.to_show--,this.props.img.to_show<0&&(this.props.img.to_show=t(this.options.thumbs).length-1),this._hideImage(function(){s._showImage()}),this._triggerEvent("prev")}return t(this.elem)},goNext:function(e){if(t(this.options.thumbs).length>1){var s=this;e||this.options.auto.start!==!0||this.pause(),this._hideOverlay(),this.props.img.to_show++,this.props.img.to_show>=t(this.options.thumbs).length&&(this.props.img.to_show=0),this._hideImage(function(){s._showImage()}),this._triggerEvent("next")}return t(this.elem)},goTo:function(e){if(t(this.options.thumbs).length>1&&this._isThumbExists(e)===!0){var s=this;this.options.auto.start===!0&&this.pause(),e!==this.props.img.to_show&&(this._stopAnimation(),this._hideOverlay(),s.props.img.to_show=e,this._hideImage(function(){s._showImage()}))}return t(this.elem)},_supportsTransitions:function(){var t=s.body||s.documentElement,e=t.style,i="transition",o=["Moz","webkit","Webkit","Khtml","O","ms"],r=0;if("string"==typeof e[i])return!0;for(i=i.charAt(0).toUpperCase()+i.substr(1),r;r",{src:s.src,alt:s.alt}).hide().appendTo("body")})},_wrapper:function(){var e=t("").attr("alt",this._name).addClass(this.options.imageClass);t(this.elem).html(e).wrapInner(t("
",{"class":this._namespace+"-wrapper"})),this.props.img.$elem=t(this.elem).find("img:first")},_clearEffectClass:function(){var t,e,s=this;if(this.props.img.$elem.attr("class")!==i){var o=this.props.img.$elem.attr("class").split(/\s+/);for(t in s.props.effect.list)if(s.props.effect.list.hasOwnProperty(t))for(e in s.props.effect.list[t])s.props.effect.list[t].hasOwnProperty(e)&&(-1!==o.indexOf(s.props.effect.list[t][e])&&this.props.img.$elem.removeClass(s.props.effect.list[t][e]),s.props.effect.list[t][e].in&&-1!==o.indexOf(s.props.effect.list[t][e].in)&&this.props.img.$elem.removeClass(s.props.effect.list[t][e].in),s.props.effect.list[t][e].out&&-1!==o.indexOf(s.props.effect.list[t][e].out)&&this.props.img.$elem.removeClass(s.props.effect.list[t][e].out))}},_getRandomEffect:function(t){var e,s,i=0;for(s in this.props.effect.list[t])this.props.effect.list[t].hasOwnProperty(s)&&"css"!==s&&Math.random()<1/++i&&(e=s);return e},_hasEffect:function(){return null===this.props.effect.provider&&"none"===this.props.effect.name?!1:!0},_showImage:function(){var e=this;null===this.props.plugin_status&&this._errorHandler(),this._triggerEvent("imageShow"),this.props.img.$elem.attr("src",this.props.thumbs[this.props.img.to_show].src).attr("alt",this.props.thumbs[this.props.img.to_show].alt).one("load",function(){e._hasEffect()===!1?(t(this).css("opacity",1),e._overlay(),e._triggerEvent("imageShown")):e.props.is_transition_supported===!0?t(this).removeClass(e.props.effect.list[e.props.effect.provider].css+" "+e.props.effect.list[e.props.effect.provider][e.props.effect.name].out).addClass(e.props.effect.list[e.props.effect.provider].css+" "+e.props.effect.list[e.props.effect.provider][e.props.effect.name].in).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){e._overlay(),e._triggerEvent("imageShown")}):t(this).css("opacity",0).animate({opacity:1},1e3,function(){e._overlay(),e._triggerEvent("imageShown")}),e.options.auto.start===!0&&(e.props.img.timer=setTimeout(function(){e.goNext(!0)},e.options.interval<1500?1500:e.options.interval))})},_hideImage:function(t){var e=this;this._triggerEvent("imageHide"),this._hasEffect()===!1?(this.props.img.$elem.css("opacity",0),e._triggerEvent("imageHidden"),t&&t()):e.props.is_transition_supported===!0?(this._clearEffectClass(),this.props.img.$elem.removeClass(this.props.effect.list[this.props.effect.provider].css+" "+this.props.effect.list[this.props.effect.provider][this.props.effect.name].in).addClass(this.props.effect.list[this.props.effect.provider].css+" "+this.props.effect.list[this.props.effect.provider][this.props.effect.name].out).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){e._triggerEvent("imageHidden"),t&&t()})):this.props.img.$elem.animate({opacity:0},1e3,function(){e._triggerEvent("imageHidden"),t&&t()})},_overlay:function(){if("none"!==this.options.overlay){var e=this.props.img.$elem.position(),s=parseInt(this.props.img.$elem.css("border-left-width"),10),i=this.props.img.$elem.width()+2*s,o=this.props.img.$elem.height();0===t(this.elem).find("."+this._namespace+"-overlay").length&&t("
",{"class":this._namespace+"-overlay"}).appendTo(t(this.elem).find("."+this._namespace+"-wrapper")),this.props.img.$overlay=t(this.elem).find("."+this._namespace+"-overlay");var r=parseInt(this.props.img.$overlay.css("padding-top"),10),n=parseInt(this.props.img.$overlay.css("padding-bottom"),10),a=parseInt(this.props.img.$overlay.css("padding-left"),10),p=parseInt(this.props.img.$overlay.css("padding-right"),10),h=parseInt(this.props.img.$overlay.css("height"),10)-(a+p);h=parseInt(o,10)-h-(r+n);var l=e.top+h+2*s,f=e.left;this.props.img.$overlay.css({left:f+"px",top:l+"px",width:i+"px","border-bottom-left-radius":this.props.img.$elem.css("border-radius"),"border-bottom-right-radius":this.props.img.$elem.css("border-radius")}),"always"===this.options.overlay&&this.props.img.$overlay.animate({opacity:.7},this._hasEffect()===!0?500:0),this._caption(),this.options.controls.show===!0&&this.props.thumbs.length>1&&this._controls()}},_hideOverlay:function(){null!==this.props.img.$overlay&&this.props.img.$overlay.animate({opacity:0},this._hasEffect()===!0?500:0)},_controls:function(){t(this.elem).find("."+this._namespace+"-controls-wrapper").remove();var e='',s='',i='',o='',r=t("
",{"class":this._namespace+"-controls-wrapper"}).append(e+s+i+o);r.appendTo(this.props.img.$overlay.find("a:first").length>0?this.props.img.$overlay.find("a:first"):this.props.img.$overlay),this.props.controls.$wrapper=t(this.elem).find("."+this._namespace+"-controls-wrapper"),this.props.controls.$wrapper.length&&(this.options.auto.start===!0?this.props.controls.$wrapper.find('a[href="#play"]').hide().parent().find('a[href="#pause"]').show():this.props.controls.$wrapper.find('a[href="#pause"]').hide().parent().find('a[href="#play"]').show())},_caption:function(){if(null!==this.props.thumbs[this.props.img.to_show].caption_title){this.props.img.$overlay.html(''+this.props.thumbs[this.props.img.to_show].caption_title+"");var e=this.props.img.$overlay.find("a:first").length>0?!0:!1,s=null!==this.props.thumbs[this.props.img.to_show].caption_link?!0:!1,i='';if(e===!0&&s===!0)this.props.img.$overlay.find("a:first").attr("href",this.props.thumbs[this.props.img.to_show].caption_link);else if(e===!0&&s===!1){var o=this.props.img.$overlay.find("a:first"),r=o.children().clone(),n=o.parent();o.remove(),r.appendTo(n),this.props.img.$overlay.find("span:first").empty()}else e===!1&&s===!0&&t(this.elem).find("."+this._namespace+"-overlay span:first").wrap(i)}},_stopAnimation:function(){t(this.elem).stop()},_triggerEvent:function(e){t(this.elem).triggerHandler(e+"."+this._namespace);var s=e.charAt(0).toUpperCase()+e.slice(1);this.options.events["on"+s]&&this.options.events["on"+s](this.props.img.$elem)},_events:function(){var i=this;t(this.options.thumbs).on("click",function(e){e.preventDefault(),i.goTo(t(this).data(i._namespace+"-index")),i._triggerEvent("thumbClick")}),this.props.img.$elem.on("click",function(t){t.preventDefault(),i._triggerEvent("imageClick")}),t(this.elem).on("click","."+this._namespace+"-controls-wrapper a",t(this.elem),function(e){switch(e.preventDefault(),t(this).attr("href")){case"#prev":i.goPrev();break;case"#pause":i.pause();break;case"#play":i.play();break;case"#next":i.goNext()}}),t(this.elem).find("."+this._namespace+"-wrapper").on({mouseover:function(){"hover"===i.options.overlay&&null!==i.props.img.$overlay&&i.props.img.$overlay.stop().animate({opacity:.7},400)},mouseleave:function(){"hover"===i.options.overlay&&null!==i.props.img.$overlay&&i.props.img.$overlay.stop().animate({opacity:0},400)}}),this.options.controls.keys===!0&&t(s).on("keydown",function(t){switch(t.which){case 37:i.goPrev();break;case 39:i.goNext();break;case 32:t.preventDefault(),i.options.auto.start===!0?i.pause():i.play()}});var o=function(){var t=0;return function(e,s){clearTimeout(t),t=setTimeout(e,s)}}();"none"!==this.options.overlay&&t(e).bind("resize",function(){o(function(){i._overlay()},100)})},_errorHandler:function(t,e){switch(t){case"error":console!==i&&console.error(this._name+": "+e+" Check out the documentation."),this._triggerEvent("error"),this.props.plugin_status=t;break;case"warning":console!==i&&console.warn(this._name+": "+e),this._triggerEvent("warning"),this.props.plugin_status=t;break;default:this._triggerEvent("success"),this.props.plugin_status=t}}},t.fn[r]=function(e){var s,n,a=arguments;return e===i||"object"==typeof e?n=this.each(function(){t.data(this,"plugin_"+r)||t.data(this,"plugin_"+r,new o(this,e))}):"string"==typeof e&&"_"!==e[0]?(s=t.data(this[0],"plugin_"+r),s[e]!==i&&(n=s[e].apply(s,Array.prototype.slice.call(a,1)))):n=this.each(function(){s=t.data(this,"plugin_"+r),s instanceof o&&"function"==typeof s[e]&&s[e].apply(s,Array.prototype.slice.call(a,1))}),n}}(jQuery,window,document); \ No newline at end of file diff --git a/dist/less/jquery.desoslide.less b/dist/less/jquery.desoslide.less index 9069150..ea43d0b 100644 --- a/dist/less/jquery.desoslide.less +++ b/dist/less/jquery.desoslide.less @@ -1,5 +1,5 @@ /*! -* Version 2.0.1 +* Version 2.1.0 * jQuery: desoSlide plugin * Copyright - 2014 - https://github.com/sylouuu/desoslide * This source code is under the MIT License diff --git a/doc/index.html b/doc/index.html index 66ee3a4..696a595 100644 --- a/doc/index.html +++ b/doc/index.html @@ -97,7 +97,7 @@

Documentation

- Documentation covers: 2.0.1 + Documentation covers: 2.1.0

diff --git a/doc/release-notes.html b/doc/release-notes.html index 1b9692e..783a737 100644 --- a/doc/release-notes.html +++ b/doc/release-notes.html @@ -97,7 +97,7 @@

Release Notes

- Current stable release: 2.0.1 + Current stable release: 2.1.0

@@ -107,6 +107,30 @@

Release Notes

+ +
+ +

+ 2014-06-30 +
+ 2.1.0 +

+
+ + +
+
+
+
    +
  • + New + Allowed instant transition with effect: 'none'. +
  • +
+
+
+
+
@@ -130,6 +154,7 @@

+
diff --git a/index.html b/index.html index d829232..46007e1 100644 --- a/index.html +++ b/index.html @@ -101,7 +101,7 @@

Your browser is too old!

- Current stable release: 2.0.1 + Current stable release: 2.1.0
diff --git a/tests/index.html b/tests/index.html index 2411d20..f9233f7 100644 --- a/tests/index.html +++ b/tests/index.html @@ -98,7 +98,7 @@

Tests

- Tests cover: 2.0.1 + Tests cover: 2.1.0