This repository has been archived by the owner on Aug 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
jquery.mThumbnailScroller.min.js
1 lines (1 loc) · 29.9 KB
/
jquery.mThumbnailScroller.min.js
1
!function(t,e){var n,a="mThumbnailScroller",o="mTS",i=".mThumbnailScroller",l={setWidth:!1,setHeight:!1,setTop:0,setLeft:0,type:"hover-50",axis:"x",speed:15,contentTouchScroll:25,markup:{thumbnailsContainer:!1,thumbnailContainer:!1,thumbnailElement:!1,buttonsPlaceholder:!1,buttonsHTML:{up:"SVG set 1",down:"SVG set 1",left:"SVG set 1",right:"SVG set 1"}},advanced:{autoExpandHorizontalScroll:!0,updateOnContentResize:!0,updateOnImageLoad:!0,updateOnSelectorChange:!1},theme:"none",callbacks:{onInit:!1,onScrollStart:!1,onScroll:!1,onTotalScroll:!1,onTotalScrollBack:!1,whileScrolling:!1,onTotalScrollOffset:0,onTotalScrollBackOffset:0,alwaysTriggerOffsets:!0},live:!1,liveSelector:null},r=0,s={},c=function(t){s[t]&&(clearTimeout(s[t]),f._delete.call(null,s[t]))},d=e.attachEvent&&!e.addEventListener?1:0,u=!1,h={init:function(e){var e=t.extend(!0,{},l,e),n=f._selector.call(this);if(e.live){var a=e.liveSelector||this.selector||i,d=t(a);if("off"===e.live)return void c(a);s[a]=setTimeout(function(){d.mThumbnailScroller(e),"once"===e.live&&d.length&&c(a)},500)}else c(a);return e.speed=0===e.speed?100:e.speed,f._theme.call(null,e),t(n).each(function(){var n=t(this);if(!n.data(o)){n.data(o,{idx:++r,opt:e,html:null,overflowed:null,bindEvents:!1,tweenRunning:!1,langDir:n.css("direction"),cbOffsets:null,trigger:null});var a=n.data(o).opt,i=n.data("mts-axis"),l=n.data("mts-type"),s=n.data("mts-theme");i&&(a.axis=i),l&&(a.type=l),s&&(a.theme=s,f._theme.call(null,a)),f._pluginMarkup.call(this),h.update.call(null,n)}})},update:function(e){var n=e||f._selector.call(this);return t(n).each(function(){var e=t(this);if(e.data(o)){var n=e.data(o),a=n.opt,i=t("#mTS_"+n.idx+"_container");if(!i.length)return;n.tweenRunning&&f._stop.call(null,e),e.hasClass("mTS_disabled")&&e.removeClass("mTS_disabled"),e.hasClass("mTS_destroyed")&&e.removeClass("mTS_destroyed"),f._maxHeight.call(this),f._expandContentHorizontally.call(this),n.overflowed=f._overflowed.call(this),f._buttonsVisibility.call(this),f._bindEvents.call(this);var l=[i[0].offsetTop,i[0].offsetLeft];"x"!==a.axis&&(n.overflowed[0]?f._scrollTo.call(this,e,l[0].toString(),{dir:"y",dur:0,overwrite:"none"}):(f._resetContentPosition.call(this),"y"===a.axis?f._unbindEvents.call(this):"yx"===a.axis&&n.overflowed[1]&&f._scrollTo.call(this,e,l[1].toString(),{dir:"x",dur:0,overwrite:"none"}))),"y"!==a.axis&&(n.overflowed[1]?f._scrollTo.call(this,e,l[1].toString(),{dir:"x",dur:0,overwrite:"none"}):(f._resetContentPosition.call(this),"x"===a.axis?f._unbindEvents.call(this):"yx"===a.axis&&n.overflowed[0]&&f._scrollTo.call(this,e,l[0].toString(),{dir:"y",dur:0,overwrite:"none"}))),n.overflowed[0]||n.overflowed[1]?e.removeClass("mTS_no_scroll"):e.addClass("mTS_no_scroll"),f._autoUpdate.call(this)}})},scrollTo:function(e,n){if("undefined"!=typeof e&&null!=e){var a=f._selector.call(this);return t(a).each(function(){var a=t(this);if(a.data(o)){var i=a.data(o),l=i.opt,r={trigger:"external",speed:l.speed,duration:1e3,easing:"easeInOut",timeout:60,callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},s=t.extend(!0,{},r,n),c=f._arr.call(this,e),d=s.duration?s.duration:7e3/(s.speed||1);c[0]=f._to.call(this,c[0],"y"),c[1]=f._to.call(this,c[1],"x"),s.dur=d>0&&17>d?17:d,setTimeout(function(){null!==c[0]&&"undefined"!=typeof c[0]&&"x"!==l.axis&&i.overflowed[0]&&(s.dir="y",s.overwrite="all",f._scrollTo.call(this,a,-c[0].toString(),s)),null!==c[1]&&"undefined"!=typeof c[1]&&"y"!==l.axis&&i.overflowed[1]&&(s.dir="x",s.overwrite="none",f._scrollTo.call(this,a,-c[1].toString(),s))},s.timeout)}})}},stop:function(){var e=f._selector.call(this);return t(e).each(function(){var e=t(this);e.data(o)&&f._stop.call(null,e)})},disable:function(e){var n=f._selector.call(this);return t(n).each(function(){var n=t(this);if(n.data(o)){{var a=n.data(o);a.opt}f._autoUpdate.call(this,"remove"),f._unbindEvents.call(this),e&&f._resetContentPosition.call(this),f._buttonsVisibility.call(this,!0),n.addClass("mTS_disabled")}})},destroy:function(){var e=f._selector.call(this);return t(e).each(function(){var n=t(this);if(n.data(o)){var i=n.data(o),l=i.opt,r=t("#mTS_"+i.idx),s=(t("#mTS_"+i.idx+"_container"),t("#mTS_"+i.idx+"_buttonUp,#mTS_"+i.idx+"_buttonDown,#mTS_"+i.idx+"_buttonLeft,#mTS_"+i.idx+"_buttonRight"));l.live&&c(e),f._autoUpdate.call(this,"remove"),f._unbindEvents.call(this),f._resetContentPosition.call(this),n.removeData(o),f._delete.call(null,this.mts),s.remove(),r.replaceWith(i.html),n.removeClass(a+" _"+o+"_"+i.idx+" "+o+"-"+l.theme+" mTS_no_scroll mTS_disabled").addClass("mTS_destroyed")}})}},f={_selector:function(){return"object"!=typeof t(this)||t(this).length<1?i:this},_theme:function(e){var n=["buttons-out"],a=["buttons-in"],o=["buttons-out"],i=["hover-classic"],l=["hover-full"];e.markup.buttonsPlaceholder=t.inArray(e.theme,n)>-1?"outside":e.markup.buttonsPlaceholder,e.markup.buttonsHTML=t.inArray(e.theme,a)>-1?{up:"SVG set 2",down:"SVG set 2",left:"SVG set 2",right:"SVG set 2"}:t.inArray(e.theme,o)>-1?{up:"SVG set 3",down:"SVG set 3",left:"SVG set 3",right:"SVG set 3"}:e.markup.buttonsHTML,e.type=t.inArray(e.theme,i)>-1?"hover-85":t.inArray(e.theme,l)>-1?"hover-precise":e.type,e.speed=t.inArray(e.theme,i)>-1?60:t.inArray(e.theme,l)>-1?10:e.speed},_pluginMarkup:function(){var e=t(this),n=e.data(o),i=n.opt,l="yx"===i.axis?"mTS_vertical_horizontal":"x"===i.axis?"mTS_horizontal":"mTS_vertical",r=i.markup.thumbnailsContainer||"ul",s=i.markup.thumbnailContainer||"li",c=i.markup.thumbnailElement||"img";if(n.html=e.children().clone(!0,!0),!e.find(r).length){var d=e.find("li").length?"<ul class='"+o+"AutoContainer' />":"<div class='"+o+"AutoContainer' />";e.wrapInner(d),r="."+o+"AutoContainer"}i.setWidth&&e.css("width",i.setWidth),i.setHeight&&e.css("height",i.setHeight),i.setLeft="y"!==i.axis&&"rtl"===n.langDir?"-989999px":i.setLeft,e.addClass(a+" _"+o+"_"+n.idx+" "+o+"-"+i.theme).find(r).wrap("<div id='mTS_"+n.idx+"' class='mTSWrapper "+l+"' />").addClass(o+"Container").attr("id","mTS_"+n.idx+"_container").css({position:"relative",top:i.setTop,left:i.setLeft}).find(s).addClass(o+"ThumbContainer").find(c).addClass(o+"Thumb"),f._scrollButtons.call(this)},_expandContentHorizontally:function(){var e=t(this),n=e.data(o),a=n.opt,i=t("#mTS_"+n.idx+"_container");a.advanced.autoExpandHorizontalScroll&&"y"!==a.axis&&i.css({position:"absolute",width:"auto"}).wrap("<div class='mTS_h_wrapper' style='position:relative; left:0; width:999999px;' />").css({width:Math.ceil(i[0].getBoundingClientRect().right)-Math.floor(i[0].getBoundingClientRect().left),position:"relative"}).unwrap()},_scrollButtons:function(){{var e=t(this),n=e.data(o),i=n.opt,l=i.markup.buttonsPlaceholder?"outside"===i.markup.buttonsPlaceholder?e:t(i.markup.buttonsPlaceholder):t("#mTS_"+n.idx),r=["<a href='#' id='mTS_"+n.idx+"_buttonUp' class='mTSButton mTSButtonUp'><span class='mTSButtonIconContainer'>"+f._scrollButtonsIcons.call(this,"up")+"</span></a>","<a href='#' id='mTS_"+n.idx+"_buttonDown' class='mTSButton mTSButtonDown'><span class='mTSButtonIconContainer'>"+f._scrollButtonsIcons.call(this,"down")+"</span></a>","<a href='#' id='mTS_"+n.idx+"_buttonLeft' class='mTSButton mTSButtonLeft'><span class='mTSButtonIconContainer'>"+f._scrollButtonsIcons.call(this,"left")+"</span></a>","<a href='#' id='mTS_"+n.idx+"_buttonRight' class='mTSButton mTSButtonRight'><span class='mTSButtonIconContainer'>"+f._scrollButtonsIcons.call(this,"right")+"</span></a>"];["x"===i.axis?r[2]:r[0],"x"===i.axis?r[3]:r[1]]}l.hasClass(a)&&"static"===l.css("position")&&l.css("position","relative"),-1!==i.type.indexOf("click")&&("x"!==i.axis&&l.append(r[0]+r[1]),"y"!==i.axis&&l.append(r[2]+r[3]))},_scrollButtonsIcons:function(e){var n=t(this),a=n.data(o),i=a.opt,l=i.markup.buttonsHTML,r="SVG set 1"===l[e]?0:"SVG set 2"===l[e]?1:"SVG set 3"===l[e]?2:"SVG set 4"===l[e]?3:"SVG set 5"===l[e]?4:null;switch(e){case"up":return null===r?l[e]:d?"↑":f._icons(l[e])[r][0];case"down":return null===r?l[e]:d?"↓":f._icons(l[e])[r][1];case"left":return null===r?l[e]:d?"←":f._icons(l[e])[r][2];case"right":return null===r?l[e]:d?"→":f._icons(l[e])[r][3]}},_icons:function(){var t="<svg version='1.1' viewBox='0 0 24 24' preserveAspectRatio='xMinYMin meet' class='mTSButtonIcon'><g><line stroke-width='1' x1='' y1='' x2='' y2='' stroke='#449FDB' opacity=''></line></g>",e="</svg>";return[[t+"<path d='M20.561 9.439l-7.5-7.5c-0.586-0.586-1.535-0.586-2.121 0l-7.5 7.5c-0.586 0.586-0.586 1.536 0 2.121s1.536 0.586 2.121 0l4.939-4.939v14.379c0 0.828 0.672 1.5 1.5 1.5s1.5-0.672 1.5-1.5v-14.379l4.939 4.939c0.293 0.293 0.677 0.439 1.061 0.439s0.768-0.146 1.061-0.439c0.586-0.586 0.586-1.535 0-2.121z'></path>"+e,t+"<path d='M3.439 14.561l7.5 7.5c0.586 0.586 1.536 0.586 2.121 0l7.5-7.5c0.586-0.586 0.586-1.536 0-2.121s-1.536-0.586-2.121 0l-4.939 4.939v-14.379c0-0.828-0.672-1.5-1.5-1.5s-1.5 0.672-1.5 1.5v14.379l-4.939-4.939c-0.293-0.293-0.677-0.439-1.061-0.439s-0.768 0.146-1.061 0.439c-0.586 0.586-0.586 1.536 0 2.121z'></path>"+e,t+"<path d='M9.439 3.439l-7.5 7.5c-0.586 0.586-0.586 1.536 0 2.121l7.5 7.5c0.586 0.586 1.536 0.586 2.121 0s0.586-1.536 0-2.121l-4.939-4.939h14.379c0.828 0 1.5-0.672 1.5-1.5s-0.672-1.5-1.5-1.5h-14.379l4.939-4.939c0.293-0.293 0.439-0.677 0.439-1.061s-0.146-0.768-0.439-1.061c-0.586-0.586-1.536-0.586-2.121 0z'></path>"+e,t+"<path d='M14.561 20.561l7.5-7.5c0.586-0.586 0.586-1.536 0-2.121l-7.5-7.5c-0.586-0.586-1.536-0.586-2.121 0s-0.586 1.536 0 2.121l4.939 4.939h-14.379c-0.828 0-1.5 0.672-1.5 1.5s0.672 1.5 1.5 1.5h14.379l-4.939 4.939c-0.293 0.293-0.439 0.677-0.439 1.061s0.146 0.768 0.439 1.061c0.586 0.586 1.536 0.586 2.121 0z'></path>"+e],[t+"<path d='M18.58 13.724c-0.488-0.502-5.634-5.402-5.634-5.402-0.262-0.268-0.604-0.402-0.946-0.402-0.343 0-0.685 0.134-0.946 0.402 0 0-5.146 4.901-5.635 5.402-0.488 0.502-0.522 1.404 0 1.939 0.523 0.534 1.252 0.577 1.891 0l4.69-4.496 4.688 4.496c0.641 0.577 1.37 0.534 1.891 0 0.523-0.536 0.491-1.439 0-1.939z'</path>"+e,t+"<path d='M18.58 10.276c-0.488 0.502-5.634 5.404-5.634 5.404-0.262 0.268-0.604 0.401-0.946 0.401-0.343 0-0.685-0.133-0.946-0.401 0 0-5.146-4.902-5.635-5.404-0.488-0.502-0.522-1.403 0-1.939 0.523-0.535 1.252-0.577 1.891 0l4.69 4.498 4.688-4.496c0.641-0.577 1.37-0.535 1.891 0 0.523 0.535 0.491 1.438 0 1.938z'></path>"+e,t+"<path d='M13.724 5.419c-0.502 0.49-5.402 5.635-5.402 5.635-0.268 0.262-0.401 0.604-0.401 0.946s0.133 0.684 0.401 0.946c0 0 4.901 5.146 5.402 5.634 0.502 0.49 1.404 0.523 1.939 0 0.534-0.522 0.576-1.25-0.001-1.89l-4.496-4.69 4.496-4.69c0.577-0.641 0.535-1.369 0.001-1.891-0.536-0.522-1.439-0.49-1.939 0z'></path>"+e,t+"<path d='M10.276 5.419c0.502 0.49 5.402 5.635 5.402 5.635 0.269 0.262 0.402 0.604 0.402 0.946s-0.133 0.684-0.402 0.946c0 0-4.901 5.146-5.402 5.634-0.502 0.49-1.403 0.523-1.939 0-0.535-0.522-0.577-1.25 0-1.89l4.498-4.69-4.496-4.69c-0.577-0.641-0.535-1.369 0-1.891s1.438-0.49 1.938 0z'></path>"+e],[t+"<path d='M20.902 17.279c0.325 0.322 0.851 0.322 1.175 0 0.325-0.322 0.325-0.841 0-1.163l-9.49-9.396c-0.324-0.322-0.85-0.322-1.174 0l-9.49 9.396c-0.324 0.322-0.325 0.841 0 1.163s0.85 0.322 1.175 0l8.902-8.569 8.902 8.569z'></path>"+e,t+"<path d='M3.098 6.721c-0.325-0.322-0.851-0.322-1.175 0-0.324 0.32-0.324 0.841 0 1.163l9.49 9.396c0.325 0.322 0.85 0.322 1.175 0l9.49-9.396c0.324-0.322 0.325-0.841 0-1.163s-0.852-0.322-1.175-0.001l-8.903 8.569-8.902-8.568z'></path>"+e,t+"<path d='M17.279 20.902c0.322 0.325 0.322 0.85 0 1.175s-0.841 0.325-1.163 0l-9.396-9.488c-0.322-0.325-0.322-0.851 0-1.175l9.396-9.49c0.322-0.325 0.841-0.325 1.163 0s0.322 0.85 0 1.175l-8.568 8.902 8.568 8.902z'</path>"+e,t+"<path d='M6.72 20.902c-0.322 0.325-0.322 0.85 0 1.175s0.841 0.325 1.163 0l9.396-9.488c0.322-0.325 0.322-0.851 0-1.175l-9.396-9.49c-0.322-0.325-0.841-0.325-1.163 0s-0.322 0.85 0 1.175l8.568 8.902-8.568 8.902z'</path>"+e],[t+"<path d='M12 0l-12 12h7.5v12l9 0v-12h7.5z'></path>"+e,t+"<path d='M12 24l12-12h-7.5v-12l-9-0v12h-7.5z'></path>"+e,t+"<path d='M0 12l12 12v-7.5h12l0-9h-12v-7.5z'></path>"+e,t+"<path d='M24 12l-12-12v7.5h-12l-0 9h12v7.5z'></path>"+e],[t+"<path d='M6.48 16.8h11.040l-5.521-9.6z'></path>"+e,t+"<path d='M17.52 7.201l-11.040-0.001 5.52 9.6z'></path>"+e,t+"<path d='M16.799 6.48l0.001 11.040-9.6-5.52z'></path>"+e,t+"<path d='M7.201 6.48l-0.001 11.040 9.6-5.52z'></path>"+e]]},_maxHeight:function(){var e=t(this),n=e.data(o),a=(n.opt,t("#mTS_"+n.idx)),i=e.css("max-height"),l=-1!==i.indexOf("%"),r=e.css("box-sizing");if("none"!==i){var s=l?e.parent().height()*parseInt(i)/100:parseInt(i);"border-box"===r&&(s-=e.innerHeight()-e.height()+(e.outerHeight()-e.innerHeight())),a.css("max-height",Math.round(s))}},_overflowed:function(){var e=t(this),n=e.data(o),a=t("#mTS_"+n.idx),i=t("#mTS_"+n.idx+"_container");return[i.height()>a.height(),i.width()>a.width()]},_resetContentPosition:function(){var e=t(this),n=e.data(o),a=n.opt,i=t("#mTS_"+n.idx),l=t("#mTS_"+n.idx+"_container");if(f._stop(e),("x"!==a.axis&&!n.overflowed[0]||"y"===a.axis&&n.overflowed[0])&&l.css("top",0),"y"!==a.axis&&!n.overflowed[1]||"x"===a.axis&&n.overflowed[1]){var r="rtl"===n.langDir?i.width()-l.width():0;l.css("left",r)}},_bindEvents:function(){var e=t(this),n=e.data(o),a=n.opt;n.bindEvents||(a.contentTouchScroll&&f._contentDraggable.call(this),-1!==a.type.indexOf("hover")?"hover-precise"===a.type?f._hoverPrecise.call(this):f._hover.call(this):-1!==a.type.indexOf("click")&&f._click.call(this),n.bindEvents=!0)},_unbindEvents:function(){var e=t(this),n=e.data(o),a=o+"_"+n.idx,i=t("#mTS_"+n.idx+",#mTS_"+n.idx+"_container,#mTS_"+n.idx+"_buttonUp,#mTS_"+n.idx+"_buttonDown,#mTS_"+n.idx+"_buttonLeft,#mTS_"+n.idx+"_buttonRight"),l=t("#mTS_"+n.idx+"_container");n.bindEvents&&(i.each(function(){t(this).unbind("."+a)}),clearTimeout(l[0].onCompleteTimeout),f._delete.call(null,l[0].onCompleteTimeout),n.bindEvents=!1)},_buttonsVisibility:function(e,n,a){var i=t(this),l=i.data(o),r=l.opt;if(-1!==r.type.indexOf("click")){a||(a=r.axis);var s=[t("#mTS_"+l.idx+"_buttonUp"),t("#mTS_"+l.idx+"_buttonDown"),t("#mTS_"+l.idx+"_buttonLeft"),t("#mTS_"+l.idx+"_buttonRight")],c=o+"-hidden";"x"!==a&&(sel=!l.overflowed[0]||e||n?1===n?[s[0],s[1]]:2===n?[s[1],s[0]]:[s[0].add(s[1]),null]:[l.overflowed[1]?null:s[2].add(s[3]),s[0].add(s[1])]),"y"!==a&&(sel=!l.overflowed[1]||e||n?1===n?[s[2],s[3]]:2===n?[s[3],s[2]]:[s[2].add(s[3]),null]:[l.overflowed[0]?null:s[0].add(s[1]),s[2].add(s[3])]),sel[0]&&sel[0].addClass(c),sel[1]&&sel[1].removeClass(c)}},_coordinates:function(t){var e=t.type;switch(e){case"pointerdown":case"MSPointerDown":case"pointermove":case"MSPointerMove":case"pointerup":case"MSPointerUp":return[t.originalEvent.pageY,t.originalEvent.pageX];case"touchstart":case"touchmove":case"touchend":var n=t.originalEvent.touches[0]||t.originalEvent.changedTouches[0];return[n.pageY,n.pageX];default:return[t.pageY,t.pageX]}},_inputType:function(t){return n||-1!==t.type.indexOf("touch")||"undefined"!=typeof t.pointerType&&(2===t.pointerType||"touch"===t.pointerType)?"touch":"mouse"},_contentDraggable:function(){function e(t,e){var n=[1.5*e,2*e,e/1.5,e/2];return t>90?e>4?n[0]:n[3]:t>60?e>3?n[3]:n[2]:t>30?e>8?n[1]:e>6?n[0]:e>4?e:n[2]:e>8?e:n[3]}function a(t,e,n,a,o){t&&f._scrollTo(T,-t.toString(),{dur:e,easing:n,dir:a,overwrite:o})}var i,l,r,s,c,d,h,p,m,_,v,T=t(this),g=T.data(o),x=g.opt,S=o+"_"+g.idx,w=t("#mTS_"+g.idx),b=t("#mTS_"+g.idx+"_container"),y=[],M=[],C=0,k="yx"===x.axis?"none":"all",O=[];b.bind("touchstart."+S+" pointerdown."+S+" MSPointerDown."+S,function(t){if(f._pointerTouch(t)&&!u){var e=b.offset();i=f._coordinates(t)[0]-e.top,l=f._coordinates(t)[1]-e.left,O=[f._coordinates(t)[0],f._coordinates(t)[1]]}}).bind("touchmove."+S+" pointermove."+S+" MSPointerMove."+S,function(t){if(f._pointerTouch(t)&&!u){t.stopImmediatePropagation(),d=f._getTime();var e=w.offset(),n=f._coordinates(t)[0]-e.top,o=f._coordinates(t)[1]-e.left,r="linearOut";if(y.push(n),M.push(o),O[2]=Math.abs(f._coordinates(t)[0]-O[0]),O[3]=Math.abs(f._coordinates(t)[1]-O[1]),g.overflowed[0])var s=w.height()-b.height(),c=i-n>0&&n-i>s&&2*O[3]<O[2];if(g.overflowed[1])var h=w.width()-b.width(),p=l-o>0&&o-l>h&&2*O[2]<O[3];(c||p)&&t.preventDefault(),_="yx"===x.axis?[i-n,l-o]:"x"===x.axis?[null,l-o]:[i-n,null],b[0].idleTimer=250,g.overflowed[0]&&a(_[0],C,r,"y","all"),g.overflowed[1]&&a(_[1],C,r,"x",k)}}),w.bind("touchstart."+S+" pointerdown."+S+" MSPointerDown."+S,function(t){if(f._pointerTouch(t)&&!u){t.stopImmediatePropagation(),n=!0,f._stop(T),c=f._getTime();var e=w.offset();r=f._coordinates(t)[0]-e.top,s=f._coordinates(t)[1]-e.left,y=[],M=[]}}).bind("touchend."+S+" pointerup."+S+" MSPointerUp."+S,function(t){if(f._pointerTouch(t)&&!u){t.stopImmediatePropagation(),h=f._getTime();var n=w.offset(),o=f._coordinates(t)[0]-n.top,i=f._coordinates(t)[1]-n.left;if(!(h-d>30)){m=1e3/(h-c);var l="easeOut",T=2.5>m,S=T?[y[y.length-2],M[M.length-2]]:[0,0];p=T?[o-S[0],i-S[1]]:[o-r,i-s];var C=[Math.abs(p[0]),Math.abs(p[1])];m=T?[Math.abs(p[0]/4),Math.abs(p[1]/4)]:[m,m];var O=[Math.abs(b[0].offsetTop)-p[0]*e(C[0]/m[0],m[0]),Math.abs(b[0].offsetLeft)-p[1]*e(C[1]/m[1],m[1])];_="yx"===x.axis?[O[0],O[1]]:"x"===x.axis?[null,O[1]]:[O[0],null],v=[4*C[0]+60*x.speed,4*C[1]+60*x.speed];var I=parseInt(x.contentTouchScroll)||0;_[0]=C[0]>I?_[0]:0,_[1]=C[1]>I?_[1]:0,g.overflowed[0]&&a(_[0],v[0],l,"y",k),g.overflowed[1]&&a(_[1],v[1],l,"x",k)}}})},_hoverPrecise:function(){var n,a,i,l=t(this),r=l.data(o),s=r.opt,c=o+"_"+r.idx,d=t("#mTS_"+r.idx),u=t("#mTS_"+r.idx+"_container"),h=e.navigator.pointerEnabled?"pointermove":e.navigator.msPointerEnabled?"MSPointerMove":"mousemove";d.bind(h+"."+c,function(t){if("touch"!==f._inputType(t.originalEvent||t)&&(r.overflowed[0]||r.overflowed[1])){t.preventDefault();var e=d.height(),o=u.height(),c=d.width(),h=u.width(),p=h/c*7e3/(s.speed||1);n=[f._coordinates(t)[0]-d.offset().top,f._coordinates(t)[1]-d.offset().left],a=[n[0]/d.height(),n[1]/d.width()],i=[Math.round(-((o-e)*a[0])),Math.round(-((h-c)*a[1]))],"x"!==s.axis&&r.overflowed[0]&&f._scrollTo(l,i[0].toString(),{dir:"y",dur:p,easing:"easeOut"}),"y"!==s.axis&&r.overflowed[1]&&f._scrollTo(l,i[1].toString(),{dir:"x",dur:p,easing:"easeOut"})}})},_hover:function(){function a(){v[0].rAF||(r=e.requestAnimationFrame?e.requestAnimationFrame:function(t){return setTimeout(t,17)},v[0].rAF=r(l))}function i(){null!=v[0].rAF&&(e.requestAnimationFrame?e.cancelAnimationFrame(v[0].rAF):clearTimeout(v[0].rAF),clearTimeout(u),v[0].rAF=null)}function l(){if(!n){d=[c[0]+T[0].offsetTop,c[1]+T[0].offsetLeft];var t=[v.height()-T.height(),v.width()-T.width()];"x"!==m.axis&&p.overflowed[0]&&(d[0]=d[0]>0?0:d[0]<t[0]?t[0]:d[0],c[0]&&!y[0]&&f._scrollTo(h,d[0],{dir:"y",dur:0,easing:"linear"}),(d[0]>=0||d[0]<=t[0])&&(y[0]=1)),"y"!==m.axis&&p.overflowed[1]&&(d[1]=d[1]>0?0:d[1]<t[1]?t[1]:d[1],c[1]&&!y[1]&&f._scrollTo(h,d[1],{dir:"x",dur:0,easing:"linear"}),(d[1]>=0||d[1]<=t[1])&&(y[1]=1)),u=setTimeout(function(){v[0].rAF=r(l)},x)}}var r,s,c,d,u,h=t(this),p=h.data(o),m=p.opt,_=o+"_"+p.idx,v=t("#mTS_"+p.idx),T=t("#mTS_"+p.idx+"_container"),g=e.navigator.pointerEnabled?["pointerover","pointermove","pointerout"]:e.navigator.msPointerEnabled?["MSPointerOver","MSPointerMove","MSPointerOut"]:["mouseenter","mousemove","mouseleave"],x=e.requestAnimationFrame?0:17,S=m.speed,w=parseInt(m.type.split("hover-")[1])||1,b=S*w/100,y=[0,0];v.bind(g[0]+"."+_,function(t){"touch"!==f._inputType(t.originalEvent||t)&&(p.overflowed[0]||p.overflowed[1])&&a()}).bind(g[1]+"."+_,function(t){"touch"!==f._inputType(t.originalEvent||t)&&(p.overflowed[0]||p.overflowed[1])&&(s=[f._coordinates(t)[0]-v.offset().top,f._coordinates(t)[1]-v.offset().left],c=[Math.round(Math.cos(s[0]/v.height()*Math.PI)*S),Math.round(Math.cos(s[1]/v.width()*Math.PI)*S)],c[0]=c[0]<=-b?c[0]+=b:c[0]>=b?c[0]-=b:c[0]=0,c[1]=c[1]<=-b?c[1]+=b:c[1]>=b?c[1]-=b:c[1]=0,y=[0,0])}).bind(g[2]+"."+_,function(t){"touch"!==f._inputType(t.originalEvent||t)&&(p.overflowed[0]||p.overflowed[1])&&i()})},_click:function(){var e=t(this),n=e.data(o),a=n.opt,i=o+"_"+n.idx,l=t("#mTS_"+n.idx),r=t("#mTS_"+n.idx+"_container"),s=[t("#mTS_"+n.idx+"_buttonUp"),t("#mTS_"+n.idx+"_buttonDown"),t("#mTS_"+n.idx+"_buttonLeft"),t("#mTS_"+n.idx+"_buttonRight")],c=s[0].add(s[1]).add(s[2]).add(s[3]);c.bind("click."+i,function(o){if(f._mouseBtnLeft(o)&&(n.overflowed[0]||n.overflowed[1])&&(o.preventDefault(),!n.tweenRunning)){if("x"!==a.axis&&n.overflowed[0]){var i=l.height(),s="click-thumb"===a.type?0:t(this).hasClass("mTSButtonUp")?"+=":t(this).hasClass("mTSButtonDown")?"-=":0;if("click-thumb"!==a.type)var c=parseInt(a.type.split("click-")[1])||1,d=s?[s+i*c/100,null]:0;else{var u=f._firstLast.call(e[0])[0],p=f._firstLast.call(e[0])[1];if(t(this).hasClass("mTSButtonDown"))var d=p?p[0].offsetTop-parseInt(p.css("margin-bottom"))-i:989999;else if(t(this).hasClass("mTSButtonUp")){var d=u?u[0].offsetTop-parseInt(u.css("margin-top")):0;if(0===r[0].offsetTop)return}}}if("y"!==a.axis&&n.overflowed[1]){var m=l.width(),s="click-thumb"===a.type?0:t(this).hasClass("mTSButtonLeft")?"+=":t(this).hasClass("mTSButtonRight")?"-=":0;if("click-thumb"!==a.type)var c=parseInt(a.type.split("click-")[1])||1,d=s?[null,s+m*c/100]:d;else{var u=f._firstLast.call(e[0])[2],p=f._firstLast.call(e[0])[3];if(t(this).hasClass("mTSButtonRight"))var d=p?p[0].offsetLeft-parseInt(p.css("margin-right"))-m:989999;else if(t(this).hasClass("mTSButtonLeft")){var d=u?u[0].offsetLeft-parseInt(u.css("margin-left")):0;if(0===r[0].offsetLeft)return}}}null!==d&&h.scrollTo.call(e[0],d,{duration:0})}})},_firstLast:function(){var e,n,a,i,l=t(this),r=l.data(o),s=(r.opt,t("#mTS_"+r.idx+"_container")),c=t("#mTS_"+r.idx),d=s.find(".mTSThumbContainer");return d.each(function(){var o=t(this),l=[Math.round(o.offset().top-s.offset().top+s[0].offsetTop),Math.round(o.offset().left-s.offset().left+s[0].offsetLeft)];if(l[0]<=0-parseInt(o.css("margin-top")))e=d.eq(0===l[0]?o.index()-1:o.index());else if(l[0]<=c.height()+parseInt(o.css("margin-bottom"))){var r=d.eq(o.index()+1);n=r.length?r:null}if(l[1]<=0-parseInt(o.css("margin-left")))a=d.eq(0===l[1]?o.index()-1:o.index());else if(l[1]<=c.width()+parseInt(o.css("margin-right"))){var u=d.eq(o.index()+1);i=u.length?u:null}}),[e,n,a,i]},_arr:function(e){var n=t(this).data(o).opt,a=[];return"function"==typeof e&&(e=e()),e instanceof Array?a=e.length>1?[e[0],e[1]]:"x"===n.axis?[null,e[0]]:[e[0],null]:(a[0]=e.y?e.y:e.x||"x"===n.axis?null:e,a[1]=e.x?e.x:e.y||"y"===n.axis?null:e),"function"==typeof a[0]&&(a[0]=a[0]()),"function"==typeof a[1]&&(a[1]=a[1]()),a},_to:function(e,n){if(null!=e&&"undefined"!=typeof e){var a=t(this),i=a.data(o),l=i.opt,r=t("#mTS_"+i.idx),s=t("#mTS_"+i.idx+"_container"),c=typeof e;n||(n="x"===l.axis?"x":"y");var d="x"===n?s.width():s.height(),u="x"===n?s.offset().left:s.offset().top,p="x"===n?s[0].offsetLeft:s[0].offsetTop,m="x"===n?"left":"top";switch(c){case"function":return e();case"object":if(e.nodeType)var _="x"===n?t(e).offset().left:t(e).offset().top;else if(e.jquery){if(!e.length)return;var _="x"===n?e.offset().left:e.offset().top}return _-u;case"string":case"number":if(f._isNumeric.call(null,e))return Math.abs(e);if(-1!==e.indexOf("%"))return Math.abs(d*parseInt(e)/100);if(-1!==e.indexOf("-="))return Math.abs(p-parseInt(e.split("-=")[1]));if(-1!==e.indexOf("+=")){var v=p+parseInt(e.split("+=")[1]);return v>=0?0:Math.abs(v)}if(-1!==e.indexOf("px")&&f._isNumeric.call(null,e.split("px")[0]))return Math.abs(e.split("px")[0]);if("top"===e||"left"===e)return 0;if("bottom"===e)return Math.abs(r.height()-s.height());if("right"===e)return Math.abs(r.width()-s.width());if("first"===e||"last"===e){var T=s.find(":"+e),_="x"===n?t(T).offset().left:t(T).offset().top;return _-u}if(t(e).length){var _="x"===n?t(e).offset().left:t(e).offset().top;return _-u}return s.css(m,e),void h.update.call(null,a[0])}}},_autoUpdate:function(e){function n(){clearTimeout(p[0].autoUpdate),p[0].autoUpdate=setTimeout(function(){return d.advanced.updateOnSelectorChange&&(m=l(),m!==T)?(r(),void(T=m)):(d.advanced.updateOnContentResize&&(_=[p.height(),p.width(),u.height(),u.width(),s.height(),s.width()],(_[0]!==g[0]||_[1]!==g[1]||_[2]!==g[2]||_[3]!==g[3]||_[4]!==g[4]||_[5]!==g[5])&&(r(),g=_)),d.advanced.updateOnImageLoad&&(v=a(),v!==x&&(p.find("img").each(function(){i(this.src)}),x=v)),void((d.advanced.updateOnSelectorChange||d.advanced.updateOnContentResize||d.advanced.updateOnImageLoad)&&n()))},60)}function a(){var t=0;return d.advanced.updateOnImageLoad&&(t=p.find("img").length),t}function i(t){function e(t,e){return function(){return e.apply(t,arguments)}}function n(){this.onload=null,r()}var a=new Image;a.onload=e(a,n),a.src=t}function l(){d.advanced.updateOnSelectorChange===!0&&(d.advanced.updateOnSelectorChange="*");var e=0,n=p.find(d.advanced.updateOnSelectorChange);return d.advanced.updateOnSelectorChange&&n.length>0&&n.each(function(){e+=t(this).height()+t(this).width()}),e}function r(){clearTimeout(p[0].autoUpdate),h.update.call(null,s[0])}var s=t(this),c=s.data(o),d=c.opt,u=t("#mTS_"+c.idx),p=t("#mTS_"+c.idx+"_container");if(e)return clearTimeout(p[0].autoUpdate),void f._delete.call(null,p[0].autoUpdate);var m,_,v,T=l(),g=[p.height(),p.width(),u.height(),u.width(),s.height(),s.width()],x=a();n()},_stop:function(e){var n=e.data(o),a=t("#mTS_"+n.idx+"_container");a.each(function(){f._stopTween.call(this)})},_scrollTo:function(e,n,a){function i(t){return s&&c.callbacks[t]&&"function"==typeof c.callbacks[t]}function l(){return[c.callbacks.alwaysTriggerOffsets||v>=T+x,c.callbacks.alwaysTriggerOffsets||-S>=v]}function r(){var t=[h[0].offsetTop,h[0].offsetLeft],n=[h.height(),h.width()],o=[u.height(),u.width()];e[0].mts={content:h,top:t[0],left:t[1],topPct:Math.round(100*Math.abs(t[0])/(Math.abs(n[0])-o[0])),leftPct:Math.round(100*Math.abs(t[1])/(Math.abs(n[1])-o[1])),direction:a.dir}}var s=e.data(o),c=s.opt,d={trigger:"internal",dir:"y",easing:"easeOut",dur:60*c.speed,overwrite:"all",callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},a=t.extend(d,a),u=t("#mTS_"+s.idx),h=t("#mTS_"+s.idx+"_container"),p=c.callbacks.onTotalScrollOffset?f._arr.call(e,c.callbacks.onTotalScrollOffset):[0,0],m=c.callbacks.onTotalScrollBackOffset?f._arr.call(e,c.callbacks.onTotalScrollBackOffset):[0,0];switch(s.trigger=a.trigger,(0!==u.scrollTop()||0!==u.scrollLeft())&&u.scrollTop(0).scrollLeft(0),a.dir){case"x":var _="left",v=h[0].offsetLeft,T=u.width()-h.width(),g=n,x=p[1],S=m[1],w=x>0?x:0,b=S>0?S:0;break;case"y":var _="top",v=h[0].offsetTop,T=u.height()-h.height(),g=n,x=p[0],S=m[0],w=x>0?x:0,b=S>0?S:0}g>=0?(g=0,f._buttonsVisibility.call(e,!1,1,a.dir)):T>=g?(g=T,f._buttonsVisibility.call(e,!1,2,a.dir)):(g=g,f._buttonsVisibility.call(e,!1,0,a.dir)),e[0].mts||(r(),i("onInit")&&c.callbacks.onInit.call(e[0])),clearTimeout(h[0].onCompleteTimeout),(s.tweenRunning||!(0===v&&g>=0||v===T&&T>=g))&&f._tweenTo.call(null,h[0],_,Math.round(g),a.dur,a.easing,a.overwrite,{onStart:function(){a.callbacks&&a.onStart&&!s.tweenRunning&&(i("onScrollStart")&&(r(),c.callbacks.onScrollStart.call(e[0])),s.tweenRunning=!0,s.cbOffsets=l())},onUpdate:function(){a.callbacks&&a.onUpdate&&i("whileScrolling")&&(r(),c.callbacks.whileScrolling.call(e[0]))},onComplete:function(){if(a.callbacks&&a.onComplete){"yx"===c.axis&&clearTimeout(h[0].onCompleteTimeout);var t=h[0].idleTimer||0;h[0].onCompleteTimeout=setTimeout(function(){i("onScroll")&&(r(),c.callbacks.onScroll.call(e[0])),i("onTotalScroll")&&T+w>=g&&s.cbOffsets[0]&&(r(),c.callbacks.onTotalScroll.call(e[0])),i("onTotalScrollBack")&&g>=-b&&s.cbOffsets[1]&&(r(),c.callbacks.onTotalScrollBack.call(e[0])),s.tweenRunning=!1,h[0].idleTimer=0},t)}}})},_tweenTo:function(t,n,a,o,i,l,r){function s(){b.stop||(x||_.call(),x=f._getTime()-g,c(),x>=b.time&&(b.time=x>b.time?x+p-(x-b.time):x+p-1,b.time<x+1&&(b.time=x+1)),b.time<o?b.id=m(s):T.call())}function c(){o>0?(b.currVal=h(b.time,S,y,o,i),w[n]=Math.round(b.currVal)+"px"):w[n]=a+"px",v.call()}function d(){p=1e3/60,b.time=x+p,m=e.requestAnimationFrame?e.requestAnimationFrame:function(t){return c(),setTimeout(t,.01)},b.id=m(s)}function u(){null!=b.id&&(e.requestAnimationFrame?e.cancelAnimationFrame(b.id):clearTimeout(b.id),b.id=null)}function h(t,e,n,a,o){switch(o){case"linear":return n*t/a+e;case"linearOut":return t/=a,t--,n*Math.sqrt(1-t*t)+e;case"easeInOutSmooth":return t/=a/2,1>t?n/2*t*t+e:(t--,-n/2*(t*(t-2)-1)+e);case"easeInOutStrong":return t/=a/2,1>t?n/2*Math.pow(2,10*(t-1))+e:(t--,n/2*(-Math.pow(2,-10*t)+2)+e);case"easeInOut":return t/=a/2,1>t?n/2*t*t*t+e:(t-=2,n/2*(t*t*t+2)+e);case"easeOutSmooth":return t/=a,t--,-n*(t*t*t*t-1)+e;case"easeOutStrong":return n*(-Math.pow(2,-10*t/a)+1)+e;case"easeOut":default:var i=(t/=a)*t,l=i*t;return e+n*(.499999999999997*l*i+-2.5*i*i+5.5*l+-6.5*i+4*t)}}t._malihuTween||(t._malihuTween={top:{},left:{}});var p,m,r=r||{},_=r.onStart||function(){},v=r.onUpdate||function(){},T=r.onComplete||function(){},g=f._getTime(),x=0,S=t.offsetTop,w=t.style,b=t._malihuTween[n];"left"===n&&(S=t.offsetLeft);var y=a-S;b.stop=0,"none"!==l&&u(),d()},_getTime:function(){return e.performance&&e.performance.now?e.performance.now():e.performance&&e.performance.webkitNow?e.performance.webkitNow():Date.now?Date.now():(new Date).getTime()},_stopTween:function(){var t=this;t._malihuTween||(t._malihuTween={top:{},left:{}}),t._malihuTween.top.id&&(e.requestAnimationFrame?e.cancelAnimationFrame(t._malihuTween.top.id):clearTimeout(t._malihuTween.top.id),t._malihuTween.top.id=null,t._malihuTween.top.stop=1),t._malihuTween.left.id&&(e.requestAnimationFrame?e.cancelAnimationFrame(t._malihuTween.left.id):clearTimeout(t._malihuTween.left.id),t._malihuTween.left.id=null,t._malihuTween.left.stop=1)},_delete:function(t){try{delete t}catch(e){t=null}},_mouseBtnLeft:function(t){return!(t.which&&1!==t.which)},_pointerTouch:function(t){var e=t.originalEvent.pointerType;return!(e&&"touch"!==e&&2!==e)},_isNumeric:function(t){return!isNaN(parseFloat(t))&&isFinite(t)}};t.fn[a]=function(e){return h[e]?h[e].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof e&&e?void t.error("Method "+e+" does not exist"):h.init.apply(this,arguments)},t[a]=function(e){return h[e]?h[e].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof e&&e?void t.error("Method "+e+" does not exist"):h.init.apply(this,arguments)},t[a].defaults=l,e[a]=!0,t(e).load(function(){var e=t(i),n=[];if(e.length){e.each(function(){var e=t(this),a=e.data("mts-axis")||l.axis,i=e.data("mts-type")||l.type,r=e.data("mts-theme")||l.theme,s="auto-"+o+"-"+a+"-"+i+"-"+r,c=[s,a,i];e.addClass(s),-1===t.inArray(s,n)&&n.push(c)});for(var r=0;r<n.length;r++)t("."+n[r][0])[a]({axis:n[r][1],type:n[r][2]})}})}(jQuery,window,document);