From 4f7595a34f4260aedcc455c56566829b78a4defd Mon Sep 17 00:00:00 2001 From: Hyunje Alex Jun Date: Tue, 14 Oct 2014 01:38:04 +0100 Subject: [PATCH] Release 0.5.3. 1. Focusable element bug fix for ShadowDom element. 2. Int conversion enhancement. 3. Add IE Pointer handler. 4. Ctrl+Home/End support. 5. Iframe support. --- bower.json | 2 +- min/perfect-scrollbar.min.css | 4 ++-- min/perfect-scrollbar.min.js | 4 ++-- package.json | 2 +- perfect-scrollbar.jquery.json | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bower.json b/bower.json index 98cbfcf..7fd6b2a 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "perfect-scrollbar", - "version": "0.5.2", + "version": "0.5.3", "homepage": "http://noraesae.github.io/perfect-scrollbar/", "authors": [ "Hyunje Alex Jun " diff --git a/min/perfect-scrollbar.min.css b/min/perfect-scrollbar.min.css index 07e5334..e629e7d 100644 --- a/min/perfect-scrollbar.min.css +++ b/min/perfect-scrollbar.min.css @@ -1,5 +1,5 @@ -/*! perfect-scrollbar - v0.5.2 +/*! perfect-scrollbar - v0.5.3 * http://noraesae.github.com/perfect-scrollbar/ * Copyright (c) 2014 Hyunje Alex Jun; Licensed MIT */ -.ps-container .ps-scrollbar-x-rail{position:absolute;bottom:3px;height:8px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;opacity:0;filter:alpha(opacity=0);-o-transition:background-color .2s linear,opacity .2s linear;-webkit-transition:background-color .2s linear,opacity .2s linear;-moz-transition:background-color .2s linear,opacity .2s linear;transition:background-color .2s linear,opacity .2s linear}.ps-container:hover .ps-scrollbar-x-rail,.ps-container.hover .ps-scrollbar-x-rail{opacity:.6;filter:alpha(opacity=60)}.ps-container .ps-scrollbar-x-rail:hover,.ps-container .ps-scrollbar-x-rail.hover{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container .ps-scrollbar-x-rail.in-scrolling{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container .ps-scrollbar-y-rail{position:absolute;right:3px;width:8px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;opacity:0;filter:alpha(opacity=0);-o-transition:background-color .2s linear,opacity .2s linear;-webkit-transition:background-color .2s linear,opacity .2s linear;-moz-transition:background-color .2s linear,opacity .2s linear;transition:background-color .2s linear,opacity .2s linear}.ps-container:hover .ps-scrollbar-y-rail,.ps-container.hover .ps-scrollbar-y-rail{opacity:.6;filter:alpha(opacity=60)}.ps-container .ps-scrollbar-y-rail:hover,.ps-container .ps-scrollbar-y-rail.hover{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container .ps-scrollbar-y-rail.in-scrolling{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container .ps-scrollbar-x{position:absolute;bottom:0;height:8px;background-color:#aaa;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-o-transition:background-color .2s linear;-webkit-transition:background-color.2s linear;-moz-transition:background-color .2s linear;transition:background-color .2s linear}.ps-container.ie6 .ps-scrollbar-x{font-size:0}.ps-container .ps-scrollbar-x-rail:hover .ps-scrollbar-x,.ps-container .ps-scrollbar-x-rail.hover .ps-scrollbar-x{background-color:#999}.ps-container .ps-scrollbar-y{position:absolute;right:0;width:8px;background-color:#aaa;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-o-transition:background-color .2s linear;-webkit-transition:background-color.2s linear;-moz-transition:background-color .2s linear;transition:background-color .2s linear}.ps-container.ie6 .ps-scrollbar-y{font-size:0}.ps-container .ps-scrollbar-y-rail:hover .ps-scrollbar-y,.ps-container .ps-scrollbar-y-rail.hover .ps-scrollbar-y{background-color:#999}.ps-container.ie .ps-scrollbar-x,.ps-container.ie .ps-scrollbar-y{visibility:hidden}.ps-container.ie:hover .ps-scrollbar-x,.ps-container.ie:hover .ps-scrollbar-y,.ps-container.ie.hover .ps-scrollbar-x,.ps-container.ie.hover .ps-scrollbar-y{visibility:visible} \ No newline at end of file +.ps-container .ps-scrollbar-x-rail{position:absolute;bottom:3px;height:8px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;opacity:0;filter:alpha(opacity=0);-o-transition:background-color .2s linear,opacity .2s linear;-webkit-transition:background-color .2s linear,opacity .2s linear;-moz-transition:background-color .2s linear,opacity .2s linear;transition:background-color .2s linear,opacity .2s linear}.ps-container:hover .ps-scrollbar-x-rail,.ps-container.hover .ps-scrollbar-x-rail{opacity:.6;filter:alpha(opacity=60)}.ps-container .ps-scrollbar-x-rail:hover,.ps-container .ps-scrollbar-x-rail.hover{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container .ps-scrollbar-x-rail.in-scrolling{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container .ps-scrollbar-y-rail{position:absolute;right:3px;width:8px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;opacity:0;filter:alpha(opacity=0);-o-transition:background-color .2s linear,opacity .2s linear;-webkit-transition:background-color .2s linear,opacity .2s linear;-moz-transition:background-color .2s linear,opacity .2s linear;transition:background-color .2s linear,opacity .2s linear}.ps-container:hover .ps-scrollbar-y-rail,.ps-container.hover .ps-scrollbar-y-rail{opacity:.6;filter:alpha(opacity=60)}.ps-container .ps-scrollbar-y-rail:hover,.ps-container .ps-scrollbar-y-rail.hover{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container .ps-scrollbar-y-rail.in-scrolling{background-color:#eee;opacity:.9;filter:alpha(opacity=90)}.ps-container .ps-scrollbar-x{position:absolute;bottom:0;height:8px;background-color:#aaa;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-o-transition:background-color .2s linear;-webkit-transition:background-color.2s linear;-moz-transition:background-color .2s linear;transition:background-color .2s linear}.ps-container .ps-scrollbar-x-rail:hover .ps-scrollbar-x,.ps-container .ps-scrollbar-x-rail.hover .ps-scrollbar-x{background-color:#999}.ps-container .ps-scrollbar-y{position:absolute;right:0;width:8px;background-color:#aaa;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-o-transition:background-color .2s linear;-webkit-transition:background-color.2s linear;-moz-transition:background-color .2s linear;transition:background-color .2s linear}.ps-container .ps-scrollbar-y-rail:hover .ps-scrollbar-y,.ps-container .ps-scrollbar-y-rail.hover .ps-scrollbar-y{background-color:#999} \ No newline at end of file diff --git a/min/perfect-scrollbar.min.js b/min/perfect-scrollbar.min.js index 3681449..098cec5 100644 --- a/min/perfect-scrollbar.min.js +++ b/min/perfect-scrollbar.min.js @@ -1,4 +1,4 @@ -/*! perfect-scrollbar - v0.5.2 +/*! perfect-scrollbar - v0.5.3 * http://noraesae.github.com/perfect-scrollbar/ * Copyright (c) 2014 Hyunje Alex Jun; Licensed MIT */ -(function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)})(function(e){"use strict";var t={wheelSpeed:1,wheelPropagation:!1,minScrollbarLength:null,maxScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0,suppressScrollX:!1,suppressScrollY:!1,scrollXMarginOffset:0,scrollYMarginOffset:0,includePadding:!1},o=function(){var e=0;return function(){var t=e;return e+=1,".perfect-scrollbar-"+t}}();e.fn.perfectScrollbar=function(n,r){return this.each(function(){var l=e.extend(!0,{},t),a=e(this);if("object"==typeof n?e.extend(!0,l,n):r=n,"update"===r)return a.data("perfect-scrollbar-update")&&a.data("perfect-scrollbar-update")(),a;if("destroy"===r)return a.data("perfect-scrollbar-destroy")&&a.data("perfect-scrollbar-destroy")(),a;if(a.data("perfect-scrollbar"))return a.data("perfect-scrollbar");a.addClass("ps-container");var s,i,c,d,u,p,f,v,h,b,g=e("
").appendTo(a),m=e("
").appendTo(a),w=e("
").appendTo(g),T=e("
").appendTo(m),L=parseInt(g.css("bottom"),10),y=L===L,I=y?null:parseInt(g.css("top"),10),S=parseInt(m.css("right"),10),C=S===S,x=C?null:parseInt(m.css("left"),10),D="rtl"===a.css("direction"),X=o(),Y=parseInt(g.css("borderLeftWidth"),10)+parseInt(g.css("borderRightWidth"),10),P=parseInt(g.css("borderTopWidth"),10)+parseInt(g.css("borderBottomWidth"),10),k=function(e,t){var o=e+t,n=d-h;b=0>o?0:o>n?n:o;var r=parseInt(b*(p-d)/(d-h),10);a.scrollTop(r)},E=function(e,t){var o=e+t,n=c-f;v=0>o?0:o>n?n:o;var r=parseInt(v*(u-c)/(c-f),10);a.scrollLeft(r)},M=function(e){return l.minScrollbarLength&&(e=Math.max(e,l.minScrollbarLength)),l.maxScrollbarLength&&(e=Math.min(e,l.maxScrollbarLength)),e},W=function(){var e={width:c,display:s?"inherit":"none"};e.left=D?a.scrollLeft()+c-u:a.scrollLeft(),y?e.bottom=L-a.scrollTop():e.top=I+a.scrollTop(),g.css(e);var t={top:a.scrollTop(),height:d,display:i?"inherit":"none"};C?t.right=D?u-a.scrollLeft()-S-T.outerWidth():S-a.scrollLeft():t.left=D?a.scrollLeft()+2*c-u-x-T.outerWidth():x+a.scrollLeft(),m.css(t),w.css({left:v,width:f-Y}),T.css({top:b,height:h-P}),s?a.addClass("ps-active-x"):a.removeClass("ps-active-x"),i?a.addClass("ps-active-y"):a.removeClass("ps-active-y")},j=function(){g.hide(),m.hide(),c=l.includePadding?a.innerWidth():a.width(),d=l.includePadding?a.innerHeight():a.height(),u=a.prop("scrollWidth"),p=a.prop("scrollHeight"),!l.suppressScrollX&&u>c+l.scrollXMarginOffset?(s=!0,f=M(parseInt(c*c/u,10)),v=parseInt(a.scrollLeft()*(c-f)/(u-c),10)):(s=!1,f=0,v=0,a.scrollLeft(0)),!l.suppressScrollY&&p>d+l.scrollYMarginOffset?(i=!0,h=M(parseInt(d*d/p,10)),b=parseInt(a.scrollTop()*(d-h)/(p-d),10)):(i=!1,h=0,b=0,a.scrollTop(0)),b>=d-h&&(b=d-h),v>=c-f&&(v=c-f),W(),l.suppressScrollX||g.show(),l.suppressScrollY||m.show()},O=function(){var t,o;w.bind("mousedown"+X,function(e){o=e.pageX,t=w.position().left,g.addClass("in-scrolling"),e.stopPropagation(),e.preventDefault()}),e(document).bind("mousemove"+X,function(e){g.hasClass("in-scrolling")&&(E(t,e.pageX-o),j(),e.stopPropagation(),e.preventDefault())}),e(document).bind("mouseup"+X,function(){g.hasClass("in-scrolling")&&g.removeClass("in-scrolling")}),t=o=null},q=function(){var t,o;T.bind("mousedown"+X,function(e){o=e.pageY,t=T.position().top,m.addClass("in-scrolling"),e.stopPropagation(),e.preventDefault()}),e(document).bind("mousemove"+X,function(e){m.hasClass("in-scrolling")&&(k(t,e.pageY-o),j(),e.stopPropagation(),e.preventDefault())}),e(document).bind("mouseup"+X,function(){m.hasClass("in-scrolling")&&m.removeClass("in-scrolling")}),t=o=null},A=function(e,t){var o=a.scrollTop();if(0===e){if(!i)return!1;if(0===o&&t>0||o>=p-d&&0>t)return!l.wheelPropagation}var n=a.scrollLeft();if(0===t){if(!s)return!1;if(0===n&&0>e||n>=u-c&&e>0)return!l.wheelPropagation}return!0},B=function(){var e=!1,t=function(e){var t=e.originalEvent.deltaX,o=-1*e.originalEvent.deltaY;return(t===void 0||o===void 0)&&(t=-1*e.originalEvent.wheelDeltaX/6,o=e.originalEvent.wheelDeltaY/6),e.originalEvent.deltaMode&&1===e.originalEvent.deltaMode&&(t*=10,o*=10),t!==t&&o!==o&&(t=0,o=e.originalEvent.wheelDelta),[t,o]},o=function(o){var n=t(o),r=n[0],c=n[1];e=!1,l.useBothWheelAxes?i&&!s?(c?a.scrollTop(a.scrollTop()-c*l.wheelSpeed):a.scrollTop(a.scrollTop()+r*l.wheelSpeed),e=!0):s&&!i&&(r?a.scrollLeft(a.scrollLeft()+r*l.wheelSpeed):a.scrollLeft(a.scrollLeft()-c*l.wheelSpeed),e=!0):(a.scrollTop(a.scrollTop()-c*l.wheelSpeed),a.scrollLeft(a.scrollLeft()+r*l.wheelSpeed)),j(),e=e||A(r,c),e&&(o.stopPropagation(),o.preventDefault())};window.onwheel!==void 0?a.bind("wheel"+X,o):window.onmousewheel!==void 0&&a.bind("mousewheel"+X,o)},H=function(){var t=!1;a.bind("mouseenter"+X,function(){t=!0}),a.bind("mouseleave"+X,function(){t=!1});var o=!1;e(document).bind("keydown"+X,function(n){if(!(n.isDefaultPrevented&&n.isDefaultPrevented()||!t||e(document.activeElement).is(":input,[contenteditable]"))){var r=0,l=0;switch(n.which){case 37:r=-30;break;case 38:l=30;break;case 39:r=30;break;case 40:l=-30;break;case 33:l=90;break;case 32:case 34:l=-90;break;case 35:l=-d;break;case 36:l=d;break;default:return}a.scrollTop(a.scrollTop()-l),a.scrollLeft(a.scrollLeft()+r),o=A(r,l),o&&n.preventDefault()}})},K=function(){var e=function(e){e.stopPropagation()};T.bind("click"+X,e),m.bind("click"+X,function(e){var t=parseInt(h/2,10),o=e.pageY-m.offset().top-t,n=d-h,r=o/n;0>r?r=0:r>1&&(r=1),a.scrollTop((p-d)*r)}),w.bind("click"+X,e),g.bind("click"+X,function(e){var t=parseInt(f/2,10),o=e.pageX-g.offset().left-t,n=c-f,r=o/n;0>r?r=0:r>1&&(r=1),a.scrollLeft((u-c)*r)})},Q=function(){var t=function(e,t){a.scrollTop(a.scrollTop()-t),a.scrollLeft(a.scrollLeft()-e),j()},o={},n=0,r={},l=null,s=!1;e(window).bind("touchstart"+X,function(){s=!0}),e(window).bind("touchend"+X,function(){s=!1}),a.bind("touchstart"+X,function(e){var t=e.originalEvent.targetTouches[0];o.pageX=t.pageX,o.pageY=t.pageY,n=(new Date).getTime(),null!==l&&clearInterval(l),e.stopPropagation()}),a.bind("touchmove"+X,function(e){if(!s&&1===e.originalEvent.targetTouches.length){var l=e.originalEvent.targetTouches[0],a={};a.pageX=l.pageX,a.pageY=l.pageY;var i=a.pageX-o.pageX,c=a.pageY-o.pageY;t(i,c),o=a;var d=(new Date).getTime(),u=d-n;u>0&&(r.x=i/u,r.y=c/u,n=d),e.preventDefault()}}),a.bind("touchend"+X,function(){clearInterval(l),l=setInterval(function(){return.01>Math.abs(r.x)&&.01>Math.abs(r.y)?(clearInterval(l),void 0):(t(30*r.x,30*r.y),r.x*=.8,r.y*=.8,void 0)},10)})},R=function(){a.bind("scroll"+X,function(){j()})},z=function(){a.unbind(X),e(window).unbind(X),e(document).unbind(X),a.data("perfect-scrollbar",null),a.data("perfect-scrollbar-update",null),a.data("perfect-scrollbar-destroy",null),w.remove(),T.remove(),g.remove(),m.remove(),g=m=w=T=s=i=c=d=u=p=f=v=L=y=I=h=b=S=C=x=D=X=null},F=function(t){a.addClass("ie").addClass("ie"+t);var o=function(){var t=function(){e(this).addClass("hover")},o=function(){e(this).removeClass("hover")};a.bind("mouseenter"+X,t).bind("mouseleave"+X,o),g.bind("mouseenter"+X,t).bind("mouseleave"+X,o),m.bind("mouseenter"+X,t).bind("mouseleave"+X,o),w.bind("mouseenter"+X,t).bind("mouseleave"+X,o),T.bind("mouseenter"+X,t).bind("mouseleave"+X,o)},n=function(){W=function(){var e={left:v+a.scrollLeft(),width:f};y?e.bottom=L:e.top=I,w.css(e);var t={top:b+a.scrollTop(),height:h};C?t.right=S:t.left=x,T.css(t),w.hide().show(),T.hide().show()}};6===t&&(o(),n())},G="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,J=function(){var e=navigator.userAgent.toLowerCase().match(/(msie) ([\w.]+)/);e&&"msie"===e[1]&&F(parseInt(e[2],10)),j(),R(),O(),q(),K(),B(),G&&Q(),l.useKeyboard&&H(),a.data("perfect-scrollbar",a),a.data("perfect-scrollbar-update",j),a.data("perfect-scrollbar-destroy",z)};return J(),a})}}); \ No newline at end of file +(function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)})(function(e){"use strict";function o(e){return"string"==typeof e?parseInt(e,10):~~e}var n={wheelSpeed:1,wheelPropagation:!1,minScrollbarLength:null,maxScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0,suppressScrollX:!1,suppressScrollY:!1,scrollXMarginOffset:0,scrollYMarginOffset:0,includePadding:!1},t=function(){var e=0;return function(){var o=e;return e+=1,".perfect-scrollbar-"+o}}();e.fn.perfectScrollbar=function(r,l){return this.each(function(){function i(e,n){var t=e+n,r=P-k;C=0>t?0:t>r?r:t;var l=o(C*(x-P)/(P-k));y.scrollTop(l)}function a(e,n){var t=e+n,r=S-E;X=0>t?0:t>r?r:t;var l=o(X*(D-S)/(S-E));y.scrollLeft(l)}function s(e){return L.minScrollbarLength&&(e=Math.max(e,L.minScrollbarLength)),L.maxScrollbarLength&&(e=Math.min(e,L.maxScrollbarLength)),e}function c(){var e={width:S,display:M?"inherit":"none"};e.left=W?y.scrollLeft()+S-D:y.scrollLeft(),B?e.bottom=q-y.scrollTop():e.top=R+y.scrollTop(),K.css(e);var o={top:y.scrollTop(),height:P,display:Y?"inherit":"none"};z?o.right=W?D-y.scrollLeft()-Q-U.outerWidth():Q-y.scrollLeft():o.left=W?y.scrollLeft()+2*S-D-F-U.outerWidth():F+y.scrollLeft(),H.css(o),O.css({left:X,width:E-A}),U.css({top:C,height:k-G})}function d(){K.hide(),H.hide(),S=L.includePadding?y.innerWidth():y.width(),P=L.includePadding?y.innerHeight():y.height(),D=y.prop("scrollWidth"),x=y.prop("scrollHeight"),!L.suppressScrollX&&D>S+L.scrollXMarginOffset?(M=!0,E=s(o(S*S/D)),X=o(y.scrollLeft()*(S-E)/(D-S))):(M=!1,E=0,X=0,y.scrollLeft(0)),!L.suppressScrollY&&x>P+L.scrollYMarginOffset?(Y=!0,k=s(o(P*P/x)),C=o(y.scrollTop()*(P-k)/(x-P))):(Y=!1,k=0,C=0,y.scrollTop(0)),X>=S-E&&(X=S-E),C>=P-k&&(C=P-k),c(),M?y.addClass("ps-active-x"):y.removeClass("ps-active-x"),Y?y.addClass("ps-active-y"):y.removeClass("ps-active-y"),L.suppressScrollX||K.show(),L.suppressScrollY||H.show()}function u(){var o,n;O.bind("mousedown"+j,function(e){n=e.pageX,o=O.position().left,K.addClass("in-scrolling"),e.stopPropagation(),e.preventDefault()}),e(I).bind("mousemove"+j,function(e){K.hasClass("in-scrolling")&&(a(o,e.pageX-n),d(),e.stopPropagation(),e.preventDefault())}),e(I).bind("mouseup"+j,function(){K.hasClass("in-scrolling")&&K.removeClass("in-scrolling")}),o=n=null}function p(){var o,n;U.bind("mousedown"+j,function(e){n=e.pageY,o=U.position().top,H.addClass("in-scrolling"),e.stopPropagation(),e.preventDefault()}),e(I).bind("mousemove"+j,function(e){H.hasClass("in-scrolling")&&(i(o,e.pageY-n),d(),e.stopPropagation(),e.preventDefault())}),e(I).bind("mouseup"+j,function(){H.hasClass("in-scrolling")&&H.removeClass("in-scrolling")}),o=n=null}function f(e,o){var n=y.scrollTop();if(0===e){if(!Y)return!1;if(0===n&&o>0||n>=x-P&&0>o)return!L.wheelPropagation}var t=y.scrollLeft();if(0===o){if(!M)return!1;if(0===t&&0>e||t>=D-S&&e>0)return!L.wheelPropagation}return!0}function v(){function e(e){var o=e.originalEvent.deltaX,n=-1*e.originalEvent.deltaY;return(o===void 0||n===void 0)&&(o=-1*e.originalEvent.wheelDeltaX/6,n=e.originalEvent.wheelDeltaY/6),e.originalEvent.deltaMode&&1===e.originalEvent.deltaMode&&(o*=10,n*=10),o!==o&&n!==n&&(o=0,n=e.originalEvent.wheelDelta),[o,n]}function o(o){var t=e(o),r=t[0],l=t[1];n=!1,L.useBothWheelAxes?Y&&!M?(l?y.scrollTop(y.scrollTop()-l*L.wheelSpeed):y.scrollTop(y.scrollTop()+r*L.wheelSpeed),n=!0):M&&!Y&&(r?y.scrollLeft(y.scrollLeft()+r*L.wheelSpeed):y.scrollLeft(y.scrollLeft()-l*L.wheelSpeed),n=!0):(y.scrollTop(y.scrollTop()-l*L.wheelSpeed),y.scrollLeft(y.scrollLeft()+r*L.wheelSpeed)),d(),n=n||f(r,l),n&&(o.stopPropagation(),o.preventDefault())}var n=!1;window.onwheel!==void 0?y.bind("wheel"+j,o):window.onmousewheel!==void 0&&y.bind("mousewheel"+j,o)}function h(){var o=!1;y.bind("mouseenter"+j,function(){o=!0}),y.bind("mouseleave"+j,function(){o=!1});var n=!1;e(I).bind("keydown"+j,function(t){if((!t.isDefaultPrevented||!t.isDefaultPrevented())&&o){for(var r=document.activeElement?document.activeElement:I.activeElement;r.shadowRoot;)r=r.shadowRoot.activeElement;if(!e(r).is(":input,[contenteditable]")){var l=0,i=0;switch(t.which){case 37:l=-30;break;case 38:i=30;break;case 39:l=30;break;case 40:i=-30;break;case 33:i=90;break;case 32:case 34:i=-90;break;case 35:i=t.ctrlKey?-x:-P;break;case 36:i=t.ctrlKey?y.scrollTop():P;break;default:return}y.scrollTop(y.scrollTop()-i),y.scrollLeft(y.scrollLeft()+l),n=f(l,i),n&&t.preventDefault()}}})}function b(){function e(e){e.stopPropagation()}U.bind("click"+j,e),H.bind("click"+j,function(e){var n=o(k/2),t=e.pageY-H.offset().top-n,r=P-k,l=t/r;0>l?l=0:l>1&&(l=1),y.scrollTop((x-P)*l)}),O.bind("click"+j,e),K.bind("click"+j,function(e){var n=o(E/2),t=e.pageX-K.offset().left-n,r=S-E,l=t/r;0>l?l=0:l>1&&(l=1),y.scrollLeft((D-S)*l)})}function g(){function o(e,o){y.scrollTop(y.scrollTop()-o),y.scrollLeft(y.scrollLeft()-e),d()}function n(){f=!0}function t(){f=!1}function r(e){return e.originalEvent.targetTouches?e.originalEvent.targetTouches[0]:e.originalEvent}function l(e){var o=r(e);s.pageX=o.pageX,s.pageY=o.pageY,c=(new Date).getTime(),null!==p&&clearInterval(p),e.stopPropagation()}function i(e){if(!f&&1===e.originalEvent.targetTouches.length){var n=r(e),t={pageX:n.pageX,pageY:n.pageY},l=t.pageX-s.pageX,i=t.pageY-s.pageY;o(l,i),s=t;var a=(new Date).getTime(),d=a-c;d>0&&(u.x=l/d,u.y=i/d,c=a),e.preventDefault()}}function a(){clearInterval(p),p=setInterval(function(){return.01>Math.abs(u.x)&&.01>Math.abs(u.y)?(clearInterval(p),void 0):(o(30*u.x,30*u.y),u.x*=.8,u.y*=.8,void 0)},10)}var s={},c=0,u={},p=null,f=!1;e(window).bind("touchstart"+j,n),e(window).bind("touchend"+j,t),y.bind("touchstart"+j,l),y.bind("touchmove"+j,i),y.bind("touchend"+j,a),window.PointerEvent?(e(window).bind("pointerdown"+j,n),e(window).bind("pointerup"+j,t),y.bind("pointerdown"+j,l),y.bind("pointermove"+j,i),y.bind("pointerup"+j,a)):window.MSPointerEvent&&(e(window).bind("MSPointerDown"+j,n),e(window).bind("MSPointerUp"+j,t),y.bind("MSPointerDown"+j,l),y.bind("MSPointerMove"+j,i),y.bind("MSPointerUp"+j,a))}function w(){y.bind("scroll"+j,function(){d()})}function m(){y.unbind(j),e(window).unbind(j),e(I).unbind(j),y.data("perfect-scrollbar",null),y.data("perfect-scrollbar-update",null),y.data("perfect-scrollbar-destroy",null),O.remove(),U.remove(),K.remove(),H.remove(),K=H=O=U=M=Y=S=P=D=x=E=X=q=B=R=k=C=Q=z=F=W=j=null}function T(){d(),w(),u(),p(),b(),v(),(J||N)&&g(),L.useKeyboard&&h(),y.data("perfect-scrollbar",y),y.data("perfect-scrollbar-update",d),y.data("perfect-scrollbar-destroy",m)}var L=e.extend(!0,{},n),y=e(this);if("object"==typeof r?e.extend(!0,L,r):l=r,"update"===l)return y.data("perfect-scrollbar-update")&&y.data("perfect-scrollbar-update")(),y;if("destroy"===l)return y.data("perfect-scrollbar-destroy")&&y.data("perfect-scrollbar-destroy")(),y;if(y.data("perfect-scrollbar"))return y.data("perfect-scrollbar");y.addClass("ps-container");var S,P,D,x,M,E,X,Y,k,C,W="rtl"===y.css("direction"),j=t(),I=this.ownerDocument||document,K=e("
").appendTo(y),O=e("
").appendTo(K),q=o(K.css("bottom")),B=q===q,R=B?null:o(K.css("top")),A=o(K.css("borderLeftWidth"))+o(K.css("borderRightWidth")),H=e("
").appendTo(y),U=e("
").appendTo(H),Q=o(H.css("right")),z=Q===Q,F=z?null:o(H.css("left")),G=o(K.css("borderTopWidth"))+o(K.css("borderBottomWidth")),J="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,N=null!==window.navigator.msMaxTouchPoints;return T(),y})}}); \ No newline at end of file diff --git a/package.json b/package.json index fbd1082..106275c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "perfect-scrollbar", - "version": "0.5.2", + "version": "0.5.3", "main": "src/perfect-scrollbar.js", "engines": { "node": ">= 0.8.0" diff --git a/perfect-scrollbar.jquery.json b/perfect-scrollbar.jquery.json index 8dadfeb..8fe596f 100644 --- a/perfect-scrollbar.jquery.json +++ b/perfect-scrollbar.jquery.json @@ -2,7 +2,7 @@ "name": "perfect-scrollbar", "title": "perfect-scrollbar", "description": "Tiny but perfect jquery scrollbar plugin.", - "version": "0.5.2", + "version": "0.5.3", "author": { "name": "Hyunje Alex Jun", "email": "me@noraesae.net",