diff --git a/README b/README index fe69e7f..7f7c17f 100644 --- a/README +++ b/README @@ -11,6 +11,11 @@ http://groups.google.com/group/colorbox/topics RELEASE NOTES: ---------------------------------------------------------------------------------------------------------- +Version 1.3.6 - Jan 13 2010 +Files Changed: jquery.colorbox.js/jquery.colorbox-min.js +* Small change to make Colorbox compatible with jQuery 1.4 + + Version 1.3.5 - December 15 2009 Files Changed: jquery.colorbox.js/jquery.colorbox-min.js * Fixed a bug introduced in 1.3.4 with IE7's display of example 2 and example 3, and auto-width in Opera. @@ -18,6 +23,7 @@ Files Changed: jquery.colorbox.js/jquery.colorbox-min.js event through JavaScript. * Minor refinements. + Version 1.3.4 - December 5 2009 Files Changed: jquery.colorbox.js/jquery.colorbox-min.js * Event delegation is now used for elements that ColorBox is assigned to, rather than individual click events. diff --git a/colorbox/jquery.colorbox-min.js b/colorbox/jquery.colorbox-min.js index e8269a3..0e5a539 100644 --- a/colorbox/jquery.colorbox-min.js +++ b/colorbox/jquery.colorbox-min.js @@ -1,2 +1,2 @@ -/* ColorBox v1.3.5b - a full featured, light-weight, customizable lightbox based on jQuery 1.3 */ -(function(c){function r(b,d){d=d==="x"?m.width():m.height();return typeof b==="string"?Math.round(b.match(/%/)?d/100*parseInt(b,10):parseInt(b,10)):b}function N(b){b=c.isFunction(b)?b.call(i):b;return a.photo||b.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i)}function Z(){for(var b in a)if(c.isFunction(a[b])&&b.substring(0,2)!=="on")a[b]=a[b].call(i)}function $(b){i=b;a=c(i).data(q);Z();var d=a.rel||i.rel;if(d&&d!=="nofollow"){h=c(".cboxElement").filter(function(){return(c(this).data(q).rel|| this.rel)===d});j=h.index(i);if(j<0){h=h.add(i);j=h.length-1}}else{h=c(i);j=0}if(!B){C=B=n;O=i;O.blur();c().bind("keydown.cbox_close",function(e){if(e.keyCode===27){e.preventDefault();f.close()}}).bind("keydown.cbox_arrows",function(e){if(h.length>1)if(e.keyCode===37){e.preventDefault();D.click()}else if(e.keyCode===39){e.preventDefault();E.click()}});a.overlayClose&&s.css({cursor:"pointer"}).one("click",f.close);c.event.trigger(aa);a.onOpen&&a.onOpen.call(i);s.css({opacity:a.opacity}).show();a.w= r(a.initialWidth,"x");a.h=r(a.initialHeight,"y");f.position(0);P&&m.bind("resize.cboxie6 scroll.cboxie6",function(){s.css({width:m.width(),height:m.height(),top:m.scrollTop(),left:m.scrollLeft()})}).trigger("scroll.cboxie6")}Q.add(D).add(E).add(t).add(H).hide();R.html(a.close).show();f.slideshow();f.load()}var q="colorbox",F="hover",n=true,f,x=!c.support.opacity,P=x&&!window.XMLHttpRequest,aa="cbox_open",I="cbox_load",S="cbox_complete",T="resize.cbox_resize",s,k,u,p,U,V,W,X,h,m,l,J,K,L,H,Q,t,E,D, R,y,z,v,w,i,O,j,a,B,C,Y={transition:"elastic",speed:350,width:false,height:false,innerWidth:false,innerHeight:false,initialWidth:"400",initialHeight:"400",maxWidth:false,maxHeight:false,scalePhotos:n,scrolling:n,inline:false,html:false,iframe:false,photo:false,href:false,title:false,rel:false,opacity:0.9,preloading:n,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:false,overlayClose:n,slideshow:false,slideshowAuto:n,slideshowSpeed:2500,slideshowStart:"start slideshow", slideshowStop:"stop slideshow",onOpen:false,onLoad:false,onComplete:false,onCleanup:false,onClosed:false};f=c.fn.colorbox=function(b,d){var e=this;if(!e.length)if(e.selector===""){e=c(e).data(q,Y);b.open=n}else return this;e.each(function(){var g=c.extend({},c(this).data(q)?c(this).data(q):Y,b);c(this).data(q,g).addClass("cboxElement");if(d)c(this).data(q).onComplete=d});b&&b.open&&$(e);return this};f.init=function(){function b(d){return c('
')}m=c(window);k=c('
'); s=b("Overlay").hide();u=b("Wrapper");p=b("Content").append(l=b("LoadedContent").css({width:0,height:0}),K=b("LoadingOverlay"),L=b("LoadingGraphic"),H=b("Title"),Q=b("Current"),t=b("Slideshow"),E=b("Next"),D=b("Previous"),R=b("Close"));u.append(c("
").append(b("TopLeft"),U=b("TopCenter"),b("TopRight")),c("
").append(V=b("MiddleLeft"),p,W=b("MiddleRight")),c("
").append(b("BottomLeft"),X=b("BottomCenter"),b("BottomRight"))).children().children().css({"float":"left"});J=c("
"); c("body").prepend(s,k.append(u,J));if(x){k.addClass("cboxIE");P&&s.css("position","absolute")}p.children().bind("mouseover mouseout",function(){c(this).toggleClass(F)}).addClass(F);y=U.height()+X.height()+p.outerHeight(n)-p.height();z=V.width()+W.width()+p.outerWidth(n)-p.width();v=l.outerHeight(n);w=l.outerWidth(n);k.css({"padding-bottom":y,"padding-right":z}).hide();E.click(f.next);D.click(f.prev);R.click(f.close);p.children().removeClass(F);c(".cboxElement").live("click",function(d){if(d.button!== 0&&typeof d.button!=="undefined")return n;else{$(this);return false}})};f.position=function(b,d){function e(A){U[0].style.width=X[0].style.width=p[0].style.width=A.style.width;L[0].style.height=K[0].style.height=p[0].style.height=V[0].style.height=W[0].style.height=A.style.height}var g=m.height();g=Math.max(g-a.h-v-y,0)/2+m.scrollTop();var o=Math.max(document.documentElement.clientWidth-a.w-w-z,0)/2+m.scrollLeft();b=k.width()===a.w+w&&k.height()===a.h+v?0:b;u[0].style.width=u[0].style.height="9999px"; k.dequeue().animate({width:a.w+w,height:a.h+v,top:g,left:o},{duration:b,complete:function(){e(this);C=false;u[0].style.width=a.w+w+z+"px";u[0].style.height=a.h+v+y+"px";d&&d()},step:function(){e(this)}})};f.resize=function(b){function d(){a.w=a.w||l.width();a.w=a.mw&&a.mw");l.show();H.html(a.title||i.title);H.show();if(h.length>1){Q.html(a.current.replace(/\{current\}/,j+1).replace(/\{total\}/,h.length)).show();E.html(a.next).show();D.html(a.previous).show();a.slideshow&&t.show()}K.hide();L.hide();c.event.trigger(S);a.onComplete&&a.onComplete.call(i);a.transition==="fade"&&k.fadeTo(M,1,function(){x&&k[0].style.removeAttribute("filter")}); m.bind(T,function(){f.position(0)})}})}if(B){var o,A,M=a.transition==="none"?0:a.speed;m.unbind(T);if(b){l.remove();l=c('
').html(b);l.hide().appendTo(J).css({width:d(),overflow:a.scrolling?"auto":"hidden"}).css({height:e()}).prependTo(p);c("#cboxPhoto").css({cssFloat:"none"});P&&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(M,0,function(){g(0)})||g(M);if(a.preloading&&h.length>1){b=j>0?h[j-1]:h[h.length-1];o=j").attr("src",o);N(b)&&c("").attr("src",b)}}else setTimeout(function(){var G=l.wrapInner("
").children();a.h=G.height();l.css({height:a.h});G.replaceWith(G.children());f.position(M)},1)}};f.load=function(){var b,d,e,g=f.resize;C=n;i=h[j];a=c(i).data(q);Z();c.event.trigger(I); a.onLoad&&a.onLoad.call(i);a.h=a.height?r(a.height,"y")-v-y:a.innerHeight?r(a.innerHeight,"y"):false;a.w=a.width?r(a.width,"x")-w-z:a.innerWidth?r(a.innerWidth,"x"):false;a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=r(a.maxWidth,"x")-w-z;a.mw=a.w&&a.w').hide().insertBefore(c(b)[0]).bind(I+" cbox_cleanup",function(){c(this).replaceWith(l.children())}); g(c(b))}else if(a.iframe)g(" ");else if(a.html)g(a.html);else if(N(b)){d=new Image;d.onload=function(){var o;d.onload=null;d.id="cboxPhoto";c(d).css({margin:"auto",border:"none",display:"block",cssFloat:"left"});if(a.scalePhotos){e=function(){d.height-=d.height*o;d.width-=d.width*o};if(a.mw&&d.width>a.mw){o=(d.width-a.mw)/d.width;e()}if(a.mh&&d.height>a.mh){o=(d.height-a.mh)/d.height;e()}}if(a.h)d.style.marginTop=Math.max(a.h-d.height,0)/2+"px";g(d);h.length>1&&c(d).css({cursor:"pointer"}).click(f.next); if(x)d.style.msInterpolationMode="bicubic"};d.src=b}else c("
").appendTo(J).load(b,function(o,A){A==="success"?g(this):g(c("

Request unsuccessful.

"))})};f.next=function(){if(!C){j=j0?j-1:h.length-1;f.load()}};f.slideshow=function(){function b(){t.text(a.slideshowStop).bind(S,function(){e=setTimeout(f.next,a.slideshowSpeed)}).bind(I,function(){clearTimeout(e)}).one("click",function(){d();c(this).removeClass(F)});k.removeClass(g+ "off").addClass(g+"on")}var d,e,g="cboxSlideshow_";t.bind("cbox_closed",function(){t.unbind();clearTimeout(e);k.removeClass(g+"off "+g+"on")});d=function(){clearTimeout(e);t.text(a.slideshowStart).unbind(S+" "+I).one("click",function(){b();e=setTimeout(f.next,a.slideshowSpeed);c(this).removeClass(F)});k.removeClass(g+"on").addClass(g+"off")};if(a.slideshow&&h.length>1)a.slideshowAuto?b():d()};f.close=function(){c.event.trigger("cbox_cleanup");a.onCleanup&&a.onCleanup.call(i);B=false;c().unbind("keydown.cbox_close keydown.cbox_arrows"); m.unbind(T+" resize.cboxie6 scroll.cboxie6");s.css({cursor:"auto"}).fadeOut("fast");k.stop(n,false).fadeOut("fast",function(){c("#colorbox iframe").attr("src","about:blank");l.remove();k.css({opacity:1});try{O.focus()}catch(b){}c.event.trigger("cbox_closed");a.onClosed&&a.onClosed.call(i)})};f.element=function(){return c(i)};f.settings=Y;c(f.init)})(jQuery); \ No newline at end of file +/* ColorBox v1.3.6 - a full featured, light-weight, customizable lightbox based on jQuery 1.3 */ +(function(c){function r(b,d){d=d==="x"?m.width():m.height();return typeof b==="string"?Math.round(b.match(/%/)?d/100*parseInt(b,10):parseInt(b,10)):b}function M(b){b=c.isFunction(b)?b.call(i):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(i);a.rel=a.rel||i.rel;a.href=a.href||i.href;a.title=a.title||i.title}function Z(b){i=b;a=c(i).data(q);Y();if(a.rel&&a.rel!=="nofollow"){g= c(".cboxElement").filter(function(){return(c(this).data(q).rel||this.rel)===a.rel});j=g.index(i);if(j<0){g=g.add(i);j=g.length-1}}else{g=c(i);j=0}if(!B){C=B=n;N=i;N.blur();c(document).bind("keydown.cbox_close",function(d){if(d.keyCode===27){d.preventDefault();e.close()}}).bind("keydown.cbox_arrows",function(d){if(g.length>1)if(d.keyCode===37){d.preventDefault();D.click()}else if(d.keyCode===39){d.preventDefault();E.click()}});a.overlayClose&&s.css({cursor:"pointer"}).one("click",e.close);c.event.trigger(aa); a.onOpen&&a.onOpen.call(i);s.css({opacity:a.opacity}).show();a.w=r(a.initialWidth,"x");a.h=r(a.initialHeight,"y");e.position(0);O&&m.bind("resize.cboxie6 scroll.cboxie6",function(){s.css({width:m.width(),height:m.height(),top:m.scrollTop(),left:m.scrollLeft()})}).trigger("scroll.cboxie6")}P.add(D).add(E).add(t).add(Q).hide();R.html(a.close).show();e.slideshow();e.load()}var q="colorbox",F="hover",n=true,e,x=c.browser.msie&&!c.support.opacity,O=x&&c.browser.version<7,aa="cbox_open",H="cbox_load",S= "cbox_complete",T="resize.cbox_resize",s,k,u,p,U,V,W,X,g,m,l,I,J,K,Q,P,t,E,D,R,y,z,v,w,i,N,j,a,B,C,$={transition:"elastic",speed:350,width:false,height:false,innerWidth:false,innerHeight:false,initialWidth:"400",initialHeight:"400",maxWidth:false,maxHeight:false,scalePhotos:n,scrolling:n,inline:false,html:false,iframe:false,photo:false,href:false,title:false,rel:false,opacity:0.9,preloading:n,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:false,overlayClose:n, slideshow:false,slideshowAuto:n,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:false,onLoad:false,onComplete:false,onCleanup:false,onClosed:false};e=c.fn.colorbox=function(b,d){var h=this;if(!h.length)if(h.selector===""){h=c("");b.open=n}else return this;h.each(function(){var f=c.extend({},c(this).data(q)?c(this).data(q):$,b);c(this).data(q,f).addClass("cboxElement");if(d)c(this).data(q).onComplete=d});b&&b.open&&Z(h);return this};e.init=function(){function b(d){return c('
')}m=c(window);k=c('
');s=b("Overlay").hide();u=b("Wrapper");p=b("Content").append(l=b("LoadedContent").css({width:0,height:0}),J=b("LoadingOverlay"),K=b("LoadingGraphic"),Q=b("Title"),P=b("Current"),t=b("Slideshow"),E=b("Next"),D=b("Previous"),R=b("Close"));u.append(c("
").append(b("TopLeft"),U=b("TopCenter"),b("TopRight")),c("
").append(V=b("MiddleLeft"),p,W=b("MiddleRight")),c("
").append(b("BottomLeft"),X=b("BottomCenter"),b("BottomRight"))).children().children().css({"float":"left"}); I=c("
");c("body").prepend(s,k.append(u,I));if(x){k.addClass("cboxIE");O&&s.css("position","absolute")}p.children().bind("mouseover mouseout",function(){c(this).toggleClass(F)}).addClass(F);y=U.height()+X.height()+p.outerHeight(n)-p.height();z=V.width()+W.width()+p.outerWidth(n)-p.width();v=l.outerHeight(n);w=l.outerWidth(n);k.css({"padding-bottom":y,"padding-right":z}).hide();E.click(e.next);D.click(e.prev);R.click(e.close);p.children().removeClass(F); c(".cboxElement").live("click",function(d){if(d.button!==0&&typeof d.button!=="undefined")return n;else{Z(this);return false}})};e.position=function(b,d){function h(A){U[0].style.width=X[0].style.width=p[0].style.width=A.style.width;K[0].style.height=J[0].style.height=p[0].style.height=V[0].style.height=W[0].style.height=A.style.height}var f=m.height();f=Math.max(f-a.h-v-y,0)/2+m.scrollTop();var o=Math.max(document.documentElement.clientWidth-a.w-w-z,0)/2+m.scrollLeft();b=k.width()===a.w+w&&k.height()=== a.h+v?0:b;u[0].style.width=u[0].style.height="9999px";k.dequeue().animate({width:a.w+w,height:a.h+v,top:f,left:o},{duration:b,complete:function(){h(this);C=false;u[0].style.width=a.w+w+z+"px";u[0].style.height=a.h+v+y+"px";d&&d()},step:function(){h(this)}})};e.resize=function(b){function d(){a.w=a.w||l.width();a.w=a.mw&&a.mw");l.show();Q.show().html(a.title);if(g.length>1){P.html(a.current.replace(/\{current\}/,j+1).replace(/\{total\}/,g.length)).show();E.html(a.next).show();D.html(a.previous).show();a.slideshow&&t.show()}J.hide();K.hide();c.event.trigger(S);a.onComplete&&a.onComplete.call(i);a.transition==="fade"&&k.fadeTo(L,1,function(){x&&k[0].style.removeAttribute("filter")}); m.bind(T,function(){e.position(0)})}})}if(B){var o,A,L=a.transition==="none"?0:a.speed;m.unbind(T);if(b){l.remove();l=c('
').html(b);l.hide().appendTo(I).css({width:d(),overflow:a.scrolling?"auto":"hidden"}).css({height:h()}).prependTo(p);c("#cboxPhoto").css({cssFloat:"none"});O&&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(L,0,function(){f(0)})||f(L);if(a.preloading&&g.length>1){b=j>0?g[j-1]:g[g.length-1];o=j").attr("src",o);M(b)&&c("").attr("src",b)}}else setTimeout(function(){var G=l.wrapInner("
").children();a.h=G.height();l.css({height:a.h});G.replaceWith(G.children());e.position(L)},1)}};e.load=function(){var b,d,h,f=e.resize;C=n;i=g[j];a=c(i).data(q);Y();c.event.trigger(H); a.onLoad&&a.onLoad.call(i);a.h=a.height?r(a.height,"y")-v-y:a.innerHeight?r(a.innerHeight,"y"):false;a.w=a.width?r(a.width,"x")-w-z:a.innerWidth?r(a.innerWidth,"x"):false;a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=r(a.maxWidth,"x")-w-z;a.mw=a.w&&a.w').hide().insertBefore(c(b)[0]).bind(H+" cbox_cleanup",function(){c(this).replaceWith(l.children())}); f(c(b))}else if(a.iframe)f(" ");else if(a.html)f(a.html);else if(M(b)){d=new Image;d.onload=function(){var o;d.onload=null;d.id="cboxPhoto";c(d).css({margin:"auto",border:"none",display:"block",cssFloat:"left"});if(a.scalePhotos){h=function(){d.height-=d.height*o;d.width-=d.width*o};if(a.mw&&d.width>a.mw){o=(d.width-a.mw)/d.width;h()}if(a.mh&&d.height>a.mh){o=(d.height-a.mh)/d.height;h()}}if(a.h)d.style.marginTop=Math.max(a.h-d.height,0)/2+"px";f(d);g.length>1&&c(d).css({cursor:"pointer"}).click(e.next); if(x)d.style.msInterpolationMode="bicubic"};d.src=b}else c("
").appendTo(I).load(b,function(o,A){A==="success"?f(this):f(c("

Request unsuccessful.

"))})};e.next=function(){if(!C){j=j0?j-1:g.length-1;e.load()}};e.slideshow=function(){function b(){t.text(a.slideshowStop).bind(S,function(){h=setTimeout(e.next,a.slideshowSpeed)}).bind(H,function(){clearTimeout(h)}).one("click",function(){d();c(this).removeClass(F)});k.removeClass(f+ "off").addClass(f+"on")}var d,h,f="cboxSlideshow_";t.bind("cbox_closed",function(){t.unbind();clearTimeout(h);k.removeClass(f+"off "+f+"on")});d=function(){clearTimeout(h);t.text(a.slideshowStart).unbind(S+" "+H).one("click",function(){b();h=setTimeout(e.next,a.slideshowSpeed);c(this).removeClass(F)});k.removeClass(f+"on").addClass(f+"off")};if(a.slideshow&&g.length>1)a.slideshowAuto?b():d()};e.close=function(){c.event.trigger("cbox_cleanup");a.onCleanup&&a.onCleanup.call(i);B=false;c(document).unbind("keydown.cbox_close keydown.cbox_arrows"); m.unbind(T+" resize.cboxie6 scroll.cboxie6");s.css({cursor:"auto"}).fadeOut("fast");k.stop(n,false).fadeOut("fast",function(){c("#colorbox iframe").attr("src","about:blank");l.remove();k.css({opacity:1});try{N.focus()}catch(b){}c.event.trigger("cbox_closed");a.onClosed&&a.onClosed.call(i)})};e.element=function(){return c(i)};e.settings=$;c(e.init)})(jQuery); \ No newline at end of file diff --git a/colorbox/jquery.colorbox.js b/colorbox/jquery.colorbox.js index 04554ea..d6827c4 100644 --- a/colorbox/jquery.colorbox.js +++ b/colorbox/jquery.colorbox.js @@ -1,4 +1,4 @@ -// ColorBox v1.3.5b - a full featured, light-weight, customizable lightbox based on jQuery 1.3 +// ColorBox v1.3.6 - a full featured, light-weight, customizable lightbox based on jQuery 1.3 // c) 2009 Jack Moore - www.colorpowered.com - jack@colorpowered.com // Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php @@ -9,8 +9,8 @@ TRUE = true, FALSE = false, cboxPublic, - isIE = !$.support.opacity, - isIE6 = isIE && !window.XMLHttpRequest, + isIE = $.browser.msie && !$.support.opacity, // feature detection alone gave false positives in some browsers + isIE6 = isIE && $.browser.version < 7, // Event Strings (to increase compression) cbox_open = 'cbox_open', @@ -122,6 +122,9 @@ settings[i] = settings[i].call(element); } } + settings.rel = settings.rel || element.rel; + settings.href = settings.href || element.href; + settings.title = settings.title || element.title; } function launch(elem) { @@ -132,12 +135,10 @@ process(); // Convert functions to their returned values. - var rel = settings.rel || element.rel; - - if (rel && rel !== 'nofollow') { + if (settings.rel && settings.rel !== 'nofollow') { $related = $('.cboxElement').filter(function () { var relRelated = $(this).data(colorbox).rel || this.rel; - return (relRelated === rel); + return (relRelated === settings.rel); }); index = $related.index(element); @@ -161,7 +162,7 @@ bookmark.blur(); // Remove the focus from the calling element. // Set Navigation Key Bindings - $().bind("keydown.cbox_close", function (e) { + $(document).bind("keydown.cbox_close", function (e) { if (e.keyCode === 27) { e.preventDefault(); cboxPublic.close(); @@ -221,7 +222,7 @@ if (!$this.length) { if ($this.selector === '') { // empty selector means a direct call, ie: $.fn.colorbox(); - $this = $($this).data(colorbox, defaults); + $this = $(''); options.open = TRUE; } else { // else the selector didn't match anything, and colorbox should go ahead and return. return this; @@ -444,14 +445,12 @@ //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){ - $loaded.append("