PageSourceSearch

https://uslugi-elektriki.ru/js/jquery/fancybox/jquery.fancybox-1.3.4-wrapped.js?2cmp

js uslugi-elektriki.ru collected 2026-10-04 23:53:16 UTC 28,270 bytes, 1,162 lines download raw bytes

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

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.