jQuery Colorbox - Version 3.6

Version Description

(2010-09-12) = * CHANGE: Update of Colorbox library to version 1.3.9 which fixes lots of bugs. Most notably the "0 by 0" bug in Chrome.

Download this release

Release Info

Developer techotronic
Plugin Icon 128x128 jQuery Colorbox
Version 3.6
Comparing to
See all releases

Code changes from version 3.5 to 3.6

jquery-colorbox.php CHANGED
@@ -6,7 +6,7 @@
6
  * Plugin Name: jQuery Colorbox
7
  * Plugin URI: http://www.techotronic.de/plugins/jquery-colorbox/
8
  * Description: Used to overlay images on the current page. Images in one post are grouped automatically.
9
- * Version: 3.5
10
  * Author: Arne Franken
11
  * Author URI: http://www.techotronic.de/
12
  * License: GPL
@@ -19,7 +19,8 @@
19
  ?>
20
  <?php
21
  //define constants
22
- define('JQUERYCOLORBOX_VERSION', '3.5');
 
23
 
24
  if (!defined('JQUERYCOLORBOX_PLUGIN_BASENAME')) {
25
  define('JQUERYCOLORBOX_PLUGIN_BASENAME', plugin_basename(__FILE__));
@@ -145,7 +146,7 @@ class jQueryColorbox {
145
  // enqueue javascripts in wordpress
146
  wp_register_style('colorbox-' . $this->colorboxSettings['colorboxTheme'], plugins_url('themes/' . $this->colorboxSettings['colorboxTheme'] . '/colorbox.css', __FILE__), array(), JQUERYCOLORBOX_VERSION, 'screen');
147
  wp_enqueue_style('colorbox-' . $this->colorboxSettings['colorboxTheme']);
148
- wp_enqueue_script('colorbox', plugins_url('js/jquery.colorbox-min.js', __FILE__), array('jquery'), '1.3.6');
149
  // if($this->colorboxSettings['draggable']) {
150
  // ?!?wp_enqueue_script('jquery-ui-draggable');
151
  // wp_enqueue_script('colorbox-draggable', plugins_url('js/jquery-colorbox-draggable.js', __FILE__), array('jquery-ui-draggable'), JQUERYCOLORBOX_VERSION);
6
  * Plugin Name: jQuery Colorbox
7
  * Plugin URI: http://www.techotronic.de/plugins/jquery-colorbox/
8
  * Description: Used to overlay images on the current page. Images in one post are grouped automatically.
9
+ * Version: 3.6
10
  * Author: Arne Franken
11
  * Author URI: http://www.techotronic.de/
12
  * License: GPL
19
  ?>
20
  <?php
21
  //define constants
22
+ define('JQUERYCOLORBOX_VERSION', '3.6');
23
+ define('COLORBOXLIBRARY_VERSION', '1.3.9');
24
 
25
  if (!defined('JQUERYCOLORBOX_PLUGIN_BASENAME')) {
26
  define('JQUERYCOLORBOX_PLUGIN_BASENAME', plugin_basename(__FILE__));
146
  // enqueue javascripts in wordpress
147
  wp_register_style('colorbox-' . $this->colorboxSettings['colorboxTheme'], plugins_url('themes/' . $this->colorboxSettings['colorboxTheme'] . '/colorbox.css', __FILE__), array(), JQUERYCOLORBOX_VERSION, 'screen');
148
  wp_enqueue_style('colorbox-' . $this->colorboxSettings['colorboxTheme']);
149
+ wp_enqueue_script('colorbox', plugins_url('js/jquery.colorbox-min.js', __FILE__), array('jquery'), COLORBOXLIBRARY_VERSION);
150
  // if($this->colorboxSettings['draggable']) {
151
  // ?!?wp_enqueue_script('jquery-ui-draggable');
152
  // wp_enqueue_script('colorbox-draggable', plugins_url('js/jquery-colorbox-draggable.js', __FILE__), array('jquery-ui-draggable'), JQUERYCOLORBOX_VERSION);
js/jquery.colorbox-min.js CHANGED
@@ -1,2 +1,4 @@
1
- /* ColorBox v1.3.6 - a full featured, light-weight, customizable lightbox based on jQuery 1.3 */
2
- (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.support.opacity,O=x&&!window.XMLHttpRequest,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("<a/>");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('<div id="cbox'+ d+'"/>')}m=c(window);k=c('<div id="colorbox"/>');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("<div/>").append(b("TopLeft"),U=b("TopCenter"),b("TopRight")),c("<div/>").append(V=b("MiddleLeft"),p,W=b("MiddleRight")),c("<div/>").append(b("BottomLeft"),X=b("BottomCenter"),b("BottomRight"))).children().children().css({"float":"left"}); I=c("<div style='position:absolute; top:0; left:0; width:9999px; height:0;'/>");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<a.w?a.mw:a.w;return a.w}function h(){a.h=a.h||l.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}function f(G){e.position(G,function(){if(B){if(x){A&&l.fadeIn(100);k[0].style.removeAttribute("filter")}if(a.iframe)l.append("<iframe id='cboxIframe'"+ (a.scrolling?" ":"scrolling='no'")+" name='iframe_"+(new Date).getTime()+"' frameborder=0 src='"+a.href+"' "+(x?"allowtransparency='true'":"")+" />");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('<div id="cboxLoadedContent"/>').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<g.length-1?g[j+1]:g[0];o=c(o).data(q).href||o.href;b=c(b).data(q).href||b.href;M(o)&&c("<img />").attr("src",o);M(b)&&c("<img />").attr("src",b)}}else setTimeout(function(){var G=l.wrapInner("<div style='overflow:auto'></div>").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<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=r(a.maxHeight,"y")-v-y;a.mh=a.h&&a.h<a.mh?a.h:a.mh}b=a.href;J.show();K.show();if(a.inline){c('<div id="cboxInlineTemp" />').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("<div />").appendTo(I).load(b,function(o,A){A==="success"?f(this):f(c("<p>Request unsuccessful.</p>"))})};e.next=function(){if(!C){j=j<g.length-1?j+1:0;e.load()}};e.prev=function(){if(!C){j=j>0?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);
 
 
1
+ // ColorBox v1.3.9 - a full featured, light-weight, customizable lightbox based on jQuery 1.3
2
+ // c) 2009 Jack Moore - www.colorpowered.com - jack@colorpowered.com
3
+ // Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
4
+ (function(b,gb){var v="none",t="click",N="LoadedContent",d=false,x="resize.",o="y",u="auto",f=true,M="nofollow",q="on",n="x";function e(a,c){a=a?' id="'+k+a+'"':"";c=c?' style="'+c+'"':"";return b("<div"+a+c+"/>")}function p(a,b){b=b===n?m.width():m.height();return typeof a==="string"?Math.round(a.match(/%/)?b/100*parseInt(a,10):parseInt(a,10)):a}function Q(c){c=b.isFunction(c)?c.call(h):c;return a.photo||c.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i)}function cb(){for(var c in a)if(b.isFunction(a[c])&&c.substring(0,2)!==q)a[c]=a[c].call(h);a.rel=a.rel||h.rel||M;a.href=a.href||b(h).attr("href");a.title=a.title||h.title}function db(d){h=d;a=b.extend({},b(h).data(r));cb();if(a.rel!==M){i=b("."+H).filter(function(){return (b(this).data(r).rel||this.rel)===a.rel});g=i.index(h);if(g===-1){i=i.add(h);g=i.length-1}}else{i=b(h);g=0}if(!w){w=F=f;R=h;try{R.blur()}catch(e){}b.event.trigger(hb);a.onOpen&&a.onOpen.call(h);y.css({opacity:+a.opacity,cursor:a.overlayClose?"pointer":u}).show();a.w=p(a.initialWidth,n);a.h=p(a.initialHeight,o);c.position(0);S&&m.bind(x+O+" scroll."+O,function(){y.css({width:m.width(),height:m.height(),top:m.scrollTop(),left:m.scrollLeft()})}).trigger("scroll."+O)}T.add(I).add(J).add(z).add(U).hide();V.html(a.close).show();c.slideshow();c.load()}var eb={transition:"elastic",speed:300,width:d,initialWidth:"600",innerWidth:d,maxWidth:d,height:d,initialHeight:"450",innerHeight:d,maxHeight:d,scalePhotos:f,scrolling:f,inline:d,html:d,iframe:d,photo:d,href:d,title:d,rel:d,opacity:.9,preloading:f,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:d,loop:f,slideshow:d,slideshowAuto:f,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:d,onLoad:d,onComplete:d,onCleanup:d,onClosed:d,overlayClose:f,escKey:f,arrowKey:f},r="colorbox",k="cbox",hb=k+"_open",P=k+"_load",W=k+"_complete",X=k+"_cleanup",fb=k+"_closed",G=b.browser.msie&&!b.support.opacity,S=G&&b.browser.version<7,O=k+"_IE6",y,j,E,s,Y,Z,ab,bb,i,m,l,K,L,U,T,z,J,I,V,C,D,A,B,h,R,g,a,w,F,c,H=k+"Element";c=b.fn[r]=b[r]=function(c,d){var a=this;if(!a[0]&&a.selector)return a;c=c||{};if(d)c.onComplete=d;if(!a[0]||a.selector===undefined){a=b("<a/>");c.open=f}a.each(function(){b(this).data(r,b.extend({},b(this).data(r)||eb,c)).addClass(H)});c.open&&db(a[0]);return a};c.init=function(){var h="hover";m=b(gb);j=e().attr({id:r,"class":G?k+"IE":""});y=e("Overlay",S?"position:absolute":"").hide();E=e("Wrapper");s=e("Content").append(l=e(N,"width:0; height:0"),L=e("LoadingOverlay").add(e("LoadingGraphic")),U=e("Title"),T=e("Current"),J=e("Next"),I=e("Previous"),z=e("Slideshow"),V=e("Close"));E.append(e().append(e("TopLeft"),Y=e("TopCenter"),e("TopRight")),e().append(Z=e("MiddleLeft"),s,ab=e("MiddleRight")),e().append(e("BottomLeft"),bb=e("BottomCenter"),e("BottomRight"))).children().children().css({"float":"left"});K=e(d,"position:absolute; width:9999px; visibility:hidden; display:none");b("body").prepend(y,j.append(E,K));s.children().hover(function(){b(this).addClass(h)},function(){b(this).removeClass(h)}).addClass(h);C=Y.height()+bb.height()+s.outerHeight(f)-s.height();D=Z.width()+ab.width()+s.outerWidth(f)-s.width();A=l.outerHeight(f);B=l.outerWidth(f);j.css({"padding-bottom":C,"padding-right":D}).hide();J.click(c.next);I.click(c.prev);V.click(c.close);s.children().removeClass(h);b("."+H).live(t,function(a){if(a.button!==0&&typeof a.button!=="undefined"||a.ctrlKey||a.shiftKey||a.altKey)return f;else{db(this);return d}});y.click(function(){a.overlayClose&&c.close()});b(document).bind("keydown",function(b){if(w&&a.escKey&&b.keyCode===27){b.preventDefault();c.close()}if(w&&a.arrowKey&&!F&&i[1])if(b.keyCode===37&&(g||a.loop)){b.preventDefault();I.click()}else if(b.keyCode===39&&(g<i.length-1||a.loop)){b.preventDefault();J.click()}})};c.remove=function(){j.add(y).remove();b("."+H).die(t).removeData(r).removeClass(H)};c.position=function(f,b){function c(a){Y[0].style.width=bb[0].style.width=s[0].style.width=a.style.width;L[0].style.height=L[1].style.height=s[0].style.height=Z[0].style.height=ab[0].style.height=a.style.height}var e,h=Math.max(m.height()-a.h-A-C,0)/2+m.scrollTop(),g=Math.max(m.width()-a.w-B-D,0)/2+m.scrollLeft();e=j.width()===a.w+B&&j.height()===a.h+A?0:f;E[0].style.width=E[0].style.height="9999px";j.dequeue().animate({width:a.w+B,height:a.h+A,top:h,left:g},{duration:e,complete:function(){c(this);F=d;E[0].style.width=a.w+B+D+"px";E[0].style.height=a.h+A+C+"px";b&&b()},step:function(){c(this)}})};c.resize=function(b){if(w){b=b||{};if(b.width)a.w=p(b.width,n)-B-D;if(b.innerWidth)a.w=p(b.innerWidth,n);l.css({width:a.w});if(b.height)a.h=p(b.height,o)-A-C;if(b.innerHeight)a.h=p(b.innerHeight,o);if(!b.innerHeight&&!b.height){b=l.wrapInner("<div style='overflow:auto'></div>").children();a.h=b.height();b.replaceWith(b.children())}l.css({height:a.h});c.position(a.transition===v?0:a.speed)}};c.prep=function(o){var d="hidden";function n(t){var o,q,s,n,d=i.length,e=a.loop;c.position(t,function(){function t(){G&&j[0].style.removeAttribute("filter")}if(w){G&&p&&l.fadeIn(100);a.iframe&&b("<iframe frameborder=0"+(a.scrolling?"":" scrolling='no'")+(G?" allowtransparency='true'":"")+"/>").attr({src:a.href,name:(new Date).getTime()}).appendTo(l);l.show();U.show().html(a.title);if(d>1){T.html(a.current.replace(/\{current\}/,g+1).replace(/\{total\}/,d)).show();J[e||g<d-1?"show":"hide"]().html(a.next);I[e||g?"show":"hide"]().html(a.previous);o=g?i[g-1]:i[d-1];s=g<d-1?i[g+1]:i[0];if(a.slideshow){z.show();g===d-1&&!e&&j.is("."+k+"Slideshow_on")&&z.click()}if(a.preloading){n=b(s).data(r).href||s.href;q=b(o).data(r).href||o.href;if(Q(n))b("<img/>")[0].src=n;if(Q(q))b("<img/>")[0].src=q}}L.hide();a.transition==="fade"?j.fadeTo(f,1,function(){t()}):t();m.bind(x+k,function(){c.position(0)});b.event.trigger(W);a.onComplete&&a.onComplete.call(h)}})}if(w){var p,f=a.transition===v?0:a.speed;m.unbind(x+k);l.remove();l=e(N).html(o);l.hide().appendTo(K.show()).css({width:function(){a.w=a.w||l.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}(),overflow:a.scrolling?u:d}).css({height:function(){a.h=a.h||l.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}()}).prependTo(s);K.hide();b("#"+k+"Photo").css({cssFloat:v});S&&b("select").not(j.find("select")).filter(function(){return this.style.visibility!==d}).css({visibility:d}).one(X,function(){this.style.visibility="inherit"});a.transition==="fade"?j.fadeTo(f,0,function(){n(0)}):n(f)}};c.load=function(){var j,d,q,m=c.prep;F=f;h=i[g];a=b.extend({},b(h).data(r));cb();b.event.trigger(P);a.onLoad&&a.onLoad.call(h);a.h=a.height?p(a.height,o)-A-C:a.innerHeight&&p(a.innerHeight,o);a.w=a.width?p(a.width,n)-B-D:a.innerWidth&&p(a.innerWidth,n);a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=p(a.maxWidth,n)-B-D;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=p(a.maxHeight,o)-A-C;a.mh=a.h&&a.h<a.mh?a.h:a.mh}j=a.href;L.show();if(a.inline){e("InlineTemp").hide().insertBefore(b(j)[0]).bind(P+" "+X,function(){b(this).replaceWith(l.children())});m(b(j))}else if(a.iframe)m(" ");else if(a.html)m(a.html);else if(Q(j)){d=new Image;d.onload=function(){var e;d.onload=null;d.id=k+"Photo";b(d).css({margin:u,border:v,display:"block",cssFloat:"left"});if(a.scalePhotos){q=function(){d.height-=d.height*e;d.width-=d.width*e};if(a.mw&&d.width>a.mw){e=(d.width-a.mw)/d.width;q()}if(a.mh&&d.height>a.mh){e=(d.height-a.mh)/d.height;q()}}if(a.h)d.style.marginTop=Math.max(a.h-d.height,0)/2+"px";setTimeout(function(){m(d)},1);i[1]&&(g<i.length-1||a.loop)&&b(d).css({cursor:"pointer"}).click(c.next);if(G)d.style.msInterpolationMode="bicubic"};d.src=j}else e().appendTo(K).load(j,function(c,a,b){m(a==="error"?"Request unsuccessful: "+b.statusText:this)})};c.next=function(){if(!F){g=g<i.length-1?g+1:0;c.load()}};c.prev=function(){if(!F){g=g?g-1:i.length-1;c.load()}};c.slideshow=function(){function f(){z.text(a.slideshowStop).bind(W,function(){d=setTimeout(c.next,a.slideshowSpeed)}).bind(P,function(){clearTimeout(d)}).one(t,function(){e()});j.removeClass(b+"off").addClass(b+q)}var e,d,b=k+"Slideshow_";z.bind(fb,function(){z.unbind();clearTimeout(d);j.removeClass(b+"off "+b+q)});e=function(){clearTimeout(d);z.text(a.slideshowStart).unbind(W+" "+P).one(t,function(){f();d=setTimeout(c.next,a.slideshowSpeed)});j.removeClass(b+q).addClass(b+"off")};if(a.slideshow&&i[1])a.slideshowAuto?f():e()};c.close=function(){if(w){w=d;b.event.trigger(X);a.onCleanup&&a.onCleanup.call(h);m.unbind("."+k+" ."+O);y.fadeTo("fast",0);j.stop().fadeTo("fast",0,function(){j.find("iframe").attr("src","about:blank");l.remove();j.add(y).css({opacity:1,cursor:u}).hide();try{R.focus()}catch(c){}setTimeout(function(){b.event.trigger(fb);a.onClosed&&a.onClosed.call(h)},1)})}};c.element=function(){return b(h)};c.settings=eb;b(c.init)})(jQuery,this)
js/jquery.colorbox.js CHANGED
@@ -1,28 +1,73 @@
1
- // ColorBox v1.3.6 - a full featured, light-weight, customizable lightbox based on jQuery 1.3
2
  // c) 2009 Jack Moore - www.colorpowered.com - jack@colorpowered.com
3
  // Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
4
-
5
- (function ($) {
6
- // Shortcuts (to increase compression)
7
- var colorbox = 'colorbox',
8
- hover = 'hover',
9
- TRUE = true,
10
- FALSE = false,
11
- cboxPublic,
12
- isIE = !$.support.opacity,
13
- isIE6 = isIE && !window.XMLHttpRequest,
14
-
15
- // Event Strings (to increase compression)
16
- cbox_open = 'cbox_open',
17
- cbox_load = 'cbox_load',
18
- cbox_complete = 'cbox_complete',
19
- cbox_cleanup = 'cbox_cleanup',
20
- cbox_closed = 'cbox_closed',
21
- cbox_resize = 'resize.cbox_resize',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  // Cached jQuery Object Variables
24
  $overlay,
25
- $cbox,
26
  $wrap,
27
  $content,
28
  $topBorder,
@@ -34,7 +79,6 @@
34
  $loaded,
35
  $loadingBay,
36
  $loadingOverlay,
37
- $loadingGraphic,
38
  $title,
39
  $current,
40
  $slideshow,
@@ -54,57 +98,23 @@
54
  open,
55
  active,
56
 
57
- // ColorBox Default Settings.
58
- // See http://colorpowered.com/colorbox for details.
59
- defaults = {
60
- transition: "elastic",
61
- speed: 350,
62
- width: FALSE,
63
- height: FALSE,
64
- innerWidth: FALSE,
65
- innerHeight: FALSE,
66
- initialWidth: "400",
67
- initialHeight: "400",
68
- maxWidth: FALSE,
69
- maxHeight: FALSE,
70
- scalePhotos: TRUE,
71
- scrolling: TRUE,
72
- inline: FALSE,
73
- html: FALSE,
74
- iframe: FALSE,
75
- photo: FALSE,
76
- href: FALSE,
77
- title: FALSE,
78
- rel: FALSE,
79
- opacity: 0.9,
80
- preloading: TRUE,
81
- current: "image {current} of {total}",
82
- previous: "previous",
83
- next: "next",
84
- close: "close",
85
- open: FALSE,
86
- overlayClose: TRUE,
87
-
88
- slideshow: FALSE,
89
- slideshowAuto: TRUE,
90
- slideshowSpeed: 2500,
91
- slideshowStart: "start slideshow",
92
- slideshowStop: "stop slideshow",
93
-
94
- onOpen: FALSE,
95
- onLoad: FALSE,
96
- onComplete: FALSE,
97
- onCleanup: FALSE,
98
- onClosed: FALSE
99
- };
100
 
101
  // ****************
102
  // HELPER FUNCTIONS
103
  // ****************
104
-
 
 
 
 
 
 
 
105
  // Convert % values to pixels
106
  function setSize(size, dimension) {
107
- dimension = dimension === 'x' ? $window.width() : $window.height();//document.documentElement.clientWidth : document.documentElement.clientHeight;
108
  return (typeof size === 'string') ? Math.round((size.match(/%/) ? (dimension / 100) * parseInt(size, 10) : parseInt(size, 10))) : size;
109
  }
110
 
@@ -122,8 +132,8 @@
122
  settings[i] = settings[i].call(element);
123
  }
124
  }
125
- settings.rel = settings.rel || element.rel;
126
- settings.href = settings.href || element.href;
127
  settings.title = settings.title || element.title;
128
  }
129
 
@@ -131,19 +141,19 @@
131
 
132
  element = elem;
133
 
134
- settings = $(element).data(colorbox);
135
 
136
  process(); // Convert functions to their returned values.
137
 
138
- if (settings.rel && settings.rel !== 'nofollow') {
139
- $related = $('.cboxElement').filter(function () {
140
  var relRelated = $(this).data(colorbox).rel || this.rel;
141
  return (relRelated === settings.rel);
142
  });
143
  index = $related.index(element);
144
 
145
  // Check direct calls to ColorBox.
146
- if (index < 0) {
147
  $related = $related.add(element);
148
  index = $related.length - 1;
149
  }
@@ -153,52 +163,31 @@
153
  }
154
 
155
  if (!open) {
156
- open = TRUE;
157
-
158
- active = TRUE; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
159
 
160
  bookmark = element;
161
 
162
- bookmark.blur(); // Remove the focus from the calling element.
 
 
163
 
164
- // Set Navigation Key Bindings
165
- $(document).bind("keydown.cbox_close", function (e) {
166
- if (e.keyCode === 27) {
167
- e.preventDefault();
168
- cboxPublic.close();
169
- }
170
- }).bind("keydown.cbox_arrows", function (e) {
171
- if ($related.length > 1) {
172
- if (e.keyCode === 37) {
173
- e.preventDefault();
174
- $prev.click();
175
- } else if (e.keyCode === 39) {
176
- e.preventDefault();
177
- $next.click();
178
- }
179
- }
180
- });
181
-
182
- if (settings.overlayClose) {
183
- $overlay.css({"cursor": "pointer"}).one('click', cboxPublic.close);
184
- }
185
-
186
- $.event.trigger(cbox_open);
187
  if (settings.onOpen) {
188
  settings.onOpen.call(element);
189
  }
190
 
191
- $overlay.css({"opacity": settings.opacity}).show();
 
192
 
193
  // Opens inital empty ColorBox prior to content being loaded.
194
  settings.w = setSize(settings.initialWidth, 'x');
195
  settings.h = setSize(settings.initialHeight, 'y');
196
- cboxPublic.position(0);
197
 
198
  if (isIE6) {
199
- $window.bind('resize.cboxie6 scroll.cboxie6', function () {
200
  $overlay.css({width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft()});
201
- }).trigger("scroll.cboxie6");
202
  }
203
  }
204
 
@@ -206,9 +195,9 @@
206
 
207
  $close.html(settings.close).show();
208
 
209
- cboxPublic.slideshow();
210
 
211
- cboxPublic.load();
212
  }
213
 
214
  // ****************
@@ -217,349 +206,372 @@
217
  // Usage from within an iframe: parent.$.fn.colorbox.close();
218
  // ****************
219
 
220
- cboxPublic = $.fn.colorbox = function (options, callback) {
221
  var $this = this;
222
 
223
- if (!$this.length) {
224
- if ($this.selector === '') { // empty selector means a direct call, ie: $.fn.colorbox();
225
- $this = $('<a/>');
226
- options.open = TRUE;
227
- } else { // else the selector didn't match anything, and colorbox should go ahead and return.
228
- return this;
229
- }
 
 
 
 
 
 
230
  }
231
 
232
  $this.each(function () {
233
- var data = $.extend({}, $(this).data(colorbox) ? $(this).data(colorbox) : defaults, options);
234
-
235
- $(this).data(colorbox, data).addClass("cboxElement");
236
-
237
- if (callback) {
238
- $(this).data(colorbox).onComplete = callback;
239
- }
240
  });
241
 
242
- if (options && options.open) {
243
- launch($this);
244
  }
245
 
246
- return this;
247
  };
248
 
249
  // Initialize ColorBox: store common calculations, preload the interface graphics, append the html.
250
  // This preps colorbox for a speedy open when clicked, and lightens the burdon on the browser by only
251
  // having to run once, instead of each time colorbox is opened.
252
- cboxPublic.init = function () {
253
-
254
- // jQuery object generator to save a bit of space
255
- function $div(id) {
256
- return $('<div id="cbox' + id + '"/>');
257
- }
258
-
259
  // Create & Append jQuery Objects
260
  $window = $(window);
261
- $cbox = $('<div id="colorbox"/>');
262
- $overlay = $div("Overlay").hide();
 
263
  $wrap = $div("Wrapper");
264
  $content = $div("Content").append(
265
- $loaded = $div("LoadedContent").css({width: 0, height: 0}),
266
- $loadingOverlay = $div("LoadingOverlay"),
267
- $loadingGraphic = $div("LoadingGraphic"),
268
  $title = $div("Title"),
269
  $current = $div("Current"),
270
- $slideshow = $div("Slideshow"),
271
  $next = $div("Next"),
272
  $prev = $div("Previous"),
 
273
  $close = $div("Close")
274
  );
275
  $wrap.append( // The 3x3 Grid that makes up ColorBox
276
- $('<div/>').append(
277
  $div("TopLeft"),
278
  $topBorder = $div("TopCenter"),
279
  $div("TopRight")
280
  ),
281
- $('<div/>').append(
282
  $leftBorder = $div("MiddleLeft"),
283
  $content,
284
  $rightBorder = $div("MiddleRight")
285
  ),
286
- $('<div/>').append(
287
  $div("BottomLeft"),
288
  $bottomBorder = $div("BottomCenter"),
289
  $div("BottomRight")
290
  )
291
  ).children().children().css({'float': 'left'});
292
 
293
- $loadingBay = $("<div style='position:absolute; top:0; left:0; width:9999px; height:0;'/>");
294
 
295
- $('body').prepend($overlay, $cbox.append($wrap, $loadingBay));
296
-
297
- if (isIE) {
298
- $cbox.addClass('cboxIE');
299
- if (isIE6) {
300
- $overlay.css('position', 'absolute');
301
- }
302
- }
303
 
304
- // Add rollover event to navigation elements
305
  $content.children()
306
- .bind('mouseover mouseout', function(){
307
- $(this).toggleClass(hover);
308
- }).addClass(hover);
 
 
309
 
310
  // Cache values needed for size calculations
311
- interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(TRUE) - $content.height();//Subtraction needed for IE6
312
- interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(TRUE) - $content.width();
313
- loadedHeight = $loaded.outerHeight(TRUE);
314
- loadedWidth = $loaded.outerWidth(TRUE);
315
 
316
  // Setting padding to remove the need to do size conversions during the animation step.
317
- $cbox.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth}).hide();
318
 
