Version Description
- Updated to latest Colorbox libraries
Download this release
Release Info
Developer | freediver |
Plugin | Smart YouTube PRO |
Version | 4.2.0 |
Comparing to | |
See all releases |
Code changes from version 4.1.9 to 4.2.0
- javascripts/jquery.colorbox-min.js +6 -4
- javascripts/jquery.colorbox.js +551 -364
- readme.txt +3 -0
- smartyoutube.php +1 -1
javascripts/jquery.colorbox-min.js
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
|
|
|
1 |
+
/*
|
2 |
+
jQuery ColorBox v1.3.32 - 2013-01-31
|
3 |
+
(c) 2013 Jack Moore - jacklmoore.com/colorbox
|
4 |
+
license: http://www.opensource.org/licenses/mit-license.php
|
5 |
+
*/
|
6 |
+
(function(e,t,i){function o(i,o,n){var h=t.createElement(i);return o&&(h.id=U+o),n&&(h.style.cssText=n),e(h)}function n(e){var t=b.length,i=(A+e)%t;return 0>i?t+i:i}function h(e,t){return Math.round((/%/.test(e)?("x"===t?T.width():T.height())/100:1)*parseInt(e,10))}function l(e){return _.photo||/\.(gif|png|jp(e|g|eg)|bmp|ico)((#|\?).*)?$/i.test(e)}function r(){var t,i=e.data(N,J);null==i?(_=e.extend({},$),console&&console.log&&console.log("Error: cboxElement missing settings object")):_=e.extend({},i);for(t in _)e.isFunction(_[t])&&"on"!==t.slice(0,2)&&(_[t]=_[t].call(N));_.rel=_.rel||N.rel||e(N).data("rel")||"nofollow",_.href=_.href||e(N).attr("href"),_.title=_.title||N.title,"string"==typeof _.href&&(_.href=e.trim(_.href))}function s(i,o){e(t).trigger(i),rt.trigger(i),e.isFunction(o)&&o.call(N)}function a(){var e,t,i,o,n,h=U+"Slideshow_",l="click."+U;_.slideshow&&b[1]?(t=function(){clearTimeout(e)},i=function(){(_.loop||b[A+1])&&(e=setTimeout(G.next,_.slideshowSpeed))},o=function(){I.html(_.slideshowStop).unbind(l).one(l,n),rt.bind(et,i).bind(Z,t).bind(tt,n),p.removeClass(h+"off").addClass(h+"on")},n=function(){t(),rt.unbind(et,i).unbind(Z,t).unbind(tt,n),I.html(_.slideshowStart).unbind(l).one(l,function(){G.next(),o()}),p.removeClass(h+"on").addClass(h+"off")},_.slideshowAuto?o():n()):p.removeClass(h+"off "+h+"on")}function d(t){j||(N=t,r(),b=e(N),A=0,"nofollow"!==_.rel&&(b=e("."+V).filter(function(){var t,i=e.data(this,J);return i&&(t=e(this).data("rel")||i.rel||this.rel),t===_.rel}),A=b.index(N),-1===A&&(b=b.add(N),A=b.length-1)),P||(P=R=!0,p.css({visibility:"hidden",display:"block"}),C=o(st,"LoadedContent","width:0; height:0; overflow:hidden").appendTo(w),K=g.height()+x.height()+w.outerHeight(!0)-w.height(),z=y.width()+v.width()+w.outerWidth(!0)-w.width(),D=C.outerHeight(!0),B=C.outerWidth(!0),_.returnFocus&&(e(N).blur(),rt.one(it,function(){e(N).focus()})),f.css({opacity:parseFloat(_.opacity),cursor:_.overlayClose?"pointer":"auto",visibility:"visible"}).show(),_.w=h(_.initialWidth,"x"),_.h=h(_.initialHeight,"y"),G.position(),ht&&T.bind("resize."+lt+" scroll."+lt,function(){f.css({width:T.width(),height:T.height(),top:T.scrollTop(),left:T.scrollLeft()})}).trigger("resize."+lt),a(),s(Y,_.onOpen),S.add(H).hide(),F.html(_.close).show()),G.load(!0))}function c(){!p&&t.body&&(X=!1,T=e(i),p=o(st).attr({id:J,"class":nt?U+(ht?"IE6":"IE"):""}).hide(),f=o(st,"Overlay",ht?"position:absolute":"").hide(),W=o(st,"LoadingOverlay").add(o(st,"LoadingGraphic")),m=o(st,"Wrapper"),w=o(st,"Content").append(H=o(st,"Title"),E=o(st,"Current"),L=o(st,"Next"),M=o(st,"Previous"),I=o(st,"Slideshow"),F=o(st,"Close")),m.append(o(st).append(o(st,"TopLeft"),g=o(st,"TopCenter"),o(st,"TopRight")),o(st,!1,"clear:left").append(y=o(st,"MiddleLeft"),w,v=o(st,"MiddleRight")),o(st,!1,"clear:left").append(o(st,"BottomLeft"),x=o(st,"BottomCenter"),o(st,"BottomRight"))).find("div div").css({"float":"left"}),k=o(st,!1,"position:absolute; width:9999px; visibility:hidden; display:none"),S=L.add(M).add(E).add(I),e(t.body).append(f,p.append(m,k)))}function u(){function i(e){e.which>1||e.shiftKey||e.altKey||e.metaKey||(e.preventDefault(),d(this))}return p?(X||(X=!0,L.click(function(){G.next()}),M.click(function(){G.prev()}),F.click(function(){G.close()}),f.click(function(){_.overlayClose&&G.close()}),e(t).bind("keydown."+U,function(e){var t=e.keyCode;P&&_.escKey&&27===t&&(e.preventDefault(),G.close()),P&&_.arrowKey&&b[1]&&(37===t?(e.preventDefault(),M.click()):39===t&&(e.preventDefault(),L.click()))}),e.isFunction(e.fn.on)?e(t).on("click."+U,"."+V,i):e("."+V).live("click."+U,i)),!0):!1}var f,p,m,w,g,y,v,x,b,T,C,k,W,H,E,I,L,M,F,S,_,K,z,D,B,N,A,O,P,R,j,q,G,Q,X,$={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,className:!1,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",open:!1,returnFocus:!0,reposition:!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,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0},J="colorbox",U="cbox",V=U+"Element",Y=U+"_open",Z=U+"_load",et=U+"_complete",tt=U+"_cleanup",it=U+"_closed",ot=U+"_purge",nt=!e.support.leadingWhitespace,ht=nt&&!i.XMLHttpRequest,lt=U+"_IE6",rt=e({}),st="div";e.colorbox||(e(c),G=e.fn[J]=e[J]=function(t,i){var o=this;if(t=t||{},c(),u()){if(e.isFunction(o))o=e("<a/>"),t.open=!0;else if(!o[0])return o;i&&(t.onComplete=i),o.each(function(){e.data(this,J,e.extend({},e.data(this,J)||$,t))}).addClass(V),(e.isFunction(t.open)&&t.open.call(o)||t.open)&&d(o[0])}return o},G.position=function(e,t){function i(e){g[0].style.width=x[0].style.width=w[0].style.width=parseInt(e.style.width,10)-z+"px",w[0].style.height=y[0].style.height=v[0].style.height=parseInt(e.style.height,10)-K+"px"}var o,n,l,r=0,s=0,a=p.offset();T.unbind("resize."+U),p.css({top:-9e4,left:-9e4}),n=T.scrollTop(),l=T.scrollLeft(),_.fixed&&!ht?(a.top-=n,a.left-=l,p.css({position:"fixed"})):(r=n,s=l,p.css({position:"absolute"})),s+=_.right!==!1?Math.max(T.width()-_.w-B-z-h(_.right,"x"),0):_.left!==!1?h(_.left,"x"):Math.round(Math.max(T.width()-_.w-B-z,0)/2),r+=_.bottom!==!1?Math.max(T.height()-_.h-D-K-h(_.bottom,"y"),0):_.top!==!1?h(_.top,"y"):Math.round(Math.max(T.height()-_.h-D-K,0)/2),p.css({top:a.top,left:a.left,visibility:"visible"}),e=p.width()===_.w+B&&p.height()===_.h+D?0:e||0,m[0].style.width=m[0].style.height="9999px",o={width:_.w+B+z,height:_.h+D+K,top:r,left:s},0===e&&p.css(o),p.dequeue().animate(o,{duration:e,complete:function(){i(this),R=!1,m[0].style.width=_.w+B+z+"px",m[0].style.height=_.h+D+K+"px",_.reposition&&setTimeout(function(){T.bind("resize."+U,G.position)},1),t&&t()},step:function(){i(this)}})},G.resize=function(e){P&&(e=e||{},e.width&&(_.w=h(e.width,"x")-B-z),e.innerWidth&&(_.w=h(e.innerWidth,"x")),C.css({width:_.w}),e.height&&(_.h=h(e.height,"y")-D-K),e.innerHeight&&(_.h=h(e.innerHeight,"y")),e.innerHeight||e.height||(C.css({height:"auto"}),_.h=C.height()),C.css({height:_.h}),G.position("none"===_.transition?0:_.speed))},G.prep=function(t){function i(){return _.w=_.w||C.width(),_.w=_.mw&&_.mw<_.w?_.mw:_.w,_.w}function h(){return _.h=_.h||C.height(),_.h=_.mh&&_.mh<_.h?_.mh:_.h,_.h}if(P){var r,a="none"===_.transition?0:_.speed;C.empty().remove(),C=o(st,"LoadedContent").append(t),C.hide().appendTo(k.show()).css({width:i(),overflow:_.scrolling?"auto":"hidden"}).css({height:h()}).prependTo(w),k.hide(),e(O).css({"float":"none"}),r=function(){function t(){nt&&p[0].style.removeAttribute("filter")}var i,h,r=b.length,d="frameBorder",c="allowTransparency";P&&(h=function(){clearTimeout(q),W.remove(),s(et,_.onComplete)},nt&&O&&C.fadeIn(100),H.html(_.title).add(C).show(),r>1?("string"==typeof _.current&&E.html(_.current.replace("{current}",A+1).replace("{total}",r)).show(),L[_.loop||r-1>A?"show":"hide"]().html(_.next),M[_.loop||A?"show":"hide"]().html(_.previous),_.slideshow&&I.show(),_.preloading&&e.each([n(-1),n(1)],function(){var t,i,o=b[this],n=e.data(o,J);n&&n.href?(t=n.href,e.isFunction(t)&&(t=t.call(o))):t=o.href,l(t)&&(i=new Image,i.src=t)})):S.hide(),_.iframe?(i=o("iframe")[0],d in i&&(i[d]=0),c in i&&(i[c]="true"),_.scrolling||(i.scrolling="no"),e(i).attr({src:_.href,name:(new Date).getTime(),"class":U+"Iframe",allowFullScreen:!0,webkitAllowFullScreen:!0,mozallowfullscreen:!0}).one("load",h).appendTo(C),rt.one(ot,function(){i.src="//about:blank"}),_.fastIframe&&e(i).trigger("load")):h(),"fade"===_.transition?p.fadeTo(a,1,t):t())},"fade"===_.transition?p.fadeTo(a,0,function(){G.position(0,r)}):G.position(a,r)}},G.load=function(t){var i,n,a,d=G.prep;R=!0,O=!1,N=b[A],t||r(),Q&&p.add(f).removeClass(Q),_.className&&p.add(f).addClass(_.className),Q=_.className,s(ot),s(Z,_.onLoad),_.h=_.height?h(_.height,"y")-D-K:_.innerHeight&&h(_.innerHeight,"y"),_.w=_.width?h(_.width,"x")-B-z:_.innerWidth&&h(_.innerWidth,"x"),_.mw=_.w,_.mh=_.h,_.maxWidth&&(_.mw=h(_.maxWidth,"x")-B-z,_.mw=_.w&&_.w<_.mw?_.w:_.mw),_.maxHeight&&(_.mh=h(_.maxHeight,"y")-D-K,_.mh=_.h&&_.h<_.mh?_.h:_.mh),i=_.href,q=setTimeout(function(){W.appendTo(w)},100),_.inline?(a=o(st).hide().insertBefore(e(i)[0]),rt.one(ot,function(){a.replaceWith(C.children())}),d(e(i))):_.iframe?d(" "):_.html?d(_.html):l(i)?(e(O=new Image).addClass(U+"Photo").bind("error",function(){_.title=!1,d(o(st,"Error").html(_.imgError))}).one("load",function(){var e;_.scalePhotos&&(n=function(){O.height-=O.height*e,O.width-=O.width*e},_.mw&&O.width>_.mw&&(e=(O.width-_.mw)/O.width,n()),_.mh&&O.height>_.mh&&(e=(O.height-_.mh)/O.height,n())),_.h&&(O.style.marginTop=Math.max(_.h-O.height,0)/2+"px"),b[1]&&(_.loop||b[A+1])&&(O.style.cursor="pointer",O.onclick=function(){G.next()}),nt&&(O.style.msInterpolationMode="bicubic"),setTimeout(function(){d(O)},1)}),setTimeout(function(){O.src=i},1)):i&&k.load(i,_.data,function(t,i){d("error"===i?o(st,"Error").html(_.xhrError):e(this).contents())})},G.next=function(){!R&&b[1]&&(_.loop||b[A+1])&&(A=n(1),G.load())},G.prev=function(){!R&&b[1]&&(_.loop||A)&&(A=n(-1),G.load())},G.close=function(){P&&!j&&(j=!0,P=!1,s(tt,_.onCleanup),T.unbind("."+U+" ."+lt),f.fadeTo(200,0),p.stop().fadeTo(300,0,function(){p.add(f).css({opacity:1,cursor:"auto"}).hide(),s(ot),C.empty().remove(),setTimeout(function(){j=!1,s(it,_.onClosed)},1)}))},G.remove=function(){e([]).add(p).add(f).remove(),p=null,e("."+V).removeData(J).removeClass(V),e(t).unbind("click."+U)},G.element=function(){return e(N)},G.settings=$)})(jQuery,document,window);
|
javascripts/jquery.colorbox.js
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
6 |
var
|
7 |
-
//
|
8 |
-
// See http://
|
9 |
defaults = {
|
10 |
transition: "elastic",
|
11 |
speed: 300,
|
@@ -22,18 +23,25 @@
|
|
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 |
returnFocus: true,
|
|
|
37 |
loop: true,
|
38 |
slideshow: false,
|
39 |
slideshowAuto: true,
|
@@ -45,27 +53,33 @@
|
|
45 |
onComplete: false,
|
46 |
onCleanup: false,
|
47 |
onClosed: false,
|
48 |
-
overlayClose: true,
|
49 |
escKey: true,
|
50 |
-
arrowKey: true
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
},
|
52 |
|
53 |
// Abstracting the HTML and event identifiers for easy rebranding
|
54 |
colorbox = 'colorbox',
|
55 |
prefix = 'cbox',
|
|
|
56 |
|
57 |
-
// Events
|
58 |
event_open = prefix + '_open',
|
59 |
event_load = prefix + '_load',
|
60 |
event_complete = prefix + '_complete',
|
61 |
event_cleanup = prefix + '_cleanup',
|
62 |
event_closed = prefix + '_closed',
|
63 |
event_purge = prefix + '_purge',
|
64 |
-
event_loaded = prefix + '_loaded',
|
65 |
|
66 |
// Special Handling for IE
|
67 |
-
isIE =
|
68 |
-
isIE6 = isIE &&
|
69 |
event_ie6 = prefix + '_IE6',
|
70 |
|
71 |
// Cached jQuery Object Variables
|
@@ -88,63 +102,105 @@
|
|
88 |
$next,
|
89 |
$prev,
|
90 |
$close,
|
91 |
-
|
|
|
|
|
92 |
// Variables for cached values or use across multiple functions
|
|
|
93 |
interfaceHeight,
|
94 |
interfaceWidth,
|
95 |
loadedHeight,
|
96 |
loadedWidth,
|
97 |
element,
|
98 |
index,
|
99 |
-
|
100 |
open,
|
101 |
active,
|
102 |
-
closing
|
103 |
-
|
104 |
publicMethod,
|
105 |
-
|
106 |
-
|
|
|
|
|
107 |
// ****************
|
108 |
// HELPER FUNCTIONS
|
109 |
// ****************
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
|
111 |
-
|
112 |
-
function $div(id, css) {
|
113 |
-
id = id ? ' id="' + prefix + id + '"' : '';
|
114 |
-
css = css ? ' style="' + css + '"' : '';
|
115 |
-
return $('<div' + id + css + '/>');
|
116 |
}
|
117 |
|
118 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
function setSize(size, dimension) {
|
120 |
-
|
121 |
-
return (typeof size === 'string') ? Math.round((/%/.test(size) ? (dimension / 100) * parseInt(size, 10) : parseInt(size, 10))) : size;
|
122 |
}
|
123 |
|
124 |
// Checks an href to see if it is a photo.
|
125 |
// There is a force photo option (photo: true) for hrefs that cannot be matched by this regex.
|
126 |
function isImage(url) {
|
127 |
-
return settings.photo || /\.(gif|png|
|
128 |
}
|
129 |
-
|
130 |
-
// Assigns function results to their respective
|
131 |
-
function
|
132 |
-
|
133 |
-
|
134 |
-
|
|
|
|
|
|
|
|
|
135 |
}
|
|
|
|
|
136 |
}
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
settings.href = settings.href || $(element).attr('href');
|
139 |
settings.title = settings.title || element.title;
|
140 |
-
|
|
|
|
|
|
|
141 |
}
|
142 |
|
143 |
function trigger(event, callback) {
|
144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
callback.call(element);
|
146 |
}
|
147 |
-
$.event.trigger(event);
|
148 |
}
|
149 |
|
150 |
// Slideshow functionality
|
@@ -153,34 +209,52 @@
|
|
153 |
timeOut,
|
154 |
className = prefix + "Slideshow_",
|
155 |
click = "click." + prefix,
|
|
|
|
|
156 |
start,
|
157 |
-
stop
|
158 |
-
clear;
|
159 |
|
160 |
if (settings.slideshow && $related[1]) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
start = function () {
|
162 |
$slideshow
|
163 |
-
.
|
164 |
.unbind(click)
|
165 |
-
.
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
.bind(
|
171 |
-
|
172 |
-
})
|
173 |
-
.one(click + ' ' + event_cleanup, stop);
|
174 |
$box.removeClass(className + "off").addClass(className + "on");
|
175 |
-
timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
|
176 |
};
|
177 |
|
178 |
stop = function () {
|
179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
$slideshow
|
181 |
-
.
|
182 |
-
.unbind(
|
183 |
-
.one(click,
|
|
|
|
|
|
|
|
|
184 |
$box.removeClass(className + "on").addClass(className + "off");
|
185 |
};
|
186 |
|
@@ -189,15 +263,17 @@
|
|
189 |
} else {
|
190 |
stop();
|
191 |
}
|
|
|
|
|
192 |
}
|
193 |
}
|
194 |
|
195 |
-
function launch(
|
196 |
if (!closing) {
|
197 |
|
198 |
-
element =
|
199 |
|
200 |
-
|
201 |
|
202 |
$related = $(element);
|
203 |
|
@@ -205,7 +281,13 @@
|
|
205 |
|
206 |
if (settings.rel !== 'nofollow') {
|
207 |
$related = $('.' + boxElement).filter(function () {
|
208 |
-
var
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
return (relRelated === settings.rel);
|
210 |
});
|
211 |
index = $related.index(element);
|
@@ -220,40 +302,46 @@
|
|
220 |
if (!open) {
|
221 |
open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
|
222 |
|
223 |
-
|
|
|
224 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
if (settings.returnFocus) {
|
226 |
-
|
227 |
-
|
228 |
-
$(element).
|
229 |
-
|
230 |
-
this.focus();
|
231 |
-
} catch (e) {
|
232 |
-
// do nothing
|
233 |
-
}
|
234 |
-
});
|
235 |
-
} catch (e) {
|
236 |
-
// do nothing
|
237 |
-
}
|
238 |
}
|
239 |
|
240 |
-
|
241 |
-
|
|
|
|
|
|
|
242 |
|
243 |
// Opens inital empty ColorBox prior to content being loaded.
|
244 |
settings.w = setSize(settings.initialWidth, 'x');
|
245 |
settings.h = setSize(settings.initialHeight, 'y');
|
246 |
-
publicMethod.position(
|
247 |
-
|
248 |
if (isIE6) {
|
249 |
$window.bind('resize.' + event_ie6 + ' scroll.' + event_ie6, function () {
|
250 |
$overlay.css({width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft()});
|
251 |
-
}).trigger('
|
252 |
}
|
253 |
|
|
|
|
|
254 |
trigger(event_open, settings.onOpen);
|
255 |
|
256 |
-
$
|
257 |
|
258 |
$close.html(settings.close).show();
|
259 |
}
|
@@ -262,6 +350,121 @@
|
|
262 |
}
|
263 |
}
|
264 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
// ****************
|
266 |
// PUBLIC FUNCTIONS
|
267 |
// Usage format: $.fn.colorbox.close();
|
@@ -269,154 +472,84 @@
|
|
269 |
// ****************
|
270 |
|
271 |
publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
|
272 |
-
var $this = this
|
273 |
-
|
274 |
-
if (!$this[0] && $this.selector) { // if a selector was given and it didn't match any elements, go ahead and exit.
|
275 |
-
return $this;
|
276 |
-
}
|
277 |
|
278 |
options = options || {};
|
279 |
|
280 |
-
|
281 |
-
options.onComplete = callback;
|
282 |
-
}
|
283 |
-
|
284 |
-
if (!$this[0] || $this.selector === undefined) { // detects $.colorbox() and $.fn.colorbox()
|
285 |
-
$this = $('<a/>');
|
286 |
-
options.open = true; // assume an immediate open
|
287 |
-
}
|
288 |
-
|
289 |
-
$this.each(function () {
|
290 |
-
$.data(this, colorbox, $.extend({}, $.data(this, colorbox) || defaults, options));
|
291 |
-
$(this).addClass(boxElement);
|
292 |
-
});
|
293 |
-
|
294 |
-
autoOpen = options.open;
|
295 |
-
|
296 |
-
if ($.isFunction(autoOpen)) {
|
297 |
-
autoOpen = autoOpen.call($this);
|
298 |
-
}
|
299 |
-
|
300 |
-
if (autoOpen) {
|
301 |
-
launch($this[0]);
|
302 |
-
}
|
303 |
-
|
304 |
-
return $this;
|
305 |
-
};
|
306 |
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
$box = $div().attr({id: colorbox, 'class': isIE ? prefix + 'IE' : ''});
|
314 |
-
$overlay = $div("Overlay", isIE6 ? 'position:absolute' : '').hide();
|
315 |
-
|
316 |
-
$wrap = $div("Wrapper");
|
317 |
-
$content = $div("Content").append(
|
318 |
-
$loaded = $div("LoadedContent", 'width:0; height:0; overflow:hidden'),
|
319 |
-
$loadingOverlay = $div("LoadingOverlay").add($div("LoadingGraphic")),
|
320 |
-
$title = $div("Title"),
|
321 |
-
$current = $div("Current"),
|
322 |
-
$next = $div("Next"),
|
323 |
-
$prev = $div("Previous"),
|
324 |
-
$slideshow = $div("Slideshow").bind(event_open, slideshow),
|
325 |
-
$close = $div("Close")
|
326 |
-
);
|
327 |
-
$wrap.append( // The 3x3 Grid that makes up ColorBox
|
328 |
-
$div().append(
|
329 |
-
$div("TopLeft"),
|
330 |
-
$topBorder = $div("TopCenter"),
|
331 |
-
$div("TopRight")
|
332 |
-
),
|
333 |
-
$div(false, 'clear:left').append(
|
334 |
-
$leftBorder = $div("MiddleLeft"),
|
335 |
-
$content,
|
336 |
-
$rightBorder = $div("MiddleRight")
|
337 |
-
),
|
338 |
-
$div(false, 'clear:left').append(
|
339 |
-
$div("BottomLeft"),
|
340 |
-
$bottomBorder = $div("BottomCenter"),
|
341 |
-
$div("BottomRight")
|
342 |
-
)
|
343 |
-
).children().children().css({'float': 'left'});
|
344 |
-
|
345 |
-
$loadingBay = $div(false, 'position:absolute; width:9999px; visibility:hidden; display:none');
|
346 |
-
|
347 |
-
$('body').prepend($overlay, $box.append($wrap, $loadingBay));
|
348 |
-
|
349 |
-
$content.children()
|
350 |
-
.hover(function () {
|
351 |
-
$(this).addClass('hover');
|
352 |
-
}, function () {
|
353 |
-
$(this).removeClass('hover');
|
354 |
-
}).addClass('hover');
|
355 |
-
|
356 |
-
// Cache values needed for size calculations
|
357 |
-
interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();//Subtraction needed for IE6
|
358 |
-
interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
|
359 |
-
loadedHeight = $loaded.outerHeight(true);
|
360 |
-
loadedWidth = $loaded.outerWidth(true);
|
361 |
-
|
362 |
-
// Setting padding to remove the need to do size conversions during the animation step.
|
363 |
-
$box.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth}).hide();
|
364 |
-
|
365 |
-
// Setup button events.
|
366 |
-
$next.click(publicMethod.next);
|
367 |
-
$prev.click(publicMethod.prev);
|
368 |
-
$close.click(publicMethod.close);
|
369 |
-
|
370 |
-
// Adding the 'hover' class allowed the browser to load the hover-state
|
371 |
-
// background graphics. The class can now can be removed.
|
372 |
-
$content.children().removeClass('hover');
|
373 |
-
|
374 |
-
$('.' + boxElement).live('click', function (e) {
|
375 |
-
// checks to see if it was a non-left mouse-click and for clicks modified with ctrl, shift, or alt.
|
376 |
-
if (!((e.button !== 0 && typeof e.button !== 'undefined') || e.ctrlKey || e.shiftKey || e.altKey)) {
|
377 |
-
e.preventDefault();
|
378 |
-
launch(this);
|
379 |
-
}
|
380 |
-
});
|
381 |
-
|
382 |
-
$overlay.click(function () {
|
383 |
-
if (settings.overlayClose) {
|
384 |
-
publicMethod.close();
|
385 |
}
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
$(document).bind("keydown", function (e) {
|
390 |
-
if (open && settings.escKey && e.keyCode === 27) {
|
391 |
-
e.preventDefault();
|
392 |
-
publicMethod.close();
|
393 |
}
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
}
|
402 |
}
|
403 |
-
}
|
404 |
-
|
405 |
-
|
406 |
-
publicMethod.remove = function () {
|
407 |
-
$box.add($overlay).remove();
|
408 |
-
$('.' + boxElement).die('click').removeData(colorbox).removeClass(boxElement);
|
409 |
};
|
410 |
|
411 |
publicMethod.position = function (speed, loadedCallback) {
|
412 |
var
|
413 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
414 |
// keeps the top and left positions within the browser's viewport.
|
415 |
-
|
416 |
-
|
|
|
|
|
|
|
|
|
|
|
417 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
418 |
// setting the speed to 0 to reduce the delay between same-sized content.
|
419 |
-
|
420 |
|
421 |
// this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
|
422 |
// but it has to be shrank down around the size of div#colorbox when it's done. If not,
|
@@ -424,13 +557,17 @@
|
|
424 |
$wrap[0].style.width = $wrap[0].style.height = "9999px";
|
425 |
|
426 |
function modalDimensions(that) {
|
427 |
-
|
428 |
-
$
|
429 |
-
$loadingOverlay[0].style.height = $loadingOverlay[1].style.height = $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = that.style.height;
|
430 |
}
|
431 |
-
|
432 |
-
|
433 |
-
|
|
|
|
|
|
|
|
|
|
|
434 |
complete: function () {
|
435 |
modalDimensions(this);
|
436 |
|
@@ -440,6 +577,12 @@
|
|
440 |
$wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
|
441 |
$wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
|
442 |
|
|
|
|
|
|
|
|
|
|
|
|
|
443 |
if (loadedCallback) {
|
444 |
loadedCallback();
|
445 |
}
|
@@ -468,10 +611,9 @@
|
|
468 |
if (options.innerHeight) {
|
469 |
settings.h = setSize(options.innerHeight, 'y');
|
470 |
}
|
471 |
-
if (!options.innerHeight && !options.height) {
|
472 |
-
|
473 |
-
settings.h = $
|
474 |
-
$child.replaceWith($child.children()); // ditch the temporary wrapper div used in height calculation
|
475 |
}
|
476 |
$loaded.css({height: settings.h});
|
477 |
|
@@ -484,12 +626,11 @@
|
|
484 |
return;
|
485 |
}
|
486 |
|
487 |
-
var
|
488 |
-
speed = settings.transition === "none" ? 0 : settings.speed;
|
489 |
|
490 |
-
$
|
491 |
-
|
492 |
-
$loaded = $div
|
493 |
|
494 |
function getWidth() {
|
495 |
settings.w = settings.w || $loaded.width();
|
@@ -511,113 +652,156 @@
|
|
511 |
$loadingBay.hide();
|
512 |
|
513 |
// 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 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
}
|
534 |
-
|
535 |
-
|
536 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
537 |
}
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
|
|
544 |
}
|
545 |
|
546 |
-
$
|
547 |
-
|
548 |
-
trigger(event_loaded);
|
549 |
|
550 |
-
|
|
|
|
|
551 |
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
// Preloads images within a rel group
|
568 |
-
if (settings.preloading) {
|
569 |
-
nextSrc = $.data(next, colorbox).href || next.href;
|
570 |
-
prevSrc = $.data(prev, colorbox).href || prev.href;
|
571 |
-
|
572 |
-
nextSrc = $.isFunction(nextSrc) ? nextSrc.call(next) : nextSrc;
|
573 |
-
prevSrc = $.isFunction(prevSrc) ? prevSrc.call(prev) : prevSrc;
|
574 |
-
|
575 |
-
if (isImage(nextSrc)) {
|
576 |
-
$('<img/>')[0].src = nextSrc;
|
577 |
}
|
578 |
-
|
579 |
-
if (isImage(
|
580 |
-
|
|
|
581 |
}
|
582 |
-
}
|
583 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
584 |
|
585 |
-
|
|
|
|
|
586 |
|
587 |
-
if (
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
}
|
594 |
|
595 |
-
$
|
596 |
-
|
597 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
598 |
|
599 |
-
|
600 |
-
|
601 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
602 |
|
603 |
if (settings.transition === 'fade') {
|
604 |
$box.fadeTo(speed, 0, function () {
|
605 |
-
|
606 |
});
|
607 |
} else {
|
608 |
-
|
609 |
}
|
610 |
};
|
611 |
|
612 |
publicMethod.load = function (launched) {
|
613 |
-
var href,
|
614 |
|
615 |
active = true;
|
|
|
|
|
|
|
616 |
element = $related[index];
|
617 |
|
618 |
if (!launched) {
|
619 |
-
|
|
|
|
|
|
|
|
|
620 |
}
|
|
|
|
|
|
|
|
|
621 |
|
622 |
trigger(event_purge);
|
623 |
|
@@ -648,99 +832,92 @@
|
|
648 |
|
649 |
href = settings.href;
|
650 |
|
651 |
-
|
652 |
-
|
|
|
|
|
653 |
if (settings.inline) {
|
654 |
// Inserts an empty placeholder where inline content is being pulled from.
|
655 |
// An event is bound to put inline content back when ColorBox closes or loads new content.
|
656 |
-
$div
|
657 |
-
|
|
|
|
|
658 |
});
|
|
|
659 |
prep($(href));
|
660 |
} else if (settings.iframe) {
|
661 |
// IFrame element won't be added to the DOM until it is ready to be displayed,
|
662 |
// 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 frameborder='0' style='width:100%; height:100%; border:0; display:block'/>")[0];
|
665 |
-
iframe.name = prefix + (+new Date());
|
666 |
-
iframe.src = settings.href;
|
667 |
-
|
668 |
-
if (!settings.scrolling) {
|
669 |
-
iframe.scrolling = "no";
|
670 |
-
}
|
671 |
-
|
672 |
-
if (isIE) {
|
673 |
-
iframe.allowtransparency = "true";
|
674 |
-
}
|
675 |
-
|
676 |
-
$(iframe).appendTo($loaded).one(event_purge, function () {
|
677 |
-
iframe.src = "//about:blank";
|
678 |
-
});
|
679 |
-
});
|
680 |
-
|
681 |
prep(" ");
|
682 |
} else if (settings.html) {
|
683 |
prep(settings.html);
|
684 |
} else if (isImage(href)) {
|
685 |
-
|
686 |
-
|
|
|
|
|
|
|
|
|
|
|
687 |
var percent;
|
688 |
-
|
689 |
-
img.id = prefix + 'Photo';
|
690 |
-
$(img).css({border: 'none', display: 'block', cssFloat: 'left'});
|
691 |
if (settings.scalePhotos) {
|
692 |
setResize = function () {
|
693 |
-
|
694 |
-
|
695 |
};
|
696 |
-
if (settings.mw &&
|
697 |
-
percent = (
|
698 |
setResize();
|
699 |
}
|
700 |
-
if (settings.mh &&
|
701 |
-
percent = (
|
702 |
setResize();
|
703 |
}
|
704 |
}
|
705 |
|
706 |
if (settings.h) {
|
707 |
-
|
708 |
}
|
709 |
|
710 |
-
if ($related[1] && (
|
711 |
-
|
|
|
|
|
|
|
712 |
}
|
713 |
|
714 |
if (isIE) {
|
715 |
-
|
716 |
}
|
717 |
|
718 |
-
setTimeout(function () { // Chrome will sometimes report a 0 by 0 size
|
719 |
-
prep(
|
720 |
}, 1);
|
721 |
-
};
|
722 |
|
723 |
-
setTimeout(function () { // Opera 10.6+ will sometimes
|
724 |
-
|
725 |
-
}, 1);
|
726 |
} else if (href) {
|
727 |
-
$loadingBay.load(href, function (data, status
|
728 |
-
prep(status === 'error' ?
|
729 |
});
|
730 |
}
|
731 |
};
|
732 |
-
|
733 |
// Navigates to the next page/image in a set.
|
734 |
publicMethod.next = function () {
|
735 |
-
if (!active) {
|
736 |
-
index =
|
737 |
publicMethod.load();
|
738 |
}
|
739 |
};
|
740 |
|
741 |
publicMethod.prev = function () {
|
742 |
-
if (!active) {
|
743 |
-
index =
|
744 |
publicMethod.load();
|
745 |
}
|
746 |
};
|
@@ -748,6 +925,7 @@
|
|
748 |
// Note: to use this within an iframe use the following format: parent.$.fn.colorbox.close();
|
749 |
publicMethod.close = function () {
|
750 |
if (open && !closing) {
|
|
|
751 |
closing = true;
|
752 |
|
753 |
open = false;
|
@@ -756,15 +934,15 @@
|
|
756 |
|
757 |
$window.unbind('.' + prefix + ' .' + event_ie6);
|
758 |
|
759 |
-
$overlay.fadeTo(
|
760 |
|
761 |
-
$box.stop().fadeTo(
|
|
|
|
|
762 |
|
763 |
trigger(event_purge);
|
764 |
|
765 |
-
$loaded.remove();
|
766 |
-
|
767 |
-
$box.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide();
|
768 |
|
769 |
setTimeout(function () {
|
770 |
closing = false;
|
@@ -774,6 +952,18 @@
|
|
774 |
}
|
775 |
};
|
776 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
777 |
// A method for fetching the current element ColorBox is referencing.
|
778 |
// returns a jQuery object.
|
779 |
publicMethod.element = function () {
|
@@ -782,7 +972,4 @@
|
|
782 |
|
783 |
publicMethod.settings = defaults;
|
784 |
|
785 |
-
|
786 |
-
$(publicMethod.init);
|
787 |
-
|
788 |
-
}(jQuery, this));
|
1 |
+
/*
|
2 |
+
jQuery ColorBox v1.3.32 - 2013-01-31
|
3 |
+
(c) 2013 Jack Moore - jacklmoore.com/colorbox
|
4 |
+
license: http://www.opensource.org/licenses/mit-license.php
|
5 |
+
*/
|
6 |
+
(function ($, document, window) {
|
7 |
var
|
8 |
+
// Default settings object.
|
9 |
+
// See http://jacklmoore.com/colorbox for details.
|
10 |
defaults = {
|
11 |
transition: "elastic",
|
12 |
speed: 300,
|
23 |
inline: false,
|
24 |
html: false,
|
25 |
iframe: false,
|
26 |
+
fastIframe: true,
|
27 |
photo: false,
|
28 |
href: false,
|
29 |
title: false,
|
30 |
rel: false,
|
31 |
opacity: 0.9,
|
32 |
preloading: true,
|
33 |
+
className: false,
|
34 |
+
|
35 |
current: "image {current} of {total}",
|
36 |
previous: "previous",
|
37 |
next: "next",
|
38 |
close: "close",
|
39 |
+
xhrError: "This content failed to load.",
|
40 |
+
imgError: "This image failed to load.",
|
41 |
+
|
42 |
open: false,
|
43 |
returnFocus: true,
|
44 |
+
reposition: true,
|
45 |
loop: true,
|
46 |
slideshow: false,
|
47 |
slideshowAuto: true,
|
53 |
onComplete: false,
|
54 |
onCleanup: false,
|
55 |
onClosed: false,
|
56 |
+
overlayClose: true,
|
57 |
escKey: true,
|
58 |
+
arrowKey: true,
|
59 |
+
top: false,
|
60 |
+
bottom: false,
|
61 |
+
left: false,
|
62 |
+
right: false,
|
63 |
+
fixed: false,
|
64 |
+
data: undefined
|
65 |
},
|
66 |
|
67 |
// Abstracting the HTML and event identifiers for easy rebranding
|
68 |
colorbox = 'colorbox',
|
69 |
prefix = 'cbox',
|
70 |
+
boxElement = prefix + 'Element',
|
71 |
|
72 |
+
// Events
|
73 |
event_open = prefix + '_open',
|
74 |
event_load = prefix + '_load',
|
75 |
event_complete = prefix + '_complete',
|
76 |
event_cleanup = prefix + '_cleanup',
|
77 |
event_closed = prefix + '_closed',
|
78 |
event_purge = prefix + '_purge',
|
|
|
79 |
|
80 |
// Special Handling for IE
|
81 |
+
isIE = !$.support.leadingWhitespace, // IE6 to IE8
|
82 |
+
isIE6 = isIE && !window.XMLHttpRequest, // IE6
|
83 |
event_ie6 = prefix + '_IE6',
|
84 |
|
85 |
// Cached jQuery Object Variables
|
102 |
$next,
|
103 |
$prev,
|
104 |
$close,
|
105 |
+
$groupControls,
|
106 |
+
$events = $({}),
|
107 |
+
|
108 |
// Variables for cached values or use across multiple functions
|
109 |
+
settings,
|
110 |
interfaceHeight,
|
111 |
interfaceWidth,
|
112 |
loadedHeight,
|
113 |
loadedWidth,
|
114 |
element,
|
115 |
index,
|
116 |
+
photo,
|
117 |
open,
|
118 |
active,
|
119 |
+
closing,
|
120 |
+
loadingTimer,
|
121 |
publicMethod,
|
122 |
+
div = "div",
|
123 |
+
className,
|
124 |
+
init;
|
125 |
+
|
126 |
// ****************
|
127 |
// HELPER FUNCTIONS
|
128 |
// ****************
|
129 |
+
|
130 |
+
// Convience function for creating new jQuery objects
|
131 |
+
function $tag(tag, id, css) {
|
132 |
+
var element = document.createElement(tag);
|
133 |
+
|
134 |
+
if (id) {
|
135 |
+
element.id = prefix + id;
|
136 |
+
}
|
137 |
+
|
138 |
+
if (css) {
|
139 |
+
element.style.cssText = css;
|
140 |
+
}
|
141 |
|
142 |
+
return $(element);
|
|
|
|
|
|
|
|
|
143 |
}
|
144 |
|
145 |
+
// Determine the next and previous members in a group.
|
146 |
+
function getIndex(increment) {
|
147 |
+
var
|
148 |
+
max = $related.length,
|
149 |
+
newIndex = (index + increment) % max;
|
150 |
+
|
151 |
+
return (newIndex < 0) ? max + newIndex : newIndex;
|
152 |
+
}
|
153 |
+
|
154 |
+
// Convert '%' and 'px' values to integers
|
155 |
function setSize(size, dimension) {
|
156 |
+
return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : $window.height()) / 100) : 1) * parseInt(size, 10));
|
|
|
157 |
}
|
158 |
|
159 |
// Checks an href to see if it is a photo.
|
160 |
// There is a force photo option (photo: true) for hrefs that cannot be matched by this regex.
|
161 |
function isImage(url) {
|
162 |
+
return settings.photo || /\.(gif|png|jp(e|g|eg)|bmp|ico)((#|\?).*)?$/i.test(url);
|
163 |
}
|
164 |
+
|
165 |
+
// Assigns function results to their respective properties
|
166 |
+
function makeSettings() {
|
167 |
+
var i,
|
168 |
+
data = $.data(element, colorbox);
|
169 |
+
|
170 |
+
if (data == null) {
|
171 |
+
settings = $.extend({}, defaults);
|
172 |
+
if (console && console.log) {
|
173 |
+
console.log('Error: cboxElement missing settings object');
|
174 |
}
|
175 |
+
} else {
|
176 |
+
settings = $.extend({}, data);
|
177 |
}
|
178 |
+
|
179 |
+
for (i in settings) {
|
180 |
+
if ($.isFunction(settings[i]) && i.slice(0, 2) !== 'on') { // checks to make sure the function isn't one of the callbacks, they will be handled at the appropriate time.
|
181 |
+
settings[i] = settings[i].call(element);
|
182 |
+
}
|
183 |
+
}
|
184 |
+
|
185 |
+
settings.rel = settings.rel || element.rel || $(element).data('rel') || 'nofollow';
|
186 |
settings.href = settings.href || $(element).attr('href');
|
187 |
settings.title = settings.title || element.title;
|
188 |
+
|
189 |
+
if (typeof settings.href === "string") {
|
190 |
+
settings.href = $.trim(settings.href);
|
191 |
+
}
|
192 |
}
|
193 |
|
194 |
function trigger(event, callback) {
|
195 |
+
// for external use
|
196 |
+
$(document).trigger(event);
|
197 |
+
|
198 |
+
// for internal use
|
199 |
+
$events.trigger(event);
|
200 |
+
|
201 |
+
if ($.isFunction(callback)) {
|
202 |
callback.call(element);
|
203 |
}
|
|
|
204 |
}
|
205 |
|
206 |
// Slideshow functionality
|
209 |
timeOut,
|
210 |
className = prefix + "Slideshow_",
|
211 |
click = "click." + prefix,
|
212 |
+
clear,
|
213 |
+
set,
|
214 |
start,
|
215 |
+
stop;
|
|
|
216 |
|
217 |
if (settings.slideshow && $related[1]) {
|
218 |
+
clear = function () {
|
219 |
+
clearTimeout(timeOut);
|
220 |
+
};
|
221 |
+
|
222 |
+
set = function () {
|
223 |
+
if (settings.loop || $related[index + 1]) {
|
224 |
+
timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
|
225 |
+
}
|
226 |
+
};
|
227 |
+
|
228 |
start = function () {
|
229 |
$slideshow
|
230 |
+
.html(settings.slideshowStop)
|
231 |
.unbind(click)
|
232 |
+
.one(click, stop);
|
233 |
+
|
234 |
+
$events
|
235 |
+
.bind(event_complete, set)
|
236 |
+
.bind(event_load, clear)
|
237 |
+
.bind(event_cleanup, stop);
|
238 |
+
|
|
|
|
|
239 |
$box.removeClass(className + "off").addClass(className + "on");
|
|
|
240 |
};
|
241 |
|
242 |
stop = function () {
|
243 |
+
clear();
|
244 |
+
|
245 |
+
$events
|
246 |
+
.unbind(event_complete, set)
|
247 |
+
.unbind(event_load, clear)
|
248 |
+
.unbind(event_cleanup, stop);
|
249 |
+
|
250 |
$slideshow
|
251 |
+
.html(settings.slideshowStart)
|
252 |
+
.unbind(click)
|
253 |
+
.one(click, function () {
|
254 |
+
publicMethod.next();
|
255 |
+
start();
|
256 |
+
});
|
257 |
+
|
258 |
$box.removeClass(className + "on").addClass(className + "off");
|
259 |
};
|
260 |
|
263 |
} else {
|
264 |
stop();
|
265 |
}
|
266 |
+
} else {
|
267 |
+
$box.removeClass(className + "off " + className + "on");
|
268 |
}
|
269 |
}
|
270 |
|
271 |
+
function launch(target) {
|
272 |
if (!closing) {
|
273 |
|
274 |
+
element = target;
|
275 |
|
276 |
+
makeSettings();
|
277 |
|
278 |
$related = $(element);
|
279 |
|
281 |
|
282 |
if (settings.rel !== 'nofollow') {
|
283 |
$related = $('.' + boxElement).filter(function () {
|
284 |
+
var data = $.data(this, colorbox),
|
285 |
+
relRelated;
|
286 |
+
|
287 |
+
if (data) {
|
288 |
+
relRelated = $(this).data('rel') || data.rel || this.rel;
|
289 |
+
}
|
290 |
+
|
291 |
return (relRelated === settings.rel);
|
292 |
});
|
293 |
index = $related.index(element);
|
302 |
if (!open) {
|
303 |
open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
|
304 |
|
305 |
+
// Show colorbox so the sizes can be calculated in older versions of jQuery
|
306 |
+
$box.css({visibility:'hidden', display:'block'});
|
307 |
|
308 |
+
$loaded = $tag(div, 'LoadedContent', 'width:0; height:0; overflow:hidden').appendTo($content);
|
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 |
if (settings.returnFocus) {
|
317 |
+
$(element).blur();
|
318 |
+
$events.one(event_closed, function () {
|
319 |
+
$(element).focus();
|
320 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
}
|
322 |
|
323 |
+
$overlay.css({
|
324 |
+
opacity: parseFloat(settings.opacity),
|
325 |
+
cursor: settings.overlayClose ? "pointer" : "auto",
|
326 |
+
visibility: 'visible'
|
327 |
+
}).show();
|
328 |
|
329 |
// Opens inital empty ColorBox prior to content being loaded.
|
330 |
settings.w = setSize(settings.initialWidth, 'x');
|
331 |
settings.h = setSize(settings.initialHeight, 'y');
|
332 |
+
publicMethod.position();
|
333 |
+
|
334 |
if (isIE6) {
|
335 |
$window.bind('resize.' + event_ie6 + ' scroll.' + event_ie6, function () {
|
336 |
$overlay.css({width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft()});
|
337 |
+
}).trigger('resize.' + event_ie6);
|
338 |
}
|
339 |
|
340 |
+
slideshow();
|
341 |
+
|
342 |
trigger(event_open, settings.onOpen);
|
343 |
|
344 |
+
$groupControls.add($title).hide();
|
345 |
|
346 |
$close.html(settings.close).show();
|
347 |
}
|
350 |
}
|
351 |
}
|
352 |
|
353 |
+
// ColorBox's markup needs to be added to the DOM prior to being called
|
354 |
+
// so that the browser will go ahead and load the CSS background images.
|
355 |
+
function appendHTML() {
|
356 |
+
if (!$box && document.body) {
|
357 |
+
init = false;
|
358 |
+
|
359 |
+
$window = $(window);
|
360 |
+
$box = $tag(div).attr({id: colorbox, 'class': isIE ? prefix + (isIE6 ? 'IE6' : 'IE') : ''}).hide();
|
361 |
+
$overlay = $tag(div, "Overlay", isIE6 ? 'position:absolute' : '').hide();
|
362 |
+
$loadingOverlay = $tag(div, "LoadingOverlay").add($tag(div, "LoadingGraphic"));
|
363 |
+
$wrap = $tag(div, "Wrapper");
|
364 |
+
$content = $tag(div, "Content").append(
|
365 |
+
$title = $tag(div, "Title"),
|
366 |
+
$current = $tag(div, "Current"),
|
367 |
+
$next = $tag(div, "Next"),
|
368 |
+
$prev = $tag(div, "Previous"),
|
369 |
+
$slideshow = $tag(div, "Slideshow"),
|
370 |
+
$close = $tag(div, "Close")
|
371 |
+
);
|
372 |
+
|
373 |
+
$wrap.append( // The 3x3 Grid that makes up ColorBox
|
374 |
+
$tag(div).append(
|
375 |
+
$tag(div, "TopLeft"),
|
376 |
+
$topBorder = $tag(div, "TopCenter"),
|
377 |
+
$tag(div, "TopRight")
|
378 |
+
),
|
379 |
+
$tag(div, false, 'clear:left').append(
|
380 |
+
$leftBorder = $tag(div, "MiddleLeft"),
|
381 |
+
$content,
|
382 |
+
$rightBorder = $tag(div, "MiddleRight")
|
383 |
+
),
|
384 |
+
$tag(div, false, 'clear:left').append(
|
385 |
+
$tag(div, "BottomLeft"),
|
386 |
+
$bottomBorder = $tag(div, "BottomCenter"),
|
387 |
+
$tag(div, "BottomRight")
|
388 |
+
)
|
389 |
+
).find('div div').css({'float': 'left'});
|
390 |
+
|
391 |
+
$loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none');
|
392 |
+
|
393 |
+
$groupControls = $next.add($prev).add($current).add($slideshow);
|
394 |
+
|
395 |
+
$(document.body).append($overlay, $box.append($wrap, $loadingBay));
|
396 |
+
}
|
397 |
+
}
|
398 |
+
|
399 |
+
// Add ColorBox's event bindings
|
400 |
+
function addBindings() {
|
401 |
+
function clickHandler(e) {
|
402 |
+
// ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.
|
403 |
+
// See: http://jacklmoore.com/notes/click-events/
|
404 |
+
if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey)) {
|
405 |
+
e.preventDefault();
|
406 |
+
launch(this);
|
407 |
+
}
|
408 |
+
}
|
409 |
+
|
410 |
+
if ($box) {
|
411 |
+
if (!init) {
|
412 |
+
init = true;
|
413 |
+
|
414 |
+
// Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.
|
415 |
+
$next.click(function () {
|
416 |
+
publicMethod.next();
|
417 |
+
});
|
418 |
+
$prev.click(function () {
|
419 |
+
publicMethod.prev();
|
420 |
+
});
|
421 |
+
$close.click(function () {
|
422 |
+
publicMethod.close();
|
423 |
+
});
|
424 |
+
$overlay.click(function () {
|
425 |
+
if (settings.overlayClose) {
|
426 |
+
publicMethod.close();
|
427 |
+
}
|
428 |
+
});
|
429 |
+
|
430 |
+
// Key Bindings
|
431 |
+
$(document).bind('keydown.' + prefix, function (e) {
|
432 |
+
var key = e.keyCode;
|
433 |
+
if (open && settings.escKey && key === 27) {
|
434 |
+
e.preventDefault();
|
435 |
+
publicMethod.close();
|
436 |
+
}
|
437 |
+
if (open && settings.arrowKey && $related[1]) {
|
438 |
+
if (key === 37) {
|
439 |
+
e.preventDefault();
|
440 |
+
$prev.click();
|
441 |
+
} else if (key === 39) {
|
442 |
+
e.preventDefault();
|
443 |
+
$next.click();
|
444 |
+
}
|
445 |
+
}
|
446 |
+
});
|
447 |
+
|
448 |
+
if ($.isFunction($.fn.on)) {
|
449 |
+
$(document).on('click.'+prefix, '.'+boxElement, clickHandler);
|
450 |
+
} else { // For jQuery 1.3.x -> 1.6.x
|
451 |
+
$('.'+boxElement).live('click.'+prefix, clickHandler);
|
452 |
+
}
|
453 |
+
}
|
454 |
+
return true;
|
455 |
+
}
|
456 |
+
return false;
|
457 |
+
}
|
458 |
+
|
459 |
+
// Don't do anything if ColorBox already exists.
|
460 |
+
if ($.colorbox) {
|
461 |
+
return;
|
462 |
+
}
|
463 |
+
|
464 |
+
// Append the HTML when the DOM loads
|
465 |
+
$(appendHTML);
|
466 |
+
|
467 |
+
|
468 |
// ****************
|
469 |
// PUBLIC FUNCTIONS
|
470 |
// Usage format: $.fn.colorbox.close();
|
472 |
// ****************
|
473 |
|
474 |
publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
|
475 |
+
var $this = this;
|
|
|
|
|
|
|
|
|
476 |
|
477 |
options = options || {};
|
478 |
|
479 |
+
appendHTML();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
480 |
|
481 |
+
if (addBindings()) {
|
482 |
+
if ($.isFunction($this)) { // assume a call to $.colorbox
|
483 |
+
$this = $('<a/>');
|
484 |
+
options.open = true;
|
485 |
+
} else if (!$this[0]) { // colorbox being applied to empty collection
|
486 |
+
return $this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
487 |
}
|
488 |
+
|
489 |
+
if (callback) {
|
490 |
+
options.onComplete = callback;
|
|
|
|
|
|
|
|
|
491 |
}
|
492 |
+
|
493 |
+
$this.each(function () {
|
494 |
+
$.data(this, colorbox, $.extend({}, $.data(this, colorbox) || defaults, options));
|
495 |
+
}).addClass(boxElement);
|
496 |
+
|
497 |
+
if (($.isFunction(options.open) && options.open.call($this)) || options.open) {
|
498 |
+
launch($this[0]);
|
|
|
499 |
}
|
500 |
+
}
|
501 |
+
|
502 |
+
return $this;
|
|
|
|
|
|
|
503 |
};
|
504 |
|
505 |
publicMethod.position = function (speed, loadedCallback) {
|
506 |
var
|
507 |
+
css,
|
508 |
+
top = 0,
|
509 |
+
left = 0,
|
510 |
+
offset = $box.offset(),
|
511 |
+
scrollTop,
|
512 |
+
scrollLeft;
|
513 |
+
|
514 |
+
$window.unbind('resize.' + prefix);
|
515 |
+
|
516 |
+
// remove the modal so that it doesn't influence the document width/height
|
517 |
+
$box.css({top: -9e4, left: -9e4});
|
518 |
+
|
519 |
+
scrollTop = $window.scrollTop();
|
520 |
+
scrollLeft = $window.scrollLeft();
|
521 |
+
|
522 |
+
if (settings.fixed && !isIE6) {
|
523 |
+
offset.top -= scrollTop;
|
524 |
+
offset.left -= scrollLeft;
|
525 |
+
$box.css({position: 'fixed'});
|
526 |
+
} else {
|
527 |
+
top = scrollTop;
|
528 |
+
left = scrollLeft;
|
529 |
+
$box.css({position: 'absolute'});
|
530 |
+
}
|
531 |
+
|
532 |
// keeps the top and left positions within the browser's viewport.
|
533 |
+
if (settings.right !== false) {
|
534 |
+
left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth - setSize(settings.right, 'x'), 0);
|
535 |
+
} else if (settings.left !== false) {
|
536 |
+
left += setSize(settings.left, 'x');
|
537 |
+
} else {
|
538 |
+
left += Math.round(Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2);
|
539 |
+
}
|
540 |
|
541 |
+
if (settings.bottom !== false) {
|
542 |
+
top += Math.max($window.height() - settings.h - loadedHeight - interfaceHeight - setSize(settings.bottom, 'y'), 0);
|
543 |
+
} else if (settings.top !== false) {
|
544 |
+
top += setSize(settings.top, 'y');
|
545 |
+
} else {
|
546 |
+
top += Math.round(Math.max($window.height() - settings.h - loadedHeight - interfaceHeight, 0) / 2);
|
547 |
+
}
|
548 |
+
|
549 |
+
$box.css({top: offset.top, left: offset.left, visibility:'visible'});
|
550 |
+
|
551 |
// setting the speed to 0 to reduce the delay between same-sized content.
|
552 |
+
speed = ($box.width() === settings.w + loadedWidth && $box.height() === settings.h + loadedHeight) ? 0 : speed || 0;
|
553 |
|
554 |
// this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
|
555 |
// but it has to be shrank down around the size of div#colorbox when it's done. If not,
|
557 |
$wrap[0].style.width = $wrap[0].style.height = "9999px";
|
558 |
|
559 |
function modalDimensions(that) {
|
560 |
+
$topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = (parseInt(that.style.width,10) - interfaceWidth)+'px';
|
561 |
+
$content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = (parseInt(that.style.height,10) - interfaceHeight)+'px';
|
|
|
562 |
}
|
563 |
+
|
564 |
+
css = {width: settings.w + loadedWidth + interfaceWidth, height: settings.h + loadedHeight + interfaceHeight, top: top, left: left};
|
565 |
+
|
566 |
+
if(speed===0){ // temporary workaround to side-step jQuery-UI 1.8 bug (http://bugs.jquery.com/ticket/12273)
|
567 |
+
$box.css(css);
|
568 |
+
}
|
569 |
+
$box.dequeue().animate(css, {
|
570 |
+
duration: speed,
|
571 |
complete: function () {
|
572 |
modalDimensions(this);
|
573 |
|
577 |
$wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
|
578 |
$wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
|
579 |
|
580 |
+
if (settings.reposition) {
|
581 |
+
setTimeout(function () { // small delay before binding onresize due to an IE8 bug.
|
582 |
+
$window.bind('resize.' + prefix, publicMethod.position);
|
583 |
+
}, 1);
|
584 |
+
}
|
585 |
+
|
586 |
if (loadedCallback) {
|
587 |
loadedCallback();
|
588 |
}
|
611 |
if (options.innerHeight) {
|
612 |
settings.h = setSize(options.innerHeight, 'y');
|
613 |
}
|
614 |
+
if (!options.innerHeight && !options.height) {
|
615 |
+
$loaded.css({height: "auto"});
|
616 |
+
settings.h = $loaded.height();
|
|
|
617 |
}
|
618 |
$loaded.css({height: settings.h});
|
619 |
|
626 |
return;
|
627 |
}
|
628 |
|
629 |
+
var callback, speed = settings.transition === "none" ? 0 : settings.speed;
|
|
|
630 |
|
631 |
+
$loaded.empty().remove(); // Using empty first may prevent some IE7 issues.
|
632 |
+
|
633 |
+
$loaded = $tag(div, 'LoadedContent').append(object);
|
634 |
|
635 |
function getWidth() {
|
636 |
settings.w = settings.w || $loaded.width();
|
652 |
$loadingBay.hide();
|
653 |
|
654 |
// 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.
|
655 |
+
//$(photo).css({'float': 'none', marginLeft: 'auto', marginRight: 'auto'});
|
656 |
+
|
657 |
+
$(photo).css({'float': 'none'});
|
658 |
+
|
659 |
+
|
660 |
+
callback = function () {
|
661 |
+
var total = $related.length,
|
662 |
+
iframe,
|
663 |
+
frameBorder = 'frameBorder',
|
664 |
+
allowTransparency = 'allowTransparency',
|
665 |
+
complete;
|
666 |
+
|
667 |
+
if (!open) {
|
668 |
+
return;
|
669 |
+
}
|
670 |
+
|
671 |
+
function removeFilter() {
|
672 |
+
if (isIE) {
|
673 |
+
$box[0].style.removeAttribute('filter');
|
674 |
}
|
675 |
+
}
|
676 |
+
|
677 |
+
complete = function () {
|
678 |
+
clearTimeout(loadingTimer);
|
679 |
+
$loadingOverlay.remove();
|
680 |
+
trigger(event_complete, settings.onComplete);
|
681 |
+
};
|
682 |
+
|
683 |
+
if (isIE) {
|
684 |
+
//This fadeIn helps the bicubic resampling to kick-in.
|
685 |
+
if (photo) {
|
686 |
+
$loaded.fadeIn(100);
|
687 |
}
|
688 |
+
}
|
689 |
+
|
690 |
+
$title.html(settings.title).add($loaded).show();
|
691 |
+
|
692 |
+
if (total > 1) { // handle grouping
|
693 |
+
if (typeof settings.current === "string") {
|
694 |
+
$current.html(settings.current.replace('{current}', index + 1).replace('{total}', total)).show();
|
695 |
}
|
696 |
|
697 |
+
$next[(settings.loop || index < total - 1) ? "show" : "hide"]().html(settings.next);
|
698 |
+
$prev[(settings.loop || index) ? "show" : "hide"]().html(settings.previous);
|
|
|
699 |
|
700 |
+
if (settings.slideshow) {
|
701 |
+
$slideshow.show();
|
702 |
+
}
|
703 |
|
704 |
+
// Preloads images within a rel group
|
705 |
+
if (settings.preloading) {
|
706 |
+
$.each([getIndex(-1), getIndex(1)], function(){
|
707 |
+
var src,
|
708 |
+
img,
|
709 |
+
i = $related[this],
|
710 |
+
data = $.data(i, colorbox);
|
711 |
+
|
712 |
+
if (data && data.href) {
|
713 |
+
src = data.href;
|
714 |
+
if ($.isFunction(src)) {
|
715 |
+
src = src.call(i);
|
716 |
+
}
|
717 |
+
} else {
|
718 |
+
src = i.href;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
719 |
}
|
720 |
+
|
721 |
+
if (isImage(src)) {
|
722 |
+
img = new Image();
|
723 |
+
img.src = src;
|
724 |
}
|
725 |
+
});
|
726 |
}
|
727 |
+
} else {
|
728 |
+
$groupControls.hide();
|
729 |
+
}
|
730 |
+
|
731 |
+
if (settings.iframe) {
|
732 |
+
iframe = $tag('iframe')[0];
|
733 |
|
734 |
+
if (frameBorder in iframe) {
|
735 |
+
iframe[frameBorder] = 0;
|
736 |
+
}
|
737 |
|
738 |
+
if (allowTransparency in iframe) {
|
739 |
+
iframe[allowTransparency] = "true";
|
740 |
+
}
|
741 |
+
|
742 |
+
if (!settings.scrolling) {
|
743 |
+
iframe.scrolling = "no";
|
744 |
}
|
745 |
|
746 |
+
$(iframe)
|
747 |
+
.attr({
|
748 |
+
src: settings.href,
|
749 |
+
name: (new Date()).getTime(), // give the iframe a unique name to prevent caching
|
750 |
+
'class': prefix + 'Iframe',
|
751 |
+
allowFullScreen : true, // allow HTML5 video to go fullscreen
|
752 |
+
webkitAllowFullScreen : true,
|
753 |
+
mozallowfullscreen : true
|
754 |
+
})
|
755 |
+
.one('load', complete)
|
756 |
+
.appendTo($loaded);
|
757 |
|
758 |
+
$events.one(event_purge, function () {
|
759 |
+
iframe.src = "//about:blank";
|
760 |
+
});
|
761 |
+
|
762 |
+
if (settings.fastIframe) {
|
763 |
+
$(iframe).trigger('load');
|
764 |
+
}
|
765 |
+
} else {
|
766 |
+
complete();
|
767 |
+
}
|
768 |
+
|
769 |
+
if (settings.transition === 'fade') {
|
770 |
+
$box.fadeTo(speed, 1, removeFilter);
|
771 |
+
} else {
|
772 |
+
removeFilter();
|
773 |
+
}
|
774 |
+
};
|
775 |
|
776 |
if (settings.transition === 'fade') {
|
777 |
$box.fadeTo(speed, 0, function () {
|
778 |
+
publicMethod.position(0, callback);
|
779 |
});
|
780 |
} else {
|
781 |
+
publicMethod.position(speed, callback);
|
782 |
}
|
783 |
};
|
784 |
|
785 |
publicMethod.load = function (launched) {
|
786 |
+
var href, setResize, prep = publicMethod.prep, $inline;
|
787 |
|
788 |
active = true;
|
789 |
+
|
790 |
+
photo = false;
|
791 |
+
|
792 |
element = $related[index];
|
793 |
|
794 |
if (!launched) {
|
795 |
+
makeSettings();
|
796 |
+
}
|
797 |
+
|
798 |
+
if (className) {
|
799 |
+
$box.add($overlay).removeClass(className);
|
800 |
}
|
801 |
+
if (settings.className) {
|
802 |
+
$box.add($overlay).addClass(settings.className);
|
803 |
+
}
|
804 |
+
className = settings.className;
|
805 |
|
806 |
trigger(event_purge);
|
807 |
|
832 |
|
833 |
href = settings.href;
|
834 |
|
835 |
+
loadingTimer = setTimeout(function () {
|
836 |
+
$loadingOverlay.appendTo($content);
|
837 |
+
}, 100);
|
838 |
+
|
839 |
if (settings.inline) {
|
840 |
// Inserts an empty placeholder where inline content is being pulled from.
|
841 |
// An event is bound to put inline content back when ColorBox closes or loads new content.
|
842 |
+
$inline = $tag(div).hide().insertBefore($(href)[0]);
|
843 |
+
|
844 |
+
$events.one(event_purge, function () {
|
845 |
+
$inline.replaceWith($loaded.children());
|
846 |
});
|
847 |
+
|
848 |
prep($(href));
|
849 |
} else if (settings.iframe) {
|
850 |
// IFrame element won't be added to the DOM until it is ready to be displayed,
|
851 |
// to avoid problems with DOM-ready JS that might be trying to run in that iframe.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
852 |
prep(" ");
|
853 |
} else if (settings.html) {
|
854 |
prep(settings.html);
|
855 |
} else if (isImage(href)) {
|
856 |
+
$(photo = new Image())
|
857 |
+
.addClass(prefix + 'Photo')
|
858 |
+
.bind('error',function () {
|
859 |
+
settings.title = false;
|
860 |
+
prep($tag(div, 'Error').html(settings.imgError));
|
861 |
+
})
|
862 |
+
.one('load', function () {
|
863 |
var percent;
|
864 |
+
|
|
|
|
|
865 |
if (settings.scalePhotos) {
|
866 |
setResize = function () {
|
867 |
+
photo.height -= photo.height * percent;
|
868 |
+
photo.width -= photo.width * percent;
|
869 |
};
|
870 |
+
if (settings.mw && photo.width > settings.mw) {
|
871 |
+
percent = (photo.width - settings.mw) / photo.width;
|
872 |
setResize();
|
873 |
}
|
874 |
+
if (settings.mh && photo.height > settings.mh) {
|
875 |
+
percent = (photo.height - settings.mh) / photo.height;
|
876 |
setResize();
|
877 |
}
|
878 |
}
|
879 |
|
880 |
if (settings.h) {
|
881 |
+
photo.style.marginTop = Math.max(settings.h - photo.height, 0) / 2 + 'px';
|
882 |
}
|
883 |
|
884 |
+
if ($related[1] && (settings.loop || $related[index + 1])) {
|
885 |
+
photo.style.cursor = 'pointer';
|
886 |
+
photo.onclick = function () {
|
887 |
+
publicMethod.next();
|
888 |
+
};
|
889 |
}
|
890 |
|
891 |
if (isIE) {
|
892 |
+
photo.style.msInterpolationMode = 'bicubic';
|
893 |
}
|
894 |
|
895 |
+
setTimeout(function () { // A pause because Chrome will sometimes report a 0 by 0 size otherwise.
|
896 |
+
prep(photo);
|
897 |
}, 1);
|
898 |
+
});
|
899 |
|
900 |
+
setTimeout(function () { // A pause because Opera 10.6+ will sometimes not run the onload function otherwise.
|
901 |
+
photo.src = href;
|
902 |
+
}, 1);
|
903 |
} else if (href) {
|
904 |
+
$loadingBay.load(href, settings.data, function (data, status) {
|
905 |
+
prep(status === 'error' ? $tag(div, 'Error').html(settings.xhrError) : $(this).contents());
|
906 |
});
|
907 |
}
|
908 |
};
|
909 |
+
|
910 |
// Navigates to the next page/image in a set.
|
911 |
publicMethod.next = function () {
|
912 |
+
if (!active && $related[1] && (settings.loop || $related[index + 1])) {
|
913 |
+
index = getIndex(1);
|
914 |
publicMethod.load();
|
915 |
}
|
916 |
};
|
917 |
|
918 |
publicMethod.prev = function () {
|
919 |
+
if (!active && $related[1] && (settings.loop || index)) {
|
920 |
+
index = getIndex(-1);
|
921 |
publicMethod.load();
|
922 |
}
|
923 |
};
|
925 |
// Note: to use this within an iframe use the following format: parent.$.fn.colorbox.close();
|
926 |
publicMethod.close = function () {
|
927 |
if (open && !closing) {
|
928 |
+
|
929 |
closing = true;
|
930 |
|
931 |
open = false;
|
934 |
|
935 |
$window.unbind('.' + prefix + ' .' + event_ie6);
|
936 |
|
937 |
+
$overlay.fadeTo(200, 0);
|
938 |
|
939 |
+
$box.stop().fadeTo(300, 0, function () {
|
940 |
+
|
941 |
+
$box.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide();
|
942 |
|
943 |
trigger(event_purge);
|
944 |
|
945 |
+
$loaded.empty().remove(); // Using empty first may prevent some IE7 issues.
|
|
|
|
|
946 |
|
947 |
setTimeout(function () {
|
948 |
closing = false;
|
952 |
}
|
953 |
};
|
954 |
|
955 |
+
// Removes changes ColorBox made to the document, but does not remove the plugin
|
956 |
+
// from jQuery.
|
957 |
+
publicMethod.remove = function () {
|
958 |
+
$([]).add($box).add($overlay).remove();
|
959 |
+
$box = null;
|
960 |
+
$('.' + boxElement)
|
961 |
+
.removeData(colorbox)
|
962 |
+
.removeClass(boxElement);
|
963 |
+
|
964 |
+
$(document).unbind('click.'+prefix);
|
965 |
+
};
|
966 |
+
|
967 |
// A method for fetching the current element ColorBox is referencing.
|
968 |
// returns a jQuery object.
|
969 |
publicMethod.element = function () {
|
972 |
|
973 |
publicMethod.settings = defaults;
|
974 |
|
975 |
+
}(jQuery, document, window));
|
|
|
|
|
|
readme.txt
CHANGED
@@ -49,6 +49,9 @@ For updates, you can check out [my blog](http://www.prelovac.com/vladimir/) or f
|
|
49 |
|
50 |
== Changelog ==
|
51 |
|
|
|
|
|
|
|
52 |
= 4.1.9 =
|
53 |
* Fixed HTML validation
|
54 |
* Colorbox now displayed on archive pages as well
|
49 |
|
50 |
== Changelog ==
|
51 |
|
52 |
+
= 4.2.0 =
|
53 |
+
* Updated to latest Colorbox libraries
|
54 |
+
|
55 |
= 4.1.9 =
|
56 |
* Fixed HTML validation
|
57 |
* Colorbox now displayed on archive pages as well
|
smartyoutube.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Smart Youtube PRO
|
|
4 |
Plugin URI: http://www.prelovac.com/vladimir/wordpress-plugins/smart-youtube
|
5 |
Description: Insert YouTube videos in posts, comments and RSS feeds with ease and full customization.
|
6 |
Author: Vladimir Prelovac
|
7 |
-
Version: 4.
|
8 |
Author URI: http://www.prelovac.com/vladimir/
|
9 |
|
10 |
|
4 |
Plugin URI: http://www.prelovac.com/vladimir/wordpress-plugins/smart-youtube
|
5 |
Description: Insert YouTube videos in posts, comments and RSS feeds with ease and full customization.
|
6 |
Author: Vladimir Prelovac
|
7 |
+
Version: 4.2.0
|
8 |
Author URI: http://www.prelovac.com/vladimir/
|
9 |
|
10 |
|