PageSourceSearch

https://www.goo-net.com/common_v2/js/jquery.fancybox.js?171128

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