PageSourceSearch

https://www.toptalents.com/js/shared/jquery.colorbox.js?v=BDUyzBTbHMJo-Mo1pl1ZaDzETb8FRPRgx2WGYbA9bM8

js toptalents.com collected 2026-10-08 03:45:52 UTC 30,933 bytes, 1,118 lines download raw bytes

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