319
- // Setup button & key events.
320
- $next.click(cboxPublic.next);
321
- $prev.click(cboxPublic.prev);
322
- $close.click(cboxPublic.close);
323
 
324
  // Adding the 'hover' class allowed the browser to load the hover-state
325
  // background graphics. The class can now can be removed.
326
- $content.children().removeClass(hover);
327
 
328
- $('.cboxElement').live('click', function (e) {
329
- if (e.button !== 0 && typeof e.button !== 'undefined') {// checks to see if it was a non-left mouse-click.
330
- return TRUE;
 
331
  } else {
332
  launch(this);
333
- return FALSE;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  }
335
  });
336
  };
 
 
 
 
 
337
 
338
- cboxPublic.position = function (speed, loadedCallback) {
339
  var
340
  animate_speed,
341
- winHeight = $window.height(),
342
  // keeps the top and left positions within the browser's viewport.
343
- posTop = Math.max(winHeight - settings.h - loadedHeight - interfaceHeight,0)/2 + $window.scrollTop(),
344
- posLeft = Math.max(document.documentElement.clientWidth - settings.w - loadedWidth - interfaceWidth,0)/2 + $window.scrollLeft();
345
 
346
  // setting the speed to 0 to reduce the delay between same-sized content.
347
- animate_speed = ($cbox.width() === settings.w+loadedWidth && $cbox.height() === settings.h+loadedHeight) ? 0 : speed;
348
 
349
  // this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
350
  // but it has to be shrank down around the size of div#colorbox when it's done. If not,
351
  // it can invoke an obscure IE bug when using iframes.
352
  $wrap[0].style.width = $wrap[0].style.height = "9999px";
353
 
354
- function modalDimensions (that) {
355
- // loading overlay size has to be sure that IE6 uses the correct height.
356
  $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = that.style.width;
357
- $loadingGraphic[0].style.height = $loadingOverlay[0].style.height = $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = that.style.height;
358
  }
359
 
360
- $cbox.dequeue().animate({width:settings.w+loadedWidth, height:settings.h+loadedHeight, top:posTop, left:posLeft}, {duration: animate_speed,
361
- complete: function(){
 
362
  modalDimensions(this);
363
 
364
- active = FALSE;
365
 
366
  // shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
367
- $wrap[0].style.width = (settings.w+loadedWidth+interfaceWidth) + "px";
368
- $wrap[0].style.height = (settings.h+loadedHeight+interfaceHeight) + "px";
369
 
370
- if (loadedCallback) {loadedCallback();}
 
 
371
  },
372
- step: function(){
373
  modalDimensions(this);
374
  }
375
  });
376
  };
