perfect-scrollbar/out/js/perfect-scrollbar.min.js

1 line
9.5 KiB
JavaScript
Raw Normal View History

2015-01-16 06:44:17 +08:00
!function e(t,n,o){function r(i,a){if(!n[i]){if(!t[i]){var s="function"==typeof require&&require;if(!a&&s)return s(i,!0);if(l)return l(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[i]={exports:{}};t[i][0].call(u.exports,function(e){var n=t[i][1][e];return r(n?n:e)},u,u.exports,e,t,n,o)}return n[i].exports}for(var l="function"==typeof require&&require,i=0;i<o.length;i++)r(o[i]);return r}({1:[function(){!function(e){"use strict";e(jQuery)}(function(e){"use strict";function t(e){return"string"==typeof e?parseInt(e,10):~~e}var n={wheelSpeed:1,wheelPropagation:!1,swipePropagation:!0,minScrollbarLength:null,maxScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0,suppressScrollX:!1,suppressScrollY:!1,scrollXMarginOffset:0,scrollYMarginOffset:0,includePadding:!1},o=0,r=function(){var e=o++;return function(t){var n=".perfect-scrollbar-"+e;return"undefined"==typeof t?n:t+n}},l="WebkitAppearance"in document.documentElement.style;e.fn.perfectScrollbar=function(o,i){return this.each(function(){function a(e,n){var o=e+n,r=D-R;A=0>o?0:o>r?r:o;var l=t(A*(Y-D)/(D-R));x.scrollTop(l)}function s(e,n){var o=e+n,r=M-k;W=0>o?0:o>r?r:o;var l=t(W*(C-M)/(M-k));x.scrollLeft(l)}function c(e){return P.minScrollbarLength&&(e=Math.max(e,P.minScrollbarLength)),P.maxScrollbarLength&&(e=Math.min(e,P.maxScrollbarLength)),e}function u(){var e={width:I};e.left=q?x.scrollLeft()+M-C:x.scrollLeft(),j?e.bottom=N-x.scrollTop():e.top=F+x.scrollTop(),_.css(e);var t={top:x.scrollTop(),height:U};Z?t.right=q?C-x.scrollLeft()-V-J.outerWidth():V-x.scrollLeft():t.left=q?x.scrollLeft()+2*M-C-$-J.outerWidth():$+x.scrollLeft(),G.css(t),H.css({left:W,width:k-Q}),J.css({top:A,height:R-et})}function p(){x.removeClass("ps-active-x"),x.removeClass("ps-active-y"),M=P.includePadding?x.innerWidth():x.width(),D=P.includePadding?x.innerHeight():x.height(),C=x.prop("scrollWidth"),Y=x.prop("scrollHeight"),!P.suppressScrollX&&M+P.scrollXMarginOffset<C?(X=!0,I=M-z,k=c(t(I*M/C)),W=t(x.scrollLeft()*(I-k)/(C-M))):(X=!1,k=0,W=0,x.scrollLeft(0)),!P.suppressScrollY&&D+P.scrollYMarginOffset<Y?(O=!0,U=D-tt,R=c(t(U*D/Y)),A=t(x.scrollTop()*(U-R)/(Y-D))):(O=!1,R=0,A=0,x.scrollTop(0)),W>=I-k&&(W=I-k),A>=U-R&&(A=U-R),u(),X&&x.addClass("ps-active-x"),O&&x.addClass("ps-active-y")}function d(){var t,n,o=function(e){s(t,e.pageX-n),p(),e.stopPropagation(),e.preventDefault()},r=function(){x.removeClass("ps-in-scrolling"),e(K).unbind(B("mousemove"),o)};H.bind(B("mousedown"),function(l){n=l.pageX,t=H.position().left,x.addClass("ps-in-scrolling"),e(K).bind(B("mousemove"),o),e(K).one(B("mouseup"),r),l.stopPropagation(),l.preventDefault()}),t=n=null}function f(){var t,n,o=function(e){a(t,e.pageY-n),p(),e.stopPropagation(),e.preventDefault()},r=function(){x.removeClass("ps-in-scrolling"),e(K).unbind(B("mousemove"),o)};J.bind(B("mousedown"),function(l){n=l.pageY,t=J.position().top,x.addClass("ps-in-scrolling"),e(K).bind(B("mousemove"),o),e(K).one(B("mouseup"),r),l.stopPropagation(),l.preventDefault()}),t=n=null}function v(e,t){var n=x.scrollTop();if(0===e){if(!O)return!1;if(0===n&&t>0||n>=Y-D&&0>t)return!P.wheelPropagation}var o=x.scrollLeft();if(0===t){if(!X)return!1;if(0===o&&0>e||o>=C-M&&e>0)return!P.wheelPropagation}return!0}function g(e,t){var n=x.scrollTop(),o=x.scrollLeft(),r=Math.abs(e),l=Math.abs(t);if(l>r){if(0>t&&n===Y-D||t>0&&0===n)return!P.swipePropagation}else if(r>l&&(0>e&&o===C-M||e>0&&0===o))return!P.swipePropagation;return!0}function b(){function e(e){var t=e.originalEvent.deltaX,n=-1*e.originalEvent.deltaY;return("undefined"==typeof t||"undefined"==typeof n)&&(t=-1*e.originalEvent.wheelDeltaX/6,n=e.originalEvent.wheelDeltaY/6),e.originalEvent.deltaMode&&1===e.originalEvent.deltaMode&&(t*=10,n*=10),t!==t&&n!==n&&(t=0,n=e.originalEvent.wheelDelta),[t,n]}function t(t){if(l||!(x.find("select:focus").length>0)){var o=e(t),r=o[0],i=o[1];n=!1,P.useBothWheelAxes?O&&!X?(x.scrollTop(i?x.scrollTop()-i*P.wheelSpeed:x.scrollTop()+r*P.wheelSpeed),n=!0):X&&!O&&(x.scrollLeft(r?x.scrollLeft()+r*P.wheelSpeed:x.scrollLeft()-i*P.wheelSpeed),n=!0):(x.scrollTop(x.