text: (function(e,t){e("JC.Scrollbar",["JC.BaseMVC"],function(){function e(t){t&&(t=$(t));if(e.getInstance(t))return e.getInstance(t);e.getInstance(t,this),this._model=new e.Model(t),this._view=new e.View(this._model),this._init()}return JC.Scrollbar=e,e.getInstance=function(t,n){typeof t=="string"&&!/</.test(t)&&(t=$(t));if(!t||!t.length||typeof t=="string")return;return typeof n!="undefined"&&t.data(e.Model._instanceName,n),t.data(e.Model._instanceName)},e.init=function(t){var n=[];return t=$(t||document),t.length&&(t.hasClass("js_compScrollbar")?n.push(new e(t)):t.find(".js_compScrollbar").each(function(){n.push(new e(this))})),n},BaseMVC.build(e),JC.f.extendObject(e.prototype,{_beforeInit:function(){var e=this,t=e._model.selector();e._model.containerHeight=t.prop("offsetHeight"),e._model.contentHeight=t.prop("scrollHeight"),e._model.containerWidth=t.prop("offsetWidth"),e._model.contentWidth=t.prop("scrollWidth"),e._model.contentXRatio=e._model.containerWidth/e._model.contentWidth,e._model.contentYRatio=e._model.containerHeight/e._model.contentHeight,e._model.trackXRatio=e._model.contentWidth/e._model.containerWidth,e._model.trackYRatio=e._model.contentHeight/e._model.containerHeight,e._model.trackXWidth=e._model.containerWidth,e._model.trackYHeight=e._model.containerHeight,e._model.thumbXWidth=e._model.containerWidth*e._model.contentXRatio,e._model.thumbYHeight=e._model.containerHeight*e._model.contentYRatio,e._model.maxTop=e._model.containerHeight-e._model.thumbYHeight,e._model.maxLeft=e._model.containerWidth-e._model.thumbXWidth},_initHanlderEvent:function(){var e=this,t=e._model.selector();e.on("COMPScrollbarUpdate",function(){$('<div class="COMP_trackX"><div class="COMP_thumbX"></div></div><div class="COMP_trackY"><div class="COMP_thumbY"></div></div>').appendTo(e._model.selector()),e._model.setSize(),e._model.contentXRatio<1&&e._scrollXHanlderEvent(),e._model.contentYRatio<1&&e._scrollYHanlderEvent(),e._model.wheelEvent()&&(window.addEventListener?(e._model.selector()[0].addEventListener("mousewheel",function(t){e._model.wheel(t)},!1),e._model.selector()[0].addEventListener("DOMMouseScroll",function(t){e._model.wheel(t)},!1)):e._model.selector()[0].onmousewheel=function(t){e._model.wheel(t||window.event)})})},_scrollXHanlderEvent:function(){var e=this,t=!1;e._model.thumbX().on("mousedown",function(n){t=!0,e._model.curPageX=n.pageX,e._model.curLeft=e._model.thumbX().position().left,n.stopPropagation(),n.preventDefault()}),$(document).on("mousemove",function(n){t&&(e._model.updateContentScrollLeft(n.pageX),n.stopPropagation(),n.preventDefault())}),$(document).on("mouseup",function(e){t=!1,e.stopPropagation(),e.preventDefault()})},_scrollYHanlderEvent:function(){var e=this,t=!1;e._model.thumbY().on("mousedown",function(n){t=!0,e._model.curPageY=n.pageY,e._model.curTop=e._model.thumbY().position().top,n.stopPropagation(),n.preventDefault()}),$(document).on("mousemove",function(n){t&&(e._model.updateContentScrollTop(n.pageY),n.stopPropagation(),n.preventDefault())}),$(document).on("mouseup",function(e){t=!1,e.stopPropagation(),e.preventDefault()})},_inited:function(){var e=$(this);e.trigger("COMPScrollbarUpdate")},update:function(){}}),e.Model._instanceName="Scrollbar",JC.f.extendObject(e.Model.prototype,{init:function(){},containerWidth:0,containerHeight:0,contentWidth:0,contentHeight:0,contentXRatio:0,contentYRatio:0,trackXWidth:0,trackYHeight:0,trackXRatio:0,trackYRatio:0,thumbXWidth:0,thumbYHeight:0,maxTop:0,maxLeft:0,curPageX:0,curPageY:0,contentXPosition:0,contentYPosition:0,xRailActive:function(){var e=this,t=!1;return!e.disabledXrail()&&e.contentXRatio<1&&(t=!0),t},yRailActive:function(){var e=this,t=!1;return!e.disabledYrail()&&e.contentYRatio<1&&(t=!0),t},trackX:function(){return this.selector().find(".COMP_trackX")},trackY:function(){return this.selector().find(".COMP_trackY")},thumbX:function(){return this.selector().find(".COMP_thumbX")},thumbY:function(){return this.selector().find(".COMP_thumbY")},bothWheel:function(){return this.boolProp("scrollbarbothwheel")},wheelEvent:function(){var e=this.is("[scrollbarwheelevent]"),t;return e?this.boolProp("scrollbarwheelevent"):!0},wheelSpeed:function(){return this.intProp("scrollbarwheelspeed")||40},disabledXrail:function(){return this.boolProp("disabledxscrollbar")},disabledYrail:function(){return this.boolProp("disabledyscrollbar")},setSize:function(){var e=this;e.trackX().css({width:e.trackXWidth,display:e.xRailActive()?"block":"none"}),e.thumbX().css({width:e.thumbXWidth}),e.trackY().css({height:e.trackYHeight,display:e.yRailActive()?"block":"none"}),e.thumbY().css({height:e.thumbYHeight})},wheel:function(e){var t=this,n=t.wheelSpeed(),r=0;r=e.wheelDelta?e.wheelDelta/120*n:-e.detail/3*n,t.bothWheel()?(t.contentYPosition-=r,t.contentXPosition-=r,t.contentYPosition=Math.min(t.contentHeight-t.containerHeight,Math.max(0,t.contentYPosition)),t.contentXPosition=Math.min(t.contentWidth-t.containerWidth,Math.max(0,t.contentXPosition))):t.contentYRatio<1&&!t.disabledYrail()?(t.contentYPosition-=r,t.contentYPosition=Math.min(t.contentHeight-t.containerHeight,Math.max(0,t.contentYPosition)),t.contentXPosition=0):t.contentXRatio<1&&!t.disabledXrail()&&(t.contentXPosition-=r,t.contentXPosition=Math.min(t.contentWidth-t.containerWidth,Math.max(0,t.contentXPosition)),t.contentYPosition=0),t.selector().scrollTop(t.contentYPosition),t.selector().scrollLeft(t.contentXPosition),t.updateScrollBar(),e=$.event.fix(e),e.preventDefault()},updateScrollBar:function(){var e=this;e.trackY().css({top:e.contentYPosition,right:e.contentXRatio<1?-e.contentXPosition:0}),e.thumbY().css({top:e.contentYPosition/e.trackYRatio}),e.trackX().css({left:e.contentXPosition,bottom:e.contentYRatio<1?-e.contentYPosition:0}),e.thumbX().css({left:e.contentXPosition/e.trackXRatio})},updateContentScrollTop:function(e){var t=this,n=e-t.curPageY,r;r=Math.min(t.maxTop,Math.max(0,t.curTop+n)),t.contentYPosition=r*t.trackYRatio,t.selector().scrollTop(t.contentYPosition),t.updateScrollBar()},updateContentScrollLeft:function(e){var t=this,n=e-t.curPageX,r;r=Math.min(t.maxLeft,Math.max(0,t.curLeft+n)),t.contentXPosition=r*t.trackXRatio,t.selector().scrollLeft(t.contentXPosition),t.updateScrollBar()}}),JC.f.extendObject(e.View.prototype,{update:function(){}}),$(document).ready(function(){var t=0;e.autoInit&&(t=e.init())}),JC.Scrollbar})})(typeof define=="function"&&define.amd?define:function(e,t,n){typeof e=="function"&&(n=e),typeof t=="function"&&(n=t),n&&n()},window);