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