PageSourceSearch

https://ziegenmilch.de/zm-wGlobal/wGlobal/layout/scripts/items/jquery.fancybox.js

js ziegenmilch.de collected 2026-10-03 01:47:14 UTC 29,510 bytes, 1,157 lines download raw bytes

1/*
2 * FancyBox - jQuery Plugin
3 * Simple and fancy lightbox alternative
4 *
5 * Examples and documentation at: http://fancybox.net
6 *
7 * Copyright (c) 2008 - 2010 Janis Skarnelis
8 * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
9 *
10 * Version: 1.3.4 (11/11/2010)
11 * Requires: jQuery v1.3+
12 *
13 * Dual licensed under the MIT and GPL licenses:
14 *   http://www.opensource.org/licenses/mit-license.php
15 *   http://www.gnu.org/licenses/gpl.html
16 */
17
18;(function($) {
19	var tmp, loading, overlay, wrap, outer, content, close, title, nav_left, nav_right,
20
21		selectedIndex = 0, selectedOpts = {}, selectedArray = [], currentIndex = 0, currentOpts = {}, currentArray = [],
22
23		ajaxLoader = null, imgPreloader = new Image(), imgRegExp = /\.(jpg|gif|png|bmp|jpeg)(.*)?$/i, swfRegExp = /[^\.]\.(swf)\s*$/i,
24
25		loadingTimer, loadingFrame = 1,
26
27		titleHeight = 0, titleStr = '', start_pos, final_pos, busy = false, fx = $.extend($('<div/>')[0], { prop: 0 }),
28
29		//isIE6 = $.browser.msie && $.browser.version < 7 && !window.XMLHttpRequest,
30    isIE6 = navigator.userAgent.match(/msie/i) && navigator.userAgent.match(/6/) && !window.XMLHttpRequest,
31
32		/*
33		 * Private methods 
34		 */
35
36		_abort = function() {
37			loading.hide();
38
39			imgPreloader.onerror = imgPreloader.onload = null;
40
41			if (ajaxLoader) {
42				ajaxLoader.abort();
43			}
44
45			tmp.empty();
46		},
47
48		_error = function() {
49			if (false === selectedOpts.onError(selectedArray, selectedIndex, selectedOpts)) {
50				loading.hide();
51				busy = false;
52				return;
53			}
54
55			selectedOpts.titleShow = false;
56
57			selectedOpts.width = 'auto';
58			selectedOpts.height = 'auto';
59
60			tmp.html( '<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>' );
61
62			_process_inline();
63		},
64
65		_start = function() {
66			var obj = selectedArray[ selectedIndex ],
67				href, 
68				type, 
69				title,
70				str,
71				emb,
72				ret;
73
74			_abort();
75
76			selectedOpts = $.extend({}, $.fn.fancybox.defaults, (typeof $(obj).data('fancybox') == 'undefined' ? selectedOpts : $(obj).data('fancybox')));
77
78			ret = selectedOpts.onStart(selectedArray, selectedIndex, selectedOpts);
79
80			if (ret === false) {
81				busy = false;
82				return;
83			} else if (typeof ret == 'object') {
84				selectedOpts = $.extend(selectedOpts, ret);
85			}
86
87			title = selectedOpts.title || (obj.nodeName ? $(obj).attr('title') : obj.title) || '';
88
89			if (obj.nodeName && !selectedOpts.orig) {
90				selectedOpts.orig = $(obj).children("img:first").length ? $(obj).children("img:first") : $(obj);
91			}
92
93			if (title === '' && selectedOpts.orig && selectedOpts.titleFromAlt) {
94				title = selectedOpts.orig.attr('alt');
95			}
96
97			href = selectedOpts.href || (obj.nodeName ? $(obj).attr('href') : obj.href) || null;
98
99			if ((/^(?:javascript)/i).test(href) || href == '#') {
100				href = null;
101			}
102
103			if (selectedOpts.type) {
104				type = selectedOpts.type;
105
106				if (!href) {
107					href = selectedOpts.content;
108				}
109
110			} else if (selectedOpts.content) {
111				type = 'html';
112
113			} else if (href) {
114				if (href.match(imgRegExp)) {
115					type = 'image';
116
117				} else if (href.match(swfRegExp)) {
118					type = 'swf';
119
120				} else if ($(obj).hasClass("iframe")) {
121					type = 'iframe';
122
123				} else if (href.indexOf("#") === 0) {
124					type = 'inline';
125
126				} else {
127					type = 'ajax';
128				}
129			}
130
131			if (!type) {
132				_error();
133				return;
134			}
135
136			if (type == 'inline') {
137				obj	= href.substr(href.indexOf("#"));
138				type = $(obj).length > 0 ? 'inline' : 'ajax';
139			}
140
141			selectedOpts.type = type;
142			selectedOpts.href = href;
143			selectedOpts.title = title;
144
145			if (selectedOpts.autoDimensions) {
146				if (selectedOpts.type == 'html' || selectedOpts.type == 'inline' || selectedOpts.type == 'ajax') {
147					selectedOpts.width = 'auto';
148					selectedOpts.height = 'auto';
149				} else {
150					selectedOpts.autoDimensions = false;	
151				}
152			}
153
154			if (selectedOpts.modal) {
155				selectedOpts.overlayShow = true;
156				selectedOpts.hideOnOverlayClick = false;
157				selectedOpts.hideOnContentClick = false;
158				selectedOpts.enableEscapeButton = false;
159				selectedOpts.showCloseButton = false;
160			}
161
162			selectedOpts.padding = parseInt(selectedOpts.padding, 10);
163			selectedOpts.margin = parseInt(selectedOpts.margin, 10);
164
165			tmp.css('padding', (selectedOpts.padding + selectedOpts.margin));
166
167			$('.fancybox-inline-tmp').unbind('fancybox-cancel').bind('fancybox-change', function() {
168				$(this).replaceWith(content.children());				
169			});
170
171			switch (type) {
172				case 'html' :
173					tmp.html( selectedOpts.content );
174					_process_inline();
175				break;
176
177				case 'inline' :
178					if ( $(obj).parent().is('#fancybox-content') === true) {
179						busy = false;
180						return;
181					}
182
183					$('<div class="fancybox-inline-tmp" />')
184						.hide()
185						.insertBefore( $(obj) )
186						.bind('fancybox-cleanup', function() {
187							$(this).replaceWith(content.children());
188						}).bind('fancybox-cancel', function() {
189							$(this).replaceWith(tmp.children());
190						});
191
192					$(obj).appendTo(tmp);
193
194					_process_inline();
195				break;
196
197				case 'image':
198					busy = false;
199
200					$.fancybox.showActivity();
201
202					imgPreloader = new Image();
203
204					imgPreloader.onerror = function() {
205						_error();
206					};
207
208					imgPreloader.onload = function() {
209						busy = true;
210
211						imgPreloader.onerror = imgPreloader.onload = null;
212
213						_process_image();
214					};
215
216					imgPreloader.src = href;
217				break;
218
219				case 'swf':
220					selectedOpts.scrolling = 'no';
221
222					str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"><param name="movie" value="' + href + '"></param>';
223					emb = '';
224
225					$.each(selectedOpts.swf, function(name, val) {
226						str += '<param name="' + name + '" value="' + val + '"></param>';
227						emb += ' ' + name + '="' + val + '"';
228					});
229
230					str += '<embed src="' + href + '" type="application/x-shockwave-flash" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"' + emb + '></embed></object>';
231
232					tmp.html(str);
233
234					_process_inline();
235				break;
236
237				case 'ajax':
238					busy = false;
239
240					$.fancybox.showActivity();
241
242					selectedOpts.ajax.win = selectedOpts.ajax.success;
243
244					ajaxLoader = $.ajax($.extend({}, selectedOpts.ajax, {
245						url	: href,
246						data : selectedOpts.ajax.data || {},
247						error : function(XMLHttpRequest, textStatus, errorThrown) {
248							if ( XMLHttpRequest.status > 0 ) {
249								_error();
250							}
251						},
252						success : function(data, textStatus, XMLHttpRequest) {
253							var o = typeof XMLHttpRequest == 'object' ? XMLHttpRequest : ajaxLoader;
254							if (o.status == 200) {
255								if ( typeof selectedOpts.ajax.win == 'function' ) {
256									ret = selectedOpts.ajax.win(href, data, textStatus, XMLHttpRequest);
257
258									if (ret === false) {
259										loading.hide();
260										return;
261									} else if (typeof ret == 'string' || typeof ret == 'object') {
262										data = ret;
263									}
264								}
265
266								tmp.html( data );
267								_process_inline();
268							}
269						}
270					}));
271
272				break;
273
274				case 'iframe':
275					_show();
276				break;
277			}
278		},
279
280		_process_inline = function() {
281			var
282				w = selectedOpts.width,
283				h = selectedOpts.height;
284
285			if (w.toString().indexOf('%') > -1) {
286				w = parseInt( ($(window).width() - (selectedOpts.margin * 2)) * parseFloat(w) / 100, 10) + 'px';
287
288			} else {
289				w = w == 'auto' ? 'auto' : w + 'px';	
290			}
291
292			if (h.toString().indexOf('%') > -1) {
293				h = parseInt( ($(window).height() - (selectedOpts.margin * 2)) * parseFloat(h) / 100, 10) + 'px';
294
295			} else {
296				h = h == 'auto' ? 'auto' : h + 'px';	
297			}
298
299			tmp.wrapInner('<div style="width:' + w + ';height:' + h + ';overflow: ' + (selectedOpts.scrolling == 'auto' ? 'auto' : (selectedOpts.scrolling == 'yes' ? 'scroll' : 'hidden')) + ';position:relative;"></div>');
300
301			selectedOpts.width = tmp.width();
302			selectedOpts.height = tmp.height();
303
304			_show();
305		},
306
307		_process_image = function() {
308			selectedOpts.width = imgPreloader.width;
309			selectedOpts.height = imgPreloader.height;
310
311			$("<img />").attr({
312				'id' : 'fancybox-img',
313				'src' : imgPreloader.src,
314				'alt' : selectedOpts.title
315			}).appendTo( tmp );
316
317			_show();
318		},
319
320		_show = function() {
321			var pos, equal;
322
323			loading.hide();
324
325			if (wrap.is(":visible") && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) {
326				$.event.trigger('fancybox-cancel');
327
328				busy = false;
329				return;
330			}
331
332			busy = true;
333
334			$(content.add( overlay )).unbind();
335
336			$(window).unbind("resize.fb scroll.fb");
337			$(document).unbind('keydown.fb');
338
339			if (wrap.is(":visible") && currentOpts.titlePosition !== 'outside') {
340				wrap.css('height', wrap.height());
341			}
342
343			currentArray = selectedArray;
344			currentIndex = selectedIndex;
345			currentOpts = selectedOpts;
346
347			if (currentOpts.overlayShow) {
348				overlay.css({
349					'background-color' : currentOpts.overlayColor,
350					'opacity' : currentOpts.overlayOpacity,
351					'cursor' : currentOpts.hideOnOverlayClick ? 'pointer' : 'auto',
352					'height' : $(document).height()
353				});
354
355				if (!overlay.is(':visible')) {
356					if (isIE6) {
357						$('select:not(#fancybox-tmp select)').filter(function() {
358							return this.style.visibility !== 'hidden';
359						}).css({'visibility' : 'hidden'}).one('fancybox-cleanup', function() {
360							this.style.visibility = 'inherit';
361						});
362					}
363
364					overlay.show();
365				}
366			} else {
367				overlay.hide();
368			}
369
370			final_pos = _get_zoom_to();
371
372			_process_title();
373
374			if (wrap.is(":visible")) {
375				$( close.add( nav_left ).add( nav_right ) ).hide();
376
377				pos = wrap.position(),
378
379				start_pos = {
380					top	 : pos.top,
381					left : pos.left,
382					width : wrap.width(),
383					height : wrap.height()
384				};
385
386				equal = (start_pos.width == final_pos.width && start_pos.height == final_pos.height);
387
388				content.fadeTo(currentOpts.changeFade, 0.3, function() {
389					var finish_resizing = function() {
390						content.html( tmp.contents() ).fadeTo(currentOpts.changeFade, 1, _finish);
391					};
392
393					$.event.trigger('fancybox-change');
394
395					content
396						.empty()
397						.removeAttr('filter')
398						.css({
399							'border-width' : currentOpts.padding,
400							'width'	: final_pos.width - currentOpts.padding * 2,
401							'height' : selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2
402						});
403
404					if (equal) {
405						finish_resizing();
406
407					} else {
408						fx.prop = 0;
409
410						$(fx).animate({prop: 1}, {
411							 duration : currentOpts.changeSpeed,
412							 easing : currentOpts.easingChange,
413							 step : _draw,
414							 complete : finish_resizing
415						});
416					}
417				});
418
419				return;
420			}
421
422			wrap.removeAttr("style");
423
424			content.css('border-width', currentOpts.padding);
425
426			if (currentOpts.transitionIn == 'elastic') {
427				start_pos = _get_zoom_from();
428
429				content.html( tmp.contents() );
430
431				wrap.show();
432
433				if (currentOpts.opacity) {
434					final_pos.opacity = 0;
435				}
436
437				fx.prop = 0;
438
439				$(fx).animate({prop: 1}, {
440					 duration : currentOpts.speedIn,
441					 easing : currentOpts.easingIn,
442					 step : _draw,
443					 complete : _finish
444				});
445
446				return;
447			}
448
449			if (currentOpts.titlePosition == 'inside' && titleHeight > 0) {	
450				title.show();	
451			}
452
453			content
454				.css({
455					'width' : final_pos.width - currentOpts.padding * 2,
456					'height' : selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2
457				})
458				.html( tmp.contents() );
459
460			wrap
461				.css(final_pos)
462				.fadeIn( currentOpts.transitionIn == 'none' ? 0 : currentOpts.speedIn, _finish );
463		},
464
465		_format_title = function(title) {
466			if (title && title.length) {
467				if (currentOpts.titlePosition == 'float') {
468					return '<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">' + title + '</td><td id="fancybox-title-float-right"></td></tr></table>';
469				}
470
471				return '<div id="fancybox-title-' + currentOpts.titlePosition + '">' + title + '</div>';
472			}
473
474			return false;
475		},
476
477		_process_title = function() {
478			titleStr = currentOpts.title || '';
479			titleHeight = 0;
480
481			title
482				.empty()
483				.removeAttr('style')
484				.removeClass();
485
486			if (currentOpts.titleShow === false) {
487				title.hide();
488				return;
489			}
490
491			titleStr = $.isFunction(currentOpts.titleFormat) ? currentOpts.titleFormat(titleStr, currentArray, currentIndex, currentOpts) : _format_title(titleStr);
492
493			if (!titleStr || titleStr === '') {
494				title.hide();
495				return;
496			}
497
498			title
499				.addClass('fancybox-title-' + currentOpts.titlePosition)
500				.html( titleStr )
501				.appendTo( 'body' )
502				.show();
503
504			switch (currentOpts.titlePosition) {
505				case 'inside':
506					title
507						.css({
508							'width' : final_pos.width - (currentOpts.padding * 2),
509							'marginLeft' : currentOpts.padding,
510							'marginRight' : currentOpts.padding
511						});
512
513					titleHeight = title.outerHeight(true);
514
515					title.appendTo( outer );
516
517					final_pos.height += titleHeight;
518				break;
519
520				case 'over':
521					title
522						.css({
523							'marginLeft' : currentOpts.padding,
524							'width'	: final_pos.width - (currentOpts.padding * 2),
525							'bottom' : currentOpts.padding
526						})
527						.appendTo( outer );
528				break;
529
530				case 'float':
531					title
532						.css('left', parseInt((title.width() - final_pos.width - 40)/ 2, 10) * -1)
533						.appendTo( wrap );
534				break;
535
536				default:
537					title
538						.css({
539							'width' : final_pos.width - (currentOpts.padding * 2),
540							'paddingLeft' : currentOpts.padding,
541							'paddingRight' : currentOpts.padding
542						})
543						.appendTo( wrap );
544				break;
545			}
546
547			title.hide();
548		},
549
550		_set_navigation = function() {
551			if (currentOpts.enableEscapeButton || currentOpts.enableKeyboardNav) {
552				$(document).bind('keydown.fb', function(e) {
553					if (e.keyCode == 27 && currentOpts.enableEscapeButton) {
554						e.preventDefault();
555						$.fancybox.close();
556
557					} else if ((e.keyCode == 37 || e.keyCode == 39) && currentOpts.enableKeyboardNav && e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA' && e.target.tagName !== 'SELECT') {
558						e.preventDefault();
559						$.fancybox[ e.keyCode == 37 ? 'prev' : 'next']();
560					}
561				});
562			}
563
564			if (!currentOpts.showNavArrows) { 
565				nav_left.hide();
566				nav_right.hide();
567				return;
568			}
569
570			if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex !== 0) {
571				nav_left.show();
572			}
573
574			if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex != (currentArray.length -1)) {
575				nav_right.show();
576			}
577		},
578
579		_finish = function () {
580			if (!$.support.opacity) {
581				content.get(0).style.removeAttribute('filter');
582				wrap.get(0).style.removeAttribute('filter');
583			}
584
585			if (selectedOpts.autoDimensions) {
586				content.css('height', 'auto');
587			}
588
589			wrap.css('height', 'auto');
590
591			if (titleStr && titleStr.length) {
592				title.show();
593			}
594
595			if (currentOpts.showCloseButton) {
596				close.show();
597			}
598
599			_set_navigation();
600	
601			if (currentOpts.hideOnContentClick)	{
602				content.bind('click', $.fancybox.close);
603			}
604
605			if (currentOpts.hideOnOverlayClick)	{
606				overlay.bind('click', $.fancybox.close);
607			}
608
609			$(window).bind("resize.fb", $.fancybox.resize);
610
611			if (currentOpts.centerOnScroll) {
612				$(window).bind("scroll.fb", $.fancybox.center);
613			}
614
615			if (currentOpts.type == 'iframe') {
616				$('<iframe id="fancybox-frame" name="fancybox-frame' + new Date().getTime() + '" frameborder="0" hspace="0" ' + (isIE6 ? 'allowtransparency="true""' : '') + ' scrolling="' + selectedOpts.scrolling + '" src="' + currentOpts.href + '"></iframe>').appendTo(content);
617			}
618
619			wrap.show();
620
621			busy = false;
622
623			$.fancybox.center();
624
625			currentOpts.onComplete(currentArray, currentIndex, currentOpts);
626
627			_preload_images();
628		},
629
630		_preload_images = function() {
631			var href, 
632				objNext;
633
634			if ((currentArray.length -1) > currentIndex) {
635				href = currentArray[ currentIndex + 1 ].href;
636
637				if (typeof href !== 'undefined' && href.match(imgRegExp)) {
638					objNext = new Image();
639					objNext.src = href;
640				}
641			}
642
643			if (currentIndex > 0) {
644				href = currentArray[ currentIndex - 1 ].href;
645
646				if (typeof href !== 'undefined' && href.match(imgRegExp)) {
647					objNext = new Image();
648					objNext.src = href;
649				}
650			}
651		},
652
653		_draw = function(pos) {
654			var dim = {
655				width : parseInt(start_pos.width + (final_pos.width - start_pos.width) * pos, 10),
656				height : parseInt(start_pos.height + (final_pos.height - start_pos.height) * pos, 10),
657
658				top : parseInt(start_pos.top + (final_pos.top - start_pos.top) * pos, 10),
659				left : parseInt(start_pos.left + (final_pos.left - start_pos.left) * pos, 10)
660			};
661
662			if (typeof final_pos.opacity !== 'undefined') {
663				dim.opacity = pos < 0.5 ? 0.5 : pos;
664			}
665
666			wrap.css(dim);
667
668			content.css({
669				'width' : dim.width - currentOpts.padding * 2,
670				'height' : dim.height - (titleHeight * pos) - currentOpts.padding * 2
671			});
672		},
673
674		_get_viewport = function() {
675			return [
676				$(window).width() - (currentOpts.margin * 2),
677				$(window).height() - (currentOpts.margin * 2),
678				$(document).scrollLeft() + currentOpts.margin,
679				$(document).scrollTop() + currentOpts.margin
680			];
681		},
682
683		_get_zoom_to = function () {
684			var view = _get_viewport(),
685				to = {},
686				resize = currentOpts.autoScale,
687				double_padding = currentOpts.padding * 2,
688				ratio;
689
690			if (currentOpts.width.toString().indexOf('%') > -1) {
691				to.width = parseInt((view[0] * parseFloat(currentOpts.width)) / 100, 10);
692			} else {
693				to.width = parseInt(currentOpts.width + double_padding);
694			}
695
696			if (currentOpts.height.toString().indexOf('%') > -1) {
697				to.height = parseInt((view[1] * parseFloat(currentOpts.height)) / 100, 10);
698			} else {
699				to.height = currentOpts.height + double_padding;
700			}
701
702			if (resize && (to.width > view[0] || to.height > view[1])) {
703				if (selectedOpts.type == 'image' || selectedOpts.type == 'swf') {
704					ratio = (currentOpts.width ) / (currentOpts.height );
705
706					if ((to.width ) > view[0]) {
707						to.width = view[0];
708						to.height = parseInt(((to.width - double_padding) / ratio) + double_padding, 10);
709					}
710
711					if ((to.height) > view[1]) {
712						to.height = view[1];
713						to.width = parseInt(((to.height - double_padding) * ratio) + double_padding, 10);
714					}
715
716				} else {
717					to.width = Math.min(to.width, view[0]);
718					to.height = Math.min(to.height, view[1]);
719				}
720			}
721
722			to.top = parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - to.height - 40) * 0.5)), 10);
723			to.left = parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - to.width - 40) * 0.5)), 10);
724
725			return to;
726		},
727
728		_get_obj_pos = function(obj) {
729			var pos = obj.offset();
730
731			pos.top += parseInt( obj.css('paddingTop'), 10 ) || 0;
732			pos.left += parseInt( obj.css('paddingLeft'), 10 ) || 0;
733
734			pos.top += parseInt( obj.css('border-top-width'), 10 ) || 0;
735			pos.left += parseInt( obj.css('border-left-width'), 10 ) || 0;
736
737			pos.width = obj.width();
738			pos.height = obj.height();
739
740			return pos;
741		},
742
743		_get_zoom_from = function() {
744			var orig = selectedOpts.orig ? $(selectedOpts.orig) : false,
745				from = {},
746				pos,
747				view;
748
749			if (orig && orig.length) {
750				pos = _get_obj_pos(orig);
751
752				from = {
753					width : pos.width + (currentOpts.padding * 2),
754					height : pos.height + (currentOpts.padding * 2),
755					top	: pos.top - currentOpts.padding - 20,
756					left : pos.left - currentOpts.padding - 20
757				};
758
759			} else {
760				view = _get_viewport();
761
762				from = {
763					width : currentOpts.padding * 2,
764					height : currentOpts.padding * 2,
765					top	: parseInt(view[3] + view[1] * 0.5, 10),
766					left : parseInt(view[2] + view[0] * 0.5, 10)
767				};
768			}
769
770			return from;
771		},
772
773		_animate_loading = function() {
774			if (!loading.is(':visible')){
775				clearInterval(loadingTimer);
776				return;
777			}
778
779			$('div', loading).css('top', (loadingFrame * -40) + 'px');
780
781			loadingFrame = (loadingFrame + 1) % 12;
782		};
783
784	/*
785	 * Public methods 
786	 */
787
788	$.fn.fancybox = function(options) {
789		if (!$(this).length) {
790			return this;
791		}
792
793		$(this)
794			.data('fancybox', $.extend({}, options, ($.metadata ? $(this).metadata() : {})))
795			.unbind('click.fb')
796			.bind('click.fb', function(e) {
797				e.preventDefault();
798
799				if (busy) {
800					return;
801				}
802
803				busy = true;
804
805				$(this).blur();
806
807				selectedArray = [];
808				selectedIndex = 0;
809
810				var rel = $(this).attr('rel') || '';
811
812				if (!rel || rel == '' || rel === 'nofollow') {
813					selectedArray.push(this);
814
815				} else {
816					selectedArray = $("a[rel=" + rel + "], area[rel=" + rel + "]");
817					selectedIndex = selectedArray.index( this );
818				}
819
820				_start();
821
822				return;
823			});
824
825		return this;
826	};
827
828	$.fancybox = function(obj) {
829		var opts;
830
831		if (busy) {
832			return;
833		}
834
835		busy = true;
836		opts = typeof arguments[1] !== 'undefined' ? arguments[1] : {};
837
838		selectedArray = [];
839		selectedIndex = parseInt(opts.index, 10) || 0;
840
841		if ($.isArray(obj)) {
842			for (var i = 0, j = obj.length; i < j; i++) {
843				if (typeof obj[i] == 'object') {
844					$(obj[i]).data('fancybox', $.extend({}, opts, obj[i]));
845				} else {
846					obj[i] = $({}).data('fancybox', $.extend({content : obj[i]}, opts));
847				}
848			}
849
850			selectedArray = jQuery.merge(selectedArray, obj);
851
852		} else {
853			if (typeof obj == 'object') {
854				$(obj).data('fancybox', $.extend({}, opts, obj));
855			} else {
856				obj = $({}).data('fancybox', $.extend({content : obj}, opts));
857			}
858
859			selectedArray.push(obj);
860		}
861
862		if (selectedIndex > selectedArray.length || selectedIndex < 0) {
863			selectedIndex = 0;
864		}
865
866		_start();
867	};
868
869	$.fancybox.showActivity = function() {
870		clearInterval(loadingTimer);
871
872		loading.show();
873		loadingTimer = setInterval(_animate_loading, 66);
874	};
875
876	$.fancybox.hideActivity = function() {
877		loading.hide();
878	};
879
880	$.fancybox.next = function() {
881		return $.fancybox.pos( currentIndex + 1);
882	};
883
884	$.fancybox.prev = function() {
885		return $.fancybox.pos( currentIndex - 1);
886	};
887
888	$.fancybox.pos = function(pos) {
889		if (busy) {
890			return;
891		}
892
893		pos = parseInt(pos);
894
895		selectedArray = currentArray;
896
897		if (pos > -1 && pos < currentArray.length) {
898			selectedIndex = pos;
899			_start();
900
901		} else if (currentOpts.cyclic && currentArray.length > 1) {
902			selectedIndex = pos >= currentArray.length ? 0 : currentArray.length - 1;
903			_start();
904		}
905
906		return;
907	};
908
909	$.fancybox.cancel = function() {
910		if (busy) {
911			return;
912		}
913
914		busy = true;
915
916		$.event.trigger('fancybox-cancel');
917
918		_abort();
919
920		selectedOpts.onCancel(selectedArray, selectedIndex, selectedOpts);
921
922		busy = false;
923	};
924
925	// Note: within an iframe use - parent.$.fancybox.close();
926	$.fancybox.close = function() {
927		if (busy || wrap.is(':hidden')) {
928			return;
929		}
930
931		busy = true;
932
933		if (currentOpts && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) {
934			busy = false;
935			return;
936		}
937
938		_abort();
939
940		$(close.add( nav_left ).add( nav_right )).hide();
941
942		$(content.add( overlay )).unbind();
943
944		$(window).unbind("resize.fb scroll.fb");
945		$(document).unbind('keydown.fb');
946
947		content.find('iframe').attr('src', isIE6 && /^https/i.test(window.location.href || '') ? 'javascript:void(false)' : 'about:blank');
948
949		if (currentOpts.titlePosition !== 'inside') {
950			title.empty();
951		}
952
953		wrap.stop();
954
955		function _cleanup() {
956			overlay.fadeOut('fast');
957
958			title.empty().hide();
959			wrap.hide();
960
961			$.event.trigger('fancybox-cleanup');
962
963			content.empty();
964
965			currentOpts.onClosed(currentArray, currentIndex, currentOpts);
966
967			currentArray = selectedOpts	= [];
968			currentIndex = selectedIndex = 0;
969			currentOpts = selectedOpts	= {};
970
971			busy = false;
972		}
973
974		if (currentOpts.transitionOut == 'elastic') {
975			start_pos = _get_zoom_from();
976
977			var pos = wrap.position();
978
979			final_pos = {
980				top	 : pos.top ,
981				left : pos.left,
982				width :	wrap.width(),
983				height : wrap.height()
984			};
985
986			if (currentOpts.opacity) {
987				final_pos.opacity = 1;
988			}
989
990			title.empty().hide();
991
992			fx.prop = 1;
993
994			$(fx).animate({ prop: 0 }, {
995				 duration : currentOpts.speedOut,
996				 easing : currentOpts.easingOut,
997				 step : _draw,
998				 complete : _cleanup
999			});
1000
1001		} else {
1002			wrap.fadeOut( currentOpts.transitionOut == 'none' ? 0 : currentOpts.speedOut, _cleanup);
1003		}
1004	};
1005
1006	$.fancybox.resize = function() {
1007		if (overlay.is(':visible')) {
1008			overlay.css('height', $(document).height());
1009		}
1010
1011		$.fancybox.center(true);
1012	};
1013
1014	$.fancybox.center = function() {
1015		var view, align;
1016
1017		if (busy) {
1018			return;	
1019		}
1020
1021		align = arguments[0] === true ? 1 : 0;
1022		view = _get_viewport();
1023
1024		if (!align && (wrap.width() > view[0] || wrap.height() > view[1])) {
1025			return;	
1026		}
1027
1028		wrap
1029			.stop()
1030			.animate({
1031				'top' : parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - content.height() - 40) * 0.5) - currentOpts.padding)),
1032				'left' : parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - content.width() - 40) * 0.5) - currentOpts.padding))
1033			}, typeof arguments[0] == 'number' ? arguments[0] : 200);
1034	};
1035
1036	$.fancybox.init = function() {
1037		if ($("#fancybox-wrap").length) {
1038			return;
1039		}
1040
1041		$('body').append(
1042			tmp	= $('<div id="fancybox-tmp"></div>'),
1043			loading	= $('<div id="fancybox-loading"><div></div></div>'),
1044			overlay	= $('<div id="fancybox-overlay"></div>'),
1045			wrap = $('<div id="fancybox-wrap"></div>')
1046		);
1047
1048		outer = $('<div id="fancybox-outer"></div>')
1049			.append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>')
1050			.appendTo( wrap );
1051
1052		outer.append(
1053			content = $('<div id="fancybox-content"></div>'),
1054			close = $('<a id="fancybox-close"></a>'),
1055			title = $('<div id="fancybox-title"></div>'),
1056
1057			nav_left = $('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),
1058			nav_right = $('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>')
1059		);
1060
1061		close.click($.fancybox.close);
1062		loading.click($.fancybox.cancel);
1063
1064		nav_left.click(function(e) {
1065			e.preventDefault();
1066			$.fancybox.prev();
1067		});
1068
1069		nav_right.click(function(e) {
1070			e.preventDefault();
1071			$.fancybox.next();
1072		});
1073
1074		if ($.fn.mousewheel) {
1075			wrap.bind('mousewheel.fb', function(e, delta) {
1076				if (busy) {
1077					e.preventDefault();
1078
1079				} else if ($(e.target).get(0).clientHeight == 0 || $(e.target).get(0).scrollHeight === $(e.target).get(0).clientHeight) {
1080					e.preventDefault();
1081					$.fancybox[ delta > 0 ? 'prev' : 'next']();
1082				}
1083			});
1084		}
1085
1086		if (!$.support.opacity) {
1087			wrap.addClass('fancybox-ie');
1088		}
1089
1090		if (isIE6) {
1091			loading.addClass('fancybox-ie6');
1092			wrap.addClass('fancybox-ie6');
1093
1094			$('<iframe id="fancybox-hide-sel-frame" src="' + (/^https/i.test(window.location.href || '') ? 'javascript:void(false)' : 'about:blank' ) + '" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(outer);
1095		}
1096	};
1097
1098	$.fn.fancybox.defaults = {
1099		padding : 10,
1100		margin : 40,
1101		opacity : false,
1102		modal : false,
1103		cyclic : false,
1104		scrolling : 'auto',	// 'auto', 'yes' or 'no'
1105
1106		width : 560,
1107		height : 340,
1108
1109		autoScale : true,
1110		autoDimensions : true,
1111		centerOnScroll : false,
1112
1113		ajax : {},
1114		swf : { wmode: 'transparent' },
1115
1116		hideOnOverlayClick : true,
1117		hideOnContentClick : false,
1118
1119		overlayShow : true,
1120		overlayOpacity : 0.7,
1121		overlayColor : '#777',
1122
1123		titleShow : true,
1124		titlePosition : 'float', // 'float', 'outside', 'inside' or 'over'
1125		titleFormat : null,
1126		titleFromAlt : false,
1127
1128		transitionIn : 'fade', // 'elastic', 'fade' or 'none'
1129		transitionOut : 'fade', // 'elastic', 'fade' or 'none'
1130
1131		speedIn : 300,
1132		speedOut : 300,
1133
1134		changeSpeed : 300,
1135		changeFade : 'fast',
1136
1137		easingIn : 'swing',
1138		easingOut : 'swing',
1139
1140		showCloseButton	 : true,
1141		showNavArrows : true,
1142		enableEscapeButton : true,
1143		enableKeyboardNav : true,
1144
1145		onStart : function(){},
1146		onCancel : function(){},
1147		onComplete : function(){},
1148		onCleanup : function(){},
1149		onClosed : function(){},
1150		onError : function(){}
1151	};
1152
1153	$(document).ready(function() {
1154		$.fancybox.init();
1155	});
1156
1157})(jQuery);

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.