define("taoCe/controller/home/custom-scrollbar",["jquery"],function(jQuery){!function($){$.fn.customScrollbar=function(options,args){var defaultOptions={skin:void 0,hScroll:!0,vScroll:!0,updateOnWindowResize:!1,animationSpeed:300,onCustomScroll:void 0,swipeSpeed:1,wheelSpeed:40,fixedThumbWidth:void 0,fixedThumbHeight:void 0,preventDefaultScroll:!1},Scrollable=function(element,options){this.$element=$(element),this.options=options,this.addScrollableClass(),this.addSkinClass(),this.addScrollBarComponents(),this.options.vScroll&&(this.vScrollbar=new Scrollbar(this,new VSizing)),this.options.hScroll&&(this.hScrollbar=new Scrollbar(this,new HSizing)),this.$element.data("scrollable",this), this.initKeyboardScrolling(),this.bindEvents()};Scrollable.prototype={addScrollableClass:function(){this.$element.hasClass("scrollable")||(this.scrollableAdded=!0,this.$element.addClass("scrollable"))},removeScrollableClass:function(){this.scrollableAdded&&this.$element.removeClass("scrollable")},addSkinClass:function(){"string"!=typeof this.options.skin||this.$element.hasClass(this.options.skin)||(this.skinClassAdded=!0,this.$element.addClass(this.options.skin))},removeSkinClass:function(){this.skinClassAdded&&this.$element.removeClass(this.options.skin)},addScrollBarComponents:function(){this.assignViewPort(),0==this.$viewPort.length&&(this.$element.wrapInner('
'), this.assignViewPort(),this.viewPortAdded=!0),this.assignOverview(),0==this.$overview.length&&(this.$viewPort.wrapInner(''),this.assignOverview(),this.overviewAdded=!0),this.addScrollBar("vertical","prepend"),this.addScrollBar("horizontal","append")},removeScrollbarComponents:function(){this.removeScrollbar("vertical"),this.removeScrollbar("horizontal"),this.overviewAdded&&this.$element.unwrap(),this.viewPortAdded&&this.$element.unwrap()},removeScrollbar:function(orientation){this[orientation+"ScrollbarAdded"]&&this.$element.find(".scroll-bar."+orientation).remove()},assignViewPort:function(){this.$viewPort=this.$element.find(".viewport"); },assignOverview:function(){this.$overview=this.$viewPort.find(".overview")},addScrollBar:function(orientation,fun){0==this.$element.find(".scroll-bar."+orientation).length&&(this.$element[fun](" "),this[orientation+"ScrollbarAdded"]=!0)},resize:function(keepPosition){this.vScrollbar&&this.vScrollbar.resize(keepPosition),this.hScrollbar&&this.hScrollbar.resize(keepPosition)},scrollTo:function(element){this.vScrollbar&&this.vScrollbar.scrollToElement(element),this.hScrollbar&&this.hScrollbar.scrollToElement(element)},scrollToXY:function(x,y){this.scrollToX(x),this.scrollToY(y)},scrollToX:function(x){ this.hScrollbar&&this.hScrollbar.scrollOverviewTo(x,!0)},scrollToY:function(y){this.vScrollbar&&this.vScrollbar.scrollOverviewTo(y,!0)},scrollByX:function(x){this.hScrollbar&&this.scrollToX(this.hScrollbar.overviewPosition()+x)},scrollByY:function(y){this.vScrollbar&&this.scrollToY(this.vScrollbar.overviewPosition()+y)},remove:function(){this.removeScrollableClass(),this.removeSkinClass(),this.removeScrollbarComponents(),this.$element.data("scrollable",null),this.removeKeyboardScrolling(),this.vScrollbar&&this.vScrollbar.remove(),this.hScrollbar&&this.hScrollbar.remove()},setAnimationSpeed:function(speed){this.options.animationSpeed=speed},isInside:function(element,wrappingElement){ var $element=$(element),$wrappingElement=$(wrappingElement),elementOffset=$element.offset(),wrappingElementOffset=$wrappingElement.offset();return elementOffset.top>=wrappingElementOffset.top&&elementOffset.left>=wrappingElementOffset.left&&elementOffset.top+$element.height()<=wrappingElementOffset.top+$wrappingElement.height()&&elementOffset.left+$element.width()<=wrappingElementOffset.left+$wrappingElement.width()},initKeyboardScrolling:function(){var _this=this;this.elementKeydown=function(event){document.activeElement===_this.$element[0]&&(_this.vScrollbar&&_this.vScrollbar.keyScroll(event),_this.hScrollbar&&_this.hScrollbar.keyScroll(event))},this.$element.attr("tabindex","-1").keydown(this.elementKeydown); },removeKeyboardScrolling:function(){this.$element.removeAttr("tabindex").unbind("keydown",this.elementKeydown)},bindEvents:function(){this.options.onCustomScroll&&this.$element.on("customScroll",this.options.onCustomScroll)}};var Scrollbar=function(scrollable,sizing){this.scrollable=scrollable,this.sizing=sizing,this.$scrollBar=this.sizing.scrollBar(this.scrollable.$element),this.$thumb=this.$scrollBar.find(".thumb"),this.setScrollPosition(0,0),this.resize(),this.initMouseMoveScrolling(),this.initMouseWheelScrolling(),this.initTouchScrolling(),this.initMouseClickScrolling(),this.initWindowResize()};Scrollbar.prototype={resize:function(keepPosition){this.overviewSize=this.sizing.size(this.scrollable.$overview), this.calculateViewPortSize(),this.sizing.size(this.scrollable.$viewPort,this.viewPortSize),this.ratio=this.viewPortSize/this.overviewSize,this.sizing.size(this.$scrollBar,this.viewPortSize),this.thumbSize=this.calculateThumbSize(),this.sizing.size(this.$thumb,this.thumbSize),this.maxThumbPosition=this.calculateMaxThumbPosition(),this.maxOverviewPosition=this.calculateMaxOverviewPosition(),this.enabled=this.overviewSize>this.viewPortSize,void 0===this.scrollPercent&&(this.scrollPercent=0),this.enabled?this.rescroll(keepPosition):this.setScrollPosition(0,0),this.$scrollBar.toggle(this.enabled)},calculateViewPortSize:function(){var elementSize=this.sizing.size(this.scrollable.$element); if(elementSize>0&&!this.maxSizeUsed)this.viewPortSize=elementSize,this.maxSizeUsed=!1;else{var maxSize=this.sizing.maxSize(this.scrollable.$element);this.viewPortSize=Math.min(maxSize,this.overviewSize),this.maxSizeUsed=!0}},calculateThumbSize:function(){var size,fixedSize=this.sizing.fixedThumbSize(this.scrollable.options);return size=fixedSize?fixedSize:this.ratio*this.viewPortSize,Math.max(size,this.sizing.minSize(this.$thumb))},initMouseMoveScrolling:function(){var _this=this;this.$thumb.mousedown(function(event){_this.enabled&&_this.startMouseMoveScrolling(event)}),this.documentMouseup=function(event){_this.stopMouseMoveScrolling(event)},$(document).mouseup(this.documentMouseup), this.documentMousemove=function(event){_this.mouseMoveScroll(event)},$(document).mousemove(this.documentMousemove),this.$thumb.click(function(event){event.stopPropagation()})},removeMouseMoveScrolling:function(){this.$thumb.unbind(),$(document).unbind("mouseup",this.documentMouseup),$(document).unbind("mousemove",this.documentMousemove)},initMouseWheelScrolling:function(){var _this=this;this.scrollable.$element.mousewheel(function(event,delta,deltaX,deltaY){if(_this.enabled){var scrolled=_this.mouseWheelScroll(deltaX,deltaY);_this.stopEventConditionally(event,scrolled)}})},removeMouseWheelScrolling:function(){this.scrollable.$element.unbind("mousewheel")},initTouchScrolling:function(){ if(document.addEventListener){var _this=this;this.elementTouchstart=function(event){_this.enabled&&_this.startTouchScrolling(event)},this.scrollable.$element[0].addEventListener("touchstart",this.elementTouchstart),this.documentTouchmove=function(event){_this.touchScroll(event)},document.addEventListener("touchmove",this.documentTouchmove),this.elementTouchend=function(event){_this.stopTouchScrolling(event)},this.scrollable.$element[0].addEventListener("touchend",this.elementTouchend)}},removeTouchScrolling:function(){document.addEventListener&&(this.scrollable.$element[0].removeEventListener("touchstart",this.elementTouchstart),document.removeEventListener("touchmove",this.documentTouchmove), this.scrollable.$element[0].removeEventListener("touchend",this.elementTouchend))},initMouseClickScrolling:function(){var _this=this;this.scrollBarClick=function(event){_this.mouseClickScroll(event)},this.$scrollBar.click(this.scrollBarClick)},removeMouseClickScrolling:function(){this.$scrollBar.unbind("click",this.scrollBarClick)},initWindowResize:function(){if(this.scrollable.options.updateOnWindowResize){var _this=this;this.windowResize=function(){_this.resize()},$(window).resize(this.windowResize)}},removeWindowResize:function(){$(window).unbind("resize",this.windowResize)},isKeyScrolling:function(key){return null!=this.keyScrollDelta(key)},keyScrollDelta:function(key){ for(var scrollingKey in this.sizing.scrollingKeys)if(scrollingKey==key)return this.sizing.scrollingKeys[key](this.viewPortSize);return null},startMouseMoveScrolling:function(event){this.mouseMoveScrolling=!0,$("html").addClass("not-selectable"),this.setUnselectable($("html"),"on"),this.setScrollEvent(event)},stopMouseMoveScrolling:function(event){this.mouseMoveScrolling=!1,$("html").removeClass("not-selectable"),this.setUnselectable($("html"),null)},setUnselectable:function(element,value){element.attr("unselectable")!=value&&(element.attr("unselectable",value),element.find(":not(input)").attr("unselectable",value))},mouseMoveScroll:function(event){if(this.mouseMoveScrolling){ var delta=this.sizing.mouseDelta(this.scrollEvent,event);this.scrollThumbBy(delta),this.setScrollEvent(event)}},startTouchScrolling:function(event){event.touches&&1==event.touches.length&&(this.setScrollEvent(event.touches[0]),this.touchScrolling=!0,event.stopPropagation())},touchScroll:function(event){if(this.touchScrolling&&event.touches&&1==event.touches.length){var delta=-this.sizing.mouseDelta(this.scrollEvent,event.touches[0])*this.scrollable.options.swipeSpeed,scrolled=this.scrollOverviewBy(delta);scrolled&&this.setScrollEvent(event.touches[0]),this.stopEventConditionally(event,scrolled)}},stopTouchScrolling:function(event){this.touchScrolling=!1,event.stopPropagation(); },mouseWheelScroll:function(deltaX,deltaY){var delta=-this.sizing.wheelDelta(deltaX,deltaY)*this.scrollable.options.wheelSpeed;if(0!=delta)return this.scrollOverviewBy(delta)},mouseClickScroll:function(event){var delta=this.viewPortSize-20;event["page"+this.sizing.scrollAxis()]