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