diff --git a/demo/js/jquery.nicescroll.min.js b/demo/js/jquery.nicescroll.min.js new file mode 100644 index 0000000..9602845 --- /dev/null +++ b/demo/js/jquery.nicescroll.min.js @@ -0,0 +1,2 @@ +/* nicescroll v3.7.2 InuYaksa - MIT - https://nicescroll.areaaperta.com */ +!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,n=0,s=e,l=s(window),a=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||!1}(),c=function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||!1}();if(a)window.cancelAnimationFrame||(c=function(e){});else{var d=0;a=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-d)),i=window.setTimeout(function(){e(t+r)},r);return d=t+r,i},c=function(e){window.clearTimeout(e)}}var u=window.MutationObserver||window.WebKitMutationObserver||!1,h=Date.now||function(){return(new Date).getTime()},p={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:60,mousescrollstep:24,touchbehavior:!1,emulatetouch:!1,hwacceleration:!0,usetransition:!0,boxzoom:!1,dblclickzoom:!0,gesturezoom:!0,grabcursorenabled:!0,autohidemode:!0,background:"",iframeautoresize:!0,cursorminheight:32,preservenativescrolling:!0,railoffset:!1,railhoffset:!1,bouncescroll:!0,spacebarenabled:!0,railpadding:{top:0,right:0,left:0,bottom:0},disableoutline:!0,horizrailenabled:!0,railalign:"right",railvalign:"bottom",enabletranslate3d:!0,enablemousewheel:!0,enablekeyboard:!0,smoothscroll:!0,sensitiverail:!0,enablemouselockapi:!0,cursorfixedheight:!1,directionlockdeadzone:6,hidecursordelay:400,nativeparentscrolling:!0,enablescrollonselection:!0,overflowx:!0,overflowy:!0,cursordragspeed:.3,rtlmode:"auto",cursordragontouch:!1,oneaxismousemode:"auto",scriptpath:function(){var e=document.currentScript||function(){var e=document.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},m=!1,f=function(){if(m)return m;var e=document.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in document||"webkitPointerLockElement"in document||"mozPointerLockElement"in document,i.isopera="opera"in window,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(window.operamini),i.isie="all"in document&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in document)||7===document.documentMode),i.isie8=i.isie&&"documentMode"in document&&8===document.documentMode,i.isie9=i.isie&&"performance"in window&&9===document.documentMode,i.isie10=i.isie&&"performance"in window&&10===document.documentMode,i.isie11="msRequestFullscreen"in e&&document.documentMode>=11,i.ismsedge="msCredentials"in window,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in window,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in document.documentElement||"ontouchstart"in window,i.hasw3ctouch=(window.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(window.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in document,i.isios8=i.isios&&"hidden"in document,i.isios10=i.isios&&window.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!=o)return parseInt(o);e=e.parent()}return!1}function v(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var n=3==(i=N[r]||0)?t?x.win.outerHeight()-x.win.innerHeight():x.win.outerWidth()-x.win.innerWidth():1;return x.isie8&&i&&(i+=1),n?i:0}return i}function b(e,o,t,r){x._bind(e,o,function(r){var i={original:r=r||window.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function y(e,o,t){var r,i;if(0==e.deltaMode?(r=-Math.floor(e.deltaX*(x.opt.mousescrollstep/54)),i=-Math.floor(e.deltaY*(x.opt.mousescrollstep/54))):1==e.deltaMode&&(r=-Math.floor(e.deltaX*x.opt.mousescrollstep),i=-Math.floor(e.deltaY*x.opt.mousescrollstep)),o&&x.opt.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?x.getScrollLeft()>=x.page.maxw:x.getScrollLeft()<=0)&&(i=r,r=0)),x.isrtlmode&&(r=-r),r){if(x.scrollmom)x.scrollmom.stop();else if(r<0){if(x.getScrollLeft()>=x.page.maxw)return!0}else if(x.getScrollLeft()<=0)return!0;x.lastdeltax+=r,x.debounced("mousewheelx",function(){var e=x.lastdeltax;x.lastdeltax=0,x.rail.drag||x.doScrollLeftBy(e)},15)}if(i){if(x.opt.nativeparentscrolling&&t&&!x.ispage&&!x.zoomactive)if(i<0){if(x.getScrollTop()>=x.page.maxh)return!0}else if(x.getScrollTop()<=0)return!0;x.scrollmom&&x.scrollmom.stop(),x.lastdeltay+=i,x.synched("mousewheely",function(){var e=x.lastdeltay;x.lastdeltay=0,x.rail.drag||x.doScrollBy(e)},15)}return e.stopImmediatePropagation(),e.preventDefault()}var x=this;this.version="3.7.2",this.name="nicescroll",this.me=d;var S=s("body");if(this.opt={doc:S,win:!1},s.extend(this.opt,p),this.opt.snapbackspeed=80,e)for(var z in x.opt)void 0!==e[z]&&(x.opt[z]=e[z]);if(x.opt.disablemutationobserver&&(u=!1),this.doc=x.opt.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(x.opt.win?x.opt.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==x.opt.win,this.win=x.opt.win||(this.ispage?l:this.doc),this.docscroll=this.ispage&&!this.haswrapper?l:this.win,this.body=S,this.viewport=!1,this.isfixed=!1,this.iframe=!1,this.isiframe="IFRAME"==this.doc[0].nodeName&&"IFRAME"==this.win[0].nodeName,this.istextarea="TEXTAREA"==this.win[0].nodeName,this.forcescreen=!1,this.canshowonmouseevent="scroll"!=x.opt.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==this.opt.rtlmode){var k=this.win[0]==window?this.body:this.win,T=k.css("writing-mode")||k.css("-webkit-writing-mode")||k.css("-ms-writing-mode")||k.css("-moz-writing-mode");"horizontal-tb"==T||"lr-tb"==T||""==T?(this.isrtlmode="rtl"==k.css("direction"),this.isvertical=!1):(this.isrtlmode="vertical-rl"==T||"tb"==T||"tb-rl"==T||"rl-tb"==T,this.isvertical="vertical-rl"==T||"tb"==T||"tb-rl"==T)}else this.isrtlmode=!0===this.opt.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1===x.opt.scrollbarid)do{this.id="ascrail"+i++}while(document.getElementById(this.id));else this.id=x.opt.scrollbarid;this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=x.opt.overflowx,this.overflowy=x.opt.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=f();var M=s.extend({},this.detected);this.canhwscroll=M.hastransform&&x.opt.hwacceleration,this.ishwscroll=this.canhwscroll&&x.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(M.iswebkit||M.isie||M.isie11):this.hasreversehr=!(M.iswebkit||M.isie&&!M.isie10&&!M.isie11):this.hasreversehr=!1,this.istouchcapable=!1,M.cantouch||!M.hasw3ctouch&&!M.hasmstouch?!M.cantouch||M.isios||M.isandroid||!M.iswebkit&&!M.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,x.opt.enablemouselockapi||(M.hasmousecapture=!1,M.haspointerlock=!1),this.debounced=function(e,o,t){x&&(x.delaylist[e]||!1||(x.delaylist[e]={h:a(function(){x.delaylist[e].fn.call(x),x.delaylist[e]=!1},t)},o.call(x)),x.delaylist[e].fn=o)};var E=!1;this.synched=function(e,o){return x.synclist[e]=o,function(){E||(a(function(){if(x){E=!1;for(var e in x.synclist){var o=x.synclist[e];o&&o.call(x),x.synclist[e]=!1}}}),E=!0)}(),e},this.unsynched=function(e){x.synclist[e]&&(x.synclist[e]=!1)},this.css=function(e,o){for(var t in o)x.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?x.getScrollTop():x.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?x.getScrollLeft():x.setScrollLeft(e)};var L=function(e,o,t,r,i,n,s){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=n||0,this.p4=s||1,this.ts=h(),this.df=this.ed-this.st};if(L.prototype={B2:function(e){return 3*e*e*(1-e)},B3:function(e){return 3*e*(1-e)*(1-e)},B4:function(e){return(1-e)*(1-e)*(1-e)},getNow:function(){var e=1-(h()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e<0?this.ed:this.st+Math.round(this.df*o)},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=h(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},M.hastranslate3d&&M.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=m();if(o)return 16==o.length?-o[13]:-o[5];if(x.timerscroll&&x.timerscroll.bz)return x.timerscroll.bz.getNow()}return x.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=m();if(o)return 16==o.length?-o[12]:-o[4];if(x.timerscroll&&x.timerscroll.bh)return x.timerscroll.bh.getNow()}return x.doc.translate.x},this.notifyScrollEvent=function(e){var o=document.createEvent("UIEvents");o.initUIEvent("scroll",!1,!0,window,1),o.niceevent=!0,e.dispatchEvent(o)};var C=this.isrtlmode?1:-1;M.hastranslate3d&&x.opt.enabletranslate3d?(this.setScrollTop=function(e,o){x.doc.translate.y=e,x.doc.translate.ty=-1*e+"px",x.doc.css(M.trstyle,"translate3d("+x.doc.translate.tx+","+x.doc.translate.ty+",0)"),o||x.notifyScrollEvent(x.win[0])},this.setScrollLeft=function(e,o){x.doc.translate.x=e,x.doc.translate.tx=e*C+"px",x.doc.css(M.trstyle,"translate3d("+x.doc.translate.tx+","+x.doc.translate.ty+",0)"),o||x.notifyScrollEvent(x.win[0])}):(this.setScrollTop=function(e,o){x.doc.translate.y=e,x.doc.translate.ty=-1*e+"px",x.doc.css(M.trstyle,"translate("+x.doc.translate.tx+","+x.doc.translate.ty+")"),o||x.notifyScrollEvent(x.win[0])},this.setScrollLeft=function(e,o){x.doc.translate.x=e,x.doc.translate.tx=e*C+"px",x.doc.css(M.trstyle,"translate("+x.doc.translate.tx+","+x.doc.translate.ty+")"),o||x.notifyScrollEvent(x.win[0])})}else this.getScrollTop=function(){return x.docscroll.scrollTop()},this.setScrollTop=function(e){return setTimeout(function(){x&&x.docscroll.scrollTop(e)},1)},this.getScrollLeft=function(){return x.hasreversehr?x.detected.ismozilla?x.page.maxw-Math.abs(x.docscroll.scrollLeft()):x.page.maxw-x.docscroll.scrollLeft():x.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(x)return x.hasreversehr&&(e=x.detected.ismozilla?-(x.page.maxw-e):x.page.maxw-e),x.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var N={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:window.pageYOffset||document.documentElement.scrollTop,left:window.pageXOffset||document.documentElement.scrollLeft}},this.getOffset=function(){if(x.isfixed){var e=x.win.offset(),o=x.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=x.win.offset();if(!x.viewport)return t;var r=x.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(x.ishwscroll)x.rail.css({height:x.win.innerHeight()-(x.opt.railpadding.top+x.opt.railpadding.bottom)}),x.railh&&x.railh.css({width:x.win.innerWidth()-(x.opt.railpadding.left+x.opt.railpadding.right)});else{var r=x.getOffset();if(o={top:r.top,left:r.left-(x.opt.railpadding.left+x.opt.railpadding.right)},o.top+=v(x.win,"border-top-width",!0),o.left+=x.rail.align?x.win.outerWidth()-v(x.win,"border-right-width")-x.rail.width:v(x.win,"border-left-width"),(t=x.opt.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),x.railslocked||x.rail.css({top:o.top,left:o.left,height:(e?e.h:x.win.innerHeight())-(x.opt.railpadding.top+x.opt.railpadding.bottom)}),x.zoom&&x.zoom.css({top:o.top+1,left:1==x.rail.align?o.left-20:o.left+x.rail.width+4}),x.railh&&!x.railslocked){o={top:r.top,left:r.left},(t=x.opt.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=x.railh.align?o.top+v(x.win,"border-top-width",!0)+x.win.innerHeight()-x.railh.height:o.top+v(x.win,"border-top-width",!0),n=o.left+v(x.win,"border-left-width");x.railh.css({top:i-(x.opt.railpadding.top+x.opt.railpadding.bottom),left:n,width:x.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,n,s;x.railslocked||(x.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+document.documentElement.scrollLeft,e.pageY=e.clientY+document.documentElement.scrollTop),o?(r=t?x.doScrollLeft:x.doScrollTop)(n=t?(e.pageX-x.railh.offset().left-x.cursorwidth/2)*x.scrollratio.x:(e.pageY-x.rail.offset().top-x.cursorheight/2)*x.scrollratio.y):(r=t?x.doScrollLeftBy:x.doScrollBy,n=t?x.scroll.x:x.scroll.y,s=t?e.pageX-x.railh.offset().left:e.pageY-x.rail.offset().top,i=t?x.view.w:x.view.h,r(n>=s?i:-i)))},x.hasanimationframe="requestAnimationFrame"in window,x.hascancelanimationframe="cancelAnimationFrame"in window,this.init=function(){if(x.saved.css=[],M.isoperamini)return!0;if(M.isandroid&&!("hidden"in document))return!0;x.opt.emulatetouch=x.opt.emulatetouch||x.opt.touchbehavior;var e={"overflow-y":"hidden"};if((M.isie11||M.isie10)&&(e["-ms-overflow-style"]="none"),x.zindex="auto",x.ispage||"auto"!=x.opt.zindex?x.zindex=x.opt.zindex:x.zindex=g()||"auto",!x.ispage&&"auto"!=x.zindex&&x.zindex>n&&(n=x.zindex),x.isie&&0==x.zindex&&"auto"==x.opt.zindex&&(x.zindex="auto"),!x.ispage||!M.cantouch&&!M.isieold){var i=x.docscroll;x.ispage&&(i=x.haswrapper?x.win:x.doc),x.css(i,e),x.ispage&&(M.isie11||M.isie)&&x.css(s("html"),e),!M.isios||x.ispage||x.haswrapper||x.css(S,{"-webkit-overflow-scrolling":"touch"});var a=s(document.createElement("div"));a.css({position:"relative",top:0,float:"right",width:x.opt.cursorwidth,height:0,"background-color":x.opt.cursorcolor,border:x.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":x.opt.cursorborderradius,"-moz-border-radius":x.opt.cursorborderradius,"border-radius":x.opt.cursorborderradius}),a.addClass("nicescroll-cursors"),x.cursor=a;var c=s(document.createElement("div"));c.attr("id",x.id),c.addClass("nicescroll-rails nicescroll-rails-vr");var d,h,p=["left","right","top","bottom"];for(var m in p)h=p[m],(d=x.opt.railpadding[h])?c.css("padding-"+h,d+"px"):x.opt.railpadding[h]=0;c.append(a),c.width=Math.max(parseFloat(x.opt.cursorwidth),a.outerWidth()),c.css({width:c.width+"px",zIndex:x.zindex,background:x.opt.background,cursor:"default"}),c.visibility=!0,c.scrollable=!0,c.align="left"==x.opt.railalign?0:1,x.rail=c,x.rail.drag=!1;var f=!1;!x.opt.boxzoom||x.ispage||M.isieold||(f=document.createElement("div"),x.bind(f,"click",x.doZoom),x.bind(f,"mouseenter",function(){x.zoom.css("opacity",x.opt.cursoropacitymax)}),x.bind(f,"mouseleave",function(){x.zoom.css("opacity",x.opt.cursoropacitymin)}),x.zoom=s(f),x.zoom.css({cursor:"pointer",zIndex:x.zindex,backgroundImage:"url("+x.opt.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),x.opt.dblclickzoom&&x.bind(x.win,"dblclick",x.doZoom),M.cantouch&&x.opt.gesturezoom&&(x.ongesturezoom=function(e){return e.scale>1.5&&x.doZoomIn(e),e.scale<.8&&x.doZoomOut(e),x.cancelEvent(e)},x.bind(x.win,"gestureend",x.ongesturezoom))),x.railh=!1;var v;if(x.opt.horizrailenabled&&(x.css(i,{overflowX:"hidden"}),(a=s(document.createElement("div"))).css({position:"absolute",top:0,height:x.opt.cursorwidth,width:0,backgroundColor:x.opt.cursorcolor,border:x.opt.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":x.opt.cursorborderradius,"-moz-border-radius":x.opt.cursorborderradius,"border-radius":x.opt.cursorborderradius}),M.isieold&&a.css("overflow","hidden"),a.addClass("nicescroll-cursors"),x.cursorh=a,(v=s(document.createElement("div"))).attr("id",x.id+"-hr"),v.addClass("nicescroll-rails nicescroll-rails-hr"),v.height=Math.max(parseFloat(x.opt.cursorwidth),a.outerHeight()),v.css({height:v.height+"px",zIndex:x.zindex,background:x.opt.background}),v.append(a),v.visibility=!0,v.scrollable=!0,v.align="top"==x.opt.railvalign?0:1,x.railh=v,x.railh.drag=!1),x.ispage)c.css({position:"fixed",top:0,height:"100%"}),c.align?c.css({right:0}):c.css({left:0}),x.body.append(c),x.railh&&(v.css({position:"fixed",left:0,width:"100%"}),v.align?v.css({bottom:0}):v.css({top:0}),x.body.append(v));else{if(x.ishwscroll){"static"==x.win.css("position")&&x.css(x.win,{position:"relative"});var b="HTML"==x.win[0].nodeName?x.body:x.win;s(b).scrollTop(0).scrollLeft(0),x.zoom&&(x.zoom.css({position:"absolute",top:1,right:0,"margin-right":c.width+4}),b.append(x.zoom)),c.css({position:"absolute",top:0}),c.align?c.css({right:0}):c.css({left:0}),b.append(c),v&&(v.css({position:"absolute",left:0,bottom:0}),v.align?v.css({bottom:0}):v.css({top:0}),b.append(v))}else{x.isfixed="fixed"==x.win.css("position");var y=x.isfixed?"fixed":"absolute";x.isfixed||(x.viewport=x.getViewport(x.win[0])),x.viewport&&(x.body=x.viewport,0==/fixed|absolute/.test(x.viewport.css("position"))&&x.css(x.viewport,{position:"relative"})),c.css({position:y}),x.zoom&&x.zoom.css({position:y}),x.updateScrollBar(),x.body.append(c),x.zoom&&x.body.append(x.zoom),x.railh&&(v.css({position:y}),x.body.append(v))}M.isios&&x.css(x.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),M.isie&&x.opt.disableoutline&&x.win.attr("hideFocus","true"),M.iswebkit&&x.opt.disableoutline&&x.win.css("outline","none")}if(!1===x.opt.autohidemode?(x.autohidedom=!1,x.rail.css({opacity:x.opt.cursoropacitymax}),x.railh&&x.railh.css({opacity:x.opt.cursoropacitymax})):!0===x.opt.autohidemode||"leave"===x.opt.autohidemode?(x.autohidedom=s().add(x.rail),M.isie8&&(x.autohidedom=x.autohidedom.add(x.cursor)),x.railh&&(x.autohidedom=x.autohidedom.add(x.railh)),x.railh&&M.isie8&&(x.autohidedom=x.autohidedom.add(x.cursorh))):"scroll"==x.opt.autohidemode?(x.autohidedom=s().add(x.rail),x.railh&&(x.autohidedom=x.autohidedom.add(x.railh))):"cursor"==x.opt.autohidemode?(x.autohidedom=s().add(x.cursor),x.railh&&(x.autohidedom=x.autohidedom.add(x.cursorh))):"hidden"==x.opt.autohidemode&&(x.autohidedom=!1,x.hide(),x.railslocked=!1),M.cantouch||x.istouchcapable||x.opt.emulatetouch||M.hasmstouch){x.scrollmom=new w(x),x.ontouchstart=function(e){if(e.pointerType&&2!=e.pointerType&&"touch"!=e.pointerType)return!1;if(x.hasmoving=!1,!x.railslocked){var o;if(M.hasmstouch)for(o=!!e.target&&e.target;o;){var t=s(o).getNiceScroll();if(t.length>0&&t[0].me==x.me)break;if(t.length>0)return!1;if("DIV"==o.nodeName&&o.id==x.id)break;o=!!o.parentNode&&o.parentNode}if(e.stopPropagation(),x.cancelScroll(),(o=x.getTarget(e))&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return x.stopPropagation(e);if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),x.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(x.rail.drag={x:e.clientX,y:e.clientY,sx:x.scroll.x,sy:x.scroll.y,st:x.getScrollTop(),sl:x.getScrollLeft(),pt:2,dl:!1,tg:o},x.ispage||!x.opt.directionlockdeadzone)x.rail.drag.dl="f";else{var i={w:l.width(),h:l.height()},n={w:Math.max(document.body.scrollWidth,document.documentElement.scrollWidth),h:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)},a=Math.max(0,n.h-i.h),c=Math.max(0,n.w-i.w);!x.rail.scrollable&&x.railh.scrollable?x.rail.drag.ck=a>0&&"v":x.rail.scrollable&&!x.railh.scrollable?x.rail.drag.ck=c>0&&"h":x.rail.drag.ck=!1,x.rail.drag.ck||(x.rail.drag.dl="f")}if(x.opt.emulatetouch&&x.isiframe&&M.isie){var d=x.win.position();x.rail.drag.x+=d.left,x.rail.drag.y+=d.top}if(x.hasmoving=!1,x.lastmouseup=!1,x.scrollmom.reset(e.clientX,e.clientY),!M.cantouch&&!this.istouchcapable&&!e.pointerType){if(!(!!o&&/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName)))return!x.ispage&&M.hasmousecapture&&o.setCapture(),x.opt.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(x.hasmoving)return!1;o._onclick.call(this,e)}),x.cancelEvent(e)):x.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(s(o).attr("type"))&&(x.preventclick={tg:o,click:!1})}}},x.ontouchend=function(e){if(!x.rail.drag)return!0;if(2==x.rail.drag.pt){if(e.pointerType&&2!=e.pointerType&&"touch"!=e.pointerType)return!1;if(x.rail.drag=!1,x.hasmoving&&(x.scrollmom.doMomentum(),x.lastmouseup=!0,x.hideCursor(),M.hasmousecapture&&document.releaseCapture(),!M.cantouch))return x.cancelEvent(e)}else if(1==x.rail.drag.pt)return x.onmouseup(e)};var z=x.opt.emulatetouch&&x.isiframe&&!M.hasmousecapture;x.ontouchmove=function(e,o){if(!x.rail.drag)return!1;if(e.targetTouches&&x.opt.preventmultitouchscrolling&&e.targetTouches.length>1)return!1;if(e.pointerType&&2!=e.pointerType&&"touch"!=e.pointerType)return!1;if(2==x.rail.drag.pt){if("changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),x.rail.drag.y===e.clientY&&x.rail.drag.x===e.clientX)return!1;x.hasmoving||x.triggerScrollStart(e.clientX,e.clientY,0,0,0),x.hasmoving=!0,x.preventclick&&!x.preventclick.click&&(x.preventclick.click=x.preventclick.tg.onclick||!1,x.preventclick.tg.onclick=x.onpreventclick);var t,r;if(r=t=0,z&&!o){var i=x.win.position();r=-i.left,t=-i.top}var n=e.clientY+t,s=n-x.rail.drag.y,l=e.clientX+r,a=l-x.rail.drag.x,c=x.rail.drag.st-s;x.ishwscroll&&x.opt.bouncescroll?c<0?c=Math.round(c/2):c>x.page.maxh&&(c=x.page.maxh+Math.round((c-x.page.maxh)/2)):(c<0&&(c=0,n=0),c>x.page.maxh&&(c=x.page.maxh,n=0));var d;x.railh&&x.railh.scrollable&&(d=x.isrtlmode?a-x.rail.drag.sl:x.rail.drag.sl-a,x.ishwscroll&&x.opt.bouncescroll?d<0?d=Math.round(d/2):d>x.page.maxw&&(d=x.page.maxw+Math.round((d-x.page.maxw)/2)):(d<0&&(d=0,l=0),d>x.page.maxw&&(d=x.page.maxw,l=0)));var u=!1;if(x.rail.drag.dl)u=!0,"v"==x.rail.drag.dl?d=x.rail.drag.sl:"h"==x.rail.drag.dl&&(c=x.rail.drag.st);else{var h=Math.abs(s),p=Math.abs(a),m=x.opt.directionlockdeadzone;if("v"==x.rail.drag.ck){if(h>m&&p<=.3*h)return x.rail.drag=!1,!0;p>m&&(x.rail.drag.dl="f",S.scrollTop(S.scrollTop()))}else if("h"==x.rail.drag.ck){if(p>m&&h<=.3*p)return x.rail.drag=!1,!0;h>m&&(x.rail.drag.dl="f",S.scrollLeft(S.scrollLeft()))}}if(x.synched("touchmove",function(){x.rail.drag&&2==x.rail.drag.pt&&(x.prepareTransition&&x.prepareTransition(0),x.rail.scrollable&&x.setScrollTop(c),x.scrollmom.update(l,n),x.railh&&x.railh.scrollable?(x.setScrollLeft(d),x.showCursor(c,d)):x.showCursor(c),M.isie10&&document.selection.clear())}),M.ischrome&&x.istouchcapable&&(u=!1),u)return x.cancelEvent(e)}else if(1==x.rail.drag.pt)return x.onmousemove(e)},x.ontouchstartCursor=function(e,o){if(!x.rail.drag||3==x.rail.drag.pt){if(x.locked)return x.cancelEvent(e);x.cancelScroll(),x.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:x.scroll.x,sy:x.scroll.y,pt:3,hr:!!o};var t=x.getTarget(e);return!x.ispage&&M.hasmousecapture&&t.setCapture(),x.isiframe&&!M.hasmousecapture&&(x.saved.csspointerevents=x.doc.css("pointer-events"),x.css(x.doc,{"pointer-events":"none"})),x.cancelEvent(e)}},x.ontouchendCursor=function(e){if(x.rail.drag){if(M.hasmousecapture&&document.releaseCapture(),x.isiframe&&!M.hasmousecapture&&x.doc.css("pointer-events",x.saved.csspointerevents),3!=x.rail.drag.pt)return;return x.rail.drag=!1,x.cancelEvent(e)}},x.ontouchmoveCursor=function(e){if(x.rail.drag){if(3!=x.rail.drag.pt)return;if(x.cursorfreezed=!0,x.rail.drag.hr){x.scroll.x=x.rail.drag.sx+(e.touches[0].clientX-x.rail.drag.x),x.scroll.x<0&&(x.scroll.x=0);var o=x.scrollvaluemaxw;x.scroll.x>o&&(x.scroll.x=o)}else{x.scroll.y=x.rail.drag.sy+(e.touches[0].clientY-x.rail.drag.y),x.scroll.y<0&&(x.scroll.y=0);var t=x.scrollvaluemax;x.scroll.y>t&&(x.scroll.y=t)}return x.synched("touchmove",function(){x.rail.drag&&3==x.rail.drag.pt&&(x.showCursor(),x.rail.drag.hr?x.doScrollLeft(Math.round(x.scroll.x*x.scrollratio.x),x.opt.cursordragspeed):x.doScrollTop(Math.round(x.scroll.y*x.scrollratio.y),x.opt.cursordragspeed))}),x.cancelEvent(e)}}}if(x.onmousedown=function(e,o){if(!x.rail.drag||1==x.rail.drag.pt){if(x.railslocked)return x.cancelEvent(e);x.cancelScroll(),x.rail.drag={x:e.clientX,y:e.clientY,sx:x.scroll.x,sy:x.scroll.y,pt:1,hr:o||!1};var t=x.getTarget(e);return!x.ispage&&M.hasmousecapture&&t.setCapture(),x.isiframe&&!M.hasmousecapture&&(x.saved.csspointerevents=x.doc.css("pointer-events"),x.css(x.doc,{"pointer-events":"none"})),x.hasmoving=!1,x.cancelEvent(e)}},x.onmouseup=function(e){if(x.rail.drag)return 1!=x.rail.drag.pt||(M.hasmousecapture&&document.releaseCapture(),x.isiframe&&!M.hasmousecapture&&x.doc.css("pointer-events",x.saved.csspointerevents),x.rail.drag=!1,x.hasmoving&&x.triggerScrollEnd(),x.cancelEvent(e))},x.onmousemove=function(e){if(x.rail.drag){if(1!==x.rail.drag.pt)return;if(M.ischrome&&0===e.which)return x.onmouseup(e);if(x.cursorfreezed=!0,x.hasmoving=!0,x.rail.drag.hr){x.scroll.x=x.rail.drag.sx+(e.clientX-x.rail.drag.x),x.scroll.x<0&&(x.scroll.x=0);var o=x.scrollvaluemaxw;x.scroll.x>o&&(x.scroll.x=o)}else{x.scroll.y=x.rail.drag.sy+(e.clientY-x.rail.drag.y),x.scroll.y<0&&(x.scroll.y=0);var t=x.scrollvaluemax;x.scroll.y>t&&(x.scroll.y=t)}return x.synched("mousemove",function(){x.rail.drag&&1==x.rail.drag.pt&&(x.showCursor(),x.rail.drag.hr?x.hasreversehr?x.doScrollLeft(x.scrollvaluemaxw-Math.round(x.scroll.x*x.scrollratio.x),x.opt.cursordragspeed):x.doScrollLeft(Math.round(x.scroll.x*x.scrollratio.x),x.opt.cursordragspeed):x.doScrollTop(Math.round(x.scroll.y*x.scrollratio.y),x.opt.cursordragspeed))}),x.cancelEvent(e)}x.checkarea=0},M.cantouch||x.opt.emulatetouch)x.onpreventclick=function(e){if(x.preventclick)return x.preventclick.tg.onclick=x.preventclick.click,x.preventclick=!1,x.cancelEvent(e)},x.onclick=!M.isios&&function(e){return!x.lastmouseup||(x.lastmouseup=!1,x.cancelEvent(e))},x.opt.grabcursorenabled&&M.cursorgrabvalue&&(x.css(x.ispage?x.doc:x.win,{cursor:M.cursorgrabvalue}),x.css(x.rail,{cursor:M.cursorgrabvalue}));else{var k=function(e){if(x.selectiondrag){if(e){var o=x.win.outerHeight(),t=e.pageY-x.selectiondrag.top;t>0&&t=o&&(t-=o),x.selectiondrag.df=t}if(0!=x.selectiondrag.df){var r=2*-Math.floor(x.selectiondrag.df/6);x.doScrollBy(r),x.debounced("doselectionscroll",function(){k()},50)}}};"getSelection"in document?x.hasTextSelected=function(){return document.getSelection().rangeCount>0}:"selection"in document?x.hasTextSelected=function(){return"None"!=document.selection.type}:x.hasTextSelected=function(){return!1},x.onselectionstart=function(e){x.ispage||(x.selectiondrag=x.win.offset())},x.onselectionend=function(e){x.selectiondrag=!1},x.onselectiondrag=function(e){x.selectiondrag&&x.hasTextSelected()&&x.debounced("selectionscroll",function(){k(e)},250)}}if(M.hasw3ctouch?(x.css(x.ispage?s("html"):x.win,{"touch-action":"none"}),x.css(x.rail,{"touch-action":"none"}),x.css(x.cursor,{"touch-action":"none"}),x.bind(x.win,"pointerdown",x.ontouchstart),x.bind(document,"pointerup",x.ontouchend),x.bind(document,"pointermove",x.ontouchmove)):M.hasmstouch?(x.css(x.ispage?s("html"):x.win,{"-ms-touch-action":"none"}),x.css(x.rail,{"-ms-touch-action":"none"}),x.css(x.cursor,{"-ms-touch-action":"none"}),x.bind(x.win,"MSPointerDown",x.ontouchstart),x.bind(document,"MSPointerUp",x.ontouchend),x.bind(document,"MSPointerMove",x.ontouchmove),x.bind(x.cursor,"MSGestureHold",function(e){e.preventDefault()}),x.bind(x.cursor,"contextmenu",function(e){e.preventDefault()})):M.cantouch&&(x.bind(x.win,"touchstart",x.ontouchstart,!1,!0),x.bind(document,"touchend",x.ontouchend,!1,!0),x.bind(document,"touchcancel",x.ontouchend,!1,!0),x.bind(document,"touchmove",x.ontouchmove,!1,!0)),x.opt.emulatetouch&&(x.bind(x.win,"mousedown",x.ontouchstart,!1,!0),x.bind(document,"mouseup",x.ontouchend,!1,!0),x.bind(document,"mousemove",x.ontouchmove,!1,!0)),(x.opt.cursordragontouch||!M.cantouch&&!x.opt.emulatetouch)&&(x.rail.css({cursor:"default"}),x.railh&&x.railh.css({cursor:"default"}),x.jqbind(x.rail,"mouseenter",function(){if(!x.ispage&&!x.win.is(":visible"))return!1;x.canshowonmouseevent&&x.showCursor(),x.rail.active=!0}),x.jqbind(x.rail,"mouseleave",function(){x.rail.active=!1,x.rail.drag||x.hideCursor()}),x.opt.sensitiverail&&(x.bind(x.rail,"click",function(e){x.doRailClick(e,!1,!1)}),x.bind(x.rail,"dblclick",function(e){x.doRailClick(e,!0,!1)}),x.bind(x.cursor,"click",function(e){x.cancelEvent(e)}),x.bind(x.cursor,"dblclick",function(e){x.cancelEvent(e)})),x.railh&&(x.jqbind(x.railh,"mouseenter",function(){if(!x.ispage&&!x.win.is(":visible"))return!1;x.canshowonmouseevent&&x.showCursor(),x.rail.active=!0}),x.jqbind(x.railh,"mouseleave",function(){x.rail.active=!1,x.rail.drag||x.hideCursor()}),x.opt.sensitiverail&&(x.bind(x.railh,"click",function(e){x.doRailClick(e,!1,!0)}),x.bind(x.railh,"dblclick",function(e){x.doRailClick(e,!0,!0)}),x.bind(x.cursorh,"click",function(e){x.cancelEvent(e)}),x.bind(x.cursorh,"dblclick",function(e){x.cancelEvent(e)})))),x.opt.cursordragontouch&&(this.istouchcapable||M.cantouch)&&(x.bind(x.cursor,"touchstart",x.ontouchstartCursor),x.bind(x.cursor,"touchmove",x.ontouchmoveCursor),x.bind(x.cursor,"touchend",x.ontouchendCursor),x.cursorh&&x.bind(x.cursorh,"touchstart",function(e){x.ontouchstartCursor(e,!0)}),x.cursorh&&x.bind(x.cursorh,"touchmove",x.ontouchmoveCursor),x.cursorh&&x.bind(x.cursorh,"touchend",x.ontouchendCursor)),M.cantouch||x.opt.emulatetouch?(x.bind(M.hasmousecapture?x.win:document,"mouseup",x.ontouchend),x.onclick&&x.bind(document,"click",x.onclick),x.opt.cursordragontouch?(x.bind(x.cursor,"mousedown",x.onmousedown),x.bind(x.cursor,"mouseup",x.onmouseup),x.cursorh&&x.bind(x.cursorh,"mousedown",function(e){x.onmousedown(e,!0)}),x.cursorh&&x.bind(x.cursorh,"mouseup",x.onmouseup)):(x.bind(x.rail,"mousedown",function(e){e.preventDefault()}),x.railh&&x.bind(x.railh,"mousedown",function(e){e.preventDefault()}))):(x.bind(M.hasmousecapture?x.win:document,"mouseup",x.onmouseup),x.bind(document,"mousemove",x.onmousemove),x.onclick&&x.bind(document,"click",x.onclick),x.bind(x.cursor,"mousedown",x.onmousedown),x.bind(x.cursor,"mouseup",x.onmouseup),x.railh&&(x.bind(x.cursorh,"mousedown",function(e){x.onmousedown(e,!0)}),x.bind(x.cursorh,"mouseup",x.onmouseup)),!x.ispage&&x.opt.enablescrollonselection&&(x.bind(x.win[0],"mousedown",x.onselectionstart),x.bind(document,"mouseup",x.onselectionend),x.bind(x.cursor,"mouseup",x.onselectionend),x.cursorh&&x.bind(x.cursorh,"mouseup",x.onselectionend),x.bind(document,"mousemove",x.onselectiondrag)),x.zoom&&(x.jqbind(x.zoom,"mouseenter",function(){x.canshowonmouseevent&&x.showCursor(),x.rail.active=!0}),x.jqbind(x.zoom,"mouseleave",function(){x.rail.active=!1,x.rail.drag||x.hideCursor()}))),x.opt.enablemousewheel&&(x.isiframe||x.mousewheel(M.isie&&x.ispage?document:x.win,x.onmousewheel),x.mousewheel(x.rail,x.onmousewheel),x.railh&&x.mousewheel(x.railh,x.onmousewheelhr)),x.ispage||M.cantouch||/HTML|^BODY/.test(x.win[0].nodeName)||(x.win.attr("tabindex")||x.win.attr({tabindex:++r}),x.bind(x.win,"focus",function(e){o=x.getTarget(e).id||!0,x.hasfocus=!0,x.canshowonmouseevent&&x.noticeCursor()}),x.bind(x.win,"blur",function(e){o=!1,x.hasfocus=!1}),x.bind(x.win,"mouseenter",function(e){t=x.getTarget(e).id||!0,x.hasmousefocus=!0,x.canshowonmouseevent&&x.noticeCursor()}),x.bind(x.win,"mouseleave",function(e){t=!1,x.hasmousefocus=!1,x.rail.drag||x.hideCursor()})),x.onkeypress=function(e){if(x.railslocked&&0==x.page.maxh)return!0;e=e||window.e;var r=x.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(s(r).attr("contenteditable"))return!0;if(x.hasfocus||x.hasmousefocus&&!o||x.ispage&&!o&&!t){var i=e.keyCode;if(x.railslocked&&27!=i)return x.cancelEvent(e);var n=e.ctrlKey||!1,l=e.shiftKey||!1,a=!1;switch(i){case 38:case 63233:x.doScrollBy(72),a=!0;break;case 40:case 63235:x.doScrollBy(-72),a=!0;break;case 37:case 63232:x.railh&&(n?x.doScrollLeft(0):x.doScrollLeftBy(72),a=!0);break;case 39:case 63234:x.railh&&(n?x.doScrollLeft(x.page.maxw):x.doScrollLeftBy(-72),a=!0);break;case 33:case 63276:x.doScrollBy(x.view.h),a=!0;break;case 34:case 63277:x.doScrollBy(-x.view.h),a=!0;break;case 36:case 63273:x.railh&&n?x.doScrollPos(0,0):x.doScrollTo(0),a=!0;break;case 35:case 63275:x.railh&&n?x.doScrollPos(x.page.maxw,x.page.maxh):x.doScrollTo(x.page.maxh),a=!0;break;case 32:x.opt.spacebarenabled&&(l?x.doScrollBy(x.view.h):x.doScrollBy(-x.view.h),a=!0);break;case 27:x.zoomactive&&(x.doZoom(),a=!0)}if(a)return x.cancelEvent(e)}},x.opt.enablekeyboard&&x.bind(document,M.isopera&&!M.isopera12?"keypress":"keydown",x.onkeypress),x.bind(document,"keydown",function(e){(e.ctrlKey||!1)&&(x.wheelprevented=!0)}),x.bind(document,"keyup",function(e){e.ctrlKey||!1||(x.wheelprevented=!1)}),x.bind(window,"blur",function(e){x.wheelprevented=!1}),x.bind(window,"resize",x.lazyResize),x.bind(window,"orientationchange",x.lazyResize),x.bind(window,"load",x.lazyResize),M.ischrome&&!x.ispage&&!x.haswrapper){var T=x.win.attr("style"),E=parseFloat(x.win.css("width"))+1;x.win.css("width",E),x.synched("chromefix",function(){x.win.attr("style",T)})}x.onAttributeChange=function(e){x.lazyResize(x.isieold?250:30)},x.opt.enableobserver&&(x.isie11||!1===u||(x.observerbody=new u(function(e){if(e.forEach(function(e){if("attributes"==e.type)return S.hasClass("modal-open")&&S.hasClass("modal-dialog")&&!s.contains(s(".modal-dialog")[0],x.doc[0])?x.hide():x.show()}),x.me.clientWidth!=x.page.width||x.me.clientHeight!=x.page.height)return x.lazyResize(30)}),x.observerbody.observe(document.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),x.ispage||x.haswrapper||(!1!==u?(x.observer=new u(function(e){e.forEach(x.onAttributeChange)}),x.observer.observe(x.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),x.observerremover=new u(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(x&&e.removedNodes[o]==x.win[0])return x.remove()})}),x.observerremover.observe(x.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(x.bind(x.win,M.isie&&!M.isie9?"propertychange":"DOMAttrModified",x.onAttributeChange),M.isie9&&x.win[0].attachEvent("onpropertychange",x.onAttributeChange),x.bind(x.win,"DOMNodeRemoved",function(e){e.target==x.win[0]&&x.remove()})))),!x.ispage&&x.opt.boxzoom&&x.bind(window,"resize",x.resizeZoom),x.istextarea&&(x.bind(x.win,"keydown",x.lazyResize),x.bind(x.win,"mouseup",x.lazyResize)),x.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var L=function(){x.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow.document).domain}catch(e){x.iframexd=!0,o=!1}if(x.iframexd)return"console"in window&&console.log("NiceScroll error: policy restriced iframe"),!0;if(x.forcescreen=!0,x.isiframe&&(x.iframe={doc:s(o),html:x.doc.contents().find("html")[0],body:x.doc.contents().find("body")[0]},x.getContentSize=function(){return{w:Math.max(x.iframe.html.scrollWidth,x.iframe.body.scrollWidth),h:Math.max(x.iframe.html.scrollHeight,x.iframe.body.scrollHeight)}},x.docscroll=s(x.iframe.body)),!M.isios&&x.opt.iframeautoresize&&!x.isiframe){x.win.scrollTop(0),x.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);x.doc.height(t)}x.lazyResize(30),x.css(s(x.iframe.body),e),M.isios&&x.haswrapper&&x.css(s(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?x.bind(this.contentWindow,"scroll",x.onscroll):x.bind(o,"scroll",x.onscroll),x.opt.enablemousewheel&&x.mousewheel(o,x.onmousewheel),x.opt.enablekeyboard&&x.bind(o,M.isopera?"keypress":"keydown",x.onkeypress),M.cantouch?(x.bind(o,"touchstart",x.ontouchstart),x.bind(o,"touchmove",x.ontouchmove)):x.opt.emulatetouch&&(x.bind(o,"mousedown",x.ontouchstart),x.bind(o,"mousemove",function(e){return x.ontouchmove(e,!0)}),x.opt.grabcursorenabled&&M.cursorgrabvalue&&x.css(s(o.body),{cursor:M.cursorgrabvalue})),x.bind(o,"mouseup",x.ontouchend),x.zoom&&(x.opt.dblclickzoom&&x.bind(o,"dblclick",x.doZoom),x.ongesturezoom&&x.bind(o,"gestureend",x.ongesturezoom))};this.doc[0].readyState&&"complete"==this.doc[0].readyState&&setTimeout(function(){L.call(x.doc[0],!1)},500),x.bind(this.doc,"load",L)}},this.showCursor=function(e,o){if(x.cursortimeout&&(clearTimeout(x.cursortimeout),x.cursortimeout=0),x.rail){if(x.autohidedom&&(x.autohidedom.stop().css({opacity:x.opt.cursoropacitymax}),x.cursoractive=!0),x.rail.drag&&1==x.rail.drag.pt||(void 0!==e&&!1!==e&&(x.scroll.y=Math.round(1*e/x.scrollratio.y)),void 0!==o&&(x.scroll.x=Math.round(1*o/x.scrollratio.x))),x.cursor.css({height:x.cursorheight,top:x.scroll.y}),x.cursorh){var t=x.hasreversehr?x.scrollvaluemaxw-x.scroll.x:x.scroll.x;!x.rail.align&&x.rail.visibility?x.cursorh.css({width:x.cursorwidth,left:t+x.rail.width}):x.cursorh.css({width:x.cursorwidth,left:t}),x.cursoractive=!0}x.zoom&&x.zoom.stop().css({opacity:x.opt.cursoropacitymax})}},this.hideCursor=function(e){x.cursortimeout||x.rail&&x.autohidedom&&(x.hasmousefocus&&"leave"==x.opt.autohidemode||(x.cursortimeout=setTimeout(function(){x.rail.active&&x.showonmouseevent||(x.autohidedom.stop().animate({opacity:x.opt.cursoropacitymin}),x.zoom&&x.zoom.stop().animate({opacity:x.opt.cursoropacitymin}),x.cursoractive=!1),x.cursortimeout=0},e||x.opt.hidecursordelay)))},this.noticeCursor=function(e,o,t){x.showCursor(o,t),x.rail.active||x.hideCursor(e)},this.getContentSize=x.ispage?function(){return{w:Math.max(document.body.scrollWidth,document.documentElement.scrollWidth),h:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}}:x.haswrapper?function(){return{w:x.doc[0].offsetWidth,h:x.doc[0].offsetHeight}}:function(){return{w:x.docscroll[0].scrollWidth,h:x.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!x||!x.win)return!1;if(!x.haswrapper&&!x.ispage){if("none"==x.win.css("display"))return x.visibility&&x.hideRail().hideRailHr(),!1;x.hidden||x.visibility||x.showRail().showRailHr()}var t=x.page.maxh,r=x.page.maxw,i={h:x.view.h,w:x.view.w};if(x.view={w:x.ispage?x.win.width():x.win[0].clientWidth,h:x.ispage?x.win.height():x.win[0].clientHeight},x.page=o||x.getContentSize(),x.page.maxh=Math.max(0,x.page.h-x.view.h),x.page.maxw=Math.max(0,x.page.w-x.view.w),x.page.maxh==t&&x.page.maxw==r&&x.view.w==i.w&&x.view.h==i.h){if(x.ispage)return x;var n=x.win.offset();if(x.lastposition){var s=x.lastposition;if(s.top==n.top&&s.left==n.left)return x}x.lastposition=n}return 0===x.page.maxh?(x.hideRail(),x.scrollvaluemax=0,x.scroll.y=0,x.scrollratio.y=0,x.cursorheight=0,x.setScrollTop(0),x.rail&&(x.rail.scrollable=!1)):(x.page.maxh-=x.opt.railpadding.top+x.opt.railpadding.bottom,x.rail.scrollable=!0),0===x.page.maxw?(x.hideRailHr(),x.scrollvaluemaxw=0,x.scroll.x=0,x.scrollratio.x=0,x.cursorwidth=0,x.setScrollLeft(0),x.railh&&(x.railh.scrollable=!1)):(x.page.maxw-=x.opt.railpadding.left+x.opt.railpadding.right,x.railh&&(x.railh.scrollable=x.opt.horizrailenabled)),x.railslocked=x.locked||0===x.page.maxh&&0===x.page.maxw,x.railslocked?(x.ispage||x.updateScrollBar(x.view),!1):(x.hidden||x.visibility?!x.railh||x.hidden||x.railh.visibility||x.showRailHr():x.showRail().showRailHr(),x.istextarea&&x.win.css("resize")&&"none"!=x.win.css("resize")&&(x.view.h-=20),x.cursorheight=Math.min(x.view.h,Math.round(x.view.h*(x.view.h/x.page.h))),x.cursorheight=x.opt.cursorfixedheight?x.opt.cursorfixedheight:Math.max(x.opt.cursorminheight,x.cursorheight),x.cursorwidth=Math.min(x.view.w,Math.round(x.view.w*(x.view.w/x.page.w))),x.cursorwidth=x.opt.cursorfixedheight?x.opt.cursorfixedheight:Math.max(x.opt.cursorminheight,x.cursorwidth),x.scrollvaluemax=x.view.h-x.cursorheight-(x.opt.railpadding.top+x.opt.railpadding.bottom),x.railh&&(x.railh.width=x.page.maxh>0?x.view.w-x.rail.width:x.view.w,x.scrollvaluemaxw=x.railh.width-x.cursorwidth-(x.opt.railpadding.left+x.opt.railpadding.right)),x.ispage||x.updateScrollBar(x.view),x.scrollratio={x:x.page.maxw/x.scrollvaluemaxw,y:x.page.maxh/x.scrollvaluemax},x.getScrollTop()>x.page.maxh?x.doScrollTop(x.page.maxh):(x.scroll.y=Math.round(x.getScrollTop()*(1/x.scrollratio.y)),x.scroll.x=Math.round(x.getScrollLeft()*(1/x.scrollratio.x)),x.cursoractive&&x.noticeCursor()),x.scroll.y&&0==x.getScrollTop()&&x.doScrollTo(Math.floor(x.scroll.y*x.scrollratio.y)),x)},this.resize=x.onResize,this.hlazyresize=0,this.lazyResize=function(e){return x.haswrapper||x.hide(),x.hlazyresize&&clearTimeout(x.hlazyresize),x.hlazyresize=setTimeout(function(){x&&(x.resize(),x.show())},240),x},this.jqbind=function(e,o,t){x.events.push({e:e,n:o,f:t,q:!0}),s(e).bind(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in document.createElement("div"))x._bind(r,"wheel",o,t||!1);else{var i=void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll";b(r,i,o,t||!1),"DOMMouseScroll"==i&&b(r,"MozMousePixelScroll",o,t||!1)}};var P=!1;if(M.haseventlistener){try{var R=Object.defineProperty({},"passive",{get:function(){P=!0}});window.addEventListener("test",null,R)}catch(e){}this.cancelEvent=function(e){return!!e&&((e=e.original?e.original:e).cancelable&&e.preventDefault(),e.stopPropagation(),e.preventManipulation&&e.preventManipulation(),!1)},this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},window.constructor.prototype.addEventListener=document.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},window.constructor.prototype.removeEventListener=document.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return!!(e=window.event||!1)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1,!1)},this.stopPropagation=function(e){return!!(e=window.event||!1)&&(e.cancelBubble=!0,!1)};this.bind=function(e,o,t,r,i){var n="jquery"in e?e[0]:e;x._bind(n,o,t,r||!1,i||!1)},this._bind=function(e,o,t,r,i){x.events.push({e:e,n:o,f:t,b:r,q:!1}),P&&i?e.addEventListener(o,t,{passive:!1,capture:r}):e.addEventListener(o,t,r||!1)},this._unbind=function(e,o,t,r){e.removeEventListener(o,t,r)},this.unbindAll=function(){for(var e=0;e0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){var n={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:x.newscrollx,y:x.newscrolly},speed:i};x.onscrollstart.call(x,n)},this.triggerScrollEnd=function(){if(x.onscrollend){var e=x.getScrollLeft(),o=x.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};x.onscrollend.call(x,t)}},this.onmousewheel=function(e){if(!x.wheelprevented){if(x.railslocked)return x.debounced("checkunlock",x.resize,250),!0;if(x.rail.drag)return x.cancelEvent(e);if("auto"===x.opt.oneaxismousemode&&0!==e.deltaX&&(x.opt.oneaxismousemode=!1),x.opt.oneaxismousemode&&0===e.deltaX&&!x.rail.scrollable)return!x.railh||!x.railh.scrollable||x.onmousewheelhr(e);var o=h(),t=!1;if(x.opt.preservenativescrolling&&x.checkarea+60020?t:0},x.opt.smoothscroll?x.ishwscroll&&M.hastransition&&x.opt.usetransition&&x.opt.smoothscroll?(this.prepareTransition=function(e,o){var t=o?e>20?e:0:x.getTransitionSpeed(e),r=t?M.prefixstyle+"transform "+t+"ms ease-out":"";return x.lasttransitionstyle&&x.lasttransitionstyle==r||(x.lasttransitionstyle=r,x.doc.css(M.transitionstyle,r)),t},this.doScrollLeft=function(e,o){var t=x.scrollrunning?x.newscrolly:x.getScrollTop();x.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=x.scrollrunning?x.newscrollx:x.getScrollLeft();x.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=x.getScrollTop(),i=x.getScrollLeft();return((x.newscrolly-r)*(o-r)<0||(x.newscrollx-i)*(e-i)<0)&&x.cancelScroll(),0==x.opt.bouncescroll&&(o<0?o=0:o>x.page.maxh&&(o=x.page.maxh),e<0?e=0:e>x.page.maxw&&(e=x.page.maxw)),(!x.scrollrunning||e!=x.newscrollx||o!=x.newscrolly)&&(x.newscrolly=o,x.newscrollx=e,x.newscrollspeed=t||!1,!x.timer&&void(x.timer=setTimeout(function(){var t=x.getScrollTop(),r=x.getScrollLeft(),i={};i.x=e-r,i.y=o-t,i.px=r,i.py=t;var n=Math.round(Math.sqrt(Math.pow(i.x,2)+Math.pow(i.y,2))),s=x.newscrollspeed&&x.newscrollspeed>1?x.newscrollspeed:x.getTransitionSpeed(n);if(x.newscrollspeed&&x.newscrollspeed<=1&&(s*=x.newscrollspeed),x.prepareTransition(s,!0),x.timerscroll&&x.timerscroll.tm&&clearInterval(x.timerscroll.tm),s>0){!x.scrollrunning&&x.onscrollstart&&x.triggerScrollStart(r,t,e,o,s),M.transitionend?x.scrollendtrapped||(x.scrollendtrapped=!0,x.bind(x.doc,M.transitionend,x.onScrollTransitionEnd,!1)):(x.scrollendtrapped&&clearTimeout(x.scrollendtrapped),x.scrollendtrapped=setTimeout(x.onScrollTransitionEnd,s));var l=t,a=r;x.timerscroll={bz:new L(l,x.newscrolly,s,0,0,.58,1),bh:new L(a,x.newscrollx,s,0,0,.58,1)},x.cursorfreezed||(x.timerscroll.tm=setInterval(function(){x.showCursor(x.getScrollTop(),x.getScrollLeft())},60))}x.synched("doScroll-set",function(){x.timer=0,x.scrollendtrapped&&(x.scrollrunning=!0),x.setScrollTop(x.newscrolly),x.setScrollLeft(x.newscrollx),x.scrollendtrapped||x.onScrollTransitionEnd()})},50)))},this.cancelScroll=function(){if(!x.scrollendtrapped)return!0;var e=x.getScrollTop(),o=x.getScrollLeft();return x.scrollrunning=!1,M.transitionend||clearTimeout(M.transitionend),x.scrollendtrapped=!1,x._unbind(x.doc[0],M.transitionend,x.onScrollTransitionEnd),x.prepareTransition(0),x.setScrollTop(e),x.railh&&x.setScrollLeft(o),x.timerscroll&&x.timerscroll.tm&&clearInterval(x.timerscroll.tm),x.timerscroll=!1,x.cursorfreezed=!1,x.showCursor(e,o),x},this.onScrollTransitionEnd=function(){x.scrollendtrapped&&x._unbind(x.doc[0],M.transitionend,x.onScrollTransitionEnd),x.scrollendtrapped=!1,x.prepareTransition(0),x.timerscroll&&x.timerscroll.tm&&clearInterval(x.timerscroll.tm),x.timerscroll=!1;var e=x.getScrollTop(),o=x.getScrollLeft();if(x.setScrollTop(e),x.railh&&x.setScrollLeft(o),x.noticeCursor(!1,e,o),x.cursorfreezed=!1,e<0?e=0:e>x.page.maxh&&(e=x.page.maxh),o<0?o=0:o>x.page.maxw&&(o=x.page.maxw),e!=x.newscrolly||o!=x.newscrollx)return x.doScrollPos(o,e,x.opt.snapbackspeed);x.onscrollend&&x.scrollrunning&&x.triggerScrollEnd(),x.scrollrunning=!1}):(this.doScrollLeft=function(e,o){var t=x.scrollrunning?x.newscrolly:x.getScrollTop();x.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=x.scrollrunning?x.newscrollx:x.getScrollLeft();x.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){function r(){if(x.cancelAnimationFrame)return!0;if(x.scrollrunning=!0,h=1-h)return x.timer=a(r)||1;var e,o,t=0,i=o=x.getScrollTop();x.dst.ay?(((s=(i=x.bzscroll?x.dst.py+x.bzscroll.getNow()*x.dst.ay:x.newscrolly)-o)<0&&i0&&i>x.newscrolly)&&(i=x.newscrolly),x.setScrollTop(i),i==x.newscrolly&&(t=1)):t=1;var n=e=x.getScrollLeft();if(x.dst.ax){var s=(n=x.bzscroll?x.dst.px+x.bzscroll.getNow()*x.dst.ax:x.newscrollx)-e;(s<0&&n0&&n>x.newscrollx)&&(n=x.newscrollx),x.setScrollLeft(n),n==x.newscrollx&&(t+=1)}else t+=1;2==t?(x.timer=0,x.cursorfreezed=!1,x.bzscroll=!1,x.scrollrunning=!1,i<0?i=0:i>x.page.maxh&&(i=Math.max(0,x.page.maxh)),n<0?n=0:n>x.page.maxw&&(n=x.page.maxw),n!=x.newscrollx||i!=x.newscrolly?x.doScrollPos(n,i):x.onscrollend&&x.triggerScrollEnd()):x.timer=a(r)||1}var o=void 0===o||!1===o?x.getScrollTop(!0):o;if(x.timer&&x.newscrolly==o&&x.newscrollx==e)return!0;x.timer&&c(x.timer),x.timer=0;var i=x.getScrollTop(),n=x.getScrollLeft();((x.newscrolly-i)*(o-i)<0||(x.newscrollx-n)*(e-n)<0)&&x.cancelScroll(),x.newscrolly=o,x.newscrollx=e,x.bouncescroll&&x.rail.visibility||(x.newscrolly<0?x.newscrolly=0:x.newscrolly>x.page.maxh&&(x.newscrolly=x.page.maxh)),x.bouncescroll&&x.railh.visibility||(x.newscrollx<0?x.newscrollx=0:x.newscrollx>x.page.maxw&&(x.newscrollx=x.page.maxw)),x.dst={},x.dst.x=e-n,x.dst.y=o-i,x.dst.px=n,x.dst.py=i;var s=Math.round(Math.sqrt(Math.pow(x.dst.x,2)+Math.pow(x.dst.y,2)));x.dst.ax=x.dst.x/s,x.dst.ay=x.dst.y/s;var l=0,d=s;0==x.dst.x?(l=i,d=o,x.dst.ay=1,x.dst.py=0):0==x.dst.y&&(l=n,d=e,x.dst.ax=1,x.dst.px=0);var u=x.getTransitionSpeed(s);if(t&&t<=1&&(u*=t),x.bzscroll=u>0&&(x.bzscroll?x.bzscroll.update(d,u):new L(l,d,u,0,1,0,1)),!x.timer){(i==x.page.maxh&&o>=x.page.maxh||n==x.page.maxw&&e>=x.page.maxw)&&x.checkContentSize();var h=1;x.cancelAnimationFrame=!1,x.timer=1,x.onscrollstart&&!x.scrollrunning&&x.triggerScrollStart(n,i,e,o,u),r(),(i==x.page.maxh&&o>=i||n==x.page.maxw&&e>=n)&&x.checkContentSize(),x.noticeCursor()}},this.cancelScroll=function(){return x.timer&&c(x.timer),x.timer=0,x.bzscroll=!1,x.scrollrunning=!1,x}):(this.doScrollLeft=function(e,o){var t=x.getScrollTop();x.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=x.getScrollLeft();x.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>x.page.maxw?x.page.maxw:e;r<0&&(r=0);var i=o>x.page.maxh?x.page.maxh:o;i<0&&(i=0),x.synched("scroll",function(){x.setScrollTop(i),x.setScrollLeft(r)})},this.cancelScroll=function(){}),this.doScrollBy=function(e,o){var t=0;if(t=o?Math.floor((x.scroll.y-e)*x.scrollratio.y):(x.timer?x.newscrolly:x.getScrollTop(!0))-e,x.bouncescroll){var r=Math.round(x.view.h/2);t<-r?t=-r:t>x.page.maxh+r&&(t=x.page.maxh+r)}x.cursorfreezed=!1;var i=x.getScrollTop(!0);return t<0&&i<=0?x.noticeCursor():t>x.page.maxh&&i>=x.page.maxh?(x.checkContentSize(),x.noticeCursor()):void x.doScrollTop(t)},this.doScrollLeftBy=function(e,o){var t=0;if(t=o?Math.floor((x.scroll.x-e)*x.scrollratio.x):(x.timer?x.newscrollx:x.getScrollLeft(!0))-e,x.bouncescroll){var r=Math.round(x.view.w/2);t<-r?t=-r:t>x.page.maxw+r&&(t=x.page.maxw+r)}x.cursorfreezed=!1;var i=x.getScrollLeft(!0);return t<0&&i<=0?x.noticeCursor():t>x.page.maxw&&i>=x.page.maxw?x.noticeCursor():void x.doScrollLeft(t)},this.doScrollTo=function(e,o){var t=o?Math.round(e*x.scrollratio.y):e;t<0?t=0:t>x.page.maxh&&(t=x.page.maxh),x.cursorfreezed=!1,x.doScrollTop(e)},this.checkContentSize=function(){var e=x.getContentSize();e.h==x.page.h&&e.w==x.page.w||x.resize(!1,e)},x.onscroll=function(e){x.rail.drag||x.cursorfreezed||x.synched("scroll",function(){x.scroll.y=Math.round(x.getScrollTop()*(1/x.scrollratio.y)),x.railh&&(x.scroll.x=Math.round(x.getScrollLeft()*(1/x.scrollratio.x))),x.noticeCursor()})},x.bind(x.docscroll,"scroll",x.onscroll),this.doZoomIn=function(e){if(!x.zoomactive){x.zoomactive=!0,x.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=x.win[0].style;for(var r in o){var i=o[r];x.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}x.zoomrestore.style.width=x.win.css("width"),x.zoomrestore.style.height=x.win.css("height"),x.zoomrestore.padding={w:x.win.outerWidth()-x.win.width(),h:x.win.outerHeight()-x.win.height()},M.isios4&&(x.zoomrestore.scrollTop=l.scrollTop(),l.scrollTop(0)),x.win.css({position:M.isios4?"absolute":"fixed",top:0,left:0,zIndex:n+100,margin:0});var s=x.win.css("backgroundColor");return(""==s||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(s))&&x.win.css("backgroundColor","#fff"),x.rail.css({zIndex:n+101}),x.zoom.css({zIndex:n+102}),x.zoom.css("backgroundPosition","0 -18px"),x.resizeZoom(),x.onzoomin&&x.onzoomin.call(x),x.cancelEvent(e)}},this.doZoomOut=function(e){if(x.zoomactive)return x.zoomactive=!1,x.win.css("margin",""),x.win.css(x.zoomrestore.style),M.isios4&&l.scrollTop(x.zoomrestore.scrollTop),x.rail.css({"z-index":x.zindex}),x.zoom.css({"z-index":x.zindex}),x.zoomrestore=!1,x.zoom.css("backgroundPosition","0 0"),x.onResize(),x.onzoomout&&x.onzoomout.call(x),x.cancelEvent(e)},this.doZoom=function(e){return x.zoomactive?x.doZoomOut(e):x.doZoomIn(e)},this.resizeZoom=function(){if(x.zoomactive){var e=x.getScrollTop();x.win.css({width:l.width()-x.zoomrestore.padding.w+"px",height:l.height()-x.zoomrestore.padding.h+"px"}),x.onResize(),x.setScrollTop(Math.min(x.page.maxh,e))}},this.init(),s.nicescroll.push(this)},w=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=h(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=h();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,n=e-o.lastx,s=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+n;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=s<0||s>o.nc.page.maxh,o.speedx=n,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=h(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),n=o.nc.getScrollTop(),s=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=s>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(n<0||n>s||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var p=u/50;o.speedx*=p,o.speedy*=p,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var m=o.lastscrollx,f=o.lastscrolly,g=function(){var e=h()-t>600?.04:.02;o.speedx&&(m=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=m,(m<0||m>l)&&(e=.1)),o.speedy&&(f=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=f,(f<0||f>s)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=m,o.nc.setScrollLeft(m)}if(o.speedy){o.nc.getScrollTop();o.chky=f,o.nc.setScrollTop(f)}o.timer||(o.nc.hideCursor(),o.doSnapy(m,f))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(m,f))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},v=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=s.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():v.call(e)},set:function(e,o){var t=s.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):v.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(s.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():v.call(this)}return this.each(function(){var o=s.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):v.call(s(this),e)})};var b=e.fn.scrollLeft;s.cssHooks.pageXOffset={get:function(e,o,t){var r=s.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():b.call(e)},set:function(e,o){var t=s.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):b.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(s.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():b.call(this)}return this.each(function(){var o=s.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):b.call(s(this),e)})};var y=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return s.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?s(e,r):n,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new g(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},window.NiceScroll={getjQuery:function(){return e}},s.nicescroll||(s.nicescroll=new y,s.nicescroll.options=p)}); \ No newline at end of file diff --git a/dist/jquery.nicescroll.js b/dist/jquery.nicescroll.js index ac249b9..a4b0480 100644 --- a/dist/jquery.nicescroll.js +++ b/dist/jquery.nicescroll.js @@ -31,7 +31,7 @@ var $ = jQuery; // sandbox - var document = document; + //var document = document; var $window = $(window); // http://stackoverflow.com/questions/2161159/get-script-path diff --git a/dist/jquery.nicescroll.min.js b/dist/jquery.nicescroll.min.js index 014c3bb..9602845 100644 --- a/dist/jquery.nicescroll.min.js +++ b/dist/jquery.nicescroll.min.js @@ -1,2 +1,2 @@ /* nicescroll v3.7.2 InuYaksa - MIT - https://nicescroll.areaaperta.com */ -!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=l,a=n(window),c=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||!1}(),d=function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||!1}();if(c)window.cancelAnimationFrame||(d=function(e){});else{var u=0;c=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-u)),i=window.setTimeout(function(){e(t+r)},r);return u=t+r,i},d=function(e){window.clearTimeout(e)}}var h=window.MutationObserver||window.WebKitMutationObserver||!1,p=Date.now||function(){return(new Date).getTime()},m={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:60,mousescrollstep:24,touchbehavior:!1,emulatetouch:!1,hwacceleration:!0,usetransition:!0,boxzoom:!1,dblclickzoom:!0,gesturezoom:!0,grabcursorenabled:!0,autohidemode:!0,background:"",iframeautoresize:!0,cursorminheight:32,preservenativescrolling:!0,railoffset:!1,railhoffset:!1,bouncescroll:!0,spacebarenabled:!0,railpadding:{top:0,right:0,left:0,bottom:0},disableoutline:!0,horizrailenabled:!0,railalign:"right",railvalign:"bottom",enabletranslate3d:!0,enablemousewheel:!0,enablekeyboard:!0,smoothscroll:!0,sensitiverail:!0,enablemouselockapi:!0,cursorfixedheight:!1,directionlockdeadzone:6,hidecursordelay:400,nativeparentscrolling:!0,enablescrollonselection:!0,overflowx:!0,overflowy:!0,cursordragspeed:.3,rtlmode:"auto",cursordragontouch:!1,oneaxismousemode:"auto",scriptpath:function(){var e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},f=!1,g=function(){if(f)return f;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in window,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(window.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in window&&9===l.documentMode,i.isie10=i.isie&&"performance"in window&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in window,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in window,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in window,i.hasw3ctouch=(window.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(window.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&window.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!=o)return parseInt(o);e=e.parent()}return!1}function b(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=P[r]||0)?t?S.win.outerHeight()-S.win.innerHeight():S.win.outerWidth()-S.win.innerWidth():1;return S.isie8&&i&&(i+=1),s?i:0}return i}function y(e,o,t,r){S._bind(e,o,function(r){var i={original:r=r||window.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function x(e,o,t){var r,i;if(0==e.deltaMode?(r=-Math.floor(e.deltaX*(S.opt.mousescrollstep/54)),i=-Math.floor(e.deltaY*(S.opt.mousescrollstep/54))):1==e.deltaMode&&(r=-Math.floor(e.deltaX*S.opt.mousescrollstep),i=-Math.floor(e.deltaY*S.opt.mousescrollstep)),o&&S.opt.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?S.getScrollLeft()>=S.page.maxw:S.getScrollLeft()<=0)&&(i=r,r=0)),S.isrtlmode&&(r=-r),r){if(S.scrollmom)S.scrollmom.stop();else if(r<0){if(S.getScrollLeft()>=S.page.maxw)return!0}else if(S.getScrollLeft()<=0)return!0;S.lastdeltax+=r,S.debounced("mousewheelx",function(){var e=S.lastdeltax;S.lastdeltax=0,S.rail.drag||S.doScrollLeftBy(e)},15)}if(i){if(S.opt.nativeparentscrolling&&t&&!S.ispage&&!S.zoomactive)if(i<0){if(S.getScrollTop()>=S.page.maxh)return!0}else if(S.getScrollTop()<=0)return!0;S.scrollmom&&S.scrollmom.stop(),S.lastdeltay+=i,S.synched("mousewheely",function(){var e=S.lastdeltay;S.lastdeltay=0,S.rail.drag||S.doScrollBy(e)},15)}return e.stopImmediatePropagation(),e.preventDefault()}var S=this;this.version="3.7.2",this.name="nicescroll",this.me=u;var z=n("body");if(this.opt={doc:z,win:!1},n.extend(this.opt,m),this.opt.snapbackspeed=80,e)for(var k in S.opt)void 0!==e[k]&&(S.opt[k]=e[k]);if(S.opt.disablemutationobserver&&(h=!1),this.doc=S.opt.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(S.opt.win?S.opt.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==S.opt.win,this.win=S.opt.win||(this.ispage?a:this.doc),this.docscroll=this.ispage&&!this.haswrapper?a:this.win,this.body=z,this.viewport=!1,this.isfixed=!1,this.iframe=!1,this.isiframe="IFRAME"==this.doc[0].nodeName&&"IFRAME"==this.win[0].nodeName,this.istextarea="TEXTAREA"==this.win[0].nodeName,this.forcescreen=!1,this.canshowonmouseevent="scroll"!=S.opt.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==this.opt.rtlmode){var T=this.win[0]==window?this.body:this.win,M=T.css("writing-mode")||T.css("-webkit-writing-mode")||T.css("-ms-writing-mode")||T.css("-moz-writing-mode");"horizontal-tb"==M||"lr-tb"==M||""==M?(this.isrtlmode="rtl"==T.css("direction"),this.isvertical=!1):(this.isrtlmode="vertical-rl"==M||"tb"==M||"tb-rl"==M||"rl-tb"==M,this.isvertical="vertical-rl"==M||"tb"==M||"tb-rl"==M)}else this.isrtlmode=!0===this.opt.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1===S.opt.scrollbarid)do{this.id="ascrail"+i++}while(l.getElementById(this.id));else this.id=S.opt.scrollbarid;this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=S.opt.overflowx,this.overflowy=S.opt.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=g();var E=n.extend({},this.detected);this.canhwscroll=E.hastransform&&S.opt.hwacceleration,this.ishwscroll=this.canhwscroll&&S.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(E.iswebkit||E.isie||E.isie11):this.hasreversehr=!(E.iswebkit||E.isie&&!E.isie10&&!E.isie11):this.hasreversehr=!1,this.istouchcapable=!1,E.cantouch||!E.hasw3ctouch&&!E.hasmstouch?!E.cantouch||E.isios||E.isandroid||!E.iswebkit&&!E.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,S.opt.enablemouselockapi||(E.hasmousecapture=!1,E.haspointerlock=!1),this.debounced=function(e,o,t){S&&(S.delaylist[e]||!1||(S.delaylist[e]={h:c(function(){S.delaylist[e].fn.call(S),S.delaylist[e]=!1},t)},o.call(S)),S.delaylist[e].fn=o)};var L=!1;this.synched=function(e,o){return S.synclist[e]=o,function(){L||(c(function(){if(S){L=!1;for(var e in S.synclist){var o=S.synclist[e];o&&o.call(S),S.synclist[e]=!1}}}),L=!0)}(),e},this.unsynched=function(e){S.synclist[e]&&(S.synclist[e]=!1)},this.css=function(e,o){for(var t in o)S.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?S.getScrollTop():S.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?S.getScrollLeft():S.setScrollLeft(e)};var C=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=p(),this.df=this.ed-this.st};if(C.prototype={B2:function(e){return 3*e*e*(1-e)},B3:function(e){return 3*e*(1-e)*(1-e)},B4:function(e){return(1-e)*(1-e)*(1-e)},getNow:function(){var e=1-(p()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e<0?this.ed:this.st+Math.round(this.df*o)},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=p(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},E.hastranslate3d&&E.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=f();if(o)return 16==o.length?-o[13]:-o[5];if(S.timerscroll&&S.timerscroll.bz)return S.timerscroll.bz.getNow()}return S.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=f();if(o)return 16==o.length?-o[12]:-o[4];if(S.timerscroll&&S.timerscroll.bh)return S.timerscroll.bh.getNow()}return S.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!0,window,1),o.niceevent=!0,e.dispatchEvent(o)};var N=this.isrtlmode?1:-1;E.hastranslate3d&&S.opt.enabletranslate3d?(this.setScrollTop=function(e,o){S.doc.translate.y=e,S.doc.translate.ty=-1*e+"px",S.doc.css(E.trstyle,"translate3d("+S.doc.translate.tx+","+S.doc.translate.ty+",0)"),o||S.notifyScrollEvent(S.win[0])},this.setScrollLeft=function(e,o){S.doc.translate.x=e,S.doc.translate.tx=e*N+"px",S.doc.css(E.trstyle,"translate3d("+S.doc.translate.tx+","+S.doc.translate.ty+",0)"),o||S.notifyScrollEvent(S.win[0])}):(this.setScrollTop=function(e,o){S.doc.translate.y=e,S.doc.translate.ty=-1*e+"px",S.doc.css(E.trstyle,"translate("+S.doc.translate.tx+","+S.doc.translate.ty+")"),o||S.notifyScrollEvent(S.win[0])},this.setScrollLeft=function(e,o){S.doc.translate.x=e,S.doc.translate.tx=e*N+"px",S.doc.css(E.trstyle,"translate("+S.doc.translate.tx+","+S.doc.translate.ty+")"),o||S.notifyScrollEvent(S.win[0])})}else this.getScrollTop=function(){return S.docscroll.scrollTop()},this.setScrollTop=function(e){return setTimeout(function(){S&&S.docscroll.scrollTop(e)},1)},this.getScrollLeft=function(){return S.hasreversehr?S.detected.ismozilla?S.page.maxw-Math.abs(S.docscroll.scrollLeft()):S.page.maxw-S.docscroll.scrollLeft():S.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(S)return S.hasreversehr&&(e=S.detected.ismozilla?-(S.page.maxw-e):S.page.maxw-e),S.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var P={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:window.pageYOffset||l.documentElement.scrollTop,left:window.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(S.isfixed){var e=S.win.offset(),o=S.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=S.win.offset();if(!S.viewport)return t;var r=S.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(S.ishwscroll)S.rail.css({height:S.win.innerHeight()-(S.opt.railpadding.top+S.opt.railpadding.bottom)}),S.railh&&S.railh.css({width:S.win.innerWidth()-(S.opt.railpadding.left+S.opt.railpadding.right)});else{var r=S.getOffset();if(o={top:r.top,left:r.left-(S.opt.railpadding.left+S.opt.railpadding.right)},o.top+=b(S.win,"border-top-width",!0),o.left+=S.rail.align?S.win.outerWidth()-b(S.win,"border-right-width")-S.rail.width:b(S.win,"border-left-width"),(t=S.opt.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),S.railslocked||S.rail.css({top:o.top,left:o.left,height:(e?e.h:S.win.innerHeight())-(S.opt.railpadding.top+S.opt.railpadding.bottom)}),S.zoom&&S.zoom.css({top:o.top+1,left:1==S.rail.align?o.left-20:o.left+S.rail.width+4}),S.railh&&!S.railslocked){o={top:r.top,left:r.left},(t=S.opt.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=S.railh.align?o.top+b(S.win,"border-top-width",!0)+S.win.innerHeight()-S.railh.height:o.top+b(S.win,"border-top-width",!0),s=o.left+b(S.win,"border-left-width");S.railh.css({top:i-(S.opt.railpadding.top+S.opt.railpadding.bottom),left:s,width:S.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;S.railslocked||(S.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?S.doScrollLeft:S.doScrollTop)(s=t?(e.pageX-S.railh.offset().left-S.cursorwidth/2)*S.scrollratio.x:(e.pageY-S.rail.offset().top-S.cursorheight/2)*S.scrollratio.y):(r=t?S.doScrollLeftBy:S.doScrollBy,s=t?S.scroll.x:S.scroll.y,n=t?e.pageX-S.railh.offset().left:e.pageY-S.rail.offset().top,i=t?S.view.w:S.view.h,r(s>=n?i:-i)))},S.hasanimationframe="requestAnimationFrame"in window,S.hascancelanimationframe="cancelAnimationFrame"in window,this.init=function(){if(S.saved.css=[],E.isoperamini)return!0;if(E.isandroid&&!("hidden"in l))return!0;S.opt.emulatetouch=S.opt.emulatetouch||S.opt.touchbehavior;var e={"overflow-y":"hidden"};if((E.isie11||E.isie10)&&(e["-ms-overflow-style"]="none"),S.zindex="auto",S.ispage||"auto"!=S.opt.zindex?S.zindex=S.opt.zindex:S.zindex=w()||"auto",!S.ispage&&"auto"!=S.zindex&&S.zindex>s&&(s=S.zindex),S.isie&&0==S.zindex&&"auto"==S.opt.zindex&&(S.zindex="auto"),!S.ispage||!E.cantouch&&!E.isieold){var i=S.docscroll;S.ispage&&(i=S.haswrapper?S.win:S.doc),S.css(i,e),S.ispage&&(E.isie11||E.isie)&&S.css(n("html"),e),!E.isios||S.ispage||S.haswrapper||S.css(z,{"-webkit-overflow-scrolling":"touch"});var c=n(l.createElement("div"));c.css({position:"relative",top:0,float:"right",width:S.opt.cursorwidth,height:0,"background-color":S.opt.cursorcolor,border:S.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":S.opt.cursorborderradius,"-moz-border-radius":S.opt.cursorborderradius,"border-radius":S.opt.cursorborderradius}),c.addClass("nicescroll-cursors"),S.cursor=c;var d=n(l.createElement("div"));d.attr("id",S.id),d.addClass("nicescroll-rails nicescroll-rails-vr");var u,p,m=["left","right","top","bottom"];for(var f in m)p=m[f],(u=S.opt.railpadding[p])?d.css("padding-"+p,u+"px"):S.opt.railpadding[p]=0;d.append(c),d.width=Math.max(parseFloat(S.opt.cursorwidth),c.outerWidth()),d.css({width:d.width+"px",zIndex:S.zindex,background:S.opt.background,cursor:"default"}),d.visibility=!0,d.scrollable=!0,d.align="left"==S.opt.railalign?0:1,S.rail=d,S.rail.drag=!1;var g=!1;!S.opt.boxzoom||S.ispage||E.isieold||(g=l.createElement("div"),S.bind(g,"click",S.doZoom),S.bind(g,"mouseenter",function(){S.zoom.css("opacity",S.opt.cursoropacitymax)}),S.bind(g,"mouseleave",function(){S.zoom.css("opacity",S.opt.cursoropacitymin)}),S.zoom=n(g),S.zoom.css({cursor:"pointer",zIndex:S.zindex,backgroundImage:"url("+S.opt.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),S.opt.dblclickzoom&&S.bind(S.win,"dblclick",S.doZoom),E.cantouch&&S.opt.gesturezoom&&(S.ongesturezoom=function(e){return e.scale>1.5&&S.doZoomIn(e),e.scale<.8&&S.doZoomOut(e),S.cancelEvent(e)},S.bind(S.win,"gestureend",S.ongesturezoom))),S.railh=!1;var b;if(S.opt.horizrailenabled&&(S.css(i,{overflowX:"hidden"}),(c=n(l.createElement("div"))).css({position:"absolute",top:0,height:S.opt.cursorwidth,width:0,backgroundColor:S.opt.cursorcolor,border:S.opt.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":S.opt.cursorborderradius,"-moz-border-radius":S.opt.cursorborderradius,"border-radius":S.opt.cursorborderradius}),E.isieold&&c.css("overflow","hidden"),c.addClass("nicescroll-cursors"),S.cursorh=c,(b=n(l.createElement("div"))).attr("id",S.id+"-hr"),b.addClass("nicescroll-rails nicescroll-rails-hr"),b.height=Math.max(parseFloat(S.opt.cursorwidth),c.outerHeight()),b.css({height:b.height+"px",zIndex:S.zindex,background:S.opt.background}),b.append(c),b.visibility=!0,b.scrollable=!0,b.align="top"==S.opt.railvalign?0:1,S.railh=b,S.railh.drag=!1),S.ispage)d.css({position:"fixed",top:0,height:"100%"}),d.align?d.css({right:0}):d.css({left:0}),S.body.append(d),S.railh&&(b.css({position:"fixed",left:0,width:"100%"}),b.align?b.css({bottom:0}):b.css({top:0}),S.body.append(b));else{if(S.ishwscroll){"static"==S.win.css("position")&&S.css(S.win,{position:"relative"});var y="HTML"==S.win[0].nodeName?S.body:S.win;n(y).scrollTop(0).scrollLeft(0),S.zoom&&(S.zoom.css({position:"absolute",top:1,right:0,"margin-right":d.width+4}),y.append(S.zoom)),d.css({position:"absolute",top:0}),d.align?d.css({right:0}):d.css({left:0}),y.append(d),b&&(b.css({position:"absolute",left:0,bottom:0}),b.align?b.css({bottom:0}):b.css({top:0}),y.append(b))}else{S.isfixed="fixed"==S.win.css("position");var x=S.isfixed?"fixed":"absolute";S.isfixed||(S.viewport=S.getViewport(S.win[0])),S.viewport&&(S.body=S.viewport,0==/fixed|absolute/.test(S.viewport.css("position"))&&S.css(S.viewport,{position:"relative"})),d.css({position:x}),S.zoom&&S.zoom.css({position:x}),S.updateScrollBar(),S.body.append(d),S.zoom&&S.body.append(S.zoom),S.railh&&(b.css({position:x}),S.body.append(b))}E.isios&&S.css(S.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),E.isie&&S.opt.disableoutline&&S.win.attr("hideFocus","true"),E.iswebkit&&S.opt.disableoutline&&S.win.css("outline","none")}if(!1===S.opt.autohidemode?(S.autohidedom=!1,S.rail.css({opacity:S.opt.cursoropacitymax}),S.railh&&S.railh.css({opacity:S.opt.cursoropacitymax})):!0===S.opt.autohidemode||"leave"===S.opt.autohidemode?(S.autohidedom=n().add(S.rail),E.isie8&&(S.autohidedom=S.autohidedom.add(S.cursor)),S.railh&&(S.autohidedom=S.autohidedom.add(S.railh)),S.railh&&E.isie8&&(S.autohidedom=S.autohidedom.add(S.cursorh))):"scroll"==S.opt.autohidemode?(S.autohidedom=n().add(S.rail),S.railh&&(S.autohidedom=S.autohidedom.add(S.railh))):"cursor"==S.opt.autohidemode?(S.autohidedom=n().add(S.cursor),S.railh&&(S.autohidedom=S.autohidedom.add(S.cursorh))):"hidden"==S.opt.autohidemode&&(S.autohidedom=!1,S.hide(),S.railslocked=!1),E.cantouch||S.istouchcapable||S.opt.emulatetouch||E.hasmstouch){S.scrollmom=new v(S),S.ontouchstart=function(e){if(e.pointerType&&2!=e.pointerType&&"touch"!=e.pointerType)return!1;if(S.hasmoving=!1,!S.railslocked){var o;if(E.hasmstouch)for(o=!!e.target&&e.target;o;){var t=n(o).getNiceScroll();if(t.length>0&&t[0].me==S.me)break;if(t.length>0)return!1;if("DIV"==o.nodeName&&o.id==S.id)break;o=!!o.parentNode&&o.parentNode}if(e.stopPropagation(),S.cancelScroll(),(o=S.getTarget(e))&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return S.stopPropagation(e);if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),S.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(S.rail.drag={x:e.clientX,y:e.clientY,sx:S.scroll.x,sy:S.scroll.y,st:S.getScrollTop(),sl:S.getScrollLeft(),pt:2,dl:!1,tg:o},S.ispage||!S.opt.directionlockdeadzone)S.rail.drag.dl="f";else{var i={w:a.width(),h:a.height()},s={w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)},c=Math.max(0,s.h-i.h),d=Math.max(0,s.w-i.w);!S.rail.scrollable&&S.railh.scrollable?S.rail.drag.ck=c>0&&"v":S.rail.scrollable&&!S.railh.scrollable?S.rail.drag.ck=d>0&&"h":S.rail.drag.ck=!1,S.rail.drag.ck||(S.rail.drag.dl="f")}if(S.opt.emulatetouch&&S.isiframe&&E.isie){var u=S.win.position();S.rail.drag.x+=u.left,S.rail.drag.y+=u.top}if(S.hasmoving=!1,S.lastmouseup=!1,S.scrollmom.reset(e.clientX,e.clientY),!E.cantouch&&!this.istouchcapable&&!e.pointerType){if(!(!!o&&/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName)))return!S.ispage&&E.hasmousecapture&&o.setCapture(),S.opt.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(S.hasmoving)return!1;o._onclick.call(this,e)}),S.cancelEvent(e)):S.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(S.preventclick={tg:o,click:!1})}}},S.ontouchend=function(e){if(!S.rail.drag)return!0;if(2==S.rail.drag.pt){if(e.pointerType&&2!=e.pointerType&&"touch"!=e.pointerType)return!1;if(S.rail.drag=!1,S.hasmoving&&(S.scrollmom.doMomentum(),S.lastmouseup=!0,S.hideCursor(),E.hasmousecapture&&l.releaseCapture(),!E.cantouch))return S.cancelEvent(e)}else if(1==S.rail.drag.pt)return S.onmouseup(e)};var k=S.opt.emulatetouch&&S.isiframe&&!E.hasmousecapture;S.ontouchmove=function(e,o){if(!S.rail.drag)return!1;if(e.targetTouches&&S.opt.preventmultitouchscrolling&&e.targetTouches.length>1)return!1;if(e.pointerType&&2!=e.pointerType&&"touch"!=e.pointerType)return!1;if(2==S.rail.drag.pt){if("changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),S.rail.drag.y===e.clientY&&S.rail.drag.x===e.clientX)return!1;S.hasmoving||S.triggerScrollStart(e.clientX,e.clientY,0,0,0),S.hasmoving=!0,S.preventclick&&!S.preventclick.click&&(S.preventclick.click=S.preventclick.tg.onclick||!1,S.preventclick.tg.onclick=S.onpreventclick);var t,r;if(r=t=0,k&&!o){var i=S.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-S.rail.drag.y,a=e.clientX+r,c=a-S.rail.drag.x,d=S.rail.drag.st-n;S.ishwscroll&&S.opt.bouncescroll?d<0?d=Math.round(d/2):d>S.page.maxh&&(d=S.page.maxh+Math.round((d-S.page.maxh)/2)):(d<0&&(d=0,s=0),d>S.page.maxh&&(d=S.page.maxh,s=0));var u;S.railh&&S.railh.scrollable&&(u=S.isrtlmode?c-S.rail.drag.sl:S.rail.drag.sl-c,S.ishwscroll&&S.opt.bouncescroll?u<0?u=Math.round(u/2):u>S.page.maxw&&(u=S.page.maxw+Math.round((u-S.page.maxw)/2)):(u<0&&(u=0,a=0),u>S.page.maxw&&(u=S.page.maxw,a=0)));var h=!1;if(S.rail.drag.dl)h=!0,"v"==S.rail.drag.dl?u=S.rail.drag.sl:"h"==S.rail.drag.dl&&(d=S.rail.drag.st);else{var p=Math.abs(n),m=Math.abs(c),f=S.opt.directionlockdeadzone;if("v"==S.rail.drag.ck){if(p>f&&m<=.3*p)return S.rail.drag=!1,!0;m>f&&(S.rail.drag.dl="f",z.scrollTop(z.scrollTop()))}else if("h"==S.rail.drag.ck){if(m>f&&p<=.3*m)return S.rail.drag=!1,!0;p>f&&(S.rail.drag.dl="f",z.scrollLeft(z.scrollLeft()))}}if(S.synched("touchmove",function(){S.rail.drag&&2==S.rail.drag.pt&&(S.prepareTransition&&S.prepareTransition(0),S.rail.scrollable&&S.setScrollTop(d),S.scrollmom.update(a,s),S.railh&&S.railh.scrollable?(S.setScrollLeft(u),S.showCursor(d,u)):S.showCursor(d),E.isie10&&l.selection.clear())}),E.ischrome&&S.istouchcapable&&(h=!1),h)return S.cancelEvent(e)}else if(1==S.rail.drag.pt)return S.onmousemove(e)},S.ontouchstartCursor=function(e,o){if(!S.rail.drag||3==S.rail.drag.pt){if(S.locked)return S.cancelEvent(e);S.cancelScroll(),S.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:S.scroll.x,sy:S.scroll.y,pt:3,hr:!!o};var t=S.getTarget(e);return!S.ispage&&E.hasmousecapture&&t.setCapture(),S.isiframe&&!E.hasmousecapture&&(S.saved.csspointerevents=S.doc.css("pointer-events"),S.css(S.doc,{"pointer-events":"none"})),S.cancelEvent(e)}},S.ontouchendCursor=function(e){if(S.rail.drag){if(E.hasmousecapture&&l.releaseCapture(),S.isiframe&&!E.hasmousecapture&&S.doc.css("pointer-events",S.saved.csspointerevents),3!=S.rail.drag.pt)return;return S.rail.drag=!1,S.cancelEvent(e)}},S.ontouchmoveCursor=function(e){if(S.rail.drag){if(3!=S.rail.drag.pt)return;if(S.cursorfreezed=!0,S.rail.drag.hr){S.scroll.x=S.rail.drag.sx+(e.touches[0].clientX-S.rail.drag.x),S.scroll.x<0&&(S.scroll.x=0);var o=S.scrollvaluemaxw;S.scroll.x>o&&(S.scroll.x=o)}else{S.scroll.y=S.rail.drag.sy+(e.touches[0].clientY-S.rail.drag.y),S.scroll.y<0&&(S.scroll.y=0);var t=S.scrollvaluemax;S.scroll.y>t&&(S.scroll.y=t)}return S.synched("touchmove",function(){S.rail.drag&&3==S.rail.drag.pt&&(S.showCursor(),S.rail.drag.hr?S.doScrollLeft(Math.round(S.scroll.x*S.scrollratio.x),S.opt.cursordragspeed):S.doScrollTop(Math.round(S.scroll.y*S.scrollratio.y),S.opt.cursordragspeed))}),S.cancelEvent(e)}}}if(S.onmousedown=function(e,o){if(!S.rail.drag||1==S.rail.drag.pt){if(S.railslocked)return S.cancelEvent(e);S.cancelScroll(),S.rail.drag={x:e.clientX,y:e.clientY,sx:S.scroll.x,sy:S.scroll.y,pt:1,hr:o||!1};var t=S.getTarget(e);return!S.ispage&&E.hasmousecapture&&t.setCapture(),S.isiframe&&!E.hasmousecapture&&(S.saved.csspointerevents=S.doc.css("pointer-events"),S.css(S.doc,{"pointer-events":"none"})),S.hasmoving=!1,S.cancelEvent(e)}},S.onmouseup=function(e){if(S.rail.drag)return 1!=S.rail.drag.pt||(E.hasmousecapture&&l.releaseCapture(),S.isiframe&&!E.hasmousecapture&&S.doc.css("pointer-events",S.saved.csspointerevents),S.rail.drag=!1,S.hasmoving&&S.triggerScrollEnd(),S.cancelEvent(e))},S.onmousemove=function(e){if(S.rail.drag){if(1!==S.rail.drag.pt)return;if(E.ischrome&&0===e.which)return S.onmouseup(e);if(S.cursorfreezed=!0,S.hasmoving=!0,S.rail.drag.hr){S.scroll.x=S.rail.drag.sx+(e.clientX-S.rail.drag.x),S.scroll.x<0&&(S.scroll.x=0);var o=S.scrollvaluemaxw;S.scroll.x>o&&(S.scroll.x=o)}else{S.scroll.y=S.rail.drag.sy+(e.clientY-S.rail.drag.y),S.scroll.y<0&&(S.scroll.y=0);var t=S.scrollvaluemax;S.scroll.y>t&&(S.scroll.y=t)}return S.synched("mousemove",function(){S.rail.drag&&1==S.rail.drag.pt&&(S.showCursor(),S.rail.drag.hr?S.hasreversehr?S.doScrollLeft(S.scrollvaluemaxw-Math.round(S.scroll.x*S.scrollratio.x),S.opt.cursordragspeed):S.doScrollLeft(Math.round(S.scroll.x*S.scrollratio.x),S.opt.cursordragspeed):S.doScrollTop(Math.round(S.scroll.y*S.scrollratio.y),S.opt.cursordragspeed))}),S.cancelEvent(e)}S.checkarea=0},E.cantouch||S.opt.emulatetouch)S.onpreventclick=function(e){if(S.preventclick)return S.preventclick.tg.onclick=S.preventclick.click,S.preventclick=!1,S.cancelEvent(e)},S.onclick=!E.isios&&function(e){return!S.lastmouseup||(S.lastmouseup=!1,S.cancelEvent(e))},S.opt.grabcursorenabled&&E.cursorgrabvalue&&(S.css(S.ispage?S.doc:S.win,{cursor:E.cursorgrabvalue}),S.css(S.rail,{cursor:E.cursorgrabvalue}));else{var T=function(e){if(S.selectiondrag){if(e){var o=S.win.outerHeight(),t=e.pageY-S.selectiondrag.top;t>0&&t=o&&(t-=o),S.selectiondrag.df=t}if(0!=S.selectiondrag.df){var r=2*-Math.floor(S.selectiondrag.df/6);S.doScrollBy(r),S.debounced("doselectionscroll",function(){T()},50)}}};S.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},S.onselectionstart=function(e){S.ispage||(S.selectiondrag=S.win.offset())},S.onselectionend=function(e){S.selectiondrag=!1},S.onselectiondrag=function(e){S.selectiondrag&&S.hasTextSelected()&&S.debounced("selectionscroll",function(){T(e)},250)}}if(E.hasw3ctouch?(S.css(S.ispage?n("html"):S.win,{"touch-action":"none"}),S.css(S.rail,{"touch-action":"none"}),S.css(S.cursor,{"touch-action":"none"}),S.bind(S.win,"pointerdown",S.ontouchstart),S.bind(l,"pointerup",S.ontouchend),S.bind(l,"pointermove",S.ontouchmove)):E.hasmstouch?(S.css(S.ispage?n("html"):S.win,{"-ms-touch-action":"none"}),S.css(S.rail,{"-ms-touch-action":"none"}),S.css(S.cursor,{"-ms-touch-action":"none"}),S.bind(S.win,"MSPointerDown",S.ontouchstart),S.bind(l,"MSPointerUp",S.ontouchend),S.bind(l,"MSPointerMove",S.ontouchmove),S.bind(S.cursor,"MSGestureHold",function(e){e.preventDefault()}),S.bind(S.cursor,"contextmenu",function(e){e.preventDefault()})):E.cantouch&&(S.bind(S.win,"touchstart",S.ontouchstart,!1,!0),S.bind(l,"touchend",S.ontouchend,!1,!0),S.bind(l,"touchcancel",S.ontouchend,!1,!0),S.bind(l,"touchmove",S.ontouchmove,!1,!0)),S.opt.emulatetouch&&(S.bind(S.win,"mousedown",S.ontouchstart,!1,!0),S.bind(l,"mouseup",S.ontouchend,!1,!0),S.bind(l,"mousemove",S.ontouchmove,!1,!0)),(S.opt.cursordragontouch||!E.cantouch&&!S.opt.emulatetouch)&&(S.rail.css({cursor:"default"}),S.railh&&S.railh.css({cursor:"default"}),S.jqbind(S.rail,"mouseenter",function(){if(!S.ispage&&!S.win.is(":visible"))return!1;S.canshowonmouseevent&&S.showCursor(),S.rail.active=!0}),S.jqbind(S.rail,"mouseleave",function(){S.rail.active=!1,S.rail.drag||S.hideCursor()}),S.opt.sensitiverail&&(S.bind(S.rail,"click",function(e){S.doRailClick(e,!1,!1)}),S.bind(S.rail,"dblclick",function(e){S.doRailClick(e,!0,!1)}),S.bind(S.cursor,"click",function(e){S.cancelEvent(e)}),S.bind(S.cursor,"dblclick",function(e){S.cancelEvent(e)})),S.railh&&(S.jqbind(S.railh,"mouseenter",function(){if(!S.ispage&&!S.win.is(":visible"))return!1;S.canshowonmouseevent&&S.showCursor(),S.rail.active=!0}),S.jqbind(S.railh,"mouseleave",function(){S.rail.active=!1,S.rail.drag||S.hideCursor()}),S.opt.sensitiverail&&(S.bind(S.railh,"click",function(e){S.doRailClick(e,!1,!0)}),S.bind(S.railh,"dblclick",function(e){S.doRailClick(e,!0,!0)}),S.bind(S.cursorh,"click",function(e){S.cancelEvent(e)}),S.bind(S.cursorh,"dblclick",function(e){S.cancelEvent(e)})))),S.opt.cursordragontouch&&(this.istouchcapable||E.cantouch)&&(S.bind(S.cursor,"touchstart",S.ontouchstartCursor),S.bind(S.cursor,"touchmove",S.ontouchmoveCursor),S.bind(S.cursor,"touchend",S.ontouchendCursor),S.cursorh&&S.bind(S.cursorh,"touchstart",function(e){S.ontouchstartCursor(e,!0)}),S.cursorh&&S.bind(S.cursorh,"touchmove",S.ontouchmoveCursor),S.cursorh&&S.bind(S.cursorh,"touchend",S.ontouchendCursor)),E.cantouch||S.opt.emulatetouch?(S.bind(E.hasmousecapture?S.win:l,"mouseup",S.ontouchend),S.onclick&&S.bind(l,"click",S.onclick),S.opt.cursordragontouch?(S.bind(S.cursor,"mousedown",S.onmousedown),S.bind(S.cursor,"mouseup",S.onmouseup),S.cursorh&&S.bind(S.cursorh,"mousedown",function(e){S.onmousedown(e,!0)}),S.cursorh&&S.bind(S.cursorh,"mouseup",S.onmouseup)):(S.bind(S.rail,"mousedown",function(e){e.preventDefault()}),S.railh&&S.bind(S.railh,"mousedown",function(e){e.preventDefault()}))):(S.bind(E.hasmousecapture?S.win:l,"mouseup",S.onmouseup),S.bind(l,"mousemove",S.onmousemove),S.onclick&&S.bind(l,"click",S.onclick),S.bind(S.cursor,"mousedown",S.onmousedown),S.bind(S.cursor,"mouseup",S.onmouseup),S.railh&&(S.bind(S.cursorh,"mousedown",function(e){S.onmousedown(e,!0)}),S.bind(S.cursorh,"mouseup",S.onmouseup)),!S.ispage&&S.opt.enablescrollonselection&&(S.bind(S.win[0],"mousedown",S.onselectionstart),S.bind(l,"mouseup",S.onselectionend),S.bind(S.cursor,"mouseup",S.onselectionend),S.cursorh&&S.bind(S.cursorh,"mouseup",S.onselectionend),S.bind(l,"mousemove",S.onselectiondrag)),S.zoom&&(S.jqbind(S.zoom,"mouseenter",function(){S.canshowonmouseevent&&S.showCursor(),S.rail.active=!0}),S.jqbind(S.zoom,"mouseleave",function(){S.rail.active=!1,S.rail.drag||S.hideCursor()}))),S.opt.enablemousewheel&&(S.isiframe||S.mousewheel(E.isie&&S.ispage?l:S.win,S.onmousewheel),S.mousewheel(S.rail,S.onmousewheel),S.railh&&S.mousewheel(S.railh,S.onmousewheelhr)),S.ispage||E.cantouch||/HTML|^BODY/.test(S.win[0].nodeName)||(S.win.attr("tabindex")||S.win.attr({tabindex:++r}),S.bind(S.win,"focus",function(e){o=S.getTarget(e).id||!0,S.hasfocus=!0,S.canshowonmouseevent&&S.noticeCursor()}),S.bind(S.win,"blur",function(e){o=!1,S.hasfocus=!1}),S.bind(S.win,"mouseenter",function(e){t=S.getTarget(e).id||!0,S.hasmousefocus=!0,S.canshowonmouseevent&&S.noticeCursor()}),S.bind(S.win,"mouseleave",function(e){t=!1,S.hasmousefocus=!1,S.rail.drag||S.hideCursor()})),S.onkeypress=function(e){if(S.railslocked&&0==S.page.maxh)return!0;e=e||window.e;var r=S.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(S.hasfocus||S.hasmousefocus&&!o||S.ispage&&!o&&!t){var i=e.keyCode;if(S.railslocked&&27!=i)return S.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,a=!1;switch(i){case 38:case 63233:S.doScrollBy(72),a=!0;break;case 40:case 63235:S.doScrollBy(-72),a=!0;break;case 37:case 63232:S.railh&&(s?S.doScrollLeft(0):S.doScrollLeftBy(72),a=!0);break;case 39:case 63234:S.railh&&(s?S.doScrollLeft(S.page.maxw):S.doScrollLeftBy(-72),a=!0);break;case 33:case 63276:S.doScrollBy(S.view.h),a=!0;break;case 34:case 63277:S.doScrollBy(-S.view.h),a=!0;break;case 36:case 63273:S.railh&&s?S.doScrollPos(0,0):S.doScrollTo(0),a=!0;break;case 35:case 63275:S.railh&&s?S.doScrollPos(S.page.maxw,S.page.maxh):S.doScrollTo(S.page.maxh),a=!0;break;case 32:S.opt.spacebarenabled&&(l?S.doScrollBy(S.view.h):S.doScrollBy(-S.view.h),a=!0);break;case 27:S.zoomactive&&(S.doZoom(),a=!0)}if(a)return S.cancelEvent(e)}},S.opt.enablekeyboard&&S.bind(l,E.isopera&&!E.isopera12?"keypress":"keydown",S.onkeypress),S.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(S.wheelprevented=!0)}),S.bind(l,"keyup",function(e){e.ctrlKey||!1||(S.wheelprevented=!1)}),S.bind(window,"blur",function(e){S.wheelprevented=!1}),S.bind(window,"resize",S.lazyResize),S.bind(window,"orientationchange",S.lazyResize),S.bind(window,"load",S.lazyResize),E.ischrome&&!S.ispage&&!S.haswrapper){var M=S.win.attr("style"),L=parseFloat(S.win.css("width"))+1;S.win.css("width",L),S.synched("chromefix",function(){S.win.attr("style",M)})}S.onAttributeChange=function(e){S.lazyResize(S.isieold?250:30)},S.opt.enableobserver&&(S.isie11||!1===h||(S.observerbody=new h(function(e){if(e.forEach(function(e){if("attributes"==e.type)return z.hasClass("modal-open")&&z.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],S.doc[0])?S.hide():S.show()}),S.me.clientWidth!=S.page.width||S.me.clientHeight!=S.page.height)return S.lazyResize(30)}),S.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),S.ispage||S.haswrapper||(!1!==h?(S.observer=new h(function(e){e.forEach(S.onAttributeChange)}),S.observer.observe(S.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),S.observerremover=new h(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(S&&e.removedNodes[o]==S.win[0])return S.remove()})}),S.observerremover.observe(S.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(S.bind(S.win,E.isie&&!E.isie9?"propertychange":"DOMAttrModified",S.onAttributeChange),E.isie9&&S.win[0].attachEvent("onpropertychange",S.onAttributeChange),S.bind(S.win,"DOMNodeRemoved",function(e){e.target==S.win[0]&&S.remove()})))),!S.ispage&&S.opt.boxzoom&&S.bind(window,"resize",S.resizeZoom),S.istextarea&&(S.bind(S.win,"keydown",S.lazyResize),S.bind(S.win,"mouseup",S.lazyResize)),S.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var C=function(){S.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow.document).domain}catch(e){S.iframexd=!0,o=!1}if(S.iframexd)return"console"in window&&console.log("NiceScroll error: policy restriced iframe"),!0;if(S.forcescreen=!0,S.isiframe&&(S.iframe={doc:n(o),html:S.doc.contents().find("html")[0],body:S.doc.contents().find("body")[0]},S.getContentSize=function(){return{w:Math.max(S.iframe.html.scrollWidth,S.iframe.body.scrollWidth),h:Math.max(S.iframe.html.scrollHeight,S.iframe.body.scrollHeight)}},S.docscroll=n(S.iframe.body)),!E.isios&&S.opt.iframeautoresize&&!S.isiframe){S.win.scrollTop(0),S.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);S.doc.height(t)}S.lazyResize(30),S.css(n(S.iframe.body),e),E.isios&&S.haswrapper&&S.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?S.bind(this.contentWindow,"scroll",S.onscroll):S.bind(o,"scroll",S.onscroll),S.opt.enablemousewheel&&S.mousewheel(o,S.onmousewheel),S.opt.enablekeyboard&&S.bind(o,E.isopera?"keypress":"keydown",S.onkeypress),E.cantouch?(S.bind(o,"touchstart",S.ontouchstart),S.bind(o,"touchmove",S.ontouchmove)):S.opt.emulatetouch&&(S.bind(o,"mousedown",S.ontouchstart),S.bind(o,"mousemove",function(e){return S.ontouchmove(e,!0)}),S.opt.grabcursorenabled&&E.cursorgrabvalue&&S.css(n(o.body),{cursor:E.cursorgrabvalue})),S.bind(o,"mouseup",S.ontouchend),S.zoom&&(S.opt.dblclickzoom&&S.bind(o,"dblclick",S.doZoom),S.ongesturezoom&&S.bind(o,"gestureend",S.ongesturezoom))};this.doc[0].readyState&&"complete"==this.doc[0].readyState&&setTimeout(function(){C.call(S.doc[0],!1)},500),S.bind(this.doc,"load",C)}},this.showCursor=function(e,o){if(S.cursortimeout&&(clearTimeout(S.cursortimeout),S.cursortimeout=0),S.rail){if(S.autohidedom&&(S.autohidedom.stop().css({opacity:S.opt.cursoropacitymax}),S.cursoractive=!0),S.rail.drag&&1==S.rail.drag.pt||(void 0!==e&&!1!==e&&(S.scroll.y=Math.round(1*e/S.scrollratio.y)),void 0!==o&&(S.scroll.x=Math.round(1*o/S.scrollratio.x))),S.cursor.css({height:S.cursorheight,top:S.scroll.y}),S.cursorh){var t=S.hasreversehr?S.scrollvaluemaxw-S.scroll.x:S.scroll.x;!S.rail.align&&S.rail.visibility?S.cursorh.css({width:S.cursorwidth,left:t+S.rail.width}):S.cursorh.css({width:S.cursorwidth,left:t}),S.cursoractive=!0}S.zoom&&S.zoom.stop().css({opacity:S.opt.cursoropacitymax})}},this.hideCursor=function(e){S.cursortimeout||S.rail&&S.autohidedom&&(S.hasmousefocus&&"leave"==S.opt.autohidemode||(S.cursortimeout=setTimeout(function(){S.rail.active&&S.showonmouseevent||(S.autohidedom.stop().animate({opacity:S.opt.cursoropacitymin}),S.zoom&&S.zoom.stop().animate({opacity:S.opt.cursoropacitymin}),S.cursoractive=!1),S.cursortimeout=0},e||S.opt.hidecursordelay)))},this.noticeCursor=function(e,o,t){S.showCursor(o,t),S.rail.active||S.hideCursor(e)},this.getContentSize=S.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:S.haswrapper?function(){return{w:S.doc[0].offsetWidth,h:S.doc[0].offsetHeight}}:function(){return{w:S.docscroll[0].scrollWidth,h:S.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!S||!S.win)return!1;if(!S.haswrapper&&!S.ispage){if("none"==S.win.css("display"))return S.visibility&&S.hideRail().hideRailHr(),!1;S.hidden||S.visibility||S.showRail().showRailHr()}var t=S.page.maxh,r=S.page.maxw,i={h:S.view.h,w:S.view.w};if(S.view={w:S.ispage?S.win.width():S.win[0].clientWidth,h:S.ispage?S.win.height():S.win[0].clientHeight},S.page=o||S.getContentSize(),S.page.maxh=Math.max(0,S.page.h-S.view.h),S.page.maxw=Math.max(0,S.page.w-S.view.w),S.page.maxh==t&&S.page.maxw==r&&S.view.w==i.w&&S.view.h==i.h){if(S.ispage)return S;var s=S.win.offset();if(S.lastposition){var n=S.lastposition;if(n.top==s.top&&n.left==s.left)return S}S.lastposition=s}return 0===S.page.maxh?(S.hideRail(),S.scrollvaluemax=0,S.scroll.y=0,S.scrollratio.y=0,S.cursorheight=0,S.setScrollTop(0),S.rail&&(S.rail.scrollable=!1)):(S.page.maxh-=S.opt.railpadding.top+S.opt.railpadding.bottom,S.rail.scrollable=!0),0===S.page.maxw?(S.hideRailHr(),S.scrollvaluemaxw=0,S.scroll.x=0,S.scrollratio.x=0,S.cursorwidth=0,S.setScrollLeft(0),S.railh&&(S.railh.scrollable=!1)):(S.page.maxw-=S.opt.railpadding.left+S.opt.railpadding.right,S.railh&&(S.railh.scrollable=S.opt.horizrailenabled)),S.railslocked=S.locked||0===S.page.maxh&&0===S.page.maxw,S.railslocked?(S.ispage||S.updateScrollBar(S.view),!1):(S.hidden||S.visibility?!S.railh||S.hidden||S.railh.visibility||S.showRailHr():S.showRail().showRailHr(),S.istextarea&&S.win.css("resize")&&"none"!=S.win.css("resize")&&(S.view.h-=20),S.cursorheight=Math.min(S.view.h,Math.round(S.view.h*(S.view.h/S.page.h))),S.cursorheight=S.opt.cursorfixedheight?S.opt.cursorfixedheight:Math.max(S.opt.cursorminheight,S.cursorheight),S.cursorwidth=Math.min(S.view.w,Math.round(S.view.w*(S.view.w/S.page.w))),S.cursorwidth=S.opt.cursorfixedheight?S.opt.cursorfixedheight:Math.max(S.opt.cursorminheight,S.cursorwidth),S.scrollvaluemax=S.view.h-S.cursorheight-(S.opt.railpadding.top+S.opt.railpadding.bottom),S.railh&&(S.railh.width=S.page.maxh>0?S.view.w-S.rail.width:S.view.w,S.scrollvaluemaxw=S.railh.width-S.cursorwidth-(S.opt.railpadding.left+S.opt.railpadding.right)),S.ispage||S.updateScrollBar(S.view),S.scrollratio={x:S.page.maxw/S.scrollvaluemaxw,y:S.page.maxh/S.scrollvaluemax},S.getScrollTop()>S.page.maxh?S.doScrollTop(S.page.maxh):(S.scroll.y=Math.round(S.getScrollTop()*(1/S.scrollratio.y)),S.scroll.x=Math.round(S.getScrollLeft()*(1/S.scrollratio.x)),S.cursoractive&&S.noticeCursor()),S.scroll.y&&0==S.getScrollTop()&&S.doScrollTo(Math.floor(S.scroll.y*S.scrollratio.y)),S)},this.resize=S.onResize,this.hlazyresize=0,this.lazyResize=function(e){return S.haswrapper||S.hide(),S.hlazyresize&&clearTimeout(S.hlazyresize),S.hlazyresize=setTimeout(function(){S&&(S.resize(),S.show())},240),S},this.jqbind=function(e,o,t){S.events.push({e:e,n:o,f:t,q:!0}),n(e).bind(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))S._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";y(r,i,o,t||!1),"DOMMouseScroll"==i&&y(r,"MozMousePixelScroll",o,t||!1)}};var R=!1;if(E.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){R=!0}});window.addEventListener("test",null,H)}catch(e){}this.cancelEvent=function(e){return!!e&&((e=e.original?e.original:e).cancelable&&e.preventDefault(),e.stopPropagation(),e.preventManipulation&&e.preventManipulation(),!1)},this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},window.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},window.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return!!(e=window.event||!1)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1,!1)},this.stopPropagation=function(e){return!!(e=window.event||!1)&&(e.cancelBubble=!0,!1)};this.bind=function(e,o,t,r,i){var s="jquery"in e?e[0]:e;S._bind(s,o,t,r||!1,i||!1)},this._bind=function(e,o,t,r,i){S.events.push({e:e,n:o,f:t,b:r,q:!1}),R&&i?e.addEventListener(o,t,{passive:!1,capture:r}):e.addEventListener(o,t,r||!1)},this._unbind=function(e,o,t,r){e.removeEventListener(o,t,r)},this.unbindAll=function(){for(var e=0;e0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:S.newscrollx,y:S.newscrolly},speed:i};S.onscrollstart.call(S,s)},this.triggerScrollEnd=function(){if(S.onscrollend){var e=S.getScrollLeft(),o=S.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};S.onscrollend.call(S,t)}},this.onmousewheel=function(e){if(!S.wheelprevented){if(S.railslocked)return S.debounced("checkunlock",S.resize,250),!0;if(S.rail.drag)return S.cancelEvent(e);if("auto"===S.opt.oneaxismousemode&&0!==e.deltaX&&(S.opt.oneaxismousemode=!1),S.opt.oneaxismousemode&&0===e.deltaX&&!S.rail.scrollable)return!S.railh||!S.railh.scrollable||S.onmousewheelhr(e);var o=p(),t=!1;if(S.opt.preservenativescrolling&&S.checkarea+60020?t:0},S.opt.smoothscroll?S.ishwscroll&&E.hastransition&&S.opt.usetransition&&S.opt.smoothscroll?(this.prepareTransition=function(e,o){var t=o?e>20?e:0:S.getTransitionSpeed(e),r=t?E.prefixstyle+"transform "+t+"ms ease-out":"";return S.lasttransitionstyle&&S.lasttransitionstyle==r||(S.lasttransitionstyle=r,S.doc.css(E.transitionstyle,r)),t},this.doScrollLeft=function(e,o){var t=S.scrollrunning?S.newscrolly:S.getScrollTop();S.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=S.scrollrunning?S.newscrollx:S.getScrollLeft();S.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=S.getScrollTop(),i=S.getScrollLeft();return((S.newscrolly-r)*(o-r)<0||(S.newscrollx-i)*(e-i)<0)&&S.cancelScroll(),0==S.opt.bouncescroll&&(o<0?o=0:o>S.page.maxh&&(o=S.page.maxh),e<0?e=0:e>S.page.maxw&&(e=S.page.maxw)),(!S.scrollrunning||e!=S.newscrollx||o!=S.newscrolly)&&(S.newscrolly=o,S.newscrollx=e,S.newscrollspeed=t||!1,!S.timer&&void(S.timer=setTimeout(function(){var t=S.getScrollTop(),r=S.getScrollLeft(),i={};i.x=e-r,i.y=o-t,i.px=r,i.py=t;var s=Math.round(Math.sqrt(Math.pow(i.x,2)+Math.pow(i.y,2))),n=S.newscrollspeed&&S.newscrollspeed>1?S.newscrollspeed:S.getTransitionSpeed(s);if(S.newscrollspeed&&S.newscrollspeed<=1&&(n*=S.newscrollspeed),S.prepareTransition(n,!0),S.timerscroll&&S.timerscroll.tm&&clearInterval(S.timerscroll.tm),n>0){!S.scrollrunning&&S.onscrollstart&&S.triggerScrollStart(r,t,e,o,n),E.transitionend?S.scrollendtrapped||(S.scrollendtrapped=!0,S.bind(S.doc,E.transitionend,S.onScrollTransitionEnd,!1)):(S.scrollendtrapped&&clearTimeout(S.scrollendtrapped),S.scrollendtrapped=setTimeout(S.onScrollTransitionEnd,n));var l=t,a=r;S.timerscroll={bz:new C(l,S.newscrolly,n,0,0,.58,1),bh:new C(a,S.newscrollx,n,0,0,.58,1)},S.cursorfreezed||(S.timerscroll.tm=setInterval(function(){S.showCursor(S.getScrollTop(),S.getScrollLeft())},60))}S.synched("doScroll-set",function(){S.timer=0,S.scrollendtrapped&&(S.scrollrunning=!0),S.setScrollTop(S.newscrolly),S.setScrollLeft(S.newscrollx),S.scrollendtrapped||S.onScrollTransitionEnd()})},50)))},this.cancelScroll=function(){if(!S.scrollendtrapped)return!0;var e=S.getScrollTop(),o=S.getScrollLeft();return S.scrollrunning=!1,E.transitionend||clearTimeout(E.transitionend),S.scrollendtrapped=!1,S._unbind(S.doc[0],E.transitionend,S.onScrollTransitionEnd),S.prepareTransition(0),S.setScrollTop(e),S.railh&&S.setScrollLeft(o),S.timerscroll&&S.timerscroll.tm&&clearInterval(S.timerscroll.tm),S.timerscroll=!1,S.cursorfreezed=!1,S.showCursor(e,o),S},this.onScrollTransitionEnd=function(){S.scrollendtrapped&&S._unbind(S.doc[0],E.transitionend,S.onScrollTransitionEnd),S.scrollendtrapped=!1,S.prepareTransition(0),S.timerscroll&&S.timerscroll.tm&&clearInterval(S.timerscroll.tm),S.timerscroll=!1;var e=S.getScrollTop(),o=S.getScrollLeft();if(S.setScrollTop(e),S.railh&&S.setScrollLeft(o),S.noticeCursor(!1,e,o),S.cursorfreezed=!1,e<0?e=0:e>S.page.maxh&&(e=S.page.maxh),o<0?o=0:o>S.page.maxw&&(o=S.page.maxw),e!=S.newscrolly||o!=S.newscrollx)return S.doScrollPos(o,e,S.opt.snapbackspeed);S.onscrollend&&S.scrollrunning&&S.triggerScrollEnd(),S.scrollrunning=!1}):(this.doScrollLeft=function(e,o){var t=S.scrollrunning?S.newscrolly:S.getScrollTop();S.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=S.scrollrunning?S.newscrollx:S.getScrollLeft();S.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){function r(){if(S.cancelAnimationFrame)return!0;if(S.scrollrunning=!0,h=1-h)return S.timer=c(r)||1;var e,o,t=0,i=o=S.getScrollTop();S.dst.ay?(((n=(i=S.bzscroll?S.dst.py+S.bzscroll.getNow()*S.dst.ay:S.newscrolly)-o)<0&&i0&&i>S.newscrolly)&&(i=S.newscrolly),S.setScrollTop(i),i==S.newscrolly&&(t=1)):t=1;var s=e=S.getScrollLeft();if(S.dst.ax){var n=(s=S.bzscroll?S.dst.px+S.bzscroll.getNow()*S.dst.ax:S.newscrollx)-e;(n<0&&s0&&s>S.newscrollx)&&(s=S.newscrollx),S.setScrollLeft(s),s==S.newscrollx&&(t+=1)}else t+=1;2==t?(S.timer=0,S.cursorfreezed=!1,S.bzscroll=!1,S.scrollrunning=!1,i<0?i=0:i>S.page.maxh&&(i=Math.max(0,S.page.maxh)),s<0?s=0:s>S.page.maxw&&(s=S.page.maxw),s!=S.newscrollx||i!=S.newscrolly?S.doScrollPos(s,i):S.onscrollend&&S.triggerScrollEnd()):S.timer=c(r)||1}var o=void 0===o||!1===o?S.getScrollTop(!0):o;if(S.timer&&S.newscrolly==o&&S.newscrollx==e)return!0;S.timer&&d(S.timer),S.timer=0;var i=S.getScrollTop(),s=S.getScrollLeft();((S.newscrolly-i)*(o-i)<0||(S.newscrollx-s)*(e-s)<0)&&S.cancelScroll(),S.newscrolly=o,S.newscrollx=e,S.bouncescroll&&S.rail.visibility||(S.newscrolly<0?S.newscrolly=0:S.newscrolly>S.page.maxh&&(S.newscrolly=S.page.maxh)),S.bouncescroll&&S.railh.visibility||(S.newscrollx<0?S.newscrollx=0:S.newscrollx>S.page.maxw&&(S.newscrollx=S.page.maxw)),S.dst={},S.dst.x=e-s,S.dst.y=o-i,S.dst.px=s,S.dst.py=i;var n=Math.round(Math.sqrt(Math.pow(S.dst.x,2)+Math.pow(S.dst.y,2)));S.dst.ax=S.dst.x/n,S.dst.ay=S.dst.y/n;var l=0,a=n;0==S.dst.x?(l=i,a=o,S.dst.ay=1,S.dst.py=0):0==S.dst.y&&(l=s,a=e,S.dst.ax=1,S.dst.px=0);var u=S.getTransitionSpeed(n);if(t&&t<=1&&(u*=t),S.bzscroll=u>0&&(S.bzscroll?S.bzscroll.update(a,u):new C(l,a,u,0,1,0,1)),!S.timer){(i==S.page.maxh&&o>=S.page.maxh||s==S.page.maxw&&e>=S.page.maxw)&&S.checkContentSize();var h=1;S.cancelAnimationFrame=!1,S.timer=1,S.onscrollstart&&!S.scrollrunning&&S.triggerScrollStart(s,i,e,o,u),r(),(i==S.page.maxh&&o>=i||s==S.page.maxw&&e>=s)&&S.checkContentSize(),S.noticeCursor()}},this.cancelScroll=function(){return S.timer&&d(S.timer),S.timer=0,S.bzscroll=!1,S.scrollrunning=!1,S}):(this.doScrollLeft=function(e,o){var t=S.getScrollTop();S.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=S.getScrollLeft();S.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>S.page.maxw?S.page.maxw:e;r<0&&(r=0);var i=o>S.page.maxh?S.page.maxh:o;i<0&&(i=0),S.synched("scroll",function(){S.setScrollTop(i),S.setScrollLeft(r)})},this.cancelScroll=function(){}),this.doScrollBy=function(e,o){var t=0;if(t=o?Math.floor((S.scroll.y-e)*S.scrollratio.y):(S.timer?S.newscrolly:S.getScrollTop(!0))-e,S.bouncescroll){var r=Math.round(S.view.h/2);t<-r?t=-r:t>S.page.maxh+r&&(t=S.page.maxh+r)}S.cursorfreezed=!1;var i=S.getScrollTop(!0);return t<0&&i<=0?S.noticeCursor():t>S.page.maxh&&i>=S.page.maxh?(S.checkContentSize(),S.noticeCursor()):void S.doScrollTop(t)},this.doScrollLeftBy=function(e,o){var t=0;if(t=o?Math.floor((S.scroll.x-e)*S.scrollratio.x):(S.timer?S.newscrollx:S.getScrollLeft(!0))-e,S.bouncescroll){var r=Math.round(S.view.w/2);t<-r?t=-r:t>S.page.maxw+r&&(t=S.page.maxw+r)}S.cursorfreezed=!1;var i=S.getScrollLeft(!0);return t<0&&i<=0?S.noticeCursor():t>S.page.maxw&&i>=S.page.maxw?S.noticeCursor():void S.doScrollLeft(t)},this.doScrollTo=function(e,o){var t=o?Math.round(e*S.scrollratio.y):e;t<0?t=0:t>S.page.maxh&&(t=S.page.maxh),S.cursorfreezed=!1,S.doScrollTop(e)},this.checkContentSize=function(){var e=S.getContentSize();e.h==S.page.h&&e.w==S.page.w||S.resize(!1,e)},S.onscroll=function(e){S.rail.drag||S.cursorfreezed||S.synched("scroll",function(){S.scroll.y=Math.round(S.getScrollTop()*(1/S.scrollratio.y)),S.railh&&(S.scroll.x=Math.round(S.getScrollLeft()*(1/S.scrollratio.x))),S.noticeCursor()})},S.bind(S.docscroll,"scroll",S.onscroll),this.doZoomIn=function(e){if(!S.zoomactive){S.zoomactive=!0,S.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=S.win[0].style;for(var r in o){var i=o[r];S.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}S.zoomrestore.style.width=S.win.css("width"),S.zoomrestore.style.height=S.win.css("height"),S.zoomrestore.padding={w:S.win.outerWidth()-S.win.width(),h:S.win.outerHeight()-S.win.height()},E.isios4&&(S.zoomrestore.scrollTop=a.scrollTop(),a.scrollTop(0)),S.win.css({position:E.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=S.win.css("backgroundColor");return(""==n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&S.win.css("backgroundColor","#fff"),S.rail.css({zIndex:s+101}),S.zoom.css({zIndex:s+102}),S.zoom.css("backgroundPosition","0 -18px"),S.resizeZoom(),S.onzoomin&&S.onzoomin.call(S),S.cancelEvent(e)}},this.doZoomOut=function(e){if(S.zoomactive)return S.zoomactive=!1,S.win.css("margin",""),S.win.css(S.zoomrestore.style),E.isios4&&a.scrollTop(S.zoomrestore.scrollTop),S.rail.css({"z-index":S.zindex}),S.zoom.css({"z-index":S.zindex}),S.zoomrestore=!1,S.zoom.css("backgroundPosition","0 0"),S.onResize(),S.onzoomout&&S.onzoomout.call(S),S.cancelEvent(e)},this.doZoom=function(e){return S.zoomactive?S.doZoomOut(e):S.doZoomIn(e)},this.resizeZoom=function(){if(S.zoomactive){var e=S.getScrollTop();S.win.css({width:a.width()-S.zoomrestore.padding.w+"px",height:a.height()-S.zoomrestore.padding.h+"px"}),S.onResize(),S.setScrollTop(Math.min(S.page.maxh,e))}},this.init(),n.nicescroll.push(this)},v=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=p(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=p();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=p(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var m=o.lastscrollx,f=o.lastscrolly,g=function(){var e=p()-t>600?.04:.02;o.speedx&&(m=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=m,(m<0||m>l)&&(e=.1)),o.speedy&&(f=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=f,(f<0||f>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=m,o.nc.setScrollLeft(m)}if(o.speedy){o.nc.getScrollTop();o.chky=f,o.nc.setScrollTop(f)}o.timer||(o.nc.hideCursor(),o.doSnapy(m,f))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(m,f))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},b=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():b.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):b.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():b.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):b.call(n(this),e)})};var y=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():y.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):y.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():y.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):y.call(n(this),e)})};var x=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new w(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},window.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new x,n.nicescroll.options=m)}); \ No newline at end of file +!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,n=0,s=e,l=s(window),a=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||!1}(),c=function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||!1}();if(a)window.cancelAnimationFrame||(c=function(e){});else{var d=0;a=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-d)),i=window.setTimeout(function(){e(t+r)},r);return d=t+r,i},c=function(e){window.clearTimeout(e)}}var u=window.MutationObserver||window.WebKitMutationObserver||!1,h=Date.now||function(){return(new Date).getTime()},p={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:60,mousescrollstep:24,touchbehavior:!1,emulatetouch:!1,hwacceleration:!0,usetransition:!0,boxzoom:!1,dblclickzoom:!0,gesturezoom:!0,grabcursorenabled:!0,autohidemode:!0,background:"",iframeautoresize:!0,cursorminheight:32,preservenativescrolling:!0,railoffset:!1,railhoffset:!1,bouncescroll:!0,spacebarenabled:!0,railpadding:{top:0,right:0,left:0,bottom:0},disableoutline:!0,horizrailenabled:!0,railalign:"right",railvalign:"bottom",enabletranslate3d:!0,enablemousewheel:!0,enablekeyboard:!0,smoothscroll:!0,sensitiverail:!0,enablemouselockapi:!0,cursorfixedheight:!1,directionlockdeadzone:6,hidecursordelay:400,nativeparentscrolling:!0,enablescrollonselection:!0,overflowx:!0,overflowy:!0,cursordragspeed:.3,rtlmode:"auto",cursordragontouch:!1,oneaxismousemode:"auto",scriptpath:function(){var e=document.currentScript||function(){var e=document.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},m=!1,f=function(){if(m)return m;var e=document.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in document||"webkitPointerLockElement"in document||"mozPointerLockElement"in document,i.isopera="opera"in window,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(window.operamini),i.isie="all"in document&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in document)||7===document.documentMode),i.isie8=i.isie&&"documentMode"in document&&8===document.documentMode,i.isie9=i.isie&&"performance"in window&&9===document.documentMode,i.isie10=i.isie&&"performance"in window&&10===document.documentMode,i.isie11="msRequestFullscreen"in e&&document.documentMode>=11,i.ismsedge="msCredentials"in window,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in window,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in document.documentElement||"ontouchstart"in window,i.hasw3ctouch=(window.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(window.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in document,i.isios8=i.isios&&"hidden"in document,i.isios10=i.isios&&window.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!=o)return parseInt(o);e=e.parent()}return!1}function v(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var n=3==(i=N[r]||0)?t?x.win.outerHeight()-x.win.innerHeight():x.win.outerWidth()-x.win.innerWidth():1;return x.isie8&&i&&(i+=1),n?i:0}return i}function b(e,o,t,r){x._bind(e,o,function(r){var i={original:r=r||window.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function y(e,o,t){var r,i;if(0==e.deltaMode?(r=-Math.floor(e.deltaX*(x.opt.mousescrollstep/54)),i=-Math.floor(e.deltaY*(x.opt.mousescrollstep/54))):1==e.deltaMode&&(r=-Math.floor(e.deltaX*x.opt.mousescrollstep),i=-Math.floor(e.deltaY*x.opt.mousescrollstep)),o&&x.opt.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?x.getScrollLeft()>=x.page.maxw:x.getScrollLeft()<=0)&&(i=r,r=0)),x.isrtlmode&&(r=-r),r){if(x.scrollmom)x.scrollmom.stop();else if(r<0){if(x.getScrollLeft()>=x.page.maxw)return!0}else if(x.getScrollLeft()<=0)return!0;x.lastdeltax+=r,x.debounced("mousewheelx",function(){var e=x.lastdeltax;x.lastdeltax=0,x.rail.drag||x.doScrollLeftBy(e)},15)}if(i){if(x.opt.nativeparentscrolling&&t&&!x.ispage&&!x.zoomactive)if(i<0){if(x.getScrollTop()>=x.page.maxh)return!0}else if(x.getScrollTop()<=0)return!0;x.scrollmom&&x.scrollmom.stop(),x.lastdeltay+=i,x.synched("mousewheely",function(){var e=x.lastdeltay;x.lastdeltay=0,x.rail.drag||x.doScrollBy(e)},15)}return e.stopImmediatePropagation(),e.preventDefault()}var x=this;this.version="3.7.2",this.name="nicescroll",this.me=d;var S=s("body");if(this.opt={doc:S,win:!1},s.extend(this.opt,p),this.opt.snapbackspeed=80,e)for(var z in x.opt)void 0!==e[z]&&(x.opt[z]=e[z]);if(x.opt.disablemutationobserver&&(u=!1),this.doc=x.opt.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(x.opt.win?x.opt.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==x.opt.win,this.win=x.opt.win||(this.ispage?l:this.doc),this.docscroll=this.ispage&&!this.haswrapper?l:this.win,this.body=S,this.viewport=!1,this.isfixed=!1,this.iframe=!1,this.isiframe="IFRAME"==this.doc[0].nodeName&&"IFRAME"==this.win[0].nodeName,this.istextarea="TEXTAREA"==this.win[0].nodeName,this.forcescreen=!1,this.canshowonmouseevent="scroll"!=x.opt.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==this.opt.rtlmode){var k=this.win[0]==window?this.body:this.win,T=k.css("writing-mode")||k.css("-webkit-writing-mode")||k.css("-ms-writing-mode")||k.css("-moz-writing-mode");"horizontal-tb"==T||"lr-tb"==T||""==T?(this.isrtlmode="rtl"==k.css("direction"),this.isvertical=!1):(this.isrtlmode="vertical-rl"==T||"tb"==T||"tb-rl"==T||"rl-tb"==T,this.isvertical="vertical-rl"==T||"tb"==T||"tb-rl"==T)}else this.isrtlmode=!0===this.opt.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1===x.opt.scrollbarid)do{this.id="ascrail"+i++}while(document.getElementById(this.id));else this.id=x.opt.scrollbarid;this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=x.opt.overflowx,this.overflowy=x.opt.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=f();var M=s.extend({},this.detected);this.canhwscroll=M.hastransform&&x.opt.hwacceleration,this.ishwscroll=this.canhwscroll&&x.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(M.iswebkit||M.isie||M.isie11):this.hasreversehr=!(M.iswebkit||M.isie&&!M.isie10&&!M.isie11):this.hasreversehr=!1,this.istouchcapable=!1,M.cantouch||!M.hasw3ctouch&&!M.hasmstouch?!M.cantouch||M.isios||M.isandroid||!M.iswebkit&&!M.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,x.opt.enablemouselockapi||(M.hasmousecapture=!1,M.haspointerlock=!1),this.debounced=function(e,o,t){x&&(x.delaylist[e]||!1||(x.delaylist[e]={h:a(function(){x.delaylist[e].fn.call(x),x.delaylist[e]=!1},t)},o.call(x)),x.delaylist[e].fn=o)};var E=!1;this.synched=function(e,o){return x.synclist[e]=o,function(){E||(a(function(){if(x){E=!1;for(var e in x.synclist){var o=x.synclist[e];o&&o.call(x),x.synclist[e]=!1}}}),E=!0)}(),e},this.unsynched=function(e){x.synclist[e]&&(x.synclist[e]=!1)},this.css=function(e,o){for(var t in o)x.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?x.getScrollTop():x.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?x.getScrollLeft():x.setScrollLeft(e)};var L=function(e,o,t,r,i,n,s){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=n||0,this.p4=s||1,this.ts=h(),this.df=this.ed-this.st};if(L.prototype={B2:function(e){return 3*e*e*(1-e)},B3:function(e){return 3*e*(1-e)*(1-e)},B4:function(e){return(1-e)*(1-e)*(1-e)},getNow:function(){var e=1-(h()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e<0?this.ed:this.st+Math.round(this.df*o)},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=h(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},M.hastranslate3d&&M.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=m();if(o)return 16==o.length?-o[13]:-o[5];if(x.timerscroll&&x.timerscroll.bz)return x.timerscroll.bz.getNow()}return x.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=m();if(o)return 16==o.length?-o[12]:-o[4];if(x.timerscroll&&x.timerscroll.bh)return x.timerscroll.bh.getNow()}return x.doc.translate.x},this.notifyScrollEvent=function(e){var o=document.createEvent("UIEvents");o.initUIEvent("scroll",!1,!0,window,1),o.niceevent=!0,e.dispatchEvent(o)};var C=this.isrtlmode?1:-1;M.hastranslate3d&&x.opt.enabletranslate3d?(this.setScrollTop=function(e,o){x.doc.translate.y=e,x.doc.translate.ty=-1*e+"px",x.doc.css(M.trstyle,"translate3d("+x.doc.translate.tx+","+x.doc.translate.ty+",0)"),o||x.notifyScrollEvent(x.win[0])},this.setScrollLeft=function(e,o){x.doc.translate.x=e,x.doc.translate.tx=e*C+"px",x.doc.css(M.trstyle,"translate3d("+x.doc.translate.tx+","+x.doc.translate.ty+",0)"),o||x.notifyScrollEvent(x.win[0])}):(this.setScrollTop=function(e,o){x.doc.translate.y=e,x.doc.translate.ty=-1*e+"px",x.doc.css(M.trstyle,"translate("+x.doc.translate.tx+","+x.doc.translate.ty+")"),o||x.notifyScrollEvent(x.win[0])},this.setScrollLeft=function(e,o){x.doc.translate.x=e,x.doc.translate.tx=e*C+"px",x.doc.css(M.trstyle,"translate("+x.doc.translate.tx+","+x.doc.translate.ty+")"),o||x.notifyScrollEvent(x.win[0])})}else this.getScrollTop=function(){return x.docscroll.scrollTop()},this.setScrollTop=function(e){return setTimeout(function(){x&&x.docscroll.scrollTop(e)},1)},this.getScrollLeft=function(){return x.hasreversehr?x.detected.ismozilla?x.page.maxw-Math.abs(x.docscroll.scrollLeft()):x.page.maxw-x.docscroll.scrollLeft():x.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(x)return x.hasreversehr&&(e=x.detected.ismozilla?-(x.page.maxw-e):x.page.maxw-e),x.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var N={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:window.pageYOffset||document.documentElement.scrollTop,left:window.pageXOffset||document.documentElement.scrollLeft}},this.getOffset=function(){if(x.isfixed){var e=x.win.offset(),o=x.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=x.win.offset();if(!x.viewport)return t;var r=x.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(x.ishwscroll)x.rail.css({height:x.win.innerHeight()-(x.opt.railpadding.top+x.opt.railpadding.bottom)}),x.railh&&x.railh.css({width:x.win.innerWidth()-(x.opt.railpadding.left+x.opt.railpadding.right)});else{var r=x.getOffset();if(o={top:r.top,left:r.left-(x.opt.railpadding.left+x.opt.railpadding.right)},o.top+=v(x.win,"border-top-width",!0),o.left+=x.rail.align?x.win.outerWidth()-v(x.win,"border-right-width")-x.rail.width:v(x.win,"border-left-width"),(t=x.opt.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),x.railslocked||x.rail.css({top:o.top,left:o.left,height:(e?e.h:x.win.innerHeight())-(x.opt.railpadding.top+x.opt.railpadding.bottom)}),x.zoom&&x.zoom.css({top:o.top+1,left:1==x.rail.align?o.left-20:o.left+x.rail.width+4}),x.railh&&!x.railslocked){o={top:r.top,left:r.left},(t=x.opt.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=x.railh.align?o.top+v(x.win,"border-top-width",!0)+x.win.innerHeight()-x.railh.height:o.top+v(x.win,"border-top-width",!0),n=o.left+v(x.win,"border-left-width");x.railh.css({top:i-(x.opt.railpadding.top+x.opt.railpadding.bottom),left:n,width:x.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,n,s;x.railslocked||(x.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+document.documentElement.scrollLeft,e.pageY=e.clientY+document.documentElement.scrollTop),o?(r=t?x.doScrollLeft:x.doScrollTop)(n=t?(e.pageX-x.railh.offset().left-x.cursorwidth/2)*x.scrollratio.x:(e.pageY-x.rail.offset().top-x.cursorheight/2)*x.scrollratio.y):(r=t?x.doScrollLeftBy:x.doScrollBy,n=t?x.scroll.x:x.scroll.y,s=t?e.pageX-x.railh.offset().left:e.pageY-x.rail.offset().top,i=t?x.view.w:x.view.h,r(n>=s?i:-i)))},x.hasanimationframe="requestAnimationFrame"in window,x.hascancelanimationframe="cancelAnimationFrame"in window,this.init=function(){if(x.saved.css=[],M.isoperamini)return!0;if(M.isandroid&&!("hidden"in document))return!0;x.opt.emulatetouch=x.opt.emulatetouch||x.opt.touchbehavior;var e={"overflow-y":"hidden"};if((M.isie11||M.isie10)&&(e["-ms-overflow-style"]="none"),x.zindex="auto",x.ispage||"auto"!=x.opt.zindex?x.zindex=x.opt.zindex:x.zindex=g()||"auto",!x.ispage&&"auto"!=x.zindex&&x.zindex>n&&(n=x.zindex),x.isie&&0==x.zindex&&"auto"==x.opt.zindex&&(x.zindex="auto"),!x.ispage||!M.cantouch&&!M.isieold){var i=x.docscroll;x.ispage&&(i=x.haswrapper?x.win:x.doc),x.css(i,e),x.ispage&&(M.isie11||M.isie)&&x.css(s("html"),e),!M.isios||x.ispage||x.haswrapper||x.css(S,{"-webkit-overflow-scrolling":"touch"});var a=s(document.createElement("div"));a.css({position:"relative",top:0,float:"right",width:x.opt.cursorwidth,height:0,"background-color":x.opt.cursorcolor,border:x.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":x.opt.cursorborderradius,"-moz-border-radius":x.opt.cursorborderradius,"border-radius":x.opt.cursorborderradius}),a.addClass("nicescroll-cursors"),x.cursor=a;var c=s(document.createElement("div"));c.attr("id",x.id),c.addClass("nicescroll-rails nicescroll-rails-vr");var d,h,p=["left","right","top","bottom"];for(var m in p)h=p[m],(d=x.opt.railpadding[h])?c.css("padding-"+h,d+"px"):x.opt.railpadding[h]=0;c.append(a),c.width=Math.max(parseFloat(x.opt.cursorwidth),a.outerWidth()),c.css({width:c.width+"px",zIndex:x.zindex,background:x.opt.background,cursor:"default"}),c.visibility=!0,c.scrollable=!0,c.align="left"==x.opt.railalign?0:1,x.rail=c,x.rail.drag=!1;var f=!1;!x.opt.boxzoom||x.ispage||M.isieold||(f=document.createElement("div"),x.bind(f,"click",x.doZoom),x.bind(f,"mouseenter",function(){x.zoom.css("opacity",x.opt.cursoropacitymax)}),x.bind(f,"mouseleave",function(){x.zoom.css("opacity",x.opt.cursoropacitymin)}),x.zoom=s(f),x.zoom.css({cursor:"pointer",zIndex:x.zindex,backgroundImage:"url("+x.opt.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),x.opt.dblclickzoom&&x.bind(x.win,"dblclick",x.doZoom),M.cantouch&&x.opt.gesturezoom&&(x.ongesturezoom=function(e){return e.scale>1.5&&x.doZoomIn(e),e.scale<.8&&x.doZoomOut(e),x.cancelEvent(e)},x.bind(x.win,"gestureend",x.ongesturezoom))),x.railh=!1;var v;if(x.opt.horizrailenabled&&(x.css(i,{overflowX:"hidden"}),(a=s(document.createElement("div"))).css({position:"absolute",top:0,height:x.opt.cursorwidth,width:0,backgroundColor:x.opt.cursorcolor,border:x.opt.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":x.opt.cursorborderradius,"-moz-border-radius":x.opt.cursorborderradius,"border-radius":x.opt.cursorborderradius}),M.isieold&&a.css("overflow","hidden"),a.addClass("nicescroll-cursors"),x.cursorh=a,(v=s(document.createElement("div"))).attr("id",x.id+"-hr"),v.addClass("nicescroll-rails nicescroll-rails-hr"),v.height=Math.max(parseFloat(x.opt.cursorwidth),a.outerHeight()),v.css({height:v.height+"px",zIndex:x.zindex,background:x.opt.background}),v.append(a),v.visibility=!0,v.scrollable=!0,v.align="top"==x.opt.railvalign?0:1,x.railh=v,x.railh.drag=!1),x.ispage)c.css({position:"fixed",top:0,height:"100%"}),c.align?c.css({right:0}):c.css({left:0}),x.body.append(c),x.railh&&(v.css({position:"fixed",left:0,width:"100%"}),v.align?v.css({bottom:0}):v.css({top:0}),x.body.append(v));else{if(x.ishwscroll){"static"==x.win.css("position")&&x.css(x.win,{position:"relative"});var b="HTML"==x.win[0].nodeName?x.body:x.win;s(b).scrollTop(0).scrollLeft(0),x.zoom&&(x.zoom.css({position:"absolute",top:1,right:0,"margin-right":c.width+4}),b.append(x.zoom)),c.css({position:"absolute",top:0}),c.align?c.css({right:0}):c.css({left:0}),b.append(c),v&&(v.css({position:"absolute",left:0,bottom:0}),v.align?v.css({bottom:0}):v.css({top:0}),b.append(v))}else{x.isfixed="fixed"==x.win.css("position");var y=x.isfixed?"fixed":"absolute";x.isfixed||(x.viewport=x.getViewport(x.win[0])),x.viewport&&(x.body=x.viewport,0==/fixed|absolute/.test(x.viewport.css("position"))&&x.css(x.viewport,{position:"relative"})),c.css({position:y}),x.zoom&&x.zoom.css({position:y}),x.updateScrollBar(),x.body.append(c),x.zoom&&x.body.append(x.zoom),x.railh&&(v.css({position:y}),x.body.append(v))}M.isios&&x.css(x.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),M.isie&&x.opt.disableoutline&&x.win.attr("hideFocus","true"),M.iswebkit&&x.opt.disableoutline&&x.win.css("outline","none")}if(!1===x.opt.autohidemode?(x.autohidedom=!1,x.rail.css({opacity:x.opt.cursoropacitymax}),x.railh&&x.railh.css({opacity:x.opt.cursoropacitymax})):!0===x.opt.autohidemode||"leave"===x.opt.autohidemode?(x.autohidedom=s().add(x.rail),M.isie8&&(x.autohidedom=x.autohidedom.add(x.cursor)),x.railh&&(x.autohidedom=x.autohidedom.add(x.railh)),x.railh&&M.isie8&&(x.autohidedom=x.autohidedom.add(x.cursorh))):"scroll"==x.opt.autohidemode?(x.autohidedom=s().add(x.rail),x.railh&&(x.autohidedom=x.autohidedom.add(x.railh))):"cursor"==x.opt.autohidemode?(x.autohidedom=s().add(x.cursor),x.railh&&(x.autohidedom=x.autohidedom.add(x.cursorh))):"hidden"==x.opt.autohidemode&&(x.autohidedom=!1,x.hide(),x.railslocked=!1),M.cantouch||x.istouchcapable||x.opt.emulatetouch||M.hasmstouch){x.scrollmom=new w(x),x.ontouchstart=function(e){if(e.pointerType&&2!=e.pointerType&&"touch"!=e.pointerType)return!1;if(x.hasmoving=!1,!x.railslocked){var o;if(M.hasmstouch)for(o=!!e.target&&e.target;o;){var t=s(o).getNiceScroll();if(t.length>0&&t[0].me==x.me)break;if(t.length>0)return!1;if("DIV"==o.nodeName&&o.id==x.id)break;o=!!o.parentNode&&o.parentNode}if(e.stopPropagation(),x.cancelScroll(),(o=x.getTarget(e))&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return x.stopPropagation(e);if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),x.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(x.rail.drag={x:e.clientX,y:e.clientY,sx:x.scroll.x,sy:x.scroll.y,st:x.getScrollTop(),sl:x.getScrollLeft(),pt:2,dl:!1,tg:o},x.ispage||!x.opt.directionlockdeadzone)x.rail.drag.dl="f";else{var i={w:l.width(),h:l.height()},n={w:Math.max(document.body.scrollWidth,document.documentElement.scrollWidth),h:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)},a=Math.max(0,n.h-i.h),c=Math.max(0,n.w-i.w);!x.rail.scrollable&&x.railh.scrollable?x.rail.drag.ck=a>0&&"v":x.rail.scrollable&&!x.railh.scrollable?x.rail.drag.ck=c>0&&"h":x.rail.drag.ck=!1,x.rail.drag.ck||(x.rail.drag.dl="f")}if(x.opt.emulatetouch&&x.isiframe&&M.isie){var d=x.win.position();x.rail.drag.x+=d.left,x.rail.drag.y+=d.top}if(x.hasmoving=!1,x.lastmouseup=!1,x.scrollmom.reset(e.clientX,e.clientY),!M.cantouch&&!this.istouchcapable&&!e.pointerType){if(!(!!o&&/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName)))return!x.ispage&&M.hasmousecapture&&o.setCapture(),x.opt.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(x.hasmoving)return!1;o._onclick.call(this,e)}),x.cancelEvent(e)):x.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(s(o).attr("type"))&&(x.preventclick={tg:o,click:!1})}}},x.ontouchend=function(e){if(!x.rail.drag)return!0;if(2==x.rail.drag.pt){if(e.pointerType&&2!=e.pointerType&&"touch"!=e.pointerType)return!1;if(x.rail.drag=!1,x.hasmoving&&(x.scrollmom.doMomentum(),x.lastmouseup=!0,x.hideCursor(),M.hasmousecapture&&document.releaseCapture(),!M.cantouch))return x.cancelEvent(e)}else if(1==x.rail.drag.pt)return x.onmouseup(e)};var z=x.opt.emulatetouch&&x.isiframe&&!M.hasmousecapture;x.ontouchmove=function(e,o){if(!x.rail.drag)return!1;if(e.targetTouches&&x.opt.preventmultitouchscrolling&&e.targetTouches.length>1)return!1;if(e.pointerType&&2!=e.pointerType&&"touch"!=e.pointerType)return!1;if(2==x.rail.drag.pt){if("changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),x.rail.drag.y===e.clientY&&x.rail.drag.x===e.clientX)return!1;x.hasmoving||x.triggerScrollStart(e.clientX,e.clientY,0,0,0),x.hasmoving=!0,x.preventclick&&!x.preventclick.click&&(x.preventclick.click=x.preventclick.tg.onclick||!1,x.preventclick.tg.onclick=x.onpreventclick);var t,r;if(r=t=0,z&&!o){var i=x.win.position();r=-i.left,t=-i.top}var n=e.clientY+t,s=n-x.rail.drag.y,l=e.clientX+r,a=l-x.rail.drag.x,c=x.rail.drag.st-s;x.ishwscroll&&x.opt.bouncescroll?c<0?c=Math.round(c/2):c>x.page.maxh&&(c=x.page.maxh+Math.round((c-x.page.maxh)/2)):(c<0&&(c=0,n=0),c>x.page.maxh&&(c=x.page.maxh,n=0));var d;x.railh&&x.railh.scrollable&&(d=x.isrtlmode?a-x.rail.drag.sl:x.rail.drag.sl-a,x.ishwscroll&&x.opt.bouncescroll?d<0?d=Math.round(d/2):d>x.page.maxw&&(d=x.page.maxw+Math.round((d-x.page.maxw)/2)):(d<0&&(d=0,l=0),d>x.page.maxw&&(d=x.page.maxw,l=0)));var u=!1;if(x.rail.drag.dl)u=!0,"v"==x.rail.drag.dl?d=x.rail.drag.sl:"h"==x.rail.drag.dl&&(c=x.rail.drag.st);else{var h=Math.abs(s),p=Math.abs(a),m=x.opt.directionlockdeadzone;if("v"==x.rail.drag.ck){if(h>m&&p<=.3*h)return x.rail.drag=!1,!0;p>m&&(x.rail.drag.dl="f",S.scrollTop(S.scrollTop()))}else if("h"==x.rail.drag.ck){if(p>m&&h<=.3*p)return x.rail.drag=!1,!0;h>m&&(x.rail.drag.dl="f",S.scrollLeft(S.scrollLeft()))}}if(x.synched("touchmove",function(){x.rail.drag&&2==x.rail.drag.pt&&(x.prepareTransition&&x.prepareTransition(0),x.rail.scrollable&&x.setScrollTop(c),x.scrollmom.update(l,n),x.railh&&x.railh.scrollable?(x.setScrollLeft(d),x.showCursor(c,d)):x.showCursor(c),M.isie10&&document.selection.clear())}),M.ischrome&&x.istouchcapable&&(u=!1),u)return x.cancelEvent(e)}else if(1==x.rail.drag.pt)return x.onmousemove(e)},x.ontouchstartCursor=function(e,o){if(!x.rail.drag||3==x.rail.drag.pt){if(x.locked)return x.cancelEvent(e);x.cancelScroll(),x.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:x.scroll.x,sy:x.scroll.y,pt:3,hr:!!o};var t=x.getTarget(e);return!x.ispage&&M.hasmousecapture&&t.setCapture(),x.isiframe&&!M.hasmousecapture&&(x.saved.csspointerevents=x.doc.css("pointer-events"),x.css(x.doc,{"pointer-events":"none"})),x.cancelEvent(e)}},x.ontouchendCursor=function(e){if(x.rail.drag){if(M.hasmousecapture&&document.releaseCapture(),x.isiframe&&!M.hasmousecapture&&x.doc.css("pointer-events",x.saved.csspointerevents),3!=x.rail.drag.pt)return;return x.rail.drag=!1,x.cancelEvent(e)}},x.ontouchmoveCursor=function(e){if(x.rail.drag){if(3!=x.rail.drag.pt)return;if(x.cursorfreezed=!0,x.rail.drag.hr){x.scroll.x=x.rail.drag.sx+(e.touches[0].clientX-x.rail.drag.x),x.scroll.x<0&&(x.scroll.x=0);var o=x.scrollvaluemaxw;x.scroll.x>o&&(x.scroll.x=o)}else{x.scroll.y=x.rail.drag.sy+(e.touches[0].clientY-x.rail.drag.y),x.scroll.y<0&&(x.scroll.y=0);var t=x.scrollvaluemax;x.scroll.y>t&&(x.scroll.y=t)}return x.synched("touchmove",function(){x.rail.drag&&3==x.rail.drag.pt&&(x.showCursor(),x.rail.drag.hr?x.doScrollLeft(Math.round(x.scroll.x*x.scrollratio.x),x.opt.cursordragspeed):x.doScrollTop(Math.round(x.scroll.y*x.scrollratio.y),x.opt.cursordragspeed))}),x.cancelEvent(e)}}}if(x.onmousedown=function(e,o){if(!x.rail.drag||1==x.rail.drag.pt){if(x.railslocked)return x.cancelEvent(e);x.cancelScroll(),x.rail.drag={x:e.clientX,y:e.clientY,sx:x.scroll.x,sy:x.scroll.y,pt:1,hr:o||!1};var t=x.getTarget(e);return!x.ispage&&M.hasmousecapture&&t.setCapture(),x.isiframe&&!M.hasmousecapture&&(x.saved.csspointerevents=x.doc.css("pointer-events"),x.css(x.doc,{"pointer-events":"none"})),x.hasmoving=!1,x.cancelEvent(e)}},x.onmouseup=function(e){if(x.rail.drag)return 1!=x.rail.drag.pt||(M.hasmousecapture&&document.releaseCapture(),x.isiframe&&!M.hasmousecapture&&x.doc.css("pointer-events",x.saved.csspointerevents),x.rail.drag=!1,x.hasmoving&&x.triggerScrollEnd(),x.cancelEvent(e))},x.onmousemove=function(e){if(x.rail.drag){if(1!==x.rail.drag.pt)return;if(M.ischrome&&0===e.which)return x.onmouseup(e);if(x.cursorfreezed=!0,x.hasmoving=!0,x.rail.drag.hr){x.scroll.x=x.rail.drag.sx+(e.clientX-x.rail.drag.x),x.scroll.x<0&&(x.scroll.x=0);var o=x.scrollvaluemaxw;x.scroll.x>o&&(x.scroll.x=o)}else{x.scroll.y=x.rail.drag.sy+(e.clientY-x.rail.drag.y),x.scroll.y<0&&(x.scroll.y=0);var t=x.scrollvaluemax;x.scroll.y>t&&(x.scroll.y=t)}return x.synched("mousemove",function(){x.rail.drag&&1==x.rail.drag.pt&&(x.showCursor(),x.rail.drag.hr?x.hasreversehr?x.doScrollLeft(x.scrollvaluemaxw-Math.round(x.scroll.x*x.scrollratio.x),x.opt.cursordragspeed):x.doScrollLeft(Math.round(x.scroll.x*x.scrollratio.x),x.opt.cursordragspeed):x.doScrollTop(Math.round(x.scroll.y*x.scrollratio.y),x.opt.cursordragspeed))}),x.cancelEvent(e)}x.checkarea=0},M.cantouch||x.opt.emulatetouch)x.onpreventclick=function(e){if(x.preventclick)return x.preventclick.tg.onclick=x.preventclick.click,x.preventclick=!1,x.cancelEvent(e)},x.onclick=!M.isios&&function(e){return!x.lastmouseup||(x.lastmouseup=!1,x.cancelEvent(e))},x.opt.grabcursorenabled&&M.cursorgrabvalue&&(x.css(x.ispage?x.doc:x.win,{cursor:M.cursorgrabvalue}),x.css(x.rail,{cursor:M.cursorgrabvalue}));else{var k=function(e){if(x.selectiondrag){if(e){var o=x.win.outerHeight(),t=e.pageY-x.selectiondrag.top;t>0&&t=o&&(t-=o),x.selectiondrag.df=t}if(0!=x.selectiondrag.df){var r=2*-Math.floor(x.selectiondrag.df/6);x.doScrollBy(r),x.debounced("doselectionscroll",function(){k()},50)}}};"getSelection"in document?x.hasTextSelected=function(){return document.getSelection().rangeCount>0}:"selection"in document?x.hasTextSelected=function(){return"None"!=document.selection.type}:x.hasTextSelected=function(){return!1},x.onselectionstart=function(e){x.ispage||(x.selectiondrag=x.win.offset())},x.onselectionend=function(e){x.selectiondrag=!1},x.onselectiondrag=function(e){x.selectiondrag&&x.hasTextSelected()&&x.debounced("selectionscroll",function(){k(e)},250)}}if(M.hasw3ctouch?(x.css(x.ispage?s("html"):x.win,{"touch-action":"none"}),x.css(x.rail,{"touch-action":"none"}),x.css(x.cursor,{"touch-action":"none"}),x.bind(x.win,"pointerdown",x.ontouchstart),x.bind(document,"pointerup",x.ontouchend),x.bind(document,"pointermove",x.ontouchmove)):M.hasmstouch?(x.css(x.ispage?s("html"):x.win,{"-ms-touch-action":"none"}),x.css(x.rail,{"-ms-touch-action":"none"}),x.css(x.cursor,{"-ms-touch-action":"none"}),x.bind(x.win,"MSPointerDown",x.ontouchstart),x.bind(document,"MSPointerUp",x.ontouchend),x.bind(document,"MSPointerMove",x.ontouchmove),x.bind(x.cursor,"MSGestureHold",function(e){e.preventDefault()}),x.bind(x.cursor,"contextmenu",function(e){e.preventDefault()})):M.cantouch&&(x.bind(x.win,"touchstart",x.ontouchstart,!1,!0),x.bind(document,"touchend",x.ontouchend,!1,!0),x.bind(document,"touchcancel",x.ontouchend,!1,!0),x.bind(document,"touchmove",x.ontouchmove,!1,!0)),x.opt.emulatetouch&&(x.bind(x.win,"mousedown",x.ontouchstart,!1,!0),x.bind(document,"mouseup",x.ontouchend,!1,!0),x.bind(document,"mousemove",x.ontouchmove,!1,!0)),(x.opt.cursordragontouch||!M.cantouch&&!x.opt.emulatetouch)&&(x.rail.css({cursor:"default"}),x.railh&&x.railh.css({cursor:"default"}),x.jqbind(x.rail,"mouseenter",function(){if(!x.ispage&&!x.win.is(":visible"))return!1;x.canshowonmouseevent&&x.showCursor(),x.rail.active=!0}),x.jqbind(x.rail,"mouseleave",function(){x.rail.active=!1,x.rail.drag||x.hideCursor()}),x.opt.sensitiverail&&(x.bind(x.rail,"click",function(e){x.doRailClick(e,!1,!1)}),x.bind(x.rail,"dblclick",function(e){x.doRailClick(e,!0,!1)}),x.bind(x.cursor,"click",function(e){x.cancelEvent(e)}),x.bind(x.cursor,"dblclick",function(e){x.cancelEvent(e)})),x.railh&&(x.jqbind(x.railh,"mouseenter",function(){if(!x.ispage&&!x.win.is(":visible"))return!1;x.canshowonmouseevent&&x.showCursor(),x.rail.active=!0}),x.jqbind(x.railh,"mouseleave",function(){x.rail.active=!1,x.rail.drag||x.hideCursor()}),x.opt.sensitiverail&&(x.bind(x.railh,"click",function(e){x.doRailClick(e,!1,!0)}),x.bind(x.railh,"dblclick",function(e){x.doRailClick(e,!0,!0)}),x.bind(x.cursorh,"click",function(e){x.cancelEvent(e)}),x.bind(x.cursorh,"dblclick",function(e){x.cancelEvent(e)})))),x.opt.cursordragontouch&&(this.istouchcapable||M.cantouch)&&(x.bind(x.cursor,"touchstart",x.ontouchstartCursor),x.bind(x.cursor,"touchmove",x.ontouchmoveCursor),x.bind(x.cursor,"touchend",x.ontouchendCursor),x.cursorh&&x.bind(x.cursorh,"touchstart",function(e){x.ontouchstartCursor(e,!0)}),x.cursorh&&x.bind(x.cursorh,"touchmove",x.ontouchmoveCursor),x.cursorh&&x.bind(x.cursorh,"touchend",x.ontouchendCursor)),M.cantouch||x.opt.emulatetouch?(x.bind(M.hasmousecapture?x.win:document,"mouseup",x.ontouchend),x.onclick&&x.bind(document,"click",x.onclick),x.opt.cursordragontouch?(x.bind(x.cursor,"mousedown",x.onmousedown),x.bind(x.cursor,"mouseup",x.onmouseup),x.cursorh&&x.bind(x.cursorh,"mousedown",function(e){x.onmousedown(e,!0)}),x.cursorh&&x.bind(x.cursorh,"mouseup",x.onmouseup)):(x.bind(x.rail,"mousedown",function(e){e.preventDefault()}),x.railh&&x.bind(x.railh,"mousedown",function(e){e.preventDefault()}))):(x.bind(M.hasmousecapture?x.win:document,"mouseup",x.onmouseup),x.bind(document,"mousemove",x.onmousemove),x.onclick&&x.bind(document,"click",x.onclick),x.bind(x.cursor,"mousedown",x.onmousedown),x.bind(x.cursor,"mouseup",x.onmouseup),x.railh&&(x.bind(x.cursorh,"mousedown",function(e){x.onmousedown(e,!0)}),x.bind(x.cursorh,"mouseup",x.onmouseup)),!x.ispage&&x.opt.enablescrollonselection&&(x.bind(x.win[0],"mousedown",x.onselectionstart),x.bind(document,"mouseup",x.onselectionend),x.bind(x.cursor,"mouseup",x.onselectionend),x.cursorh&&x.bind(x.cursorh,"mouseup",x.onselectionend),x.bind(document,"mousemove",x.onselectiondrag)),x.zoom&&(x.jqbind(x.zoom,"mouseenter",function(){x.canshowonmouseevent&&x.showCursor(),x.rail.active=!0}),x.jqbind(x.zoom,"mouseleave",function(){x.rail.active=!1,x.rail.drag||x.hideCursor()}))),x.opt.enablemousewheel&&(x.isiframe||x.mousewheel(M.isie&&x.ispage?document:x.win,x.onmousewheel),x.mousewheel(x.rail,x.onmousewheel),x.railh&&x.mousewheel(x.railh,x.onmousewheelhr)),x.ispage||M.cantouch||/HTML|^BODY/.test(x.win[0].nodeName)||(x.win.attr("tabindex")||x.win.attr({tabindex:++r}),x.bind(x.win,"focus",function(e){o=x.getTarget(e).id||!0,x.hasfocus=!0,x.canshowonmouseevent&&x.noticeCursor()}),x.bind(x.win,"blur",function(e){o=!1,x.hasfocus=!1}),x.bind(x.win,"mouseenter",function(e){t=x.getTarget(e).id||!0,x.hasmousefocus=!0,x.canshowonmouseevent&&x.noticeCursor()}),x.bind(x.win,"mouseleave",function(e){t=!1,x.hasmousefocus=!1,x.rail.drag||x.hideCursor()})),x.onkeypress=function(e){if(x.railslocked&&0==x.page.maxh)return!0;e=e||window.e;var r=x.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(s(r).attr("contenteditable"))return!0;if(x.hasfocus||x.hasmousefocus&&!o||x.ispage&&!o&&!t){var i=e.keyCode;if(x.railslocked&&27!=i)return x.cancelEvent(e);var n=e.ctrlKey||!1,l=e.shiftKey||!1,a=!1;switch(i){case 38:case 63233:x.doScrollBy(72),a=!0;break;case 40:case 63235:x.doScrollBy(-72),a=!0;break;case 37:case 63232:x.railh&&(n?x.doScrollLeft(0):x.doScrollLeftBy(72),a=!0);break;case 39:case 63234:x.railh&&(n?x.doScrollLeft(x.page.maxw):x.doScrollLeftBy(-72),a=!0);break;case 33:case 63276:x.doScrollBy(x.view.h),a=!0;break;case 34:case 63277:x.doScrollBy(-x.view.h),a=!0;break;case 36:case 63273:x.railh&&n?x.doScrollPos(0,0):x.doScrollTo(0),a=!0;break;case 35:case 63275:x.railh&&n?x.doScrollPos(x.page.maxw,x.page.maxh):x.doScrollTo(x.page.maxh),a=!0;break;case 32:x.opt.spacebarenabled&&(l?x.doScrollBy(x.view.h):x.doScrollBy(-x.view.h),a=!0);break;case 27:x.zoomactive&&(x.doZoom(),a=!0)}if(a)return x.cancelEvent(e)}},x.opt.enablekeyboard&&x.bind(document,M.isopera&&!M.isopera12?"keypress":"keydown",x.onkeypress),x.bind(document,"keydown",function(e){(e.ctrlKey||!1)&&(x.wheelprevented=!0)}),x.bind(document,"keyup",function(e){e.ctrlKey||!1||(x.wheelprevented=!1)}),x.bind(window,"blur",function(e){x.wheelprevented=!1}),x.bind(window,"resize",x.lazyResize),x.bind(window,"orientationchange",x.lazyResize),x.bind(window,"load",x.lazyResize),M.ischrome&&!x.ispage&&!x.haswrapper){var T=x.win.attr("style"),E=parseFloat(x.win.css("width"))+1;x.win.css("width",E),x.synched("chromefix",function(){x.win.attr("style",T)})}x.onAttributeChange=function(e){x.lazyResize(x.isieold?250:30)},x.opt.enableobserver&&(x.isie11||!1===u||(x.observerbody=new u(function(e){if(e.forEach(function(e){if("attributes"==e.type)return S.hasClass("modal-open")&&S.hasClass("modal-dialog")&&!s.contains(s(".modal-dialog")[0],x.doc[0])?x.hide():x.show()}),x.me.clientWidth!=x.page.width||x.me.clientHeight!=x.page.height)return x.lazyResize(30)}),x.observerbody.observe(document.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),x.ispage||x.haswrapper||(!1!==u?(x.observer=new u(function(e){e.forEach(x.onAttributeChange)}),x.observer.observe(x.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),x.observerremover=new u(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(x&&e.removedNodes[o]==x.win[0])return x.remove()})}),x.observerremover.observe(x.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(x.bind(x.win,M.isie&&!M.isie9?"propertychange":"DOMAttrModified",x.onAttributeChange),M.isie9&&x.win[0].attachEvent("onpropertychange",x.onAttributeChange),x.bind(x.win,"DOMNodeRemoved",function(e){e.target==x.win[0]&&x.remove()})))),!x.ispage&&x.opt.boxzoom&&x.bind(window,"resize",x.resizeZoom),x.istextarea&&(x.bind(x.win,"keydown",x.lazyResize),x.bind(x.win,"mouseup",x.lazyResize)),x.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var L=function(){x.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow.document).domain}catch(e){x.iframexd=!0,o=!1}if(x.iframexd)return"console"in window&&console.log("NiceScroll error: policy restriced iframe"),!0;if(x.forcescreen=!0,x.isiframe&&(x.iframe={doc:s(o),html:x.doc.contents().find("html")[0],body:x.doc.contents().find("body")[0]},x.getContentSize=function(){return{w:Math.max(x.iframe.html.scrollWidth,x.iframe.body.scrollWidth),h:Math.max(x.iframe.html.scrollHeight,x.iframe.body.scrollHeight)}},x.docscroll=s(x.iframe.body)),!M.isios&&x.opt.iframeautoresize&&!x.isiframe){x.win.scrollTop(0),x.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);x.doc.height(t)}x.lazyResize(30),x.css(s(x.iframe.body),e),M.isios&&x.haswrapper&&x.css(s(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?x.bind(this.contentWindow,"scroll",x.onscroll):x.bind(o,"scroll",x.onscroll),x.opt.enablemousewheel&&x.mousewheel(o,x.onmousewheel),x.opt.enablekeyboard&&x.bind(o,M.isopera?"keypress":"keydown",x.onkeypress),M.cantouch?(x.bind(o,"touchstart",x.ontouchstart),x.bind(o,"touchmove",x.ontouchmove)):x.opt.emulatetouch&&(x.bind(o,"mousedown",x.ontouchstart),x.bind(o,"mousemove",function(e){return x.ontouchmove(e,!0)}),x.opt.grabcursorenabled&&M.cursorgrabvalue&&x.css(s(o.body),{cursor:M.cursorgrabvalue})),x.bind(o,"mouseup",x.ontouchend),x.zoom&&(x.opt.dblclickzoom&&x.bind(o,"dblclick",x.doZoom),x.ongesturezoom&&x.bind(o,"gestureend",x.ongesturezoom))};this.doc[0].readyState&&"complete"==this.doc[0].readyState&&setTimeout(function(){L.call(x.doc[0],!1)},500),x.bind(this.doc,"load",L)}},this.showCursor=function(e,o){if(x.cursortimeout&&(clearTimeout(x.cursortimeout),x.cursortimeout=0),x.rail){if(x.autohidedom&&(x.autohidedom.stop().css({opacity:x.opt.cursoropacitymax}),x.cursoractive=!0),x.rail.drag&&1==x.rail.drag.pt||(void 0!==e&&!1!==e&&(x.scroll.y=Math.round(1*e/x.scrollratio.y)),void 0!==o&&(x.scroll.x=Math.round(1*o/x.scrollratio.x))),x.cursor.css({height:x.cursorheight,top:x.scroll.y}),x.cursorh){var t=x.hasreversehr?x.scrollvaluemaxw-x.scroll.x:x.scroll.x;!x.rail.align&&x.rail.visibility?x.cursorh.css({width:x.cursorwidth,left:t+x.rail.width}):x.cursorh.css({width:x.cursorwidth,left:t}),x.cursoractive=!0}x.zoom&&x.zoom.stop().css({opacity:x.opt.cursoropacitymax})}},this.hideCursor=function(e){x.cursortimeout||x.rail&&x.autohidedom&&(x.hasmousefocus&&"leave"==x.opt.autohidemode||(x.cursortimeout=setTimeout(function(){x.rail.active&&x.showonmouseevent||(x.autohidedom.stop().animate({opacity:x.opt.cursoropacitymin}),x.zoom&&x.zoom.stop().animate({opacity:x.opt.cursoropacitymin}),x.cursoractive=!1),x.cursortimeout=0},e||x.opt.hidecursordelay)))},this.noticeCursor=function(e,o,t){x.showCursor(o,t),x.rail.active||x.hideCursor(e)},this.getContentSize=x.ispage?function(){return{w:Math.max(document.body.scrollWidth,document.documentElement.scrollWidth),h:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}}:x.haswrapper?function(){return{w:x.doc[0].offsetWidth,h:x.doc[0].offsetHeight}}:function(){return{w:x.docscroll[0].scrollWidth,h:x.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!x||!x.win)return!1;if(!x.haswrapper&&!x.ispage){if("none"==x.win.css("display"))return x.visibility&&x.hideRail().hideRailHr(),!1;x.hidden||x.visibility||x.showRail().showRailHr()}var t=x.page.maxh,r=x.page.maxw,i={h:x.view.h,w:x.view.w};if(x.view={w:x.ispage?x.win.width():x.win[0].clientWidth,h:x.ispage?x.win.height():x.win[0].clientHeight},x.page=o||x.getContentSize(),x.page.maxh=Math.max(0,x.page.h-x.view.h),x.page.maxw=Math.max(0,x.page.w-x.view.w),x.page.maxh==t&&x.page.maxw==r&&x.view.w==i.w&&x.view.h==i.h){if(x.ispage)return x;var n=x.win.offset();if(x.lastposition){var s=x.lastposition;if(s.top==n.top&&s.left==n.left)return x}x.lastposition=n}return 0===x.page.maxh?(x.hideRail(),x.scrollvaluemax=0,x.scroll.y=0,x.scrollratio.y=0,x.cursorheight=0,x.setScrollTop(0),x.rail&&(x.rail.scrollable=!1)):(x.page.maxh-=x.opt.railpadding.top+x.opt.railpadding.bottom,x.rail.scrollable=!0),0===x.page.maxw?(x.hideRailHr(),x.scrollvaluemaxw=0,x.scroll.x=0,x.scrollratio.x=0,x.cursorwidth=0,x.setScrollLeft(0),x.railh&&(x.railh.scrollable=!1)):(x.page.maxw-=x.opt.railpadding.left+x.opt.railpadding.right,x.railh&&(x.railh.scrollable=x.opt.horizrailenabled)),x.railslocked=x.locked||0===x.page.maxh&&0===x.page.maxw,x.railslocked?(x.ispage||x.updateScrollBar(x.view),!1):(x.hidden||x.visibility?!x.railh||x.hidden||x.railh.visibility||x.showRailHr():x.showRail().showRailHr(),x.istextarea&&x.win.css("resize")&&"none"!=x.win.css("resize")&&(x.view.h-=20),x.cursorheight=Math.min(x.view.h,Math.round(x.view.h*(x.view.h/x.page.h))),x.cursorheight=x.opt.cursorfixedheight?x.opt.cursorfixedheight:Math.max(x.opt.cursorminheight,x.cursorheight),x.cursorwidth=Math.min(x.view.w,Math.round(x.view.w*(x.view.w/x.page.w))),x.cursorwidth=x.opt.cursorfixedheight?x.opt.cursorfixedheight:Math.max(x.opt.cursorminheight,x.cursorwidth),x.scrollvaluemax=x.view.h-x.cursorheight-(x.opt.railpadding.top+x.opt.railpadding.bottom),x.railh&&(x.railh.width=x.page.maxh>0?x.view.w-x.rail.width:x.view.w,x.scrollvaluemaxw=x.railh.width-x.cursorwidth-(x.opt.railpadding.left+x.opt.railpadding.right)),x.ispage||x.updateScrollBar(x.view),x.scrollratio={x:x.page.maxw/x.scrollvaluemaxw,y:x.page.maxh/x.scrollvaluemax},x.getScrollTop()>x.page.maxh?x.doScrollTop(x.page.maxh):(x.scroll.y=Math.round(x.getScrollTop()*(1/x.scrollratio.y)),x.scroll.x=Math.round(x.getScrollLeft()*(1/x.scrollratio.x)),x.cursoractive&&x.noticeCursor()),x.scroll.y&&0==x.getScrollTop()&&x.doScrollTo(Math.floor(x.scroll.y*x.scrollratio.y)),x)},this.resize=x.onResize,this.hlazyresize=0,this.lazyResize=function(e){return x.haswrapper||x.hide(),x.hlazyresize&&clearTimeout(x.hlazyresize),x.hlazyresize=setTimeout(function(){x&&(x.resize(),x.show())},240),x},this.jqbind=function(e,o,t){x.events.push({e:e,n:o,f:t,q:!0}),s(e).bind(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in document.createElement("div"))x._bind(r,"wheel",o,t||!1);else{var i=void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll";b(r,i,o,t||!1),"DOMMouseScroll"==i&&b(r,"MozMousePixelScroll",o,t||!1)}};var P=!1;if(M.haseventlistener){try{var R=Object.defineProperty({},"passive",{get:function(){P=!0}});window.addEventListener("test",null,R)}catch(e){}this.cancelEvent=function(e){return!!e&&((e=e.original?e.original:e).cancelable&&e.preventDefault(),e.stopPropagation(),e.preventManipulation&&e.preventManipulation(),!1)},this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},window.constructor.prototype.addEventListener=document.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},window.constructor.prototype.removeEventListener=document.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return!!(e=window.event||!1)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1,!1)},this.stopPropagation=function(e){return!!(e=window.event||!1)&&(e.cancelBubble=!0,!1)};this.bind=function(e,o,t,r,i){var n="jquery"in e?e[0]:e;x._bind(n,o,t,r||!1,i||!1)},this._bind=function(e,o,t,r,i){x.events.push({e:e,n:o,f:t,b:r,q:!1}),P&&i?e.addEventListener(o,t,{passive:!1,capture:r}):e.addEventListener(o,t,r||!1)},this._unbind=function(e,o,t,r){e.removeEventListener(o,t,r)},this.unbindAll=function(){for(var e=0;e0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){var n={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:x.newscrollx,y:x.newscrolly},speed:i};x.onscrollstart.call(x,n)},this.triggerScrollEnd=function(){if(x.onscrollend){var e=x.getScrollLeft(),o=x.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};x.onscrollend.call(x,t)}},this.onmousewheel=function(e){if(!x.wheelprevented){if(x.railslocked)return x.debounced("checkunlock",x.resize,250),!0;if(x.rail.drag)return x.cancelEvent(e);if("auto"===x.opt.oneaxismousemode&&0!==e.deltaX&&(x.opt.oneaxismousemode=!1),x.opt.oneaxismousemode&&0===e.deltaX&&!x.rail.scrollable)return!x.railh||!x.railh.scrollable||x.onmousewheelhr(e);var o=h(),t=!1;if(x.opt.preservenativescrolling&&x.checkarea+60020?t:0},x.opt.smoothscroll?x.ishwscroll&&M.hastransition&&x.opt.usetransition&&x.opt.smoothscroll?(this.prepareTransition=function(e,o){var t=o?e>20?e:0:x.getTransitionSpeed(e),r=t?M.prefixstyle+"transform "+t+"ms ease-out":"";return x.lasttransitionstyle&&x.lasttransitionstyle==r||(x.lasttransitionstyle=r,x.doc.css(M.transitionstyle,r)),t},this.doScrollLeft=function(e,o){var t=x.scrollrunning?x.newscrolly:x.getScrollTop();x.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=x.scrollrunning?x.newscrollx:x.getScrollLeft();x.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=x.getScrollTop(),i=x.getScrollLeft();return((x.newscrolly-r)*(o-r)<0||(x.newscrollx-i)*(e-i)<0)&&x.cancelScroll(),0==x.opt.bouncescroll&&(o<0?o=0:o>x.page.maxh&&(o=x.page.maxh),e<0?e=0:e>x.page.maxw&&(e=x.page.maxw)),(!x.scrollrunning||e!=x.newscrollx||o!=x.newscrolly)&&(x.newscrolly=o,x.newscrollx=e,x.newscrollspeed=t||!1,!x.timer&&void(x.timer=setTimeout(function(){var t=x.getScrollTop(),r=x.getScrollLeft(),i={};i.x=e-r,i.y=o-t,i.px=r,i.py=t;var n=Math.round(Math.sqrt(Math.pow(i.x,2)+Math.pow(i.y,2))),s=x.newscrollspeed&&x.newscrollspeed>1?x.newscrollspeed:x.getTransitionSpeed(n);if(x.newscrollspeed&&x.newscrollspeed<=1&&(s*=x.newscrollspeed),x.prepareTransition(s,!0),x.timerscroll&&x.timerscroll.tm&&clearInterval(x.timerscroll.tm),s>0){!x.scrollrunning&&x.onscrollstart&&x.triggerScrollStart(r,t,e,o,s),M.transitionend?x.scrollendtrapped||(x.scrollendtrapped=!0,x.bind(x.doc,M.transitionend,x.onScrollTransitionEnd,!1)):(x.scrollendtrapped&&clearTimeout(x.scrollendtrapped),x.scrollendtrapped=setTimeout(x.onScrollTransitionEnd,s));var l=t,a=r;x.timerscroll={bz:new L(l,x.newscrolly,s,0,0,.58,1),bh:new L(a,x.newscrollx,s,0,0,.58,1)},x.cursorfreezed||(x.timerscroll.tm=setInterval(function(){x.showCursor(x.getScrollTop(),x.getScrollLeft())},60))}x.synched("doScroll-set",function(){x.timer=0,x.scrollendtrapped&&(x.scrollrunning=!0),x.setScrollTop(x.newscrolly),x.setScrollLeft(x.newscrollx),x.scrollendtrapped||x.onScrollTransitionEnd()})},50)))},this.cancelScroll=function(){if(!x.scrollendtrapped)return!0;var e=x.getScrollTop(),o=x.getScrollLeft();return x.scrollrunning=!1,M.transitionend||clearTimeout(M.transitionend),x.scrollendtrapped=!1,x._unbind(x.doc[0],M.transitionend,x.onScrollTransitionEnd),x.prepareTransition(0),x.setScrollTop(e),x.railh&&x.setScrollLeft(o),x.timerscroll&&x.timerscroll.tm&&clearInterval(x.timerscroll.tm),x.timerscroll=!1,x.cursorfreezed=!1,x.showCursor(e,o),x},this.onScrollTransitionEnd=function(){x.scrollendtrapped&&x._unbind(x.doc[0],M.transitionend,x.onScrollTransitionEnd),x.scrollendtrapped=!1,x.prepareTransition(0),x.timerscroll&&x.timerscroll.tm&&clearInterval(x.timerscroll.tm),x.timerscroll=!1;var e=x.getScrollTop(),o=x.getScrollLeft();if(x.setScrollTop(e),x.railh&&x.setScrollLeft(o),x.noticeCursor(!1,e,o),x.cursorfreezed=!1,e<0?e=0:e>x.page.maxh&&(e=x.page.maxh),o<0?o=0:o>x.page.maxw&&(o=x.page.maxw),e!=x.newscrolly||o!=x.newscrollx)return x.doScrollPos(o,e,x.opt.snapbackspeed);x.onscrollend&&x.scrollrunning&&x.triggerScrollEnd(),x.scrollrunning=!1}):(this.doScrollLeft=function(e,o){var t=x.scrollrunning?x.newscrolly:x.getScrollTop();x.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=x.scrollrunning?x.newscrollx:x.getScrollLeft();x.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){function r(){if(x.cancelAnimationFrame)return!0;if(x.scrollrunning=!0,h=1-h)return x.timer=a(r)||1;var e,o,t=0,i=o=x.getScrollTop();x.dst.ay?(((s=(i=x.bzscroll?x.dst.py+x.bzscroll.getNow()*x.dst.ay:x.newscrolly)-o)<0&&i0&&i>x.newscrolly)&&(i=x.newscrolly),x.setScrollTop(i),i==x.newscrolly&&(t=1)):t=1;var n=e=x.getScrollLeft();if(x.dst.ax){var s=(n=x.bzscroll?x.dst.px+x.bzscroll.getNow()*x.dst.ax:x.newscrollx)-e;(s<0&&n0&&n>x.newscrollx)&&(n=x.newscrollx),x.setScrollLeft(n),n==x.newscrollx&&(t+=1)}else t+=1;2==t?(x.timer=0,x.cursorfreezed=!1,x.bzscroll=!1,x.scrollrunning=!1,i<0?i=0:i>x.page.maxh&&(i=Math.max(0,x.page.maxh)),n<0?n=0:n>x.page.maxw&&(n=x.page.maxw),n!=x.newscrollx||i!=x.newscrolly?x.doScrollPos(n,i):x.onscrollend&&x.triggerScrollEnd()):x.timer=a(r)||1}var o=void 0===o||!1===o?x.getScrollTop(!0):o;if(x.timer&&x.newscrolly==o&&x.newscrollx==e)return!0;x.timer&&c(x.timer),x.timer=0;var i=x.getScrollTop(),n=x.getScrollLeft();((x.newscrolly-i)*(o-i)<0||(x.newscrollx-n)*(e-n)<0)&&x.cancelScroll(),x.newscrolly=o,x.newscrollx=e,x.bouncescroll&&x.rail.visibility||(x.newscrolly<0?x.newscrolly=0:x.newscrolly>x.page.maxh&&(x.newscrolly=x.page.maxh)),x.bouncescroll&&x.railh.visibility||(x.newscrollx<0?x.newscrollx=0:x.newscrollx>x.page.maxw&&(x.newscrollx=x.page.maxw)),x.dst={},x.dst.x=e-n,x.dst.y=o-i,x.dst.px=n,x.dst.py=i;var s=Math.round(Math.sqrt(Math.pow(x.dst.x,2)+Math.pow(x.dst.y,2)));x.dst.ax=x.dst.x/s,x.dst.ay=x.dst.y/s;var l=0,d=s;0==x.dst.x?(l=i,d=o,x.dst.ay=1,x.dst.py=0):0==x.dst.y&&(l=n,d=e,x.dst.ax=1,x.dst.px=0);var u=x.getTransitionSpeed(s);if(t&&t<=1&&(u*=t),x.bzscroll=u>0&&(x.bzscroll?x.bzscroll.update(d,u):new L(l,d,u,0,1,0,1)),!x.timer){(i==x.page.maxh&&o>=x.page.maxh||n==x.page.maxw&&e>=x.page.maxw)&&x.checkContentSize();var h=1;x.cancelAnimationFrame=!1,x.timer=1,x.onscrollstart&&!x.scrollrunning&&x.triggerScrollStart(n,i,e,o,u),r(),(i==x.page.maxh&&o>=i||n==x.page.maxw&&e>=n)&&x.checkContentSize(),x.noticeCursor()}},this.cancelScroll=function(){return x.timer&&c(x.timer),x.timer=0,x.bzscroll=!1,x.scrollrunning=!1,x}):(this.doScrollLeft=function(e,o){var t=x.getScrollTop();x.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=x.getScrollLeft();x.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>x.page.maxw?x.page.maxw:e;r<0&&(r=0);var i=o>x.page.maxh?x.page.maxh:o;i<0&&(i=0),x.synched("scroll",function(){x.setScrollTop(i),x.setScrollLeft(r)})},this.cancelScroll=function(){}),this.doScrollBy=function(e,o){var t=0;if(t=o?Math.floor((x.scroll.y-e)*x.scrollratio.y):(x.timer?x.newscrolly:x.getScrollTop(!0))-e,x.bouncescroll){var r=Math.round(x.view.h/2);t<-r?t=-r:t>x.page.maxh+r&&(t=x.page.maxh+r)}x.cursorfreezed=!1;var i=x.getScrollTop(!0);return t<0&&i<=0?x.noticeCursor():t>x.page.maxh&&i>=x.page.maxh?(x.checkContentSize(),x.noticeCursor()):void x.doScrollTop(t)},this.doScrollLeftBy=function(e,o){var t=0;if(t=o?Math.floor((x.scroll.x-e)*x.scrollratio.x):(x.timer?x.newscrollx:x.getScrollLeft(!0))-e,x.bouncescroll){var r=Math.round(x.view.w/2);t<-r?t=-r:t>x.page.maxw+r&&(t=x.page.maxw+r)}x.cursorfreezed=!1;var i=x.getScrollLeft(!0);return t<0&&i<=0?x.noticeCursor():t>x.page.maxw&&i>=x.page.maxw?x.noticeCursor():void x.doScrollLeft(t)},this.doScrollTo=function(e,o){var t=o?Math.round(e*x.scrollratio.y):e;t<0?t=0:t>x.page.maxh&&(t=x.page.maxh),x.cursorfreezed=!1,x.doScrollTop(e)},this.checkContentSize=function(){var e=x.getContentSize();e.h==x.page.h&&e.w==x.page.w||x.resize(!1,e)},x.onscroll=function(e){x.rail.drag||x.cursorfreezed||x.synched("scroll",function(){x.scroll.y=Math.round(x.getScrollTop()*(1/x.scrollratio.y)),x.railh&&(x.scroll.x=Math.round(x.getScrollLeft()*(1/x.scrollratio.x))),x.noticeCursor()})},x.bind(x.docscroll,"scroll",x.onscroll),this.doZoomIn=function(e){if(!x.zoomactive){x.zoomactive=!0,x.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=x.win[0].style;for(var r in o){var i=o[r];x.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}x.zoomrestore.style.width=x.win.css("width"),x.zoomrestore.style.height=x.win.css("height"),x.zoomrestore.padding={w:x.win.outerWidth()-x.win.width(),h:x.win.outerHeight()-x.win.height()},M.isios4&&(x.zoomrestore.scrollTop=l.scrollTop(),l.scrollTop(0)),x.win.css({position:M.isios4?"absolute":"fixed",top:0,left:0,zIndex:n+100,margin:0});var s=x.win.css("backgroundColor");return(""==s||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(s))&&x.win.css("backgroundColor","#fff"),x.rail.css({zIndex:n+101}),x.zoom.css({zIndex:n+102}),x.zoom.css("backgroundPosition","0 -18px"),x.resizeZoom(),x.onzoomin&&x.onzoomin.call(x),x.cancelEvent(e)}},this.doZoomOut=function(e){if(x.zoomactive)return x.zoomactive=!1,x.win.css("margin",""),x.win.css(x.zoomrestore.style),M.isios4&&l.scrollTop(x.zoomrestore.scrollTop),x.rail.css({"z-index":x.zindex}),x.zoom.css({"z-index":x.zindex}),x.zoomrestore=!1,x.zoom.css("backgroundPosition","0 0"),x.onResize(),x.onzoomout&&x.onzoomout.call(x),x.cancelEvent(e)},this.doZoom=function(e){return x.zoomactive?x.doZoomOut(e):x.doZoomIn(e)},this.resizeZoom=function(){if(x.zoomactive){var e=x.getScrollTop();x.win.css({width:l.width()-x.zoomrestore.padding.w+"px",height:l.height()-x.zoomrestore.padding.h+"px"}),x.onResize(),x.setScrollTop(Math.min(x.page.maxh,e))}},this.init(),s.nicescroll.push(this)},w=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=h(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=h();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,n=e-o.lastx,s=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+n;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=s<0||s>o.nc.page.maxh,o.speedx=n,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=h(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),n=o.nc.getScrollTop(),s=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=s>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(n<0||n>s||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var p=u/50;o.speedx*=p,o.speedy*=p,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var m=o.lastscrollx,f=o.lastscrolly,g=function(){var e=h()-t>600?.04:.02;o.speedx&&(m=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=m,(m<0||m>l)&&(e=.1)),o.speedy&&(f=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=f,(f<0||f>s)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=m,o.nc.setScrollLeft(m)}if(o.speedy){o.nc.getScrollTop();o.chky=f,o.nc.setScrollTop(f)}o.timer||(o.nc.hideCursor(),o.doSnapy(m,f))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(m,f))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},v=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=s.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():v.call(e)},set:function(e,o){var t=s.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):v.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(s.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():v.call(this)}return this.each(function(){var o=s.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):v.call(s(this),e)})};var b=e.fn.scrollLeft;s.cssHooks.pageXOffset={get:function(e,o,t){var r=s.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():b.call(e)},set:function(e,o){var t=s.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):b.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(s.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():b.call(this)}return this.each(function(){var o=s.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):b.call(s(this),e)})};var y=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return s.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?s(e,r):n,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new g(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},window.NiceScroll={getjQuery:function(){return e}},s.nicescroll||(s.nicescroll=new y,s.nicescroll.options=p)}); \ No newline at end of file diff --git a/jquery.nicescroll.js b/jquery.nicescroll.js index ac249b9..a4b0480 100644 --- a/jquery.nicescroll.js +++ b/jquery.nicescroll.js @@ -31,7 +31,7 @@ var $ = jQuery; // sandbox - var document = document; + //var document = document; var $window = $(window); // http://stackoverflow.com/questions/2161159/get-script-path diff --git a/jquery.nicescroll.min.js b/jquery.nicescroll.min.js index 014c3bb..9602845 100644 --- a/jquery.nicescroll.min.js +++ b/jquery.nicescroll.min.js @@ -1,2 +1,2 @@ /* nicescroll v3.7.2 InuYaksa - MIT - https://nicescroll.areaaperta.com */ -!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=l,a=n(window),c=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||!1}(),d=function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||!1}();if(c)window.cancelAnimationFrame||(d=function(e){});else{var u=0;c=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-u)),i=window.setTimeout(function(){e(t+r)},r);return u=t+r,i},d=function(e){window.clearTimeout(e)}}var h=window.MutationObserver||window.WebKitMutationObserver||!1,p=Date.now||function(){return(new Date).getTime()},m={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:60,mousescrollstep:24,touchbehavior:!1,emulatetouch:!1,hwacceleration:!0,usetransition:!0,boxzoom:!1,dblclickzoom:!0,gesturezoom:!0,grabcursorenabled:!0,autohidemode:!0,background:"",iframeautoresize:!0,cursorminheight:32,preservenativescrolling:!0,railoffset:!1,railhoffset:!1,bouncescroll:!0,spacebarenabled:!0,railpadding:{top:0,right:0,left:0,bottom:0},disableoutline:!0,horizrailenabled:!0,railalign:"right",railvalign:"bottom",enabletranslate3d:!0,enablemousewheel:!0,enablekeyboard:!0,smoothscroll:!0,sensitiverail:!0,enablemouselockapi:!0,cursorfixedheight:!1,directionlockdeadzone:6,hidecursordelay:400,nativeparentscrolling:!0,enablescrollonselection:!0,overflowx:!0,overflowy:!0,cursordragspeed:.3,rtlmode:"auto",cursordragontouch:!1,oneaxismousemode:"auto",scriptpath:function(){var e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},f=!1,g=function(){if(f)return f;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in window,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(window.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in window&&9===l.documentMode,i.isie10=i.isie&&"performance"in window&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in window,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in window,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in window,i.hasw3ctouch=(window.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(window.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&window.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!=o)return parseInt(o);e=e.parent()}return!1}function b(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=P[r]||0)?t?S.win.outerHeight()-S.win.innerHeight():S.win.outerWidth()-S.win.innerWidth():1;return S.isie8&&i&&(i+=1),s?i:0}return i}function y(e,o,t,r){S._bind(e,o,function(r){var i={original:r=r||window.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function x(e,o,t){var r,i;if(0==e.deltaMode?(r=-Math.floor(e.deltaX*(S.opt.mousescrollstep/54)),i=-Math.floor(e.deltaY*(S.opt.mousescrollstep/54))):1==e.deltaMode&&(r=-Math.floor(e.deltaX*S.opt.mousescrollstep),i=-Math.floor(e.deltaY*S.opt.mousescrollstep)),o&&S.opt.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?S.getScrollLeft()>=S.page.maxw:S.getScrollLeft()<=0)&&(i=r,r=0)),S.isrtlmode&&(r=-r),r){if(S.scrollmom)S.scrollmom.stop();else if(r<0){if(S.getScrollLeft()>=S.page.maxw)return!0}else if(S.getScrollLeft()<=0)return!0;S.lastdeltax+=r,S.debounced("mousewheelx",function(){var e=S.lastdeltax;S.lastdeltax=0,S.rail.drag||S.doScrollLeftBy(e)},15)}if(i){if(S.opt.nativeparentscrolling&&t&&!S.ispage&&!S.zoomactive)if(i<0){if(S.getScrollTop()>=S.page.maxh)return!0}else if(S.getScrollTop()<=0)return!0;S.scrollmom&&S.scrollmom.stop(),S.lastdeltay+=i,S.synched("mousewheely",function(){var e=S.lastdeltay;S.lastdeltay=0,S.rail.drag||S.doScrollBy(e)},15)}return e.stopImmediatePropagation(),e.preventDefault()}var S=this;this.version="3.7.2",this.name="nicescroll",this.me=u;var z=n("body");if(this.opt={doc:z,win:!1},n.extend(this.opt,m),this.opt.snapbackspeed=80,e)for(var k in S.opt)void 0!==e[k]&&(S.opt[k]=e[k]);if(S.opt.disablemutationobserver&&(h=!1),this.doc=S.opt.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(S.opt.win?S.opt.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==S.opt.win,this.win=S.opt.win||(this.ispage?a:this.doc),this.docscroll=this.ispage&&!this.haswrapper?a:this.win,this.body=z,this.viewport=!1,this.isfixed=!1,this.iframe=!1,this.isiframe="IFRAME"==this.doc[0].nodeName&&"IFRAME"==this.win[0].nodeName,this.istextarea="TEXTAREA"==this.win[0].nodeName,this.forcescreen=!1,this.canshowonmouseevent="scroll"!=S.opt.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==this.opt.rtlmode){var T=this.win[0]==window?this.body:this.win,M=T.css("writing-mode")||T.css("-webkit-writing-mode")||T.css("-ms-writing-mode")||T.css("-moz-writing-mode");"horizontal-tb"==M||"lr-tb"==M||""==M?(this.isrtlmode="rtl"==T.css("direction"),this.isvertical=!1):(this.isrtlmode="vertical-rl"==M||"tb"==M||"tb-rl"==M||"rl-tb"==M,this.isvertical="vertical-rl"==M||"tb"==M||"tb-rl"==M)}else this.isrtlmode=!0===this.opt.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1===S.opt.scrollbarid)do{this.id="ascrail"+i++}while(l.getElementById(this.id));else this.id=S.opt.scrollbarid;this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=S.opt.overflowx,this.overflowy=S.opt.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=g();var E=n.extend({},this.detected);this.canhwscroll=E.hastransform&&S.opt.hwacceleration,this.ishwscroll=this.canhwscroll&&S.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(E.iswebkit||E.isie||E.isie11):this.hasreversehr=!(E.iswebkit||E.isie&&!E.isie10&&!E.isie11):this.hasreversehr=!1,this.istouchcapable=!1,E.cantouch||!E.hasw3ctouch&&!E.hasmstouch?!E.cantouch||E.isios||E.isandroid||!E.iswebkit&&!E.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,S.opt.enablemouselockapi||(E.hasmousecapture=!1,E.haspointerlock=!1),this.debounced=function(e,o,t){S&&(S.delaylist[e]||!1||(S.delaylist[e]={h:c(function(){S.delaylist[e].fn.call(S),S.delaylist[e]=!1},t)},o.call(S)),S.delaylist[e].fn=o)};var L=!1;this.synched=function(e,o){return S.synclist[e]=o,function(){L||(c(function(){if(S){L=!1;for(var e in S.synclist){var o=S.synclist[e];o&&o.call(S),S.synclist[e]=!1}}}),L=!0)}(),e},this.unsynched=function(e){S.synclist[e]&&(S.synclist[e]=!1)},this.css=function(e,o){for(var t in o)S.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?S.getScrollTop():S.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?S.getScrollLeft():S.setScrollLeft(e)};var C=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=p(),this.df=this.ed-this.st};if(C.prototype={B2:function(e){return 3*e*e*(1-e)},B3:function(e){return 3*e*(1-e)*(1-e)},B4:function(e){return(1-e)*(1-e)*(1-e)},getNow:function(){var e=1-(p()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e<0?this.ed:this.st+Math.round(this.df*o)},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=p(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},E.hastranslate3d&&E.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=f();if(o)return 16==o.length?-o[13]:-o[5];if(S.timerscroll&&S.timerscroll.bz)return S.timerscroll.bz.getNow()}return S.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=f();if(o)return 16==o.length?-o[12]:-o[4];if(S.timerscroll&&S.timerscroll.bh)return S.timerscroll.bh.getNow()}return S.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!0,window,1),o.niceevent=!0,e.dispatchEvent(o)};var N=this.isrtlmode?1:-1;E.hastranslate3d&&S.opt.enabletranslate3d?(this.setScrollTop=function(e,o){S.doc.translate.y=e,S.doc.translate.ty=-1*e+"px",S.doc.css(E.trstyle,"translate3d("+S.doc.translate.tx+","+S.doc.translate.ty+",0)"),o||S.notifyScrollEvent(S.win[0])},this.setScrollLeft=function(e,o){S.doc.translate.x=e,S.doc.translate.tx=e*N+"px",S.doc.css(E.trstyle,"translate3d("+S.doc.translate.tx+","+S.doc.translate.ty+",0)"),o||S.notifyScrollEvent(S.win[0])}):(this.setScrollTop=function(e,o){S.doc.translate.y=e,S.doc.translate.ty=-1*e+"px",S.doc.css(E.trstyle,"translate("+S.doc.translate.tx+","+S.doc.translate.ty+")"),o||S.notifyScrollEvent(S.win[0])},this.setScrollLeft=function(e,o){S.doc.translate.x=e,S.doc.translate.tx=e*N+"px",S.doc.css(E.trstyle,"translate("+S.doc.translate.tx+","+S.doc.translate.ty+")"),o||S.notifyScrollEvent(S.win[0])})}else this.getScrollTop=function(){return S.docscroll.scrollTop()},this.setScrollTop=function(e){return setTimeout(function(){S&&S.docscroll.scrollTop(e)},1)},this.getScrollLeft=function(){return S.hasreversehr?S.detected.ismozilla?S.page.maxw-Math.abs(S.docscroll.scrollLeft()):S.page.maxw-S.docscroll.scrollLeft():S.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(S)return S.hasreversehr&&(e=S.detected.ismozilla?-(S.page.maxw-e):S.page.maxw-e),S.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var P={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:window.pageYOffset||l.documentElement.scrollTop,left:window.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(S.isfixed){var e=S.win.offset(),o=S.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=S.win.offset();if(!S.viewport)return t;var r=S.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(S.ishwscroll)S.rail.css({height:S.win.innerHeight()-(S.opt.railpadding.top+S.opt.railpadding.bottom)}),S.railh&&S.railh.css({width:S.win.innerWidth()-(S.opt.railpadding.left+S.opt.railpadding.right)});else{var r=S.getOffset();if(o={top:r.top,left:r.left-(S.opt.railpadding.left+S.opt.railpadding.right)},o.top+=b(S.win,"border-top-width",!0),o.left+=S.rail.align?S.win.outerWidth()-b(S.win,"border-right-width")-S.rail.width:b(S.win,"border-left-width"),(t=S.opt.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),S.railslocked||S.rail.css({top:o.top,left:o.left,height:(e?e.h:S.win.innerHeight())-(S.opt.railpadding.top+S.opt.railpadding.bottom)}),S.zoom&&S.zoom.css({top:o.top+1,left:1==S.rail.align?o.left-20:o.left+S.rail.width+4}),S.railh&&!S.railslocked){o={top:r.top,left:r.left},(t=S.opt.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=S.railh.align?o.top+b(S.win,"border-top-width",!0)+S.win.innerHeight()-S.railh.height:o.top+b(S.win,"border-top-width",!0),s=o.left+b(S.win,"border-left-width");S.railh.css({top:i-(S.opt.railpadding.top+S.opt.railpadding.bottom),left:s,width:S.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;S.railslocked||(S.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?S.doScrollLeft:S.doScrollTop)(s=t?(e.pageX-S.railh.offset().left-S.cursorwidth/2)*S.scrollratio.x:(e.pageY-S.rail.offset().top-S.cursorheight/2)*S.scrollratio.y):(r=t?S.doScrollLeftBy:S.doScrollBy,s=t?S.scroll.x:S.scroll.y,n=t?e.pageX-S.railh.offset().left:e.pageY-S.rail.offset().top,i=t?S.view.w:S.view.h,r(s>=n?i:-i)))},S.hasanimationframe="requestAnimationFrame"in window,S.hascancelanimationframe="cancelAnimationFrame"in window,this.init=function(){if(S.saved.css=[],E.isoperamini)return!0;if(E.isandroid&&!("hidden"in l))return!0;S.opt.emulatetouch=S.opt.emulatetouch||S.opt.touchbehavior;var e={"overflow-y":"hidden"};if((E.isie11||E.isie10)&&(e["-ms-overflow-style"]="none"),S.zindex="auto",S.ispage||"auto"!=S.opt.zindex?S.zindex=S.opt.zindex:S.zindex=w()||"auto",!S.ispage&&"auto"!=S.zindex&&S.zindex>s&&(s=S.zindex),S.isie&&0==S.zindex&&"auto"==S.opt.zindex&&(S.zindex="auto"),!S.ispage||!E.cantouch&&!E.isieold){var i=S.docscroll;S.ispage&&(i=S.haswrapper?S.win:S.doc),S.css(i,e),S.ispage&&(E.isie11||E.isie)&&S.css(n("html"),e),!E.isios||S.ispage||S.haswrapper||S.css(z,{"-webkit-overflow-scrolling":"touch"});var c=n(l.createElement("div"));c.css({position:"relative",top:0,float:"right",width:S.opt.cursorwidth,height:0,"background-color":S.opt.cursorcolor,border:S.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":S.opt.cursorborderradius,"-moz-border-radius":S.opt.cursorborderradius,"border-radius":S.opt.cursorborderradius}),c.addClass("nicescroll-cursors"),S.cursor=c;var d=n(l.createElement("div"));d.attr("id",S.id),d.addClass("nicescroll-rails nicescroll-rails-vr");var u,p,m=["left","right","top","bottom"];for(var f in m)p=m[f],(u=S.opt.railpadding[p])?d.css("padding-"+p,u+"px"):S.opt.railpadding[p]=0;d.append(c),d.width=Math.max(parseFloat(S.opt.cursorwidth),c.outerWidth()),d.css({width:d.width+"px",zIndex:S.zindex,background:S.opt.background,cursor:"default"}),d.visibility=!0,d.scrollable=!0,d.align="left"==S.opt.railalign?0:1,S.rail=d,S.rail.drag=!1;var g=!1;!S.opt.boxzoom||S.ispage||E.isieold||(g=l.createElement("div"),S.bind(g,"click",S.doZoom),S.bind(g,"mouseenter",function(){S.zoom.css("opacity",S.opt.cursoropacitymax)}),S.bind(g,"mouseleave",function(){S.zoom.css("opacity",S.opt.cursoropacitymin)}),S.zoom=n(g),S.zoom.css({cursor:"pointer",zIndex:S.zindex,backgroundImage:"url("+S.opt.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),S.opt.dblclickzoom&&S.bind(S.win,"dblclick",S.doZoom),E.cantouch&&S.opt.gesturezoom&&(S.ongesturezoom=function(e){return e.scale>1.5&&S.doZoomIn(e),e.scale<.8&&S.doZoomOut(e),S.cancelEvent(e)},S.bind(S.win,"gestureend",S.ongesturezoom))),S.railh=!1;var b;if(S.opt.horizrailenabled&&(S.css(i,{overflowX:"hidden"}),(c=n(l.createElement("div"))).css({position:"absolute",top:0,height:S.opt.cursorwidth,width:0,backgroundColor:S.opt.cursorcolor,border:S.opt.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":S.opt.cursorborderradius,"-moz-border-radius":S.opt.cursorborderradius,"border-radius":S.opt.cursorborderradius}),E.isieold&&c.css("overflow","hidden"),c.addClass("nicescroll-cursors"),S.cursorh=c,(b=n(l.createElement("div"))).attr("id",S.id+"-hr"),b.addClass("nicescroll-rails nicescroll-rails-hr"),b.height=Math.max(parseFloat(S.opt.cursorwidth),c.outerHeight()),b.css({height:b.height+"px",zIndex:S.zindex,background:S.opt.background}),b.append(c),b.visibility=!0,b.scrollable=!0,b.align="top"==S.opt.railvalign?0:1,S.railh=b,S.railh.drag=!1),S.ispage)d.css({position:"fixed",top:0,height:"100%"}),d.align?d.css({right:0}):d.css({left:0}),S.body.append(d),S.railh&&(b.css({position:"fixed",left:0,width:"100%"}),b.align?b.css({bottom:0}):b.css({top:0}),S.body.append(b));else{if(S.ishwscroll){"static"==S.win.css("position")&&S.css(S.win,{position:"relative"});var y="HTML"==S.win[0].nodeName?S.body:S.win;n(y).scrollTop(0).scrollLeft(0),S.zoom&&(S.zoom.css({position:"absolute",top:1,right:0,"margin-right":d.width+4}),y.append(S.zoom)),d.css({position:"absolute",top:0}),d.align?d.css({right:0}):d.css({left:0}),y.append(d),b&&(b.css({position:"absolute",left:0,bottom:0}),b.align?b.css({bottom:0}):b.css({top:0}),y.append(b))}else{S.isfixed="fixed"==S.win.css("position");var x=S.isfixed?"fixed":"absolute";S.isfixed||(S.viewport=S.getViewport(S.win[0])),S.viewport&&(S.body=S.viewport,0==/fixed|absolute/.test(S.viewport.css("position"))&&S.css(S.viewport,{position:"relative"})),d.css({position:x}),S.zoom&&S.zoom.css({position:x}),S.updateScrollBar(),S.body.append(d),S.zoom&&S.body.append(S.zoom),S.railh&&(b.css({position:x}),S.body.append(b))}E.isios&&S.css(S.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),E.isie&&S.opt.disableoutline&&S.win.attr("hideFocus","true"),E.iswebkit&&S.opt.disableoutline&&S.win.css("outline","none")}if(!1===S.opt.autohidemode?(S.autohidedom=!1,S.rail.css({opacity:S.opt.cursoropacitymax}),S.railh&&S.railh.css({opacity:S.opt.cursoropacitymax})):!0===S.opt.autohidemode||"leave"===S.opt.autohidemode?(S.autohidedom=n().add(S.rail),E.isie8&&(S.autohidedom=S.autohidedom.add(S.cursor)),S.railh&&(S.autohidedom=S.autohidedom.add(S.railh)),S.railh&&E.isie8&&(S.autohidedom=S.autohidedom.add(S.cursorh))):"scroll"==S.opt.autohidemode?(S.autohidedom=n().add(S.rail),S.railh&&(S.autohidedom=S.autohidedom.add(S.railh))):"cursor"==S.opt.autohidemode?(S.autohidedom=n().add(S.cursor),S.railh&&(S.autohidedom=S.autohidedom.add(S.cursorh))):"hidden"==S.opt.autohidemode&&(S.autohidedom=!1,S.hide(),S.railslocked=!1),E.cantouch||S.istouchcapable||S.opt.emulatetouch||E.hasmstouch){S.scrollmom=new v(S),S.ontouchstart=function(e){if(e.pointerType&&2!=e.pointerType&&"touch"!=e.pointerType)return!1;if(S.hasmoving=!1,!S.railslocked){var o;if(E.hasmstouch)for(o=!!e.target&&e.target;o;){var t=n(o).getNiceScroll();if(t.length>0&&t[0].me==S.me)break;if(t.length>0)return!1;if("DIV"==o.nodeName&&o.id==S.id)break;o=!!o.parentNode&&o.parentNode}if(e.stopPropagation(),S.cancelScroll(),(o=S.getTarget(e))&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return S.stopPropagation(e);if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),S.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(S.rail.drag={x:e.clientX,y:e.clientY,sx:S.scroll.x,sy:S.scroll.y,st:S.getScrollTop(),sl:S.getScrollLeft(),pt:2,dl:!1,tg:o},S.ispage||!S.opt.directionlockdeadzone)S.rail.drag.dl="f";else{var i={w:a.width(),h:a.height()},s={w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)},c=Math.max(0,s.h-i.h),d=Math.max(0,s.w-i.w);!S.rail.scrollable&&S.railh.scrollable?S.rail.drag.ck=c>0&&"v":S.rail.scrollable&&!S.railh.scrollable?S.rail.drag.ck=d>0&&"h":S.rail.drag.ck=!1,S.rail.drag.ck||(S.rail.drag.dl="f")}if(S.opt.emulatetouch&&S.isiframe&&E.isie){var u=S.win.position();S.rail.drag.x+=u.left,S.rail.drag.y+=u.top}if(S.hasmoving=!1,S.lastmouseup=!1,S.scrollmom.reset(e.clientX,e.clientY),!E.cantouch&&!this.istouchcapable&&!e.pointerType){if(!(!!o&&/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName)))return!S.ispage&&E.hasmousecapture&&o.setCapture(),S.opt.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(S.hasmoving)return!1;o._onclick.call(this,e)}),S.cancelEvent(e)):S.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(S.preventclick={tg:o,click:!1})}}},S.ontouchend=function(e){if(!S.rail.drag)return!0;if(2==S.rail.drag.pt){if(e.pointerType&&2!=e.pointerType&&"touch"!=e.pointerType)return!1;if(S.rail.drag=!1,S.hasmoving&&(S.scrollmom.doMomentum(),S.lastmouseup=!0,S.hideCursor(),E.hasmousecapture&&l.releaseCapture(),!E.cantouch))return S.cancelEvent(e)}else if(1==S.rail.drag.pt)return S.onmouseup(e)};var k=S.opt.emulatetouch&&S.isiframe&&!E.hasmousecapture;S.ontouchmove=function(e,o){if(!S.rail.drag)return!1;if(e.targetTouches&&S.opt.preventmultitouchscrolling&&e.targetTouches.length>1)return!1;if(e.pointerType&&2!=e.pointerType&&"touch"!=e.pointerType)return!1;if(2==S.rail.drag.pt){if("changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),S.rail.drag.y===e.clientY&&S.rail.drag.x===e.clientX)return!1;S.hasmoving||S.triggerScrollStart(e.clientX,e.clientY,0,0,0),S.hasmoving=!0,S.preventclick&&!S.preventclick.click&&(S.preventclick.click=S.preventclick.tg.onclick||!1,S.preventclick.tg.onclick=S.onpreventclick);var t,r;if(r=t=0,k&&!o){var i=S.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-S.rail.drag.y,a=e.clientX+r,c=a-S.rail.drag.x,d=S.rail.drag.st-n;S.ishwscroll&&S.opt.bouncescroll?d<0?d=Math.round(d/2):d>S.page.maxh&&(d=S.page.maxh+Math.round((d-S.page.maxh)/2)):(d<0&&(d=0,s=0),d>S.page.maxh&&(d=S.page.maxh,s=0));var u;S.railh&&S.railh.scrollable&&(u=S.isrtlmode?c-S.rail.drag.sl:S.rail.drag.sl-c,S.ishwscroll&&S.opt.bouncescroll?u<0?u=Math.round(u/2):u>S.page.maxw&&(u=S.page.maxw+Math.round((u-S.page.maxw)/2)):(u<0&&(u=0,a=0),u>S.page.maxw&&(u=S.page.maxw,a=0)));var h=!1;if(S.rail.drag.dl)h=!0,"v"==S.rail.drag.dl?u=S.rail.drag.sl:"h"==S.rail.drag.dl&&(d=S.rail.drag.st);else{var p=Math.abs(n),m=Math.abs(c),f=S.opt.directionlockdeadzone;if("v"==S.rail.drag.ck){if(p>f&&m<=.3*p)return S.rail.drag=!1,!0;m>f&&(S.rail.drag.dl="f",z.scrollTop(z.scrollTop()))}else if("h"==S.rail.drag.ck){if(m>f&&p<=.3*m)return S.rail.drag=!1,!0;p>f&&(S.rail.drag.dl="f",z.scrollLeft(z.scrollLeft()))}}if(S.synched("touchmove",function(){S.rail.drag&&2==S.rail.drag.pt&&(S.prepareTransition&&S.prepareTransition(0),S.rail.scrollable&&S.setScrollTop(d),S.scrollmom.update(a,s),S.railh&&S.railh.scrollable?(S.setScrollLeft(u),S.showCursor(d,u)):S.showCursor(d),E.isie10&&l.selection.clear())}),E.ischrome&&S.istouchcapable&&(h=!1),h)return S.cancelEvent(e)}else if(1==S.rail.drag.pt)return S.onmousemove(e)},S.ontouchstartCursor=function(e,o){if(!S.rail.drag||3==S.rail.drag.pt){if(S.locked)return S.cancelEvent(e);S.cancelScroll(),S.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:S.scroll.x,sy:S.scroll.y,pt:3,hr:!!o};var t=S.getTarget(e);return!S.ispage&&E.hasmousecapture&&t.setCapture(),S.isiframe&&!E.hasmousecapture&&(S.saved.csspointerevents=S.doc.css("pointer-events"),S.css(S.doc,{"pointer-events":"none"})),S.cancelEvent(e)}},S.ontouchendCursor=function(e){if(S.rail.drag){if(E.hasmousecapture&&l.releaseCapture(),S.isiframe&&!E.hasmousecapture&&S.doc.css("pointer-events",S.saved.csspointerevents),3!=S.rail.drag.pt)return;return S.rail.drag=!1,S.cancelEvent(e)}},S.ontouchmoveCursor=function(e){if(S.rail.drag){if(3!=S.rail.drag.pt)return;if(S.cursorfreezed=!0,S.rail.drag.hr){S.scroll.x=S.rail.drag.sx+(e.touches[0].clientX-S.rail.drag.x),S.scroll.x<0&&(S.scroll.x=0);var o=S.scrollvaluemaxw;S.scroll.x>o&&(S.scroll.x=o)}else{S.scroll.y=S.rail.drag.sy+(e.touches[0].clientY-S.rail.drag.y),S.scroll.y<0&&(S.scroll.y=0);var t=S.scrollvaluemax;S.scroll.y>t&&(S.scroll.y=t)}return S.synched("touchmove",function(){S.rail.drag&&3==S.rail.drag.pt&&(S.showCursor(),S.rail.drag.hr?S.doScrollLeft(Math.round(S.scroll.x*S.scrollratio.x),S.opt.cursordragspeed):S.doScrollTop(Math.round(S.scroll.y*S.scrollratio.y),S.opt.cursordragspeed))}),S.cancelEvent(e)}}}if(S.onmousedown=function(e,o){if(!S.rail.drag||1==S.rail.drag.pt){if(S.railslocked)return S.cancelEvent(e);S.cancelScroll(),S.rail.drag={x:e.clientX,y:e.clientY,sx:S.scroll.x,sy:S.scroll.y,pt:1,hr:o||!1};var t=S.getTarget(e);return!S.ispage&&E.hasmousecapture&&t.setCapture(),S.isiframe&&!E.hasmousecapture&&(S.saved.csspointerevents=S.doc.css("pointer-events"),S.css(S.doc,{"pointer-events":"none"})),S.hasmoving=!1,S.cancelEvent(e)}},S.onmouseup=function(e){if(S.rail.drag)return 1!=S.rail.drag.pt||(E.hasmousecapture&&l.releaseCapture(),S.isiframe&&!E.hasmousecapture&&S.doc.css("pointer-events",S.saved.csspointerevents),S.rail.drag=!1,S.hasmoving&&S.triggerScrollEnd(),S.cancelEvent(e))},S.onmousemove=function(e){if(S.rail.drag){if(1!==S.rail.drag.pt)return;if(E.ischrome&&0===e.which)return S.onmouseup(e);if(S.cursorfreezed=!0,S.hasmoving=!0,S.rail.drag.hr){S.scroll.x=S.rail.drag.sx+(e.clientX-S.rail.drag.x),S.scroll.x<0&&(S.scroll.x=0);var o=S.scrollvaluemaxw;S.scroll.x>o&&(S.scroll.x=o)}else{S.scroll.y=S.rail.drag.sy+(e.clientY-S.rail.drag.y),S.scroll.y<0&&(S.scroll.y=0);var t=S.scrollvaluemax;S.scroll.y>t&&(S.scroll.y=t)}return S.synched("mousemove",function(){S.rail.drag&&1==S.rail.drag.pt&&(S.showCursor(),S.rail.drag.hr?S.hasreversehr?S.doScrollLeft(S.scrollvaluemaxw-Math.round(S.scroll.x*S.scrollratio.x),S.opt.cursordragspeed):S.doScrollLeft(Math.round(S.scroll.x*S.scrollratio.x),S.opt.cursordragspeed):S.doScrollTop(Math.round(S.scroll.y*S.scrollratio.y),S.opt.cursordragspeed))}),S.cancelEvent(e)}S.checkarea=0},E.cantouch||S.opt.emulatetouch)S.onpreventclick=function(e){if(S.preventclick)return S.preventclick.tg.onclick=S.preventclick.click,S.preventclick=!1,S.cancelEvent(e)},S.onclick=!E.isios&&function(e){return!S.lastmouseup||(S.lastmouseup=!1,S.cancelEvent(e))},S.opt.grabcursorenabled&&E.cursorgrabvalue&&(S.css(S.ispage?S.doc:S.win,{cursor:E.cursorgrabvalue}),S.css(S.rail,{cursor:E.cursorgrabvalue}));else{var T=function(e){if(S.selectiondrag){if(e){var o=S.win.outerHeight(),t=e.pageY-S.selectiondrag.top;t>0&&t=o&&(t-=o),S.selectiondrag.df=t}if(0!=S.selectiondrag.df){var r=2*-Math.floor(S.selectiondrag.df/6);S.doScrollBy(r),S.debounced("doselectionscroll",function(){T()},50)}}};S.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},S.onselectionstart=function(e){S.ispage||(S.selectiondrag=S.win.offset())},S.onselectionend=function(e){S.selectiondrag=!1},S.onselectiondrag=function(e){S.selectiondrag&&S.hasTextSelected()&&S.debounced("selectionscroll",function(){T(e)},250)}}if(E.hasw3ctouch?(S.css(S.ispage?n("html"):S.win,{"touch-action":"none"}),S.css(S.rail,{"touch-action":"none"}),S.css(S.cursor,{"touch-action":"none"}),S.bind(S.win,"pointerdown",S.ontouchstart),S.bind(l,"pointerup",S.ontouchend),S.bind(l,"pointermove",S.ontouchmove)):E.hasmstouch?(S.css(S.ispage?n("html"):S.win,{"-ms-touch-action":"none"}),S.css(S.rail,{"-ms-touch-action":"none"}),S.css(S.cursor,{"-ms-touch-action":"none"}),S.bind(S.win,"MSPointerDown",S.ontouchstart),S.bind(l,"MSPointerUp",S.ontouchend),S.bind(l,"MSPointerMove",S.ontouchmove),S.bind(S.cursor,"MSGestureHold",function(e){e.preventDefault()}),S.bind(S.cursor,"contextmenu",function(e){e.preventDefault()})):E.cantouch&&(S.bind(S.win,"touchstart",S.ontouchstart,!1,!0),S.bind(l,"touchend",S.ontouchend,!1,!0),S.bind(l,"touchcancel",S.ontouchend,!1,!0),S.bind(l,"touchmove",S.ontouchmove,!1,!0)),S.opt.emulatetouch&&(S.bind(S.win,"mousedown",S.ontouchstart,!1,!0),S.bind(l,"mouseup",S.ontouchend,!1,!0),S.bind(l,"mousemove",S.ontouchmove,!1,!0)),(S.opt.cursordragontouch||!E.cantouch&&!S.opt.emulatetouch)&&(S.rail.css({cursor:"default"}),S.railh&&S.railh.css({cursor:"default"}),S.jqbind(S.rail,"mouseenter",function(){if(!S.ispage&&!S.win.is(":visible"))return!1;S.canshowonmouseevent&&S.showCursor(),S.rail.active=!0}),S.jqbind(S.rail,"mouseleave",function(){S.rail.active=!1,S.rail.drag||S.hideCursor()}),S.opt.sensitiverail&&(S.bind(S.rail,"click",function(e){S.doRailClick(e,!1,!1)}),S.bind(S.rail,"dblclick",function(e){S.doRailClick(e,!0,!1)}),S.bind(S.cursor,"click",function(e){S.cancelEvent(e)}),S.bind(S.cursor,"dblclick",function(e){S.cancelEvent(e)})),S.railh&&(S.jqbind(S.railh,"mouseenter",function(){if(!S.ispage&&!S.win.is(":visible"))return!1;S.canshowonmouseevent&&S.showCursor(),S.rail.active=!0}),S.jqbind(S.railh,"mouseleave",function(){S.rail.active=!1,S.rail.drag||S.hideCursor()}),S.opt.sensitiverail&&(S.bind(S.railh,"click",function(e){S.doRailClick(e,!1,!0)}),S.bind(S.railh,"dblclick",function(e){S.doRailClick(e,!0,!0)}),S.bind(S.cursorh,"click",function(e){S.cancelEvent(e)}),S.bind(S.cursorh,"dblclick",function(e){S.cancelEvent(e)})))),S.opt.cursordragontouch&&(this.istouchcapable||E.cantouch)&&(S.bind(S.cursor,"touchstart",S.ontouchstartCursor),S.bind(S.cursor,"touchmove",S.ontouchmoveCursor),S.bind(S.cursor,"touchend",S.ontouchendCursor),S.cursorh&&S.bind(S.cursorh,"touchstart",function(e){S.ontouchstartCursor(e,!0)}),S.cursorh&&S.bind(S.cursorh,"touchmove",S.ontouchmoveCursor),S.cursorh&&S.bind(S.cursorh,"touchend",S.ontouchendCursor)),E.cantouch||S.opt.emulatetouch?(S.bind(E.hasmousecapture?S.win:l,"mouseup",S.ontouchend),S.onclick&&S.bind(l,"click",S.onclick),S.opt.cursordragontouch?(S.bind(S.cursor,"mousedown",S.onmousedown),S.bind(S.cursor,"mouseup",S.onmouseup),S.cursorh&&S.bind(S.cursorh,"mousedown",function(e){S.onmousedown(e,!0)}),S.cursorh&&S.bind(S.cursorh,"mouseup",S.onmouseup)):(S.bind(S.rail,"mousedown",function(e){e.preventDefault()}),S.railh&&S.bind(S.railh,"mousedown",function(e){e.preventDefault()}))):(S.bind(E.hasmousecapture?S.win:l,"mouseup",S.onmouseup),S.bind(l,"mousemove",S.onmousemove),S.onclick&&S.bind(l,"click",S.onclick),S.bind(S.cursor,"mousedown",S.onmousedown),S.bind(S.cursor,"mouseup",S.onmouseup),S.railh&&(S.bind(S.cursorh,"mousedown",function(e){S.onmousedown(e,!0)}),S.bind(S.cursorh,"mouseup",S.onmouseup)),!S.ispage&&S.opt.enablescrollonselection&&(S.bind(S.win[0],"mousedown",S.onselectionstart),S.bind(l,"mouseup",S.onselectionend),S.bind(S.cursor,"mouseup",S.onselectionend),S.cursorh&&S.bind(S.cursorh,"mouseup",S.onselectionend),S.bind(l,"mousemove",S.onselectiondrag)),S.zoom&&(S.jqbind(S.zoom,"mouseenter",function(){S.canshowonmouseevent&&S.showCursor(),S.rail.active=!0}),S.jqbind(S.zoom,"mouseleave",function(){S.rail.active=!1,S.rail.drag||S.hideCursor()}))),S.opt.enablemousewheel&&(S.isiframe||S.mousewheel(E.isie&&S.ispage?l:S.win,S.onmousewheel),S.mousewheel(S.rail,S.onmousewheel),S.railh&&S.mousewheel(S.railh,S.onmousewheelhr)),S.ispage||E.cantouch||/HTML|^BODY/.test(S.win[0].nodeName)||(S.win.attr("tabindex")||S.win.attr({tabindex:++r}),S.bind(S.win,"focus",function(e){o=S.getTarget(e).id||!0,S.hasfocus=!0,S.canshowonmouseevent&&S.noticeCursor()}),S.bind(S.win,"blur",function(e){o=!1,S.hasfocus=!1}),S.bind(S.win,"mouseenter",function(e){t=S.getTarget(e).id||!0,S.hasmousefocus=!0,S.canshowonmouseevent&&S.noticeCursor()}),S.bind(S.win,"mouseleave",function(e){t=!1,S.hasmousefocus=!1,S.rail.drag||S.hideCursor()})),S.onkeypress=function(e){if(S.railslocked&&0==S.page.maxh)return!0;e=e||window.e;var r=S.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(S.hasfocus||S.hasmousefocus&&!o||S.ispage&&!o&&!t){var i=e.keyCode;if(S.railslocked&&27!=i)return S.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,a=!1;switch(i){case 38:case 63233:S.doScrollBy(72),a=!0;break;case 40:case 63235:S.doScrollBy(-72),a=!0;break;case 37:case 63232:S.railh&&(s?S.doScrollLeft(0):S.doScrollLeftBy(72),a=!0);break;case 39:case 63234:S.railh&&(s?S.doScrollLeft(S.page.maxw):S.doScrollLeftBy(-72),a=!0);break;case 33:case 63276:S.doScrollBy(S.view.h),a=!0;break;case 34:case 63277:S.doScrollBy(-S.view.h),a=!0;break;case 36:case 63273:S.railh&&s?S.doScrollPos(0,0):S.doScrollTo(0),a=!0;break;case 35:case 63275:S.railh&&s?S.doScrollPos(S.page.maxw,S.page.maxh):S.doScrollTo(S.page.maxh),a=!0;break;case 32:S.opt.spacebarenabled&&(l?S.doScrollBy(S.view.h):S.doScrollBy(-S.view.h),a=!0);break;case 27:S.zoomactive&&(S.doZoom(),a=!0)}if(a)return S.cancelEvent(e)}},S.opt.enablekeyboard&&S.bind(l,E.isopera&&!E.isopera12?"keypress":"keydown",S.onkeypress),S.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(S.wheelprevented=!0)}),S.bind(l,"keyup",function(e){e.ctrlKey||!1||(S.wheelprevented=!1)}),S.bind(window,"blur",function(e){S.wheelprevented=!1}),S.bind(window,"resize",S.lazyResize),S.bind(window,"orientationchange",S.lazyResize),S.bind(window,"load",S.lazyResize),E.ischrome&&!S.ispage&&!S.haswrapper){var M=S.win.attr("style"),L=parseFloat(S.win.css("width"))+1;S.win.css("width",L),S.synched("chromefix",function(){S.win.attr("style",M)})}S.onAttributeChange=function(e){S.lazyResize(S.isieold?250:30)},S.opt.enableobserver&&(S.isie11||!1===h||(S.observerbody=new h(function(e){if(e.forEach(function(e){if("attributes"==e.type)return z.hasClass("modal-open")&&z.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],S.doc[0])?S.hide():S.show()}),S.me.clientWidth!=S.page.width||S.me.clientHeight!=S.page.height)return S.lazyResize(30)}),S.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),S.ispage||S.haswrapper||(!1!==h?(S.observer=new h(function(e){e.forEach(S.onAttributeChange)}),S.observer.observe(S.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),S.observerremover=new h(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(S&&e.removedNodes[o]==S.win[0])return S.remove()})}),S.observerremover.observe(S.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(S.bind(S.win,E.isie&&!E.isie9?"propertychange":"DOMAttrModified",S.onAttributeChange),E.isie9&&S.win[0].attachEvent("onpropertychange",S.onAttributeChange),S.bind(S.win,"DOMNodeRemoved",function(e){e.target==S.win[0]&&S.remove()})))),!S.ispage&&S.opt.boxzoom&&S.bind(window,"resize",S.resizeZoom),S.istextarea&&(S.bind(S.win,"keydown",S.lazyResize),S.bind(S.win,"mouseup",S.lazyResize)),S.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var C=function(){S.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow.document).domain}catch(e){S.iframexd=!0,o=!1}if(S.iframexd)return"console"in window&&console.log("NiceScroll error: policy restriced iframe"),!0;if(S.forcescreen=!0,S.isiframe&&(S.iframe={doc:n(o),html:S.doc.contents().find("html")[0],body:S.doc.contents().find("body")[0]},S.getContentSize=function(){return{w:Math.max(S.iframe.html.scrollWidth,S.iframe.body.scrollWidth),h:Math.max(S.iframe.html.scrollHeight,S.iframe.body.scrollHeight)}},S.docscroll=n(S.iframe.body)),!E.isios&&S.opt.iframeautoresize&&!S.isiframe){S.win.scrollTop(0),S.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);S.doc.height(t)}S.lazyResize(30),S.css(n(S.iframe.body),e),E.isios&&S.haswrapper&&S.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?S.bind(this.contentWindow,"scroll",S.onscroll):S.bind(o,"scroll",S.onscroll),S.opt.enablemousewheel&&S.mousewheel(o,S.onmousewheel),S.opt.enablekeyboard&&S.bind(o,E.isopera?"keypress":"keydown",S.onkeypress),E.cantouch?(S.bind(o,"touchstart",S.ontouchstart),S.bind(o,"touchmove",S.ontouchmove)):S.opt.emulatetouch&&(S.bind(o,"mousedown",S.ontouchstart),S.bind(o,"mousemove",function(e){return S.ontouchmove(e,!0)}),S.opt.grabcursorenabled&&E.cursorgrabvalue&&S.css(n(o.body),{cursor:E.cursorgrabvalue})),S.bind(o,"mouseup",S.ontouchend),S.zoom&&(S.opt.dblclickzoom&&S.bind(o,"dblclick",S.doZoom),S.ongesturezoom&&S.bind(o,"gestureend",S.ongesturezoom))};this.doc[0].readyState&&"complete"==this.doc[0].readyState&&setTimeout(function(){C.call(S.doc[0],!1)},500),S.bind(this.doc,"load",C)}},this.showCursor=function(e,o){if(S.cursortimeout&&(clearTimeout(S.cursortimeout),S.cursortimeout=0),S.rail){if(S.autohidedom&&(S.autohidedom.stop().css({opacity:S.opt.cursoropacitymax}),S.cursoractive=!0),S.rail.drag&&1==S.rail.drag.pt||(void 0!==e&&!1!==e&&(S.scroll.y=Math.round(1*e/S.scrollratio.y)),void 0!==o&&(S.scroll.x=Math.round(1*o/S.scrollratio.x))),S.cursor.css({height:S.cursorheight,top:S.scroll.y}),S.cursorh){var t=S.hasreversehr?S.scrollvaluemaxw-S.scroll.x:S.scroll.x;!S.rail.align&&S.rail.visibility?S.cursorh.css({width:S.cursorwidth,left:t+S.rail.width}):S.cursorh.css({width:S.cursorwidth,left:t}),S.cursoractive=!0}S.zoom&&S.zoom.stop().css({opacity:S.opt.cursoropacitymax})}},this.hideCursor=function(e){S.cursortimeout||S.rail&&S.autohidedom&&(S.hasmousefocus&&"leave"==S.opt.autohidemode||(S.cursortimeout=setTimeout(function(){S.rail.active&&S.showonmouseevent||(S.autohidedom.stop().animate({opacity:S.opt.cursoropacitymin}),S.zoom&&S.zoom.stop().animate({opacity:S.opt.cursoropacitymin}),S.cursoractive=!1),S.cursortimeout=0},e||S.opt.hidecursordelay)))},this.noticeCursor=function(e,o,t){S.showCursor(o,t),S.rail.active||S.hideCursor(e)},this.getContentSize=S.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:S.haswrapper?function(){return{w:S.doc[0].offsetWidth,h:S.doc[0].offsetHeight}}:function(){return{w:S.docscroll[0].scrollWidth,h:S.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!S||!S.win)return!1;if(!S.haswrapper&&!S.ispage){if("none"==S.win.css("display"))return S.visibility&&S.hideRail().hideRailHr(),!1;S.hidden||S.visibility||S.showRail().showRailHr()}var t=S.page.maxh,r=S.page.maxw,i={h:S.view.h,w:S.view.w};if(S.view={w:S.ispage?S.win.width():S.win[0].clientWidth,h:S.ispage?S.win.height():S.win[0].clientHeight},S.page=o||S.getContentSize(),S.page.maxh=Math.max(0,S.page.h-S.view.h),S.page.maxw=Math.max(0,S.page.w-S.view.w),S.page.maxh==t&&S.page.maxw==r&&S.view.w==i.w&&S.view.h==i.h){if(S.ispage)return S;var s=S.win.offset();if(S.lastposition){var n=S.lastposition;if(n.top==s.top&&n.left==s.left)return S}S.lastposition=s}return 0===S.page.maxh?(S.hideRail(),S.scrollvaluemax=0,S.scroll.y=0,S.scrollratio.y=0,S.cursorheight=0,S.setScrollTop(0),S.rail&&(S.rail.scrollable=!1)):(S.page.maxh-=S.opt.railpadding.top+S.opt.railpadding.bottom,S.rail.scrollable=!0),0===S.page.maxw?(S.hideRailHr(),S.scrollvaluemaxw=0,S.scroll.x=0,S.scrollratio.x=0,S.cursorwidth=0,S.setScrollLeft(0),S.railh&&(S.railh.scrollable=!1)):(S.page.maxw-=S.opt.railpadding.left+S.opt.railpadding.right,S.railh&&(S.railh.scrollable=S.opt.horizrailenabled)),S.railslocked=S.locked||0===S.page.maxh&&0===S.page.maxw,S.railslocked?(S.ispage||S.updateScrollBar(S.view),!1):(S.hidden||S.visibility?!S.railh||S.hidden||S.railh.visibility||S.showRailHr():S.showRail().showRailHr(),S.istextarea&&S.win.css("resize")&&"none"!=S.win.css("resize")&&(S.view.h-=20),S.cursorheight=Math.min(S.view.h,Math.round(S.view.h*(S.view.h/S.page.h))),S.cursorheight=S.opt.cursorfixedheight?S.opt.cursorfixedheight:Math.max(S.opt.cursorminheight,S.cursorheight),S.cursorwidth=Math.min(S.view.w,Math.round(S.view.w*(S.view.w/S.page.w))),S.cursorwidth=S.opt.cursorfixedheight?S.opt.cursorfixedheight:Math.max(S.opt.cursorminheight,S.cursorwidth),S.scrollvaluemax=S.view.h-S.cursorheight-(S.opt.railpadding.top+S.opt.railpadding.bottom),S.railh&&(S.railh.width=S.page.maxh>0?S.view.w-S.rail.width:S.view.w,S.scrollvaluemaxw=S.railh.width-S.cursorwidth-(S.opt.railpadding.left+S.opt.railpadding.right)),S.ispage||S.updateScrollBar(S.view),S.scrollratio={x:S.page.maxw/S.scrollvaluemaxw,y:S.page.maxh/S.scrollvaluemax},S.getScrollTop()>S.page.maxh?S.doScrollTop(S.page.maxh):(S.scroll.y=Math.round(S.getScrollTop()*(1/S.scrollratio.y)),S.scroll.x=Math.round(S.getScrollLeft()*(1/S.scrollratio.x)),S.cursoractive&&S.noticeCursor()),S.scroll.y&&0==S.getScrollTop()&&S.doScrollTo(Math.floor(S.scroll.y*S.scrollratio.y)),S)},this.resize=S.onResize,this.hlazyresize=0,this.lazyResize=function(e){return S.haswrapper||S.hide(),S.hlazyresize&&clearTimeout(S.hlazyresize),S.hlazyresize=setTimeout(function(){S&&(S.resize(),S.show())},240),S},this.jqbind=function(e,o,t){S.events.push({e:e,n:o,f:t,q:!0}),n(e).bind(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))S._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";y(r,i,o,t||!1),"DOMMouseScroll"==i&&y(r,"MozMousePixelScroll",o,t||!1)}};var R=!1;if(E.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){R=!0}});window.addEventListener("test",null,H)}catch(e){}this.cancelEvent=function(e){return!!e&&((e=e.original?e.original:e).cancelable&&e.preventDefault(),e.stopPropagation(),e.preventManipulation&&e.preventManipulation(),!1)},this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},window.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},window.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return!!(e=window.event||!1)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1,!1)},this.stopPropagation=function(e){return!!(e=window.event||!1)&&(e.cancelBubble=!0,!1)};this.bind=function(e,o,t,r,i){var s="jquery"in e?e[0]:e;S._bind(s,o,t,r||!1,i||!1)},this._bind=function(e,o,t,r,i){S.events.push({e:e,n:o,f:t,b:r,q:!1}),R&&i?e.addEventListener(o,t,{passive:!1,capture:r}):e.addEventListener(o,t,r||!1)},this._unbind=function(e,o,t,r){e.removeEventListener(o,t,r)},this.unbindAll=function(){for(var e=0;e0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:S.newscrollx,y:S.newscrolly},speed:i};S.onscrollstart.call(S,s)},this.triggerScrollEnd=function(){if(S.onscrollend){var e=S.getScrollLeft(),o=S.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};S.onscrollend.call(S,t)}},this.onmousewheel=function(e){if(!S.wheelprevented){if(S.railslocked)return S.debounced("checkunlock",S.resize,250),!0;if(S.rail.drag)return S.cancelEvent(e);if("auto"===S.opt.oneaxismousemode&&0!==e.deltaX&&(S.opt.oneaxismousemode=!1),S.opt.oneaxismousemode&&0===e.deltaX&&!S.rail.scrollable)return!S.railh||!S.railh.scrollable||S.onmousewheelhr(e);var o=p(),t=!1;if(S.opt.preservenativescrolling&&S.checkarea+60020?t:0},S.opt.smoothscroll?S.ishwscroll&&E.hastransition&&S.opt.usetransition&&S.opt.smoothscroll?(this.prepareTransition=function(e,o){var t=o?e>20?e:0:S.getTransitionSpeed(e),r=t?E.prefixstyle+"transform "+t+"ms ease-out":"";return S.lasttransitionstyle&&S.lasttransitionstyle==r||(S.lasttransitionstyle=r,S.doc.css(E.transitionstyle,r)),t},this.doScrollLeft=function(e,o){var t=S.scrollrunning?S.newscrolly:S.getScrollTop();S.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=S.scrollrunning?S.newscrollx:S.getScrollLeft();S.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=S.getScrollTop(),i=S.getScrollLeft();return((S.newscrolly-r)*(o-r)<0||(S.newscrollx-i)*(e-i)<0)&&S.cancelScroll(),0==S.opt.bouncescroll&&(o<0?o=0:o>S.page.maxh&&(o=S.page.maxh),e<0?e=0:e>S.page.maxw&&(e=S.page.maxw)),(!S.scrollrunning||e!=S.newscrollx||o!=S.newscrolly)&&(S.newscrolly=o,S.newscrollx=e,S.newscrollspeed=t||!1,!S.timer&&void(S.timer=setTimeout(function(){var t=S.getScrollTop(),r=S.getScrollLeft(),i={};i.x=e-r,i.y=o-t,i.px=r,i.py=t;var s=Math.round(Math.sqrt(Math.pow(i.x,2)+Math.pow(i.y,2))),n=S.newscrollspeed&&S.newscrollspeed>1?S.newscrollspeed:S.getTransitionSpeed(s);if(S.newscrollspeed&&S.newscrollspeed<=1&&(n*=S.newscrollspeed),S.prepareTransition(n,!0),S.timerscroll&&S.timerscroll.tm&&clearInterval(S.timerscroll.tm),n>0){!S.scrollrunning&&S.onscrollstart&&S.triggerScrollStart(r,t,e,o,n),E.transitionend?S.scrollendtrapped||(S.scrollendtrapped=!0,S.bind(S.doc,E.transitionend,S.onScrollTransitionEnd,!1)):(S.scrollendtrapped&&clearTimeout(S.scrollendtrapped),S.scrollendtrapped=setTimeout(S.onScrollTransitionEnd,n));var l=t,a=r;S.timerscroll={bz:new C(l,S.newscrolly,n,0,0,.58,1),bh:new C(a,S.newscrollx,n,0,0,.58,1)},S.cursorfreezed||(S.timerscroll.tm=setInterval(function(){S.showCursor(S.getScrollTop(),S.getScrollLeft())},60))}S.synched("doScroll-set",function(){S.timer=0,S.scrollendtrapped&&(S.scrollrunning=!0),S.setScrollTop(S.newscrolly),S.setScrollLeft(S.newscrollx),S.scrollendtrapped||S.onScrollTransitionEnd()})},50)))},this.cancelScroll=function(){if(!S.scrollendtrapped)return!0;var e=S.getScrollTop(),o=S.getScrollLeft();return S.scrollrunning=!1,E.transitionend||clearTimeout(E.transitionend),S.scrollendtrapped=!1,S._unbind(S.doc[0],E.transitionend,S.onScrollTransitionEnd),S.prepareTransition(0),S.setScrollTop(e),S.railh&&S.setScrollLeft(o),S.timerscroll&&S.timerscroll.tm&&clearInterval(S.timerscroll.tm),S.timerscroll=!1,S.cursorfreezed=!1,S.showCursor(e,o),S},this.onScrollTransitionEnd=function(){S.scrollendtrapped&&S._unbind(S.doc[0],E.transitionend,S.onScrollTransitionEnd),S.scrollendtrapped=!1,S.prepareTransition(0),S.timerscroll&&S.timerscroll.tm&&clearInterval(S.timerscroll.tm),S.timerscroll=!1;var e=S.getScrollTop(),o=S.getScrollLeft();if(S.setScrollTop(e),S.railh&&S.setScrollLeft(o),S.noticeCursor(!1,e,o),S.cursorfreezed=!1,e<0?e=0:e>S.page.maxh&&(e=S.page.maxh),o<0?o=0:o>S.page.maxw&&(o=S.page.maxw),e!=S.newscrolly||o!=S.newscrollx)return S.doScrollPos(o,e,S.opt.snapbackspeed);S.onscrollend&&S.scrollrunning&&S.triggerScrollEnd(),S.scrollrunning=!1}):(this.doScrollLeft=function(e,o){var t=S.scrollrunning?S.newscrolly:S.getScrollTop();S.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=S.scrollrunning?S.newscrollx:S.getScrollLeft();S.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){function r(){if(S.cancelAnimationFrame)return!0;if(S.scrollrunning=!0,h=1-h)return S.timer=c(r)||1;var e,o,t=0,i=o=S.getScrollTop();S.dst.ay?(((n=(i=S.bzscroll?S.dst.py+S.bzscroll.getNow()*S.dst.ay:S.newscrolly)-o)<0&&i0&&i>S.newscrolly)&&(i=S.newscrolly),S.setScrollTop(i),i==S.newscrolly&&(t=1)):t=1;var s=e=S.getScrollLeft();if(S.dst.ax){var n=(s=S.bzscroll?S.dst.px+S.bzscroll.getNow()*S.dst.ax:S.newscrollx)-e;(n<0&&s0&&s>S.newscrollx)&&(s=S.newscrollx),S.setScrollLeft(s),s==S.newscrollx&&(t+=1)}else t+=1;2==t?(S.timer=0,S.cursorfreezed=!1,S.bzscroll=!1,S.scrollrunning=!1,i<0?i=0:i>S.page.maxh&&(i=Math.max(0,S.page.maxh)),s<0?s=0:s>S.page.maxw&&(s=S.page.maxw),s!=S.newscrollx||i!=S.newscrolly?S.doScrollPos(s,i):S.onscrollend&&S.triggerScrollEnd()):S.timer=c(r)||1}var o=void 0===o||!1===o?S.getScrollTop(!0):o;if(S.timer&&S.newscrolly==o&&S.newscrollx==e)return!0;S.timer&&d(S.timer),S.timer=0;var i=S.getScrollTop(),s=S.getScrollLeft();((S.newscrolly-i)*(o-i)<0||(S.newscrollx-s)*(e-s)<0)&&S.cancelScroll(),S.newscrolly=o,S.newscrollx=e,S.bouncescroll&&S.rail.visibility||(S.newscrolly<0?S.newscrolly=0:S.newscrolly>S.page.maxh&&(S.newscrolly=S.page.maxh)),S.bouncescroll&&S.railh.visibility||(S.newscrollx<0?S.newscrollx=0:S.newscrollx>S.page.maxw&&(S.newscrollx=S.page.maxw)),S.dst={},S.dst.x=e-s,S.dst.y=o-i,S.dst.px=s,S.dst.py=i;var n=Math.round(Math.sqrt(Math.pow(S.dst.x,2)+Math.pow(S.dst.y,2)));S.dst.ax=S.dst.x/n,S.dst.ay=S.dst.y/n;var l=0,a=n;0==S.dst.x?(l=i,a=o,S.dst.ay=1,S.dst.py=0):0==S.dst.y&&(l=s,a=e,S.dst.ax=1,S.dst.px=0);var u=S.getTransitionSpeed(n);if(t&&t<=1&&(u*=t),S.bzscroll=u>0&&(S.bzscroll?S.bzscroll.update(a,u):new C(l,a,u,0,1,0,1)),!S.timer){(i==S.page.maxh&&o>=S.page.maxh||s==S.page.maxw&&e>=S.page.maxw)&&S.checkContentSize();var h=1;S.cancelAnimationFrame=!1,S.timer=1,S.onscrollstart&&!S.scrollrunning&&S.triggerScrollStart(s,i,e,o,u),r(),(i==S.page.maxh&&o>=i||s==S.page.maxw&&e>=s)&&S.checkContentSize(),S.noticeCursor()}},this.cancelScroll=function(){return S.timer&&d(S.timer),S.timer=0,S.bzscroll=!1,S.scrollrunning=!1,S}):(this.doScrollLeft=function(e,o){var t=S.getScrollTop();S.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=S.getScrollLeft();S.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>S.page.maxw?S.page.maxw:e;r<0&&(r=0);var i=o>S.page.maxh?S.page.maxh:o;i<0&&(i=0),S.synched("scroll",function(){S.setScrollTop(i),S.setScrollLeft(r)})},this.cancelScroll=function(){}),this.doScrollBy=function(e,o){var t=0;if(t=o?Math.floor((S.scroll.y-e)*S.scrollratio.y):(S.timer?S.newscrolly:S.getScrollTop(!0))-e,S.bouncescroll){var r=Math.round(S.view.h/2);t<-r?t=-r:t>S.page.maxh+r&&(t=S.page.maxh+r)}S.cursorfreezed=!1;var i=S.getScrollTop(!0);return t<0&&i<=0?S.noticeCursor():t>S.page.maxh&&i>=S.page.maxh?(S.checkContentSize(),S.noticeCursor()):void S.doScrollTop(t)},this.doScrollLeftBy=function(e,o){var t=0;if(t=o?Math.floor((S.scroll.x-e)*S.scrollratio.x):(S.timer?S.newscrollx:S.getScrollLeft(!0))-e,S.bouncescroll){var r=Math.round(S.view.w/2);t<-r?t=-r:t>S.page.maxw+r&&(t=S.page.maxw+r)}S.cursorfreezed=!1;var i=S.getScrollLeft(!0);return t<0&&i<=0?S.noticeCursor():t>S.page.maxw&&i>=S.page.maxw?S.noticeCursor():void S.doScrollLeft(t)},this.doScrollTo=function(e,o){var t=o?Math.round(e*S.scrollratio.y):e;t<0?t=0:t>S.page.maxh&&(t=S.page.maxh),S.cursorfreezed=!1,S.doScrollTop(e)},this.checkContentSize=function(){var e=S.getContentSize();e.h==S.page.h&&e.w==S.page.w||S.resize(!1,e)},S.onscroll=function(e){S.rail.drag||S.cursorfreezed||S.synched("scroll",function(){S.scroll.y=Math.round(S.getScrollTop()*(1/S.scrollratio.y)),S.railh&&(S.scroll.x=Math.round(S.getScrollLeft()*(1/S.scrollratio.x))),S.noticeCursor()})},S.bind(S.docscroll,"scroll",S.onscroll),this.doZoomIn=function(e){if(!S.zoomactive){S.zoomactive=!0,S.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=S.win[0].style;for(var r in o){var i=o[r];S.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}S.zoomrestore.style.width=S.win.css("width"),S.zoomrestore.style.height=S.win.css("height"),S.zoomrestore.padding={w:S.win.outerWidth()-S.win.width(),h:S.win.outerHeight()-S.win.height()},E.isios4&&(S.zoomrestore.scrollTop=a.scrollTop(),a.scrollTop(0)),S.win.css({position:E.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=S.win.css("backgroundColor");return(""==n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&S.win.css("backgroundColor","#fff"),S.rail.css({zIndex:s+101}),S.zoom.css({zIndex:s+102}),S.zoom.css("backgroundPosition","0 -18px"),S.resizeZoom(),S.onzoomin&&S.onzoomin.call(S),S.cancelEvent(e)}},this.doZoomOut=function(e){if(S.zoomactive)return S.zoomactive=!1,S.win.css("margin",""),S.win.css(S.zoomrestore.style),E.isios4&&a.scrollTop(S.zoomrestore.scrollTop),S.rail.css({"z-index":S.zindex}),S.zoom.css({"z-index":S.zindex}),S.zoomrestore=!1,S.zoom.css("backgroundPosition","0 0"),S.onResize(),S.onzoomout&&S.onzoomout.call(S),S.cancelEvent(e)},this.doZoom=function(e){return S.zoomactive?S.doZoomOut(e):S.doZoomIn(e)},this.resizeZoom=function(){if(S.zoomactive){var e=S.getScrollTop();S.win.css({width:a.width()-S.zoomrestore.padding.w+"px",height:a.height()-S.zoomrestore.padding.h+"px"}),S.onResize(),S.setScrollTop(Math.min(S.page.maxh,e))}},this.init(),n.nicescroll.push(this)},v=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=p(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=p();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=p(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var m=o.lastscrollx,f=o.lastscrolly,g=function(){var e=p()-t>600?.04:.02;o.speedx&&(m=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=m,(m<0||m>l)&&(e=.1)),o.speedy&&(f=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=f,(f<0||f>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=m,o.nc.setScrollLeft(m)}if(o.speedy){o.nc.getScrollTop();o.chky=f,o.nc.setScrollTop(f)}o.timer||(o.nc.hideCursor(),o.doSnapy(m,f))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(m,f))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},b=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():b.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):b.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():b.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):b.call(n(this),e)})};var y=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():y.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):y.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():y.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):y.call(n(this),e)})};var x=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new w(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},window.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new x,n.nicescroll.options=m)}); \ No newline at end of file +!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,n=0,s=e,l=s(window),a=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||!1}(),c=function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||!1}();if(a)window.cancelAnimationFrame||(c=function(e){});else{var d=0;a=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-d)),i=window.setTimeout(function(){e(t+r)},r);return d=t+r,i},c=function(e){window.clearTimeout(e)}}var u=window.MutationObserver||window.WebKitMutationObserver||!1,h=Date.now||function(){return(new Date).getTime()},p={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:60,mousescrollstep:24,touchbehavior:!1,emulatetouch:!1,hwacceleration:!0,usetransition:!0,boxzoom:!1,dblclickzoom:!0,gesturezoom:!0,grabcursorenabled:!0,autohidemode:!0,background:"",iframeautoresize:!0,cursorminheight:32,preservenativescrolling:!0,railoffset:!1,railhoffset:!1,bouncescroll:!0,spacebarenabled:!0,railpadding:{top:0,right:0,left:0,bottom:0},disableoutline:!0,horizrailenabled:!0,railalign:"right",railvalign:"bottom",enabletranslate3d:!0,enablemousewheel:!0,enablekeyboard:!0,smoothscroll:!0,sensitiverail:!0,enablemouselockapi:!0,cursorfixedheight:!1,directionlockdeadzone:6,hidecursordelay:400,nativeparentscrolling:!0,enablescrollonselection:!0,overflowx:!0,overflowy:!0,cursordragspeed:.3,rtlmode:"auto",cursordragontouch:!1,oneaxismousemode:"auto",scriptpath:function(){var e=document.currentScript||function(){var e=document.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},m=!1,f=function(){if(m)return m;var e=document.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in document||"webkitPointerLockElement"in document||"mozPointerLockElement"in document,i.isopera="opera"in window,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(window.operamini),i.isie="all"in document&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in document)||7===document.documentMode),i.isie8=i.isie&&"documentMode"in document&&8===document.documentMode,i.isie9=i.isie&&"performance"in window&&9===document.documentMode,i.isie10=i.isie&&"performance"in window&&10===document.documentMode,i.isie11="msRequestFullscreen"in e&&document.documentMode>=11,i.ismsedge="msCredentials"in window,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in window,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in document.documentElement||"ontouchstart"in window,i.hasw3ctouch=(window.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(window.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in document,i.isios8=i.isios&&"hidden"in document,i.isios10=i.isios&&window.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!=o)return parseInt(o);e=e.parent()}return!1}function v(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var n=3==(i=N[r]||0)?t?x.win.outerHeight()-x.win.innerHeight():x.win.outerWidth()-x.win.innerWidth():1;return x.isie8&&i&&(i+=1),n?i:0}return i}function b(e,o,t,r){x._bind(e,o,function(r){var i={original:r=r||window.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function y(e,o,t){var r,i;if(0==e.deltaMode?(r=-Math.floor(e.deltaX*(x.opt.mousescrollstep/54)),i=-Math.floor(e.deltaY*(x.opt.mousescrollstep/54))):1==e.deltaMode&&(r=-Math.floor(e.deltaX*x.opt.mousescrollstep),i=-Math.floor(e.deltaY*x.opt.mousescrollstep)),o&&x.opt.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?x.getScrollLeft()>=x.page.maxw:x.getScrollLeft()<=0)&&(i=r,r=0)),x.isrtlmode&&(r=-r),r){if(x.scrollmom)x.scrollmom.stop();else if(r<0){if(x.getScrollLeft()>=x.page.maxw)return!0}else if(x.getScrollLeft()<=0)return!0;x.lastdeltax+=r,x.debounced("mousewheelx",function(){var e=x.lastdeltax;x.lastdeltax=0,x.rail.drag||x.doScrollLeftBy(e)},15)}if(i){if(x.opt.nativeparentscrolling&&t&&!x.ispage&&!x.zoomactive)if(i<0){if(x.getScrollTop()>=x.page.maxh)return!0}else if(x.getScrollTop()<=0)return!0;x.scrollmom&&x.scrollmom.stop(),x.lastdeltay+=i,x.synched("mousewheely",function(){var e=x.lastdeltay;x.lastdeltay=0,x.rail.drag||x.doScrollBy(e)},15)}return e.stopImmediatePropagation(),e.preventDefault()}var x=this;this.version="3.7.2",this.name="nicescroll",this.me=d;var S=s("body");if(this.opt={doc:S,win:!1},s.extend(this.opt,p),this.opt.snapbackspeed=80,e)for(var z in x.opt)void 0!==e[z]&&(x.opt[z]=e[z]);if(x.opt.disablemutationobserver&&(u=!1),this.doc=x.opt.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(x.opt.win?x.opt.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==x.opt.win,this.win=x.opt.win||(this.ispage?l:this.doc),this.docscroll=this.ispage&&!this.haswrapper?l:this.win,this.body=S,this.viewport=!1,this.isfixed=!1,this.iframe=!1,this.isiframe="IFRAME"==this.doc[0].nodeName&&"IFRAME"==this.win[0].nodeName,this.istextarea="TEXTAREA"==this.win[0].nodeName,this.forcescreen=!1,this.canshowonmouseevent="scroll"!=x.opt.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==this.opt.rtlmode){var k=this.win[0]==window?this.body:this.win,T=k.css("writing-mode")||k.css("-webkit-writing-mode")||k.css("-ms-writing-mode")||k.css("-moz-writing-mode");"horizontal-tb"==T||"lr-tb"==T||""==T?(this.isrtlmode="rtl"==k.css("direction"),this.isvertical=!1):(this.isrtlmode="vertical-rl"==T||"tb"==T||"tb-rl"==T||"rl-tb"==T,this.isvertical="vertical-rl"==T||"tb"==T||"tb-rl"==T)}else this.isrtlmode=!0===this.opt.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1===x.opt.scrollbarid)do{this.id="ascrail"+i++}while(document.getElementById(this.id));else this.id=x.opt.scrollbarid;this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=x.opt.overflowx,this.overflowy=x.opt.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=f();var M=s.extend({},this.detected);this.canhwscroll=M.hastransform&&x.opt.hwacceleration,this.ishwscroll=this.canhwscroll&&x.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(M.iswebkit||M.isie||M.isie11):this.hasreversehr=!(M.iswebkit||M.isie&&!M.isie10&&!M.isie11):this.hasreversehr=!1,this.istouchcapable=!1,M.cantouch||!M.hasw3ctouch&&!M.hasmstouch?!M.cantouch||M.isios||M.isandroid||!M.iswebkit&&!M.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,x.opt.enablemouselockapi||(M.hasmousecapture=!1,M.haspointerlock=!1),this.debounced=function(e,o,t){x&&(x.delaylist[e]||!1||(x.delaylist[e]={h:a(function(){x.delaylist[e].fn.call(x),x.delaylist[e]=!1},t)},o.call(x)),x.delaylist[e].fn=o)};var E=!1;this.synched=function(e,o){return x.synclist[e]=o,function(){E||(a(function(){if(x){E=!1;for(var e in x.synclist){var o=x.synclist[e];o&&o.call(x),x.synclist[e]=!1}}}),E=!0)}(),e},this.unsynched=function(e){x.synclist[e]&&(x.synclist[e]=!1)},this.css=function(e,o){for(var t in o)x.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?x.getScrollTop():x.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?x.getScrollLeft():x.setScrollLeft(e)};var L=function(e,o,t,r,i,n,s){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=n||0,this.p4=s||1,this.ts=h(),this.df=this.ed-this.st};if(L.prototype={B2:function(e){return 3*e*e*(1-e)},B3:function(e){return 3*e*(1-e)*(1-e)},B4:function(e){return(1-e)*(1-e)*(1-e)},getNow:function(){var e=1-(h()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e<0?this.ed:this.st+Math.round(this.df*o)},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=h(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},M.hastranslate3d&&M.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=m();if(o)return 16==o.length?-o[13]:-o[5];if(x.timerscroll&&x.timerscroll.bz)return x.timerscroll.bz.getNow()}return x.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=m();if(o)return 16==o.length?-o[12]:-o[4];if(x.timerscroll&&x.timerscroll.bh)return x.timerscroll.bh.getNow()}return x.doc.translate.x},this.notifyScrollEvent=function(e){var o=document.createEvent("UIEvents");o.initUIEvent("scroll",!1,!0,window,1),o.niceevent=!0,e.dispatchEvent(o)};var C=this.isrtlmode?1:-1;M.hastranslate3d&&x.opt.enabletranslate3d?(this.setScrollTop=function(e,o){x.doc.translate.y=e,x.doc.translate.ty=-1*e+"px",x.doc.css(M.trstyle,"translate3d("+x.doc.translate.tx+","+x.doc.translate.ty+",0)"),o||x.notifyScrollEvent(x.win[0])},this.setScrollLeft=function(e,o){x.doc.translate.x=e,x.doc.translate.tx=e*C+"px",x.doc.css(M.trstyle,"translate3d("+x.doc.translate.tx+","+x.doc.translate.ty+",0)"),o||x.notifyScrollEvent(x.win[0])}):(this.setScrollTop=function(e,o){x.doc.translate.y=e,x.doc.translate.ty=-1*e+"px",x.doc.css(M.trstyle,"translate("+x.doc.translate.tx+","+x.doc.translate.ty+")"),o||x.notifyScrollEvent(x.win[0])},this.setScrollLeft=function(e,o){x.doc.translate.x=e,x.doc.translate.tx=e*C+"px",x.doc.css(M.trstyle,"translate("+x.doc.translate.tx+","+x.doc.translate.ty+")"),o||x.notifyScrollEvent(x.win[0])})}else this.getScrollTop=function(){return x.docscroll.scrollTop()},this.setScrollTop=function(e){return setTimeout(function(){x&&x.docscroll.scrollTop(e)},1)},this.getScrollLeft=function(){return x.hasreversehr?x.detected.ismozilla?x.page.maxw-Math.abs(x.docscroll.scrollLeft()):x.page.maxw-x.docscroll.scrollLeft():x.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(x)return x.hasreversehr&&(e=x.detected.ismozilla?-(x.page.maxw-e):x.page.maxw-e),x.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var N={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:window.pageYOffset||document.documentElement.scrollTop,left:window.pageXOffset||document.documentElement.scrollLeft}},this.getOffset=function(){if(x.isfixed){var e=x.win.offset(),o=x.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=x.win.offset();if(!x.viewport)return t;var r=x.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(x.ishwscroll)x.rail.css({height:x.win.innerHeight()-(x.opt.railpadding.top+x.opt.railpadding.bottom)}),x.railh&&x.railh.css({width:x.win.innerWidth()-(x.opt.railpadding.left+x.opt.railpadding.right)});else{var r=x.getOffset();if(o={top:r.top,left:r.left-(x.opt.railpadding.left+x.opt.railpadding.right)},o.top+=v(x.win,"border-top-width",!0),o.left+=x.rail.align?x.win.outerWidth()-v(x.win,"border-right-width")-x.rail.width:v(x.win,"border-left-width"),(t=x.opt.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),x.railslocked||x.rail.css({top:o.top,left:o.left,height:(e?e.h:x.win.innerHeight())-(x.opt.railpadding.top+x.opt.railpadding.bottom)}),x.zoom&&x.zoom.css({top:o.top+1,left:1==x.rail.align?o.left-20:o.left+x.rail.width+4}),x.railh&&!x.railslocked){o={top:r.top,left:r.left},(t=x.opt.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=x.railh.align?o.top+v(x.win,"border-top-width",!0)+x.win.innerHeight()-x.railh.height:o.top+v(x.win,"border-top-width",!0),n=o.left+v(x.win,"border-left-width");x.railh.css({top:i-(x.opt.railpadding.top+x.opt.railpadding.bottom),left:n,width:x.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,n,s;x.railslocked||(x.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+document.documentElement.scrollLeft,e.pageY=e.clientY+document.documentElement.scrollTop),o?(r=t?x.doScrollLeft:x.doScrollTop)(n=t?(e.pageX-x.railh.offset().left-x.cursorwidth/2)*x.scrollratio.x:(e.pageY-x.rail.offset().top-x.cursorheight/2)*x.scrollratio.y):(r=t?x.doScrollLeftBy:x.doScrollBy,n=t?x.scroll.x:x.scroll.y,s=t?e.pageX-x.railh.offset().left:e.pageY-x.rail.offset().top,i=t?x.view.w:x.view.h,r(n>=s?i:-i)))},x.hasanimationframe="requestAnimationFrame"in window,x.hascancelanimationframe="cancelAnimationFrame"in window,this.init=function(){if(x.saved.css=[],M.isoperamini)return!0;if(M.isandroid&&!("hidden"in document))return!0;x.opt.emulatetouch=x.opt.emulatetouch||x.opt.touchbehavior;var e={"overflow-y":"hidden"};if((M.isie11||M.isie10)&&(e["-ms-overflow-style"]="none"),x.zindex="auto",x.ispage||"auto"!=x.opt.zindex?x.zindex=x.opt.zindex:x.zindex=g()||"auto",!x.ispage&&"auto"!=x.zindex&&x.zindex>n&&(n=x.zindex),x.isie&&0==x.zindex&&"auto"==x.opt.zindex&&(x.zindex="auto"),!x.ispage||!M.cantouch&&!M.isieold){var i=x.docscroll;x.ispage&&(i=x.haswrapper?x.win:x.doc),x.css(i,e),x.ispage&&(M.isie11||M.isie)&&x.css(s("html"),e),!M.isios||x.ispage||x.haswrapper||x.css(S,{"-webkit-overflow-scrolling":"touch"});var a=s(document.createElement("div"));a.css({position:"relative",top:0,float:"right",width:x.opt.cursorwidth,height:0,"background-color":x.opt.cursorcolor,border:x.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":x.opt.cursorborderradius,"-moz-border-radius":x.opt.cursorborderradius,"border-radius":x.opt.cursorborderradius}),a.addClass("nicescroll-cursors"),x.cursor=a;var c=s(document.createElement("div"));c.attr("id",x.id),c.addClass("nicescroll-rails nicescroll-rails-vr");var d,h,p=["left","right","top","bottom"];for(var m in p)h=p[m],(d=x.opt.railpadding[h])?c.css("padding-"+h,d+"px"):x.opt.railpadding[h]=0;c.append(a),c.width=Math.max(parseFloat(x.opt.cursorwidth),a.outerWidth()),c.css({width:c.width+"px",zIndex:x.zindex,background:x.opt.background,cursor:"default"}),c.visibility=!0,c.scrollable=!0,c.align="left"==x.opt.railalign?0:1,x.rail=c,x.rail.drag=!1;var f=!1;!x.opt.boxzoom||x.ispage||M.isieold||(f=document.createElement("div"),x.bind(f,"click",x.doZoom),x.bind(f,"mouseenter",function(){x.zoom.css("opacity",x.opt.cursoropacitymax)}),x.bind(f,"mouseleave",function(){x.zoom.css("opacity",x.opt.cursoropacitymin)}),x.zoom=s(f),x.zoom.css({cursor:"pointer",zIndex:x.zindex,backgroundImage:"url("+x.opt.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),x.opt.dblclickzoom&&x.bind(x.win,"dblclick",x.doZoom),M.cantouch&&x.opt.gesturezoom&&(x.ongesturezoom=function(e){return e.scale>1.5&&x.doZoomIn(e),e.scale<.8&&x.doZoomOut(e),x.cancelEvent(e)},x.bind(x.win,"gestureend",x.ongesturezoom))),x.railh=!1;var v;if(x.opt.horizrailenabled&&(x.css(i,{overflowX:"hidden"}),(a=s(document.createElement("div"))).css({position:"absolute",top:0,height:x.opt.cursorwidth,width:0,backgroundColor:x.opt.cursorcolor,border:x.opt.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":x.opt.cursorborderradius,"-moz-border-radius":x.opt.cursorborderradius,"border-radius":x.opt.cursorborderradius}),M.isieold&&a.css("overflow","hidden"),a.addClass("nicescroll-cursors"),x.cursorh=a,(v=s(document.createElement("div"))).attr("id",x.id+"-hr"),v.addClass("nicescroll-rails nicescroll-rails-hr"),v.height=Math.max(parseFloat(x.opt.cursorwidth),a.outerHeight()),v.css({height:v.height+"px",zIndex:x.zindex,background:x.opt.background}),v.append(a),v.visibility=!0,v.scrollable=!0,v.align="top"==x.opt.railvalign?0:1,x.railh=v,x.railh.drag=!1),x.ispage)c.css({position:"fixed",top:0,height:"100%"}),c.align?c.css({right:0}):c.css({left:0}),x.body.append(c),x.railh&&(v.css({position:"fixed",left:0,width:"100%"}),v.align?v.css({bottom:0}):v.css({top:0}),x.body.append(v));else{if(x.ishwscroll){"static"==x.win.css("position")&&x.css(x.win,{position:"relative"});var b="HTML"==x.win[0].nodeName?x.body:x.win;s(b).scrollTop(0).scrollLeft(0),x.zoom&&(x.zoom.css({position:"absolute",top:1,right:0,"margin-right":c.width+4}),b.append(x.zoom)),c.css({position:"absolute",top:0}),c.align?c.css({right:0}):c.css({left:0}),b.append(c),v&&(v.css({position:"absolute",left:0,bottom:0}),v.align?v.css({bottom:0}):v.css({top:0}),b.append(v))}else{x.isfixed="fixed"==x.win.css("position");var y=x.isfixed?"fixed":"absolute";x.isfixed||(x.viewport=x.getViewport(x.win[0])),x.viewport&&(x.body=x.viewport,0==/fixed|absolute/.test(x.viewport.css("position"))&&x.css(x.viewport,{position:"relative"})),c.css({position:y}),x.zoom&&x.zoom.css({position:y}),x.updateScrollBar(),x.body.append(c),x.zoom&&x.body.append(x.zoom),x.railh&&(v.css({position:y}),x.body.append(v))}M.isios&&x.css(x.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),M.isie&&x.opt.disableoutline&&x.win.attr("hideFocus","true"),M.iswebkit&&x.opt.disableoutline&&x.win.css("outline","none")}if(!1===x.opt.autohidemode?(x.autohidedom=!1,x.rail.css({opacity:x.opt.cursoropacitymax}),x.railh&&x.railh.css({opacity:x.opt.cursoropacitymax})):!0===x.opt.autohidemode||"leave"===x.opt.autohidemode?(x.autohidedom=s().add(x.rail),M.isie8&&(x.autohidedom=x.autohidedom.add(x.cursor)),x.railh&&(x.autohidedom=x.autohidedom.add(x.railh)),x.railh&&M.isie8&&(x.autohidedom=x.autohidedom.add(x.cursorh))):"scroll"==x.opt.autohidemode?(x.autohidedom=s().add(x.rail),x.railh&&(x.autohidedom=x.autohidedom.add(x.railh))):"cursor"==x.opt.autohidemode?(x.autohidedom=s().add(x.cursor),x.railh&&(x.autohidedom=x.autohidedom.add(x.cursorh))):"hidden"==x.opt.autohidemode&&(x.autohidedom=!1,x.hide(),x.railslocked=!1),M.cantouch||x.istouchcapable||x.opt.emulatetouch||M.hasmstouch){x.scrollmom=new w(x),x.ontouchstart=function(e){if(e.pointerType&&2!=e.pointerType&&"touch"!=e.pointerType)return!1;if(x.hasmoving=!1,!x.railslocked){var o;if(M.hasmstouch)for(o=!!e.target&&e.target;o;){var t=s(o).getNiceScroll();if(t.length>0&&t[0].me==x.me)break;if(t.length>0)return!1;if("DIV"==o.nodeName&&o.id==x.id)break;o=!!o.parentNode&&o.parentNode}if(e.stopPropagation(),x.cancelScroll(),(o=x.getTarget(e))&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return x.stopPropagation(e);if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),x.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(x.rail.drag={x:e.clientX,y:e.clientY,sx:x.scroll.x,sy:x.scroll.y,st:x.getScrollTop(),sl:x.getScrollLeft(),pt:2,dl:!1,tg:o},x.ispage||!x.opt.directionlockdeadzone)x.rail.drag.dl="f";else{var i={w:l.width(),h:l.height()},n={w:Math.max(document.body.scrollWidth,document.documentElement.scrollWidth),h:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)},a=Math.max(0,n.h-i.h),c=Math.max(0,n.w-i.w);!x.rail.scrollable&&x.railh.scrollable?x.rail.drag.ck=a>0&&"v":x.rail.scrollable&&!x.railh.scrollable?x.rail.drag.ck=c>0&&"h":x.rail.drag.ck=!1,x.rail.drag.ck||(x.rail.drag.dl="f")}if(x.opt.emulatetouch&&x.isiframe&&M.isie){var d=x.win.position();x.rail.drag.x+=d.left,x.rail.drag.y+=d.top}if(x.hasmoving=!1,x.lastmouseup=!1,x.scrollmom.reset(e.clientX,e.clientY),!M.cantouch&&!this.istouchcapable&&!e.pointerType){if(!(!!o&&/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName)))return!x.ispage&&M.hasmousecapture&&o.setCapture(),x.opt.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(x.hasmoving)return!1;o._onclick.call(this,e)}),x.cancelEvent(e)):x.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(s(o).attr("type"))&&(x.preventclick={tg:o,click:!1})}}},x.ontouchend=function(e){if(!x.rail.drag)return!0;if(2==x.rail.drag.pt){if(e.pointerType&&2!=e.pointerType&&"touch"!=e.pointerType)return!1;if(x.rail.drag=!1,x.hasmoving&&(x.scrollmom.doMomentum(),x.lastmouseup=!0,x.hideCursor(),M.hasmousecapture&&document.releaseCapture(),!M.cantouch))return x.cancelEvent(e)}else if(1==x.rail.drag.pt)return x.onmouseup(e)};var z=x.opt.emulatetouch&&x.isiframe&&!M.hasmousecapture;x.ontouchmove=function(e,o){if(!x.rail.drag)return!1;if(e.targetTouches&&x.opt.preventmultitouchscrolling&&e.targetTouches.length>1)return!1;if(e.pointerType&&2!=e.pointerType&&"touch"!=e.pointerType)return!1;if(2==x.rail.drag.pt){if("changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),x.rail.drag.y===e.clientY&&x.rail.drag.x===e.clientX)return!1;x.hasmoving||x.triggerScrollStart(e.clientX,e.clientY,0,0,0),x.hasmoving=!0,x.preventclick&&!x.preventclick.click&&(x.preventclick.click=x.preventclick.tg.onclick||!1,x.preventclick.tg.onclick=x.onpreventclick);var t,r;if(r=t=0,z&&!o){var i=x.win.position();r=-i.left,t=-i.top}var n=e.clientY+t,s=n-x.rail.drag.y,l=e.clientX+r,a=l-x.rail.drag.x,c=x.rail.drag.st-s;x.ishwscroll&&x.opt.bouncescroll?c<0?c=Math.round(c/2):c>x.page.maxh&&(c=x.page.maxh+Math.round((c-x.page.maxh)/2)):(c<0&&(c=0,n=0),c>x.page.maxh&&(c=x.page.maxh,n=0));var d;x.railh&&x.railh.scrollable&&(d=x.isrtlmode?a-x.rail.drag.sl:x.rail.drag.sl-a,x.ishwscroll&&x.opt.bouncescroll?d<0?d=Math.round(d/2):d>x.page.maxw&&(d=x.page.maxw+Math.round((d-x.page.maxw)/2)):(d<0&&(d=0,l=0),d>x.page.maxw&&(d=x.page.maxw,l=0)));var u=!1;if(x.rail.drag.dl)u=!0,"v"==x.rail.drag.dl?d=x.rail.drag.sl:"h"==x.rail.drag.dl&&(c=x.rail.drag.st);else{var h=Math.abs(s),p=Math.abs(a),m=x.opt.directionlockdeadzone;if("v"==x.rail.drag.ck){if(h>m&&p<=.3*h)return x.rail.drag=!1,!0;p>m&&(x.rail.drag.dl="f",S.scrollTop(S.scrollTop()))}else if("h"==x.rail.drag.ck){if(p>m&&h<=.3*p)return x.rail.drag=!1,!0;h>m&&(x.rail.drag.dl="f",S.scrollLeft(S.scrollLeft()))}}if(x.synched("touchmove",function(){x.rail.drag&&2==x.rail.drag.pt&&(x.prepareTransition&&x.prepareTransition(0),x.rail.scrollable&&x.setScrollTop(c),x.scrollmom.update(l,n),x.railh&&x.railh.scrollable?(x.setScrollLeft(d),x.showCursor(c,d)):x.showCursor(c),M.isie10&&document.selection.clear())}),M.ischrome&&x.istouchcapable&&(u=!1),u)return x.cancelEvent(e)}else if(1==x.rail.drag.pt)return x.onmousemove(e)},x.ontouchstartCursor=function(e,o){if(!x.rail.drag||3==x.rail.drag.pt){if(x.locked)return x.cancelEvent(e);x.cancelScroll(),x.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:x.scroll.x,sy:x.scroll.y,pt:3,hr:!!o};var t=x.getTarget(e);return!x.ispage&&M.hasmousecapture&&t.setCapture(),x.isiframe&&!M.hasmousecapture&&(x.saved.csspointerevents=x.doc.css("pointer-events"),x.css(x.doc,{"pointer-events":"none"})),x.cancelEvent(e)}},x.ontouchendCursor=function(e){if(x.rail.drag){if(M.hasmousecapture&&document.releaseCapture(),x.isiframe&&!M.hasmousecapture&&x.doc.css("pointer-events",x.saved.csspointerevents),3!=x.rail.drag.pt)return;return x.rail.drag=!1,x.cancelEvent(e)}},x.ontouchmoveCursor=function(e){if(x.rail.drag){if(3!=x.rail.drag.pt)return;if(x.cursorfreezed=!0,x.rail.drag.hr){x.scroll.x=x.rail.drag.sx+(e.touches[0].clientX-x.rail.drag.x),x.scroll.x<0&&(x.scroll.x=0);var o=x.scrollvaluemaxw;x.scroll.x>o&&(x.scroll.x=o)}else{x.scroll.y=x.rail.drag.sy+(e.touches[0].clientY-x.rail.drag.y),x.scroll.y<0&&(x.scroll.y=0);var t=x.scrollvaluemax;x.scroll.y>t&&(x.scroll.y=t)}return x.synched("touchmove",function(){x.rail.drag&&3==x.rail.drag.pt&&(x.showCursor(),x.rail.drag.hr?x.doScrollLeft(Math.round(x.scroll.x*x.scrollratio.x),x.opt.cursordragspeed):x.doScrollTop(Math.round(x.scroll.y*x.scrollratio.y),x.opt.cursordragspeed))}),x.cancelEvent(e)}}}if(x.onmousedown=function(e,o){if(!x.rail.drag||1==x.rail.drag.pt){if(x.railslocked)return x.cancelEvent(e);x.cancelScroll(),x.rail.drag={x:e.clientX,y:e.clientY,sx:x.scroll.x,sy:x.scroll.y,pt:1,hr:o||!1};var t=x.getTarget(e);return!x.ispage&&M.hasmousecapture&&t.setCapture(),x.isiframe&&!M.hasmousecapture&&(x.saved.csspointerevents=x.doc.css("pointer-events"),x.css(x.doc,{"pointer-events":"none"})),x.hasmoving=!1,x.cancelEvent(e)}},x.onmouseup=function(e){if(x.rail.drag)return 1!=x.rail.drag.pt||(M.hasmousecapture&&document.releaseCapture(),x.isiframe&&!M.hasmousecapture&&x.doc.css("pointer-events",x.saved.csspointerevents),x.rail.drag=!1,x.hasmoving&&x.triggerScrollEnd(),x.cancelEvent(e))},x.onmousemove=function(e){if(x.rail.drag){if(1!==x.rail.drag.pt)return;if(M.ischrome&&0===e.which)return x.onmouseup(e);if(x.cursorfreezed=!0,x.hasmoving=!0,x.rail.drag.hr){x.scroll.x=x.rail.drag.sx+(e.clientX-x.rail.drag.x),x.scroll.x<0&&(x.scroll.x=0);var o=x.scrollvaluemaxw;x.scroll.x>o&&(x.scroll.x=o)}else{x.scroll.y=x.rail.drag.sy+(e.clientY-x.rail.drag.y),x.scroll.y<0&&(x.scroll.y=0);var t=x.scrollvaluemax;x.scroll.y>t&&(x.scroll.y=t)}return x.synched("mousemove",function(){x.rail.drag&&1==x.rail.drag.pt&&(x.showCursor(),x.rail.drag.hr?x.hasreversehr?x.doScrollLeft(x.scrollvaluemaxw-Math.round(x.scroll.x*x.scrollratio.x),x.opt.cursordragspeed):x.doScrollLeft(Math.round(x.scroll.x*x.scrollratio.x),x.opt.cursordragspeed):x.doScrollTop(Math.round(x.scroll.y*x.scrollratio.y),x.opt.cursordragspeed))}),x.cancelEvent(e)}x.checkarea=0},M.cantouch||x.opt.emulatetouch)x.onpreventclick=function(e){if(x.preventclick)return x.preventclick.tg.onclick=x.preventclick.click,x.preventclick=!1,x.cancelEvent(e)},x.onclick=!M.isios&&function(e){return!x.lastmouseup||(x.lastmouseup=!1,x.cancelEvent(e))},x.opt.grabcursorenabled&&M.cursorgrabvalue&&(x.css(x.ispage?x.doc:x.win,{cursor:M.cursorgrabvalue}),x.css(x.rail,{cursor:M.cursorgrabvalue}));else{var k=function(e){if(x.selectiondrag){if(e){var o=x.win.outerHeight(),t=e.pageY-x.selectiondrag.top;t>0&&t=o&&(t-=o),x.selectiondrag.df=t}if(0!=x.selectiondrag.df){var r=2*-Math.floor(x.selectiondrag.df/6);x.doScrollBy(r),x.debounced("doselectionscroll",function(){k()},50)}}};"getSelection"in document?x.hasTextSelected=function(){return document.getSelection().rangeCount>0}:"selection"in document?x.hasTextSelected=function(){return"None"!=document.selection.type}:x.hasTextSelected=function(){return!1},x.onselectionstart=function(e){x.ispage||(x.selectiondrag=x.win.offset())},x.onselectionend=function(e){x.selectiondrag=!1},x.onselectiondrag=function(e){x.selectiondrag&&x.hasTextSelected()&&x.debounced("selectionscroll",function(){k(e)},250)}}if(M.hasw3ctouch?(x.css(x.ispage?s("html"):x.win,{"touch-action":"none"}),x.css(x.rail,{"touch-action":"none"}),x.css(x.cursor,{"touch-action":"none"}),x.bind(x.win,"pointerdown",x.ontouchstart),x.bind(document,"pointerup",x.ontouchend),x.bind(document,"pointermove",x.ontouchmove)):M.hasmstouch?(x.css(x.ispage?s("html"):x.win,{"-ms-touch-action":"none"}),x.css(x.rail,{"-ms-touch-action":"none"}),x.css(x.cursor,{"-ms-touch-action":"none"}),x.bind(x.win,"MSPointerDown",x.ontouchstart),x.bind(document,"MSPointerUp",x.ontouchend),x.bind(document,"MSPointerMove",x.ontouchmove),x.bind(x.cursor,"MSGestureHold",function(e){e.preventDefault()}),x.bind(x.cursor,"contextmenu",function(e){e.preventDefault()})):M.cantouch&&(x.bind(x.win,"touchstart",x.ontouchstart,!1,!0),x.bind(document,"touchend",x.ontouchend,!1,!0),x.bind(document,"touchcancel",x.ontouchend,!1,!0),x.bind(document,"touchmove",x.ontouchmove,!1,!0)),x.opt.emulatetouch&&(x.bind(x.win,"mousedown",x.ontouchstart,!1,!0),x.bind(document,"mouseup",x.ontouchend,!1,!0),x.bind(document,"mousemove",x.ontouchmove,!1,!0)),(x.opt.cursordragontouch||!M.cantouch&&!x.opt.emulatetouch)&&(x.rail.css({cursor:"default"}),x.railh&&x.railh.css({cursor:"default"}),x.jqbind(x.rail,"mouseenter",function(){if(!x.ispage&&!x.win.is(":visible"))return!1;x.canshowonmouseevent&&x.showCursor(),x.rail.active=!0}),x.jqbind(x.rail,"mouseleave",function(){x.rail.active=!1,x.rail.drag||x.hideCursor()}),x.opt.sensitiverail&&(x.bind(x.rail,"click",function(e){x.doRailClick(e,!1,!1)}),x.bind(x.rail,"dblclick",function(e){x.doRailClick(e,!0,!1)}),x.bind(x.cursor,"click",function(e){x.cancelEvent(e)}),x.bind(x.cursor,"dblclick",function(e){x.cancelEvent(e)})),x.railh&&(x.jqbind(x.railh,"mouseenter",function(){if(!x.ispage&&!x.win.is(":visible"))return!1;x.canshowonmouseevent&&x.showCursor(),x.rail.active=!0}),x.jqbind(x.railh,"mouseleave",function(){x.rail.active=!1,x.rail.drag||x.hideCursor()}),x.opt.sensitiverail&&(x.bind(x.railh,"click",function(e){x.doRailClick(e,!1,!0)}),x.bind(x.railh,"dblclick",function(e){x.doRailClick(e,!0,!0)}),x.bind(x.cursorh,"click",function(e){x.cancelEvent(e)}),x.bind(x.cursorh,"dblclick",function(e){x.cancelEvent(e)})))),x.opt.cursordragontouch&&(this.istouchcapable||M.cantouch)&&(x.bind(x.cursor,"touchstart",x.ontouchstartCursor),x.bind(x.cursor,"touchmove",x.ontouchmoveCursor),x.bind(x.cursor,"touchend",x.ontouchendCursor),x.cursorh&&x.bind(x.cursorh,"touchstart",function(e){x.ontouchstartCursor(e,!0)}),x.cursorh&&x.bind(x.cursorh,"touchmove",x.ontouchmoveCursor),x.cursorh&&x.bind(x.cursorh,"touchend",x.ontouchendCursor)),M.cantouch||x.opt.emulatetouch?(x.bind(M.hasmousecapture?x.win:document,"mouseup",x.ontouchend),x.onclick&&x.bind(document,"click",x.onclick),x.opt.cursordragontouch?(x.bind(x.cursor,"mousedown",x.onmousedown),x.bind(x.cursor,"mouseup",x.onmouseup),x.cursorh&&x.bind(x.cursorh,"mousedown",function(e){x.onmousedown(e,!0)}),x.cursorh&&x.bind(x.cursorh,"mouseup",x.onmouseup)):(x.bind(x.rail,"mousedown",function(e){e.preventDefault()}),x.railh&&x.bind(x.railh,"mousedown",function(e){e.preventDefault()}))):(x.bind(M.hasmousecapture?x.win:document,"mouseup",x.onmouseup),x.bind(document,"mousemove",x.onmousemove),x.onclick&&x.bind(document,"click",x.onclick),x.bind(x.cursor,"mousedown",x.onmousedown),x.bind(x.cursor,"mouseup",x.onmouseup),x.railh&&(x.bind(x.cursorh,"mousedown",function(e){x.onmousedown(e,!0)}),x.bind(x.cursorh,"mouseup",x.onmouseup)),!x.ispage&&x.opt.enablescrollonselection&&(x.bind(x.win[0],"mousedown",x.onselectionstart),x.bind(document,"mouseup",x.onselectionend),x.bind(x.cursor,"mouseup",x.onselectionend),x.cursorh&&x.bind(x.cursorh,"mouseup",x.onselectionend),x.bind(document,"mousemove",x.onselectiondrag)),x.zoom&&(x.jqbind(x.zoom,"mouseenter",function(){x.canshowonmouseevent&&x.showCursor(),x.rail.active=!0}),x.jqbind(x.zoom,"mouseleave",function(){x.rail.active=!1,x.rail.drag||x.hideCursor()}))),x.opt.enablemousewheel&&(x.isiframe||x.mousewheel(M.isie&&x.ispage?document:x.win,x.onmousewheel),x.mousewheel(x.rail,x.onmousewheel),x.railh&&x.mousewheel(x.railh,x.onmousewheelhr)),x.ispage||M.cantouch||/HTML|^BODY/.test(x.win[0].nodeName)||(x.win.attr("tabindex")||x.win.attr({tabindex:++r}),x.bind(x.win,"focus",function(e){o=x.getTarget(e).id||!0,x.hasfocus=!0,x.canshowonmouseevent&&x.noticeCursor()}),x.bind(x.win,"blur",function(e){o=!1,x.hasfocus=!1}),x.bind(x.win,"mouseenter",function(e){t=x.getTarget(e).id||!0,x.hasmousefocus=!0,x.canshowonmouseevent&&x.noticeCursor()}),x.bind(x.win,"mouseleave",function(e){t=!1,x.hasmousefocus=!1,x.rail.drag||x.hideCursor()})),x.onkeypress=function(e){if(x.railslocked&&0==x.page.maxh)return!0;e=e||window.e;var r=x.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(s(r).attr("contenteditable"))return!0;if(x.hasfocus||x.hasmousefocus&&!o||x.ispage&&!o&&!t){var i=e.keyCode;if(x.railslocked&&27!=i)return x.cancelEvent(e);var n=e.ctrlKey||!1,l=e.shiftKey||!1,a=!1;switch(i){case 38:case 63233:x.doScrollBy(72),a=!0;break;case 40:case 63235:x.doScrollBy(-72),a=!0;break;case 37:case 63232:x.railh&&(n?x.doScrollLeft(0):x.doScrollLeftBy(72),a=!0);break;case 39:case 63234:x.railh&&(n?x.doScrollLeft(x.page.maxw):x.doScrollLeftBy(-72),a=!0);break;case 33:case 63276:x.doScrollBy(x.view.h),a=!0;break;case 34:case 63277:x.doScrollBy(-x.view.h),a=!0;break;case 36:case 63273:x.railh&&n?x.doScrollPos(0,0):x.doScrollTo(0),a=!0;break;case 35:case 63275:x.railh&&n?x.doScrollPos(x.page.maxw,x.page.maxh):x.doScrollTo(x.page.maxh),a=!0;break;case 32:x.opt.spacebarenabled&&(l?x.doScrollBy(x.view.h):x.doScrollBy(-x.view.h),a=!0);break;case 27:x.zoomactive&&(x.doZoom(),a=!0)}if(a)return x.cancelEvent(e)}},x.opt.enablekeyboard&&x.bind(document,M.isopera&&!M.isopera12?"keypress":"keydown",x.onkeypress),x.bind(document,"keydown",function(e){(e.ctrlKey||!1)&&(x.wheelprevented=!0)}),x.bind(document,"keyup",function(e){e.ctrlKey||!1||(x.wheelprevented=!1)}),x.bind(window,"blur",function(e){x.wheelprevented=!1}),x.bind(window,"resize",x.lazyResize),x.bind(window,"orientationchange",x.lazyResize),x.bind(window,"load",x.lazyResize),M.ischrome&&!x.ispage&&!x.haswrapper){var T=x.win.attr("style"),E=parseFloat(x.win.css("width"))+1;x.win.css("width",E),x.synched("chromefix",function(){x.win.attr("style",T)})}x.onAttributeChange=function(e){x.lazyResize(x.isieold?250:30)},x.opt.enableobserver&&(x.isie11||!1===u||(x.observerbody=new u(function(e){if(e.forEach(function(e){if("attributes"==e.type)return S.hasClass("modal-open")&&S.hasClass("modal-dialog")&&!s.contains(s(".modal-dialog")[0],x.doc[0])?x.hide():x.show()}),x.me.clientWidth!=x.page.width||x.me.clientHeight!=x.page.height)return x.lazyResize(30)}),x.observerbody.observe(document.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),x.ispage||x.haswrapper||(!1!==u?(x.observer=new u(function(e){e.forEach(x.onAttributeChange)}),x.observer.observe(x.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),x.observerremover=new u(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(x&&e.removedNodes[o]==x.win[0])return x.remove()})}),x.observerremover.observe(x.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(x.bind(x.win,M.isie&&!M.isie9?"propertychange":"DOMAttrModified",x.onAttributeChange),M.isie9&&x.win[0].attachEvent("onpropertychange",x.onAttributeChange),x.bind(x.win,"DOMNodeRemoved",function(e){e.target==x.win[0]&&x.remove()})))),!x.ispage&&x.opt.boxzoom&&x.bind(window,"resize",x.resizeZoom),x.istextarea&&(x.bind(x.win,"keydown",x.lazyResize),x.bind(x.win,"mouseup",x.lazyResize)),x.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var L=function(){x.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow.document).domain}catch(e){x.iframexd=!0,o=!1}if(x.iframexd)return"console"in window&&console.log("NiceScroll error: policy restriced iframe"),!0;if(x.forcescreen=!0,x.isiframe&&(x.iframe={doc:s(o),html:x.doc.contents().find("html")[0],body:x.doc.contents().find("body")[0]},x.getContentSize=function(){return{w:Math.max(x.iframe.html.scrollWidth,x.iframe.body.scrollWidth),h:Math.max(x.iframe.html.scrollHeight,x.iframe.body.scrollHeight)}},x.docscroll=s(x.iframe.body)),!M.isios&&x.opt.iframeautoresize&&!x.isiframe){x.win.scrollTop(0),x.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);x.doc.height(t)}x.lazyResize(30),x.css(s(x.iframe.body),e),M.isios&&x.haswrapper&&x.css(s(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?x.bind(this.contentWindow,"scroll",x.onscroll):x.bind(o,"scroll",x.onscroll),x.opt.enablemousewheel&&x.mousewheel(o,x.onmousewheel),x.opt.enablekeyboard&&x.bind(o,M.isopera?"keypress":"keydown",x.onkeypress),M.cantouch?(x.bind(o,"touchstart",x.ontouchstart),x.bind(o,"touchmove",x.ontouchmove)):x.opt.emulatetouch&&(x.bind(o,"mousedown",x.ontouchstart),x.bind(o,"mousemove",function(e){return x.ontouchmove(e,!0)}),x.opt.grabcursorenabled&&M.cursorgrabvalue&&x.css(s(o.body),{cursor:M.cursorgrabvalue})),x.bind(o,"mouseup",x.ontouchend),x.zoom&&(x.opt.dblclickzoom&&x.bind(o,"dblclick",x.doZoom),x.ongesturezoom&&x.bind(o,"gestureend",x.ongesturezoom))};this.doc[0].readyState&&"complete"==this.doc[0].readyState&&setTimeout(function(){L.call(x.doc[0],!1)},500),x.bind(this.doc,"load",L)}},this.showCursor=function(e,o){if(x.cursortimeout&&(clearTimeout(x.cursortimeout),x.cursortimeout=0),x.rail){if(x.autohidedom&&(x.autohidedom.stop().css({opacity:x.opt.cursoropacitymax}),x.cursoractive=!0),x.rail.drag&&1==x.rail.drag.pt||(void 0!==e&&!1!==e&&(x.scroll.y=Math.round(1*e/x.scrollratio.y)),void 0!==o&&(x.scroll.x=Math.round(1*o/x.scrollratio.x))),x.cursor.css({height:x.cursorheight,top:x.scroll.y}),x.cursorh){var t=x.hasreversehr?x.scrollvaluemaxw-x.scroll.x:x.scroll.x;!x.rail.align&&x.rail.visibility?x.cursorh.css({width:x.cursorwidth,left:t+x.rail.width}):x.cursorh.css({width:x.cursorwidth,left:t}),x.cursoractive=!0}x.zoom&&x.zoom.stop().css({opacity:x.opt.cursoropacitymax})}},this.hideCursor=function(e){x.cursortimeout||x.rail&&x.autohidedom&&(x.hasmousefocus&&"leave"==x.opt.autohidemode||(x.cursortimeout=setTimeout(function(){x.rail.active&&x.showonmouseevent||(x.autohidedom.stop().animate({opacity:x.opt.cursoropacitymin}),x.zoom&&x.zoom.stop().animate({opacity:x.opt.cursoropacitymin}),x.cursoractive=!1),x.cursortimeout=0},e||x.opt.hidecursordelay)))},this.noticeCursor=function(e,o,t){x.showCursor(o,t),x.rail.active||x.hideCursor(e)},this.getContentSize=x.ispage?function(){return{w:Math.max(document.body.scrollWidth,document.documentElement.scrollWidth),h:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}}:x.haswrapper?function(){return{w:x.doc[0].offsetWidth,h:x.doc[0].offsetHeight}}:function(){return{w:x.docscroll[0].scrollWidth,h:x.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!x||!x.win)return!1;if(!x.haswrapper&&!x.ispage){if("none"==x.win.css("display"))return x.visibility&&x.hideRail().hideRailHr(),!1;x.hidden||x.visibility||x.showRail().showRailHr()}var t=x.page.maxh,r=x.page.maxw,i={h:x.view.h,w:x.view.w};if(x.view={w:x.ispage?x.win.width():x.win[0].clientWidth,h:x.ispage?x.win.height():x.win[0].clientHeight},x.page=o||x.getContentSize(),x.page.maxh=Math.max(0,x.page.h-x.view.h),x.page.maxw=Math.max(0,x.page.w-x.view.w),x.page.maxh==t&&x.page.maxw==r&&x.view.w==i.w&&x.view.h==i.h){if(x.ispage)return x;var n=x.win.offset();if(x.lastposition){var s=x.lastposition;if(s.top==n.top&&s.left==n.left)return x}x.lastposition=n}return 0===x.page.maxh?(x.hideRail(),x.scrollvaluemax=0,x.scroll.y=0,x.scrollratio.y=0,x.cursorheight=0,x.setScrollTop(0),x.rail&&(x.rail.scrollable=!1)):(x.page.maxh-=x.opt.railpadding.top+x.opt.railpadding.bottom,x.rail.scrollable=!0),0===x.page.maxw?(x.hideRailHr(),x.scrollvaluemaxw=0,x.scroll.x=0,x.scrollratio.x=0,x.cursorwidth=0,x.setScrollLeft(0),x.railh&&(x.railh.scrollable=!1)):(x.page.maxw-=x.opt.railpadding.left+x.opt.railpadding.right,x.railh&&(x.railh.scrollable=x.opt.horizrailenabled)),x.railslocked=x.locked||0===x.page.maxh&&0===x.page.maxw,x.railslocked?(x.ispage||x.updateScrollBar(x.view),!1):(x.hidden||x.visibility?!x.railh||x.hidden||x.railh.visibility||x.showRailHr():x.showRail().showRailHr(),x.istextarea&&x.win.css("resize")&&"none"!=x.win.css("resize")&&(x.view.h-=20),x.cursorheight=Math.min(x.view.h,Math.round(x.view.h*(x.view.h/x.page.h))),x.cursorheight=x.opt.cursorfixedheight?x.opt.cursorfixedheight:Math.max(x.opt.cursorminheight,x.cursorheight),x.cursorwidth=Math.min(x.view.w,Math.round(x.view.w*(x.view.w/x.page.w))),x.cursorwidth=x.opt.cursorfixedheight?x.opt.cursorfixedheight:Math.max(x.opt.cursorminheight,x.cursorwidth),x.scrollvaluemax=x.view.h-x.cursorheight-(x.opt.railpadding.top+x.opt.railpadding.bottom),x.railh&&(x.railh.width=x.page.maxh>0?x.view.w-x.rail.width:x.view.w,x.scrollvaluemaxw=x.railh.width-x.cursorwidth-(x.opt.railpadding.left+x.opt.railpadding.right)),x.ispage||x.updateScrollBar(x.view),x.scrollratio={x:x.page.maxw/x.scrollvaluemaxw,y:x.page.maxh/x.scrollvaluemax},x.getScrollTop()>x.page.maxh?x.doScrollTop(x.page.maxh):(x.scroll.y=Math.round(x.getScrollTop()*(1/x.scrollratio.y)),x.scroll.x=Math.round(x.getScrollLeft()*(1/x.scrollratio.x)),x.cursoractive&&x.noticeCursor()),x.scroll.y&&0==x.getScrollTop()&&x.doScrollTo(Math.floor(x.scroll.y*x.scrollratio.y)),x)},this.resize=x.onResize,this.hlazyresize=0,this.lazyResize=function(e){return x.haswrapper||x.hide(),x.hlazyresize&&clearTimeout(x.hlazyresize),x.hlazyresize=setTimeout(function(){x&&(x.resize(),x.show())},240),x},this.jqbind=function(e,o,t){x.events.push({e:e,n:o,f:t,q:!0}),s(e).bind(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in document.createElement("div"))x._bind(r,"wheel",o,t||!1);else{var i=void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll";b(r,i,o,t||!1),"DOMMouseScroll"==i&&b(r,"MozMousePixelScroll",o,t||!1)}};var P=!1;if(M.haseventlistener){try{var R=Object.defineProperty({},"passive",{get:function(){P=!0}});window.addEventListener("test",null,R)}catch(e){}this.cancelEvent=function(e){return!!e&&((e=e.original?e.original:e).cancelable&&e.preventDefault(),e.stopPropagation(),e.preventManipulation&&e.preventManipulation(),!1)},this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},window.constructor.prototype.addEventListener=document.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},window.constructor.prototype.removeEventListener=document.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return!!(e=window.event||!1)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1,!1)},this.stopPropagation=function(e){return!!(e=window.event||!1)&&(e.cancelBubble=!0,!1)};this.bind=function(e,o,t,r,i){var n="jquery"in e?e[0]:e;x._bind(n,o,t,r||!1,i||!1)},this._bind=function(e,o,t,r,i){x.events.push({e:e,n:o,f:t,b:r,q:!1}),P&&i?e.addEventListener(o,t,{passive:!1,capture:r}):e.addEventListener(o,t,r||!1)},this._unbind=function(e,o,t,r){e.removeEventListener(o,t,r)},this.unbindAll=function(){for(var e=0;e0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){var n={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:x.newscrollx,y:x.newscrolly},speed:i};x.onscrollstart.call(x,n)},this.triggerScrollEnd=function(){if(x.onscrollend){var e=x.getScrollLeft(),o=x.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};x.onscrollend.call(x,t)}},this.onmousewheel=function(e){if(!x.wheelprevented){if(x.railslocked)return x.debounced("checkunlock",x.resize,250),!0;if(x.rail.drag)return x.cancelEvent(e);if("auto"===x.opt.oneaxismousemode&&0!==e.deltaX&&(x.opt.oneaxismousemode=!1),x.opt.oneaxismousemode&&0===e.deltaX&&!x.rail.scrollable)return!x.railh||!x.railh.scrollable||x.onmousewheelhr(e);var o=h(),t=!1;if(x.opt.preservenativescrolling&&x.checkarea+60020?t:0},x.opt.smoothscroll?x.ishwscroll&&M.hastransition&&x.opt.usetransition&&x.opt.smoothscroll?(this.prepareTransition=function(e,o){var t=o?e>20?e:0:x.getTransitionSpeed(e),r=t?M.prefixstyle+"transform "+t+"ms ease-out":"";return x.lasttransitionstyle&&x.lasttransitionstyle==r||(x.lasttransitionstyle=r,x.doc.css(M.transitionstyle,r)),t},this.doScrollLeft=function(e,o){var t=x.scrollrunning?x.newscrolly:x.getScrollTop();x.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=x.scrollrunning?x.newscrollx:x.getScrollLeft();x.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=x.getScrollTop(),i=x.getScrollLeft();return((x.newscrolly-r)*(o-r)<0||(x.newscrollx-i)*(e-i)<0)&&x.cancelScroll(),0==x.opt.bouncescroll&&(o<0?o=0:o>x.page.maxh&&(o=x.page.maxh),e<0?e=0:e>x.page.maxw&&(e=x.page.maxw)),(!x.scrollrunning||e!=x.newscrollx||o!=x.newscrolly)&&(x.newscrolly=o,x.newscrollx=e,x.newscrollspeed=t||!1,!x.timer&&void(x.timer=setTimeout(function(){var t=x.getScrollTop(),r=x.getScrollLeft(),i={};i.x=e-r,i.y=o-t,i.px=r,i.py=t;var n=Math.round(Math.sqrt(Math.pow(i.x,2)+Math.pow(i.y,2))),s=x.newscrollspeed&&x.newscrollspeed>1?x.newscrollspeed:x.getTransitionSpeed(n);if(x.newscrollspeed&&x.newscrollspeed<=1&&(s*=x.newscrollspeed),x.prepareTransition(s,!0),x.timerscroll&&x.timerscroll.tm&&clearInterval(x.timerscroll.tm),s>0){!x.scrollrunning&&x.onscrollstart&&x.triggerScrollStart(r,t,e,o,s),M.transitionend?x.scrollendtrapped||(x.scrollendtrapped=!0,x.bind(x.doc,M.transitionend,x.onScrollTransitionEnd,!1)):(x.scrollendtrapped&&clearTimeout(x.scrollendtrapped),x.scrollendtrapped=setTimeout(x.onScrollTransitionEnd,s));var l=t,a=r;x.timerscroll={bz:new L(l,x.newscrolly,s,0,0,.58,1),bh:new L(a,x.newscrollx,s,0,0,.58,1)},x.cursorfreezed||(x.timerscroll.tm=setInterval(function(){x.showCursor(x.getScrollTop(),x.getScrollLeft())},60))}x.synched("doScroll-set",function(){x.timer=0,x.scrollendtrapped&&(x.scrollrunning=!0),x.setScrollTop(x.newscrolly),x.setScrollLeft(x.newscrollx),x.scrollendtrapped||x.onScrollTransitionEnd()})},50)))},this.cancelScroll=function(){if(!x.scrollendtrapped)return!0;var e=x.getScrollTop(),o=x.getScrollLeft();return x.scrollrunning=!1,M.transitionend||clearTimeout(M.transitionend),x.scrollendtrapped=!1,x._unbind(x.doc[0],M.transitionend,x.onScrollTransitionEnd),x.prepareTransition(0),x.setScrollTop(e),x.railh&&x.setScrollLeft(o),x.timerscroll&&x.timerscroll.tm&&clearInterval(x.timerscroll.tm),x.timerscroll=!1,x.cursorfreezed=!1,x.showCursor(e,o),x},this.onScrollTransitionEnd=function(){x.scrollendtrapped&&x._unbind(x.doc[0],M.transitionend,x.onScrollTransitionEnd),x.scrollendtrapped=!1,x.prepareTransition(0),x.timerscroll&&x.timerscroll.tm&&clearInterval(x.timerscroll.tm),x.timerscroll=!1;var e=x.getScrollTop(),o=x.getScrollLeft();if(x.setScrollTop(e),x.railh&&x.setScrollLeft(o),x.noticeCursor(!1,e,o),x.cursorfreezed=!1,e<0?e=0:e>x.page.maxh&&(e=x.page.maxh),o<0?o=0:o>x.page.maxw&&(o=x.page.maxw),e!=x.newscrolly||o!=x.newscrollx)return x.doScrollPos(o,e,x.opt.snapbackspeed);x.onscrollend&&x.scrollrunning&&x.triggerScrollEnd(),x.scrollrunning=!1}):(this.doScrollLeft=function(e,o){var t=x.scrollrunning?x.newscrolly:x.getScrollTop();x.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=x.scrollrunning?x.newscrollx:x.getScrollLeft();x.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){function r(){if(x.cancelAnimationFrame)return!0;if(x.scrollrunning=!0,h=1-h)return x.timer=a(r)||1;var e,o,t=0,i=o=x.getScrollTop();x.dst.ay?(((s=(i=x.bzscroll?x.dst.py+x.bzscroll.getNow()*x.dst.ay:x.newscrolly)-o)<0&&i0&&i>x.newscrolly)&&(i=x.newscrolly),x.setScrollTop(i),i==x.newscrolly&&(t=1)):t=1;var n=e=x.getScrollLeft();if(x.dst.ax){var s=(n=x.bzscroll?x.dst.px+x.bzscroll.getNow()*x.dst.ax:x.newscrollx)-e;(s<0&&n0&&n>x.newscrollx)&&(n=x.newscrollx),x.setScrollLeft(n),n==x.newscrollx&&(t+=1)}else t+=1;2==t?(x.timer=0,x.cursorfreezed=!1,x.bzscroll=!1,x.scrollrunning=!1,i<0?i=0:i>x.page.maxh&&(i=Math.max(0,x.page.maxh)),n<0?n=0:n>x.page.maxw&&(n=x.page.maxw),n!=x.newscrollx||i!=x.newscrolly?x.doScrollPos(n,i):x.onscrollend&&x.triggerScrollEnd()):x.timer=a(r)||1}var o=void 0===o||!1===o?x.getScrollTop(!0):o;if(x.timer&&x.newscrolly==o&&x.newscrollx==e)return!0;x.timer&&c(x.timer),x.timer=0;var i=x.getScrollTop(),n=x.getScrollLeft();((x.newscrolly-i)*(o-i)<0||(x.newscrollx-n)*(e-n)<0)&&x.cancelScroll(),x.newscrolly=o,x.newscrollx=e,x.bouncescroll&&x.rail.visibility||(x.newscrolly<0?x.newscrolly=0:x.newscrolly>x.page.maxh&&(x.newscrolly=x.page.maxh)),x.bouncescroll&&x.railh.visibility||(x.newscrollx<0?x.newscrollx=0:x.newscrollx>x.page.maxw&&(x.newscrollx=x.page.maxw)),x.dst={},x.dst.x=e-n,x.dst.y=o-i,x.dst.px=n,x.dst.py=i;var s=Math.round(Math.sqrt(Math.pow(x.dst.x,2)+Math.pow(x.dst.y,2)));x.dst.ax=x.dst.x/s,x.dst.ay=x.dst.y/s;var l=0,d=s;0==x.dst.x?(l=i,d=o,x.dst.ay=1,x.dst.py=0):0==x.dst.y&&(l=n,d=e,x.dst.ax=1,x.dst.px=0);var u=x.getTransitionSpeed(s);if(t&&t<=1&&(u*=t),x.bzscroll=u>0&&(x.bzscroll?x.bzscroll.update(d,u):new L(l,d,u,0,1,0,1)),!x.timer){(i==x.page.maxh&&o>=x.page.maxh||n==x.page.maxw&&e>=x.page.maxw)&&x.checkContentSize();var h=1;x.cancelAnimationFrame=!1,x.timer=1,x.onscrollstart&&!x.scrollrunning&&x.triggerScrollStart(n,i,e,o,u),r(),(i==x.page.maxh&&o>=i||n==x.page.maxw&&e>=n)&&x.checkContentSize(),x.noticeCursor()}},this.cancelScroll=function(){return x.timer&&c(x.timer),x.timer=0,x.bzscroll=!1,x.scrollrunning=!1,x}):(this.doScrollLeft=function(e,o){var t=x.getScrollTop();x.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=x.getScrollLeft();x.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>x.page.maxw?x.page.maxw:e;r<0&&(r=0);var i=o>x.page.maxh?x.page.maxh:o;i<0&&(i=0),x.synched("scroll",function(){x.setScrollTop(i),x.setScrollLeft(r)})},this.cancelScroll=function(){}),this.doScrollBy=function(e,o){var t=0;if(t=o?Math.floor((x.scroll.y-e)*x.scrollratio.y):(x.timer?x.newscrolly:x.getScrollTop(!0))-e,x.bouncescroll){var r=Math.round(x.view.h/2);t<-r?t=-r:t>x.page.maxh+r&&(t=x.page.maxh+r)}x.cursorfreezed=!1;var i=x.getScrollTop(!0);return t<0&&i<=0?x.noticeCursor():t>x.page.maxh&&i>=x.page.maxh?(x.checkContentSize(),x.noticeCursor()):void x.doScrollTop(t)},this.doScrollLeftBy=function(e,o){var t=0;if(t=o?Math.floor((x.scroll.x-e)*x.scrollratio.x):(x.timer?x.newscrollx:x.getScrollLeft(!0))-e,x.bouncescroll){var r=Math.round(x.view.w/2);t<-r?t=-r:t>x.page.maxw+r&&(t=x.page.maxw+r)}x.cursorfreezed=!1;var i=x.getScrollLeft(!0);return t<0&&i<=0?x.noticeCursor():t>x.page.maxw&&i>=x.page.maxw?x.noticeCursor():void x.doScrollLeft(t)},this.doScrollTo=function(e,o){var t=o?Math.round(e*x.scrollratio.y):e;t<0?t=0:t>x.page.maxh&&(t=x.page.maxh),x.cursorfreezed=!1,x.doScrollTop(e)},this.checkContentSize=function(){var e=x.getContentSize();e.h==x.page.h&&e.w==x.page.w||x.resize(!1,e)},x.onscroll=function(e){x.rail.drag||x.cursorfreezed||x.synched("scroll",function(){x.scroll.y=Math.round(x.getScrollTop()*(1/x.scrollratio.y)),x.railh&&(x.scroll.x=Math.round(x.getScrollLeft()*(1/x.scrollratio.x))),x.noticeCursor()})},x.bind(x.docscroll,"scroll",x.onscroll),this.doZoomIn=function(e){if(!x.zoomactive){x.zoomactive=!0,x.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=x.win[0].style;for(var r in o){var i=o[r];x.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}x.zoomrestore.style.width=x.win.css("width"),x.zoomrestore.style.height=x.win.css("height"),x.zoomrestore.padding={w:x.win.outerWidth()-x.win.width(),h:x.win.outerHeight()-x.win.height()},M.isios4&&(x.zoomrestore.scrollTop=l.scrollTop(),l.scrollTop(0)),x.win.css({position:M.isios4?"absolute":"fixed",top:0,left:0,zIndex:n+100,margin:0});var s=x.win.css("backgroundColor");return(""==s||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(s))&&x.win.css("backgroundColor","#fff"),x.rail.css({zIndex:n+101}),x.zoom.css({zIndex:n+102}),x.zoom.css("backgroundPosition","0 -18px"),x.resizeZoom(),x.onzoomin&&x.onzoomin.call(x),x.cancelEvent(e)}},this.doZoomOut=function(e){if(x.zoomactive)return x.zoomactive=!1,x.win.css("margin",""),x.win.css(x.zoomrestore.style),M.isios4&&l.scrollTop(x.zoomrestore.scrollTop),x.rail.css({"z-index":x.zindex}),x.zoom.css({"z-index":x.zindex}),x.zoomrestore=!1,x.zoom.css("backgroundPosition","0 0"),x.onResize(),x.onzoomout&&x.onzoomout.call(x),x.cancelEvent(e)},this.doZoom=function(e){return x.zoomactive?x.doZoomOut(e):x.doZoomIn(e)},this.resizeZoom=function(){if(x.zoomactive){var e=x.getScrollTop();x.win.css({width:l.width()-x.zoomrestore.padding.w+"px",height:l.height()-x.zoomrestore.padding.h+"px"}),x.onResize(),x.setScrollTop(Math.min(x.page.maxh,e))}},this.init(),s.nicescroll.push(this)},w=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=h(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=h();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,n=e-o.lastx,s=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+n;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=s<0||s>o.nc.page.maxh,o.speedx=n,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=h(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),n=o.nc.getScrollTop(),s=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=s>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(n<0||n>s||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var p=u/50;o.speedx*=p,o.speedy*=p,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var m=o.lastscrollx,f=o.lastscrolly,g=function(){var e=h()-t>600?.04:.02;o.speedx&&(m=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=m,(m<0||m>l)&&(e=.1)),o.speedy&&(f=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=f,(f<0||f>s)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=m,o.nc.setScrollLeft(m)}if(o.speedy){o.nc.getScrollTop();o.chky=f,o.nc.setScrollTop(f)}o.timer||(o.nc.hideCursor(),o.doSnapy(m,f))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(m,f))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},v=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=s.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():v.call(e)},set:function(e,o){var t=s.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):v.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(s.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():v.call(this)}return this.each(function(){var o=s.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):v.call(s(this),e)})};var b=e.fn.scrollLeft;s.cssHooks.pageXOffset={get:function(e,o,t){var r=s.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():b.call(e)},set:function(e,o){var t=s.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):b.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(s.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():b.call(this)}return this.each(function(){var o=s.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):b.call(s(this),e)})};var y=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return s.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?s(e,r):n,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new g(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},window.NiceScroll={getjQuery:function(){return e}},s.nicescroll||(s.nicescroll=new y,s.nicescroll.options=p)}); \ No newline at end of file