377
 
378
- cboxPublic.resize = function (object) {
379
- if(!open){ return; }
380
-
381
- var topMargin,
382
- prev,
383
- prevSrc,
384
- next,
385
- nextSrc,
386
- photo,
387
- timeout,
388
- speed = settings.transition==="none" ? 0 : settings.speed;
389
-
390
- $window.unbind(cbox_resize);
391
-
392
- if(!object){
393
- timeout = setTimeout(function(){ // timer allows IE to render the dimensions before attempting to calculate the height
 
 
 
394
  var $child = $loaded.wrapInner("<div style='overflow:auto'></div>").children(); // temporary wrapper to get an accurate estimate of just how high the total content should be.
395
  settings.h = $child.height();
396
- $loaded.css({height:settings.h});
397
  $child.replaceWith($child.children()); // ditch the temporary wrapper div used in height calculation
398
- cboxPublic.position(speed);
399
- }, 1);
 
 
 
 
 
 
 
400
  return;
401
  }
402
 
 
 
 
 
403
  $loaded.remove();
404
- $loaded = $('<div id="cboxLoadedContent"/>').html(object);
405
 
406
- function getWidth(){
407
  settings.w = settings.w || $loaded.width();
408
  settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
409
  return settings.w;
410
  }
411
- function getHeight(){
412
  settings.h = settings.h || $loaded.height();
413
  settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
414
  return settings.h;
415
  }
416
 
417
  $loaded.hide()
418
- .appendTo($loadingBay)// content has to be appended to the DOM for accurate size calculations. Appended to an absolutely positioned element, rather than BODY, which avoids an extremely brief display of the vertical scrollbar in Firefox that can occur for a small minority of websites.
419
- .css({width:getWidth(), overflow:settings.scrolling ? 'auto' : 'hidden'})
420
- .css({height:getHeight()})// sets the height independently from the width in case the new width influences the value of height.
421
  .prependTo($content);
422
 
423
- $('#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.
 
 
424
 
425
  // Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay.
426
  if (isIE6) {
427
- $('select:not(#colorbox select)').filter(function(){
428
  return this.style.visibility !== 'hidden';
429
- }).css({'visibility':'hidden'}).one(cbox_cleanup, function(){
430
  this.style.visibility = 'inherit';
431
  });
432
  }
433
 
434
- function setPosition (s) {
435
- cboxPublic.position(s, function(){
436
- if (!open) { return; }
 
 
 
 
 
 
 
 
 
 
437
 
438
  if (isIE) {
439
  //This fadeIn helps the bicubic resampling to kick-in.
440
- if( photo ){$loaded.fadeIn(100);}
441
- //IE adds a filter when ColorBox fades in and out that can cause problems if the loaded content contains transparent pngs.
442
- $cbox[0].style.removeAttribute("filter");
443
  }
444
 
445
  //Waited until the iframe is added to the DOM & it is visible before setting the src.
446
  //This increases compatability with pages using DOM dependent JavaScript.
447
- if(settings.iframe){
448
- $loaded.append("<iframe id='cboxIframe'" + (settings.scrolling ? " " : "scrolling='no'") + " name='iframe_"+new Date().getTime()+"' frameborder=0 src='"+settings.href+"' " + (isIE ? "allowtransparency='true'" : '') + " />");
 
 
449
  }
450
 
451
  $loaded.show();
452
 
453
  $title.show().html(settings.title);
454
 
455
- if ($related.length>1) {
456
- $current.html(settings.current.replace(/\{current\}/, index+1).replace(/\{total\}/, $related.length)).show();
457
- $next.html(settings.next).show();
458
- $prev.html(settings.previous).show();
459
 
460
- if(settings.slideshow){
 
 
 
 
 
 
461
  $slideshow.show();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
462
  }
463
  }
464
 
465
  $loadingOverlay.hide();
466
- $loadingGraphic.hide();
467
 
468
- $.event.trigger(cbox_complete);
469
- if (settings.onComplete) {
470
- settings.onComplete.call(element);
471
- }
472
-
473
- if (settings.transition === 'fade'){
474
- $cbox.fadeTo(speed, 1, function(){
475
- if(isIE){$cbox[0].style.removeAttribute("filter");}
476
  });
 
 
477
  }
478
 
479
- $window.bind(cbox_resize, function(){
480
- cboxPublic.position(0);
481
  });
 
 
 
 
 
482
  });
483
  }
484
 
485
- if((settings.transition === 'fade' && $cbox.fadeTo(speed, 0, function(){setPosition(0);})) || setPosition(speed)){}
486
-
487
- // Preloads images within a rel group
488
- if (settings.preloading && $related.length>1) {
489
- prev = index > 0 ? $related[index-1] : $related[$related.length-1];
490
- next = index < $related.length-1 ? $related[index+1] : $related[0];
491
- nextSrc = $(next).data(colorbox).href || next.href;
492
- prevSrc = $(prev).data(colorbox).href || prev.href;
493
-
494
- if(isImage(nextSrc)){
495
- $('<img />').attr('src', nextSrc);
496
- }
497
-
498
- if(isImage(prevSrc)){
499
- $('<img />').attr('src', prevSrc);
500
- }
501
  }
502
  };
503
 
504
- cboxPublic.load = function () {
505
- var href, img, setResize, resize = cboxPublic.resize;
506
-
507
- active = TRUE;
508
-
509
- /*
510
-
511
- // I decided to comment this out because I can see it causing problems as users
512
- // really should just set the dimensions on their IMG elements instead,
513
- // but I'm leaving the code in as it may be useful to someone.
514
- // To use, uncomment the function and change 'if(textStatus === "success"){ resize(this); }'
515
- // to 'if(textStatus === "success"){ preload(this); }'
516
-
517
- // Preload loops through the HTML to find IMG elements and loads their sources.
518
- // This allows the resize method to accurately estimate the dimensions of the new content.
519
- function preload(html){
520
- var
521
- $ajax = $(html),
522
- $imgs = $ajax.find('img'),
523
- x = $imgs.length;
524
-
525
- function loadloop(){
526
- var img = new Image();
527
- x = x-1;
528
- if(x >= 0){
529
- img.onload = loadloop;
530
- img.src = $imgs[x].src;
531
- } else {
532
- resize($ajax);
533
- }
534
- }
535
-
536
- loadloop();
537
- }
538
- */
539
 
540
  element = $related[index];
541
 
542
- settings = $(element).data(colorbox);
543
 
544
  //convert functions to static values
545
  process();
546
 
547
- $.event.trigger(cbox_load);
548
  if (settings.onLoad) {
549
  settings.onLoad.call(element);
550
  }
551
 
552
- // Evaluate the height based on the optional height and width settings.
553
  settings.h = settings.height ?
554
  setSize(settings.height, 'y') - loadedHeight - interfaceHeight :
555
- settings.innerHeight ?
556
- setSize(settings.innerHeight, 'y') :
557
- FALSE;
558
  settings.w = settings.width ?
559
  setSize(settings.width, 'x') - loadedWidth - interfaceWidth :
560
- settings.innerWidth ?
561
- setSize(settings.innerWidth, 'x') :
562
- FALSE;
563
 
564
  // Sets the minimum dimensions for use in image scaling
565
  settings.mw = settings.w;
@@ -567,11 +579,11 @@
567
 
568
  // Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
569
  // If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
570
- if(settings.maxWidth){
571
  settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth;
572
  settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
573
  }
574
- if(settings.maxHeight){
575
  settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight;
576
  settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
577
  }
@@ -579,127 +591,120 @@
579
  href = settings.href;
580
 
581
  $loadingOverlay.show();
582
- $loadingGraphic.show();
583
 
584
  if (settings.inline) {
585
  // Inserts an empty placeholder where inline content is being pulled from.
586
  // An event is bound to put inline content back when ColorBox closes or loads new content.
587
- $('<div id="cboxInlineTemp" />').hide().insertBefore($(href)[0]).bind(cbox_load+' '+cbox_cleanup, function(){
588
  $(this).replaceWith($loaded.children());
589
  });
590
- resize($(href));
591
  } else if (settings.iframe) {
592
  // IFrame element won't be added to the DOM until it is ready to be displayed,
593
  // to avoid problems with DOM-ready JS that might be trying to run in that iframe.
594
- resize(" ");
595
  } else if (settings.html) {
596
- resize(settings.html);
597
- } else if (isImage(href)){
598
  img = new Image();
599
- img.onload = function(){
600
  var percent;
601
 
602
  img.onload = null;
 
 
603
 
604
- img.id = 'cboxPhoto';
605
-
606
- $(img).css({margin:'auto', border:'none', display:'block', cssFloat:'left'});
607
-
608
- if(settings.scalePhotos){
609
- setResize = function(){
610
  img.height -= img.height * percent;
611
  img.width -= img.width * percent;
612
  };
613
- if(settings.mw && img.width > settings.mw){
614
  percent = (img.width - settings.mw) / img.width;
615
  setResize();
616
  }
617
- if(settings.mh && img.height > settings.mh){
618
  percent = (img.height - settings.mh) / img.height;
619
  setResize();
620
  }
621
  }
622
 
623
  if (settings.h) {
624
- img.style.marginTop = Math.max(settings.h - img.height,0)/2 + 'px';
625
  }
626
 
627
- resize(img);
 
 
628
 
629
- if($related.length > 1){
630
- $(img).css({cursor:'pointer'}).click(cboxPublic.next);
631
  }
632
 
633
- if(isIE){
634
- img.style.msInterpolationMode='bicubic';
635
  }
636
  };
637
  img.src = href;
638
  } else {
639
- $('<div />').appendTo($loadingBay).load(href, function(data, textStatus){
640
- if(textStatus === "success"){
641
- resize(this);
642
- } else {
643
- resize($("<p>Request unsuccessful.</p>"));
644
- }
645
  });
646
  }
647
  };
648
 
649
  // Navigates to the next page/image in a set.
650
- cboxPublic.next = function () {
651
- if(!active){
652
- index = index < $related.length-1 ? index+1 : 0;
653
- cboxPublic.load();
654
  }
655
  };
656
 
657
- cboxPublic.prev = function () {
658
- if(!active){
659
- index = index > 0 ? index-1 : $related.length-1;
660
- cboxPublic.load();
661
  }
662
  };
663
 
664
- cboxPublic.slideshow = function () {
665
- var stop, timeOut, className = 'cboxSlideshow_';
666
 
667
- $slideshow.bind(cbox_closed, function(){
668
  $slideshow.unbind();
669
  clearTimeout(timeOut);
670
- $cbox.removeClass(className+"off"+" "+className+"on");
671
  });
672
 
673
- function start(){
674
  $slideshow
675
  .text(settings.slideshowStop)
676
- .bind(cbox_complete, function(){
677
- timeOut = setTimeout(cboxPublic.next, settings.slideshowSpeed);
678
  })
679
- .bind(cbox_load, function(){
680
  clearTimeout(timeOut);
681
- }).one("click", function(){
682
  stop();
683
- $(this).removeClass(hover);
684
  });
685
- $cbox.removeClass(className+"off").addClass(className+"on");
686
  }
687
 
688
- stop = function(){
689
  clearTimeout(timeOut);
690
  $slideshow
691
  .text(settings.slideshowStart)
692
- .unbind(cbox_complete+' '+cbox_load)
693
- .one("click", function(){
694
  start();
695
- timeOut = setTimeout(cboxPublic.next, settings.slideshowSpeed);
696
- $(this).removeClass(hover);
697
  });
698
- $cbox.removeClass(className+"on").addClass(className+"off");
699
  };
700
 
701
- if(settings.slideshow && $related.length>1){
702
- if(settings.slideshowAuto){
703
  start();
704
  } else {
705
  stop();
@@ -708,45 +713,52 @@
708
  };
709
 
710
  // Note: to use this within an iframe use the following format: parent.$.fn.colorbox.close();
711
- cboxPublic.close = function () {
712
-
713
- $.event.trigger(cbox_cleanup);
714
- if (settings.onCleanup) {
715
- settings.onCleanup.call(element);
716
- }
717
-
718
- open = FALSE;
719
- $(document).unbind("keydown.cbox_close keydown.cbox_arrows");
720
- $window.unbind(cbox_resize+' resize.cboxie6 scroll.cboxie6');
721
- $overlay.css({cursor: 'auto'}).fadeOut('fast');
722
-
723
- $cbox
724
- .stop(TRUE, FALSE)
725
- .fadeOut('fast', function () {
726
- $('#colorbox iframe').attr('src', 'about:blank');
727
- $loaded.remove();
728
- $cbox.css({'opacity': 1});
729
 
730
- try{
731
- bookmark.focus();
732
- } catch (er){
733
- // do nothing
734
- }
735
 
736
- $.event.trigger(cbox_closed);
737
- if (settings.onClosed) {
738
- settings.onClosed.call(element);
739
  }
740
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
741
  };
742
 
743
  // A method for fetching the current element ColorBox is referencing.
744
  // returns a jQuery object.
745
- cboxPublic.element = function(){ return $(element); };
 
 
746
 
747
- cboxPublic.settings = defaults;
748
 
749
  // Initializes ColorBox when the DOM has loaded
750
- $(cboxPublic.init);
751
 
752
- }(jQuery));
1
+ // ColorBox v1.3.9 - a full featured, light-weight, customizable lightbox based on jQuery 1.3
2
  // c) 2009 Jack Moore - www.colorpowered.com - jack@colorpowered.com
3
  // Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
4
+ (function ($, window) {
5
+
6
+ var
7
+ // ColorBox Default Settings.
8
+ // See http://colorpowered.com/colorbox for details.
9
+ defaults = {
10
+ transition: "elastic",
11
+ speed: 300,
12
+ width: false,
13
+ initialWidth: "600",
14
+ innerWidth: false,
15
+ maxWidth: false,
16
+ height: false,
17
+ initialHeight: "450",
18
+ innerHeight: false,
19
+ maxHeight: false,
20
+ scalePhotos: true,
21
+ scrolling: true,
22
+ inline: false,
23
+ html: false,
24
+ iframe: false,
25
+ photo: false,
26
+ href: false,
27
+ title: false,
28
+ rel: false,
29
+ opacity: 0.9,
30
+ preloading: true,
31
+ current: "image {current} of {total}",
32
+ previous: "previous",
33
+ next: "next",
34
+ close: "close",
35
+ open: false,
36
+ loop: true,
37
+ slideshow: false,
38
+ slideshowAuto: true,
39
+ slideshowSpeed: 2500,
40
+ slideshowStart: "start slideshow",
41
+ slideshowStop: "stop slideshow",
42
+ onOpen: false,
43
+ onLoad: false,
44
+ onComplete: false,
45
+ onCleanup: false,
46
+ onClosed: false,
47
+ overlayClose: true,
48
+ escKey: true,
49
+ arrowKey: true
50
+ },
51
+
52
+ // Abstracting the HTML and event identifiers for easy rebranding
53
+ colorbox = 'colorbox',
54
+ prefix = 'cbox',
55
+
56
+ // Events
57
+ event_open = prefix + '_open',
58
+ event_load = prefix + '_load',
59
+ event_complete = prefix + '_complete',
60
+ event_cleanup = prefix + '_cleanup',
61
+ event_closed = prefix + '_closed',
62
+
63
+ // Special Handling for IE
64
+ 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.
65
+ isIE6 = isIE && $.browser.version < 7,
66
+ event_ie6 = prefix + '_IE6',
67
 
68
  // Cached jQuery Object Variables
69
  $overlay,
70
+ $box,
71
  $wrap,
72
  $content,
73
  $topBorder,
79
  $loaded,
80
  $loadingBay,
81
  $loadingOverlay,
 
82
  $title,
83
  $current,
84
  $slideshow,
98
  open,
99
  active,
100
 
101
+ publicMethod,
102
+ boxElement = prefix + 'Element';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
 
104
  // ****************
105
  // HELPER FUNCTIONS
106
  // ****************
107
+
108
+ // jQuery object generator to reduce code size
109
+ function $div(id, css) {
110
+ id = id ? ' id="' + prefix + id + '"' : '';
111
+ css = css ? ' style="' + css + '"' : '';
112
+ return $('<div' + id + css + '/>');
113
+ }
114
+
115
  // Convert % values to pixels
116
  function setSize(size, dimension) {
117
+ dimension = dimension === 'x' ? $window.width() : $window.height();
118
  return (typeof size === 'string') ? Math.round((size.match(/%/) ? (dimension / 100) * parseInt(size, 10) : parseInt(size, 10))) : size;
119
  }
120
 
132
  settings[i] = settings[i].call(element);
133
  }
134
  }
135
+ settings.rel = settings.rel || element.rel || 'nofollow';
136
+ settings.href = settings.href || $(element).attr('href');
137
  settings.title = settings.title || element.title;
138
  }
139
 
141
 
142
  element = elem;
143
 
144
+ settings = $.extend({}, $(element).data(colorbox));
145
 
146
  process(); // Convert functions to their returned values.
147
 
148
+ if (settings.rel !== 'nofollow') {
149
+ $related = $('.' + boxElement).filter(function () {
150
  var relRelated = $(this).data(colorbox).rel || this.rel;
151
  return (relRelated === settings.rel);
152
  });
153
  index = $related.index(element);
154
 
155
  // Check direct calls to ColorBox.
156
+ if (index === -1) {
157
  $related = $related.add(element);
158
  index = $related.length - 1;
159
  }
163
  }
164
 
165
  if (!open) {
166
+ open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
 
 
167
 
168
  bookmark = element;
169
 
170
+ try {
171
+ bookmark.blur(); // Remove the focus from the calling element.
172
+ }catch (e) {}
173
 
174
+ $.event.trigger(event_open);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  if (settings.onOpen) {
176
  settings.onOpen.call(element);
177
  }
178
 
179
+ // +settings.opacity avoids a problem in IE when using non-zero-prefixed-string-values, like '.5'
180
+ $overlay.css({"opacity": +settings.opacity, "cursor": settings.overlayClose ? "pointer" : "auto"}).show();
181
 
182
  // Opens inital empty ColorBox prior to content being loaded.
183
  settings.w = setSize(settings.initialWidth, 'x');
184
  settings.h = setSize(settings.initialHeight, 'y');
185
+ publicMethod.position(0);
186
 
187
  if (isIE6) {
188
+ $window.bind('resize.' + event_ie6 + ' scroll.' + event_ie6, function () {
189
  $overlay.css({width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft()});
190
+ }).trigger('scroll.' + event_ie6);
191
  }
192
  }
193
 
195
 
196
  $close.html(settings.close).show();
197
 
198
+ publicMethod.slideshow();
199
 
200
+ publicMethod.load();
201
  }
202
 
203
  // ****************
206
  // Usage from within an iframe: parent.$.fn.colorbox.close();
207
  // ****************
208
 
209
+ publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
210
  var $this = this;
211
 
212
+ if (!$this[0] && $this.selector) { // if a selector was given and it didn't match any elements, go ahead and exit.
213
+ return $this;
214
+ }
215
+
216
+ options = options || {};
217
+
218
+ if (callback) {
219
+ options.onComplete = callback;
220
+ }
221
+
222
+ if (!$this[0] || $this.selector === undefined) { // detects $.colorbox() and $.fn.colorbox()
223
+ $this = $('<a/>');
224
+ options.open = true; // assume an immediate open
225
  }
226
 
227
  $this.each(function () {
228
+ $(this).data(colorbox, $.extend({}, $(this).data(colorbox) || defaults, options)).addClass(boxElement);
 
 
 
 
 
 
229
  });
230
 
231
+ if (options.open) {
232
+ launch($this[0]);
233
  }
234
 
235
+ return $this;
236
  };
