PageSourceSearch

https://www.wamwamfm.com/wp-content/plugins/wpb-super-gallery/public/inc/js/jquery.prettyPhoto.js

js wamwamfm.com collected 2026-09-30 12:41:50 UTC 47,487 bytes, 1,133 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.6
6------------------------------------------------------------------------- */
7(function($) {
8	$.prettyPhoto = {version: '3.1.6'};
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 wpbg"> \
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" aria-hidden="true">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" style=""> \
57											<div class="pp_nav"> \
58												<a href="#" class="pp_arrow_previous" aria-hidden="true">Previous</a> \
59												<p class="currentTextHolder">0/0</p> \
60												<a href="#" class="pp_arrow_next" aria-hidden="true">Next</a> \
61												<div class="pp_downloadLinkDiv"><a href="javascript:void(0)" class="pp_downloadLink" aria-hidden="true" target="_top">Download Image</a></div>\
62											</div> \
63											<p class="pp_description"></p> \
64											<div class="pp_divider">&nbsp;</div> \
65											<div class="pp_social">{pp_social}</div> \
66											<div class="pp_buy_btn">{pp_buy_btn}</div> \
67											<div id="ratings">{ratings}</div> \
68											<a class="pp_close" href="#">Close</a> \
69										</div> \
70									</div> \
71								</div> \
72							</div> \
73							</div> \
74						</div> \
75						<div class="pp_bottom"> \
76							<div class="pp_left"></div> \
77							<div class="pp_middle"></div> \
78							<div class="pp_right"></div> \
79						</div> \
80					</div> \
81					<div class="pp_overlay"></div>',
82			gallery_markup: '<div class="pp_gallery" aria-hidden="true"> \
83								<a href="#" class="pp_arrow_previous">Previous</a> \
84								<div> \
85									<ul> \
86										{gallery} \
87									</ul> \
88								</div> \
89								<a href="#" class="pp_arrow_next">Next</a> \
90							</div>',
91			image_markup: '<img id="fullResImage" src="{path}" />',
92			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>',
93			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>',
94			iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no" allowfullscreen="allowfullscreen" mozallowfullscreen="mozallowfullscreen" msallowfullscreen="msallowfullscreen" oallowfullscreen="oallowfullscreen" webkitallowfullscreen="webkitallowfullscreen"></iframe>',
95			inline_markup: '<div class="pp_inline">{content}</div>',
96			custom_markup: '',
97			ratings: '',
98			//social_tools: '<div class="twitter"><a href="http://twitter.com/share?text={twtext}&url={tpath}" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="//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 */
99			//social_tools: '<div class="twitter"><a href="http://twitter.com/share?text={twtext}&url={tpath}" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script></div><div class="facebook"><iframe src="https://www.facebook.com/plugins/share_button.php?href={location_href}&layout=button&size=small&mobile_iframe=true&width=59&height=20&appId" width="59" height="20" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true"></iframe></div><div class="pinterest"><a href="http://pinterest.com/pin/create/button/?url={pinpath}&media={pinpath}&description={pintext}"   target="_blank"><img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png" /></a></div>' /* with pinterest */
100			social_tools: '<div class="twitter" aria-hidden="true"><a aria-hidden="true" href="//twitter.com/share?text={twtext}&url={tpath}" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script></div><div class="facebook" aria-hidden="true"><iframe aria-hidden="true" src="https://www.facebook.com/plugins/share_button.php?href={location_href}&layout=button&size=small&mobile_iframe=true&width=59&height=20&appId" width="59" height="20" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true"></iframe></div>' /* html or false to disable */
101		}, pp_settings);
102		
103		// Global variables accessible only by prettyPhoto
104		var matchedObjects = this, percentBased = false, pp_dimensions, pp_open,
105		
106		// prettyPhoto container specific
107		pp_contentHeight, pp_contentWidth, pp_containerHeight, pp_containerWidth,
108		
109		// Window size
110		windowHeight = $(window).height(), windowWidth = $(window).width(),
111
112		// Global elements
113		pp_slideshow;
114		
115		doresize = true, scroll_pos = _get_scroll();
116	
117		// Window/Keyboard events
118		$(window).unbind('resize.prettyphoto').bind('resize.prettyphoto',function(){ _center_overlay(); _resize_overlay(); });
119		
120		if(pp_settings.keyboard_shortcuts) {
121			$(document).unbind('keydown.prettyphoto').bind('keydown.prettyphoto',function(e){
122				if(typeof $pp_pic_holder != 'undefined'){
123					if($pp_pic_holder.is(':visible')){
124						switch(e.keyCode){
125							case 37:
126								$.prettyPhoto.changePage('previous');
127								e.preventDefault();
128								break;
129							case 39:
130								$.prettyPhoto.changePage('next');
131								e.preventDefault();
132								break;
133							case 27:
134								if(!settings.modal)
135								$.prettyPhoto.close();
136								e.preventDefault();
137								break;
138						};
139						// return false;
140					};
141				};
142			});
143		};
144		
145		/**
146		* Initialize prettyPhoto.
147		*/
148		$.prettyPhoto.initialize = function() {
149			
150			settings = pp_settings;
151			
152			if(settings.theme == 'pp_default') settings.horizontal_padding = 16;
153			
154			// Find out if the picture is part of a set
155			theRel = $(this).attr(settings.hook);
156			galleryRegExp = /\[(?:.*)\]/;
157			isSet = (galleryRegExp.exec(theRel)) ? true : false;
158			
159			// Put the SRCs, TITLEs, ALTs into an array.
160			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'));
161			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'));
162			pp_descriptions = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).attr('data-caption')) ? $(n).attr('data-caption') : ""; }) : $.makeArray($(this).attr('data-caption'));
163			//console.log("pp_descriptions"); //console.log(pp_images) //console.log(pp_titles) //console.log(pp_descriptions)
164			if(pp_images.length > settings.overlay_gallery_max) settings.overlay_gallery = false;
165			
166			set_position = jQuery.inArray($(this).attr('href'), pp_images); // Define where in the array the clicked item is positionned
167			rel_index = (isSet) ? set_position : $("a["+settings.hook+"^='"+theRel+"']").index($(this));
168			pp_dataUID = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).attr('data-uid')) ? $(n).attr('data-uid') : ""; }) : $.makeArray($(this).attr('data-uid'));
169			pp_datavideoID = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).attr('data-vid')) ? $(n).attr('data-vid') : ""; }) : $.makeArray($(this).attr('data-vid'));
170			_build_overlay(this); // Build the overlay {this} being the caller
171			
172			if(settings.allow_resize)
173				$(window).bind('scroll.prettyphoto',function(){ _center_overlay(); });
174			
175			$.prettyPhoto.open();
176			tracking();
177			
178			return false;
179		}
180
181
182		/**
183		* Opens the prettyPhoto modal box.
184		* @param image {String,Array} Full path to the image to be open, can also be an array containing full images paths.
185		* @param title {String,Array} The title to be displayed with the picture, can also be an array containing all the titles.
186		* @param description {String,Array} The description to be displayed with the picture, can also be an array containing all the descriptions.
187		*/
188		$.prettyPhoto.open = function(event) {
189			if(typeof settings == "undefined"){ // Means it's an API call, need to manually get the settings and set the variables
190				settings = pp_settings;
191				pp_images = $.makeArray(arguments[0]);
192				pp_titles = (arguments[1]) ? $.makeArray(arguments[1]) : $.makeArray("");
193				pp_descriptions = (arguments[2]) ? $.makeArray(arguments[2]) : $.makeArray("");
194				isSet = (pp_images.length > 1) ? true : false;
195				set_position = (arguments[3])? arguments[3]: 0;
196				pp_dataUID = (arguments[4])? arguments[4]: 0;
197				pp_datavideoID = (arguments[5])? arguments[5]: 0;
198				_build_overlay(event.target); // Build the overlay {this} being the caller
199			}
200
201			console.log('prettyPhoto.open');
202				
203			if(settings.hideflash) $('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','hidden'); // Hide the flash
204
205			_checkPosition($(pp_images).length); // Hide the next/previous links if on first or last images.
206		
207			$('.pp_loaderIcon').show();
208		
209			if(settings.deeplinking)
210				setHashtag();
211		
212			// Rebuild socail Like Button with updated href
213			var galleryTitle = '';
214			if(settings.social_tools){
215		
216				var galleryTitle = $('#page_name_gallery').val();
217				/*twtext1 = settings.social_tools.replace('{twtext}', pp_titles[set_position]); 
218				twtext1 = twtext1.replace('{tpath}', encodeURIComponent(pp_images[set_position])); 
219				twtext1 = twtext1.replace('{pintext}', pp_titles[set_position]); 
220				twtext1 = twtext1.replace('{pinpath}', encodeURIComponent(pp_images[set_position])); 
221				facebook_like_link = twtext1.replace('{location_href}', encodeURIComponent(pp_images[set_position])); 
222				$pp_pic_holder.find('.pp_social').html(facebook_like_link);*/
223				var url_image = document.location.protocol +"//"+ document.location.hostname + document.location.pathname+"?galid="+pp_dataUID[set_position]+"&videoid="+pp_datavideoID[set_position]+location.hash;
224				twtext1 = settings.social_tools.replace('{twtext}', galleryTitle); 
225				twtext1 = twtext1.replace('{tpath}', encodeURIComponent(url_image)); 
226				twtext1 = twtext1.replace('{pintext}', galleryTitle); 
227				twtext1 = twtext1.replace('{pinpath}', encodeURIComponent(url_image)); 
228				facebook_like_link = twtext1.replace('{location_href}', encodeURIComponent(url_image)); 
229				$pp_pic_holder.find('.pp_social').html(facebook_like_link);
230				$('meta[property="og:image"]').attr('content', pp_images[set_position]);
231			}
232
233			//WPB-3897 -- wpb-mycapture
234			var buyBtn = jQuery('#buy_button_to_super_gallery').clone();
235			var oldUrl = buyBtn.find('a').attr("href"); // Get current url : upto .../mycapture/remoteimage.asp?image=
236			var actualImgUrl = pp_images[set_position];
237			//console.log(actualImgUrl);
238			var tempArr = actualImgUrl.split('?');
239			actualImgUrl = tempArr[0];
240            var newUrl = oldUrl; //+actualImgUrl; //WPB-4560 removed ?image=
241			buyBtn.find('a').attr("href", newUrl);
242			$pp_pic_holder.find('.pp_buy_btn').html(buyBtn.show());
243
244			//console.log($pp_pic_holder.find('.pp_buy_btn').html());
245			//<div style="display: block;" class="gallery-item-buy-button" id="buy_button_to_super_gallery"><a href="http://ozarkssportszone.mycapture.com/mycapture/remoteimage.asp?image=https://dehayf5mhw1h7.cloudfront.net/image.jpg" target="blank"><img src="http://dehayf5mhw1h7.cloudfront.net/wp-content/uploads/sites/658/2016/09/13175946/buy-now-btn-blue.png"></a></div>
246			
247			// Fade the content in
248			if($ppt.is(':hidden')) $ppt.css('opacity',0).show();
249			$pp_overlay.show().fadeTo(settings.animation_speed,settings.opacity);
250
251			// Display the current position
252			$pp_pic_holder.find('.currentTextHolder').text((set_position+1) + settings.counter_separator_label + $(pp_images).length);
253
254			// Set the description
255			if(typeof pp_descriptions[set_position] != 'undefined' && pp_descriptions[set_position] != ""){
256				$pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[set_position]));
257			}else{
258				$pp_pic_holder.find('.pp_description').hide();
259			}
260			
261			// Get the dimensions
262			movie_width = ( parseFloat(getParam('width',pp_images[set_position])) ) ? getParam('width',pp_images[set_position]) : settings.default_width.toString();
263			movie_height = ( parseFloat(getParam('height',pp_images[set_position])) ) ? getParam('height',pp_images[set_position]) : settings.default_height.toString();
264			
265			// If the size is % based, calculate according to window dimensions
266			percentBased=false;
267			if(movie_height.indexOf('%') != -1) { movie_height = parseFloat(($(window).height() * parseFloat(movie_height) / 100) - 150); percentBased = true; }
268			if(movie_width.indexOf('%') != -1) { movie_width = parseFloat(($(window).width() * parseFloat(movie_width) / 100) - 150); percentBased = true; }
269			
270			// Fade the holder
271			$pp_pic_holder.fadeIn(function(){
272				// Set the title
273				(settings.show_title && pp_titles[set_position] != "" && typeof pp_titles[set_position] != "undefined") ? $ppt.html(unescape(pp_titles[set_position])) : $ppt.html('&nbsp;');
274				
275				imgPreloader = "";
276				skipInjection = false;
277				
278				// Inject the proper content
279				switch(_getFileType(pp_images[set_position])){
280					case 'image':
281						imgPreloader = new Image();
282
283						// Preload the neighbour images
284						nextImage = new Image();
285						if(isSet && set_position < $(pp_images).length -1) nextImage.src = pp_images[set_position + 1];
286						prevImage = new Image();
287						if(isSet && pp_images[set_position - 1]) prevImage.src = pp_images[set_position - 1];
288						var qvars = [], hash;
289							var hashes = pp_images[set_position].slice(pp_images[set_position].indexOf('?') + 1).split('&');
290							for(var i = 0; i < hashes.length; i++)
291							{
292								 hash = hashes[i].split('=');
293								 var objv = {};
294								 objv[hash[0]] = hash[1];
295								if(!objv.hasOwnProperty('fit')){
296									qvars.push(objv);
297								}
298								
299							}
300						if(settings.social_tools){
301							var galleryTitle = $('#page_name_gallery').val();
302							/*twtext1 = settings.social_tools.replace('{twtext}', pp_titles[set_position]); 
303							twtext1 = twtext1.replace('{tpath}', pp_images[set_position]); 
304							twtext1 = twtext1.replace('{pintext}', pp_titles[set_position]); 
305							twtext1 = twtext1.replace('{pinpath}', encodeURIComponent(pp_images[set_position]));
306							facebook_like_link = twtext1.replace('{location_href}', pp_images[set_position]); 
307							$pp_pic_holder.find('.pp_social').html(facebook_like_link);*/
308							
309							twtext1 = settings.social_tools.replace('{twtext}', galleryTitle); 
310							var url_image = document.location.protocol +"//"+ document.location.hostname + document.location.pathname+"?galid="+qvars[1]['image_id']+location.hash;
311							//(url_image)
312							twtext1 = twtext1.replace('{tpath}', encodeURIComponent(url_image)); 
313							twtext1 = twtext1.replace('{pintext}', galleryTitle); 
314							twtext1 = twtext1.replace('{pinpath}', encodeURIComponent(url_image)); 
315							facebook_like_link = twtext1.replace('{location_href}', encodeURIComponent(url_image)); 
316							$pp_pic_holder.find('.pp_social').html(facebook_like_link);
317							$('meta[property="og:image"]').attr('content', pp_images[set_position]);
318						}
319						$pp_pic_holder.find('#pp_full_res')[0].innerHTML = settings.image_markup.replace(/{path}/g,pp_images[set_position]);
320							//alert(JSON.stringify(qvars));
321							if(qvars[0]['voting_enabled']){
322							   $pp_pic_holder.find('#ratings').html("<span class='text-center voting-control-pop'></span>");
323								$("#voting-"+qvars[1]['image_id']).clone().appendTo( "#ratings" );
324							}
325							else{
326								 $pp_pic_holder.find('#ratings').hide();
327							}
328
329							//$pp_pic_holder.find('#ratings').html("<span class='text-center voting-control voting-control-pop' id='mnk'>"+$("#voting-"+qvars[3]['image_id']).html()+"</span>");
330						imgPreloader.onload = function(){
331							// Fit item to viewport
332							pp_dimensions = _fitToViewport(imgPreloader.width,imgPreloader.height);
333
334							_showContent();
335						};
336
337						imgPreloader.onerror = function(){
338							alert('Image cannot be loaded. Make sure the path is correct and image exist.');
339							$.prettyPhoto.close();
340						};
341					
342						imgPreloader.src = pp_images[set_position];
343
344						//WPB-4390
345                        var imgSrc = pp_images[set_position];
346						var img = imgSrc.split('?')[0]
347		                var download_url = "/wp-content/plugins/wpb-super-gallery/download_file.php?path="+img;
348					    $pp_pic_holder.find('.pp_downloadLink').attr('href', download_url);
349
350					break;
351				
352					case 'youtube':
353						$('.pp_details .pp_nav .pp_play').hide();
354						pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
355						
356						// Regular youtube link
357						movie_id = getParam('v',pp_images[set_position]);
358						
359						// youtu.be link
360						if(movie_id == ""){
361							movie_id = pp_images[set_position].split('youtu.be/');
362							movie_id = movie_id[1];
363							if(movie_id.indexOf('?') > 0)
364								movie_id = movie_id.substr(0,movie_id.indexOf('?')); // Strip anything after the ?
365
366							if(movie_id.indexOf('&') > 0)
367								movie_id = movie_id.substr(0,movie_id.indexOf('&')); // Strip anything after the &
368						}
369
370						movie = 'https://www.youtube.com/embed/'+movie_id;
371						(getParam('rel',pp_images[set_position])) ? movie+="?rel="+getParam('rel',pp_images[set_position]) : movie+="?rel=1";
372							var qvars = [], hash;
373							var hashes = pp_images[set_position].slice(pp_images[set_position].indexOf('?') + 1).split('&');
374							for(var i = 0; i < hashes.length; i++) {
375								 hash = hashes[i].split('=');
376								 var objv = {};
377								 objv[hash[0]] = hash[1];
378								 qvars.push(objv);
379							}
380							if(qvars[1]['voting_enabled']){
381							   $pp_pic_holder.find('#ratings').html("<span class='text-center voting-control-pop'></span>");
382								$("#voting-"+qvars[2]['image_id']).clone().appendTo( "#ratings" );
383							}
384							else{
385								 $pp_pic_holder.find('#ratings').html("");
386							}
387
388						if(settings.autoplay) movie += "&autoplay=1";
389					
390						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);
391					break;
392				
393					case 'vimeo':
394						pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
395					
396						movie_id = pp_images[set_position];
397						var regExp = /http(s?):\/\/(www\.)?vimeo.com\/(\d+)/;
398						var match = movie_id.match(regExp);
399						
400						movie = 'http://player.vimeo.com/video/'+ match[3] +'?title=0&amp;byline=0&amp;portrait=0';
401						if(settings.autoplay) movie += "&autoplay=1;";
402				
403						vimeo_width = pp_dimensions['width'] + '/embed/?moog_width='+ pp_dimensions['width'];
404				
405						toInject = settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,movie);
406					break;
407				
408					case 'quicktime':
409						pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
410						pp_dimensions['height']+=15; pp_dimensions['contentHeight']+=15; pp_dimensions['containerHeight']+=15; // Add space for the control bar
411				
412						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);
413					break;
414				
415					case 'flash':
416						pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
417					
418						flash_vars = pp_images[set_position];
419						flash_vars = flash_vars.substring(pp_images[set_position].indexOf('flashvars') + 10,pp_images[set_position].length);
420
421						filename = pp_images[set_position];
422						filename = filename.substring(0,filename.indexOf('?'));
423					
424						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);
425					break;
426				
427					case 'iframe':
428						pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
429				
430						frame_url = pp_images[set_position];
431						frame_url = frame_url.substr(0,frame_url.indexOf('iframe')-1);
432
433						toInject = settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,frame_url);
434					break;
435					
436					case 'ajax':
437						doresize = false; // Make sure the dimensions are not resized.
438						pp_dimensions = _fitToViewport(movie_width,movie_height);
439						doresize = true; // Reset the dimensions
440					
441						skipInjection = true;
442						$.get(pp_images[set_position],function(responseHTML){
443							toInject = settings.inline_markup.replace(/{content}/g,responseHTML);
444							$pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject;
445							_showContent();
446						});
447					break;
448					
449					case 'custom':
450						pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
451					
452						toInject = settings.custom_markup;
453					break;
454				
455					case 'inline':
456						// to get the item height clone it, apply default width, wrap it in the prettyPhoto containers , then delete
457						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();
458						doresize = false; // Make sure the dimensions are not resized.
459						pp_dimensions = _fitToViewport($(myClone).width(),$(myClone).height());
460						doresize = true; // Reset the dimensions
461						$(myClone).remove();
462						toInject = settings.inline_markup.replace(/{content}/g,$(pp_images[set_position]).html());
463					break;
464				};
465
466				if(!imgPreloader && !skipInjection){
467					$pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject;
468				
469					// Show content
470					_showContent();
471				};
472			});
473
474			//---------------------------------
475			//WPB-4016
476			//http://zark-rd1.onecmsdev.com/2020/10/31/pictures-class-2-district-6-xc-meet/
477		try {
478			if (ga && ga != 'undefined') {
479
480				var galleryTitle = ''; var imageURL = ''; var imageTitle = '';
481
482				//console.log('prettyPhoto.open, up to reach at end >> ga found !');
483				//alert(ga);
484				galleryTitle = $('#page_name_gallery').val();
485				imageURL = pp_images[set_position]; //https://dehayf5mhw1h7.cloudfront.net/wp-content/uploads/sites/658/2020/10/31225717/IMG_3219.jpg?voting_enabled=&image_id=805246
486				imageTitle = pp_titles[set_position];
487
488				console.log('ga found ! >> Gallery/Image : Here >> ' + galleryTitle + ' >> ' + imageTitle + ' >> ' + imageURL);
489
490				//===============================
491				
492				//https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets
493				/*ga('send', 'pageview', {
494				  'galleryName':  galleryTitle,
495				  'imageName':  imageTitle
496				});*/
497
498				//ga('send', 'pageview', galleryTitle + ' ^@^ ' + imageTitle);
499
500				var campaignSource_Val = 'WPB Super Gallery';
501
502				if (site_GlobalArr && site_GlobalArr != 'undefined') {
503					if (site_GlobalArr['blogId'] &&  site_GlobalArr['siteURL']) {
504						campaignSource_Val = site_GlobalArr['siteURL'] + ':' + site_GlobalArr['blogId'];
505					}
506				}
507
508				//https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#trafficsources
509				ga('send', 'pageview', galleryTitle + ' ^@^ ' + imageTitle, {'campaignSource': campaignSource_Val, 'campaignMedium': 'prettyPhoto_open', 'campaignName': 'WPB'} );
510
511				//it will take current url.
512				//ga('send', 'pageview', {'campaignSource': 'foo', 'campaignMedium': 'yourmedium', 'campaignName': 'test'});
513
514				//===============================
515
516				//ga('send', 'event', 'Video', 'play', 'cats.mp4');
517				//ga('send', 'event', 'category', 'action', { 'metric19': 24.99 });
518				/*ga('send', 'event', 'WPB Super Gallery', 'prettyPhoto_open', {
519				  'galleryName': galleryTitle,
520				  'imageName':  imageTitle
521				});*/
522
523				//ga('send', 'event', 'Event Category', 'Event Action', 'Event Label');
524				ga('send', 'event', 'WPB Super Gallery', 'prettyPhoto_open', galleryTitle + ' ^@^ ' + imageTitle);
525
526				//ga('send', 'event', { eventCategory: 'WPB Super Gallery', eventAction: 'prettyPhoto_open', eventLabel: 'gallery_info', eventValue: galleryTitle + ' ^@^ ' + imageTitle});
527
528				//===============================
529
530				console.log('ga send pageview/event done !');
531			}
532			else {
533				console.log('prettyPhoto.open >> ga not found !');
534			}
535		}catch(ee) {
536			console.log('prettyPhoto.open >> catch >> ga not found !');
537		}
538			//---------------------------------
539
540			return false;
541		};
542
543	
544		/**
545		* Change page in the prettyPhoto modal box
546		* @param direction {String} Direction of the paging, previous or next.
547		*/
548		$.prettyPhoto.changePage = function(direction){
549			currentGalleryPage = 0;
550			
551			if(direction == 'previous') {
552				set_position--;
553				if (set_position < 0) set_position = $(pp_images).length-1;
554			}else if(direction == 'next'){
555				set_position++;
556				if(set_position > $(pp_images).length-1) set_position = 0;
557			}else{
558				set_position=direction;
559			};
560
561			console.log('prettyPhoto.changePage');
562			
563			rel_index = set_position;
564
565			if(!doresize) doresize = true; // Allow the resizing of the images
566			if(settings.allow_expand) {
567				$('.pp_contract').removeClass('pp_contract').addClass('pp_expand');
568			}
569
570			_hideContent(function(){ $.prettyPhoto.open(); });
571		};
572
573
574		/**
575		* Change gallery page in the prettyPhoto modal box
576		* @param direction {String} Direction of the paging, previous or next.
577		*/
578		$.prettyPhoto.changeGalleryPage = function(direction){
579			if(direction=='next'){
580				currentGalleryPage ++;
581
582				if(currentGalleryPage > totalPage) currentGalleryPage = 0;
583			}else if(direction=='previous'){
584				currentGalleryPage --;
585
586				if(currentGalleryPage < 0) currentGalleryPage = totalPage;
587			}else{
588				currentGalleryPage = direction;
589			};
590			
591			slide_speed = (direction == 'next' || direction == 'previous') ? settings.animation_speed : 0;
592
593			slide_to = currentGalleryPage * (itemsPerPage * itemWidth);
594
595			$pp_gallery.find('ul').animate({left:-slide_to},slide_speed);
596		};
597
598
599		/**
600		* Start the slideshow...
601		*/
602		$.prettyPhoto.startSlideshow = function(){
603			if(typeof pp_slideshow == 'undefined'){
604				$pp_pic_holder.find('.pp_play').unbind('click').removeClass('pp_play').addClass('pp_pause').click(function(){
605					$.prettyPhoto.stopSlideshow();
606					return false;
607				});
608				pp_slideshow = setInterval($.prettyPhoto.startSlideshow,settings.slideshow);
609			}else{
610				$.prettyPhoto.changePage('next');	
611			};
612		}
613
614
615		/**
616		* Stop the slideshow...
617		*/
618		$.prettyPhoto.stopSlideshow = function(){
619			$pp_pic_holder.find('.pp_pause').unbind('click').removeClass('pp_pause').addClass('pp_play').click(function(){
620				$.prettyPhoto.startSlideshow();
621				return false;
622			});
623			clearInterval(pp_slideshow);
624			pp_slideshow=undefined;
625		}
626
627
628		/**
629		* Closes prettyPhoto.
630		*/
631		$.prettyPhoto.close = function(){
632			if($pp_overlay.is(":animated")) return;
633			
634			$.prettyPhoto.stopSlideshow();
635			
636			$pp_pic_holder.stop().find('object,embed').css('visibility','hidden');
637			
638			$('div.pp_pic_holder,div.ppt,.pp_fade').fadeOut(settings.animation_speed,function(){ $(this).remove(); });
639			
640			$pp_overlay.fadeOut(settings.animation_speed, function(){
641				
642				if(settings.hideflash) $('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','visible'); // Show the flash
643				
644				$(this).remove(); // No more need for the prettyPhoto markup
645				
646				$(window).unbind('scroll.prettyphoto');
647				
648				clearHashtag();
649				
650				settings.callback();
651				
652				doresize = true;
653				
654				pp_open = false;
655				
656				delete settings;
657			});
658		};
659	
660		/**
661		* Set the proper sizes on the containers and animate the content in.
662		*/
663		function _showContent(){
664			$('.pp_loaderIcon').hide();
665
666			// Calculate the opened top position of the pic holder
667			projectedTop = scroll_pos['scrollTop'] + ((windowHeight/2) - (pp_dimensions['containerHeight']/2));
668			if(projectedTop < 0) projectedTop = 0;
669
670			$ppt.fadeTo(settings.animation_speed,1);
671
672			// Resize the content holder
673			$pp_pic_holder.find('.pp_content')
674				.animate({
675					height:pp_dimensions['contentHeight'],
676					width:pp_dimensions['contentWidth']
677				},settings.animation_speed);
678			
679			// Resize picture the holder
680			$pp_pic_holder.animate({
681				'top': projectedTop,
682				'left': ((windowWidth/2) - (pp_dimensions['containerWidth']/2) < 0) ? 0 : (windowWidth/2) - (pp_dimensions['containerWidth']/2),
683				width:pp_dimensions['containerWidth']
684			},settings.animation_speed,function(){
685				$pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(pp_dimensions['height']).width(pp_dimensions['width']);
686
687				$pp_pic_holder.find('.pp_fade').fadeIn(settings.animation_speed); // Fade the new content
688
689				// Show the nav
690				if(isSet && _getFileType(pp_images[set_position])=="image") { $pp_pic_holder.find('.pp_hoverContainer').show(); }else{ $pp_pic_holder.find('.pp_hoverContainer').hide(); }
691			
692				if(settings.allow_expand) {
693					if(pp_dimensions['resized']){ // Fade the resizing link if the image is resized
694						$('a.pp_expand,a.pp_contract').show();
695					}else{
696						$('a.pp_expand').hide();
697					}
698				}
699				
700				if(settings.autoplay_slideshow && !pp_slideshow && !pp_open) $.prettyPhoto.startSlideshow();
701				
702				settings.changepicturecallback(); // Callback!
703				
704				pp_open = true;
705			});
706			
707			_insert_gallery();
708			pp_settings.ajaxcallback();
709		};
710		
711		/**
712		* Hide the content...DUH!
713		*/
714		function _hideContent(callback){
715			// Fade out the current picture
716			$pp_pic_holder.find('#pp_full_res object,#pp_full_res embed').css('visibility','hidden');
717			$pp_pic_holder.find('.pp_fade').fadeOut(settings.animation_speed,function(){
718				$('.pp_loaderIcon').show();
719				
720				callback();
721			});
722		};
723	
724		/**
725		* Check the item position in the gallery array, hide or show the navigation links
726		* @param setCount {integer} The total number of items in the set
727		*/
728		function _checkPosition(setCount){
729			(setCount > 1) ? $('.pp_nav').show() : $('.pp_nav').hide(); // Hide the bottom nav if it's not a set.
730		};
731	
732		/**
733		* Resize the item dimensions if it's bigger than the viewport
734		* @param width {integer} Width of the item to be opened
735		* @param height {integer} Height of the item to be opened
736		* @return An array containin the "fitted" dimensions
737		*/
738		function _fitToViewport(width,height){
739			resized = false;
740
741			_getDimensions(width,height);
742			
743			// Define them in case there's no resize needed
744			imageWidth = width, imageHeight = height;
745
746			if( ((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)) && doresize && settings.allow_resize && !percentBased) {
747				resized = true, fitting = false;
748			
749				while (!fitting){
750					if((pp_containerWidth > windowWidth)){
751						imageWidth = (windowWidth - 50);
752						imageHeight = (height/width) * imageWidth;
753					}else if((pp_containerHeight > windowHeight)){
754						imageHeight = (windowHeight - 50);
755						imageWidth = (width/height) * imageHeight;
756					}else{
757						fitting = true;
758					};
759
760					pp_containerHeight = imageHeight, pp_containerWidth = imageWidth;
761				};
762			
763
764				
765				if((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)){
766					_fitToViewport(pp_containerWidth,pp_containerHeight)
767				};
768				
769				_getDimensions(imageWidth,imageHeight);
770			};
771			
772			return {
773				width:Math.floor(imageWidth),
774				height:Math.floor(imageHeight),
775				containerHeight:Math.floor(pp_containerHeight),
776				containerWidth:Math.floor(pp_containerWidth) + (settings.horizontal_padding * 2),
777				contentHeight:Math.floor(pp_contentHeight),
778				contentWidth:Math.floor(pp_contentWidth),
779				resized:resized
780			};
781		};
782		
783		/**
784		* Get the containers dimensions according to the item size
785		* @param width {integer} Width of the item to be opened
786		* @param height {integer} Height of the item to be opened
787		*/
788		function _getDimensions(width,height){
789			width = parseFloat(width);
790			height = parseFloat(height);
791			
792			// Get the details height, to do so, I need to clone it since it's invisible
793			$pp_details = $pp_pic_holder.find('.pp_details');
794			$pp_details.width(width);
795			detailsHeight = parseFloat($pp_details.css('marginTop')) + parseFloat($pp_details.css('marginBottom'));
796			
797			$pp_details = $pp_details.clone().addClass(settings.theme).width(width).appendTo($('body')).css({
798				'position':'absolute',
799				'top':-10000
800			});
801			detailsHeight += $pp_details.height();
802			detailsHeight = (detailsHeight <= 34) ? 36 : detailsHeight; // Min-height for the details
803			$pp_details.remove();
804			
805			// Get the titles height, to do so, I need to clone it since it's invisible
806			$pp_title = $pp_pic_holder.find('.ppt');
807			$pp_title.width(width);
808			titleHeight = parseFloat($pp_title.css('marginTop')) + parseFloat($pp_title.css('marginBottom'));
809			$pp_title = $pp_title.clone().appendTo($('body')).css({
810				'position':'absolute',
811				'top':-10000
812			});
813			titleHeight += $pp_title.height();
814			$pp_title.remove();
815			
816			// Get the container size, to resize the holder to the right dimensions
817			pp_contentHeight = height + detailsHeight;
818			pp_contentWidth = width;
819			pp_containerHeight = pp_contentHeight + titleHeight + $pp_pic_holder.find('.pp_top').height() + $pp_pic_holder.find('.pp_bottom').height();
820			pp_containerWidth = width;
821		}
822	
823		function _getFileType(itemSrc){
824			if (itemSrc.match(/youtube\.com\/watch/i) || itemSrc.match(/youtu\.be/i)) {
825				return 'youtube';
826			}else if (itemSrc.match(/vimeo\.com/i)) {
827				return 'vimeo';
828			}else if(itemSrc.match(/\b.mov\b/i)){ 
829				return 'quicktime';
830			}else if(itemSrc.match(/\b.swf\b/i)){
831				return 'flash';
832			}else if(itemSrc.match(/\biframe=true\b/i)){
833				return 'iframe';
834			}else if(itemSrc.match(/\bajax=true\b/i)){
835				return 'ajax';
836			}else if(itemSrc.match(/\bcustom=true\b/i)){
837				return 'custom';
838			}else if(itemSrc.substr(0,1) == '#'){
839				return 'inline';
840			}else{
841				return 'image';
842			};
843		};
844	
845		function _center_overlay(){
846			if(doresize && typeof $pp_pic_holder != 'undefined') {
847				scroll_pos = _get_scroll();
848				contentHeight = $pp_pic_holder.height(), contentwidth = $pp_pic_holder.width();
849
850				projectedTop = (windowHeight/2) + scroll_pos['scrollTop'] - (contentHeight/2);
851				if(projectedTop < 0) projectedTop = 0;
852				
853				if(contentHeight > windowHeight)
854					return;
855
856				$pp_pic_holder.css({
857					'top': projectedTop,
858					'left': (windowWidth/2) + scroll_pos['scrollLeft'] - (contentwidth/2)
859				});
860			};
861		};
862	
863		function _get_scroll(){
864			if (self.pageYOffset) {
865				return {scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset};
866			} else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
867				return {scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft};
868			} else if (document.body) {// all other Explorers
869				return {scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft};
870			};
871		};
872	
873		function _resize_overlay() {
874			windowHeight = $(window).height(), windowWidth = $(window).width();
875			
876			if(typeof $pp_overlay != "undefined") $pp_overlay.height($(document).height()).width(windowWidth);
877		};
878	
879		function _insert_gallery(){
880			if(isSet && settings.overlay_gallery && _getFileType(pp_images[set_position])=="image") {
881				itemWidth = 52+5; // 52 beign the thumb width, 5 being the right margin.
882				navWidth = (settings.theme == "facebook" || settings.theme == "pp_default") ? 50 : 30; // Define the arrow width depending on the theme
883				
884				itemsPerPage = Math.floor((pp_dimensions['containerWidth'] - 100 - navWidth) / itemWidth);
885				itemsPerPage = (itemsPerPage < pp_images.length) ? itemsPerPage : pp_images.length;
886				totalPage = Math.ceil(pp_images.length / itemsPerPage) - 1;
887
888				// Hide the nav in the case there's no need for links
889				if(totalPage == 0){
890					navWidth = 0; // No nav means no width!
891					$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').hide();
892				}else{
893					$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').show();
894				};
895
896				galleryWidth = itemsPerPage * itemWidth;
897				fullGalleryWidth = pp_images.length * itemWidth;
898				
899				// Set the proper width to the gallery items
900				$pp_gallery
901					.css('margin-left',-((galleryWidth/2) + (navWidth/2)))
902					.find('div:first').width(galleryWidth+5)
903					.find('ul').width(fullGalleryWidth)
904					.find('li.selected').removeClass('selected');
905				
906				goToPage = (Math.floor(set_position/itemsPerPage) < totalPage) ? Math.floor(set_position/itemsPerPage) : totalPage;
907
908				$.prettyPhoto.changeGalleryPage(goToPage);
909				
910				$pp_gallery_li.filter(':eq('+set_position+')').addClass('selected');
911			}else{
912				$pp_pic_holder.find('.pp_content').unbind('mouseenter mouseleave');
913				// $pp_gallery.hide();
914			}
915		}
916	
917		function _build_overlay(caller){
918			// Inject Social Tool markup into General markup
919			if(settings.social_tools)
920				facebook_like_link = settings.social_tools.replace('{location_href}', encodeURIComponent(location.href)); 
921
922			settings.markup = settings.markup.replace('{pp_social}','');
923			settings.markup = settings.markup.replace('{pp_buy_btn}',''); 
924			
925			$('body').append(settings.markup); // Inject the markup
926			
927			$pp_pic_holder = $('.pp_pic_holder') , $ppt = $('.ppt'), $pp_overlay 
927= $('div.pp_overlay'); // Set my global selectors
928			
929			// Inject the inline gallery!
930			if(isSet && settings.overlay_gallery) {
931				currentGalleryPage = 0;
932				toInject = "";
933				for (var i=0; i < pp_images.length; i++) {
934					if(!pp_images[i].match(/\b(jpg|jpeg|png|gif)\b/gi)){
935						classname = 'default';
936						img_src = '';
937					}else{
938						classname = '';
939						img_src = pp_images[i];
940					}
941					toInject += "<li class='"+classname+"'><a href='#'><img src='" + img_src + "' width='50' alt='' /></a></li>";
942				};
943				
944				toInject = settings.gallery_markup.replace(/{gallery}/g,toInject);
945				
946				$pp_pic_holder.find('#pp_full_res').after(toInject);
947				
948				$pp_gallery = $('.pp_pic_holder .pp_gallery'), $pp_gallery_li = $pp_gallery.find('li'); // Set the gallery selectors
949
950				$pp_gallery.find('.pp_arrow_next').click(function(){
951					$.prettyPhoto.changeGalleryPage('next');
952					$.prettyPhoto.stopSlideshow();
953					return false;
954				});
955				
956				$pp_gallery.find('.pp_arrow_previous').click(function(){
957					$.prettyPhoto.changeGalleryPage('previous');
958					$.prettyPhoto.stopSlideshow();
959					return false;
960				});
961				
962				$pp_pic_holder.find('.pp_content').hover(
963					function(){
964						$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn();
965					},
966					function(){
967						$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut();
968					});
969
970				itemWidth = 52+5; // 52 beign the thumb width, 5 being the right margin.
971				$pp_gallery_li.each(function(i){
972					$(this)
973						.find('a')
974						.click(function(){
975							$.prettyPhoto.changePage(i);
976							$.prettyPhoto.stopSlideshow();
977							return false;
978						});
979				});
980			};
981			
982			
983			// Inject the play/pause if it's a slideshow
984			if(settings.slideshow){
985				$pp_pic_holder.find('.pp_nav').prepend('<a href="#" class="pp_play">Play</a>')
986				$pp_pic_holder.find('.pp_nav .pp_play').click(function(){
987					$.prettyPhoto.startSlideshow();
988					tracking();
989					return false;
990				});
991			}
992			
993			$pp_pic_holder.attr('class','pp_pic_holder ' + settings.theme); // Set the proper theme
994			$pp_overlay
995				.css({
996					'opacity':0,
997					'height':$(document).height(),
998					'width':$(window).width()
999					})
1000				.bind('click',function(){
1001					if(!settings.modal) $.prettyPhoto.close();
1002				});
1003
1004			$('a.pp_close').bind('click',function(){ $.prettyPhoto.close(); return false; });
1005
1006
1007			if(settings.allow_expand) {
1008				$('a.pp_expand').bind('click',function(e){
1009					// Expand the image
1010					if($(this).hasClass('pp_expand')){
1011						$(this).removeClass('pp_expand').addClass('pp_contract');
1012						doresize = false;
1013					}else{
1014						$(this).removeClass('pp_contract').addClass('pp_expand');
1015						doresize = true;
1016					};
1017				
1018					_hideContent(function(){ $.prettyPhoto.open(); });
1019			
1020					return false;
1021				});
1022			}
1023		
1024			$pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click',function(){
1025				$.prettyPhoto.changePage('previous');
1026				$.prettyPhoto.stopSlideshow();
1027				tracking();
1028				return false;
1029			});
1030		
1031			$pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click',function(){
1032				$.prettyPhoto.changePage('next');
1033				$.prettyPhoto.stopSlideshow();
1034				tracking();
1035				return false;
1036			});
1037
1038			_center_overlay(); // Center it
1039		};
1040
1041		if(!pp_alreadyInitialized && getHashtag()){
1042			pp_alreadyInitialized = true;
1043			
1044			// Grab the rel index to trigger the click on the correct element
1045			hashIndex = getHashtag();
1046			hashRel = hashIndex;
1047			hashIndex = hashIndex.substring(hashIndex.indexOf('/')+1,hashIndex.length-1);
1048			hashRel = hashRel.substring(0,hashRel.indexOf('/'));
1049
1050			// Little timeout to make sure all the prettyPhoto initialize scripts has been run.
1051			// Useful in the event the page contain several init scripts.
1052			setTimeout(function(){ $("a["+pp_settings.hook+"^='"+hashRel+"']:eq("+hashIndex+")").trigger('click'); },50);
1053		}
1054		
1055		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
1056	};
1057	
1058	function getHashtag(){
1059		var url = location.href;
1060		hashtag = (url.indexOf('#prettyPhoto') !== -1) ? decodeURI(url.substring(url.indexOf('#prettyPhoto')+1,url.length)) : false;
1061		if(hashtag){  hashtag = hashtag.replace(/<|>/g,''); }
1062		return hashtag;
1063	};
1064	
1065	function setHashtag(){
1066		//commented showing hashtag in main url WPB-3221
1067		return;
1068		if(typeof theRel == 'undefined') return; // theRel is set on normal calls, it's impossible to deeplink using the API
1069		location.hash = theRel + '/'+rel_index+'/';
1070	};
1071	
1072	function clearHashtag(){
1073		//commented showing hashtag in main url WPB-3221
1074		return;
1075		if ( location.href.indexOf('#prettyPhoto') !== -1 ) location.hash = "prettyPhoto";
1076	}
1077	
1078	function getParam(name,url){
1079	  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
1080	  var regexS = "[\\?&]"+name+"=([^&#]*)";
1081	  var regex = new RegExp( regexS );
1082	  var results = regex.exec( url );
1083	  return ( results == null ) ? "" : results[1];
1084	}
1085
1086	function tracking() {
1087		var path = location.href;
1088
1089		path = path.replace("http://","");
1090		path = path.replace("https://","");
1091		path = path.replace("https:/","");
1092		path = path.replace("http:/","");
1093		var pathArr = path.split("/");
1094		var siteurl = pathArr[0];
1095		path = path.replace(siteurl+"/","");
1096
1097	setTimeout(function () {
1098		// Delay to allow for state change.
1099		path = path.replace(/\/\//g, '/'); // Replace instance of a double backslash.
1100        var imageTitle = ($pp_pic_holder.find('.pp_description').html());
1101
1102        var fullResImage = $('#fullResImage').prop('src');
1103		var imgPathArray = fullResImage.split("&image_id=");
1104		var imgaeId = imgPathArray[1];
1105		
1106		path = path +imgaeId;
1107		//alert(path);
1108		if (typeof gtag === 'function') {
1109			 gtag('js', new Date());
1110			    gtag('config', 'UA-103821886-2', {
1111			    'page_title' : document.title,
1112			    'page_path': path
1113			    });
1114
1115			// Gtag GA Tracking
1116			gtag('event', 'page_view', {
1117				page_title: document.title,
1118				page_location: window.location.href,
1119				page_path: path
1120			});
1121			//if (alm_localize.ga_debug) {
1122			//	console.log('Pageview sent to Google Analytics (gtag)');
1123			//}
1124		}
1125
1126		
1127	}, 1000);
1128}
1129
1130	
1131})(jQuery);
1132
1133var 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.