PageSourceSearch

https://joomla-expert.ru/plugins/system/ytshortcodes/assets/js/jquery.prettyPhoto.js

js joomla-expert.ru collected 2026-10-08 12:53:13 UTC 37,240 bytes, 719 lines download raw bytes

1(function($) {
2    $.prettyPhoto = {
3        version: '3.1.6'
4    };
5    $.fn.prettyPhoto = function(pp_settings) {
6        pp_settings = jQuery.extend({
7            hook: 'rel',
8            animation_speed: 'fast',
9            ajaxcallback: function() {},
10            slideshow: 5000,
11            autoplay_slideshow: false,
12            opacity: 0.80,
13            show_title: true,
14            allow_resize: true,
15            allow_expand: true,
16            default_width: 500,
17            default_height: 344,
18            counter_separator_label: '/',
19            theme: 'pp_default',
20            horizontal_padding: 20,
21            hideflash: false,
22            wmode: 'opaque',
23            autoplay: true,
24            modal: false,
25            deeplinking: true,
26            overlay_gallery: true,
27            overlay_gallery_max: 30,
28            keyboard_shortcuts: true,
29            changepicturecallback: function() {},
30            callback: function() {},
31            ie6_fallback: true,
32            markup: '<div class="pp_pic_holder"> \
33						<div class="ppt">&nbsp;</div> \
34						<div class="pp_content_container"> \
35							<div class="pp_left"> \
36							<div class="pp_right"> \
37								<div class="pp_content"> \
38									<div class="pp_loaderIcon"></div> \
39									<div class="pp_fade"> \
40										<a href="#" class="pp_expand" title="Expand the image">Expand</a> \
41										<div class="pp_hoverContainer"> \
42											<a class="pp_next" href="#">next</a> \
43											<a class="pp_previous" href="#">previous</a> \
44										</div> \
45										<div id="pp_full_res"></div> \
46										<div class="pp_details"> \
47											<div class="pp_nav"> \
48												<a href="#" class="pp_arrow_previous">Previous</a> \
49												<p class="currentTextHolder">0/0</p> \
50												<a href="#" class="pp_arrow_next">Next</a> \
51											</div> \
52											<p class="pp_description"></p> \
53											<div class="pp_social">{pp_social}</div> \
54											<a class="pp_close" href="#">Close</a> \
55										</div> \
56									</div> \
57								</div> \
58							</div> \
59							</div> \
60						</div> \
61						<div class="pp_bottom"> \
62							<div class="pp_left"></div> \
63							<div class="pp_middle"></div> \
64							<div class="pp_right"></div> \
65						</div> \
66					</div> \
67					<div class="pp_overlay"></div>',
68            gallery_markup: '<div class="pp_gallery"> \
69								<a href="#" class="pp_arrow_previous">Previous</a> \
70								<div> \
71									<ul> \
72										{gallery} \
73									</ul> \
74								</div> \
75								<a href="#" class="pp_arrow_next">Next</a> \
76							</div>',
77            image_markup: '<img id="fullResImage" src="{path}" />',
78            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>',
79            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>',
80            iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',
81            inline_markup: '<div class="pp_inline">{content}</div>',
82            custom_markup: '',
83            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>'
84        }, pp_settings);
85        var matchedObjects = this,
86            percentBased = false,
87            pp_dimensions, pp_open, pp_contentHeight, pp_contentWidth, pp_containerHeight, pp_containerWidth, windowHeight = $(window).height(),
88            windowWidth = $(window).width(),
89            pp_slideshow;
90        doresize = true, scroll_pos = _get_scroll();
91        $(window).unbind('resize.prettyphoto').bind('resize.prettyphoto', function() {
92            _center_overlay();
93            _resize_overlay();
94        });
95        if (pp_settings.keyboard_shortcuts) {
96            $(document).unbind('keydown.prettyphoto').bind('keydown.prettyphoto', function(e) {
97                if (typeof $pp_pic_holder != 'undefined') {
98                    if ($pp_pic_holder.is(':visible')) {
99                        switch (e.keyCode) {
100                            case 37:
101                                $.prettyPhoto.changePage('previous');
102                                e.preventDefault();
103                                break;
104                            case 39:
105                                $.prettyPhoto.changePage('next');
106                                e.preventDefault();
107                                break;
108                            case 27:
109                                if (!settings.modal)
110                                    $.prettyPhoto.close();
111                                e.preventDefault();
112                                break;
113                        };
114                    };
115                };
116            });
117        };
118        $.prettyPhoto.initialize = function() {
119            settings = pp_settings;
120            if (settings.theme == 'pp_default') settings.horizontal_padding = 16;
121            theRel = $(this).attr(settings.hook);
122            galleryRegExp = /\[(?:.*)\]/;
123            isSet = (galleryRegExp.exec(theRel)) ? true : false;
124            pp_images = (isSet) ? jQuery.map(matchedObjects, function(n, i) {
125                if ($(n).attr(settings.hook).indexOf(theRel) != -1) return $(n).attr('href');
126            }) : $.makeArray($(this).attr('href'));
127            pp_titles = (isSet) ? jQuery.map(matchedObjects, function(n, i) {
128                if ($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).find('img').attr('alt')) ? $(n).find('img').attr('alt') : "";
129            }) : $.makeArray($(this).find('img').attr('alt'));
130            pp_descriptions = (isSet) ? jQuery.map(matchedObjects, function(n, i) {
131                if ($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).attr('title')) ? $(n).attr('title') : "";
132            }) : $.makeArray($(this).attr('title'));
133            if (pp_images.length > settings.overlay_gallery_max) settings.overlay_gallery = false;
134            set_position = jQuery.inArray($(this).attr('href'), pp_images);
135            rel_index = (isSet) ? set_position : $("a[" + settings.hook + "^='" + theRel + "']").index($(this));
136            _build_overlay(this);
137            if (settings.allow_resize)
138                $(window).bind('scroll.prettyphoto', function() {
139                    _center_overlay();
140                });
141            $.prettyPhoto.open();
142            return false;
143        }
144        $.prettyPhoto.open = function(event) {
145            if (typeof settings == "undefined") {
146                settings = pp_settings;
147                pp_images = $.makeArray(arguments[0]);
148                pp_titles = (arguments[1]) ? $.makeArray(arguments[1]) : $.makeArray("");
149                pp_descriptions = (arguments[2]) ? $.makeArray(arguments[2]) : $.makeArray("");
150                isSet = (pp_images.length > 1) ? true : false;
151                set_position = (arguments[3]) ? arguments[3] : 0;
152                _build_overlay(event.target);
153            }
154            if (settings.hideflash) $('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility', 'hidden');
155            _checkPosition($(pp_images).size());
156            $('.pp_loaderIcon').show();
157            if (settings.deeplinking)
158                setHashtag();
159            if (settings.social_tools) {
160                facebook_like_link = settings.social_tools.replace('{location_href}', encodeURIComponent(location.href));
161                $pp_pic_holder.find('.pp_social').html(facebook_like_link);
162            }
163            if ($ppt.is(':hidden')) $ppt.css('opacity', 0).show();
164            $pp_overlay.show().fadeTo(settings.animation_speed, settings.opacity);
165            $pp_pic_holder.find('.currentTextHolder').text((set_position + 1) + settings.counter_separator_label + $(pp_images).size());
166            if (typeof pp_descriptions[set_position] != 'undefined' && pp_descriptions[set_position] != "") {
167                $pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[set_position]));
168            } else {
169                $pp_pic_holder.find('.pp_description').hide();
170            }
171            movie_width = (parseFloat(getParam('width', pp_images[set_position]))) ? getParam('width', pp_images[set_position]) : settings.default_width.toString();
172            movie_height = (parseFloat(getParam('height', pp_images[set_position]))) ? getParam('height', pp_images[set_position]) : settings.default_height.toString();
173            percentBased = false;
174            if (movie_height.indexOf('%') != -1) {
175                movie_height = parseFloat(($(window).height() * parseFloat(movie_height) / 100) - 150);
176                percentBased = true;
177            }
178            if (movie_width.indexOf('%') != -1) {
179                movie_width = parseFloat(($(window).width() * parseFloat(movie_width) / 100) - 150);
180                percentBased = true;
181            }
182            $pp_pic_holder.fadeIn(function() {
183                //(settings.show_title && pp_titles[set_position] != "" && typeof pp_titles[set_position] != "undefined") ? $ppt.html(unescape(pp_titles[set_position])): $ppt.html('&nbsp;');
184                imgPreloader = "";
185                skipInjection = false;
186                switch (_getFileType(pp_images[set_position])) {
187                    case 'image':
188                        imgPreloader = new Image();
189                        nextImage = new Image();
190                        if (isSet && set_position < $(pp_images).size() - 1) nextImage.src = pp_images[set_position + 1];
191                        prevImage = new Image();
192                        if (isSet && pp_images[set_position - 1]) prevImage.src = pp_images[set_position - 1];
193                        $pp_pic_holder.find('#pp_full_res')[0].innerHTML = settings.image_markup.replace(/{path}/g, pp_images[set_position]);
194                        imgPreloader.onload = function() {
195                            pp_dimensions = _fitToViewport(imgPreloader.width, imgPreloader.height);
196                            _showContent();
197                        };
198                        imgPreloader.onerror = function() {
199                            alert('Image cannot be loaded. Make sure the path is correct and image exist.');
200                            $.prettyPhoto.close();
201                        };
202                        imgPreloader.src = pp_images[set_position];
203                        break;
204                    case 'youtube':
205                        pp_dimensions = _fitToViewport(movie_width, movie_height);
206                        movie_id = getParam('v', pp_images[set_position]);
207                        if (movie_id == "") {
208                            movie_id = pp_images[set_position].split('youtu.be/');
209                            movie_id = movie_id[1];
210                            if (movie_id.indexOf('?') > 0)
211                                movie_id = movie_id.substr(0, movie_id.indexOf('?'));
212                            if (movie_id.indexOf('&') > 0)
213                                movie_id = movie_id.substr(0, movie_id.indexOf('&'));
214                        }
215                        movie = 'http://www.youtube.com/embed/' + movie_id;
216                        (getParam('rel', pp_images[set_position])) ? movie += "?rel=" + getParam('rel', pp_images[set_position]): movie += "?rel=1";
217                        if (settings.autoplay) movie += "&autoplay=1";
218                        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);
219                        break;
220                    case 'vimeo':
221                        pp_dimensions = _fitToViewport(movie_width, movie_height);
222                        movie_id = pp_images[set_position];
223                        var regExp = /http(s?):\/\/(www\.)?vimeo.com\/(\d+)/;
224                        var match = movie_id.match(regExp);
225                        movie = 'http://player.vimeo.com/video/' + match[3] + '?title=0&amp;byline=0&amp;portrait=0';
226                        if (settings.autoplay) movie += "&autoplay=1;";
227                        vimeo_width = pp_dimensions['width'] + '/embed/?moog_width=' + pp_dimensions['width'];
228                        toInject = settings.iframe_markup.replace(/{width}/g, vimeo_width).replace(/{height}/g, pp_dimensions['height']).replace(/{path}/g, movie);
229                        break;
230                    case 'quicktime':
231                        pp_dimensions = _fitToViewport(movie_width, movie_height);
232                        pp_dimensions['height'] += 15;
233                        pp_dimensions['contentHeight'] += 15;
234                        pp_dimensions['containerHeight'] += 15;
235                        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);
236                        break;
237                    case 'flash':
238                        pp_dimensions = _fitToViewport(movie_width, movie_height);
239                        flash_vars = pp_images[set_position];
240                        flash_vars = flash_vars.substring(pp_images[set_position].indexOf('flashvars') + 10, pp_images[set_position].length);
241                        filename = pp_images[set_position];
242                        filename = filename.substring(0, filename.indexOf('?'));
243                        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);
244                        break;
245                    case 'iframe':
246                        pp_dimensions = _fitToViewport(movie_width, movie_height);
247                        frame_url = pp_images[set_position];
248                        frame_url = frame_url.substr(0, frame_url.indexOf('iframe') - 1);
249                        toInject = settings.iframe_markup.replace(/{width}/g, pp_dimensions['width']).replace(/{height}/g, pp_dimensions['height']).replace(/{path}/g, frame_url);
250                        break;
251                    case 'ajax':
252                        doresize = false;
253                        pp_dimensions = _fitToViewport(movie_width, movie_height);
254                        doresize = true;
255                        skipInjection = true;
256                        $.get(pp_images[set_position], function(responseHTML) {
257                            toInject = settings.inline_markup.replace(/{content}/g, responseHTML);
258                            $pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject;
259                            _showContent();
260                        });
261                        break;
262                    case 'custom':
263                        pp_dimensions = _fitToViewport(movie_width, movie_height);
264                        toInject = settings.custom_markup;
265                        break;
266                    case 'inline':
267                        myClone = $(pp_images[set_position]).clone().append('<br clear="all" />').css({
268                            'width': settings.default_width
269                        }).wrapInner('<div id="pp_full_res"><div class="pp_inline"></div></div>').appendTo($('body')).show();
270                        doresize = false;
271                        pp_dimensions = _fitToViewport($(myClone).width(), $(myClone).height());
272                        doresize = true;
273                        $(myClone).remove();
274                        toInject = settings.inline_markup.replace(/{content}/g, $(pp_images[set_position]).html());
275                        break;
276                };
277                if (!imgPreloader && !skipInjection) {
278                    $pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject;
279                    _showContent();
280                };
281            });
282            return false;
283        };
284        $.prettyPhoto.changePage = function(direction) {
285            currentGalleryPage = 0;
286            if (direction == 'previous') {
287                set_position--;
288                if (set_position < 0) set_position = $(pp_images).size() - 1;
289            } else if (direction == 'next') {
290                set_position++;
291                if (set_position > $(pp_images).size() - 1) set_position = 0;
292            } else {
293                set_position = direction;
294            };
295            rel_index = set_position;
296            if (!doresize) doresize = true;
297            if (settings.allow_expand) {
298                $('.pp_contract').removeClass('pp_contract').addClass('pp_expand');
299            }
300            _hideContent(function() {
301                $.prettyPhoto.open();
302            });
303        };
304        $.prettyPhoto.changeGalleryPage = function(direction) {
305            if (direction == 'next') {
306                currentGalleryPage++;
307                if (currentGalleryPage > totalPage) currentGalleryPage = 0;
308            } else if (direction == 'previous') {
309                currentGalleryPage--;
310                if (currentGalleryPage < 0) currentGalleryPage = totalPage;
311            } else {
312                currentGalleryPage = direction;
313            };
314            slide_speed = (direction == 'next' || direction == 'previous') ? settings.animation_speed : 0;
315            slide_to = currentGalleryPage * (itemsPerPage * itemWidth);
316            $pp_gallery.find('ul').animate({
317                left: -slide_to
318            }, slide_speed);
319        };
320        $.prettyPhoto.startSlideshow = function() {
321            if (typeof pp_slideshow == 'undefined') {
322                $pp_pic_holder.find('.pp_play').unbind('click').removeClass('pp_play').addClass('pp_pause').click(function() {
323                    $.prettyPhoto.stopSlideshow();
324                    return false;
325                });
326                pp_slideshow = setInterval($.prettyPhoto.startSlideshow, settings.slideshow);
327            } else {
328                $.prettyPhoto.changePage('next');
329            };
330        }
331        $.prettyPhoto.stopSlideshow = function() {
332            $pp_pic_holder.find('.pp_pause').unbind('click').removeClass('pp_pause').addClass('pp_play').click(function() {
333                $.prettyPhoto.startSlideshow();
334                return false;
335            });
336            clearInterval(pp_slideshow);
337            pp_slideshow = undefined;
338        }
339        $.prettyPhoto.close = function() {
340            if ($pp_overlay.is(":animated")) return;
341            $.prettyPhoto.stopSlideshow();
342            $pp_pic_holder.stop().find('object,embed').css('visibility', 'hidden');
343            $('div.pp_pic_holder,div.ppt,.pp_fade').fadeOut(settings.animation_speed, function() {
344                $(this).remove();
345            });
346            $pp_overlay.fadeOut(settings.animation_speed, function() {
347                if (settings.hideflash) $('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility', 'visible');
348                $(this).remove();
349                $(window).unbind('scroll.prettyphoto');
350                clearHashtag();
351                settings.callback();
352                doresize = true;
353                pp_open = false;
354                delete settings;
355            });
356        };
357
358        function _showContent() {
359            $('.pp_loaderIcon').hide();
360            projectedTop = scroll_pos['scrollTop'] + ((windowHeight / 2) - (pp_dimensions['containerHeight'] / 2));
361            if (projectedTop < 0) projectedTop = 0;
362            $ppt.fadeTo(settings.animation_speed, 1);
363            $pp_pic_holder.find('.pp_content').animate({
364               height: pp_dimensions['contentHeight'] - 80,
365                width: pp_dimensions['contentWidth']
366            }, settings.animation_speed);
367            $pp_pic_holder.animate({
368                'top': projectedTop,
369                'left': ((windowWidth / 2) - (pp_dimensions['containerWidth'] / 2) < 0) ? 0 : (windowWidth / 2) - (pp_dimensions['containerWidth'] / 2),
370                width: pp_dimensions['containerWidth']
371            }, settings.animation_speed, function() {
372                $pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(pp_dimensions['height']).width(pp_dimensions['width']);
373                $pp_pic_holder.find('.pp_fade').fadeIn(settings.animation_speed);
374                if (isSet && _getFileType(pp_images[set_position]) == "image") {
375                    $pp_pic_holder.find('.pp_hoverContainer').show();
376                } else {
377                    $pp_pic_holder.find('.pp_hoverContainer').hide();
378                }
379                if (settings.allow_expand) {
380                    if (pp_dimensions['resized']) {
381                        $('a.pp_expand,a.pp_contract').show();
382                    } else {
383                        $('a.pp_expand').hide();
384                    }
385                }
386                if (settings.autoplay_slideshow && !pp_slideshow && !pp_open) $.prettyPhoto.startSlideshow();
387                settings.changepicturecallback();
388                pp_open = true;
389            });
390            _insert_gallery();
391            pp_settings.ajaxcallback();
392        };
393
394        function _hideContent(callback) {
395            $pp_pic_holder.find('#pp_full_res object,#pp_full_res embed').css('visibility', 'hidden');
396            $pp_pic_holder.find('.pp_fade').fadeOut(settings.animation_speed, function() {
397                $('.pp_loaderIcon').show();
398                callback();
399            });
400        };
401
402        function _checkPosition(setCount) {
403            (setCount > 1) ? $('.pp_nav').show(): $('.pp_nav').hide();
404        };
405
406        function _fitToViewport(width, height) {
407            resized = false;
408            _getDimensions(width, height);
409            imageWidth = width, imageHeight = height;
410            if (((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)) && doresize && settings.allow_resize && !percentBased) {
411                resized = true, fitting = false;
412                while (!fitting) {
413                    if ((pp_containerWidth > windowWidth)) {
414                        imageWidth = (windowWidth - 200);
415                        imageHeight = (height / width) * imageWidth;
416                    } else if ((pp_containerHeight > windowHeight)) {
417                        imageHeight = (windowHeight - 200);
418                        imageWidth = (width / height) * imageHeight;
419                    } else {
420                        fitting = true;
421                    };
422                    pp_containerHeight = imageHeight, pp_containerWidth = imageWidth;
423                };
424                if ((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)) {
425                    _fitToViewport(pp_containerWidth, pp_containerHeight)
426                };
427                _getDimensions(imageWidth, imageHeight);
428            };
429            return {
430                width: Math.floor(imageWidth),
431                height: Math.floor(imageHeight),
432                containerHeight: Math.floor(pp_containerHeight),
433                containerWidth: Math.floor(pp_containerWidth) + (settings.horizontal_padding * 2),
434                contentHeight: Math.floor(pp_contentHeight),
435                contentWidth: Math.floor(pp_contentWidth),
436                resized: resized
437            };
438        };
439
440        function _getDimensions(width, height) {
441            width = parseFloat(width);
442            height = parseFloat(height);
443            $pp_details = $pp_pic_holder.find('.pp_details');
444            $pp_details.width(width);
445            detailsHeight = parseFloat($pp_details.css('marginTop')) + parseFloat($pp_details.css('marginBottom'));
446            $pp_details = $pp_details.clone().addClass(settings.theme).width(width).appendTo($('body')).css({
447                'position': 'absolute',
448                'top': -10000
449            });
450            detailsHeight += $pp_details.height();
451             detailsHeight = (detailsHeight <= 100) ? 130 : detailsHeight;
452            $pp_details.remove();
453            $pp_title = $pp_pic_holder.find('.ppt');
454            $pp_title.width(width);
455            titleHeight = parseFloat($pp_title.css('marginTop')) + parseFloat($pp_title.css('marginBottom'));
456            $pp_title = $pp_title.clone().appendTo($('body')).css({
457                'position': 'absolute',
458                'top': -10000
459            });
460            titleHeight += $pp_title.height();
461            $pp_title.remove();
462            pp_contentHeight = height + detailsHeight;
463            pp_contentWidth = width;
464            pp_containerHeight = pp_contentHeight + titleHeight + $pp_pic_holder.find('.pp_top').height() + $pp_pic_holder.find('.pp_bottom').height();
465            pp_containerWidth = width;
466        }
467
468        function _getFileType(itemSrc) {
469            if (itemSrc.match(/youtube\.com\/watch/i) || itemSrc.match(/youtu\.be/i)) {
470                return 'youtube';
471            } else if (itemSrc.match(/vimeo\.com/i)) {
472                return 'vimeo';
473            } else if (itemSrc.match(/\b.mov\b/i)) {
474                return 'quicktime';
475            } else if (itemSrc.match(/\b.swf\b/i)) {
476                return 'flash';
477            } else if (itemSrc.match(/\biframe=true\b/i)) {
478                return 'iframe';
479            } else if (itemSrc.match(/\bajax=true\b/i)) {
480                return 'ajax';
481            } else if (itemSrc.match(/\bcustom=true\b/i)) {
482                return 'custom';
483            } else if (itemSrc.substr(0, 1) == '#') {
484                return 'inline';
485            } else {
486                return 'image';
487            };
488        };
489
490        function _center_overlay() {
491            if (doresize && typeof $pp_pic_holder != 'undefined') {
492                scroll_pos = _get_scroll();
493                contentHeight = $pp_pic_holder.height(), contentwidth = $pp_pic_holder.width();
494                projectedTop = (windowHeight / 2) + scroll_pos['scrollTop'] - (contentHeight / 2);
495                if (projectedTop < 0) projectedTop = 0;
496                if (contentHeight > windowHeight)
497                    return;
498                $pp_pic_holder.css({
499                    'top': projectedTop,
500                    'left': (windowWidth / 2) + scroll_pos['scrollLeft'] - (contentwidth / 2)
501                });
502            };
503        };
504
505        function _get_scroll() {
506            if (self.pageYOffset) {
507                return {
508                    scrollTop: self.pageYOffset,
509                    scrollLeft: self.pageXOffset
510                };
511            } else if (document.documentElement && document.documentElement.scrollTop) {
512                return {
513                    scrollTop: document.documentElement.scrollTop,
514                    scrollLeft: document.documentElement.scrollLeft
515                };
516            } else if (document.body) {
517                return {
518                    scrollTop: document.body.scrollTop,
519                    scrollLeft: document.body.scrollLeft
520                };
521            };
522        };
523
524        function _resize_overlay() {
525            windowHeight = $(window).height(), windowWidth = $(window).width();
526            if (typeof $pp_overlay != "undefined") $pp_overlay.height($(document).height()).width(windowWidth);
527        };
528
529        function _insert_gallery() {
530            if (isSet && settings.overlay_gallery && _getFileType(pp_images[set_position]) == "image") {
531                itemWidth = 52 + 5;
532                navWidth = (settings.theme == "facebook" || settings.theme == "pp_default") ? 50 : 30;
533                itemsPerPage = Math.floor((pp_dimensions['containerWidth'] - 100 - navWidth) / itemWidth);
534                itemsPerPage = (itemsPerPage < pp_images.length) ? itemsPerPage : pp_images.length;
535                totalPage = Math.ceil(pp_images.length / itemsPerPage) - 1;
536                if (totalPage == 0) {
537                    navWidth = 0;
538                    $pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').hide();
539                } else {
540                    $pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').show();
541                };
542                galleryWidth = itemsPerPage * itemWidth;
543                fullGalleryWidth = pp_images.length * itemWidth;
544                $pp_gallery.css('margin-left', -((galleryWidth / 2) + (navWidth / 2))).find('div:first').width(galleryWidth + 5).find('ul').width(fullGalleryWidth).find('li.selected').removeClass('selected');
545                goToPage = (Math.floor(set_position / itemsPerPage) < totalPage) ? Math.floor(set_position / itemsPerPage) : totalPage;
546                $.prettyPhoto.changeGalleryPage(goToPage);
547                $pp_gallery_li.filter(':eq(' + set_position + ')').addClass('selected');
548            } else {
549                $pp_pic_holder.find('.pp_content').unbind('mouseenter mouseleave');
550            }
551        }
552
553        function _build_overlay(caller) {
554            if (settings.social_tools)
555                facebook_like_link = settings.social_tools.replace('{location_href}', encodeURIComponent(location.href));
556            settings.markup = settings.markup.replace('{pp_social}', '');
557            $('body').append(settings.markup);
558            $pp_pic_holder = $('.pp_pic_holder'), $ppt = $('.ppt'), $pp_overlay 
558= $('div.pp_overlay');
559            if (isSet && settings.overlay_gallery) {
560                currentGalleryPage = 0;
561                toInject = "";
562                for (var i = 0; i < pp_images.length; i++) {
563                    if (!pp_images[i].match(/\b(jpg|jpeg|png|gif)\b/gi)) {
564                        classname = 'default';
565                        img_src = '';
566                    } else {
567                        classname = '';
568                        img_src = pp_images[i];
569                    }
570                    toInject += "<li class='" + classname + "'><a href='#'><img src='" + img_src + "' width='50' alt='' /></a></li>";
571                };
572                toInject = settings.gallery_markup.replace(/{gallery}/g, toInject);
573                $pp_pic_holder.find('#pp_full_res').after(toInject);
574                $pp_gallery = $('.pp_pic_holder .pp_gallery'), $pp_gallery_li = $pp_gallery.find('li');
575                $pp_gallery.find('.pp_arrow_next').click(function() {
576                    $.prettyPhoto.changeGalleryPage('next');
577                    $.prettyPhoto.stopSlideshow();
578                    return false;
579                });
580                $pp_gallery.find('.pp_arrow_previous').click(function() {
581                    $.prettyPhoto.changeGalleryPage('previous');
582                    $.prettyPhoto.stopSlideshow();
583                    return false;
584                });
585                $pp_pic_holder.find('.pp_content').hover(function() {
586                    $pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn();
587                }, function() {
588                    $pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut();
589                });
590                itemWidth = 52 + 5;
591                $pp_gallery_li.each(function(i) {
592                    $(this).find('a').click(function() {
593                        $.prettyPhoto.changePage(i);
594                        $.prettyPhoto.stopSlideshow();
595                        return false;
596                    });
597                });
598            };
599            if (settings.slideshow) {
600                $pp_pic_holder.find('.pp_nav').prepend('<a href="#" class="pp_play">Play</a>')
601                $pp_pic_holder.find('.pp_nav .pp_play').click(function() {
602                    $.prettyPhoto.startSlideshow();
603                    return false;
604                });
605            }
606            $pp_pic_holder.attr('class', 'pp_pic_holder ' + settings.theme);
607            $pp_overlay.css({
608                'opacity': 0,
609                'height': $(document).height(),
610                'width': $(window).width()
611            }).bind('click', function() {
612                if (!settings.modal) $.prettyPhoto.close();
613            });
614            $('a.pp_close').bind('click', function() {
615                $.prettyPhoto.close();
616                return false;
617            });
618            if (settings.allow_expand) {
619                $('a.pp_expand').bind('click', function(e) {
620                    if ($(this).hasClass('pp_expand')) {
621                        $(this).removeClass('pp_expand').addClass('pp_contract');
622                        doresize = false;
623                    } else {
624                        $(this).removeClass('pp_contract').addClass('pp_expand');
625                        doresize = true;
626                    };
627                    _hideContent(function() {
628                        $.prettyPhoto.open();
629                    });
630                    return false;
631                });
632            }
633            $pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click', function() {
634                $.prettyPhoto.changePage('previous');
635                $.prettyPhoto.stopSlideshow();
636                return false;
637            });
638            $pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click', function() {
639                $.prettyPhoto.changePage('next');
640                $.prettyPhoto.stopSlideshow();
641                return false;
642            });
643            _center_overlay();
644        };
645        if (!pp_alreadyInitialized && getHashtag()) {
646            pp_alreadyInitialized = true;
647            hashIndex = getHashtag();
648            hashRel = hashIndex;
649            hashIndex = hashIndex.substring(hashIndex.indexOf('/') + 1, hashIndex.length - 1);
650            hashRel = hashRel.substring(0, hashRel.indexOf('/'));
651            setTimeout(function() {
652                $("a[" + pp_settings.hook + "^='" + hashRel + "']:eq(" + hashIndex + ")").trigger('click');
653            }, 50);
654        }
655        return this.unbind('click.prettyphoto').bind('click.prettyphoto', $.prettyPhoto.initialize);
656    };
657
658    function getHashtag() {
659        var url = location.href;
660        hashtag = (url.indexOf('#prettyPhoto') !== -1) ? decodeURI(url.substring(url.indexOf('#prettyPhoto') + 1, url.length)) : false;
661        if (hashtag) {
662            hashtag = hashtag.replace(/<|>/g, '');
663        }
664        return hashtag;
665    };
666
667    function setHashtag() {
668        if (typeof theRel == 'undefined') return;
669        location.hash = theRel + '/' + rel_index + '/';
670    };
671
672    function clearHashtag() {
673        if (location.href.indexOf('#prettyPhoto') !== -1) location.hash = "prettyPhoto";
674    }
675
676    function getParam(name, url) {
677        name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
678        var regexS = "[\\?&]" + name + "=([^&#]*)";
679        var regex = new RegExp(regexS);
680        var results = regex.exec(url);
681        return (results == null) ? "" : results[1];
682    }
683})(jQuery);
684var pp_alreadyInitialized = false;
685
686
687jQuery(document).ready(function ($) {
688    $("a[data-rel^='prettyPhoto']").prettyPhoto({
689        autoplay: false,
690        deeplinking: false,
691        animation_speed: 'fast',
692        /* fast/slow/normal */
693        slideshow: 5000,
694        /* false OR interval time in ms */
695        autoplay_slideshow: false,
696        /* true/false */
697        opacity: 0.8,
698        /* Value between 0 and 1 */
699        show_title: true,
700        /* true/false */
701        allow_resize: true,
702        /* Resize the photos bigger than viewport. true/false */
703        default_width: 500,
704        default_height: 344,
705        counter_separator_label: '/',
706        /* The separator for the gallery counter 1 "of" 2 */
707        theme: 'pp_default',
708        /* light_rounded / dark_rounded / light_square / dark_square / facebook */
709        horizontal_padding: 20,
710        /* The padding on each side of the picture */
711        overlay_gallery: true,
712        /* If set to true, a gallery will overlay the fullscreen image on mouse over */
713        keyboard_shortcuts: true,
714        /* Set to false if you open forms inside prettyPhoto */
715        social_tools: false
716    });
717
718
719});

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.