237
 
238
  // Initialize ColorBox: store common calculations, preload the interface graphics, append the html.
239
  // This preps colorbox for a speedy open when clicked, and lightens the burdon on the browser by only
240
  // having to run once, instead of each time colorbox is opened.
241
+ publicMethod.init = function () {
 
 
 
 
 
 
242
  // Create & Append jQuery Objects
243
  $window = $(window);
244
+ $box = $div().attr({id: colorbox, 'class': isIE ? prefix + 'IE' : ''});
245
+ $overlay = $div("Overlay", isIE6 ? 'position:absolute' : '').hide();
246
+
247
  $wrap = $div("Wrapper");
248
  $content = $div("Content").append(
249
+ $loaded = $div("LoadedContent", 'width:0; height:0'),
250
+ $loadingOverlay = $div("LoadingOverlay").add($div("LoadingGraphic")),
 
251
  $title = $div("Title"),
252
  $current = $div("Current"),
 
253
  $next = $div("Next"),
254
  $prev = $div("Previous"),
255
+ $slideshow = $div("Slideshow"),
256
  $close = $div("Close")
257
  );
258
  $wrap.append( // The 3x3 Grid that makes up ColorBox
259
+ $div().append(
260
  $div("TopLeft"),
261
  $topBorder = $div("TopCenter"),
262
  $div("TopRight")
263
  ),
264
+ $div().append(
265
  $leftBorder = $div("MiddleLeft"),
266
  $content,
267
  $rightBorder = $div("MiddleRight")
268
  ),
269
+ $div().append(
270
  $div("BottomLeft"),
271
  $bottomBorder = $div("BottomCenter"),
272
  $div("BottomRight")
273
  )
274
  ).children().children().css({'float': 'left'});
275
 
276
+ $loadingBay = $div(false, 'position:absolute; width:9999px; visibility:hidden; display:none');
277
 
278
+ $('body').prepend($overlay, $box.append($wrap, $loadingBay));
 
 
 
 
 
 
 
279
 
 
280
  $content.children()
281
+ .hover(function () {
282
+ $(this).addClass('hover');
283
+ }, function () {
284
+ $(this).removeClass('hover');
285
+ }).addClass('hover');
286
 
287
  // Cache values needed for size calculations
288
+ interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();//Subtraction needed for IE6
289
+ interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
290
+ loadedHeight = $loaded.outerHeight(true);
291
+ loadedWidth = $loaded.outerWidth(true);
292
 
293
  // Setting padding to remove the need to do size conversions during the animation step.
294
+ $box.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth}).hide();
295
 
