1/*! Copyright (c) 2013 Brandon Aaron (http://brandonaaron.net) 2* Licensed under the MIT License (LICENSE.txt). 3* 4* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. 5* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. 6* Thanks to: Seamus Leahy for adding deltaX and deltaY 7* 8* Version: 3.1.3 9* 10* Requires: 1.2.2+ 11*/ 12(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else{if(typeof exports==="object"){module.exports=factory}else{factory(jQuery)}}}(function($){var toFix=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"];var toBind="onwheel" in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"];var lowestDelta,lowestDeltaXY;if($.event.fixHooks){for(var i=toFix.length;i;){$.event.fixHooks[toFix[--i]]=$.event.mouseHooks}}$.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var i=toBind.length;i;){this.addEventListener(toBind[--i],handler,false)}}else{this.onmousewheel=handler}},teardown:function(){if(this.removeEventListener){for(var i=toBind.length;i;){this.removeEventListener(toBind[--i],handler,false)}}else{this.onmousewheel=null}}};$.fn.extend({mousewheel:function(fn){return fn?this.bind("mousewheel",fn):this.trigger("mousewheel")},unmousewheel:function(fn){return this.unbind("mousewheel",fn)}});function handler(event){var orgEvent=event||window.event,args=[].slice.call(arguments,1),delta=0,deltaX=0,deltaY=0,absDelta=0,absDeltaXY=0,fn;event=$.event.fix(orgEvent);event.type="mousewheel";if(orgEvent.wheelDelta){delta=orgEvent.wheelDelta}if(orgEvent.detail){delta=orgEvent.detail*-1}if(orgEvent.deltaY){deltaY=orgEvent.deltaY*-1;delta=deltaY}if(orgEvent.deltaX){deltaX=orgEvent.deltaX;delta=deltaX*-1}if(orgEvent.wheelDeltaY!==undefined){deltaY=orgEvent.wheelDeltaY}if(orgEvent.wheelDeltaX!==undefined){deltaX=orgEvent.wheelDeltaX*-1}absDelta=Math.abs(delta);if(!lowestDelta||absDelta<lowestDelta){lowestDelta=absDelta}absDeltaXY=Math.max(Math.abs(deltaY),Math.abs(deltaX));if(!lowestDeltaXY||absDeltaXY<lowestDeltaXY){lowestDeltaXY=absDeltaXY}fn=delta>0?"floor":"ceil";delta=Math[fn](delta/lowestDelta);deltaX=Math[fn](deltaX/lowestDeltaXY);deltaY=Math[fn](deltaY/lowestDeltaXY);args.unshift(event,delta,deltaX,deltaY);return($.event.dispatch||$.event.handle).apply(this,args)}})); 13 14 15/* 16* @fileOverview TouchSwipe - jQuery Plugin 17* @version 1.6.3 18* 19* @author Matt Bryson http://www.github.com/mattbryson 20* @see https://github.com/mattbryson/TouchSwipe-Jquery-Plugin 21* @see http://labs.skinkers.com/touchSwipe/ 22* @see http://plugins.jquery.com/project/touchSwipe 23* 24* Copyright (c) 2010 Matt Bryson 25* Dual licensed under the MIT or GPL Version 2 licenses. 26*/ 27(function(e){var o="left",n="right",d="up",v="down",c="in",w="out",l="none",r="auto",k="swipe",s="pinch",x="tap",i="doubletap",b="longtap",A="horizontal",t="vertical",h="all",q=10,f="start",j="move",g="end",p="cancel",a="ontouchstart" in window,y="TouchSwipe";var m={fingers:1,threshold:75,cancelThreshold:null,pinchThreshold:20,maxTimeThreshold:null,fingerReleaseThreshold:250,longTapThreshold:500,doubleTapThreshold:200,swipe:null,swipeLeft:null,swipeRight:null,swipeUp:null,swipeDown:null,swipeStatus:null,pinchIn:null,pinchOut:null,pinchStatus:null,click:null,tap:null,doubleTap:null,longTap:null,triggerOnTouchEnd:true,triggerOnTouchLeave:false,allowPageScroll:"auto",fallbackToMouseEvents:true,excludedElements:"button, input, select, textarea, a, .noSwipe"};e.fn.swipe=function(D){var C=e(this),B=C.data(y);if(B&&typeof D==="string"){if(B[D]){return B[D].apply(this,Array.prototype.slice.call(arguments,1))}else{e.error("Method "+D+" does not exist on jQuery.swipe")}}else{if(!B&&(typeof D==="object"||!D)){return u.apply(this,arguments)}}return C};e.fn.swipe.defaults=m;e.fn.swipe.phases={PHASE_START:f,PHASE_MOVE:j,PHASE_END:g,PHASE_CANCEL:p};e.fn.swipe.directions={LEFT:o,RIGHT:n,UP:d,DOWN:v,IN:c,OUT:w};e.fn.swipe.pageScroll={NONE:l,HORIZONTAL:A,VERTICAL:t,AUTO:r};e.fn.swipe.fingers={ONE:1,TWO:2,THREE:3,ALL:h};function u(B){if(B&&(B.allowPageScroll===undefined&&(B.swipe!==undefined||B.swipeStatus!==undefined))){B.allowPageScroll=l}
27if(B.click!==undefined&&B.tap===undefined){B.tap=B.click}if(!B){B={}}B=e.extend({},e.fn.swipe.defaults,B);return this.each(function(){var D=e(this);var C=D.data(y);if(!C){C=new z(this,B);D.data(y,C)}})}function z(a0,aq){var av=(a||!aq.fallbackToMouseEvents),G=av?"touchstart":"mousedown",au=av?"touchmove":"mousemove",R=av?"touchend":"mouseup",P=av?null:"mouseleave",az="touchcancel";var ac=0,aL=null,Y=0,aX=0,aV=0,D=1,am=0,aF=0,J=null;var aN=e(a0);var W="start";var T=0;var aM=null;var Q=0,aY=0,a1=0,aa=0,K=0;var aS=null;try{aN.bind(G,aJ);aN.bind(az,a5)}catch(ag){e.error("events not supported "+G+","+az+" on jQuery.swipe")}this.enable=function(){aN.bind(G,aJ);aN.bind(az,a5);return aN};this.disable=function(){aG();return aN};this.destroy=function(){aG();aN.data(y,null);return aN};this.option=function(a8,a7){if(aq[a8]!==undefined){if(a7===undefined){return aq[a8]}else{aq[a8]=a7}}else{e.error("Option "+a8+" does not exist on jQuery.swipe.options")}};function aJ(a9){if(ax()){return}if(e(a9.target).closest(aq.excludedElements,aN).length>0){return}var ba=a9.originalEvent?a9.originalEvent:a9;var a8,a7=a?ba.touches[0]:ba;W=f;if(a){T=ba.touches.length}else{a9.preventDefault()}ac=0;aL=null;aF=null;Y=0;aX=0;aV=0;D=1;am=0;aM=af();J=X();O();if(!a||(T===aq.fingers||aq.fingers===h)||aT()){ae(0,a7);Q=ao();if(T==2){ae(1,ba.touches[1]);aX=aV=ap(aM[0].start,aM[1].start)}if(aq.swipeStatus||aq.pinchStatus){a8=L(ba,W)}}else{a8=false}if(a8===false){W=p;L(ba,W);return a8}else{ak(true)}}function aZ(ba){var bd=ba.originalEvent?ba.originalEvent:ba;if(W===g||W===p||ai()){return}var a9,a8=a?bd.touches[0]:bd;var bb=aD(a8);aY=ao();if(a){T=bd.touches.length}W=j;if(T==2){if(aX==0){ae(1,bd.touches[1]);aX=aV=ap(aM[0].start,aM[1].start)}else{aD(bd.touches[1]);aV=ap(aM[0].end,aM[1].end);aF=an(aM[0].end,aM[1].end)}D=a3(aX,aV);am=Math.abs(aX-aV)}if((T===aq.fingers||aq.fingers===h)||!a||aT()){aL=aH(bb.start,bb.end);ah(ba,aL);ac=aO(bb.start,bb.end);Y=aI();aE(aL,ac);if(aq.swipeStatus||aq.pinchStatus){a9=L(bd,W)}if(!aq.triggerOnTouchEnd||aq.triggerOnTouchLeave){var a7=true;if(aq.triggerOnTouchLeave){var bc=aU(this);a7=B(bb.end,bc)}if(!aq.triggerOnTouchEnd&&a7){W=ay(j)}else{if(aq.triggerOnTouchLeave&&!a7){W=ay(g)}}if(W==p||W==g){L(bd,W)}}}else{W=p;L(bd,W)}if(a9===false){W=p;L(bd,W)}}function I(a7){var a8=a7.originalEvent;if(a){if(a8.touches.length>0){C();return true}}if(ai()){T=aa}a7.preventDefault();aY=ao();Y=aI();if(a6()){W=p;L(a8,W)}else{if(aq.triggerOnTouchEnd||(aq.triggerOnTouchEnd==false&&W===j)){W=g;L(a8,W)}else{if(!aq.triggerOnTouchEnd&&a2()){W=g;aB(a8,W,x)}else{if(W===j){W=p;L(a8,W)}}}}ak(false)}function a5(){T=0;aY=0;Q=0;aX=0;aV=0;D=1;O();ak(false)}function H(a7){var a8=a7.originalEvent;if(aq.triggerOnTouchLeave){W=ay(g);L(a8,W)}}function aG(){aN.unbind(G,aJ);aN.unbind(az,a5);aN.unbind(au,aZ);aN.unbind(R,I);if(P){aN.unbind(P,H)}ak(false)}function ay(bb){var ba=bb;var a9=aw();var a8=aj();var a7=a6();if(!a9||a7){ba=p}else{if(a8&&bb==j&&(!aq.triggerOnTouchEnd||aq.triggerOnTouchLeave)){ba=g}else{if(!a8&&bb==g&&aq.triggerOnTouchLeave){ba=p}}}return ba}function L(a9,a7){var a8=undefined;if(F()||S()){a8=aB(a9,a7,k)}else{if((M()||aT())&&a8!==false){a8=aB(a9,a7,s)}}if(aC()&&a8!==false){a8=aB(a9,a7,i)}else{if(al()&&a8!==false){a8=aB(a9,a7,b)}else{if(ad()&&a8!==false){a8=aB(a9,a7,x)}}}if(a7===p){a5(a9)}if(a7===g){if(a){if(a9.touches.length==0){a5(a9)}}else{a5(a9)}}return a8}function aB(ba,a7,a9){var a8=undefined;if(a9==k){aN.trigger("swipeStatus",[a7,aL||null,ac||0,Y||0,T]);if(aq.swipeStatus){a8=aq.swipeStatus.call(aN,ba,a7,aL||null,ac||0,Y||0,T);if(a8===false){return false}}if(a7==g&&aR()){aN.trigger("swipe",[aL,ac,Y,T]);if(aq.swipe){a8=aq.swipe.call(aN,ba,aL,ac,Y,T);if(a8===false){return false}}switch(aL){case o:aN.trigger("swipeLeft",[aL,ac,Y,T]);if(aq.swipeLeft){a8=aq.swipeLeft.call(aN,ba,aL,ac,Y,T)}break;case n:aN.trigger("swipeRight",[aL,ac,Y,T]);if(aq.swipeRight){a8=aq.swipeRight.call(aN,ba,aL,ac,Y,T)}break;case d:aN.trigger("swipeUp",[aL,ac,Y,T]);if(aq.swipeUp){a8=aq.swipeUp.call(aN,ba,aL,ac,Y,T)}break;case v:aN.trigger("swipeDown",[aL,ac,Y,T]);if(aq.swipeDown){a8=aq.swipeDown.call(aN,ba,aL,ac,Y,T)}
vendor: 4,093 bytes, line 27
27break}}}if(a9==s){aN.trigger("pinchStatus",[a7,aF||null,am||0,Y||0,T,D]);if(aq.pinchStatus){a8=aq.pinchStatus.call(aN,ba,a7,aF||null,am||0,Y||0,T,D);if(a8===false){return false}}if(a7==g&&a4()){switch(aF){case c:aN.trigger("pinchIn",[aF||null,am||0,Y||0,T,D]);if(aq.pinchIn){a8=aq.pinchIn.call(aN,ba,aF||null,am||0,Y||0,T,D)}break;case w:aN.trigger("pinchOut",[aF||null,am||0,Y||0,T,D]);if(aq.pinchOut){a8=aq.pinchOut.call(aN,ba,aF||null,am||0,Y||0,T,D)}break}}}if(a9==x){if(a7===p||a7===g){clearTimeout(aS);if(V()&&!E()){K=ao();aS=setTimeout(e.proxy(function(){K=null;aN.trigger("tap",[ba.target]);if(aq.tap){a8=aq.tap.call(aN,ba,ba.target)}},this),aq.doubleTapThreshold)}else{K=null;aN.trigger("tap",[ba.target]);if(aq.tap){a8=aq.tap.call(aN,ba,ba.target)}}}}else{if(a9==i){if(a7===p||a7===g){clearTimeout(aS);K=null;aN.trigger("doubletap",[ba.target]);if(aq.doubleTap){a8=aq.doubleTap.call(aN,ba,ba.target)}}}else{if(a9==b){if(a7===p||a7===g){clearTimeout(aS);K=null;aN.trigger("longtap",[ba.target]);if(aq.longTap){a8=aq.longTap.call(aN,ba,ba.target)}}}}}return a8}function aj(){var a7=true;if(aq.threshold!==null){a7=ac>=aq.threshold}return a7}function a6(){var a7=false;if(aq.cancelThreshold!==null&&aL!==null){a7=(aP(aL)-ac)>=aq.cancelThreshold}return a7}function ab(){if(aq.pinchThreshold!==null){return am>=aq.pinchThreshold}return true}function aw(){var a7;if(aq.maxTimeThreshold){if(Y>=aq.maxTimeThreshold){a7=false}else{a7=true}}else{a7=true}return a7}function ah(a7,a8){if(aq.allowPageScroll===l||aT()){a7.preventDefault()}else{var a9=aq.allowPageScroll===r;switch(a8){case o:if((aq.swipeLeft&&a9)||(!a9&&aq.allowPageScroll!=A)){a7.preventDefault()}break;case n:if((aq.swipeRight&&a9)||(!a9&&aq.allowPageScroll!=A)){a7.preventDefault()}break;case d:if((aq.swipeUp&&a9)||(!a9&&aq.allowPageScroll!=t)){a7.preventDefault()}break;case v:if((aq.swipeDown&&a9)||(!a9&&aq.allowPageScroll!=t)){a7.preventDefault()}break}}}function a4(){var a8=aK();var a7=U();var a9=ab();return a8&&a7&&a9}function aT(){return !!(aq.pinchStatus||aq.pinchIn||aq.pinchOut)}function M(){return !!(a4()&&aT())}function aR(){var ba=aw();var bc=aj();var a9=aK();var a7=U();var a8=a6();var bb=!a8&&a7&&a9&&bc&&ba;return bb}function S(){return !!(aq.swipe||aq.swipeStatus||aq.swipeLeft||aq.swipeRight||aq.swipeUp||aq.swipeDown)}function F(){return !!(aR()&&S())}function aK(){return((T===aq.fingers||aq.fingers===h)||!a)}function U(){return aM[0].end.x!==0}function a2(){return !!(aq.tap)}function V(){return !!(aq.doubleTap)}function aQ(){return !!(aq.longTap)}function N(){if(K==null){return false}var a7=ao();return(V()&&((a7-K)<=aq.doubleTapThreshold))}function E(){return N()}function at(){return((T===1||!a)&&(isNaN(ac)||ac===0))}function aW(){return((Y>aq.longTapThreshold)&&(ac<q))}function ad(){return !!(at()&&a2())}function aC(){return !!(N()&&V())}function al(){return !!(aW()&&aQ())}function C(){a1=ao();aa=event.touches.length+1}function O(){a1=0;aa=0}function ai(){var a7=false;if(a1){var a8=ao()-a1;if(a8<=aq.fingerReleaseThreshold){a7=true}}return a7}function ax(){return !!(aN.data(y+"_intouch")===true)}function ak(a7){if(a7===true){aN.bind(au,aZ);aN.bind(R,I);if(P){aN.bind(P,H)}}else{aN.unbind(au,aZ,false);aN.unbind(R,I,false);if(P){aN.unbind(P,H,false)}}aN.data(y+"_intouch",a7===true)}function ae(a8,a7){var a9=a7.identifier!==undefined?a7.identifier:0;aM[a8].identifier=a9;aM[a8].start.x=aM[a8].end.x=a7.pageX||a7.clientX;aM[a8].start.y=aM[a8].end.y=a7.pageY||a7.clientY;return aM[a8]}function aD(a7){var a9=a7.identifier!==undefined?a7.identifier:0;var a8=Z(a9);a8.end.x=a7.pageX||a7.clientX;a8.end.y=a7.pageY||a7.clientY;return a8}function Z(a8){for(var a7=0;a7<aM.length;a7++){if(aM[a7].identifier==a8){return aM[a7]}}}function af(){var a7=[];for(var a8=0;a8<=5;a8++){a7.push({start:{x:0,y:0},end:{x:0,y:0},identifier:0})}return a7}function aE(a7,a8){a8=Math.max(a8,aP(a7));J[a7].distance=a8}function aP(a7){return J[a7].distance}function X(){var a7={};a7[o]=ar(o);a7[n]=ar(n);a7[d]=ar(d);a7[v]=ar(v);return a7}function ar(a7){return{direction:a7,distance:0}}function aI(){return aY-Q}
27function ap(ba,a9){var a8=Math.abs(ba.x-a9.x);var a7=Math.abs(ba.y-a9.y);return Math.round(Math.sqrt(a8*a8+a7*a7))}function a3(a7,a8){var a9=(a8/a7)*1;return a9.toFixed(2)}function an(){if(D<1){return w}else{return c}}function aO(a8,a7){return Math.round(Math.sqrt(Math.pow(a7.x-a8.x,2)+Math.pow(a7.y-a8.y,2)))}function aA(ba,a8){var a7=ba.x-a8.x;var bc=a8.y-ba.y;var a9=Math.atan2(bc,a7);var bb=Math.round(a9*180/Math.PI);if(bb<0){bb=360-Math.abs(bb)}return bb}function aH(a8,a7){var a9=aA(a8,a7);if((a9<=45)&&(a9>=0)){return o}else{if((a9<=360)&&(a9>=315)){return o}else{if((a9>=135)&&(a9<=225)){return n}else{if((a9>45)&&(a9<135)){return v}else{return d}}}}}function ao(){var a7=new Date();return a7.getTime()}function aU(a7){a7=e(a7);var a9=a7.offset();var a8={left:a9.left,right:a9.left+a7.outerWidth(),top:a9.top,bottom:a9.top+a7.outerHeight()};return a8}function B(a7,a8){return(a7.x>a8.left&&a7.x<a8.right&&a7.y>a8.top&&a7.y<a8.bottom)}}})(jQuery); 28 29 30/** 31 * @author trixta 32 * @version 1.2 33 */ 34(function(c){var b={pos:[-260,-260]},d=3,h=document,g=h.documentElement,e=h.body,a,i;function f(){if(this===b.elem){b.pos=[-260,-260];b.elem=false;d=3}}c.event.special.mwheelIntent={setup:function(){var j=c(this).bind("mousewheel",c.event.special.mwheelIntent.handler);if(this!==h&&this!==g&&this!==e){j.bind("mouseleave",f)}j=null;return true},teardown:function(){c(this).unbind("mousewheel",c.event.special.mwheelIntent.handler).unbind("mouseleave",f);return true},handler:function(j,k){var l=[j.clientX,j.clientY];if(this===b.elem||Math.abs(b.pos[0]-l[0])>d||Math.abs(b.pos[1]-l[1])>d){b.elem=this;b.pos=l;d=250;clearTimeout(i);i=setTimeout(function(){d=10},200);clearTimeout(a);a=setTimeout(function(){d=3},1500);j=c.extend({},j,{type:"mwheelIntent"});return c.event.handle.apply(this,arguments)}}};c.fn.extend({mwheelIntent:function(j){return j?this.bind("mwheelIntent",j):this.trigger("mwheelIntent")},unmwheelIntent:function(j){return this.unbind("mwheelIntent",j)}});c(function(){e=h.body;c(h).bind("mwheelIntent.mwheelIntentDefault",c.noop)})})(jQuery); 35 36/* 37 * jScrollPane - v2.0.0beta11 - 2011-07-04 38 * http://jscrollpane.kelvinluck.com/ 39 * 40 * Copyright (c) 2010 Kelvin Luck 41 * Dual licensed under the MIT and GPL licenses. 42 */ 43(function(b,a,c){b.fn.jScrollPane=function(e){function d(D,O){var az,Q=this,Y,ak,v,am,T,Z,y,q,aA,aF,av,i,I,h,j,aa,U,aq,X,t,A,ar,af,an,G,l,au,ay,x,aw,aI,f,L,aj=true,P=true,aH=false,k=false,ap=D.clone(false,false).empty(),ac=b.fn.mwheelIntent?"mwheelIntent.jsp":"mousewheel.jsp";aI=D.css("paddingTop")+" "+D.css("paddingRight")+" "+D.css("paddingBottom")+" "+D.css("paddingLeft");f=(parseInt(D.css("paddingLeft"),10)||0)+(parseInt(D.css("paddingRight"),10)||0);function at(aR){var aM,aO,aN,aK,aJ,aQ,aP=false,aL=false;az=aR;if(Y===c){aJ=D.scrollTop();aQ=D.scrollLeft();D.css({overflow:"hidden",padding:0});ak=D.innerWidth()+f;v=D.innerHeight();D.width(ak);Y=b('<div class="jspPane" />').css("padding",aI).append(D.children());am=b('<div class="jspContainer" />').css({width:ak+"px",height:v+"px"}).append(Y).appendTo(D)}else{D.css("width","");aP=az.stickToBottom&&K();aL=az.stickToRight&&B();aK=D.innerWidth()+f!=ak||D.outerHeight()!=v;if(aK){ak=D.innerWidth()+f;v=D.innerHeight();am.css({width:ak+"px",height:v+"px"})}if(!aK&&L==T&&Y.outerHeight()==Z){D.width(ak);return}L=T;Y.css("width","");D.width(ak);am.find(">.jspVerticalBar,>.jspHorizontalBar").remove().end()}Y.css("overflow","auto");if(aR.contentWidth){T=aR.contentWidth}else{T=Y[0].scrollWidth}Z=Y[0].scrollHeight;Y.css("overflow","");y=T/ak;q=Z/v;aA=q>1;aF=y>1;if(!(aF||aA)){D.removeClass("jspScrollable");Y.css({top:0,width:am.width()-f});n();E();R();w();ai()}else{D.addClass("jspScrollable");aM=az.maintainPosition&&(I||aa);if(aM){aO=aD();aN=aB()}aG();z();F();if(aM){N(aL?(T-ak):aO,false);M(aP?(Z-v):aN,false)}J();ag();ao();if(az.enableKeyboardNavigation){S()}if(az.clickOnTrack){p()}C();if(az.hijackInternalLinks){m()}}if(az.autoReinitialise&&!aw){aw=setInterval(function(){at(az)},az.autoReinitialiseDelay)}else{if(!az.autoReinitialise&&aw){clearInterval(aw)}}aJ&&D.scrollTop(0)&&M(aJ,false);aQ&&D.scrollLeft(0)&&N(aQ,false);D.trigger("jsp-initialised",[aF||aA])}function aG(){if(aA){am.append(b('<div class="jspVerticalBar" />').append(b('<div class="jspCap jspCapTop" />'),b('<div class="jspTrack" />').append(b('<div class="jspDrag" />').append(b('<div class="jspDragTop" />'),b('<div class="jspDragBottom" />'))),b('<div class="jspCap jspCapBottom" />')));U=am.find(">.jspVerticalBar");aq=U.find(">.jspTrack");av=aq.find(">.jspDrag");
43if(az.showArrows){ar=b('<a class="jspArrow jspArrowUp" />').bind("mousedown.jsp",aE(0,-1)).bind("click.jsp",aC);af=b('<a class="jspArrow jspArrowDown" />').bind("mousedown.jsp",aE(0,1)).bind("click.jsp",aC);if(az.arrowScrollOnHover){ar.bind("mouseover.jsp",aE(0,-1,ar));af.bind("mouseover.jsp",aE(0,1,af))}al(aq,az.verticalArrowPositions,ar,af)}t=v;am.find(">.jspVerticalBar>.jspCap:visible,>.jspVerticalBar>.jspArrow").each(function(){t-=b(this).outerHeight()});av.hover(function(){av.addClass("jspHover")},function(){av.removeClass("jspHover")}).bind("mousedown.jsp",function(aJ){b("html").bind("dragstart.jsp selectstart.jsp",aC);av.addClass("jspActive");var s=aJ.pageY-av.position().top;b("html").bind("mousemove.jsp",function(aK){V(aK.pageY-s,false)}).bind("mouseup.jsp mouseleave.jsp",ax);return false});o()}}function o(){aq.height(t+"px");I=0;X=az.verticalGutter+aq.outerWidth();Y.width(ak-X-f);try{if(U.position().left===0){Y.css("margin-left",X+"px")}}catch(s){}}function z(){if(aF){am.append(b('<div class="jspHorizontalBar" />').append(b('<div class="jspCap jspCapLeft" />'),b('<div class="jspTrack" />').append(b('<div class="jspDrag" />').append(b('<div class="jspDragLeft" />'),b('<div class="jspDragRight" />'))),b('<div class="jspCap jspCapRight" />')));an=am.find(">.jspHorizontalBar");G=an.find(">.jspTrack");h=G.find(">.jspDrag");if(az.showArrows){ay=b('<a class="jspArrow jspArrowLeft" />').bind("mousedown.jsp",aE(-1,0)).bind("click.jsp",aC);x=b('<a class="jspArrow jspArrowRight" />').bind("mousedown.jsp",aE(1,0)).bind("click.jsp",aC); 44if(az.arrowScrollOnHover){ay.bind("mouseover.jsp",aE(-1,0,ay));x.bind("mouseover.jsp",aE(1,0,x))}al(G,az.horizontalArrowPositions,ay,x)}h.hover(function(){h.addClass("jspHover")},function(){h.removeClass("jspHover")}).bind("mousedown.jsp",function(aJ){b("html").bind("dragstart.jsp selectstart.jsp",aC);h.addClass("jspActive");var s=aJ.pageX-h.position().left;b("html").bind("mousemove.jsp",function(aK){W(aK.pageX-s,false)}).bind("mouseup.jsp mouseleave.jsp",ax);return false});l=am.innerWidth();ah()}}function ah(){am.find(">.jspHorizontalBar>.jspCap:visible,>.jspHorizontalBar>.jspArrow").each(function(){l-=b(this).outerWidth()});G.width(l+"px");aa=0}function F(){if(aF&&aA){var aJ=G.outerHeight(),s=aq.outerWidth();t-=aJ;b(an).find(">.jspCap:visible,>.jspArrow").each(function(){l+=b(this).outerWidth()});l-=s;v-=s;ak-=aJ;G.parent().append(b('<div class="jspCorner" />').css("width",aJ+"px"));o();ah()}if(aF){Y.width((am.outerWidth()-f)+"px")}Z=Y.outerHeight();q=Z/v;if(aF){au=Math.ceil(1/y*l);if(au>az.horizontalDragMaxWidth){au=az.horizontalDragMaxWidth}else{if(au<az.horizontalDragMinWidth){au=az.horizontalDragMinWidth}}h.width(au+"px");j=l-au;ae(aa)}if(aA){A=Math.ceil(1/q*t);if(A>az.verticalDragMaxHeight){A=az.verticalDragMaxHeight}else{if(A<az.verticalDragMinHeight){A=az.verticalDragMinHeight}}av.height(A+"px");i=t-A;ad(I)}}function al(aK,aM,aJ,s){var aO="before",aL="after",aN;if(aM=="os"){aM=/Mac/.test(navigator.platform)?"after":"split"}if(aM==aO){aL=aM}else{if(aM==aL){aO=aM;aN=aJ;aJ=s;s=aN}}aK[aO](aJ)[aL](s)}function aE(aJ,s,aK){return function(){H(aJ,s,this,aK);this.blur();return false}}function H(aM,aL,aP,aO){aP=b(aP).addClass("jspActive");var aN,aK,aJ=true,s=function(){if(aM!==0){Q.scrollByX(aM*az.arrowButtonSpeed)}if(aL!==0){Q.scrollByY(aL*az.arrowButtonSpeed)}aK=setTimeout(s,aJ?az.initialDelay:az.arrowRepeatFreq);aJ=false};s();aN=aO?"mouseout.jsp":"mouseup.jsp";aO=aO||b("html");aO.bind(aN,function(){aP.removeClass("jspActive");aK&&clearTimeout(aK);aK=null;aO.unbind(aN)})}function p(){w();if(aA){aq.bind("mousedown.jsp",function(aO){if(aO.originalTarget===c||aO.originalTarget==aO.currentTarget){var aM=b(this),aP=aM.offset(),aN=aO.pageY-aP.top-I,aK,aJ=true,s=function(){var aS=aM.offset(),aT=aO.pageY-aS.top-A/2,aQ=v*az.scrollPagePercent,aR=i*aQ/(Z-v);if(aN<0){if(I-aR>aT){Q.scrollByY(-aQ)}else{V(aT)}}else{if(aN>0){if(I+aR<aT){Q.scrollByY(aQ)}else{V(aT)}}else{aL();return}}aK=setTimeout(s,aJ?az.initialDelay:az.trackClickRepeatFreq);aJ=false},aL=function(){aK&&clearTimeout(aK);aK=null;b(document).unbind("mouseup.jsp",aL)};s();b(document).bind("mouseup.jsp",aL);return false}})}if(aF){G.bind("mousedown.jsp",function(aO){if(aO.originalTarget===c||aO.originalTarget==aO.currentTarget){var aM=b(this),aP=aM.offset(),aN=aO.pageX-aP.left-aa,aK,aJ=true,s=function(){var aS=aM.offset(),aT=aO.pageX-aS.left-au/2,aQ=ak*az.scrollPagePercent,aR=j*aQ/(T-ak);if(aN<0){if(aa-aR>aT){Q.scrollByX(-aQ)}else{W(aT)}}else{if(aN>0){if(aa+aR<aT){Q.scrollByX(aQ)}else{W(aT)}}else{aL();return}}aK=setTimeout(s,aJ?az.initialDelay:az.trackClickRepeatFreq);aJ=false},aL=function(){aK&&clearTimeout(aK);aK=null;b(document).unbind("mouseup.jsp",aL)};s();b(document).bind("mouseup.jsp",aL);return false}})}}function w(){if(G){G.unbind("mousedown.jsp")}if(aq){aq.unbind("mousedown.jsp")}}function ax(){b("html").unbind("dragstart.jsp selectstart.jsp mousemove.jsp mouseup.jsp mouseleave.jsp");if(av){av.removeClass("jspActive")}if(h){h.removeClass("jspActive")}}function V(s,aJ){if(!aA){return}if(s<0){s=0}else{if(s>i){s=i}}if(aJ===c){aJ=az.animateScroll}if(aJ){Q.animate(av,"top",s,ad)}else{av.css("top",s);ad(s)}}function ad(aJ){if(aJ===c){aJ=av.position().top}am.scrollTop(0);I=aJ;var aM=I===0,aK=I==i,aL=aJ/i,s=-aL*(Z-v);if(aj!=aM||aH!=aK){aj=aM;aH=aK;D.trigger("jsp-arrow-change",[aj,aH,P,k])}u(aM,aK);Y.css("top",s);D.trigger("jsp-scroll-y",[-s,aM,aK]).trigger("scroll")}function W(aJ,s){if(!aF){return}if(aJ<0){aJ=0}else{if(aJ>j){aJ=j}}if(s===c){s=az.animateScroll}if(s){Q.animate(h,"left",aJ,ae) 45}else{h.css("left",aJ);ae(aJ)}}function ae(aJ){if(aJ===c){aJ=h.position().left}am.scrollTop(0);aa=aJ;var aM=aa===0,aL=aa==j,aK=aJ/j,s=-aK*(T-ak);if(P!=aM||k!=aL){P=aM;k=aL;D.trigger("jsp-arrow-change",[aj,aH,P,k])}r(aM,aL);Y.css("left",s);D.trigger("jsp-scroll-x",[-s,aM,aL]).trigger("scroll")}function u(aJ,s){if(az.showArrows){ar[aJ?"addClass":"removeClass"]("jspDisabled");af[s?"addClass":"removeClass"]("jspDisabled")}}function r(aJ,s){if(az.showArrows){ay[aJ?"addClass":"removeClass"]("jspDisabled");x[s?"addClass":"removeClass"]("jspDisabled")}}function M(s,aJ){var aK=s/(Z-v);V(aK*i,aJ)}function N(aJ,s){var aK=aJ/(T-ak);W(aK*j,s)}function ab(aW,aR,aK){var aO,aL,aM,s=0,aV=0,aJ,aQ,aP,aT,aS,aU;try{aO=b(aW)}catch(aN){return}aL=aO.outerHeight();aM=aO.outerWidth();am.scrollTop(0);am.scrollLeft(0);while(!aO.is(".jspPane")){s+=aO.position().top;aV+=aO.position().left;aO=aO.offsetParent();if(/^body|html$/i.test(aO[0].nodeName)){return}}aJ=aB();aP=aJ+v;if(s<aJ||aR){aS=s-az.verticalGutter}else{if(s+aL>aP){aS=s-v+aL+az.verticalGutter}}if(aS){M(aS,aK)}aQ=aD();aT=aQ+ak;if(aV<aQ||aR){aU=aV-az.horizontalGutter}else{if(aV+aM>aT){aU=aV-ak+aM+az.horizontalGutter}}if(aU){N(aU,aK)}}function aD(){return -Y.position().left}function aB(){return -Y.position().top}function K(){var s=Z-v;return(s>
4520)&&(s-aB()<10)}function B(){var s=T-ak;return(s>20)&&(s-aD()<10)}function ag(){am.unbind(ac).bind(ac,function(aM,aN,aL,aJ){var aK=aa,s=I;Q.scrollBy(aL*az.mouseWheelSpeed,-aJ*az.mouseWheelSpeed,false);return aK==aa&&s==I})}function n(){am.unbind(ac)}function aC(){return false}function J(){Y.find(":input,a").unbind("focus.jsp").bind("focus.jsp",function(s){ab(s.target,false)})}function E(){Y.find(":input,a").unbind("focus.jsp")}function S(){var s,aJ,aL=[];aF&&aL.push(an[0]);aA&&aL.push(U[0]);Y.focus(function(){D.focus()});D.attr("tabindex",0).unbind("keydown.jsp keypress.jsp").bind("keydown.jsp",function(aO){if(aO.target!==this&&!(aL.length&&b(aO.target).closest(aL).length)){return}var aN=aa,aM=I;switch(aO.keyCode){case 40:case 38:case 34:case 32:case 33:case 39:case 37:s=aO.keyCode;aK();break;case 35:M(Z-v);s=null;break;case 36:M(0);s=null;break}aJ=aO.keyCode==s&&aN!=aa||aM!=I;return !aJ}).bind("keypress.jsp",function(aM){if(aM.keyCode==s){aK()}return !aJ});if(az.hideFocus){D.css("outline","none");if("hideFocus" in am[0]){D.attr("hideFocus",true)}}else{D.css("outline","");if("hideFocus" in am[0]){D.attr("hideFocus",false)}}function aK(){var aN=aa,aM=I;switch(s){case 40:Q.scrollByY(az.keyboardSpeed,false);break;case 38:Q.scrollByY(-az.keyboardSpeed,false);break;case 34:case 32:Q.scrollByY(v*az.scrollPagePercent,false);break;case 33:Q.scrollByY(-v*az.scrollPagePercent,false);break;case 39:Q.scrollByX(az.keyboardSpeed,false);break;case 37:Q.scrollByX(-az.keyboardSpeed,false);break}aJ=aN!=aa||aM!=I;return aJ}}function R(){D.attr("tabindex","-1").removeAttr("tabindex").unbind("keydown.jsp keypress.jsp")}function C(){if(location.hash&&location.hash.length>1){var aL,aJ,aK=escape(location.hash);try{aL=b(aK)}catch(s){return}if(aL.length&&Y.find(aK)){if(am.scrollTop()===0){aJ=setInterval(function(){if(am.scrollTop()>0){ab(aK,true);b(document).scrollTop(am.position().top);clearInterval(aJ)}},50)}else{ab(aK,true);b(document).scrollTop(am.position().top)}}}}function ai(){b("a.jspHijack").unbind("click.jsp-hijack").removeClass("jspHijack")}function m(){ai();b("a[href^=#]").addClass("jspHijack").bind("click.jsp-hijack",function(){var s=this.href.split("#"),aJ;if(s.length>1){aJ=s[1];if(aJ.length>0&&Y.find("#"+aJ).length>0){ab("#"+aJ,true);return false}}})}function ao(){var aK,aJ,aM,aL,aN,s=false;am.unbind("touchstart.jsp touchmove.jsp touchend.jsp click.jsp-touchclick").bind("touchstart.jsp",function(aO){var aP=aO.originalEvent.touches[0];aK=aD();aJ=aB();aM=aP.pageX;aL=aP.pageY;aN=false;s=true}).bind("touchmove.jsp",function(aR){if(!s){return}var aQ=aR.originalEvent.touches[0],aP=aa,aO=I;Q.scrollTo(aK+aM-aQ.pageX,aJ+aL-aQ.pageY);aN=aN||Math.abs(aM-aQ.pageX)>5||Math.abs(aL-aQ.pageY)>5; 46return aP==aa&&aO==I}).bind("touchend.jsp",function(aO){s=false}).bind("click.jsp-touchclick",function(aO){if(aN){aN=false;return false}})}function g(){var s=aB(),aJ=aD();D.removeClass("jspScrollable").unbind(".jsp");D.replaceWith(ap.append(Y.children()));ap.scrollTop(s);ap.scrollLeft(aJ)}b.extend(Q,{reinitialise:function(aJ){aJ=b.extend({},az,aJ);at(aJ)},scrollToElement:function(aK,aJ,s){ab(aK,aJ,s)},scrollTo:function(aK,s,aJ){N(aK,aJ);M(s,aJ)},scrollToX:function(aJ,s){N(aJ,s)},scrollToY:function(s,aJ){M(s,aJ)},scrollToPercentX:function(aJ,s){N(aJ*(T-ak),s)},scrollToPercentY:function(aJ,s){M(aJ*(Z-v),s)},scrollBy:function(aJ,s,aK){Q.scrollByX(aJ,aK);Q.scrollByY(s,aK)},scrollByX:function(s,aK){var aJ=aD()+Math[s<0?"floor":"ceil"](s),aL=aJ/(T-ak);W(aL*j,aK)},scrollByY:function(s,aK){var aJ=aB()+Math[s<0?"floor":"ceil"](s),aL=aJ/(Z-v);V(aL*i,aK)},positionDragX:function(s,aJ){W(s,aJ)},positionDragY:function(aJ,s){V(aJ,s)},animate:function(aJ,aM,s,aL){var aK={};aK[aM]=s;aJ.animate(aK,{duration:az.animateDuration,easing:az.animateEase,queue:false,step:aL})},getContentPositionX:function(){return aD()},getContentPositionY:function(){return aB()},getContentWidth:function(){return T},getContentHeight:function(){return Z},getPercentScrolledX:function(){return aD()/(T-ak)},getPercentScrolledY:function(){return aB()/(Z-v)},getIsScrollableH:function(){return aF},getIsScrollableV:function(){return aA},getContentPane:function(){return Y},scrollToBottom:function(s){V(i,s)},hijackInternalLinks:function(){m()},destroy:function(){g()}});at(O)}e=b.extend({},b.fn.jScrollPane.defaults,e);b.each(["mouseWheelSpeed","arrowButtonSpeed","trackClickSpeed","keyboardSpeed"],function(){e[this]=e[this]||e.speed});return this.each(function(){var f=b(this),g=f.data("jsp");if(g){g.reinitialise(e)}else{g=new d(f,e);f.data("jsp",g)}})};b.fn.jScrollPane.defaults={showArrows:false,maintainPosition:true,stickToBottom:false,stickToRight:false,clickOnTrack:true,autoReinitialise:false,autoReinitialiseDelay:500,verticalDragMinHeight:0,verticalDragMaxHeight:99999,horizontalDragMinWidth:0,horizontalDragMaxWidth:99999,contentWidth:c,animateScroll:false,animateDuration:300,animateEase:"linear",hijackInternalLinks:false,verticalGutter:4,horizontalGutter:4,mouseWheelSpeed:0,arrowButtonSpeed:0,arrowRepeatFreq:50,arrowScrollOnHover:false,trackClickSpeed:0,trackClickRepeatFreq:70,verticalArrowPositions:"split",horizontalArrowPositions:"split",enableKeyboardNavigation:true,hideFocus:false,keyboardSpeed:0,initialDelay:300,speed:30,scrollPagePercent:0.8}})(jQuery,this); 47 48 49/** 50 * jQuery Masonry v2.0.110927 51 * A dynamic layout plugin for jQuery 52 * The flip-side of CSS Floats 53 * http://masonry.desandro.com 54 * 55 * Licensed under the MIT license. 56 * Copyright 2011 David DeSandro 57 */ 58(function(a,b,c){var d=b.event,e;d.special.smartresize={setup:function(){b(this).bind("resize",d.special.smartresize.handler)},teardown:function(){b(this).unbind("resize",d.special.smartresize.handler)},handler:function(a,b){var c=this,d=arguments;a.type="smartresize",e&&clearTimeout(e),e=setTimeout(function(){jQuery.event.handle.apply(c,d)},b==="execAsap"?0:100)}},b.fn.smartresize=function(a){return a?this.bind("smartresize",a):this.trigger("smartresize",["execAsap"])},b.Mason=function(a,c){this.element=b(c),this._create(a),this._init()};var f=["position","height"];b.Mason.settings={isResizable:!0,isAnimated:!1,animationOptions:{queue:!1,duration:500},gutterWidth:0,isRTL:!1,isFitWidth:!1},b.Mason.prototype={_filterFindBricks:function(a){var b=this.options.itemSelector;return b?a.filter(b).add(a.find(b)):a},_getBricks:function(a){var b=this._filterFindBricks(a).css({position:"absolute"}).addClass("masonry-brick");return b},_create:function(c){this.options=b.extend(!0,{},b.Mason.settings,c),this.styleQueue=[],this.reloadItems();var d=this.element[0].style;this.originalStyle={};for(var e=0,g=f.length;e<g;e++){var h=f[e];this.originalStyle[h]=d[h]||""}this.element.css({position:"relative"}),this.horizontalDirection=this.options.isRTL?"right":"left",this.offset={};var i=b(document.createElement("div"));
58this.element.prepend(i),this.offset.y=Math.round(i.position().top),this.options.isRTL?(i.css({"float":"right",display:"inline-block"}),this.offset.x=Math.round(this.element.outerWidth()-i.position().left)):this.offset.x=Math.round(i.position().left),i.remove();var j=this;setTimeout(function(){j.element.addClass("masonry")},0),this.options.isResizable&&b(a).bind("smartresize.masonry",function(){j.resize()})},_init:function(a){this._getColumns("masonry"),this._reLayout(a)},option:function(a,c){b.isPlainObject(a)&&(this.options=b.extend(!0,this.options,a))},layout:function(a,c){var d,e,f,g,h,i;for(var j=0,k=a.length;j<k;j++){d=b(a[j]),e=Math.ceil(d.outerWidth(!0)/this.columnWidth),e=Math.min(e,this.cols);if(e===1)this._placeBrick(d,this.colYs);else{f=this.cols+1-e,g=[];for(i=0;i<f;i++)h=this.colYs.slice(i,i+e),g[i]=Math.max.apply(Math,h);this._placeBrick(d,g)}}var l={};l.height=Math.max.apply(Math,this.colYs)-this.offset.y;if(this.options.isFitWidth){var m=0,j=this.cols;while(--j){if(this.colYs[j]!==this.offset.y)break;m++}l.width=(this.cols-m)*this.columnWidth-this.options.gutterWidth}this.styleQueue.push({$el:this.element,style:l});var n=this.isLaidOut?this.options.isAnimated?"animate":"css":"css",o=this.options.animationOptions,p;for(j=0,k=this.styleQueue.length;j<k;j++)p=this.styleQueue[j],p.$el[n](p.style,o);this.styleQueue=[],c&&c.call(a),this.isLaidOut=!0},_getColumns:function(){var a=this.options.isFitWidth?this.element.parent():this.element,b=a.width();this.columnWidth=this.options.columnWidth||this.$bricks.outerWidth(!0)||b,this.columnWidth+=this.options.gutterWidth,this.cols=Math.floor((b+this.options.gutterWidth)/this.columnWidth),this.cols=Math.max(this.cols,1)},_placeBrick:function(a,b){var c=Math.min.apply(Math,b),d=0;for(var e=0,f=b.length;e<f;e++)if(b[e]===c){d=e;break}var g={top:c};g[this.horizontalDirection]=this.columnWidth*d+this.offset.x,this.styleQueue.push({$el:a,style:g});var h=c+a.outerHeight(!0),i=this.cols+1-f;for(e=0;e<i;e++)this.colYs[d+e]=h},resize:function(){var a=this.cols;this._getColumns("masonry"),this.cols!==a&&this._reLayout()},_reLayout:function(a){var b=this.cols;this.colYs=[];while(b--)this.colYs.push(this.offset.y);this.layout(this.$bricks,a)},reloadItems:function(){this.$bricks=this._getBricks(this.element.children())},reload:function(a){this.reloadItems(),this._init(a)},appended:function(a,b,c){if(b){this._filterFindBricks(a).css({top:this.element.height()});var d=this;setTimeout(function(){d._appended(a,c)},1)}else this._appended(a,c)},_appended:function(a,b){var c=this._getBricks(a);this.$bricks=this.$bricks.add(c),this.layout(c,b)},remove:function(a){this.$bricks=this.$bricks.not(a),a.remove()},destroy:function(){this.$bricks.removeClass("masonry-brick").each(function(){this.style.position="",this.style.top="",this.style.left=""});var c=this.element[0].style;for(var d=0,e=f.length;d<e;d++){var g=f[d];c[g]=this.originalStyle[g]}this.element.unbind(".masonry").removeClass("masonry").removeData("masonry"),b(a).unbind(".masonry")}},b.fn.imagesLoaded=function(a){function h(){--e<=0&&this.src!==f&&(setTimeout(g),d.unbind("load error",h))}function g(){a.call(b,d)}var b=this,d=b.find("img").add(b.filter("img")),e=d.length,f="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";e||g(),d.bind("load error",h).each(function(){if(this.complete||this.complete===c){var a=this.src;this.src=f,this.src=a}});return b};var g=function(a){this.console&&console.error(a)};b.fn.masonry=function(a){if(typeof a=="string"){var c=Array.prototype.slice.call(arguments,1);this.each(function(){var d=b.data(this,"masonry");if(!d)g("cannot call methods on masonry prior to initialization; attempted to call method '"+a+"'");else{if(!b.isFunction(d[a])||a.charAt(0)==="_"){g("no such method '"+a+"' for masonry instance");return}d[a].apply(d,c)}})}else this.each(function(){var c=b.data(this,"masonry");c?(c.option(a||{}),c._init()):b.data(this,"masonry",new b.Mason(a,this))});return this}})(window,jQuery); 59 60 61 62/*! 63 * jQuery imagesLoaded plugin v1.0.4 64 * http://github.com/desandro/imagesloaded 65 * 66 * MIT License. by Paul Irish et al. 67 */ 68 69(function(a,b){a.fn.imagesLoaded=function(i){var g=this,e=g.find("img").add(g.filter("img")),c=e.length,h="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";function f(){i.call(g,e)}function d(j){if(--c<=0&&j.target.src!==h){setTimeout(f);e.unbind("load error",d)}}if(!c){f()}e.bind("load error",d).each(function(){if(this.complete||this.complete===b){var j=this.src;this.src=h;this.src=j}});return g}})(jQuery); 70 71/* 72 * Special event for image load events 73 * Needed because some browsers does not trigger the event on cached images. 74 75 * MIT License 76 * Paul Irish | @paul_irish | www.paulirish.com
77 * Andree Hansson | @peolanha | www.andreehansson.se 78 * 2010. 79 * 80 * Usage: 81 * $(images).bind('load', function (e) { 82 * // Do stuff on load 83 * }); 84 * 85 * Note that you can bind the 'error' event on data uri images, this will trigger when 86 * data uri images isn't supported. 87 * 88 * Tested in: 89 * FF 3+ 90 * IE 6-8 91 * Chromium 5-6 92 * Opera 9-10 93 */ 94 95/** 96 * Horizontal slider with scrollbar. Sets a horizontal sliding functionality to an element, with the following navigation options: 97 * - sliding on mouse scroll 98 * - adds a scrollbar 99 * - adds navigation arrows on top 100 * 101 * Dependencies: 102 * - mousewheel - Brandon Aaron (http://brandonaaron.net) 103 * - jQuery UI Core http://jqueryui.com 104 * - jQuery UI Draggable http://jqueryui.com 105 * 106 * @author Pexeto 107 * http://pexeto.com 108 */ 109(function( $ ) { 110 $.fn.pexetoHorizontalSlider = function( options ){ 111 112 var defaults={ 113 frameWidth : 500, //the width of the visible frame of the slider 114 frameHeight : 500, //the height of the visible frame of the slider 115 easing : 'easeOutSine', //easing function for the sliding animation 116 additionalWidth : 310, //the width that will be added to the slider 117 showScrollbar : true, 118 scrollAppendTo : null, //the element to which to append the scrollbar, if left null the scrollbar will be appended to the root element 119 partialLoading : true, 120 imgNumBeforeLoad : 3, 121 hiddenImgWidth : 500, //the width a loading image would allocate before getting displayed 122 123 //classes, ids and selectors 124 leftArrowId : 'preview-left-arrow', 125 rightArrowId : 'preview-right-arrow', 126 arrowsClass : 'preview-arrows', 127 imgHolderClass : 'preview-img-container' 128 }; 129 130 //define some helper variables that will be used globally by the plugin 131 var o = $.extend(defaults, options), 132 $root = $(this), 133 $wrapper=$root.parent(), 134 $imgHolder = $root.find('.'+o.imgHolderClass), 135 wrapperWidth=0, 136 $scrollBar = null, 137 $handle = null, 138 sliderWidth = 0, 139 slideStep = 0, 140 scroll = false, 141 handleRatio=0, 142 $leftArrow=null, 143 $rightArrow=null, 144 leftArrowHidden=true, 145 rightArrowHidden=false, 146 imgLoaded = [], 147 imgNum = $imgHolder.find('img').length, 148 ie = pexetoSite.getBrowser().msie, 149 isIdevice=(navigator.platform === 'iPad' || navigator.platform === 'iPhone' || navigator.platform === 'iPod')?true:false, 150 additionalRootWidth=isIdevice?100:3000, 151 isMobile = pexetoSite.checkIfMobile(), 152 sliderSpeed = isMobile ? 1500 : 1000, 153 stepDivide = isMobile ? 1.5 : 2, 154 swipeStarted = 0; 155 156 /** 157 * Inits the main functionality - calls the initialization functions. 158 */ 159 function init(){ 160 if(isIdevice){ 161 $wrapper.css({border:'3px solid transparent'}); 162 } 163 if(o.partialLoading){ 164 //create an array of the loaded images - 0 in the relevant index means that the image is not loaded and 1 means that it is loaded 165 for(var i=0; i<imgNum; i++){ 166 imgLoaded[i] = (i<=o.imgNumBeforeLoad-1)?1:0; 167 } 168 169 } 170 calculateDimensions(); 171 172 //set the navigation functionality if the slider is larger than the visible frame width 173 if(sliderWidth>o.frameWidth){ 174 scroll=true; 175 if(o.showScrollbar){ 176 setScrollbar(); 177 addArrows(); 178 } 179 } 180 181 bindEventHandlers(); 182 183 var $share = $root.find('.social-share'); 184 if($share.length){ 185 pexetoSite.initShare($share); 186 } 187 188 } 189 190 /** 191 * Calculates the main dimentions that will be used for the calculations of the sliding. 192 */ 193 function calculateDimensions(){ 194 var allImages = $imgHolder.find('img'); 195 196 //get the slider width 197 sliderWidth=o.additionalWidth; 198 wrapperWidth=o.scrollAppendTo?$(o.scrollAppendTo).width():$wrapper.width(); 199 200 allImages.each(function(i){ 201 var newImgWidth = 0, 202 w = 0, 203 h = 0; 204 205 if( (o.partialLoading && imgLoaded[i]) || !o.partialLoading ){ 206 //image is loaded, add the real image size
207 w = this.naturalWidth || $(this).width(); 208 h = this.naturalHeight || $(this).height(); 209 newImgWidth= getDisplayWidth(o.frameHeight, h , w); 210 }else{ 211 //image is not loaded, set a hidden image size 212 newImgWidth=o.hiddenImgWidth; 213 } 214 sliderWidth+=newImgWidth; 215 216 }); 217 218 219 $root.width(sliderWidth+additionalRootWidth); 220 slideStep=o.frameWidth/stepDivide; 221 } 222 223 /** 224 * Adds the navigation arrows. 225 */ 226 function addArrows(){ 227 $leftArrow=$("<div />", {"class":o.arrowsClass+" hover", "id":o.leftArrowId}).css({top:o.frameHeight/2}).appendTo($wrapper).on("click", movePrev).hide(); 228 $rightArrow=$("<div />", {"class":o.arrowsClass+" hover", "id":o.rightArrowId}).css({top:o.frameHeight/2}).appendTo($wrapper).on("click", moveNext); 229 } 230 231 /** 232 * Calculates the display width of an image depending on its display height when it is resized. 233 * @param displayHeight the resized height of the image 234 * @param originalHeight the original height of the image 235 * @param originalWidth the original width of the image 236 * @return the display width 237 */ 238 function getDisplayWidth(displayHeight, originalHeight, originalWidth){ 239 var ratio = originalHeight/displayHeight, 240 res = Math.round(originalWidth/ratio) || 1000; 241 return res; 242 } 243 244 /** 245 * Binds event handlers to the elements. 246 */ 247 function bindEventHandlers(){ 248 $root.on({ 249 "sizeChanged" : doOnWidthChanged, 250 "reset" : doOnReset, 251 "sliderDisplayed" : function(){ 252 if(scroll && $scrollBar){ 253 $scrollBar.show(); 254 } 255 } 256 }); 257 258 259 260 261 if(scroll){ 262 $imgHolder.on("mousewheel",doOnImageMouseWheel); 263 264 $root.swipe({ 265 swipe:doOnSwipe, 266 swipeStatus:function(event,status,direction,distance,duration){ 267 //move the navigation arrows when the swipe starts 268 if(status==='start'){ 269 swipeStarted=true; 270 }if(status==='move' && swipeStarted){ 271 if(direction==='left'){ 272 $rightArrow.stop().animate({marginRight:-20}); 273 }else if(direction==='right'){ 274 $leftArrow.stop().animate({marginLeft:-20}); 275 } 276 swipeStarted=false; 277 }else if(status==='end'){ 278 if(direction==='left'){ 279 $rightArrow.stop().animate({marginRight:0}); 280 }else if(direction==='right'){ 281 $leftArrow.stop().animate({marginLeft:0}); 282 } 283 } 284 } 285 }); 286 287 } 288 289 if(o.partialLoading){ 290 setImgLoading(); 291 } 292 } 293 294 295 296 /** 297 * If partial loading is enabled, when each image is loaded displays the image, recalculates the new dimensions and 298 * refreshes the navigation. 299 **/ 300 function setImgLoading(){ 301 var imagesToLoad = $imgHolder.find('img:gt('+(o.imgNumBeforeLoad-1)+')'); 302 imagesToLoad.each(function(i){ 303 if($(this).data("loaded")==="true"){ 304 displayImage($(this), i); 305 }else{ 306 $(this).onPexetoImagesLoaded({callback:function(){ 307 displayImage($(this), i); 308 } 309 }); 310 } 311 }); 312 } 313 314 /** 315 * When partial loading is enabled and an image has been loaded, displays the image in the slider 316 * and calls a function to refresh the navigation. 317 * @param $img the image to be displayed 318 * @param i the index of the image 319 */ 320 function displayImage($img, i){ 321 imgLoaded[i+o.imgNumBeforeLoad]=1; 322 addImageSizeToSlider($img); 323 324 $img.animate({opacity:1}, 500).parent().removeClass("to-load"); 325 326 refreshScrollbar(); 327 } 328 329 /** 330 * When partial loading is enabled and an image has been loaded, calculates the image size and updates the 331 * slider size accordingly. 332 * @param $img the image to be displayed 333 */ 334 function addImageSizeToSlider($img){ 335 var w = $img.get(0).naturalWidth || $img.width(), 336 h = $img.get(0).naturalHeight || $img.height(), 337 imgWidth = getDisplayWidth(o.frameHeight, h , w), 338 difference = imgWidth - o.hiddenImgWidth; 339 sliderWidth+=difference; 340 $root.width(sliderWidth+additionalRootWidth); 341 } 342 343 /** 344 * Creates the scrollbar and appends it to the selected element. 345 */ 346 function setScrollbar(){ 347 var $appendEl=o.scrollAppendTo||$root; 348 $scrollBar=$('<div />', {"class":"horizontal-slider"}).appendTo($appendEl); 349 $handle=$('<div />', {"class":"horizontal-handle hover"}).appendTo($scrollBar); 350 refreshScrollbar(); 351 } 352 353 function refreshScrollbar(){ 354 if(scroll && o.showScrollbar){ 355 setHandleWidth(); 356 357 //initialize the draggable functionality 358 $handle.draggable({ axis: "x", drag:doOnHandleDragged, containment:"parent" }); 359 } 360 361 } 362 363 /** 364 * Sets the scrollbar handle width according to the slider and display frame width. 365 */ 366 function setHandleWidth(){ 367 if($handle){ 368 var widthRatio = sliderWidth/o.frameWidth,
369 handleWidth = wrapperWidth/widthRatio-2; 370 $handle.stop().animate({width:handleWidth}, 200); 371 handleRatio=sliderWidth/wrapperWidth; 372 } 373 } 374 375 /** 376 * Handles the window width change event - recalculates all the dimensions and changes the scrollbar handle width. 377 * @param e the event object 378 * @param newWidth the new width of the display frame 379 * @param newHeight the new height of the display frame 380 */ 381 function doOnWidthChanged(e, newWidth, newHeight){ 382 var prevWidth=sliderWidth, 383 currentPosition=0, 384 handleLeft=0, 385 ratio=0; 386 387 o.frameWidth=newWidth; 388 o.frameHeight=newHeight; 389 calculateDimensions(); 390 391 if(scroll){ 392 ratio = prevWidth/sliderWidth; 393 currentPosition=parseInt($root.css("left"), 10); 394 $root.css({left:currentPosition/ratio}); 395 396 if(o.showScrollbar){ 397 handleLeft=parseInt($handle.css("left"), 10); 398 setHandleWidth(); 399 $handle.css({left:handleLeft/ratio}); 400 } 401 402 if($leftArrow && $rightArrow){ 403 $leftArrow.css({top:o.frameHeight/2});
404 $rightArrow.css({top:o.frameHeight/2}); 405 } 406 } 407 408 } 409 410 /** 411 * Handles the mouse wheel (scroll) event to an image - calls the relevant sliding function. 412 * @param e the event object 413 * @param delta an ineteger setting the orientation for the scroll (-1 for down and 1 for up) 414 */ 415 function doOnImageMouseWheel(e, delta){ 416 e.preventDefault(); 417 if(delta<0){ 418 moveNext(); 419 }else{ 420 movePrev(); 421 } 422 } 423 424 function doOnSwipe(event, direction, distance, duration, fingerCount){ 425 var newPosition = 0; 426 if(direction==='left'){ 427 newPosition = getNewSliderPosition(true, distance); 428 moveSlider(newPosition); 429 }else if(direction==='right'){ 430 newPosition = getNewSliderPosition(false, distance); 431 moveSlider(newPosition); 432 } 433 434 435 } 436 437 /** 438 * Slides the slider back and moves the scrollbar handle accordingly. 439 */ 440 function movePrev(){ 441 var newPosition = getNewSliderPosition(false, slideStep); 442 moveSlider(newPosition); 443 } 444 445 /** 446 * Slides the slider forward and moves the scrollbar handle accordingly. 447 */ 448 function moveNext(){ 449 var newPosition = getNewSliderPosition(true, slideStep); 450 451 moveSlider(newPosition); 452 } 453 454 function getNewSliderPosition(next, length){ 455 var step=0, 456 currentPosition=parseInt($root.css('left'),10), 457 lengthLeft=0, 458 newPosition=0; 459 460 if(next){ 461 lengthLeft=sliderWidth+currentPosition; 462 step=((lengthLeft-o.frameWidth)>length)?length:(lengthLeft-o.frameWidth); 463 newPosition=currentPosition-step; 464 }else{ 465 step=((-currentPosition)>length)?length:-currentPosition; 466 newPosition=currentPosition+step; 467 } 468 469 return newPosition; 470 471 } 472 473 function moveSlider(newPosition){ 474 $root.stop().animate({left:[newPosition, o.easing]}, sliderSpeed); //move the slider 475 $handle.stop().animate({left:-newPosition/handleRatio}); //move the scrollbar handle 476 setArrowVisibility(newPosition); 477 } 478 479 480 /** 481 * Sets the arrows visibility. The left arrow should be hidden when there is no more space to move back and the 482 * right arrow should be hidden when there is no more space to move forward. 483 * @param newPosition the new margin of the slider 484 * @return 485 */ 486 function setArrowVisibility(newPosition){ 487 //right arrow 488 if(-newPosition+2>=sliderWidth-o.frameWidth && !rightArrowHidden){ 489 //hide the arrow 490 $rightArrow.hide(); 491 rightArrowHidden=true; 492 }else if(-newPosition<sliderWidth-o.frameWidth){ 493 //show the arrow 494 $rightArrow.show(); 495 rightArrowHidden=false; 496 } 497 498 //left arrow 499 if(newPosition<0 && leftArrowHidden){ 500 //show the arrow 501 $leftArrow.show(); 502 leftArrowHidden=false; 503 }else if(newPosition===0){ 504 //hide the arrow 505 $leftArrow.hide(); 506 leftArrowHidden=true; 507 } 508 } 509 510 /** 511 * Handles the reset event - removes the scrollbar and navigation arrows. 512 */ 513 function doOnReset(){ 514 if($scrollBar){ 515 $scrollBar.remove(); 516 $leftArrow.remove(); 517 $rightArrow.remove(); 518 } 519 } 520 521 /** 522 * Handles the handle drag event - slides the slider according to the dragging event. 523 * @param event the event object 524 * @param ui an object that contains the drag data 525 */ 526 function doOnHandleDragged(event, ui){ 527 var left = ui.offset.left, 528 newPosition=-left*handleRatio; 529 $root.stop().css({left:newPosition}); 530 setArrowVisibility(newPosition); 531 } 532 533 init(); 534 535 return $(this); 536 }; 537})( jQuery ); 538 539 540 541/** 542 * Portfolio grid gallery - displays the portfolio items separated in a grid structure. Provides different options for the 543 * gallery item clicking actions - open the image in lightbox, open a preview section with more images displayed in a slider, 544 * open a custom link, etc. 545 * Provides a category filter to display items by a selected category. 546 * All the functionality is executed via AJAX requests, there are no page reloads. 547 * 548 * Dependencies: 549 * pexetoSite - for lightbox loading and templating function (by Pexeto) 550 * pexetoHorizontalSlider - the horizontal slider functionality on image preview (by Pexeto) 551 * jQuery imagesLoaded plugin v1.0.4 - http://github.com/desandro/imagesloaded 552 * mousewheel - Brandon Aaron (http://brandonaaron.net) 553 * jQuery UI Core http://jqueryui.com
554 * jQuery UI Draggable http://jqueryui.com 555 * mwheelintent - http://www.protofunc.com/scripts/jquery/mwheelIntent/ 556 * jScrollPane - http://jscrollpane.kelvinluck.com/ 557 * 558 * @author Pexeto 559 * http://pexeto.com 560 */ 561(function($){ 562 $.fn.pexetoGridGallery=function(options){ 563 var defaults={ 564 //default settings 565 itemsPerPage : 15, //the number of items per page 566 showCategories : true, // if set to false, the categories will be hidden 567 easing : 'easeOutSine', //the animation easing 568 scrollEasing : 'easeOutExpo', //the easing of the scrolling animation in the preview slider section 569 showInfo : true, //whether to show item info (title and category) below the image 570 imageWidth : 290, //the default image width 571 category : -1, //category to load by default (-1 for all categories) 572 categories : [], //the categories that will be displayed in the filter 573 heightToDecrease : 182, //the height to reduce from the window height to calculate the preview images height 574 descHeightToDecrease : 70, //the height to decrease from the preview content section that will leave space for the "Back to gallery button" 575 descPadding : 20, //the padding of the description in the preview content section 576 windowMargin : 80, //the sum of the window marging from left and right 577 scrollAppendTo : $('#full-content-container'), //the element to which the scrollbar in the preview section will be appended 578 orderBy : 'date', //the way the items should be ordered - available options: "date" and "custom" 579 desaturate : false, //whether the black & white effect is enabled 580 showBackBtnEnd : false, //whether to add a "Back to gallery" button in the end of the slider 581 imgNumBeforeLoad : 1, //the number of images to load before showing the horizontal slider 582 partialLoading : true, //whether to load the images one by one after opening the horizontal slider or to load them all at once before showing the slider 583 584 //texts 585 allText : 'ALL', 586 filterText : 'Filter', 587 loadMoreText : 'Load More', 588 backText : 'Back to gallery', 589 infoText : 'Info', 590 591 //selectors and class/id names 592 itemClass : 'content-box', //the class of the div that wraps each portfolio item data 593 plusClass : 'portfolio-more', 594 loadingClass : 'loading', 595 btnLoadingClass : 'btn-loading', 596 galleryId : 'grid-gallery', 597 categoryHolderId : 'portfolio-categories', 598 selectedClass : 'selected', 599 openedClass : 'filter-opened', 600 filterBtnId : 'filter-btn', 601 galleryContainerId : 'gallery-container', 602 previewContainerClass : 'preview-container', 603 slideContainerId : 'gallery-slide-container', 604 previewContentClass : 'preview-content', 605 previewDescClass : 'preview-description', 606 previewImgSliderClass : 'preview-img-slider', 607 previewImgContainerClass:'preview-img-container', 608 previewWrapperClass : 'preview-content-wrapper', 609 backBtnClass : 'back-btn', 610 backBtnEndClass : 'back-btn-end', 611 itemLoadingClass : 'portfolio-loading', 612 previewShadowClass : 'preview-shadow', 613 videoClass : 'portfolio-video', 614 sliderInfoBtnClass : 'slider-info-btn', 615 sliderInfoClass : 'slider-info', 616 sliderInfoCloseClass : 'slider-info-close', 617 618 //templates 619 moreTmpl : '<div class="more-container"><a id="loadMore" class="button"><span>{text}</span></a></div>', 620 previewContentTmpl : '<div class="preview-description"><div class="preview-text"><span class="post-info">{cat}</span><h2>{title}</h2>{content}</div></div>' 621 }; 622 623 624 625 //define some helper variables that will be globally used within the plugin 626 var o=$.extend(defaults, options), 627 $wrapper=$(this), 628 $galleryContainer=$wrapper.find('#'+o.galleryContainerId), 629 $previewWrapper=null, 630 $previewContainer=null, 631 $previewContent=null, 632 $imageContainer=null, 633 $backButton=null, 634 $root=$('<div/>', {'id':o.galleryId}).appendTo($galleryContainer), 635 items = [], //will contain all the portfolio items
636 $moreBtn=$(pexetoSite.template(o.moreTmpl, {text:o.loadMoreText})), //the "Load More" button element 637 $catHolder=null, //the category filter holder 638 currentCat=o.category, //the ID of the current selectec category 639 filterDisplayed=false, //the state of the category filter - true for displayed and false for hidden 640 $filterBtn = null, 641 filterInAnimation=false, //a boolean setting whether the filter has been currently animated 642 windowWidth = $(window).width(), 643 windowHeight = $(window).height(), 644 fullImageHeight = 0, 645 currentItem=null, 646 previewMode=false, //a boolean setting whether a preview content section is displayed 647 currentXhr=null, 648 isIdevice=(navigator.platform === 'iPad' || navigator.platform === 'iPhone' || navigator.platform === 'iPod')?true:false, 649 heightToDecrease = 0, 650 inLoading = false, 651 galleryLoaded = false, 652 browser = pexetoSite.getBrowser(), 653 isIe = browser.msie, 654 isIE8 = isIe && parseInt(browser.version, 10) == 8; 655 656 657 /** 658 * Initializes the main functionality - calls the main functions. 659 */ 660 function init(){ 661 var hash = location.hash.replace('#',''), 662 item = null; 663 664 if(hash && $.isNumeric(hash)){ 665 item = {id:hash, link:'permalink'}; 666 currentItem=item; 667 loadItemContent(item); 668 }else{ 669 loadGallery(); 670 } 671 672 $(window).on('resize orientationchange', doOnWindowResize); 673 } 674 675 function loadGallery(){ 676 if(o.showCategories){ 677 displayCategoryFilter(); 678 } 679 loadImages({}, true); 680 bindEventHandlers(); 681 682 //initialize the Masonry script to order the items one below another 683 $root.masonry({ 684 itemSelector : '.'+o.itemClass 685 }); 686 galleryLoaded=true; 687 688 //show the gallery when the browser back button is clicked in the slider view section 689 window.onpopstate = function(event) { 690 if(previewMode){ 691 doOnBackClicked(); 692 } 693 }; 694 } 695 696 /** 697 * Binds event handlers to the elements. 698 */ 699 function bindEventHandlers(){ 700 //the hover effect of the items 701 $root.delegate('.'+o.itemClass+' a', 'mouseenter', doOnItemMouseEnter); 702 $root.delegate('.'+o.itemClass+' a', 'mouseleave', doOnItemMouseLeave); 703 704 $moreBtn.find('a').on('click', doOnMoreBtnClick); 705 706 if(o.showCategories){ 707 $catHolder.delegate('li', 'click', doOnCategoryClick); 708 } 709 } 710 711 /** 712 * Displays all the items in a smooth animation 713 * @param data the data received from the AJAX request, containing the new items to display and a boolean variable to set whether there are more items to load 714 * @param first boolean setting whether this is the first image set loading 715 */ 716 function printItems(data, first){ 717 var newItems = data.items; 718 //render the items data 719 for(var i=0, len=newItems.length; i<len; i++){ 720 var item = newItems[i], 721 $el = renderItemElement(item); 722 item.el = newItems.el = $el; 723 items.push(item); 724 if(item.link==='permalink' || item.lightbox){ 725 bindItemClickHandler(item); 726 } 727 $root.append($el); 728 if(o.desaturate){ 729 $el.find('img').pexetoDesaturate({parent:$el, globalHover:false}); 730 } 731 } 732 733 setContainerWidth(); 734 735 //initialize the lightbox 736 pexetoSite.setLightbox($root.find("a[rel^='lightbox']")); 737 738 //load cufon 739 if(!isIE8){ 740 pexetoSite.loadCufon(); 741 } 742 743 //display the items when the images get loaded 744 $root.imagesLoaded(function(){ 745 removeLoading(); 746 $root.masonry('reload'); 747 $root.trigger('itemsLoaded'); 748 749 var displayItem = function(i){ 750 newItems[i].el.css({opacity:0, visibility:'visible', marginTop:100}).animate({opacity:1, marginTop:0}, 300, o.easing); 751 }; 752 753 //display the items in a smooth animation 754 for(var i=0, len = newItems.length; i<len; i++){ 755 (function(i){ 756 window.setTimeout(function(){ 757 displayItem(i); 758 }, i*100); 759 })(i); 760 } 761 762 if(data.more && first){ 763 //display the "Load more" button 764 $moreBtn.insertAfter($root); 765 }else if(!data.more){ 766 //hide more click button 767 $moreBtn.detach(); 768 } 769 }); 770 } 771 772 773 /** 774 * Sets the container width on mobile devices, so that the container 775 * can get centered on smaller screens. 776 */ 777 function setContainerWidth(){ 778
779 if(!pexetoSite.checkIfMobile()){ 780 return; 781 } 782 783 var windowWidth = $(window).width(), 784 firstItem = items[0], 785 itemWidth = 0, 786 columns = 0, 787 galleryMargin = parseInt($root.css('marginLeft')), 788 galleryWidth = 0, 789 rootWidth = 0; 790 791 792 if(firstItem){ 793 itemWidth = o.imageWidth + parseInt(firstItem.el.css('marginRight')); 794 galleryWidth = windowWidth - o.windowMargin/2; 795 columns = Math.floor(galleryWidth/itemWidth) || 1; 796 797 rootWidth = columns*itemWidth; 798 if(rootWidth>windowWidth){ 799 rootWidth = windowWidth - 10; 800 } 801 802 803 $root.width(rootWidth); 804 } 805 } 806 807 function loadLightbox(data){ 808 var titles=[], 809 descs=[], 810 srcs=[]; 811 for(var i=0, len = data.images.length; i<len; i++){ 812 titles.push(""); 813 descs.push(data.images[i].desc); 814 srcs.push(data.images[i].img); 815 } 816 $.prettyPhoto.open(srcs, titles, descs); 817 } 818 819 /** 820 * Displays an item preview - the preview section consists of an item description section (if enabled) and a horizontal 821 * image slider section that would contain more images for the portfolio item 822 * @param data the item data 823 */ 824 function showItemPreview(data){ 825 renderPreviewContainer(); 826 renderItemPreview(data); 827 828 //display the preview when all the slider images get loaded 829 var $imgToLoad = o.partialLoading?$imageContainer.find('img:lt('+o.imgNumBeforeLoad+')'):$imageContainer; 830 if(o.partialLoading){ 831 $imageContainer.find('img:gt('+(o.imgNumBeforeLoad-1)+')').css({opacity:0}); 832 } 833 834 $imgToLoad.imagesLoaded(function(){ 835 836 if(currentItem.el){ 837 currentItem.el.find('.'+o.plusClass).removeClass(o.itemLoadingClass); 838 } 839 840 setFooterVisibility(); 841 heightToDecrease=getHeightToDecrease(); 842 fullImageHeight=windowHeight-heightToDecrease; 843 844 845 $imageContainer.height(fullImageHeight); 846 $previewContent.height(fullImageHeight-2*o.descPadding).find('.preview-description').height(fullImageHeight-o.descHeightToDecrease).jScrollPane({showArrows: fal
846se}); 847 848 //initialize the horizontal slider functionality 849 var args={ easing:o.scrollEasing, 850 frameWidth:windowWidth-o.windowMargin, 851 frameHeight:fullImageHeight, 852 scrollAppendTo:o.scrollAppendTo, 853 partialLoading:o.partialLoading, 854 imgNumBeforeLoad:o.imgNumBeforeLoad}; 855 856 if(currentItem.hideContent){ 857 args.additionalWidth=0; 858 } 859 860 861 //initialize the scrolling functionality 862 $previewContainer.pexetoHorizontalSlider(args); 863 864 if(!isIE8){ 865 //load cufon 866 pexetoSite.loadCufon(); 867 } 868 869 $previewWrapper.css({marginLeft:windowWidth+300}); 870 871 removeLoading(); 872 873 //slide and hide the gallery to left 874 $galleryContainer.animate({marginLeft:-windowWidth, opacity:0}, 800, function(){ 875 $(this).animate({height:'hide'}); 876 $wrapper.animate({height:fullImageHeight+o.windowMargin}, 100, function(){ 877 878 $imageContainer.find('img').height(fullImageHeight).width("auto"); 879 $previewContainer.trigger("sliderDisplayed"); 880 $previewWrapper.css({visibility:"visible", height:"auto"}).animate({marginLeft:o.windowMargin/2}, function(){$wrapper.css({height:'auto'});}); //slide and show the preview slider 881 }); 882 883 }); 884 }); 885 886 if(o.partialLoading){ 887 var imagesToLoad = $imageContainer.find('img:gt('+(o.imgNumBeforeLoad-1)+')'); 888 imagesToLoad.each(function(i){ 889 $(this).imagesLoaded(function(){ 890 $(this).data("loaded", "true"); 891 }); 892 }); 893 } 894 } 895 896 /** 897 * Loads the items from a selected category. 898 * @param cat the category ID of the items to be displayed 899 */ 900 function filterItems(cat){ 901 inLoading=true; 902 $root.animate({opacity:0}
902, function(){ 903 $root.html('').animate({opacity:1},0); 904 $wrapper.addClass(o.loadingClass); 905 items=[]; 906 loadImages({cat:cat}, true); 907 }); 908 } 909 910 /***************************************************************************************** 911 * AJAX FUNCTIONS 912 ****************************************************************************************/ 913 914 /** 915 * Loads the content and attached images to an item - executes an AJAX request. 916 * @param item the item object whose content has been requested 917 */ 918 function loadItemContent(item){ 919 920 var data = {number:o.itemsPerPage, itemid:item.id , action:'pexeto_get_portfolio_content', pageurl: o.pageUrl}; 921 922 if(!currentXhr){ 923 currentXhr = $.ajax({ 924 url:o.ajaxUrl, 925 data:data, 926 dataType:'json', 927 type:'GET'}) 928 .done(function(data){ 929 if(data && !data.failed){ 930 if(item.link==='permalink'){ 931 showItemPreview(data); 932 previewMode=true; 933 }else{ 934 loadLightbox(data); 935 currentItem.el.find('.'+o.plusClass).removeClass(o.itemLoadingClass); 936 } 937 }else{ 938 if(!galleryLoaded){ 939 currentXhr=null; 940 loadGallery(); 941 } 942 } 943 }) 944 .always(doOnAjaxComplete); 945 } 946 } 947 948 /** 949 * Loads the images via AJAX request. 950 * @param options an object literal, handled options: 951 * Example: {cat:1, offset:0, imgwidth:290, orderby:'date'} 952 * @param first boolean setting whether this is the first image set loading 953 */ 954 function loadImages(options, first){ 955 //default request values 956 var data = {number:o.itemsPerPage, 957 cat:o.category, 958 orderby:o.orderBy, 959 offset:0, 960 imgwidth:o.imageWidth, 961 action:'pexeto_get_portfolio_items' 962 }; 963 964 data=$.extend(data, options); 965 if(!currentXhr){ 966 currentXhr=$.ajax({ 967 url:o.ajaxUrl, 968 data:data, 969 dataType:'json', 970 type:'GET'}) 971 .done(function(data){ 972 if(data.items.length){ 973 printItems(data, first); 974 }else{ 975 removeLoading(); 976 } 977 if(first && o.showCategories){ 978 $catHolder.show(); 979 } 980 }) 981 .always(doOnAjaxComplete); 982 } 983 } 984 985 /***************************************************************************************** 986 * ELEMENT RENDERING FUNCTIONS 987 ****************************************************************************************/ 988 989 /** 990 * Renders the HTML of each of the items depending on the settings. 991 * @return the item as jQuery object 992 */ 993 function renderItemElement(item){ 994 var html='<div class="'+o.itemClass+'" style="width:'+o.imageWidth+'px;">', 995 openLink='', 996 closeLink='', 997 $el = null, 998 videoClass=''; 999 1000 //render the opening an closing link 1001 if(item.link){ 1002 var rel=item.video?' rel="lightbox"':'', 1003 link=item.link=='permalink'?'#'+item.id:item.link; 1004 desc=''; 1005 if(item.desc){ 1006 desc='title="'+item.desc+'"'; 1007 }else if(item.video){ 1008 desc='title=""'; 1009 } 1010 openLink='<a href="'+link+'"'+rel+desc+' >'; 1011 closeLink='</a>'; 1012 } 1013 if(item.video){ 1014 videoClass=' '+o.videoClass; 1015 } 1016 html+=openLink+'<img src="'+item.image+'" width="'+o.imageWidth+'"/><div class="'+o.plusClass+videoClass+'"><div class="portfolio-icon"></div></div>'+closeLink; 1017 html+='<div class="content-box-content">'; 1018 if(o.showInfo){ 1019 if(item.cat){ 1020 html+='<h3 class="post-info">'+item.cat+'</h3>'; 1021 } 1022 html+='<h2>'+item.title+'</h2></div>'; 1023 } 1024 html+='</div>'; 1025 return $(html); 1026 } 1027 1028 /** 1029 * Renders the category filter element and appends it to the gallery container. 1030 */ 1031 function displayCategoryFilter(){ 1032 $catHolder = $('<div />', {"id":o.categoryHolderId}); 1033 $filterBtn=$('<div>', {"class":"alignright hover", "id":o.filterBtnId, "html":"<span>"+o.filterText+"</span>"}).click(doOnFilterClick); 1034 var catHtml='<ul>'; 1035 catHtml+='<li class="hover '+o.selectedClass+'" data-cat="'+o.category+'">'+o.allText+'</li>'; 1036 for(var i=0, len=o.categories.length; i<len; i++){ 1037 catHtml+='<li class="hover" data-cat="'+o.categories[i].id+'">'+o.categories[i].name+'</li>'; 1038 } 1039 catHtml+='</ul><div class="clear"></div>'; 1040 1041 $catHolder.append($filterBtn).append(catHtml).hide(); 1042 $galleryContainer.prepend($catHolder); 1043 } 1044 1045 /** 1046 * Renders the item preview element.
1047 * @param item a literal that contains the data to be displayed 1048 */ 1049 function renderItemPreview(item){ 1050 var content='', 1051 imgHtml=''; 1052 1053 if(item.show_content){ 1054 content = pexetoSite.template(o.previewContentTmpl, {cat:(item.cat||''), title:item.title, content:item.content}); 1055 $previewContent.append(content); 1056 }else{ 1057 $previewContent.remove(); 1058 currentItem.hideContent=true; 1059 } 1060 1061 for(var i=0, len = item.images.length; i<len; i++){ 1062 var addClass = (o.partialLoading && i>=o.imgNumBeforeLoad) ? ' to-load' : '', 1063 $wrapDiv = $('<div/>', {"class":"horizontal-img-wrapper" + addClass}), 1064 img = new Image(); 1065 img.setAttribute("src", item.images[i].img); 1066 1067 $wrapDiv.append(img); 1068 $imageContainer.append($wrapDiv); 1069 } 1070 1071 $previewWrapper.css({visibility:'hidden'}).show(); 1072 } 1073 1074 /** 1075 * Renders the preview container element - with a section for displaying content and a section for image slider. 1076 */ 1077 function renderPreviewContainer(){ 1078 $previewWrapper=$('<div />', {"class":o.previewWrapperClass}).hide().appendTo($wrapper); 1079 $previewContainer=$('<div />', {"class":o.previewContainerClass}).appendTo($previewWrapper); 1080 var $shadowDiv=$('<div />', {"class":o.previewShadowClass}).appendTo($previewContainer); 1081 $previewContent = $('<div />', {"class":o.previewContentClass}).appendTo($shadowDiv); 1082 $backButton = $('<div />', {"class":o.backBtnClass+" hover noSwipe", html:"<span>"+o.backText+"</span>"}).appendTo($previewContent).on("click", doOnBackClicked); 1083 var $sliderInfoBtn = $('<div />', {"class": o.sliderInfoBtnClass+" noSwipe", "html":o.infoText}).insertAfter($backButton).on('click', doOnMoreInfoClicked); 1084 $imageContainer= $('<div />', {"class":o.previewImgContainerClass}).appendTo($shadowDiv); 1085 if(o.showBackBtnEnd){ 1086 //append a back button to the end of the slider 1087 $('<div />', {"class":o.backBtnEndClass+" hover noSwipe", html:"<span>"+o.backText+"</span>"}).appendTo($imageContainer).on("click", doOnBackClicked); 1088 } 1089 $('<div />', {"class":'clear'}).appendTo($shadowDiv); 1090 } 1091 1092 function abortPendingRequests(){ 1093 if(currentXhr){ 1094 //there is a request pending, abort it and execute this one 1095 currentXhr.abort(); 1096 if(currentItem){ 1097 currentItem.el.find('.'+o.plusClass).removeClass(o.itemLoadingClass).trigger("mouseleave"); 1098 } 1099 } 1100 } 1101 1102 /***************************************************************************************** 1103 * EVENT BINDING AND HANDLER FUNCTIONS 1104 ****************************************************************************************/ 1105 1106 /** 1107 * Handles the item mouse enter event - shows the hover circle and fades the image out. 1108 */ 1109 function doOnItemMouseEnter(){ 1110 elemFadeIn($(this).find('.'+o.plusClass)); 1111 if(!o.desaturate){ 1112 elemFadeOut($(this).find('img'), 0.8); 1113 } 1114 } 1115 1116 /** 1117 * Handles the item mouse leave event - hides the hover circle and fades the image in. 1118 */ 1119 function doOnItemMouseLeave(){ 1120 if(!$(this).find('.'+o.itemLoadingClass).length){ 1121 elemFadeOut($(this).find('.'+o.plusClass), 0); 1122 if(!o.desaturate){ 1123 elemFadeIn($(this).find('img')); 1124 } 1125 } 1126 } 1127 1128 /** 1129 * Handles the category filter click event - calls the filter function to display the items from the selected 1130 * category. 1131 */ 1132 function doOnCategoryClick(){ 1133 var that = $(this), 1134 cat = Number(that.data('cat')), 1135 ul = null; 1136 abortPendingRequests(); 1137 1138 if(currentCat!==cat){ 1139 currentCat=cat; 1140 filterItems(cat); 1141 that.addClass(o.selectedClass).siblings('.'+o.selectedClass).removeClass(o.selectedClass); 1142 1143 //hide the filter if it is a mobile device 1144 ul = $catHolder.find('ul'); 1145 if( ul.css('position')==='absolute' && !filterInAnimation){ 1146 filterInAnimation=true; 1147 ul.animate({height:'hide'}, 400, function(){ 1148 filterInAnimation=false; 1149 filterDisplayed=false; 1150 $filterBtn.removeClass(o.openedClass); 1151 }); 1152 } 1153 } 1154 } 1155 1156 /** 1157 * Handles the filter button click event - to close/open the category filter with a sliding animation. 1158 */ 1159 function doOnFilterClick(){ 1160 var that = $(this), 1161 ul = that.siblings('ul:first'), 1162 filterDropdown = ul.css('position')==='absolute', 1163 animateProperty = filterDropdown ? 'height' : 'width', 1164 animationSettings = {}; 1165 1166 if(!filterInAnimation){ 1167 filterInAnimation=true; 1168 if(!filterDropdown){ 1169 ul.css({height:25}); 1170 } 1171 1172 if(filterDisplayed){ 1173 //hide the category filter 1174 $catHolder.animate({marginTop:0, paddingBottom:0}); 1175 animationSettings[animateProperty] = 'hide'; 1176 ul.animate(animationSettings, 400, function(){ 1177 filterInAnimation=false; 1178 filterDisplayed=false; 1179 if(!filterDropdown){ 1180 ul.css({height:'auto'}); 1181 } 1182 that.removeClass(o.openedClass); 1183 });
1184 }else{ 1185 //display the category filter 1186 that.addClass(o.openedClass); 1187 $catHolder.animate({marginTop:6, paddingBottom:10}); 1188 animationSettings[animateProperty] = 'show'; 1189 ul.animate(animationSettings, 400, function(){ 1190 filterInAnimation=false; 1191 filterDisplayed=true; 1192 if(!filterDropdown){ 1193 ul.css({height:'auto'}); 1194 } 1195 }); 1196 } 1197 } 1198 } 1199 1200 /** 1201 * Handles the "Load More" button click event. Calls a function to load more images. 1202 */ 1203 function doOnMoreBtnClick(){ 1204 abortPendingRequests(); 1205 $moreBtn.addClass(o.btnLoadingClass); 1206 loadImages({offset:items.length, cat:currentCat}, false); 1207 } 1208 1209 /** 1210 * Binds a click handler to a single item - this is bound to item that display an image slider in a preview mode. 1211 * When clicked, calls a function to load the additional data and images to be displayed. 1212 * @param item the item to bind the click event handler 1213 */ 1214 function bindItemClickHandler(item){ 1215 item.el.find('a').click(function(e){ 1216 e.preventDefault(); 1217 if(item.link=='permalink'){ 1218 location.hash=item.id; 1219 } 1220 abortPendingRequests(); 1221 if(!previewMode && !inLoading){ 1222 item.el.find('.'+o.plusClass).addClass(o.itemLoadingClass); 1223 currentItem=item; 1224 loadItemContent(item); 1225 } 1226 }); 1227 } 1228 1229 /** 1230 * Handles the window resize event - it is mainly used for the preview item section to make sure that the images 1231 * will be displayed in full height of the window. 1232 */ 1233 function doOnWindowResize(){ 1234 // alert("orientation"); 1235 windowWidth=$(window).width(); 1236 windowHeight=$(window).height(); 1237 1238 if(previewMode){ 1239 setFooterVisibility(); 1240 } 1241 1242 heightToDecrease = getHeightToDecrease(); 1243 fullImageHeight=windowHeight-heightToDecrease; 1244 1245 if(previewMode){ 1246 $previewContent.height(fullImageHeight-2*o.descPadding).find('.preview-description').height(fullImageHeight-o.descHeightToDecrease).jScrollPane({showArrows: fal
1246se}); 1247 $imageContainer.height(fullImageHeight).find('img').height(fullImageHeight); 1248 if(isIdevice){ 1249 $previewWrapper.height(fullImageHeight); 1250 } 1251 $previewContainer.trigger("sizeChanged", [windowWidth-o.windowMargin, fullImageHeight]); 1252 }else{ 1253 setContainerWidth(); 1254 $root.masonry('reload'); 1255 } 1256 } 1257 1258 /** 1259 * Handles the "Back to gallery" button click event in the preview item section. 1260 */ 1261 function doOnBackClicked(){ 1262 $previewContainer.trigger("reset"); 1263 location.hash=''; 1264 if(currentItem.el){ 1265 currentItem.el.find('img').trigger("mouseleave"); 1266 } 1267 previewMode=false; 1268 $previewWrapper.animate({marginLeft:windowWidth+300}, function(){ 1269 $galleryContainer.show().animate({marginLeft:0, opacity:1}); 1270 $previewWrapper.remove(); 1271 if(!$('#footer').is(':visible')){ 1272 $('#footer').css({display:'block', height:'auto'}); 1273 } 1274 if(galleryLoaded){ 1275 $root.masonry('reload'); 1276 }else{ 1277 addLoading(); 1278 loadGallery(); 1279 } 1280 1281 }); 1282 } 1283 1284 function doOnMoreInfoClicked(){ 1285 var html = $previewContent.find('.preview-text:first').html(), 1286 $infoBox = $('<div/>', {'class':o.sliderInfoClass, html:html}).appendTo($('body')).fadeIn(), 1287 $closeBtn = $('<div />', {'class':o.sliderInfoCloseClass}) 1288 .appendTo($infoBox) 1289 .on('click', function(){ 1290 $infoBox.fadeOut(function(){ 1291 $infoBox.remove(); 1292 }); 1293 }); 1294 1295 } 1296 1297 function doOnAjaxComplete(){ 1298 inLoading=false; 1299 currentXhr=null; 1300 } 1301 1302 /***************************************************************************************** 1303 * HELPER FUNCTIONS 1304 ****************************************************************************************/ 1305 1306 /** 1307 * Removes the loading from the wrapper and more button. 1308 */ 1309 function removeLoading(){ 1310 $wrapper.removeClass(o.loadingClass); 1311 $moreBtn.removeClass(o.btnLoadingClass); 1312 } 1313 1314 function addLoading(){ 1315 $wrapper.addClass(o.loadingClass); 1316 } 1317 1318 /** 1319 * Fades an element in. 1320 * @param $elem the element to be faded 1321 */ 1322 function elemFadeIn($elem){ 1323 $elem.stop().animate({opacity:1}, function(){ 1324 $elem.animate({opacity:1}, 0); 1325 }); 1326 } 1327 1328 /** 1329 * Fades an elemen out to a selected opacity. 1330 * @param $elem the element to be faded 1331 * @param opacity the opacity to be faded to 1332 */ 1333 function elemFadeOut($elem, opacity){ 1334 $elem.stop().animate({opacity:opacity}, function(){ 1335 $elem.animate({opacity:opacity}, 0); 1336 }); 1337 } 1338 1339 function getHeightToDecrease(){ 1340 var windowMargin = parseInt($('#header').css('marginBottom'))*2 || o.windowMargin, 1341 footerHeight = $('#footer').is(':visible') ? $('#footer').outerHeight():0; 1342 1343 return ($('#header').outerHeight()+footerHeight + windowMargin ) || o.heightToDecrease; 1344 } 1345 1346 function setFooterVisibility(){ 1347 var windowHeight = $(window).height(); 1348 1349 if(windowHeight<400){ 1350 $('#footer').css({display:'none', height:0}); 1351 }else if(!$('#footer').is(':visible')){ 1352 $('#footer').css({display:'block', height:'auto'}); 1353 } 1354 } 1355 1356 init(); 1357 1358 }; 1359}(jQuery));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.