PageSourceSearch

https://www.salusuhealth.com/_files/js/jquery.colorbox.js

js salusuhealth.com collected 2026-09-25 03:54:46 UTC 28,094 bytes, 1,075 lines download raw bytes

1/*!
2	Colorbox v1.4.29 - 2013-09-10
3	jQuery lightbox and modal window plugin
4	(c) 2013 Jack Moore - http://www.jacklmoore.com/colorbox
5	license: http://www.opensource.org/licenses/mit-license.php
6*/
7(function ($, document, window) {
8	var
9	// Default settings object.
10	// See http://jacklmoore.com/colorbox for details.
11	defaults = {
12		transition: "elastic",
13		speed: 300,
14		fadeOut: 300,
15		width: false,
16		initialWidth: "600",
17		innerWidth: false,
18		maxWidth: false,
19		height: false,
20		initialHeight: "450",
21		innerHeight: false,
22		maxHeight: 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		className: false,
36
37		// alternate image paths for high-res displays
38		retinaImage: false,
39		retinaUrl: false,
40		retinaSuffix: '@2x.$1',
41
42		// internationalization
43		current: "image {current} of {total}",
44		previous: "previous",
45		next: "next",
46		close: "close",
47		xhrError: "This content failed to load.",
48		imgError: "This image failed to load.",
49
50		open: false,
51		returnFocus: true,
52		trapFocus: true,
53		reposition: true,
54		loop: true,
55		slideshow: false,
56		slideshowAuto: true,
57		slideshowSpeed: 2500,
58		slideshowStart: "start slideshow",
59		slideshowStop: "stop slideshow",
60		photoRegex: /\.(gif|png|jp(e|g|eg)|bmp|ico|webp)((#|\?).*)?$/i,
61
62		onOpen: false,
63		onLoad: false,
64		onComplete: false,
65		onCleanup: false,
66		onClosed: false,
67
68		overlayClose: true,
69		escKey: true,
70		arrowKey: true,
71		top: false,
72		bottom: false,
73		left: false,
74		right: false,
75		fixed: false,
76		data: undefined,
77		closeButton: true
78	},
79	
80	// Abstracting the HTML and event identifiers for easy rebranding
81	colorbox = 'colorbox',
82	prefix = 'cbox',
83	boxElement = prefix + 'Element',
84	
85	// Events
86	event_open = prefix + '_open',
87	event_load = prefix + '_load',
88	event_complete = prefix + '_complete',
89	event_cleanup = prefix + '_cleanup',
90	event_closed = prefix + '_closed',
91	event_purge = prefix + '_purge',
92
93	// Cached jQuery Object Variables
94	$overlay,
95	$box,
96	$wrap,
97	$content,
98	$topBorder,
99	$leftBorder,
100	$rightBorder,
101	$bottomBorder,
102	$related,
103	$window,
104	$loaded,
105	$loadingBay,
106	$loadingOverlay,
107	$title,
108	$current,
109	$slideshow,
110	$next,
111	$prev,
112	$close,
113	$groupControls,
114	$events = $('<a/>'),
115	
116	// Variables for cached values or use across multiple functions
117	settings,
118	interfaceHeight,
119	interfaceWidth,
120	loadedHeight,
121	loadedWidth,
122	element,
123	index,
124	photo,
125	open,
126	active,
127	closing,
128	loadingTimer,
129	publicMethod,
130	div = "div",
131	className,
132	requests = 0,
133	previousCSS = {},
134	init;
135
136	// ****************
137	// HELPER FUNCTIONS
138	// ****************
139	
140	// Convenience function for creating new jQuery objects
141	function $tag(tag, id, css) {
142		var element = document.createElement(tag);
143
144		if (id) {
145			element.id = prefix + id;
146		}
147
148		if (css) {
149			element.style.cssText = css;
150		}
151
152		return $(element);
153	}
154	
155	// Get the window height using innerHeight when available to avoid an issue with iOS
156	// http://bugs.jquery.com/ticket/6724
157	function winheight() {
158		return window.innerHeight ? window.innerHeight : $(window).height();
159	}
160
161	// Determine the next and previous members in a group.
162	function getIndex(increment) {
163		var
164		max = $related.length,
165		newIndex = (index + increment) % max;
166		
167		return (newIndex < 0) ? max + newIndex : newIndex;
168	}
169
170	// Convert '%' and 'px' values to integers
171	function setSize(size, dimension) {
172		return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : winheight()) / 100) : 1) * parseInt(size, 10));
173	}
174	
175	// Checks an href to see if it is a photo.
176	// There is a force photo option (photo: true) for hrefs that cannot be matched by the regex.
177	function isImage(settings, url) {
178		return settings.photo || settings.photoRegex.test(url);
179	}
180
181	function retinaUrl(settings, url) {
182		return settings.retinaUrl && window.devicePixelRatio > 1 ? url.replace(settings.photoRegex, settings.retinaSuffix) : url;
183	}
184
185	function trapFocus(e) {
186		if ('contains' in $box[0] && !$box[0].contains(e.target)) {
187			e.stopPropagation();
188			$box.focus();
189		}
190	}
191
192	// Assigns function results to their respective properties
193	function makeSettings() {
194		var i,
195			data = $.data(element, colorbox);
196		
197		if (data == null) {
198			settings = $.extend({}, defaults);
199			if (console && console.log) {
200				console.log('Error: cboxElement missing settings object');
201			}
202		} else {
203			settings = $.extend({}, data);
204		}
205		
206		for (i in settings) {
207			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.
208				settings[i] = settings[i].call(element);
209			}
210		}
211		
212		settings.rel = settings.rel || element.rel || $(element).data('rel') || 'nofollow';
213		settings.href = settings.href || $(element).attr('href');
214		settings.title = settings.title || element.title;
215		
216		if (typeof settings.href === "string") {
217			settings.href = $.trim(settings.href);
218		}
219	}
220
221	function trigger(event, callback) {
222		// for external use
223		$(document).trigger(event);
224
225		// for internal use
226		$events.trigger(event);
227
228		if ($.isFunction(callback)) {
229			callback.call(element);
230		}
231	}
232
233
234	var slideshow = (function(){
235		var active,
236			className = prefix + "Slideshow_",
237			click = "click." + prefix,
238			timeOut;
239
240		function clear () {
241			clearTimeout(timeOut);
242		}
243
244		function set() {
245			if (settings.loop || $related[index + 1]) {
246				clear();
247				timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
248			}
249		}
250
251		function start() {
252			$slideshow
253				.html(settings.slideshowStop)
254				.unbind(click)
255				.one(click, stop);
256
257			$events
258				.bind(event_complete, set)
259				.bind(event_load, clear);
260
261			$box.removeClass(className + "off").addClass(className + "on");
262		}
263
264		function stop() {
265			clear();
266			
267			$events
268				.unbind(event_complete, set)
269				.unbind(event_load, clear);
270
271			$slideshow
272				.html(settings.slideshowStart)
273				.unbind(click)
274				.one(click, function () {
275					publicMethod.next();
276					start();
277				});
278
279			$box.removeClass(className + "on").addClass(className + "off");
280		}
281
282		function reset() {
283			active = false;
284			$slideshow.hide();
285			clear();
286			$events
287				.unbind(event_complete, set)
288				.unbind(event_load, clear);
289			$box.removeClass(className + "off " + className + "on");
290		}
291
292		return function(){
293			if (active) {
294				if (!settings.slideshow) {
295					$events.unbind(event_cleanup, reset);
296					reset();
297				}
298			} else {
299				if (settings.slideshow && $related[1]) {
300					active = true;
301					$events.one(event_cleanup, reset);
302					if (settings.slideshowAuto) {
303						start();
304					} else {
305						stop();
306					}
307					$slideshow.show();
308				}
309			}
310		};
311
312	}());
313
314
315	function launch(target) {
316		if (!closing) {
317			
318			element = target;
319			
320			makeSettings();
321			
322			$related = $(element);
323			
324			index = 0;
325			
326			if (settings.rel !== 'nofollow') {
327				$related = $('.' + boxElement).filter(function () {
328					var data = $.data(this, colorbox),
329						relRelated;
330
331					if (data) {
332						relRelated =  $(this).data('rel') || data.rel || this.rel;
333					}
334					
335					return (relRelated === settings.rel);
336				});
337				index = $related.index(element);
338				
339				// Check direct calls to Colorbox.
340				if (index === -1) {
341					$related = $related.add(element);
342					index = $related.length - 1;
343				}
344			}
345			
346			$overlay.css({
347				opacity: parseFloat(settings.opacity),
348				cursor: settings.overlayClose ? "pointer" : "auto",
349				visibility: 'visible'
350			}).show();
351			
352
353			if (className) {
354				$box.add($overlay).removeClass(className);
355			}
356			if (settings.className) {
357				$box.add($overlay).addClass(settings.className);
358			}
359			className = settings.className;
360
361			if (settings.closeButton) {
362				$close.html(settings.close).appendTo($content);
363			} else {
364				$close.appendTo('<div/>');
365			}
366
367			if (!open) {
368				open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
369				
370				// Show colorbox so the sizes can be calculated in older versions of jQuery
371				$box.css({visibility:'hidden', display:'block'});
372				
373				$loaded = $tag(div, 'LoadedContent', 'width:0; height:0; overflow:hidden');
374				$content.css({width:'', height:''}).append($loaded);
375
376				// Cache values needed for size calculations
377				interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();
378				interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
379				loadedHeight = $loaded.outerHeight(true);
380				loadedWidth = $loaded.outerWidth(true);
381
382				// Opens inital empty Colorbox prior to content being loaded.
383				settings.w = setSize(settings.initialWidth, 'x');
384				settings.h = setSize(settings.initialHeight, 'y');
385				$loaded.css({width:'', height:settings.h});
386				publicMethod.position();
387
388				trigger(event_open, settings.onOpen);
389				
390				$groupControls.add($title).hide();
391
392				$box.focus();
393				
394				if (settings.trapFocus) {
395					// Confine focus to the modal
396					// Uses event capturing that is not supported in IE8-
397					if (document.addEventListener) {
398
399						document.addEventListener('focus', trapFocus, true);
400						
401						$events.one(event_closed, function () {
402							document.removeEventListener('focus', trapFocus, true);
403						});
404					}
405				}
406
407				// Return focus on closing
408				if (settings.returnFocus) {
409					$events.one(event_closed, function () {
410						$(element).focus();
411					});
412				}
413			}
414			load();
415		}
416	}
417
418	// Colorbox's markup needs to be added to the DOM prior to being called
419	// so that the browser will go ahead and load the CSS background images.
420	function appendHTML() {
421		if (!$box && document.body) {
422			init = false;
vendor: 9,490 bytes, lines 423-746
423			$window = $(window);
424			$box = $tag(div).attr({
425				id: colorbox,
426				'class': $.support.opacity === false ? prefix + 'IE' : '', // class for optional IE8 & lower targeted CSS.
427				role: 'dialog',
428				tabindex: '-1'
429			}).hide();
430			$overlay = $tag(div, "Overlay").hide();
431			$loadingOverlay = $([$tag(div, "LoadingOverlay")[0],$tag(div, "LoadingGraphic")[0]]);
432			$wrap = $tag(div, "Wrapper");
433			$content = $tag(div, "Content").append(
434				$title = $tag(div, "Title"),
435				$current = $tag(div, "Current"),
436				$prev = $('<button type="button"/>').attr({id:prefix+'Previous'}),
437				$next = $('<button type="button"/>').attr({id:prefix+'Next'}),
438				$slideshow = $tag('button', "Slideshow"),
439				$loadingOverlay
440			);
441
442			$close = $('<button type="button"/>').attr({id:prefix+'Close'});
443			
444			$wrap.append( // The 3x3 Grid that makes up Colorbox
445				$tag(div).append(
446					$tag(div, "TopLeft"),
447					$topBorder = $tag(div, "TopCenter"),
448					$tag(div, "TopRight")
449				),
450				$tag(div, false, 'clear:left').append(
451					$leftBorder = $tag(div, "MiddleLeft"),
452					$content,
453					$rightBorder = $tag(div, "MiddleRight")
454				),
455				$tag(div, false, 'clear:left').append(
456					$tag(div, "BottomLeft"),
457					$bottomBorder = $tag(div, "BottomCenter"),
458					$tag(div, "BottomRight")
459				)
460			).find('div div').css({'float': 'left'});
461			
462			$loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none');
463			
464			$groupControls = $next.add($prev).add($current).add($slideshow);
465
466			$(document.body).append($overlay, $box.append($wrap, $loadingBay));
467		}
468	}
469
470	// Add Colorbox's event bindings
471	function addBindings() {
472		function clickHandler(e) {
473			// ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.
474			// See: http://jacklmoore.com/notes/click-events/
475			if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey)) {
476				e.preventDefault();
477				launch(this);
478			}
479		}
480
481		if ($box) {
482			if (!init) {
483				init = true;
484
485				// Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.
486				$next.click(function () {
487					publicMethod.next();
488				});
489				$prev.click(function () {
490					publicMethod.prev();
491				});
492				$close.click(function () {
493					publicMethod.close();
494				});
495				$overlay.click(function () {
496					if (settings.overlayClose) {
497						publicMethod.close();
498					}
499				});
500				
501				// Key Bindings
502				$(document).bind('keydown.' + prefix, function (e) {
503					var key = e.keyCode;
504					if (open && settings.escKey && key === 27) {
505						e.preventDefault();
506						publicMethod.close();
507					}
508					if (open && settings.arrowKey && $related[1] && !e.altKey) {
509						if (key === 37) {
510							e.preventDefault();
511							$prev.click();
512						} else if (key === 39) {
513							e.preventDefault();
514							$next.click();
515						}
516					}
517				});
518
519				if ($.isFunction($.fn.on)) {
520					// For jQuery 1.7+
521					$(document).on('click.'+prefix, '.'+boxElement, clickHandler);
522				} else {
523					// For jQuery 1.3.x -> 1.6.x
524					// This code is never reached in jQuery 1.9, so do not contact me about 'live' being removed.
525					// This is not here for jQuery 1.9, it's here for legacy users.
526					$('.'+boxElement).live('click.'+prefix, clickHandler);
527				}
528			}
529			return true;
530		}
531		return false;
532	}
533
534	// Don't do anything if Colorbox already exists.
535	if ($.colorbox) {
536		return;
537	}
538
539	// Append the HTML when the DOM loads
540	$(appendHTML);
541
542
543	// ****************
544	// PUBLIC FUNCTIONS
545	// Usage format: $.colorbox.close();
546	// Usage from within an iframe: parent.jQuery.colorbox.close();
547	// ****************
548	
549	publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
550		var $this = this;
551		
552		options = options || {};
553		
554		appendHTML();
555
556		if (addBindings()) {
557			if ($.isFunction($this)) { // assume a call to $.colorbox
558				$this = $('<a/>');
559				options.open = true;
560			} else if (!$this[0]) { // colorbox being applied to empty collection
561				return $this;
562			}
563			
564			if (callback) {
565				options.onComplete = callback;
566			}
567			
568			$this.each(function () {
569				$.data(this, colorbox, $.extend({}, $.data(this, colorbox) || defaults, options));
570			}).addClass(boxElement);
571			
572			if (($.isFunction(options.open) && options.open.call($this)) || options.open) {
573				launch($this[0]);
574			}
575		}
576		
577		return $this;
578	};
579
580	publicMethod.position = function (speed, loadedCallback) {
581		var
582		css,
583		top = 0,
584		left = 0,
585		offset = $box.offset(),
586		scrollTop,
587		scrollLeft;
588		
589		$window.unbind('resize.' + prefix);
590
591		// remove the modal so that it doesn't influence the document width/height
592		$box.css({top: -9e4, left: -9e4});
593
594		scrollTop = $window.scrollTop();
595		scrollLeft = $window.scrollLeft();
596
597		if (settings.fixed) {
598			offset.top -= scrollTop;
599			offset.left -= scrollLeft;
600			$box.css({position: 'fixed'});
601		} else {
602			top = scrollTop;
603			left = scrollLeft;
604			$box.css({position: 'absolute'});
605		}
606
607		// keeps the top and left positions within the browser's viewport.
608		if (settings.right !== false) {
609			left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth - setSize(settings.right, 'x'), 0);
610		} else if (settings.left !== false) {
611			left += setSize(settings.left, 'x');
612		} else {
613			left += Math.round(Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2);
614		}
615		
616		if (settings.bottom !== false) {
617			top += Math.max(winheight() - settings.h - loadedHeight - interfaceHeight - setSize(settings.bottom, 'y'), 0);
618		} else if (settings.top !== false) {
619			top += setSize(settings.top, 'y');
620		} else {
621			top += Math.round(Math.max(winheight() - settings.h - loadedHeight - interfaceHeight, 0) / 2);
622		}
623
624		$box.css({top: offset.top, left: offset.left, visibility:'visible'});
625		
626		// this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
627		// but it has to be shrank down around the size of div#colorbox when it's done.  If not,
628		// it can invoke an obscure IE bug when using iframes.
629		$wrap[0].style.width = $wrap[0].style.height = "9999px";
630		
631		function modalDimensions() {
632			$topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = (parseInt($box[0].style.width,10) - interfaceWidth)+'px';
633			$content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = (parseInt($box[0].style.height,10) - interfaceHeight)+'px';
634		}
635
636		css = {width: settings.w + loadedWidth + interfaceWidth, height: settings.h + loadedHeight + interfaceHeight, top: top, left: left};
637
638		// setting the speed to 0 if the content hasn't changed size or position
639		if (speed) {
640			var tempSpeed = 0;
641			$.each(css, function(i){
642				if (css[i] !== previousCSS[i]) {
643					tempSpeed = speed;
644					return;
645				}
646			});
647			speed = tempSpeed;
648		}
649
650		previousCSS = css;
651
652		if (!speed) {
653			$box.css(css);
654		}
655
656		$box.dequeue().animate(css, {
657			duration: speed || 0,
658			complete: function () {
659				modalDimensions();
660				
661				active = false;
662				
663				// shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
664				$wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
665				$wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
666				
667				if (settings.reposition) {
668					setTimeout(function () {  // small delay before binding onresize due to an IE8 bug.
669						$window.bind('resize.' + prefix, publicMethod.position);
670					}, 1);
671				}
672
673				if (loadedCallback) {
674					loadedCallback();
675				}
676			},
677			step: modalDimensions
678		});
679	};
680
681	publicMethod.resize = function (options) {
682		var scrolltop;
683		
684		if (open) {
685			options = options || {};
686			
687			if (options.width) {
688				settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
689			}
690
691			if (options.innerWidth) {
692				settings.w = setSize(options.innerWidth, 'x');
693			}
694
695			$loaded.css({width: settings.w});
696			
697			if (options.height) {
698				settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
699			}
700
701			if (options.innerHeight) {
702				settings.h = setSize(options.innerHeight, 'y');
703			}
704
705			if (!options.innerHeight && !options.height) {
706				scrolltop = $loaded.scrollTop();
707				$loaded.css({height: "auto"});
708				settings.h = $loaded.height();
709			}
710
711			$loaded.css({height: settings.h});
712
713			if(scrolltop) {
714				$loaded.scrollTop(scrolltop);
715			}
716			
717			publicMethod.position(settings.transition === "none" ? 0 : settings.speed);
718		}
719	};
720
721	publicMethod.prep = function (object) {
722		if (!open) {
723			return;
724		}
725		
726		var callback, speed = settings.transition === "none" ? 0 : settings.speed;
727
728		$loaded.empty().remove(); // Using empty first may prevent some IE7 issues.
729
730		$loaded = $tag(div, 'LoadedContent').append(object);
731		
732		function getWidth() {
733			settings.w = settings.w || $loaded.width();
734			settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
735			return settings.w;
736		}
737		function getHeight() {
738			settings.h = settings.h || $loaded.height();
739			settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
740			return settings.h;
741		}
742		
743		$loaded.hide()
744		.appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
745		.css({width: getWidth(), overflow: settings.scrolling ? 'auto' : 'hidden'})
746		.css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
747		.prependTo($content);
748		
749		$loadingBay.hide();
750		
751		// 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.
752		
753		$(photo).css({'float': 'none'});
754
755		callback = function () {
756			var total = $related.length,
757				iframe,
758				frameBorder = 'frameBorder',
759				allowTransparency = 'allowTransparency',
760				complete;
761			
762			if (!open) {
763				return;
764			}
765			
766			function removeFilter() { // Needed for IE7 & IE8 in versions of jQuery prior to 1.7.2
767				if ($.support.opacity === false) {
768					$box[0].style.removeAttribute('filter');
769				}
770			}
771			
772			complete = function () {
773				clearTimeout(loadingTimer);
774				$loadingOverlay.hide();
775				trigger(event_complete, settings.onComplete);
776			};
777
778			
779			$title.html(settings.title).add($loaded).show();
780			
781			if (total > 1) { // handle grouping
782				if (typeof settings.current === "string") {
783					$current.html(settings.current.replace('{current}', index + 1).replace('{total}', total)).show();
784				}
785				
786				$next[(settings.loop || index < total - 1) ? "show" : "hide"]().html(sett
786ings.next);
787				$prev[(settings.loop || index) ? "show" : "hide"]().html(settings.previous);
788				
789				slideshow();
790				
791				// Preloads images within a rel group
792				if (settings.preloading) {
793					$.each([getIndex(-1), getIndex(1)], function(){
794						var src,
795							img,
796							i = $related[this],
797							data = $.data(i, colorbox);
798
799						if (data && data.href) {
800							src = data.href;
801							if ($.isFunction(src)) {
802								src = src.call(i);
803							}
804						} else {
805							src = $(i).attr('href');
806						}
807
808						if (src && isImage(data, src)) {
809							src = retinaUrl(data, src);
810							img = document.createElement('img');
811							img.src = src;
812						}
813					});
814				}
815			} else {
816				$groupControls.hide();
817			}
818			
819			if (settings.iframe) {
820				iframe = $tag('iframe')[0];
821				
822				if (frameBorder in iframe) {
823					iframe[frameBorder] = 0;
824				}
825				
826				if (allowTransparency in iframe) {
827					iframe[allowTransparency] = "true";
828				}
829
830				if (!settings.scrolling) {
831					iframe.scrolling = "no";
832				}
833				
834				$(iframe)
835					.attr({
836						src: settings.href,
837						name: (new Date()).getTime(), // give the iframe a unique name to prevent caching
838						'class': prefix + 'Iframe',
839						allowFullScreen : true, // allow HTML5 video to go fullscreen
840						webkitAllowFullScreen : true,
841						mozallowfullscreen : true
842					})
843					.one('load', complete)
844					.appendTo($loaded);
845				
846				$events.one(event_purge, function () {
847					iframe.src = "//about:blank";
848				});
849
850				if (settings.fastIframe) {
851					$(iframe).trigger('load');
852				}
853			} else {
854				complete();
855			}
856			
857			if (settings.transition === 'fade') {
858				$box.fadeTo(speed, 1, removeFilter);
859			} else {
860				removeFilter();
861			}
862		};
863		
864		if (settings.transition === 'fade') {
865			$box.fadeTo(speed, 0, function () {
866				publicMethod.position(0, callback);
867			});
868		} else {
869			publicMethod.position(speed, callback);
870		}
871	};
872
873	function load () {
874		var href, setResize, prep = publicMethod.prep, $inline, request = ++requests;
875		
876		active = true;
877		
878		photo = false;
879		
880		element = $related[index];
881		
882		makeSettings();
883		
884		trigger(event_purge);
885		
886		trigger(event_load, settings.onLoad);
887		
888		settings.h = settings.height ?
889				setSize(settings.height, 'y') - loadedHeight - interfaceHeight :
890				settings.innerHeight && setSize(settings.innerHeight, 'y');
891		
892		settings.w = settings.width ?
893				setSize(settings.width, 'x') - loadedWidth - interfaceWidth :
894				settings.innerWidth && setSize(settings.innerWidth, 'x');
895		
896		// Sets the minimum dimensions for use in image scaling
897		settings.mw = settings.w;
898		settings.mh = settings.h;
899		
900		// Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
901		// If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
902		if (settings.maxWidth) {
903			settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth;
904			settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
905		}
906		if (settings.maxHeight) {
907			settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight;
908			settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
909		}
910		
911		href = settings.href;
912		
913		loadingTimer = setTimeout(function () {
914			$loadingOverlay.show();
915		}, 100);
916		
917		if (settings.inline) {
918			// Inserts an empty placeholder where inline content is being pulled from.
919			// An event is bound to put inline content back when Colorbox closes or loads new content.
920			$inline = $tag(div).hide().insertBefore($(href)[0]);
921
922			$events.one(event_purge, function () {
923				$inline.replaceWith($loaded.children());
924			});
925
926			prep($(href));
927		} else if (settings.iframe) {
928			// IFrame element won't be added to the DOM until it is ready to be displayed,
929			// to avoid problems with DOM-ready JS that might be trying to run in that iframe.
930			prep(" ");
931		} else if (settings.html) {
932			prep(settings.html);
933		} else if (isImage(settings, href)) {
934
935			href = retinaUrl(settings, href);
936
937			photo = document.createElement('img');
938
939			$(photo)
940			.addClass(prefix + 'Photo')
941			.bind('error',function () {
942				settings.title = false;
943				prep($tag(div, 'Error').html(settings.imgError));
944			})
945			.one('load', function () {
946				var percent;
947
948				if (request !== requests) {
949					return;
950				}
951
952				photo.alt = $(element).attr('alt') || $(element).attr('data-alt') || '';
953
954				if (settings.retinaImage && window.devicePixelRatio > 1) {
955					photo.height = photo.height / window.devicePixelRatio;
956					photo.width = photo.width / window.devicePixelRatio;
957				}
958
959				if (settings.scalePhotos) {
960					setResize = function () {
961						photo.height -= photo.height * percent;
962						photo.width -= photo.width * percent;
963					};
964					if (settings.mw && photo.width > settings.mw) {
965						percent = (photo.width - settings.mw) / photo.width;
966						setResize();
967					}
968					if (settings.mh && photo.height > settings.mh) {
969						percent = (photo.height - settings.mh) / photo.height;
970						setResize();
971					}
972				}
973				
974				if (settings.h) {
975					photo.style.marginTop = Math.max(settings.mh - photo.height, 0) / 2 + 'px';
976				}
977				
978				if ($related[1] && (settings.loop || $related[index + 1])) {
979					photo.style.cursor = 'pointer';
980					photo.onclick = function () {
981						publicMethod.next();
982					};
983				}
984
985				photo.style.width = photo.width + 'px';
986				photo.style.height = photo.height + 'px';
987
988				setTimeout(function () { // A pause because Chrome will sometimes report a 0 by 0 size otherwise.
989					prep(photo);
990				}, 1);
991			});
992			
993			setTimeout(function () { // A pause because Opera 10.6+ will sometimes not run the onload function otherwise.
994				photo.src = href;
995			}, 1);
996		} else if (href) {
997			$loadingBay.load(href, settings.data, function (data, status) {
998				if (request === requests) {
999					prep(status === 'error' ? $tag(div, 'Error').html(settings.xhrError) : $(this).contents());
1000				}
1001			});
1002		}
1003	}
1004		
1005	// Navigates to the next page/image in a set.
1006	publicMethod.next = function () {
1007		if (!active && $related[1] && (settings.loop || $related[index + 1])) {
1008			index = getIndex(1);
1009			launch($related[index]);
1010		}
1011	};
1012	
1013	publicMethod.prev = function () {
1014		if (!active && $related[1] && (settings.loop || index)) {
1015			index = getIndex(-1);
1016			launch($related[index]);
1017		}
1018	};
1019
1020	// Note: to use this within an iframe use the following format: parent.jQuery.colorbox.close();
1021	publicMethod.close = function () {
1022		if (open && !closing) {
1023			
1024			closing = true;
1025			
1026			open = false;
1027			
1028			trigger(event_cleanup, settings.onCleanup);
1029			
1030			$window.unbind('.' + prefix);
1031			
1032			$overlay.fadeTo(settings.fadeOut || 0, 0);
1033			
1034			$box.stop().fadeTo(settings.fadeOut || 0, 0, function () {
1035			
1036				$box.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide();
1037				
1038				trigger(event_purge);
1039				
1040				$loaded.empty().remove(); // Using empty first may prevent some IE7 issues.
1041				
1042				setTimeout(function () {
1043					closing = false;
1044					trigger(event_closed, settings.onClosed);
1045				}, 1);
1046			});
1047		}
1048	};
1049
1050	// Removes changes Colorbox made to the document, but does not remove the plugin.
1051	publicMethod.remove = function () {
1052		if (!$box) { return; }
1053
1054		$box.stop();
1055		$.colorbox.close();
1056		$box.stop().remove();
1057		$overlay.remove();
1058		closing = false;
1059		$box = null;
1060		$('.' + boxElement)
1061			.removeData(colorbox)
1062			.removeClass(boxElement);
1063
1064		$(document).unbind('click.'+prefix);
1065	};
1066
1067	// A method for fetching the current element Colorbox is referencing.
1068	// returns a jQuery object.
1069	publicMethod.element = function () {
1070		return $(element);
1071	};
1072
1073	publicMethod.settings = defaults;
1074
1075}(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.