296
+ // Setup button events.
297
+ $next.click(publicMethod.next);
298
+ $prev.click(publicMethod.prev);
299
+ $close.click(publicMethod.close);
300
 
301
  // Adding the 'hover' class allowed the browser to load the hover-state
302
  // background graphics. The class can now can be removed.
303
+ $content.children().removeClass('hover');
304
 
305
+ $('.' + boxElement).live('click', function (e) {
306
+ // checks to see if it was a non-left mouse-click and for clicks modified with ctrl, shift, or alt.
307
+ if ((e.button !== 0 && typeof e.button !== 'undefined') || e.ctrlKey || e.shiftKey || e.altKey) {
308
+ return true;
309
  } else {
310
  launch(this);
311
+ return false;
312
+ }
313
+ });
314
+
315
+ $overlay.click(function () {
316
+ if (settings.overlayClose) {
317
+ publicMethod.close();
318
+ }
319
+ });
320
+
321
+ // Set Navigation Key Bindings
322
+ $(document).bind("keydown", function (e) {
323
+ if (open && settings.escKey && e.keyCode === 27) {
324
+ e.preventDefault();
325
+ publicMethod.close();
326
+ }
327
+ if (open && settings.arrowKey && !active && $related[1]) {
328
+ if (e.keyCode === 37 && (index || settings.loop)) {
329
+ e.preventDefault();
330
+ $prev.click();
331
+ } else if (e.keyCode === 39 && (index < $related.length - 1 || settings.loop)) {
332
+ e.preventDefault();
333
+ $next.click();
334
+ }
335
  }
336
  });
