PageSourceSearch

https://slaverybyanothername.com/wp-content/plugins/lightbox-plus/js/jquery.colorbox.1.3.32.js?ver=1.3.32

js slaverybyanothername.com collected 2026-09-24 22:59:35 UTC 26,029 bytes, 975 lines download raw bytes

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,
13		width: false,
14		initialWidth: "600",
15		innerWidth: false,
16		maxWidth: false,
17		height: false,
18		initialHeight: "450",
19		innerHeight: false,
20		maxHeight: false,
21		scalePhotos: true,
22		scrolling: true,
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,
48		slideshowSpeed: 2500,
49		slideshowStart: "start slideshow",
50		slideshowStop: "stop slideshow",
51		onOpen: false,
52		onLoad: false,
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
86	$overlay,
87	$box,
88	$wrap,
89	$content,
90	$topBorder,
91	$leftBorder,
92	$rightBorder,
93	$bottomBorder,
94	$related,
95	$window,
96	$loaded,
97	$loadingBay,
98	$loadingOverlay,
99	$title,
100	$current,
101	$slideshow,
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
207	function slideshow() {
208		var
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			
261			if (settings.slideshowAuto) {
262				start();
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			
280			index = 0;
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);
294				
295				// Check direct calls to ColorBox.
296				if (index === -1) {
297					$related = $related.add(element);
298					index = $related.length - 1;
299				}
300			}
301			
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			}
348			
349			publicMethod.load(true);
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();
471	// Usage from within an iframe: parent.$.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(sett
534ings.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,
556		// it can invoke an obscure IE bug when using iframes.
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				
574				active = false;
575				
576				// shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
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				}
589			},
590			step: function () {
591				modalDimensions(this);
592			}
593		});
594	};
595
596	publicMethod.resize = function (options) {
597		if (open) {
598			options = options || {};
599			
600			if (options.width) {
601				settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
602			}
603			if (options.innerWidth) {
604				settings.w = setSize(options.innerWidth, 'x');
605			}
606			$loaded.css({width: settings.w});
607			
608			if (options.height) {
609				settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
610			}
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			
620			publicMethod.position(settings.transition === "none" ? 0 : settings.speed);
621		}
622	};
623
624	publicMethod.prep = function (object) {
625		if (!open) {
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();
637			settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
638			return settings.w;
639		}
640		function getHeight() {
641			settings.h = settings.h || $loaded.height();
642			settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
643			return settings.h;
644		}
645		
646		$loaded.hide()
647		.appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
648		.css({width: getWidth(), overflow: settings.scrolling ? 'auto' : 'hidden'})
649		.css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
650		.prependTo($content);
651		
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(sett
697ings.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		
808		trigger(event_load, settings.onLoad);
809		
810		settings.h = settings.height ?
811				setSize(settings.height, 'y') - loadedHeight - interfaceHeight :
812				settings.innerHeight && setSize(settings.innerHeight, 'y');
813		
814		settings.w = settings.width ?
815				setSize(settings.width, 'x') - loadedWidth - interfaceWidth :
816				settings.innerWidth && setSize(settings.innerWidth, 'x');
817		
818		// Sets the minimum dimensions for use in image scaling
819		settings.mw = settings.w;
820		settings.mh = settings.h;
821		
822		// Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
823		// If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
824		if (settings.maxWidth) {
825			settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth;
826			settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
827		}
828		if (settings.maxHeight) {
829			settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight;
830			settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
831		}
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.mh - 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	};
924
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;
932			
933			trigger(event_cleanup, settings.onCleanup);
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;
949					trigger(event_closed, settings.onClosed);
950				}, 1);
951			});
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 () {
970		return $(element);
971	};
972
973	publicMethod.settings = defaults;
974
975}(jQuery, document, window));

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.