-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpure-js-slideshow.min.js
1 lines (1 loc) · 22.3 KB
/
pure-js-slideshow.min.js
1
function pure_js_slideshow(t){var e=this;this.inited=!1,this.animating=!1,this.animate_timeout_handler=0,this.paused=!1,this.inited_callback=t.inited?t.inited:function(){},this.animated_callback=t.animated?t.animated:function(){},this.thumb_callback=t.thumbSelected?t.thumbSelected:function(){},this.page_callback=t.pageSelected?t.pageSelected:function(){},this.navigation_callback=t.navigationSelected?t.navigationSelected:function(){},this.autoplay=void 0===t.autoplay||t.autoplay,this.mobile=!(!t.mobile||void 0===t.mobile.enabled)&&t.mobile.enabled,this.ghost=document.getElementById("pure-js-slideshow-ghost"),null==this.ghost&&(this.ghost=document.createElement("div"),this.ghost.setAttribute("id","pure-js-slideshow-ghost"),this.ghost.style.cssText="margin:0;padding:0;position:fixed;top:0px;left:0px;right:0px;bottom:0px;opacity:0;z-index:-1;-moz-opacity:0;-webkit-opacity:0;",document.body.appendChild(this.ghost)),this.drag_ghost=document.createElement("div"),this.drag_ghost.style.cssText="position:absolute;top:0px;left:0px;right:0px;bottom:0px;",this.drag_ghost.setAttribute("class","pure-js-slideshow-drag"),this.dragging=!1,this.drag_callback=t.dragCallback?t.dragCallback:function(){},this.dragStartX=0,this.dragDiff=0,this.drag_autoplay=!1,this.ondragstart=function(t){if(e.animating)t.preventDefault();else if(clearTimeout(e.animate_timeout_handler),e.drag_autoplay=e.autoplay,e.autoplay=!1,e.dragging=!0,e.dragStartX=t.touches&&t.touches.length>0?t.touches[0].pageX:t.pageX,document.addEventListener("mouseup",e.ondragend),document.addEventListener("mousemove",e.ondragging),document.addEventListener("touchend",e.ondragend),document.addEventListener("touchmove",e.ondragging),"fade"==e.animation)for(var i in e.children)e.children[i].style.opacity=1,i!=e.currentIndex&&(e.children[i].style.left=e.width+"px")},this.ondragend=function(){function t(){if(e.dragDiff=0,e.autoplay=e.drag_autoplay,"fade"==e.animation)for(var t in e.children)e.children[t].style.left="0px",t!=e.currentIndex&&(e.children[t].style.opacity=0);e.autoplay&&(e.animate_timeout_handler=setTimeout(function(){e.animate(e.currentIndex)},e.timeout))}e.dragging=!1;var i=e.dragDiff,n=!1;if(e.width/4<Math.abs(i))if(i<0){var a=e.children[e.currentIndex],r=e.currentIndex+1>=e.children_size?0:e.currentIndex+1;if(r>0){var s=e.children[r],o=e.width+i;s.style.left=o+"px";var l=0,h=function(){l++,2==l&&(e.currentIndex=r,e.selectPage(r),e.selectThumb(r),t())};e.slideleft(a,e.transition,e.width,-1*e.width,h),e.slideleft(s,e.transition,e.width,0,h)}else a.style.left="0px",n=!0}else{a=e.children[e.currentIndex];var d=e.currentIndex-1<0?-1:e.currentIndex-1;if(d>=0){var u=e.children[d];u.style.left=-1*e.width+i+"px";l=0,h=function(){l++,2==l&&(e.currentIndex=d,e.selectPage(d),e.selectThumb(d),t())};e.slideright(a,e.transition,e.width,e.width,h),e.slideright(u,e.transition,e.width,0,h)}else a.style.left="0px",n=!0}else{a=e.children[e.currentIndex];if(i<0){r=e.currentIndex+1>=e.children_size?0:e.currentIndex+1;if(r>0){s=e.children[r];s.style.left=e.width+"px"}}else{d=e.currentIndex-1<0?-1:e.currentIndex-1;if(d>=0){u=e.children[d];u.style.left=-1*e.width+"px"}}a.style.left="0px",n=!0}n&&t(),document.removeEventListener("mouseup",e.ondragend),document.removeEventListener("mousemove",e.ondragging),document.removeEventListener("touchend",e.ondragend),document.removeEventListener("touchmove",e.ondragging)},this.ondragging=function(t){if(e.dragging){var i=t.touches&&t.touches.length>0?t.touches[0].pageX:t.pageX,n=i-e.dragStartX;if(e.dragDiff=n,n<0){var a=e.children[e.currentIndex];a.style.left=n+"px";var r=e.currentIndex+1>=e.children_size?0:e.currentIndex+1;if(r>0){var s=e.children[r],o=e.width+n;s.style.left=o+"px",e.drag_callback(e,e.currentIndex,r)}else e.drag_callback(e,e.currentIndex)}else{a=e.children[e.currentIndex];a.style.left=n+"px";var l=e.currentIndex-1<0?-1:e.currentIndex-1;if(l>=0){var h=e.children[l],d=-1*e.width+n;h.style.left=d+"px",e.drag_callback(e,e.currentIndex,l)}else e.drag_callback(e,e.currentIndex)}}},this.dragContent=void 0===t.dragContent||t.dragContent,this.dragContent&&(this.drag_ghost.addEventListener("mousedown",this.ondragstart),this.drag_ghost.addEventListener("touchstart",this.ondragstart),this.drag_ghost.addEventListener("click",function(){e.slide_clicked(e,e.currentIndex,e.children[e.currentIndex])})),this.prnt="string"==typeof t.el?document.querySelector(t.el):t.el,this.prnt.style.position="relative",this.backgroundColor=t.backgroundColor?t.backgroundColor:"#fff",this.prnt.style.backgroundColor=this.backgroundColor,void 0!==t.keyboard&&t.keyboard&&(this.prnt.setAttribute("tabindex",-1),this.prnt.addEventListener("focus",function(){e.prnt.style.border="none!important;",e.prnt.style.boxShadow="0",e.prnt.style.outlineColor="transparent"}),this.prnt.addEventListener("keyup",function(){37==event.keyCode?e.previousContent():39==event.keyCode&&e.nextContent()})),this.elem=this.prnt.querySelector(".pure-js-slideshow-container"),this.elem.style.position="relative",this.elem.style.overflowX="hidden",this.elem.style.overflowY="hidden",this.children_list=this.elem.querySelectorAll(".pure-js-slideshow-content"),this.children=[],this.images=[],this.image_thumbs=[],[].forEach.call(this.children_list,function(t){e.children.push(t)}),this.children_size=this.children.length,this.full_screen_elem=document.createElement("a"),this.full_screen_elem.innerHTML="↗",this.full_screen_elem.style.cssText="cursor:pointer;position:absolute;top:20px;right:20px;color:#fff;z-index:"+(e.children_size+1)+";font-size:20px;";var i=document.createElement("span");i.innerHTML="↙",i.style.cssText="position:absolute;top:0px;left:0px;color:#fff;";var n=document.createElement("span");n.innerHTML="↗",n.style.cssText="position:absolute;top:1px;left:-1px;color:#fff;transform:rotate(-90deg)";var a=document.createElement("span");a.innerHTML="↙",a.style.cssText="position:absolute;top:1px;left:-1px;color:#fff;transform:rotate(-90deg)",this.full_screen_elem.appendChild(i),this.full_screen_elem.appendChild(n),this.full_screen_elem.appendChild(a),this.full_screen=!1,document.addEventListener("fullscreenchange",function(t){document.fullscreenElement==e.prnt?e.full_screen=!0:e.full_screen=!1}),void 0!==t.fullscreen&&t.fullscreen&&(this.elem.appendChild(this.full_screen_elem),this.full_screen_elem.onclick=function(){e.full_screen?document.exitFullscreen():e.fullScreen()}),this.previousContent=function(){if(e.inited&&!e.animating){clearTimeout(e.animate_timeout_handler);var t=e.currentIndex;t-1<0?t=e.children_size-1:t--,e.animate(e.currentIndex,t)}},this.nextContent=function(){if(e.inited&&!e.animating){clearTimeout(e.animate_timeout_handler);var t=e.currentIndex;t+1>=e.children_size?t=0:t++,e.animate(e.currentIndex)}},this.moveTo=function(t){if(e.inited&&!e.animating){clearTimeout(e.animate_timeout_handler);var i=t;e.animate(e.currentIndex,i)}},this.navigation=!(!t.navigation||!t.navigation.visible)&&t.navigation.visible,this.mobile&&t.navigation&&t.navigation.mobile&&void 0!==t.navigation.mobile.visible&&(this.navigation=t.navigation.mobile.visible),this.navRadius=t.navigation&&t.navigation.radius?t.navigation.radius:"0px",this.navBorderColor=t.navigation&&t.navigation.borderColor?t.navigation.borderColor:"#fff",this.navBackgroundColor=t.navigation&&t.navigation.backgroundColor?t.navigation.backgroundColor:"#fff",this.navArrowColor=t.navigation&&t.navigation.arrowColor?t.navigation.arrowColor:"#fff",this.previous=null,this.next=null,this.renderNavigation=function(){e.previous=document.createElement("a"),e.previous.onclick=function(){e.previousContent()},e.previous.style.cssText="position:absolute;top:45%;left:10px;z-index:"+(e.children_size+1)+";border:solid 1px "+e.navBorderColor+";padding:7px 14px;cursor:pointer;display:inline-block;background-color:"+e.navBackgroundColor+";border-radius:"+this.navRadius+";";var t=document.createElement("span");t.style.cssText="margin:0;padding:0;width:0px;height:0px;display:inline-block;border-top:7px solid transparent;border-bottom:7px solid transparent;border-right:9px solid "+e.navArrowColor+";margin-top:3px;",e.previous.appendChild(t),e.elem.appendChild(e.previous),e.next=document.createElement("a"),e.next.onclick=function(){e.nextContent()},e.next.style.cssText="position:absolute;top:45%;right:10px;z-index:"+(e.children_size+1)+";border:solid 1px "+e.navBorderColor+";padding:7px 14px;cursor:pointer;display:inline-block;background-color:"+e.navBackgroundColor+";border-radius:"+this.navRadius+";";var i=document.createElement("span");i.style.cssText="margin:0;padding:0;width:0px;height:0px;display:inline-block;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:9px solid "+e.navArrowColor+";margin-top:3px;",e.next.appendChild(i),e.elem.appendChild(e.next)},this.navigation&&this.renderNavigation(),this.pagination=!(!t.pagination||!t.pagination.visible)&&t.pagination.visible,this.mobile&&t.pagination&&t.pagination.mobile&&void 0!==t.pagination.mobile.visible&&(this.pagination=t.pagination.mobile.visible),this.pageSize=t.pagination&&t.pagination.size?t.pagination.size:10,this.page_clicked=function(t){var i=t.currentTarget,n=i.getAttribute("data-index");e.moveTo(n)},this.renderPage=function(t){var i=document.createElement("span");return i.style.cssText="border-radius:"+e.pageSize+"px;border:solid 1px #fff;width:"+e.pageSize+"px;height:"+e.pageSize+"px;display:inline-block;cursor:pointer;margin-left:2px;margin-right:2px;",i.setAttribute("data-index",t),i.onclick=function(){var t=parseInt(this.getAttribute("data-index"));e.moveTo(t),e.page_callback(e,t,e.images[t])},i},this.selectPage=function(t){null!=e.paginationElem&&([].forEach.call(e.paginationElem.querySelectorAll("span"),function(t){t.style.backgroundColor="transparent"}),e.paginationElem.querySelector("span:nth-child("+(t+1)+")").style.backgroundColor="#fff")},this.paginationElem=null,this.renderPagination=function(){e.children_size;e.paginationElem=document.createElement("div"),e.paginationElem.style.cssText="position:absolute;left:0px;bottom:10px;width:100%;text-align:center;z-index:"+(e.children_size+1)+";";for(var t=0;t<e.children_size;t++){var i=e.renderPage(t);e.paginationElem.appendChild(i)}e.elem.appendChild(e.paginationElem)},this.pagination&&(this.renderPagination(),this.selectPage(0)),this.getWidth=function(){return parseFloat(getComputedStyle(e.ghost,null).width.replace("px",""))},this.getHeight=function(){return parseFloat(getComputedStyle(this.ghost,null).height.replace("px",""))},this.width=this.getWidth(),this.currentIndex=0,this.animation=t.animation||"fade",this.thumbnails=!(!t.thumbnails||!t.thumbnails.visible)&&t.thumbnails.visible,this.mobile&&t.thumbnails&&t.thumbnails.mobile&&void 0!==t.thumbnails.mobile.visible&&(this.thumbnails=t.thumbnails.mobile.visible),this.thumbsBorderColor=t.thumbnails&&t.thumbnails.borderColor?t.thumbnails.borderColor:"#fff",this.thumbsSelBorderColor=t.thumbnails&&t.thumbnails.selectedBorderColor?t.thumbnails.selectedBorderColor:"#000",this.thumbWidth=t.thumbnails&&t.thumbnails.width?parseInt(t.thumbnails.width):80,this.thumbHeight=t.thumbnails&&t.thumbnails.height?parseInt(t.thumbnails.height):70,this.thumbElem=null,this.thumbTbl=null,this.maxheight=t.maxheight?t.maxheight:0,this.mobile&&t.mobile&&t.mobile.maxheight&&(this.maxheight=t.mobile.maxheight),this.user_dynamicheight=t.dynamicHeightResizer?t.dynamicHeightResizer:null,this.user_maxheight=t.maxheightResizer?t.maxheightResizer:null,this.minheight=t.minheight?t.minheight:0,this.mobile&&t.mobile&&t.mobile.minheight&&(this.minheight=t.mobile.minheight),this.height=this.getHeight(),this.elem.style.width=this.width+"px";var r=this.height;if(this.maxheight>0&&this.maxheight<r&&(r=this.maxheight),null!=this.user_dynamicheight){var s=this.user_dynamicheight(this,this.height);r=s}if(null!=this.user_maxheight){var o=this.user_maxheight(this,this.height);o<r&&(r=o)}if(this.minheight>0&&this.minheight>r&&(r=this.minheight),this.elem.style.height=r+"px",this.slide_callback=t.slideClicked?t.slideClicked:function(){},this.slide_clicked=function(){e.slide_callback(e,e.currentIndex,e.images[e.currentIndex])},this.setupBackground=function(t,i,n){t.style.backgroundImage="url("+i+")",t.style.backgroundPosition="center",t.style.backgroundSize="cover",t.style.backgroundRepeat="no-repeat",t.onclick=e.slide_clicked,e.images.push(i),e.image_thumbs.push(n)},this.setupText=function(t,i){var n=i.getAttribute("data-pos-v")||"middle",a=i.getAttribute("data-pos-h")||"center",r=document.createElement("div");r.style.cssText="display:table;height:100%;width:100%;",r.style.textAlign=a;var s=document.createElement("div");s.style.cssText="display:table-cell;",s.style.verticalAlign=n;var o=document.createElement("div");o.style.cssText="position:relative;display:inline-block;z-index:"+e.children_size+1,o.innerHTML=i.innerHTML,s.appendChild(o),r.appendChild(s),t.removeChild(i),t.appendChild(r)},this.setupBackgrounds=function(){for(var t in e.children){var i=e.children[t];i.setAttribute("data-index",t);var n=i.querySelector("img:first-child");i.removeChild(n);var a=n.getAttribute("data-thumb");null==a&&(a=i.getAttribute("data-thumb"),null==a&&(a=n.src));var r=i.querySelector("div:first-child");null!=r&&e.setupText(i,r),e.setupBackground(i,n.src,a)}},this.setupBackgrounds(),this.renderBackgrounds=function(){for(var t in e.children){var i=e.children[t],n=e.height;if(e.maxheight>0&&e.maxheight<n&&(n=e.maxheight),null!=e.user_dynamicheight){var a=e.user_dynamicheight(e,e.height);n=a}if(null!=e.user_maxheight){console.log("user maxheight");var r=e.user_maxheight(e,e.height);console.log(r,e.height),r<n&&(n=r)}e.minheight>0&&e.minheight>n&&(n=e.minheight),i.style.height=n+"px",i.style.width=e.width+"px",i.style.position="absolute",i.style.top="0px","slide"==e.animation?t==e.currentIndex?i.style.left="0px":i.style.left=e.width+"px":"fade"==e.animation&&(i.style.left="0px")}},this.renderBackgrounds(),this.resizeBackgrounds=function(){for(var t in e.children){var i=e.children[t],n=e.height;if(e.maxheight>0&&e.maxheight<n&&(n=e.maxheight),null!=e.user_dynamicheight){var a=e.user_dynamicheight(e,e.height);n=a}if(e.minheight>0&&e.minheight>n&&(n=e.minheight),null!=e.user_maxheight){var r=e.user_maxheight(e,e.height);r<n&&(n=r)}i.style.height=n+"px",i.style.width=e.width+"px","slide"==e.animation?t==e.currentIndex?i.style.left="0px":i.style.left=e.width+"px":"fade"==e.animation&&(i.style.left="0px")}},this.moveThumbs=function(t,i,n){if(!e.animating)if("left"==t&&i!=n){e.width;var a=parseInt(this.thumbTbl.style.left),r=(n-i)*e.thumbWidth,s=-1*(Math.abs(a)+r),o=e.thumbTbl.offsetWidth-e.width;o>0&&Math.abs(s)>o&&(s=-1*o),e.slideleft(e.thumbTbl,e.transition,r,s,function(){})}else if("right"==t&&i!=n){e.width,a=parseInt(this.thumbTbl.style.left),r=(i-n)*e.thumbWidth,s=a+r;s>0&&(s=0),e.slideright(e.thumbTbl,e.transition,r,s,function(){})}},this.slideleft=function(t,e,i,n,a){function r(){var e=parseFloat(t.style.left.replace("px",""));t.style.left=e-s+"px",+new Date,parseFloat(t.style.left.replace("px",""))>n?setTimeout(r,20):(t.style.left=n+"px",a())}new Date;var s=parseFloat(i/parseFloat(e/20));r()},this.slideright=function(t,e,i,n,a){function r(){var e=parseFloat(t.style.left.replace("px",""));t.style.left=e+s+"px",+new Date,parseFloat(t.style.left.replace("px",""))<n?setTimeout(r,20):(t.style.left=n+"px",a())}new Date;var s=parseFloat(i/parseFloat(e/20));r()},this.selectThumb=function(t,i){if(null!=e.thumbElem){[].forEach.call(e.thumbElem.querySelectorAll("div"),function(t){t.style.border="solid 1px "+e.thumbsBorderColor});var n=e.thumbElem.querySelector("div[data-index='"+t+"']"),a=(parseInt(n.getAttribute("data-x")),e.width),r=e.thumbTbl.offsetWidth,s=!1;a<r&&(s=!0),s&&(i<t?e.moveThumbs("left",i,t):e.moveThumbs("right",i,t)),n.style.borderStyle="solid",n.style.borderColor=e.thumbsSelBorderColor,n.style.borderWidth="2px"}},this.renderThumb=function(t,i){var n=document.createElement("td");n.setAttribute("cellpadding",0),n.setAttribute("cellspacing",0),n.setAttribute("data-x",t*e.thumbWidth),n.style.cssText="border-width:1px;padding:0;margin:0;border-spacing:0;border-spacing:0;box-sizing:border-box;";var a='<div data-index="'+t+'" style="cursor:pointer;background-image:url('+i+");background-position:center;background-size:cover;background-repeat:no-repeat;width:"+e.thumbWidth+"px;height:"+e.thumbHeight+"px;border:solid 1px "+e.thumbsBorderColor+';box-sizing:border-box;"></div>';return n.innerHTML=a,n.onclick=function(){var t=parseInt(this.firstChild.getAttribute("data-index"));e.moveTo(t),e.thumb_callback(e,t,e.images[t])},n},this.renderThumbs=function(){e.thumbElem=document.createElement("div");var t=e.thumbnails?"block":"none";e.thumbElem.style.cssText="position:relative;width:100%;overflow-x:hidden;height:"+e.thumbHeight+"px;display:"+t+";",e.thumbTbl=document.createElement("table"),e.thumbTbl.style.cssText="position:absolute;top:0px;left:0px;border-style:none;padding:0;margin:0;border-width:0px;border-spacing:0;";var i=document.createElement("tr");for(var n in e.thumbTbl.appendChild(i),e.image_thumbs){var a=e.image_thumbs[n],r=e.renderThumb(n,a);i.appendChild(r)}e.thumbElem.appendChild(e.thumbTbl),e.prnt.appendChild(e.thumbElem)},this.renderThumbs(),this.selectThumb(0,0),this.resize_timeout=0,this.onresized=function(){e.width=e.getWidth(),e.height=e.getHeight(),e.elem.style.width=e.width+"px";var t=e.height;if(e.maxheight>0&&e.maxheight<t&&(t=e.maxheight),null!=e.user_dynamicheight){var i=e.user_dynamicheight(e,e.height);t=i}if(null!=e.user_maxheight){var n=e.user_maxheight(e,e.height);n<t&&(t=n)}if(e.minheight>0&&e.minheight>t&&(t=e.minheight),e.elem.style.height=t+"px",e.resizeBackgrounds(),e.thumbnails){e.width;var a=e.thumbTbl.offsetWidth;e.width>a&&(e.thumbTbl.style.left="0px")}},window.addEventListener("resize",function(){clearTimeout(e.resize_timeout),e.resize_timeout=setTimeout(function(){e.onresized()},100)}),this.fadeIn=function(t,e,i){t.style.opacity=0;var n=+new Date,a=function(){t.style.opacity=+t.style.opacity+(new Date-n)/e,n=+new Date,+t.style.opacity<1?window.requestAnimationFrame&&requestAnimationFrame(a)||setTimeout(a,16):(t.style.opacity=1,i())};a()},this.fadeOut=function(t,e,i){t.style.opacity=1;var n=+new Date,a=function(){t.style.opacity=t.style.opacity-(new Date-n)/e,n=+new Date,parseFloat(t.style.opacity)>0?window.requestAnimationFrame&&requestAnimationFrame(a)||setTimeout(a,16):(t.style.opacity=0,i())};a()},this.imageRatio=t.imageRatio?parseInt(t.imageRatio):0,this.loadImage=function(t,i,n){var a=new Image;a.onload=function(){var t=a.width,r=a.height,s="horizontal";r>t&&(s="vertical");var o=e.children[i];o.setAttribute("data-img-dir",s),o.setAttribute("data-img-width",t),o.setAttribute("data-img-height",r),(1==e.imageRatio&&t<r||2==e.imageRatio)&&(o.style.backgroundSize="auto 100%"),i<2&&n()},a.onerror=function(){i<2&&n()},a.src=t},this.loadImages=function(t){function i(){a++,2!=a&&a!=n||(e.inited=!0,e.inited_callback(e,e.currentIndex),e.autoplay&&(e.animate_timeout_handler=setTimeout(function(){e.animate(e.currentIndex)},e.timeout)))}var n=t.length,a=0;for(var r in t)e.loadImage(t[r],r,i)},"fade"==this.animation)for(var l in e.children){var h=e.children[l];h.style.zIndex=e.children-l,h.style.left="0px",l>0&&(h.style.opacity=0)}return this.timeout=t.timeout?t.timeout:null!=this.prnt.getAttribute("data-timeout")?parseInt(this.prnt.getAttribute("data-timeout")):2500,this.transition=t.transition?t.transition:null!=this.prnt.getAttribute("data-transition")?parseInt(this.prnt.getAttribute("data-transition")):500,this.syncs=0,this.synced=function(t){this.syncs++,2==this.syncs&&(this.syncs=0,e.animating=!1,t())},this.animate=function(t,i){e.currentIndex=t;var n=t,a=n+1>=e.children_size?0:n+1;if(void 0!==i&&i!=t)a=i;else if(void 0!==i&&i==t)return;var r=e.children[n],s=e.children[a];"fade"==e.animation?(r.style.opacity=1,s.style.opacity=0):"slide"==e.animation&&(r.style.left="0px",s.style.left=a<n?-1*e.width+"px":e.width+"px"),e.selectPage(a),e.selectThumb(a,n);var o=r.style.zIndex,l=s.style.zIndex;if(r.style.zIndex=l,s.style.zIndex=o,e.animating=!0,"fade"==e.animation)e.fadeOut(r,e.transition,function(){e.synced(function(){e.currentIndex=a,e.animated_callback(e,a),e.autoplay&&(e.animate_timeout_handler=setTimeout(function(){e.animate(a)},e.timeout))})}),e.fadeIn(s,e.transition,function(){e.synced(function(){e.currentIndex=a,e.animated_callback(e,a),e.autoplay&&(e.animate_timeout_handler=setTimeout(function(){e.animate(a)},e.timeout))})});else if("slide"==e.animation)if(a<n){var h=e.width;e.slideright(s,e.transition,h,0,function(){e.synced(function(){e.currentIndex=a,e.animated_callback(e,a),e.autoplay&&(e.animate_timeout_handler=setTimeout(function(){e.animate(a)},e.timeout))})}),e.slideright(r,e.transition,h,e.width,function(){e.synced(function(){e.currentIndex=a,e.animated_callback(e,a),e.autoplay&&(e.animate_timeout_handler=setTimeout(function(){e.animate(a)},e.timeout))})})}else if(a>n){h=e.width;e.slideleft(s,e.transition,h,0,function(){e.synced(function(){e.currentIndex=a,e.animated_callback(e,a),e.autoplay&&(e.animate_timeout_handler=setTimeout(function(){e.animate(a)},e.timeout))})}),e.slideleft(r,e.transition,h,-1*e.width,function(){e.synced(function(){e.currentIndex=a,e.animated_callback(e,a),e.autoplay&&(e.animate_timeout_handler=setTimeout(function(){e.animate(a)},e.timeout))})})}},this.loadImages(this.images),this.drag_ghost.style.zIndex=this.images.length,this.elem.appendChild(this.drag_ghost),this}pure_js_slideshow.prototype.fullScreen=function(t){t&&this.full_screen?document.exitFullscreen():this.prnt.requestFullscreen&&this.prnt.requestFullscreen()},pure_js_slideshow.prototype.thumbsVisible=function(t){this.thumbElem.style.display=t?"block":"none"},pure_js_slideshow.prototype.getCurrentIndex=function(){return this.currentIndex},pure_js_slideshow.prototype.totalChildren=function(){return this.children.length},pure_js_slideshow.prototype.appendImage=function(t){var e=document.createElement("div");this.loadImage(t,function(){e.style.setAttribute("class","pure-js-slideshow-content"),me.setupBackground(e,t),me.children.push(e),me.children_size+=1})},pure_js_slideshow.prototype.previousSlide=function(){this.previousContent()},pure_js_slideshow.prototype.nextSlide=function(){this.nextContent()},pure_js_slideshow.prototype.firstSlide=function(){this.moveTo(0)},pure_js_slideshow.prototype.lastSlide=function(){this.moveTo(this.children_size-1)},pure_js_slideshow.prototype.autoPlay=function(t){this.autoplay=t,t?this.animate(this.currentIndex):clearTimeout(this.animate_timeout_handler)},pure_js_slideshow.prototype.getImages=function(){return this.images},pure_js_slideshow.prototype.getContents=function(){return this.children};