PageSourceSearch

https://24akbspb.ru/wp-content/plugins/easy-fancybox/js/jquery.fancybox.js?ver=1.3.24

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