1234 |
- !function($){function code(s,discard,alpha,beta,w1,w2){s=String(s);for(var buffer=0,i=0,length=s.length,result="",bitsInBuffer=0;length>i;){var c=s.charCodeAt(i);for(c=256>c?alpha[c]:-1,buffer=(buffer<<w1)+c,bitsInBuffer+=w1;bitsInBuffer>=w2;){bitsInBuffer-=w2;var tmp=buffer>>bitsInBuffer;result+=beta.charAt(tmp),buffer^=tmp<<bitsInBuffer}++i}return!discard&&bitsInBuffer>0&&(result+=beta.charAt(buffer<<w2-bitsInBuffer)),result}for(var b64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a256="",r64=[256],r256=[256],i=0,UTF8={encode:function(strUni){var strUtf=strUni.replace(/[\u0080-\u07ff]/g,function(c){var cc=c.charCodeAt(0);return String.fromCharCode(192|cc>>6,128|63&cc)}).replace(/[\u0800-\uffff]/g,function(c){var cc=c.charCodeAt(0);return String.fromCharCode(224|cc>>12,128|cc>>6&63,128|63&cc)});return strUtf},decode:function(strUtf){var strUni=strUtf.replace(/[\u00e0-\u00ef][\u0080-\u00bf][\u0080-\u00bf]/g,function(c){var cc=(15&c.charCodeAt(0))<<12|(63&c.charCodeAt(1))<<6|63&c.charCodeAt(2);return String.fromCharCode(cc)}).replace(/[\u00c0-\u00df][\u0080-\u00bf]/g,function(c){var cc=(31&c.charCodeAt(0))<<6|63&c.charCodeAt(1);return String.fromCharCode(cc)});return strUni}};256>i;){var c=String.fromCharCode(i);a256+=c,r256[i]=i,r64[i]=b64.indexOf(c),++i}var Plugin=$.base64=function(dir,input,encode){return input?Plugin[dir](input,encode):dir?null:this};Plugin.btoa=Plugin.encode=function(plain,utf8encode){return plain=Plugin.raw===!1||Plugin.utf8encode||utf8encode?UTF8.encode(plain):plain,plain=code(plain,!1,r256,b64,8,6),plain+"====".slice(plain.length%4||4)},Plugin.atob=Plugin.decode=function(coded,utf8decode){coded=String(coded).split("=");var i=coded.length;do--i,coded[i]=code(coded[i],!0,r64,a256,6,8);while(i>0);return coded=coded.join(""),Plugin.raw===!1||Plugin.utf8decode||utf8decode?UTF8.decode(coded):coded}}(jQuery);
- !function(factory){"function"==typeof define&&define.amd?define(["jquery"],factory):"object"==typeof exports?module.exports=factory(require("jquery")):factory(jQuery)}(function($){$.fn.jScrollPane=function(settings){function JScrollPane(elem,s){function initialise(s){var isMaintainingPositon,lastContentX,lastContentY,hasContainingSpaceChanged,originalScrollTop,originalScrollLeft,maintainAtBottom=!1,maintainAtRight=!1;if(settings=s,void 0===pane)originalScrollTop=elem.scrollTop(),originalScrollLeft=elem.scrollLeft(),elem.css({overflow:"hidden",padding:0}),paneWidth=elem.innerWidth()+originalPaddingTotalWidth,paneHeight=elem.innerHeight(),elem.width(paneWidth),pane=$('<div class="jspPane" />').css("padding",originalPadding).append(elem.children()),container=$('<div class="jspContainer" />').css({width:paneWidth+"px",height:paneHeight+"px"}).append(pane).appendTo(elem);else{if(elem.css("width",""),maintainAtBottom=settings.stickToBottom&&isCloseToBottom(),maintainAtRight=settings.stickToRight&&isCloseToRight(),hasContainingSpaceChanged=elem.innerWidth()+originalPaddingTotalWidth!=paneWidth||elem.outerHeight()!=paneHeight,hasContainingSpaceChanged&&(paneWidth=elem.innerWidth()+originalPaddingTotalWidth,paneHeight=elem.innerHeight(),container.css({width:paneWidth+"px",height:paneHeight+"px"})),!hasContainingSpaceChanged&&previousContentWidth==contentWidth&&pane.outerHeight()==contentHeight)return elem.width(paneWidth),void 0;previousContentWidth=contentWidth,pane.css("width",""),elem.width(paneWidth),container.find(">.jspVerticalBar,>.jspHorizontalBar").remove().end()}pane.css("overflow","auto"),contentWidth=s.contentWidth?s.contentWidth:pane[0].scrollWidth,contentHeight=pane[0].scrollHeight,pane.css("overflow",""),percentInViewH=contentWidth/paneWidth,percentInViewV=contentHeight/paneHeight,isScrollableV=percentInViewV>1,isScrollableH=percentInViewH>1,isScrollableH||isScrollableV?(elem.addClass("jspScrollable"),isMaintainingPositon=settings.maintainPosition&&(verticalDragPosition||horizontalDragPosition),isMaintainingPositon&&(lastContentX=contentPositionX(),lastContentY=contentPositionY()),initialiseVerticalScroll(),initialiseHorizontalScroll(),resizeScrollbars(),isMaintainingPositon&&(scrollToX(maintainAtRight?contentWidth-paneWidth:lastContentX,!1),scrollToY(maintainAtBottom?contentHeight-paneHeight:lastContentY,!1)),initFocusHandler(),initMousewheel(),initTouch(),settings.enableKeyboardNavigation&&initKeyboardNav(),settings.clickOnTrack&&initClickOnTrack(),observeHash(),settings.hijackInternalLinks&&hijackInternalLinks()):(elem.removeClass("jspScrollable"),pane.css({top:0,left:0,width:container.width()-originalPaddingTotalWidth}),removeMousewheel(),removeFocusHandler(),removeKeyboardNav(),removeClickOnTrack()),settings.autoReinitialise&&!reinitialiseInterval?reinitialiseInterval=setInterval(function(){initialise(settings)},settings.autoReinitialiseDelay):!settings.autoReinitialise&&reinitialiseInterval&&clearInterval(reinitialiseInterval),originalScrollTop&&elem.scrollTop(0)&&scrollToY(originalScrollTop,!1),originalScrollLeft&&elem.scrollLeft(0)&&scrollToX(originalScrollLeft,!1),elem.trigger("jsp-initialised",[isScrollableH||isScrollableV])}function initialiseVerticalScroll(){isScrollableV&&(container.append($('<div class="jspVerticalBar" />').append($('<div class="jspCap jspCapTop" />'),$('<div class="jspTrack" />').append($('<div class="jspDrag" />').append($('<div class="jspDragTop" />'),$('<div class="jspDragBottom" />'))),$('<div class="jspCap jspCapBottom" />'))),verticalBar=container.find(">.jspVerticalBar"),verticalTrack=verticalBar.find(">.jspTrack"),verticalDrag=verticalTrack.find(">.jspDrag"),settings.showArrows&&(arrowUp=$('<a class="jspArrow jspArrowUp" />').bind("mousedown.jsp",getArrowScroll(0,-1)).bind("click.jsp",nil),arrowDown=$('<a class="jspArrow jspArrowDown" />').bind("mousedown.jsp",getArrowScroll(0,1)).bind("click.jsp",nil),settings.arrowScrollOnHover&&(arrowUp.bind("mouseover.jsp",getArrowScroll(0,-1,arrowUp)),arrowDown.bind("mouseover.jsp",getArrowScroll(0,1,arrowDown))),appendArrows(verticalTrack,settings.verticalArrowPositions,arrowUp,arrowDown)),verticalTrackHeight=paneHeight,container.find(">.jspVerticalBar>.jspCap:visible,>.jspVerticalBar>.jspArrow").each(function(){verticalTrackHeight-=$(this).outerHeight()}),verticalDrag.hover(function(){verticalDrag.addClass("jspHover")},function(){verticalDrag.removeClass("jspHover")}).bind("mousedown.jsp",function(e){$("html").bind("dragstart.jsp selectstart.jsp",nil),verticalDrag.addClass("jspActive");var startY=e.pageY-verticalDrag.position().top;return $("html").bind("mousemove.jsp",function(e){positionDragY(e.pageY-startY,!1)}).bind("mouseup.jsp mouseleave.jsp",cancelDrag),!1}),sizeVerticalScrollbar())}function sizeVerticalScrollbar(){verticalTrack.height(verticalTrackHeight+"px"),verticalDragPosition=0,scrollbarWidth=settings.verticalGutter+verticalTrack.outerWidth(),pane.width(paneWidth-scrollbarWidth-originalPaddingTotalWidth);try{0===verticalBar.position().left&&pane.css("margin-left",scrollbarWidth+"px")}catch(err){}}function initialiseHorizontalScroll(){isScrollableH&&(container.append($('<div class="jspHorizontalBar" />').append($('<div class="jspCap jspCapLeft" />'),$('<div class="jspTrack" />').append($('<div class="jspDrag" />').append($('<div class="jspDragLeft" />'),$('<div class="jspDragRight" />'))),$('<div class="jspCap jspCapRight" />'))),horizontalBar=container.find(">.jspHorizontalBar"),horizontalTrack=horizontalBar.find(">.jspTrack"),horizontalDrag=horizontalTrack.find(">.jspDrag"),settings.showArrows&&(arrowLeft=$('<a class="jspArrow jspArrowLeft" />').bind("mousedown.jsp",getArrowScroll(-1,0)).bind("click.jsp",nil),arrowRight=$('<a class="jspArrow jspArrowRight" />').bind("mousedown.jsp",getArrowScroll(1,0)).bind("click.jsp",nil),settings.arrowScrollOnHover&&(arrowLeft.bind("mouseover.jsp",getArrowScroll(-1,0,arrowLeft)),arrowRight.bind("mouseover.jsp",getArrowScroll(1,0,arrowRight))),appendArrows(horizontalTrack,settings.horizontalArrowPositions,arrowLeft,arrowRight)),horizontalDrag.hover(function(){horizontalDrag.addClass("jspHover")},function(){horizontalDrag.removeClass("jspHover")}).bind("mousedown.jsp",function(e){$("html").bind("dragstart.jsp selectstart.jsp",nil),horizontalDrag.addClass("jspActive");var startX=e.pageX-horizontalDrag.position().left;return $("html").bind("mousemove.jsp",function(e){positionDragX(e.pageX-startX,!1)}).bind("mouseup.jsp mouseleave.jsp",cancelDrag),!1}),horizontalTrackWidth=container.innerWidth(),sizeHorizontalScrollbar())}function sizeHorizontalScrollbar(){container.find(">.jspHorizontalBar>.jspCap:visible,>.jspHorizontalBar>.jspArrow").each(function(){horizontalTrackWidth-=$(this).outerWidth()}),horizontalTrack.width(horizontalTrackWidth+"px"),horizontalDragPosition=0}function resizeScrollbars(){if(isScrollableH&&isScrollableV){var horizontalTrackHeight=horizontalTrack.outerHeight(),verticalTrackWidth=verticalTrack.outerWidth();verticalTrackHeight-=horizontalTrackHeight,$(horizontalBar).find(">.jspCap:visible,>.jspArrow").each(function(){horizontalTrackWidth+=$(this).outerWidth()}),horizontalTrackWidth-=verticalTrackWidth,paneHeight-=verticalTrackWidth,paneWidth-=horizontalTrackHeight,horizontalTrack.parent().append($('<div class="jspCorner" />').css("width",horizontalTrackHeight+"px")),sizeVerticalScrollbar(),sizeHorizontalScrollbar()}isScrollableH&&pane.width(container.outerWidth()-originalPaddingTotalWidth+"px"),contentHeight=pane.outerHeight(),percentInViewV=contentHeight/paneHeight,isScrollableH&&(horizontalDragWidth=Math.ceil(1/percentInViewH*horizontalTrackWidth),horizontalDragWidth>settings.horizontalDragMaxWidth?horizontalDragWidth=settings.horizontalDragMaxWidth:horizontalDragWidth<settings.horizontalDragMinWidth&&(horizontalDragWidth=settings.horizontalDragMinWidth),horizontalDrag.width(horizontalDragWidth+"px"),dragMaxX=horizontalTrackWidth-horizontalDragWidth,_positionDragX(horizontalDragPosition)),isScrollableV&&(verticalDragHeight=Math.ceil(1/percentInViewV*verticalTrackHeight),verticalDragHeight>settings.verticalDragMaxHeight?verticalDragHeight=settings.verticalDragMaxHeight:verticalDragHeight<settings.verticalDragMinHeight&&(verticalDragHeight=settings.verticalDragMinHeight),verticalDrag.height(verticalDragHeight+"px"),dragMaxY=verticalTrackHeight-verticalDragHeight,_positionDragY(verticalDragPosition))}function appendArrows(ele,p,a1,a2){var aTemp,p1="before",p2="after";"os"==p&&(p=/Mac/.test(navigator.platform)?"after":"split"),p==p1?p2=p:p==p2&&(p1=p,aTemp=a1,a1=a2,a2=aTemp),ele[p1](a1)[p2](a2)}function getArrowScroll(dirX,dirY,ele){return function(){return arrowScroll(dirX,dirY,this,ele),this.blur(),!1}}function arrowScroll(dirX,dirY,arrow,ele){arrow=$(arrow).addClass("jspActive");var eve,scrollTimeout,isFirst=!0,doScroll=function(){0!==dirX&&jsp.scrollByX(dirX*settings.arrowButtonSpeed),0!==dirY&&jsp.scrollByY(dirY*settings.arrowButtonSpeed),scrollTimeout=setTimeout(doScroll,isFirst?settings.initialDelay:settings.arrowRepeatFreq),isFirst=!1};doScroll(),eve=ele?"mouseout.jsp":"mouseup.jsp",ele=ele||$("html"),ele.bind(eve,function(){arrow.removeClass("jspActive"),scrollTimeout&&clearTimeout(scrollTimeout),scrollTimeout=null,ele.unbind(eve)})}function initClickOnTrack(){removeClickOnTrack(),isScrollableV&&verticalTrack.bind("mousedown.jsp",function(e){if(void 0===e.originalTarget||e.originalTarget==e.currentTarget){var scrollTimeout,clickedTrack=$(this),offset=clickedTrack.offset(),direction=e.pageY-offset.top-verticalDragPosition,isFirst=!0,doScroll=function(){var offset=clickedTrack.offset(),pos=e.pageY-offset.top-verticalDragHeight/2,contentDragY=paneHeight*settings.scrollPagePercent,dragY=dragMaxY*contentDragY/(contentHeight-paneHeight);if(0>direction)verticalDragPosition-dragY>pos?jsp.scrollByY(-contentDragY):positionDragY(pos);else{if(!(direction>0))return cancelClick(),void 0;pos>verticalDragPosition+dragY?jsp.scrollByY(contentDragY):positionDragY(pos)}scrollTimeout=setTimeout(doScroll,isFirst?settings.initialDelay:settings.trackClickRepeatFreq),isFirst=!1},cancelClick=function(){scrollTimeout&&clearTimeout(scrollTimeout),scrollTimeout=null,$(document).unbind("mouseup.jsp",cancelClick)};return doScroll(),$(document).bind("mouseup.jsp",cancelClick),!1}}),isScrollableH&&horizontalTrack.bind("mousedown.jsp",function(e){if(void 0===e.originalTarget||e.originalTarget==e.currentTarget){var scrollTimeout,clickedTrack=$(this),offset=clickedTrack.offset(),direction=e.pageX-offset.left-horizontalDragPosition,isFirst=!0,doScroll=function(){var offset=clickedTrack.offset(),pos=e.pageX-offset.left-horizontalDragWidth/2,contentDragX=paneWidth*settings.scrollPagePercent,dragX=dragMaxX*contentDragX/(contentWidth-paneWidth);if(0>direction)horizontalDragPosition-dragX>pos?jsp.scrollByX(-contentDragX):positionDragX(pos);else{if(!(direction>0))return cancelClick(),void 0;pos>horizontalDragPosition+dragX?jsp.scrollByX(contentDragX):positionDragX(pos)}scrollTimeout=setTimeout(doScroll,isFirst?settings.initialDelay:settings.trackClickRepeatFreq),isFirst=!1},cancelClick=function(){scrollTimeout&&clearTimeout(scrollTimeout),scrollTimeout=null,$(document).unbind("mouseup.jsp",cancelClick)};return doScroll(),$(document).bind("mouseup.jsp",cancelClick),!1}})}function removeClickOnTrack(){horizontalTrack&&horizontalTrack.unbind("mousedown.jsp"),verticalTrack&&verticalTrack.unbind("mousedown.jsp")}function cancelDrag(){$("html").unbind("dragstart.jsp selectstart.jsp mousemove.jsp mouseup.jsp mouseleave.jsp"),verticalDrag&&verticalDrag.removeClass("jspActive"),horizontalDrag&&horizontalDrag.removeClass("jspActive")}function positionDragY(destY,animate){isScrollableV&&(0>destY?destY=0:destY>dragMaxY&&(destY=dragMaxY),void 0===animate&&(animate=settings.animateScroll),animate?jsp.animate(verticalDrag,"top",destY,_positionDragY):(verticalDrag.css("top",destY),_positionDragY(destY)))}function _positionDragY(destY){void 0===destY&&(destY=verticalDrag.position().top),container.scrollTop(0),verticalDragPosition=destY||0;var isAtTop=0===verticalDragPosition,isAtBottom=verticalDragPosition==dragMaxY,percentScrolled=destY/dragMaxY,destTop=-percentScrolled*(contentHeight-paneHeight);(wasAtTop!=isAtTop||wasAtBottom!=isAtBottom)&&(wasAtTop=isAtTop,wasAtBottom=isAtBottom,elem.trigger("jsp-arrow-change",[wasAtTop,wasAtBottom,wasAtLeft,wasAtRight])),updateVerticalArrows(isAtTop,isAtBottom),pane.css("top",destTop),elem.trigger("jsp-scroll-y",[-destTop,isAtTop,isAtBottom]).trigger("scroll")}function positionDragX(destX,animate){isScrollableH&&(0>destX?destX=0:destX>dragMaxX&&(destX=dragMaxX),void 0===animate&&(animate=settings.animateScroll),animate?jsp.animate(horizontalDrag,"left",destX,_positionDragX):(horizontalDrag.css("left",destX),_positionDragX(destX)))}function _positionDragX(destX){void 0===destX&&(destX=horizontalDrag.position().left),container.scrollTop(0),horizontalDragPosition=destX||0;var isAtLeft=0===horizontalDragPosition,isAtRight=horizontalDragPosition==dragMaxX,percentScrolled=destX/dragMaxX,destLeft=-percentScrolled*(contentWidth-paneWidth);(wasAtLeft!=isAtLeft||wasAtRight!=isAtRight)&&(wasAtLeft=isAtLeft,wasAtRight=isAtRight,elem.trigger("jsp-arrow-change",[wasAtTop,wasAtBottom,wasAtLeft,wasAtRight])),updateHorizontalArrows(isAtLeft,isAtRight),pane.css("left",destLeft),elem.trigger("jsp-scroll-x",[-destLeft,isAtLeft,isAtRight]).trigger("scroll")}function updateVerticalArrows(isAtTop,isAtBottom){settings.showArrows&&(arrowUp[isAtTop?"addClass":"removeClass"]("jspDisabled"),arrowDown[isAtBottom?"addClass":"removeClass"]("jspDisabled"))}function updateHorizontalArrows(isAtLeft,isAtRight){settings.showArrows&&(arrowLeft[isAtLeft?"addClass":"removeClass"]("jspDisabled"),arrowRight[isAtRight?"addClass":"removeClass"]("jspDisabled"))}function scrollToY(destY,animate){var percentScrolled=destY/(contentHeight-paneHeight);positionDragY(percentScrolled*dragMaxY,animate)}function scrollToX(destX,animate){var percentScrolled=destX/(contentWidth-paneWidth);positionDragX(percentScrolled*dragMaxX,animate)}function scrollToElement(ele,stickToTop,animate){var e,eleHeight,eleWidth,viewportTop,viewportLeft,maxVisibleEleTop,maxVisibleEleLeft,destY,destX,eleTop=0,eleLeft=0;try{e=$(ele)}catch(err){return}for(eleHeight=e.outerHeight(),eleWidth=e.outerWidth(),container.scrollTop(0),container.scrollLeft(0);!e.is(".jspPane");)if(eleTop+=e.position().top,eleLeft+=e.position().left,e=e.offsetParent(),/^body|html$/i.test(e[0].nodeName))return;viewportTop=contentPositionY(),maxVisibleEleTop=viewportTop+paneHeight,viewportTop>eleTop||stickToTop?destY=eleTop-settings.horizontalGutter:eleTop+eleHeight>maxVisibleEleTop&&(destY=eleTop-paneHeight+eleHeight+settings.horizontalGutter),isNaN(destY)||scrollToY(destY,animate),viewportLeft=contentPositionX(),maxVisibleEleLeft=viewportLeft+paneWidth,viewportLeft>eleLeft||stickToTop?destX=eleLeft-settings.horizontalGutter:eleLeft+eleWidth>maxVisibleEleLeft&&(destX=eleLeft-paneWidth+eleWidth+settings.horizontalGutter),isNaN(destX)||scrollToX(destX,animate)}function contentPositionX(){return-pane.position().left}function contentPositionY(){return-pane.position().top}function isCloseToBottom(){var scrollableHeight=contentHeight-paneHeight;return scrollableHeight>20&&scrollableHeight-contentPositionY()<10}function isCloseToRight(){var scrollableWidth=contentWidth-paneWidth;return scrollableWidth>20&&scrollableWidth-contentPositionX()<10}function initMousewheel(){container.unbind(mwEvent).bind(mwEvent,function(event,delta,deltaX,deltaY){horizontalDragPosition||(horizontalDragPosition=0),verticalDragPosition||(verticalDragPosition=0);var dX=horizontalDragPosition,dY=verticalDragPosition,factor=settings.mouseWheelSpeed||event.deltaFactor;return jsp.scrollBy(deltaX*factor,-deltaY*factor,!1),dX==horizontalDragPosition&&dY==verticalDragPosition})}function removeMousewheel(){container.unbind(mwEvent)}function nil(){return!1}function initFocusHandler(){pane.find(":input,a").unbind("focus.jsp").bind("focus.jsp",function(e){scrollToElement(e.target,!1)})}function removeFocusHandler(){pane.find(":input,a").unbind("focus.jsp")}function initKeyboardNav(){function keyDownHandler(){var dX=horizontalDragPosition,dY=verticalDragPosition;switch(keyDown){case 40:jsp.scrollByY(settings.keyboardSpeed,!1);break;case 38:jsp.scrollByY(-settings.keyboardSpeed,!1);break;case 34:case 32:jsp.scrollByY(paneHeight*settings.scrollPagePercent,!1);break;case 33:jsp.scrollByY(-paneHeight*settings.scrollPagePercent,!1);break;case 39:jsp.scrollByX(settings.keyboardSpeed,!1);break;case 37:jsp.scrollByX(-settings.keyboardSpeed,!1)}return elementHasScrolled=dX!=horizontalDragPosition||dY!=verticalDragPosition}var keyDown,elementHasScrolled,validParents=[];isScrollableH&&validParents.push(horizontalBar[0]),isScrollableV&&validParents.push(verticalBar[0]),pane.bind("focus.jsp",function(){elem.focus()}),elem.attr("tabindex",0).unbind("keydown.jsp keypress.jsp").bind("keydown.jsp",function(e){if(e.target===this||validParents.length&&$(e.target).closest(validParents).length){var dX=horizontalDragPosition,dY=verticalDragPosition;switch(e.keyCode){case 40:case 38:case 34:case 32:case 33:case 39:case 37:keyDown=e.keyCode,keyDownHandler();break;case 35:scrollToY(contentHeight-paneHeight),keyDown=null;break;case 36:scrollToY(0),keyDown=null}return elementHasScrolled=e.keyCode==keyDown&&dX!=horizontalDragPosition||dY!=verticalDragPosition,!elementHasScrolled}}).bind("keypress.jsp",function(e){return e.keyCode==keyDown&&keyDownHandler(),e.target===this||validParents.length&&$(e.target).closest(validParents).length?!elementHasScrolled:void 0}),settings.hideFocus?(elem.css("outline","none"),"hideFocus"in container[0]&&elem.attr("hideFocus",!0)):(elem.css("outline",""),"hideFocus"in container[0]&&elem.attr("hideFocus",!1))}function removeKeyboardNav(){elem.attr("tabindex","-1").removeAttr("tabindex").unbind("keydown.jsp keypress.jsp"),pane.unbind(".jsp")}function observeHash(){if(location.hash&&location.hash.length>1){var e,retryInt,hash=escape(location.hash.substr(1));try{e=$("#"+hash+', a[name="'+hash+'"]')}catch(err){return}e.length&&pane.find(hash)&&(0===container.scrollTop()?retryInt=setInterval(function(){container.scrollTop()>0&&(scrollToElement(e,!0),$(document).scrollTop(container.position().top),clearInterval(retryInt))},50):(scrollToElement(e,!0),$(document).scrollTop(container.position().top)))}}function hijackInternalLinks(){$(document.body).data("jspHijack")||($(document.body).data("jspHijack",!0),$(document.body).delegate("a[href*=#]","click",function(event){var hash,element,container,jsp,scrollTop,elementTop,href=this.href.substr(0,this.href.indexOf("#")),locationHref=location.href;if(-1!==location.href.indexOf("#")&&(locationHref=location.href.substr(0,location.href.indexOf("#"))),href===locationHref){hash=escape(this.href.substr(this.href.indexOf("#")+1));try{element=$("#"+hash+', a[name="'+hash+'"]')}catch(e){return}element.length&&(container=element.closest(".jspScrollable"),jsp=container.data("jsp"),jsp.scrollToElement(element,!0),container[0].scrollIntoView&&(scrollTop=$(window).scrollTop(),elementTop=element.offset().top,(scrollTop>elementTop||elementTop>scrollTop+$(window).height())&&container[0].scrollIntoView()),event.preventDefault())}}))}function initTouch(){var startX,startY,touchStartX,touchStartY,moved,moving=!1;container.unbind("touchstart.jsp touchmove.jsp touchend.jsp click.jsp-touchclick").bind("touchstart.jsp",function(e){var touch=e.originalEvent.touches[0];startX=contentPositionX(),startY=contentPositionY(),touchStartX=touch.pageX,touchStartY=touch.pageY,moved=!1,moving=!0}).bind("touchmove.jsp",function(ev){if(moving){var touchPos=ev.originalEvent.touches[0],dX=horizontalDragPosition,dY=verticalDragPosition;return jsp.scrollTo(startX+touchStartX-touchPos.pageX,startY+touchStartY-touchPos.pageY),moved=moved||Math.abs(touchStartX-touchPos.pageX)>5||Math.abs(touchStartY-touchPos.pageY)>5,dX==horizontalDragPosition&&dY==verticalDragPosition}}).bind("touchend.jsp",function(){moving=!1}).bind("click.jsp-touchclick",function(){return moved?(moved=!1,!1):void 0})}function destroy(){var currentY=contentPositionY(),currentX=contentPositionX();elem.removeClass("jspScrollable").unbind(".jsp"),pane.unbind(".jsp"),elem.replaceWith(originalElement.append(pane.children())),originalElement.scrollTop(currentY),originalElement.scrollLeft(currentX),reinitialiseInterval&&clearInterval(reinitialiseInterval)}var settings,pane,paneWidth,paneHeight,container,contentWidth,contentHeight,percentInViewH,percentInViewV,isScrollableV,isScrollableH,verticalDrag,dragMaxY,verticalDragPosition,horizontalDrag,dragMaxX,horizontalDragPosition,verticalBar,verticalTrack,scrollbarWidth,verticalTrackHeight,verticalDragHeight,arrowUp,arrowDown,horizontalBar,horizontalTrack,horizontalTrackWidth,horizontalDragWidth,arrowLeft,arrowRight,reinitialiseInterval,originalPadding,originalPaddingTotalWidth,previousContentWidth,jsp=this,wasAtTop=!0,wasAtLeft=!0,wasAtBottom=!1,wasAtRight=!1,originalElement=elem.clone(!1,!1).empty(),mwEvent=$.fn.mwheelIntent?"mwheelIntent.jsp":"mousewheel.jsp";"border-box"===elem.css("box-sizing")?(originalPadding=0,originalPaddingTotalWidth=0):(originalPadding=elem.css("paddingTop")+" "+elem.css("paddingRight")+" "+elem.css("paddingBottom")+" "+elem.css("paddingLeft"),originalPaddingTotalWidth=(parseInt(elem.css("paddingLeft"),10)||0)+(parseInt(elem.css("paddingRight"),10)||0)),$.extend(jsp,{reinitialise:function(s){s=$.extend({},settings,s),initialise(s)},scrollToElement:function(ele,stickToTop,animate){scrollToElement(ele,stickToTop,animate)},scrollTo:function(destX,destY,animate){scrollToX(destX,animate),scrollToY(destY,animate)},scrollToX:function(destX,animate){scrollToX(destX,animate)},scrollToY:function(destY,animate){scrollToY(destY,animate)},scrollToPercentX:function(destPercentX,animate){scrollToX(destPercentX*(contentWidth-paneWidth),animate)},scrollToPercentY:function(destPercentY,animate){scrollToY(destPercentY*(contentHeight-paneHeight),animate)},scrollBy:function(deltaX,deltaY,animate){jsp.scrollByX(deltaX,animate),jsp.scrollByY(deltaY,animate)},scrollByX:function(deltaX,animate){var destX=contentPositionX()+Math[0>deltaX?"floor":"ceil"](deltaX),percentScrolled=destX/(contentWidth-paneWidth);positionDragX(percentScrolled*dragMaxX,animate)},scrollByY:function(deltaY,animate){var destY=contentPositionY()+Math[0>deltaY?"floor":"ceil"](deltaY),percentScrolled=destY/(contentHeight-paneHeight);positionDragY(percentScrolled*dragMaxY,animate)},positionDragX:function(x,animate){positionDragX(x,animate)},positionDragY:function(y,animate){positionDragY(y,animate)},animate:function(ele,prop,value,stepCallback){var params={};params[prop]=value,ele.animate(params,{duration:settings.animateDuration,easing:settings.animateEase,queue:!1,step:stepCallback})},getContentPositionX:function(){return contentPositionX()},getContentPositionY:function(){return contentPositionY()},getContentWidth:function(){return contentWidth},getContentHeight:function(){return contentHeight},getPercentScrolledX:function(){return contentPositionX()/(contentWidth-paneWidth)},getPercentScrolledY:function(){return contentPositionY()/(contentHeight-paneHeight)},getIsScrollableH:function(){return isScrollableH},getIsScrollableV:function(){return isScrollableV},getContentPane:function(){return pane},scrollToBottom:function(animate){positionDragY(dragMaxY,animate)},hijackInternalLinks:$.noop,destroy:function(){destroy()}}),initialise(s)}return settings=$.extend({},$.fn.jScrollPane.defaults,settings),$.each(["arrowButtonSpeed","trackClickSpeed","keyboardSpeed"],function(){settings[this]=settings[this]||settings.speed}),this.each(function(){var elem=$(this),jspApi=elem.data("jsp");jspApi?jspApi.reinitialise(settings):($("script",elem).filter('[type="text/javascript"],:not([type])').remove(),jspApi=new JScrollPane(elem,settings),elem.data("jsp",jspApi))})},$.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}});
- !function(factory){"function"==typeof define&&define.amd?define(["jquery"],factory):"object"==typeof exports?module.exports=factory:factory(jQuery)}(function($){function handler(event){var orgEvent=event||window.event,args=slice.call(arguments,1),delta=0,deltaX=0,deltaY=0,absDelta=0,offsetX=0,offsetY=0;if(event=$.event.fix(orgEvent),event.type="mousewheel","detail"in orgEvent&&(deltaY=-1*orgEvent.detail),"wheelDelta"in orgEvent&&(deltaY=orgEvent.wheelDelta),"wheelDeltaY"in orgEvent&&(deltaY=orgEvent.wheelDeltaY),"wheelDeltaX"in orgEvent&&(deltaX=-1*orgEvent.wheelDeltaX),"axis"in orgEvent&&orgEvent.axis===orgEvent.HORIZONTAL_AXIS&&(deltaX=-1*deltaY,deltaY=0),delta=0===deltaY?deltaX:deltaY,"deltaY"in orgEvent&&(deltaY=-1*orgEvent.deltaY,delta=deltaY),"deltaX"in orgEvent&&(deltaX=orgEvent.deltaX,0===deltaY&&(delta=-1*deltaX)),0!==deltaY||0!==deltaX){if(1===orgEvent.deltaMode){var lineHeight=$.data(this,"mousewheel-line-height");delta*=lineHeight,deltaY*=lineHeight,deltaX*=lineHeight}else if(2===orgEvent.deltaMode){var pageHeight=$.data(this,"mousewheel-page-height");delta*=pageHeight,deltaY*=pageHeight,deltaX*=pageHeight}if(absDelta=Math.max(Math.abs(deltaY),Math.abs(deltaX)),(!lowestDelta||lowestDelta>absDelta)&&(lowestDelta=absDelta,shouldAdjustOldDeltas(orgEvent,absDelta)&&(lowestDelta/=40)),shouldAdjustOldDeltas(orgEvent,absDelta)&&(delta/=40,deltaX/=40,deltaY/=40),delta=Math[delta>=1?"floor":"ceil"](delta/lowestDelta),deltaX=Math[deltaX>=1?"floor":"ceil"](deltaX/lowestDelta),deltaY=Math[deltaY>=1?"floor":"ceil"](deltaY/lowestDelta),special.settings.normalizeOffset&&this.getBoundingClientRect){var boundingRect=this.getBoundingClientRect();offsetX=event.clientX-boundingRect.left,offsetY=event.clientY-boundingRect.top}return event.deltaX=deltaX,event.deltaY=deltaY,event.deltaFactor=lowestDelta,event.offsetX=offsetX,event.offsetY=offsetY,event.deltaMode=0,args.unshift(event,delta,deltaX,deltaY),nullLowestDeltaTimeout&&clearTimeout(nullLowestDeltaTimeout),nullLowestDeltaTimeout=setTimeout(nullLowestDelta,200),($.event.dispatch||$.event.handle).apply(this,args)}}function nullLowestDelta(){lowestDelta=null}function shouldAdjustOldDeltas(orgEvent,absDelta){return special.settings.adjustOldDeltas&&"mousewheel"===orgEvent.type&&absDelta%120===0}var nullLowestDeltaTimeout,lowestDelta,toFix=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],toBind="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],slice=Array.prototype.slice;if($.event.fixHooks)for(var i=toFix.length;i;)$.event.fixHooks[toFix[--i]]=$.event.mouseHooks;var special=$.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var i=toBind.length;i;)this.addEventListener(toBind[--i],handler,!1);else this.onmousewheel=handler;$.data(this,"mousewheel-line-height",special.getLineHeight(this)),$.data(this,"mousewheel-page-height",special.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var i=toBind.length;i;)this.removeEventListener(toBind[--i],handler,!1);else this.onmousewheel=null;$.removeData(this,"mousewheel-line-height"),$.removeData(this,"mousewheel-page-height")},getLineHeight:function(elem){var $elem=$(elem),$parent=$elem["offsetParent"in $.fn?"offsetParent":"parent"]();return $parent.length||($parent=$("body")),parseInt($parent.css("fontSize"),10)||parseInt($elem.css("fontSize"),10)||16},getPageHeight:function(elem){return $(elem).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};$.fn.extend({mousewheel:function(fn){return fn?this.bind("mousewheel",fn):this.trigger("mousewheel")},unmousewheel:function(fn){return this.unbind("mousewheel",fn)}})});
- var JSON;JSON||(JSON={}),function(){"use strict";function f(n){return 10>n?"0"+n:n}function quote(string){return escapable.lastIndex=0,escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return"string"==typeof c?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,partial,mind=gap,value=holder[key];switch(value&&"object"==typeof value&&"function"==typeof value.toJSON&&(value=value.toJSON(key)),"function"==typeof rep&&(value=rep.call(holder,key,value)),typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value)return"null";if(gap+=indent,partial=[],"[object Array]"===Object.prototype.toString.apply(value)){for(length=value.length,i=0;length>i;i+=1)partial[i]=str(i,value)||"null";return v=0===partial.length?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]",gap=mind,v}if(rep&&"object"==typeof rep)for(length=rep.length,i=0;length>i;i+=1)"string"==typeof rep[i]&&(k=rep[i],v=str(k,value),v&&partial.push(quote(k)+(gap?": ":":")+v));else for(k in value)Object.prototype.hasOwnProperty.call(value,k)&&(v=str(k,value),v&&partial.push(quote(k)+(gap?": ":":")+v));return v=0===partial.length?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}",gap=mind,v}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;"function"!=typeof JSON.stringify&&(JSON.stringify=function(value,replacer,space){var i;if(gap="",indent="","number"==typeof space)for(i=0;space>i;i+=1)indent+=" ";else"string"==typeof space&&(indent=space);if(rep=replacer,replacer&&"function"!=typeof replacer&&("object"!=typeof replacer||"number"!=typeof replacer.length))throw new Error("JSON.stringify");return str("",{"":value})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(holder,key){var k,v,value=holder[key];if(value&&"object"==typeof value)for(k in value)Object.prototype.hasOwnProperty.call(value,k)&&(v=walk(value,k),void 0!==v?value[k]=v:delete value[k]);return reviver.call(holder,key,value)}var j;if(text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}();
|