snappymail/vendors/jquery-nanoscroller/jquery.nanoscroller-0.7.min.js

2 lines
10 KiB
JavaScript
Raw Normal View History

/*! nanoScrollerJS v0.7 (c) 2013 James Florentino; modified by RainLoop Team | MIT */
!function(t,i,e){"use strict";var s,l,o,n,r,h,a,c,d,p,v,g,f,u,m,S,b,w,T,y,$;y={paneClass:"pane",sliderClass:"slider",contentClass:"content",iOSNativeScrolling:!1,preventPageScrolling:!1,disableResize:!1,alwaysVisible:!1,flashDelay:1500,sliderMinHeight:20,sliderMaxHeight:null},S="scrollbar",m="scroll",c="mousedown",d="mousemove",v="mousewheel",p="mouseup",u="resize",r="drag",w="up",f="panedown",o="DOMMouseScroll",n="down",T="wheel",h="keydown",a="keyup",b="touchmove",s="Microsoft Internet Explorer"===i.navigator.appName&&/msie 7./i.test(i.navigator.appVersion)&&i.ActiveXObject,l=null,$=function(){var t,i,s;return t=e.createElement("div"),i=t.style,i.position="absolute",i.width="100px",i.height="100px",i.overflow=m,i.top="-9999px",t.className="nano-visibility-hidden",e.body.appendChild(t),s=t.offsetWidth-t.clientWidth,e.body.removeChild(t),s},g=function(){function h(s,o){this.el=s,this.options=o,l||(l=$()),this.$el=t(this.el),this.doc=t(e),this.win=t(i),this.$content=this.$el.children("."+o.contentClass),this.$content.attr("tabindex",0),this.content=this.$content[0],this.options.iOSNativeScrolling&&null!=this.el.style.WebkitOverflowScrolling?this.nativeScrolling():this.generate(),this.createEvents(),this.addEvents(),this.reset()}return h.prototype.preventScrolling=function(t,i){if(this.isActive||this.isActive2)if(t.type===o)(i===n&&t.originalEvent.detail>0||i===w&&t.originalEvent.detail<0)&&t.preventDefault();else if(t.type===v){if(!t.originalEvent||!t.originalEvent.wheelDelta)return;(i===n&&t.originalEvent.wheelDelta<0||i===w&&t.originalEvent.wheelDelta>0)&&t.preventDefault()}},h.prototype.scrollClassTimer=0,h.prototype.scrollClassTrigger=function(){i.clearTimeout(this.scrollClassTimer);var t=this;t.$el.addClass("nano-scrollevent"),t.pane.addClass("activescroll"),t.pane2.addClass("activescroll"),this.scrollClassTimer=i.setTimeout(function(){t.$el.removeClass("nano-scrollevent"),t.pane.removeClass("activescroll"),t.pane2.removeClass("activescroll")},1e3)},h.prototype.nativeScrolling=function(){this.$content.css({WebkitOverflowScrolling:"touch"}),this.iOSNativeScrolling=!0,this.isActive=!0,this.isActive2=!0},h.prototype.updateScrollValues=function(){var t,i=8;t=this.content,this.maxScrollTop=t.scrollHeight-t.clientHeight,this.maxScroll2Left=t.scrollWidth-t.clientWidth,this.contentScrollTop=t.scrollTop,this.contentScroll2Left=t.scrollLeft,this.iOSNativeScrolling||(this.maxSliderTop=this.paneHeight-this.sliderHeight,this.maxSlider2Left=this.pane2Width-this.slider2Width,this.sliderTop=this.contentScrollTop*this.maxSliderTop/this.maxScrollTop,this.slider2Left=this.contentScroll2Left*this.maxSlider2Left/this.maxScroll2Left,i<this.sliderTop?this.$el.addClass("nano-scrolllimit-top"):this.$el.removeClass("nano-scrolllimit-top"),this.contentScrollTop+i>=this.maxScrollTop?this.$el.removeClass("nano-scrolllimit-bottom"):this.$el.addClass("nano-scrolllimit-bottom"))},h.prototype.createEvents=function(){var t=this;this.events={down:function(i){return t.isBeingDragged=!0,t.offsetY=i.pageY-t.slider.offset().top,t.pane.addClass("active"),t.doc.bind(d,t.events[r]).bind(p,t.events[w]),!1},down2:function(i){return t.isBeingDragged2=!0,t.offsetX=i.pageX-t.slider2.offset().left,t.pane2.addClass("active"),t.doc.bind(d,t.events.drag2).bind(p,t.events.up2),!1},drag:function(i){return t.sliderY=i.pageY-t.$el.offset().top-t.offsetY,t.scroll(),t.updateScrollValues(),t.contentScrollTop>=t.maxScrollTop?t.$el.trigger("scrollend"):0===t.contentScrollTop&&t.$el.trigger("scrolltop"),!1},drag2:function(i){return t.slider2X=i.pageX-t.$el.offset().left-t.offsetX,t.scroll(),t.updateScrollValues(),!1},up:function(){return t.isBeingDragged=!1,t.pane.removeClass("active"),t.doc.unbind(d,t.events[r]).unbind(p,t.events[w]),!1},up2:function(){return t.isBeingDragged2=!1,t.pane2.removeClass("active"),t.doc.unbind(d,t.events.drag2).unbind(p,t.events.up2),!1},resize:function(){t.reset()},panedown:function(i){return t.sliderY=(i.offsetY||i.originalEvent.layerY)-.5*t.sliderHeight,t.scroll(),t.events.down(i),!1},panedown2:function(i){return t.slider2X=(i.offsetX||i.origi