Changeset 9976 for extensions/lightbox/js
- Timestamp:
- Apr 2, 2011, 11:53:02 AM (13 years ago)
- Location:
- extensions/lightbox/js
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/lightbox/js/jquery.colorbox-min.js
r7949 r9976 1 // ColorBox v1.3.1 4- a full featured, light-weight, customizable lightbox based on jQuery 1.3+2 // Copyright (c) 201 0Jack Moore - jack@colorpowered.com1 // ColorBox v1.3.16 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+ 2 // Copyright (c) 2011 Jack Moore - jack@colorpowered.com 3 3 // Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 4 (function( b,ib){var t="none",M="LoadedContent",c=false,v="resize.",o="y",q="auto",e=true,L="nofollow",m="x";function f(a,c){a=a?' id="'+i+a+'"':"";c=c?' style="'+c+'"':"";return b("<div"+a+c+"/>")}function p(a,b){b=b===m?n.width():n.height();return typeof a==="string"?Math.round(/%/.test(a)?b/100*parseInt(a,10):parseInt(a,10)):a}function U(b){return a.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(b)}function cb(a){for(var c in a)if(b.isFunction(a[c])&&c.substring(0,2)!=="on")a[c]=a[c].call(l);a.rel=a.rel||l.rel||L;a.href=a.href||b(l).attr("href");a.title=a.title||l.title;return a}function w(c,a){a&&a.call(l);b.event.trigger(c)}function jb(){var b,e=i+"Slideshow_",c="click."+i,f,k;if(a.slideshow&&h[1]){f=function(){F.text(a.slideshowStop).unbind(c).bind(V,function(){if(g<h.length-1||a.loop)b=setTimeout(d.next,a.slideshowSpeed)}).bind(W,function(){clearTimeout(b)}).one(c+" "+N,k);j.removeClass(e+"off").addClass(e+"on");b=setTimeout(d.next,a.slideshowSpeed)};k=function(){clearTimeout(b);F.text(a.slideshowStart).unbind([V,W,N,c].join(" ")).one(c,f);j.removeClass(e+"on").addClass(e+"off")};a.slideshowAuto?f():k()}}function db(c){if(!O){l=c;a=cb(b.extend({},b.data(l,r)));h=b(l);g=0;if(a.rel!==L){h=b("."+G).filter(function(){return (b.data(this,r).rel||this.rel)===a.rel});g=h.index(l);if(g===-1){h=h.add(l);g=h.length-1}}if(!u){u=E=e;j.show();if(a.returnFocus)try{l.blur();b(l).one(eb,function(){try{this.focus()}catch(a){}})}catch(f){}x.css({opacity:+a.opacity,cursor:a.overlayClose?"pointer":q}).show();a.w=p(a.initialWidth,m);a.h=p(a.initialHeight,o);d.position(0);X&&n.bind(v+P+" scroll."+P,function(){x.css({width:n.width(),height:n.height(),top:n.scrollTop(),left:n.scrollLeft()})}).trigger("scroll."+P);w(fb,a.onOpen);Y.add(H).add(I).add(F).add(Z).hide();ab.html(a.close).show()}d.load(e)}}var gb={transition:"elastic",speed:300,width:c,initialWidth:"600",innerWidth:c,maxWidth:c,height:c,initialHeight:"450",innerHeight:c,maxHeight:c,scalePhotos:e,scrolling:e,inline:c,html:c,iframe:c,photo:c,href:c,title:c,rel:c,opacity:.9,preloading:e,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:c,returnFocus:e,loop:e,slideshow:c,slideshowAuto:e,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:c,onLoad:c,onComplete:c,onCleanup:c,onClosed:c,overlayClose:e,escKey:e,arrowKey:e},r="colorbox",i="cbox",fb=i+"_open",W=i+"_load",V=i+"_complete",N=i+"_cleanup",eb=i+"_closed",Q=i+"_purge",hb=i+"_loaded",A=b.browser.msie&&!b.support.opacity,X=A&&b.browser.version<7,P=i+"_IE6",x,j,B,s,bb,T,R,S,h,n,k,J,K,Z,Y,F,I,H,ab,C,D,y,z,l,g,a,u,E,O=c,d,G=i+"Element";d=b.fn[r]=b[r]=function(c,f){var a=this,d;if(!a[0]&&a.selector)return a;c=c||{};if(f)c.onComplete=f;if(!a[0]||a.selector===undefined){a=b("<a/>");c.open=e}a.each(function(){b.data(this,r,b.extend({},b.data(this,r)||gb,c));b(this).addClass(G)});d=c.open;if(b.isFunction(d))d=d.call(a);d&&db(a[0]);return a};d.init=function(){var l="hover",m="clear:left";n=b(ib);j=f().attr({id:r,"class":A?i+"IE":""});x=f("Overlay",X?"position:absolute":"").hide();B=f("Wrapper");s=f("Content").append(k=f(M,"width:0; height:0; overflow:hidden"),K=f("LoadingOverlay").add(f("LoadingGraphic")),Z=f("Title"),Y=f("Current"),I=f("Next"),H=f("Previous"),F=f("Slideshow").bind(fb,jb),ab=f("Close"));B.append(f().append(f("TopLeft"),bb=f("TopCenter"),f("TopRight")),f(c,m).append(T=f("MiddleLeft"),s,R=f("MiddleRight")),f(c,m).append(f("BottomLeft"),S=f("BottomCenter"),f("BottomRight"))).children().children().css({"float":"left"});J=f(c,"position:absolute; width:9999px; visibility:hidden; display:none");b("body").prepend(x,j.append(B,J));s.children().hover(function(){b(this).addClass(l)},function(){b(this).removeClass(l)}).addClass(l);C=bb.height()+S.height()+s.outerHeight(e)-s.height();D=T.width()+R.width()+s.outerWidth(e)-s.width();y=k.outerHeight(e);z=k.outerWidth(e);j.css({"padding-bottom":C,"padding-right":D}).hide();I.click(d.next);H.click(d.prev);ab.click(d.close);s.children().removeClass(l);b("."+G).live("click",function(a){if(!(a.button!==0&&typeof a.button!=="undefined"||a.ctrlKey||a.shiftKey||a.altKey)){a.preventDefault();db(this)}});x.click(function(){a.overlayClose&&d.close()});b(document).bind("keydown",function(b){if(u&&a.escKey&&b.keyCode===27){b.preventDefault();d.close()}if(u&&a.arrowKey&&!E&&h[1])if(b.keyCode===37&&(g||a.loop)){b.preventDefault();H.click()}else if(b.keyCode===39&&(g<h.length-1||a.loop)){b.preventDefault();I.click()}})};d.remove=function(){j.add(x).remove();b("."+G).die("click").removeData(r).removeClass(G)};d.position=function(f,d){function b(a){bb[0].style.width=S[0].style.width=s[0].style.width=a.style.width;K[0].style.height=K[1].style.height=s[0].style.height=T[0].style.height=R[0].style.height=a.style.height}var e,h=Math.max(document.documentElement.clientHeight-a.h-y-C,0)/2+n.scrollTop(),g=Math.max(n.width()-a.w-z-D,0)/2+n.scrollLeft();e=j.width()===a.w+z&&j.height()===a.h+y?0:f;B[0].style.width=B[0].style.height="9999px";j.dequeue().animate({width:a.w+z,height:a.h+y,top:h,left:g},{duration:e,complete:function(){b(this);E=c;B[0].style.width=a.w+z+D+"px";B[0].style.height=a.h+y+C+"px";d&&d()},step:function(){b(this)}})};d.resize=function(b){if(u){b=b||{};if(b.width)a.w=p(b.width,m)-z-D;if(b.innerWidth)a.w=p(b.innerWidth,m);k.css({width:a.w});if(b.height)a.h=p(b.height,o)-y-C;if(b.innerHeight)a.h=p(b.innerHeight,o);if(!b.innerHeight&&!b.height){b=k.wrapInner("<div style='overflow:auto'></div>").children();a.h=b.height();b.replaceWith(b.children())}k.css({height:a.h});d.position(a.transition===t?0:a.speed)}};d.prep=function(o){var e="hidden";function m(t){var q,f,o,e,m=h.length,s=a.loop;d.position(t,function(){if(u){A&&p&&k.fadeIn(100);k.show();w(hb);Z.show().html(a.title);if(m>1){typeof a.current==="string"&&Y.html(a.current.replace(/\{current\}/,g+1).replace(/\{total\}/,m)).show();I[s||g<m-1?"show":"hide"]().html(a.next);H[s||g?"show":"hide"]().html(a.previous);q=g?h[g-1]:h[m-1];o=g<m-1?h[g+1]:h[0];a.slideshow&&F.show();if(a.preloading){e=b.data(o,r).href||o.href;f=b.data(q,r).href||q.href;e=b.isFunction(e)?e.call(o):e;f=b.isFunction(f)?f.call(q):f;if(U(e))b("<img/>")[0].src=e;if(U(f))b("<img/>")[0].src=f}}K.hide();if(a.transition==="fade")j.fadeTo(l,1,function(){if(A)j[0].style.filter=c});else if(A)j[0].style.filter=c;n.bind(v+i,function(){d.position(0)});w(V,a.onComplete)}})}if(u){var p,l=a.transition===t?0:a.speed;n.unbind(v+i);k.remove();k=f(M).html(o);k.hide().appendTo(J.show()).css({width:function(){a.w=a.w||k.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}(),overflow:a.scrolling?q:e}).css({height:function(){a.h=a.h||k.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}()}).prependTo(s);J.hide();b("#"+i+"Photo").css({cssFloat:t,marginLeft:q,marginRight:q});X&&b("select").not(j.find("select")).filter(function(){return this.style.visibility!==e}).css({visibility:e}).one(N,function(){this.style.visibility="inherit"});a.transition==="fade"?j.fadeTo(l,0,function(){m(0)}):m(l)}};d.load=function(u){var n,c,s,q=d.prep;E=e;l=h[g];u||(a=cb(b.extend({},b.data(l,r))));w(Q);w(W,a.onLoad);a.h=a.height?p(a.height,o)-y-C:a.innerHeight&&p(a.innerHeight,o);a.w=a.width?p(a.width,m)-z-D:a.innerWidth&&p(a.innerWidth,m);a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=p(a.maxWidth,m)-z-D;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=p(a.maxHeight,o)-y-C;a.mh=a.h&&a.h<a.mh?a.h:a.mh}n=a.href;K.show();if(a.inline){f().hide().insertBefore(b(n)[0]).one(Q,function(){b(this).replaceWith(k.children())});q(b(n))}else if(a.iframe){j.one(hb,function(){var c=b("<iframe name='"+(new Date).getTime()+"' frameborder=0"+(a.scrolling?"":" scrolling='no'")+(A?" allowtransparency='true'":"")+" style='width:100%; height:100%; border:0; display:block;'/>");c[0].src=a.href;c.appendTo(k).one(Q,function(){c[0].src='//about:blank'})});q(" ")}else if(a.html)q(a.html);else if(U(n)){c=new Image;c.onload=function(){var e;c.onload=null;c.id=i+"Photo";b(c).css({border:t,display:"block",cssFloat:"left"});if(a.scalePhotos){s=function(){c.height-=c.height*e;c.width-=c.width*e};if(a.mw&&c.width>a.mw){e=(c.width-a.mw)/c.width;s()}if(a.mh&&c.height>a.mh){e=(c.height-a.mh)/c.height;s()}}if(a.h)c.style.marginTop=Math.max(a.h-c.height,0)/2+"px";h[1]&&(g<h.length-1||a.loop)&&b(c).css({cursor:"pointer"}).click(d.next);if(A)c.style.msInterpolationMode="bicubic";setTimeout(function(){q(c)},1)};setTimeout(function(){c.src=n},1)}else n&&J.load(n,function(d,c,a){q(c==="error"?"Request unsuccessful: "+a.statusText:b(this).children())})};d.next=function(){if(!E){g=g<h.length-1?g+1:0;d.load()}};d.prev=function(){if(!E){g=g?g-1:h.length-1;d.load()}};d.close=function(){if(u&&!O){O=e;u=c;w(N,a.onCleanup);n.unbind("."+i+" ."+P);x.fadeTo("fast",0);j.stop().fadeTo("fast",0,function(){w(Q);k.remove();j.add(x).css({opacity:1,cursor:q}).hide();setTimeout(function(){O=c;w(eb,a.onClosed)},1)})}};d.element=function(){return b(l)};d.settings=gb;b(d.init)})(jQuery,this)4 (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); -
extensions/lightbox/js/jquery.colorbox.js
r7949 r9976 1 // ColorBox v1.3.1 4- a full featured, light-weight, customizable lightbox based on jQuery 1.3+2 // Copyright (c) 201 0Jack Moore - jack@colorpowered.com1 // ColorBox v1.3.16 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+ 2 // Copyright (c) 2011 Jack Moore - jack@colorpowered.com 3 3 // Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 4 (function ($, window) { 5 4 (function ($, document, window) { 6 5 var 7 6 // ColorBox Default Settings. … … 23 22 html: false, 24 23 iframe: false, 24 fastIframe: true, 25 25 photo: false, 26 26 href: false, … … 62 62 event_closed = prefix + '_closed', 63 63 event_purge = prefix + '_purge', 64 event_loaded = prefix + '_loaded',65 64 66 65 // Special Handling for IE … … 89 88 $prev, 90 89 $close, 90 $groupControls, 91 91 92 92 // Variables for cached values or use across multiple functions 93 settings = {}, 93 94 interfaceHeight, 94 95 interfaceWidth, … … 97 98 element, 98 99 index, 99 settings,100 photo, 100 101 open, 101 102 active, … … 110 111 111 112 // jQuery object generator to reduce code size 112 function $div(id, css) { 113 id = id ? ' id="' + prefix + id + '"' : ''; 114 css = css ? ' style="' + css + '"' : ''; 115 return $('<div' + id + css + '/>'); 113 function $div(id, cssText) { 114 var div = document.createElement('div'); 115 if (id) { 116 div.id = prefix + id; 117 } 118 div.style.cssText = cssText || false; 119 return $(div); 116 120 } 117 121 … … 136 140 } 137 141 settings.rel = settings.rel || element.rel || 'nofollow'; 138 settings.href = settings.href || $(element).attr('href');142 settings.href = $.trim(settings.href || $(element).attr('href')); 139 143 settings.title = settings.title || element.title; 140 return settings;141 144 } 142 145 … … 198 201 element = elem; 199 202 200 settings = process($.extend({}, $.data(element, colorbox)));203 process($.extend(settings, $.data(element, colorbox))); 201 204 202 205 $related = $(element); … … 249 252 $window.bind('resize.' + event_ie6 + ' scroll.' + event_ie6, function () { 250 253 $overlay.css({width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft()}); 251 }).trigger(' scroll.' + event_ie6);254 }).trigger('resize.' + event_ie6); 252 255 } 253 256 254 257 trigger(event_open, settings.onOpen); 255 258 256 $ current.add($prev).add($next).add($slideshow).add($title).hide();259 $groupControls.add($title).hide(); 257 260 258 261 $close.html(settings.close).show(); … … 311 314 // Create & Append jQuery Objects 312 315 $window = $(window); 313 $box = $div().attr({id: colorbox, 'class': isIE ? prefix + 'IE': ''});316 $box = $div().attr({id: colorbox, 'class': isIE ? prefix + (isIE6 ? 'IE6' : 'IE') : ''}); 314 317 $overlay = $div("Overlay", isIE6 ? 'position:absolute' : '').hide(); 315 318 … … 363 366 $box.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth}).hide(); 364 367 365 // Setup button events. 366 $next.click(publicMethod.next); 367 $prev.click(publicMethod.prev); 368 $close.click(publicMethod.close); 368 // Setup button events. 369 $next.click(function () { 370 publicMethod.next(); 371 }); 372 $prev.click(function () { 373 publicMethod.prev(); 374 }); 375 $close.click(function () { 376 publicMethod.close(); 377 }); 378 379 $groupControls = $next.add($prev).add($current).add($slideshow); 369 380 370 381 // Adding the 'hover' class allowed the browser to load the hover-state … … 387 398 388 399 // Set Navigation Key Bindings 389 $(document).bind("keydown", function (e) { 390 if (open && settings.escKey && e.keyCode === 27) { 400 $(document).bind('keydown.' + prefix, function (e) { 401 var key = e.keyCode; 402 if (open && settings.escKey && key === 27) { 391 403 e.preventDefault(); 392 404 publicMethod.close(); 393 405 } 394 if (open && settings.arrowKey && !active &&$related[1]) {395 if ( e.keyCode === 37 && (index || settings.loop)) {406 if (open && settings.arrowKey && $related[1]) { 407 if (key === 37) { 396 408 e.preventDefault(); 397 409 $prev.click(); 398 } else if ( e.keyCode === 39 && (index < $related.length - 1 || settings.loop)) {410 } else if (key === 39) { 399 411 e.preventDefault(); 400 412 $next.click(); … … 485 497 } 486 498 487 var photo, 488 speed = settings.transition === "none" ? 0 : settings.speed; 499 var speed = settings.transition === "none" ? 0 : settings.speed; 489 500 490 501 $window.unbind('resize.' + prefix); … … 512 523 513 524 // 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. 514 $('#' + prefix + 'Photo').css({cssFloat: 'none', marginLeft: 'auto', marginRight: 'auto'}); 515 525 //$(photo).css({'float': 'none', marginLeft: 'auto', marginRight: 'auto'}); 526 527 $(photo).css({'float': 'none'}); 528 516 529 // Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay. 517 530 if (isIE6) { … … 522 535 }); 523 536 } 524 537 525 538 function setPosition(s) { 526 var prev, prevSrc, next, nextSrc, total = $related.length, loop = settings.loop;527 539 publicMethod.position(s, function () { 528 function defilter() { 529 if (isIE) { 530 //IE adds a filter when ColorBox fades in and out that can cause problems if the loaded content contains transparent pngs. 531 $box[0].style.filter = false; 532 } 533 } 540 var prev, prevSrc, next, nextSrc, total = $related.length, iframe, complete; 534 541 535 542 if (!open) { 536 543 return; 537 544 } 545 546 complete = function () { 547 $loadingOverlay.hide(); 548 trigger(event_complete, settings.onComplete); 549 }; 538 550 539 551 if (isIE) { … … 544 556 } 545 557 546 $loaded.show(); 547 548 trigger(event_loaded); 549 550 $title.show().html(settings.title); 558 $title.html(settings.title).add($loaded).show(); 551 559 552 560 if (total > 1) { // handle grouping … … 555 563 } 556 564 557 $next[( loop || index < total - 1) ? "show" : "hide"]().html(settings.next);558 $prev[( loop || index) ? "show" : "hide"]().html(settings.previous);565 $next[(settings.loop || index < total - 1) ? "show" : "hide"]().html(settings.next); 566 $prev[(settings.loop || index) ? "show" : "hide"]().html(settings.previous); 559 567 560 568 prev = index ? $related[index - 1] : $related[total - 1]; … … 581 589 } 582 590 } 583 } 584 585 $loadingOverlay.hide(); 591 } else { 592 $groupControls.hide(); 593 } 594 595 if (settings.iframe) { 596 iframe = $('<iframe/>').addClass(prefix + 'Iframe')[0]; 597 598 if (settings.fastIframe) { 599 complete(); 600 } else { 601 $(iframe).load(complete); 602 } 603 iframe.name = prefix + (+new Date()); 604 iframe.src = settings.href; 605 606 if (!settings.scrolling) { 607 iframe.scrolling = "no"; 608 } 609 610 if (isIE) { 611 iframe.frameBorder=0; 612 iframe.allowTransparency = "true"; 613 } 614 615 $(iframe).appendTo($loaded).one(event_purge, function () { 616 iframe.src = "//about:blank"; 617 }); 618 } else { 619 complete(); 620 } 586 621 587 622 if (settings.transition === 'fade') { 588 623 $box.fadeTo(speed, 1, function () { 589 defilter();624 $box[0].style.filter = ""; 590 625 }); 591 626 } else { 592 defilter();627 $box[0].style.filter = ""; 593 628 } 594 629 … … 596 631 publicMethod.position(0); 597 632 }); 598 599 trigger(event_complete, settings.onComplete);600 633 }); 601 634 } … … 611 644 612 645 publicMethod.load = function (launched) { 613 var href, img,setResize, prep = publicMethod.prep;646 var href, setResize, prep = publicMethod.prep; 614 647 615 648 active = true; 649 650 photo = false; 651 616 652 element = $related[index]; 617 653 618 654 if (!launched) { 619 settings = process($.extend({}, $.data(element, colorbox)));655 process($.extend(settings, $.data(element, colorbox))); 620 656 } 621 657 … … 661 697 // IFrame element won't be added to the DOM until it is ready to be displayed, 662 698 // to avoid problems with DOM-ready JS that might be trying to run in that iframe. 663 $box.one(event_loaded, function () {664 var $iframe = $("<iframe name='" + new Date().getTime() + "' frameborder=0" + (settings.scrolling ? "" : " scrolling='no'") + (isIE ? " allowtransparency='true'" : '') + " style='width:100%; height:100%; border:0; display:block;'/>");665 $iframe[0].src = settings.href;666 $iframe.appendTo($loaded).one(event_purge, function () {667 $iframe[0].src = '//about:blank';668 });669 });670 671 699 prep(" "); 672 700 } else if (settings.html) { 673 701 prep(settings.html); 674 702 } else if (isImage(href)) { 675 img = new Image(); 676 img.onload = function () { 703 $(photo = new Image()) 704 .addClass(prefix + 'Photo') 705 .error(function () { 706 settings.title = false; 707 prep($div('Error').text('This image could not be loaded')); 708 }) 709 .load(function () { 677 710 var percent; 678 img.onload = null; 679 img.id = prefix + 'Photo'; 680 $(img).css({border: 'none', display: 'block', cssFloat: 'left'}); 711 photo.onload = null; //stops animated gifs from firing the onload repeatedly. 712 681 713 if (settings.scalePhotos) { 682 714 setResize = function () { 683 img.height -= img.height * percent;684 img.width -= img.width * percent;715 photo.height -= photo.height * percent; 716 photo.width -= photo.width * percent; 685 717 }; 686 if (settings.mw && img.width > settings.mw) {687 percent = ( img.width - settings.mw) / img.width;718 if (settings.mw && photo.width > settings.mw) { 719 percent = (photo.width - settings.mw) / photo.width; 688 720 setResize(); 689 721 } 690 if (settings.mh && img.height > settings.mh) {691 percent = ( img.height - settings.mh) / img.height;722 if (settings.mh && photo.height > settings.mh) { 723 percent = (photo.height - settings.mh) / photo.height; 692 724 setResize(); 693 725 } … … 695 727 696 728 if (settings.h) { 697 img.style.marginTop = Math.max(settings.h - img.height, 0) / 2 + 'px';729 photo.style.marginTop = Math.max(settings.h - photo.height, 0) / 2 + 'px'; 698 730 } 699 731 700 732 if ($related[1] && (index < $related.length - 1 || settings.loop)) { 701 $(img).css({cursor: 'pointer'}).click(publicMethod.next); 733 photo.style.cursor = 'pointer'; 734 photo.onclick = function () { 735 publicMethod.next(); 736 }; 702 737 } 703 738 704 739 if (isIE) { 705 img.style.msInterpolationMode = 'bicubic';706 } 707 708 setTimeout(function () { // Chrome will sometimes report a 0 by 0 size if there isn't pause in execution709 prep( img);740 photo.style.msInterpolationMode = 'bicubic'; 741 } 742 743 setTimeout(function () { // A pause because Chrome will sometimes report a 0 by 0 size otherwise. 744 prep(photo); 710 745 }, 1); 711 } ;712 713 setTimeout(function () { // Opera 10.6+ will sometimes load the src before the onload function is set714 img.src = href;715 }, 1); 746 }); 747 748 setTimeout(function () { // A pause because Opera 10.6+ will sometimes not run the onload function otherwise. 749 photo.src = href; 750 }, 1); 716 751 } else if (href) { 717 752 $loadingBay.load(href, function (data, status, xhr) { 718 prep(status === 'error' ? 'Request unsuccessful: ' + xhr.statusText : $(this).children());753 prep(status === 'error' ? $div('Error').text('Request unsuccessful: ' + xhr.statusText) : $(this).contents()); 719 754 }); 720 755 } 721 756 }; 722 757 723 758 // Navigates to the next page/image in a set. 724 759 publicMethod.next = function () { 725 if (!active ) {760 if (!active && $related[1] && (index < $related.length - 1 || settings.loop)) { 726 761 index = index < $related.length - 1 ? index + 1 : 0; 727 762 publicMethod.load(); … … 730 765 731 766 publicMethod.prev = function () { 732 if (!active ) {767 if (!active && $related[1] && (index || settings.loop)) { 733 768 index = index ? index - 1 : $related.length - 1; 734 769 publicMethod.load(); … … 739 774 publicMethod.close = function () { 740 775 if (open && !closing) { 776 741 777 closing = true; 742 778 … … 747 783 $window.unbind('.' + prefix + ' .' + event_ie6); 748 784 749 $overlay.fadeTo('fast', 0); 750 751 $box.stop().fadeTo('fast', 0, function () { 785 $overlay.fadeTo(200, 0); 786 787 $box.stop().fadeTo(300, 0, function () { 788 789 $box.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide(); 752 790 753 791 trigger(event_purge); 754 792 755 793 $loaded.remove(); 756 757 $box.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide();758 794 759 795 setTimeout(function () { … … 776 812 $(publicMethod.init); 777 813 778 }(jQuery, this));814 }(jQuery, document, this));
Note: See TracChangeset
for help on using the changeset viewer.