/*! * jscrollpane - v2.0.23 - 2016-01-28 * http://jscrollpane.kelvinluck.com/ * * copyright (c) 2014 kelvin luck * dual licensed under the mit or gpl licenses. */ !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jquery)}(function(a){a.fn.jscrollpane=function(b){function c(b,c){function d(c){var f,h,j,k,l,o,p=!1,q=!1;if(n=c,void 0===o)l=b.scrolltop(),o=b.scrollleft(),b.css({overflow:"hidden",padding:0}),p=b.innerwidth()+rb,q=b.innerheight(),b.width(p),o=a('
').css("padding",qb).append(b.children()),r=a('
').css({width:p+"px",height:q+"px"}).append(o).appendto(b);else{if(b.css("width",""),p=n.sticktobottom&&a(),q=n.sticktoright&&b(),k=b.innerwidth()+rb!=p||b.outerheight()!=q,k&&(p=b.innerwidth()+rb,q=b.innerheight(),r.css({width:p+"px",height:q+"px"})),!k&&sb==s&&o.outerheight()==t)return void b.width(p);sb=s,o.css("width",""),b.width(p),r.find(">.jspverticalbar,>.jsphorizontalbar").remove().end()}o.css("overflow","auto"),s=c.contentwidth?c.contentwidth:o[0].scrollwidth,t=o[0].scrollheight,o.css("overflow",""),u=s/p,v=t/q,w=v>1,x=u>1,x||w?(b.addclass("jspscrollable"),f=n.maintainposition&&($||bb),f&&(h=y(),j=z()),e(),g(),i(),f&&(w(q?s-p:h,!1),v(p?t-q:j,!1)),f(),c(),l(),n.enablekeyboardnavigation&&h(),n.clickontrack&&m(),j(),n.hijackinternallinks&&k()):(b.removeclass("jspscrollable"),o.css({top:0,left:0,width:r.width()-rb}),d(),g(),i(),n()),n.autoreinitialise&&!pb?pb=setinterval(function(){d(n)},n.autoreinitialisedelay):!n.autoreinitialise&&pb&&clearinterval(pb),l&&b.scrolltop(0)&&v(l,!1),o&&b.scrollleft(0)&&w(o,!1),b.trigger("jsp-initialised",[x||w])}function e(){w&&(r.append(a('
').append(a('
'),a('
').append(a('
').append(a('
'),a('
'))),a('
'))),cb=r.find(">.jspverticalbar"),db=cb.find(">.jsptrack"),y=db.find(">.jspdrag"),n.showarrows&&(hb=a('').bind("mousedown.jsp",k(0,-1)).bind("click.jsp",e),ib=a('').bind("mousedown.jsp",k(0,1)).bind("click.jsp",e),n.arrowscrollonhover&&(hb.bind("mouseover.jsp",k(0,-1,hb)),ib.bind("mouseover.jsp",k(0,1,ib))),j(db,n.verticalarrowpositions,hb,ib)),fb=q,r.find(">.jspverticalbar>.jspcap:visible,>.jspverticalbar>.jsparrow").each(function(){fb-=a(this).outerheight()}),y.hover(function(){y.addclass("jsphover")},function(){y.removeclass("jsphover")}).bind("mousedown.jsp",function(b){a("html").bind("dragstart.jsp selectstart.jsp",e),y.addclass("jspactive");var c=b.pagey-y.position().top;return a("html").bind("mousemove.jsp",function(a){p(a.pagey-c,!1)}).bind("mouseup.jsp mouseleave.jsp",o),!1}),f())}function f(){db.height(fb+"px"),$=0,eb=n.verticalgutter+db.outerwidth(),o.width(p-eb-rb);try{0===cb.position().left&&o.css("margin-left",eb+"px")}catch(a){}}function g(){x&&(r.append(a('
').append(a('
'),a('
').append(a('
').append(a('
'),a('
'))),a('
'))),jb=r.find(">.jsphorizontalbar"),kb=jb.find(">.jsptrack"),_=kb.find(">.jspdrag"),n.showarrows&&(nb=a('').bind("mousedown.jsp",k(-1,0)).bind("click.jsp",e),ob=a('').bind("mousedown.jsp",k(1,0)).bind("click.jsp",e),n.arrowscrollonhover&&(nb.bind("mouseover.jsp",k(-1,0,nb)),ob.bind("mouseover.jsp",k(1,0,ob))),j(kb,n.horizontalarrowpositions,nb,ob)),_.hover(function(){_.addclass("jsphover")},function(){_.removeclass("jsphover")}).bind("mousedown.jsp",function(b){a("html").bind("dragstart.jsp selectstart.jsp",e),_.addclass("jspactive");var c=b.pagex-_.position().left;return a("html").bind("mousemove.jsp",function(a){r(a.pagex-c,!1)}).bind("mouseup.jsp mouseleave.jsp",o),!1}),lb=r.innerwidth(),h())}function h(){r.find(">.jsphorizontalbar>.jspcap:visible,>.jsphorizontalbar>.jsparrow").each(function(){lb-=a(this).outerwidth()}),kb.width(lb+"px"),bb=0}function i(){if(x&&w){var b=kb.outerheight(),c=db.outerwidth();fb-=b,a(jb).find(">.jspcap:visible,>.jsparrow").each(function(){lb+=a(this).outerwidth()}),lb-=c,q-=c,p-=b,kb.parent().append(a('
').css("width",b+"px")),f(),h()}x&&o.width(r.outerwidth()-rb+"px"),t=o.outerheight(),v=t/q,x&&(mb=math.ceil(1/u*lb),mb>n.horizontaldragmaxwidth?mb=n.horizontaldragmaxwidth:mbn.verticaldragmaxheight?gb=n.verticaldragmaxheight:gbf)$-k>e?tb.scrollbyy(-j):p(e);else{if(!(f>0))return void i();e>$+k?tb.scrollbyy(j):p(e)}c=settimeout(h,g?n.initialdelay:n.trackclickrepeatfreq),g=!1},i=function(){c&&cleartimeout(c),c=null,a(document).unbind("mouseup.jsp",i)};return h(),a(document).bind("mouseup.jsp",i),!1}}),x&&kb.bind("mousedown.jsp",function(b){if(void 0===b.originaltarget||b.originaltarget==b.currenttarget){var c,d=a(this),e=d.offset(),f=b.pagex-e.left-bb,g=!0,h=function(){var a=d.offset(),e=b.pagex-a.left-mb/2,j=p*n.scrollpagepercent,k=ab*j/(s-p);if(0>f)bb-k>e?tb.scrollbyx(-j):r(e);else{if(!(f>0))return void i();e>bb+k?tb.scrollbyx(j):r(e)}c=settimeout(h,g?n.initialdelay:n.trackclickrepeatfreq),g=!1},i=function(){c&&cleartimeout(c),c=null,a(document).unbind("mouseup.jsp",i)};return h(),a(document).bind("mouseup.jsp",i),!1}})}function n(){kb&&kb.unbind("mousedown.jsp"),db&&db.unbind("mousedown.jsp")}function o(){a("html").unbind("dragstart.jsp selectstart.jsp mousemove.jsp mouseup.jsp mouseleave.jsp"),y&&y.removeclass("jspactive"),_&&_.removeclass("jspactive")}function p(c,d){if(w){0>c?c=0:c>z&&(c=z);var e=new a.event("jsp-will-scroll-y");if(b.trigger(e,[c]),!e.isdefaultprevented()){var f=c||0,g=0===f,h=f==z,i=c/z,j=-i*(t-q);void 0===d&&(d=n.animatescroll),d?tb.animate(y,"top",c,q,function(){b.trigger("jsp-user-scroll-y",[-j,g,h])}):(y.css("top",c),q(c),b.trigger("jsp-user-scroll-y",[-j,g,h]))}}}function q(a){void 0===a&&(a=y.position().top),r.scrolltop(0),$=a||0;var c=0===$,d=$==z,e=a/z,f=-e*(t-q);(ub!=c||wb!=d)&&(ub=c,wb=d,b.trigger("jsp-arrow-change",[ub,wb,vb,xb])),t(c,d),o.css("top",f),b.trigger("jsp-scroll-y",[-f,c,d]).trigger("scroll")}function r(c,d){if(x){0>c?c=0:c>ab&&(c=ab);var e=new a.event("jsp-will-scroll-x");if(b.trigger(e,[c]),!e.isdefaultprevented()){var f=c||0,g=0===f,h=f==ab,i=c/ab,j=-i*(s-p);void 0===d&&(d=n.animatescroll),d?tb.animate(_,"left",c,s,function(){b.trigger("jsp-user-scroll-x",[-j,g,h])}):(_.css("left",c),s(c),b.trigger("jsp-user-scroll-x",[-j,g,h]))}}}function s(a){void 0===a&&(a=_.position().left),r.scrolltop(0),bb=a||0;var c=0===bb,d=bb==ab,e=a/ab,f=-e*(s-p);(vb!=c||xb!=d)&&(vb=c,xb=d,b.trigger("jsp-arrow-change",[ub,wb,vb,xb])),u(c,d),o.css("left",f),b.trigger("jsp-scroll-x",[-f,c,d]).trigger("scroll")}function t(a,b){n.showarrows&&(hb[a?"addclass":"removeclass"]("jspdisabled"),ib[b?"addclass":"removeclass"]("jspdisabled"))}function u(a,b){n.showarrows&&(nb[a?"addclass":"removeclass"]("jspdisabled"),ob[b?"addclass":"removeclass"]("jspdisabled"))}function v(a,b){var c=a/(t-q);p(c*z,b)}function w(a,b){var c=a/(s-p);r(c*ab,b)}function x(b,c,d){var e,f,g,h,i,j,k,l,m,n=0,o=0;try{e=a(b)}catch(p){return}for(f=e.outerheight(),g=e.outerwidth(),r.scrolltop(0),r.scrollleft(0);!e.is(".jsppane");)if(n+=e.position().top,o+=e.position().left,e=e.offsetparent(),/^body|html$/i.test(e[0].nodename))return;h=z(),j=h+q,h>n||c?l=n-n.horizontalgutter:n+f>j&&(l=n-q+f+n.horizontalgutter),isnan(l)||v(l,d),i=y(),k=i+p,i>o||c?m=o-n.horizontalgutter:o+g>k&&(m=o-p+g+n.horizontalgutter),isnan(m)||w(m,d)}function y(){return-o.position().left}function z(){return-o.position().top}function a(){var a=t-q;return a>20&&a-z()<10}function b(){var a=s-p;return a>20&&a-y()<10}function c(){r.unbind(zb).bind(zb,function(a,b,c,d){bb||(bb=0),$||($=0);var e=bb,f=$,g=a.deltafactor||n.mousewheelspeed;return tb.scrollby(c*g,-d*g,!1),e==bb&&f==$})}function d(){r.unbind(zb)}function e(){return!1}function f(){o.find(":input,a").unbind("focus.jsp").bind("focus.jsp",function(a){x(a.target,!1)})}function g(){o.find(":input,a").unbind("focus.jsp")}function h(){function c(){var a=bb,b=$;switch(d){case 40:tb.scrollbyy(n.keyboardspeed,!1);break;case 38:tb.scrollbyy(-n.keyboardspeed,!1);break;case 34:case 32:tb.scrollbyy(q*n.scrollpagepercent,!1);break;case 33:tb.scrollbyy(-q*n.scrollpagepercent,!1);break;case 39:tb.scrollbyx(n.keyboardspeed,!1);break;case 37:tb.scrollbyx(-n.keyboardspeed,!1)}return e=a!=bb||b!=$}var d,e,f=[];x&&f.push(jb[0]),w&&f.push(cb[0]),o.bind("focus.jsp",function(){b.focus()}),b.attr("tabindex",0).unbind("keydown.jsp keypress.jsp").bind("keydown.jsp",function(b){if(b.target===this||f.length&&a(b.target).closest(f).length){var g=bb,h=$;switch(b.keycode){case 40:case 38:case 34:case 32:case 33:case 39:case 37:d=b.keycode,c();break;case 35:v(t-q),d=null;break;case 36:v(0),d=null}return e=b.keycode==d&&g!=bb||h!=$,!e}}).bind("keypress.jsp",function(b){return b.keycode==d&&c(),b.target===this||f.length&&a(b.target).closest(f).length?!e:void 0}),n.hidefocus?(b.css("outline","none"),"hidefocus"in r[0]&&b.attr("hidefocus",!0)):(b.css("outline",""),"hidefocus"in r[0]&&b.attr("hidefocus",!1))}function i(){b.attr("tabindex","-1").removeattr("tabindex").unbind("keydown.jsp keypress.jsp"),o.unbind(".jsp")}function j(){if(location.hash&&location.hash.length>1){var b,c,d=escape(location.hash.substr(1));try{b=a("#"+d+', a[name="'+d+'"]')}catch(e){return}b.length&&o.find(d)&&(0===r.scrolltop()?c=setinterval(function(){r.scrolltop()>0&&(x(b,!0),a(document).scrolltop(r.position().top),clearinterval(c))},50):(x(b,!0),a(document).scrolltop(r.position().top)))}}function k(){a(document.body).data("jsphijack")||(a(document.body).data("jsphijack",!0),a(document.body).delegate('a[href*="#"]',"click",function(b){var c,d,e,f,g,h,i=this.href.substr(0,this.href.indexof("#")),j=location.href;if(-1!==location.href.indexof("#")&&(j=location.href.substr(0,location.href.indexof("#"))),i===j){c=escape(this.href.substr(this.href.indexof("#")+1));try{d=a("#"+c+', a[name="'+c+'"]')}catch(k){return}d.length&&(e=d.closest(".jspscrollable"),f=e.data("jsp"),f.scrolltoelement(d,!0),e[0].scrollintoview&&(g=a(window).scrolltop(),h=d.offset().top,(g>h||h>g+a(window).height())&&e[0].scrollintoview()),b.preventdefault())}}))}function l(){var a,b,c,d,e,f=!1;r.unbind("touchstart.jsp touchmove.jsp touchend.jsp click.jsp-touchclick").bind("touchstart.jsp",function(g){var h=g.originalevent.touches[0];a=y(),b=z(),c=h.pagex,d=h.pagey,e=!1,f=!0}).bind("touchmove.jsp",function(g){if(f){var h=g.originalevent.touches[0],i=bb,j=$;return tb.scrollto(a+c-h.pagex,b+d-h.pagey),e=e||math.abs(c-h.pagex)>5||math.abs(d-h.pagey)>5,i==bb&&j==$}}).bind("touchend.jsp",function(){f=!1}).bind("click.jsp-touchclick",function(){return e?(e=!1,!1):void 0})}function m(){var a=z(),c=y();b.removeclass("jspscrollable").unbind(".jsp"),o.unbind(".jsp"),b.replacewith(yb.append(o.children())),yb.scrolltop(a),yb.scrollleft(c),pb&&clearinterval(pb)}var n,o,p,q,r,s,t,u,v,w,x,y,z,$,_,ab,bb,cb,db,eb,fb,gb,hb,ib,jb,kb,lb,mb,nb,ob,pb,qb,rb,sb,tb=this,ub=!0,vb=!0,wb=!1,xb=!1,yb=b.clone(!1,!1).empty(),zb=a.fn.mwheelintent?"mwheelintent.jsp":"mousewheel.jsp";"border-box"===b.css("box-sizing")?(qb=0,rb=0):(qb=b.css("paddingtop")+" "+b.css("paddingright")+" "+b.css("paddingbottom")+" "+b.css("paddingleft"),rb=(parseint(b.css("paddingleft"),10)||0)+(parseint(b.css("paddingright"),10)||0)),a.extend(tb,{reinitialise:function(b){b=a.extend({},n,b),d(b)},scrolltoelement:function(a,b,c){x(a,b,c)},scrollto:function(a,b,c){w(a,c),v(b,c)},scrolltox:function(a,b){w(a,b)},scrolltoy:function(a,b){v(a,b)},scrolltopercentx:function(a,b){w(a*(s-p),b)},scrolltopercenty:function(a,b){v(a*(t-q),b)},scrollby:function(a,b,c){tb.scrollbyx(a,c),tb.scrollbyy(b,c)},scrollbyx:function(a,b){var c=y()+math[0>a?"floor":"ceil"](a),d=c/(s-p);r(d*ab,b)},scrollbyy:function(a,b){var c=z()+math[0>a?"floor":"ceil"](a),d=c/(t-q);p(d*z,b)},positiondragx:function(a,b){r(a,b)},positiondragy:function(a,b){p(a,b)},animate:function(a,b,c,d,e){var f={};f[b]=c,a.animate(f,{duration:n.animateduration,easing:n.animateease,queue:!1,step:d,complete:e})},getcontentpositionx:function(){return y()},getcontentpositiony:function(){return z()},getcontentwidth:function(){return s},getcontentheight:function(){return t},getpercentscrolledx:function(){return y()/(s-p)},getpercentscrolledy:function(){return z()/(t-q)},getisscrollableh:function(){return x},getisscrollablev:function(){return w},getcontentpane:function(){return o},scrolltobottom:function(a){p(z,a)},hijackinternallinks:a.noop,destroy:function(){m()}}),d(c)}return b=a.extend({},a.fn.jscrollpane.defaults,b),a.each(["arrowbuttonspeed","trackclickspeed","keyboardspeed"],function(){b[this]=b[this]||b.speed}),this.each(function(){var d=a(this),e=d.data("jsp");e?e.reinitialise(b):(a("script",d).filter('[type="text/javascript"],:not([type])').remove(),e=new c(d,b),d.data("jsp",e))})},a.fn.jscrollpane.defaults={showarrows:!1,maintainposition:!0,sticktobottom:!1,sticktoright:!1,clickontrack:!0,autoreinitialise:!1,autoreinitialisedelay:500,verticaldragminheight:0,verticaldragmaxheight:99999,horizontaldragminwidth:0,horizontaldragmaxwidth:99999,contentwidth:void 0,animatescroll:!1,animateduration:300,animateease:"linear",hijackinternallinks:!1,verticalgutter:4,horizontalgutter:4,mousewheelspeed:3,arrowbuttonspeed:0,arrowrepeatfreq:50,arrowscrollonhover:!1,trackclickspeed:0,trackclickrepeatfreq:70,verticalarrowpositions:"split",horizontalarrowpositions:"split",enablekeyboardnavigation:!0,hidefocus:!1,keyboardspeed:0,initialdelay:300,speed:30,scrollpagepercent:.8}});