PageSourceSearch

https://3rd-strike.com/wp-content/themes/score/lib/scripts/prettyPhoto/js/jquery.prettyPhoto.js?ver=5.8.17

js 3rd-strike.com collected 2026-10-02 05:15:57 UTC 38,802 bytes, 968 lines download raw bytes

1/* ------------------------------------------------------------------------
2	Class: prettyPhoto
3	Use: Lightbox clone for jQuery
4	Author: Stephane Caron (http://www.no-margin-for-errors.com)
5	Version: 3.1.4
6------------------------------------------------------------------------- */
7(function($) {
8	$.prettyPhoto = {version: '3.1.4'};
9	
10	$.fn.prettyPhoto = function(pp_settings) {
11		pp_settings = jQuery.extend({
12			hook: 'rel', /* the attribute tag to use for prettyPhoto hooks. default: 'rel'. For HTML5, use "data-rel" or similar. */
13			animation_speed: 'fast', /* fast/slow/normal */
14			ajaxcallback: function() {},
15			slideshow: 5000, /* false OR interval time in ms */
16			autoplay_slideshow: false, /* true/false */
17			opacity: 0.80, /* Value between 0 and 1 */
18			show_title: true, /* true/false */
19			allow_resize: true, /* Resize the photos bigger than viewport. true/false */
20			allow_expand: true, /* Allow the user to expand a resized image. true/false */
21			default_width: 500,
22			default_height: 344,
23			counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
24			theme: 'pp_default', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
25			horizontal_padding: 20, /* The padding on each side of the picture */
26			hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
27			wmode: 'opaque', /* Set the flash wmode attribute */
28			autoplay: true, /* Automatically start videos: True/False */
29			modal: false, /* If set to true, only the close button will close the window */
30			deeplinking: true, /* Allow prettyPhoto to update the url to enable deeplinking. */
31			overlay_gallery: true, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
32			overlay_gallery_max: 30, /* Maximum number of pictures in the overlay gallery */
33			keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */
34			changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
35			callback: function(){}, /* Called when prettyPhoto is closed */
36			ie6_fallback: true,
37			markup: '<div class="pp_pic_holder"> \
38						<div class="ppt">&nbsp;</div> \
39						<div class="pp_top"> \
40							<div class="pp_left"></div> \
41							<div class="pp_middle"></div> \
42							<div class="pp_right"></div> \
43						</div> \
44						<div class="pp_content_container"> \
45							<div class="pp_left"> \
46							<div class="pp_right"> \
47								<div class="pp_content"> \
48									<div class="pp_loaderIcon"></div> \
49									<div class="pp_fade"> \
50										<a href="#" class="pp_expand" title="Expand the image">Expand</a> \
51										<div class="pp_hoverContainer"> \
52											<a class="pp_next" href="#">next</a> \
53											<a class="pp_previous" href="#">previous</a> \
54										</div> \
55										<div id="pp_full_res"></div> \
56										<div class="pp_details"> \
57											<div class="pp_nav"> \
58												<a href="#" class="pp_arrow_previous">Previous</a> \
59												<p class="currentTextHolder">0/0</p> \
60												<a href="#" class="pp_arrow_next">Next</a> \
61											</div> \
62											<p class="pp_description"></p> \
63											<div class="pp_social">{pp_social}</div> \
64											<a class="pp_close" href="#">Close</a> \
65										</div> \
66									</div> \
67								</div> \
68							</div> \
69							</div> \
70						</div> \
71						<div class="pp_bottom"> \
72							<div class="pp_left"></div> \
73							<div class="pp_middle"></div> \
74							<div class="pp_right"></div> \
75						</div> \
76					</div> \
77					<div class="pp_overlay"></div>',
78			gallery_markup: '<div class="pp_gallery"> \
79								<a href="#" class="pp_arrow_previous">Previous</a> \
80								<div> \
81									<ul> \
82										{gallery} \
83									</ul> \
84								</div> \
85								<a href="#" class="pp_arrow_next">Next</a> \
86							</div>',
87			image_markup: '<img id="fullResImage" src="{path}" />',
88			flash_markup: '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',
89			quicktime_markup: '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',
90			iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',
91			inline_markup: '<div class="pp_inline">{content}</div>',
92			custom_markup: '',
93			social_tools: '<div class="twitter"><a href="http://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div class="facebook"><iframe src="//www.facebook.com/plugins/like.php?locale=en_US&href={location_href}&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div>' /* html or false to disable */
94		}, pp_settings);
95		
96		// Global variables accessible only by prettyPhoto
97		var matchedObjects = this, percentBased = false, pp_dimensions, pp_open,
98		
99		// prettyPhoto container specific
100		pp_contentHeight, pp_contentWidth, pp_containerHeight, pp_containerWidth,
101		
102		// Window size
103		windowHeight = $(window).height(), windowWidth = $(window).width(),
104
105		// Global elements
106		pp_slideshow;
107		
108		doresize = true, scroll_pos = _get_scroll();
109	
110		// Window/Keyboard events
111		$(window).unbind('resize.prettyphoto').bind('resize.prettyphoto',function(){ _center_overlay(); _resize_overlay(); });
112		
113		if(pp_settings.keyboard_shortcuts) {
114			$(document).unbind('keydown.prettyphoto').bind('keydown.prettyphoto',function(e){
115				if(typeof $pp_pic_holder != 'undefined'){
116					if($pp_pic_holder.is(':visible')){
117						switch(e.keyCode){
118							case 37:
119								$.prettyPhoto.changePage('previous');
120								e.preventDefault();
121								break;
122							case 39:
123								$.prettyPhoto.changePage('next');
124								e.preventDefault();
125								break;
126							case 27:
127								if(!settings.modal)
128								$.prettyPhoto.close();
129								e.preventDefault();
130								break;
131						};
132						// return false;
133					};
134				};
135			});
136		};
137		
138		/**
139		* Initialize prettyPhoto.
140		*/
141		$.prettyPhoto.initialize = function() {
142			
143			settings = pp_settings;
144			
145			if(settings.theme == 'pp_default') settings.horizontal_padding = 16;
146			if(settings.ie6_fallback && $.browser.msie && parseInt($.browser.version) == 6) settings.theme = "light_square"; // Fallback to a supported theme for IE6
147			
148			// Find out if the picture is part of a set
149			theRel = $(this).attr(settings.hook);
150			galleryRegExp = /\[(?:.*)\]/;
151			isSet = (galleryRegExp.exec(theRel)) ? true : false;
152			
153			// Put the SRCs, TITLEs, ALTs into an array.
154			pp_images = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return $(n).attr('href'); }) : $.makeArray($(this).attr('href'));
155			pp_titles = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).find('img').attr('alt')) ? $(n).find('img').attr('alt') : ""; }) : $.makeArray($(this).find('img').attr('alt'));
156			pp_descriptions = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).attr('title')) ? $(n).attr('title') : ""; }) : $.makeArray($(this).attr('title'));
157			
158			if(pp_images.length > settings.overlay_gallery_max) settings.overlay_gallery = false;
159			
160			set_position = jQuery.inArray($(this).attr('href'), pp_images); // Define where in the array the clicked item is positionned
161			rel_index = (isSet) ? set_position : $("a["+settings.hook+"^='"+theRel+"']").index($(this));
162			
163			_build_overlay(this); // Build the overlay {this} being the caller
164			
165			if(settings.allow_resize)
166				$(window).bind('scroll.prettyphoto',function(){ _center_overlay(); });
167			
168			
169			$.prettyPhoto.open();
170			
171			return false;
172		}
173
174
175		/**
176		* Opens the prettyPhoto modal box.
177		* @param image {String,Array} Full path to the image to be open, can also be an array containing full images paths.
178		* @param title {String,Array} The title to be displayed with the picture, can also be an array containing all the titles.
179		* @param description {String,Array} The description to be displayed with the picture, can also be an array containing all the descriptions.
180		*/
181		$.prettyPhoto.open = function(event) {
182			if(typeof settings == "undefined"){ // Means it's an API call, need to manually get the settings and set the variables
183				settings = pp_settings;
184				if($.browser.msie && $.browser.version == 6) settings.theme = "light_square"; // Fallback to a supported theme for IE6
185				pp_images = $.makeArray(arguments[0]);
186				pp_titles = (arguments[1]) ? $.makeArray(arguments[1]) : $.makeArray("");
187				pp_descriptions = (arguments[2]) ? $.makeArray(arguments[2]) : $.makeArray("");
188				isSet = (pp_images.length > 1) ? true : false;
189				set_position = (arguments[3])? arguments[3]: 0;
190				_build_overlay(event.target); // Build the overlay {this} being the caller
191			}
192
193			if($.browser.msie && $.browser.version == 6) $('select').css('visibility','hidden'); // To fix the bug with IE select boxes
194			
195			if(settings.hideflash) $('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','hidden'); // Hide the flash
196
197			_checkPosition($(pp_images).size()); // Hide the next/previous links if on first or last images.
198		
199			$('.pp_loaderIcon').show();
200		
201			if(settings.deeplinking)
202				setHashtag();
203		
204			// Rebuild Facebook Like Button with updated href
205			if(settings.social_tools){
206				facebook_like_link = settings.social_tools.replace('{location_href}', encodeURIComponent(location.href)); 
207				$pp_pic_holder.find('.pp_social').html(facebook_like_link);
208			}
209			
210			// Fade the content in
211			if($ppt.is(':hidden')) $ppt.css('opacity',0).show();
212			$pp_overlay.show().fadeTo(settings.animation_speed,settings.opacity);
213
214			// Display the current position
215			$pp_pic_holder.find('.currentTextHolder').text((set_position+1) + settings.counter_separator_label + $(pp_images).size());
216
217			// Set the description
218			if(typeof pp_descriptions[set_position] != 'undefined' && pp_descriptions[set_position] != ""){
219				$pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[set_position]));
220			}else{
221				$pp_pic_holder.find('.pp_description').hide();
222			}
223			
224			// Get the dimensions
225			movie_width = ( parseFloat(getParam('width',pp_images[set_position])) ) ? getParam('width',pp_images[set_position]) : settings.default_width.toString();
226			movie_height = ( parseFloat(getParam('height',pp_images[set_position])) ) ? getParam('height',pp_images[set_position]) : settings.default_height.toString();
227			
228			// If the size is % based, calculate according to window dimensions
229			percentBased=false;
230			if(movie_height.indexOf('%') != -1) { movie_height = parseFloat(($(window).height() * parseFloat(movie_height) / 100) - 150); percentBased = true; }
231			if(movie_width.indexOf('%') != -1) { movie_width = parseFloat(($(window).width() * parseFloat(movie_width) / 100) - 150); percentBased = true; }
232			
233			// Fade the holder
234			$pp_pic_holder.fadeIn(function(){
235				// Set the title
236				(settings.show_title && pp_titles[set_position] != "" && typeof pp_titles[set_position] != "undefined") ? $ppt.html(unescape(pp_titles[set_position])) : $ppt.html('&nbsp;');
237				
238				imgPreloader = "";
239				skipInjection = false;
240				
241				// Inject the proper content
242				switch(_getFileType(pp_images[set_position])){
243					case 'image':
244						imgPreloader = new Image();
245
246						// Preload the neighbour images
247						nextImage = new Image();
248						if(isSet && set_position < $(pp_images).size() -1) nextImage.src = pp_images[set_position + 1];
249						prevImage = new Image();
250						if(isSet && pp_images[set_position - 1]) prevImage.src = pp_images[set_position - 1];
251
252						$pp_pic_holder.find('#pp_full_res')[0].innerHTML = settings.image_markup.replace(/{path}/g,pp_images[set_position]);
253
254						imgPreloader.onload = function(){
255							// Fit item to viewport
256							pp_dimensions = _fitToViewport(imgPreloader.width,imgPreloader.height);
257
258							_showContent();
259						};
260
261						imgPreloader.onerror = function(){
262							alert('Image cannot be loaded. Make sure the path is correct and image exist.');
263							$.prettyPhoto.close();
264						};
265					
266						imgPreloader.src = pp_images[set_position];
267					break;
268				
269					case 'youtube':
270						pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
271						
272						// Regular youtube link
273						movie_id = getParam('v',pp_images[set_position]);
274						
275						// youtu.be link
276						if(movie_id == ""){
277							movie_id = pp_images[set_position].split('youtu.be/');
278							movie_id = movie_id[1];
279							if(movie_id.indexOf('?') > 0)
280								movie_id = movie_id.substr(0,movie_id.indexOf('?')); // Strip anything after the ?
281
282							if(movie_id.indexOf('&') > 0)
283								movie_id = movie_id.substr(0,movie_id.indexOf('&')); // Strip anything after the &
284						}
285
286						movie = 'http://www.youtube.com/embed/'+movie_id;
287						(getParam('rel',pp_images[set_position])) ? movie+="?rel="+getParam('rel',pp_images[set_position]) : movie+="?rel=1";
288							
289						if(settings.autoplay) movie += "&autoplay=1";
290					
291						toInject = settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);
292					break;
293				
294					case 'vimeo':
295						pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
296					
297						movie_id = pp_images[set_position];
298						var regExp = /http:\/\/(www\.)?vimeo.com\/(\d+)/;
299						var match = movie_id.match(regExp);
300						
301						movie = 'http://player.vimeo.com/video/'+ match[2] +'?title=0&amp;byline=0&amp;portrait=0';
302						if(settings.autoplay) movie += "&autoplay=1;";
303				
304						vimeo_width = pp_dimensions['width'] + '/embed/?moog_width='+ pp_dimensions['width'];
305				
306						toInject = settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,movie);
307					break;
308				
309					case 'quicktime':
310						pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
311						pp_dimensions['height']+=15; pp_dimensions['contentHeight']+=15; pp_dimensions['containerHeight']+=15; // Add space for the control bar
312				
313						toInject = settings.quicktime_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);
314					break;
315				
316					case 'flash':
317						pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
318					
319						flash_vars = pp_images[set_position];
320						flash_vars = flash_vars.substring(pp_images[set_position].indexOf('flashvars') + 10,pp_images[set_position].length);
321
322						filename = pp_images[set_position];
323						filename = filename.substring(0,filename.indexOf('?'));
324					
325						toInject =  settings.flash_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+'?'+flash_vars);
326					break;
327
328					case 'jwplayer':
329						pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
330					
331						flash_vars = pp_images[set_position];
332						flash_vars = flash_vars.substring(pp_images[set_position].indexOf('flashvars') + 0,pp_images[set_position].length);
333
334						filename = pp_images[set_position];
335						filename = filename.substring(0,filename.indexOf('?'));
336					
337						toInject = '<embed id="jwplayer" height="'+movie_height+'" width="'+movie_width+'" flashvars="'+flash_vars+'&amp;width='+movie_width+'&amp;height='+movie_height+'&amp;skin='+rootFolder+'/lib/scripts/mediaplayer/fs39/fs39.xml&amp;autostart=true&amp;stretching=fill" type="application/x-shockwave-flash" src="'+rootFolder+'/lib/scripts/mediaplayer/player.swf" allowfullscreen="true" allowscriptaccess="always" wmode="opaque"></embed>';
338					break;
339
340					case 'mp3':
341						pp_dimensions = _fitToViewport(movie_width,'46'); // Fit item to viewport
342					
343						flash_vars = pp_images[set_position];
344						flash_vars = flash_vars.substring(pp_images[set_position].indexOf('flashvars') + 0,pp_images[set_position].length);
345
346						filename = pp_images[set_position];
347						filename = filename.substring(0,filename.indexOf('?'));
348					
349						toInject = '<embed id="jwplayer" height="46" width="'+movie_width+'" flashvars="'+flash_vars+'&amp;width='+movie_width+'&amp;height='+movie_height+'&amp;skin='+rootFolder+'/lib/scripts/mediaplayer/fs39/fs39.xml&amp;autostart=true&amp;stretching=fill" type="application/x-shockwave-flash" src="'+rootFolder+'/lib/scripts/mediaplayer/player.swf" allowfullscreen="true" allowscriptaccess="always" wmode="opaque"></embed>';
350					break;
351					
352					case 'html5':
353						pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
354					
355						flash_vars = pp_images[set_position];
356						flash_vars = flash_vars.substring(pp_images[set_position].indexOf('flashvars') + 6,pp_images[set_position].length);
357
358						filename = pp_images[set_position];
359						filename = filename.substring(0,filename.indexOf('?'));
360						
361						toInject = '<video class="html5player" src="'+flash_vars+'" height="'+movie_height+'" width="'+movie_width+'" poster="" controls="controls" preload autoplay></video>';
362					break;	
363					
364					case 'iframe':
365						pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
366				
367						frame_url = pp_images[set_position];
368						frame_url = frame_url.substr(0,frame_url.indexOf('iframe')-1);
369
370						toInject = settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,frame_url);
371					break;
372					
373					case 'ajax':
374						doresize = false; // Make sure the dimensions are not resized.
375						pp_dimensions = _fitToViewport(movie_width,movie_height);
376						doresize = true; // Reset the dimensions
377					
378						skipInjection = true;
379						$.get(pp_images[set_position],function(responseHTML){
380							toInject = settings.inline_markup.replace(/{content}/g,responseHTML);
381							$pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject;
382							_showContent();
383						});
384						
385					break;
386					
387					case 'custom':
388						pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
389					
390						toInject = settings.custom_markup;
391					break;
392				
393					case 'inline':
394						// to get the item height clone it, apply default width, wrap it in the prettyPhoto containers , then delete
395						myClone = $(pp_images[set_position]).clone().append('<br clear="all" />').css({'width':settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline"></div></div>').appendTo($('body')).show();
396						doresize = false; // Make sure the dimensions are not resized.
397						pp_dimensions = _fitToViewport($(myClone).width(),$(myClone).height());
398						doresize = true; // Reset the dimensions
399						$(myClone).remove();
400						toInject = settings.inline_markup.replace(/{content}/g,$(pp_images[set_position]).html());
401					break;
402				};
403
404				if(!imgPreloader && !skipInjection){
405					$pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject;
406				
407					// Show content
408					_showContent();
409				};
410			});
411
412			return false;
413		};
414
415	
416		/**
417		* Change page in the prettyPhoto modal box
418		* @param direction {String} Direction of the paging, previous or next.
419		*/
420		$.prettyPhoto.changePage = function(direction){
421			currentGalleryPage = 0;
422			
423			if(direction == 'previous') {
424				set_position--;
425				if (set_position < 0) set_position = $(pp_images).size()-1;
426			}else if(direction == 'next'){
427				set_position++;
428				if(set_position > $(pp_images).size()-1) set_position = 0;
429			}else{
430				set_position=direction;
431			};
432			
433			rel_index = set_position;
434
435			if(!doresize) doresize = true; // Allow the resizing of the images
436			if(settings.allow_expand) {
437				$('.pp_contract').removeClass('pp_contract').addClass('pp_expand');
438			}
439
440			_hideContent(function(){ $.prettyPhoto.open(); });
441		};
442
443
444		/**
445		* Change gallery page in the prettyPhoto modal box
446		* @param direction {String} Direction of the paging, previous or next.
447		*/
448		$.prettyPhoto.changeGalleryPage = function(direction){
449			if(direction=='next'){
450				currentGalleryPage ++;
451
452				if(currentGalleryPage > totalPage) currentGalleryPage = 0;
453			}else if(direction=='previous'){
454				currentGalleryPage --;
455
456				if(currentGalleryPage < 0) currentGalleryPage = totalPage;
457			}else{
458				currentGalleryPage = direction;
459			};
460			
461			slide_speed = (direction == 'next' || direction == 'previous') ? settings.animation_speed : 0;
462
463			slide_to = currentGalleryPage * (itemsPerPage * itemWidth);
464
465			$pp_gallery.find('ul').animate({left:-slide_to},slide_speed);
466		};
467
468
469		/**
470		* Start the slideshow...
471		*/
472		$.prettyPhoto.startSlideshow = function(){
473			if(typeof pp_slideshow == 'undefined'){
474				$pp_pic_holder.find('.pp_play').unbind('click').removeClass('pp_play').addClass('pp_pause').click(function(){
475					$.prettyPhoto.stopSlideshow();
476					return false;
477				});
478				pp_slideshow = setInterval($.prettyPhoto.startSlideshow,settings.slideshow);
479			}else{
480				$.prettyPhoto.changePage('next');	
481			};
482		}
483
484
485		/**
486		* Stop the slideshow...
487		*/
488		$.prettyPhoto.stopSlideshow = function(){
489			$pp_pic_holder.find('.pp_pause').unbind('click').removeClass('pp_pause').addClass('pp_play').click(function(){
490				$.prettyPhoto.startSlideshow();
491				return false;
492			});
493			clearInterval(pp_slideshow);
494			pp_slideshow=undefined;
495		}
496
497
498		/**
499		* Closes prettyPhoto.
500		*/
501		$.prettyPhoto.close = function(){
502			if($pp_overlay.is(":animated")) return;
503			
504			$.prettyPhoto.stopSlideshow();
505			
506			$pp_pic_holder.stop().find('object,embed').css('visibility','hidden');
507			
508			$('div.pp_pic_holder,div.ppt,.pp_fade').fadeOut(settings.animation_speed,function(){ $(this).remove(); });
509			
510			$pp_overlay.fadeOut(settings.animation_speed, function(){
511				if($.browser.msie && $.browser.version == 6) $('select').css('visibility','visible'); // To fix the bug with IE select boxes
512				
513				if(settings.hideflash) $('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','visible'); // Show the flash
514				
515				$(this).remove(); // No more need for the prettyPhoto markup
516				
517				$(window).unbind('scroll.prettyphoto');
518				
519				clearHashtag();
520				
521				settings.callback();
522				
523				doresize = true;
524				
525				pp_open = false;
526				
527				delete settings;
528			});
529		};
530	
531		/**
532		* Set the proper sizes on the containers and animate the content in.
533		*/
534		function _showContent(){
535			$('.pp_loaderIcon').hide();
536
537			// Calculate the opened top position of the pic holder
538			projectedTop = scroll_pos['scrollTop'] + ((windowHeight/2) - (pp_dimensions['containerHeight']/2));
539			if(projectedTop < 0) projectedTop = 0;
540
541			$ppt.fadeTo(settings.animation_speed,1);
542
543			// Resize the content holder
544			$pp_pic_holder.find('.pp_content')
545				.animate({
546					height:pp_dimensions['contentHeight'],
547					width:pp_dimensions['contentWidth']
548				},settings.animation_speed);
549			
550			// Resize picture the holder
551			$pp_pic_holder.animate({
552				'top': projectedTop,
553				'left': ((windowWidth/2) - (pp_dimensions['containerWidth']/2) < 0) ? 0 : (windowWidth/2) - (pp_dimensions['containerWidth']/2),
554				width:pp_dimensions['containerWidth']
555			},settings.animation_speed,function(){
556				$pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(pp_dimensions['height']).width(pp_dimensions['width']);
557
558				$pp_pic_holder.find('.pp_fade').fadeIn(settings.animation_speed); // Fade the new content
559
560				// Show the nav
561				if(isSet && _getFileType(pp_images[set_position])=="image") { $pp_pic_holder.find('.pp_hoverContainer').show(); }else{ $pp_pic_holder.find('.pp_hoverContainer').hide(); }
562			
563				if(settings.allow_expand) {
564					if(pp_dimensions['resized']){ // Fade the resizing link if the image is resized
565						$('a.pp_expand,a.pp_contract').show();
566					}else{
567						$('a.pp_expand').hide();
568					}
569				}
570				
571				if(settings.autoplay_slideshow && !pp_slideshow && !pp_open) $.prettyPhoto.startSlideshow();
572				
573				settings.changepicturecallback(); // Callback!
574				
575				pp_open = true;
576			});
577			
578			_insert_gallery();
579			pp_settings.ajaxcallback();
580		};
581		
582		/**
583		* Hide the content...DUH!
584		*/
585		function _hideContent(callback){
586			// Fade out the current picture
587			$pp_pic_holder.find('#pp_full_res object,#pp_full_res embed').css('visibility','hidden');
588			$pp_pic_holder.find('.pp_fade').fadeOut(settings.animation_speed,function(){
589				$('.pp_loaderIcon').show();
590				
591				callback();
592			});
593		};
594	
595		/**
596		* Check the item position in the gallery array, hide or show the navigation links
597		* @param setCount {integer} The total number of items in the set
598		*/
599		function _checkPosition(setCount){
600			(setCount > 1) ? $('.pp_nav').show() : $('.pp_nav').hide(); // Hide the bottom nav if it's not a set.
601		};
602	
603		/**
604		* Resize the item dimensions if it's bigger than the viewport
605		* @param width {integer} Width of the item to be opened
606		* @param height {integer} Height of the item to be opened
607		* @return An array containin the "fitted" dimensions
608		*/
609		function _fitToViewport(width,height){
610			resized = false;
611
612			_getDimensions(width,height);
613			
614			// Define them in case there's no resize needed
615			imageWidth = width, imageHeight = height;
616
617			if( ((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)) && doresize && settings.allow_resize && !percentBased) {
618				resized = true, fitting = false;
619			
620				while (!fitting){
621					if((pp_containerWidth > windowWidth)){
622						imageWidth = (windowWidth - 200);
623						imageHeight = (height/width) * imageWidth;
624					}else if((pp_containerHeight > windowHeight)){
625						imageHeight = (windowHeight - 200);
626						imageWidth = (width/height) * imageHeight;
627					}else{
628						fitting = true;
629					};
630
631					pp_containerHeight = imageHeight, pp_containerWidth = imageWidth;
632				};
633			
634				_getDimensions(imageWidth,imageHeight);
635				
636				if((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)){
637					_fitToViewport(pp_containerWidth,pp_containerHeight)
638				};
639			};
640			
641			return {
642				width:Math.floor(imageWidth),
643				height:Math.floor(imageHeight),
644				containerHeight:Math.floor(pp_containerHeight),
645				containerWidth:Math.floor(pp_containerWidth) + (settings.horizontal_padding * 2),
646				contentHeight:Math.floor(pp_contentHeight),
647				contentWidth:Math.floor(pp_contentWidth),
648				resized:resized
649			};
650		};
651		
652		/**
653		* Get the containers dimensions according to the item size
654		* @param width {integer} Width of the item to be opened
655		* @param height {integer} Height of the item to be opened
656		*/
657		function _getDimensions(width,height){
658			width = parseFloat(width);
659			height = parseFloat(height);
660			
661			// Get the details height, to do so, I need to clone it since it's invisible
662			$pp_details = $pp_pic_holder.find('.pp_details');
663			$pp_details.width(width);
664			detailsHeight = parseFloat($pp_details.css('marginTop')) + parseFloat($pp_details.css('marginBottom'));
665			
666			$pp_details = $pp_details.clone().addClass(settings.theme).width(width).appendTo($('body')).css({
667				'position':'absolute',
668				'top':-10000
669			});
670			detailsHeight += $pp_details.height();
671			detailsHeight = (detailsHeight <= 34) ? 36 : detailsHeight; // Min-height for the details
672			if($.browser.msie && $.browser.version==7) detailsHeight+=8;
673			$pp_details.remove();
674			
675			// Get the titles height, to do so, I need to clone it since it's invisible
676			$pp_title = $pp_pic_holder.find('.ppt');
677			$pp_title.width(width);
678			titleHeight = parseFloat($pp_title.css('marginTop')) + parseFloat($pp_title.css('marginBottom'));
679			$pp_title = $pp_title.clone().appendTo($('body')).css({
680				'position':'absolute',
681				'top':-10000
682			});
683			titleHeight += $pp_title.height();
684			$pp_title.remove();
685			
686			// Get the container size, to resize the holder to the right dimensions
687			pp_contentHeight = height + detailsHeight;
688			pp_contentWidth = width;
689			pp_containerHeight = pp_contentHeight + titleHeight + $pp_pic_holder.find('.pp_top').height() + $pp_pic_holder.find('.pp_bottom').height();
690			pp_containerWidth = width;
691		}
692	
693		function _getFileType(itemSrc){
694			if (itemSrc.match(/youtube\.com\/watch/i) || itemSrc.match(/youtu\.be/i)) {
695				return 'jwplayer';				
696			}else if (itemSrc.match(/vimeo\.com/i)) {
697				return 'vimeo';
698			}else if(itemSrc.match(/\b.mov\b/i)){ 
699				return 'quicktime';
700			}else if(itemSrc.match(/\b.swf\b/i)){
701				return 'flash';
702			}else if(itemSrc.match(/\b.flv\b/i)){
703				return 'jwplayer';
704			}else if(itemSrc.match(/\b.mp4\b/i)){
705				return 'jwplayer';
706			}else if(itemSrc.match(/\b.mp3\b/i)){
707				return 'mp3';	
708			}else if(itemSrc.match(/\b.ogg\b/i)){
709				return 'html5';	
710			}else if(itemSrc.match(/\b.ogv\b/i)){
711				return 'html5';	
712			}else if(itemSrc.match(/\b.webm\b/i)){
713				return 'html5';
714			}else if(itemSrc.match(/\b.m4v\b/i)){
715				return 'html5';				
716			}else if(itemSrc.match(/\biframe=true\b/i)){
717				return 'iframe';
718			}else if(itemSrc.match(/\bajax=true\b/i)){
719				return 'ajax';
720			}else if(itemSrc.match(/\bcustom=true\b/i)){
721				return 'custom';
722			}else if(itemSrc.substr(0,1) == '#'){
723				return 'inline';
724			}else{
725				return 'image';
726			};
727		};
728	
729		function _center_overlay(){
730			if(doresize && typeof $pp_pic_holder != 'undefined') {
731				scroll_pos = _get_scroll();
732				contentHeight = $pp_pic_holder.height(), contentwidth = $pp_pic_holder.width();
733
734				projectedTop = (windowHeight/2) + scroll_pos['scrollTop'] - (contentHeight/2);
735				if(projectedTop < 0) projectedTop = 0;
736				
737				if(contentHeight > windowHeight)
738					return;
739
740				$pp_pic_holder.css({
741					'top': projectedTop,
742					'left': (windowWidth/2) + scroll_pos['scrollLeft'] - (contentwidth/2)
743				});
744			};
745		};
746	
747		function _get_scroll(){
748			if (self.pageYOffset) {
749				return {scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset};
750			} else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
751				return {scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft};
752			} else if (document.body) {// all other Explorers
753				return {scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft};
754			};
755		};
756	
757		function _resize_overlay() {
758			windowHeight = $(window).height(), windowWidth = $(window).width();
759			
760			if(typeof $pp_overlay != "undefined") $pp_overlay.height($(document).height()).width(windowWidth);
761		};
762	
763		function _insert_gallery(){
764			if(isSet && settings.overlay_gallery && _getFileType(pp_images[set_position])=="image" && (sett
764ings.ie6_fallback && !($.browser.msie && parseInt($.browser.version) == 6))) {
765				itemWidth = 52+5; // 52 beign the thumb width, 5 being the right margin.
766				navWidth = (settings.theme == "facebook" || settings.theme == "pp_default") ? 50 : 30; // Define the arrow width depending on the theme
767				
768				itemsPerPage = Math.floor((pp_dimensions['containerWidth'] - 100 - navWidth) / itemWidth);
769				itemsPerPage = (itemsPerPage < pp_images.length) ? itemsPerPage : pp_images.length;
770				totalPage = Math.ceil(pp_images.length / itemsPerPage) - 1;
771
772				// Hide the nav in the case there's no need for links
773				if(totalPage == 0){
774					navWidth = 0; // No nav means no width!
775					$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').hide();
776				}else{
777					$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').show();
778				};
779
780				galleryWidth = itemsPerPage * itemWidth;
781				fullGalleryWidth = pp_images.length * itemWidth;
782				
783				// Set the proper width to the gallery items
784				$pp_gallery
785					.css('margin-left',-((galleryWidth/2) + (navWidth/2)))
786					.find('div:first').width(galleryWidth+5)
787					.find('ul').width(fullGalleryWidth)
788					.find('li.selected').removeClass('selected');
789				
790				goToPage = (Math.floor(set_position/itemsPerPage) < totalPage) ? Math.floor(set_position/itemsPerPage) : totalPage;
791
792				$.prettyPhoto.changeGalleryPage(goToPage);
793				
794				$pp_gallery_li.filter(':eq('+set_position+')').addClass('selected');
795			}else{
796				$pp_pic_holder.find('.pp_content').unbind('mouseenter mouseleave');
797				// $pp_gallery.hide();
798			}
799		}
800	
801		function _build_overlay(caller){
802			// Inject Social Tool markup into General markup
803			if(settings.social_tools)
804				facebook_like_link = settings.social_tools.replace('{location_href}', encodeURIComponent(location.href)); 
805
806			settings.markup = settings.markup.replace('{pp_social}',''); 
807			
808			$('body').append(settings.markup); // Inject the markup
809			
810			$pp_pic_holder = $('.pp_pic_holder') , $ppt = $('.ppt'), $pp_overlay 
810= $('div.pp_overlay'); // Set my global selectors
811			
812			// Inject the inline gallery!
813			if(isSet && settings.overlay_gallery) {
814				currentGalleryPage = 0;
815				toInject = "";
816				for (var i=0; i < pp_images.length; i++) {
817					if(!pp_images[i].match(/\b(jpg|jpeg|png|gif)\b/gi)){
818						classname = 'default';
819						img_src = '';
820					}else{
821						classname = '';
822						img_src = pp_images[i];
823						img_src = pp_images[i].substring(pp_images[i].indexOf("image=") + 6); // MODIFIED
824					}
825					toInject += "<li class='"+classname+"'><a href='#'><img src='" + img_src + "' width='50' alt='' /></a></li>";
826				};
827				
828				toInject = settings.gallery_markup.replace(/{gallery}/g,toInject);
829				
830				$pp_pic_holder.find('#pp_full_res').after(toInject);
831				
832				$pp_gallery = $('.pp_pic_holder .pp_gallery'), $pp_gallery_li = $pp_gallery.find('li'); // Set the gallery selectors
833				
834				$pp_gallery.find('.pp_arrow_next').click(function(){
835					$.prettyPhoto.changeGalleryPage('next');
836					$.prettyPhoto.stopSlideshow();
837					return false;
838				});
839				
840				$pp_gallery.find('.pp_arrow_previous').click(function(){
841					$.prettyPhoto.changeGalleryPage('previous');
842					$.prettyPhoto.stopSlideshow();
843					return false;
844				});
845				
846				$pp_pic_holder.find('.pp_content').hover(
847					function(){
848						$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn();
849					},
850					function(){
851						$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut();
852					});
853
854				itemWidth = 52+5; // 52 beign the thumb width, 5 being the right margin.
855				$pp_gallery_li.each(function(i){
856					$(this)
857						.find('a')
858						.click(function(){
859							$.prettyPhoto.changePage(i);
860							$.prettyPhoto.stopSlideshow();
861							return false;
862						});
863				});
864			};
865			
866			
867			// Inject the play/pause if it's a slideshow
868			if(settings.slideshow){
869				$pp_pic_holder.find('.pp_nav').prepend('<a href="#" class="pp_play">Play</a>')
870				$pp_pic_holder.find('.pp_nav .pp_play').click(function(){
871					$.prettyPhoto.startSlideshow();
872					return false;
873				});
874			}
875			
876			$pp_pic_holder.attr('class','pp_pic_holder ' + settings.theme); // Set the proper theme
877			
878			$pp_overlay
879				.css({
880					'opacity':0,
881					'height':$(document).height(),
882					'width':$(window).width()
883					})
884				.bind('click',function(){
885					if(!settings.modal) $.prettyPhoto.close();
886				});
887
888			$('a.pp_close').bind('click',function(){ $.prettyPhoto.close(); return false; });
889
890
891			if(settings.allow_expand) {
892				$('a.pp_expand').bind('click',function(e){
893					// Expand the image
894					if($(this).hasClass('pp_expand')){
895						$(this).removeClass('pp_expand').addClass('pp_contract');
896						doresize = false;
897					}else{
898						$(this).removeClass('pp_contract').addClass('pp_expand');
899						doresize = true;
900					};
901				
902					_hideContent(function(){ $.prettyPhoto.open(); });
903			
904					return false;
905				});
906			}
907		
908			$pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click',function(){
909				$.prettyPhoto.changePage('previous');
910				$.prettyPhoto.stopSlideshow();
911				return false;
912			});
913		
914			$pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click',function(){
915				$.prettyPhoto.changePage('next');
916				$.prettyPhoto.stopSlideshow();
917				return false;
918			});
919			
920			_center_overlay(); // Center it
921		};
922
923		if(!pp_alreadyInitialized && getHashtag()){
924			pp_alreadyInitialized = true;
925			
926			// Grab the rel index to trigger the click on the correct element
927			hashIndex = getHashtag();
928			hashRel = hashIndex;
929			hashIndex = hashIndex.substring(hashIndex.indexOf('/')+1,hashIndex.length-1);
930			hashRel = hashRel.substring(0,hashRel.indexOf('/'));
931			hashIndex = parseInt(hashIndex);
932			hashRel = hashRel.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/])/g,'\\$1');
933
934			// Little timeout to make sure all the prettyPhoto initialize scripts has been run.
935			// Useful in the event the page contain several init scripts.
936			setTimeout(function(){ $("a["+pp_settings.hook+"^='"+hashRel+"']:eq("+hashIndex+")").trigger('click'); },50);
937		}
938		
939		return this.unbind('click.prettyphoto').bind('click.prettyphoto',$.prettyPhoto.initialize); // Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once
940	};
941	
942	function getHashtag(){
943		url = location.href;
944		hashtag = (url.indexOf('#prettyPhoto') !== -1) ? decodeURI(url.substring(url.indexOf('#prettyPhoto')+1,url.length)) : false;
945
946		return hashtag;
947	};
948	
949	function setHashtag(){
950		if(typeof theRel == 'undefined') return; // theRel is set on normal calls, it's impossible to deeplink using the API
951		location.hash = theRel + '/'+rel_index+'/';
952	};
953	
954	function clearHashtag(){
955		if ( location.href.indexOf('#prettyPhoto') !== -1 ) location.hash = "prettyPhoto";
956	}
957	
958	function getParam(name,url){
959	  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
960	  var regexS = "[\\?&]"+name+"=([^&#]*)";
961	  var regex = new RegExp( regexS );
962	  var results = regex.exec( url );
963	  return ( results == null ) ? "" : results[1];
964	}
965	
966})(jQuery);
967
968var pp_alreadyInitialized = false; // Used for the deep linking to make sure not to call the same function several times.

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.