PageSourceSearch

http://www.telecostasmeralda.tv/wp-content/plugins/portfolio-gallery/js/jquery.colorbox.js?ver=1.0.0

js telecostasmeralda.tv collected 2026-09-25 11:01:18 UTC 29,863 bytes, 1,094 lines download raw bytes

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

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.