forked from inuyaksa/jquery.nicescroll
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery.nicescroll.min.js
2 lines (2 loc) · 60.7 KB
/
jquery.nicescroll.min.js
1
2
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){"use strict";function h(){var a=document.getElementsByTagName("script"),b=a.length?a[a.length-1].src.split("?")[0]:"";return b.split("/").length>0?b.split("/").slice(0,-1).join("/")+"/":""}function w(a,b,c){for(var d=0;d<b.length;d++)c(a,b[d])}var b=!1,c=!1,d=0,e=2e3,f=0,g=a,i=["webkit","ms","moz","o"],j=window.requestAnimationFrame||!1,k=window.cancelAnimationFrame||!1;if(!j)for(var l in i){var m=i[l];if(j=window[m+"RequestAnimationFrame"]){k=window[m+"CancelAnimationFrame"]||window[m+"CancelRequestAnimationFrame"];break}}var n=window.MutationObserver||window.WebKitMutationObserver||!1,o={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:60,mousescrollstep:24,touchbehavior:!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:h(),preventmultitouchscrolling:!0,disablemutationobserver:!1},p=!1,q=function(){function j(){var a=["grab","-webkit-grab","-moz-grab"];(e.ischrome&&!e.ischrome38||e.isie)&&(a=[]);for(var c=0;c<a.length;c++){var d=a[c];if(b.cursor=d,b.cursor==d)return d}return"url(//patriciaportfolio.googlecode.com/files/openhand.cur),n-resize"}if(p)return p;var a=document.createElement("DIV"),b=a.style,c=navigator.userAgent,d=navigator.platform,e={};e.haspointerlock="pointerLockElement"in document||"webkitPointerLockElement"in document||"mozPointerLockElement"in document,e.isopera="opera"in window,e.isopera12=e.isopera&&"getUserMedia"in navigator,e.isoperamini="[object OperaMini]"===Object.prototype.toString.call(window.operamini),e.isie="all"in document&&"attachEvent"in a&&!e.isopera,e.isieold=e.isie&&!("msInterpolationMode"in b),e.isie7=e.isie&&!e.isieold&&(!("documentMode"in document)||7==document.documentMode),e.isie8=e.isie&&"documentMode"in document&&8==document.documentMode,e.isie9=e.isie&&"performance"in window&&9==document.documentMode,e.isie10=e.isie&&"performance"in window&&10==document.documentMode,e.isie11="msRequestFullscreen"in a&&document.documentMode>=11,e.isieedge12=navigator.userAgent.match(/Edge\/12\./),e.isieedge="msOverflowStyle"in a,e.ismodernie=e.isie11||e.isieedge,e.isie9mobile=/iemobile.9/i.test(c),e.isie9mobile&&(e.isie9=!1),e.isie7mobile=!e.isie9mobile&&e.isie7&&/iemobile/i.test(c),e.ismozilla="MozAppearance"in b,e.iswebkit="WebkitAppearance"in b,e.ischrome="chrome"in window,e.ischrome38=e.ischrome&&"touchAction"in b,e.ischrome22=!e.ischrome38&&e.ischrome&&e.haspointerlock,e.ischrome26=!e.ischrome38&&e.ischrome&&"transition"in b,e.cantouch="ontouchstart"in document.documentElement||"ontouchstart"in window,e.hasw3ctouch=(window.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),e.hasmstouch=!e.hasw3ctouch&&(window.MSPointerEvent||!1),e.ismac=/^mac$/i.test(d),e.isios=e.cantouch&&/iphone|ipad|ipod/i.test(d),e.isios4=e.isios&&!("seal"in Object),e.isios7=e.isios&&"webkitHidden"in document,e.isios8=e.isios&&"hidden"in document,e.isandroid=/android/i.test(c),e.haseventlistener="addEventListener"in a,e.trstyle=!1,e.hastransform=!1,e.hastranslate3d=!1,e.transitionstyle=!1,e.hastransition=!1,e.transitionend=!1;var f,g=["transform","msTransform","webkitTransform","MozTransform","OTransform"];for(f=0;f<g.length;f++)if(void 0!==b[g[f]]){e.trstyle=g[f];break}e.hastransform=!!e.trstyle,e.hastransform&&(b[e.trstyle]="translate3d(1px,2px,3px)",e.hastranslate3d=/translate3d/.test(b[e.trstyle])),e.transitionstyle=!1,e.prefixstyle="",e.transitionend=!1,g=["transition","webkitTransition","msTransition","MozTransition","OTransition","OTransition","KhtmlTransition"];var h=["","-webkit-","-ms-","-moz-","-o-","-o","-khtml-"],i=["transitionend","webkitTransitionEnd","msTransitionEnd","transitionend","otransitionend","oTransitionEnd","KhtmlTransitionEnd"];for(f=0;f<g.length;f++)if(g[f]in b){e.transitionstyle=g[f],e.prefixstyle=h[f],e.transitionend=i[f];break}return e.ischrome26&&(e.prefixstyle=h[1]),e.hastransition=e.transitionstyle,e.cursorgrabvalue=j(),e.hasmousecapture="setCapture"in a,e.hasMutationObserver=n!==!1,a=null,p=e,e},r=function(a,h){function v(){var a=i.doc.css(r.trstyle);return a&&"matrix"==a.substr(0,6)?a.replace(/^.*\((.*)\)$/g,"$1").replace(/px/g,"").split(/, +/):!1}function x(){var a=i.win;if("zIndex"in a)return a.zIndex();for(;a.length>0;){if(9==a[0].nodeType)return!1;var b=a.css("zIndex");if(!isNaN(b)&&0!=b)return parseInt(b);a=a.parent()}return!1}function z(a,b,c){var d=a.css(b),e=parseFloat(d);if(isNaN(e)){e=y[d]||0;var f=3==e?c?i.win.outerHeight()-i.win.innerHeight():i.win.outerWidth()-i.win.innerWidth():1;return i.isie8&&e&&(e+=1),f?e:0}return e}function A(a,b,c,d){i._bind(a,b,function(d){var d=d?d:window.event,e={original:d,target:d.target||d.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==d.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return d.preventDefault?d.preventDefault():d.returnValue=!1,!1},stopImmediatePropagation:function(){d.stopImmediatePropagation?d.stopImmediatePropagation():d.cancelBubble=!0}};return"mousewheel"==b?(d.wheelDeltaX&&(e.deltaX=-1/40*d.wheelDeltaX),d.wheelDeltaY&&(e.deltaY=-1/40*d.wheelDeltaY),!e.deltaY&&!e.deltaX&&(e.deltaY=-1/40*d.wheelDelta)):e.deltaY=d.detail,c.call(a,e)},d)}function B(a,b,c){var d,e;if(0==a.deltaMode?(d=-Math.floor(a.deltaX*(i.opt.mousescrollstep/54)),e=-Math.floor(a.deltaY*(i.opt.mousescrollstep/54))):1==a.deltaMode&&(d=-Math.floor(a.deltaX*i.opt.mousescrollstep),e=-Math.floor(a.deltaY*i.opt.mousescrollstep)),b&&i.opt.oneaxismousemode&&0==d&&e&&(d=e,e=0,c)){var f=0>d?i.getScrollLeft()>=i.page.maxw:i.getScrollLeft()<=0;f&&(e=d,d=0)}if(i.isrtlmode&&(d=-d),d&&(i.scrollmom&&i.scrollmom.stop(),i.lastdeltax+=d,i.debounced("mousewheelx",function(){var a=i.lastdeltax;i.lastdeltax=0,i.rail.drag||i.doScrollLeftBy(a)},15)),e){if(i.opt.nativeparentscrolling&&c&&!i.ispage&&!i.zoomactive)if(0>e){if(i.getScrollTop()>=i.page.maxh)return!0}else if(i.getScrollTop()<=0)return!0;i.scrollmom&&i.scrollmom.stop(),i.lastdeltay+=e,i.synched("mousewheely",function(){var a=i.lastdeltay;i.lastdeltay=0,i.rail.drag||i.doScrollBy(a)},15)}return a.stopImmediatePropagation(),a.preventDefault()}var i=this;if(this.version="3.6.8",this.name="nicescroll",this.me=h,this.opt={doc:g("body"),win:!1},g.extend(this.opt,o),this.opt.snapbackspeed=80,a)for(var l in i.opt)void 0!==a[l]&&(i.opt[l]=a[l]);if(i.opt.disablemutationobserver&&(n=!1),this.doc=i.opt.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(i.opt.win?i.opt.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=i.opt.win!==!1,this.win=i.opt.win||(this.ispage?g(window):this.doc),this.docscroll=this.ispage&&!this.haswrapper?g(window):this.win,this.body=g("body"),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"!=i.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 m=this.win[0]==window?this.body:this.win,p=m.css("writing-mode")||m.css("-webkit-writing-mode")||m.css("-ms-writing-mode")||m.css("-moz-writing-mode");"horizontal-tb"==p||"lr-tb"==p||""==p?(this.isrtlmode="rtl"==m.css("direction"),this.isvertical=!1):(this.isrtlmode="vertical-rl"==p||"tb"==p||"tb-rl"==p||"rl-tb"==p,this.isvertical="vertical-rl"==p||"tb"==p||"tb-rl"==p)}else this.isrtlmode=this.opt.rtlmode===!0,this.isvertical=!1;this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1;do this.id="ascrail"+e++;while(document.getElementById(this.id));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=i.opt.overflowx,this.overflowy=i.opt.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=q();var r=g.extend({},this.detected);this.canhwscroll=r.hastransform&&i.opt.hwacceleration,this.ishwscroll=this.canhwscroll&&i.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(r.iswebkit||r.isie||r.isie11):this.hasreversehr=!(r.iswebkit||r.isie&&!r.isie10&&!r.isie11):this.hasreversehr=!1,this.istouchcapable=!1,r.cantouch||!r.hasw3ctouch&&!r.hasmstouch?!r.cantouch||r.isios||r.isandroid||!r.iswebkit&&!r.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,i.opt.enablemouselockapi||(r.hasmousecapture=!1,r.haspointerlock=!1),this.debounced=function(a,b,c){if(i){var d=i.delaylist[a]||!1;d||(b.call(i),i.delaylist[a]={h:j(function(){i.delaylist[a].fn.call(i),i.delaylist[a]=!1},c)}),i.delaylist[a].fn=b}};var t=!1;this.synched=function(a,b){function c(){t||(j(function(){if(i){t=!1;for(var a in i.synclist){var b=i.synclist[a];b&&b.call(i),i.synclist[a]=!1}}}),t=!0)}return i.synclist[a]=b,c(),a},this.unsynched=function(a){i.synclist[a]&&(i.synclist[a]=!1)},this.css=function(a,b){for(var c in b)i.saved.css.push([a,c,a.css(c)]),a.css(c,b[c])},this.scrollTop=function(a){return void 0===a?i.getScrollTop():i.setScrollTop(a)},this.scrollLeft=function(a){return void 0===a?i.getScrollLeft():i.setScrollLeft(a)};var u=function(a,b,c,d,e,f,g){this.st=a,this.ed=b,this.spd=c,this.p1=d||0,this.p2=e||1,this.p3=f||0,this.p4=g||1,this.ts=(new Date).getTime(),this.df=this.ed-this.st};if(u.prototype={B2:function(a){return 3*a*a*(1-a)},B3:function(a){return 3*a*(1-a)*(1-a)},B4:function(a){return(1-a)*(1-a)*(1-a)},getNow:function(){var a=(new Date).getTime(),b=1-(a-this.ts)/this.spd,c=this.B2(b)+this.B3(b)+this.B4(b);return 0>b?this.ed:this.st+Math.round(this.df*c)},update:function(a,b){return this.st=this.getNow(),this.ed=a,this.spd=b,this.ts=(new Date).getTime(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},r.hastranslate3d&&r.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(a){if(!a){var b=v();if(b)return 16==b.length?-b[13]:-b[5];if(i.timerscroll&&i.timerscroll.bz)return i.timerscroll.bz.getNow()}return i.doc.translate.y},this.getScrollLeft=function(a){if(!a){var b=v();if(b)return 16==b.length?-b[12]:-b[4];if(i.timerscroll&&i.timerscroll.bh)return i.timerscroll.bh.getNow()}return i.doc.translate.x},this.notifyScrollEvent=function(a){var b=document.createEvent("UIEvents");b.initUIEvent("scroll",!1,!0,window,1),b.niceevent=!0,a.dispatchEvent(b)};var w=this.isrtlmode?1:-1;r.hastranslate3d&&i.opt.enabletranslate3d?(this.setScrollTop=function(a,b){i.doc.translate.y=a,i.doc.translate.ty=-1*a+"px",i.doc.css(r.trstyle,"translate3d("+i.doc.translate.tx+","+i.doc.translate.ty+",0px)"),b||i.notifyScrollEvent(i.win[0])},this.setScrollLeft=function(a,b){i.doc.translate.x=a,i.doc.translate.tx=a*w+"px",i.doc.css(r.trstyle,"translate3d("+i.doc.translate.tx+","+i.doc.translate.ty+",0px)"),b||i.notifyScrollEvent(i.win[0])}):(this.setScrollTop=function(a,b){i.doc.translate.y=a,i.doc.translate.ty=-1*a+"px",i.doc.css(r.trstyle,"translate("+i.doc.translate.tx+","+i.doc.translate.ty+")"),b||i.notifyScrollEvent(i.win[0])},this.setScrollLeft=function(a,b){i.doc.translate.x=a,i.doc.translate.tx=a*w+"px",i.doc.css(r.trstyle,"translate("+i.doc.translate.tx+","+i.doc.translate.ty+")"),b||i.notifyScrollEvent(i.win[0])})}else this.getScrollTop=function(){return i.docscroll.scrollTop()},this.setScrollTop=function(a){return setTimeout(function(){i&&i.docscroll.scrollTop(a)},1)},this.getScrollLeft=function(){var a;return a=i.hasreversehr?i.detected.ismozilla?i.page.maxw-Math.abs(i.docscroll.scrollLeft()):i.page.maxw-i.docscroll.scrollLeft():i.docscroll.scrollLeft()},this.setScrollLeft=function(a){return setTimeout(function(){return i?(i.hasreversehr&&(a=i.detected.ismozilla?-(i.page.maxw-a):i.page.maxw-a),i.docscroll.scrollLeft(a)):void 0},1)};this.getTarget=function(a){return a?a.target?a.target:a.srcElement?a.srcElement:!1:!1},this.hasParent=function(a,b){if(!a)return!1;for(var c=a.target||a.srcElement||a||!1;c&&c.id!=b;)c=c.parentNode||!1;return c!==!1};var y={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(i.isfixed){var a=i.win.offset(),b=i.getDocumentScrollOffset();return a.top-=b.top,a.left-=b.left,a}var c=i.win.offset();if(!i.viewport)return c;var d=i.viewport.offset();return{top:c.top-d.top,left:c.left-d.left}},this.updateScrollBar=function(a){var b,c;if(i.ishwscroll)i.rail.css({height:i.win.innerHeight()-(i.opt.railpadding.top+i.opt.railpadding.bottom)}),i.railh&&i.railh.css({width:i.win.innerWidth()-(i.opt.railpadding.left+i.opt.railpadding.right)});else{var d=i.getOffset();if(b={top:d.top,left:d.left-(i.opt.railpadding.left+i.opt.railpadding.right)},b.top+=z(i.win,"border-top-width",!0),b.left+=i.rail.align?i.win.outerWidth()-z(i.win,"border-right-width")-i.rail.width:z(i.win,"border-left-width"),c=i.opt.railoffset,c&&(c.top&&(b.top+=c.top),c.left&&(b.left+=c.left)),i.railslocked||i.rail.css({top:b.top,left:b.left,height:(a?a.h:i.win.innerHeight())-(i.opt.railpadding.top+i.opt.railpadding.bottom)}),i.zoom&&i.zoom.css({top:b.top+1,left:1==i.rail.align?b.left-20:b.left+i.rail.width+4}),i.railh&&!i.railslocked){b={top:d.top,left:d.left},c=i.opt.railhoffset,c&&(c.top&&(b.top+=c.top),c.left&&(b.left+=c.left));var e=i.railh.align?b.top+z(i.win,"border-top-width",!0)+i.win.innerHeight()-i.railh.height:b.top+z(i.win,"border-top-width",!0),f=b.left+z(i.win,"border-left-width");i.railh.css({top:e-(i.opt.railpadding.top+i.opt.railpadding.bottom),left:f,width:i.railh.width})}}},this.doRailClick=function(a,b,c){var d,e,f,g;i.railslocked||(i.cancelEvent(a),b?(d=c?i.doScrollLeft:i.doScrollTop,f=c?(a.pageX-i.railh.offset().left-i.cursorwidth/2)*i.scrollratio.x:(a.pageY-i.rail.offset().top-i.cursorheight/2)*i.scrollratio.y,d(f)):(d=c?i.doScrollLeftBy:i.doScrollBy,f=c?i.scroll.x:i.scroll.y,g=c?a.pageX-i.railh.offset().left:a.pageY-i.rail.offset().top,e=c?i.view.w:i.view.h,d(f>=g?e:-e)))},i.hasanimationframe=j,i.hascancelanimationframe=k,i.hasanimationframe?i.hascancelanimationframe||(k=function(){i.cancelAnimationFrame=!0}):(j=function(a){return setTimeout(a,15-Math.floor(+new Date/1e3)%16)},k=clearTimeout),this.init=function(){if(i.saved.css=[],r.isie7mobile)return!0;if(r.isoperamini)return!0;r.isie10?"-ms-touch-action":"touch-action";r.hasmstouch&&i.css(i.ispage?g("html"):i.win,{_touchaction:"none"});var e=r.ismodernie||r.isie10?{"-ms-overflow-style":"none"}:{"overflow-y":"hidden"};if(i.zindex="auto",i.ispage||"auto"!=i.opt.zindex?i.zindex=i.opt.zindex:i.zindex=x()||"auto",!i.ispage&&"auto"!=i.zindex&&i.zindex>f&&(f=i.zindex),i.isie&&0==i.zindex&&"auto"==i.opt.zindex&&(i.zindex="auto"),!i.ispage||!r.cantouch&&!r.isieold&&!r.isie9mobile){var h=i.docscroll;i.ispage&&(h=i.haswrapper?i.win:i.doc),r.isie9mobile||i.css(h,e),i.ispage&&r.isie7&&("BODY"==i.doc[0].nodeName?i.css(g("html"),{"overflow-y":"hidden"}):"HTML"==i.doc[0].nodeName&&i.css(g("body"),e)),!r.isios||i.ispage||i.haswrapper||i.css(g("body"),{"-webkit-overflow-scrolling":"touch"});var j=g(document.createElement("div"));j.css({position:"relative",top:0,"float":"right",width:i.opt.cursorwidth,height:0,"background-color":i.opt.cursorcolor,border:i.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":i.opt.cursorborderradius,"-moz-border-radius":i.opt.cursorborderradius,"border-radius":i.opt.cursorborderradius}),j.hborder=parseFloat(j.outerHeight()-j.innerHeight()),j.addClass("nicescroll-cursors"),i.cursor=j;var k=g(document.createElement("div"));k.attr("id",i.id),k.addClass("nicescroll-rails nicescroll-rails-vr");var l,m,o=["left","right","top","bottom"];for(var p in o)m=o[p],l=i.opt.railpadding[m],l?k.css("padding-"+m,l+"px"):i.opt.railpadding[m]=0;k.append(j),k.width=Math.max(parseFloat(i.opt.cursorwidth),j.outerWidth()),k.css({width:k.width+"px",zIndex:i.zindex,background:i.opt.background,cursor:"default"}),k.visibility=!0,k.scrollable=!0,k.align="left"==i.opt.railalign?0:1,i.rail=k,i.rail.drag=!1;var q=!1;!i.opt.boxzoom||i.ispage||r.isieold||(q=document.createElement("div"),i.bind(q,"click",i.doZoom),i.bind(q,"mouseenter",function(){i.zoom.css("opacity",i.opt.cursoropacitymax)}),i.bind(q,"mouseleave",function(){i.zoom.css("opacity",i.opt.cursoropacitymin)}),i.zoom=g(q),i.zoom.css({cursor:"pointer",zIndex:i.zindex,backgroundImage:"url("+i.opt.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0px 0px"}),i.opt.dblclickzoom&&i.bind(i.win,"dblclick",i.doZoom),r.cantouch&&i.opt.gesturezoom&&(i.ongesturezoom=function(a){return a.scale>1.5&&i.doZoomIn(a),a.scale<.8&&i.doZoomOut(a),i.cancelEvent(a)},i.bind(i.win,"gestureend",i.ongesturezoom))),i.railh=!1;var t;if(i.opt.horizrailenabled){i.css(h,{overflowX:"hidden"});var j=g(document.createElement("div"));j.css({position:"absolute",top:0,height:i.opt.cursorwidth,width:0,backgroundColor:i.opt.cursorcolor,border:i.opt.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":i.opt.cursorborderradius,"-moz-border-radius":i.opt.cursorborderradius,"border-radius":i.opt.cursorborderradius}),r.isieold&&j.css("overflow","hidden"),j.wborder=parseFloat(j.outerWidth()-j.innerWidth()),j.addClass("nicescroll-cursors"),i.cursorh=j,t=g(document.createElement("div")),t.attr("id",i.id+"-hr"),t.addClass("nicescroll-rails nicescroll-rails-hr"),t.height=Math.max(parseFloat(i.opt.cursorwidth),j.outerHeight()),t.css({height:t.height+"px",zIndex:i.zindex,background:i.opt.background}),t.append(j),t.visibility=!0,t.scrollable=!0,t.align="top"==i.opt.railvalign?0:1,i.railh=t,i.railh.drag=!1}if(i.ispage)k.css({position:"fixed",top:0,height:"100%"}),k.align?k.css({right:0}):k.css({left:0}),i.body.append(k),i.railh&&(t.css({position:"fixed",left:0,width:"100%"}),t.align?t.css({bottom:0}):t.css({top:0}),i.body.append(t));else{if(i.ishwscroll){"static"==i.win.css("position")&&i.css(i.win,{position:"relative"});var u="HTML"==i.win[0].nodeName?i.body:i.win;g(u).scrollTop(0).scrollLeft(0),i.zoom&&(i.zoom.css({position:"absolute",top:1,right:0,"margin-right":k.width+4}),u.append(i.zoom)),k.css({position:"absolute",top:0}),k.align?k.css({right:0}):k.css({left:0}),u.append(k),t&&(t.css({position:"absolute",left:0,bottom:0}),t.align?t.css({bottom:0}):t.css({top:0}),u.append(t))}else{i.isfixed="fixed"==i.win.css("position");var v=i.isfixed?"fixed":"absolute";i.isfixed||(i.viewport=i.getViewport(i.win[0])),i.viewport&&(i.body=i.viewport,0==/fixed|absolute/.test(i.viewport.css("position"))&&i.css(i.viewport,{position:"relative"})),k.css({position:v}),i.zoom&&i.zoom.css({position:v}),i.updateScrollBar(),i.body.append(k),i.zoom&&i.body.append(i.zoom),i.railh&&(t.css({position:v}),i.body.append(t))}r.isios&&i.css(i.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),r.isie&&i.opt.disableoutline&&i.win.attr("hideFocus","true"),r.iswebkit&&i.opt.disableoutline&&i.win.css("outline","none")}if(i.opt.autohidemode===!1?(i.autohidedom=!1,i.rail.css({opacity:i.opt.cursoropacitymax}),i.railh&&i.railh.css({opacity:i.opt.cursoropacitymax})):i.opt.autohidemode===!0||"leave"===i.opt.autohidemode?(i.autohidedom=g().add(i.rail),r.isie8&&(i.autohidedom=i.autohidedom.add(i.cursor)),i.railh&&(i.autohidedom=i.autohidedom.add(i.railh)),i.railh&&r.isie8&&(i.autohidedom=i.autohidedom.add(i.cursorh))):"scroll"==i.opt.autohidemode?(i.autohidedom=g().add(i.rail),i.railh&&(i.autohidedom=i.autohidedom.add(i.railh))):"cursor"==i.opt.autohidemode?(i.autohidedom=g().add(i.cursor),i.railh&&(i.autohidedom=i.autohidedom.add(i.cursorh))):"hidden"==i.opt.autohidemode&&(i.autohidedom=!1,i.hide(),i.railslocked=!1),r.isie9mobile){i.scrollmom=new s(i),i.onmangotouch=function(){var a=i.getScrollTop(),b=i.getScrollLeft();if(a==i.scrollmom.lastscrolly&&b==i.scrollmom.lastscrollx)return!0;var c=a-i.mangotouch.sy,d=b-i.mangotouch.sx,e=Math.round(Math.sqrt(Math.pow(d,2)+Math.pow(c,2)));if(0!=e){var f=0>c?-1:1,g=0>d?-1:1,h=+new Date;if(i.mangotouch.lazy&&clearTimeout(i.mangotouch.lazy),h-i.mangotouch.tm>80||i.mangotouch.dry!=f||i.mangotouch.drx!=g)i.scrollmom.stop(),i.scrollmom.reset(b,a),i.mangotouch.sy=a,i.mangotouch.ly=a,i.mangotouch.sx=b,i.mangotouch.lx=b,i.mangotouch.dry=f,i.mangotouch.drx=g,i.mangotouch.tm=h;else{i.scrollmom.stop(),i.scrollmom.update(i.mangotouch.sx-d,i.mangotouch.sy-c),i.mangotouch.tm=h;var j=Math.max(Math.abs(i.mangotouch.ly-a),Math.abs(i.mangotouch.lx-b));i.mangotouch.ly=a,i.mangotouch.lx=b,j>2&&(i.mangotouch.lazy=setTimeout(function(){i.mangotouch.lazy=!1,i.mangotouch.dry=0,i.mangotouch.drx=0,i.mangotouch.tm=0,i.scrollmom.doMomentum(30)},100))}}};var w=i.getScrollTop(),y=i.getScrollLeft();i.mangotouch={sy:w,ly:w,dry:0,sx:y,lx:y,drx:0,lazy:!1,tm:0},i.bind(i.docscroll,"scroll",i.onmangotouch)}else{if(r.cantouch||i.istouchcapable||i.opt.touchbehavior||r.hasmstouch){i.scrollmom=new s(i),i.ontouchstart=function(a){if(a.pointerType&&2!=a.pointerType&&"touch"!=a.pointerType)return!1;if(i.hasmoving=!1,!i.railslocked){var b;if(r.hasmstouch)for(b=a.target?a.target:!1;b;){var c=g(b).getNiceScroll();if(c.length>0&&c[0].me==i.me)break;if(c.length>0)return!1;if("DIV"==b.nodeName&&b.id==i.id)break;b=b.parentNode?b.parentNode:!1}if(i.cancelScroll(),b=i.getTarget(a)){var d=/INPUT/i.test(b.nodeName)&&/range/i.test(b.type);if(d)return i.stopPropagation(a)}if(!("clientX"in a)&&"changedTouches"in a&&(a.clientX=a.changedTouches[0].clientX,a.clientY=a.changedTouches[0].clientY),i.forcescreen){var e=a;a={original:a.original?a.original:a},a.clientX=e.screenX,a.clientY=e.screenY}if(i.rail.drag={x:a.clientX,y:a.clientY,sx:i.scroll.x,sy:i.scroll.y,st:i.getScrollTop(),sl:i.getScrollLeft(),pt:2,dl:!1},i.ispage||!i.opt.directionlockdeadzone)i.rail.drag.dl="f";else{var f={w:g(window).width(),h:g(window).height()},h={w:Math.max(document.body.scrollWidth,document.documentElement.scrollWidth),h:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)},j=Math.max(0,h.h-f.h),k=Math.max(0,h.w-f.w);!i.rail.scrollable&&i.railh.scrollable?i.rail.drag.ck=j>0?"v":!1:i.rail.scrollable&&!i.railh.scrollable?i.rail.drag.ck=k>0?"h":!1:i.rail.drag.ck=!1,i.rail.drag.ck||(i.rail.drag.dl="f")}if(i.opt.touchbehavior&&i.isiframe&&r.isie){var l=i.win.position();i.rail.drag.x+=l.left,i.rail.drag.y+=l.top}if(i.hasmoving=!1,i.lastmouseup=!1,i.scrollmom.reset(a.clientX,a.clientY),!r.cantouch&&!this.istouchcapable&&!a.pointerType){var m=b?/INPUT|SELECT|TEXTAREA/i.test(b.nodeName):!1;if(!m)return!i.ispage&&r.hasmousecapture&&b.setCapture(),i.opt.touchbehavior?(b.onclick&&!b._onclick&&(b._onclick=b.onclick,b.onclick=function(a){return i.hasmoving?!1:void b._onclick.call(this,a)}),i.cancelEvent(a)):i.stopPropagation(a);/SUBMIT|CANCEL|BUTTON/i.test(g(b).attr("type"))&&(pc={tg:b,click:!1},i.preventclick=pc)}}},i.ontouchend=function(a){if(!i.rail.drag)return!0;if(2==i.rail.drag.pt){if(a.pointerType&&2!=a.pointerType&&"touch"!=a.pointerType)return!1;if(i.scrollmom.doMomentum(),i.rail.drag=!1,i.hasmoving&&(i.lastmouseup=!0,i.hideCursor(),r.hasmousecapture&&document.releaseCapture(),!r.cantouch))return i.cancelEvent(a)}else if(1==i.rail.drag.pt)return i.onmouseup(a)};var z=i.opt.touchbehavior&&i.isiframe&&!r.hasmousecapture;i.ontouchmove=function(a,b){if(!i.rail.drag)return!1;if(a.targetTouches&&i.opt.preventmultitouchscrolling&&a.targetTouches.length>1)return!1;if(a.pointerType&&2!=a.pointerType&&"touch"!=a.pointerType)return!1;if(2==i.rail.drag.pt){if(r.cantouch&&r.isios&&void 0===a.original)return!0;i.hasmoving=!0,i.preventclick&&!i.preventclick.click&&(i.preventclick.click=i.preventclick.tg.onclick||!1,i.preventclick.tg.onclick=i.onpreventclick);var c=g.extend({original:a},a);if(a=c,"changedTouches"in a&&(a.clientX=a.changedTouches[0].clientX,a.clientY=a.changedTouches[0].clientY),i.forcescreen){var d=a;a={original:a.original?a.original:a},a.clientX=d.screenX,a.clientY=d.screenY}var e,f;if(f=e=0,z&&!b){var h=i.win.position();f=-h.left,e=-h.top}var j=a.clientY+e,k=j-i.rail.drag.y,l=a.clientX+f,m=l-i.rail.drag.x,n=i.rail.drag.st-k;i.ishwscroll&&i.opt.bouncescroll?0>n?n=Math.round(n/2):n>i.page.maxh&&(n=i.page.maxh+Math.round((n-i.page.maxh)/2)):(0>n&&(n=0,j=0),n>i.page.maxh&&(n=i.page.maxh,j=0));var o;i.railh&&i.railh.scrollable&&(o=i.isrtlmode?m-i.rail.drag.sl:i.rail.drag.sl-m,i.ishwscroll&&i.opt.bouncescroll?0>o?o=Math.round(o/2):o>i.page.maxw&&(o=i.page.maxw+Math.round((o-i.page.maxw)/2)):(0>o&&(o=0,l=0),o>i.page.maxw&&(o=i.page.maxw,l=0)));var p=!1;if(i.rail.drag.dl)p=!0,"v"==i.rail.drag.dl?o=i.rail.drag.sl:"h"==i.rail.drag.dl&&(n=i.rail.drag.st);else{var q=Math.abs(k),s=Math.abs(m),t=i.opt.directionlockdeadzone;if("v"==i.rail.drag.ck){if(q>t&&.3*q>=s)return i.rail.drag=!1,!0;s>t&&(i.rail.drag.dl="f",g("body").scrollTop(g("body").scrollTop()))}else if("h"==i.rail.drag.ck){if(s>t&&.3*s>=q)return i.rail.drag=!1,!0;q>t&&(i.rail.drag.dl="f",g("body").scrollLeft(g("body").scrollLeft()))}}if(i.synched("touchmove",function(){i.rail.drag&&2==i.rail.drag.pt&&(i.prepareTransition&&i.prepareTransition(0),i.rail.scrollable&&i.setScrollTop(n),i.scrollmom.update(l,j),i.railh&&i.railh.scrollable?(i.setScrollLeft(o),i.showCursor(n,o)):i.showCursor(n),r.isie10&&document.selection.clear())}),r.ischrome&&i.istouchcapable&&(p=!1),p)return i.cancelEvent(a)}else if(1==i.rail.drag.pt)return i.onmousemove(a)}}if(i.onmousedown=function(a,b){if(!i.rail.drag||1==i.rail.drag.pt){if(i.railslocked)return i.cancelEvent(a);i.cancelScroll(),i.rail.drag={x:a.clientX,y:a.clientY,sx:i.scroll.x,sy:i.scroll.y,pt:1,hr:!!b};var c=i.getTarget(a);return!i.ispage&&r.hasmousecapture&&c.setCapture(),i.isiframe&&!r.hasmousecapture&&(i.saved.csspointerevents=i.doc.css("pointer-events"),i.css(i.doc,{"pointer-events":"none"})),i.hasmoving=!1,i.cancelEvent(a)}},i.onmouseup=function(a){return i.rail.drag?1!=i.rail.drag.pt?!0:(r.hasmousecapture&&document.releaseCapture(),i.isiframe&&!r.hasmousecapture&&i.doc.css("pointer-events",i.saved.csspointerevents),i.rail.drag=!1,i.hasmoving&&i.triggerScrollEnd(),i.cancelEvent(a)):void 0},i.onmousemove=function(a){if(i.rail.drag){if(1!=i.rail.drag.pt)return;if(r.ischrome&&0==a.which)return i.onmouseup(a);if(i.cursorfreezed=!0,i.hasmoving=!0,i.rail.drag.hr){i.scroll.x=i.rail.drag.sx+(a.clientX-i.rail.drag.x),i.scroll.x<0&&(i.scroll.x=0);var b=i.scrollvaluemaxw;i.scroll.x>b&&(i.scroll.x=b)}else{i.scroll.y=i.rail.drag.sy+(a.clientY-i.rail.drag.y),i.scroll.y<0&&(i.scroll.y=0);var c=i.scrollvaluemax;i.scroll.y>c&&(i.scroll.y=c)}return i.synched("mousemove",function(){i.rail.drag&&1==i.rail.drag.pt&&(i.showCursor(),i.rail.drag.hr?i.hasreversehr?i.doScrollLeft(i.scrollvaluemaxw-Math.round(i.scroll.x*i.scrollratio.x),i.opt.cursordragspeed):i.doScrollLeft(Math.round(i.scroll.x*i.scrollratio.x),i.opt.cursordragspeed):i.doScrollTop(Math.round(i.scroll.y*i.scrollratio.y),i.opt.cursordragspeed))}),i.cancelEvent(a)}i.checkarea=0},r.cantouch||i.opt.touchbehavior)i.onpreventclick=function(a){return i.preventclick?(i.preventclick.tg.onclick=i.preventclick.click,i.preventclick=!1,i.cancelEvent(a)):void 0},i.bind(i.win,"mousedown",i.ontouchstart),i.onclick=r.isios?!1:function(a){return i.lastmouseup?(i.lastmouseup=!1,i.cancelEvent(a)):!0},i.opt.grabcursorenabled&&r.cursorgrabvalue&&(i.css(i.ispage?i.doc:i.win,{cursor:r.cursorgrabvalue}),i.css(i.rail,{cursor:r.cursorgrabvalue}));else{var A=function(a){if(i.selectiondrag){if(a){var b=i.win.outerHeight(),c=a.pageY-i.selectiondrag.top;c>0&&b>c&&(c=0),c>=b&&(c-=b),i.selectiondrag.df=c}if(0!=i.selectiondrag.df){var d=2*-Math.floor(i.selectiondrag.df/6);i.doScrollBy(d),i.debounced("doselectionscroll",function(){A()},50)}}};"getSelection"in document?i.hasTextSelected=function(){return document.getSelection().rangeCount>0}:"selection"in document?i.hasTextSelected=function(){return"None"!=document.selection.type}:i.hasTextSelected=function(){return!1},i.onselectionstart=function(a){i.ispage||(i.selectiondrag=i.win.offset())},i.onselectionend=function(a){i.selectiondrag=!1},i.onselectiondrag=function(a){i.selectiondrag&&i.hasTextSelected()&&i.debounced("selectionscroll",function(){A(a)},250)}}r.hasw3ctouch?(i.css(i.rail,{"touch-action":"none"}),i.css(i.cursor,{"touch-action":"none"}),i.bind(i.win,"pointerdown",i.ontouchstart),i.bind(document,"pointerup",i.ontouchend),i.bind(document,"pointermove",i.ontouchmove)):r.hasmstouch?(i.css(i.rail,{"-ms-touch-action":"none"}),i.css(i.cursor,{"-ms-touch-action":"none"}),i.bind(i.win,"MSPointerDown",i.ontouchstart),i.bind(document,"MSPointerUp",i.ontouchend),i.bind(document,"MSPointerMove",i.ontouchmove),i.bind(i.cursor,"MSGestureHold",function(a){a.preventDefault()}),i.bind(i.cursor,"contextmenu",function(a){a.preventDefault()})):this.istouchcapable&&(i.bind(i.win,"touchstart",i.ontouchstart),i.bind(document,"touchend",i.ontouchend),i.bind(document,"touchcancel",i.ontouchend),i.bind(document,"touchmove",i.ontouchmove)),(i.opt.cursordragontouch||!r.cantouch&&!i.opt.touchbehavior)&&(i.rail.css({cursor:"default"}),i.railh&&i.railh.css({cursor:"default"}),i.jqbind(i.rail,"mouseenter",function(){return i.ispage||i.win.is(":visible")?(i.canshowonmouseevent&&i.showCursor(),void(i.rail.active=!0)):!1}),i.jqbind(i.rail,"mouseleave",function(){i.rail.active=!1,i.rail.drag||i.hideCursor()}),i.opt.sensitiverail&&(i.bind(i.rail,"click",function(a){i.doRailClick(a,!1,!1)}),i.bind(i.rail,"dblclick",function(a){i.doRailClick(a,!0,!1)}),i.bind(i.cursor,"click",function(a){i.cancelEvent(a)}),i.bind(i.cursor,"dblclick",function(a){i.cancelEvent(a)})),i.railh&&(i.jqbind(i.railh,"mouseenter",function(){return i.ispage||i.win.is(":visible")?(i.canshowonmouseevent&&i.showCursor(),void(i.rail.active=!0)):!1}),i.jqbind(i.railh,"mouseleave",function(){i.rail.active=!1,i.rail.drag||i.hideCursor()}),i.opt.sensitiverail&&(i.bind(i.railh,"click",function(a){i.doRailClick(a,!1,!0)}),i.bind(i.railh,"dblclick",function(a){i.doRailClick(a,!0,!0)}),i.bind(i.cursorh,"click",function(a){i.cancelEvent(a)}),i.bind(i.cursorh,"dblclick",function(a){i.cancelEvent(a)})))),r.cantouch||i.opt.touchbehavior?(i.bind(r.hasmousecapture?i.win:document,"mouseup",i.ontouchend),i.bind(document,"mousemove",i.ontouchmove),i.onclick&&i.bind(document,"click",i.onclick),i.opt.cursordragontouch?(i.bind(i.cursor,"mousedown",i.onmousedown),i.bind(i.cursor,"mouseup",i.onmouseup),i.cursorh&&i.bind(i.cursorh,"mousedown",function(a){i.onmousedown(a,!0)}),i.cursorh&&i.bind(i.cursorh,"mouseup",i.onmouseup)):(i.bind(i.rail,"mousedown",function(a){a.preventDefault()}),i.railh&&i.bind(i.railh,"mousedown",function(a){a.preventDefault()}))):(i.bind(r.hasmousecapture?i.win:document,"mouseup",i.onmouseup),i.bind(document,"mousemove",i.onmousemove),i.onclick&&i.bind(document,"click",i.onclick),
i.bind(i.cursor,"mousedown",i.onmousedown),i.bind(i.cursor,"mouseup",i.onmouseup),i.railh&&(i.bind(i.cursorh,"mousedown",function(a){i.onmousedown(a,!0)}),i.bind(i.cursorh,"mouseup",i.onmouseup)),!i.ispage&&i.opt.enablescrollonselection&&(i.bind(i.win[0],"mousedown",i.onselectionstart),i.bind(document,"mouseup",i.onselectionend),i.bind(i.cursor,"mouseup",i.onselectionend),i.cursorh&&i.bind(i.cursorh,"mouseup",i.onselectionend),i.bind(document,"mousemove",i.onselectiondrag)),i.zoom&&(i.jqbind(i.zoom,"mouseenter",function(){i.canshowonmouseevent&&i.showCursor(),i.rail.active=!0}),i.jqbind(i.zoom,"mouseleave",function(){i.rail.active=!1,i.rail.drag||i.hideCursor()}))),i.opt.enablemousewheel&&(i.isiframe||i.mousewheel(r.isie&&i.ispage?document:i.win,i.onmousewheel),i.mousewheel(i.rail,i.onmousewheel),i.railh&&i.mousewheel(i.railh,i.onmousewheelhr)),i.ispage||r.cantouch||/HTML|^BODY/.test(i.win[0].nodeName)||(i.win.attr("tabindex")||i.win.attr({tabindex:d++}),i.jqbind(i.win,"focus",function(a){b=i.getTarget(a).id||!0,i.hasfocus=!0,i.canshowonmouseevent&&i.noticeCursor()}),i.jqbind(i.win,"blur",function(a){b=!1,i.hasfocus=!1}),i.jqbind(i.win,"mouseenter",function(a){c=i.getTarget(a).id||!0,i.hasmousefocus=!0,i.canshowonmouseevent&&i.noticeCursor()}),i.jqbind(i.win,"mouseleave",function(){c=!1,i.hasmousefocus=!1,i.rail.drag||i.hideCursor()}))}if(i.onkeypress=function(a){if(i.railslocked&&0==i.page.maxh)return!0;a=a?a:window.e;var d=i.getTarget(a);if(d&&/INPUT|TEXTAREA|SELECT|OPTION/.test(d.nodeName)){var e=d.getAttribute("type")||d.type||!1;if(!e||!/submit|button|cancel/i.tp)return!0}if(g(d).attr("contenteditable"))return!0;if(i.hasfocus||i.hasmousefocus&&!b||i.ispage&&!b&&!c){var f=a.keyCode;if(i.railslocked&&27!=f)return i.cancelEvent(a);var h=a.ctrlKey||!1,j=a.shiftKey||!1,k=!1;switch(f){case 38:case 63233:i.doScrollBy(72),k=!0;break;case 40:case 63235:i.doScrollBy(-72),k=!0;break;case 37:case 63232:i.railh&&(h?i.doScrollLeft(0):i.doScrollLeftBy(72),k=!0);break;case 39:case 63234:i.railh&&(h?i.doScrollLeft(i.page.maxw):i.doScrollLeftBy(-72),k=!0);break;case 33:case 63276:i.doScrollBy(i.view.h),k=!0;break;case 34:case 63277:i.doScrollBy(-i.view.h),k=!0;break;case 36:case 63273:i.railh&&h?i.doScrollPos(0,0):i.doScrollTo(0),k=!0;break;case 35:case 63275:i.railh&&h?i.doScrollPos(i.page.maxw,i.page.maxh):i.doScrollTo(i.page.maxh),k=!0;break;case 32:i.opt.spacebarenabled&&(j?i.doScrollBy(i.view.h):i.doScrollBy(-i.view.h),k=!0);break;case 27:i.zoomactive&&(i.doZoom(),k=!0)}if(k)return i.cancelEvent(a)}},i.opt.enablekeyboard&&i.bind(document,r.isopera&&!r.isopera12?"keypress":"keydown",i.onkeypress),i.bind(document,"keydown",function(a){var b=a.ctrlKey||!1;b&&(i.wheelprevented=!0)}),i.bind(document,"keyup",function(a){var b=a.ctrlKey||!1;b||(i.wheelprevented=!1)}),i.bind(window,"blur",function(a){i.wheelprevented=!1}),i.bind(window,"resize",i.lazyResize),i.bind(window,"orientationchange",i.lazyResize),i.bind(window,"load",i.lazyResize),r.ischrome&&!i.ispage&&!i.haswrapper){var B=i.win.attr("style"),C=parseFloat(i.win.css("width"))+1;i.win.css("width",C),i.synched("chromefix",function(){i.win.attr("style",B)})}i.onAttributeChange=function(a){i.lazyResize(i.isieold?250:30)},i.isie11||n===!1||(i.observerbody=new n(function(a){return a.forEach(function(a){return"attributes"==a.type?g("body").hasClass("modal-open")&&g("body").hasClass("modal-dialog")&&!g.contains(g(".modal-dialog")[0],i.doc[0])?i.hide():i.show():void 0}),i.me.clientWidth!=i.page.width||i.me.clientHeight!=i.page.height?i.lazyResize(30):void 0}),i.observerbody.observe(document.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),i.ispage||i.haswrapper||(n!==!1?(i.observer=new n(function(a){a.forEach(i.onAttributeChange)}),i.observer.observe(i.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),i.observerremover=new n(function(a){a.forEach(function(a){if(a.removedNodes.length>0)for(var b in a.removedNodes)if(i&&a.removedNodes[b]==i.win[0])return i.remove()})}),i.observerremover.observe(i.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(i.bind(i.win,r.isie&&!r.isie9?"propertychange":"DOMAttrModified",i.onAttributeChange),r.isie9&&i.win[0].attachEvent("onpropertychange",i.onAttributeChange),i.bind(i.win,"DOMNodeRemoved",function(a){a.target==i.win[0]&&i.remove()}))),!i.ispage&&i.opt.boxzoom&&i.bind(window,"resize",i.resizeZoom),i.istextarea&&(i.bind(i.win,"keydown",i.lazyResize),i.bind(i.win,"mouseup",i.lazyResize)),i.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var D=function(){i.iframexd=!1;var a;try{a="contentDocument"in this?this.contentDocument:this.contentWindow.document;a.domain}catch(c){i.iframexd=!0,a=!1}if(i.iframexd)return"console"in window&&console.log("NiceScroll error: policy restriced iframe"),!0;if(i.forcescreen=!0,i.isiframe&&(i.iframe={doc:g(a),html:i.doc.contents().find("html")[0],body:i.doc.contents().find("body")[0]},i.getContentSize=function(){return{w:Math.max(i.iframe.html.scrollWidth,i.iframe.body.scrollWidth),h:Math.max(i.iframe.html.scrollHeight,i.iframe.body.scrollHeight)}},i.docscroll=g(i.iframe.body)),!r.isios&&i.opt.iframeautoresize&&!i.isiframe){i.win.scrollTop(0),i.doc.height("");var d=Math.max(a.getElementsByTagName("html")[0].scrollHeight,a.body.scrollHeight);i.doc.height(d)}i.lazyResize(30),r.isie7&&i.css(g(i.iframe.html),e),i.css(g(i.iframe.body),e),r.isios&&i.haswrapper&&i.css(g(a.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?i.bind(this.contentWindow,"scroll",i.onscroll):i.bind(a,"scroll",i.onscroll),i.opt.enablemousewheel&&i.mousewheel(a,i.onmousewheel),i.opt.enablekeyboard&&i.bind(a,r.isopera?"keypress":"keydown",i.onkeypress),(r.cantouch||i.opt.touchbehavior)&&(i.bind(a,"mousedown",i.ontouchstart),i.bind(a,"mousemove",function(a){return i.ontouchmove(a,!0)}),i.opt.grabcursorenabled&&r.cursorgrabvalue&&i.css(g(a.body),{cursor:r.cursorgrabvalue})),i.bind(a,"mouseup",i.ontouchend),i.zoom&&(i.opt.dblclickzoom&&i.bind(a,"dblclick",i.doZoom),i.ongesturezoom&&i.bind(a,"gestureend",i.ongesturezoom))};this.doc[0].readyState&&"complete"==this.doc[0].readyState&&setTimeout(function(){D.call(i.doc[0],!1)},500),i.bind(this.doc,"load",D)}},this.showCursor=function(a,b){if(i.cursortimeout&&(clearTimeout(i.cursortimeout),i.cursortimeout=0),i.rail){if(i.autohidedom&&(i.autohidedom.stop().css({opacity:i.opt.cursoropacitymax}),i.cursoractive=!0),i.rail.drag&&1==i.rail.drag.pt||(void 0!==a&&a!==!1&&(i.scroll.y=Math.round(1*a/i.scrollratio.y)),void 0!==b&&(i.scroll.x=Math.round(1*b/i.scrollratio.x))),i.cursor.css({height:i.cursorheight,top:i.scroll.y}),i.cursorh){var c=i.hasreversehr?i.scrollvaluemaxw-i.scroll.x:i.scroll.x;!i.rail.align&&i.rail.visibility?i.cursorh.css({width:i.cursorwidth,left:c+i.rail.width}):i.cursorh.css({width:i.cursorwidth,left:c}),i.cursoractive=!0}i.zoom&&i.zoom.stop().css({opacity:i.opt.cursoropacitymax})}},this.hideCursor=function(a){i.cursortimeout||i.rail&&i.autohidedom&&(i.hasmousefocus&&"leave"==i.opt.autohidemode||(i.cursortimeout=setTimeout(function(){i.rail.active&&i.showonmouseevent||(i.autohidedom.stop().animate({opacity:i.opt.cursoropacitymin}),i.zoom&&i.zoom.stop().animate({opacity:i.opt.cursoropacitymin}),i.cursoractive=!1),i.cursortimeout=0},a||i.opt.hidecursordelay)))},this.noticeCursor=function(a,b,c){i.showCursor(b,c),i.rail.active||i.hideCursor(a)},this.getContentSize=i.ispage?function(){return{w:Math.max(document.body.scrollWidth,document.documentElement.scrollWidth),h:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}}:i.haswrapper?function(){return{w:i.doc.outerWidth()+parseInt(i.win.css("paddingLeft"))+parseInt(i.win.css("paddingRight")),h:i.doc.outerHeight()+parseInt(i.win.css("paddingTop"))+parseInt(i.win.css("paddingBottom"))}}:function(){return{w:i.docscroll[0].scrollWidth,h:i.docscroll[0].scrollHeight}},this.onResize=function(a,b){if(!i||!i.win)return!1;if(!i.haswrapper&&!i.ispage){if("none"==i.win.css("display"))return i.visibility&&i.hideRail().hideRailHr(),!1;i.hidden||i.visibility||i.showRail().showRailHr()}var c=i.page.maxh,d=i.page.maxw,e={h:i.view.h,w:i.view.w};if(i.view={w:i.ispage?i.win.width():parseInt(i.win[0].clientWidth),h:i.ispage?i.win.height():parseInt(i.win[0].clientHeight)},i.page=b?b:i.getContentSize(),i.page.maxh=Math.max(0,i.page.h-i.view.h),i.page.maxw=Math.max(0,i.page.w-i.view.w),i.page.maxh==c&&i.page.maxw==d&&i.view.w==e.w&&i.view.h==e.h){if(i.ispage)return i;var f=i.win.offset();if(i.lastposition){var g=i.lastposition;if(g.top==f.top&&g.left==f.left)return i}i.lastposition=f}if(0==i.page.maxh?(i.hideRail(),i.scrollvaluemax=0,i.scroll.y=0,i.scrollratio.y=0,i.cursorheight=0,i.setScrollTop(0),i.rail&&(i.rail.scrollable=!1)):(i.page.maxh-=i.opt.railpadding.top+i.opt.railpadding.bottom,i.rail.scrollable=!0),0==i.page.maxw?(i.hideRailHr(),i.scrollvaluemaxw=0,i.scroll.x=0,i.scrollratio.x=0,i.cursorwidth=0,i.setScrollLeft(0),i.railh&&(i.railh.scrollable=!1)):(i.page.maxw-=i.opt.railpadding.left+i.opt.railpadding.right,i.railh&&(i.railh.scrollable=i.opt.horizrailenabled)),i.railslocked=i.locked||0==i.page.maxh&&0==i.page.maxw,i.railslocked)return i.ispage||i.updateScrollBar(i.view),!1;i.hidden||i.visibility?!i.railh||i.hidden||i.railh.visibility||i.showRailHr():i.showRail().showRailHr(),i.istextarea&&i.win.css("resize")&&"none"!=i.win.css("resize")&&(i.view.h-=20),i.cursorheight=Math.min(i.view.h,Math.round(i.view.h*(i.view.h/i.page.h))),i.cursorheight=i.opt.cursorfixedheight?i.opt.cursorfixedheight:Math.max(i.opt.cursorminheight,i.cursorheight),i.cursorwidth=Math.min(i.view.w,Math.round(i.view.w*(i.view.w/i.page.w))),i.cursorwidth=i.opt.cursorfixedheight?i.opt.cursorfixedheight:Math.max(i.opt.cursorminheight,i.cursorwidth),i.scrollvaluemax=i.view.h-i.cursorheight-i.cursor.hborder-(i.opt.railpadding.top+i.opt.railpadding.bottom),i.railh&&(i.railh.width=i.page.maxh>0?i.view.w-i.rail.width:i.view.w,i.scrollvaluemaxw=i.railh.width-i.cursorwidth-i.cursorh.wborder-(i.opt.railpadding.left+i.opt.railpadding.right)),i.ispage||i.updateScrollBar(i.view),i.scrollratio={x:i.page.maxw/i.scrollvaluemaxw,y:i.page.maxh/i.scrollvaluemax};var h=i.getScrollTop();return h>i.page.maxh?i.doScrollTop(i.page.maxh):(i.scroll.y=Math.round(i.getScrollTop()*(1/i.scrollratio.y)),i.scroll.x=Math.round(i.getScrollLeft()*(1/i.scrollratio.x)),i.cursoractive&&i.noticeCursor()),i.scroll.y&&0==i.getScrollTop()&&i.doScrollTo(Math.floor(i.scroll.y*i.scrollratio.y)),i},this.resize=i.onResize,this.hlazyresize=0,this.lazyResize=function(a){return i.haswrapper||i.hide(),i.hlazyresize&&clearTimeout(i.hlazyresize),i.hlazyresize=setTimeout(function(){i&&i.show().resize()},240),i},this.jqbind=function(a,b,c){i.events.push({e:a,n:b,f:c,q:!0}),g(a).bind(b,c)},this.mousewheel=function(a,b,c){var d="jquery"in a?a[0]:a;if("onwheel"in document.createElement("div"))i._bind(d,"wheel",b,c||!1);else{var e=void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll";A(d,e,b,c||!1),"DOMMouseScroll"==e&&A(d,"MozMousePixelScroll",b,c||!1)}},r.haseventlistener?(this.bind=function(a,b,c,d){var e="jquery"in a?a[0]:a;i._bind(e,b,c,d||!1)},this._bind=function(a,b,c,d){i.events.push({e:a,n:b,f:c,b:d,q:!1}),a.addEventListener(b,c,d||!1)},this.cancelEvent=function(a){if(!a)return!1;var a=a.original?a.original:a;return a.cancelable&&a.preventDefault(),a.stopPropagation(),a.preventManipulation&&a.preventManipulation(),!1},this.stopPropagation=function(a){if(!a)return!1;var a=a.original?a.original:a;return a.stopPropagation(),!1},this._unbind=function(a,b,c,d){a.removeEventListener(b,c,d)}):(this.bind=function(a,b,c,d){var e="jquery"in a?a[0]:a;i._bind(e,b,function(a){return a=a||window.event||!1,a&&a.srcElement&&(a.target=a.srcElement),"pageY"in a||(a.pageX=a.clientX+document.documentElement.scrollLeft,a.pageY=a.clientY+document.documentElement.scrollTop),c.call(e,a)===!1||d===!1?i.cancelEvent(a):!0})},this._bind=function(a,b,c,d){i.events.push({e:a,n:b,f:c,b:d,q:!1}),a.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c},this.cancelEvent=function(a){var a=window.event||!1;return a?(a.cancelBubble=!0,a.cancel=!0,a.returnValue=!1,!1):!1},this.stopPropagation=function(a){var a=window.event||!1;return a?(a.cancelBubble=!0,!1):!1},this._unbind=function(a,b,c,d){a.detachEvent?a.detachEvent("on"+b,c):a["on"+b]=!1}),this.unbindAll=function(){for(var a=0;a<i.events.length;a++){var b=i.events[a];b.q?b.e.unbind(b.n,b.f):i._unbind(b.e,b.n,b.f,b.b)}},this.showRail=function(){return 0==i.page.maxh||!i.ispage&&"none"==i.win.css("display")||(i.visibility=!0,i.rail.visibility=!0,i.rail.css("display","block")),i},this.showRailHr=function(){return i.railh?(0==i.page.maxw||!i.ispage&&"none"==i.win.css("display")||(i.railh.visibility=!0,i.railh.css("display","block")),i):i},this.hideRail=function(){return i.visibility=!1,i.rail.visibility=!1,i.rail.css("display","none"),i},this.hideRailHr=function(){return i.railh?(i.railh.visibility=!1,i.railh.css("display","none"),i):i},this.show=function(){return i.hidden=!1,i.railslocked=!1,i.showRail().showRailHr()},this.hide=function(){return i.hidden=!0,i.railslocked=!0,i.hideRail().hideRailHr()},this.toggle=function(){return i.hidden?i.show():i.hide()},this.remove=function(){i.stop(),i.cursortimeout&&clearTimeout(i.cursortimeout);for(var a in i.delaylist)i.delaylist[a]&&k(i.delaylist[a].h);i.doZoomOut(),i.unbindAll(),r.isie9&&i.win[0].detachEvent("onpropertychange",i.onAttributeChange),i.observer!==!1&&i.observer.disconnect(),i.observerremover!==!1&&i.observerremover.disconnect(),i.observerbody!==!1&&i.observerbody.disconnect(),i.events=null,i.cursor&&i.cursor.remove(),i.cursorh&&i.cursorh.remove(),i.rail&&i.rail.remove(),i.railh&&i.railh.remove(),i.zoom&&i.zoom.remove();for(var b=0;b<i.saved.css.length;b++){var c=i.saved.css[b];c[0].css(c[1],void 0===c[2]?"":c[2])}i.saved=!1,i.me.data("__nicescroll","");var d=g.nicescroll;d.each(function(a){if(this&&this.id===i.id){delete d[a];for(var b=++a;b<d.length;b++,a++)d[a]=d[b];d.length--,d.length&&delete d[d.length]}});for(var e in i)i[e]=null,delete i[e];i=null},this.scrollstart=function(a){return this.onscrollstart=a,i},this.scrollend=function(a){return this.onscrollend=a,i},this.scrollcancel=function(a){return this.onscrollcancel=a,i},this.zoomin=function(a){return this.onzoomin=a,i},this.zoomout=function(a){return this.onzoomout=a,i},this.isScrollable=function(a){var b=a.target?a.target:a;if("OPTION"==b.nodeName)return!0;for(;b&&1==b.nodeType&&!/^BODY|HTML/.test(b.nodeName);){var c=g(b),d=c.css("overflowY")||c.css("overflowX")||c.css("overflow")||"";if(/scroll|auto/.test(d))return b.clientHeight!=b.scrollHeight;b=b.parentNode?b.parentNode:!1}return!1},this.getViewport=function(a){for(var b=a&&a.parentNode?a.parentNode:!1;b&&1==b.nodeType&&!/^BODY|HTML/.test(b.nodeName);){var c=g(b);if(/fixed|absolute/.test(c.css("position")))return c;var d=c.css("overflowY")||c.css("overflowX")||c.css("overflow")||"";if(/scroll|auto/.test(d)&&b.clientHeight!=b.scrollHeight)return c;if(c.getNiceScroll().length>0)return c;b=b.parentNode?b.parentNode:!1}return!1},this.triggerScrollEnd=function(){if(i.onscrollend){var a=i.getScrollLeft(),b=i.getScrollTop(),c={type:"scrollend",current:{x:a,y:b},end:{x:a,y:b}};i.onscrollend.call(i,c)}},this.onmousewheel=function(a){if(!i.wheelprevented){if(i.railslocked)return i.debounced("checkunlock",i.resize,250),!0;if(i.rail.drag)return i.cancelEvent(a);if("auto"==i.opt.oneaxismousemode&&0!=a.deltaX&&(i.opt.oneaxismousemode=!1),i.opt.oneaxismousemode&&0==a.deltaX&&!i.rail.scrollable)return i.railh&&i.railh.scrollable?i.onmousewheelhr(a):!0;var b=+new Date,c=!1;if(i.opt.preservenativescrolling&&i.checkarea+600<b&&(i.nativescrollingarea=i.isScrollable(a),c=!0),i.checkarea=b,i.nativescrollingarea)return!0;var d=B(a,!1,c);return d&&(i.checkarea=0),d}},this.onmousewheelhr=function(a){if(!i.wheelprevented){if(i.railslocked||!i.railh.scrollable)return!0;if(i.rail.drag)return i.cancelEvent(a);var b=+new Date,c=!1;return i.opt.preservenativescrolling&&i.checkarea+600<b&&(i.nativescrollingarea=i.isScrollable(a),c=!0),i.checkarea=b,i.nativescrollingarea?!0:i.railslocked?i.cancelEvent(a):B(a,!0,c)}},this.stop=function(){return i.cancelScroll(),i.scrollmon&&i.scrollmon.stop(),i.cursorfreezed=!1,i.scroll.y=Math.round(i.getScrollTop()*(1/i.scrollratio.y)),i.noticeCursor(),i},this.getTransitionSpeed=function(a){var b=Math.round(10*i.opt.scrollspeed),c=Math.min(b,Math.round(a/20*i.opt.scrollspeed));return c>20?c:0},i.opt.smoothscroll?i.ishwscroll&&r.hastransition&&i.opt.usetransition&&i.opt.smoothscroll?(this.prepareTransition=function(a,b){var c=b?a>20?a:0:i.getTransitionSpeed(a),d=c?r.prefixstyle+"transform "+c+"ms ease-out":"";return i.lasttransitionstyle&&i.lasttransitionstyle==d||(i.lasttransitionstyle=d,i.doc.css(r.transitionstyle,d)),c},this.doScrollLeft=function(a,b){var c=i.scrollrunning?i.newscrolly:i.getScrollTop();i.doScrollPos(a,c,b)},this.doScrollTop=function(a,b){var c=i.scrollrunning?i.newscrollx:i.getScrollLeft();i.doScrollPos(c,a,b)},this.doScrollPos=function(a,b,c){var d=i.getScrollTop(),e=i.getScrollLeft();return((i.newscrolly-d)*(b-d)<0||(i.newscrollx-e)*(a-e)<0)&&i.cancelScroll(),0==i.opt.bouncescroll&&(0>b?b=0:b>i.page.maxh&&(b=i.page.maxh),0>a?a=0:a>i.page.maxw&&(a=i.page.maxw)),i.scrollrunning&&a==i.newscrollx&&b==i.newscrolly?!1:(i.newscrolly=b,i.newscrollx=a,i.newscrollspeed=c||!1,i.timer?!1:void(i.timer=setTimeout(function(){var c=i.getScrollTop(),d=i.getScrollLeft(),e={};e.x=a-d,e.y=b-c,e.px=d,e.py=c;var f=Math.round(Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))),g=i.newscrollspeed&&i.newscrollspeed>1?i.newscrollspeed:i.getTransitionSpeed(f);if(i.newscrollspeed&&i.newscrollspeed<=1&&(g*=i.newscrollspeed),i.prepareTransition(g,!0),i.timerscroll&&i.timerscroll.tm&&clearInterval(i.timerscroll.tm),g>0){if(!i.scrollrunning&&i.onscrollstart){var h={type:"scrollstart",current:{x:d,y:c},request:{x:a,y:b},end:{x:i.newscrollx,y:i.newscrolly},speed:g};i.onscrollstart.call(i,h)}r.transitionend?i.scrollendtrapped||(i.scrollendtrapped=!0,i.bind(i.doc,r.transitionend,i.onScrollTransitionEnd,!1)):(i.scrollendtrapped&&clearTimeout(i.scrollendtrapped),i.scrollendtrapped=setTimeout(i.onScrollTransitionEnd,g));var j=c,k=d;i.timerscroll={bz:new u(j,i.newscrolly,g,0,0,.58,1),bh:new u(k,i.newscrollx,g,0,0,.58,1)},i.cursorfreezed||(i.timerscroll.tm=setInterval(function(){i.showCursor(i.getScrollTop(),i.getScrollLeft())},60))}i.synched("doScroll-set",function(){i.timer=0,i.scrollendtrapped&&(i.scrollrunning=!0),i.setScrollTop(i.newscrolly),i.setScrollLeft(i.newscrollx),i.scrollendtrapped||i.onScrollTransitionEnd()})},50)))},this.cancelScroll=function(){if(!i.scrollendtrapped)return!0;var a=i.getScrollTop(),b=i.getScrollLeft();return i.scrollrunning=!1,r.transitionend||clearTimeout(r.transitionend),i.scrollendtrapped=!1,i._unbind(i.doc[0],r.transitionend,i.onScrollTransitionEnd),i.prepareTransition(0),i.setScrollTop(a),i.railh&&i.setScrollLeft(b),i.timerscroll&&i.timerscroll.tm&&clearInterval(i.timerscroll.tm),i.timerscroll=!1,i.cursorfreezed=!1,i.showCursor(a,b),i},this.onScrollTransitionEnd=function(){i.scrollendtrapped&&i._unbind(i.doc[0],r.transitionend,i.onScrollTransitionEnd),i.scrollendtrapped=!1,i.prepareTransition(0),i.timerscroll&&i.timerscroll.tm&&clearInterval(i.timerscroll.tm),i.timerscroll=!1;var a=i.getScrollTop(),b=i.getScrollLeft();return i.setScrollTop(a),i.railh&&i.setScrollLeft(b),i.noticeCursor(!1,a,b),i.cursorfreezed=!1,0>a?a=0:a>i.page.maxh&&(a=i.page.maxh),0>b?b=0:b>i.page.maxw&&(b=i.page.maxw),a!=i.newscrolly||b!=i.newscrollx?i.doScrollPos(b,a,i.opt.snapbackspeed):(i.onscrollend&&i.scrollrunning&&i.triggerScrollEnd(),void(i.scrollrunning=!1))}):(this.doScrollLeft=function(a,b){var c=i.scrollrunning?i.newscrolly:i.getScrollTop();i.doScrollPos(a,c,b)},this.doScrollTop=function(a,b){var c=i.scrollrunning?i.newscrollx:i.getScrollLeft();i.doScrollPos(c,a,b)},this.doScrollPos=function(a,b,c){function n(){if(i.cancelAnimationFrame)return!0;if(i.scrollrunning=!0,m=1-m)return i.timer=j(n)||1;var b,c,a=0,d=c=i.getScrollTop();if(i.dst.ay){d=i.bzscroll?i.dst.py+i.bzscroll.getNow()*i.dst.ay:i.newscrolly;var e=d-c;(0>e&&d<i.newscrolly||e>0&&d>i.newscrolly)&&(d=i.newscrolly),i.setScrollTop(d),d==i.newscrolly&&(a=1)}else a=1;var f=b=i.getScrollLeft();if(i.dst.ax){f=i.bzscroll?i.dst.px+i.bzscroll.getNow()*i.dst.ax:i.newscrollx;var e=f-b;(0>e&&f<i.newscrollx||e>0&&f>i.newscrollx)&&(f=i.newscrollx),i.setScrollLeft(f),f==i.newscrollx&&(a+=1)}else a+=1;2==a?(i.timer=0,i.cursorfreezed=!1,i.bzscroll=!1,i.scrollrunning=!1,0>d?d=0:d>i.page.maxh&&(d=Math.max(0,i.page.maxh)),0>f?f=0:f>i.page.maxw&&(f=i.page.maxw),f!=i.newscrollx||d!=i.newscrolly?i.doScrollPos(f,d):i.onscrollend&&i.triggerScrollEnd()):i.timer=j(n)||1}var b=void 0===b||b===!1?i.getScrollTop(!0):b;if(i.timer&&i.newscrolly==b&&i.newscrollx==a)return!0;i.timer&&k(i.timer),i.timer=0;var d=i.getScrollTop(),e=i.getScrollLeft();((i.newscrolly-d)*(b-d)<0||(i.newscrollx-e)*(a-e)<0)&&i.cancelScroll(),i.newscrolly=b,i.newscrollx=a,i.bouncescroll&&i.rail.visibility||(i.newscrolly<0?i.newscrolly=0:i.newscrolly>i.page.maxh&&(i.newscrolly=i.page.maxh)),i.bouncescroll&&i.railh.visibility||(i.newscrollx<0?i.newscrollx=0:i.newscrollx>i.page.maxw&&(i.newscrollx=i.page.maxw)),i.dst={},i.dst.x=a-e,i.dst.y=b-d,i.dst.px=e,i.dst.py=d;var f=Math.round(Math.sqrt(Math.pow(i.dst.x,2)+Math.pow(i.dst.y,2)));i.dst.ax=i.dst.x/f,i.dst.ay=i.dst.y/f;var g=0,h=f;0==i.dst.x?(g=d,h=b,i.dst.ay=1,i.dst.py=0):0==i.dst.y&&(g=e,h=a,i.dst.ax=1,i.dst.px=0);var l=i.getTransitionSpeed(f);if(c&&1>=c&&(l*=c),l>0?i.bzscroll=i.bzscroll?i.bzscroll.update(h,l):new u(g,h,l,0,1,0,1):i.bzscroll=!1,!i.timer){(d==i.page.maxh&&b>=i.page.maxh||e==i.page.maxw&&a>=i.page.maxw)&&i.checkContentSize();var m=1;if(i.cancelAnimationFrame=!1,i.timer=1,i.onscrollstart&&!i.scrollrunning){var o={type:"scrollstart",current:{x:e,y:d},request:{x:a,y:b},end:{x:i.newscrollx,y:i.newscrolly},speed:l};i.onscrollstart.call(i,o)}n(),(d==i.page.maxh&&b>=d||e==i.page.maxw&&a>=e)&&i.checkContentSize(),i.noticeCursor()}},this.cancelScroll=function(){return i.timer&&k(i.timer),i.timer=0,i.bzscroll=!1,i.scrollrunning=!1,i}):(this.doScrollLeft=function(a,b){var c=i.getScrollTop();i.doScrollPos(a,c,b)},this.doScrollTop=function(a,b){var c=i.getScrollLeft();i.doScrollPos(c,a,b)},this.doScrollPos=function(a,b,c){var d=a>i.page.maxw?i.page.maxw:a;0>d&&(d=0);var e=b>i.page.maxh?i.page.maxh:b;0>e&&(e=0),i.synched("scroll",function(){i.setScrollTop(e),i.setScrollLeft(d)})},this.cancelScroll=function(){}),this.doScrollBy=function(a,b){var c=0;if(b)c=Math.floor((i.scroll.y-a)*i.scrollratio.y);else{var d=i.timer?i.newscrolly:i.getScrollTop(!0);c=d-a}if(i.bouncescroll){var e=Math.round(i.view.h/2);-e>c?c=-e:c>i.page.maxh+e&&(c=i.page.maxh+e)}i.cursorfreezed=!1;var f=i.getScrollTop(!0);return 0>c&&0>=f?i.noticeCursor():c>i.page.maxh&&f>=i.page.maxh?(i.checkContentSize(),i.noticeCursor()):void i.doScrollTop(c)},this.doScrollLeftBy=function(a,b){var c=0;if(b)c=Math.floor((i.scroll.x-a)*i.scrollratio.x);else{var d=i.timer?i.newscrollx:i.getScrollLeft(!0);c=d-a}if(i.bouncescroll){var e=Math.round(i.view.w/2);-e>c?c=-e:c>i.page.maxw+e&&(c=i.page.maxw+e)}i.cursorfreezed=!1;var f=i.getScrollLeft(!0);return 0>c&&0>=f?i.noticeCursor():c>i.page.maxw&&f>=i.page.maxw?i.noticeCursor():void i.doScrollLeft(c)},this.doScrollTo=function(a,b){var c=b?Math.round(a*i.scrollratio.y):a;0>c?c=0:c>i.page.maxh&&(c=i.page.maxh),i.cursorfreezed=!1,i.doScrollTop(a)},this.checkContentSize=function(){var a=i.getContentSize();(a.h!=i.page.h||a.w!=i.page.w)&&i.resize(!1,a)},i.onscroll=function(a){i.rail.drag||i.cursorfreezed||i.synched("scroll",function(){i.scroll.y=Math.round(i.getScrollTop()*(1/i.scrollratio.y)),i.railh&&(i.scroll.x=Math.round(i.getScrollLeft()*(1/i.scrollratio.x))),i.noticeCursor()})},i.bind(i.docscroll,"scroll",i.onscroll),this.doZoomIn=function(a){if(!i.zoomactive){i.zoomactive=!0,i.zoomrestore={style:{}};var b=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],c=i.win[0].style;for(var d in b){var e=b[d];i.zoomrestore.style[e]=void 0!==c[e]?c[e]:""}i.zoomrestore.style.width=i.win.css("width"),i.zoomrestore.style.height=i.win.css("height"),i.zoomrestore.padding={w:i.win.outerWidth()-i.win.width(),h:i.win.outerHeight()-i.win.height()},r.isios4&&(i.zoomrestore.scrollTop=g(window).scrollTop(),g(window).scrollTop(0)),i.win.css({position:r.isios4?"absolute":"fixed",top:0,left:0,zIndex:f+100,margin:0});var h=i.win.css("backgroundColor");return(""==h||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(h))&&i.win.css("backgroundColor","#fff"),i.rail.css({zIndex:f+101}),i.zoom.css({zIndex:f+102}),i.zoom.css("backgroundPosition","0px -18px"),i.resizeZoom(),i.onzoomin&&i.onzoomin.call(i),i.cancelEvent(a)}},this.doZoomOut=function(a){return i.zoomactive?(i.zoomactive=!1,i.win.css("margin",""),i.win.css(i.zoomrestore.style),r.isios4&&g(window).scrollTop(i.zoomrestore.scrollTop),i.rail.css({"z-index":i.zindex}),i.zoom.css({"z-index":i.zindex}),i.zoomrestore=!1,i.zoom.css("backgroundPosition","0px 0px"),i.onResize(),i.onzoomout&&i.onzoomout.call(i),i.cancelEvent(a)):void 0},this.doZoom=function(a){return i.zoomactive?i.doZoomOut(a):i.doZoomIn(a)},this.resizeZoom=function(){if(i.zoomactive){var a=i.getScrollTop();i.win.css({width:g(window).width()-i.zoomrestore.padding.w+"px",height:g(window).height()-i.zoomrestore.padding.h+"px"}),i.onResize(),i.setScrollTop(Math.min(i.page.maxh,a))}},this.init(),g.nicescroll.push(this)},s=function(a){var b=this;this.nc=a,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.time=function(){return+new Date},this.reset=function(a,c){b.stop();var d=b.time();b.steptime=0,b.lasttime=d,b.speedx=0,b.speedy=0,b.lastx=a,b.lasty=c,b.lastscrollx=-1,b.lastscrolly=-1},this.update=function(a,c){var d=b.time();b.steptime=d-b.lasttime,b.lasttime=d;var e=c-b.lasty,f=a-b.lastx,g=b.nc.getScrollTop(),h=b.nc.getScrollLeft(),i=g+e,j=h+f;b.snapx=0>j||j>b.nc.page.maxw,b.snapy=0>i||i>b.nc.page.maxh,b.speedx=f,b.speedy=e,b.lastx=a,b.lasty=c},this.stop=function(){b.nc.unsynched("domomentum2d"),b.timer&&clearTimeout(b.timer),b.timer=0,b.lastscrollx=-1,b.lastscrolly=-1},this.doSnapy=function(a,c){var d=!1;0>c?(c=0,d=!0):c>b.nc.page.maxh&&(c=b.nc.page.maxh,d=!0),0>a?(a=0,d=!0):a>b.nc.page.maxw&&(a=b.nc.page.maxw,d=!0),d?b.nc.doScrollPos(a,c,b.nc.opt.snapbackspeed):b.nc.triggerScrollEnd()},this.doMomentum=function(a){var c=b.time(),d=a?c+a:b.lasttime,e=b.nc.getScrollLeft(),f=b.nc.getScrollTop(),g=b.nc.page.maxh,h=b.nc.page.maxw;b.speedx=h>0?Math.min(60,b.speedx):0,b.speedy=g>0?Math.min(60,b.speedy):0;var i=d&&60>=c-d;(0>f||f>g||0>e||e>h)&&(i=!1);var j=b.speedy&&i?b.speedy:!1,k=b.speedx&&i?b.speedx:!1;if(j||k){var l=Math.max(16,b.steptime);if(l>50){var m=l/50;b.speedx*=m,b.speedy*=m,l=50}b.demulxy=0,b.lastscrollx=b.nc.getScrollLeft(),b.chkx=b.lastscrollx,b.lastscrolly=b.nc.getScrollTop(),b.chky=b.lastscrolly;var n=b.lastscrollx,o=b.lastscrolly,p=function(){var a=b.time()-c>600?.04:.02;b.speedx&&(n=Math.floor(b.lastscrollx-b.speedx*(1-b.demulxy)),b.lastscrollx=n,(0>n||n>h)&&(a=.1)),b.speedy&&(o=Math.floor(b.lastscrolly-b.speedy*(1-b.demulxy)),b.lastscrolly=o,(0>o||o>g)&&(a=.1)),b.demulxy=Math.min(1,b.demulxy+a),b.nc.synched("domomentum2d",function(){if(b.speedx){b.nc.getScrollLeft();b.chkx=n,b.nc.setScrollLeft(n)}if(b.speedy){b.nc.getScrollTop();b.chky=o,b.nc.setScrollTop(o)}b.timer||(b.nc.hideCursor(),b.doSnapy(n,o))}),b.demulxy<1?b.timer=setTimeout(p,l):(b.stop(),b.nc.hideCursor(),b.doSnapy(n,o))};p()}else b.doSnapy(b.nc.getScrollLeft(),b.nc.getScrollTop())}},t=a.fn.scrollTop;a.cssHooks.pageYOffset={get:function(a,b,c){var d=g.data(a,"__nicescroll")||!1;return d&&d.ishwscroll?d.getScrollTop():t.call(a)},set:function(a,b){var c=g.data(a,"__nicescroll")||!1;return c&&c.ishwscroll?c.setScrollTop(parseInt(b)):t.call(a,b),this}},a.fn.scrollTop=function(a){if(void 0===a){var b=this[0]?g.data(this[0],"__nicescroll")||!1:!1;return b&&b.ishwscroll?b.getScrollTop():t.call(this)}return this.each(function(){var b=g.data(this,"__nicescroll")||!1;b&&b.ishwscroll?b.setScrollTop(parseInt(a)):t.call(g(this),a)})};var u=a.fn.scrollLeft;g.cssHooks.pageXOffset={get:function(a,b,c){var d=g.data(a,"__nicescroll")||!1;return d&&d.ishwscroll?d.getScrollLeft():u.call(a)},set:function(a,b){var c=g.data(a,"__nicescroll")||!1;return c&&c.ishwscroll?c.setScrollLeft(parseInt(b)):u.call(a,b),this}},a.fn.scrollLeft=function(a){if(void 0===a){var b=this[0]?g.data(this[0],"__nicescroll")||!1:!1;return b&&b.ishwscroll?b.getScrollLeft():u.call(this)}return this.each(function(){var b=g.data(this,"__nicescroll")||!1;b&&b.ishwscroll?b.setScrollLeft(parseInt(a)):u.call(g(this),a)})};var v=function(a){var b=this;if(this.length=0,this.name="nicescrollarray",this.each=function(a){return g.each(b,a),b},this.push=function(a){b[b.length]=a,b.length++},this.eq=function(a){return b[a]},a)for(var c=0;c<a.length;c++){var d=g.data(a[c],"__nicescroll")||!1;d&&(this[this.length]=d,this.length++)}return this};w(v.prototype,["show","hide","toggle","onResize","resize","remove","stop","doScrollPos"],function(a,b){a[b]=function(){var a=arguments;return this.each(function(){this[b].apply(this,a)})}}),a.fn.getNiceScroll=function(a){return void 0===a?new v(this):this[a]&&g.data(this[a],"__nicescroll")||!1},a.expr[":"].nicescroll=function(a){return void 0!==g.data(a,"__nicescroll")},g.fn.niceScroll=function(a,b){void 0!==b||"object"!=typeof a||"jquery"in a||(b=a,a=!1),b=g.extend({},b);var c=new v;void 0===b&&(b={}),a&&(b.doc=g(a),b.win=g(this));var d=!("doc"in b);return d||"win"in b||(b.win=g(this)),this.each(function(){var a=g(this).data("__nicescroll")||!1;a||(b.doc=d?g(this):b.doc,a=new r(b,g(this)),g(this).data("__nicescroll",a)),c.push(a)}),1==c.length?c[0]:c},window.NiceScroll={getjQuery:function(){return a}},g.nicescroll||(g.nicescroll=new v,g.nicescroll.options=o)});