337
  };
338
+
339
+ publicMethod.remove = function () {
340
+ $box.add($overlay).remove();
341
+ $('.' + boxElement).die('click').removeData(colorbox).removeClass(boxElement);
342
+ };
343
 
344
+ publicMethod.position = function (speed, loadedCallback) {
345
  var
346
  animate_speed,
 
347
  // keeps the top and left positions within the browser's viewport.
348
+ posTop = Math.max($window.height() - settings.h - loadedHeight - interfaceHeight, 0) / 2 + $window.scrollTop(),
349
+ posLeft = Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2 + $window.scrollLeft();
350
 
351
  // setting the speed to 0 to reduce the delay between same-sized content.
352
+ animate_speed = ($box.width() === settings.w + loadedWidth && $box.height() === settings.h + loadedHeight) ? 0 : speed;
353
 
354
  // this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
355
  // but it has to be shrank down around the size of div#colorbox when it's done. If not,
356
  // it can invoke an obscure IE bug when using iframes.
357
  $wrap[0].style.width = $wrap[0].style.height = "9999px";
358
 
359
+ function modalDimensions(that) {
360
+ // loading overlay height has to be explicitly set for IE6.
361
  $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = that.style.width;
362
+ $loadingOverlay[0].style.height = $loadingOverlay[1].style.height = $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = that.style.height;
363
  }
364
 
365
+ $box.dequeue().animate({width: settings.w + loadedWidth, height: settings.h + loadedHeight, top: posTop, left: posLeft}, {
366
+ duration: animate_speed,
367
+ complete: function () {
368
  modalDimensions(this);
369
 
370
+ active = false;
371
 
372
  // shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
373
+ $wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
374
+ $wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
375
 
376
+ if (loadedCallback) {
377
+ loadedCallback();
378
+ }
379
  },
380
+ step: function () {
381
  modalDimensions(this);
382
  }
383
  });
384
  };
