PageSourceSearch

http://taldis.ru/lib/js/jquery/lib/jquery.prettyPhoto.js

js taldis.ru collected 2026-10-05 00:35:04 UTC 25,109 bytes, 671 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: 2.5.6
6------------------------------------------------------------------------- */
7
8(function($) {
9	$.prettyPhoto = {version: '2.5.6'};
10
11	$.fn.prettyPhoto = function(settings) {
12		settings = jQuery.extend({
13			animationSpeed: 'normal', /* fast/slow/normal */
14			opacity: 0.80, /* Value between 0 and 1 */
15			showTitle: true, /* true/false */
16			allowresize: true, /* true/false */
17			default_width: 500,
18			default_height: 344,
19			startFrom: 0,
20			counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
21			theme: 'light_rounded', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
22			hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
23			wmode: 'opaque', /* Set the flash wmode attribute */
24			autoplay: true, /* Automatically start videos: True/False */
25			modal: false, /* If set to true, only the close button will close the window */
26			changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
27			callback: function(){}, /* Called when prettyPhoto is closed */
28			markup: '<div class="pp_pic_holder"> \
29						<div class="pp_top"> \
30							<div class="pp_left"></div> \
31							<div class="pp_middle"></div> \
32							<div class="pp_right"></div> \
33						</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 clearfix"> \
47											<a class="pp_close" href="#">Close</a> \
48											<p class="pp_description"></p> \
49											<div class="pp_nav"> \
50												<a href="#" class="pp_arrow_previous">Previous</a> \
51												<p class="currentTextHolder">0/0</p> \
52												<a href="#" class="pp_arrow_next">Next</a> \
53											</div> \
54										</div> \
55									</div> \
56								</div> \
57							</div> \
58							</div> \
59						</div> \
60						<div class="pp_bottom"> \
61							<div class="pp_left"></div> \
62							<div class="pp_middle"></div> \
63							<div class="pp_right"></div> \
64						</div> \
65					</div> \
66					<div class="pp_overlay"></div> \
67					<div class="ppt"></div>',
68			image_markup: '<img id="fullResImage" src="" />',
69			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>',
70			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>',
71			iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',
72			inline_markup: '<div class="pp_inline clearfix">{content}</div>'
73		}, settings);
74
75		// Fallback to a supported theme for IE6
76		if($.browser.msie && parseInt($.browser.version) == 6){
77			settings.theme = "light_square";
78		}
79
80		if($('.pp_overlay').size()==0) _buildOverlay(); // If the overlay is not there, inject it!
81
82		// Global variables accessible only by prettyPhoto
83		var doresize = true, percentBased = false, correctSizes,
84
85		// Cached selectors
86		$pp_pic_holder, $ppt, $pp_overlay,
87
88		// prettyPhoto container specific
89		pp_contentHeight, pp_contentWidth, pp_containerHeight, pp_containerWidth,
90
91		// Window size
92		windowHeight = $(window).height(), windowWidth = $(window).width(),
93
94		//Gallery specific
95		setPosition = 0,
96
97		// Global elements
98		scrollPos = _getScroll();
99
100		// Window/Keyboard events
101		$(window).scroll(function(){ scrollPos = _getScroll(); _centerOverlay(); _resizeOverlay(); });
102		$(window).resize(function(){ _centerOverlay(); _resizeOverlay(); });
103		$(document).keydown(function(e){
104			if($pp_pic_holder.is(':visible'))
105			switch(e.keyCode){
106				case 37:
107					$.prettyPhoto.changePage('previous');
108					break;
109				case 39:
110					$.prettyPhoto.changePage('next');
111					break;
112				case 27:
113					if(!settings.modal)
114					$.prettyPhoto.close();
115					break;
116			};
117	    });
118
119		// Bind the code to each links
120		$(this).each(function(){
121			$(this).bind('click',function(){
122				_self = this; // Fix scoping
123
124				// Find out if the picture is part of a set
125				theRel = $(this).attr('rel');
126				galleryRegExp = /\[(?:.*)\]/;
127				theGallery = galleryRegExp.exec(theRel);
128
129				// Build the gallery array
130				var images = new Array(), titles = new Array(), descriptions = new Array();
131				if(theGallery){
132					$('a[rel*='+theGallery+']').each(function(i){
133						if($(this)[0] === $(_self)[0]) setPosition = settings.startFrom + i; // Get the position in the set
134						images.push($(this).attr('href'));
135						titles.push($(this).find('img').attr('alt'));
136						descriptions.push($(this).attr('title'));
137					});
138				}else{
139					images = $(this).attr('href');
140					titles = ($(this).find('img').attr('alt')) ?  $(this).find('img').attr('alt') : '';
141					descriptions = ($(this).attr('title')) ?  $(this).attr('title') : '';
142				}
143
144				$.prettyPhoto.open(images,titles,descriptions);
145				return false;
146			});
147		});
148
149
150		/**
151		* Opens the prettyPhoto modal box.
152		* @param image {String,Array} Full path to the image to be open, can also be an array containing full images paths.
153		* @param title {String,Array} The title to be displayed with the picture, can also be an array containing all the titles.
154		* @param description {String,Array} The description to be displayed with the picture, can also be an array containing all the descriptions.
155		*/
156		$.prettyPhoto.open = function(gallery_images,gallery_titles,gallery_descriptions) {
157			// To fix the bug with IE select boxes
158			if($.browser.msie && $.browser.version == 6){
159				$('select').css('visibility','hidden');
160			};
161
162			if(settings.hideflash) $('object,embed').css('visibility','hidden'); // Hide the flash
163
164			// Convert everything to an array in the case it's a single item
165			images = $.makeArray(gallery_images);
166			titles = $.makeArray(gallery_titles);
167			descriptions = $.makeArray(gallery_descriptions);
168
169			image_set = ($(images).size() > 0) ?  true : false; // Find out if it's a set
170
171			// Hide the next/previous links if on first or last images.
172			_checkPosition($(images).size());
173
174			$('.pp_loaderIcon').show(); // Do I need to explain?
175
176			// Fade the content in
177			$pp_overlay.show().fadeTo(settings.animationSpeed,settings.opacity);
178
179			// Display the current position
180			$pp_pic_holder.find('.currentTextHolder').text((setPosition+1) + settings.counter_separator_label + $(images).size());
181
182			// Set the description
183			if(descriptions[setPosition]){
184				$pp_pic_holder.find('.pp_description').show().html(unescape(descriptions[setPosition]));
185			}else{
186				$pp_pic_holder.find('.pp_description').hide().text('');
187			};
188
189			// Set the title
190			if(titles[setPosition] && settings.showTitle){
191				hasTitle = true;
192				$ppt.html(unescape(titles[setPosition]));
193			}else{
194				hasTitle = false;
195			};
196
197			// Get the dimensions
198			movie_width = ( parseFloat(grab_param('width',images[setPosition])) ) ? grab_param('width',images[setPosition]) : settings.default_width.toString();
199			movie_height = ( parseFloat(grab_param('height',images[setPosition])) ) ? grab_param('height',images[setPosition]) : settings.default_height.toString();
200
201			// If the size is % based, calculate according to window dimensions
202			if(movie_width.indexOf('%') != -1 || movie_height.indexOf('%') != -1){
203				movie_height = parseFloat(($(window).height() * parseFloat(movie_height) / 100) - 100);
204				movie_width = parseFloat(($(window).width() * parseFloat(movie_width) / 100) - 100);
205				percentBased = true;
206			}
207
208			// Fade the holder
209			$pp_pic_holder.fadeIn(function(){
210				imgPreloader = "";
211				// Inject the proper content
212				switch(_getFileType(images[setPosition])){
213					case 'image':
214						// Set the new image
215						imgPreloader = new Image();
216
217						// Preload the neighbour images
218						nextImage = new Image();
219						if(image_set && setPosition > $(images).size()) nextImage.src = images[setPosition + 1];
220						prevImage = new Image();
221						if(image_set && images[setPosition - 1]) prevImage.src = images[setPosition - 1];
222
223						$pp_pic_holder.find('#pp_full_res')[0].innerHTML = settings.image_markup;
224						$pp_pic_holder.find('#fullResImage').attr('src',images[setPosition]);
225
226						imgPreloader.onload = function(){
227							// Fit item to viewport
228							correctSizes = _fitToViewport(imgPreloader.width,imgPreloader.height);
229
230							_showContent();
231						};
232
233						imgPreloader.onerror = function(){
234							alert('Image cannot be loaded. Make sure the path is correct and image exist.');
235							$.prettyPhoto.close();
236						};
237
238						imgPreloader.src = images[setPosition];
239					break;
240
241					case 'youtube':
242						correctSizes = _fitToViewport(movie_width,movie_height); // Fit item to viewport
243
244						movie = 'http://www.youtube.com/v/'+grab_param('v',images[setPosition]);
245						if(settings.autoplay) movie += "&autoplay=1";
246
247						toInject = settings.flash_markup.replace(/{width}/g,correctSizes['width']).replace(/{height}/g,correctSizes['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);
248					break;
249
250					case 'vimeo':
251						correctSizes = _fitToViewport(movie_width,movie_height); // Fit item to viewport
252
253						movie_id = images[setPosition];
254						movie = 'http://vimeo.com/moogaloop.swf?clip_id='+ movie_id.replace('http://vimeo.com/','');
255						if(settings.autoplay) movie += "&autoplay=1";
256
257						toInject = settings.flash_markup.replace(/{width}/g,correctSizes['width']).replace(/{height}/g,correctSizes['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);
258					break;
259
260					case 'quicktime':
261						correctSizes = _fitToViewport(movie_width,movie_height); // Fit item to viewport
262						correctSizes['height']+=15; correctSizes['contentHeight']+=15; correctSizes['containerHeight']+=15; // Add space for the control bar
263
264						toInject = settings.quicktime_markup.replace(/{width}/g,correctSizes['width']).replace(/{height}/g,correctSizes['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}
264/g,images[setPosition]).replace(/{autoplay}/g,settings.autoplay);
265					break;
266
267					case 'flash':
268						correctSizes = _fitToViewport(movie_width,movie_height); // Fit item to viewport
269
270						flash_vars = images[setPosition];
271						flash_vars = flash_vars.substring(images[setPosition].indexOf('flashvars') + 10,images[setPosition].length);
272
273						filename = images[setPosition];
274						filename = filename.substring(0,filename.indexOf('?'));
275
276						toInject =  settings.flash_markup.replace(/{width}/g,correctSizes['width']).replace(/{height}/g,correctSizes['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+'?'+flash_vars);
277					break;
278
279					case 'flash_video':
280						correctSizes = _fitToViewport(movie_width,movie_height); // Fit item to viewport
281
282						flash_vars = images[setPosition];
283						flash_vars = flash_vars.substring(images[setPosition].indexOf('flashvars') + 10,images[setPosition].length);
284
285						filename = images[setPosition];
286						filename = filename.substring(0,filename.indexOf('?'));
287
288						toInject =  settings.flash_markup.replace(/{width}/g,correctSizes['width']).replace(/{height}/g,correctSizes['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+'?'+flash_vars);
289					break;
290
291					case 'iframe':
292						correctSizes = _fitToViewport(movie_width,movie_height); // Fit item to viewport
293
294						frame_url = images[setPosition];
295						frame_url = frame_url.substr(0,frame_url.indexOf('iframe')-1);
296
297						toInject = settings.iframe_markup.replace(/{width}/g,correctSizes['width']).replace(/{height}/g,correctSizes['height']).replace(/{path}/g,frame_url);
298					break;
299
300					case 'inline':
301						// to get the item height clone it, apply default width, wrap it in the prettyPhoto containers , then delete
302						myClone = $(images[setPosition]).clone().css({'width':settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline clearfix"></div></div>').appendTo($('body'));
303						correctSizes = _fitToViewport($(myClone).width(),$(myClone).height());
304						$(myClone).remove();
305						toInject = settings.inline_markup.replace(/{content}/g,$(images[setPosition]).html());
306					break;
307				};
308
309				if(!imgPreloader){
310					$pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject;
311
312					// Show content
313					_showContent();
314				};
315			});
316
317		};
318
319		/**
320		* Change page in the prettyPhoto modal box
321		* @param direction {String} Direction of the paging, previous or next.
322		*/
323		$.prettyPhoto.changePage = function(direction){
324			if(direction == 'previous') {
325				setPosition--;
326				if (setPosition < 0){
327					setPosition = 0;
328					return;
329				};
330			}else{
331				if($('.pp_arrow_next').is('.disabled')) return;
332				setPosition++;
333			};
334
335			// Allow the resizing of the images
336			if(!doresize) doresize = true;
337
338			_hideContent(function(){$.prettyPhoto.open(images,titles,descriptions)});
339			$('a.pp_expand,a.pp_contract').fadeOut(settings.animationSpeed);
340		};
341
342		/**
343		* Closes the prettyPhoto modal box.
344		*/
345		$.prettyPhoto.close = function(){
346			$pp_pic_holder.find('object,embed').css('visibility','hidden');
347
348			$('div.pp_pic_holder,div.ppt,.pp_fade').fadeOut(settings.animationSpeed);
349
350			$pp_overlay.fadeOut(settings.animationSpeed, function(){
351				$('#pp_full_res').html(''); // Kill the opened content
352
353				$pp_pic_holder.attr('style','').find('div:not(.pp_hoverContainer)').attr('style',''); // Reset the width and everything that has been set.
354				_centerOverlay(); // Center it
355
356				// To fix the bug with IE select boxes
357				if($.browser.msie && $.browser.version == 6){
358					$('select').css('visibility','visible');
359				};
360
361				// Show the flash
362				if(settings.hideflash) $('object,embed').css('visibility','visible');
363
364				setPosition = 0;
365				settings.callback();
366			});
367			doresize = true;
368		};
369
370		/**
371		* Set the proper sizes on the containers and animate the content in.
372		*/
373		_showContent = function(){
374			$('.pp_loaderIcon').hide();
375
376			// Calculate the opened top position of the pic holder
377			projectedTop = scrollPos['scrollTop'] + ((windowHeight/2) - (correctSizes['containerHeight']/2));
378			if(projectedTop < 0) projectedTop = 0 + $ppt.height();
379
380			// Resize the content holder
381			$pp_pic_holder.find('.pp_content').animate({'height':correctSizes['contentHeight']},settings.animationSpeed);
382
383			// Resize picture the holder
384			$pp_pic_holder.animate({
385				'top': projectedTop,
386				'left': (windowWidth/2) - (correctSizes['containerWidth']/2),
387				'width': correctSizes['containerWidth']
388			},settings.animationSpeed,function(){
389				$pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(correctSizes['height']).width(correctSizes['width']);
390
391				// Fade the new image
392				$pp_pic_holder.find('.pp_fade').fadeIn(settings.animationSpeed);
393
394				// Show the nav
395				if(image_set && _getFileType(images[setPosition])=="image") { $pp_pic_holder.find('.pp_hoverContainer').show(); }else{ $pp_pic_holder.find('.pp_hoverContainer').hide(); }
396
397				// Show the title
398				if(settings.showTitle && hasTitle){
399					$ppt.css({
400						'top' : $pp_pic_holder.offset().top - 25,
401						'left' : $pp_pic_holder.offset().left + 20,
402						'display' : 'none'
403					});
404
405					$ppt.fadeIn(settings.animationSpeed);
406				};
407
408				// Fade the resizing link if the image is resized
409				if(correctSizes['resized']) $('a.pp_expand,a.pp_contract').fadeIn(settings.animationSpeed);
410
411				// Callback!
412				settings.changepicturecallback();
413			});
414		};
415
416		/**
417		* Hide the content...DUH!
418		*/
419		function _hideContent(callback){
420			// Fade out the current picture
421			$pp_pic_holder.find('#pp_full_res object,#pp_full_res embed').css('visibility','hidden');
422			$pp_pic_holder.find('.pp_fade').fadeOut(settings.animationSpeed,function(){
423				$('.pp_loaderIcon').show();
424
425				if(callback) callback();
426			});
427
428			// Hide the title
429			$ppt.fadeOut(settings.animationSpeed);
430		}
431
432		/**
433		* Check the item position in the gallery array, hide or show the navigation links
434		* @param setCount {integer} The total number of items in the set
435		*/
436		function _checkPosition(setCount){
437			// If at the end, hide the next link
438			if(setPosition == setCount-1) {
439				$pp_pic_holder.find('a.pp_next').css('visibility','hidden');
440				$pp_pic_holder.find('a.pp_arrow_next').addClass('disabled').unbind('click');
441			}else{
442				$pp_pic_holder.find('a.pp_next').css('visibility','visible');
443				$pp_pic_holder.find('a.pp_arrow_next.disabled').removeClass('disabled').bind('click',function(){
444					$.prettyPhoto.changePage('next');
445					return false;
446				});
447			};
448
449			// If at the beginning, hide the previous link
450			if(setPosition == 0) {
451				$pp_pic_holder.find('a.pp_previous').css('visibility','hidden');
452				$pp_pic_holder.find('a.pp_arrow_previous').addClass('disabled').unbind('click');
453			}else{
454				$pp_pic_holder.find('a.pp_previous').css('visibility','visible');
455				$pp_pic_holder.find('a.pp_arrow_previous.disabled').removeClass('disabled').bind('click',function(){
456					$.prettyPhoto.changePage('previous');
457					return false;
458				});
459			};
460
461			// Hide the bottom nav if it's not a set.
462			if(setCount > 1) {
463				$('.pp_nav').show();
464			}else{
465				$('.pp_nav').hide();
466			}
467		};
468
469		/**
470		* Resize the item dimensions if it's bigger than the viewport
471		* @param width {integer} Width of the item to be opened
472		* @param height {integer} Height of the item to be opened
473		* @return An array containin the "fitted" dimensions
474		*/
475		function _fitToViewport(width,height){
476			hasBeenResized = false;
477
478			_getDimensions(width,height);
479
480			// Define them in case there's no resize needed
481			imageWidth = width;
482			imageHeight = height;
483
484			if( ((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)) && doresize && settings.allowresize && !percentBased) {
485				hasBeenResized = true;
486				notFitting = true;
487
488				while (notFitting){
489					if((pp_containerWidth > windowWidth)){
490						imageWidth = (windowWidth - 200);
491						imageHeight = (height/width) * imageWidth;
492					}else if((pp_containerHeight > windowHeight)){
493						imageHeight = (windowHeight - 200);
494						imageWidth = (width/height) * imageHeight;
495					}else{
496						notFitting = false;
497					};
498
499					pp_containerHeight = imageHeight;
500					pp_containerWidth = imageWidth;
501				};
502
503				_getDimensions(imageWidth,imageHeight);
504			};
505
506			return {
507				width:Math.floor(imageWidth),
508				height:Math.floor(imageHeight),
509				containerHeight:Math.floor(pp_containerHeight),
510				containerWidth:Math.floor(pp_containerWidth) + 40,
511				contentHeight:Math.floor(pp_contentHeight),
512				contentWidth:Math.floor(pp_contentWidth),
513				resized:hasBeenResized
514			};
515		};
516
517		/**
518		* Get the containers dimensions according to the item size
519		* @param width {integer} Width of the item to be opened
520		* @param height {integer} Height of the item to be opened
521		*/
522		function _getDimensions(width,height){
523			width = parseFloat(width);
524			height = parseFloat(height);
525
526			// Get the details height, to do so, I need to clone it since it's invisible
527			$pp_details = $pp_pic_holder.find('.pp_details');
528			$pp_details.width(width);
529			detailsHeight = parseFloat($pp_details.css('marginTop')) + parseFloat($pp_details.css('marginBottom'));
530			$pp_details = $pp_details.clone().appendTo($('body')).css({
531				'position':'absolute',
532				'top':-10000
533			});
534			detailsHeight += $pp_details.height();
535			detailsHeight = (detailsHeight <= 34) ? 36 : detailsHeight; // Min-height for the details
536			if($.browser.msie && $.browser.version==7) detailsHeight+=8;
537			$pp_details.remove();
538
539			// Get the container size, to resize the holder to the right dimensions
540			pp_contentHeight = height + detailsHeight;
541			pp_contentWidth = width;
542			pp_containerHeight = pp_contentHeight + $ppt.height() + $pp_pic_holder.find('.pp_top').height() + $pp_pic_holder.find('.pp_bottom').height();
543			pp_containerWidth = width;
544		}
545
546		function _getFileType(itemSrc){
547			if (itemSrc.match(/youtube\.com\/watch/i)) {
548				return 'youtube';
549			}else if (itemSrc.match(/vimeo\.com/i)) {
550				return 'vimeo';
551			}else if(itemSrc.indexOf('.mov') != -1){
552				return 'quicktime';
553			}else if(itemSrc.indexOf('.swf') != -1){
554				return 'flash';
555			}else if(itemSrc.indexOf('.flv') != -1){
556				return 'flash_video';
557			}else if(itemSrc.indexOf('iframe') != -1){
558				return 'iframe'
559			}else if(itemSrc.substr(0,1) == '#'){
560				return 'inline';
561			}else{
562				return 'image';
563			};
564		};
565
566		function _centerOverlay(){
567			if(doresize) {
568				titleHeight = $ppt.height();
569				contentHeight = $pp_pic_holder.height();
570				contentwidth = $pp_pic_holder.width();
571
572				projectedTop = (windowHeight/2) + scrollPos['scrollTop'] - ((contentHeight+titleHeight)/2);
573
574				$pp_pic_holder.css({
575					'top': projectedTop,
576					'left': (windowWidth/2) + scrollPos['scrollLeft'] - (contentwidth/2)
577				});
578
579				$ppt.css({
580					'top' : projectedTop - titleHeight,
581					'left': (windowWidth/2) + scrollPos['scrollLeft'] - (contentwidth/2) + 20
582				});
583			};
584		};
585
586		function _getScroll(){
587			if (self.pageYOffset) {
588				return {scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset};
589			} else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
590				return {scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft};
591			} else if (document.body) {// all other Explorers
592				return {scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft};
593			};
594		};
595
596		function _resizeOverlay() {
597			windowHeight = $(window).height();
598			windowWidth = $(window).width();
599
600			$pp_overlay.css({
601				'height':$(document).height()
602			});
603		};
604
605		function _buildOverlay(){
606			// Inject the markup
607			$('body').append(settings.markup);
608
609			// Set my global selectors
610			$pp_pic_holder = $('.pp_pic_holder');
611			$ppt = $('.ppt');
612			$pp_overlay = $('div.pp_overlay');
613
614			$pp_pic_holder.attr('class','pp_pic_holder ' + settings.theme); // Set the proper theme
615
616			$pp_overlay
617				.css({
618					'opacity':0,
619					'height':$(document).height()
620					})
621				.bind('click',function(){
622					if(!settings.modal)
623					$.prettyPhoto.close();
624				});
625
626			$('a.pp_close').bind('click',function(){ $.prettyPhoto.close(); return false; });
627
628			$('a.pp_expand').bind('click',function(){
629				$this = $(this); // Fix scoping
630
631				// Expand the image
632				if($this.hasClass('pp_expand')){
633					$this.removeClass('pp_expand').addClass('pp_contract');
634					doresize = false;
635				}else{
636					$this.removeClass('pp_contract').addClass('pp_expand');
637					doresize = true;
638				};
639
640				_hideContent(function(){ $.prettyPhoto.open(images,titles,descriptions) });
641
642				$pp_pic_holder.find('.pp_fade').fadeOut(settings.animationSpeed);
643
644				return false;
645			});
646
647			$pp_pic_holder.find('.pp_previous, .pp_arrow_previous').bind('click',function(){
648				$.prettyPhoto.changePage('previous');
649				return false;
650			});
651
652			$pp_pic_holder.find('.pp_next, .pp_arrow_next').bind('click',function(){
653				$.prettyPhoto.changePage('next');
654				return false;
655			});
656		};
657
658		_centerOverlay(); // Center it
659	};
660
661	function grab_param(name,url){
662	  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
663	  var regexS = "[\\?&]"+name+"=([^&#]*)";
664	  var regex = new RegExp( regexS );
665	  var results = regex.exec( url );
666	  if( results == null )
667	    return "";
668	  else
669	    return results[1];
670	}
671})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.