PageSourceSearch

https://dahofficial.com/wordpress/wp-content/themes/dahofficial/js/colorbox/jquery.colorbox.js

js dahofficial.com collected 2026-10-02 12:10:55 UTC 23,637 bytes, 788 lines download raw bytes

1// ColorBox v1.3.15 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
2// Copyright (c) 2010 Jack Moore - [email protected]
3// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
4(function ($, window) {
5	
6	var
7	// ColorBox Default Settings.	
8	// See http://colorpowered.com/colorbox for details.
9	defaults = {
10		transition: "elastic",
11		speed: 300,
12		width: false,
13		initialWidth: "600",
14		innerWidth: false,
15		maxWidth: false,
16		height: false,
17		initialHeight: "450",
18		innerHeight: false,
19		maxHeight: false,
20		scalePhotos: true,
21		scrolling: true,
22		inline: false,
23		html: false,
24		iframe: false,
25		photo: false,
26		href: false,
27		title: false,
28		rel: false,
29		opacity: 0.9,
30		preloading: true,
31		current: "image {current} of {total}",
32		previous: "previous",
33		next: "next",
34		close: "close",
35		open: false,
36		returnFocus: true,
37		loop: true,
38		slideshow: false,
39		slideshowAuto: true,
40		slideshowSpeed: 2500,
41		slideshowStart: "start slideshow",
42		slideshowStop: "stop slideshow",
43		onOpen: false,
44		onLoad: false,
45		onComplete: false,
46		onCleanup: false,
47		onClosed: false,
48		overlayClose: true,		
49		escKey: true,
50		arrowKey: true
51	},
52	
53	// Abstracting the HTML and event identifiers for easy rebranding
54	colorbox = 'colorbox',
55	prefix = 'cbox',
56	
57	// Events	
58	event_open = prefix + '_open',
59	event_load = prefix + '_load',
60	event_complete = prefix + '_complete',
61	event_cleanup = prefix + '_cleanup',
62	event_closed = prefix + '_closed',
63	event_purge = prefix + '_purge',
64	event_loaded = prefix + '_loaded',
65	
66	// Special Handling for IE
67	isIE = $.browser.msie && !$.support.opacity, // feature detection alone gave a false positive on at least one phone browser and on some development versions of Chrome.
68	isIE6 = isIE && $.browser.version < 7,
69	event_ie6 = prefix + '_IE6',
70
71	// Cached jQuery Object Variables
72	$overlay,
73	$box,
74	$wrap,
75	$content,
76	$topBorder,
77	$leftBorder,
78	$rightBorder,
79	$bottomBorder,
80	$related,
81	$window,
82	$loaded,
83	$loadingBay,
84	$loadingOverlay,
85	$title,
86	$current,
87	$slideshow,
88	$next,
89	$prev,
90	$close,
91
92	// Variables for cached values or use across multiple functions
93	interfaceHeight,
94	interfaceWidth,
95	loadedHeight,
96	loadedWidth,
97	element,
98	index,
99	settings,
100	open,
101	active,
102	closing = false,
103	
104	publicMethod,
105	boxElement = prefix + 'Element';
106	
107	// ****************
108	// HELPER FUNCTIONS
109	// ****************
110
111	// jQuery object generator to reduce code size
112	function $div(id, css) { 
113		id = id ? ' id="' + prefix + id + '"' : '';
114		css = css ? ' style="' + css + '"' : '';
115		return $('<div' + id + css + '/>');
116	}
117
118	// Convert % values to pixels
119	function setSize(size, dimension) {
120		dimension = dimension === 'x' ? $window.width() : $window.height();
121		return (typeof size === 'string') ? Math.round((/%/.test(size) ? (dimension / 100) * parseInt(size, 10) : parseInt(size, 10))) : size;
122	}
123	
124	// Checks an href to see if it is a photo.
125	// There is a force photo option (photo: true) for hrefs that cannot be matched by this regex.
126	function isImage(url) {
127		return settings.photo || /\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(url);
128	}
129	
130	// Assigns function results to their respective settings.  This allows functions to be used as values.
131	function process(settings) {
132		for (var i in settings) {
133			if ($.isFunction(settings[i]) && i.substring(0, 2) !== 'on') { // checks to make sure the function isn't one of the callbacks, they will be handled at the appropriate time.
134			    settings[i] = settings[i].call(element);
135			}
136		}
137		settings.rel = settings.rel || element.rel || 'nofollow';
138		settings.href = settings.href || $(element).attr('href');
139		settings.title = settings.title || element.title;
140		return settings;
141	}
142
143	function trigger(event, callback) {
144		if (callback) {
145			callback.call(element);
146		}
147		$.event.trigger(event);
148	}
149
150	// Slideshow functionality
151	function slideshow() {
152		var
153		timeOut,
154		className = prefix + "Slideshow_",
155		click = "click." + prefix,
156		start,
157		stop,
158		clear;
159		
160		if (settings.slideshow && $related[1]) {
161			start = function () {
162				$slideshow
163					.text(settings.slideshowStop)
164					.unbind(click)
165					.bind(event_complete, function () {
166						if (index < $related.length - 1 || settings.loop) {
167							timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
168						}
169					})
170					.bind(event_load, function () {
171						clearTimeout(timeOut);
172					})
173					.one(click + ' ' + event_cleanup, stop);
174				$box.removeClass(className + "off").addClass(className + "on");
175				timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
176			};
177			
178			stop = function () {
179				clearTimeout(timeOut);
180				$slideshow
181					.text(settings.slideshowStart)
182					.unbind([event_complete, event_load, event_cleanup, click].join(' '))
183					.one(click, start);
184				$box.removeClass(className + "on").addClass(className + "off");
185			};
186			
187			if (settings.slideshowAuto) {
188				start();
189			} else {
190				stop();
191			}
192		}
193	}
194
195	function launch(elem) {
196		if (!closing) {
197			
198			element = elem;
199			
200			settings = process($.extend({}, $.data(element, colorbox)));
201			
202			$related = $(element);
203			
204			index = 0;
205			
206			if (settings.rel !== 'nofollow') {
207				$related = $('.' + boxElement).filter(function () {
208					var relRelated = $.data(this, colorbox).rel || this.rel;
209					return (relRelated === settings.rel);
210				});
211				index = $related.index(element);
212				
213				// Check direct calls to ColorBox.
214				if (index === -1) {
215					$related = $related.add(element);
216					index = $related.length - 1;
217				}
218			}
219			
220			if (!open) {
221				open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right 
221keys.
222				
223				$box.show();
224				
225				if (settings.returnFocus) {
226					try {
227						element.blur();
228						$(element).one(event_closed, function () {
229							try {
230								this.focus();
231							} catch (e) {
232								// do nothing
233							}
234						});
235					} catch (e) {
236						// do nothing
237					}
238				}
239				
240				// +settings.opacity avoids a problem in IE when using non-zero-prefixed-string-values, like '.5'
241				$overlay.css({"opacity": +settings.opacity, "cursor": settings.overlayClose ? "pointer" : "auto"}).show();
242				
243				// Opens inital empty ColorBox prior to content being loaded.
244				settings.w = setSize(settings.initialWidth, 'x');
245				settings.h = setSize(settings.initialHeight, 'y');
246				publicMethod.position(0);
247				
248				if (isIE6) {
249					$window.bind('resize.' + event_ie6 + ' scroll.' + event_ie6, function () {
250						$overlay.css({width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft()});
251					}).trigger('scroll.' + event_ie6);
252				}
253				
254				trigger(event_open, settings.onOpen);
255				
256				$current.add($prev).add($next).add($slideshow).add($title).hide();
257				
258				$close.html(settings.close).show();
259			}
260			
261			publicMethod.load(true);
262		}
263	}
264
265	// ****************
266	// PUBLIC FUNCTIONS
267	// Usage format: $.fn.colorbox.close();
268	// Usage from within an iframe: parent.$.fn.colorbox.close();
269	// ****************
270	
271	publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
272		var $this = this, autoOpen;
273		
274		if (!$this[0] && $this.selector) { // if a selector was given and it didn't match any elements, go ahead and exit.
275			return $this;
276		}
277		
278		options = options || {};
279		
280		if (callback) {
281			options.onComplete = callback;
282		}
283		
284		if (!$this[0] || $this.selector === undefined) { // detects $.colorbox() and $.fn.colorbox()
285			$this = $('<a/>');
286			options.open = true; // assume an immediate open
287		}
288		
289		$this.each(function () {
290			$.data(this, colorbox, $.extend({}, $.data(this, colorbox) || defaults, options));
291			$(this).addClass(boxElement);
292		});
293		
294		autoOpen = options.open;
295		
296		if ($.isFunction(autoOpen)) {
297			autoOpen = autoOpen.call($this);
298		}
299		
300		if (autoOpen) {
301			launch($this[0]);
302		}
303		
304		return $this;
305	};
306
307	// Initialize ColorBox: store common calculations, preload the interface graphics, append the html.
308	// This preps colorbox for a speedy open when clicked, and lightens the burdon on the browser by only
309	// having to run once, instead of each time colorbox is opened.
310	publicMethod.init = function () {
311		// Create & Append jQuery Objects
312		$window = $(window);
313		$box = $div().attr({id: colorbox, 'class': isIE ? prefix + 'IE' : ''});
314		$overlay = $div("Overlay", isIE6 ? 'position:absolute' : '').hide();
315		
316		$wrap = $div("Wrapper");
317		$content = $div("Content").append(
318			$loaded = $div("LoadedContent", 'width:0; height:0; overflow:hidden'),
319			$loadingOverlay = $div("LoadingOverlay").add($div("LoadingGraphic")),
320			$title = $div("Title"),
321			$current = $div("Current"),
322			$next = $div("Next"),
323			$prev = $div("Previous"),
324			$slideshow = $div("Slideshow").bind(event_open, slideshow),
325			$close = $div("Close")
326		);
327		$wrap.append( // The 3x3 Grid that makes up ColorBox
328			$div().append(
329				$div("TopLeft"),
330				$topBorder = $div("TopCenter"),
331				$div("TopRight")
332			),
333			$div(false, 'clear:left').append(
334				$leftBorder = $div("MiddleLeft"),
335				$content,
336				$rightBorder = $div("MiddleRight")
337			),
338			$div(false, 'clear:left').append(
339				$div("BottomLeft"),
340				$bottomBorder = $div("BottomCenter"),
341				$div("BottomRight")
342			)
343		).children().children().css({'float': 'left'});
344		
345		$loadingBay = $div(false, 'position:absolute; width:9999px; visibility:hidden; display:none');
346		
347		$('body').prepend($overlay, $box.append($wrap, $loadingBay));
348		
349		$content.children()
350		.hover(function () {
351			$(this).addClass('hover');
352		}, function () {
353			$(this).removeClass('hover');
354		}).addClass('hover');
355		
356		// Cache values needed for size calculations
357		interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();//Subtraction needed for IE6
358		interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
359		loadedHeight = $loaded.outerHeight(true);
360		loadedWidth = $loaded.outerWidth(true);
361		
362		// Setting padding to remove the need to do size conversions during the animation step.
363		$box.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth}).hide();
364		
365		// Setup button events.
366		$next.click(publicMethod.next);
367		$prev.click(publicMethod.prev);
368		$close.click(publicMethod.close);
369		
370		// Adding the 'hover' class allowed the browser to load the hover-state
371		// background graphics.  The class can now can be removed.
372		$content.children().removeClass('hover');
373		
374		$('.' + boxElement).live('click', function (e) {
375			// checks to see if it was a non-left mouse-click and for clicks modified with ctrl, shift, or alt.
376			if (!((e.button !== 0 && typeof e.button !== 'undefined') || e.ctrlKey || e.shiftKey || e.altKey)) {
377				e.preventDefault();
378				launch(this);
379			}
380		});
381		
382		$overlay.click(function () {
383			if (settings.overlayClose) {
384				publicMethod.close();
385			}
386		});
387		
388		// Set Navigation Key Bindings
389		$(document).bind("keydown", function (e) {
390			if (open && settings.escKey && e.keyCode === 27) {
391				e.preventDefault();
392				publicMethod.close();
393			}
394			if (open && settings.arrowKey && !active && $related[1]) {
395				if (e.keyCode === 37 && (index || settings.loop)) {
396					e.preventDefault();
397					$prev.click();
398				} else if (e.keyCode === 39 && (index < $related.length - 1 || settings.loop)) {
399					e.preventDefault();
400					$next.click();
401				}
402			}
403		});
404	};
405	
406	publicMethod.remove = function () {
407		$box.add($overlay).remove();
408		$('.' + boxElement).die('click').removeData(colorbox).removeClass(boxElement);
409	};
410
411	publicMethod.position = function (speed, loadedCallback) {
412		var
413		animate_speed,
414		// keeps the top and left positions within the browser's viewport.
415		posTop = Math.max(document.documentElement.clientHeight - settings.h - loadedHeight - interfaceHeight, 0) / 2 + $window.scrollTop(),
416		posLeft = Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2 + $window.scrollLeft();
417		
418		// setting the speed to 0 to reduce the delay between same-sized content.
419		animate_speed = ($box.width() === settings.w + loadedWidth && $box.height() === settings.h + loadedHeight) ? 0 : speed;
420		
421		// this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
422		// but it has to be shrank down around the size of div#colorbox when it's done.  If not,
423		// it can invoke an obscure IE bug when using iframes.
424		$wrap[0].style.width = $wrap[0].style.height = "9999px";
425		
426		function modalDimensions(that) {
427			// loading overlay height has to be explicitly set for IE6.
428			$topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = that.style.width;
429			$loadingOverlay[0].style.height = $loadingOverlay[1].style.height = $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = that.style.height;
430		}
431		
432		$box.dequeue().animate({width: settings.w + loadedWidth, height: settings.h + loadedHeight, top: posTop, left: posLeft}, {
433			duration: animate_speed,
434			complete: function () {
435				modalDimensions(this);
436				
437				active = false;
438				
439				// shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
440				$wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
441				$wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
442				
443				if (loadedCallback) {
444					loadedCallback();
445				}
446			},
447			step: function () {
448				modalDimensions(this);
449			}
450		});
451	};
452
453	publicMethod.resize = function (options) {
454		if (open) {
455			options = options || {};
456			
457			if (options.width) {
458				settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
459			}
460			if (options.innerWidth) {
461				settings.w = setSize(options.innerWidth, 'x');
462			}
463			$loaded.css({width: settings.w});
464			
465			if (options.height) {
466				settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
467			}
468			if (options.innerHeight) {
469				settings.h = setSize(options.innerHeight, 'y');
470			}
471			if (!options.innerHeight && !options.height) {				
472				var $child = $loaded.wrapInner("<div style='overflow:auto'></div>").children(); // temporary wrapper to get an accurate estimate of just how high the total content should be.
473				settings.h = $child.height();
474				$child.replaceWith($child.children()); // ditch the temporary wrapper div used in height calculation
475			}
476			$loaded.css({height: settings.h});
477			
478			publicMethod.position(settings.transition === "none" ? 0 : settings.speed);
479		}
480	};
481
482	publicMethod.prep = function (object) {
483		if (!open) {
484			return;
485		}
486		
487		var photo,
488		speed = settings.transition === "none" ? 0 : settings.speed;
489		
490		$window.unbind('resize.' + prefix);
491		$loaded.remove();
492		$loaded = $div('LoadedContent').html(object);
493		
494		function getWidth() {
495			settings.w = settings.w || $loaded.width();
496			settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
497			return settings.w;
498		}
499		function getHeight() {
500			settings.h = settings.h || $loaded.height();
501			settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
502			return settings.h;
503		}
504		
505		$loaded.hide()
506		.appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
507		.css({width: getWidth(), overflow: settings.scrolling ? 'auto' : 'hidden'})
508		.css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
509		.prependTo($content);
510		
511		$loadingBay.hide();
512		
513		// 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.
514		$('#' + prefix + 'Photo').css({cssFloat: 'none', marginLeft: 'auto', marginRight: 'auto'});
515		
516		// Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay.
517		if (isIE6) {
518			$('select').not($box.find('select')).filter(function () {
519				return this.style.visibility !== 'hidden';
520			}).css({'visibility': 'hidden'}).one(event_cleanup, function () {
521				this.style.visibility = 'inherit';
522			});
523		}
524				
525		function setPosition(s) {
526			var prev, prevSrc, next, nextSrc, total = $related.length, loop = settings.loop;
527			publicMethod.position(s, function () {
528				function defilter() {
529					if (isIE) {
530						//IE adds a filter when ColorBox fades in and out that can cause problems if the loaded content contains transparent pngs.
531						$box[0].style.removeAttribute("filter"); 
532					}
533				}
534				
535				if (!open) {
536					return;
537				}
538				
539				if (isIE) {
540					//This fadeIn helps the bicubic resampling to kick-in.
541					if (photo) {
542						$loaded.fadeIn(100);
543					}
544				}
545				
546				$loaded.show();
547				
548				trigger(event_loaded);
549				
550				$title.show().html(settings.title);
551				
552				if (total > 1) { // handle grouping
553					if (typeof settings.current === "string") {
554						$current.html(settings.current.replace(/\{current\}/, index + 1).replace(/\{total\}/, total)).show();
555					}
556					
557					$next[(loop || index < total - 1) ? "show" : "hide"]().html(settings.next);
558					$prev[(loop || index) ? "show" : "hide"]().html(settings.previous);
559					
560					prev = index ? $related[index - 1] : $related[total - 1];
561					next = index < total - 1 ? $related[index + 1] : $related[0];
562					
563					if (settings.slideshow) {
564						$slideshow.show();
565					}
566					
567					// Preloads images within a rel group
568					if (settings.preloading) {
569						nextSrc = $.data(next, colorbox).href || next.href;
570						prevSrc = $.data(prev, colorbox).href || prev.href;
571						
572						nextSrc = $.isFunction(nextSrc) ? nextSrc.call(next) : nextSrc;
573						prevSrc = $.isFunction(prevSrc) ? prevSrc.call(prev) : prevSrc;
574						
575						if (isImage(nextSrc)) {
576							$('<img/>')[0].src = nextSrc;
577						}
578						
579						if (isImage(prevSrc)) {
580							$('<img/>')[0].src = prevSrc;
581						}
582					}
583				}
584				
585				$loadingOverlay.hide();
586				
587				if (settings.transition === 'fade') {
588					$box.fadeTo(speed, 1, function () {
589						defilter();
590					});
591				} else {
592					defilter();
593				}
594				
595				$window.bind('resize.' + prefix, function () {
596					publicMethod.position(0);
597				});
598				
599				trigger(event_complete, settings.onComplete);
600			});
601		}
602		
603		if (settings.transition === 'fade') {
604			$box.fadeTo(speed, 0, function () {
605				setPosition(0);
606			});
607		} else {
608			setPosition(speed);
609		}
610	};
611
612	publicMethod.load = function (launched) {
613		var href, img, setResize, prep = publicMethod.prep;
614		
615		active = true;
616		element = $related[index];
617		
618		if (!launched) {
619			settings = process($.extend({}, $.data(element, colorbox)));
620		}
621		
622		trigger(event_purge);
623		
624		trigger(event_load, settings.onLoad);
625		
626		settings.h = settings.height ?
627				setSize(settings.height, 'y') - loadedHeight - interfaceHeight :
628				settings.innerHeight && setSize(settings.innerHeight, 'y');
629		
630		settings.w = settings.width ?
631				setSize(settings.width, 'x') - loadedWidth - interfaceWidth :
632				settings.innerWidth && setSize(settings.innerWidth, 'x');
633		
634		// Sets the minimum dimensions for use in image scaling
635		settings.mw = settings.w;
636		settings.mh = settings.h;
637		
638		// Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
639		// If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
640		if (settings.maxWidth) {
641			settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth;
642			settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
643		}
644		if (settings.maxHeight) {
645			settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight;
646			settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
647		}
648		
649		href = settings.href;
650		
651		$loadingOverlay.show();
652
653		if (settings.inline) {
654			// Inserts an empty placeholder where inline content is being pulled from.
655			// An event is bound to put inline content back when ColorBox closes or loads new content.
656			$div().hide().insertBefore($(href)[0]).one(event_purge, function () {
657				$(this).replaceWith($loaded.children());
658			});
659			prep($(href));
660		} else if (settings.iframe) {
661			// IFrame element won't be added to the DOM until it is ready to be displayed,
662			// to avoid problems with DOM-ready JS that might be trying to run in that iframe.
663			$box.one(event_loaded, function () {
664				var iframe = $("<iframe frameborder='0' style='width:100%; height:100%; border:0; display:block'/>")[0];
665				iframe.name = +new Date();
666				iframe.src = settings.href;
667				
668				if(!settings.scrolling){
669					iframe.scrolling = "no";
670				}
671				
672				if(isIE){
673					iframe.allowtransparency="true";
674				}
675				
676				$(iframe).appendTo($loaded).one(event_purge, function () {
677					iframe.src = "//about:blank";
678				});
679			});
680			
681			prep(" ");
682		} else if (settings.html) {
683			prep(settings.html);
684		} else if (isImage(href)) {
685			img = new Image();
686			img.onload = function () {
687				var percent;
688				img.onload = null;
689				img.id = prefix + 'Photo';
690				$(img).css({border: 'none', display: 'block', cssFloat: 'left'});
691				if (settings.scalePhotos) {
692					setResize = function () {
693						img.height -= img.height * percent;
694						img.width -= img.width * percent;	
695					};
696					if (settings.mw && img.width > settings.mw) {
697						percent = (img.width - settings.mw) / img.width;
698						setResize();
699					}
700					if (settings.mh && img.height > settings.mh) {
701						percent = (img.height - settings.mh) / img.height;
702						setResize();
703					}
704				}
705				
706				if (settings.h) {
707					img.style.marginTop = Math.max(settings.h - img.height, 0) / 2 + 'px';
708				}
709				
710				if ($related[1] && (index < $related.length - 1 || settings.loop)) {
711					$(img).css({cursor: 'pointer'}).click(publicMethod.next);
712				}
713				
714				if (isIE) {
715					img.style.msInterpolationMode = 'bicubic';
716				}
717				
718				setTimeout(function () { // Chrome will sometimes report a 0 by 0 size if there isn't pause in execution
719					prep(img);
720				}, 1);
721			};
722			
723			setTimeout(function () { // Opera 10.6+ will sometimes load the src before the onload function is set
724				img.src = href;
725			}, 1);	
726		} else if (href) {
727			$loadingBay.load(href, function (data, status, xhr) {
728				prep(status === 'error' ? 'Request unsuccessful: ' + xhr.statusText : $(this).children());
729			});
730		}
731	};
732
733	// Navigates to the next page/image in a set.
734	publicMethod.next = function () {
735		if (!active) {
736			index = index < $related.length - 1 ? index + 1 : 0;
737			publicMethod.load();
738		}
739	};
740	
741	publicMethod.prev = function () {
742		if (!active) {
743			index = index ? index - 1 : $related.length - 1;
744			publicMethod.load();
745		}
746	};
747
748	// Note: to use this within an iframe use the following format: parent.$.fn.colorbox.close();
749	publicMethod.close = function () {
750		if (open && !closing) {
751			closing = true;
752			
753			open = false;
754			
755			trigger(event_cleanup, settings.onCleanup);
756			
757			$window.unbind('.' + prefix + ' .' + event_ie6);
758			
759			$overlay.fadeTo('fast', 0);
760			
761			$box.stop().fadeTo('fast', 0, function () {
762				
763				trigger(event_purge);
764				
765				$loaded.remove();
766				
767				$box.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide();
768				
769				setTimeout(function () {
770					closing = false;
771					trigger(event_closed, settings.onClosed);
772				}, 1);
773			});
774		}
775	};
776
777	// A method for fetching the current element ColorBox is referencing.
778	// returns a jQuery object.
779	publicMethod.element = function () {
780		return $(element);
781	};
782
783	publicMethod.settings = defaults;
784
785	// Initializes ColorBox when the DOM has loaded
786	$(publicMethod.init);
787
788}(jQuery, this));

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