wp_back/wp-content/themes/simple-theme/js/lightslider.min.js

1 line
15 KiB
JavaScript
Raw Normal View History

2024-05-20 15:37:46 +03:00
!function(e,i){"use strict";var t={item:3,autoWidth:!1,slideMove:1,slideMargin:10,addClass:"",mode:"slide",useCSS:!0,cssEasing:"ease",easing:"linear",speed:400,auto:!1,pauseOnHover:!1,loop:!1,slideEndAnimation:!0,pause:2e3,keyPress:!1,controls:!0,prevHtml:"",nextHtml:"",rtl:!1,adaptiveHeight:!1,vertical:!1,verticalHeight:500,vThumbWidth:100,thumbItem:10,pager:!0,gallery:!1,galleryMargin:5,thumbMargin:5,currentPagerPosition:"middle",enableTouch:!0,enableDrag:!0,freeMove:!0,swipeThreshold:40,responsive:[],onBeforeStart:function(e){},onSliderLoad:function(e){},onBeforeSlide:function(e,i){},onAfterSlide:function(e,i){},onBeforeNextSlide:function(e,i){},onBeforePrevSlide:function(e,i){}};e.fn.lightSlider=function(i){if(0===this.length)return this;if(this.length>1)return this.each(function(){e(this).lightSlider(i)}),this;var n={},l=e.extend(!0,{},t,i),a={},s=this;n.$el=this,"fade"===l.mode&&(l.vertical=!1);var o=s.children(),r=e(window).width(),d=null,c=null,u=0,f=0,h=!1,g=0,v="",p=0,$=!0===l.vertical?"height":"width",m=!0===l.vertical?"margin-bottom":"margin-right",S=0,_=0,b=0,C=0,M=null,T="ontouchstart"in document.documentElement,x={};return x.chbreakpoint=function(){if(r=e(window).width(),l.responsive.length){var i;if(!1===l.autoWidth&&(i=l.item),r<l.responsive[0].breakpoint)for(var t=0;t<l.responsive.length;t++)r<l.responsive[t].breakpoint&&(d=l.responsive[t].breakpoint,c=l.responsive[t]);if(null!=c)for(var n in c.settings)c.settings.hasOwnProperty(n)&&((void 0===a[n]||null===a[n])&&(a[n]=l[n]),l[n]=c.settings[n]);if(!e.isEmptyObject(a)&&r>l.responsive[0].breakpoint)for(var s in a)a.hasOwnProperty(s)&&(l[s]=a[s]);!1===l.autoWidth&&S>0&&b>0&&i!==l.item&&(p=Math.round(S/((b+l.slideMargin)*l.slideMove)))}},x.calSW=function(){!1===l.autoWidth&&(b=(g-(l.item*l.slideMargin-l.slideMargin))/l.item)},x.calWidth=function(e){var i=!0===e?v.find(".lslide").length:o.length;if(!1===l.autoWidth)f=i*(b+l.slideMargin);else{f=0;for(var t=0;t<i;t++)f+=parseInt(o.eq(t).width())+l.slideMargin}return f},(n={doCss:function(){return!!(l.useCSS&&function(){for(var e=["transition","MozTransition","WebkitTransition","OTransition","msTransition","KhtmlTransition"],i=document.documentElement,t=0;t<e.length;t++)if(e[t]in i.style)return!0}())},keyPress:function(){l.keyPress&&e(document).on("keyup.lightslider",function(i){e(":focus").is("input, textarea")||(i.preventDefault?i.preventDefault():i.returnValue=!1,37===i.keyCode?s.goToPrevSlide():39===i.keyCode&&s.goToNextSlide())})},controls:function(){l.controls&&(s.after('<div class="lSAction"><a class="lSPrev">'+l.prevHtml+'</a><a class="lSNext">'+l.nextHtml+"</a></div>"),l.autoWidth?x.calWidth(!1)<g&&v.find(".lSAction").hide():u<=l.item&&v.find(".lSAction").hide(),v.find(".lSAction a").on("click",function(i){return i.preventDefault?i.preventDefault():i.returnValue=!1,"lSPrev"===e(this).attr("class")?s.goToPrevSlide():s.goToNextSlide(),!1}))},initialStyle:function(){var e=this;"fade"===l.mode&&(l.autoWidth=!1,l.slideEndAnimation=!1),l.auto&&(l.slideEndAnimation=!1),l.autoWidth&&(l.slideMove=1,l.item=1),l.loop&&(l.slideMove=1,l.freeMove=!1),l.onBeforeStart.call(this,s),x.chbreakpoint(),s.addClass("lightSlider").wrap('<div class="lSSlideOuter '+l.addClass+'"><div class="lSSlideWrapper"></div></div>'),v=s.parent(".lSSlideWrapper"),!0===l.rtl&&v.parent().addClass("lSrtl"),l.vertical?(v.parent().addClass("vertical"),g=l.verticalHeight,v.css("height",g+"px")):g=s.outerWidth(),o.addClass("lslide"),!0===l.loop&&"slide"===l.mode&&(x.calSW(),x.clone=function(){if(x.calWidth(!0)>g){for(var i=0,t=0,n=0;n<o.length&&(i+=parseInt(s.find(".lslide").eq(n).width())+l.slideMargin,t++,!(i>=g+l.slideMargin));n++);var a=!0===l.autoWidth?t:l.item;if(a<s.find(".clone.left").length)for(var r=0;r<s.find(".clone.left").length-a;r++)o.eq(r).remove();if(a<s.find(".clone.right").length)for(var d=o.length-1;d>o.length-1-s.find(".clone.right").length;d--)p--,o.eq(d).remove();for(var c=s.find(".clone.right").length;c<a;c++)s.find(".lslide").eq(c).clone().removeClass("lslide").addClass("clone right").appendTo(s),p++;for(var u=s.find(".ls