385
 
386
+ publicMethod.resize = function (options) {
387
+ if (open) {
388
+ options = options || {};
389
+
390
+ if (options.width) {
391
+ settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
392
+ }
393
+ if (options.innerWidth) {
394
+ settings.w = setSize(options.innerWidth, 'x');
395
+ }
396
+ $loaded.css({width: settings.w});
397
+
398
+ if (options.height) {
399
+ settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
400
+ }
401
+ if (options.innerHeight) {
402
+ settings.h = setSize(options.innerHeight, 'y');
403
+ }
404
+ if (!options.innerHeight && !options.height) {
405
  var $child = $loaded.wrapInner("<div style='overflow:auto'></div>").children(); // temporary wrapper to get an accurate estimate of just how high the total content should be.
406
  settings.h = $child.height();
 
407
  $child.replaceWith($child.children()); // ditch the temporary wrapper div used in height calculation
408
+ }
409
+ $loaded.css({height: settings.h});
410
+
411
+ publicMethod.position(settings.transition === "none" ? 0 : settings.speed);
412
+ }
413
+ };
414
+
415
+ publicMethod.prep = function (object) {
416
+ if (!open) {
417
  return;
418
  }
419
 
420
+ var photo,
421
+ speed = settings.transition === "none" ? 0 : settings.speed;
422
+
423
+ $window.unbind('resize.' + prefix);
424
  $loaded.remove();
425
+ $loaded = $div('LoadedContent').html(object);
426
 
427
+ function getWidth() {
428
  settings.w = settings.w || $loaded.width();
429
  settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
430
  return settings.w;
431
  }
432
+ function getHeight() {
433
  settings.h = settings.h || $loaded.height();
434
  settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
435
  return settings.h;
436
  }
437
 
438
  $loaded.hide()
439
+ .appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
440
+ .css({width: getWidth(), overflow: settings.scrolling ? 'auto' : 'hidden'})
441
+ .css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
442
  .prependTo($content);
443
 
444
+ $loadingBay.hide();
445
+
446
+ $('#' + prefix + 'Photo').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.
447
 
448
  // Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay.
449
  if (isIE6) {
450
+ $('select').not($box.find('select')).filter(function () {
451
  return this.style.visibility !== 'hidden';
452
+ }).css({'visibility': 'hidden'}).one(event_cleanup, function () {
453
  this.style.visibility = 'inherit';
454
  });
455
  }
456
 
457
+ function setPosition(s) {
458
+ var prev, prevSrc, next, nextSrc, total = $related.length, loop = settings.loop;
459
+ publicMethod.position(s, function () {
460
+ function defilter() {
461
+ if (isIE) {
462
+ //IE adds a filter when ColorBox fades in and out that can cause problems if the loaded content contains transparent pngs.
463
+ $box[0].style.removeAttribute("filter");
464
+ }
465
+ }
466
+
467
+ if (!open) {
468
+ return;
469
+ }
470
 
471
  if (isIE) {
472
  //This fadeIn helps the bicubic resampling to kick-in.
473
+ if (photo) {
474
+ $loaded.fadeIn(100);
475
+ }
476
  }
477
 
478
  //Waited until the iframe is added to the DOM & it is visible before setting the src.
479
  //This increases compatability with pages using DOM dependent JavaScript.
480
+ if (settings.iframe) {
481
+ $("<iframe frameborder=0" + (settings.scrolling ? "" : " scrolling='no'") + (isIE ? " allowtransparency='true'" : '') + "/>")
482
+ .attr({src: settings.href, name: new Date().getTime()})
483
+ .appendTo($loaded);
484
  }
485
 
486
  $loaded.show();
487
 
488
  $title.show().html(settings.title);
489
 
490
+ if (total > 1) { // handle grouping
491
+ $current.html(settings.current.replace(/\{current\}/, index + 1).replace(/\{total\}/, total)).show();
 
 
492
 
493
+ $next[(loop || index < total - 1) ? "show" : "hide"]().html(settings.next);
494
+ $prev[(loop || index) ? "show" : "hide"]().html(settings.previous);
495
+
496
+ prev = index ? $related[index - 1] : $related[total - 1];
497
+ next = index < total - 1 ? $related[index + 1] : $related[0];
498
+
499
+ if (settings.slideshow) {
500
  $slideshow.show();
501
+ if (index === total - 1 && !loop && $box.is('.' + prefix + 'Slideshow_on')) {
502
+ $slideshow.click();
503
+ }
504
+ }
505
+
506
+ // Preloads images within a rel group
507
+ if (settings.preloading) {
508
+ nextSrc = $(next).data(colorbox).href || next.href;
509
+ prevSrc = $(prev).data(colorbox).href || prev.href;
510
+
511
+ if (isImage(nextSrc)) {
512
+ $('<img/>')[0].src = nextSrc;
513
+ }
514
+
515
+ if (isImage(prevSrc)) {
516
+ $('<img/>')[0].src = prevSrc;
517
+ }
518
  }
519
  }
520
 
521
  $loadingOverlay.hide();
 
522
 
523
+ if (settings.transition === 'fade') {
524
+ $box.fadeTo(speed, 1, function () {
525
+ defilter();
 
 
 
 
 
526
  });
527
+ } else {
528
+ defilter();
529
  }
530
 
531
+ $window.bind('resize.' + prefix, function () {
532
+ publicMethod.position(0);
533
  });
534
+
535
+ $.event.trigger(event_complete);
536
+ if (settings.onComplete) {
537
+ settings.onComplete.call(element);
538
+ }
539
  });
540
  }
541
 
542
+ if (settings.transition === 'fade') {
543
+ $box.fadeTo(speed, 0, function () {
544
+ setPosition(0);
545
+ });
546
+ } else {
547
+ setPosition(speed);
 
 
 
 
 
 
 
 
 
 
548
  }
549
  };
550
 
