snappymail/vendors/jquery-nanoscroller/jquery.nanoscroller-0.7.min.js
RainLoop Team 4cc2207513 Uploading and preparing the repository to the dev version.
Original unminified source code (dev folder - js, css, less) (fixes #6)
Grunt build system
Multiple identities correction (fixes #9)
Compose html editor (fixes #12)
New general settings - Loading Description
New warning about default admin password
Split general and login screen settings
2013-11-16 02:21:12 +04:00

2 lines
No EOL
9.4 KiB
JavaScript

/*! nanoScrollerJS v0.7 (c) 2013 James Florentino; modified by RainLoop Team | MIT */
!function(a,b,c){"use strict";var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x;w={paneClass:"pane",sliderClass:"slider",contentClass:"content",iOSNativeScrolling:!1,preventPageScrolling:!1,disableResize:!1,alwaysVisible:!1,flashDelay:1500,sliderMinHeight:20,sliderMaxHeight:null},s="scrollbar",r="scroll",k="mousedown",l="mousemove",n="mousewheel",m="mouseup",q="resize",h="drag",u="up",p="panedown",f="DOMMouseScroll",g="down",v="wheel",i="keydown",j="keyup",t="touchmove",d="Microsoft Internet Explorer"===b.navigator.appName&&/msie 7./i.test(b.navigator.appVersion)&&b.ActiveXObject,e=null,x=function(){var a,b,d;return a=c.createElement("div"),b=a.style,b.position="absolute",b.width="100px",b.height="100px",b.overflow=r,b.top="-9999px",a.className="nano-visibility-hidden",c.body.appendChild(a),d=a.offsetWidth-a.clientWidth,c.body.removeChild(a),d},o=function(){function i(d,f){this.el=d,this.options=f,e||(e=x()),this.$el=a(this.el),this.doc=a(c),this.win=a(b),this.$content=this.$el.children("."+f.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 i.prototype.preventScrolling=function(a,b){if(this.isActive||this.isActive2)if(a.type===f)(b===g&&a.originalEvent.detail>0||b===u&&a.originalEvent.detail<0)&&a.preventDefault();else if(a.type===n){if(!a.originalEvent||!a.originalEvent.wheelDelta)return;(b===g&&a.originalEvent.wheelDelta<0||b===u&&a.originalEvent.wheelDelta>0)&&a.preventDefault()}},i.prototype.nativeScrolling=function(){this.$content.css({WebkitOverflowScrolling:"touch"}),this.iOSNativeScrolling=!0,this.isActive=!0,this.isActive2=!0},i.prototype.updateScrollValues=function(){var a;a=this.content,this.maxScrollTop=a.scrollHeight-a.clientHeight,this.maxScroll2Left=a.scrollWidth-a.clientWidth,this.contentScrollTop=a.scrollTop,this.contentScroll2Left=a.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.prototype.createEvents=function(){var a=this;this.events={down:function(b){return a.isBeingDragged=!0,a.offsetY=b.pageY-a.slider.offset().top,a.pane.addClass("active"),a.doc.bind(l,a.events[h]).bind(m,a.events[u]),!1},down2:function(b){return a.isBeingDragged2=!0,a.offsetX=b.pageX-a.slider2.offset().left,a.pane2.addClass("active"),a.doc.bind(l,a.events.drag2).bind(m,a.events.up2),!1},drag:function(b){return a.sliderY=b.pageY-a.$el.offset().top-a.offsetY,a.scroll(),a.updateScrollValues(),a.contentScrollTop>=a.maxScrollTop?a.$el.trigger("scrollend"):0===a.contentScrollTop&&a.$el.trigger("scrolltop"),!1},drag2:function(b){return a.slider2X=b.pageX-a.$el.offset().left-a.offsetX,a.scroll(),a.updateScrollValues(),!1},up:function(){return a.isBeingDragged=!1,a.pane.removeClass("active"),a.doc.unbind(l,a.events[h]).unbind(m,a.events[u]),!1},up2:function(){return a.isBeingDragged2=!1,a.pane2.removeClass("active"),a.doc.unbind(l,a.events.drag2).unbind(m,a.events.up2),!1},resize:function(){a.reset()},panedown:function(b){return a.sliderY=(b.offsetY||b.originalEvent.layerY)-.5*a.sliderHeight,a.scroll(),a.events.down(b),!1},panedown2:function(b){return a.slider2X=(b.offsetX||b.originalEvent.layerX)-.5*a.slider2Width,a.scroll(),a.events.down2(b),!1},scroll:function(b){a.isBeingDragged||a.isBeingDragged2||(a.updateScrollValues(),a.iOSNativeScrolling||(a.sliderY=a.sliderTop,a.slider.css({top:a.sliderTop}),a.slider2X=a.slider2Left,a.slider2.css({left:a.slider2Left})),b&&(a.contentScrollTop>=a.maxScrollTop?(a.options.preventPageScrolling&&a.preventScrolling(b,g),a.$el.trigger("scrollend")):0===a.contentScrollTop&&(a.options.preventPageScrolling&&a.preventScrolling(b,u),a.$el.trigger("scrolltop"))))},wheel:function(b){return b&&void 0!==b.wheelDeltaY&&void 0!==b.delta?(a.sliderY+=-b.wheelDeltaY||-b.delta,a.scroll(),!1):void 0}}},i.prototype.addEvents=function(){var a;this.removeEvents(),a=this.events,this.options.disableResize||this.win.bind(q,a[q]),this.iOSNativeScrolling||(this.slider.bind(k,a[g]),this.slider2.bind(k,a.down2),this.pane.bind(k,a[p]),this.pane2.bind(k,a.panedown2)),this.$content.bind(""+r+" "+n+" "+f+" "+t,a[r])},i.prototype.removeEvents=function(){var a;a=this.events,this.win.unbind(q,a[q]),this.iOSNativeScrolling||(this.slider.unbind(),this.pane.unbind(),this.slider2.unbind(),this.pane2.unbind()),this.$content.unbind(""+r+" "+n+" "+f+" "+t,a[r])},i.prototype.generate=function(){var a,b,c,d,f;return c=this.options,d=c.paneClass,f=c.sliderClass,a=c.contentClass,this.$el.find("."+d).length||this.$el.find("."+f).length||this.$el.append('<div class="'+d+'"><div class="'+f+'" /></div>'),this.$el.find(".pane2").length||this.$el.find(".slider2").length||this.$el.append('<div class="pane2"><div class="slider2" /></div>'),this.slider=this.$el.find("."+f),this.slider2=this.$el.find(".slider2"),this.pane=this.$el.find("."+d),this.pane2=this.$el.find(".pane2"),e&&(b="rtl"===this.$el.css("direction")?{left:-e,bottom:-e}:{right:-e,bottom:-e},this.$el.addClass("has-scrollbar")),null!=b&&this.$content.css(b),this},i.prototype.restore=function(){this.stopped=!1,this.pane.show(),this.pane2.show(),this.addEvents()},i.prototype.reset=function(){var a,b,c,f,g,h,i,j,k,l,m,n,o,p,q,s;return this.iOSNativeScrolling?(this.contentHeight=this.content.scrollHeight,this.contentWidth=this.content.scrollWidth,void 0):(this.$el.find("."+this.options.paneClass).length||this.generate().stop(),this.$el.find(".pane2").length||this.generate().stop(),this.stopped&&this.restore(),a=this.content,c=a.style,f=c.overflowY,l=c.overflowX,d&&this.$content.css({height:this.$content.height()}),b=a.scrollHeight+e,m=a.scrollWidth+e,h=this.pane.outerHeight(),n=this.pane2.outerWidth(),j=parseInt(this.pane.css("top"),10),p=parseInt(this.pane2.css("left"),10),g=parseInt(this.pane.css("bottom"),10),o=parseInt(this.pane2.css("right"),10),i=h+j+g,q=n+p+o,k=Math.round(i/b*i),s=Math.round(q/m*q),k<this.options.sliderMinHeight?k=this.options.sliderMinHeight:null!=this.options.sliderMaxHeight&&k>this.options.sliderMaxHeight&&(k=this.options.sliderMaxHeight),s<this.options.sliderMinHeight?s=this.options.sliderMinHeight:null!=this.options.sliderMaxHeight&&s>this.options.sliderMaxHeight&&(s=this.options.sliderMaxHeight),f===r&&c.overflowX!==r&&(k+=e),l===r&&c.overflowY!==r&&(s+=e),this.maxSliderTop=i-k,this.maxSlider2Left=q-s,this.contentHeight=b,this.contentWidth=m,this.paneHeight=h,this.pane2Width=n,this.paneOuterHeight=i,this.pane2OuterWidth=q,this.sliderHeight=k,this.slider2Width=s,this.slider.height(k),this.slider2.width(s),this.events.scroll(),this.pane.show(),this.pane2.show(),this.isActive=!0,a.scrollHeight===a.clientHeight||this.pane.outerHeight(!0)>=a.scrollHeight&&f!==r?(this.pane.hide(),this.isActive=!1):this.el.clientHeight===a.scrollHeight&&f===r?this.slider.hide():this.slider.show(),this.isActive2=!0,a.scrollWidth===a.clientWidth||this.pane2.outerWidth(!0)>=a.scrollWidth-30&&l!==r?(this.pane2.hide(),this.isActive2=!1):this.el.clientWidth===a.scrollWidth&&l===r?this.slider2.hide():this.slider2.show(),this.pane.css({opacity:this.options.alwaysVisible?1:"",visibility:this.options.alwaysVisible?"visible":""}),this.pane2.css({opacity:this.options.alwaysVisible?1:"",visibility:this.options.alwaysVisible?"visible":""}),this)},i.prototype.scroll=function(){return this.isActive||this.isActive2?(this.isActive&&(this.sliderY=Math.max(0,this.sliderY),this.sliderY=Math.min(this.maxSliderTop,this.sliderY),this.$content.scrollTop((this.paneHeight-this.contentHeight+e)*this.sliderY/this.maxSliderTop*-1)),this.isActive2&&(this.slider2X=Math.max(0,this.slider2X),this.slider2X=Math.min(this.maxSlider2Left,this.slider2X),this.$content.scrollLeft((this.pane2Width-this.contentWidth+e)*this.slider2X/this.maxSlider2Left*-1)),this.iOSNativeScrolling||(this.isActive&&this.slider.css({top:this.sliderY}),this.isActive2&&this.slider2.css({left:this.slider2X})),this):void 0},i.prototype.scrollBottom=function(a){return this.isActive||this.isActive2?(this.reset(),this.$content.scrollTop(this.contentHeight-this.$content.height()-a).trigger(n),this):void 0},i.prototype.scrollTop=function(a){return this.isActive||this.isActive2?(this.reset(),this.$content.scrollTop(+a).trigger(n),this):void 0},i.prototype.scrollTo=function(b){return this.isActive||this.isActive2?(this.reset(),this.scrollTop(a(b).get(0).offsetTop),this):void 0},i.prototype.stop=function(){return this.stopped=!0,this.removeEvents(),this.pane.hide(),this},i.prototype.flash=function(){var a=this;if(this.isActive||this.isActive2)return this.reset(),this.pane.addClass("flashed"),setTimeout(function(){a.pane.removeClass("flashed")},this.options.flashDelay),this},i}(),a.fn.nanoScroller=function(b){return this.each(function(){var c,d;if((d=this.nanoscroller)||(c=a.extend({},w,b),this.nanoscroller=d=new o(this,c)),b&&"object"==typeof b){if(a.extend(d.options,b),b.scrollBottom)return d.scrollBottom(b.scrollBottom);if(b.scrollTop)return d.scrollTop(b.scrollTop);if(b.scrollTo)return d.scrollTo(b.scrollTo);if("bottom"===b.scroll)return d.scrollBottom(0);if("top"===b.scroll)return d.scrollTop(0);if(b.scroll&&b.scroll instanceof a)return d.scrollTo(b.scroll);if(b.stop)return d.stop();if(b.flash)return d.flash()}return d.reset()})}}(jQuery,window,document);