PageSourceSearch

https://www.cadredesante.com/spip/plugins-dist/mediabox/javascript/jquery.colorbox_1449070117.js

js cadredesante.com collected 2026-10-02 10:27:45 UTC 28,000 bytes, 985 lines download raw bytes

1// ColorBox v1.3.20.1 - jQuery lightbox plugin
2// (c) 2011 Jack Moore - jacklmoore.com
3// License: http://www.opensource.org/licenses/mit-license.php
4// + minWidth&minHeight support
5// + colorbox_class support
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,
13		width: false,
14		initialWidth: "600",
15		innerWidth: false,
16		maxWidth: false,
17		minWidth:false,
18		height: false,
19		initialHeight: "450",
20		innerHeight: false,
21		maxHeight: false,
22		minHeight:false,
23		scalePhotos: true,
24		scrolling: true,
25		inline: false,
26		html: false,
27		iframe: false,
28		fastIframe: true,
29		photo: false,
30		href: false,
31		title: false,
32		rel: false,
33		opacity: 0.9,
34		preloading: true,
35
36		current: "image {current} of {total}",
37		previous: "previous",
38		next: "next",
39		close: "close",
40		xhrError: "This content failed to load.",
41		imgError: "This image failed to load.",
42
43		open: false,
44		returnFocus: true,
45		reposition: true,
46		loop: true,
47		slideshow: false,
48		slideshowAuto: true,
49		slideshowSpeed: 2500,
50		slideshowStart: "start slideshow",
51		slideshowStop: "stop slideshow",
52		onOpen: false,
53		onLoad: false,
54		onComplete: false,
55		onCleanup: false,
56		onClosed: false,
57		overlayClose: true,
58		escKey: true,
59		arrowKey: true,
60		top: false,
61		bottom: false,
62		left: false,
63		right: false,
64		fixed: false,
65		data: undefined
66	},
67	
68	// Abstracting the HTML and event identifiers for easy rebranding
69	colorbox = 'colorbox',
70	colorbox_class = 'box_mediabox box_modalbox',
71	prefix = 'cbox',
72	boxElement = prefix + 'Element',
73	
74	// Events
75	event_open = prefix + '_open',
76	event_load = prefix + '_load',
77	event_complete = prefix + '_complete',
78	event_cleanup = prefix + '_cleanup',
79	event_closed = prefix + '_closed',
80	event_purge = prefix + '_purge',
81	
82	// Special Handling for IE
83	isIE = !$.support.opacity && !$.support.style, // IE7 & IE8
84	isIE6 = isIE && !window.XMLHttpRequest, // IE6
85	event_ie6 = prefix + '_IE6',
86
87	// Cached jQuery Object Variables
88	$overlay,
89	$box,
90	$wrap,
91	$content,
92	$topBorder,
93	$leftBorder,
94	$rightBorder,
95	$bottomBorder,
96	$related,
97	$window,
98	$loaded,
99	$loadingBay,
100	$loadingOverlay,
101	$title,
102	$current,
103	$slideshow,
104	$next,
105	$prev,
106	$close,
107	$groupControls,
108	
109	// Variables for cached values or use across multiple functions
110	settings,
111	interfaceHeight,
112	interfaceWidth,
113	loadedHeight,
114	loadedWidth,
115	element,
116	index,
117	photo,
118	open,
119	active,
120	closing,
121	loadingTimer,
122	publicMethod,
123	div = "div",
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' ? winWidth() : winHeight()) / 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	function winWidth() {
166		// $(window).width() is incorrect for some mobile browsers, but
167		// window.innerWidth is unsupported in IE8 and lower.
168		return window.innerWidth || $window.width();
169	}
170
171	function winHeight() {
172		return window.innerHeight || $window.height();
173	}
174
175	// Assigns function results to their respective properties
176	function makeSettings() {
177		var i,
178			data = $.data(element, colorbox);
179		
180		if (data == null) {
181			settings = $.extend({}, defaults);
182			if (console && console.log) {
183				console.log('Error: cboxElement missing settings object');
184			}
185		} else {
186			settings = $.extend({}, data);
187		}
188		
189		for (i in settings) {
190			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.
191				settings[i] = settings[i].call(element);
192			}
193		}
194		
195		settings.rel = settings.rel || element.rel || $(element).data('rel') || 'nofollow';
196		settings.href = settings.href || $(element).attr('href');
197		settings.title = settings.title || element.title;
198		
199		if (typeof settings.href === "string") {
200			settings.href = $.trim(settings.href);
201		}
202	}
203
204	function trigger(event, callback) {
205		$.event.trigger(event);
206		if (callback) {
207			callback.call(element);
208		}
209	}
210
211	// Slideshow functionality
212	function slideshow() {
213		var
214		timeOut,
215		className = prefix + "Slideshow_",
216		click = "click." + prefix,
217		start,
218		stop,
219		clear;
220		
221		if (settings.slideshow && $related[1]) {
222			start = function () {
223				$slideshow
224					.text(settings.slideshowStop)
225					.unbind(click)
226					.bind(event_complete, function () {
227						if (settings.loop || $related[index + 1]) {
228							timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
229						}
230					})
231					.bind(event_load, function () {
232						clearTimeout(timeOut);
233					})
234					.one(click + ' ' + event_cleanup, stop);
235				$box.removeClass(className + "off").addClass(className + "on");
236				timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
237			};
238			
239			stop = function () {
240				clearTimeout(timeOut);
241				$slideshow
242					.text(settings.slideshowStart)
243					.unbind([event_complete, event_load, event_cleanup, click].join(' '))
244					.one(click, function () {
245						publicMethod.next();
246						start();
247					});
248				$box.removeClass(className + "on").addClass(className + "off");
249			};
250			
251			if (settings.slideshowAuto) {
252				start();
253			} else {
254				stop();
255			}
256		} else {
257			$box.removeClass(className + "off " + className + "on");
258		}
259	}
260
261	var init_dimensions = false;
262	function launch(target) {
263		if (!closing) {
264
265			element = target;
266			
267			makeSettings();
268			
269			$related = $(element);
270			
271			index = 0;
272			
273			if (settings.rel !== 'nofollow') {
274				$related = $('.' + boxElement).filter(function () {
275					var data = $.data(this, colorbox),
276						relRelated;
277
278					if (data) {
279						relRelated =  $(this).data('rel') || data.rel || this.rel;
280					}
281					
282					return (relRelated === settings.rel);
283				});
284				index = $related.index(element);
285				
286				// Check direct calls to ColorBox.
287				if (index === -1) {
288					$related = $related.add(element);
289					index = $related.length - 1;
290				}
291			}
292			
293			if (!open) {
294				if (!init_dimensions) {
295					init_dimensions = true;
296					// Cache values needed for size calculations
297					interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();//Subtraction needed for IE6
298					interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
299					loadedHeight = $loaded.outerHeight(true);
300					loadedWidth = $loaded.outerWidth(true);
301
302					// Setting padding to remove the need to do size conversions during the animation step.
303					$box.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth});
304				}
305
306				open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
307				
308				$box.show();
309				
310				if (settings.returnFocus) {
311					$(element).blur().one(event_closed, function () {
312						$(this).focus();
313					});
314				}
315				
316				// +settings.opacity avoids a problem in IE when using non-zero-prefixed-string-values, like '.5'
317				$overlay.css({"opacity": +settings.opacity, "cursor": settings.overlayClose ? "pointer" : "auto"}).show();
318				
319				// Opens inital empty ColorBox prior to content being loaded.
320				settings.w = setSize(settings.initialWidth, 'x');
321				settings.h = setSize(settings.initialHeight, 'y');
322				publicMethod.position();
323				
324				if (isIE6) {
325					$window.bind('resize.' + event_ie6 + ' scroll.' + event_ie6, function () {
326						$overlay.css({width: winWidth(), height: winHeight(), top: $window.scrollTop(), left: $window.scrollLeft()});
327					}).trigger('resize.' + event_ie6);
328				}
329				
330				trigger(event_open, settings.onOpen);
331				
332				$groupControls.add($title).hide();
333				
334				$close.html(settings.close).show();
335			}
336			
337			publicMethod.load(true);
338		}
339	}
340
341	// ColorBox's markup needs to be added to the DOM prior to being called
342	// so that the browser will go ahead and load the CSS background images.
343	function appendHTML() {
344		if (!$box && document.body) {
345			init = false;
346
347			$window = $(window);
348			$box = $tag(div).attr({id: colorbox, 'class': (isIE ? prefix + (isIE6 ? 'IE6' : 'IE') : '')+colorbox_class}).hide();
349			$overlay = $tag(div, "Overlay", isIE6 ? 'position:absolute' : '').hide();
350			$loadingOverlay = $tag(div, "LoadingOverlay").add($tag(div, "LoadingGraphic"));
351			$wrap = $tag(div, "Wrapper");
352			$content = $tag(div, "Content").append(
353				$loaded = $tag(div, "LoadedContent", 'width:0; height:0; overflow:hidden'),
354				$title = $tag(div, "Title"),
355				$current = $tag(div, "Current"),
356				$next = $tag(div, "Next"),
357				$prev = $tag(div, "Previous"),
358				$slideshow = $tag(div, "Slideshow").bind(event_open, slideshow),
359				$close = $tag(div, "Close")
360			);
361			
362			$wrap.append( // The 3x3 Grid that makes up ColorBox
363				$tag(div).append(
364					$tag(div, "TopLeft"),
365					$topBorder = $tag(div, "TopCenter"),
366					$tag(div, "TopRight")
367				),
368				$tag(div, false, 'clear:left').append(
369					$leftBorder = $tag(div, "MiddleLeft"),
370					$content,
371					$rightBorder = $tag(div, "MiddleRight")
372				),
373				$tag(div, false, 'clear:left').append(
374					$tag(div, "BottomLeft"),
375					$bottomBorder = $tag(div, "BottomCenter"),
376					$tag(div, "BottomRight")
377				)
378			).find('div div').css({'float': 'left'});
379			
380			$loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none');
381			
382			$groupControls = $next.add($prev).add($current).add($slideshow);
383
384			$(document.body).append($overlay, $box.append($wrap, $loadingBay));
385		}
386	}
387
388	// Add ColorBox's event bindings
389	function addBindings() {
390		if ($box) {
391			if (!init) {
392				init = true;
393
394				// Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.
395				$next.click(function () {
396					publicMethod.next();
397				});
398				$prev.click(function () {
399					publicMethod.prev();
400				});
401				$close.click(function () {
402					publicMethod.close();
403				});
404				$overlay.click(function () {
405					if (settings.overlayClose) {
406						publicMethod.close();
407					}
408				});
409				
410				// Key Bindings
411				$(document).bind('keydown.' + prefix, function (e) {
412					var key = e.keyCode;
413					if (open && settings.escKey && key === 27) {
414						e.preventDefault();
415						publicMethod.close();
416					}
417					if (open && settings.arrowKey && $related[1]) {
418						if (key === 37) {
419							e.preventDefault();
420							$prev.click();
421						} else if (key === 39) {
422							e.preventDefault();
423							$next.click();
424						}
425					}
426				});
427
428				$('.' + boxElement, document).live('click', function (e) {
429					// ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.
430					// See: http://jacklmoore.com/notes/click-events/
431					if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey)) {
432						e.preventDefault();
433						launch(this);
434					}
435				});
436			}
437			return true;
438		}
439		return false;
440	}
441
442	// Don't do anything if ColorBox already exists.
443	if ($.colorbox) {
444		return;
445	}
446
447	// Append the HTML when the DOM loads
448	$(appendHTML);
449
450
451	// ****************
452	// PUBLIC FUNCTIONS
453	// Usage format: $.fn.colorbox.close();
454	// Usage from within an iframe: parent.$.fn.colorbox.close();
455	// ****************
456	
457	publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
458		var $this = this;
459		
460		options = options || {};
461
462		appendHTML();
463
464		if (addBindings()) {
465			if (!$this[0]) {
466				if ($this.selector) { // if a selector was given and it didn't match any elements, go ahead and exit.
467					return $this;
468				}
469				// if no selector was given (ie. $.colorbox()), create a temporary element to work with
470				$this = $('<a/>');
471				options.open = true; // assume an immediate open
472			}
473			
474			if (callback) {
475				options.onComplete = callback;
476			}
477			
478			$this.each(function () {
479				$.data(this, colorbox, $.extend({}, $.data(this, colorbox) || defaults, options));
480				var eltclass = $(this).attr('class');
481				if (eltclass){
482					if (eltclass.indexOf("boxWidth-")!==-1) {
483						var w = eltclass.match(/boxWidth-([^\s'">]*)/);
484						w = w[1].replace(/pc/,'%'); // % not allowed in html attribute ; use 100pc instead of 100%
485						$.data(this, colorbox, $.extend($.data(this, colorbox),{width:w}));
486					}
487					if (eltclass.indexOf("boxHeight-")!==-1) {
488						var h = eltclass.match(/boxHeight-([^\s'">
488]*)/);
489						h = h[1].replace(/pc/,'%'); // % not allowed in html attribute ; use 100pc instead of 100%
490						$.data(this, colorbox, $.extend($.data(this, colorbox),{height:h}));
491					}
492					if (eltclass.indexOf("boxIframe")!==-1) {
493						$.data(this, colorbox, $.extend($.data(this, colorbox),{iframe:true}));
494					}
495					if (eltclass.indexOf("boxInline")!==-1) {
496						$.data(this, colorbox, $.extend($.data(this, colorbox),{inline:true}));
497					}
498					if (eltclass.indexOf("boxSlideshow_off")!==-1) {
499						$.data(this, colorbox, $.extend($.data(this, colorbox),{slideshow:false}));
500					}
501				}
502			}).addClass(boxElement);
503			
504			if (($.isFunction(options.open) && options.open.call($this)) || options.open) {
505				launch($this[0]);
506			}
507		}
508		
509		return $this;
510	};
511
512	publicMethod.position = function (speed, loadedCallback) {
513		var
514		css,
515		top = 0,
516		left = 0,
517		offset = $box.offset(),
518		scrollTop,
519		scrollLeft;
520		
521		$window.unbind('resize.' + prefix);
522
523		// remove the modal so that it doesn't influence the document width/height
524		$box.css({top: -9e4, left: -9e4});
525
526		scrollTop = $window.scrollTop();
527		scrollLeft = $window.scrollLeft();
528
529		if (settings.fixed && !isIE6) {
530			offset.top -= scrollTop;
531			offset.left -= scrollLeft;
532			$box.css({position: 'fixed'});
533		} else {
534			top = scrollTop;
535			left = scrollLeft;
536			$box.css({position: 'absolute'});
537		}
538
539		// keeps the top and left positions within the browser's viewport.
540		if (settings.right !== false) {
541			left += Math.max(winWidth() - settings.w - loadedWidth - interfaceWidth - setSize(settings.right, 'x'), 0);
542		} else if (settings.left !== false) {
543			left += setSize(settings.left, 'x');
544		} else {
545			left += Math.round(Math.max(winWidth() - settings.w - loadedWidth - interfaceWidth, 0) / 2);
546		}
547		
548		if (settings.bottom !== false) {
549			top += Math.max(winHeight() - settings.h - loadedHeight - interfaceHeight - setSize(settings.bottom, 'y'), 0);
550		} else if (settings.top !== false) {
551			top += setSize(settings.top, 'y');
552		} else {
553			top += Math.round(Math.max(winHeight() - settings.h - loadedHeight - interfaceHeight, 0) / 2);
554		}
555
556		$box.css({top: offset.top, left: offset.left});
557
558		// setting the speed to 0 to reduce the delay between same-sized content.
559		speed = ($box.width() === settings.w + loadedWidth && $box.height() === settings.h + loadedHeight) ? 0 : speed || 0;
560		
561		// this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
562		// but it has to be shrank down around the size of div#colorbox when it's done.  If not,
563		// it can invoke an obscure IE bug when using iframes.
564		$wrap[0].style.width = $wrap[0].style.height = "9999px";
565		
566		function modalDimensions(that) {
567			$topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = that.style.width;
568			$content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = that.style.height;
569		}
570
571		css = {width: settings.w + loadedWidth, height: settings.h + loadedHeight, top: top, left: left};
572		if(speed===0){ // temporary workaround to side-step jQuery-UI 1.8 bug (http://bugs.jquery.com/ticket/12273)
573			$box.css(css);
574		}
575		$box.dequeue().animate(css, {
576			duration: speed,
577			complete: function () {
578				modalDimensions(this);
579				
580				active = false;
581				
582				// shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
583				$wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
584				$wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
585				
586				if (settings.reposition) {
587					setTimeout(function () {  // small delay before binding onresize due to an IE8 bug.
588						$window.bind('resize.' + prefix, publicMethod.position);
589					}, 1);
590				}
591
592				if (loadedCallback) {
593					loadedCallback();
594				}
595			},
596			step: function () {
597				modalDimensions(this);
598			}
599		});
600	};
601
602	publicMethod.resize = function (options) {
603		if (open) {
604			options = options || {};
605			
606			if (options.width) {
607				settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
608			}
609			if (options.innerWidth) {
610				settings.w = setSize(options.innerWidth, 'x');
611			}
612			$loaded.css({width: settings.w});
613			
614			if (options.height) {
615				settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
616			}
617			if (options.innerHeight) {
618				settings.h = setSize(options.innerHeight, 'y');
619			}
620			if (!options.innerHeight && !options.height) {
621				$loaded.css({height: "auto"});
622				settings.h = $loaded.height();
623			}
624			$loaded.css({height: settings.h});
625			
626			publicMethod.position(settings.transition === "none" ? 0 : settings.speed);
627		}
628	};
629
630	publicMethod.prep = function (object) {
631		if (!open) {
632			return;
633		}
634		
635		var callback, speed = settings.transition === "none" ? 0 : settings.speed;
636		
637		$loaded.remove();
638		$loaded = $tag(div, 'LoadedContent').append(object);
639		
640		function getWidth() {
641			settings.w = settings.w || $loaded.width();
642			settings.w = settings.minw && settings.minw > settings.w ? settings.minw : settings.w;
643			settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
644			return settings.w;
645		}
646		function getHeight() {
647			settings.h = settings.h || $loaded.height();
648			settings.h = settings.minh && settings.minh > settings.h ? settings.minh : settings.h;
649			settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
650			return settings.h;
651		}
652		
653		$loaded.hide()
654		.appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
655		.css({width: getWidth(), overflow: settings.scrolling ? 'auto' : 'hidden'})
656		.css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
657		.prependTo($content);
658		
659		$loadingBay.hide();
660		
661		// 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.
662		//$(photo).css({'float': 'none', marginLeft: 'auto', marginRight: 'auto'});
663		
664		$(photo).css({'float': 'none'});
665		
666		// Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay.
667		if (isIE6) {
668			$('select').not($box.find('select')).filter(function () {
669				return this.style.visibility !== 'hidden';
670			}).css({'visibility': 'hidden'}).one(event_cleanup, function () {
671				this.style.visibility = 'inherit';
672			});
673		}
674		
675		callback = function () {
676			var preload,
677				i,
678				total = $related.length,
679				iframe,
680				frameBorder = 'frameBorder',
681				allowTransparency = 'allowTransparency',
682				complete,
683				src,
684				img,
685				data;
686			
687			if (!open) {
688				return;
689			}
690			
691			function removeFilter() {
692				if (isIE) {
693					$box[0].style.removeAttribute('filter');
694				}
695			}
696			
697			complete = function () {
698				clearTimeout(loadingTimer);
699				// Detaching forces Andriod stock browser to redraw the area underneat the loading overlay.  Hiding alone isn't enough.
700				$loadingOverlay.detach().hide();
701				trigger(event_complete, settings.onComplete);
702			};
703			
704			if (isIE) {
705				//This fadeIn helps the bicubic resampling to kick-in.
706				if (photo) {
707					$loaded.fadeIn(100);
708				}
709			}
710			
711			$title.html(settings.title).add($loaded).show();
712			
713			if (total > 1) { // handle grouping
714				if (typeof settings.current === "string") {
715					$current.html(settings.current.replace('{current}', index + 1).replace('{total}', total)).show();
716				}
717				
718				$next[(settings.loop || index < total - 1) ? "show" : "hide"]().html(sett
718ings.next);
719				$prev[(settings.loop || index) ? "show" : "hide"]().html(settings.previous);
720				
721				if (settings.slideshow) {
722					$slideshow.show();
723				}
724				
725				// Preloads images within a rel group
726				if (settings.preloading) {
727					preload = [
728						getIndex(-1),
729						getIndex(1)
730					];
731					while (i = $related[preload.pop()]) {
732						data = $.data(i, colorbox);
733						
734						if (data && data.href) {
735							src = data.href;
736							if ($.isFunction(src)) {
737								src = src.call(i);
738							}
739						} else {
740							src = i.href;
741						}
742
743						if (isImage(src)) {
744							img = new Image();
745							img.src = src;
746						}
747					}
748				}
749			} else {
750				$groupControls.hide();
751			}
752			
753			if (settings.iframe) {
754				iframe = $tag('iframe')[0];
755				
756				if (frameBorder in iframe) {
757					iframe[frameBorder] = 0;
758				}
759				if (allowTransparency in iframe) {
760					iframe[allowTransparency] = "true";
761				}
762				// give the iframe a unique name to prevent caching
763				iframe.name = prefix + (+new Date());
764				if (settings.fastIframe) {
765					complete();
766				} else {
767					$(iframe).one('load', complete);
768				}
769				iframe.src = settings.href;
770				if (!settings.scrolling) {
771					iframe.scrolling = "no";
772				}
773				$(iframe).addClass(prefix + 'Iframe').appendTo($loaded).one(event_purge, function () {
774					iframe.src = "https://about:blank";
775				});
776			} else {
777				complete();
778			}
779			
780			if (settings.transition === 'fade') {
781				$box.fadeTo(speed, 1, removeFilter);
782			} else {
783				removeFilter();
784			}
785		};
786		
787		if (settings.transition === 'fade') {
788			$box.fadeTo(speed, 0, function () {
789				publicMethod.position(0, callback);
790			});
791		} else {
792			publicMethod.position(speed, callback);
793		}
794	};
795
796	publicMethod.load = function (launched) {
797		var href, setResize, prep = publicMethod.prep;
798		
799		active = true;
800		
801		photo = false;
802		
803		element = $related[index];
804		
805		if (!launched) {
806			makeSettings();
807		}
808		
809		trigger(event_purge);
810		
811		trigger(event_load, settings.onLoad);
812		
813		settings.h = settings.height ?
814				setSize(settings.height, 'y') - loadedHeight - interfaceHeight :
815				settings.innerHeight && setSize(settings.innerHeight, 'y');
816		
817		settings.w = settings.width ?
818				setSize(settings.width, 'x') - loadedWidth - interfaceWidth :
819				settings.innerWidth && setSize(settings.innerWidth, 'x');
820		
821		// Sets the minimum dimensions for use in image scaling
822		settings.mw = settings.w;
823		settings.mh = settings.h;
824		settings.minw = settings.w;
825		settings.minh = settings.h;
826
827		// Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
828		// If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
829		if (settings.maxWidth) {
830			settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth;
831			settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
832		}
833		if(settings.minWidth){
834			settings.minw = setSize(settings.minWidth, 'x') - loadedWidth - interfaceWidth;
835		 	settings.minw = settings.w && settings.w > settings.minw ? settings.w : settings.minw;
836		}
837		if (settings.maxHeight) {
838			settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight;
839			settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
840		}
841		if(settings.minHeight){
842			settings.minh = setSize(settings.minHeight, 'y') - loadedHeight - interfaceHeight;
843		 	settings.minh = settings.h && settings.h > settings.minh ? settings.h : settings.minh;
844		}
845
846		href = settings.href;
847		
848		loadingTimer = setTimeout(function () {
849			$loadingOverlay.show().appendTo($content);
850		}, 100);
851		
852		if (settings.inline) {
853			// Inserts an empty placeholder where inline content is being pulled from.
854			// An event is bound to put inline content back when ColorBox closes or loads new content.
855			$tag(div).hide().insertBefore($(href)[0]).one(event_purge, function () {
856				$(this).replaceWith($loaded.children());
857			});
858			prep($(href));
859		} else if (settings.iframe) {
860			// IFrame element won't be added to the DOM until it is ready to be displayed,
861			// to avoid problems with DOM-ready JS that might be trying to run in that iframe.
862			prep(" ");
863		} else if (settings.html) {
864			prep(settings.html);
865		} else if (isImage(href)) {
866			$(photo = new Image())
867			.addClass(prefix + 'Photo')
868			.error(function () {
869				settings.title = false;
870				prep($tag(div, 'Error').html(settings.imgError));
871			})
872			.load(function () {
873				var percent;
874				photo.onload = null; //stops animated gifs from firing the onload repeatedly.
875				
876				if (settings.scalePhotos) {
877					setResize = function () {
878						photo.height -= photo.height * percent;
879						photo.width -= photo.width * percent;
880					};
881					if (settings.mw && photo.width > settings.mw) {
882						percent = (photo.width - settings.mw) / photo.width;
883						setResize();
884					}
885					if (settings.mh && photo.height > settings.mh) {
886						percent = (photo.height - settings.mh) / photo.height;
887						setResize();
888					}
889				}
890				
891				if (settings.h) {
892					photo.style.marginTop = Math.max(settings.h - photo.height, 0) / 2 + 'px';
893				}
894				
895				if ($related[1] && (settings.loop || $related[index + 1])) {
896					photo.style.cursor = 'pointer';
897					photo.onclick = function () {
898						publicMethod.next();
899					};
900				}
901				
902				if (isIE) {
903					photo.style.msInterpolationMode = 'bicubic';
904				}
905				
906				setTimeout(function () { // A pause because Chrome will sometimes report a 0 by 0 size otherwise.
907					prep(photo);
908				}, 1);
909			});
910			
911			setTimeout(function () { // A pause because Opera 10.6+ will sometimes not run the onload function otherwise.
912				photo.src = href;
913			}, 1);
914		} else if (href) {
915			$loadingBay.load(href, settings.data, function (data, status, xhr) {
916				prep(status === 'error' ? $tag(div, 'Error').html(settings.xhrError) : $(this).contents());
917			});
918		}
919	};
920		
921	// Navigates to the next page/image in a set.
922	publicMethod.next = function () {
923		if (!active && $related[1] && (settings.loop || $related[index + 1])) {
924			index = getIndex(1);
925			publicMethod.load();
926		}
927	};
928	
929	publicMethod.prev = function () {
930		if (!active && $related[1] && (settings.loop || index)) {
931			index = getIndex(-1);
932			publicMethod.load();
933		}
934	};
935
936	// Note: to use this within an iframe use the following format: parent.$.fn.colorbox.close();
937	publicMethod.close = function () {
938		if (open && !closing) {
939			
940			closing = true;
941			
942			open = false;
943			
944			trigger(event_cleanup, settings.onCleanup);
945			
946			$window.unbind('.' + prefix + ' .' + event_ie6);
947			
948			$overlay.fadeTo(200, 0);
949			
950			$box.stop().fadeTo(300, 0, function () {
951			
952				$box.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide();
953				
954				trigger(event_purge);
955				
956				$loaded.remove();
957				
958				setTimeout(function () {
959					closing = false;
960					trigger(event_closed, settings.onClosed);
961				}, 1);
962			});
963		}
964	};
965
966	// Removes changes ColorBox made to the document, but does not remove the plugin
967	// from jQuery.
968	publicMethod.remove = function () {
969		$([]).add($box).add($overlay).remove();
970		$box = null;
971		$('.' + boxElement)
972			.removeData(colorbox)
973			.removeClass(boxElement)
974			.die();
975	};
976
977	// A method for fetching the current element ColorBox is referencing.
978	// returns a jQuery object.
979	publicMethod.element = function () {
980		return $(element);
981	};
982
983	publicMethod.settings = defaults;
984
985}(jQuery, document, this));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.