551
+ publicMethod.load = function () {
552
+ var href, img, setResize, prep = publicMethod.prep;
553
+
554
+ active = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
555
 
556
  element = $related[index];
557
 
558
+ settings = $.extend({}, $(element).data(colorbox));
559
 
560
  //convert functions to static values
561
  process();
562
 
563
+ $.event.trigger(event_load);
564
  if (settings.onLoad) {
565
  settings.onLoad.call(element);
566
  }
567
 
 
568
  settings.h = settings.height ?
569
  setSize(settings.height, 'y') - loadedHeight - interfaceHeight :
570
+ settings.innerHeight && setSize(settings.innerHeight, 'y');
571
+
 
572
  settings.w = settings.width ?
573
  setSize(settings.width, 'x') - loadedWidth - interfaceWidth :
574
+ settings.innerWidth && setSize(settings.innerWidth, 'x');
 
 
575
 
576
  // Sets the minimum dimensions for use in image scaling
577
  settings.mw = settings.w;
579
 
580
  // Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
581
  // If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
582
+ if (settings.maxWidth) {
583
  settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth;
584
  settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
585
  }
586
+ if (settings.maxHeight) {
587
  settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight;
588
  settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
589
  }
591
  href = settings.href;
592
 
593
  $loadingOverlay.show();
 
594
 
595
  if (settings.inline) {
596
  // Inserts an empty placeholder where inline content is being pulled from.
597
  // An event is bound to put inline content back when ColorBox closes or loads new content.
598
+ $div('InlineTemp').hide().insertBefore($(href)[0]).bind(event_load + ' ' + event_cleanup, function () {
599
  $(this).replaceWith($loaded.children());
600
  });
601
+ prep($(href));
602
  } else if (settings.iframe) {
603
  // IFrame element won't be added to the DOM until it is ready to be displayed,
604
  // to avoid problems with DOM-ready JS that might be trying to run in that iframe.
605
+ prep(" ");
606
  } else if (settings.html) {
607
+ prep(settings.html);
608
+ } else if (isImage(href)) {
609
  img = new Image();
610
+ img.onload = function () {
611
  var percent;
612
 
613
  img.onload = null;
614
+ img.id = prefix + 'Photo';
615
+ $(img).css({margin: 'auto', border: 'none', display: 'block', cssFloat: 'left'});
616
 
617
+ if (settings.scalePhotos) {
618
+ setResize = function () {
 
 
 
 
619
  img.height -= img.height * percent;
620
  img.width -= img.width * percent;
621
  };
622
+ if (settings.mw && img.width > settings.mw) {
623
  percent = (img.width - settings.mw) / img.width;
624
  setResize();
625
  }
626
+ if (settings.mh && img.height > settings.mh) {
627
  percent = (img.height - settings.mh) / img.height;
628
  setResize();
629
  }
630
  }
631
 
632
  if (settings.h) {
633
+ img.style.marginTop = Math.max(settings.h - img.height, 0) / 2 + 'px';
634
  }
635
 
636
+ setTimeout(function () { // Chrome will sometimes report a 0 by 0 size if there isn't pause in execution
637
+ prep(img);
638
+ }, 1);
639
 
640
+ if ($related[1] && (index < $related.length - 1 || settings.loop)) {
641
+ $(img).css({cursor: 'pointer'}).click(publicMethod.next);
642
  }
643
 
644
+ if (isIE) {
645
+ img.style.msInterpolationMode = 'bicubic';
646
  }
647
  };
648
  img.src = href;
649
  } else {
650
+ $div().appendTo($loadingBay).load(href, function (data, status, xhr) {
651
+ prep(status === 'error' ? 'Request unsuccessful: ' + xhr.statusText : this);
 
 
 
 
652
  });
653
  }
654
  };
655
 
656
  // Navigates to the next page/image in a set.
657
+ publicMethod.next = function () {
658
+ if (!active) {
659
+ index = index < $related.length - 1 ? index + 1 : 0;
660
+ publicMethod.load();
661
  }
662
  };
663
 
664
+ publicMethod.prev = function () {
665
+ if (!active) {
666
+ index = index ? index - 1 : $related.length - 1;
667
+ publicMethod.load();
668
  }
669
  };
670
 
671
+ publicMethod.slideshow = function () {
672
+ var stop, timeOut, className = prefix + 'Slideshow_';
673
 
674
+ $slideshow.bind(event_closed, function () {
675
  $slideshow.unbind();
676
  clearTimeout(timeOut);
677
+ $box.removeClass(className + "off " + className + "on");
678
  });
679
 
680
+ function start() {
681
  $slideshow
682
  .text(settings.slideshowStop)
683
+ .bind(event_complete, function () {
684
+ timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
685
  })
686
+ .bind(event_load, function () {
687
  clearTimeout(timeOut);
688
+ }).one("click", function () {
689
  stop();
 
690
  });
691
+ $box.removeClass(className + "off").addClass(className + "on");
692
  }
693
 
694
+ stop = function () {
695
  clearTimeout(timeOut);
696
  $slideshow
697
  .text(settings.slideshowStart)
698
+ .unbind(event_complete + ' ' + event_load)
699
+ .one("click", function () {
700
  start();
701
+ timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
 
702
  });
703
+ $box.removeClass(className + "on").addClass(className + "off");
704
  };
705
 
706
+ if (settings.slideshow && $related[1]) {
707
+ if (settings.slideshowAuto) {
708
  start();
709
  } else {
710
  stop();
713
  };
714
 
715
  // Note: to use this within an iframe use the following format: parent.$.fn.colorbox.close();
716
+ publicMethod.close = function () {
717
+ if (open) {
718
+ open = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
719
 
720
+ $.event.trigger(event_cleanup);
 
 
 
 
721
 
722
+ if (settings.onCleanup) {
723
+ settings.onCleanup.call(element);
 
724
  }
725
+
726
+ $window.unbind('.' + prefix + ' .' + event_ie6);
727
+
728
+ $overlay.fadeTo('fast', 0);
729
+
730
+ $box.stop().fadeTo('fast', 0, function () {
731
+ $box.find('iframe').attr('src', 'about:blank'); // change the location of the iframe to avoid a problem in IE with flash objects not clearing.
732
+
733
+ $loaded.remove();
734
+
735
+ $box.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide();
736
+
737
+ try {
738
+ bookmark.focus();
739
+ } catch (e) {
740
+ // do nothing
741
+ }
742
+
743
+ setTimeout(function () {
744
+ $.event.trigger(event_closed);
745
+ if (settings.onClosed) {
746
+ settings.onClosed.call(element);
747
+ }
748
+ }, 1);
749
+ });
750
+ }
751
  };
752
 
753
  // A method for fetching the current element ColorBox is referencing.
754
  // returns a jQuery object.
755
+ publicMethod.element = function () {
756
+ return $(element);
757
+ };
758
 
759
+ publicMethod.settings = defaults;
760
 
761
  // Initializes ColorBox when the DOM has loaded
762
+ $(publicMethod.init);
763
 
764
+ }(jQuery, this));
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.techotronic.de/donate/
4
  Tags: jquery, colorbox, lightbox, images, pictures, photos, gallery, javascript, overlay, nextgen gallery, nextgen-gallery, image, picture, photo, media, slideshow, ngg, mu
5
  Requires at least: 2.8
6
  Tested up to: 3.0
7
- Stable tag: 3.5
8
 
9
  Adds Colorbox/Lightbox functionality to images, grouped by post or page. Works for WordPress and NextGEN galleries. Comes with different themes.
10
 
@@ -44,7 +44,7 @@ Localization
44
 
45
  Is your native language missing? Translating the plugin is easy if you understand english and are fluent in another language. Just send me an email.
46
 
47
- Includes <a href="http://colorpowered.com/colorbox/">ColorBox</a> 1.3.6 jQuery plugin from Jack Moore.
48
  Colorbox is licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT License</a>.
49
  jQuery Colorbox uses the jQuery library version 1.3.2 bundled with Wordpress. Works with jQuery 1.4.2 too.
50
  The picture I used for the screenshots was designed by <a href="http://wallpapers.vintage.it/">Davide Vicariotto</a>
@@ -164,6 +164,9 @@ Feel free to write an email to blog [at] techotronic.de or open a thread at <a h
164
  I'll include new FAQs in every new version. Promise.
165
 
166
  == Changelog ==
 
 
 
167
  = 3.5 (2010-06-16) =
168
  * NEW: Ukrainian translation by <a href="http://www.politcult.com/">Yuri Kryzhanivskyi</a>
169
  * NEW: Italian translation by <a href="http://erkinson.altervista.org/">Erkinson</a>
4
  Tags: jquery, colorbox, lightbox, images, pictures, photos, gallery, javascript, overlay, nextgen gallery, nextgen-gallery, image, picture, photo, media, slideshow, ngg, mu
5
  Requires at least: 2.8
6
  Tested up to: 3.0
7
+ Stable tag: 3.6
8
 
9
  Adds Colorbox/Lightbox functionality to images, grouped by post or page. Works for WordPress and NextGEN galleries. Comes with different themes.
10
 
44
 
45
  Is your native language missing? Translating the plugin is easy if you understand english and are fluent in another language. Just send me an email.
46
 
47
+ Includes <a href="http://colorpowered.com/colorbox/">ColorBox</a> 1.3.9 jQuery plugin from Jack Moore.
48
  Colorbox is licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT License</a>.
49
  jQuery Colorbox uses the jQuery library version 1.3.2 bundled with Wordpress. Works with jQuery 1.4.2 too.
50
  The picture I used for the screenshots was designed by <a href="http://wallpapers.vintage.it/">Davide Vicariotto</a>
164
  I'll include new FAQs in every new version. Promise.
165
 
166
  == Changelog ==
167
+ = 3.6 (2010-09-12) =
168
+ * CHANGE: Update of Colorbox library to version 1.3.9 which fixes lots of bugs. Most notably the "0 by 0" bug in Chrome.
169
+
170
  = 3.5 (2010-06-16) =
171
  * NEW: Ukrainian translation by <a href="http://www.politcult.com/">Yuri Kryzhanivskyi</a>
172
  * NEW: Italian translation by <a href="http://erkinson.altervista.org/">Erkinson</a>