1Drupal.locale = { 'pluralFormula': function ($n) { return Number((((($n%10)==1)&&(($n%100)!=11))?(0):((((($n%10)>=2)&&(($n%10)<=4))&&((($n%100)<10)||(($n%100)>=20)))?(1):2))); }, 'strings': {"":{"An AJAX HTTP error occurred.":"Objevila se AJAX HTTP chyba.","HTTP Result Code: !status":"V\u00fdsledn\u00fd k\u00f3d HTTP je: !status","An AJAX HTTP request terminated abnormally.":"AJAX HTTP po\u017eadavek skon\u010dil neobvykle.","Debugging information follows.":"N\u00e1sleduj\u00ed informace pro lad\u011bn\u00ed.","Path: !uri":"Cesta: !uri","StatusText: !statusText":"Text stavu: !statusText","ResponseText: !responseText":"Text odpov\u011bdi: !responseText","ReadyState: !readyState":"ReadyState: !readyState","Next":"N\u00e1sleduj\u00edc\u00ed","Status":"Stav","Disabled":"Vypnuto","Enabled":"Zapnuto","Yes":"Ano","No":"Ne","Edit":"Upravit","Date":"Datum","Size":"Velikost","Search":"Hledat","Sunday":"Ned\u011ble","Monday":"Pond\u011bl\u00ed","Tuesday":"\u00dater\u00fd","Wednesday":"St\u0159eda","Thursday":"\u010ctvrtek","Friday":"P\u00e1tek","Saturday":"Sobota","Add":"P\u0159idat","Filename":"N\u00e1zev souboru","Menu":"Menu","Upload":"Nahr\u00e1t","Configure":"Nastaven\u00ed","All":"V\u0161e","Done":"Hotovo","N\/A":"N\/A","This field is required.":"Toto pole je vy\u017eadov\u00e1no.","Prev":"P\u0159edchoz\u00ed","Mon":"Po","Tue":"\u00dat","Wed":"St","Thu":"\u010ct","Fri":"P\u00e1","Sat":"So","Sun":"Ne","January":"Leden","February":"\u00danor","March":"B\u0159ezen","April":"Duben","May":"Kv\u011b","June":"\u010cerven","July":"\u010cervenec","August":"Srpen","September":"Z\u00e1\u0159\u00ed","October":"\u0158\u00edjen","November":"Listopad","December":"Prosinec","Show":"Uk\u00e1zat","Select all rows in this table":"Ozna\u010dit v\u0161echny \u0159\u00e1dky v t\u00e9to tabulce","Deselect all rows in this table":"Zru\u0161it ozna\u010den\u00ed v\u0161ech \u0159\u00e1dek v t\u00e9to tabulce","Today":"Dnes","Jan":"Led","Feb":"\u00dano","Mar":"B\u0159e","Apr":"Dub","Jun":"\u010cer","Jul":"\u010crv","Aug":"Srp","Sep":"Z\u00e1\u0159","Oct":"\u0158\u00edj","Nov":"Lis","Dec":"Pro","Su":"Ne","Mo":"Po","Tu":"\u00dat","We":"St","Th":"\u010ct","Fr":"P\u00e1","Sa":"So","Not published":"Nevyd\u00e1no","Shortcuts":"Zkratky","Please wait...":"Pros\u00edm \u010dekejte...","Hide":"Skr\u00fdt","Loading":"Na\u010d\u00edt\u00e1n\u00ed","mm\/dd\/yy":"mm\/dd\/yy","Only files with the following extensions are allowed: %files-allowed.":"Povoleny jsou pouze soubory s n\u00e1sleduj\u00edc\u00edmi p\u0159\u00edponami: %files-allowed.","Not in book":"Nen\u00ed v knize","New book":"Nov\u00e1 kniha","By @name on @date":"U\u017eivatel @name dne @date","By @name":"Dle @name","Not in menu":"Nen\u00ed v menu","Alias: @alias":"Alias: @alias","No alias":"\u017d\u00e1dn\u00fd alias","New revision":"Nov\u00e1 revize","Drag to re-order":"Pro p\u0159eskupen\u00ed p\u0159et\u00e1hn\u011bte my\u0161\u00ed","Changes made in this table will not be saved until the form is submitted.":"Zm\u011bny proveden\u00e9 v t\u00e9to tabulce budou ulo\u017eeny a\u017e po odesl\u00e1n\u00ed formul\u00e1\u0159e.","The changes to these blocks will not be saved until the \u003Cem\u003ESave blocks\u003C\/em\u003E button is clicked.":"Zm\u011bny v t\u011bchto bloc\u00edch se neprojev\u00ed, dokud je neulo\u017e\u00edte pomoc\u00ed tla\u010d\u00edtka \u003Cem\u003EUlo\u017eit bloky\u003C\/em\u003E.","Show shortcuts":"Zobrazit zkratky","This permission is inherited from the authenticated user role.":"Pr\u00e1va byla zd\u011bd\u011bna z ov\u011b\u0159en\u00e9 u\u017eivatelsk\u00e9 role.","No revision":"\u017d\u00e1dn\u00e1 revize","Requires a title":"Vy\u017eaduje n\u00e1zev","Not restricted":"Nen\u00ed omezeno","(active tab)":"(aktivn\u00ed z\u00e1lo\u017eka)","Not customizable":"Nelze p\u0159izp\u016fsobit","Restricted to certain pages":"Omezen\u00fd na ur\u010dit\u00fd str\u00e1nky","The block cannot be placed in this region.":"Blok nem\u016f\u017ee b\u00fdt um\u00edst\u011bn do tohoto regionu.","Customize dashboard":"P\u0159izp\u016fsobit ovl\u00e1dac\u00ed panel","Hide summary":"Skr\u00fdt souhrn","Edit summary":"Uprav
1it souhrn","Don\u0027t display post information":"Nezobrazovat informace o p\u0159\u00edsp\u011bvku","@title dialog":"@title dialog","The selected file %filename cannot be uploaded. Only files with the following extensions are allowed: %extensions.":"Vybran\u00fd soubor %filename nelze nahr\u00e1t. Jsou povoleny pouze soubory s t\u011bmito p\u0159\u00edponami: %extensions.","Re-order rows by numerical weight instead of dragging.":"Zm\u011b\u0148te po\u0159ad\u00ed \u0159\u00e1dk\u016f pomoc\u00ed \u010d\u00edseln\u00e9 v\u00e1hy m\u00edsto p\u0159eta\u017een\u00ed my\u0161\u00ed.","Show row weights":"Uka\u017e v\u00e1hy \u0159\u00e1dk\u016f","Hide row weights":"Skryj v\u00e1hy \u0159\u00e1dk\u016f","Autocomplete popup":"Vyskakovac\u00ed okno automatick\u00e9ho dokon\u010dov\u00e1n\u00ed","Searching for matches...":"Hled\u00e1m shody...","Hide shortcuts":"Skr\u00fdt zkratky","Show description":"Zobrazit popis","Hide description":"Skr\u00fdt popis","Other":"Jin\u00e9","New":"Nov\u00e9","No results":"\u017d\u00e1dn\u00e9 v\u00fdsledky","Available tokens":"Dostupn\u00e9 tokeny","Insert this token into your form":"Vlo\u017eit token do formul\u00e1\u0159e","First click a text field to insert your tokens into.":"Nejprve klikn\u011bte do textov\u00e9ho pole, do kter\u00e9ho chcete tokeny vlo\u017eit.","Loading token browser...":"Na\u010d\u00edt\u00e1n\u00ed prohl\u00ed\u01
vendor: 10,725 bytes, lines 1-7
17ee\u010de token\u016f...","No title":"Bez nadpisu","@count year from now":"za rok","@count years from now":"za @count roky","Submit":"Odeslat","Close":"Zav\u0159\u00edt","Start upload":"Za\u010d\u00edt nahr\u00e1v\u00e1n\u00ed","Uploading...":"Nahr\u00e1v\u00e1n\u00ed prob\u00edh\u00e1...","No name":"Beze jm\u00e9na","Query":"Dotaz","Remove group":"Odstranit skupinu","Apply (all displays)":"Pou\u017e\u00edt (v\u0161echny pohledy)","Apply (this display)":"Pou\u017e\u00edt (tento pohled)","Revert to default":"Obnovit v\u00fdchoz\u00ed","Priority: @value":"Priorita: @value","Please select a file.":"Zvolte soubor.","Please specify dimensions within the allowed range that is from 1x1 to @dimensions.":"Zadejte rozm\u011bry v povolen\u00e9m rozsahu ve form\u00e1tu 1x1 do","%filename is not an image.":"%filename nen\u00ed obr\u00e1zek.","Insert file":"Vlo\u017eit soubor","Change view":"Zm\u011bnit zobrazen\u00ed","Directory":"Adres\u00e1\u0159","You can not perform this operation.":"Nen\u00ed mo\u017en\u00e9 prov\u00e9st tuto operaci.","Do you want to refresh the current directory?":"Obnovit aktu\u00e1ln\u00ed adres\u00e1\u0159?","Delete selected files?":"Smazat vybran\u00e9 soubory?","Please select a thumbnail.":"Zvolte n\u00e1hled.","Log messages":"Logovat zpr\u00e1vy","You must select at least %num files.":"Je nutn\u00e9 vybrat alespo\u0148 %num soubor\u016f.","Translatable":"P\u0159elo\u017eiteln\u00fd","Select None":"Vybrat: Nic","Select All":"Vybrat: V\u0161e","Downloads":"Sta\u017een\u00ed soubor\u016f","Clicks":"Kliknut\u00ed","No redirects":"\u017d\u00e1dn\u00e1 p\u0159esm\u011brov\u00e1n\u00ed","One domain with multiple subdomains":"Jedna dom\u00e9na s v\u00edce subdom\u00e9nami"}} };; 2/*! 3 Colorbox 1.6.4 4 license: MIT 5 http://www.jacklmoore.com/colorbox 6*/ 7(function(t,e,i){function n(i,n,o){var r=e.createElement(i);return n&&(r.id=Z+n),o&&(r.style.cssText=o),t(r)}function o(){return i.innerHeight?i.innerHeight:t(i).height()}function r(e,i){i!==Object(i)&&(i={}),this.cache={},this.el=e,this.value=function(e){var n;return void 0===this.cache[e]&&(n=t(this.el).attr("data-cbox-"+e),void 0!==n?this.cache[e]=n:void 0!==i[e]?this.cache[e]=i[e]:void 0!==X[e]&&(this.cache[e]=X[e])),this.cache[e]},this.get=function(e){var i=this.value(e);return t.isFunction(i)?i.call(this.el,this):i}}function h(t){var e=W.length,i=(A+t)%e;return 0>i?e+i:i}function a(t,e){return Math.round((/%/.test(t)?("x"===e?E.width():o())/100:1)*parseInt(t,10))}function s(t,e){return t.get("photo")||t.get("photoRegex").test(e)}function l(t,e){return t.get("retinaUrl")&&i.devicePixelRatio>1?e.replace(t.get("photoRegex"),t.get("retinaSuffix")):e}function d(t){"contains"in x[0]&&!x[0].contains(t.target)&&t.target!==v[0]&&(t.stopPropagation(),x.focus())}function c(t){c.str!==t&&(x.add(v).removeClass(c.str).addClass(t),c.str=t)}function g(e){A=0,e&&e!==!1&&"nofollow"!==e?(W=t("."+te).filter(function(){var i=t.data(this,Y),n=new r(this,i);return n.get("rel")===e}),A=W.index(_.el),-1===A&&(W=W.add(_.el),A=W.length-1)):W=t(_.el)}function u(i){t(e).trigger(i),ae.triggerHandler(i)}function f(i){var o;if(!G){if(o=t(i).data(Y),_=new r(i,o),g(_.get("rel")),!U){U=$=!0,c(_.get("className")),x.css({visibility:"hidden",display:"block",opacity:""}),I=n(se,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),b.css({width:"",height:""}).append(I),j=T.height()+k.height()+b.outerHeight(!0)-b.height(),D=C.width()+H.width()+b.outerWidth(!0)-b.width(),N=I.outerHeight(!0),z=I.outerWidth(!0);var h=a(_.get("initialWidth"),"x"),s=a(_.get("initialHeight"),"y"),l=_.get("maxWidth"),f=_.get("maxHeight");_.w=Math.max((l!==!1?Math.min(h,a(l,"x")):h)-z-D,0),_.h=Math.max((f!==!1?Math.min(s,a(f,"y")):s)-N-j,0),I.css({width:"",height:_.h}),J.position(),u(ee),_.get("onOpen"),O.add(F).hide(),x.focus(),_.get("trapFocus")&&e.addEventListener&&(e.addEventListener("focus",d,!0),ae.one(re,function(){e.removeEventListener("focus",d,!0)})),_.get("returnFocus")&&ae.one(re,function(){t(_.el).focus()})}var p=parseFloat(_.get("opacity"));v.css({opacity:p===p?p:"",cursor:_.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),_.get("closeButton")?B.html(_.get("close")).appendTo(b):B.appendTo("<div/>"),w()}}function p(){x||(V=!1,E=t(i),x=n(se).attr({id:Y,"class":t.support.opacity===!1?Z+"IE":"",role:"dialog",tabindex:"-1"}).hide(),v=n(se,"Overlay").hide(),L=t([n(se,"LoadingOverlay")[0],n(se,"LoadingGraphic")[0]]),y=n(se,"Wrapper"),b=n(se,"Content").append(F=n(se,"Title"),R=n(se,"Current"),P=t('<button type="button"/>').attr({id:Z+"Previous"}),K=t('<button type="button"/>').attr({id:Z+"Next"}),S=t('<button type="button"/>').attr({id:Z+"Slideshow"}),L),B=t('<button type="button"/>').attr({id:Z+"Close"}),y.append(n(se).append(n(se,"TopLeft"),T=n(se,"TopCenter"),n(se,"TopRight")),n(se,!1,"clear:left").append(C=n(se,"MiddleLeft"),b,H=n(se,"MiddleRight")),n(se,!1,"clear:left").append(n(se,"BottomLeft"),k=n(se,"BottomCenter"),n(se,"BottomRight"))).find("div div").css({"float":"left"}),M=n(se,!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),O=K.add(P).add(R).add(S)),e.body&&!x.parent().length&&t(e.body).append(v,x.append(y,M))}function m(){function i(t){t.which>1||t.shiftKey||t.altKey||t.metaKey||t.ctrlKey||(t.preventDefault(),f(this))}return x?(V||(V=!0,K.click(function(){J.next()}),P.click(function(){J.prev()}),B.click(function(){J.close()}),v.click(function(){_.get("overlayClose")&&J.close()}),t(e).bind("keydown."+Z,function(t){var e=t.keyCode;U&&_.get("escKey")&&27===e&&(t.preventDefault(),J.close()),U&&_.get("arrowKey")&&W[1]&&!t.altKey&&(37===e?(t.preventDefault(),P.click()):39===e&&(t.preventDefault(),K.click()))}),t.isFunction(t.fn.on)?t(e).on("click."+Z,"."+te,i):t("."+te).live("click."+Z,i)),!0):!1}function w(){var e,o,r,h=J.prep,d=++le;if($=!0,q=!1,u(he),u(ie),_.get("onLoad"),_.h=_.get("height")?a(_.get("height"),"y")-N-j:_.get("innerHeight")&&a(_.get("innerHeight"),"y"),_.w=_.get("width")?a(_.get("width"),"x")-z-D:_.get("innerWidth")&&a(_.get("innerWidth"),"x"),_.mw=_.w,_.mh=_.h,_.get("maxWidth")&&(_.mw=a(_.get("maxWidth"),"x")-z-D,_.mw=_.w&&_.w<_.mw?_.w:_.mw),_.get("maxHeight")&&(_.mh=a(_.get("maxHeight"),"y")-N-j,_.mh=_.h&&_.h<_.mh?_.h:_.mh),e=_.get("href"),Q=setTimeout(function(){L.show()},100),_.get("inline")){var c=t(e).eq(0);r=t("<div>").hide().insertBefore(c),ae.one(he,function(){r.replaceWith(c)}),h(c)}else _.get("iframe")?h(" "):_.get("html")?h(_.get("html")):s(_,e)?(e=l(_,e),q=_.get("createImg"),t(q).addClass(Z+"Photo").bind("error."+Z,function(){h(n(se,"Error").html(_.get("imgError")))}).one("load",function(){d===le&&setTimeout(function(){var e;_.get("retinaImage")&&i.devicePixelRatio>1&&(q.height=q.height/i.devicePixelRatio,q.width=q.width/i.devicePixelRatio),_.get("scalePhotos")&&(o=function(){q.height-=q.height*e,q.width-=q.width*e},_.mw&&q.width>_.mw&&(e=(q.width-_.mw)/q.width,o()),_.mh&&q.height>_.mh&&(e=(q.height-_.mh)/q.height,o())),_.h&&(q.style.marginTop=Math.max(_.mh-q.height,0)/2+"px"),W[1]&&(_.get("loop")||W[A+1])&&(q.style.cursor="pointer",t(q).bind("click."+Z,function(){J.next()})),q.style.width=q.width+"px",q.style.height=q.height+"px",h(q)},1)}),q.src=e):e&&M.load(e,_.get("data"),function(e,i){d===le&&h("error"===i?n(se,"Error").html(_.get("xhrError")):t(this).contents())})}var v,x,y,b,T,C,H,k,W,E,I,M,L,F,R,S,K,P,B,O,_,j,D,N,z,A,q,U,$,G,Q,J,V,X={html:!1,photo:!1,iframe:!1,inline:!1,transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,opacity:.9,preloading:!0,className:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0,closeButton:!0,fastIframe:!0,open:!1,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:!0,trapFocus:!0,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,rel:function(){return this.rel},href:function(){return t(this).attr("href")},title:function(){return this.title},createImg:function(){var e=new Image,i=t(this).data("cbox-img-attrs");return"object"==typeof i&&t.each(i,function(t,i){e[t]=i}),e},createIframe:function(){var i=e.createElement("iframe"),n=t(this).data("cbox-iframe-attrs");return"object"==typeof n&&t.each(n,function(t,e){i[t]=e}),"frameBorder"in i&&(i.frameBorder=0),"allowTransparency"in i&&(i.allowTransparency="true"),i.name=(new Date).getTime(),i.allowFullscreen=!0,i}},Y="colorbox",Z="cbox",te=Z+"Element",ee=Z+"_open",ie=Z+"_load",ne=Z+"_complete",oe=Z+"_cleanup",re=Z+"_closed",he=Z+"_purge",ae=t("<a/>"),se="div",le=0,de={},ce=function(){function t(){clearTimeout(h)}function e(){(_.get("loop")||W[A+1])&&(t(),h=setTimeout(J.next,_.get("slideshowSpeed")))}function i(){S.html(_.get("slideshowStop")).unbind(s).one(s,n),ae.bind(ne,e).bind(ie,t),x.removeClass(a+"off").addClass(a+"on")}function n(){t(),ae.unbind(ne,e).unbind(ie,t),S.html(_.get("slideshowStart")).unbind(s).one(s,function(){J.next(),i()}),x.removeClass(a+"on").addClass(a+"off")}function o(){r=!1,S.hide(),t(),ae.unbind(ne,e).unbind(ie,t),x.removeClass(a+"off "+a+"on")}var r,h,a=Z+"Slideshow_",s="click."+Z;return function(){r?_.get("slideshow")||(ae.unbind(oe,o),o()):_.get("slideshow")&&W[1]&&(r=!0,ae.one(oe,o),_.get("slideshowAuto")?i():n(),S.show())}}();t[Y]||(t(p),J=t.fn[Y]=t[Y]=function(e,i){var n,o=this;return e=e||{},t.isFunction(o)&&(o=t("<a/>"),e.open=!0),o[0]?(p(),m()&&(i&&(e.onComplete=i),o.each(function(){var i=t.data(this,Y)||{};t.data(this,Y,t.extend(i,e))}).addClass(te),n=new r(o[0],e),n.get("open")&&f(o[0])),o):o},J.position=function(e,i){function n(){T[0].style.width=k[0].style.width=b[0].style.width=parseInt(x[0].style.width,10)-D+"px",b[0].style.height=C[0].style.height=H[0].style.height=parseInt(x[0].style.height,10)-j+"px"}var r,h,s,l=0,d=0,c=x.offset();if(E.unbind("resize."+Z),x.css({top:-9e4,left:-9e4}),h=E.scrollTop(),s=E.scrollLeft(),_.get("fixed")?(c.top-=h,c.left-=s,x.css({position:"fixed"})):(l=h,d=s,x.css({position:"absolute"})),d+=_.get("right")!==!1?Math.max(E.width()-_.w-z-D-a(_.get("right"),"x"),0):_.get("left")!==!1?a(_.get("left"),"x"):Math.round(Math.max(E.width()-_.w-z-D,0)/2),l+=_.get("bottom")!==!1?Math.max(o()-_.h-N-j-a(_.get("bottom"),"y"),0):_.get("top")!==!1?a(_.get("top"),"y"):Math.round(Math.max(o()-_.h-N-j,0)/2),x.css({top:c.top,left
7:c.left,visibility:"visible"}),y[0].style.width=y[0].style.height="9999px",r={width:_.w+z+D,height:_.h+N+j,top:l,left:d},e){var g=0;t.each(r,function(t){return r[t]!==de[t]?(g=e,void 0):void 0}),e=g}de=r,e||x.css(r),x.dequeue().animate(r,{duration:e||0,complete:function(){n(),$=!1,y[0].style.width=_.w+z+D+"px",y[0].style.height=_.h+N+j+"px",_.get("reposition")&&setTimeout(function(){E.bind("resize."+Z,J.position)},1),t.isFunction(i)&&i()},step:n})},J.resize=function(t){var e;U&&(t=t||{},t.width&&(_.w=a(t.width,"x")-z-D),t.innerWidth&&(_.w=a(t.innerWidth,"x")),I.css({width:_.w}),t.height&&(_.h=a(t.height,"y")-N-j),t.innerHeight&&(_.h=a(t.innerHeight,"y")),t.innerHeight||t.height||(e=I.scrollTop(),I.css({height:"auto"}),_.h=I.height()),I.css({height:_.h}),e&&I.scrollTop(e),J.position("none"===_.get("transition")?0:_.get("speed")))},J.prep=function(i){function o(){return _.w=_.w||I.width(),_.w=_.mw&&_.mw<_.w?_.mw:_.w,_.w}function a(){return _.h=_.h||I.height(),_.h=_.mh&&_.mh<_.h?_.mh:_.h,_.h}if(U){var d,g="none"===_.get("transition")?0:_.get("speed");I.remove(),I=n(se,"LoadedContent").append(i),I.hide().appendTo(M.show()).css({width:o(),overflow:_.get("scrolling")?"auto":"hidden"}).css({height:a()}).prependTo(b),M.hide(),t(q).css({"float":"none"}),c(_.get("className")),d=function(){function i(){t.support.opacity===!1&&x[0].style.removeAttribute("filter")}var n,o,a=W.length;U&&(o=function(){clearTimeout(Q),L.hide(),u(ne),_.get("onComplete")},F.html(_.get("title")).show(),I.show(),a>1?("string"==typeof _.get("current")&&R.html(_.get("current").replace("{current}",A+1).replace("{total}",a)).show(),K[_.get("loop")||a-1>A?"show":"hide"]().html(_.get("next")),P[_.get("loop")||A?"show":"hide"]().html(_.get("previous")),ce(),_.get("preloading")&&t.each([h(-1),h(1)],function(){var i,n=W[this],o=new r(n,t.data(n,Y)),h=o.get("href");h&&s(o,h)&&(h=l(o,h),i=e.createElement("img"),i.src=h)})):O.hide(),_.get("iframe")?(n=_.get("createIframe"),_.get("scrolling")||(n.scrolling="no"),t(n).attr({src:_.get("href"),"class":Z+"Iframe"}).one("load",o).appendTo(I),ae.one(he,function(){n.src="//about:blank"}),_.get("fastIframe")&&t(n).trigger("load")):o(),"fade"===_.get("transition")?x.fadeTo(g,1,i):i())},"fade"===_.get("transition")?x.fadeTo(g,0,function(){J.position(0,d)}):J.position(g,d)}},J.next=function(){!$&&W[1]&&(_.get("loop")||W[A+1])&&(A=h(1),f(W[A]))},J.prev=function(){!$&&W[1]&&(_.get("loop")||A)&&(A=h(-1),f(W[A]))},J.close=function(){U&&!G&&(G=!0,U=!1,u(oe),_.get("onCleanup"),E.unbind("."+Z),v.fadeTo(_.get("fadeOut")||0,0),x.stop().fadeTo(_.get("fadeOut")||0,0,function(){x.hide(),v.hide(),u(he),I.remove(),setTimeout(function(){G=!1,u(re),_.get("onClosed")},1)}))},J.remove=function(){x&&(x.stop(),t[Y].close(),x.stop(!1,!0).remove(),v.remove(),G=!1,x=null,t("."+te).removeData(Y).removeClass(te),t(e).unbind("click."+Z).unbind("keydown."+Z))},J.element=function(){return t(_.el)},J.settings=X)})(jQuery,document,window);; 8/** 9 * @file 10 * Colorbox module init js. 11 */ 12 13(function ($) { 14 15Drupal.behaviors.initColorbox = { 16 attach: function (context, settings) { 17 if (!$.isFunction($('a, area, input', context).colorbox) || typeof settings.colorbox === 'undefined') { 18 return; 19 } 20 21 if (settings.colorbox.mobiledetect && window.matchMedia) { 22 // Disable Colorbox for small screens. 23 var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")"); 24 if (mq.matches) { 25 return; 26 } 27 } 28 29 // Use "data-colorbox-gallery" if set otherwise use "rel". 30 settings.colorbox.rel = function () { 31 if ($(this).data('colorbox-gallery')) { 32 return $(this).data('colorbox-gallery'); 33 } 34 else { 35 return $(this).attr('rel'); 36 } 37 }; 38 39 $('.colorbox', context) 40 .once('init-colorbox').each(function(){ 41 // Only images are supported for the "colorbox" class. 42 // The "photo" setting forces the href attribute to be treated as an image. 43 var extendParams = { 44 photo: true 45 }; 46 // If a title attribute is supplied, sanitize it. 47 var title = $(this).attr('title'); 48 if (title) { 49 extendParams.title = Drupal.colorbox.sanitizeMarkup(title); 50 } 51 $(this).colorbox($.extend({}, settings.colorbox, extendParams)); 52 }); 53 54 $(context).bind('cbox_complete', function () { 55 Drupal.attachBehaviors('#cboxLoadedContent'); 56 }); 57 } 58}; 59 60// Create colorbox namespace if it doesn't exist. 61if (!Drupal.hasOwnProperty('colorbox')) { 62 Drupal.colorbox = {}; 63} 64 65/** 66 * Global function to allow sanitizing captions and control strings. 67 * 68 * @param markup 69 * String containing potential markup. 70 * @return @string 71 * Sanitized string with potentially dangerous markup removed. 72 */ 73Drupal.colorbox.sanitizeMarkup = function(markup) { 74 // If DOMPurify installed, allow some HTML. Otherwise, treat as plain text. 75 if (typeof DOMPurify !== 'undefined') { 76 var purifyConfig = { 77 ALLOWED_TAGS: [ 78 'a', 79 'b', 80 'strong', 81 'i', 82 'em', 83 'u', 84 'cite', 85 'code', 86 'br' 87 ], 88 ALLOWED_ATTR: [ 89 'href', 90 'hreflang', 91 'title', 92 'target' 93 ] 94 } 95 if (Drupal.settings.hasOwnProperty('dompurify_custom_config')) { 96 purifyConfig = Drupal.settings.dompurify_custom_config; 97 } 98 return DOMPurify.sanitize(markup, purifyConfig); 99 } 100 else { 101 return Drupal.checkPlain(markup); 102 } 103} 104 105})(jQuery); 106; 107/** 108 * @file 109 * Colorbox module style js. 110 */ 111 112(function ($) { 113 114Drupal.behaviors.initColorboxDefaultStyle = { 115 attach: function (context, settings) { 116 $(context).bind('cbox_complete', function () { 117 // Only run if there is a title. 118 if ($('#cboxTitle:empty', context).length == false) { 119 $('#cboxLoadedContent img', context).bind('mouseover', function () { 120 $('#cboxTitle', context).slideDown(); 121 }); 122 $('#cboxOverlay', context).bind('mouseover', function () {
123 $('#cboxTitle', context).slideUp(); 124 }); 125 } 126 else { 127 $('#cboxTitle', context).hide(); 128 } 129 }); 130 } 131}; 132 133})(jQuery); 134; 135/** 136 * @file 137 * Colorbox module load js. 138 */ 139(function ($) { 140 141Drupal.behaviors.initColorboxLoad = { 142 attach: function (context, settings) { 143 if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') { 144 return; 145 } 146 147 if (settings.colorbox.mobiledetect && window.matchMedia) { 148 // Disable Colorbox for small screens. 149 var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")"); 150 if (mq.matches) { 151 return; 152 } 153 } 154 155 $.urlParams = function (url) { 156 var p = {}, 157 e, 158 a = /\+/g, // Regex for replacing addition symbol with a space. 159 r = /([^&=]+)=?([^&]*)/g, 160 d = function (s) { return decodeURIComponent(s.replace(a, ' ')); }, 161 q = url.split('?'); 162 while (e = r.exec(q[1])) { 163 e[1] = d(e[1]); 164 e[2] = d(e[2]); 165 switch (e[2].toLowerCase()) { 166 case 'true': 167 case 'yes': 168 e[2] = true; 169 break; 170 case 'false': 171 case 'no': 172 e[2] = false; 173 break; 174 } 175 if (e[1] == 'width') { e[1] = 'innerWidth'; } 176 if (e[1] == 'height') { e[1] = 'innerHeight'; } 177 if (e[2]) { 178 e[2] = Drupal.checkPlain(e[2]); 179 } 180 p[e[1]] = e[2]; 181 } 182 return p; 183 }; 184 185 $('.colorbox-load', context) 186 .once('init-colorbox-load', function () { 187 var href = $(this).attr('href'); 188 189 var params = $.urlParams(href); 190 191 // Always load in an iframe. 192 params.iframe = true; 193 194 // Set inner width and height if not already specified. 195 if (!params.hasOwnProperty('innerWidth')) { 196 params.innerWidth = $(window).width() * .8; 197 } 198 if (!params.hasOwnProperty('innerHeight')) { 199 params.innerHeight = $(window).height() * .8; 200 } 201 202 if (!params.hasOwnProperty('title')) { 203 // If a title attribute is supplied, sanitize it. 204 var title = $(this).attr('title'); 205 if (title) { 206 params.title = Drupal.colorbox.sanitizeMarkup(title); 207 } 208 } 209 $(this).colorbox($.extend({}, settings.colorbox, params)); 210 }); 211 } 212}; 213 214})(jQuery); 215; 216/** 217 * @file 218 * Colorbox module inline js. 219 */ 220 221(function ($) { 222 223Drupal.behaviors.initColorboxInline = { 224 attach: function (context, settings) { 225 if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') { 226 return; 227 } 228 229 if (settings.colorbox.mobiledetect && window.matchMedia) { 230 // Disable Colorbox for small screens. 231 var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")"); 232 if (mq.matches) { 233 return; 234 } 235 } 236 237 $.urlParam = function(name, url){ 238 if (name == 'fragment') { 239 var results = new RegExp('(#[^&#]*)').exec(url); 240 } 241 else { 242 var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(url); 243 } 244 if (!results) { return ''; } 245 return results[1] || ''; 246 }; 247 $('.colorbox-inline', context).once('init-colorbox-inline').colorbox({ 248 transition:settings.colorbox.transition, 249 speed:settings.colorbox.speed, 250 opacity:settings.colorbox.opacity, 251 slideshow:settings.colorbox.slideshow, 252 slideshowAuto:settings.colorbox.slideshowAuto, 253 slideshowSpeed:settings.colorbox.slideshowSpeed, 254 slideshowStart:settings.colorbox.slideshowStart, 255 slideshowStop:settings.colorbox.slideshowStop, 256 current:settings.colorbox.current, 257 previous:settings.colorbox.previous, 258 next:settings.colorbox.next, 259 close:settings.colorbox.close, 260 overlayClose:settings.colorbox.overlayClose, 261 maxWidth:settings.colorbox.maxWidth, 262 maxHeight:settings.colorbox.maxHeight, 263 innerWidth:function(){ 264 return $.urlParam('width', $(this).attr('href')); 265 }, 266 innerHeight:function(){ 267 return $.urlParam('height', $(this).attr('href')); 268 }, 269 title:function(){ 270 return Drupal.colorbox.sanitizeMarkup( 271 decodeURIComponent($.urlParam('title', $(this).attr('href')))); 272 }, 273 iframe:function(){ 274 return $.urlParam('iframe', $(this).attr('href')); 275 }, 276 inline:function(){ 277 return $.urlParam('inline', $(this).attr('href')); 278 }, 279 href:function(){ 280 return $.urlParam('fragment', $(this).attr('href')); 281 } 282 }); 283 } 284}; 285 286})(jQuery); 287; 288(function($) { 289 Drupal.behaviors.custom_search = { 290 attach: function(context) { 291 292 if (!Drupal.settings.custom_search.solr) { 293 // Check if the search box is not empty on submit 294 $('form.search-form', context).submit(function(){ 295 var $this = $(this); 296 var box = $this.find('input.custom-search-box'); 297 if (box.val() != undefined && box.val() == '') { 298 $this.find('input.custom-search-box').addClass('error'); 299 return false;
300 } 301 // If basic search is hidden, copy or value to the keys 302 if ($this.find('#edit-keys').parents('div.element-invisible').attr('class') == 'element-invisible') { 303 $this.find('#edit-keys').val($this.find('#edit-or').val()); 304 $this.find('#edit-or').val(''); 305 } 306 return true; 307 }); 308 } 309 310 // Search from target 311 $('form.search-form').attr('target', Drupal.settings.custom_search.form_target); 312 313 // Displays Popup. 314 $('form.search-form input.custom-search-box', context).bind('click focus', function(e){ 315 var $parentForm = $(this).parents('form'); 316 // check if there's something in the popup and displays it 317 var popup = $parentForm.find('fieldset.custom_search-popup'); 318 if (popup.find('input,select').length && !popup.hasClass('opened')) { 319 popup.fadeIn().addClass('opened'); 320 } 321 e.stopPropagation(); 322 }); 323 $(document).bind('click focus', function(){ 324 $('fieldset.custom_search-popup').hide().removeClass('opened'); 325 }); 326 327 // Handle checkboxes 328 $('.custom-search-selector input:checkbox', context).each(function(){ 329 var el = $(this); 330 if (el.val() == 'c-all') { 331 el.change(function(){ 332 $(this).parents('.custom-search-selector').find('input:checkbox[value!=c-all]').attr('checked', false); 333 }); 334 } 335 else { 336 if (el.val().substr(0,2) == 'c-') { 337 el.change(function(){ 338 $('.custom-search-selector input:checkbox').each(function(){ 339 if ($(this).val().substr(0,2) == 'o-') { 340 $(this).attr('checked', false); 341 } 342 }); 343 $(this).parents('.custom-search-selector').find('input:checkbox[value=c-all]').attr('checked', false); 344 }); 345 } else { 346 el.change(function(){ 347 $(this).parents('.custom-search-selector').find('input:checkbox[value!=' + el.val() + ']').attr('checked', false); 348 }); 349 } 350 } 351 }); 352 353 // Handle popup. 354 var popup = $('fieldset.custom_search-popup:not(.custom_search-processed)', context).addClass("custom_search-processed"); 355 popup.click(function(e){ 356 e.stopPropagation(); 357 }) 358 popup.append('<a class="custom_search-popup-close" href="#">' + Drupal.t('Close') + '</a>'); 359 $('a.custom_search-popup-close').click(function(e){ 360 $('fieldset.custom_search-popup.opened').hide().removeClass('opened'); 361 e.preventDefault(); 362 }); 363 364 } 365 } 366})(jQuery); 367; 368/*! 369 * jQuery Cycle Plugin (with Transition Definitions) 370 * Examples and documentation at: http://jquery.malsup.com/cycle/ 371 * Copyright (c) 2007-2013 M. Alsup 372 * Version: 3.0.3 (11-JUL-2013) 373 * Dual licensed under the MIT and GPL licenses. 374 * http://jquery.malsup.com/license.html 375 * Requires: jQuery v1.7.1 or later 376 */ 377;(function($, undefined) { 378"use strict"; 379 380var ver = '3.0.3'; 381 382function debug(s) { 383 if ($.fn.cycle.debug) 384 log(s); 385} 386function log() { 387 /*global console */ 388 if (window.console && console.log) 389 console.log('[cycle] ' + Array.prototype.join.call(arguments,' ')); 390} 391$.expr[':'].paused = function(el) { 392 return el.cyclePause; 393}; 394 395 396// the options arg can be... 397// a number - indicates an immediate transition should occur to the given slide index 398// a string - 'pause', 'resume', 'toggle', 'next', 'prev', 'stop', 'destroy' or the name of a transition effect (ie, 'fade', 'zoom', etc) 399// an object - properties to control the slideshow 400// 401// the arg2 arg can be... 402// the name of an fx (only used in conjunction with a numeric value for 'options') 403// the value true (only used in first arg == 'resume') and indicates 404// that the resume should occur immediately (not wait for next timeout) 405 406$.fn.cycle = function(options, arg2) { 407 var o = { s: this.selector, c: this.context }; 408 409 // in 1.3+ we can fix mistakes with the ready state 410 if (this.length === 0 && options != 'stop') { 411 if (!$.isReady && o.s) { 412 log('DOM not ready, queuing slideshow'); 413 $(function() { 414 $(o.s,o.c).cycle(options,arg2); 415 }); 416 return this; 417 } 418 // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready() 419 log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)')); 420 return this; 421 } 422 423 // iterate the matched nodeset 424 return this.each(function() { 425 var opts = handleArguments(this, options, arg2); 426 if (opts === false) 427 return; 428 429 opts.updateActivePagerLink = opts.updateActivePagerLink || $.fn.cycle.updateActivePagerLink; 430 431 // stop existing slideshow for this container (if there is one) 432 if (this.cycleTimeout) 433 clearTimeout(this.cycleTimeout); 434 this.cycleTimeout = this.cyclePause = 0; 435 this.cycleStop = 0; // issue #108 436 437 var $cont = $(this); 438 var $slides = opts.slideExpr ? $(opts.slideExpr, this) : $cont.children(); 439 var els = $slides.get(); 440 441 if (els.length < 2) { 442 log('terminating; too few slides: ' + els.length); 443 return; 444 } 445 446 var opts2 = buildOptions($cont, $slides, els, opts, o); 447 if (opts2 === false) 448 return; 449 450 var startTime = opts2.continuous ? 10 : getTimeout(els[opts2.currSlide], els[opts2.nextSlide], opts2, !opts2.backwards); 451
452 // if it's an auto slideshow, kick it off 453 if (startTime) { 454 startTime += (opts2.delay || 0); 455 if (startTime < 10) 456 startTime = 10; 457 debug('first timeout: ' + startTime); 458 this.cycleTimeout = setTimeout(function(){go(els,opts2,0,!opts.backwards);}, startTime); 459 } 460 }); 461}; 462 463function triggerPause(cont, byHover, onPager) { 464 var opts = $(cont).data('cycle.opts'); 465 if (!opts) 466 return; 467 var paused = !!cont.cyclePause; 468 if (paused && opts.paused) 469 opts.paused(cont, opts, byHover, onPager); 470 else if (!paused && opts.resumed) 471 opts.resumed(cont, opts, byHover, onPager); 472} 473 474// process the args that were passed to the plugin fn 475function handleArguments(cont, options, arg2) { 476 if (cont.cycleStop === undefined) 477 cont.cycleStop = 0; 478 if (options === undefined || options === null) 479 options = {}; 480 if (options.constructor == String) { 481 switch(options) { 482 case 'destroy': 483 case 'stop': 484 var opts = $(cont).data('cycle.opts'); 485 if (!opts) 486 return false; 487 cont.cycleStop++; // callbacks look for change 488 if (cont.cycleTimeout) 489 clearTimeout(cont.cycleTimeout); 490 cont.cycleTimeout = 0; 491 if (opts.elements) 492 $(opts.elements).stop(); 493 $(cont).removeData('cycle.opts'); 494 if (options == 'destroy') 495 destroy(cont, opts); 496 return false; 497 case 'toggle': 498 cont.cyclePause = (cont.cyclePause === 1) ? 0 : 1; 499 checkInstantResume(cont.cyclePause, arg2, cont); 500 triggerPause(cont); 501 return false; 502 case 'pause': 503 cont.cyclePause = 1; 504 triggerPause(cont); 505 return false; 506 case 'resume': 507 cont.cyclePause = 0; 508 checkInstantResume(false, arg2, cont); 509 triggerPause(cont); 510 return false; 511 case 'prev': 512 case 'next': 513 opts = $(cont).data('cycle.opts'); 514 if (!opts) { 515 log('options not found, "prev/next" ignored'); 516 return false; 517 } 518 if (typeof arg2 == 'string') 519 opts.oneTimeFx = arg2; 520 $.fn.cycle[options](opts); 521 return false; 522 default: 523 options = { fx: options }; 524 } 525 return options; 526 } 527 else if (options.constructor == Number) { 528 // go to the requested slide 529 var num = options; 530 options = $(cont).data('cycle.opts'); 531 if (!options) { 532 log('options not found, can not advance slide'); 533 return false; 534 } 535 if (num < 0 || num >= options.elements.length) { 536 log('invalid slide index: ' + num); 537 return false; 538 } 539 options.nextSlide = num; 540 if (cont.cycleTimeout) { 541 clearTimeout(cont.cycleTimeout); 542 cont.cycleTimeout = 0; 543 } 544 if (typeof arg2 == 'string') 545 options.oneTimeFx = arg2; 546 go(options.elements, options, 1, num >= options.currSlide); 547 return false; 548 } 549 return options; 550 551 function checkInstantResume(isPaused, arg2, cont) { 552 if (!isPaused && arg2 === true) { // resume now! 553 var options = $(cont).data('cycle.opts'); 554 if (!options) { 555 log('options not found, can not resume'); 556 return false; 557 } 558 if (cont.cycleTimeout) { 559 clearTimeout(cont.cycleTimeout); 560 cont.cycleTimeout = 0; 561 } 562 go(options.elements, options, 1, !options.backwards); 563 } 564 } 565} 566 567function removeFilter(el, opts) { 568 if (!$.support.opacity && opts.cleartype && el.style.filter) { 569 try { el.style.removeAttribute('filter'); } 570 catch(smother) {} // handle old opera versions 571 } 572} 573 574// unbind event handlers 575function destroy(cont, opts) { 576 if (opts.next) 577 $(opts.next).unbind(opts.prevNextEvent); 578 if (opts.prev) 579 $(opts.prev).unbind(opts.prevNextEvent); 580 581 if (opts.pager || opts.pagerAnchorBuilder) 582 $.each(opts.pagerAnchors || [], function() { 583 this.unbind().remove(); 584 }); 585 opts.pagerAnchors = null; 586 $(cont).unbind('mouseenter.cycle mouseleave.cycle'); 587 if (opts.destroy) // callback 588 opts.destroy(opts); 589} 590 591// one-time initialization 592function buildOptions($cont, $slides, els, options, o) { 593 var startingSlideSpecified; 594 // support metadata plugin (v1.0 and v2.0) 595 var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {}); 596 var meta = $.isFunction($cont.data) ? $cont.data(opts.metaAttr) : null; 597 if (meta) 598 opts = $.extend(opts, meta); 599 if (opts.autostop) 600 opts.countdown = opts.autostopCount || els.length; 601 602 var cont = $cont[0]; 603 $cont.data('cycle.opts', opts); 604 opts.$cont = $cont; 605 opts.stopCount = cont.cycleStop; 606 opts.elements = els; 607 opts.before = opts.before ? [opts.before] : []; 608 opts.after = opts.after ? [opts.after] : []; 609 610 // push some after callbacks 611 if (!$.support.opacity && opts.cleartype) 612 opts.after.push(function() { removeFilter(this, opts); }); 613 if (opts.continuous) 614 opts.after.push(function() { go(els,opts,0,!opts.backwards); }); 615 616 saveOriginalOpts(opts); 617 618 // clearType corrections 619 if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg) 620 clearTypeFix($slides); 621 622 // container requires non-static position so that slides can be position within 623 if ($cont.css('position') == 'static') 624 $cont.css('position', 'relative'); 625 if (opts.width) 626 $cont.width(opts.width); 627 if (opts.height && opts.height != 'auto') 628 $cont.height(opts.height); 629 630 if (opts.startingSlide !== undefined) { 631 opts.startingSlide = parseInt(opts.startingSlide,10); 632 if (opts.startingSlide >= els.length || opts.startSlide < 0) 633 opts.startingSlide = 0; // catch bogus input 634 else 635 startingSlideSpecified = true; 636 } 637 else if (opts.backwards) 638 opts.startingSlide = els.length - 1; 639 else 640 opts.startingSlide = 0; 641 642 // if random, mix up the slide array 643 if (opts.random) { 644 opts.randomMap = []; 645 for (var i = 0; i < els.length; i++) 646 opts.randomMap.push(i); 647 opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;}); 648 if (startingSlideSpecified) { 649 // try to find the specified starting slide and if found set start slide index in the map accordingly 650 for ( var cnt = 0; cnt < els.length; cnt++ ) { 651 if ( opts.startingSlide == opts.randomMap[cnt] ) { 652 opts.randomIndex = cnt; 653 } 654 } 655 } 656 else { 657 opts.randomIndex = 1; 658 opts.startingSlide = opts.randomMap[1]; 659 } 660 } 661 else if (opts.startingSlide >= els.length) 662 opts.startingSlide = 0; // catch bogus input 663 opts.currSlide = opts.startingSlide || 0; 664 var first = opts.startingSlide; 665 666 // set position and zIndex on all the slides
667 $slides.css({position: 'absolute', top:0, left:0}).hide().each(function(i) { 668 var z; 669 if (opts.backwards) 670 z = first ? i <= first ? els.length + (i-first) : first-i : els.length-i; 671 else 672 z = first ? i >= first ? els.length - (i-first) : first-i : els.length-i; 673 $(this).css('z-index', z); 674 }); 675 676 // make sure first slide is visible 677 $(els[first]).css('opacity',1).show(); // opacity bit needed to handle restart use case 678 removeFilter(els[first], opts); 679 680 // stretch slides 681 if (opts.fit) { 682 if (!opts.aspect) { 683 if (opts.width) 684 $slides.width(opts.width); 685 if (opts.height && opts.height != 'auto') 686 $slides.height(opts.height); 687 } else { 688 $slides.each(function(){ 689 var $slide = $(this); 690 var ratio = (opts.aspect === true) ? $slide.width()/$slide.height() : opts.aspect; 691 if( opts.width && $slide.width() != opts.width ) { 692 $slide.width( opts.width ); 693 $slide.height( opts.width / ratio ); 694 } 695 696 if( opts.height && $slide.height() < opts.height ) { 697 $slide.height( opts.height ); 698 $slide.width( opts.height * ratio ); 699 } 700 }); 701 } 702 } 703 704 if (opts.center && ((!opts.fit) || opts.aspect)) { 705 $slides.each(function(){ 706 var $slide = $(this); 707 $slide.css({ 708 "margin-left": opts.width ? 709 ((opts.width - $slide.width()) / 2) + "px" : 710 0, 711 "margin-top": opts.height ? 712 ((opts.height - $slide.height()) / 2) + "px" : 713 0 714 }); 715 }); 716 } 717 718 if (opts.center && !opts.fit && !opts.slideResize) { 719 $slides.each(function(){ 720 var $slide = $(this); 721 $slide.css({ 722 "margin-left": opts.width ? ((opts.width - $slide.width()) / 2) + "px" : 0, 723 "margin-top": opts.height ? ((opts.height - $slide.height()) / 2) + "px" : 0 724 }); 725 }); 726 } 727 728 // stretch container 729 var reshape = (opts.containerResize || opts.containerResizeHeight) && $cont.innerHeight() < 1; 730 if (reshape) { // do this only if container has no size http://tinyurl.com/da2oa9 731 var maxw = 0, maxh = 0; 732 for(var j=0; j < els.length; j++) { 733 var $e = $(els[j]), e = $e[0], w = $e.outerWidth(), h = $e.outerHeight(); 734 if (!w) w = e.offsetWidth || e.width || $e.attr('width'); 735 if (!h) h = e.offsetHeight || e.height || $e.attr('height'); 736 maxw = w > maxw ? w : maxw; 737 maxh = h > maxh ? h : maxh; 738 } 739 if (opts.containerResize && maxw > 0 && maxh > 0) 740 $cont.css({width:maxw+'px',height:maxh+'px'}); 741 if (opts.containerResizeHeight && maxh > 0) 742 $cont.css({height:maxh+'px'}); 743 } 744 745 var pauseFlag = false; // https://github.com/malsup/cycle/issues/44 746 if (opts.pause) 747 $cont.bind('mouseenter.cycle', function(){ 748 pauseFlag = true; 749 this.cyclePause++; 750 triggerPause(cont, true); 751 }).bind('mouseleave.cycle', function(){ 752 if (pauseFlag) 753 this.cyclePause--; 754 triggerPause(cont, true); 755 }); 756 757 if (supportMultiTransitions(opts) === false) 758 return false; 759 760 // apparently a lot of people use image slideshows without height/width attributes on the images. 761 // Cycle 2.50+ requires the sizing info for every slide; this block tries to deal with that. 762 var requeue = false; 763 options.requeueAttempts = options.requeueAttempts || 0; 764 $slides.each(function() { 765 // try to get height/width of each slide 766 var $el = $(this); 767 this.cycleH = (opts.fit && opts.height) ? opts.height : ($el.height() || this.offsetHeight || this.height || $el.attr('height') || 0); 768 this.cycleW = (opts.fit && opts.width) ? opts.width : ($el.width() || this.offsetWidth || this.width || $el.attr('width') || 0); 769 770 if ( $el.is('img') ) { 771 var loading = (this.cycleH === 0 && this.cycleW === 0 && !this.complete); 772 // don't requeue for images that are still loading but have a valid size 773 if (loading) { 774 if (o.s && opts.requeueOnImageNotLoaded && ++options.requeueAttempts < 100) { // track retry count so we don't loop forever 775 log(options.requeueAttempts,' - img slide not loaded, requeuing slideshow: ', this.src, this.cycleW, this.cycleH); 776 setTimeout(function() {$(o.s,o.c).cycle(options);}, opts.requeueTimeout); 777 requeue = true; 778 return false; // break each loop 779 } 780 else { 781 log('could not determine size of image: '+this.src, this.cycleW, this.cycleH); 782 } 783 } 784 } 785 return true; 786 }); 787 788 if (requeue) 789 return false;
790 791 opts.cssBefore = opts.cssBefore || {}; 792 opts.cssAfter = opts.cssAfter || {}; 793 opts.cssFirst = opts.cssFirst || {}; 794 opts.animIn = opts.animIn || {}; 795 opts.animOut = opts.animOut || {}; 796 797 $slides.not(':eq('+first+')').css(opts.cssBefore); 798 $($slides[first]).css(opts.cssFirst); 799 800 if (opts.timeout) { 801 opts.timeout = parseInt(opts.timeout,10); 802 // ensure that timeout and speed settings are sane 803 if (opts.speed.constructor == String) 804 opts.speed = $.fx.speeds[opts.speed] || parseInt(opts.speed,10); 805 if (!opts.sync) 806 opts.speed = opts.speed / 2; 807 808 var buffer = opts.fx == 'none' ? 0 : opts.fx == 'shuffle' ? 500 : 250; 809 while((opts.timeout - opts.speed) < buffer) // sanitize timeout 810 opts.timeout += opts.speed; 811 } 812 if (opts.easing) 813 opts.easeIn = opts.easeOut = opts.easing; 814 if (!opts.speedIn) 815 opts.speedIn = opts.speed; 816 if (!opts.speedOut) 817 opts.speedOut = opts.speed; 818 819 opts.slideCount = els.length; 820 opts.currSlide = opts.lastSlide = first; 821 if (opts.random) { 822 if (++opts.randomIndex == els.length) 823 opts.randomIndex = 0; 824 opts.nextSlide = opts.randomMap[opts.randomIndex]; 825 } 826 else if (opts.backwards) 827 opts.nextSlide = opts.startingSlide === 0 ? (els.length-1) : opts.startingSlide-1; 828 else 829 opts.nextSlide = opts.startingSlide >= (els.length-1) ? 0 : opts.startingSlide+1; 830 831 // run transition init fn 832 if (!opts.multiFx) { 833 var init = $.fn.cycle.transitions[opts.fx]; 834 if ($.isFunction(init)) 835 init($cont, $slides, opts); 836 else if (opts.fx != 'custom' && !opts.multiFx) { 837 log('unknown transition: ' + opts.fx,'; slideshow terminating'); 838 return false; 839 } 840 } 841 842 // fire artificial events 843 var e0 = $slides[first]; 844 if (!opts.skipInitializationCallbacks) { 845 if (opts.before.length) 846 opts.before[0].apply(e0, [e0, e0, opts, true]); 847 if (opts.after.length) 848 opts.after[0].apply(e0, [e0, e0, opts, true]); 849 } 850 if (opts.next) 851 $(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,1);}); 852 if (opts.prev) 853 $(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,0);}); 854 if (opts.pager || opts.pagerAnchorBuilder) 855 buildPager(els,opts); 856 857 exposeAddSlide(opts, els); 858 859 return opts; 860} 861 862// save off original opts so we can restore after clearing state 863function saveOriginalOpts(opts) { 864 opts.original = { before: [], after: [] }; 865 opts.original.cssBefore = $.extend({}, opts.cssBefore); 866 opts.original.cssAfter = $.extend({}, opts.cssAfter); 867 opts.original.animIn = $.extend({}, opts.animIn); 868 opts.original.animOut = $.extend({}, opts.animOut); 869 $.each(opts.before, function() { opts.original.before.push(this); }); 870 $.each(opts.after, function() { opts.original.after.push(this); }); 871} 872 873function supportMultiTransitions(opts) { 874 var i, tx, txs = $.fn.cycle.transitions; 875 // look for multiple effects 876 if (opts.fx.indexOf(',') > 0) { 877 opts.multiFx = true; 878 opts.fxs = opts.fx.replace(/\s*/g,'').split(','); 879 // discard any bogus effect names 880 for (i=0; i < opts.fxs.length; i++) { 881 var fx = opts.fxs[i]; 882 tx = txs[fx]; 883 if (!tx || !txs.hasOwnProperty(fx) || !$.isFunction(tx)) { 884 log('discarding unknown transition: ',fx); 885 opts.fxs.splice(i,1); 886 i--; 887 } 888 } 889 // if we have an empty list then we threw everything away! 890 if (!opts.fxs.length) { 891 log('No valid transitions named; slideshow terminating.'); 892 return false; 893 } 894 } 895 else if (opts.fx == 'all') { // auto-gen the list of transitions 896 opts.multiFx = true; 897 opts.fxs = []; 898 for (var p in txs) { 899 if (txs.hasOwnProperty(p)) { 900 tx = txs[p]; 901 if (txs.hasOwnProperty(p) && $.isFunction(tx)) 902 opts.fxs.push(p); 903 } 904 } 905 } 906 if (opts.multiFx && opts.randomizeEffects) { 907 // munge the fxs array to make effect selection random 908 var r1 = Math.floor(Math.random() * 20) + 30; 909 for (i = 0; i < r1; i++) { 910 var r2 = Math.floor(Math.random() * opts.fxs.length); 911 opts.fxs.push(opts.fxs.splice(r2,1)[0]); 912 } 913 debug('randomized fx sequence: ',opts.fxs); 914 } 915 return true; 916} 917 918// provide a mechanism for adding slides after the slideshow has started 919function exposeAddSlide(opts, els) { 920 opts.addSlide = function(newSlide, prepend) {
921 var $s = $(newSlide), s = $s[0]; 922 if (!opts.autostopCount) 923 opts.countdown++; 924 els[prepend?'unshift':'push'](s); 925 if (opts.els) 926 opts.els[prepend?'unshift':'push'](s); // shuffle needs this 927 opts.slideCount = els.length; 928 929 // add the slide to the random map and resort 930 if (opts.random) { 931 opts.randomMap.push(opts.slideCount-1); 932 opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;}); 933 } 934 935 $s.css('position','absolute'); 936 $s[prepend?'prependTo':'appendTo'](opts.$cont); 937 938 if (prepend) { 939 opts.currSlide++; 940 opts.nextSlide++; 941 } 942 943 if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg) 944 clearTypeFix($s); 945 946 if (opts.fit && opts.width) 947 $s.width(opts.width); 948 if (opts.fit && opts.height && opts.height != 'auto') 949 $s.height(opts.height); 950 s.cycleH = (opts.fit && opts.height) ? opts.height : $s.height(); 951 s.cycleW = (opts.fit && opts.width) ? opts.width : $s.width(); 952 953 $s.css(opts.cssBefore); 954 955 if (opts.pager || opts.pagerAnchorBuilder) 956 $.fn.cycle.createPagerAnchor(els.length-1, s, $(opts.pager), els, opts); 957 958 if ($.isFunction(opts.onAddSlide)) 959 opts.onAddSlide($s); 960 else 961 $s.hide(); // default behavior 962 }; 963} 964 965// reset internal state; we do this on every pass in order to support multiple effects 966$.fn.cycle.resetState = function(opts, fx) { 967 fx = fx || opts.fx; 968 opts.before = []; opts.after = []; 969 opts.cssBefore = $.extend({}, opts.original.cssBefore); 970 opts.cssAfter = $.extend({}, opts.original.cssAfter); 971 opts.animIn = $.extend({}, opts.original.animIn); 972 opts.animOut = $.extend({}, opts.original.animOut); 973 opts.fxFn = null; 974 $.each(opts.original.before, function() { opts.before.push(this); }); 975 $.each(opts.original.after, function() { opts.after.push(this); }); 976 977 // re-init 978 var init = $.fn.cycle.transitions[fx]; 979 if ($.isFunction(init)) 980 init(opts.$cont, $(opts.elements), opts); 981}; 982 983// this is the main engine fn, it handles the timeouts, callbacks and slide index mgmt 984function go(els, opts, manual, fwd) { 985 var p = opts.$cont[0], curr = els[opts.currSlide], next = els[opts.nextSlide]; 986 987 // opts.busy is true if we're in the middle of an animation 988 if (manual && opts.busy && opts.manualTrump) { 989 // let manual transitions requests trump active ones 990 debug('manualTrump in go(), stopping active transition'); 991 $(els).stop(true,true); 992 opts.busy = 0; 993 clearTimeout(p.cycleTimeout); 994 } 995 996 // don't begin another timeout-based transition if there is one active 997 if (opts.busy) { 998 debug('transition active, ignoring new tx request'); 999 return; 1000 } 1001 1002 1003 // stop cycling if we have an outstanding stop request 1004 if (p.cycleStop != opts.stopCount || p.cycleTimeout === 0 && !manual) 1005 return; 1006 1007 // check to see if we should stop cycling based on autostop options 1008 if (!manual && !p.cyclePause && !opts.bounce && 1009 ((opts.autostop && (--opts.countdown <= 0)) || 1010 (opts.nowrap && !opts.random && opts.nextSlide < opts.currSlide))) { 1011 if (opts.end) 1012 opts.end(opts); 1013 return; 1014 } 1015 1016 // if slideshow is paused, only transition on a manual trigger 1017 var changed = false; 1018 if ((manual || !p.cyclePause) && (opts.nextSlide != opts.currSlide)) { 1019 changed = true; 1020 var fx = opts.fx; 1021 // keep trying to get the slide size if we don't have it yet 1022 curr.cycleH = curr.cycleH || $(curr).height(); 1023 curr.cycleW = curr.cycleW || $(curr).width(); 1024 next.cycleH = next.cycleH || $(next).height(); 1025 next.cycleW = next.cycleW || $(next).width(); 1026 1027 // support multiple transition types 1028 if (opts.multiFx) { 1029 if (fwd && (opts.lastFx === undefined || ++opts.lastFx >= opts.fxs.length)) 1030 opts.lastFx = 0; 1031 else if (!fwd && (opts.lastFx === undefined || --opts.lastFx < 0)) 1032 opts.lastFx = opts.fxs.length - 1; 1033 fx = opts.fxs[opts.lastFx]; 1034 } 1035 1036 // one-time fx overrides apply to: $('div').cycle(3,'zoom'); 1037 if (opts.oneTimeFx) { 1038 fx = opts.oneTimeFx; 1039 opts.oneTimeFx = null; 1040 } 1041 1042 $.fn.cycle.resetState(opts, fx); 1043 1044 // run the before callbacks 1045 if (opts.before.length) 1046 $.each(opts.before, function(i,o) { 1047 if (p.cycleStop != opts.stopCount) return; 1048 o.apply(next, [curr, next, opts, fwd]); 1049 }); 1050 1051 // stage the after callacks 1052 var after = function() { 1053 opts.busy = 0; 1054 $.each(opts.after, function(i,o) { 1055 if (p.cycleStop != opts.stopCount) return; 1056 o.apply(next, [curr, next, opts, fwd]); 1057 }); 1058 if (!p.cycleStop) { 1059 // queue next transition 1060 queueNext(); 1061 } 1062 }; 1063 1064 debug('tx firing('+fx+'); currSlide: ' + opts.currSlide + '; nextSlide: ' + opts.nextSlide); 1065 1066 // get ready to perform the transition 1067 opts.busy = 1; 1068 if (opts.fxFn) // fx function provided? 1069 opts.fxFn(curr, next, opts, after, fwd, manual && opts.fastOnEvent); 1070 else if ($.isFunction($.fn.cycle[opts.fx])) // fx plugin ? 1071 $.fn.cycle[opts.fx](curr, next, opts, after, fwd, manual && opts.fastOnEvent); 1072 else 1073 $.fn.cycle.custom(curr, next, opts, after, fwd, manual && opts.fastOnEvent); 1074 } 1075 else { 1076 queueNext(); 1077 } 1078 1079 if (changed || opts.nextSlide == opts.currSlide) { 1080 // calculate the next slide 1081 var roll; 1082 opts.lastSlide = opts.currSlide; 1083 if (opts.random) { 1084 opts.currSlide = opts.nextSlide; 1085 if (++opts.randomIndex == els.length) { 1086 opts.randomIndex = 0; 1087 opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;}); 1088 } 1089 opts.nextSlide = opts.randomMap[opts.randomIndex]; 1090 if (opts.nextSlide == opts.currSlide) 1091 opts.nextSlide = (opts.currSlide == opts.slideCount - 1) ? 0 : opts.currSlide + 1; 1092 } 1093 else if (opts.backwards) { 1094 roll = (opts.nextSlide - 1) < 0; 1095 if (roll && opts.bounce) { 1096 opts.backwards = !opts.backwards; 1097 opts.nextSlide = 1; 1098 opts.currSlide = 0; 1099 } 1100 else { 1101 opts.nextSlide = roll ? (els.length-1) : opts.nextSlide-1; 1102 opts.currSlide = roll ? 0 : opts.nextSlide+1; 1103 } 1104 } 1105 else { // sequence 1106 roll = (opts.nextSlide + 1) == els.length; 1107 if (roll && opts.bounce) { 1108 opts.backwards = !opts.backwards; 1109 opts.nextSlide = els.length-2; 1110 opts.currSlide = els.length-1; 1111 } 1112 else { 1113 opts.nextSlide = roll ? 0 : opts.nextSlide+1; 1114 opts.currSlide = roll ? els.length-1 : opts.nextSlide-1; 1115 } 1116 } 1117 } 1118 if (changed && opts.pager) 1119 opts.updateActivePagerLink(opts.pager, opts.currSlide, opts.activePagerClass); 1120 1121 function queueNext() { 1122 // stage the next transition 1123 var ms = 0, timeout = opts.timeout; 1124 if (opts.timeout && !opts.continuous) { 1125 ms = getTimeout(els[opts.currSlide], els[opts.nextSlide], opts, fwd); 1126 if (opts.fx == 'shuffle') 1127 ms -= opts.speedOut; 1128 } 1129 else if (opts.continuous && p.cyclePause) // continuous shows work off an after callback, not this timer logic 1130 ms = 10; 1131 if (ms > 0) 1132 p.cycleTimeout = setTimeout(function(){ go(els, opts, 0, !opts.backwards); }, ms); 1133 } 1134} 1135 1136// invoked after transition 1137$.fn.cycle.updateActivePagerLink = function(pager, currSlide, clsName) { 1138 $(pager).each(function() { 1139 $(this).children().removeClass(clsName).eq(currSlide).addClass(clsName); 1140 }); 1141}; 1142 1143// calculate timeout value for current transition 1144function getTimeout(curr, next, opts, fwd) { 1145 if (opts.timeoutFn) { 1146 // call user provided calc fn 1147 var t = opts.timeoutFn.call(curr,curr,next,opts,fwd); 1148 while (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout 1149 t += opts.speed;
1150 debug('calculated timeout: ' + t + '; speed: ' + opts.speed); 1151 if (t !== false) 1152 return t; 1153 } 1154 return opts.timeout; 1155} 1156 1157// expose next/prev function, caller must pass in state 1158$.fn.cycle.next = function(opts) { advance(opts,1); }; 1159$.fn.cycle.prev = function(opts) { advance(opts,0);}; 1160 1161// advance slide forward or back 1162function advance(opts, moveForward) { 1163 var val = moveForward ? 1 : -1; 1164 var els = opts.elements; 1165 var p = opts.$cont[0], timeout = p.cycleTimeout; 1166 if (timeout) { 1167 clearTimeout(timeout); 1168 p.cycleTimeout = 0; 1169 } 1170 if (opts.random && val < 0) { 1171 // move back to the previously display slide 1172 opts.randomIndex--; 1173 if (--opts.randomIndex == -2) 1174 opts.randomIndex = els.length-2; 1175 else if (opts.randomIndex == -1) 1176 opts.randomIndex = els.length-1; 1177 opts.nextSlide = opts.randomMap[opts.randomIndex]; 1178 } 1179 else if (opts.random) { 1180 opts.nextSlide = opts.randomMap[opts.randomIndex]; 1181 } 1182 else { 1183 opts.nextSlide = opts.currSlide + val; 1184 if (opts.nextSlide < 0) { 1185 if (opts.nowrap) return false; 1186 opts.nextSlide = els.length - 1; 1187 } 1188 else if (opts.nextSlide >= els.length) { 1189 if (opts.nowrap) return false; 1190 opts.nextSlide = 0; 1191 } 1192 } 1193 1194 var cb = opts.onPrevNextEvent || opts.prevNextClick; // prevNextClick is deprecated 1195 if ($.isFunction(cb)) 1196 cb(val > 0, opts.nextSlide, els[opts.nextSlide]); 1197 go(els, opts, 1, moveForward); 1198 return false; 1199} 1200 1201function buildPager(els, opts) { 1202 var $p = $(opts.pager); 1203 $.each(els, function(i,o) { 1204 $.fn.cycle.createPagerAnchor(i,o,$p,els,opts); 1205 }); 1206 opts.updateActivePagerLink(opts.pager, opts.startingSlide, opts.activePagerClass); 1207} 1208 1209$.fn.cycle.createPagerAnchor = function(i, el, $p, els, opts) { 1210 var a; 1211 if ($.isFunction(opts.pagerAnchorBuilder)) { 1212 a = opts.pagerAnchorBuilder(i,el); 1213 debug('pagerAnchorBuilder('+i+', el) returned: ' + a); 1214 } 1215 else 1216 a = '<a href="#">'+(i+1)+'</a>'; 1217 1218 if (!a) 1219 return; 1220 var $a = $(a); 1221 // don't reparent if anchor is in the dom 1222 if ($a.parents('body').length === 0) { 1223 var arr = []; 1224 if ($p.length > 1) { 1225 $p.each(function() { 1226 var $clone = $a.clone(true); 1227 $(this).append($clone); 1228 arr.push($clone[0]); 1229 }); 1230 $a = $(arr); 1231 } 1232 else { 1233 $a.appendTo($p); 1234 } 1235 } 1236 1237 opts.pagerAnchors = opts.pagerAnchors || []; 1238 opts.pagerAnchors.push($a); 1239 1240 var pagerFn = function(e) { 1241 e.preventDefault(); 1242 opts.nextSlide = i; 1243 var p = opts.$cont[0], timeout = p.cycleTimeout; 1244 if (timeout) { 1245 clearTimeout(timeout); 1246 p.cycleTimeout = 0; 1247 } 1248 var cb = opts.onPagerEvent || opts.pagerClick; // pagerClick is deprecated 1249 if ($.isFunction(cb)) 1250 cb(opts.nextSlide, els[opts.nextSlide]); 1251 go(els,opts,1,opts.currSlide < i); // trigger the trans 1252// return false; // <== allow bubble 1253 }; 1254 1255 if ( /mouseenter|mouseover/i.test(opts.pagerEvent) ) { 1256 $a.hover(pagerFn, function(){/* no-op */} ); 1257 } 1258 else { 1259 $a.bind(opts.pagerEvent, pagerFn); 1260 } 1261 1262 if ( ! /^click/.test(opts.pagerEvent) && !opts.allowPagerClickBubble) 1263 $a.bind('click.cycle', function(){return false;}); // suppress click 1264 1265 var cont = opts.$cont[0]; 1266 var pauseFlag = false; // https://github.com/malsup/cycle/issues/44 1267 if (opts.pauseOnPagerHover) { 1268 $a.hover( 1269 function() { 1270 pauseFlag = true; 1271 cont.cyclePause++; 1272 triggerPause(cont,true,true); 1273 }, function() { 1274 if (pauseFlag) 1275 cont.cyclePause--; 1276 triggerPause(cont,true,true); 1277 } 1278 ); 1279 } 1280}; 1281 1282// helper fn to calculate the number of slides between the current and the next 1283$.fn.cycle.hopsFromLast = function(opts, fwd) { 1284 var hops, l = opts.lastSlide, c = opts.currSlide; 1285 if (fwd) 1286 hops = c > l ? c - l : opts.slideCount - l; 1287 else 1288 hops = c < l ? l - c : l + opts.slideCount - c; 1289 return hops; 1290}; 1291 1292// fix clearType problems in ie6 by setting an explicit bg color 1293// (otherwise text slides look horrible during a fade transition) 1294function clearTypeFix($slides) { 1295 debug('applying clearType background-color hack'); 1296 function hex(s) { 1297 s = parseInt(s,10).toString(16); 1298 return s.length < 2 ? '0'+s : s; 1299 } 1300 function getBg(e) { 1301 for ( ; e && e.nodeName.toLowerCase() != 'html'; e = e.parentNode) { 1302 var v = $.css(e,'background-color'); 1303 if (v && v.indexOf('rgb') >= 0 ) { 1304 var rgb = v.match(/\d+/g); 1305 return '#'+ hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]); 1306 } 1307 if (v && v != 'transparent') 1308 return v; 1309 } 1310 return '#ffffff'; 1311 } 1312 $slides.each(function() { $(this).css('background-color', getBg(this)); }); 1313} 1314 1315// reset common props before the next transition 1316$.fn.cycle.commonReset = function(curr,next,opts,w,h,rev) { 1317 $(opts.elements).not(curr).hide(); 1318 if (typeof opts.cssBefore.opacity == 'undefined') 1319 opts.cssBefore.opacity = 1; 1320 opts.cssBefore.display = 'block'; 1321 if (opts.slideResize && w !== false && next.cycleW > 0) 1322 opts.cssBefore.width = next.cycleW; 1323 if (opts.slideResize && h !== false && next.cycleH > 0) 1324 opts.cssBefore.height = next.cycleH; 1325 opts.cssAfter = opts.cssAfter || {}; 1326 opts.cssAfter.display = 'none'; 1327 $(curr).css('zIndex',opts.slideCount + (rev === true ? 1 : 0)); 1328 $(next).css('zIndex',opts.slideCount + (rev === true ? 0 : 1)); 1329}; 1330 1331// the actual fn for effecting a transition 1332$.fn.cycle.custom = function(curr, next, opts, cb, fwd, speedOverride) { 1333 var $l = $(curr), $n = $(next); 1334 var speedIn = opts.speedIn, speedOut = opts.speedOut, easeIn = opts.easeIn, easeOut = opts.easeOut, animInDelay = opts.animInDelay, animOutDelay = opts.animOutDelay;
1335 $n.css(opts.cssBefore); 1336 if (speedOverride) { 1337 if (typeof speedOverride == 'number') 1338 speedIn = speedOut = speedOverride; 1339 else 1340 speedIn = speedOut = 1; 1341 easeIn = easeOut = null; 1342 } 1343 var fn = function() { 1344 $n.delay(animInDelay).animate(opts.animIn, speedIn, easeIn, function() { 1345 cb(); 1346 }); 1347 }; 1348 $l.delay(animOutDelay).animate(opts.animOut, speedOut, easeOut, function() { 1349 $l.css(opts.cssAfter); 1350 if (!opts.sync) 1351 fn(); 1352 }); 1353 if (opts.sync) fn(); 1354}; 1355 1356// transition definitions - only fade is defined here, transition pack defines the rest 1357$.fn.cycle.transitions = { 1358 fade: function($cont, $slides, opts) { 1359 $slides.not(':eq('+opts.currSlide+')').css('opacity',0); 1360 opts.before.push(function(curr,next,opts) { 1361 $.fn.cycle.commonReset(curr,next,opts); 1362 opts.cssBefore.opacity = 0; 1363 }); 1364 opts.animIn = { opacity: 1 }; 1365 opts.animOut = { opacity: 0 }; 1366 opts.cssBefore = { top: 0, left: 0 }; 1367 } 1368}; 1369 1370$.fn.cycle.ver = function() { return ver; }; 1371 1372// override these globally if you like (they are all optional) 1373$.fn.cycle.defaults = { 1374 activePagerClass: 'activeSlide', // class name used for the active pager link 1375 after: null, // transition callback (scope set to element that was shown): function(currSlideElement, nextSlideElement, options, forwardFlag) 1376 allowPagerClickBubble: false, // allows or prevents click event on pager anchors from bubbling 1377 animIn: null, // properties that define how the slide animates in 1378 animInDelay: 0, // allows delay before next slide transitions in 1379 animOut: null, // properties that define how the slide animates out 1380 animOutDelay: 0, // allows delay before current slide transitions out 1381 aspect: false, // preserve aspect ratio during fit resizing, cropping if necessary (must be used with fit option) 1382 autostop: 0, // true to end slideshow after X transitions (where X == slide count) 1383 autostopCount: 0, // number of transitions (optionally used with autostop to define X) 1384 backwards: false, // true to start slideshow at last slide and move backwards through the stack 1385 before: null, // transition callback (scope set to element to be shown): function(currSlideElement, nextSlideElement, options, forwardFlag) 1386 center: null, // set to true to have cycle add top/left margin to each slide (use with width and height options) 1387 cleartype: !$.support.opacity, // true if clearType corrections should be applied (for IE) 1388 cleartypeNoBg: false, // set to true to disable extra cleartype fixing (leave false to force background color setting on slides) 1389 containerResize: 1, // resize container to fit largest slide 1390 containerResizeHeight: 0, // resize containers height to fit the largest slide but leave the width dynamic 1391 continuous: 0, // true to start next transition immediately after current one completes 1392 cssAfter: null, // properties that defined the state of the slide after transitioning out 1393 cssBefore: null, // properties that define the initial state of the slide before transitioning in 1394 delay: 0, // additional delay (in ms) for first transition (hint: can be negative) 1395 easeIn: null, // easing for "in" transition 1396 easeOut: null, // easing for "out" transition 1397 easing: null, // easing method for both in and out transitions 1398 end: null, // callback invoked when the slideshow terminates (use with autostop or nowrap options): function(options) 1399 fastOnEvent: 0, // force fast transitions when triggered manually (via pager or prev/next); value == time in ms 1400 fit: 0, // force slides to fit container 1401 fx: 'fade', // name of transition effect (or comma separated names, ex: 'fade,scrollUp,shuffle') 1402 fxFn: null, // function used to control the transition: function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag) 1403 height: 'auto', // container height (if the 'fit' option is true, the slides will be set to this height as well) 1404 manualTrump: true, // causes manual transition to stop an active transition instead of being ignored 1405 metaAttr: 'cycle', // data- attribute that holds the option data for the slideshow 1406 next: null, // element, jQuery object, or jQuery selector string for the element to use as event trigger for next slide 1407 nowrap: 0, // true to prevent slideshow from wrapping 1408 onPagerEvent: null, // callback fn for pager events: function(zeroBasedSlideIndex, slideElement) 1409 onPrevNextEvent: null, // callback fn for prev/next events: function(isNext, zeroBasedSlideIndex, slideElement) 1410 pager: null, // element, jQuery object, or jQuery selector string for the element to use as pager container 1411 pagerAnchorBuilder: null, // callback fn for building anchor links: function(index, DOMelement) 1412 pagerEvent: 'click.cycle', // name of event which drives the pager navigation 1413 pause: 0, // true to enable "pause on hover" 1414 pauseOnPagerHover: 0, // true to pause when hovering over pager link 1415 prev: null, // element, jQuery object, or jQuery selector string for the element to use as event trigger for previous slide 1416 prevNextEvent: 'click.cycle',// event which drives the manual transition to the previous or next slide 1417 random: 0, // true for random, false for sequence (not applicable to shuffle fx) 1418 randomizeEffects: 1, // valid when multiple effects are used; true to make the effect sequence random 1419 requeueOnImageNotLoaded: true, // requeue the slideshow if any image slides are not yet loaded 1420 requeueTimeout: 250, // ms delay for requeue 1421 rev: 0, // causes animations to transition in reverse (for effects that support it such as scrollHorz/scrollVert/shuffle) 1422 shuffle: null, // coords for shuffle animation, ex: { top:15, left: 200 } 1423 skipInitializationCallbacks: false, // set to true to disable the first before/after callback that occurs prior to any transition 1424 slideExpr: null, // expression for selecting slides (if something other than all children is required) 1425 slideResize: 1, // force slide width/height to fixed size before every transition 1426 speed: 1000, // speed of the transition (any valid fx speed value) 1427 speedIn: null, // speed of the 'in' transition 1428 speedOut: null, // speed of the 'out' transition 1429 startingSlide: undefined,// zero-based index of the first slide to be displayed 1430 sync: 1, // true if in/out transitions should occur simultaneously 1431 timeout: 4000, // milliseconds between slide transitions (0 to disable auto advance) 1432 timeoutFn: null, // callback for determining per-slide timeout value: function(currSlideElement, nextSlideElement, options, forwardFlag) 1433 updateActivePagerLink: null,// callback fn invoked to update the active pager link (adds/removes activePagerClass style) 1434 width: null // container width (if the 'fit' option is true, the slides will be set to this width as well) 1435}; 1436 1437}
1437)(jQuery); 1438 1439 1440/*! 1441 * jQuery Cycle Plugin Transition Definitions 1442 * This script is a plugin for the jQuery Cycle Plugin 1443 * Examples and documentation at: http://malsup.com/jquery/cycle/ 1444 * Copyright (c) 2007-2010 M. Alsup 1445 * Version: 2.73 1446 * Dual licensed under the MIT and GPL licenses: 1447 * http://www.opensource.org/licenses/mit-license.php 1448 * http://www.gnu.org/licenses/gpl.html 1449 */ 1450(function($) { 1451"use strict"; 1452 1453// 1454// These functions define slide initialization and properties for the named 1455// transitions. To save file size feel free to remove any of these that you 1456// don't need. 1457// 1458$.fn.cycle.transitions.none = function($cont, $slides, opts) { 1459 opts.fxFn = function(curr,next,opts,after){ 1460 $(next).show(); 1461 $(curr).hide(); 1462 after(); 1463 }; 1464}; 1465 1466// not a cross-fade, fadeout only fades out the top slide 1467$.fn.cycle.transitions.fadeout = function($cont, $slides, opts) { 1468 $slides.not(':eq('+opts.currSlide+')').css({ display: 'block', 'opacity': 1 }); 1469 opts.before.push(function(curr,next,opts,w,h,rev) { 1470 $(curr).css('zIndex',opts.slideCount + (rev !== true ? 1 : 0)); 1471 $(next).css('zIndex',opts.slideCount + (rev !== true ? 0 : 1)); 1472 }); 1473 opts.animIn.opacity = 1; 1474 opts.animOut.opacity = 0; 1475 opts.cssBefore.opacity = 1; 1476 opts.cssBefore.display = 'block'; 1477 opts.cssAfter.zIndex = 0; 1478}; 1479 1480// scrollUp/Down/Left/Right 1481$.fn.cycle.transitions.scrollUp = function($cont, $slides, opts) { 1482 $cont.css('overflow','hidden'); 1483 opts.before.push($.fn.cycle.commonReset); 1484 var h = $cont.height(); 1485 opts.cssBefore.top = h; 1486 opts.cssBefore.left = 0; 1487 opts.cssFirst.top = 0; 1488 opts.animIn.top = 0; 1489 opts.animOut.top = -h; 1490}; 1491$.fn.cycle.transitions.scrollDown = function($cont, $slides, opts) { 1492 $cont.css('overflow','hidden'); 1493 opts.before.push($.fn.cycle.commonReset); 1494 var h = $cont.height(); 1495 opts.cssFirst.top = 0; 1496 opts.cssBefore.top = -h; 1497 opts.cssBefore.left = 0; 1498 opts.animIn.top = 0; 1499 opts.animOut.top = h; 1500}; 1501$.fn.cycle.transitions.scrollLeft = function($cont, $slides, opts) { 1502 $cont.css('overflow','hidden'); 1503 opts.before.push($.fn.cycle.commonReset); 1504 var w = $cont.width(); 1505 opts.cssFirst.left = 0; 1506 opts.cssBefore.left = w; 1507 opts.cssBefore.top = 0; 1508 opts.animIn.left = 0; 1509 opts.animOut.left = 0-w; 1510}; 1511$.fn.cycle.transitions.scrollRight = function($cont, $slides, opts) { 1512 $cont.css('overflow','hidden'); 1513 opts.before.push($.fn.cycle.commonReset); 1514 var w = $cont.width(); 1515 opts.cssFirst.left = 0; 1516 opts.cssBefore.left = -w; 1517 opts.cssBefore.top = 0; 1518 opts.animIn.left = 0; 1519 opts.animOut.left = w; 1520}; 1521$.fn.cycle.transitions.scrollHorz = function($cont, $slides, opts) { 1522 $cont.css('overflow','hidden').width(); 1523 opts.before.push(function(curr, next, opts, fwd) { 1524 if (opts.rev) 1525 fwd = !fwd; 1526 $.fn.cycle.commonReset(curr,next,opts); 1527 opts.cssBefore.left = fwd ? (next.cycleW-1) : (1-next.cycleW); 1528 opts.animOut.left = fwd ? -curr.cycleW : curr.cycleW; 1529 }); 1530 opts.cssFirst.left = 0; 1531 opts.cssBefore.top = 0; 1532 opts.animIn.left = 0; 1533 opts.animOut.top = 0; 1534}; 1535$.fn.cycle.transitions.scrollVert = function($cont, $slides, opts) { 1536 $cont.css('overflow','hidden'); 1537 opts.before.push(function(curr, next, opts, fwd) { 1538 if (opts.rev) 1539 fwd = !fwd; 1540 $.fn.cycle.commonReset(curr,next,opts); 1541 opts.cssBefore.top = fwd ? (1-next.cycleH) : (next.cycleH-1); 1542 opts.animOut.top = fwd ? curr.cycleH : -curr.cycleH; 1543 }); 1544 opts.cssFirst.top = 0; 1545 opts.cssBefore.left = 0; 1546 opts.animIn.top = 0; 1547 opts.animOut.left = 0; 1548}; 1549 1550// slideX/slideY 1551$.fn.cycle.transitions.slideX = function($cont, $slides, opts) { 1552 opts.before.push(function(curr, next, opts) { 1553 $(opts.elements).not(curr).hide(); 1554 $.fn.cycle.commonReset(curr,next,opts,false,true); 1555 opts.animIn.width = next.cycleW; 1556 }); 1557 opts.cssBefore.left = 0; 1558 opts.cssBefore.top = 0; 1559 opts.cssBefore.width = 0; 1560 opts.animIn.width = 'show'; 1561 opts.animOut.width = 0; 1562}; 1563$.fn.cycle.transitions.slideY = function($cont, $slides, opts) { 1564 opts.before.push(function(curr, next, opts) { 1565 $(opts.elements).not(curr).hide(); 1566 $.fn.cycle.commonReset(curr,next,opts,true,false); 1567 opts.animIn.height = next.cycleH; 1568 }); 1569 opts.cssBefore.left = 0; 1570 opts.cssBefore.top = 0; 1571 opts.cssBefore.height = 0; 1572 opts.animIn.height = 'show'; 1573 opts.animOut.height = 0; 1574}; 1575 1576// shuffle 1577$.fn.cycle.transitions.shuffle = function($cont, $slides, opts) { 1578 var i, w = $cont.css('overflow', 'visible').width(); 1579 $slides.css({left: 0, top: 0}); 1580 opts.before.push(function(curr,next,opts) { 1581 $.fn.cycle.commonReset(curr,next,opts,true,true,true); 1582 }); 1583 // only adjust speed once! 1584 if (!opts.speedAdjusted) { 1585 opts.speed = opts.speed / 2; // shuffle has 2 transitions 1586 opts.speedAdjusted = true; 1587 } 1588 opts.random = 0; 1589 opts.shuffle = opts.shuffle || {left:-w, top:15}; 1590 opts.els = []; 1591 for (i=0; i < $slides.length; i++) 1592 opts.els.push($slides[i]); 1593 1594 for (i=0; i < opts.currSlide; i++) 1595 opts.els.push(opts.els.shift()); 1596 1597 // custom transition fn (hat tip to Benjamin Sterling for this bit of sweetness!) 1598 opts.fxFn = function(curr, next, opts, cb, fwd) { 1599 if (opts.rev) 1600 fwd = !fwd; 1601 var $el = fwd ? $(curr) : $(next); 1602 $(next).css(opts.cssBefore); 1603 var count = opts.slideCount; 1604 $el.animate(opts.shuffle, opts.speedIn, opts.easeIn, function() { 1605 var hops = $.fn.cycle.hopsFromLast(opts, fwd); 1606 for (var k=0; k < hops; k++) { 1607 if (fwd) 1608 opts.els.push(opts.els.shift()); 1609 else 1610 opts.els.unshift(opts.els.pop()); 1611 } 1612 if (fwd) { 1613 for (var i=0, len=opts.els.length; i < len; i++) 1614 $(opts.els[i]).css('z-index', len-i+count); 1615 } 1616 else { 1617 var z = $(curr).css('z-index'); 1618 $el.css('z-index', parseInt(z,10)+1+count); 1619 } 1620 $el.animate({left:0, top:0}, opts.speedOut, opts.easeOut, function() {
1621 $(fwd ? this : curr).hide(); 1622 if (cb) cb(); 1623 }); 1624 }); 1625 }; 1626 $.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 }); 1627}; 1628 1629// turnUp/Down/Left/Right 1630$.fn.cycle.transitions.turnUp = function($cont, $slides, opts) { 1631 opts.before.push(function(curr, next, opts) { 1632 $.fn.cycle.commonReset(curr,next,opts,true,false); 1633 opts.cssBefore.top = next.cycleH; 1634 opts.animIn.height = next.cycleH; 1635 opts.animOut.width = next.cycleW; 1636 }); 1637 opts.cssFirst.top = 0; 1638 opts.cssBefore.left = 0; 1639 opts.cssBefore.height = 0; 1640 opts.animIn.top = 0; 1641 opts.animOut.height = 0; 1642}; 1643$.fn.cycle.transitions.turnDown = function($cont, $slides, opts) { 1644 opts.before.push(function(curr, next, opts) { 1645 $.fn.cycle.commonReset(curr,next,opts,true,false); 1646 opts.animIn.height = next.cycleH; 1647 opts.animOut.top = curr.cycleH; 1648 }); 1649 opts.cssFirst.top = 0; 1650 opts.cssBefore.left = 0; 1651 opts.cssBefore.top = 0; 1652 opts.cssBefore.height = 0; 1653 opts.animOut.height = 0; 1654}; 1655$.fn.cycle.transitions.turnLeft = function($cont, $slides, opts) { 1656 opts.before.push(function(curr, next, opts) { 1657 $.fn.cycle.commonReset(curr,next,opts,false,true); 1658 opts.cssBefore.left = next.cycleW; 1659 opts.animIn.width = next.cycleW; 1660 }); 1661 opts.cssBefore.top = 0; 1662 opts.cssBefore.width = 0; 1663 opts.animIn.left = 0; 1664 opts.animOut.width = 0; 1665}; 1666$.fn.cycle.transitions.turnRight = function($cont, $slides, opts) { 1667 opts.before.push(function(curr, next, opts) { 1668 $.fn.cycle.commonReset(curr,next,opts,false,true); 1669 opts.animIn.width = next.cycleW; 1670 opts.animOut.left = curr.cycleW; 1671 }); 1672 $.extend(opts.cssBefore, { top: 0, left: 0, width: 0 }); 1673 opts.animIn.left = 0; 1674 opts.animOut.width = 0; 1675}; 1676 1677// zoom 1678$.fn.cycle.transitions.zoom = function($cont, $slides, opts) { 1679 opts.before.push(function(curr, next, opts) { 1680 $.fn.cycle.commonReset(curr,next,opts,false,false,true); 1681 opts.cssBefore.top = next.cycleH/2; 1682 opts.cssBefore.left = next.cycleW/2; 1683 $.extend(opts.animIn, { top: 0, left: 0, width: next.cycleW, height: next.cycleH }); 1684 $.extend(opts.animOut, { width: 0, height: 0, top: curr.cycleH/2, left: curr.cycleW/2 }); 1685 }); 1686 opts.cssFirst.top = 0; 1687 opts.cssFirst.left = 0; 1688 opts.cssBefore.width = 0; 1689 opts.cssBefore.height = 0; 1690}; 1691 1692// fadeZoom 1693$.fn.cycle.transitions.fadeZoom = function($cont, $slides, opts) { 1694 opts.before.push(function(curr, next, opts) { 1695 $.fn.cycle.commonReset(curr,next,opts,false,false); 1696 opts.cssBefore.left = next.cycleW/2; 1697 opts.cssBefore.top = next.cycleH/2; 1698 $.extend(opts.animIn, { top: 0, left: 0, width: next.cycleW, height: next.cycleH }); 1699 }); 1700 opts.cssBefore.width = 0; 1701 opts.cssBefore.height = 0; 1702 opts.animOut.opacity = 0; 1703}; 1704 1705// blindX 1706$.fn.cycle.transitions.blindX = function($cont, $slides, opts) { 1707 var w = $cont.css('overflow','hidden').width(); 1708 opts.before.push(function(curr, next, opts) { 1709 $.fn.cycle.commonReset(curr,next,opts); 1710 opts.animIn.width = next.cycleW; 1711 opts.animOut.left = curr.cycleW; 1712 }); 1713 opts.cssBefore.left = w; 1714 opts.cssBefore.top = 0; 1715 opts.animIn.left = 0; 1716 opts.animOut.left = w; 1717}; 1718// blindY 1719$.fn.cycle.transitions.blindY = function($cont, $slides, opts) { 1720 var h = $cont.css('overflow','hidden').height(); 1721 opts.before.push(function(curr, next, opts) { 1722 $.fn.cycle.commonReset(curr,next,opts); 1723 opts.animIn.height = next.cycleH; 1724 opts.animOut.top = curr.cycleH; 1725 }); 1726 opts.cssBefore.top = h; 1727 opts.cssBefore.left = 0; 1728 opts.animIn.top = 0; 1729 opts.animOut.top = h; 1730}; 1731// blindZ 1732$.fn.cycle.transitions.blindZ = function($cont, $slides, opts) { 1733 var h = $cont.css('overflow','hidden').height(); 1734 var w = $cont.width(); 1735 opts.before.push(function(curr, next, opts) { 1736 $.fn.cycle.commonReset(curr,next,opts); 1737 opts.animIn.height = next.cycleH; 1738 opts.animOut.top = curr.cycleH; 1739 }); 1740 opts.cssBefore.top = h; 1741 opts.cssBefore.left = w; 1742 opts.animIn.top = 0; 1743 opts.animIn.left = 0; 1744 opts.animOut.top = h; 1745 opts.animOut.left = w; 1746}; 1747 1748// growX - grow horizontally from centered 0 width 1749$.fn.cycle.transitions.growX = function($cont, $slides, opts) { 1750 opts.before.push(function(curr, next, opts) { 1751 $.fn.cycle.commonReset(curr,next,opts,false,true); 1752 opts.cssBefore.left = this.cycleW/2; 1753 opts.animIn.left = 0; 1754 opts.animIn.width = this.cycleW; 1755 opts.animOut.left = 0; 1756 }); 1757 opts.cssBefore.top = 0; 1758 opts.cssBefore.width = 0; 1759}; 1760// growY - grow vertically from centered 0 height 1761$.fn.cycle.transitions.growY = function($cont, $slides, opts) { 1762 opts.before.push(function(curr, next, opts) { 1763 $.fn.cycle.commonReset(curr,next,opts,true,false); 1764 opts.cssBefore.top = this.cycleH/2; 1765 opts.animIn.top = 0; 1766 opts.animIn.height = this.cycleH; 1767 opts.animOut.top = 0; 1768 }); 1769 opts.cssBefore.height = 0; 1770 opts.cssBefore.left = 0; 1771}; 1772 1773// curtainX - squeeze in both edges horizontally 1774$.fn.cycle.transitions.curtainX = function($cont, $slides, opts) { 1775 opts.before.push(function(curr, next, opts) { 1776 $.fn.cycle.commonReset(curr,next,opts,false,true,true); 1777 opts.cssBefore.left = next.cycleW/2; 1778 opts.animIn.left = 0; 1779 opts.animIn.width = this.cycleW; 1780 opts.animOut.left = curr.cycleW/2; 1781 opts.animOut.width = 0; 1782 }); 1783 opts.cssBefore.top = 0; 1784 opts.cssBefore.width = 0; 1785}; 1786// curtainY - squeeze in both edges vertically 1787$.fn.cycle.transitions.curtainY = function($cont, $slides, opts) { 1788 opts.before.push(function(curr, next, opts) { 1789 $.fn.cycle.commonReset(curr,next,opts,true,false,true); 1790 opts.cssBefore.top = next.cycleH/2; 1791 opts.animIn.top = 0; 1792 opts.animIn.height = next.cycleH; 1793 opts.animOut.top = curr.cycleH/2; 1794 opts.animOut.height = 0; 1795 }); 1796 opts.cssBefore.height = 0; 1797 opts.cssBefore.left = 0; 1798}; 1799 1800// cover - curr slide covered by next slide
1801$.fn.cycle.transitions.cover = function($cont, $slides, opts) { 1802 var d = opts.direction || 'left'; 1803 var w = $cont.css('overflow','hidden').width(); 1804 var h = $cont.height(); 1805 opts.before.push(function(curr, next, opts) { 1806 $.fn.cycle.commonReset(curr,next,opts); 1807 opts.cssAfter.display = ''; 1808 if (d == 'right') 1809 opts.cssBefore.left = -w; 1810 else if (d == 'up') 1811 opts.cssBefore.top = h; 1812 else if (d == 'down') 1813 opts.cssBefore.top = -h; 1814 else 1815 opts.cssBefore.left = w; 1816 }); 1817 opts.animIn.left = 0; 1818 opts.animIn.top = 0; 1819 opts.cssBefore.top = 0; 1820 opts.cssBefore.left = 0; 1821}; 1822 1823// uncover - curr slide moves off next slide 1824$.fn.cycle.transitions.uncover = function($cont, $slides, opts) { 1825 var d = opts.direction || 'left'; 1826 var w = $cont.css('overflow','hidden').width(); 1827 var h = $cont.height(); 1828 opts.before.push(function(curr, next, opts) { 1829 $.fn.cycle.commonReset(curr,next,opts,true,true,true); 1830 if (d == 'right') 1831 opts.animOut.left = w; 1832 else if (d == 'up') 1833 opts.animOut.top = -h; 1834 else if (d == 'down') 1835 opts.animOut.top = h; 1836 else 1837 opts.animOut.left = -w; 1838 }); 1839 opts.animIn.left = 0; 1840 opts.animIn.top = 0; 1841 opts.cssBefore.top = 0; 1842 opts.cssBefore.left = 0; 1843}; 1844 1845// toss - move top slide and fade away 1846$.fn.cycle.transitions.toss = function($cont, $slides, opts) { 1847 var w = $cont.css('overflow','visible').width(); 1848 var h = $cont.height(); 1849 opts.before.push(function(curr, next, opts) { 1850 $.fn.cycle.commonReset(curr,next,opts,true,true,true); 1851 // provide default toss settings if animOut not provided 1852 if (!opts.animOut.left && !opts.animOut.top) 1853 $.extend(opts.animOut, { left: w*2, top: -h/2, opacity: 0 }); 1854 else 1855 opts.animOut.opacity = 0; 1856 }); 1857 opts.cssBefore.left = 0; 1858 opts.cssBefore.top = 0; 1859 opts.animIn.left = 0; 1860}; 1861 1862// wipe - clip animation 1863$.fn.cycle.transitions.wipe = function($cont, $slides, opts) { 1864 var w = $cont.css('overflow','hidden').width(); 1865 var h = $cont.height(); 1866 opts.cssBefore = opts.cssBefore || {}; 1867 var clip; 1868 if (opts.clip) { 1869 if (/l2r/.test(opts.clip)) 1870 clip = 'rect(0px 0px '+h+'px 0px)'; 1871 else if (/r2l/.test(opts.clip)) 1872 clip = 'rect(0px '+w+'px '+h+'px '+w+'px)'; 1873 else if (/t2b/.test(opts.clip)) 1874 clip = 'rect(0px '+w+'px 0px 0px)'; 1875 else if (/b2t/.test(opts.clip)) 1876 clip = 'rect('+h+'px '+w+'px '+h+'px 0px)'; 1877 else if (/zoom/.test(opts.clip)) { 1878 var top = parseInt(h/2,10); 1879 var left = parseInt(w/2,10); 1880 clip = 'rect('+top+'px '+left+'px '+top+'px '+left+'px)'; 1881 } 1882 } 1883 1884 opts.cssBefore.clip = opts.cssBefore.clip || clip || 'rect(0px 0px 0px 0px)'; 1885 1886 var d = opts.cssBefore.clip.match(/(\d+)/g); 1887 var t = parseInt(d[0],10), r = parseInt(d[1],10), b = parseInt(d[2],10), l = parseInt(d[3],10); 1888 1889 opts.before.push(function(curr, next, opts) { 1890 if (curr == next) return; 1891 var $curr = $(curr), $next = $(next); 1892 $.fn.cycle.commonReset(curr,next,opts,true,true,false); 1893 opts.cssAfter.display = 'block'; 1894 1895 var step = 1, count = parseInt((opts.speedIn / 13),10) - 1; 1896 (function f() { 1897 var tt = t ? t - parseInt(step * (t/count),10) : 0; 1898 var ll = l ? l - parseInt(step * (l/count),10) : 0; 1899 var bb = b < h ? b + parseInt(step * ((h-b)/count || 1),10) : h; 1900 var rr = r < w ? r + parseInt(step * ((w-r)/count || 1),10) : w; 1901 $next.css({ clip: 'rect('+tt+'px '+rr+'px '+bb+'px '+ll+'px)' }); 1902 (step++ <= count) ? setTimeout(f, 13) : $curr.css('display', 'none'); 1903 })(); 1904 }); 1905 $.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 }); 1906 opts.animIn = { left: 0 }; 1907 opts.animOut = { left: 0 }; 1908}; 1909 1910})(jQuery); 1911; 1912/* 1913 json2.js 1914 2015-02-25 1915 1916 Public Domain. 1917 1918 NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. 1919 1920 See http://www.JSON.org/js.html 1921 1922 1923 This code should be minified before deployment. 1924 See http://javascript.crockford.com/jsmin.html 1925 1926 USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO 1927 NOT CONTROL. 1928 1929 1930 This file creates a global JSON object containing two methods: stringify 1931 and parse. 1932 1933 JSON.stringify(value, replacer, space) 1934 value any JavaScript value, usually an object or array. 1935 1936 replacer an optional parameter that determines how object 1937 values are stringified for objects. It c
1937an be a 1938 function or an array of strings. 1939 1940 space an optional parameter that specifies the indentation 1941 of nested structures. If it is omitted, the text will 1942 be packed without extra whitespace. If it is a number, 1943 it will specify the number of spaces to indent at each 1944 level. If it is a string (such as '\t' or ' '), 1945 it contains the characters used to indent at each level. 1946 1947 This method produces a JSON text from a JavaScript value. 1948 1949 When an object value is found, if the object contains a toJSON 1950 method, its toJSON method will be called and the result will be 1951 stringified. A toJSON method does not serialize: it returns the 1952 value represented by the name/value pair that should be serialized, 1953 or undefined if nothing should be serialized. The toJSON method 1954 will be passed the key associated with the value, and this will be 1955 bound to the value 1956 1957 For example, this would serialize Dates as ISO strings. 1958 1959 Date.prototype.toJSON = function (key) { 1960 function f(n) { 1961 // Format integers to have at least two digits. 1962 return n < 10 1963 ? '0' + n 1964 : n; 1965 } 1966 1967 return this.getUTCFullYear() + '-' + 1968 f(this.getUTCMonth() + 1) + '-' + 1969 f(this.getUTCDate()) + 'T' + 1970 f(this.getUTCHours()) + ':' + 1971 f(this.getUTCMinutes()) + ':' + 1972 f(this.getUTCSeconds()) + 'Z'; 1973 }; 1974 1975 You can provide an optional replacer method. It will be passed the 1976 key and value of each member, with this bound to the containing 1977 object. The value that is returned from your method will be 1978 serialized. If your method returns undefined, then the member will 1979 be excluded from the serialization. 1980 1981 If the replacer parameter is an array of strings, then it will be 1982 used to select the members to be serialized. It filters the results 1983 such that only members with keys listed in the replacer array are 1984 stringified. 1985 1986 Values that do not have JSON representations, such as undefined or 1987 functions, will not be serialized. Such values in objects will be 1988 dropped; in arrays they will be replaced with null. You can use 1989 a replacer function to replace those with JSON values. 1990 JSON.stringify(undefined) returns undefined. 1991 1992 The optional space parameter produces a stringification of the 1993 value that is filled with line breaks and indentation to make it 1994 easier to read. 1995 1996 If the space parameter is a non-empty string, then that string will 1997 be used for indentation. If the space parameter is a number, then 1998 the indentation will be that many spaces. 1999 2000 Example: 2001 2002 text = JSON.stringify(['e', {pluribus: 'unum'}]); 2003 // text is '["e",{"pluribus":"unum"}]' 2004 2005 2006 text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); 2007 // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' 2008 2009 text = JSON.stringify([new Date()], function (key, value) { 2010 return this[key] instanceof Date ? 2011 'Date(' + this[key] + ')' : value; 2012 }); 2013 // text is '["Date(---current time---)"]' 2014 2015 2016 JSON.parse(text, reviver) 2017 This method parses a JSON text to produce an object or array. 2018 It can throw a SyntaxError exception. 2019 2020 The optional reviver parameter is a function that can filter and 2021 transform the results. It receives each of the keys and values, 2022 and its return value is used instead of the original value. 2023 If it returns what it received, then the structure is not modified. 2024 If it returns undefined then the member is deleted. 2025 2026 Example: 2027 2028 // Parse the text. Values that look like ISO date strings will 2029 // be converted to Date objects. 2030 2031 myData = JSON.parse(text, function (key, value) { 2032 var a; 2033 if (typeof value === 'string') { 2034 a = 2035/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); 2036 if (a) { 2037 return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], 2038 +a[5], +a[6])); 2039 } 2040 } 2041 return value; 2042 }); 2043 2044 myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { 2045 var d; 2046 if (typeof value === 'string' && 2047 value.slice(0, 5) === 'Date(' && 2048 value.slice(-1) === ')') { 2049 d = new Date(value.slice(5, -1)); 2050 if (d) { 2051 return d; 2052 } 2053 } 2054 return value; 2055 }); 2056 2057 2058 This is a reference implementation. You are free to copy, modify, or 2059 redistribute. 2060*/ 2061 2062/*jslint 2063 eval, for, this 2064*/ 2065 2066/*property 2067 JSON, apply, call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, 2068 getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, 2069 lastIndex, length, parse, prototype, push, replace, slice, stringify, 2070 test, toJSON, toString, valueOf 2071*/ 2072 2073 2074// Create a JSON object only if one does not already exist. We create the 2075// methods in a closure to avoid creating global variables. 2076 2077if (typeof JSON !== 'object') { 2078 JSON = {}; 2079} 2080 2081(function () { 2082 'use strict'; 2083 2084 function f(n) { 2085 // Format integers to have at least two digits. 2086 return n < 10 2087 ? '0' + n 2088 : n; 2089 } 2090 2091 function this_value() { 2092 return this.valueOf(); 2093 } 2094 2095 if (typeof Date.prototype.toJSON !== 'function') { 2096 2097 Date.prototype.toJSON = function () { 2098 2099 return isFinite(this.valueOf()) 2100 ? this.getUTCFullYear() + '-' + 2101 f(this.getUTCMonth() + 1) + '-' + 2102 f(this.getUTCDate()) + 'T' + 2103 f(this.getUTCHours()) + ':' + 2104 f(this.getUTCMinutes()) + ':' + 2105 f(this.getUTCSeconds()) + 'Z' 2106 : null; 2107 }; 2108 2109 Boolean.prototype.toJSON = this_value; 2110 Number.prototype.toJSON = this_value; 2111 String.prototype.toJSON = this_value; 2112 } 2113 2114 var cx, 2115 escapable, 2116 gap, 2117 indent, 2118 meta, 2119 rep; 2120 2121 2122 function quote(string) { 2123
vendor: 10,088 bytes, lines 2124-2407
2124// If the string contains no control characters, no quote characters, and no 2125// backslash characters, then we can safely slap some quotes around it. 2126// Otherwise we must also replace the offending characters with safe escape 2127// sequences. 2128 2129 escapable.lastIndex = 0; 2130 return escapable.test(string) 2131 ? '"' + string.replace(escapable, function (a) { 2132 var c = meta[a]; 2133 return typeof c === 'string' 2134 ? c 2135 : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); 2136 }) + '"' 2137 : '"' + string + '"'; 2138 } 2139 2140 2141 function str(key, holder) { 2142 2143// Produce a string from holder[key]. 2144 2145 var i, // The loop counter. 2146 k, // The member key. 2147 v, // The member value. 2148 length, 2149 mind = gap, 2150 partial, 2151 value = holder[key]; 2152 2153// If the value has a toJSON method, call it to obtain a replacement value. 2154 2155 if (value && typeof value === 'object' && 2156 typeof value.toJSON === 'function') { 2157 value = value.toJSON(key); 2158 } 2159 2160// If we were called with a replacer function, then call the replacer to 2161// obtain a replacement value. 2162 2163 if (typeof rep === 'function') { 2164 value = rep.call(holder, key, value); 2165 } 2166 2167// What happens next depends on the value's type. 2168 2169 switch (typeof value) { 2170 case 'string': 2171 return quote(value); 2172 2173 case 'number': 2174 2175// JSON numbers must be finite. Encode non-finite numbers as null. 2176 2177 return isFinite(value) 2178 ? String(value) 2179 : 'null'; 2180 2181 case 'boolean': 2182 case 'null': 2183 2184// If the value is a boolean or null, convert it to a string. Note: 2185// typeof null does not produce 'null'. The case is included here in 2186// the remote chance that this gets fixed someday. 2187 2188 return String(value); 2189 2190// If the type is 'object', we might be dealing with an object or an array or 2191// null. 2192 2193 case 'object': 2194 2195// Due to a specification blunder in ECMAScript, typeof null is 'object', 2196// so watch out for that case. 2197 2198 if (!value) { 2199 return 'null'; 2200 } 2201 2202// Make an array to hold the partial results of stringifying this object value. 2203 2204 gap += indent; 2205 partial = []; 2206 2207// Is the value an array? 2208 2209 if (Object.prototype.toString.apply(value) === '[object Array]') { 2210 2211// The value is an array. Stringify every element. Use null as a placeholder 2212// for non-JSON values. 2213 2214 length = value.length; 2215 for (i = 0; i < length; i += 1) { 2216 partial[i] = str(i, value) || 'null'; 2217 } 2218 2219// Join all of the elements together, separated with commas, and wrap them in 2220// brackets. 2221 2222 v = partial.length === 0 2223 ? '[]' 2224 : gap 2225 ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' 2226 : '[' + partial.join(',') + ']'; 2227 gap = mind; 2228 return v; 2229 } 2230 2231// If the replacer is an array, use it to select the members to be stringified. 2232 2233 if (rep && typeof rep === 'object') { 2234 length = rep.length; 2235 for (i = 0; i < length; i += 1) { 2236 if (typeof rep[i] === 'string') { 2237 k = rep[i]; 2238 v = str(k, value); 2239 if (v) { 2240 partial.push(quote(k) + ( 2241 gap 2242 ? ': ' 2243 : ':' 2244 ) + v); 2245 } 2246 } 2247 } 2248 } else { 2249 2250// Otherwise, iterate through all of the keys in the object. 2251 2252 for (k in value) { 2253 if (Object.prototype.hasOwnProperty.call(value, k)) { 2254 v = str(k, value); 2255 if (v) { 2256 partial.push(quote(k) + ( 2257 gap 2258 ? ': ' 2259 : ':' 2260 ) + v); 2261 } 2262 } 2263 } 2264 } 2265 2266// Join all of the member texts together, separated with commas, 2267// and wrap them in braces. 2268 2269 v = partial.length === 0 2270 ? '{}' 2271 : gap 2272 ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' 2273 : '{' + partial.join(',') + '}'; 2274 gap = mind; 2275 return v; 2276 } 2277 } 2278 2279// If the JSON object does not yet have a stringify method, give it one. 2280 2281 if (typeof JSON.stringify !== 'function') { 2282 escapable = /[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; 2283 meta = { // table of character substitutions 2284 '\b': '\\b', 2285 '\t': '\\t', 2286 '\n': '\\n', 2287 '\f': '\\f', 2288 '\r': '\\r', 2289 '"': '\\"', 2290 '\\': '\\\\' 2291 }; 2292 JSON.stringify = function (value, replacer, space) { 2293 2294// The stringify method takes a value and an optional replacer, and an optional 2295// space parameter, and returns a JSON text. The replacer can be a function 2296// that can replace values, or an array of strings that will select the keys. 2297// A default replacer method can be provided. Use of the space parameter can 2298// produce text that is more easily readable. 2299 2300 var i; 2301 gap = ''; 2302 indent = ''; 2303 2304// If the space parameter is a number, make an indent string containing that 2305// many spaces. 2306 2307 if (typeof space === 'number') { 2308 for (i = 0; i < space; i += 1) { 2309 indent += ' '; 2310 } 2311 2312// If the space parameter is a string, it will be used as the indent string. 2313 2314 } else if (typeof space === 'string') { 2315 indent = space; 2316 } 2317 2318// If there is a replacer, it must be a function or an array. 2319// Otherwise, throw an error. 2320 2321 rep = replacer; 2322 if (replacer && typeof replacer !== 'function' && 2323 (typeof replacer !== 'object' || 2324 typeof replacer.length !== 'number')) { 2325 throw new Error('JSON.stringify'); 2326 } 2327 2328// Make a fake root object containing our value under the key of ''. 2329// Return the result of stringifying the value. 2330 2331 return str('', {'': value}); 2332 }; 2333 } 2334 2335 2336// If the JSON object does not yet have a parse method, give it one. 2337 2338 if (typeof JSON.parse !== 'function') { 2339 cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; 2340 JSON.parse = function (text, reviver) { 2341 2342// The parse method takes a text and an optional reviver function, and returns 2343// a JavaScript value if the text is a valid JSON text. 2344 2345 var j; 2346 2347 function walk(holder, key) { 2348 2349// The walk method is used to recursively walk the resulting structure so 2350// that modifications can be made. 2351 2352 var k, v, value = holder[key]; 2353 if (value && typeof value === 'object') { 2354 for (k in value) { 2355 if (Object.prototype.hasOwnProperty.call(value, k)) { 2356 v = walk(value, k); 2357 if (v !== undefined) { 2358 value[k] = v; 2359 } else { 2360 delete value[k]; 2361 } 2362 } 2363 } 2364 } 2365 return reviver.call(holder, key, value); 2366 } 2367 2368 2369// Parsing happens in four stages. In the first stage, we replace certain 2370// Unicode characters with escape sequences. JavaScript handles many characters 2371// incorrectly, either silently deleting them, or treating them as line endings. 2372 2373 text = String(text); 2374 cx.lastIndex = 0; 2375 if (cx.test(text)) { 2376 text = text.replace(cx, function (a) { 2377 return '\\u' + 2378 ('0000' + a.charCodeAt(0).toString(16)).slice(-4); 2379 }); 2380 } 2381 2382// In the second stage, we run the text against regular expressions that look 2383// for non-JSON patterns. We are especially concerned with '()' and 'new' 2384// because they can cause invocation, and '=' because it can cause mutation. 2385// But just to be safe, we want to reject all unexpected forms. 2386 2387// We split the second stage into 4 regexp operations in order to work around 2388// crippling inefficiencies in IE's and Safari's regexp engines. First we 2389// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we 2390// replace all simple value tokens with ']' characters. Third, we delete all 2391// open brackets that follow a colon or comma or that begin the text. Finally, 2392// we look to see that the remaining characters are only whitespace or ']' or 2393// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. 2394 2395 if ( 2396 /^[\],:{}\s]*$/.test( 2397 text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') 2398 .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') 2399 .replace(/(?:^|:|,)(?:\s*\[)+/g, '') 2400 ) 2401 ) { 2402 2403// In the third stage we use the eval function to compile the text into a 2404// JavaScript structure. The '{' operator is subject to a syntactic ambiguity 2405// in JavaScript: it can begin a block or an object literal. We wrap the text 2406// in parens to eliminate the ambiguity. 2407
2408 j = eval('(' + text + ')'); 2409 2410// In the optional fourth stage, we recursively walk the new structure, passing 2411// each name/value pair to a reviver function for possible transformation. 2412 2413 return typeof reviver === 'function' 2414 ? walk({'': j}, '') 2415 : j; 2416 } 2417 2418// If the text is not JSON parseable, then a SyntaxError is thrown. 2419 2420 throw new SyntaxError('JSON.parse'); 2421 }; 2422 } 2423}()); 2424; 2425/** 2426 * @file 2427 * A simple jQuery Cycle Div Slideshow Rotator. 2428 */ 2429 2430/** 2431 * This will set our initial behavior, by starting up each individual slideshow. 2432 */ 2433(function ($) { 2434 Drupal.behaviors.viewsSlideshowCycle = { 2435 attach: function (context) { 2436 $('.views_slideshow_cycle_main:not(.viewsSlideshowCycle-processed)', context).addClass('viewsSlideshowCycle-processed').each(function() { 2437 var fullId = '#' + $(this).attr('id'); 2438 var settings = Drupal.settings.viewsSlideshowCycle[fullId]; 2439 settings.targetId = '#' + $(fullId + " :first").attr('id'); 2440 2441 settings.slideshowId = settings.targetId.replace('#views_slideshow_cycle_teaser_section_', ''); 2442 // Pager after function. 2443 var pager_after_fn = function(curr, next, opts) { 2444 // Need to do some special handling on first load. 2445 var slideNum = opts.currSlide; 2446 if (typeof settings.processedAfter == 'undefined' || !settings.processedAfter) { 2447 settings.processedAfter = 1; 2448 slideNum = (typeof settings.opts.startingSlide == 'undefined') ? 0 : settings.opts.startingSlide; 2449 } 2450 if (settings.pause_after_slideshow) { 2451 opts.counter += 1; 2452 if (opts.counter == settings.num_divs + 1) { 2453 opts.counter = 1; 2454 Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId, "force": true }); 2455 } 2456 } 2457 Drupal.viewsSlideshow.action({ "action": 'transitionEnd', "slideshowID": settings.slideshowId, "slideNum": slideNum }); 2458 } 2459 // Pager before function. 2460 var pager_before_fn = function(curr, next, opts) { 2461 $(document).trigger('drupal:views_slideshow_cycle:before', { 2462 curr: curr, next: next, opts: opts, settings: settings 2463 }); 2464 2465 var slideNum = opts.nextSlide; 2466 2467 // Remember last slide. 2468 if (settings.remember_slide) { 2469 createCookie(settings.vss_id, slideNum, settings.remember_slide_days); 2470 } 2471 2472 // Make variable height. 2473 if (!settings.fixed_height) { 2474 //get the height of the current slide 2475 var $ht = $(next).height(); 2476 //set the container's height to that of the current slide 2477 $(next).parent().animate({height: $ht}); 2478 } 2479 2480 // Need to do some special handling on first load. 2481 if (typeof settings.processedBefore == 'undefined' || !settings.processedBefore) { 2482 settings.processedBefore = 1; 2483 slideNum = (typeof opts.startingSlide == 'undefined') ? 0 : opts.startingSlide; 2484 } 2485 2486 Drupal.viewsSlideshow.action({ "action": 'transitionBegin', "slideshowID": settings.slideshowId, "slideNum": slideNum }); 2487 } 2488 settings.loaded = false; 2489 2490 settings.opts = { 2491 speed:settings.speed, 2492 timeout:settings.timeout, 2493 delay:settings.delay, 2494 sync:settings.sync, 2495 random:settings.random, 2496 nowrap:settings.nowrap, 2497 pause_after_slideshow:settings.pause_after_slideshow, 2498 counter:0, 2499 after:pager_after_fn, 2500 before:pager_before_fn, 2501 cleartype:(settings.cleartype)? true : false, 2502 cleartypeNoBg:(settings.cleartypenobg)? true : false 2503 } 2504 2505 // Set the starting slide if we are supposed to remember the slide 2506 if (settings.remember_slide) { 2507 var startSlide = readCookie(settings.vss_id); 2508 if (startSlide == null) { 2509 startSlide = 0; 2510 } 2511 settings.opts.startingSlide = parseInt(startSlide); 2512 } 2513 2514 if (settings.effect == 'none') { 2515 settings.opts.speed = 1; 2516 } 2517 else { 2518 settings.opts.fx = settings.effect; 2519 } 2520 2521 // Take starting item from fragment. 2522 var hash = location.hash; 2523 if (hash) { 2524 var hash = hash.replace('#', ''); 2525 var aHash = hash.split(';'); 2526 var aHashLen = aHash.length; 2527 2528 // Loop through all the possible starting points. 2529 for (var i = 0; i < aHashLen; i++) { 2530 // Split the hash into two parts. One part is the slideshow id the 2531 // other is the slide number. 2532 var initialInfo = aHash[i].split(':'); 2533 // The id in the hash should match our slideshow. 2534 // The slide number chosen shouldn't be larger than the number of 2535 // slides we have. 2536 if (settings.slideshowId == initialInfo[0] && settings.num_divs >
2536 initialInfo[1]) { 2537 settings.opts.startingSlide = parseInt(initialInfo[1]); 2538 } 2539 } 2540 } 2541 2542 // Pause on hover. 2543 if (settings.pause) { 2544 var mouseIn = function() { 2545 Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId }); 2546 } 2547 2548 var mouseOut = function() { 2549 Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": settings.slideshowId }); 2550 } 2551 2552 if (jQuery.fn.hoverIntent) { 2553 $('#views_slideshow_cycle_teaser_section_' + settings.vss_id).hoverIntent(mouseIn, mouseOut); 2554 } 2555 else { 2556 $('#views_slideshow_cycle_teaser_section_' + settings.vss_id).hover(mouseIn, mouseOut); 2557 } 2558 } 2559 2560 // Play on hover. 2561 if (settings.play_on_hover) { 2562 var mouseIn = function() { 2563 Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": settings.slideshowId, "force": true }); 2564 } 2565 2566 var mouseOut = function() { 2567 Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId }); 2568 } 2569 2570 if (jQuery.fn.hoverIntent) { 2571 $('#views_slideshow_cycle_teaser_section_' + settings.vss_id).hoverIntent(mouseIn, mouseOut); 2572 } 2573 else { 2574 $('#views_slideshow_cycle_teaser_section_' + settings.vss_id).hover(mouseIn, mouseOut); 2575 } 2576 } 2577 2578 // Pause on clicking of the slide. 2579 if (settings.pause_on_click) { 2580 $('#views_slideshow_cycle_teaser_section_' + settings.vss_id).click(function() { 2581 Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId, "force": true }); 2582 }); 2583 } 2584 2585 if (typeof JSON != 'undefined') { 2586 var advancedOptions = JSON.parse(settings.advanced_options); 2587 for (var option in advancedOptions) { 2588 switch(option) { 2589 2590 // Standard Options 2591 case "activePagerClass": 2592 case "allowPagerClickBubble": 2593 case "autostop": 2594 case "autostopCount": 2595 case "backwards": 2596 case "bounce": 2597 case "cleartype": 2598 case "cleartypeNoBg": 2599 case "containerResize": 2600 case "continuous": 2601 case "delay": 2602 case "easeIn": 2603 case "easeOut": 2604 case "easing": 2605 case "fastOnEvent": 2606 case "fit": 2607 case "fx": 2608 case "manualTrump": 2609 case "metaAttr": 2610 case "next": 2611 case "nowrap": 2612 case "pager": 2613 case "pagerEvent": 2614 case "pause": 2615 case "pauseOnPagerHover": 2616 case "prev": 2617 case "prevNextEvent": 2618 case "random": 2619 case "randomizeEffects": 2620 case "requeueOnImageNotLoaded": 2621 case "requeueTimeout": 2622 case "rev": 2623 case "slideExpr": 2624 case "slideResize": 2625 case "speed": 2626 case "speedIn": 2627 case "speedOut": 2628 case "startingSlide": 2629 case "sync": 2630 case "timeout": 2631 var optionValue = advancedOptions[option]; 2632 optionValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(optionValue); 2633 settings.opts[option] = optionValue; 2634 break; 2635 2636 // If width is set we need to disable resizing. 2637 case "width": 2638 var optionValue = advancedOptions["width"]; 2639 optionValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(optionValue); 2640 settings.opts["width"] = optionValue; 2641 settings.opts["containerResize"] = 0; 2642 break; 2643 2644 // If height is set we need to set fixed_height to true. 2645 case "height": 2646 var optionValue = advancedOptions["height"]; 2647 optionValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(optionValue); 2648 settings.opts["height"] = optionValue; 2649 settings.fixed_height = 1; 2650 break; 2651 2652 // These process options that look like {top:50, bottom:20} 2653 case "animIn": 2654 case "animInDelay": 2655 case "animOut": 2656 case "animOutDelay": 2657 case "cssBefore": 2658 case "cssAfter": 2659 case "shuffle": 2660 var cssValue = advancedOptions[option]; 2661 cssValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(cssValue); 2662 settings.opts[option] = eval('(' + cssValue + ')'); 2663 break; 2664 2665 // These options have their own functions. 2666 case "after": 2667 var afterValue = advancedOptions[option]; 2668 afterValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(afterValue); 2669 // transition callback (scope set to element that was shown): function(currSlideElement, nextSlideElement, options, forwardFlag) 2670 settings.opts[option] = function(currSlideElement, nextSlideElement, options, forwardFlag) { 2671 pager_after_fn(currSlideElement, nextSlideElement, options); 2672 eval(afterValue); 2673 } 2674 break; 2675 2676 case "before": 2677 var beforeValue = advancedOptions[option]; 2678 beforeValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(beforeValue); 2679 // transition callback (scope set to element to be shown): function(currSlideElement, nextSlideElement, options, forwardFlag) 2680 settings.opts[option] = function(currSlideElement, nextSlideElement, options, forwardFlag) { 2681 pager_before_fn(currSlideElement, nextSlideElement, options); 2682 eval(beforeValue); 2683 } 2684 break; 2685 2686 case "end": 2687 var endValue = advancedOptions[option]; 2688 endValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(endValue); 2689 // callback invoked when the slideshow terminates (use with autostop or nowrap options): function(options) 2690 settings.opts[option] = function(options) { 2691 eval(endValue); 2692 } 2693 break; 2694 2695 case "fxFn": 2696 var fxFnValue = advancedOptions[option]; 2697 fxFnValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(fxFnValue); 2698 // function used to control the transition: function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag) 2699 settings.opts[option] = function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag) { 2700 eval(fxFnValue); 2701 } 2702 break; 2703 2704 case "onPagerEvent": 2705 var onPagerEventValue = advancedOptions[option]; 2706 onPagerEventValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(onPagerEventValue); 2707 settings.opts[option] = function(zeroBasedSlideIndex, slideElement) { 2708 eval(onPagerEventValue); 2709 } 2710 break; 2711 2712 case "onPrevNextEvent": 2713 var onPrevNextEventValue = advancedOptions[option]; 2714 onPrevNextEventValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(onPrevNextEventValue); 2715 settings.opts[option] = function(isNext, zeroBasedSlideIndex, slideElement) { 2716 eval(onPrevNextEventValue); 2717 } 2718 break; 2719 2720 case "pagerAnchorBuilder": 2721 var pagerAnchorBuilderValue = advancedOptions[option]; 2722 pagerAnchorBuilderValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(pagerAnchorBuilderValue); 2723 // callback fn for building anchor links: function(index, DOMelement) 2724 settings.opts[option] = function(index, DOMelement) { 2725 var returnVal = ''; 2726 eval(pagerAnchorBuilderValue); 2727 return returnVal; 2728 } 2729 break; 2730 2731 case "pagerClick": 2732 var pagerClickValue = advancedOptions[option]; 2733 pagerClickValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(pagerClickValue); 2734 // callback fn for pager clicks: function(zeroBasedSlideIndex, slideElement) 2735 settings.opts[option] = function(zeroBasedSlideIndex, slideElement) { 2736 eval(pagerClickValue); 2737 } 2738 break; 2739 2740 case "paused": 2741 var pausedValue = advancedOptions[option]; 2742 pausedValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(pausedValue); 2743 // undocumented callback when slideshow is paused: function(cont, opts, byHover) 2744 settings.opts[option] = function(cont, opts, byHover) { 2745 eval(pausedValue); 2746 } 2747 break; 2748 2749 case "resumed": 2750 var resumedValue = advancedOptions[option]; 2751 resumedValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(resumedValue); 2752 // undocumented callback when slideshow is resumed: function(cont, opts, byHover) 2753 settings.opts[option] = function(cont, opts, byHover) { 2754 eval(resumedValue); 2755 } 2756 break; 2757 2758 case "timeoutFn": 2759 var timeoutFnValue = advancedOptions[option]; 2760 timeoutFnValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(timeoutFnValue); 2761 settings.opts[option] = function(currSlideElement, nextSlideElement, options, forwardFlag) { 2762 // Set a sane return value unless function overrides it. 2763 var returnVal = settings.timeout; 2764 eval(timeoutFnValue); 2765 return returnVal; 2766 } 2767 break; 2768 2769 case "updateActivePagerLink": 2770 var updateActivePagerLinkValue = advancedOptions[option]; 2771 updateActivePagerLinkValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(updateActivePagerLinkValue); 2772 // callback fn invoked to update the active pager link (adds/removes activePagerClass style) 2773 settings.opts[option] = function(pager, currSlideIndex) { 2774 eval(updateActivePagerLinkValue); 2775 } 2776 break; 2777 } 2778 } 2779 } 2780 2781 // If selected wait for the images to be loaded. 2782 // otherwise just load the slideshow. 2783 if (settings.wait_for_image_load) { 2784 // For IE/Chrome/Opera we if there are images then we need to make 2785 // sure the images are loaded before starting the slideshow. 2786 settings.totalImages = $(settings.targetId + ' img').length; 2787 if (settings.totalImages) { 2788 settings.loadedImages = 0; 2789 2790 // Add a load event for each image. 2791 $(settings.targetId + ' img').each(function() { 2792 var $imageElement = $(this); 2793 $imageElement.bind('load', function () { 2794 Drupal.viewsSlideshowCycle.imageWait(fullId); 2795 }); 2796 2797 // Removing the source and adding it again will fire the load event. 2798 var imgSrc = $imageElement.attr('src'); 2799 $imageElement.attr('src', ''); 2800 $imageElement.attr('src', imgSrc); 2801 }); 2802 2803 // We need to set a timeout so that the slideshow doesn't wait 2804 // indefinitely for all images to load. 2805 setTimeout("Drupal.viewsSlideshowCycle.load('" + fullId + "')", settings.wait_for_image_load_timeout); 2806 } 2807 else { 2808 Drupal.viewsSlideshowCycle.load(fullId); 2809 } 2810 } 2811 else { 2812 Drupal.viewsSlideshowCycle.load(fullId); 2813 } 2814 }); 2815 } 2816 }; 2817 2818 /** 2819 * Views Slideshow swipe support. 2820 */ 2821 Drupal.behaviors.viewsSlideshowSwipe = { 2822 attach: function (context) { 2823 var isTouch = (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0));
2824 if (isTouch === true && $('.views-slideshow-cycle-main-frame').length) { 2825 var $slider = $('.views-slideshow-cycle-main-frame'), 2826 opts = { 2827 start: {x: 0, y: 0}, 2828 end: {x: 0, y: 0}, 2829 hdiff: 0, 2830 vdiff: 0, 2831 length: 0, 2832 angle: null, 2833 direction: null, 2834 }, 2835 optsReset = $.extend(true, {}, opts), 2836 H_THRESHOLD = 110, // roughly one inch effective resolution on ipad 2837 V_THRESHOLD = 50; 2838 $slider.data('bw', opts) 2839 .bind('touchstart.cycle', function (e) { 2840 var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; 2841 if (e.originalEvent.touches.length == 1) { 2842 var data = $(this).data('bw'); 2843 data.start.x = touch.pageX; 2844 data.start.y = touch.pageY; 2845 $(this).data('bw', data); 2846 } 2847 }) 2848 .bind('touchend.cycle', function (e) { 2849 var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; 2850 var data = $(this).data('bw'); 2851 data.end.x = touch.pageX; 2852 data.end.y = touch.pageY; 2853 $(this).data('bw', data); 2854 if (data.start.x != 0 && data.start.y != 0) { 2855 data.vdiff = data.start.x - data.end.x; 2856 data.hdiff = data.end.y - data.start.y; 2857 if (Math.abs(data.vdiff) == data.start.x && Math.abs(data.hdiff) == data.start.y) { 2858 data.vdiff = 0; 2859 data.hdiff = 0; 2860 } 2861 var length = Math.round(Math.sqrt(Math.pow(data.vdiff,2) + Math.pow(data.hdiff,2))); 2862 var rads = Math.atan2(data.hdiff, data.vdiff); 2863 var angle = Math.round(rads*180/Math.PI); 2864 if (angle < 0) { angle = 360 - Math.abs(angle); } 2865 if (length > H_THRESHOLD && V_THRESHOLD > data.hdiff) { 2866 e.preventDefault(); 2867 if (angle > 135 && angle < 225) { 2868 var cyopt = $slider.data('cycle.opts'); 2869 if (cyopt.currSlide > 0) { 2870 $slider.cycle((cyopt.currSlide - 1), 'scrollRight'); 2871 } 2872 else { 2873 $slider.cycle((cyopt.slideCount - 1), 'scrollRight'); 2874 } 2875 } 2876 else if (angle > 315 || angle < 45) { 2877 $slider.cycle('next'); 2878 } 2879 } 2880 } 2881 data = $.extend(true, {}, optsReset); 2882 }); 2883 } 2884 } 2885 }; 2886 2887 Drupal.viewsSlideshowCycle = Drupal.viewsSlideshowCycle || {}; 2888 2889 // Cleanup the values of advanced options. 2890 Drupal.viewsSlideshowCycle.advancedOptionCleanup = function(value) { 2891 value = $.trim(value); 2892 value = value.replace(/\n/g, ''); 2893 if (value.match(/^[\d.]+%$/)) { 2894 // noop 2895 } 2896 else if (!isNaN(parseInt(value))) { 2897 value = parseInt(value); 2898 } 2899 else if (value.toLowerCase() == 'true') { 2900 value = true; 2901 } 2902 else if (value.toLowerCase() == 'false') { 2903 value = false; 2904 } 2905 2906 return value; 2907 } 2908 2909 // This checks to see if all the images have been loaded. 2910 // If they have then it starts the slideshow. 2911 Drupal.viewsSlideshowCycle.imageWait = function(fullId) { 2912 if (++Drupal.settings.viewsSlideshowCycle[fullId].loadedImages == Drupal.settings.viewsSlideshowCycle[fullId].totalImages) { 2913 Drupal.viewsSlideshowCycle.load(fullId); 2914 } 2915 }; 2916 2917 // Start the slideshow. 2918 Drupal.viewsSlideshowCycle.load = function (fullId) { 2919 var settings = Drupal.settings.viewsSlideshowCycle[fullId]; 2920 2921 // Make sure the slideshow isn't already loaded. 2922 if (!settings.loaded) { 2923 $(settings.targetId).cycle(settings.opts); 2924 $(settings.targetId).parent().parent().addClass('views-slideshow-cycle-processed'); 2925 settings.loaded = true; 2926 2927 // Start Paused 2928 if (settings.start_paused) { 2929 Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId, "force": true }); 2930 } 2931 2932 // Pause if hidden. 2933 if (settings.pause_when_hidden) { 2934 var checkPause = function(settings) { 2935 // If the slideshow is visible and it is paused then resume. 2936 // otherwise if the slideshow is not visible and it is not paused then 2937 // pause it.
2938 var visible = viewsSlideshowCycleIsVisible(settings.targetId, settings.pause_when_hidden_type, settings.amount_allowed_visible); 2939 if (visible) { 2940 Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": settings.slideshowId }); 2941 } 2942 else { 2943 Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId }); 2944 } 2945 } 2946 2947 // Check when scrolled. 2948 $(window).scroll(function() { 2949 checkPause(settings); 2950 }); 2951 2952 // Check when the window is resized. 2953 $(window).resize(function() { 2954 checkPause(settings); 2955 }); 2956 } 2957 } 2958 }; 2959 2960 Drupal.viewsSlideshowCycle.pause = function (options) { 2961 //Eat TypeError, cycle doesn't handle pause well if options isn't defined. 2962 try{ 2963 if (options.pause_in_middle && $.fn.pause) { 2964 $('#views_slideshow_cycle_teaser_section_' + options.slideshowID).pause(); 2965 } 2966 else { 2967 $('#views_slideshow_cycle_teaser_section_' + options.slideshowID).cycle('pause'); 2968 } 2969 } 2970 catch(e){ 2971 if(!e instanceof TypeError){ 2972 throw e; 2973 } 2974 } 2975 }; 2976 2977 Drupal.viewsSlideshowCycle.play = function (options) { 2978 Drupal.settings.viewsSlideshowCycle['#views_slideshow_cycle_main_' + options.slideshowID].paused = false; 2979 if (options.pause_in_middle && $.fn.resume) { 2980 $('#views_slideshow_cycle_teaser_section_' + options.slideshowID).resume(); 2981 } 2982 else { 2983 $('#views_slideshow_cycle_teaser_section_' + options.slideshowID).cycle('resume'); 2984 } 2985 }; 2986 2987 Drupal.viewsSlideshowCycle.previousSlide = function (options) { 2988 $('#views_slideshow_cycle_teaser_section_' + options.slideshowID).cycle('prev'); 2989 }; 2990 2991 Drupal.viewsSlideshowCycle.nextSlide = function (options) { 2992 $('#views_slideshow_cycle_teaser_section_' + options.slideshowID).cycle('next'); 2993 }; 2994 2995 Drupal.viewsSlideshowCycle.goToSlide = function (options) { 2996 $('#views_slideshow_cycle_teaser_section_' + options.slideshowID).cycle(options.slideNum); 2997 }; 2998 2999 // Verify that the value is a number. 3000 function IsNumeric(sText) { 3001 var ValidChars = "0123456789"; 3002 var IsNumber=true; 3003 var Char; 3004 3005 for (var i=0; i < sText.length && IsNumber == true; i++) { 3006 Char = sText.charAt(i); 3007 if (ValidChars.indexOf(Char) == -1) { 3008 IsNumber = false; 3009 } 3010 } 3011 return IsNumber; 3012 } 3013 3014 /** 3015 * Cookie Handling Functions 3016 */ 3017 function createCookie(name,value,days) { 3018 if (days) { 3019 var date = new Date(); 3020 date.setTime(date.getTime()+(days*24*60*60*1000)); 3021 var expires = "; expires="+date.toGMTString(); 3022 } 3023 else { 3024 var expires = ""; 3025 } 3026 document.cookie = name+"="+value+expires+"; path=/"; 3027 } 3028 3029 function readCookie(name) { 3030 var nameEQ = name + "="; 3031 var ca = document.cookie.split(';'); 3032 for(var i=0;i < ca.length;i++) { 3033 var c = ca[i]; 3034 while (c.charAt(0)==' ') c = c.substring(1,c.length); 3035 if (c.indexOf(nameEQ) == 0) { 3036 return c.substring(nameEQ.length,c.length); 3037 } 3038 } 3039 return null; 3040 } 3041 3042 function eraseCookie(name) { 3043 createCookie(name,"",-1); 3044 } 3045 3046 /** 3047 * Checks to see if the slide is visible enough. 3048 * elem = element to check. 3049 * type = The way to calculate how much is visible. 3050 * amountVisible = amount that should be visible. Either in percent or px. If 3051 * it's not defined then all of the slide must be visible. 3052 * 3053 * Returns true or false 3054 */ 3055 function viewsSlideshowCycleIsVisible(elem, type, amountVisible) { 3056 // Get the top and bottom of the window; 3057 var docViewTop = $(window).scrollTop(); 3058 var docViewBottom = docViewTop + $(window).height(); 3059 var docViewLeft = $(window).scrollLeft(); 3060 var docViewRight = docViewLeft + $(window).width(); 3061 3062 // Get the top, bottom, and height of the slide; 3063 var elemTop = $(elem).offset().top; 3064 var elemHeight = $(elem).height(); 3065 var elemBottom = elemTop + elemHeight; 3066 var elemLeft = $(elem).offset().left; 3067 var elemWidth = $(elem).width(); 3068 var elemRight = elemLeft + elemWidth; 3069 var elemArea = elemHeight * elemWidth; 3070 3071 // Calculate what's hiding in the slide. 3072 var missingLeft = 0; 3073 var missingRight = 0; 3074 var missingTop = 0; 3075 var missingBottom = 0; 3076 3077 // Find out how much of the slide is missing from the left. 3078 if (elemLeft < docViewLeft) { 3079 missingLeft = docViewLeft - elemLeft; 3080 } 3081 3082 // Find out how much of the slide is missing from the right. 3083 if (elemRight > docViewRight) { 3084 missingRight = elemRight - docViewRight; 3085 } 3086 3087 // Find out how much of the slide is missing from the top. 3088 if (elemTop < docViewTop) { 3089 missingTop = docViewTop - elemTop; 3090 } 3091 3092 // Find out how much of the slide is missing from the bottom. 3093 if (elemBottom > docViewBottom) { 3094 missingBottom = elemBottom - docViewBottom; 3095 } 3096 3097 // If there is no amountVisible defined then check to see if the whole slide 3098 // is visible. 3099 if (type == 'full') { 3100 return ((elemBottom >= docViewTop) && (elemTop <= docViewBottom) 3101 && (elemBottom <= docViewBottom) && (elemTop >= docViewTop) 3102 && (elemLeft >= docViewLeft) && (elemRight <= docViewRight) 3103 && (elemLeft <= docViewRight) && (elemRight >= docViewLeft)); 3104 } 3105 else if(type == 'vertical') { 3106 var verticalShowing = elemHeight - missingTop - missingBottom; 3107 3108 // If user specified a percentage then find out if the current shown percent 3109 // is larger than the allowed percent. 3110 // Otherwise check to see if the amount of px shown is larger than the 3111 // allotted amount. 3112 if (typeof amountVisible === 'string' && amountVisible.indexOf('%')) { 3113 return (((verticalShowing/elemHeight)*100) >= parseInt(amountVisible)); 3114 } 3115 else { 3116 return (verticalShowing >= parseInt(amountVisible)); 3117 } 3118 } 3119 else if(type == 'horizontal') { 3120 var horizontalShowing = elemWidth - missingLeft - missingRight; 3121 3122 // If user specified a percentage then find out if the current shown percent 3123 // is larger than the allowed percent. 3124 // Otherwise check to see if the amount of px shown is larger than the 3125 // allotted amount. 3126 if (typeof amountVisible === 'string' && amountVisible.indexOf('%')) { 3127 return (((horizontalShowing/elemWidth)*100) >= parseInt(amountVisible)); 3128 } 3129 else { 3130 return (horizontalShowing >= parseInt(amountVisible)); 3131 } 3132 } 3133 else if(type == 'area') { 3134 var areaShowing = (elemWidth - missingLeft - missingRight) * (elemHeight - missingTop - missingBottom); 3135 3136 // If user specified a percentage then find out if the current shown percent 3137 // is larger than the allowed percent. 3138 // Otherwise check to see if the amount of px shown is larger than the 3139 // allotted amount. 3140 if (typeof amountVisible === 'string' && amountVisible.indexOf('%')) { 3141 return (((areaShowing/elemArea)*100) >= parseInt(amountVisible)); 3142 } 3143 else { 3144 return (areaShowing >= parseInt(amountVisible)); 3145 } 3146 } 3147 } 3148})(jQuery); 3149; 3150(function ($) { 3151 3152/** 3153 * A progressbar object. Initialized with the given id. Must be inserted into 3154 * the DOM afterwards through progressBar.element. 3155 * 3156 * method is the function which will perform the HTTP request to get the 3157 * progress bar state. Either "GET" or "POST". 3158 * 3159 * e.g. pb = new progressBar('myProgressBar'); 3160 * some_element.appendChild(pb.element); 3161 */ 3162Drupal.progressBar = function (id, updateCallback, method, errorCallback) { 3163 var pb = this; 3164 this.id = id; 3165 this.method = method || 'GET'; 3166 this.updateCallback = updateCallback; 3167 this.errorCallback = errorCallback; 3168
3169 // The WAI-ARIA setting aria-live="polite" will announce changes after users 3170 // have completed their current activity and not interrupt the screen reader. 3171 this.element = $('<div class="progress" aria-live="polite"></div>').attr('id', id); 3172 this.element.html('<div class="bar"><div class="filled"></div></div>' + 3173 '<div class="percentage"></div>' + 3174 '<div class="message"> </div>'); 3175}; 3176 3177/** 3178 * Set the percentage and status message for the progressbar. 3179 */ 3180Drupal.progressBar.prototype.setProgress = function (percentage, message) { 3181 if (percentage >= 0 && percentage <= 100) { 3182 $('div.filled', this.element).css('width', percentage + '%'); 3183 $('div.percentage', this.element).html(percentage + '%'); 3184 } 3185 $('div.message', this.element).html(message); 3186 if (this.updateCallback) { 3187 this.updateCallback(percentage, message, this); 3188 } 3189}; 3190 3191/** 3192 * Start monitoring progress via Ajax. 3193 */ 3194Drupal.progressBar.prototype.startMonitoring = function (uri, delay) { 3195 this.delay = delay; 3196 this.uri = uri; 3197 this.sendPing(); 3198}; 3199 3200/** 3201 * Stop monitoring progress via Ajax. 3202 */ 3203Drupal.progressBar.prototype.stopMonitoring = function () { 3204 clearTimeout(this.timer); 3205 // This allows monitoring to be stopped from within the callback. 3206 this.uri = null; 3207}; 3208 3209/** 3210 * Request progress data from server. 3211 */ 3212Drupal.progressBar.prototype.sendPing = function () { 3213 if (this.timer) { 3214 clearTimeout(this.timer); 3215 } 3216 if (this.uri) { 3217 var pb = this; 3218 // When doing a post request, you need non-null data. Otherwise a 3219 // HTTP 411 or HTTP 406 (with Apache mod_security) error may result. 3220 $.ajax({ 3221 type: this.method, 3222 url: this.uri, 3223 data: '', 3224 dataType: 'json', 3225 success: function (progress) { 3226 // Display errors. 3227 if (progress.status == 0) { 3228 pb.displayError(progress.data); 3229 return; 3230 } 3231 // Update display. 3232 pb.setProgress(progress.percentage, progress.message); 3233 // Schedule next timer. 3234 pb.timer = setTimeout(function () { pb.sendPing(); }, pb.delay); 3235 }, 3236 error: function (xmlhttp) { 3237 pb.displayError(Drupal.ajaxError(xmlhttp, pb.uri)); 3238 } 3239 }); 3240 } 3241}; 3242 3243/** 3244 * Display errors on the page. 3245 */ 3246Drupal.progressBar.prototype.displayError = function (string) { 3247 var error = $('<div class="messages error"></div>').html(string); 3248 $(this.element).before(error).hide(); 3249 3250 if (this.errorCallback) { 3251 this.errorCallback(this); 3252 } 3253}; 3254 3255})(jQuery); 3256; 3257(function ($) { 3258 3259 Drupal.behaviors.captcha = { 3260 attach: function (context) { 3261 3262 // Turn off autocompletion for the CAPTCHA response field. 3263 // We do it here with JavaScript (instead of directly in the markup) 3264 // because this autocomplete attribute is not standard and 3265 // it would break (X)HTML compliance. 3266 $("#edit-captcha-response").attr("autocomplete", "off"); 3267 3268 } 3269 }; 3270 3271 Drupal.behaviors.captchaAdmin = { 3272 attach: function (context) { 3273 // Add onclick handler to checkbox for adding a CAPTCHA description 3274 // so that the textfields for the CAPTCHA description are hidden 3275 // when no description should be added. 3276 // @todo: div.form-item-captcha-description depends on theming, maybe 3277 // it's better to add our own wrapper with id (instead of a class). 3278 $("#edit-captcha-add-captcha-description").click(function() { 3279 if ($("#edit-captcha-add-captcha-description").is(":checked")) { 3280 // Show the CAPTCHA description textfield(s). 3281 $("div.form-item-captcha-description").show('slow'); 3282 } 3283 else { 3284 // Hide the CAPTCHA description textfield(s). 3285 $("div.form-item-captcha-description").hide('slow'); 3286 } 3287 }); 3288 // Hide the CAPTCHA description textfields if option is disabled on page load. 3289 if (!$("#edit-captcha-add-captcha-description").is(":checked")) { 3290 $("div.form-item-captcha-description").hide(); 3291 } 3292 } 3293 3294 }; 3295 3296})(jQuery); 3297; 3298(function ($) { 3299 3300Drupal.googleanalytics = {}; 3301 3302$(document).ready(function() { 3303 3304 // Attach mousedown, keyup, touchstart events to document only and catch 3305 // clicks on all elements. 3306 $(document.body).bind("mousedown keyup touchstart", function(event) { 3307 3308 // Catch the closest surrounding link of a clicked element. 3309 $(event.target).closest("a,area").each(function() { 3310 3311 // Is the clicked URL internal? 3312 if (Drupal.googleanalytics.isInternal(this.href)) { 3313 // Skip 'click' tracking, if custom tracking events are bound. 3314 if ($(this).is('.colorbox') && (Drupal.settings.googleanalytics.trackColorbox)) {
3315 // Do nothing here. The custom event will handle all tracking. 3316 //console.info("Click on .colorbox item has been detected."); 3317 } 3318 // Is download tracking activated and the file extension configured for download tracking? 3319 else if (Drupal.settings.googleanalytics.trackDownload && Drupal.googleanalytics.isDownload(this.href)) { 3320 // Download link clicked. 3321 ga("send", { 3322 "hitType": "event", 3323 "eventCategory": "Downloads", 3324 "eventAction": Drupal.googleanalytics.getDownloadExtension(this.href).toUpperCase(), 3325 "eventLabel": Drupal.googleanalytics.getPageUrl(this.href), 3326 "transport": "beacon" 3327 }); 3328 } 3329 else if (Drupal.googleanalytics.isInternalSpecial(this.href)) { 3330 // Keep the internal URL for Google Analytics website overlay intact. 3331 ga("send", { 3332 "hitType": "pageview", 3333 "page": Drupal.googleanalytics.getPageUrl(this.href), 3334 "transport": "beacon" 3335 }); 3336 } 3337 } 3338 else { 3339 if (Drupal.settings.googleanalytics.trackMailto && $(this).is("a[href^='mailto:'],area[href^='mailto:']")) { 3340 // Mailto link clicked. 3341 ga("send", { 3342 "hitType": "event", 3343 "eventCategory": "Mails", 3344 "eventAction": "Click", 3345 "eventLabel": this.href.substring(7), 3346 "transport": "beacon" 3347 }); 3348 } 3349 else if (Drupal.settings.googleanalytics.trackOutbound && this.href.match(/^\w+:\/\//i)) { 3350 if (Drupal.settings.googleanalytics.trackDomainMode !== 2 || (Drupal.settings.googleanalytics.trackDomainMode === 2 && !Drupal.googleanalytics.isCrossDomain(this.hostname, Drupal.settings.googleanalytics.trackCrossDomains))) { 3351 // External link clicked / No top-level cross domain clicked. 3352 ga("send", { 3353 "hitType": "event", 3354 "eventCategory": "Outbound links", 3355 "eventAction": "Click", 3356 "eventLabel": this.href, 3357 "transport": "beacon" 3358 }); 3359 } 3360 } 3361 } 3362 }); 3363 }); 3364 3365 // Track hash changes as unique pageviews, if this option has been enabled. 3366 if (Drupal.settings.googleanalytics.trackUrlFragments) { 3367 window.onhashchange = function() { 3368 ga("send", { 3369 "hitType": "pageview", 3370 "page": location.pathname + location.search + location.hash 3371 }); 3372 }; 3373 } 3374 3375 // Colorbox: This event triggers when the transition has completed and the 3376 // newly loaded content has been revealed. 3377 if (Drupal.settings.googleanalytics.trackColorbox) { 3378 $(document).bind("cbox_complete", function () { 3379 var href = $.colorbox.element().attr("href"); 3380 if (href) { 3381 ga("send", { 3382 "hitType": "pageview", 3383 "page": Drupal.googleanalytics.getPageUrl(href) 3384 }); 3385 } 3386 }); 3387 } 3388 3389}); 3390 3391/** 3392 * Check whether the hostname is part of the cross domains or not. 3393 * 3394 * @param string hostname 3395 * The hostname of the clicked URL. 3396 * @param array crossDomains 3397 * All cross domain hostnames as JS array. 3398 * 3399 * @return boolean 3400 */ 3401Drupal.googleanalytics.isCrossDomain = function (hostname, crossDomains) { 3402 /** 3403 * jQuery < 1.6.3 bug: $.inArray crushes IE6 and Chrome if second argument is 3404 * `null` or `undefined`, https://bugs.jquery.com/ticket/10076, 3405 * https://github.com/jquery/jquery/commit/a839af034db2bd934e4d4fa6758a3fed8de74174 3406 * 3407 * @todo: Remove/Refactor in D8 3408 */ 3409 if (!crossDomains) { 3410 return false; 3411 } 3412 else { 3413 return $.inArray(hostname, crossDomains) > -1 ? true : false; 3414 } 3415}; 3416 3417/** 3418 * Check whether this is a download URL or not. 3419 * 3420 * @param string url 3421 * The web url to check. 3422 * 3423 * @return boolean 3424 */ 3425Drupal.googleanalytics.isDownload = function (url) { 3426 var isDownload = new RegExp("\\.(" + Drupal.settings.googleanalytics.trackDownloadExtensions + ")([\?#].*)?$", "i"); 3427 return isDownload.test(url); 3428}; 3429 3430/** 3431 * Check whether this is an absolute internal URL or not. 3432 * 3433 * @param string url 3434 * The web url to check. 3435 * 3436 * @return boolean 3437 */ 3438Drupal.googleanalytics.isInternal = function (url) { 3439 var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i"); 3440 return isInternal.test(url); 3441}; 3442 3443/** 3444 * Check whether this is a special URL or not. 3445 * 3446 * URL types: 3447 * - gotwo.module /go/* links. 3448 * 3449 * @param string url 3450 * The web url to check. 3451 * 3452 * @return boolean 3453 */ 3454Drupal.googleanalytics.isInternalSpecial = function (url) { 3455 var isInternalSpecial = new RegExp("(\/go\/.*)$", "i"); 3456 return isInternalSpecial.test(url); 3457}; 3458 3459/** 3460 * Extract the relative internal URL from an absolute internal URL. 3461 * 3462 * Examples: 3463 * - https://mydomain.com/node/1 -> /node/1 3464 * - https://example.com/foo/bar -> https://example.com/foo/bar 3465 * 3466 * @param string url 3467 * The web url to check. 3468 * 3469 * @return string 3470 * Internal website URL 3471 */ 3472Drupal.googleanalytics.getPageUrl = function (url) { 3473 var extractInternalUrl = new RegExp("^(https?):\/\/" + window.location.host, "i"); 3474 return url.replace(extractInternalUrl, ''); 3475}; 3476 3477/** 3478 * Extract the download file extension from the URL. 3479 * 3480 * @param string url 3481 * The web url to check. 3482 * 3483 * @return string 3484 * The file extension of the passed url. e.g. "zip", "txt" 3485 */ 3486Drupal.googleanalytics.getDownloadExtension = function (url) { 3487 var extractDownloadextension = new RegExp("\\.(" + Drupal.settings.googleanalytics.trackDownloadExtensions + ")([\?#].*)?$", "i"); 3488 var extension = extractDownloadextension.exec(url); 3489 return (extension === null) ? '' : extension[1]; 3490}; 3491 3492})(jQuery); 3493;
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.