summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspiderr <spider@viovio.com>2011-03-31 00:51:59 -0400
committerspiderr <spider@viovio.com>2011-03-31 00:51:59 -0400
commit8cd934e8f1b51d47ea0f0851a3ddb2408fdd9bf4 (patch)
treeb1df987cf1e65e0a789cadb872f2ce48f27a5e47
parent6b025c025b2ca0568f737cacfc192b999a8ef955 (diff)
downloadutil-8cd934e8f1b51d47ea0f0851a3ddb2408fdd9bf4.tar.gz
util-8cd934e8f1b51d47ea0f0851a3ddb2408fdd9bf4.tar.bz2
util-8cd934e8f1b51d47ea0f0851a3ddb2408fdd9bf4.zip
update colorbox for newer jquery
-rw-r--r--[-rwxr-xr-x]javascript/libs/jquery/plugins/colorbox/jquery.colorbox-min.js6
-rw-r--r--[-rwxr-xr-x]javascript/libs/jquery/plugins/colorbox/jquery.colorbox.js778
2 files changed, 414 insertions, 370 deletions
diff --git a/javascript/libs/jquery/plugins/colorbox/jquery.colorbox-min.js b/javascript/libs/jquery/plugins/colorbox/jquery.colorbox-min.js
index 2a682ff..b795ee8 100755..100644
--- a/javascript/libs/jquery/plugins/colorbox/jquery.colorbox-min.js
+++ b/javascript/libs/jquery/plugins/colorbox/jquery.colorbox-min.js
@@ -1,2 +1,4 @@
-/* ColorBox v1.3.7 - a full featured, light-weight, customizable lightbox based on jQuery 1.3 */
-(function(c){function o(b,d){d=d==="x"?n.width():n.height();return typeof b==="string"?Math.round(b.match(/%/)?d/100*parseInt(b,10):parseInt(b,10)):b}function K(b){b=c.isFunction(b)?b.call(h):b;return a.photo||b.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i)}function Y(){for(var b in a)if(c.isFunction(a[b])&&b.substring(0,2)!=="on")a[b]=a[b].call(h);a.rel=a.rel||h.rel||"nofollow";a.href=a.href||c(h).attr("href");a.title=a.title||h.title}function Z(b){h=b;a=c.extend({},c(h).data(s)); Y();if(a.rel!=="nofollow"){j=c(".cboxElement").filter(function(){return(c(this).data(s).rel||this.rel)===a.rel});g=j.index(h);if(g<0){j=j.add(h);g=j.length-1}}else{j=c(h);g=0}if(!q){A=q=l;L=h;try{L.blur()}catch(d){}c.event.trigger(ba);a.onOpen&&a.onOpen.call(h);r.css({opacity:parseFloat(a.opacity),cursor:a.overlayClose?"pointer":"auto"}).show();a.w=o(a.initialWidth,"x");a.h=o(a.initialHeight,"y");e.position(0);M&&n.bind("resize.cboxIE6 scroll.cboxIE6",function(){r.css({width:n.width(),height:n.height(), top:n.scrollTop(),left:n.scrollLeft()})}).trigger("scroll.cboxIE6")}N.add(E).add(F).add(t).add(O).hide();P.html(a.close).show();e.slideshow();e.load()}var s="colorbox",l=true,e,B=c.browser.msie&&!c.support.opacity,M=B&&c.browser.version<7,ba="cbox_open",I="cbox_load",Q="cbox_complete",r,k,x,p,R,S,T,U,j,n,m,J,G,O,N,t,F,E,P,y,z,u,v,h,L,g,a,q,A,$={transition:"elastic",speed:350,width:false,height:false,innerWidth:false,innerHeight:false,initialWidth:"400",initialHeight:"400",maxWidth:false,maxHeight:false, scalePhotos:l,scrolling:l,inline:false,html:false,iframe:false,photo:false,href:false,title:false,rel:false,opacity:0.9,preloading:l,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:false,overlayClose:l,loop:l,slideshow:false,slideshowAuto:l,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:false,onLoad:false,onComplete:false,onCleanup:false,onClosed:false,escKey:l,arrowKey:l};e=c.fn.colorbox=c.colorbox=function(b,d){var f= this;if(f.selector&&!f.length)return f;b=b||{};if(d)b.onComplete=d;if(!f.length||f.selector===undefined){f=c("<a/>");b.open=l}f.each(function(){c(this).data(s,c.extend({},c(this).data(s)||$,b)).addClass("cboxElement")});b.open&&Z(f[0]);return f};e.init=function(){function b(d){return c('<div id="cbox'+d+'"/>')}n=c(window);k=c('<div id="colorbox"/>');r=b("Overlay").hide();x=b("Wrapper");p=b("Content").append(m=b("LoadedContent").css({width:0,height:0}),G=b("LoadingOverlay").add(b("LoadingGraphic")), O=b("Title"),N=b("Current"),F=b("Next"),E=b("Previous"),t=b("Slideshow"),P=b("Close"));x.append(c("<div/>").append(b("TopLeft"),R=b("TopCenter"),b("TopRight")),c("<div/>").append(S=b("MiddleLeft"),p,T=b("MiddleRight")),c("<div/>").append(b("BottomLeft"),U=b("BottomCenter"),b("BottomRight"))).children().children().css({"float":"left"});J=c("<div id='cboxLoadingBay' style='position:absolute; width:9999px;'/>");c("body").prepend(r,k.append(x,J));if(B){k.addClass("cboxIE");M&&r.css("position","absolute")}p.children().hover(function(){c(this).addClass("hover")}, function(){c(this).removeClass("hover")}).addClass("hover");y=R.height()+U.height()+p.outerHeight(l)-p.height();z=S.width()+T.width()+p.outerWidth(l)-p.width();u=m.outerHeight(l);v=m.outerWidth(l);k.css({"padding-bottom":y,"padding-right":z}).hide();F.click(e.next);E.click(e.prev);P.click(e.close);p.children().removeClass("hover");c(".cboxElement").live("click",function(d){if(d.button!==0&&typeof d.button!=="undefined"||d.ctrlKey||d.shiftKey||d.altKey)return l;else{Z(this);return false}});r.click(function(){a.overlayClose&& e.close()});c(document).bind("keydown",function(d){if(q&&a.escKey&&d.keyCode===27){d.preventDefault();e.close()}if(q&&a.arrowKey&&!A&&j.length>1)if(d.keyCode===37&&(g>0||a.loop)){d.preventDefault();E.click()}else if(d.keyCode===39&&(g<j.length-1||a.loop)){d.preventDefault();F.click()}})};e.remove=function(){k.add(r).remove();c(".cboxElement").removeData(s).removeClass("cboxElement")};e.position=function(b,d){function f(C){R[0].style.width=U[0].style.width=p[0].style.width=C.style.width;G[0].style.height= G[1].style.height=p[0].style.height=S[0].style.height=T[0].style.height=C.style.height}var i,w=Math.max(n.height()-a.h-u-y,0)/2+n.scrollTop(),H=Math.max(n.width()-a.w-v-z,0)/2+n.scrollLeft();i=k.width()===a.w+v&&k.height()===a.h+u?0:b;x[0].style.width=x[0].style.height="9999px";k.dequeue().animate({width:a.w+v,height:a.h+u,top:w,left:H},{duration:i,complete:function(){f(this);A=false;x[0].style.width=a.w+v+z+"px";x[0].style.height=a.h+u+y+"px";d&&d()},step:function(){f(this)}})};e.resize=function(b){if(q){b= b||{};if(b.width)a.w=o(b.width,"x")-v-z;if(b.innerWidth)a.w=o(b.innerWidth,"x");m.css({width:a.w});if(b.height)a.h=o(b.height,"y")-u-y;if(b.innerHeight)a.h=o(b.innerHeight,"y");if(!b.innerHeight&&!b.height){b=m.wrapInner("<div style='overflow:auto'></div>").children();a.h=b.height();b.replaceWith(b.children())}m.css({height:a.h});e.position(a.transition==="none"?0:a.speed)}};e.prep=function(b){function d(w){var H,C,V,W,D=j.length,X=a.loop;e.position(w,function(){function aa(){B&&k[0].style.removeAttribute("filter")} if(q){B&&f&&m.fadeIn(100);if(a.iframe)c("<iframe frameborder=0"+(a.scrolling?"":" scrolling='no'")+(B?" allowtransparency='true'":"")+"/>").appendTo(m).attr({src:a.href,id:"cboxIframe",name:(new Date).getTime()});m.show();O.show().html(a.title);if(D>1){N.html(a.current.replace(/\{current\}/,g+1).replace(/\{total\}/,D)).show();F[X||g<D-1?"show":"hide"]().html(a.next);E[X||g>0?"show":"hide"]().html(a.previous);H=g>0?j[g-1]:j[D-1];V=g<D-1?j[g+1]:j[0];if(a.slideshow){t.show();g===D-1&&!X&&k.is(".cboxSlideshow_on")&& t.click()}if(a.preloading){W=c(V).data(s).href||V.href;C=c(H).data(s).href||H.href;if(K(W))c("<img/>")[0].src=W;if(K(C))c("<img/>")[0].src=C}}G.hide();a.transition==="fade"?k.fadeTo(i,1,function(){aa()}):aa();n.bind("resize.cbox",function(){e.position(0)});c.event.trigger(Q);a.onComplete&&a.onComplete.call(h)}})}if(q){var f,i=a.transition==="none"?0:a.speed;n.unbind("resize.cbox");m.remove();m=c('<div id="cboxLoadedContent"/>').html(b);m.hide().appendTo(J).css({width:function(){a.w=a.w||m.width(); a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}(),overflow:a.scrolling?"auto":"hidden"}).css({height:function(){a.h=a.h||m.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}()}).prependTo(p);c("#cboxPhoto").css({cssFloat:"none"});M&&c("select:not(#colorbox select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("cbox_cleanup",function(){this.style.visibility="inherit"});a.transition==="fade"?k.fadeTo(i,0,function(){d(0)}):d(i)}};e.load=function(){var b,d,f,i=e.prep; A=l;h=j[g];a=c.extend({},c(h).data(s));Y();c.event.trigger(I);a.onLoad&&a.onLoad.call(h);a.h=a.height?o(a.height,"y")-u-y:a.innerHeight?o(a.innerHeight,"y"):false;a.w=a.width?o(a.width,"x")-v-z:a.innerWidth?o(a.innerWidth,"x"):false;a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=o(a.maxWidth,"x")-v-z;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=o(a.maxHeight,"y")-u-y;a.mh=a.h&&a.h<a.mh?a.h:a.mh}b=a.href;G.show();if(a.inline){c('<div id="cboxInlineTemp"/>').hide().insertBefore(c(b)[0]).bind(I+" cbox_cleanup", function(){c(this).replaceWith(m.children())});i(c(b))}else if(a.iframe)i(" ");else if(a.html)i(a.html);else if(K(b)){d=new Image;d.onload=function(){var w;d.onload=null;d.id="cboxPhoto";c(d).css({margin:"auto",border:"none",display:"block",cssFloat:"left"});if(a.scalePhotos){f=function(){d.height-=d.height*w;d.width-=d.width*w};if(a.mw&&d.width>a.mw){w=(d.width-a.mw)/d.width;f()}if(a.mh&&d.height>a.mh){w=(d.height-a.mh)/d.height;f()}}if(a.h)d.style.marginTop=Math.max(a.h-d.height,0)/2+"px";i(d); j.length>1&&c(d).css({cursor:"pointer"}).click(e.next);if(B)d.style.msInterpolationMode="bicubic"};d.src=b}else c("<div>Request unsuccessful.</div>").appendTo(J).load(b,function(){i(this)})};e.next=function(){if(!A){g=g<j.length-1?g+1:0;e.load()}};e.prev=function(){if(!A){g=g>0?g-1:j.length-1;e.load()}};e.slideshow=function(){function b(){t.text(a.slideshowStop).bind(Q,function(){f=setTimeout(e.next,a.slideshowSpeed)}).bind(I,function(){clearTimeout(f)}).one("click",function(){d()});k.removeClass(i+ "off").addClass(i+"on")}var d,f,i="cboxSlideshow_";t.bind("cbox_closed",function(){t.unbind();clearTimeout(f);k.removeClass(i+"off "+i+"on")});d=function(){clearTimeout(f);t.text(a.slideshowStart).unbind(Q+" "+I).one("click",function(){b();f=setTimeout(e.next,a.slideshowSpeed)});k.removeClass(i+"on").addClass(i+"off")};if(a.slideshow&&j.length>1)a.slideshowAuto?b():d()};e.close=function(){if(q){q=false;c.event.trigger("cbox_cleanup");a.onCleanup&&a.onCleanup.call(h);n.unbind(".cbox .cboxIE6");k.add(r).stop().fadeTo("fast", 0,function(){c("#colorbox iframe").attr("src","about:blank");m.remove();k.add(r).css({opacity:1,cursor:"auto"}).hide();try{L.focus()}catch(b){}setTimeout(function(){c.event.trigger("cbox_closed");a.onClosed&&a.onClosed.call(h)},1)})}};e.element=function(){return c(h)};e.settings=$;c(e.init)})(jQuery);
+// ColorBox v1.3.16 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
+// Copyright (c) 2011 Jack Moore - jack@colorpowered.com
+// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
+(function(a,b,c){function ba(b){if(!T){O=b,Z(a.extend(J,a.data(O,e))),x=a(O),P=0,J.rel!=="nofollow"&&(x=a("."+V).filter(function(){var b=a.data(this,e).rel||this.rel;return b===J.rel}),P=x.index(O),P===-1&&(x=x.add(O),P=x.length-1));if(!R){R=S=!0,q.show();if(J.returnFocus)try{O.blur(),a(O).one(k,function(){try{this.focus()}catch(a){}})}catch(c){}p.css({opacity:+J.opacity,cursor:J.overlayClose?"pointer":"auto"}).show(),J.w=X(J.initialWidth,"x"),J.h=X(J.initialHeight,"y"),U.position(0),n&&y.bind("resize."+o+" scroll."+o,function(){p.css({width:y.width(),height:y.height(),top:y.scrollTop(),left:y.scrollLeft()})}).trigger("resize."+o),$(g,J.onOpen),I.add(C).hide(),H.html(J.close).show()}U.load(!0)}}function _(){var a,b=f+"Slideshow_",c="click."+f,d,e,g;J.slideshow&&x[1]&&(d=function(){E.text(J.slideshowStop).unbind(c).bind(i,function(){if(P<x.length-1||J.loop)a=setTimeout(U.next,J.slideshowSpeed)}).bind(h,function(){clearTimeout(a)}).one(c+" "+j,e),q.removeClass(b+"off").addClass(b+"on"),a=setTimeout(U.next,J.slideshowSpeed)},e=function(){clearTimeout(a),E.text(J.slideshowStart).unbind([i,h,j,c].join(" ")).one(c,d),q.removeClass(b+"on").addClass(b+"off")},J.slideshowAuto?d():e())}function $(b,c){c&&c.call(O),a.event.trigger(b)}function Z(b){for(var c in b)a.isFunction(b[c])&&c.substring(0,2)!=="on"&&(b[c]=b[c].call(O));b.rel=b.rel||O.rel||"nofollow",b.href=a.trim(b.href||a(O).attr("href")),b.title=b.title||O.title}function Y(a){return J.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(a)}function X(a,b){b=b==="x"?y.width():y.height();return typeof a=="string"?Math.round(/%/.test(a)?b/100*parseInt(a,10):parseInt(a,10)):a}function W(c,d){var e=b.createElement("div");c&&(e.id=f+c),e.style.cssText=d||!1;return a(e)}var d={transition:"elastic",speed:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,fastIframe:!0,photo:!1,href:!1,title:!1,rel:!1,opacity:.9,preloading:!0,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:!1,returnFocus:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0},e="colorbox",f="cbox",g=f+"_open",h=f+"_load",i=f+"_complete",j=f+"_cleanup",k=f+"_closed",l=f+"_purge",m=a.browser.msie&&!a.support.opacity,n=m&&a.browser.version<7,o=f+"_IE6",p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J={},K,L,M,N,O,P,Q,R,S,T=!1,U,V=f+"Element";U=a.fn[e]=a[e]=function(b,c){var f=this,g;if(!f[0]&&f.selector)return f;b=b||{},c&&(b.onComplete=c);if(!f[0]||f.selector===undefined)f=a("<a/>"),b.open=!0;f.each(function(){a.data(this,e,a.extend({},a.data(this,e)||d,b)),a(this).addClass(V)}),g=b.open,a.isFunction(g)&&(g=g.call(f)),g&&ba(f[0]);return f},U.init=function(){y=a(c),q=W().attr({id:e,"class":m?f+(n?"IE6":"IE"):""}),p=W("Overlay",n?"position:absolute":"").hide(),r=W("Wrapper"),s=W("Content").append(z=W("LoadedContent","width:0; height:0; overflow:hidden"),B=W("LoadingOverlay").add(W("LoadingGraphic")),C=W("Title"),D=W("Current"),F=W("Next"),G=W("Previous"),E=W("Slideshow").bind(g,_),H=W("Close")),r.append(W().append(W("TopLeft"),t=W("TopCenter"),W("TopRight")),W(!1,"clear:left").append(u=W("MiddleLeft"),s,v=W("MiddleRight")),W(!1,"clear:left").append(W("BottomLeft"),w=W("BottomCenter"),W("BottomRight"))).children().children().css({"float":"left"}),A=W(!1,"position:absolute; width:9999px; visibility:hidden; display:none"),a("body").prepend(p,q.append(r,A)),s.children().hover(function(){a(this).addClass("hover")},function(){a(this).removeClass("hover")}).addClass("hover"),K=t.height()+w.height()+s.outerHeight(!0)-s.height(),L=u.width()+v.width()+s.outerWidth(!0)-s.width(),M=z.outerHeight(!0),N=z.outerWidth(!0),q.css({"padding-bottom":K,"padding-right":L}).hide(),F.click(function(){U.next()}),G.click(function(){U.prev()}),H.click(function(){U.close()}),I=F.add(G).add(D).add(E),s.children().removeClass("hover"),a("."+V).live("click",function(a){a.button!==0&&typeof a.button!="undefined"||a.ctrlKey||a.shiftKey||a.altKey||(a.preventDefault(),ba(this))}),p.click(function(){J.overlayClose&&U.close()}),a(b).bind("keydown."+f,function(a){var b=a.keyCode;R&&J.escKey&&b===27&&(a.preventDefault(),U.close()),R&&J.arrowKey&&x[1]&&(b===37?(a.preventDefault(),G.click()):b===39&&(a.preventDefault(),F.click()))})},U.remove=function(){q.add(p).remove(),a("."+V).die("click").removeData(e).removeClass(V)},U.position=function(a,c){function g(a){t[0].style.width=w[0].style.width=s[0].style.width=a.style.width,B[0].style.height=B[1].style.height=s[0].style.height=u[0].style.height=v[0].style.height=a.style.height}var d,e=Math.max(b.documentElement.clientHeight-J.h-M-K,0)/2+y.scrollTop(),f=Math.max(y.width()-J.w-N-L,0)/2+y.scrollLeft();d=q.width()===J.w+N&&q.height()===J.h+M?0:a,r[0].style.width=r[0].style.height="9999px",q.dequeue().animate({width:J.w+N,height:J.h+M,top:e,left:f},{duration:d,complete:function(){g(this),S=!1,r[0].style.width=J.w+N+L+"px",r[0].style.height=J.h+M+K+"px",c&&c()},step:function(){g(this)}})},U.resize=function(a){if(R){a=a||{},a.width&&(J.w=X(a.width,"x")-N-L),a.innerWidth&&(J.w=X(a.innerWidth,"x")),z.css({width:J.w}),a.height&&(J.h=X(a.height,"y")-M-K),a.innerHeight&&(J.h=X(a.innerHeight,"y"));if(!a.innerHeight&&!a.height){var b=z.wrapInner("<div style='overflow:auto'></div>").children();J.h=b.height(),b.replaceWith(b.children())}z.css({height:J.h}),U.position(J.transition==="none"?0:J.speed)}},U.prep=function(b){function h(b){U.position(b,function(){var b,d,g,h,j=x.length,k,n;!R||(n=function(){B.hide(),$(i,J.onComplete)},m&&Q&&z.fadeIn(100),C.html(J.title).add(z).show(),j>1?(typeof J.current=="string"&&D.html(J.current.replace(/\{current\}/,P+1).replace(/\{total\}/,j)).show(),F[J.loop||P<j-1?"show":"hide"]().html(J.next),G[J.loop||P?"show":"hide"]().html(J.previous),b=P?x[P-1]:x[j-1],g=P<j-1?x[P+1]:x[0],J.slideshow&&E.show(),J.preloading&&(h=a.data(g,e).href||g.href,d=a.data(b,e).href||b.href,h=a.isFunction(h)?h.call(g):h,d=a.isFunction(d)?d.call(b):d,Y(h)&&(a("<img/>")[0].src=h),Y(d)&&(a("<img/>")[0].src=d))):I.hide(),J.iframe?(k=a("<iframe/>").addClass(f+"Iframe")[0],J.fastIframe?n():a(k).load(n),k.name=f+ +(new Date),k.src=J.href,J.scrolling||(k.scrolling="no"),m&&(k.frameBorder=0,k.allowTransparency="true"),a(k).appendTo(z).one(l,function(){k.src="//about:blank"})):n(),J.transition==="fade"?q.fadeTo(c,1,function(){q[0].style.filter=""}):q[0].style.filter="",y.bind("resize."+f,function(){U.position(0)}))})}function g(){J.h=J.h||z.height(),J.h=J.mh&&J.mh<J.h?J.mh:J.h;return J.h}function d(){J.w=J.w||z.width(),J.w=J.mw&&J.mw<J.w?J.mw:J.w;return J.w}if(!!R){var c=J.transition==="none"?0:J.speed;y.unbind("resize."+f),z.remove(),z=W("LoadedContent").html(b),z.hide().appendTo(A.show()).css({width:d(),overflow:J.scrolling?"auto":"hidden"}).css({height:g()}).prependTo(s),A.hide(),a(Q).css({"float":"none"}),n&&a("select").not(q.find("select")).filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one(j,function(){this.style.visibility="inherit"}),J.transition==="fade"?q.fadeTo(c,0,function(){h(0)}):h(c)}},U.load=function(b){var c,d,g=U.prep;S=!0,Q=!1,O=x[P],b||Z(a.extend(J,a.data(O,e))),$(l),$(h,J.onLoad),J.h=J.height?X(J.height,"y")-M-K:J.innerHeight&&X(J.innerHeight,"y"),J.w=J.width?X(J.width,"x")-N-L:J.innerWidth&&X(J.innerWidth,"x"),J.mw=J.w,J.mh=J.h,J.maxWidth&&(J.mw=X(J.maxWidth,"x")-N-L,J.mw=J.w&&J.w<J.mw?J.w:J.mw),J.maxHeight&&(J.mh=X(J.maxHeight,"y")-M-K,J.mh=J.h&&J.h<J.mh?J.h:J.mh),c=J.href,B.show(),J.inline?(W().hide().insertBefore(a(c)[0]).one(l,function(){a(this).replaceWith(z.children())}),g(a(c))):J.iframe?g(" "):J.html?g(J.html):Y(c)?(a(Q=new Image).addClass(f+"Photo").error(function(){J.title=!1,g(W("Error").text("This image could not be loaded"))}).load(function(){var a;Q.onload=null,J.scalePhotos&&(d=function(){Q.height-=Q.height*a,Q.width-=Q.width*a},J.mw&&Q.width>J.mw&&(a=(Q.width-J.mw)/Q.width,d()),J.mh&&Q.height>J.mh&&(a=(Q.height-J.mh)/Q.height,d())),J.h&&(Q.style.marginTop=Math.max(J.h-Q.height,0)/2+"px"),x[1]&&(P<x.length-1||J.loop)&&(Q.style.cursor="pointer",Q.onclick=function(){U.next()}),m&&(Q.style.msInterpolationMode="bicubic"),setTimeout(function(){g(Q)},1)}),setTimeout(function(){Q.src=c},1)):c&&A.load(c,function(b,c,d){g(c==="error"?W("Error").text("Request unsuccessful: "+d.statusText):a(this).contents())})},U.next=function(){!S&&x[1]&&(P<x.length-1||J.loop)&&(P=P<x.length-1?P+1:0,U.load())},U.prev=function(){!S&&x[1]&&(P||J.loop)&&(P=P?P-1:x.length-1,U.load())},U.close=function(){R&&!T&&(T=!0,R=!1,$(j,J.onCleanup),y.unbind("."+f+" ."+o),p.fadeTo(200,0),q.stop().fadeTo(300,0,function(){q.add(p).css({opacity:1,cursor:"auto"}).hide(),$(l),z.remove(),setTimeout(function(){T=!1,$(k,J.onClosed)},1)}))},U.element=function(){return a(O)},U.settings=d,a(U.init)})(jQuery,document,this); \ No newline at end of file
diff --git a/javascript/libs/jquery/plugins/colorbox/jquery.colorbox.js b/javascript/libs/jquery/plugins/colorbox/jquery.colorbox.js
index c4b3aa7..30208ba 100755..100644
--- a/javascript/libs/jquery/plugins/colorbox/jquery.colorbox.js
+++ b/javascript/libs/jquery/plugins/colorbox/jquery.colorbox.js
@@ -1,29 +1,75 @@
-// ColorBox v1.3.7 - a full featured, light-weight, customizable lightbox based on jQuery 1.3
-// c) 2009 Jack Moore - www.colorpowered.com - jack@colorpowered.com
+// ColorBox v1.3.16 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
+// Copyright (c) 2011 Jack Moore - jack@colorpowered.com
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
-
-/*jslint browser: true */
-
-(function ($) {
- // Shortcuts (to increase compression)
- var colorbox = 'colorbox',
- hover = 'hover',
- TRUE = true,
- FALSE = false,
- cboxPublic,
- isIE = $.browser.msie && !$.support.opacity, // feature detection alone gave a false positive on at least one phone browser
+(function ($, document, window) {
+ var
+ // ColorBox Default Settings.
+ // See http://colorpowered.com/colorbox for details.
+ defaults = {
+ transition: "elastic",
+ speed: 300,
+ width: false,
+ initialWidth: "600",
+ innerWidth: false,
+ maxWidth: false,
+ height: false,
+ initialHeight: "450",
+ innerHeight: false,
+ maxHeight: false,
+ scalePhotos: true,
+ scrolling: true,
+ inline: false,
+ html: false,
+ iframe: false,
+ fastIframe: true,
+ photo: false,
+ href: false,
+ title: false,
+ rel: false,
+ opacity: 0.9,
+ preloading: true,
+ current: "image {current} of {total}",
+ previous: "previous",
+ next: "next",
+ close: "close",
+ open: false,
+ returnFocus: true,
+ loop: true,
+ slideshow: false,
+ slideshowAuto: true,
+ slideshowSpeed: 2500,
+ slideshowStart: "start slideshow",
+ slideshowStop: "stop slideshow",
+ onOpen: false,
+ onLoad: false,
+ onComplete: false,
+ onCleanup: false,
+ onClosed: false,
+ overlayClose: true,
+ escKey: true,
+ arrowKey: true
+ },
+
+ // Abstracting the HTML and event identifiers for easy rebranding
+ colorbox = 'colorbox',
+ prefix = 'cbox',
+
+ // Events
+ event_open = prefix + '_open',
+ event_load = prefix + '_load',
+ event_complete = prefix + '_complete',
+ event_cleanup = prefix + '_cleanup',
+ event_closed = prefix + '_closed',
+ event_purge = prefix + '_purge',
+
+ // Special Handling for IE
+ isIE = $.browser.msie && !$.support.opacity, // feature detection alone gave a false positive on at least one phone browser and on some development versions of Chrome.
isIE6 = isIE && $.browser.version < 7,
-
- // Event Strings (to increase compression)
- cbox_open = 'cbox_open',
- cbox_load = 'cbox_load',
- cbox_complete = 'cbox_complete',
- cbox_cleanup = 'cbox_cleanup',
- cbox_closed = 'cbox_closed',
+ event_ie6 = prefix + '_IE6',
// Cached jQuery Object Variables
$overlay,
- $cbox,
+ $box,
$wrap,
$content,
$topBorder,
@@ -41,158 +87,182 @@
$next,
$prev,
$close,
+ $groupControls,
// Variables for cached values or use across multiple functions
+ settings = {},
interfaceHeight,
interfaceWidth,
loadedHeight,
loadedWidth,
element,
- bookmark,
index,
- settings,
+ photo,
open,
active,
+ closing = false,
- // ColorBox Default Settings.
- // See http://colorpowered.com/colorbox for details.
- defaults = {
- transition: "elastic",
- speed: 350,
- width: FALSE,
- height: FALSE,
- innerWidth: FALSE,
- innerHeight: FALSE,
- initialWidth: "400",
- initialHeight: "400",
- maxWidth: FALSE,
- maxHeight: FALSE,
- scalePhotos: TRUE,
- scrolling: TRUE,
- inline: FALSE,
- html: FALSE,
- iframe: FALSE,
- photo: FALSE,
- href: FALSE,
- title: FALSE,
- rel: FALSE,
- opacity: 0.9,
- preloading: TRUE,
- current: "image {current} of {total}",
- previous: "previous",
- next: "next",
- close: "close",
- open: FALSE,
- overlayClose: TRUE,
- loop: TRUE,
-
- slideshow: FALSE,
- slideshowAuto: TRUE,
- slideshowSpeed: 2500,
- slideshowStart: "start slideshow",
- slideshowStop: "stop slideshow",
-
- onOpen: FALSE,
- onLoad: FALSE,
- onComplete: FALSE,
- onCleanup: FALSE,
- onClosed: FALSE,
-
- escKey: TRUE,
- arrowKey: TRUE
- };
+ publicMethod,
+ boxElement = prefix + 'Element';
// ****************
// HELPER FUNCTIONS
// ****************
-
+
+ // jQuery object generator to reduce code size
+ function $div(id, cssText) {
+ var div = document.createElement('div');
+ if (id) {
+ div.id = prefix + id;
+ }
+ div.style.cssText = cssText || false;
+ return $(div);
+ }
+
// Convert % values to pixels
function setSize(size, dimension) {
- dimension = dimension === 'x' ? $window.width() : $window.height();//document.documentElement.clientWidth : document.documentElement.clientHeight;
- return (typeof size === 'string') ? Math.round((size.match(/%/) ? (dimension / 100) * parseInt(size, 10) : parseInt(size, 10))) : size;
+ dimension = dimension === 'x' ? $window.width() : $window.height();
+ return (typeof size === 'string') ? Math.round((/%/.test(size) ? (dimension / 100) * parseInt(size, 10) : parseInt(size, 10))) : size;
}
-
+
// Checks an href to see if it is a photo.
// There is a force photo option (photo: true) for hrefs that cannot be matched by this regex.
function isImage(url) {
- url = $.isFunction(url) ? url.call(element) : url;
- return settings.photo || url.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i);
+ return settings.photo || /\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(url);
}
- // Assigns functions results to their respective settings. This allows functions to be used to set ColorBox options.
- function process() {
+ // Assigns function results to their respective settings. This allows functions to be used as values.
+ function process(settings) {
for (var i in settings) {
if ($.isFunction(settings[i]) && i.substring(0, 2) !== 'on') { // checks to make sure the function isn't one of the callbacks, they will be handled at the appropriate time.
settings[i] = settings[i].call(element);
}
}
settings.rel = settings.rel || element.rel || 'nofollow';
- settings.href = settings.href || $(element).attr('href');
+ settings.href = $.trim(settings.href || $(element).attr('href'));
settings.title = settings.title || element.title;
}
- function launch(elem) {
-
- element = elem;
-
- settings = $.extend({}, $(element).data(colorbox));
-
- process(); // Convert functions to their returned values.
+ function trigger(event, callback) {
+ if (callback) {
+ callback.call(element);
+ }
+ $.event.trigger(event);
+ }
+
+ // Slideshow functionality
+ function slideshow() {
+ var
+ timeOut,
+ className = prefix + "Slideshow_",
+ click = "click." + prefix,
+ start,
+ stop,
+ clear;
- if (settings.rel !== 'nofollow') {
- $related = $('.cboxElement').filter(function () {
- var relRelated = $(this).data(colorbox).rel || this.rel;
- return (relRelated === settings.rel);
- });
- index = $related.index(element);
+ if (settings.slideshow && $related[1]) {
+ start = function () {
+ $slideshow
+ .text(settings.slideshowStop)
+ .unbind(click)
+ .bind(event_complete, function () {
+ if (index < $related.length - 1 || settings.loop) {
+ timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
+ }
+ })
+ .bind(event_load, function () {
+ clearTimeout(timeOut);
+ })
+ .one(click + ' ' + event_cleanup, stop);
+ $box.removeClass(className + "off").addClass(className + "on");
+ timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
+ };
+
+ stop = function () {
+ clearTimeout(timeOut);
+ $slideshow
+ .text(settings.slideshowStart)
+ .unbind([event_complete, event_load, event_cleanup, click].join(' '))
+ .one(click, start);
+ $box.removeClass(className + "on").addClass(className + "off");
+ };
- // Check direct calls to ColorBox.
- if (index < 0) {
- $related = $related.add(element);
- index = $related.length - 1;
+ if (settings.slideshowAuto) {
+ start();
+ } else {
+ stop();
}
- } else {
- $related = $(element);
- index = 0;
}
-
- if (!open) {
- open = TRUE;
-
- active = TRUE; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
+ }
+
+ function launch(elem) {
+ if (!closing) {
- bookmark = element;
+ element = elem;
- try {
- bookmark.blur(); // Remove the focus from the calling element.
- }catch (e) {}
+ process($.extend(settings, $.data(element, colorbox)));
- $.event.trigger(cbox_open);
- if (settings.onOpen) {
- settings.onOpen.call(element);
- }
+ $related = $(element);
- $overlay.css({"opacity": parseFloat(settings.opacity), "cursor": settings.overlayClose ? "pointer" : "auto"}).show();
+ index = 0;
- // Opens inital empty ColorBox prior to content being loaded.
- settings.w = setSize(settings.initialWidth, 'x');
- settings.h = setSize(settings.initialHeight, 'y');
- cboxPublic.position(0);
+ if (settings.rel !== 'nofollow') {
+ $related = $('.' + boxElement).filter(function () {
+ var relRelated = $.data(this, colorbox).rel || this.rel;
+ return (relRelated === settings.rel);
+ });
+ index = $related.index(element);
+
+ // Check direct calls to ColorBox.
+ if (index === -1) {
+ $related = $related.add(element);
+ index = $related.length - 1;
+ }
+ }
- if (isIE6) {
- $window.bind('resize.cboxIE6 scroll.cboxIE6', function () {
- $overlay.css({width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft()});
- }).trigger("scroll.cboxIE6");
+ if (!open) {
+ open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
+
+ $box.show();
+
+ if (settings.returnFocus) {
+ try {
+ element.blur();
+ $(element).one(event_closed, function () {
+ try {
+ this.focus();
+ } catch (e) {
+ // do nothing
+ }
+ });
+ } catch (e) {
+ // do nothing
+ }
+ }
+
+ // +settings.opacity avoids a problem in IE when using non-zero-prefixed-string-values, like '.5'
+ $overlay.css({"opacity": +settings.opacity, "cursor": settings.overlayClose ? "pointer" : "auto"}).show();
+
+ // Opens inital empty ColorBox prior to content being loaded.
+ settings.w = setSize(settings.initialWidth, 'x');
+ settings.h = setSize(settings.initialHeight, 'y');
+ publicMethod.position(0);
+
+ if (isIE6) {
+ $window.bind('resize.' + event_ie6 + ' scroll.' + event_ie6, function () {
+ $overlay.css({width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft()});
+ }).trigger('resize.' + event_ie6);
+ }
+
+ trigger(event_open, settings.onOpen);
+
+ $groupControls.add($title).hide();
+
+ $close.html(settings.close).show();
}
+
+ publicMethod.load(true);
}
-
- $current.add($prev).add($next).add($slideshow).add($title).hide();
-
- $close.html(settings.close).show();
-
- cboxPublic.slideshow();
-
- cboxPublic.load();
}
// ****************
@@ -201,10 +271,10 @@
// Usage from within an iframe: parent.$.fn.colorbox.close();
// ****************
- cboxPublic = $.fn.colorbox = $.colorbox = function (options, callback) {
- var $this = this;
+ publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
+ var $this = this, autoOpen;
- if ($this.selector && !$this.length) {
+ if (!$this[0] && $this.selector) { // if a selector was given and it didn't match any elements, go ahead and exit.
return $this;
}
@@ -214,16 +284,23 @@
options.onComplete = callback;
}
- if (!$this.length || $this.selector === undefined) { // detects $.colorbox() and $.fn.colorbox()
+ if (!$this[0] || $this.selector === undefined) { // detects $.colorbox() and $.fn.colorbox()
$this = $('<a/>');
- options.open = TRUE; // assume an immediate open
+ options.open = true; // assume an immediate open
}
$this.each(function () {
- $(this).data(colorbox, $.extend({}, $(this).data(colorbox) || defaults, options)).addClass("cboxElement");
+ $.data(this, colorbox, $.extend({}, $.data(this, colorbox) || defaults, options));
+ $(this).addClass(boxElement);
});
- if (options.open) {
+ autoOpen = options.open;
+
+ if ($.isFunction(autoOpen)) {
+ autoOpen = autoOpen.call($this);
+ }
+
+ if (autoOpen) {
launch($this[0]);
}
@@ -233,109 +310,104 @@
// Initialize ColorBox: store common calculations, preload the interface graphics, append the html.
// This preps colorbox for a speedy open when clicked, and lightens the burdon on the browser by only
// having to run once, instead of each time colorbox is opened.
- cboxPublic.init = function () {
-
- // jQuery object generator to save a bit of space
- function $div(id) {
- return $('<div id="cbox' + id + '"/>');
- }
-
+ publicMethod.init = function () {
// Create & Append jQuery Objects
$window = $(window);
- $cbox = $('<div id="colorbox"/>');
- $overlay = $div("Overlay").hide();
+ $box = $div().attr({id: colorbox, 'class': isIE ? prefix + (isIE6 ? 'IE6' : 'IE') : ''});
+ $overlay = $div("Overlay", isIE6 ? 'position:absolute' : '').hide();
+
$wrap = $div("Wrapper");
$content = $div("Content").append(
- $loaded = $div("LoadedContent").css({width: 0, height: 0}),
+ $loaded = $div("LoadedContent", 'width:0; height:0; overflow:hidden'),
$loadingOverlay = $div("LoadingOverlay").add($div("LoadingGraphic")),
$title = $div("Title"),
$current = $div("Current"),
$next = $div("Next"),
$prev = $div("Previous"),
- $slideshow = $div("Slideshow"),
+ $slideshow = $div("Slideshow").bind(event_open, slideshow),
$close = $div("Close")
);
$wrap.append( // The 3x3 Grid that makes up ColorBox
- $('<div/>').append(
+ $div().append(
$div("TopLeft"),
$topBorder = $div("TopCenter"),
$div("TopRight")
),
- $('<div/>').append(
+ $div(false, 'clear:left').append(
$leftBorder = $div("MiddleLeft"),
$content,
$rightBorder = $div("MiddleRight")
),
- $('<div/>').append(
+ $div(false, 'clear:left').append(
$div("BottomLeft"),
$bottomBorder = $div("BottomCenter"),
$div("BottomRight")
)
).children().children().css({'float': 'left'});
- $loadingBay = $("<div id='cboxLoadingBay' style='position:absolute; width:9999px;'/>");
+ $loadingBay = $div(false, 'position:absolute; width:9999px; visibility:hidden; display:none');
- $('body').prepend($overlay, $cbox.append($wrap, $loadingBay));
-
- if (isIE) {
- $cbox.addClass('cboxIE');
- if (isIE6) {
- $overlay.css('position', 'absolute');
- }
- }
+ $('body').prepend($overlay, $box.append($wrap, $loadingBay));
$content.children()
.hover(function () {
- $(this).addClass(hover);
+ $(this).addClass('hover');
}, function () {
- $(this).removeClass(hover);
- }).addClass(hover);
+ $(this).removeClass('hover');
+ }).addClass('hover');
// Cache values needed for size calculations
- interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(TRUE) - $content.height();//Subtraction needed for IE6
- interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(TRUE) - $content.width();
- loadedHeight = $loaded.outerHeight(TRUE);
- loadedWidth = $loaded.outerWidth(TRUE);
+ interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();//Subtraction needed for IE6
+ interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
+ loadedHeight = $loaded.outerHeight(true);
+ loadedWidth = $loaded.outerWidth(true);
// Setting padding to remove the need to do size conversions during the animation step.
- $cbox.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth}).hide();
+ $box.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth}).hide();
- // Setup button events.
- $next.click(cboxPublic.next);
- $prev.click(cboxPublic.prev);
- $close.click(cboxPublic.close);
+ // Setup button events.
+ $next.click(function () {
+ publicMethod.next();
+ });
+ $prev.click(function () {
+ publicMethod.prev();
+ });
+ $close.click(function () {
+ publicMethod.close();
+ });
+
+ $groupControls = $next.add($prev).add($current).add($slideshow);
// Adding the 'hover' class allowed the browser to load the hover-state
// background graphics. The class can now can be removed.
- $content.children().removeClass(hover);
+ $content.children().removeClass('hover');
- $('.cboxElement').live('click', function (e) {
+ $('.' + boxElement).live('click', function (e) {
// checks to see if it was a non-left mouse-click and for clicks modified with ctrl, shift, or alt.
- if ((e.button !== 0 && typeof e.button !== 'undefined') || e.ctrlKey || e.shiftKey || e.altKey) {
- return TRUE;
- } else {
- launch(this);
- return FALSE;
+ if (!((e.button !== 0 && typeof e.button !== 'undefined') || e.ctrlKey || e.shiftKey || e.altKey)) {
+ e.preventDefault();
+ launch(this);
}
});
$overlay.click(function () {
if (settings.overlayClose) {
- cboxPublic.close();
+ publicMethod.close();
}
});
// Set Navigation Key Bindings
- $(document).bind("keydown", function (e) {
- if (open && settings.escKey && e.keyCode === 27) {
+ $(document).bind('keydown.' + prefix, function (e) {
+ var key = e.keyCode;
+ if (open && settings.escKey && key === 27) {
e.preventDefault();
- cboxPublic.close();
+ publicMethod.close();
}
- if (open && settings.arrowKey && !active && $related.length > 1) {
- if (e.keyCode === 37 && (index > 0 || settings.loop)) {
+ if (open && settings.arrowKey && $related[1]) {
+ if (key === 37) {
e.preventDefault();
$prev.click();
- } else if (e.keyCode === 39 && (index < $related.length - 1 || settings.loop)) {
+ } else if (key === 39) {
e.preventDefault();
$next.click();
}
@@ -343,20 +415,20 @@
});
};
- cboxPublic.remove = function () {
- $cbox.add($overlay).remove();
- $('.cboxElement').removeData(colorbox).removeClass('cboxElement');
+ publicMethod.remove = function () {
+ $box.add($overlay).remove();
+ $('.' + boxElement).die('click').removeData(colorbox).removeClass(boxElement);
};
- cboxPublic.position = function (speed, loadedCallback) {
+ publicMethod.position = function (speed, loadedCallback) {
var
animate_speed,
// keeps the top and left positions within the browser's viewport.
- posTop = Math.max($window.height() - settings.h - loadedHeight - interfaceHeight, 0) / 2 + $window.scrollTop(),
+ posTop = Math.max(document.documentElement.clientHeight - settings.h - loadedHeight - interfaceHeight, 0) / 2 + $window.scrollTop(),
posLeft = Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2 + $window.scrollLeft();
// setting the speed to 0 to reduce the delay between same-sized content.
- animate_speed = ($cbox.width() === settings.w + loadedWidth && $cbox.height() === settings.h + loadedHeight) ? 0 : speed;
+ animate_speed = ($box.width() === settings.w + loadedWidth && $box.height() === settings.h + loadedHeight) ? 0 : speed;
// this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
// but it has to be shrank down around the size of div#colorbox when it's done. If not,
@@ -369,12 +441,12 @@
$loadingOverlay[0].style.height = $loadingOverlay[1].style.height = $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = that.style.height;
}
- $cbox.dequeue().animate({width: settings.w + loadedWidth, height: settings.h + loadedHeight, top: posTop, left: posLeft}, {
+ $box.dequeue().animate({width: settings.w + loadedWidth, height: settings.h + loadedHeight, top: posTop, left: posLeft}, {
duration: animate_speed,
complete: function () {
modalDimensions(this);
- active = FALSE;
+ active = false;
// shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
$wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
@@ -390,7 +462,7 @@
});
};
- cboxPublic.resize = function (options) {
+ publicMethod.resize = function (options) {
if (open) {
options = options || {};
@@ -415,22 +487,20 @@
}
$loaded.css({height: settings.h});
- cboxPublic.position(settings.transition === "none" ? 0 : settings.speed);
+ publicMethod.position(settings.transition === "none" ? 0 : settings.speed);
}
};
- cboxPublic.prep = function (object) {
+ publicMethod.prep = function (object) {
if (!open) {
return;
}
- var photo,
- speed = settings.transition === "none" ? 0 : settings.speed;
-
- $window.unbind('resize.cbox');
+ var speed = settings.transition === "none" ? 0 : settings.speed;
+ $window.unbind('resize.' + prefix);
$loaded.remove();
- $loaded = $('<div id="cboxLoadedContent"/>').html(object);
+ $loaded = $div('LoadedContent').html(object);
function getWidth() {
settings.w = settings.w || $loaded.width();
@@ -444,36 +514,40 @@
}
$loaded.hide()
- .appendTo($loadingBay)// content has to be appended to the DOM for accurate size calculations.
+ .appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
.css({width: getWidth(), overflow: settings.scrolling ? 'auto' : 'hidden'})
.css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
.prependTo($content);
- $('#cboxPhoto').css({cssFloat: 'none'});// floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width.
+ $loadingBay.hide();
+
+ // floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width.
+ //$(photo).css({'float': 'none', marginLeft: 'auto', marginRight: 'auto'});
+ $(photo).css({'float': 'none'});
+
// Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay.
if (isIE6) {
- $('select:not(#colorbox select)').filter(function () {
+ $('select').not($box.find('select')).filter(function () {
return this.style.visibility !== 'hidden';
- }).css({'visibility': 'hidden'}).one(cbox_cleanup, function () {
+ }).css({'visibility': 'hidden'}).one(event_cleanup, function () {
this.style.visibility = 'inherit';
});
}
-
+
function setPosition(s) {
- var prev, prevSrc, next, nextSrc, total = $related.length, loop = settings.loop;
- cboxPublic.position(s, function () {
- function defilter() {
- if (isIE) {
- //IE adds a filter when ColorBox fades in and out that can cause problems if the loaded content contains transparent pngs.
- $cbox[0].style.removeAttribute("filter");
- }
- }
+ publicMethod.position(s, function () {
+ var prev, prevSrc, next, nextSrc, total = $related.length, iframe, complete;
if (!open) {
return;
}
+ complete = function () {
+ $loadingOverlay.hide();
+ trigger(event_complete, settings.onComplete);
+ };
+
if (isIE) {
//This fadeIn helps the bicubic resampling to kick-in.
if (photo) {
@@ -481,38 +555,30 @@
}
}
- //Waited until the iframe is added to the DOM & it is visible before setting the src.
- //This increases compatability with pages using DOM dependent JavaScript.
- if (settings.iframe) {
- $("<iframe frameborder=0" + (settings.scrolling ? "" : " scrolling='no'") + (isIE ? " allowtransparency='true'" : '') + "/>")
- .appendTo($loaded)
- .attr({src: settings.href, id: 'cboxIframe', name: new Date().getTime()});
- }
-
- $loaded.show();
-
- $title.show().html(settings.title);
+ $title.html(settings.title).add($loaded).show();
if (total > 1) { // handle grouping
- $current.html(settings.current.replace(/\{current\}/, index + 1).replace(/\{total\}/, total)).show();
+ if (typeof settings.current === "string") {
+ $current.html(settings.current.replace(/\{current\}/, index + 1).replace(/\{total\}/, total)).show();
+ }
- $next[(loop || index < total - 1) ? "show" : "hide"]().html(settings.next);
- $prev[(loop || index > 0) ? "show" : "hide"]().html(settings.previous);
+ $next[(settings.loop || index < total - 1) ? "show" : "hide"]().html(settings.next);
+ $prev[(settings.loop || index) ? "show" : "hide"]().html(settings.previous);
- prev = index > 0 ? $related[index - 1] : $related[total - 1];
+ prev = index ? $related[index - 1] : $related[total - 1];
next = index < total - 1 ? $related[index + 1] : $related[0];
if (settings.slideshow) {
$slideshow.show();
- if (index === total - 1 && !loop && $cbox.is('.cboxSlideshow_on')) {
- $slideshow.click();
- }
}
// Preloads images within a rel group
if (settings.preloading) {
- nextSrc = $(next).data(colorbox).href || next.href;
- prevSrc = $(prev).data(colorbox).href || prev.href;
+ nextSrc = $.data(next, colorbox).href || next.href;
+ prevSrc = $.data(prev, colorbox).href || prev.href;
+
+ nextSrc = $.isFunction(nextSrc) ? nextSrc.call(next) : nextSrc;
+ prevSrc = $.isFunction(prevSrc) ? prevSrc.call(prev) : prevSrc;
if (isImage(nextSrc)) {
$('<img/>')[0].src = nextSrc;
@@ -522,31 +588,53 @@
$('<img/>')[0].src = prevSrc;
}
}
+ } else {
+ $groupControls.hide();
}
- $loadingOverlay.hide();
+ if (settings.iframe) {
+ iframe = $('<iframe/>').addClass(prefix + 'Iframe')[0];
+
+ if (settings.fastIframe) {
+ complete();
+ } else {
+ $(iframe).load(complete);
+ }
+ iframe.name = prefix + (+new Date());
+ iframe.src = settings.href;
+
+ if (!settings.scrolling) {
+ iframe.scrolling = "no";
+ }
+
+ if (isIE) {
+ iframe.frameBorder=0;
+ iframe.allowTransparency = "true";
+ }
+
+ $(iframe).appendTo($loaded).one(event_purge, function () {
+ iframe.src = "//about:blank";
+ });
+ } else {
+ complete();
+ }
if (settings.transition === 'fade') {
- $cbox.fadeTo(speed, 1, function () {
- defilter();
+ $box.fadeTo(speed, 1, function () {
+ $box[0].style.filter = "";
});
} else {
- defilter();
+ $box[0].style.filter = "";
}
- $window.bind('resize.cbox', function () {
- cboxPublic.position(0);
+ $window.bind('resize.' + prefix, function () {
+ publicMethod.position(0);
});
-
- $.event.trigger(cbox_complete);
- if (settings.onComplete) {
- settings.onComplete.call(element);
- }
});
}
if (settings.transition === 'fade') {
- $cbox.fadeTo(speed, 0, function () {
+ $box.fadeTo(speed, 0, function () {
setPosition(0);
});
} else {
@@ -554,34 +642,30 @@
}
};
- cboxPublic.load = function () {
- var href, img, setResize, prep = cboxPublic.prep;
+ publicMethod.load = function (launched) {
+ var href, setResize, prep = publicMethod.prep;
- active = TRUE;
+ active = true;
+
+ photo = false;
element = $related[index];
- settings = $.extend({}, $(element).data(colorbox));
+ if (!launched) {
+ process($.extend(settings, $.data(element, colorbox)));
+ }
- //convert functions to static values
- process();
+ trigger(event_purge);
- $.event.trigger(cbox_load);
- if (settings.onLoad) {
- settings.onLoad.call(element);
- }
+ trigger(event_load, settings.onLoad);
- // Evaluate the height based on the optional height and width settings.
settings.h = settings.height ?
setSize(settings.height, 'y') - loadedHeight - interfaceHeight :
- settings.innerHeight ?
- setSize(settings.innerHeight, 'y') :
- FALSE;
+ settings.innerHeight && setSize(settings.innerHeight, 'y');
+
settings.w = settings.width ?
setSize(settings.width, 'x') - loadedWidth - interfaceWidth :
- settings.innerWidth ?
- setSize(settings.innerWidth, 'x') :
- FALSE;
+ settings.innerWidth && setSize(settings.innerWidth, 'x');
// Sets the minimum dimensions for use in image scaling
settings.mw = settings.w;
@@ -601,11 +685,11 @@
href = settings.href;
$loadingOverlay.show();
-
+
if (settings.inline) {
// Inserts an empty placeholder where inline content is being pulled from.
// An event is bound to put inline content back when ColorBox closes or loads new content.
- $('<div id="cboxInlineTemp"/>').hide().insertBefore($(href)[0]).bind(cbox_load + ' ' + cbox_cleanup, function () {
+ $div().hide().insertBefore($(href)[0]).one(event_purge, function () {
$(this).replaceWith($loaded.children());
});
prep($(href));
@@ -616,143 +700,101 @@
} else if (settings.html) {
prep(settings.html);
} else if (isImage(href)) {
- img = new Image();
- img.onload = function () {
+ $(photo = new Image())
+ .addClass(prefix + 'Photo')
+ .error(function () {
+ settings.title = false;
+ prep($div('Error').text('This image could not be loaded'));
+ })
+ .load(function () {
var percent;
-
- img.onload = null;
- img.id = 'cboxPhoto';
- $(img).css({margin: 'auto', border: 'none', display: 'block', cssFloat: 'left'});
+ photo.onload = null; //stops animated gifs from firing the onload repeatedly.
if (settings.scalePhotos) {
setResize = function () {
- img.height -= img.height * percent;
- img.width -= img.width * percent;
+ photo.height -= photo.height * percent;
+ photo.width -= photo.width * percent;
};
- if (settings.mw && img.width > settings.mw) {
- percent = (img.width - settings.mw) / img.width;
+ if (settings.mw && photo.width > settings.mw) {
+ percent = (photo.width - settings.mw) / photo.width;
setResize();
}
- if (settings.mh && img.height > settings.mh) {
- percent = (img.height - settings.mh) / img.height;
+ if (settings.mh && photo.height > settings.mh) {
+ percent = (photo.height - settings.mh) / photo.height;
setResize();
}
}
if (settings.h) {
- img.style.marginTop = Math.max(settings.h - img.height, 0) / 2 + 'px';
+ photo.style.marginTop = Math.max(settings.h - photo.height, 0) / 2 + 'px';
}
- prep(img);
-
- if ($related.length > 1) {
- $(img).css({cursor: 'pointer'}).click(cboxPublic.next);
+ if ($related[1] && (index < $related.length - 1 || settings.loop)) {
+ photo.style.cursor = 'pointer';
+ photo.onclick = function () {
+ publicMethod.next();
+ };
}
if (isIE) {
- img.style.msInterpolationMode = 'bicubic';
+ photo.style.msInterpolationMode = 'bicubic';
}
- };
- img.src = href;
- } else {
- $('<div>Request unsuccessful.</div>').appendTo($loadingBay).load(href, function (data, textStatus) {
- prep(this);
+
+ setTimeout(function () { // A pause because Chrome will sometimes report a 0 by 0 size otherwise.
+ prep(photo);
+ }, 1);
+ });
+
+ setTimeout(function () { // A pause because Opera 10.6+ will sometimes not run the onload function otherwise.
+ photo.src = href;
+ }, 1);
+ } else if (href) {
+ $loadingBay.load(href, function (data, status, xhr) {
+ prep(status === 'error' ? $div('Error').text('Request unsuccessful: ' + xhr.statusText) : $(this).contents());
});
}
};
-
+
// Navigates to the next page/image in a set.
- cboxPublic.next = function () {
- if (!active) {
+ publicMethod.next = function () {
+ if (!active && $related[1] && (index < $related.length - 1 || settings.loop)) {
index = index < $related.length - 1 ? index + 1 : 0;
- cboxPublic.load();
+ publicMethod.load();
}
};
- cboxPublic.prev = function () {
- if (!active) {
- index = index > 0 ? index - 1 : $related.length - 1;
- cboxPublic.load();
- }
- };
-
- cboxPublic.slideshow = function () {
- var stop, timeOut, className = 'cboxSlideshow_';
-
- $slideshow.bind(cbox_closed, function () {
- $slideshow.unbind();
- clearTimeout(timeOut);
- $cbox.removeClass(className + "off " + className + "on");
- });
-
- function start() {
- $slideshow
- .text(settings.slideshowStop)
- .bind(cbox_complete, function () {
- timeOut = setTimeout(cboxPublic.next, settings.slideshowSpeed);
- })
- .bind(cbox_load, function () {
- clearTimeout(timeOut);
- }).one("click", function () {
- stop();
- });
- $cbox.removeClass(className + "off").addClass(className + "on");
- }
-
- stop = function () {
- clearTimeout(timeOut);
- $slideshow
- .text(settings.slideshowStart)
- .unbind(cbox_complete + ' ' + cbox_load)
- .one("click", function () {
- start();
- timeOut = setTimeout(cboxPublic.next, settings.slideshowSpeed);
- });
- $cbox.removeClass(className + "on").addClass(className + "off");
- };
-
- if (settings.slideshow && $related.length > 1) {
- if (settings.slideshowAuto) {
- start();
- } else {
- stop();
- }
+ publicMethod.prev = function () {
+ if (!active && $related[1] && (index || settings.loop)) {
+ index = index ? index - 1 : $related.length - 1;
+ publicMethod.load();
}
};
// Note: to use this within an iframe use the following format: parent.$.fn.colorbox.close();
- cboxPublic.close = function () {
- if (open) {
- open = FALSE;
+ publicMethod.close = function () {
+ if (open && !closing) {
- $.event.trigger(cbox_cleanup);
+ closing = true;
- if (settings.onCleanup) {
- settings.onCleanup.call(element);
- }
+ open = false;
- $window.unbind('.cbox .cboxIE6');
+ trigger(event_cleanup, settings.onCleanup);
- $cbox.add($overlay)
- .stop()
- .fadeTo('fast', 0, function () {
- $('#colorbox iframe').attr('src', 'about:blank'); // change the location of the iframe to avoid a problem in IE with flash objects not clearing.
-
- $loaded.remove();
+ $window.unbind('.' + prefix + ' .' + event_ie6);
+
+ $overlay.fadeTo(200, 0);
+
+ $box.stop().fadeTo(300, 0, function () {
+
+ $box.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide();
- $cbox.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide();
+ trigger(event_purge);
- try {
- bookmark.focus();
- } catch (e) {
- // do nothing
- }
+ $loaded.remove();
setTimeout(function () {
- $.event.trigger(cbox_closed);
- if (settings.onClosed) {
- settings.onClosed.call(element);
- }
+ closing = false;
+ trigger(event_closed, settings.onClosed);
}, 1);
});
}
@@ -760,13 +802,13 @@
// A method for fetching the current element ColorBox is referencing.
// returns a jQuery object.
- cboxPublic.element = function () {
+ publicMethod.element = function () {
return $(element);
};
- cboxPublic.settings = defaults;
+ publicMethod.settings = defaults;
// Initializes ColorBox when the DOM has loaded
- $(cboxPublic.init);
+ $(publicMethod.init);
-}(jQuery));
+}(jQuery, document, this)); \ No newline at end of file