PageSourceSearch

https://www.hotel-freiburg.de/(cms)/module/static/default/content/…/source/jquery.fancybox.js

js hotel-freiburg.de collected 2026-10-04 03:56:41 UTC 49,121 bytes, 2,037 lines download raw bytes

vendor: 5,849 bytes, lines 1-218
1/**
2 * fancyBox - jQuery Plugin
3 * @version 2.1.5-alt (Fri, 14 Jun 2013)
4 * @license www.fancyapps.com/fancybox/#license
5 * @requires jQuery v1.6 or later
6 *
7 * Copyright 2012 Janis Skarnelis - [email protected]
8 *
9 * changes vioma: added ALT attributes on images
10 */
11
12(function (window, document, $, undefined) {
13	"use strict";
14
15	if( typeof jQuery.fn.undelegate == 'undefined' ){
16		return;
17	}
18
19	var H = $("html"),
20		W = $(window),
21		D = $(document),
22		F = $.fancybox = function () {
23			F.open.apply( this, arguments );
24		},
25		IE =  navigator.userAgent.match(/msie/i),
26		didUpdate	= null,
27		isTouch		= document.createTouch !== undefined,
28
29		isQuery	= function(obj) {
30			return obj && obj.hasOwnProperty && obj instanceof $;
31		},
32		isString = function(str) {
33			return str && $.type(str) === "string";
34		},
35		isPercentage = function(str) {
36			return isString(str) && str.indexOf('%') > 0;
37		},
38		isScrollable = function(el) {
39			return (el && !(el.style.overflow && el.style.overflow === 'hidden') && ((el.clientWidth && el.scrollWidth > el.clientWidth) || (el.clientHeight && el.scrollHeight > el.clientHeight)));
40		},
41		getScalar = function(orig, dim) {
42			var value = parseInt(orig, 10) || 0;
43
44			if (dim && isPercentage(orig)) {
45				value = F.getViewport()[ dim ] / 100 * value;
46			}
47
48			return Math.ceil(value);
49		},
50		getValue = function(value, dim) {
51			return getScalar(value, dim) + 'px';
52		};
53
54	$.extend(F, {
55		// The current version of fancyBox
56		version: '2.1.5',
57
58		defaults: {
59			padding : 15,
60			margin  : 20,
61
62			width     : 800,
63			height    : 600,
64			minWidth  : 100,
65			minHeight : 100,
66			maxWidth  : 9999,
67			maxHeight : 9999,
68			pixelRatio: 1, // Set to 2 for retina display support
69
70			autoSize   : true,
71			autoHeight : false,
72			autoWidth  : false,
73
74			autoResize  : true,
75			autoCenter  : !isTouch,
76			fitToView   : true,
77			aspectRatio : false,
78			topRatio    : 0.5,
79			leftRatio   : 0.5,
80
81			scrolling : 'auto', // 'auto', 'yes' or 'no'
82			wrapCSS   : '',
83
84			arrows     : true,
85			closeBtn   : true,
86			closeClick : false,
87			nextClick  : false,
88			mouseWheel : true,
89			autoPlay   : false,
90			playSpeed  : 3000,
91			preload    : 3,
92			modal      : false,
93			loop       : true,
94
95			ajax  : {
96				dataType : 'html',
97				headers  : { 'X-fancyBox': true }
98			},
99			iframe : {
100				scrolling : 'auto',
101				preload   : true
102			},
103			swf : {
104				wmode: 'transparent',
105				allowfullscreen   : 'true',
106				allowscriptaccess : 'always'
107			},
108
109			keys  : {
110				next : {
111					13 : 'left', // enter
112					34 : 'up',   // page down
113					39 : 'left', // right arrow
114					40 : 'up'    // down arrow
115				},
116				prev : {
117					8  : 'right',  // backspace
118					33 : 'down',   // page up
119					37 : 'right',  // left arrow
120					38 : 'down'    // up arrow
121				},
122				close  : [27], // escape key
123				play   : [32], // space - start/stop slideshow
124				toggle : [70]  // letter "f" - toggle fullscreen
125			},
126
127			direction : {
128				next : 'left',
129				prev : 'right'
130			},
131
132			scrollOutside  : true,
133
134			// Override some properties
135			index   : 0,
136			type    : null,
137			href    : null,
138			content : null,
139			title   : null,
140			alt     : '',
141
142			// HTML templates
143			tpl: {
144				wrap     : '<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',
145				image    : '<img class="fancybox-image" src="{href}" alt="{alt}" />',
146				iframe   : '<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen' + (IE ? ' allowtransparency="true"' : '') + '></iframe>',
147				error    : '<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',
148				closeBtn : '<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',
149				next     : '<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
150				prev     : '<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
151			},
152
153			// Properties for each animation type
154			// Opening fancyBox
155			openEffect  : 'fade', // 'elastic', 'fade' or 'none'
156			openSpeed   : 250,
157			openEasing  : 'swing',
158			openOpacity : true,
159			openMethod  : 'zoomIn',
160
161			// Closing fancyBox
162			closeEffect  : 'fade', // 'elastic', 'fade' or 'none'
163			closeSpeed   : 250,
164			closeEasing  : 'swing',
165			closeOpacity : true,
166			closeMethod  : 'zoomOut',
167
168			// Changing next gallery item
169			nextEffect : 'elastic', // 'elastic', 'fade' or 'none'
170			nextSpeed  : 250,
171			nextEasing : 'swing',
172			nextMethod : 'changeIn',
173
174			// Changing previous gallery item
175			prevEffect : 'elastic', // 'elastic', 'fade' or 'none'
176			prevSpeed  : 250,
177			prevEasing : 'swing',
178			prevMethod : 'changeOut',
179
180			// Enable default helpers
181			helpers : {
182				overlay : true,
183				title   : true,
184				alt     : true
185			},
186
187			// Callbacks
188			onCancel     : $.noop, // If canceling
189			beforeLoad   : $.noop, // Before loading
190			afterLoad    : $.noop, // After loading
191			beforeShow   : $.noop, // Before changing in current item
192			afterShow    : $.noop, // After opening
193			beforeChange : $.noop, // Before changing gallery item
194			beforeClose  : $.noop, // Before closing
195			afterClose   : $.noop  // After closing
196		},
197
198		//Current state
199		group    : {}, // Selected group
200		opts     : {}, // Group options
201		previous : null,  // Previous element
202		coming   : null,  // Element being loaded
203		current  : null,  // Currently loaded element
204		isActive : false, // Is activated
205		isOpen   : false, // Is currently open
206		isOpened : false, // Have been fully opened at least once
207
208		wrap  : null,
209		skin  : null,
210		outer : null,
211		inner : null,
212
213		player : {
214			timer    : null,
215			isActive : false
216		},
217
218		// Loaders
vendor: 12,282 bytes, lines 219-778
219		ajaxLoad   : null,
220		imgPreload : null,
221
222		// Some collections
223		transitions : {},
224		helpers     : {},
225
226		/*
227		 *	Static methods
228		 */
229
230		open: function (group, opts) {
231			
232			if (!group) {
233				return;
234			}
235
236			if (!$.isPlainObject(opts)) {
237				opts = {};
238			}
239
240			// Close if already active
241			if (false === F.close(true)) {
242				return;
243			}
244
245			// Normalize group
246			if (!$.isArray(group)) {
247				group = isQuery(group) ? $(group).get() : [group];
248			}
249
250			// Recheck if the type of each element is `object` and set content type (image, ajax, etc)
251			$.each(group, function(i, element) {
252
253				var obj = {},
254					href,
255					title,
256					alt,
257					content,
258					type,
259					rez,
260					hrefParts,
261					selector;
262
263				if ($.type(element) === "object") {
264					// Check if is DOM element
265
266					if (element.nodeType) {
267						element = $(element);
268					}
269
270					if (isQuery(element)) {
271
272						obj = {
273							href    : element.data('fancybox-href') || element.attr('href'),
274							title   : element.data('fancybox-title') || element.attr('title'),
275							isDom   : true,
276							element : element
277						};
278
279						obj.alt = element.data('fancybox-alt') || element.find('img').attr('alt') || obj.title;
280
281						if( obj.alt && isString(obj.alt) ){
282							obj.alt = obj.alt.replace(/"/g, '&quot;');
283						}
284						if ($.metadata) {
285							$.extend(true, obj, element.metadata());
286						}
287
288					} else {
289						obj = element;
290					}
291				}
292
293				alt   = opts.alt || obj.alt;
294				href  = opts.href  || obj.href || (isString(element) ? element : null);
295				title = opts.title !== undefined ? opts.title : obj.title || '';
296
297				content = opts.content || obj.content;
298				type    = content ? 'html' : (opts.type  || obj.type);
299
300				if (!type && obj.isDom) {
301					type = element.data('fancybox-type');
302
303					if (!type) {
304						rez  = element.prop('class').match(/fancybox\.(\w+)/);
305						type = rez ? rez[1] : null;
306					}
307				}
308
309				if (isString(href)) {
310					// Try to guess the content type
311					if (!type) {
312						if (F.isImage(href)) {
313							type = 'image';
314
315						} else if (F.isSWF(href)) {
316							type = 'swf';
317
318						} else if (href.charAt(0) === '#') {
319							type = 'inline';
320
321						} else if (isString(element)) {
322							type    = 'html';
323							content = element;
324						}
325					}
326
327					// Split url into two pieces with source url and content selector, e.g,
328					// "/mypage.html #my_id" will load "/mypage.html" and display element having id "my_id"
329					if (type === 'ajax') {
330						hrefParts = href.split(/\s+/, 2);
331						href      = hrefParts.shift();
332						selector  = hrefParts.shift();
333					}
334				}
335
336				if (!content) {
337					if (type === 'inline') {
338						if (href) {
339							content = $( isString(href) ? href.replace(/.*(?=#[^\s]+$)/, '') : href ); //strip for ie7
340
341						} else if (obj.isDom) {
342							content = element;
343						}
344
345					} else if (type === 'html') {
346						content = href;
347
348					} else if (!type && !href && obj.isDom) {
349						type    = 'inline';
350						content = element;
351					}
352				}
353
354				$.extend(obj, {
355					href     : href,
356					type     : type,
357					content  : content,
358					title    : title,
359					alt      : alt,
360					selector : selector
361				});
362
363				group[ i ] = obj;
364			});
365
366			// Extend the defaults
367			F.opts = $.extend(true, {}, F.defaults, opts);
368
369			// All options are merged recursive except keys
370			if (opts.keys !== undefined) {
371				F.opts.keys = opts.keys ? $.extend({}, F.defaults.keys, opts.keys) : false;
372			}
373
374			F.group = group;
375
376			return F._start(F.opts.index);
377		},
378
379		// Cancel image loading or abort ajax request
380		cancel: function () {
381			var coming = F.coming;
382
383			if (!coming || false === F.trigger('onCancel')) {
384				return;
385			}
386
387			F.hideLoading();
388
389			if (F.ajaxLoad) {
390				F.ajaxLoad.abort();
391			}
392
393			F.ajaxLoad = null;
394
395			if (F.imgPreload) {
396				F.imgPreload.onload = F.imgPreload.onerror = null;
397			}
398
399			if (coming.wrap) {
400				coming.wrap.stop(true, true).trigger('onReset').remove();
401			}
402
403			F.coming = null;
404
405			// If the first item has been canceled, then clear everything
406			if (!F.current) {
407				F._afterZoomOut( coming );
408			}
409		},
410
411		// Start closing animation if is open; remove immediately if opening/closing
412		close: function (event) {
413			F.cancel();
414
415			if (false === F.trigger('beforeClose')) {
416				return;
417			}
418
419			F.unbindEvents();
420
421			if (!F.isActive) {
422				return;
423			}
424
425			if (!F.isOpen || event === true) {
426				$('.fancybox-wrap').stop(true).trigger('onReset').remove();
427
428				F._afterZoomOut();
429
430			} else {
431				F.isOpen = F.isOpened = false;
432				F.isClosing = true;
433
434				$('.fancybox-item, .fancybox-nav').remove();
435
436				F.wrap.stop(true, true).removeClass('fancybox-opened');
437
438				F.transitions[ F.current.closeMethod ]();
439			}
440		},
441
442		// Manage slideshow:
443		//   $.fancybox.play(); - toggle slideshow
444		//   $.fancybox.play( true ); - start
445		//   $.fancybox.play( false ); - stop
446		play: function ( action ) {
447			var clear = function () {
448					clearTimeout(F.player.timer);
449				},
450				set = function () {
451					clear();
452
453					if (F.current && F.player.isActive) {
454						F.player.timer = setTimeout(F.next, F.current.playSpeed);
455					}
456				},
457				stop = function () {
458					clear();
459
460					D.unbind('.player');
461
462					F.player.isActive = false;
463
464					F.trigger('onPlayEnd');
465				},
466				start = function () {
467					if (F.current && (F.current.loop || F.current.index < F.group.length - 1)) {
468						F.player.isActive = true;
469
470						D.bind({
471							'onCancel.player beforeClose.player' : stop,
472							'onUpdate.player'   : set,
473							'beforeLoad.player' : clear
474						});
475
476						set();
477
478						F.trigger('onPlayStart');
479					}
480				};
481
482			if (action === true || (!F.player.isActive && action !== false)) {
483				start();
484			} else {
485				stop();
486			}
487		},
488
489		// Navigate to next gallery item
490		next: function ( direction ) {
491			var current = F.current;
492
493			if (current) {
494				if (!isString(direction)) {
495					direction = current.direction.next;
496				}
497
498				F.jumpto(current.index + 1, direction, 'next');
499			}
500		},
501
502		// Navigate to previous gallery item
503		prev: function ( direction ) {
504			var current = F.current;
505
506			if (current) {
507				if (!isString(direction)) {
508					direction = current.direction.prev;
509				}
510
511				F.jumpto(current.index - 1, direction, 'prev');
512			}
513		},
514
515		// Navigate to gallery item by index
516		jumpto: function ( index, direction, router ) {
517			var current = F.current;
518
519			if (!current) {
520				return;
521			}
522
523			index = getScalar(index);
524
525			F.direction = direction || current.direction[ (index >= current.index ? 'next' : 'prev') ];
526			F.router    = router || 'jumpto';
527
528			if (current.loop) {
529				if (index < 0) {
530					index = current.group.length + (index % current.group.length);
531				}
532
533				index = index % current.group.length;
534			}
535
536			if (current.group[ index ] !== undefined) {
537				F.cancel();
538
539				F._start(index);
540			}
541		},
542
543		// Center inside viewport and toggle position type to fixed or absolute if needed
544		reposition: function (e, onlyAbsolute) {
545			var current = F.current,
546				wrap    = current ? current.wrap : null,
547				pos;
548
549			if (wrap) {
550				pos = F._getPosition(onlyAbsolute);
551
552				if (e && e.type === 'scroll') {
553					delete pos.position;
554
555					wrap.stop(true, true).animate(pos, 200);
556
557				} else {
558					wrap.css(pos);
559
560					current.pos = $.extend({}, current.dim, pos);
561				}
562			}
563		},
564
565		update: function (e) {
566			var type = (e && e.type),
567				anyway = !type || type === 'orientationchange';
568
569			if (anyway) {
570				clearTimeout(didUpdate);
571
572				didUpdate = null;
573			}
574
575			if (!F.isOpen || didUpdate) {
576				return;
577			}
578
579			didUpdate = setTimeout(function() {
580				var current = F.current;
581
582				if (!current || F.isClosing) {
583					return;
584				}
585
586				F.wrap.removeClass('fancybox-tmp');
587
588				if (anyway || type === 'load' || (type === 'resize' && current.autoResize)) {
589					F._setDimension();
590				}
591
592				if (!(type === 'scroll' && current.canShrink)) {
593					F.reposition(e);
594				}
595
596				F.trigger('onUpdate');
597
598				didUpdate = null;
599
600			}, (anyway && !isTouch ? 0 : 300));
601		},
602
603		// Shrink content to fit inside viewport or restore if resized
604		toggle: function ( action ) {
605			if (F.isOpen) {
606				F.current.fitToView = $.type(action) === "boolean" ? action : !F.current.fitToView;
607
608				// Help browser to restore document dimensions
609				if (isTouch) {
610					F.wrap.removeAttr('style').addClass('fancybox-tmp');
611
612					F.trigger('onUpdate');
613				}
614
615				F.update();
616			}
617		},
618
619		hideLoading: function () {
620			D.unbind('.loading');
621
622			$('#fancybox-loading').remove();
623		},
624
625		showLoading: function () {
626			var el, viewport;
627
628			F.hideLoading();
629
630			el = $('<div id="fancybox-loading"><div></div></div>').click(F.cancel).appendTo('body');
631
632			// If user will press the escape-button, the request will be canceled
633			D.bind('keydown.loading', function(e) {
634				if ((e.which || e.keyCode) === 27) {
635					e.preventDefault();
636
637					F.cancel();
638				}
639			});
640
641			if (!F.defaults.fixed) {
642				viewport = F.getViewport();
643
644				el.css({
645					position : 'absolute',
646					top  : (viewport.h * 0.5) + viewport.y,
647					left : (viewport.w * 0.5) + viewport.x
648				});
649			}
650		},
651
652		getViewport: function () {
653			var locked = (F.current && F.current.locked) || false,
654				rez    = {
655					x: W.scrollLeft(),
656					y: W.scrollTop()
657				};
658
659			if (locked) {
660				rez.w = locked[0].clientWidth;
661				rez.h = locked[0].clientHeight;
662
663			} else {
664				// See http://bugs.jquery.com/ticket/6724
665				rez.w = isTouch && window.innerWidth  ? window.innerWidth  : W.width();
666				rez.h = isTouch && window.innerHeight ? window.innerHeight : W.height();
667			}
668
669			return rez;
670		},
671
672		// Unbind the keyboard / clicking actions
673		unbindEvents: function () {
674			if (F.wrap && isQuery(F.wrap)) {
675				F.wrap.unbind('.fb');
676			}
677
678			D.unbind('.fb');
679			W.unbind('.fb');
680		},
681
682		bindEvents: function () {
683			var current = F.current,
684				keys;
685
686			if (!current) {
687				return;
688			}
689
690			// Changing document height on iOS devices triggers a 'resize' event,
691			// that can change document height... repeating infinitely
692			W.bind('orientationchange.fb' + (isTouch ? '' : ' resize.fb') + (current.autoCenter && !current.locked ? ' scroll.fb' : ''), F.update);
693
694			keys = current.keys;
695
696			if (keys) {
697				D.bind('keydown.fb', function (e) {
698					var code   = e.which || e.keyCode,
699						target = e.target || e.srcElement;
700
701					// Skip esc key if loading, because showLoading will cancel preloading
702					if (code === 27 && F.coming) {
703						return false;
704					}
705
706					// Ignore key combinations and key events within form elements
707					if (!e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey && !(target && (target.type || $(target).is('[contenteditable]')))) {
708						$.each(keys, function(i, val) {
709							if (current.group.length > 1 && val[ code ] !== undefined) {
710								F[ i ]( val[ code ] );
711
712								e.preventDefault();
713								return false;
714							}
715
716							if ($.inArray(code, val) > -1) {
717								F[ i ] ();
718
719								e.preventDefault();
720								return false;
721							}
722						});
723					}
724				});
725			}
726
727			if ($.fn.mousewheel && current.mouseWheel) {
728				F.wrap.bind('mousewheel.fb', function (e, delta, deltaX, deltaY) {
729					var target = e.target || null,
730						parent = $(target),
731						canScroll = false;
732
733					while (parent.length) {
734						if (canScroll || parent.is('.fancybox-skin') || parent.is('.fancybox-wrap')) {
735							break;
736						}
737
738						canScroll = isScrollable( parent[0] );
739						parent    = $(parent).parent();
740					}
741
742					if (delta !== 0 && !canScroll) {
743						if (F.group.length > 1 && !current.canShrink) {
744							if (deltaY > 0 || deltaX > 0) {
745								F.prev( deltaY > 0 ? 'down' : 'left' );
746
747							} else if (deltaY < 0 || deltaX < 0) {
748								F.next( deltaY < 0 ? 'up' : 'right' );
749							}
750
751							e.preventDefault();
752						}
753					}
754				});
755			}
756		},
757
758		trigger: function (event, o) {
759			var ret, obj = o || F.coming || F.current;
760
761			if (!obj) {
762				return;
763			}
764
765			if ($.isFunction( obj[event] )) {
766				ret = obj[event].apply(obj, Array.prototype.slice.call(arguments, 1));
767			}
768
769			if (ret === false) {
770				return false;
771			}
772
773			if (obj.helpers) {
774				$.each(obj.helpers, function (helper, opts) {
775					if (opts && F.helpers[helper] && $.isFunction(F.helpers[helper][event])) {
776						F.helpers[helper][event]($.extend(true, {}, F.helpers[helper].defaults, opts), obj);
777					}
778				});
vendor: 7,983 bytes, lines 778-1134
778
779			}
780
781			D.trigger(event);
782		},
783
784		isImage: function (str) {
785			return isString(str) && str.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i);
786		},
787
788		isSWF: function (str) {
789			return isString(str) && str.match(/\.(swf)((\?|#).*)?$/i);
790		},
791
792		_start: function (index) {
793			var coming = {},
794				obj,
795				href,
796				type,
797				margin,
798				padding;
799
800			index = getScalar( index );
801			obj   = F.group[ index ] || null;
802
803			if (!obj) {
804				return false;
805			}
806
807			coming = $.extend(true, {}, F.opts, obj);
808
809			// Convert margin and padding properties to array - top, right, bottom, left
810			margin  = coming.margin;
811			padding = coming.padding;
812
813			if ($.type(margin) === 'number') {
814				coming.margin = [margin, margin, margin, margin];
815			}
816
817			if ($.type(padding) === 'number') {
818				coming.padding = [padding, padding, padding, padding];
819			}
820
821			// 'modal' propery is just a shortcut
822			if (coming.modal) {
823				$.extend(true, coming, {
824					closeBtn   : false,
825					closeClick : false,
826					nextClick  : false,
827					arrows     : false,
828					mouseWheel : false,
829					keys       : null,
830					helpers: {
831						overlay : {
832							closeClick : false
833						}
834					}
835				});
836			}
837
838			// 'autoSize' property is a shortcut, too
839			if (coming.autoSize) {
840				coming.autoWidth = coming.autoHeight = true;
841			}
842
843			if (coming.width === 'auto') {
844				coming.autoWidth = true;
845			}
846
847			if (coming.height === 'auto') {
848				coming.autoHeight = true;
849			}
850
851			/*
852			 * Add reference to the group, so it`s possible to access from callbacks, example:
853			 * afterLoad : function() {
854			 *     this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
855			 * }
856			 */
857
858			coming.group  = F.group;
859			coming.index  = index;
860
861			// Give a chance for callback or helpers to update coming item (type, title, etc)
862			F.coming = coming;
863
864			if (false === F.trigger('beforeLoad')) {
865				F.coming = null;
866
867				return;
868			}
869
870			type = coming.type;
871			href = coming.href;
872
873			if (!type) {
874				F.coming = null;
875
876				//If we can not determine content type then drop silently or display next/prev item if looping through gallery
877				if (F.current && F.router && F.router !== 'jumpto') {
878					F.current.index = index;
879
880					return F[ F.router ]( F.direction );
881				}
882
883				return false;
884			}
885
886			F.isActive = true;
887
888			if (type === 'image' || type === 'swf') {
889				coming.autoHeight = coming.autoWidth = false;
890				coming.scrolling  = 'visible';
891			}
892
893			if (type === 'image') {
894				coming.aspectRatio = true;
895			}
896
897			if (type === 'iframe' && isTouch) {
898				coming.scrolling = 'scroll';
899			}
900
901			// Build the neccessary markup
902			coming.wrap = $(coming.tpl.wrap).addClass('fancybox-' + (isTouch ? 'mobile' : 'desktop') + ' fancybox-type-' + type + ' fancybox-tmp ' + coming.wrapCSS).appendTo( coming.parent || 'body' );
903
904			$.extend(coming, {
905				skin  : $('.fancybox-skin',  coming.wrap),
906				outer : $('.fancybox-outer', coming.wrap),
907				inner : $('.fancybox-inner', coming.wrap)
908			});
909
910			$.each(["Top", "Right", "Bottom", "Left"], function(i, v) {
911				coming.skin.css('padding' + v, getValue(coming.padding[ i ]));
912			});
913
914			F.trigger('onReady');
915
916			// Check before try to load; 'inline' and 'html' types need content, others - href
917			if (type === 'inline' || type === 'html') {
918				if (!coming.content || !coming.content.length) {
919					return F._error( 'content' );
920				}
921
922			} else if (!href) {
923				return F._error( 'href' );
924			}
925
926			if (type === 'image') {
927				F._loadImage();
928
929			} else if (type === 'ajax') {
930				F._loadAjax();
931
932			} else if (type === 'iframe') {
933				F._loadIframe();
934
935			} else {
936				F._afterLoad();
937			}
938		},
939
940		_error: function ( type ) {
941			$.extend(F.coming, {
942				type       : 'html',
943				autoWidth  : true,
944				autoHeight : true,
945				minWidth   : 0,
946				minHeight  : 0,
947				scrolling  : 'no',
948				hasError   : type,
949				content    : F.coming.tpl.error
950			});
951
952			F._afterLoad();
953		},
954
955		_loadImage: function () {
956			// Reset preload image so it is later possible to check "complete" property
957			var img = F.imgPreload = new Image();
958
959			img.onload = function () {
960				this.onload = this.onerror = null;
961
962				F.coming.width  = this.width / F.opts.pixelRatio;
963				F.coming.height = this.height / F.opts.pixelRatio;
964
965				F._afterLoad();
966			};
967
968			img.onerror = function () {
969				this.onload = this.onerror = null;
970
971				F._error( 'image' );
972			};
973
974			img.src = F.coming.href;
975
976			if (img.complete !== true) {
977				F.showLoading();
978			}
979		},
980
981		_loadAjax: function () {
982			var coming = F.coming;
983
984			F.showLoading();
985
986			F.ajaxLoad = $.ajax($.extend({}, coming.ajax, {
987				url: coming.href,
988				error: function (jqXHR, textStatus) {
989					if (F.coming && textStatus !== 'abort') {
990						F._error( 'ajax', jqXHR );
991
992					} else {
993						F.hideLoading();
994					}
995				},
996				success: function (data, textStatus) {
997					if (textStatus === 'success') {
998						coming.content = data;
999
1000						F._afterLoad();
1001					}
1002				}
1003			}));
1004		},
1005
1006		_loadIframe: function() {
1007			var coming = F.coming,
1008				iframe = $(coming.tpl.iframe.replace(/\{rnd\}/g, new Date().getTime()))
1009					.attr('scrolling', isTouch ? 'auto' : coming.iframe.scrolling)
1010					.attr('src', coming.href);
1011
1012			// This helps IE
1013			$(coming.wrap).bind('onReset', function () {
1014				try {
1015					$(this).find('iframe').hide().attr('src', '//about:blank').end().empty();
1016				} catch (e) {}
1017			});
1018
1019			if (coming.iframe.preload) {
1020				F.showLoading();
1021
1022				iframe.one('load', function() {
1023					$(this).data('ready', 1);
1024
1025					// iOS will lose scrolling if we resize
1026					if (!isTouch) {
1027						$(this).bind('load.fb', F.update);
1028					}
1029
1030					// Without this trick:
1031					//   - iframe won't scroll on iOS devices
1032					//   - IE7 sometimes displays empty iframe
1033					$(this).parents('.fancybox-wrap').width('100%').removeClass('fancybox-tmp').show();
1034
1035					F._afterLoad();
1036				});
1037			}
1038
1039			coming.content = iframe.appendTo( coming.inner );
1040
1041			if (!coming.iframe.preload) {
1042				F._afterLoad();
1043			}
1044		},
1045
1046		_preloadImages: function() {
1047			var group   = F.group,
1048				current = F.current,
1049				len     = group.length,
1050				cnt     = current.preload ? Math.min(current.preload, len - 1) : 0,
1051				item,
1052				i;
1053
1054			for (i = 1; i <= cnt; i += 1) {
1055				item = group[ (current.index + i ) % len ];
1056
1057				if (item.type === 'image' && item.href) {
1058					new Image().src = item.href;
1059				}
1060			}
1061		},
1062
1063		_afterLoad: function () {
1064			var coming   = F.coming,
1065				previous = F.current,
1066				placeholder = 'fancybox-placeholder',
1067				current,
1068				content,
1069				type,
1070				scrolling,
1071				href,
1072				embed;
1073
1074			F.hideLoading();
1075
1076			if (!coming || F.isActive === false) {
1077				return;
1078			}
1079
1080			if (false === F.trigger('afterLoad', coming, previous)) {
1081				coming.wrap.stop(true).trigger('onReset').remove();
1082
1083				F.coming = null;
1084
1085				return;
1086			}
1087
1088			if (previous) {
1089				F.trigger('beforeChange', previous);
1090
1091				previous.wrap.stop(true).removeClass('fancybox-opened')
1092					.find('.fancybox-item, .fancybox-nav')
1093					.remove();
1094			}
1095
1096			F.unbindEvents();
1097
1098			current   = coming;
1099			content   = coming.content;
1100			type      = coming.type;
1101			scrolling = coming.scrolling;
1102
1103			$.extend(F, {
1104				wrap  : current.wrap,
1105				skin  : current.skin,
1106				outer : current.outer,
1107				inner : current.inner,
1108				current  : current,
1109				previous : previous
1110			});
1111
1112			href = current.href;
1113
1114			switch (type) {
1115				case 'inline':
1116				case 'ajax':
1117				case 'html':
1118					if (current.selector) {
1119						content = $('<div>').html(content).find(current.selector);
1120
1121					} else if (isQuery(content)) {
1122						if (!content.data(placeholder)) {
1123							content.data(placeholder, $('<div class="' + placeholder + '"></div>').insertAfter( content ).hide() );
1124						}
1125
1126						content = content.show().detach();
1127
1128						current.wrap.bind('onReset', function () {
1129							if ($(this).find(content).length) {
1130								content.hide().replaceAll( content.data(placeholder) ).data(placeholder, false);
1131							}
1132						});
1133					}
1134				
vendor: 19,841 bytes, lines 1134-1909
1134	break;
1135
1136				case 'image':
1137					content = current.tpl.image.replace('{href}', href).replace('{alt}', current.alt);
1138					break;
1139
1140				case 'swf':
1141					content = '<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="' + href + '"></param>';
1142					embed   = '';
1143
1144					$.each(current.swf, function(name, val) {
1145						content += '<param name="' + name + '" value="' + val + '"></param>';
1146						embed   += ' ' + name + '="' + val + '"';
1147					});
1148
1149					content += '<embed src="' + href + '" type="application/x-shockwave-flash" width="100%" height="100%"' + embed + '></embed></object>';
1150					break;
1151			}
1152
1153			if (!(isQuery(content) && content.parent().is(current.inner))) {
1154				current.inner.append( content );
1155			}
1156
1157			// Give a chance for helpers or callbacks to update elements
1158			F.trigger('beforeShow');
1159
1160			// Set scrolling before calculating dimensions
1161			current.inner.css('overflow', scrolling === 'yes' ? 'scroll' : (scrolling === 'no' ? 'hidden' : scrolling));
1162
1163			// Set initial dimensions and start position
1164			F._setDimension();
1165
1166			F.reposition();
1167
1168			F.isOpen = false;
1169			F.coming = null;
1170
1171			F.bindEvents();
1172
1173			if (!F.isOpened) {
1174				$('.fancybox-wrap').not( current.wrap ).stop(true).trigger('onReset').remove();
1175
1176			} else if (previous.prevMethod) {
1177				F.transitions[ previous.prevMethod ]();
1178			}
1179
1180			F.transitions[ F.isOpened ? current.nextMethod : current.openMethod ]();
1181
1182			F._preloadImages();
1183		},
1184
1185		_setDimension: function () {
1186			var viewport   = F.getViewport(),
1187				steps      = 0,
1188				canShrink  = false,
1189				canExpand  = false,
1190				wrap       = F.wrap,
1191				skin       = F.skin,
1192				inner      = F.inner,
1193				current    = F.current,
1194				width      = current.width,
1195				height     = current.height,
1196				minWidth   = current.minWidth,
1197				minHeight  = current.minHeight,
1198				maxWidth   = current.maxWidth,
1199				maxHeight  = current.maxHeight,
1200				scrolling  = current.scrolling,
1201				scrollOut  = current.scrollOutside ? current.scrollbarWidth : 0,
1202				margin     = current.margin,
1203				wMargin    = getScalar(margin[1] + margin[3]),
1204				hMargin    = getScalar(margin[0] + margin[2]),
1205				wPadding,
1206				hPadding,
1207				wSpace,
1208				hSpace,
1209				origWidth,
1210				origHeight,
1211				origMaxWidth,
1212				origMaxHeight,
1213				ratio,
1214				width_,
1215				height_,
1216				maxWidth_,
1217				maxHeight_,
1218				iframe,
1219				body;
1220
1221			// Reset dimensions so we could re-check actual size
1222			wrap.add(skin).add(inner).width('auto').height('auto').removeClass('fancybox-tmp');
1223
1224			wPadding = getScalar(skin.outerWidth(true)  - skin.width());
1225			hPadding = getScalar(skin.outerHeight(true) - skin.height());
1226
1227			// Any space between content and viewport (margin, padding, border, title)
1228			wSpace = wMargin + wPadding;
1229			hSpace = hMargin + hPadding;
1230
1231			origWidth  = isPercentage(width)  ? (viewport.w - wSpace) * getScalar(width)  / 100 : width;
1232			origHeight = isPercentage(height) ? (viewport.h - hSpace) * getScalar(height) / 100 : height;
1233
1234			if (current.type === 'iframe') {
1235				iframe = current.content;
1236
1237				if (current.autoHeight && iframe.data('ready') === 1) {
1238					try {
1239						if (iframe[0].contentWindow.document.location) {
1240							inner.width( origWidth ).height(9999);
1241
1242							body = iframe.contents().find('body');
1243
1244							if (scrollOut) {
1245								body.css('overflow-x', 'hidden');
1246							}
1247
1248							origHeight = body.outerHeight(true);
1249						}
1250
1251					} catch (e) {}
1252				}
1253
1254			} else if (current.autoWidth || current.autoHeight) {
1255				inner.addClass( 'fancybox-tmp' );
1256
1257				// Set width or height in case we need to calculate only one dimension
1258				if (!current.autoWidth) {
1259					inner.width( origWidth );
1260				}
1261
1262				if (!current.autoHeight) {
1263					inner.height( origHeight );
1264				}
1265
1266				if (current.autoWidth) {
1267					origWidth = inner.width();
1268				}
1269
1270				if (current.autoHeight) {
1271					origHeight = inner.height();
1272				}
1273
1274				inner.removeClass( 'fancybox-tmp' );
1275			}
1276
1277			width  = getScalar( origWidth );
1278			height = getScalar( origHeight );
1279
1280			ratio  = origWidth / origHeight;
1281
1282			// Calculations for the content
1283			minWidth  = getScalar(isPercentage(minWidth) ? getScalar(minWidth, 'w') - wSpace : minWidth);
1284			maxWidth  = getScalar(isPercentage(maxWidth) ? getScalar(maxWidth, 'w') - wSpace : maxWidth);
1285
1286			minHeight = getScalar(isPercentage(minHeight) ? getScalar(minHeight, 'h') - hSpace : minHeight);
1287			maxHeight = getScalar(isPercentage(maxHeight) ? getScalar(maxHeight, 'h') - hSpace : maxHeight);
1288
1289			// These will be used to determine if wrap can fit in the viewport
1290			origMaxWidth  = maxWidth;
1291			origMaxHeight = maxHeight;
1292
1293			if (current.fitToView) {
1294				maxWidth  = Math.min(viewport.w - wSpace, maxWidth);
1295				maxHeight = Math.min(viewport.h - hSpace, maxHeight);
1296			}
1297
1298			maxWidth_  = viewport.w - wMargin;
1299			maxHeight_ = viewport.h - hMargin;
1300
1301			if (current.aspectRatio) {
1302				if (width > maxWidth) {
1303					width  = maxWidth;
1304					height = getScalar(width / ratio);
1305				}
1306
1307				if (height > maxHeight) {
1308					height = maxHeight;
1309					width  = getScalar(height * ratio);
1310				}
1311
1312				if (width < minWidth) {
1313					width  = minWidth;
1314					height = getScalar(width / ratio);
1315				}
1316
1317				if (height < minHeight) {
1318					height = minHeight;
1319					width  = getScalar(height * ratio);
1320				}
1321
1322			} else {
1323				width = Math.max(minWidth, Math.min(width, maxWidth));
1324
1325				if (current.autoHeight && current.type !== 'iframe') {
1326					inner.width( width );
1327
1328					height = inner.height();
1329				}
1330
1331				height = Math.max(minHeight, Math.min(height, maxHeight));
1332			}
1333
1334			// Try to fit inside viewport (including the title)
1335			if (current.fitToView) {
1336				inner.width( width ).height( height );
1337
1338				wrap.width( width + wPadding );
1339
1340				// Real wrap dimensions
1341				width_  = wrap.width();
1342				height_ = wrap.height();
1343
1344				if (current.aspectRatio) {
1345					while ((width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight) {
1346						if (steps++ > 19) {
1347							break;
1348						}
1349
1350						height = Math.max(minHeight, Math.min(maxHeight, height - 10));
1351						width  = getScalar(height * ratio);
1352
1353						if (width < minWidth) {
1354							width  = minWidth;
1355							height = getScalar(width / ratio);
1356						}
1357
1358						if (width > maxWidth) {
1359							width  = maxWidth;
1360							height = getScalar(width / ratio);
1361						}
1362
1363						inner.width( width ).height( height );
1364
1365						wrap.width( width + wPadding );
1366
1367						width_  = wrap.width();
1368						height_ = wrap.height();
1369					}
1370
1371				} else {
1372					width  = Math.max(minWidth,  Math.min(width,  width  - (width_  - maxWidth_)));
1373					height = Math.max(minHeight, Math.min(height, height - (height_ - maxHeight_)));
1374				}
1375			}
1376
1377			if (scrollOut && scrolling === 'auto' && height < origHeight && (width + wPadding + scrollOut) < maxWidth_) {
1378				width += scrollOut;
1379			}
1380
1381			inner.width( width ).height( height );
1382
1383			wrap.width( width + wPadding );
1384
1385			width_  = wrap.width();
1386			height_ = wrap.height();
1387
1388			canShrink = (width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight;
1389			canExpand = current.aspectRatio ? (width < origMaxWidth && height < origMaxHeight && width < origWidth && height < origHeight) : ((width < origMaxWidth || height < origMaxHeight) && (width < origWidth || height < origHeight));
1390
1391			$.extend(current, {
1392				dim : {
1393					width	: getValue( width_ ),
1394					height	: getValue( height_ )
1395				},
1396				origWidth  : origWidth,
1397				origHeight : origHeight,
1398				canShrink  : canShrink,
1399				canExpand  : canExpand,
1400				wPadding   : wPadding,
1401				hPadding   : hPadding,
1402				wrapSpace  : height_ - skin.outerHeight(true),
1403				skinSpace  : skin.height() - height
1404			});
1405
1406			if (!iframe && current.autoHeight && height > minHeight && height < maxHeight && !canExpand) {
1407				inner.height('auto');
1408			}
1409		},
1410
1411		_getPosition: function (onlyAbsolute) {
1412			var current  = F.current,
1413				viewport = F.getViewport(),
1414				margin   = current.margin,
1415				width    = F.wrap.width()  + margin[1] + margin[3],
1416				height   = F.wrap.height() + margin[0] + margin[2],
1417				rez      = {
1418					position: 'absolute',
1419					top  : margin[0],
1420					left : margin[3]
1421				};
1422
1423			if (current.autoCenter && current.fixed && !onlyAbsolute && height <= viewport.h && width <= viewport.w) {
1424				rez.position = 'fixed';
1425
1426			} else if (!current.locked) {
1427				rez.top  += viewport.y;
1428				rez.left += viewport.x;
1429			}
1430
1431			rez.top  = getValue(Math.max(rez.top,  rez.top  + ((viewport.h - height) * current.topRatio)));
1432			rez.left = getValue(Math.max(rez.left, rez.left + ((viewport.w - width)  * current.leftRatio)));
1433
1434			return rez;
1435		},
1436
1437		_afterZoomIn: function () {
1438			var current = F.current;
1439
1440			if (!current) {
1441				return;
1442			}
1443
1444			F.isOpen = F.isOpened = true;
1445
1446			F.wrap.css('overflow', 'visible').addClass('fancybox-opened');
1447
1448			F.update();
1449
1450			// Assign a click event
1451			if ( current.closeClick || (current.nextClick && F.group.length > 1) ) {
1452				F.inner.css('cursor', 'pointer').bind('click.fb', function(e) {
1453					if (!$(e.target).is('a') && !$(e.target).parent().is('a')) {
1454						e.preventDefault();
1455
1456						F[ current.closeClick ? 'close' : 'next' ]();
1457					}
1458				});
1459			}
1460
1461			// Create a close button
1462			if (current.closeBtn) {
1463				$(current.tpl.closeBtn).appendTo(F.skin).bind('click.fb', function(e) {
1464					e.preventDefault();
1465
1466					F.close();
1467				});
1468			}
1469
1470			// Create navigation arrows
1471			if (current.arrows && F.group.length > 1) {
1472				if (current.loop || current.index > 0) {
1473					$(current.tpl.prev).appendTo(F.outer).bind('click.fb', F.prev);
1474				}
1475
1476				if (current.loop || current.index < F.group.length - 1) {
1477					$(current.tpl.next).appendTo(F.outer).bind('click.fb', F.next);
1478				}
1479			}
1480
1481			F.trigger('afterShow');
1482
1483			// Stop the slideshow if this is the last item
1484			if (!current.loop && current.index === current.group.length - 1) {
1485				F.play( false );
1486
1487			} else if (F.opts.autoPlay && !F.player.isActive) {
1488				F.opts.autoPlay = false;
1489
1490				F.play();
1491			}
1492		},
1493
1494		_afterZoomOut: function ( obj ) {
1495			obj = obj || F.current;
1496
1497			$('.fancybox-wrap').trigger('onReset').remove();
1498
1499			$.extend(F, {
1500				group  : {},
1501				opts   : {},
1502				router : false,
1503				current   : null,
1504				isActive  : false,
1505				isOpened  : false,
1506				isOpen    : false,
1507				isClosing : false,
1508				wrap   : null,
1509				skin   : null,
1510				outer  : null,
1511				inner  : null
1512			});
1513
1514			F.trigger('afterClose', obj);
1515		}
1516	});
1517
1518	/*
1519	 *	Default transitions
1520	 */
1521
1522	F.transitions = {
1523		getOrigPosition: function () {
1524			var current  = F.current,
1525				element  = current.element,
1526				orig     = current.orig,
1527				pos      = {},
1528				width    = 50,
1529				height   = 50,
1530				hPadding = current.hPadding,
1531				wPadding = current.wPadding,
1532				viewport = F.getViewport();
1533
1534			if (!orig && current.isDom && element.is(':visible')) {
1535				orig = element.find('img:first');
1536
1537				if (!orig.length) {
1538					orig = element;
1539				}
1540			}
1541
1542			if (isQuery(orig)) {
1543				pos = orig.offset();
1544
1545				if (orig.is('img')) {
1546					width  = orig.outerWidth();
1547					height = orig.outerHeight();
1548				}
1549
1550			} else {
1551				pos.top  = viewport.y + (viewport.h - height) * current.topRatio;
1552				pos.left = viewport.x + (viewport.w - width)  * current.leftRatio;
1553			}
1554
1555			if (F.wrap.css('position') === 'fixed' || current.locked) {
1556				pos.top  -= viewport.y;
1557				pos.left -= viewport.x;
1558			}
1559
1560			pos = {
1561				top     : getValue(pos.top  - hPadding * current.topRatio),
1562				left    : getValue(pos.left - wPadding * current.leftRatio),
1563				width   : getValue(width  + wPadding),
1564				height  : getValue(height + hPadding)
1565			};
1566
1567			return pos;
1568		},
1569
1570		step: function (now, fx) {
1571			var ratio,
1572				padding,
1573				value,
1574				prop       = fx.prop,
1575				current    = F.current,
1576				wrapSpace  = current.wrapSpace,
1577				skinSpace  = current.skinSpace;
1578
1579			if (prop === 'width' || prop === 'height') {
1580				ratio = fx.end === fx.start ? 1 : (now - fx.start) / (fx.end - fx.start);
1581
1582				if (F.isClosing) {
1583					ratio = 1 - ratio;
1584				}
1585
1586				padding = prop === 'width' ? current.wPadding : current.hPadding;
1587				value   = now - padding;
1588
1589				F.skin[ prop ](  getScalar( prop === 'width' ?  value : value - (wrapSpace * ratio) ) );
1590				F.inner[ prop ]( getScalar( prop === 'width' ?  value : value - (wrapSpace * ratio) - (skinSpace * ratio) ) );
1591			}
1592		},
1593
1594		zoomIn: function () {
1595			var current  = F.current,
1596				startPos = current.pos,
1597				effect   = current.openEffect,
1598				elastic  = effect === 'elastic',
1599				endPos   = $.extend({opacity : 1}, startPos);
1600
1601			// Remove "position" property that breaks older IE
1602			delete endPos.position;
1603
1604			if (elastic) {
1605				startPos = this.getOrigPosition();
1606
1607				if (current.openOpacity) {
1608					startPos.opacity = 0.1;
1609				}
1610
1611			} else if (effect === 'fade') {
1612				startPos.opacity = 0.1;
1613			}
1614
1615			F.wrap.css(startPos).animate(endPos, {
1616				duration : effect === 'none' ? 0 : current.openSpeed,
1617				easing   : current.openEasing,
1618				step     : elastic ? this.step : null,
1619				complete : F._afterZoomIn
1620			});
1621		},
1622
1623		zoomOut: function () {
1624			var current  = F.current,
1625				effect   = current.closeEffect,
1626				elastic  = effect === 'elastic',
1627				endPos   = {opacity : 0.1};
1628
1629			if (elastic) {
1630				endPos = this.getOrigPosition();
1631
1632				if (current.closeOpacity) {
1633					endPos.opacity = 0.1;
1634				}
1635			}
1636
1637			F.wrap.animate(endPos, {
1638				duration : effect === 'none' ? 0 : current.closeSpeed,
1639				easing   : current.closeEasing,
1640				step     : elastic ? this.step : null,
1641				complete : F._afterZoomOut
1642			});
1643		},
1644
1645		changeIn: function () {
1646			var current   = F.current,
1647				effect    = current.nextEffect,
1648				startPos  = current.pos,
1649				endPos    = { opacity : 1 },
1650				direction = F.direction,
1651				distance  = 200,
1652				field;
1653
1654			startPos.opacity = 0.1;
1655
1656			if (effect === 'elastic') {
1657				field = direction === 'down' || direction === 'up' ? 'top' : 'left';
1658
1659				if (direction === 'down' || direction === 'right') {
1660					startPos[ field ] = getValue(getScalar(startPos[ field ]) - distance);
1661					endPos[ field ]   = '+=' + distance + 'px';
1662
1663				} else {
1664					startPos[ field ] = getValue(getScalar(startPos[ field ]) + distance);
1665					endPos[ field ]   = '-=' + distance + 'px';
1666				}
1667			}
1668
1669			// Workaround for http://bugs.jquery.com/ticket/12273
1670			if (effect === 'none') {
1671				F._afterZoomIn();
1672
1673			} else {
1674				F.wrap.css(startPos).animate(endPos, {
1675					duration : current.nextSpeed,
1676					easing   : current.nextEasing,
1677					complete : F._afterZoomIn
1678				});
1679			}
1680		},
1681
1682		changeOut: function () {
1683			var previous  = F.previous,
1684				effect    = previous.prevEffect,
1685				endPos    = { opacity : 0.1 },
1686				direction = F.direction,
1687				distance  = 200;
1688
1689			if (effect === 'elastic') {
1690				endPos[ direction === 'down' || direction === 'up' ? 'top' : 'left' ] = ( direction === 'up' || direction === 'left' ? '-' : '+' ) + '=' + distance + 'px';
1691			}
1692
1693			previous.wrap.animate(endPos, {
1694				duration : effect === 'none' ? 0 : previous.prevSpeed,
1695				easing   : previous.prevEasing,
1696				complete : function () {
1697					$(this).trigger('onReset').remove();
1698				}
1699			});
1700		}
1701	};
1702
1703	/*
1704	 *	Overlay helper
1705	 */
1706
1707	F.helpers.overlay = {
1708		defaults : {
1709			closeClick : true,      // if true, fancyBox will be closed when user clicks on the overlay
1710			speedOut   : 200,       // duration of fadeOut animation
1711			showEarly  : true,      // indicates if should be opened immediately or wait until the content is ready
1712			css        : {},        // custom CSS properties
1713			locked     : !isTouch,  // if true, the content will be locked into overlay
1714			fixed      : true       // if false, the overlay CSS position property will not be set to "fixed"
1715		},
1716
1717		overlay : null,      // current handle
1718		fixed   : false,     // indicates if the overlay has position "fixed"
1719		el      : $('html'), // element that contains "the lock"
1720
1721		// Public methods
1722		create : function(opts) {
1723			opts = $.extend({}, this.defaults, opts);
1724
1725			if (this.overlay) {
1726				this.close();
1727			}
1728
1729			this.overlay = $('<div class="fancybox-overlay"></div>').appendTo( F.coming ? F.coming.parent : opts.parent );
1730			this.fixed   = false;
1731
1732			if (opts.fixed && F.defaults.fixed) {
1733				this.overlay.addClass('fancybox-overlay-fixed');
1734
1735				this.fixed = true;
1736			}
1737		},
1738
1739		open : function(opts) {
1740			var that = this;
1741
1742			opts = $.extend({}, this.defaults, opts);
1743
1744			if (this.overlay) {
1745				this.overlay.unbind('.overlay').width('auto').height('auto');
1746
1747			} else {
1748				this.create(opts);
1749			}
1750
1751			if (!this.fixed) {
1752				W.bind('resize.overlay', $.proxy( this.update, this) );
1753
1754				this.update();
1755			}
1756
1757			if (opts.closeClick) {
1758				this.overlay.bind('click.overlay', function(e) {
1759					if ($(e.target).hasClass('fancybox-overlay')) {
1760						if (F.isActive) {
1761							F.close();
1762						} else {
1763							that.close();
1764						}
1765
1766						return false;
1767					}
1768				});
1769			}
1770
1771			this.overlay.css( opts.css ).show();
1772		},
1773
1774		close : function() {
1775			var scrollV, scrollH;
1776
1777			W.unbind('resize.overlay');
1778
1779			if (this.el.hasClass('fancybox-lock')) {
1780				$('.fancybox-margin').removeClass('fancybox-margin');
1781
1782				scrollV = W.scrollTop();
1783				scrollH = W.scrollLeft();
1784
1785				this.el.removeClass('fancybox-lock');
1786
1787				W.scrollTop( scrollV ).scrollLeft( scrollH );
1788			}
1789
1790			$('.fancybox-overlay').remove().hide();
1791
1792			$.extend(this, {
1793				overlay : null,
1794				fixed   : false
1795			});
1796		},
1797
1798		// Private, callbacks
1799
1800		update : function () {
1801			var width = '100%', offsetWidth;
1802
1803			// Reset width/height so it will not mess
1804			this.overlay.width(width).height('100%');
1805
1806			// jQuery does not return reliable result for IE
1807			if (IE) {
1808				offsetWidth = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth);
1809
1810				if (D.width() > offsetWidth) {
1811					width = D.width();
1812				}
1813
1814			} else if (D.width() > W.width()) {
1815				width = D.width();
1816			}
1817
1818			this.overlay.width(width).height(D.height());
1819		},
1820
1821		// This is where we can manipulate DOM, because later it would cause iframes to reload
1822		onReady : function (opts, obj) {
1823			var overlay = this.overlay;
1824
1825			$('.fancybox-overlay').stop(true, true);
1826
1827			if (!overlay) {
1828				this.create(opts);
1829			}
1830
1831			if (opts.locked && this.fixed && obj.fixed) {
1832				if (!overlay) {
1833					this.margin = D.height() > W.height() ? $('html').css('margin-right').replace("px", "") : false;
1834				}
1835
1836				obj.locked = this.overlay.append( obj.wrap );
1837				obj.fixed  = false;
1838			}
1839
1840			if (opts.showEarly === true) {
1841				this.beforeShow.apply(this, arguments);
1842			}
1843		},
1844
1845		beforeShow : function(opts, obj) {
1846			var scrollV, scrollH;
1847
1848			if (obj.locked) {
1849				if (this.margin !== false) {
1850					$('*').filter(function(){
1851						return ($(this).css('position') === 'fixed' && !$(this).hasClass("fancybox-overlay") && !$(this).hasClass("fancybox-wrap") );
1852					}).addClass('fancybox-margin');
1853
1854					this.el.addClass('fancybox-margin');
1855				}
1856
1857				scrollV = W.scrollTop();
1858				scrollH = W.scrollLeft();
1859
1860				this.el.addClass('fancybox-lock');
1861
1862				W.scrollTop( scrollV ).scrollLeft( scrollH );
1863			}
1864
1865			this.open(opts);
1866		},
1867
1868		onUpdate : function() {
1869			if (!this.fixed) {
1870				this.update();
1871			}
1872		},
1873
1874		afterClose: function (opts) {
1875			// Remove overlay if exists and fancyBox is not opening
1876			// (e.g., it is not being open using afterClose callback)
1877			//if (this.overlay && !F.isActive) {
1878			if (this.overlay && !F.coming) {
1879				this.overlay.fadeOut(opts.speedOut, $.proxy( this.close, this ));
1880			}
1881		}
1882	};
1883
1884	/*
1885	 *	Title helper
1886	 */
1887
1888	F.helpers.title = {
1889		defaults : {
1890			type     : 'float', // 'float', 'inside', 'outside' or 'over',
1891			position : 'bottom' // 'top' or 'bottom'
1892		},
1893
1894		beforeShow: function (opts) {
1895			var current = F.current,
1896				text    = current.title,
1897				type    = opts.type,
1898				title,
1899				target;
1900
1901			if ($.isFunction(text)) {
1902				text = text.call(current.element, current);
1903			}
1904
1905			if (!isString(text) || $.trim(text) === '') {
1906				return;
1907			}
1908
1909			title = $('<div class="fancybox-title fancybox-title-' + type + '-wrap">
vendor: 3,166 bytes, lines 1909-2037
1909' + text + '</div>');
1910
1911			switch (type) {
1912				case 'inside':
1913					target = F.skin;
1914					break;
1915
1916				case 'outside':
1917					target = F.wrap;
1918					break;
1919
1920				case 'over':
1921					target = F.inner;
1922					break;
1923
1924				default: // 'float'
1925					target = F.skin;
1926
1927					title.appendTo('body');
1928
1929					if (IE) {
1930						title.width( title.width() );
1931					}
1932
1933					title.wrapInner('<span class="child"></span>');
1934
1935					//Increase bottom margin so this title will also fit into viewport
1936					F.current.margin[2] += Math.abs( getScalar(title.css('margin-bottom')) );
1937					break;
1938			}
1939
1940			title[ (opts.position === 'top' ? 'prependTo'  : 'appendTo') ](target);
1941		}
1942	};
1943
1944	// jQuery plugin initialization
1945	$.fn.fancybox = function (options) {
1946		var index,
1947			that     = $(this),
1948			selector = this.selector || '',
1949			run      = function(e) {
1950				var what = $(this).blur(), idx = index, relType, relVal;
1951
1952				if (!(e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) && !what.is('.fancybox-wrap')) {
1953					relType = options.groupAttr || 'data-fancybox-group';
1954					relVal  = what.attr(relType);
1955
1956					if (!relVal) {
1957						relType = 'rel';
1958						relVal  = what.get(0)[ relType ];
1959					}
1960
1961					if (relVal && relVal !== '' && relVal !== 'nofollow') {
1962						what = selector.length ? $(selector) : that;
1963						what = what.filter('[' + relType + '="' + relVal + '"]');
1964						idx  = what.index(this);
1965					}
1966
1967					options.index = idx;
1968
1969					// Stop an event from bubbling if everything is fine
1970					if (F.open(what, options) !== false) {
1971						e.preventDefault();
1972					}
1973				}
1974			};
1975
1976		options = options || {};
1977		index   = options.index || 0;
1978
1979		if (!selector || options.live === false) {
1980			that.unbind('click.fb-start').bind('click.fb-start', run);
1981
1982		} else {
1983			D.undelegate(selector, 'click.fb-start').delegate(selector + ":not('.fancybox-item, .fancybox-nav')", 'click.fb-start', run);
1984		}
1985
1986		this.filter('[data-fancybox-start=1]').trigger('click');
1987
1988		return this;
1989	};
1990
1991	// Tests that need a body at doc ready
1992	D.ready(function() {
1993		var w1, w2;
1994
1995		if ( $.scrollbarWidth === undefined ) {
1996			// http://benalman.com/projects/jquery-misc-plugins/#scrollbarwidth
1997			$.scrollbarWidth = function() {
1998				var parent = $('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo('body'),
1999					child  = parent.children(),
2000					width  = child.innerWidth() - child.height( 99 ).innerWidth();
2001
2002				parent.remove();
2003
2004				return width;
2005			};
2006		}
2007
2008		if ( $.support.fixedPosition === undefined ) {
2009			$.support.fixedPosition = (function() {
2010				var elem  = $('<div style="position:fixed;top:20px;"></div>').appendTo('body'),
2011					fixed = ( elem[0].offsetTop === 20 || elem[0].offsetTop === 15 );
2012
2013				elem.remove();
2014
2015				return fixed;
2016			}());
2017		}
2018
2019		$.extend(F.defaults, {
2020			scrollbarWidth : $.scrollbarWidth(),
2021			fixed  : $.support.fixedPosition,
2022			parent : $('body')
2023		});
2024
2025		//Get real width of page scroll-bar
2026		w1 = $(window).width();
2027
2028		H.addClass('fancybox-lock-test');
2029
2030		w2 = $(window).width();
2031
2032		H.removeClass('fancybox-lock-test');
2033
2034		$("<style type='text/css'>.fancybox-margin{margin-right:" + (w2 - w1) + "px;}</style>").appendTo("head");
2035	});
2036
2037}(window, document, 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.