mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-30 17:07:04 +01:00
1 line
42 KiB
JavaScript
1 line
42 KiB
JavaScript
(function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"undefined"!=typeof module&&module.exports?module.exports=n:n(jQuery,window,document)})(function(n){(function(u){var g="function"==typeof define&&define.amd,_="undefined"!=typeof module&&module.exports,S="https:"==document.location.protocol?"https:":"http:";g||(_?require("jquery-mousewheel")(n):n.event.special.mousewheel||n("head").append(decodeURI("%3Cscript src="+S+"//"+"cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js"+"%3E%3C/script%3E"))),u()})(function(){var k,u="mCustomScrollbar",g="mCS",_=".mCustomScrollbar",S={setTop:0,setLeft:0,axis:"y",scrollbarPosition:"inside",scrollInertia:950,autoDraggerLength:!0,alwaysShowScrollbar:0,snapOffset:0,mouseWheel:{enable:!0,scrollAmount:"auto",axis:"y",deltaFactor:"auto",disableOver:["select","option","keygen","datalist","textarea"]},scrollButtons:{scrollType:"stepless",scrollAmount:"auto"},keyboard:{enable:!0,scrollType:"stepless",scrollAmount:"auto"},contentTouchScroll:25,documentTouchScroll:!0,advanced:{autoScrollOnFocus:"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']",updateOnContentResize:!0,updateOnImageLoad:"auto",autoUpdateTimeout:60},theme:"light",callbacks:{onTotalScrollOffset:0,onTotalScrollBackOffset:0,alwaysTriggerOffsets:!0}},v=0,C={},B=window.attachEvent&&!window.addEventListener?1:0,T=!1,O=["mCSB_dragger_onDrag","mCSB_scrollTools_onDrag","mCS_img_loaded","mCS_disabled","mCS_destroyed","mCS_no_scrollbar","mCS-autoHide","mCS-dir-rtl","mCS_no_scrollbar_y","mCS_no_scrollbar_x","mCS_y_hidden","mCS_x_hidden","mCSB_draggerContainer","mCSB_buttonUp","mCSB_buttonDown","mCSB_buttonLeft","mCSB_buttonRight"],D={init:function(ye){var ye=n.extend(!0,{},S,ye),Be=E.call(this);if(ye.live){var Te=ye.liveSelector||this.selector||_,ke=n(Te);if("off"===ye.live)return void I(Te);C[Te]=setTimeout(function(){ke.mCustomScrollbar(ye),"once"===ye.live&&ke.length&&I(Te)},500)}else I(Te);return ye.setWidth=ye.set_width?ye.set_width:ye.setWidth,ye.setHeight=ye.set_height?ye.set_height:ye.setHeight,ye.axis=ye.horizontalScroll?"x":R(ye.axis),ye.scrollInertia=0<ye.scrollInertia&&17>ye.scrollInertia?17:ye.scrollInertia,"object"!=typeof ye.mouseWheel&&!0==ye.mouseWheel&&(ye.mouseWheel={enable:!0,scrollAmount:"auto",axis:"y",preventDefault:!1,deltaFactor:"auto",normalizeDelta:!1,invert:!1}),ye.mouseWheel.scrollAmount=ye.mouseWheelPixels?ye.mouseWheelPixels:ye.mouseWheel.scrollAmount,ye.mouseWheel.normalizeDelta=ye.advanced.normalizeMouseWheelDelta?ye.advanced.normalizeMouseWheelDelta:ye.mouseWheel.normalizeDelta,ye.scrollButtons.scrollType=L(ye.scrollButtons.scrollType),W(ye),n(Be).each(function(){var Oe=n(this);if(!Oe.data(g)){Oe.data(g,{idx:++v,opt:ye,scrollRatio:{y:null,x:null},overflowed:null,contentReset:{y:null,x:null},bindEvents:!1,tweenRunning:!1,sequential:{},langDir:Oe.css("direction"),cbOffsets:null,trigger:null,poll:{size:{o:0,n:0},img:{o:0,n:0},change:{o:0,n:0}}});var De=Oe.data(g),Ee=De.opt,We=Oe.data("mcs-axis"),Ie=Oe.data("mcs-scrollbar-position"),Re=Oe.data("mcs-theme");We&&(Ee.axis=We),Ie&&(Ee.scrollbarPosition=Ie),Re&&(Ee.theme=Re,W(Ee)),A.call(this),De&&Ee.callbacks.onCreate&&"function"==typeof Ee.callbacks.onCreate&&Ee.callbacks.onCreate.call(this),n("#mCSB_"+De.idx+"_container img:not(."+O[2]+")").addClass(O[2]),D.update.call(null,Oe)}})},update:function(ye,Be){var Te=ye||E.call(this);return n(Te).each(function(){var ke=n(this);if(ke.data(g)){var Oe=ke.data(g),De=Oe.opt,Ee=n("#mCSB_"+Oe.idx+"_container"),We=n("#mCSB_"+Oe.idx),Ie=[n("#mCSB_"+Oe.idx+"_dragger_vertical"),n("#mCSB_"+Oe.idx+"_dragger_horizontal")];if(!Ee.length)return;Oe.tweenRunning&&pe(ke),Be&&Oe&&De.callbacks.onBeforeUpdate&&"function"==typeof De.callbacks.onBeforeUpdate&&De.callbacks.onBeforeUpdate.call(this),ke.hasClass(O[3])&&ke.removeClass(O[3]),ke.hasClass(O[4])&&ke.removeClass(O[4]),We.css("max-height","none"),We.height()!==ke.height()&&We.css("max-height",ke.height()),P.call(this),"y"===De.axis||De.advanced.autoExpandHorizontalScroll||Ee.css("width",z(Ee)),Oe.overflowed=q.call(this),N.call(this),De.autoDraggerLength&&M.call(this),U.call(this),X.call(this);var Re=[Math.abs(Ee[0].offsetTop),Math.abs(Ee[0].offsetLeft)];"x"!==De.axis&&(Oe.overflowed[0]?Ie[0].height()>Ie[0].parent().height()?Y.call(this):(fe(ke,Re[0].toString(),{dir:"y",dur:0,overwrite:"none"}),Oe.contentReset.y=null):(Y.call(this),"y"===De.axis?j.call(this):"yx"===De.axis&&Oe.overflowed[1]&&fe(ke,Re[1].toString(),{dir:"x",dur:0,overwrite:"none"}))),"y"!==De.axis&&(Oe.overflowed[1]?Ie[1].width()>Ie[1].parent().width()?Y.call(this):(fe(ke,Re[1].toString(),{dir:"x",dur:0,overwrite:"none"}),Oe.contentReset.x=null):(Y.call(this),"x"===De.axis?j.call(this):"yx"===De.axis&&Oe.overflowed[0]&&fe(ke,Re[0].toString(),{dir:"y",dur:0,overwrite:"none"}))),Be&&Oe&&(2===Be&&De.callbacks.onImageLoad&&"function"==typeof De.callbacks.onImageLoad?De.callbacks.onImageLoad.call(this):3===Be&&De.callbacks.onSelectorChange&&"function"==typeof De.callbacks.onSelectorChange?De.callbacks.onSelectorChange.call(this):De.callbacks.onUpdate&&"function"==typeof De.callbacks.onUpdate&&De.callbacks.onUpdate.call(this)),ue.call(this)}})},scrollTo:function(ye,Be){if("undefined"!=typeof ye&&null!=ye){var Te=E.call(this);return n(Te).each(function(){var ke=n(this);if(ke.data(g)){var Oe=ke.data(g),De=Oe.opt,Ee={trigger:"external",scrollInertia:De.scrollInertia,scrollEasing:"mcsEaseInOut",moveDragger:!1,timeout:60,callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},We=n.extend(!0,{},Ee,Be),Ie=de.call(this,ye),Re=0<We.scrollInertia&&17>We.scrollInertia?17:We.scrollInertia;Ie[0]=ce.call(this,Ie[0],"y"),Ie[1]=ce.call(this,Ie[1],"x"),We.moveDragger&&(Ie[0]*=Oe.scrollRatio.y,Ie[1]*=Oe.scrollRatio.x),We.dur=Ce()?0:Re,setTimeout(function(){null!==Ie[0]&&"undefined"!=typeof Ie[0]&&"x"!==De.axis&&Oe.overflowed[0]&&(We.dir="y",We.overwrite="all",fe(ke,Ie[0].toString(),We)),null!==Ie[1]&&"undefined"!=typeof Ie[1]&&"y"!==De.axis&&Oe.overflowed[1]&&(We.dir="x",We.overwrite="none",fe(ke,Ie[1].toString(),We))},We.timeout)}})}},stop:function(){var ye=E.call(this);return n(ye).each(function(){var Be=n(this);Be.data(g)&&pe(Be)})},disable:function(ye){var Be=E.call(this);return n(Be).each(function(){var Te=n(this);if(Te.data(g)){Te.data(g);ue.call(this,"remove"),j.call(this),ye&&Y.call(this),N.call(this,!0),Te.addClass(O[3])}})},destroy:function(){var ye=E.call(this);return n(ye).each(function(){var Be=n(this);if(Be.data(g)){var Te=Be.data(g),ke=Te.opt,Oe=n("#mCSB_"+Te.idx),De=n("#mCSB_"+Te.idx+"_container"),Ee=n(".mCSB_"+Te.idx+"_scrollbar");ke.live&&I(ke.liveSelector||n(ye).selector),ue.call(this,"remove"),j.call(this),Y.call(this),Be.removeData(g),_e(this,"mcs"),Ee.remove(),De.find("img."+O[2]).removeClass(O[2]),Oe.replaceWith(De.contents()),Be.removeClass(u+" _"+g+"_"+Te.idx+" "+O[6]+" "+O[7]+" "+O[5]+" "+O[3]).addClass(O[4])}})}},E=function(){return"object"!=typeof n(this)||1>n(this).length?_:this},W=function(ye){ye.autoDraggerLength=!(-1<n.inArray(ye.theme,["rounded","rounded-dark","rounded-dots","rounded-dots-dark"]))&&ye.autoDraggerLength,ye.autoExpandScrollbar=!(-1<n.inArray(ye.theme,["rounded-dots","rounded-dots-dark","3d","3d-dark","3d-thick","3d-thick-dark","inset","inset-dark","inset-2","inset-2-dark","inset-3","inset-3-dark"]))&&ye.autoExpandScrollbar,ye.scrollButtons.enable=!(-1<n.inArray(ye.theme,["minimal","minimal-dark"]))&&ye.scrollButtons.enable,ye.autoHideScrollbar=!!(-1<n.inArray(ye.theme,["minimal","minimal-dark"]))||ye.autoHideScrollbar,ye.scrollbarPosition=-1<n.inArray(ye.theme,["minimal","minimal-dark"])?"outside":ye.scrollbarPosition},I=function(ye){C[ye]&&(clearTimeout(C[ye]),_e(C,ye))},R=function(ye){return"yx"===ye||"xy"===ye||"auto"===ye?"yx":"x"===ye||"horizontal"===ye?"x":"y"},L=function(ye){return"stepped"===ye||"pixels"===ye||"step"===ye||"click"===ye?"stepped":"stepless"},A=function(){var ye=n(this),Be=ye.data(g),Te=Be.opt,ke=Te.autoExpandScrollbar?" "+O[1]+"_expand":"",Oe=["<div id='mCSB_"+Be.idx+"_scrollbar_vertical' class='mCSB_scrollTools mCSB_"+Be.idx+"_scrollbar mCS-"+Te.theme+" mCSB_scrollTools_vertical"+ke+"'><div class='"+O[12]+"'><div id='mCSB_"+Be.idx+"_dragger_vertical' class='mCSB_dragger' style='position:absolute;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>","<div id='mCSB_"+Be.idx+"_scrollbar_horizontal' class='mCSB_scrollTools mCSB_"+Be.idx+"_scrollbar mCS-"+Te.theme+" mCSB_scrollTools_horizontal"+ke+"'><div class='"+O[12]+"'><div id='mCSB_"+Be.idx+"_dragger_horizontal' class='mCSB_dragger' style='position:absolute;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>"],De="yx"===Te.axis?"mCSB_vertical_horizontal":"x"===Te.axis?"mCSB_horizontal":"mCSB_vertical",Ee="yx"===Te.axis?Oe[0]+Oe[1]:"x"===Te.axis?Oe[1]:Oe[0],We="yx"===Te.axis?"<div id='mCSB_"+Be.idx+"_container_wrapper' class='mCSB_container_wrapper' />":"",Ie=Te.autoHideScrollbar?" "+O[6]:"",Re="x"!==Te.axis&&"rtl"===Be.langDir?" "+O[7]:"";Te.setWidth&&ye.css("width",Te.setWidth),Te.setHeight&&ye.css("height",Te.setHeight),Te.setLeft="y"!==Te.axis&&"rtl"===Be.langDir?"989999px":Te.setLeft,ye.addClass(u+" _"+g+"_"+Be.idx+Ie+Re).wrapInner("<div id='mCSB_"+Be.idx+"' class='mCustomScrollBox mCS-"+Te.theme+" "+De+"'><div id='mCSB_"+Be.idx+"_container' class='mCSB_container' style='position:relative; top:"+Te.setTop+"; left:"+Te.setLeft+";' dir='"+Be.langDir+"' /></div>");var Le=n("#mCSB_"+Be.idx),Ae=n("#mCSB_"+Be.idx+"_container");"y"===Te.axis||Te.advanced.autoExpandHorizontalScroll||Ae.css("width",z(Ae)),"outside"===Te.scrollbarPosition?("static"===ye.css("position")&&ye.css("position","relative"),ye.css("overflow","visible"),Le.addClass("mCSB_outside").after(Ee)):(Le.addClass("mCSB_inside").append(Ee),Ae.wrap(We)),H.call(this);var ze=[n("#mCSB_"+Be.idx+"_dragger_vertical"),n("#mCSB_"+Be.idx+"_dragger_horizontal")];ze[0].css("min-height",ze[0].height()),ze[1].css("min-width",ze[1].width())},z=function(ye){var Be=[ye[0].scrollWidth,Math.max.apply(Math,ye.children().map(function(){return n(this).outerWidth(!0)}).get())],Te=ye.parent().width();return Be[0]>Te?Be[0]:Be[1]>Te?Be[1]:"100%"},P=function(){var ye=n(this),Be=ye.data(g),Te=Be.opt,ke=n("#mCSB_"+Be.idx+"_container");if(Te.advanced.autoExpandHorizontalScroll&&"y"!==Te.axis){ke.css({width:"auto","min-width":0,"overflow-x":"scroll"});var Oe=Math.ceil(ke[0].scrollWidth);3===Te.advanced.autoExpandHorizontalScroll||2!==Te.advanced.autoExpandHorizontalScroll&&Oe>ke.parent().width()?ke.css({width:Oe,"min-width":"100%","overflow-x":"inherit"}):ke.css({"overflow-x":"inherit",position:"absolute"}).wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />").css({width:Math.ceil(ke[0].getBoundingClientRect().right+0.4)-Math.floor(ke[0].getBoundingClientRect().left),"min-width":"100%",position:"relative"}).unwrap()}},H=function(){var ye=n(this),Be=ye.data(g),Te=Be.opt,ke=n(".mCSB_"+Be.idx+"_scrollbar:first"),Oe=be(Te.scrollButtons.tabindex)?"tabindex='"+Te.scrollButtons.tabindex+"'":"",De=["<a href='#' class='"+O[13]+"' "+Oe+" />","<a href='#' class='"+O[14]+"' "+Oe+" />","<a href='#' class='"+O[15]+"' "+Oe+" />","<a href='#' class='"+O[16]+"' "+Oe+" />"],Ee=["x"===Te.axis?De[2]:De[0],"x"===Te.axis?De[3]:De[1],De[2],De[3]];Te.scrollButtons.enable&&ke.prepend(Ee[0]).append(Ee[1]).next(".mCSB_scrollTools").prepend(Ee[2]).append(Ee[3])},M=function(){var ye=n(this),Be=ye.data(g),Te=n("#mCSB_"+Be.idx),ke=n("#mCSB_"+Be.idx+"_container"),Oe=[n("#mCSB_"+Be.idx+"_dragger_vertical"),n("#mCSB_"+Be.idx+"_dragger_horizontal")],De=[Te.height()/ke.outerHeight(!1),Te.width()/ke.outerWidth(!1)],Ee=[parseInt(Oe[0].css("min-height")),Math.round(De[0]*Oe[0].parent().height()),parseInt(Oe[1].css("min-width")),Math.round(De[1]*Oe[1].parent().width())],We=B&&Ee[1]<Ee[0]?Ee[0]:Ee[1],Ie=B&&Ee[3]<Ee[2]?Ee[2]:Ee[3];Oe[0].css({height:We,"max-height":Oe[0].parent().height()-10}).find(".mCSB_dragger_bar").css({"line-height":Ee[0]+"px"}),Oe[1].css({width:Ie,"max-width":Oe[1].parent().width()-10})},U=function(){var ye=n(this),Be=ye.data(g),Te=n("#mCSB_"+Be.idx),ke=n("#mCSB_"+Be.idx+"_container"),Oe=[n("#mCSB_"+Be.idx+"_dragger_vertical"),n("#mCSB_"+Be.idx+"_dragger_horizontal")],De=[ke.outerHeight(!1)-Te.height(),ke.outerWidth(!1)-Te.width()],Ee=[De[0]/(Oe[0].parent().height()-Oe[0].height()),De[1]/(Oe[1].parent().width()-Oe[1].width())];Be.scrollRatio={y:Ee[0],x:Ee[1]}},F=function(ye,Be,Te){var ke=Te?O[0]+"_expanded":"",Oe=ye.closest(".mCSB_scrollTools");"active"===Be?(ye.toggleClass(O[0]+" "+ke),Oe.toggleClass(O[1]),ye[0]._draggable=ye[0]._draggable?0:1):!ye[0]._draggable&&("hide"===Be?(ye.removeClass(O[0]),Oe.removeClass(O[1])):(ye.addClass(O[0]),Oe.addClass(O[1])))},q=function(){var ye=n(this),Be=ye.data(g),Te=n("#mCSB_"+Be.idx),ke=n("#mCSB_"+Be.idx+"_container"),Oe=null==Be.overflowed?ke.height():ke.outerHeight(!1),De=null==Be.overflowed?ke.width():ke.outerWidth(!1),Ee=ke[0].scrollHeight,We=ke[0].scrollWidth;return Ee>Oe&&(Oe=Ee),We>De&&(De=We),[Oe>Te.height(),De>Te.width()]},Y=function(){var ye=n(this),Be=ye.data(g),Te=Be.opt,ke=n("#mCSB_"+Be.idx),Oe=n("#mCSB_"+Be.idx+"_container"),De=[n("#mCSB_"+Be.idx+"_dragger_vertical"),n("#mCSB_"+Be.idx+"_dragger_horizontal")];if(pe(ye),("x"!==Te.axis&&!Be.overflowed[0]||"y"===Te.axis&&Be.overflowed[0])&&(De[0].add(Oe).css("top",0),fe(ye,"_resetY")),"y"!==Te.axis&&!Be.overflowed[1]||"x"===Te.axis&&Be.overflowed[1]){var Ee=dx=0;"rtl"===Be.langDir&&(Ee=ke.width()-Oe.outerWidth(!1),dx=Math.abs(Ee/Be.scrollRatio.x)),Oe.css("left",Ee),De[1].css("left",dx),fe(ye,"_resetX")}},X=function(){var ye=n(this),Be=ye.data(g),Te=Be.opt;if(!Be.bindEvents){if(K.call(this),Te.contentTouchScroll&&G.call(this),J.call(this),Te.mouseWheel.enable){function Oe(){ke=setTimeout(function(){n.event.special.mousewheel?(clearTimeout(ke),Z.call(ye[0])):Oe()},100)}var ke;Oe()}ae.call(this),ne.call(this),Te.advanced.autoScrollOnFocus&&le.call(this),Te.scrollButtons.enable&&ie.call(this),Te.keyboard.enable&&re.call(this),Be.bindEvents=!0}},j=function(){var ye=n(this),Be=ye.data(g),Te=Be.opt,ke=g+"_"+Be.idx,Oe=".mCSB_"+Be.idx+"_scrollbar",De=n("#mCSB_"+Be.idx+",#mCSB_"+Be.idx+"_container,#mCSB_"+Be.idx+"_container_wrapper,"+Oe+" ."+O[12]+",#mCSB_"+Be.idx+"_dragger_vertical,#mCSB_"+Be.idx+"_dragger_horizontal,"+Oe+">a"),Ee=n("#mCSB_"+Be.idx+"_container");if(Te.advanced.releaseDraggableSelectors&&De.add(n(Te.advanced.releaseDraggableSelectors)),Te.advanced.extraDraggableSelectors&&De.add(n(Te.advanced.extraDraggableSelectors)),Be.bindEvents){var We=ee()?top.document:document;n(document).add(n(We)).unbind("."+ke),De.each(function(){n(this).unbind("."+ke)}),clearTimeout(ye[0]._focusTimeout),_e(ye[0],"_focusTimeout"),clearTimeout(Be.sequential.step),_e(Be.sequential,"step"),clearTimeout(Ee[0].onCompleteTimeout),_e(Ee[0],"onCompleteTimeout"),Be.bindEvents=!1}},N=function(ye){var Be=n(this),Te=Be.data(g),ke=Te.opt,Oe=n("#mCSB_"+Te.idx+"_container_wrapper"),De=Oe.length?Oe:n("#mCSB_"+Te.idx+"_container"),Ee=[n("#mCSB_"+Te.idx+"_scrollbar_vertical"),n("#mCSB_"+Te.idx+"_scrollbar_horizontal")],We=[Ee[0].find(".mCSB_dragger"),Ee[1].find(".mCSB_dragger")];"x"!==ke.axis&&(Te.overflowed[0]&&!ye?(Ee[0].add(We[0]).add(Ee[0].children("a")).css("display","block"),De.removeClass(O[8]+" "+O[10])):(ke.alwaysShowScrollbar?(2!==ke.alwaysShowScrollbar&&We[0].css("display","none"),De.removeClass(O[10])):(Ee[0].css("display","none"),De.addClass(O[10])),De.addClass(O[8]))),"y"!==ke.axis&&(Te.overflowed[1]&&!ye?(Ee[1].add(We[1]).add(Ee[1].children("a")).css("display","block"),De.removeClass(O[9]+" "+O[11])):(ke.alwaysShowScrollbar?(2!==ke.alwaysShowScrollbar&&We[1].css("display","none"),De.removeClass(O[11])):(Ee[1].css("display","none"),De.addClass(O[11])),De.addClass(O[9]))),Te.overflowed[0]||Te.overflowed[1]?Be.removeClass(O[5]):Be.addClass(O[5])},V=function(ye){var Be=ye.type,Te=ye.target.ownerDocument!==document&&null!==frameElement?[n(frameElement).offset().top,n(frameElement).offset().left]:null,ke=ee()&&ye.target.ownerDocument!==top.document&&null!==frameElement?[n(ye.view.frameElement).offset().top,n(ye.view.frameElement).offset().left]:[0,0];switch(Be){case"pointerdown":case"MSPointerDown":case"pointermove":case"MSPointerMove":case"pointerup":case"MSPointerUp":return Te?[ye.originalEvent.pageY-Te[0]+ke[0],ye.originalEvent.pageX-Te[1]+ke[1],!1]:[ye.originalEvent.pageY,ye.originalEvent.pageX,!1];break;case"touchstart":case"touchmove":case"touchend":var Oe=ye.originalEvent.touches[0]||ye.originalEvent.changedTouches[0],De=ye.originalEvent.touches.length||ye.originalEvent.changedTouches.length;return ye.target.ownerDocument===document?[Oe.pageY,Oe.pageX,1<De]:[Oe.screenY,Oe.screenX,1<De];break;default:return Te?[ye.pageY-Te[0]+ke[0],ye.pageX-Te[1]+ke[1],!1]:[ye.pageY,ye.pageX,!1];}},K=function(){function ye(He,Me,Ue,Fe){if(Ee[0].idleTimer=233>ke.scrollInertia?250:0,Ie.attr("id")===De[1])var qe="x",Ye=(Ie[0].offsetLeft-Me+Fe)*Te.scrollRatio.x;else var qe="y",Ye=(Ie[0].offsetTop-He+Ue)*Te.scrollRatio.y;fe(Be,Ye.toString(),{dir:qe,drag:!0})}var Ie,Re,Le,Be=n(this),Te=Be.data(g),ke=Te.opt,Oe=g+"_"+Te.idx,De=["mCSB_"+Te.idx+"_dragger_vertical","mCSB_"+Te.idx+"_dragger_horizontal"],Ee=n("#mCSB_"+Te.idx+"_container"),We=n("#"+De[0]+",#"+De[1]),Ae=ke.advanced.releaseDraggableSelectors?We.add(n(ke.advanced.releaseDraggableSelectors)):We,ze=ee()?top.document:document,Pe=ke.advanced.extraDraggableSelectors?n(ze).add(n(ke.advanced.extraDraggableSelectors)):n(ze);We.bind("contextmenu."+Oe,function(He){He.preventDefault()}).bind("mousedown."+Oe+" touchstart."+Oe+" pointerdown."+Oe+" MSPointerDown."+Oe,function(He){if(He.stopImmediatePropagation(),He.preventDefault(),!!Se(He)){T=!0,B&&(document.onselectstart=function(){return!1}),te.call(Ee,!1),pe(Be),Ie=n(this);var Me=Ie.offset(),Ue=V(He)[0]-Me.top,Fe=V(He)[1]-Me.left,qe=Ie.height()+Me.top,Ye=Ie.width()+Me.left;Ue<qe&&0<Ue&&Fe<Ye&&0<Fe&&(Re=Ue,Le=Fe),F(Ie,"active",ke.autoExpandScrollbar)}}).bind("touchmove."+Oe,function(He){He.stopImmediatePropagation(),He.preventDefault();var Me=Ie.offset(),Ue=V(He)[0]-Me.top,Fe=V(He)[1]-Me.left;ye(Re,Le,Ue,Fe)}),n(document).add(Pe).bind("mousemove."+Oe+" pointermove."+Oe+" MSPointerMove."+Oe,function(He){if(Ie){var Me=Ie.offset(),Ue=V(He)[0]-Me.top,Fe=V(He)[1]-Me.left;if(Re===Ue&&Le===Fe)return;ye(Re,Le,Ue,Fe)}}).add(Ae).bind("mouseup."+Oe+" touchend."+Oe+" pointerup."+Oe+" MSPointerUp."+Oe,function(){Ie&&(F(Ie,"active",ke.autoExpandScrollbar),Ie=null),T=!1,B&&(document.onselectstart=null),te.call(Ee,!0)})},G=function(){function ye(nt){if(!ve(nt)||T||V(nt)[2])return void(k=0);k=1,et=0,tt=0,Pe=1,Ee.removeClass("mCS_touch_action");var it=Ae.offset();He=V(nt)[0]-it.top,Me=V(nt)[1]-it.left,Qe=[V(nt)[0],V(nt)[1]]}function Be(nt){if(!(!ve(nt)||T||V(nt)[2])&&(Ie.documentTouchScroll||nt.preventDefault(),nt.stopImmediatePropagation(),!tt||et)&&Pe){je=ge();var it=Le.offset(),rt=V(nt)[0]-it.top,st=V(nt)[1]-it.left,dt="mcsLinearOut";if(qe.push(rt),Ye.push(st),Qe[2]=Math.abs(V(nt)[0]-Qe[0]),Qe[3]=Math.abs(V(nt)[1]-Qe[1]),We.overflowed[0])var ct=ze[0].parent().height()-ze[0].height(),ut=0<He-rt&&rt-He>-(ct*We.scrollRatio.y)&&(2*Qe[3]<Qe[2]||"yx"===Ie.axis);if(We.overflowed[1])var mt=ze[1].parent().width()-ze[1].width(),pt=0<Me-st&&st-Me>-(mt*We.scrollRatio.x)&&(2*Qe[2]<Qe[3]||"yx"===Ie.axis);ut||pt?(!lt&&nt.preventDefault(),et=1):(tt=1,Ee.addClass("mCS_touch_action")),lt&&nt.preventDefault(),Ge="yx"===Ie.axis?[He-rt,Me-st]:"x"===Ie.axis?[null,Me-st]:[He-rt,null],Ae[0].idleTimer=250,We.overflowed[0]&&De(Ge[0],Je,dt,"y","all",!0),We.overflowed[1]&&De(Ge[1],Je,dt,"x",$e,!0)}}function Te(nt){if(!ve(nt)||T||V(nt)[2])return void(k=0);k=1,nt.stopImmediatePropagation(),pe(Ee),Xe=ge();var it=Le.offset();Ue=V(nt)[0]-it.top,Fe=V(nt)[1]-it.left,qe=[],Ye=[]}function ke(nt){if(!(!ve(nt)||T||V(nt)[2])){Pe=0,nt.stopImmediatePropagation(),et=0,tt=0,Ne=ge();var it=Le.offset(),rt=V(nt)[0]-it.top,st=V(nt)[1]-it.left;if(!(30<Ne-je)){Ke=1e3/(Ne-Xe);var dt="mcsEaseOut",ct=2.5>Ke,ut=ct?[qe[qe.length-2],Ye[Ye.length-2]]:[0,0];Ve=ct?[rt-ut[0],st-ut[1]]:[rt-Ue,st-Fe];var mt=[Math.abs(Ve[0]),Math.abs(Ve[1])];Ke=ct?[Math.abs(Ve[0]/4),Math.abs(Ve[1]/4)]:[Ke,Ke];var pt=[Math.abs(Ae[0].offsetTop)-Ve[0]*Oe(mt[0]/Ke[0],Ke[0]),Math.abs(Ae[0].offsetLeft)-Ve[1]*Oe(mt[1]/Ke[1],Ke[1])];Ge="yx"===Ie.axis?[pt[0],pt[1]]:"x"===Ie.axis?[null,pt[1]]:[pt[0],null],Ze=[4*mt[0]+Ie.scrollInertia,4*mt[1]+Ie.scrollInertia];var ft=parseInt(Ie.contentTouchScroll)||0;Ge[0]=mt[0]>ft?Ge[0]:0,Ge[1]=mt[1]>ft?Ge[1]:0,We.overflowed[0]&&De(Ge[0],Ze[0],dt,"y",$e,!1),We.overflowed[1]&&De(Ge[1],Ze[1],dt,"x",$e,!1)}}}function Oe(nt,it){var rt=[1.5*it,2*it,it/1.5,it/2];return 90<nt?4<it?rt[0]:rt[3]:60<nt?3<it?rt[3]:rt[2]:30<nt?8<it?rt[1]:6<it?rt[0]:4<it?it:rt[2]:8<it?it:rt[3]}function De(nt,it,rt,st,dt,ct){nt&&fe(Ee,nt.toString(),{dur:it,scrollEasing:rt,dir:st,overwrite:dt,drag:ct})}var Pe,He,Me,Ue,Fe,Xe,je,Ne,Ve,Ke,Ge,Ze,et,tt,Ee=n(this),We=Ee.data(g),Ie=We.opt,Re=g+"_"+We.idx,Le=n("#mCSB_"+We.idx),Ae=n("#mCSB_"+We.idx+"_container"),ze=[n("#mCSB_"+We.idx+"_dragger_vertical"),n("#mCSB_"+We.idx+"_dragger_horizontal")],qe=[],Ye=[],Je=0,$e="yx"===Ie.axis?"none":"all",Qe=[],ot=Ae.find("iframe"),at=["touchstart."+Re+" pointerdown."+Re+" MSPointerDown."+Re,"touchmove."+Re+" pointermove."+Re+" MSPointerMove."+Re,"touchend."+Re+" pointerup."+Re+" MSPointerUp."+Re],lt=document.body.style.touchAction!==void 0&&""!==document.body.style.touchAction;Ae.bind(at[0],function(nt){ye(nt)}).bind(at[1],function(nt){Be(nt)}),Le.bind(at[0],function(nt){Te(nt)}).bind(at[2],function(nt){ke(nt)}),ot.length&&ot.each(function(){n(this).bind("load",function(){ee(this)&&n(this.contentDocument||this.contentWindow.document).bind(at[0],function(nt){ye(nt),Te(nt)}).bind(at[1],function(nt){Be(nt)}).bind(at[2],function(nt){ke(nt)})})})},J=function(){function ye(){return window.getSelection?window.getSelection().toString():document.selection&&"Control"!=document.selection.type?document.selection.createRange().text:0}function Be(Le,Ae,ze){De.type=ze&&Re?"stepped":"stepless",De.scrollAmount=10,se(Te,Le,Ae,"mcsLinearOut",ze?60:null)}var Re,Te=n(this),ke=Te.data(g),Oe=ke.opt,De=ke.sequential,Ee=g+"_"+ke.idx,We=n("#mCSB_"+ke.idx+"_container"),Ie=We.parent();We.bind("mousedown."+Ee,function(){k||!Re&&(Re=1,T=!0)}).add(document).bind("mousemove."+Ee,function(Le){if(!k&&Re&&ye()){var Ae=We.offset(),ze=V(Le)[0]-Ae.top+We[0].offsetTop,Pe=V(Le)[1]-Ae.left+We[0].offsetLeft;0<ze&&ze<Ie.height()&&0<Pe&&Pe<Ie.width()?De.step&&Be("off",null,"stepped"):("x"!==Oe.axis&&ke.overflowed[0]&&(0>ze?Be("on",38):ze>Ie.height()&&Be("on",40)),"y"!==Oe.axis&&ke.overflowed[1]&&(0>Pe?Be("on",37):Pe>Ie.width()&&Be("on",39)))}}).bind("mouseup."+Ee+" dragend."+Ee,function(){k||(Re&&(Re=0,Be("off",null)),T=!1)})},Z=function(){function ye(Ie,Re){if(pe(Be),!oe(Be,Ie.target)){var Le="auto"===ke.mouseWheel.deltaFactor?B&&100>Ie.deltaFactor?100:Ie.deltaFactor||100:parseInt(ke.mouseWheel.deltaFactor),Ae=ke.scrollInertia;if("x"===ke.axis||"x"===ke.mouseWheel.axis)var ze="x",Pe=[Math.round(Le*Te.scrollRatio.x),parseInt(ke.mouseWheel.scrollAmount)],He="auto"===ke.mouseWheel.scrollAmount?Pe[0]>=De.width()?0.9*De.width():Pe[0]:Pe[1],Me=Math.abs(n("#mCSB_"+Te.idx+"_container")[0].offsetLeft),Ue=Ee[1][0].offsetLeft,Fe=Ee[1].parent().width()-Ee[1].width(),qe="y"===ke.mouseWheel.axis?Ie.deltaY||Re:Ie.deltaX;else var ze="y",Pe=[Math.round(Le*Te.scrollRatio.y),parseInt(ke.mouseWheel.scrollAmount)],He="auto"===ke.mouseWheel.scrollAmount?Pe[0]>=De.height()?0.9*De.height():Pe[0]:Pe[1],Me=Math.abs(n("#mCSB_"+Te.idx+"_container")[0].offsetTop),Ue=Ee[0][0].offsetTop,Fe=Ee[0].parent().height()-Ee[0].height(),qe=Ie.deltaY||Re;("y"!=ze||Te.overflowed[0])&&("x"!=ze||Te.overflowed[1])&&((ke.mouseWheel.invert||Ie.webkitDirectionInvertedFromDevice)&&(qe=-qe),ke.mouseWheel.normalizeDelta&&(qe=0>qe?-1:1),(0<qe&&0!==Ue||0>qe&&Ue!==Fe||ke.mouseWheel.preventDefault)&&(Ie.stopImmediatePropagation(),Ie.preventDefault()),5>Ie.deltaFactor&&!ke.mouseWheel.normalizeDelta&&(He=Ie.deltaFactor,Ae=17),fe(Be,(Me-qe*He).toString(),{dir:ze,dur:Ae}))}}if(n(this).data(g)){var Be=n(this),Te=Be.data(g),ke=Te.opt,Oe=g+"_"+Te.idx,De=n("#mCSB_"+Te.idx),Ee=[n("#mCSB_"+Te.idx+"_dragger_vertical"),n("#mCSB_"+Te.idx+"_dragger_horizontal")],We=n("#mCSB_"+Te.idx+"_container").find("iframe");We.length&&We.each(function(){n(this).bind("load",function(){ee(this)&&n(this.contentDocument||this.contentWindow.document).bind("mousewheel."+Oe,function(Ie,Re){ye(Ie,Re)})})}),De.bind("mousewheel."+Oe,function(Ie,Re){ye(Ie,Re)})}},Q={},ee=function(ye){var Be=!1,Te=!1,ke=null;if(void 0===ye?Te="#empty":void 0!==n(ye).attr("id")&&(Te=n(ye).attr("id")),!1!=Te&&void 0!==Q[Te])return Q[Te];if(!ye){try{var Oe=top.document;ke=Oe.body.innerHTML}catch(De){}Be=null!==ke}else{try{var Oe=ye.contentDocument||ye.contentWindow.document;ke=Oe.body.innerHTML}catch(De){}Be=null!==ke}return!1!=Te&&(Q[Te]=Be),Be},te=function(ye){var Be=this.find("iframe");if(Be.length){var Te=ye?"auto":"none";Be.css("pointer-events",Te)}},oe=function(ye,Be){var Te=Be.nodeName.toLowerCase(),ke=ye.data(g).opt.mouseWheel.disableOver;return-1<n.inArray(Te,ke)&&(!(-1<n.inArray(Te,["select","textarea"]))||n(Be).is(":focus"))},ae=function(){var Ee,ye=n(this),Be=ye.data(g),Te=g+"_"+Be.idx,ke=n("#mCSB_"+Be.idx+"_container"),Oe=ke.parent(),De=n(".mCSB_"+Be.idx+"_scrollbar ."+O[12]);De.bind("mousedown."+Te+" touchstart."+Te+" pointerdown."+Te+" MSPointerDown."+Te,function(We){T=!0,n(We.target).hasClass("mCSB_dragger")||(Ee=1)}).bind("touchend."+Te+" pointerup."+Te+" MSPointerUp."+Te,function(){T=!1}).bind("click."+Te,function(We){if(Ee&&(Ee=0,n(We.target).hasClass(O[12])||n(We.target).hasClass("mCSB_draggerRail"))){pe(ye);var Ie=n(this),Re=Ie.find(".mCSB_dragger");if(0<Ie.parent(".mCSB_scrollTools_horizontal").length){if(!Be.overflowed[1])return;var Le="x",Ae=We.pageX>Re.offset().left?-1:1,ze=Math.abs(ke[0].offsetLeft)-Ae*(0.9*Oe.width())}else{if(!Be.overflowed[0])return;var Le="y",Ae=We.pageY>Re.offset().top?-1:1,ze=Math.abs(ke[0].offsetTop)-Ae*(0.9*Oe.height())}fe(ye,ze.toString(),{dir:Le,scrollEasing:"mcsEaseInOut"})}})},le=function(){var ye=n(this),Be=ye.data(g),Te=Be.opt,ke=g+"_"+Be.idx,Oe=n("#mCSB_"+Be.idx+"_container"),De=Oe.parent();Oe.bind("focusin."+ke,function(){var We=n(document.activeElement),Ie=Oe.find(".mCustomScrollBox").length,Re=0;We.is(Te.advanced.autoScrollOnFocus)&&(pe(ye),clearTimeout(ye[0]._focusTimeout),ye[0]._focusTimer=Ie?(Re+17)*Ie:0,ye[0]._focusTimeout=setTimeout(function(){var Le=[we(We)[0],we(We)[1]],Ae=[Oe[0].offsetTop,Oe[0].offsetLeft],ze=[0<=Ae[0]+Le[0]&&Ae[0]+Le[0]<De.height()-We.outerHeight(!1),0<=Ae[1]+Le[1]&&Ae[0]+Le[1]<De.width()-We.outerWidth(!1)],Pe="yx"!==Te.axis||ze[0]||ze[1]?"all":"none";"x"===Te.axis||ze[0]||fe(ye,Le[0].toString(),{dir:"y",scrollEasing:"mcsEaseInOut",overwrite:Pe,dur:Re}),"y"===Te.axis||ze[1]||fe(ye,Le[1].toString(),{dir:"x",scrollEasing:"mcsEaseInOut",overwrite:Pe,dur:Re})},ye[0]._focusTimer))})},ne=function(){var ye=n(this),Be=ye.data(g),Te=g+"_"+Be.idx,ke=n("#mCSB_"+Be.idx+"_container").parent();ke.bind("scroll."+Te,function(){(0!==ke.scrollTop()||0!==ke.scrollLeft())&&n(".mCSB_"+Be.idx+"_scrollbar").css("visibility","hidden")})},ie=function(){var ye=n(this),Be=ye.data(g),Te=Be.opt,ke=Be.sequential,Oe=g+"_"+Be.idx,De=".mCSB_"+Be.idx+"_scrollbar",Ee=n(De+">a");Ee.bind("contextmenu."+Oe,function(We){We.preventDefault()}).bind("mousedown."+Oe+" touchstart."+Oe+" pointerdown."+Oe+" MSPointerDown."+Oe+" mouseup."+Oe+" touchend."+Oe+" pointerup."+Oe+" MSPointerUp."+Oe+" mouseout."+Oe+" pointerout."+Oe+" MSPointerOut."+Oe+" click."+Oe,function(We){function Ie(Le,Ae){ke.scrollAmount=Te.scrollButtons.scrollAmount,se(ye,Le,Ae)}if(We.preventDefault(),!!Se(We)){var Re=n(this).attr("class");switch(ke.type=Te.scrollButtons.scrollType,We.type){case"mousedown":case"touchstart":case"pointerdown":case"MSPointerDown":if("stepped"===ke.type)return;T=!0,Be.tweenRunning=!1,Ie("on",Re);break;case"mouseup":case"touchend":case"pointerup":case"MSPointerUp":case"mouseout":case"pointerout":case"MSPointerOut":if("stepped"===ke.type)return;T=!1,ke.dir&&Ie("off",Re);break;case"click":if("stepped"!==ke.type||Be.tweenRunning)return;Ie("on",Re);}}})},re=function(){function ye(ze){function Pe(Ye,Xe){Oe.type=ke.keyboard.scrollType,Oe.scrollAmount=ke.keyboard.scrollAmount;"stepped"===Oe.type&&Te.tweenRunning||se(Be,Ye,Xe)}switch(ze.type){case"blur":Te.tweenRunning&&Oe.dir&&Pe("off",null);break;case"keydown":case"keyup":var He=ze.keyCode?ze.keyCode:ze.which,Me="on";if("x"!==ke.axis&&(38===He||40===He)||"y"!==ke.axis&&(37===He||39===He)){if((38===He||40===He)&&!Te.overflowed[0]||(37===He||39===He)&&!Te.overflowed[1])return;"keyup"===ze.type&&(Me="off"),n(document.activeElement).is(Re)||(ze.preventDefault(),ze.stopImmediatePropagation(),Pe(Me,He))}else if(33===He||34===He){if((Te.overflowed[0]||Te.overflowed[1])&&(ze.preventDefault(),ze.stopImmediatePropagation()),"keyup"===ze.type){pe(Be);var Ue=34===He?-1:1;if("x"===ke.axis||"yx"===ke.axis&&Te.overflowed[1]&&!Te.overflowed[0])var Fe="x",qe=Math.abs(We[0].offsetLeft)-Ue*(0.9*Ie.width());else var Fe="y",qe=Math.abs(We[0].offsetTop)-Ue*(0.9*Ie.height());fe(Be,qe.toString(),{dir:Fe,scrollEasing:"mcsEaseInOut"})}}else if((35===He||36===He)&&!n(document.activeElement).is(Re)&&((Te.overflowed[0]||Te.overflowed[1])&&(ze.preventDefault(),ze.stopImmediatePropagation()),"keyup"===ze.type)){if("x"===ke.axis||"yx"===ke.axis&&Te.overflowed[1]&&!Te.overflowed[0])var Fe="x",qe=35===He?Math.abs(Ie.width()-We.outerWidth(!1)):0;else var Fe="y",qe=35===He?Math.abs(Ie.height()-We.outerHeight(!1)):0;fe(Be,qe.toString(),{dir:Fe,scrollEasing:"mcsEaseInOut"})}}}var Be=n(this),Te=Be.data(g),ke=Te.opt,Oe=Te.sequential,De=g+"_"+Te.idx,Ee=n("#mCSB_"+Te.idx),We=n("#mCSB_"+Te.idx+"_container"),Ie=We.parent(),Re="input,textarea,select,datalist,keygen,[contenteditable='true']",Le=We.find("iframe"),Ae=["blur."+De+" keydown."+De+" keyup."+De];Le.length&&Le.each(function(){n(this).bind("load",function(){ee(this)&&n(this.contentDocument||this.contentWindow.document).bind(Ae[0],function(ze){ye(ze)})})}),Ee.attr("tabindex","0").bind(Ae[0],function(ze){ye(ze)})},se=function(ye,Be,Te,ke,Oe){function De(He){Ie.snapAmount&&(Re.scrollAmount=Ie.snapAmount instanceof Array?"x"===Re.dir[0]?Ie.snapAmount[1]:Ie.snapAmount[0]:Ie.snapAmount);var Me="stepped"!==Re.type,Ue=Oe?Oe:He?Me?ze/1.5:Pe:1e3/60,Fe=He?Me?7.5:40:2.5,qe=[Math.abs(Le[0].offsetTop),Math.abs(Le[0].offsetLeft)],Ye=[10<We.scrollRatio.y?10:We.scrollRatio.y,10<We.scrollRatio.x?10:We.scrollRatio.x],Xe="x"===Re.dir[0]?qe[1]+Re.dir[1]*(Ye[1]*Fe):qe[0]+Re.dir[1]*(Ye[0]*Fe),je="x"===Re.dir[0]?qe[1]+Re.dir[1]*parseInt(Re.scrollAmount):qe[0]+Re.dir[1]*parseInt(Re.scrollAmount),Ne="auto"===Re.scrollAmount?Xe:je,Ve=ke?ke:He?Me?"mcsLinearOut":"mcsEaseInOut":"mcsLinear";return He&&17>Ue&&(Ne="x"===Re.dir[0]?qe[1]:qe[0]),fe(ye,Ne.toString(),{dir:Re.dir[0],scrollEasing:Ve,dur:Ue,onComplete:!!He}),He?void(Re.dir=!1):void(clearTimeout(Re.step),Re.step=setTimeout(function(){De()},Ue))}function Ee(){clearTimeout(Re.step),_e(Re,"step"),pe(ye)}var We=ye.data(g),Ie=We.opt,Re=We.sequential,Le=n("#mCSB_"+We.idx+"_container"),Ae=!("stepped"!==Re.type),ze=26>Ie.scrollInertia?26:Ie.scrollInertia,Pe=1>Ie.scrollInertia?17:Ie.scrollInertia;switch(Be){case"on":if(Re.dir=[Te===O[16]||Te===O[15]||39===Te||37===Te?"x":"y",Te===O[13]||Te===O[15]||38===Te||37===Te?-1:1],pe(ye),be(Te)&&"stepped"===Re.type)return;De(Ae);break;case"off":Ee(),(Ae||We.tweenRunning&&Re.dir)&&De(!0);}},de=function(ye){var Be=n(this).data(g).opt,Te=[];return"function"==typeof ye&&(ye=ye()),ye instanceof Array?Te=1<ye.length?[ye[0],ye[1]]:"x"===Be.axis?[null,ye[0]]:[ye[0],null]:(Te[0]=ye.y?ye.y:ye.x||"x"===Be.axis?null:ye,Te[1]=ye.x?ye.x:ye.y||"y"===Be.axis?null:ye),"function"==typeof Te[0]&&(Te[0]=Te[0]()),"function"==typeof Te[1]&&(Te[1]=Te[1]()),Te},ce=function(ye,Be){if(null!=ye&&"undefined"!=typeof ye){var Te=n(this),ke=Te.data(g),Oe=ke.opt,De=n("#mCSB_"+ke.idx+"_container"),Ee=De.parent();Be||(Be="x"===Oe.axis?"x":"y");var Ie="x"===Be?De.outerWidth(!1)-Ee.width():De.outerHeight(!1)-Ee.height(),Re="x"===Be?De[0].offsetLeft:De[0].offsetTop,Le="x"===Be?"left":"top";switch(typeof ye){case"function":return ye();break;case"object":var Ae=ye.jquery?ye:n(ye);return Ae.length?"x"===Be?we(Ae)[1]:we(Ae)[0]:void 0;break;case"string":case"number":if(be(ye))return Math.abs(ye);if(-1!==ye.indexOf("%"))return Math.abs(Ie*parseInt(ye)/100);if(-1!==ye.indexOf("-="))return Math.abs(Re-parseInt(ye.split("-=")[1]));if(-1!==ye.indexOf("+=")){var ze=Re+parseInt(ye.split("+=")[1]);return 0<=ze?0:Math.abs(ze)}if(-1!==ye.indexOf("px")&&be(ye.split("px")[0]))return Math.abs(ye.split("px")[0]);if("top"===ye||"left"===ye)return 0;if("bottom"===ye)return Math.abs(Ee.height()-De.outerHeight(!1));if("right"===ye)return Math.abs(Ee.width()-De.outerWidth(!1));if("first"===ye||"last"===ye){var Ae=De.find(":"+ye);return"x"===Be?we(Ae)[1]:we(Ae)[0]}return n(ye).length?"x"===Be?we(n(ye))[1]:we(n(ye))[0]:(De.css(Le,ye),void D.update.call(null,Te[0]));}}},ue=function(ye){function Be(){return clearTimeout(Ie[0].autoUpdate),0===De.parents("html").length?void(De=null):void(Ie[0].autoUpdate=setTimeout(function(){return We.advanced.updateOnSelectorChange&&(Ee.poll.change.n=ke(),Ee.poll.change.n!==Ee.poll.change.o)?(Ee.poll.change.o=Ee.poll.change.n,void Oe(3)):We.advanced.updateOnContentResize&&(Ee.poll.size.n=De[0].scrollHeight+De[0].scrollWidth+Ie[0].offsetHeight+De[0].offsetHeight+De[0].offsetWidth,Ee.poll.size.n!==Ee.poll.size.o)?(Ee.poll.size.o=Ee.poll.size.n,void Oe(1)):We.advanced.updateOnImageLoad&&("auto"!==We.advanced.updateOnImageLoad||"y"!==We.axis)&&(Ee.poll.img.n=Ie.find("img").length,Ee.poll.img.n!==Ee.poll.img.o)?(Ee.poll.img.o=Ee.poll.img.n,void Ie.find("img").each(function(){Te(this)})):void((We.advanced.updateOnSelectorChange||We.advanced.updateOnContentResize||We.advanced.updateOnImageLoad)&&Be())},We.advanced.autoUpdateTimeout))}function Te(Re){if(n(Re).hasClass(O[2]))return void Oe();var ze=new Image;ze.onload=function(Pe,He){return function(){return He.apply(Pe,arguments)}}(ze,function(){this.onload=null,n(Re).addClass(O[2]),Oe(2)}),ze.src=Re.src}function ke(){!0===We.advanced.updateOnSelectorChange&&(We.advanced.updateOnSelectorChange="*");var Re=0,Le=Ie.find(We.advanced.updateOnSelectorChange);return We.advanced.updateOnSelectorChange&&0<Le.length&&Le.each(function(){Re+=this.offsetHeight+this.offsetWidth}),Re}function Oe(Re){clearTimeout(Ie[0].autoUpdate),D.update.call(null,De[0],Re)}var De=n(this),Ee=De.data(g),We=Ee.opt,Ie=n("#mCSB_"+Ee.idx+"_container");return ye?(clearTimeout(Ie[0].autoUpdate),void _e(Ie[0],"autoUpdate")):void Be()},me=function(ye,Be,Te){return Math.round(ye/Be)*Be-Te},pe=function(ye){var Be=ye.data(g),Te=n("#mCSB_"+Be.idx+"_container,#mCSB_"+Be.idx+"_container_wrapper,#mCSB_"+Be.idx+"_dragger_vertical,#mCSB_"+Be.idx+"_dragger_horizontal");Te.each(function(){xe.call(this)})},fe=function(ye,Be,Te){function ke(Ge){return Ee&&We.callbacks[Ge]&&"function"==typeof We.callbacks[Ge]}function Oe(){return[We.callbacks.alwaysTriggerOffsets||qe>=Ye[0]+je,We.callbacks.alwaysTriggerOffsets||qe<=-Ne]}function De(){var Ge=[Ae[0].offsetTop,Ae[0].offsetLeft],Je=[Ue[0].offsetTop,Ue[0].offsetLeft],Ze=[Ae.outerHeight(!1),Ae.outerWidth(!1)],$e=[Le.height(),Le.width()];ye[0].mcs={content:Ae,top:Ge[0],left:Ge[1],draggerTop:Je[0],draggerLeft:Je[1],topPct:Math.round(100*Math.abs(Ge[0])/(Math.abs(Ze[0])-$e[0])),leftPct:Math.round(100*Math.abs(Ge[1])/(Math.abs(Ze[1])-$e[1])),direction:Te.dir}}var Ee=ye.data(g),We=Ee.opt,Ie={trigger:"internal",dir:"y",scrollEasing:"mcsEaseOut",drag:!1,dur:We.scrollInertia,overwrite:"all",callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},Te=n.extend(Ie,Te),Re=[Te.dur,Te.drag?0:Te.dur],Le=n("#mCSB_"+Ee.idx),Ae=n("#mCSB_"+Ee.idx+"_container"),ze=Ae.parent(),Pe=We.callbacks.onTotalScrollOffset?de.call(ye,We.callbacks.onTotalScrollOffset):[0,0],He=We.callbacks.onTotalScrollBackOffset?de.call(ye,We.callbacks.onTotalScrollBackOffset):[0,0];if(Ee.trigger=Te.trigger,(0!==ze.scrollTop()||0!==ze.scrollLeft())&&(n(".mCSB_"+Ee.idx+"_scrollbar").css("visibility","visible"),ze.scrollTop(0).scrollLeft(0)),"_resetY"!==Be||Ee.contentReset.y||(ke("onOverflowYNone")&&We.callbacks.onOverflowYNone.call(ye[0]),Ee.contentReset.y=1),"_resetX"!==Be||Ee.contentReset.x||(ke("onOverflowXNone")&&We.callbacks.onOverflowXNone.call(ye[0]),Ee.contentReset.x=1),"_resetY"!==Be&&"_resetX"!==Be){if((Ee.contentReset.y||!ye[0].mcs)&&Ee.overflowed[0]&&(ke("onOverflowY")&&We.callbacks.onOverflowY.call(ye[0]),Ee.contentReset.x=null),(Ee.contentReset.x||!ye[0].mcs)&&Ee.overflowed[1]&&(ke("onOverflowX")&&We.callbacks.onOverflowX.call(ye[0]),Ee.contentReset.x=null),We.snapAmount){var Me=We.snapAmount instanceof Array?"x"===Te.dir?We.snapAmount[1]:We.snapAmount[0]:We.snapAmount;Be=me(Be,Me,We.snapOffset)}switch(Te.dir){case"x":var Ue=n("#mCSB_"+Ee.idx+"_dragger_horizontal"),Fe="left",qe=Ae[0].offsetLeft,Ye=[Le.width()-Ae.outerWidth(!1),Ue.parent().width()-Ue.width()],Xe=[Be,0===Be?0:Be/Ee.scrollRatio.x],je=Pe[1],Ne=He[1],Ve=0<je?je/Ee.scrollRatio.x:0,Ke=0<Ne?Ne/Ee.scrollRatio.x:0;break;case"y":var Ue=n("#mCSB_"+Ee.idx+"_dragger_vertical"),Fe="top",qe=Ae[0].offsetTop,Ye=[Le.height()-Ae.outerHeight(!1),Ue.parent().height()-Ue.height()],Xe=[Be,0===Be?0:Be/Ee.scrollRatio.y],je=Pe[0],Ne=He[0],Ve=0<je?je/Ee.scrollRatio.y:0,Ke=0<Ne?Ne/Ee.scrollRatio.y:0;}0>Xe[1]||0===Xe[0]&&0===Xe[1]?Xe=[0,0]:Xe[1]>=Ye[1]?Xe=[Ye[0],Ye[1]]:Xe[0]=-Xe[0],ye[0].mcs||(De(),ke("onInit")&&We.callbacks.onInit.call(ye[0])),clearTimeout(Ae[0].onCompleteTimeout),he(Ue[0],Fe,Math.round(Xe[1]),Re[1],Te.scrollEasing),!Ee.tweenRunning&&(0===qe&&0<=Xe[0]||qe===Ye[0]&&Xe[0]<=Ye[0])||he(Ae[0],Fe,Math.round(Xe[0]),Re[0],Te.scrollEasing,Te.overwrite,{onStart:function(){Te.callbacks&&Te.onStart&&!Ee.tweenRunning&&(ke("onScrollStart")&&(De(),We.callbacks.onScrollStart.call(ye[0])),Ee.tweenRunning=!0,F(Ue),Ee.cbOffsets=Oe())},onUpdate:function(){Te.callbacks&&Te.onUpdate&&ke("whileScrolling")&&(De(),We.callbacks.whileScrolling.call(ye[0]))},onComplete:function(){if(Te.callbacks&&Te.onComplete){"yx"===We.axis&&clearTimeout(Ae[0].onCompleteTimeout);var Ge=Ae[0].idleTimer||0;Ae[0].onCompleteTimeout=setTimeout(function(){ke("onScroll")&&(De(),We.callbacks.onScroll.call(ye[0])),ke("onTotalScroll")&&Xe[1]>=Ye[1]-Ve&&Ee.cbOffsets[0]&&(De(),We.callbacks.onTotalScroll.call(ye[0])),ke("onTotalScrollBack")&&Xe[1]<=Ke&&Ee.cbOffsets[1]&&(De(),We.callbacks.onTotalScrollBack.call(ye[0])),Ee.tweenRunning=!1,Ae[0].idleTimer=0,F(Ue,"hide")},Ge)}}})}},he=function(ye,Be,Te,ke,Oe,De,Ee){function We(){je.stop||(!Fe&&ze.call(),Fe=ge()-Me,Ie(),Fe>=je.time&&(je.time=Fe>je.time?Fe+Ue-(Fe-je.time):Fe+Ue-1,je.time<Fe+1&&(je.time=Fe+1)),je.time<ke?je.id=Xe(We):He.call())}function Ie(){0<ke?(je.currVal=Ae(je.time,qe,Ne,ke,Oe),Ye[Be]=Math.round(je.currVal)+"px"):Ye[Be]=Te+"px",Pe.call()}function Ae(Ve,Ke,Ge,Je,Ze){switch(Ze){case"linear":case"mcsLinear":return Ge*Ve/Je+Ke;break;case"mcsLinearOut":return Ve/=Je,Ve--,Ge*Math.sqrt(1-Ve*Ve)+Ke;break;case"easeInOutSmooth":return(Ve/=Je/2,1>Ve)?Ge/2*Ve*Ve+Ke:(Ve--,-Ge/2*(Ve*(Ve-2)-1)+Ke);break;case"easeInOutStrong":return(Ve/=Je/2,1>Ve)?Ge/2*Math.pow(2,10*(Ve-1))+Ke:(Ve--,Ge/2*(-Math.pow(2,-10*Ve)+2)+Ke);break;case"easeInOut":case"mcsEaseInOut":return(Ve/=Je/2,1>Ve)?Ge/2*Ve*Ve*Ve+Ke:(Ve-=2,Ge/2*(Ve*Ve*Ve+2)+Ke);break;case"easeOutSmooth":return Ve/=Je,Ve--,-Ge*(Ve*Ve*Ve*Ve-1)+Ke;break;case"easeOutStrong":return Ge*(-Math.pow(2,-10*Ve/Je)+1)+Ke;break;case"easeOut":case"mcsEaseOut":default:var $e=(Ve/=Je)*Ve,Qe=$e*Ve;return Ke+Ge*(0.499999999999997*Qe*$e+-2.5*$e*$e+5.5*Qe+-6.5*$e+4*Ve);}}ye._mTween||(ye._mTween={top:{},left:{}});var Ue,Xe,Ee=Ee||{},ze=Ee.onStart||function(){},Pe=Ee.onUpdate||function(){},He=Ee.onComplete||function(){},Me=ge(),Fe=0,qe=ye.offsetTop,Ye=ye.style,je=ye._mTween[Be];"left"===Be&&(qe=ye.offsetLeft);var Ne=Te-qe;je.stop=0,"none"!==De&&function(){null==je.id||(window.requestAnimationFrame?window.cancelAnimationFrame(je.id):clearTimeout(je.id),je.id=null)}(),function(){Ue=1e3/60,je.time=Fe+Ue,Xe=window.requestAnimationFrame?window.requestAnimationFrame:function(Ve){return Ie(),setTimeout(Ve,0.01)},je.id=Xe(We)}()},ge=function(){return window.performance&&window.performance.now?window.performance.now():window.performance&&window.performance.webkitNow?window.performance.webkitNow():Date.now?Date.now():new Date().getTime()},xe=function(){var ye=this;ye._mTween||(ye._mTween={top:{},left:{}});for(var ke,Be=["top","left"],Te=0;Te<Be.length;Te++)ke=Be[Te],ye._mTween[ke].id&&(window.requestAnimationFrame?window.cancelAnimationFrame(ye._mTween[ke].id):clearTimeout(ye._mTween[ke].id),ye._mTween[ke].id=null,ye._mTween[ke].stop=1)},_e=function(ye,Be){try{delete ye[Be]}catch(Te){ye[Be]=null}},Se=function(ye){return!(ye.which&&1!==ye.which)},ve=function(ye){var Be=ye.originalEvent.pointerType;return!(Be&&"touch"!==Be&&2!==Be)},be=function(ye){return!isNaN(parseFloat(ye))&&isFinite(ye)},we=function(ye){var Be=ye.parents(".mCSB_container");return[ye.offset().top-Be.offset().top,ye.offset().left-Be.offset().left]},Ce=function(){var Be=function(){var Te=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var ke=0;ke<Te.length;ke++)if(Te[ke]+"Hidden"in document)return Te[ke]+"Hidden";return null}();return!!Be&&document[Be]};n.fn[u]=function(ye){if(D[ye])return D[ye].apply(this,Array.prototype.slice.call(arguments,1));return"object"!=typeof ye&&ye?void n.error("Method "+ye+" does not exist"):D.init.apply(this,arguments)},n[u]=function(ye){if(D[ye])return D[ye].apply(this,Array.prototype.slice.call(arguments,1));return"object"!=typeof ye&&ye?void n.error("Method "+ye+" does not exist"):D.init.apply(this,arguments)},n[u].defaults=S,window[u]=!0,n(window).bind("load",function(){n(_)[u](),n.extend(n.expr[":"],{mcsInView:n.expr[":"].mcsInView||function(ye){var ke,Oe,Be=n(ye),Te=Be.parents(".mCSB_container");if(Te.length)return ke=Te.parent(),Oe=[Te[0].offsetTop,Te[0].offsetLeft],0<=Oe[0]+we(Be)[0]&&Oe[0]+we(Be)[0]<ke.height()-Be.outerHeight(!1)&&0<=Oe[1]+we(Be)[1]&&Oe[1]+we(Be)[1]<ke.width()-Be.outerWidth(!1)},mcsInSight:n.expr[":"].mcsInSight||function(ye,Be,Te){var Oe,Ee,We,Ie,ke=n(ye),De=ke.parents(".mCSB_container"),Re="exact"===Te[3]?[[1,0],[1,0]]:[[0.9,0.1],[0.6,0.4]];if(De.length)return Oe=[ke.outerHeight(!1),ke.outerWidth(!1)],We=[De[0].offsetTop+we(ke)[0],De[0].offsetLeft+we(ke)[1]],Ee=[De.parent()[0].offsetHeight,De.parent()[0].offsetWidth],Ie=[Oe[0]<Ee[0]?Re[0]:Re[1],Oe[1]<Ee[1]?Re[0]:Re[1]],0>We[0]-Ee[0]*Ie[0][0]&&0<=We[0]+Oe[0]-Ee[0]*Ie[0][1]&&0>We[1]-Ee[1]*Ie[1][0]&&0<=We[1]+Oe[1]-Ee[1]*Ie[1][1]},mcsOverflow:n.expr[":"].mcsOverflow||function(ye){var Be=n(ye).data(g);return Be?Be.overflowed[0]||Be.overflowed[1]:void 0}})})})}); |