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