Version Description
- Fix: jQuery prettyPhoto DOM Cross-Site Scripting (XSS) vulnerability
- Tweak: Added regex filetype check before applying lightbox selector to gallery links.
- Tweak: Switched from wp_generate_password() to custom function, without needless DB call.
Download this release
Release Info
Developer | dfactory |
Plugin | Responsive Lightbox & Gallery |
Version | 1.4.12 |
Comparing to | |
See all releases |
Code changes from version 1.4.11 to 1.4.12
- assets/prettyphoto/js/jquery.prettyPhoto.js +906 -2
- assets/swipebox/lib/ios-orientationchange-fix.js +0 -56
- assets/swipebox/source/img/icons.png +0 -0
- assets/swipebox/source/img/icons.svg +0 -1
- assets/swipebox/source/img/loader.gif +0 -0
- assets/swipebox/source/jquery.swipebox.js +0 -451
- assets/swipebox/source/jquery.swipebox.min.js +0 -1
- assets/swipebox/source/swipebox.css +0 -223
- readme.txt +8 -5
- responsive-lightbox.php +29 -12
assets/prettyphoto/js/jquery.prettyPhoto.js
CHANGED
@@ -2,6 +2,910 @@
|
|
2 |
Class: prettyPhoto
|
3 |
Use: Lightbox clone for jQuery
|
4 |
Author: Stephane Caron (http://www.no-margin-for-errors.com)
|
5 |
-
Version: 3.1.
|
6 |
------------------------------------------------------------------------- */
|
7 |
-
(function(e){function t(){var e=location.href;hashtag=e.indexOf("#prettyPhoto")!==-1?decodeURI(e.substring(e.indexOf("#prettyPhoto")+1,e.length)):false;return hashtag}function n(){if(typeof theRel=="undefined")return;location.hash=theRel+"/"+rel_index+"/"}function r(){if(location.href.indexOf("#prettyPhoto")!==-1)location.hash="prettyPhoto"}function i(e,t){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var n="[\\?&]"+e+"=([^&#]*)";var r=new RegExp(n);var i=r.exec(t);return i==null?"":i[1]}e.prettyPhoto={version:"3.1.5"};e.fn.prettyPhoto=function(s){function g(){e(".pp_loaderIcon").hide();projectedTop=scroll_pos["scrollTop"]+(d/2-a["containerHeight"]/2);if(projectedTop<0)projectedTop=0;$ppt.fadeTo(settings.animation_speed,1);$pp_pic_holder.find(".pp_content").animate({height:a["contentHeight"],width:a["contentWidth"]},settings.animation_speed);$pp_pic_holder.animate({top:projectedTop,left:v/2-a["containerWidth"]/2<0?0:v/2-a["containerWidth"]/2,width:a["containerWidth"]},settings.animation_speed,function(){$pp_pic_holder.find(".pp_hoverContainer,#fullResImage").height(a["height"]).width(a["width"]);$pp_pic_holder.find(".pp_fade").fadeIn(settings.animation_speed);if(isSet&&S(pp_images[set_position])=="image"){$pp_pic_holder.find(".pp_hoverContainer").show()}else{$pp_pic_holder.find(".pp_hoverContainer").hide()}if(settings.allow_expand){if(a["resized"]){e("a.pp_expand,a.pp_contract").show()}else{e("a.pp_expand").hide()}}if(settings.autoplay_slideshow&&!m&&!f)e.prettyPhoto.startSlideshow();settings.changepicturecallback();f=true});C();s.ajaxcallback()}function y(t){$pp_pic_holder.find("#pp_full_res object,#pp_full_res embed").css("visibility","hidden");$pp_pic_holder.find(".pp_fade").fadeOut(settings.animation_speed,function(){e(".pp_loaderIcon").show();t()})}function b(t){t>1?e(".pp_nav").show():e(".pp_nav").hide()}function w(e,t){resized=false;E(e,t);imageWidth=e,imageHeight=t;if((p>v||h>d)&&doresize&&settings.allow_resize&&!u){resized=true,fitting=false;while(!fitting){if(p>v){imageWidth=v-200;imageHeight=t/e*imageWidth}else if(h>d){imageHeight=d-200;imageWidth=e/t*imageHeight}else{fitting=true}h=imageHeight,p=imageWidth}if(p>v||h>d){w(p,h)}E(imageWidth,imageHeight)}return{width:Math.floor(imageWidth),height:Math.floor(imageHeight),containerHeight:Math.floor(h),containerWidth:Math.floor(p)+settings.horizontal_padding*2,contentHeight:Math.floor(l),contentWidth:Math.floor(c),resized:resized}}function E(t,n){t=parseFloat(t);n=parseFloat(n);$pp_details=$pp_pic_holder.find(".pp_details");$pp_details.width(t);detailsHeight=parseFloat($pp_details.css("marginTop"))+parseFloat($pp_details.css("marginBottom"));$pp_details=$pp_details.clone().addClass(settings.theme).width(t).appendTo(e("body")).css({position:"absolute",top:-1e4});detailsHeight+=$pp_details.height();detailsHeight=detailsHeight<=34?36:detailsHeight;$pp_details.remove();$pp_title=$pp_pic_holder.find(".ppt");$pp_title.width(t);titleHeight=parseFloat($pp_title.css("marginTop"))+parseFloat($pp_title.css("marginBottom"));$pp_title=$pp_title.clone().appendTo(e("body")).css({position:"absolute",top:-1e4});titleHeight+=$pp_title.height();$pp_title.remove();l=n+detailsHeight;c=t;h=l+titleHeight+$pp_pic_holder.find(".pp_top").height()+$pp_pic_holder.find(".pp_bottom").height();p=t}function S(e){if(e.match(/youtube\.com\/watch/i)||e.match(/youtu\.be/i)){return"youtube"}else if(e.match(/vimeo\.com/i)){return"vimeo"}else if(e.match(/\b.mov\b/i)){return"quicktime"}else if(e.match(/\b.swf\b/i)){return"flash"}else if(e.match(/\biframe=true\b/i)){return"iframe"}else if(e.match(/\bajax=true\b/i)){return"ajax"}else if(e.match(/\bcustom=true\b/i)){return"custom"}else if(e.substr(0,1)=="#"){return"inline"}else{return"image"}}function x(){if(doresize&&typeof $pp_pic_holder!="undefined"){scroll_pos=T();contentHeight=$pp_pic_holder.height(),contentwidth=$pp_pic_holder.width();projectedTop=d/2+scroll_pos["scrollTop"]-contentHeight/2;if(projectedTop<0)projectedTop=0;if(contentHeight>d)return;$pp_pic_holder.css({top:projectedTop,left:v/2+scroll_pos["scrollLeft"]-contentwidth/2})}}function T(){if(self.pageYOffset){return{scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset}}else if(document.documentElement&&document.documentElement.scrollTop){return{scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft}}else if(document.body){return{scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft}}}function N(){d=e(window).height(),v=e(window).width();if(typeof $pp_overlay!="undefined")$pp_overlay.height(e(document).height()).width(v)}function C(){if(isSet&&settings.overlay_gallery&&S(pp_images[set_position])=="image"){itemWidth=52+5;navWidth=settings.theme=="facebook"||settings.theme=="pp_default"?50:30;itemsPerPage=Math.floor((a["containerWidth"]-100-navWidth)/itemWidth);itemsPerPage=itemsPerPage<pp_images.length?itemsPerPage:pp_images.length;totalPage=Math.ceil(pp_images.length/itemsPerPage)-1;if(totalPage==0){navWidth=0;$pp_gallery.find(".pp_arrow_next,.pp_arrow_previous").hide()}else{$pp_gallery.find(".pp_arrow_next,.pp_arrow_previous").show()}galleryWidth=itemsPerPage*itemWidth;fullGalleryWidth=pp_images.length*itemWidth;$pp_gallery.css("margin-left",-(galleryWidth/2+navWidth/2)).find("div:first").width(galleryWidth+5).find("ul").width(fullGalleryWidth).find("li.selected").removeClass("selected");goToPage=Math.floor(set_position/itemsPerPage)<totalPage?Math.floor(set_position/itemsPerPage):totalPage;e.prettyPhoto.changeGalleryPage(goToPage);$pp_gallery_li.filter(":eq("+set_position+")").addClass("selected")}else{$pp_pic_holder.find(".pp_content").unbind("mouseenter mouseleave")}}function k(t){if(settings.social_tools)facebook_like_link=settings.social_tools.replace("{location_href}",encodeURIComponent(location.href));settings.markup=settings.markup.replace("{pp_social}","");e("body").append(settings.markup);$pp_pic_holder=e(".pp_pic_holder"),$ppt=e(".ppt"),$pp_overlay=e("div.pp_overlay");if(isSet&&settings.overlay_gallery){currentGalleryPage=0;toInject="";for(var n=0;n<pp_images.length;n++){if(!pp_images[n].match(/\b(jpg|jpeg|png|gif)\b/gi)){classname="default";img_src=""}else{classname="";img_src=pp_images[n]}toInject+="<li class='"+classname+"'><a href='#'><img src='"+img_src+"' width='50' alt='' /></a></li>"}toInject=settings.gallery_markup.replace(/{gallery}/g,toInject);$pp_pic_holder.find("#pp_full_res").after(toInject);$pp_gallery=e(".pp_pic_holder .pp_gallery"),$pp_gallery_li=$pp_gallery.find("li");$pp_gallery.find(".pp_arrow_next").click(function(){e.prettyPhoto.changeGalleryPage("next");e.prettyPhoto.stopSlideshow();return false});$pp_gallery.find(".pp_arrow_previous").click(function(){e.prettyPhoto.changeGalleryPage("previous");e.prettyPhoto.stopSlideshow();return false});$pp_pic_holder.find(".pp_content").hover(function(){$pp_pic_holder.find(".pp_gallery:not(.disabled)").fadeIn()},function(){$pp_pic_holder.find(".pp_gallery:not(.disabled)").fadeOut()});itemWidth=52+5;$pp_gallery_li.each(function(t){e(this).find("a").click(function(){e.prettyPhoto.changePage(t);e.prettyPhoto.stopSlideshow();return false})})}if(settings.slideshow){$pp_pic_holder.find(".pp_nav").prepend('<a href="#" class="pp_play">Play</a>');$pp_pic_holder.find(".pp_nav .pp_play").click(function(){e.prettyPhoto.startSlideshow();return false})}$pp_pic_holder.attr("class","pp_pic_holder "+settings.theme);$pp_overlay.css({opacity:0,height:e(document).height(),width:e(window).width()}).bind("click",function(){if(!settings.modal)e.prettyPhoto.close()});e("a.pp_close").bind("click",function(){e.prettyPhoto.close();return false});if(settings.allow_expand){e("a.pp_expand").bind("click",function(t){if(e(this).hasClass("pp_expand")){e(this).removeClass("pp_expand").addClass("pp_contract");doresize=false}else{e(this).removeClass("pp_contract").addClass("pp_expand");doresize=true}y(function(){e.prettyPhoto.open()});return false})}$pp_pic_holder.find(".pp_previous, .pp_nav .pp_arrow_previous").bind("click",function(){e.prettyPhoto.changePage("previous");e.prettyPhoto.stopSlideshow();return false});$pp_pic_holder.find(".pp_next, .pp_nav .pp_arrow_next").bind("click",function(){e.prettyPhoto.changePage("next");e.prettyPhoto.stopSlideshow();return false});x()}s=jQuery.extend({hook:"rel",animation_speed:"fast",ajaxcallback:function(){},slideshow:5e3,autoplay_slideshow:false,opacity:.8,show_title:true,allow_resize:true,allow_expand:true,default_width:500,default_height:344,counter_separator_label:"/",theme:"pp_default",horizontal_padding:20,hideflash:false,wmode:"opaque",autoplay:true,modal:false,deeplinking:true,overlay_gallery:true,overlay_gallery_max:30,keyboard_shortcuts:true,changepicturecallback:function(){},callback:function(){},ie6_fallback:true,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>',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>',image_markup:'<img id="fullResImage" src="{path}" />',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>',quicktime_markup:'<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="//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="//www.apple.com/quicktime/download/"></embed></object>',iframe_markup:'<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',inline_markup:'<div class="pp_inline">{content}</div>',custom_markup:"",social_tools:'<div class="twitter"><a href="//twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script></div><div class="facebook"><iframe src="//www.facebook.com/plugins/like.php?locale=en_US&href={location_href}&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>'},s);var o=this,u=false,a,f,l,c,h,p,d=e(window).height(),v=e(window).width(),m;doresize=true,scroll_pos=T();e(window).unbind("resize.prettyphoto").bind("resize.prettyphoto",function(){x();N()});if(s.keyboard_shortcuts){e(document).unbind("keydown.prettyphoto").bind("keydown.prettyphoto",function(t){if(typeof $pp_pic_holder!="undefined"){if($pp_pic_holder.is(":visible")){switch(t.keyCode){case 37:e.prettyPhoto.changePage("previous");t.preventDefault();break;case 39:e.prettyPhoto.changePage("next");t.preventDefault();break;case 27:if(!settings.modal)e.prettyPhoto.close();t.preventDefault();break}}}})}e.prettyPhoto.initialize=function(){settings=s;if(settings.theme=="pp_default")settings.horizontal_padding=16;theRel=e(this).attr(settings.hook);galleryRegExp=/\[(?:.*)\]/;isSet=galleryRegExp.exec(theRel)?true:false;pp_images=isSet?jQuery.map(o,function(t,n){if(e(t).attr(settings.hook).indexOf(theRel)!=-1)return e(t).attr("href")}):e.makeArray(e(this).attr("href"));pp_titles=isSet?jQuery.map(o,function(t,n){if(e(t).attr(settings.hook).indexOf(theRel)!=-1)return e(t).find("img").attr("alt")?e(t).find("img").attr("alt"):""}):e.makeArray(e(this).find("img").attr("alt"));pp_descriptions=isSet?jQuery.map(o,function(t,n){if(e(t).attr(settings.hook).indexOf(theRel)!=-1)return e(t).attr("title")?e(t).attr("title"):""}):e.makeArray(e(this).attr("title"));if(pp_images.length>settings.overlay_gallery_max)settings.overlay_gallery=false;set_position=jQuery.inArray(e(this).attr("href"),pp_images);rel_index=isSet?set_position:e("a["+settings.hook+"^='"+theRel+"']").index(e(this));k(this);if(settings.allow_resize)e(window).bind("scroll.prettyphoto",function(){x()});e.prettyPhoto.open();return false};e.prettyPhoto.open=function(t){if(typeof settings=="undefined"){settings=s;pp_images=e.makeArray(arguments[0]);pp_titles=arguments[1]?e.makeArray(arguments[1]):e.makeArray("");pp_descriptions=arguments[2]?e.makeArray(arguments[2]):e.makeArray("");isSet=pp_images.length>1?true:false;set_position=arguments[3]?arguments[3]:0;k(t.target)}if(settings.hideflash)e("object,embed,iframe[src*=youtube],iframe[src*=vimeo]").css("visibility","hidden");b(e(pp_images).size());e(".pp_loaderIcon").show();if(settings.deeplinking)n();if(settings.social_tools){facebook_like_link=settings.social_tools.replace("{location_href}",encodeURIComponent(location.href));$pp_pic_holder.find(".pp_social").html(facebook_like_link)}if($ppt.is(":hidden"))$ppt.css("opacity",0).show();$pp_overlay.show().fadeTo(settings.animation_speed,settings.opacity);$pp_pic_holder.find(".currentTextHolder").text(set_position+1+settings.counter_separator_label+e(pp_images).size());if(typeof pp_descriptions[set_position]!="undefined"&&pp_descriptions[set_position]!=""){$pp_pic_holder.find(".pp_description").show().html(unescape(pp_descriptions[set_position]))}else{$pp_pic_holder.find(".pp_description").hide()}movie_width=parseFloat(i("width",pp_images[set_position]))?i("width",pp_images[set_position]):settings.default_width.toString();movie_height=parseFloat(i("height",pp_images[set_position]))?i("height",pp_images[set_position]):settings.default_height.toString();u=false;if(movie_height.indexOf("%")!=-1){movie_height=parseFloat(e(window).height()*parseFloat(movie_height)/100-150);u=true}if(movie_width.indexOf("%")!=-1){movie_width=parseFloat(e(window).width()*parseFloat(movie_width)/100-150);u=true}$pp_pic_holder.fadeIn(function(){settings.show_title&&pp_titles[set_position]!=""&&typeof pp_titles[set_position]!="undefined"?$ppt.html(unescape(pp_titles[set_position])):$ppt.html(" ");imgPreloader="";skipInjection=false;switch(S(pp_images[set_position])){case"image":imgPreloader=new Image;nextImage=new Image;if(isSet&&set_position<e(pp_images).size()-1)nextImage.src=pp_images[set_position+1];prevImage=new Image;if(isSet&&pp_images[set_position-1])prevImage.src=pp_images[set_position-1];$pp_pic_holder.find("#pp_full_res")[0].innerHTML=settings.image_markup.replace(/{path}/g,pp_images[set_position]);imgPreloader.onload=function(){a=w(imgPreloader.width,imgPreloader.height);g()};imgPreloader.onerror=function(){alert("Image cannot be loaded. Make sure the path is correct and image exist.");e.prettyPhoto.close()};imgPreloader.src=pp_images[set_position];break;case"youtube":a=w(movie_width,movie_height);movie_id=i("v",pp_images[set_position]);if(movie_id==""){movie_id=pp_images[set_position].split("youtu.be/");movie_id=movie_id[1];if(movie_id.indexOf("?")>0)movie_id=movie_id.substr(0,movie_id.indexOf("?"));if(movie_id.indexOf("&")>0)movie_id=movie_id.substr(0,movie_id.indexOf("&"))}movie="//www.youtube.com/embed/"+movie_id;i("rel",pp_images[set_position])?movie+="?rel="+i("rel",pp_images[set_position]):movie+="?rel=1";if(settings.autoplay)movie+="&autoplay=1";toInject=settings.iframe_markup.replace(/{width}/g,a["width"]).replace(/{height}/g,a["height"]).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);break;case"vimeo":a=w(movie_width,movie_height);movie_id=pp_images[set_position];var t=/http(s?):\/\/(www\.)?vimeo.com\/(\d+)/;var n=movie_id.match(t);movie="//player.vimeo.com/video/"+n[3]+"?title=0&byline=0&portrait=0";if(settings.autoplay)movie+="&autoplay=1;";vimeo_width=a["width"]+"/embed/?moog_width="+a["width"];toInject=settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,a["height"]).replace(/{path}/g,movie);break;case"quicktime":a=w(movie_width,movie_height);a["height"]+=15;a["contentHeight"]+=15;a["containerHeight"]+=15;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);break;case"flash":a=w(movie_width,movie_height);flash_vars=pp_images[set_position];flash_vars=flash_vars.substring(pp_images[set_position].indexOf("flashvars")+10,pp_images[set_position].length);filename=pp_images[set_position];filename=filename.substring(0,filename.indexOf("?"));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);break;case"iframe":a=w(movie_width,movie_height);frame_url=pp_images[set_position];frame_url=frame_url.substr(0,frame_url.indexOf("iframe")-1);toInject=settings.iframe_markup.replace(/{width}/g,a["width"]).replace(/{height}/g,a["height"]).replace(/{path}/g,frame_url);break;case"ajax":doresize=false;a=w(movie_width,movie_height);doresize=true;skipInjection=true;e.get(pp_images[set_position],function(e){toInject=settings.inline_markup.replace(/{content}/g,e);$pp_pic_holder.find("#pp_full_res")[0].innerHTML=toInject;g()});break;case"custom":a=w(movie_width,movie_height);toInject=settings.custom_markup;break;case"inline":myClone=e(pp_images[set_position]).clone().append('<br clear="all" />').css({width:settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline"></div></div>').appendTo(e("body")).show();doresize=false;a=w(e(myClone).width(),e(myClone).height());doresize=true;e(myClone).remove();toInject=settings.inline_markup.replace(/{content}/g,e(pp_images[set_position]).html());break}if(!imgPreloader&&!skipInjection){$pp_pic_holder.find("#pp_full_res")[0].innerHTML=toInject;g()}});return false};e.prettyPhoto.changePage=function(t){currentGalleryPage=0;if(t=="previous"){set_position--;if(set_position<0)set_position=e(pp_images).size()-1}else if(t=="next"){set_position++;if(set_position>e(pp_images).size()-1)set_position=0}else{set_position=t}rel_index=set_position;if(!doresize)doresize=true;if(settings.allow_expand){e(".pp_contract").removeClass("pp_contract").addClass("pp_expand")}y(function(){e.prettyPhoto.open()})};e.prettyPhoto.changeGalleryPage=function(e){if(e=="next"){currentGalleryPage++;if(currentGalleryPage>totalPage)currentGalleryPage=0}else if(e=="previous"){currentGalleryPage--;if(currentGalleryPage<0)currentGalleryPage=totalPage}else{currentGalleryPage=e}slide_speed=e=="next"||e=="previous"?settings.animation_speed:0;slide_to=currentGalleryPage*itemsPerPage*itemWidth;$pp_gallery.find("ul").animate({left:-slide_to},slide_speed)};e.prettyPhoto.startSlideshow=function(){if(typeof m=="undefined"){$pp_pic_holder.find(".pp_play").unbind("click").removeClass("pp_play").addClass("pp_pause").click(function(){e.prettyPhoto.stopSlideshow();return false});m=setInterval(e.prettyPhoto.startSlideshow,settings.slideshow)}else{e.prettyPhoto.changePage("next")}};e.prettyPhoto.stopSlideshow=function(){$pp_pic_holder.find(".pp_pause").unbind("click").removeClass("pp_pause").addClass("pp_play").click(function(){e.prettyPhoto.startSlideshow();return false});clearInterval(m);m=undefined};e.prettyPhoto.close=function(){if($pp_overlay.is(":animated"))return;e.prettyPhoto.stopSlideshow();$pp_pic_holder.stop().find("object,embed").css("visibility","hidden");e("div.pp_pic_holder,div.ppt,.pp_fade").fadeOut(settings.animation_speed,function(){e(this).remove()});$pp_overlay.fadeOut(settings.animation_speed,function(){if(settings.hideflash)e("object,embed,iframe[src*=youtube],iframe[src*=vimeo]").css("visibility","visible");e(this).remove();e(window).unbind("scroll.prettyphoto");r();settings.callback();doresize=true;f=false;delete settings})};if(!pp_alreadyInitialized&&t()){pp_alreadyInitialized=true;hashIndex=t();hashRel=hashIndex;hashIndex=hashIndex.substring(hashIndex.indexOf("/")+1,hashIndex.length-1);hashRel=hashRel.substring(0,hashRel.indexOf("/"));setTimeout(function(){e("a["+s.hook+"^='"+hashRel+"']:eq("+hashIndex+")").trigger("click")},50)}return this.unbind("click.prettyphoto").bind("click.prettyphoto",e.prettyPhoto.initialize)};})(jQuery);var pp_alreadyInitialized=false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
Class: prettyPhoto
|
3 |
Use: Lightbox clone for jQuery
|
4 |
Author: Stephane Caron (http://www.no-margin-for-errors.com)
|
5 |
+
Version: 3.1.6
|
6 |
------------------------------------------------------------------------- */
|
7 |
+
(function($) {
|
8 |
+
$.prettyPhoto = {version: '3.1.6'};
|
9 |
+
|
10 |
+
$.fn.prettyPhoto = function(pp_settings) {
|
11 |
+
pp_settings = jQuery.extend({
|
12 |
+
hook: 'rel', /* the attribute tag to use for prettyPhoto hooks. default: 'rel'. For HTML5, use "data-rel" or similar. */
|
13 |
+
animation_speed: 'fast', /* fast/slow/normal */
|
14 |
+
ajaxcallback: function() {},
|
15 |
+
slideshow: 5000, /* false OR interval time in ms */
|
16 |
+
autoplay_slideshow: false, /* true/false */
|
17 |
+
opacity: 0.80, /* Value between 0 and 1 */
|
18 |
+
show_title: true, /* true/false */
|
19 |
+
allow_resize: true, /* Resize the photos bigger than viewport. true/false */
|
20 |
+
allow_expand: true, /* Allow the user to expand a resized image. true/false */
|
21 |
+
default_width: 500,
|
22 |
+
default_height: 344,
|
23 |
+
counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
|
24 |
+
theme: 'pp_default', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
|
25 |
+
horizontal_padding: 20, /* The padding on each side of the picture */
|
26 |
+
hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
|
27 |
+
wmode: 'opaque', /* Set the flash wmode attribute */
|
28 |
+
autoplay: true, /* Automatically start videos: True/False */
|
29 |
+
modal: false, /* If set to true, only the close button will close the window */
|
30 |
+
deeplinking: true, /* Allow prettyPhoto to update the url to enable deeplinking. */
|
31 |
+
overlay_gallery: true, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
|
32 |
+
overlay_gallery_max: 30, /* Maximum number of pictures in the overlay gallery */
|
33 |
+
keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */
|
34 |
+
changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
|
35 |
+
callback: function(){}, /* Called when prettyPhoto is closed */
|
36 |
+
ie6_fallback: true,
|
37 |
+
markup: '<div class="pp_pic_holder"> \
|
38 |
+
<div class="ppt"> </div> \
|
39 |
+
<div class="pp_top"> \
|
40 |
+
<div class="pp_left"></div> \
|
41 |
+
<div class="pp_middle"></div> \
|
42 |
+
<div class="pp_right"></div> \
|
43 |
+
</div> \
|
44 |
+
<div class="pp_content_container"> \
|
45 |
+
<div class="pp_left"> \
|
46 |
+
<div class="pp_right"> \
|
47 |
+
<div class="pp_content"> \
|
48 |
+
<div class="pp_loaderIcon"></div> \
|
49 |
+
<div class="pp_fade"> \
|
50 |
+
<a href="#" class="pp_expand" title="Expand the image">Expand</a> \
|
51 |
+
<div class="pp_hoverContainer"> \
|
52 |
+
<a class="pp_next" href="#">next</a> \
|
53 |
+
<a class="pp_previous" href="#">previous</a> \
|
54 |
+
</div> \
|
55 |
+
<div id="pp_full_res"></div> \
|
56 |
+
<div class="pp_details"> \
|
57 |
+
<div class="pp_nav"> \
|
58 |
+
<a href="#" class="pp_arrow_previous">Previous</a> \
|
59 |
+
<p class="currentTextHolder">0/0</p> \
|
60 |
+
<a href="#" class="pp_arrow_next">Next</a> \
|
61 |
+
</div> \
|
62 |
+
<p class="pp_description"></p> \
|
63 |
+
<div class="pp_social">{pp_social}</div> \
|
64 |
+
<a class="pp_close" href="#">Close</a> \
|
65 |
+
</div> \
|
66 |
+
</div> \
|
67 |
+
</div> \
|
68 |
+
</div> \
|
69 |
+
</div> \
|
70 |
+
</div> \
|
71 |
+
<div class="pp_bottom"> \
|
72 |
+
<div class="pp_left"></div> \
|
73 |
+
<div class="pp_middle"></div> \
|
74 |
+
<div class="pp_right"></div> \
|
75 |
+
</div> \
|
76 |
+
</div> \
|
77 |
+
<div class="pp_overlay"></div>',
|
78 |
+
gallery_markup: '<div class="pp_gallery"> \
|
79 |
+
<a href="#" class="pp_arrow_previous">Previous</a> \
|
80 |
+
<div> \
|
81 |
+
<ul> \
|
82 |
+
{gallery} \
|
83 |
+
</ul> \
|
84 |
+
</div> \
|
85 |
+
<a href="#" class="pp_arrow_next">Next</a> \
|
86 |
+
</div>',
|
87 |
+
image_markup: '<img id="fullResImage" src="{path}" />',
|
88 |
+
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>',
|
89 |
+
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>',
|
90 |
+
iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',
|
91 |
+
inline_markup: '<div class="pp_inline">{content}</div>',
|
92 |
+
custom_markup: '',
|
93 |
+
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>' /* html or false to disable */
|
94 |
+
}, pp_settings);
|
95 |
+
|
96 |
+
// Global variables accessible only by prettyPhoto
|
97 |
+
var matchedObjects = this, percentBased = false, pp_dimensions, pp_open,
|
98 |
+
|
99 |
+
// prettyPhoto container specific
|
100 |
+
pp_contentHeight, pp_contentWidth, pp_containerHeight, pp_containerWidth,
|
101 |
+
|
102 |
+
// Window size
|
103 |
+
windowHeight = $(window).height(), windowWidth = $(window).width(),
|
104 |
+
|
105 |
+
// Global elements
|
106 |
+
pp_slideshow;
|
107 |
+
|
108 |
+
doresize = true, scroll_pos = _get_scroll();
|
109 |
+
|
110 |
+
// Window/Keyboard events
|
111 |
+
$(window).unbind('resize.prettyphoto').bind('resize.prettyphoto',function(){ _center_overlay(); _resize_overlay(); });
|
112 |
+
|
113 |
+
if(pp_settings.keyboard_shortcuts) {
|
114 |
+
$(document).unbind('keydown.prettyphoto').bind('keydown.prettyphoto',function(e){
|
115 |
+
if(typeof $pp_pic_holder != 'undefined'){
|
116 |
+
if($pp_pic_holder.is(':visible')){
|
117 |
+
switch(e.keyCode){
|
118 |
+
case 37:
|
119 |
+
$.prettyPhoto.changePage('previous');
|
120 |
+
e.preventDefault();
|
121 |
+
break;
|
122 |
+
case 39:
|
123 |
+
$.prettyPhoto.changePage('next');
|
124 |
+
e.preventDefault();
|
125 |
+
break;
|
126 |
+
case 27:
|
127 |
+
if(!settings.modal)
|
128 |
+
$.prettyPhoto.close();
|
129 |
+
e.preventDefault();
|
130 |
+
break;
|
131 |
+
};
|
132 |
+
// return false;
|
133 |
+
};
|
134 |
+
};
|
135 |
+
});
|
136 |
+
};
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Initialize prettyPhoto.
|
140 |
+
*/
|
141 |
+
$.prettyPhoto.initialize = function() {
|
142 |
+
|
143 |
+
settings = pp_settings;
|
144 |
+
|
145 |
+
if(settings.theme == 'pp_default') settings.horizontal_padding = 16;
|
146 |
+
|
147 |
+
// Find out if the picture is part of a set
|
148 |
+
theRel = $(this).attr(settings.hook);
|
149 |
+
galleryRegExp = /\[(?:.*)\]/;
|
150 |
+
isSet = (galleryRegExp.exec(theRel)) ? true : false;
|
151 |
+
|
152 |
+
// Put the SRCs, TITLEs, ALTs into an array.
|
153 |
+
pp_images = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return $(n).attr('href'); }) : $.makeArray($(this).attr('href'));
|
154 |
+
pp_titles = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).find('img').attr('alt')) ? $(n).find('img').attr('alt') : ""; }) : $.makeArray($(this).find('img').attr('alt'));
|
155 |
+
pp_descriptions = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).attr('title')) ? $(n).attr('title') : ""; }) : $.makeArray($(this).attr('title'));
|
156 |
+
|
157 |
+
if(pp_images.length > settings.overlay_gallery_max) settings.overlay_gallery = false;
|
158 |
+
|
159 |
+
set_position = jQuery.inArray($(this).attr('href'), pp_images); // Define where in the array the clicked item is positionned
|
160 |
+
rel_index = (isSet) ? set_position : $("a["+settings.hook+"^='"+theRel+"']").index($(this));
|
161 |
+
|
162 |
+
_build_overlay(this); // Build the overlay {this} being the caller
|
163 |
+
|
164 |
+
if(settings.allow_resize)
|
165 |
+
$(window).bind('scroll.prettyphoto',function(){ _center_overlay(); });
|
166 |
+
|
167 |
+
|
168 |
+
$.prettyPhoto.open();
|
169 |
+
|
170 |
+
return false;
|
171 |
+
}
|
172 |
+
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Opens the prettyPhoto modal box.
|
176 |
+
* @param image {String,Array} Full path to the image to be open, can also be an array containing full images paths.
|
177 |
+
* @param title {String,Array} The title to be displayed with the picture, can also be an array containing all the titles.
|
178 |
+
* @param description {String,Array} The description to be displayed with the picture, can also be an array containing all the descriptions.
|
179 |
+
*/
|
180 |
+
$.prettyPhoto.open = function(event) {
|
181 |
+
if(typeof settings == "undefined"){ // Means it's an API call, need to manually get the settings and set the variables
|
182 |
+
settings = pp_settings;
|
183 |
+
pp_images = $.makeArray(arguments[0]);
|
184 |
+
pp_titles = (arguments[1]) ? $.makeArray(arguments[1]) : $.makeArray("");
|
185 |
+
pp_descriptions = (arguments[2]) ? $.makeArray(arguments[2]) : $.makeArray("");
|
186 |
+
isSet = (pp_images.length > 1) ? true : false;
|
187 |
+
set_position = (arguments[3])? arguments[3]: 0;
|
188 |
+
_build_overlay(event.target); // Build the overlay {this} being the caller
|
189 |
+
}
|
190 |
+
|
191 |
+
if(settings.hideflash) $('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','hidden'); // Hide the flash
|
192 |
+
|
193 |
+
_checkPosition($(pp_images).size()); // Hide the next/previous links if on first or last images.
|
194 |
+
|
195 |
+
$('.pp_loaderIcon').show();
|
196 |
+
|
197 |
+
if(settings.deeplinking)
|
198 |
+
setHashtag();
|
199 |
+
|
200 |
+
// Rebuild Facebook Like Button with updated href
|
201 |
+
if(settings.social_tools){
|
202 |
+
facebook_like_link = settings.social_tools.replace('{location_href}', encodeURIComponent(location.href));
|
203 |
+
$pp_pic_holder.find('.pp_social').html(facebook_like_link);
|
204 |
+
}
|
205 |
+
|
206 |
+
// Fade the content in
|
207 |
+
if($ppt.is(':hidden')) $ppt.css('opacity',0).show();
|
208 |
+
$pp_overlay.show().fadeTo(settings.animation_speed,settings.opacity);
|
209 |
+
|
210 |
+
// Display the current position
|
211 |
+
$pp_pic_holder.find('.currentTextHolder').text((set_position+1) + settings.counter_separator_label + $(pp_images).size());
|
212 |
+
|
213 |
+
// Set the description
|
214 |
+
if(typeof pp_descriptions[set_position] != 'undefined' && pp_descriptions[set_position] != ""){
|
215 |
+
$pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[set_position]));
|
216 |
+
}else{
|
217 |
+
$pp_pic_holder.find('.pp_description').hide();
|
218 |
+
}
|
219 |
+
|
220 |
+
// Get the dimensions
|
221 |
+
movie_width = ( parseFloat(getParam('width',pp_images[set_position])) ) ? getParam('width',pp_images[set_position]) : settings.default_width.toString();
|
222 |
+
movie_height = ( parseFloat(getParam('height',pp_images[set_position])) ) ? getParam('height',pp_images[set_position]) : settings.default_height.toString();
|
223 |
+
|
224 |
+
// If the size is % based, calculate according to window dimensions
|
225 |
+
percentBased=false;
|
226 |
+
if(movie_height.indexOf('%') != -1) { movie_height = parseFloat(($(window).height() * parseFloat(movie_height) / 100) - 150); percentBased = true; }
|
227 |
+
if(movie_width.indexOf('%') != -1) { movie_width = parseFloat(($(window).width() * parseFloat(movie_width) / 100) - 150); percentBased = true; }
|
228 |
+
|
229 |
+
// Fade the holder
|
230 |
+
$pp_pic_holder.fadeIn(function(){
|
231 |
+
// Set the title
|
232 |
+
(settings.show_title && pp_titles[set_position] != "" && typeof pp_titles[set_position] != "undefined") ? $ppt.html(unescape(pp_titles[set_position])) : $ppt.html(' ');
|
233 |
+
|
234 |
+
imgPreloader = "";
|
235 |
+
skipInjection = false;
|
236 |
+
|
237 |
+
// Inject the proper content
|
238 |
+
switch(_getFileType(pp_images[set_position])){
|
239 |
+
case 'image':
|
240 |
+
imgPreloader = new Image();
|
241 |
+
|
242 |
+
// Preload the neighbour images
|
243 |
+
nextImage = new Image();
|
244 |
+
if(isSet && set_position < $(pp_images).size() -1) nextImage.src = pp_images[set_position + 1];
|
245 |
+
prevImage = new Image();
|
246 |
+
if(isSet && pp_images[set_position - 1]) prevImage.src = pp_images[set_position - 1];
|
247 |
+
|
248 |
+
$pp_pic_holder.find('#pp_full_res')[0].innerHTML = settings.image_markup.replace(/{path}/g,pp_images[set_position]);
|
249 |
+
|
250 |
+
imgPreloader.onload = function(){
|
251 |
+
// Fit item to viewport
|
252 |
+
pp_dimensions = _fitToViewport(imgPreloader.width,imgPreloader.height);
|
253 |
+
|
254 |
+
_showContent();
|
255 |
+
};
|
256 |
+
|
257 |
+
imgPreloader.onerror = function(){
|
258 |
+
alert('Image cannot be loaded. Make sure the path is correct and image exist.');
|
259 |
+
$.prettyPhoto.close();
|
260 |
+
};
|
261 |
+
|
262 |
+
imgPreloader.src = pp_images[set_position];
|
263 |
+
break;
|
264 |
+
|
265 |
+
case 'youtube':
|
266 |
+
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
|
267 |
+
|
268 |
+
// Regular youtube link
|
269 |
+
movie_id = getParam('v',pp_images[set_position]);
|
270 |
+
|
271 |
+
// youtu.be link
|
272 |
+
if(movie_id == ""){
|
273 |
+
movie_id = pp_images[set_position].split('youtu.be/');
|
274 |
+
movie_id = movie_id[1];
|
275 |
+
if(movie_id.indexOf('?') > 0)
|
276 |
+
movie_id = movie_id.substr(0,movie_id.indexOf('?')); // Strip anything after the ?
|
277 |
+
|
278 |
+
if(movie_id.indexOf('&') > 0)
|
279 |
+
movie_id = movie_id.substr(0,movie_id.indexOf('&')); // Strip anything after the &
|
280 |
+
}
|
281 |
+
|
282 |
+
movie = 'http://www.youtube.com/embed/'+movie_id;
|
283 |
+
(getParam('rel',pp_images[set_position])) ? movie+="?rel="+getParam('rel',pp_images[set_position]) : movie+="?rel=1";
|
284 |
+
|
285 |
+
if(settings.autoplay) movie += "&autoplay=1";
|
286 |
+
|
287 |
+
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);
|
288 |
+
break;
|
289 |
+
|
290 |
+
case 'vimeo':
|
291 |
+
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
|
292 |
+
|
293 |
+
movie_id = pp_images[set_position];
|
294 |
+
var regExp = /http(s?):\/\/(www\.)?vimeo.com\/(\d+)/;
|
295 |
+
var match = movie_id.match(regExp);
|
296 |
+
|
297 |
+
movie = 'http://player.vimeo.com/video/'+ match[3] +'?title=0&byline=0&portrait=0';
|
298 |
+
if(settings.autoplay) movie += "&autoplay=1;";
|
299 |
+
|
300 |
+
vimeo_width = pp_dimensions['width'] + '/embed/?moog_width='+ pp_dimensions['width'];
|
301 |
+
|
302 |
+
toInject = settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,movie);
|
303 |
+
break;
|
304 |
+
|
305 |
+
case 'quicktime':
|
306 |
+
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
|
307 |
+
pp_dimensions['height']+=15; pp_dimensions['contentHeight']+=15; pp_dimensions['containerHeight']+=15; // Add space for the control bar
|
308 |
+
|
309 |
+
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);
|
310 |
+
break;
|
311 |
+
|
312 |
+
case 'flash':
|
313 |
+
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
|
314 |
+
|
315 |
+
flash_vars = pp_images[set_position];
|
316 |
+
flash_vars = flash_vars.substring(pp_images[set_position].indexOf('flashvars') + 10,pp_images[set_position].length);
|
317 |
+
|
318 |
+
filename = pp_images[set_position];
|
319 |
+
filename = filename.substring(0,filename.indexOf('?'));
|
320 |
+
|
321 |
+
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);
|
322 |
+
break;
|
323 |
+
|
324 |
+
case 'iframe':
|
325 |
+
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
|
326 |
+
|
327 |
+
frame_url = pp_images[set_position];
|
328 |
+
frame_url = frame_url.substr(0,frame_url.indexOf('iframe')-1);
|
329 |
+
|
330 |
+
toInject = settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,frame_url);
|
331 |
+
break;
|
332 |
+
|
333 |
+
case 'ajax':
|
334 |
+
doresize = false; // Make sure the dimensions are not resized.
|
335 |
+
pp_dimensions = _fitToViewport(movie_width,movie_height);
|
336 |
+
doresize = true; // Reset the dimensions
|
337 |
+
|
338 |
+
skipInjection = true;
|
339 |
+
$.get(pp_images[set_position],function(responseHTML){
|
340 |
+
toInject = settings.inline_markup.replace(/{content}/g,responseHTML);
|
341 |
+
$pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject;
|
342 |
+
_showContent();
|
343 |
+
});
|
344 |
+
|
345 |
+
break;
|
346 |
+
|
347 |
+
case 'custom':
|
348 |
+
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
|
349 |
+
|
350 |
+
toInject = settings.custom_markup;
|
351 |
+
break;
|
352 |
+
|
353 |
+
case 'inline':
|
354 |
+
// to get the item height clone it, apply default width, wrap it in the prettyPhoto containers , then delete
|
355 |
+
myClone = $(pp_images[set_position]).clone().append('<br clear="all" />').css({'width':settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline"></div></div>').appendTo($('body')).show();
|
356 |
+
doresize = false; // Make sure the dimensions are not resized.
|
357 |
+
pp_dimensions = _fitToViewport($(myClone).width(),$(myClone).height());
|
358 |
+
doresize = true; // Reset the dimensions
|
359 |
+
$(myClone).remove();
|
360 |
+
toInject = settings.inline_markup.replace(/{content}/g,$(pp_images[set_position]).html());
|
361 |
+
break;
|
362 |
+
};
|
363 |
+
|
364 |
+
if(!imgPreloader && !skipInjection){
|
365 |
+
$pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject;
|
366 |
+
|
367 |
+
// Show content
|
368 |
+
_showContent();
|
369 |
+
};
|
370 |
+
});
|
371 |
+
|
372 |
+
return false;
|
373 |
+
};
|
374 |
+
|
375 |
+
|
376 |
+
/**
|
377 |
+
* Change page in the prettyPhoto modal box
|
378 |
+
* @param direction {String} Direction of the paging, previous or next.
|
379 |
+
*/
|
380 |
+
$.prettyPhoto.changePage = function(direction){
|
381 |
+
currentGalleryPage = 0;
|
382 |
+
|
383 |
+
if(direction == 'previous') {
|
384 |
+
set_position--;
|
385 |
+
if (set_position < 0) set_position = $(pp_images).size()-1;
|
386 |
+
}else if(direction == 'next'){
|
387 |
+
set_position++;
|
388 |
+
if(set_position > $(pp_images).size()-1) set_position = 0;
|
389 |
+
}else{
|
390 |
+
set_position=direction;
|
391 |
+
};
|
392 |
+
|
393 |
+
rel_index = set_position;
|
394 |
+
|
395 |
+
if(!doresize) doresize = true; // Allow the resizing of the images
|
396 |
+
if(settings.allow_expand) {
|
397 |
+
$('.pp_contract').removeClass('pp_contract').addClass('pp_expand');
|
398 |
+
}
|
399 |
+
|
400 |
+
_hideContent(function(){ $.prettyPhoto.open(); });
|
401 |
+
};
|
402 |
+
|
403 |
+
|
404 |
+
/**
|
405 |
+
* Change gallery page in the prettyPhoto modal box
|
406 |
+
* @param direction {String} Direction of the paging, previous or next.
|
407 |
+
*/
|
408 |
+
$.prettyPhoto.changeGalleryPage = function(direction){
|
409 |
+
if(direction=='next'){
|
410 |
+
currentGalleryPage ++;
|
411 |
+
|
412 |
+
if(currentGalleryPage > totalPage) currentGalleryPage = 0;
|
413 |
+
}else if(direction=='previous'){
|
414 |
+
currentGalleryPage --;
|
415 |
+
|
416 |
+
if(currentGalleryPage < 0) currentGalleryPage = totalPage;
|
417 |
+
}else{
|
418 |
+
currentGalleryPage = direction;
|
419 |
+
};
|
420 |
+
|
421 |
+
slide_speed = (direction == 'next' || direction == 'previous') ? settings.animation_speed : 0;
|
422 |
+
|
423 |
+
slide_to = currentGalleryPage * (itemsPerPage * itemWidth);
|
424 |
+
|
425 |
+
$pp_gallery.find('ul').animate({left:-slide_to},slide_speed);
|
426 |
+
};
|
427 |
+
|
428 |
+
|
429 |
+
/**
|
430 |
+
* Start the slideshow...
|
431 |
+
*/
|
432 |
+
$.prettyPhoto.startSlideshow = function(){
|
433 |
+
if(typeof pp_slideshow == 'undefined'){
|
434 |
+
$pp_pic_holder.find('.pp_play').unbind('click').removeClass('pp_play').addClass('pp_pause').click(function(){
|
435 |
+
$.prettyPhoto.stopSlideshow();
|
436 |
+
return false;
|
437 |
+
});
|
438 |
+
pp_slideshow = setInterval($.prettyPhoto.startSlideshow,settings.slideshow);
|
439 |
+
}else{
|
440 |
+
$.prettyPhoto.changePage('next');
|
441 |
+
};
|
442 |
+
}
|
443 |
+
|
444 |
+
|
445 |
+
/**
|
446 |
+
* Stop the slideshow...
|
447 |
+
*/
|
448 |
+
$.prettyPhoto.stopSlideshow = function(){
|
449 |
+
$pp_pic_holder.find('.pp_pause').unbind('click').removeClass('pp_pause').addClass('pp_play').click(function(){
|
450 |
+
$.prettyPhoto.startSlideshow();
|
451 |
+
return false;
|
452 |
+
});
|
453 |
+
clearInterval(pp_slideshow);
|
454 |
+
pp_slideshow=undefined;
|
455 |
+
}
|
456 |
+
|
457 |
+
|
458 |
+
/**
|
459 |
+
* Closes prettyPhoto.
|
460 |
+
*/
|
461 |
+
$.prettyPhoto.close = function(){
|
462 |
+
if($pp_overlay.is(":animated")) return;
|
463 |
+
|
464 |
+
$.prettyPhoto.stopSlideshow();
|
465 |
+
|
466 |
+
$pp_pic_holder.stop().find('object,embed').css('visibility','hidden');
|
467 |
+
|
468 |
+
$('div.pp_pic_holder,div.ppt,.pp_fade').fadeOut(settings.animation_speed,function(){ $(this).remove(); });
|
469 |
+
|
470 |
+
$pp_overlay.fadeOut(settings.animation_speed, function(){
|
471 |
+
|
472 |
+
if(settings.hideflash) $('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','visible'); // Show the flash
|
473 |
+
|
474 |
+
$(this).remove(); // No more need for the prettyPhoto markup
|
475 |
+
|
476 |
+
$(window).unbind('scroll.prettyphoto');
|
477 |
+
|
478 |
+
clearHashtag();
|
479 |
+
|
480 |
+
settings.callback();
|
481 |
+
|
482 |
+
doresize = true;
|
483 |
+
|
484 |
+
pp_open = false;
|
485 |
+
|
486 |
+
delete settings;
|
487 |
+
});
|
488 |
+
};
|
489 |
+
|
490 |
+
/**
|
491 |
+
* Set the proper sizes on the containers and animate the content in.
|
492 |
+
*/
|
493 |
+
function _showContent(){
|
494 |
+
$('.pp_loaderIcon').hide();
|
495 |
+
|
496 |
+
// Calculate the opened top position of the pic holder
|
497 |
+
projectedTop = scroll_pos['scrollTop'] + ((windowHeight/2) - (pp_dimensions['containerHeight']/2));
|
498 |
+
if(projectedTop < 0) projectedTop = 0;
|
499 |
+
|
500 |
+
$ppt.fadeTo(settings.animation_speed,1);
|
501 |
+
|
502 |
+
// Resize the content holder
|
503 |
+
$pp_pic_holder.find('.pp_content')
|
504 |
+
.animate({
|
505 |
+
height:pp_dimensions['contentHeight'],
|
506 |
+
width:pp_dimensions['contentWidth']
|
507 |
+
},settings.animation_speed);
|
508 |
+
|
509 |
+
// Resize picture the holder
|
510 |
+
$pp_pic_holder.animate({
|
511 |
+
'top': projectedTop,
|
512 |
+
'left': ((windowWidth/2) - (pp_dimensions['containerWidth']/2) < 0) ? 0 : (windowWidth/2) - (pp_dimensions['containerWidth']/2),
|
513 |
+
width:pp_dimensions['containerWidth']
|
514 |
+
},settings.animation_speed,function(){
|
515 |
+
$pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(pp_dimensions['height']).width(pp_dimensions['width']);
|
516 |
+
|
517 |
+
$pp_pic_holder.find('.pp_fade').fadeIn(settings.animation_speed); // Fade the new content
|
518 |
+
|
519 |
+
// Show the nav
|
520 |
+
if(isSet && _getFileType(pp_images[set_position])=="image") { $pp_pic_holder.find('.pp_hoverContainer').show(); }else{ $pp_pic_holder.find('.pp_hoverContainer').hide(); }
|
521 |
+
|
522 |
+
if(settings.allow_expand) {
|
523 |
+
if(pp_dimensions['resized']){ // Fade the resizing link if the image is resized
|
524 |
+
$('a.pp_expand,a.pp_contract').show();
|
525 |
+
}else{
|
526 |
+
$('a.pp_expand').hide();
|
527 |
+
}
|
528 |
+
}
|
529 |
+
|
530 |
+
if(settings.autoplay_slideshow && !pp_slideshow && !pp_open) $.prettyPhoto.startSlideshow();
|
531 |
+
|
532 |
+
settings.changepicturecallback(); // Callback!
|
533 |
+
|
534 |
+
pp_open = true;
|
535 |
+
});
|
536 |
+
|
537 |
+
_insert_gallery();
|
538 |
+
pp_settings.ajaxcallback();
|
539 |
+
};
|
540 |
+
|
541 |
+
/**
|
542 |
+
* Hide the content...DUH!
|
543 |
+
*/
|
544 |
+
function _hideContent(callback){
|
545 |
+
// Fade out the current picture
|
546 |
+
$pp_pic_holder.find('#pp_full_res object,#pp_full_res embed').css('visibility','hidden');
|
547 |
+
$pp_pic_holder.find('.pp_fade').fadeOut(settings.animation_speed,function(){
|
548 |
+
$('.pp_loaderIcon').show();
|
549 |
+
|
550 |
+
callback();
|
551 |
+
});
|
552 |
+
};
|
553 |
+
|
554 |
+
/**
|
555 |
+
* Check the item position in the gallery array, hide or show the navigation links
|
556 |
+
* @param setCount {integer} The total number of items in the set
|
557 |
+
*/
|
558 |
+
function _checkPosition(setCount){
|
559 |
+
(setCount > 1) ? $('.pp_nav').show() : $('.pp_nav').hide(); // Hide the bottom nav if it's not a set.
|
560 |
+
};
|
561 |
+
|
562 |
+
/**
|
563 |
+
* Resize the item dimensions if it's bigger than the viewport
|
564 |
+
* @param width {integer} Width of the item to be opened
|
565 |
+
* @param height {integer} Height of the item to be opened
|
566 |
+
* @return An array containin the "fitted" dimensions
|
567 |
+
*/
|
568 |
+
function _fitToViewport(width,height){
|
569 |
+
resized = false;
|
570 |
+
|
571 |
+
_getDimensions(width,height);
|
572 |
+
|
573 |
+
// Define them in case there's no resize needed
|
574 |
+
imageWidth = width, imageHeight = height;
|
575 |
+
|
576 |
+
if( ((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)) && doresize && settings.allow_resize && !percentBased) {
|
577 |
+
resized = true, fitting = false;
|
578 |
+
|
579 |
+
while (!fitting){
|
580 |
+
if((pp_containerWidth > windowWidth)){
|
581 |
+
imageWidth = (windowWidth - 200);
|
582 |
+
imageHeight = (height/width) * imageWidth;
|
583 |
+
}else if((pp_containerHeight > windowHeight)){
|
584 |
+
imageHeight = (windowHeight - 200);
|
585 |
+
imageWidth = (width/height) * imageHeight;
|
586 |
+
}else{
|
587 |
+
fitting = true;
|
588 |
+
};
|
589 |
+
|
590 |
+
pp_containerHeight = imageHeight, pp_containerWidth = imageWidth;
|
591 |
+
};
|
592 |
+
|
593 |
+
|
594 |
+
|
595 |
+
if((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)){
|
596 |
+
_fitToViewport(pp_containerWidth,pp_containerHeight)
|
597 |
+
};
|
598 |
+
|
599 |
+
_getDimensions(imageWidth,imageHeight);
|
600 |
+
};
|
601 |
+
|
602 |
+
return {
|
603 |
+
width:Math.floor(imageWidth),
|
604 |
+
height:Math.floor(imageHeight),
|
605 |
+
containerHeight:Math.floor(pp_containerHeight),
|
606 |
+
containerWidth:Math.floor(pp_containerWidth) + (settings.horizontal_padding * 2),
|
607 |
+
contentHeight:Math.floor(pp_contentHeight),
|
608 |
+
contentWidth:Math.floor(pp_contentWidth),
|
609 |
+
resized:resized
|
610 |
+
};
|
611 |
+
};
|
612 |
+
|
613 |
+
/**
|
614 |
+
* Get the containers dimensions according to the item size
|
615 |
+
* @param width {integer} Width of the item to be opened
|
616 |
+
* @param height {integer} Height of the item to be opened
|
617 |
+
*/
|
618 |
+
function _getDimensions(width,height){
|
619 |
+
width = parseFloat(width);
|
620 |
+
height = parseFloat(height);
|
621 |
+
|
622 |
+
// Get the details height, to do so, I need to clone it since it's invisible
|
623 |
+
$pp_details = $pp_pic_holder.find('.pp_details');
|
624 |
+
$pp_details.width(width);
|
625 |
+
detailsHeight = parseFloat($pp_details.css('marginTop')) + parseFloat($pp_details.css('marginBottom'));
|
626 |
+
|
627 |
+
$pp_details = $pp_details.clone().addClass(settings.theme).width(width).appendTo($('body')).css({
|
628 |
+
'position':'absolute',
|
629 |
+
'top':-10000
|
630 |
+
});
|
631 |
+
detailsHeight += $pp_details.height();
|
632 |
+
detailsHeight = (detailsHeight <= 34) ? 36 : detailsHeight; // Min-height for the details
|
633 |
+
$pp_details.remove();
|
634 |
+
|
635 |
+
// Get the titles height, to do so, I need to clone it since it's invisible
|
636 |
+
$pp_title = $pp_pic_holder.find('.ppt');
|
637 |
+
$pp_title.width(width);
|
638 |
+
titleHeight = parseFloat($pp_title.css('marginTop')) + parseFloat($pp_title.css('marginBottom'));
|
639 |
+
$pp_title = $pp_title.clone().appendTo($('body')).css({
|
640 |
+
'position':'absolute',
|
641 |
+
'top':-10000
|
642 |
+
});
|
643 |
+
titleHeight += $pp_title.height();
|
644 |
+
$pp_title.remove();
|
645 |
+
|
646 |
+
// Get the container size, to resize the holder to the right dimensions
|
647 |
+
pp_contentHeight = height + detailsHeight;
|
648 |
+
pp_contentWidth = width;
|
649 |
+
pp_containerHeight = pp_contentHeight + titleHeight + $pp_pic_holder.find('.pp_top').height() + $pp_pic_holder.find('.pp_bottom').height();
|
650 |
+
pp_containerWidth = width;
|
651 |
+
}
|
652 |
+
|
653 |
+
function _getFileType(itemSrc){
|
654 |
+
if (itemSrc.match(/youtube\.com\/watch/i) || itemSrc.match(/youtu\.be/i)) {
|
655 |
+
return 'youtube';
|
656 |
+
}else if (itemSrc.match(/vimeo\.com/i)) {
|
657 |
+
return 'vimeo';
|
658 |
+
}else if(itemSrc.match(/\b.mov\b/i)){
|
659 |
+
return 'quicktime';
|
660 |
+
}else if(itemSrc.match(/\b.swf\b/i)){
|
661 |
+
return 'flash';
|
662 |
+
}else if(itemSrc.match(/\biframe=true\b/i)){
|
663 |
+
return 'iframe';
|
664 |
+
}else if(itemSrc.match(/\bajax=true\b/i)){
|
665 |
+
return 'ajax';
|
666 |
+
}else if(itemSrc.match(/\bcustom=true\b/i)){
|
667 |
+
return 'custom';
|
668 |
+
}else if(itemSrc.substr(0,1) == '#'){
|
669 |
+
return 'inline';
|
670 |
+
}else{
|
671 |
+
return 'image';
|
672 |
+
};
|
673 |
+
};
|
674 |
+
|
675 |
+
function _center_overlay(){
|
676 |
+
if(doresize && typeof $pp_pic_holder != 'undefined') {
|
677 |
+
scroll_pos = _get_scroll();
|
678 |
+
contentHeight = $pp_pic_holder.height(), contentwidth = $pp_pic_holder.width();
|
679 |
+
|
680 |
+
projectedTop = (windowHeight/2) + scroll_pos['scrollTop'] - (contentHeight/2);
|
681 |
+
if(projectedTop < 0) projectedTop = 0;
|
682 |
+
|
683 |
+
if(contentHeight > windowHeight)
|
684 |
+
return;
|
685 |
+
|
686 |
+
$pp_pic_holder.css({
|
687 |
+
'top': projectedTop,
|
688 |
+
'left': (windowWidth/2) + scroll_pos['scrollLeft'] - (contentwidth/2)
|
689 |
+
});
|
690 |
+
};
|
691 |
+
};
|
692 |
+
|
693 |
+
function _get_scroll(){
|
694 |
+
if (self.pageYOffset) {
|
695 |
+
return {scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset};
|
696 |
+
} else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
|
697 |
+
return {scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft};
|
698 |
+
} else if (document.body) {// all other Explorers
|
699 |
+
return {scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft};
|
700 |
+
};
|
701 |
+
};
|
702 |
+
|
703 |
+
function _resize_overlay() {
|
704 |
+
windowHeight = $(window).height(), windowWidth = $(window).width();
|
705 |
+
|
706 |
+
if(typeof $pp_overlay != "undefined") $pp_overlay.height($(document).height()).width(windowWidth);
|
707 |
+
};
|
708 |
+
|
709 |
+
function _insert_gallery(){
|
710 |
+
if(isSet && settings.overlay_gallery && _getFileType(pp_images[set_position])=="image") {
|
711 |
+
itemWidth = 52+5; // 52 beign the thumb width, 5 being the right margin.
|
712 |
+
navWidth = (settings.theme == "facebook" || settings.theme == "pp_default") ? 50 : 30; // Define the arrow width depending on the theme
|
713 |
+
|
714 |
+
itemsPerPage = Math.floor((pp_dimensions['containerWidth'] - 100 - navWidth) / itemWidth);
|
715 |
+
itemsPerPage = (itemsPerPage < pp_images.length) ? itemsPerPage : pp_images.length;
|
716 |
+
totalPage = Math.ceil(pp_images.length / itemsPerPage) - 1;
|
717 |
+
|
718 |
+
// Hide the nav in the case there's no need for links
|
719 |
+
if(totalPage == 0){
|
720 |
+
navWidth = 0; // No nav means no width!
|
721 |
+
$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').hide();
|
722 |
+
}else{
|
723 |
+
$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').show();
|
724 |
+
};
|
725 |
+
|
726 |
+
galleryWidth = itemsPerPage * itemWidth;
|
727 |
+
fullGalleryWidth = pp_images.length * itemWidth;
|
728 |
+
|
729 |
+
// Set the proper width to the gallery items
|
730 |
+
$pp_gallery
|
731 |
+
.css('margin-left',-((galleryWidth/2) + (navWidth/2)))
|
732 |
+
.find('div:first').width(galleryWidth+5)
|
733 |
+
.find('ul').width(fullGalleryWidth)
|
734 |
+
.find('li.selected').removeClass('selected');
|
735 |
+
|
736 |
+
goToPage = (Math.floor(set_position/itemsPerPage) < totalPage) ? Math.floor(set_position/itemsPerPage) : totalPage;
|
737 |
+
|
738 |
+
$.prettyPhoto.changeGalleryPage(goToPage);
|
739 |
+
|
740 |
+
$pp_gallery_li.filter(':eq('+set_position+')').addClass('selected');
|
741 |
+
}else{
|
742 |
+
$pp_pic_holder.find('.pp_content').unbind('mouseenter mouseleave');
|
743 |
+
// $pp_gallery.hide();
|
744 |
+
}
|
745 |
+
}
|
746 |
+
|
747 |
+
function _build_overlay(caller){
|
748 |
+
// Inject Social Tool markup into General markup
|
749 |
+
if(settings.social_tools)
|
750 |
+
facebook_like_link = settings.social_tools.replace('{location_href}', encodeURIComponent(location.href));
|
751 |
+
|
752 |
+
settings.markup = settings.markup.replace('{pp_social}','');
|
753 |
+
|
754 |
+
$('body').append(settings.markup); // Inject the markup
|
755 |
+
|
756 |
+
$pp_pic_holder = $('.pp_pic_holder') , $ppt = $('.ppt'), $pp_overlay = $('div.pp_overlay'); // Set my global selectors
|
757 |
+
|
758 |
+
// Inject the inline gallery!
|
759 |
+
if(isSet && settings.overlay_gallery) {
|
760 |
+
currentGalleryPage = 0;
|
761 |
+
toInject = "";
|
762 |
+
for (var i=0; i < pp_images.length; i++) {
|
763 |
+
if(!pp_images[i].match(/\b(jpg|jpeg|png|gif)\b/gi)){
|
764 |
+
classname = 'default';
|
765 |
+
img_src = '';
|
766 |
+
}else{
|
767 |
+
classname = '';
|
768 |
+
img_src = pp_images[i];
|
769 |
+
}
|
770 |
+
toInject += "<li class='"+classname+"'><a href='#'><img src='" + img_src + "' width='50' alt='' /></a></li>";
|
771 |
+
};
|
772 |
+
|
773 |
+
toInject = settings.gallery_markup.replace(/{gallery}/g,toInject);
|
774 |
+
|
775 |
+
$pp_pic_holder.find('#pp_full_res').after(toInject);
|
776 |
+
|
777 |
+
$pp_gallery = $('.pp_pic_holder .pp_gallery'), $pp_gallery_li = $pp_gallery.find('li'); // Set the gallery selectors
|
778 |
+
|
779 |
+
$pp_gallery.find('.pp_arrow_next').click(function(){
|
780 |
+
$.prettyPhoto.changeGalleryPage('next');
|
781 |
+
$.prettyPhoto.stopSlideshow();
|
782 |
+
return false;
|
783 |
+
});
|
784 |
+
|
785 |
+
$pp_gallery.find('.pp_arrow_previous').click(function(){
|
786 |
+
$.prettyPhoto.changeGalleryPage('previous');
|
787 |
+
$.prettyPhoto.stopSlideshow();
|
788 |
+
return false;
|
789 |
+
});
|
790 |
+
|
791 |
+
$pp_pic_holder.find('.pp_content').hover(
|
792 |
+
function(){
|
793 |
+
$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn();
|
794 |
+
},
|
795 |
+
function(){
|
796 |
+
$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut();
|
797 |
+
});
|
798 |
+
|
799 |
+
itemWidth = 52+5; // 52 beign the thumb width, 5 being the right margin.
|
800 |
+
$pp_gallery_li.each(function(i){
|
801 |
+
$(this)
|
802 |
+
.find('a')
|
803 |
+
.click(function(){
|
804 |
+
$.prettyPhoto.changePage(i);
|
805 |
+
$.prettyPhoto.stopSlideshow();
|
806 |
+
return false;
|
807 |
+
});
|
808 |
+
});
|
809 |
+
};
|
810 |
+
|
811 |
+
|
812 |
+
// Inject the play/pause if it's a slideshow
|
813 |
+
if(settings.slideshow){
|
814 |
+
$pp_pic_holder.find('.pp_nav').prepend('<a href="#" class="pp_play">Play</a>')
|
815 |
+
$pp_pic_holder.find('.pp_nav .pp_play').click(function(){
|
816 |
+
$.prettyPhoto.startSlideshow();
|
817 |
+
return false;
|
818 |
+
});
|
819 |
+
}
|
820 |
+
|
821 |
+
$pp_pic_holder.attr('class','pp_pic_holder ' + settings.theme); // Set the proper theme
|
822 |
+
|
823 |
+
$pp_overlay
|
824 |
+
.css({
|
825 |
+
'opacity':0,
|
826 |
+
'height':$(document).height(),
|
827 |
+
'width':$(window).width()
|
828 |
+
})
|
829 |
+
.bind('click',function(){
|
830 |
+
if(!settings.modal) $.prettyPhoto.close();
|
831 |
+
});
|
832 |
+
|
833 |
+
$('a.pp_close').bind('click',function(){ $.prettyPhoto.close(); return false; });
|
834 |
+
|
835 |
+
|
836 |
+
if(settings.allow_expand) {
|
837 |
+
$('a.pp_expand').bind('click',function(e){
|
838 |
+
// Expand the image
|
839 |
+
if($(this).hasClass('pp_expand')){
|
840 |
+
$(this).removeClass('pp_expand').addClass('pp_contract');
|
841 |
+
doresize = false;
|
842 |
+
}else{
|
843 |
+
$(this).removeClass('pp_contract').addClass('pp_expand');
|
844 |
+
doresize = true;
|
845 |
+
};
|
846 |
+
|
847 |
+
_hideContent(function(){ $.prettyPhoto.open(); });
|
848 |
+
|
849 |
+
return false;
|
850 |
+
});
|
851 |
+
}
|
852 |
+
|
853 |
+
$pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click',function(){
|
854 |
+
$.prettyPhoto.changePage('previous');
|
855 |
+
$.prettyPhoto.stopSlideshow();
|
856 |
+
return false;
|
857 |
+
});
|
858 |
+
|
859 |
+
$pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click',function(){
|
860 |
+
$.prettyPhoto.changePage('next');
|
861 |
+
$.prettyPhoto.stopSlideshow();
|
862 |
+
return false;
|
863 |
+
});
|
864 |
+
|
865 |
+
_center_overlay(); // Center it
|
866 |
+
};
|
867 |
+
|
868 |
+
if(!pp_alreadyInitialized && getHashtag()){
|
869 |
+
pp_alreadyInitialized = true;
|
870 |
+
|
871 |
+
// Grab the rel index to trigger the click on the correct element
|
872 |
+
hashIndex = getHashtag();
|
873 |
+
hashRel = hashIndex;
|
874 |
+
hashIndex = hashIndex.substring(hashIndex.indexOf('/')+1,hashIndex.length-1);
|
875 |
+
hashRel = hashRel.substring(0,hashRel.indexOf('/'));
|
876 |
+
|
877 |
+
// Little timeout to make sure all the prettyPhoto initialize scripts has been run.
|
878 |
+
// Useful in the event the page contain several init scripts.
|
879 |
+
setTimeout(function(){ $("a["+pp_settings.hook+"^='"+hashRel+"']:eq("+hashIndex+")").trigger('click'); },50);
|
880 |
+
}
|
881 |
+
|
882 |
+
return this.unbind('click.prettyphoto').bind('click.prettyphoto',$.prettyPhoto.initialize); // Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once
|
883 |
+
};
|
884 |
+
|
885 |
+
function getHashtag(){
|
886 |
+
var url = location.href;
|
887 |
+
hashtag = (url.indexOf('#prettyPhoto') !== -1) ? decodeURI(url.substring(url.indexOf('#prettyPhoto')+1,url.length)) : false;
|
888 |
+
if(hashtag){ hashtag = hashtag.replace(/<|>/g,''); }
|
889 |
+
return hashtag;
|
890 |
+
};
|
891 |
+
|
892 |
+
function setHashtag(){
|
893 |
+
if(typeof theRel == 'undefined') return; // theRel is set on normal calls, it's impossible to deeplink using the API
|
894 |
+
location.hash = theRel + '/'+rel_index+'/';
|
895 |
+
};
|
896 |
+
|
897 |
+
function clearHashtag(){
|
898 |
+
if ( location.href.indexOf('#prettyPhoto') !== -1 ) location.hash = "prettyPhoto";
|
899 |
+
}
|
900 |
+
|
901 |
+
function getParam(name,url){
|
902 |
+
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
|
903 |
+
var regexS = "[\\?&]"+name+"=([^&#]*)";
|
904 |
+
var regex = new RegExp( regexS );
|
905 |
+
var results = regex.exec( url );
|
906 |
+
return ( results == null ) ? "" : results[1];
|
907 |
+
}
|
908 |
+
|
909 |
+
})(jQuery);
|
910 |
+
|
911 |
+
var pp_alreadyInitialized = false; // Used for the deep linking to make sure not to call the same function several times.
|
assets/swipebox/lib/ios-orientationchange-fix.js
DELETED
@@ -1,56 +0,0 @@
|
|
1 |
-
/*! A fix for the iOS orientationchange zoom bug.
|
2 |
-
Script by @scottjehl, rebound by @wilto.
|
3 |
-
MIT / GPLv2 License.
|
4 |
-
*/
|
5 |
-
(function(w){
|
6 |
-
|
7 |
-
// This fix addresses an iOS bug, so return early if the UA claims it's something else.
|
8 |
-
var ua = navigator.userAgent;
|
9 |
-
if( !( /iPhone|iPad|iPod/.test( navigator.platform ) && /OS [1-5]_[0-9_]* like Mac OS X/i.test(ua) && ua.indexOf( "AppleWebKit" ) > -1 ) ){
|
10 |
-
return;
|
11 |
-
}
|
12 |
-
|
13 |
-
var doc = w.document;
|
14 |
-
|
15 |
-
if( !doc.querySelector ){ return; }
|
16 |
-
|
17 |
-
var meta = doc.querySelector( "meta[name=viewport]" ),
|
18 |
-
initialContent = meta && meta.getAttribute( "content" ),
|
19 |
-
disabledZoom = initialContent + ",maximum-scale=1",
|
20 |
-
enabledZoom = initialContent + ",maximum-scale=10",
|
21 |
-
enabled = true,
|
22 |
-
x, y, z, aig;
|
23 |
-
|
24 |
-
if( !meta ){ return; }
|
25 |
-
|
26 |
-
function restoreZoom(){
|
27 |
-
meta.setAttribute( "content", enabledZoom );
|
28 |
-
enabled = true;
|
29 |
-
}
|
30 |
-
|
31 |
-
function disableZoom(){
|
32 |
-
meta.setAttribute( "content", disabledZoom );
|
33 |
-
enabled = false;
|
34 |
-
}
|
35 |
-
|
36 |
-
function checkTilt( e ){
|
37 |
-
aig = e.accelerationIncludingGravity;
|
38 |
-
x = Math.abs( aig.x );
|
39 |
-
y = Math.abs( aig.y );
|
40 |
-
z = Math.abs( aig.z );
|
41 |
-
|
42 |
-
// If portrait orientation and in one of the danger zones
|
43 |
-
if( (!w.orientation || w.orientation === 180) && ( x > 7 || ( ( z > 6 && y < 8 || z < 8 && y > 6 ) && x > 5 ) ) ){
|
44 |
-
if( enabled ){
|
45 |
-
disableZoom();
|
46 |
-
}
|
47 |
-
}
|
48 |
-
else if( !enabled ){
|
49 |
-
restoreZoom();
|
50 |
-
}
|
51 |
-
}
|
52 |
-
|
53 |
-
w.addEventListener( "orientationchange", restoreZoom, false );
|
54 |
-
w.addEventListener( "devicemotion", checkTilt, false );
|
55 |
-
|
56 |
-
})( this );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/swipebox/source/img/icons.png
DELETED
Binary file
|
assets/swipebox/source/img/icons.svg
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<?xml version="1.0" encoding="utf-8"?> <!-- Generator: IcoMoon.io --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg width="120" height="24" viewBox="0 0 120 24" fill="#ffffff" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M 17.384,17.705q0.00,0.536 -0.375,0.911l-1.821,1.821q-0.375,0.375 -0.911,0.375t-0.911-0.375l-3.938-3.938l-3.938,3.938q-0.375,0.375 -0.911,0.375t-0.911-0.375l-1.821-1.821q-0.375-0.375 -0.375-0.911t 0.375-0.911l 3.938-3.938l-3.938-3.938q-0.375-0.375 -0.375-0.911t 0.375-0.911l 1.821-1.821q 0.375-0.375 0.911-0.375t 0.911,0.375l 3.938,3.938l 3.938-3.938q 0.375-0.375 0.911-0.375t 0.911,0.375l 1.821,1.821q 0.375,0.375 0.375,0.911 t-0.375,0.911l-3.938,3.938l 3.938,3.938q 0.375,0.375 0.375,0.911zM 57.938,21.067l-8.732-8.719q-0.496-0.496 -0.496-1.212t 0.496-1.212l 8.732-8.719q 0.496-0.496 1.212-0.496t 1.212,0.496l 1.004,1.004q 0.496,0.496 0.496,1.212t-0.496,1.212l-6.509,6.509l 6.509,6.496q 0.496,0.509 0.496,1.219t-0.496,1.205l-1.004,1.004q-0.496,0.496 -1.212,0.496t-1.212-0.496zM 110.719,11.143q0.00,0.696 -0.496,1.219l-8.732,8.719q-0.496,0.496 -1.205,0.496t-1.205-0.496l-1.018-1.004q-0.496-0.522 -0.496-1.219q0.00-0.71 0.496-1.205l 6.509-6.509l-6.509-6.496q-0.496-0.522 -0.496-1.219q0.00-0.71 0.496-1.205l 1.018-1.004q 0.482-0.509 1.205-0.509t 1.205,0.509l 8.732,8.719q 0.496,0.496 0.496,1.205z"></path></svg>
|
|
assets/swipebox/source/img/loader.gif
DELETED
Binary file
|
assets/swipebox/source/jquery.swipebox.js
DELETED
@@ -1,451 +0,0 @@
|
|
1 |
-
/*---------------------------------------------------------------------------------------------
|
2 |
-
|
3 |
-
@author Constantin Saguin - @brutaldesign
|
4 |
-
@link http://bsign.co
|
5 |
-
@github http://github.com/brutaldesign/swipebox
|
6 |
-
@version 1.1.2
|
7 |
-
@license MIT License
|
8 |
-
|
9 |
-
----------------------------------------------------------------------------------------------*/
|
10 |
-
|
11 |
-
;(function (window, document, $, undefined) {
|
12 |
-
|
13 |
-
$.swipebox = function(elem, options) {
|
14 |
-
|
15 |
-
var defaults = {
|
16 |
-
useCSS : true,
|
17 |
-
hideBarsDelay : 3000
|
18 |
-
},
|
19 |
-
|
20 |
-
plugin = this,
|
21 |
-
$elem = $(elem),
|
22 |
-
elem = elem,
|
23 |
-
selector = elem.selector,
|
24 |
-
$selector = $(selector),
|
25 |
-
isTouch = document.createTouch !== undefined || ('ontouchstart' in window) || ('onmsgesturechange' in window) || navigator.msMaxTouchPoints,
|
26 |
-
supportSVG = !!(window.SVGSVGElement),
|
27 |
-
html = '<div id="swipebox-overlay">\
|
28 |
-
<div id="swipebox-slider"></div>\
|
29 |
-
<div id="swipebox-caption"></div>\
|
30 |
-
<div id="swipebox-action">\
|
31 |
-
<a id="swipebox-close"></a>\
|
32 |
-
<a id="swipebox-prev"></a>\
|
33 |
-
<a id="swipebox-next"></a>\
|
34 |
-
</div>\
|
35 |
-
</div>';
|
36 |
-
|
37 |
-
plugin.settings = {}
|
38 |
-
|
39 |
-
plugin.init = function(){
|
40 |
-
|
41 |
-
plugin.settings = $.extend({}, defaults, options);
|
42 |
-
|
43 |
-
$selector.click(function(e){
|
44 |
-
e.preventDefault();
|
45 |
-
e.stopPropagation();
|
46 |
-
index = $elem.index($(this));
|
47 |
-
ui.target = $(e.target);
|
48 |
-
ui.init(index);
|
49 |
-
});
|
50 |
-
}
|
51 |
-
|
52 |
-
var ui = {
|
53 |
-
|
54 |
-
init : function(index){
|
55 |
-
this.target.trigger('swipebox-start');
|
56 |
-
this.build();
|
57 |
-
this.openSlide(index);
|
58 |
-
this.openImg(index);
|
59 |
-
this.preloadImg(index+1);
|
60 |
-
this.preloadImg(index-1);
|
61 |
-
},
|
62 |
-
|
63 |
-
build : function(){
|
64 |
-
var $this = this;
|
65 |
-
|
66 |
-
$('body').append(html);
|
67 |
-
|
68 |
-
if($this.doCssTrans()){
|
69 |
-
$('#swipebox-slider').css({
|
70 |
-
'-webkit-transition' : 'left 0.4s ease',
|
71 |
-
'-moz-transition' : 'left 0.4s ease',
|
72 |
-
'-o-transition' : 'left 0.4s ease',
|
73 |
-
'-khtml-transition' : 'left 0.4s ease',
|
74 |
-
'transition' : 'left 0.4s ease'
|
75 |
-
});
|
76 |
-
$('#swipebox-overlay').css({
|
77 |
-
'-webkit-transition' : 'opacity 1s ease',
|
78 |
-
'-moz-transition' : 'opacity 1s ease',
|
79 |
-
'-o-transition' : 'opacity 1s ease',
|
80 |
-
'-khtml-transition' : 'opacity 1s ease',
|
81 |
-
'transition' : 'opacity 1s ease'
|
82 |
-
});
|
83 |
-
$('#swipebox-action, #swipebox-caption').css({
|
84 |
-
'-webkit-transition' : '0.5s',
|
85 |
-
'-moz-transition' : '0.5s',
|
86 |
-
'-o-transition' : '0.5s',
|
87 |
-
'-khtml-transition' : '0.5s',
|
88 |
-
'transition' : '0.5s'
|
89 |
-
});
|
90 |
-
}
|
91 |
-
|
92 |
-
|
93 |
-
if(supportSVG){
|
94 |
-
var bg = $('#swipebox-action #swipebox-close').css('background-image');
|
95 |
-
bg = bg.replace('png', 'svg');
|
96 |
-
$('#swipebox-action #swipebox-prev,#swipebox-action #swipebox-next,#swipebox-action #swipebox-close').css({
|
97 |
-
'background-image' : bg
|
98 |
-
});
|
99 |
-
}
|
100 |
-
|
101 |
-
$elem.each(function(){
|
102 |
-
$('#swipebox-slider').append('<div class="slide"></div>');
|
103 |
-
});
|
104 |
-
|
105 |
-
$this.setDim();
|
106 |
-
$this.actions();
|
107 |
-
$this.keyboard();
|
108 |
-
$this.gesture();
|
109 |
-
$this.animBars();
|
110 |
-
|
111 |
-
$(window).resize(function() {
|
112 |
-
$this.setDim();
|
113 |
-
}).resize();
|
114 |
-
},
|
115 |
-
|
116 |
-
setDim : function(){
|
117 |
-
var sliderCss = {
|
118 |
-
width : $(window).width(),
|
119 |
-
height : window.innerHeight ? window.innerHeight : $(window).height() // fix IOS bug
|
120 |
-
}
|
121 |
-
|
122 |
-
$('#swipebox-overlay').css(sliderCss);
|
123 |
-
|
124 |
-
},
|
125 |
-
|
126 |
-
supportTransition : function() {
|
127 |
-
var prefixes = 'transition WebkitTransition MozTransition OTransition msTransition KhtmlTransition'.split(' ');
|
128 |
-
for(var i = 0; i < prefixes.length; i++) {
|
129 |
-
if(document.createElement('div').style[prefixes[i]] !== undefined) {
|
130 |
-
return prefixes[i];
|
131 |
-
}
|
132 |
-
}
|
133 |
-
return false;
|
134 |
-
},
|
135 |
-
|
136 |
-
doCssTrans : function(){
|
137 |
-
if(plugin.settings.useCSS && this.supportTransition() ){
|
138 |
-
return true;
|
139 |
-
}
|
140 |
-
},
|
141 |
-
|
142 |
-
gesture : function(){
|
143 |
-
if ( isTouch ){
|
144 |
-
var $this = this,
|
145 |
-
distance = null,
|
146 |
-
swipMinDistance = 10,
|
147 |
-
startCoords = {},
|
148 |
-
endCoords = {};
|
149 |
-
var b = $('#swipebox-caption, #swipebox-action');
|
150 |
-
|
151 |
-
b.addClass('visible-bars');
|
152 |
-
$this.setTimeout();
|
153 |
-
|
154 |
-
$('body').bind('touchstart', function(e){
|
155 |
-
|
156 |
-
$(this).addClass('touching');
|
157 |
-
|
158 |
-
endCoords = e.originalEvent.targetTouches[0];
|
159 |
-
startCoords.pageX = e.originalEvent.targetTouches[0].pageX;
|
160 |
-
|
161 |
-
$('.touching').bind('touchmove',function(e){
|
162 |
-
e.preventDefault();
|
163 |
-
e.stopPropagation();
|
164 |
-
endCoords = e.originalEvent.targetTouches[0];
|
165 |
-
|
166 |
-
});
|
167 |
-
|
168 |
-
return false;
|
169 |
-
|
170 |
-
}).bind('touchend',function(e){
|
171 |
-
e.preventDefault();
|
172 |
-
e.stopPropagation();
|
173 |
-
|
174 |
-
distance = endCoords.pageX - startCoords.pageX;
|
175 |
-
|
176 |
-
if( distance >= swipMinDistance ){
|
177 |
-
// swipeLeft
|
178 |
-
$this.getPrev();
|
179 |
-
}
|
180 |
-
|
181 |
-
else if( distance <= - swipMinDistance ){
|
182 |
-
// swipeRight
|
183 |
-
$this.getNext();
|
184 |
-
|
185 |
-
}else{
|
186 |
-
// tap
|
187 |
-
if(!b.hasClass('visible-bars')){
|
188 |
-
$this.showBars();
|
189 |
-
$this.setTimeout();
|
190 |
-
}else{
|
191 |
-
$this.clearTimeout();
|
192 |
-
$this.hideBars();
|
193 |
-
}
|
194 |
-
|
195 |
-
}
|
196 |
-
|
197 |
-
$('.touching').off('touchmove').removeClass('touching');
|
198 |
-
|
199 |
-
});
|
200 |
-
|
201 |
-
}
|
202 |
-
},
|
203 |
-
|
204 |
-
setTimeout: function(){
|
205 |
-
if(plugin.settings.hideBarsDelay > 0){
|
206 |
-
var $this = this;
|
207 |
-
$this.clearTimeout();
|
208 |
-
$this.timeout = window.setTimeout( function(){
|
209 |
-
$this.hideBars() },
|
210 |
-
plugin.settings.hideBarsDelay
|
211 |
-
);
|
212 |
-
}
|
213 |
-
},
|
214 |
-
|
215 |
-
clearTimeout: function(){
|
216 |
-
window.clearTimeout(this.timeout);
|
217 |
-
this.timeout = null;
|
218 |
-
},
|
219 |
-
|
220 |
-
showBars : function(){
|
221 |
-
var b = $('#swipebox-caption, #swipebox-action');
|
222 |
-
if(this.doCssTrans()){
|
223 |
-
b.addClass('visible-bars');
|
224 |
-
}else{
|
225 |
-
$('#swipebox-caption').animate({ top : 0 }, 500);
|
226 |
-
$('#swipebox-action').animate({ bottom : 0 }, 500);
|
227 |
-
setTimeout(function(){
|
228 |
-
b.addClass('visible-bars');
|
229 |
-
}, 1000);
|
230 |
-
}
|
231 |
-
},
|
232 |
-
|
233 |
-
hideBars : function(){
|
234 |
-
var b = $('#swipebox-caption, #swipebox-action');
|
235 |
-
if(this.doCssTrans()){
|
236 |
-
b.removeClass('visible-bars');
|
237 |
-
}else{
|
238 |
-
$('#swipebox-caption').animate({ top : '-50px' }, 500);
|
239 |
-
$('#swipebox-action').animate({ bottom : '-50px' }, 500);
|
240 |
-
setTimeout(function(){
|
241 |
-
b.removeClass('visible-bars');
|
242 |
-
}, 1000);
|
243 |
-
}
|
244 |
-
},
|
245 |
-
|
246 |
-
animBars : function(){
|
247 |
-
var $this = this;
|
248 |
-
var b = $('#swipebox-caption, #swipebox-action');
|
249 |
-
|
250 |
-
b.addClass('visible-bars');
|
251 |
-
$this.setTimeout();
|
252 |
-
|
253 |
-
$('#swipebox-slider').click(function(e){
|
254 |
-
if(!b.hasClass('visible-bars')){
|
255 |
-
$this.showBars();
|
256 |
-
$this.setTimeout();
|
257 |
-
}
|
258 |
-
});
|
259 |
-
|
260 |
-
$('#swipebox-action').hover(function() {
|
261 |
-
$this.showBars();
|
262 |
-
b.addClass('force-visible-bars');
|
263 |
-
$this.clearTimeout();
|
264 |
-
|
265 |
-
},function() {
|
266 |
-
b.removeClass('force-visible-bars');
|
267 |
-
$this.setTimeout();
|
268 |
-
|
269 |
-
});
|
270 |
-
},
|
271 |
-
|
272 |
-
keyboard : function(){
|
273 |
-
var $this = this;
|
274 |
-
$(window).bind('keyup', function(e){
|
275 |
-
e.preventDefault();
|
276 |
-
e.stopPropagation();
|
277 |
-
if (e.keyCode == 37){
|
278 |
-
$this.getPrev();
|
279 |
-
}
|
280 |
-
else if (e.keyCode==39){
|
281 |
-
$this.getNext();
|
282 |
-
}
|
283 |
-
else if (e.keyCode == 27) {
|
284 |
-
$this.closeSlide();
|
285 |
-
}
|
286 |
-
});
|
287 |
-
},
|
288 |
-
|
289 |
-
actions : function(){
|
290 |
-
var $this = this;
|
291 |
-
|
292 |
-
if( $elem.length < 2 ){
|
293 |
-
$('#swipebox-prev, #swipebox-next').hide();
|
294 |
-
}else{
|
295 |
-
$('#swipebox-prev').bind('click touchend', function(e){
|
296 |
-
e.preventDefault();
|
297 |
-
e.stopPropagation();
|
298 |
-
$this.getPrev();
|
299 |
-
$this.setTimeout();
|
300 |
-
});
|
301 |
-
|
302 |
-
$('#swipebox-next').bind('click touchend', function(e){
|
303 |
-
e.preventDefault();
|
304 |
-
e.stopPropagation();
|
305 |
-
$this.getNext();
|
306 |
-
$this.setTimeout();
|
307 |
-
});
|
308 |
-
}
|
309 |
-
|
310 |
-
$('#swipebox-close').bind('click touchend', function(e){
|
311 |
-
$this.closeSlide();
|
312 |
-
});
|
313 |
-
},
|
314 |
-
|
315 |
-
setSlide : function (index, isFirst){
|
316 |
-
isFirst = isFirst || false;
|
317 |
-
|
318 |
-
var slider = $('#swipebox-slider');
|
319 |
-
|
320 |
-
if(this.doCssTrans()){
|
321 |
-
slider.css({ left : (-index*100)+'%' });
|
322 |
-
}else{
|
323 |
-
slider.animate({ left : (-index*100)+'%' });
|
324 |
-
}
|
325 |
-
|
326 |
-
$('#swipebox-slider .slide').removeClass('current');
|
327 |
-
$('#swipebox-slider .slide').eq(index).addClass('current');
|
328 |
-
this.setTitle(index);
|
329 |
-
|
330 |
-
if( isFirst ){
|
331 |
-
slider.fadeIn();
|
332 |
-
}
|
333 |
-
|
334 |
-
$('#swipebox-prev, #swipebox-next').removeClass('disabled');
|
335 |
-
if(index == 0){
|
336 |
-
$('#swipebox-prev').addClass('disabled');
|
337 |
-
}else if( index == $elem.length - 1 ){
|
338 |
-
$('#swipebox-next').addClass('disabled');
|
339 |
-
}
|
340 |
-
},
|
341 |
-
|
342 |
-
openSlide : function (index){
|
343 |
-
|
344 |
-
$('html').addClass('swipebox');
|
345 |
-
$(window).trigger('resize'); // fix scroll bar visibility on desktop
|
346 |
-
this.setSlide(index, true);
|
347 |
-
},
|
348 |
-
|
349 |
-
preloadImg : function (index){
|
350 |
-
var $this = this;
|
351 |
-
setTimeout(function(){
|
352 |
-
$this.openImg(index);
|
353 |
-
}, 1000);
|
354 |
-
},
|
355 |
-
|
356 |
-
openImg : function (index){
|
357 |
-
var $this = this;
|
358 |
-
if(index < 0 || index >= $elem.length){
|
359 |
-
return false;
|
360 |
-
}
|
361 |
-
|
362 |
-
$this.loadImg($elem.eq(index).attr('href'), function(){
|
363 |
-
$('#swipebox-slider .slide').eq(index).html(this);
|
364 |
-
});
|
365 |
-
},
|
366 |
-
|
367 |
-
|
368 |
-
setTitle : function(index, isFirst){
|
369 |
-
$('#swipebox-caption').empty();
|
370 |
-
|
371 |
-
if($elem.eq(index).attr('title')){
|
372 |
-
$('#swipebox-caption').append($elem.eq(index).attr('title'));
|
373 |
-
}
|
374 |
-
},
|
375 |
-
|
376 |
-
loadImg : function (src, callback){
|
377 |
-
var img = $('<img>').on('load', function(){
|
378 |
-
callback.call(img);
|
379 |
-
});
|
380 |
-
|
381 |
-
img.attr('src',src);
|
382 |
-
},
|
383 |
-
|
384 |
-
getNext : function (){
|
385 |
-
var $this = this;
|
386 |
-
index = $('#swipebox-slider .slide').index($('#swipebox-slider .slide.current'));
|
387 |
-
if(index+1 < $elem.length){
|
388 |
-
index++;
|
389 |
-
$this.setSlide(index);
|
390 |
-
$this.preloadImg(index+1);
|
391 |
-
}
|
392 |
-
else{
|
393 |
-
|
394 |
-
$('#swipebox-slider').addClass('rightSpring');
|
395 |
-
setTimeout(function(){
|
396 |
-
$('#swipebox-slider').removeClass('rightSpring');
|
397 |
-
},500);
|
398 |
-
}
|
399 |
-
},
|
400 |
-
|
401 |
-
getPrev : function (){
|
402 |
-
var $this = this;
|
403 |
-
index = $('#swipebox-slider .slide').index($('#swipebox-slider .slide.current'));
|
404 |
-
if(index > 0){
|
405 |
-
index--;
|
406 |
-
$this.setSlide(index);
|
407 |
-
$this.preloadImg(index-1);
|
408 |
-
}
|
409 |
-
else{
|
410 |
-
|
411 |
-
$('#swipebox-slider').addClass('leftSpring');
|
412 |
-
setTimeout(function(){
|
413 |
-
$('#swipebox-slider').removeClass('leftSpring');
|
414 |
-
},500);
|
415 |
-
}
|
416 |
-
},
|
417 |
-
|
418 |
-
|
419 |
-
closeSlide : function (){
|
420 |
-
var $this = this;
|
421 |
-
$(window).trigger('resize');
|
422 |
-
$('html').removeClass('swipebox');
|
423 |
-
$this.destroy();
|
424 |
-
},
|
425 |
-
|
426 |
-
destroy : function(){
|
427 |
-
var $this = this;
|
428 |
-
$(window).unbind('keyup');
|
429 |
-
$('body').unbind('touchstart');
|
430 |
-
$('body').unbind('touchmove');
|
431 |
-
$('body').unbind('touchend');
|
432 |
-
$('#swipebox-slider').unbind();
|
433 |
-
$('#swipebox-overlay').remove();
|
434 |
-
$elem.removeData('_swipebox');
|
435 |
-
$this.target.trigger('swipebox-destroy');
|
436 |
-
}
|
437 |
-
|
438 |
-
}
|
439 |
-
|
440 |
-
plugin.init();
|
441 |
-
|
442 |
-
}
|
443 |
-
|
444 |
-
$.fn.swipebox = function(options){
|
445 |
-
if (!$.data(this, "_swipebox")) {
|
446 |
-
var swipebox = new $.swipebox(this, options);
|
447 |
-
this.data('_swipebox', swipebox);
|
448 |
-
}
|
449 |
-
}
|
450 |
-
|
451 |
-
}(window, document, jQuery));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/swipebox/source/jquery.swipebox.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
;(function(e,t,n,r){n.swipebox=function(i,s){var o={useCSS:true,hideBarsDelay:3e3},u=this,a=n(i),i=i,f=i.selector,l=n(f),c=t.createTouch!==r||"ontouchstart"in e||"onmsgesturechange"in e||navigator.msMaxTouchPoints,h=!!e.SVGSVGElement,p='<div id="swipebox-overlay"> <div id="swipebox-slider"></div> <div id="swipebox-caption"></div> <div id="swipebox-action"> <a id="swipebox-close"></a> <a id="swipebox-prev"></a> <a id="swipebox-next"></a> </div> </div>';u.settings={};u.init=function(){u.settings=n.extend({},o,s);l.click(function(e){e.preventDefault();e.stopPropagation();index=a.index(n(this));d.target=n(e.target);d.init(index)})};var d={init:function(e){this.target.trigger("swipebox-start");this.build();this.openSlide(e);this.openImg(e);this.preloadImg(e+1);this.preloadImg(e-1)},build:function(){var t=this;n("body").append(p);if(t.doCssTrans()){n("#swipebox-slider").css({"-webkit-transition":"left 0.4s ease","-moz-transition":"left 0.4s ease","-o-transition":"left 0.4s ease","-khtml-transition":"left 0.4s ease",transition:"left 0.4s ease"});n("#swipebox-overlay").css({"-webkit-transition":"opacity 1s ease","-moz-transition":"opacity 1s ease","-o-transition":"opacity 1s ease","-khtml-transition":"opacity 1s ease",transition:"opacity 1s ease"});n("#swipebox-action, #swipebox-caption").css({"-webkit-transition":"0.5s","-moz-transition":"0.5s","-o-transition":"0.5s","-khtml-transition":"0.5s",transition:"0.5s"})}if(h){var r=n("#swipebox-action #swipebox-close").css("background-image");r=r.replace("png","svg");n("#swipebox-action #swipebox-prev,#swipebox-action #swipebox-next,#swipebox-action #swipebox-close").css({"background-image":r})}a.each(function(){n("#swipebox-slider").append('<div class="slide"></div>')});t.setDim();t.actions();t.keyboard();t.gesture();t.animBars();n(e).resize(function(){t.setDim()}).resize()},setDim:function(){var t={width:n(e).width(),height:e.innerHeight?e.innerHeight:n(e).height()};n("#swipebox-overlay").css(t)},supportTransition:function(){var e="transition WebkitTransition MozTransition OTransition msTransition KhtmlTransition".split(" ");for(var n=0;n<e.length;n++){if(t.createElement("div").style[e[n]]!==r){return e[n]}}return false},doCssTrans:function(){if(u.settings.useCSS&&this.supportTransition()){return true}},gesture:function(){if(c){var e=this,t=null,r=10,i={},s={};var o=n("#swipebox-caption, #swipebox-action");o.addClass("visible-bars");e.setTimeout();n("body").bind("touchstart",function(e){n(this).addClass("touching");s=e.originalEvent.targetTouches[0];i.pageX=e.originalEvent.targetTouches[0].pageX;n(".touching").bind("touchmove",function(e){e.preventDefault();e.stopPropagation();s=e.originalEvent.targetTouches[0]});return false}).bind("touchend",function(u){u.preventDefault();u.stopPropagation();t=s.pageX-i.pageX;if(t>=r){e.getPrev()}else if(t<=-r){e.getNext()}else{if(!o.hasClass("visible-bars")){e.showBars();e.setTimeout()}else{e.clearTimeout();e.hideBars()}}n(".touching").off("touchmove").removeClass("touching")})}},setTimeout:function(){if(u.settings.hideBarsDelay>0){var t=this;t.clearTimeout();t.timeout=e.setTimeout(function(){t.hideBars()},u.settings.hideBarsDelay)}},clearTimeout:function(){e.clearTimeout(this.timeout);this.timeout=null},showBars:function(){var e=n("#swipebox-caption, #swipebox-action");if(this.doCssTrans()){e.addClass("visible-bars")}else{n("#swipebox-caption").animate({top:0},500);n("#swipebox-action").animate({bottom:0},500);setTimeout(function(){e.addClass("visible-bars")},1e3)}},hideBars:function(){var e=n("#swipebox-caption, #swipebox-action");if(this.doCssTrans()){e.removeClass("visible-bars")}else{n("#swipebox-caption").animate({top:"-50px"},500);n("#swipebox-action").animate({bottom:"-50px"},500);setTimeout(function(){e.removeClass("visible-bars")},1e3)}},animBars:function(){var e=this;var t=n("#swipebox-caption, #swipebox-action");t.addClass("visible-bars");e.setTimeout();n("#swipebox-slider").click(function(n){if(!t.hasClass("visible-bars")){e.showBars();e.setTimeout()}});n("#swipebox-action").hover(function(){e.showBars();t.addClass("force-visible-bars");e.clearTimeout()},function(){t.removeClass("force-visible-bars");e.setTimeout()})},keyboard:function(){var t=this;n(e).bind("keyup",function(e){e.preventDefault();e.stopPropagation();if(e.keyCode==37){t.getPrev()}else if(e.keyCode==39){t.getNext()}else if(e.keyCode==27){t.closeSlide()}})},actions:function(){var e=this;if(a.length<2){n("#swipebox-prev, #swipebox-next").hide()}else{n("#swipebox-prev").bind("click touchend",function(t){t.preventDefault();t.stopPropagation();e.getPrev();e.setTimeout()});n("#swipebox-next").bind("click touchend",function(t){t.preventDefault();t.stopPropagation();e.getNext();e.setTimeout()})}n("#swipebox-close").bind("click touchend",function(t){e.closeSlide()})},setSlide:function(e,t){t=t||false;var r=n("#swipebox-slider");if(this.doCssTrans()){r.css({left:-e*100+"%"})}else{r.animate({left:-e*100+"%"})}n("#swipebox-slider .slide").removeClass("current");n("#swipebox-slider .slide").eq(e).addClass("current");this.setTitle(e);if(t){r.fadeIn()}n("#swipebox-prev, #swipebox-next").removeClass("disabled");if(e==0){n("#swipebox-prev").addClass("disabled")}else if(e==a.length-1){n("#swipebox-next").addClass("disabled")}},openSlide:function(t){n("html").addClass("swipebox");n(e).trigger("resize");this.setSlide(t,true)},preloadImg:function(e){var t=this;setTimeout(function(){t.openImg(e)},1e3)},openImg:function(e){var t=this;if(e<0||e>=a.length){return false}t.loadImg(a.eq(e).attr("href"),function(){n("#swipebox-slider .slide").eq(e).html(this)})},setTitle:function(e,t){n("#swipebox-caption").empty();if(a.eq(e).attr("title")){n("#swipebox-caption").append(a.eq(e).attr("title"))}},loadImg:function(e,t){var r=n("<img>").on("load",function(){t.call(r)});r.attr("src",e)},getNext:function(){var e=this;index=n("#swipebox-slider .slide").index(n("#swipebox-slider .slide.current"));if(index+1<a.length){index++;e.setSlide(index);e.preloadImg(index+1)}else{n("#swipebox-slider").addClass("rightSpring");setTimeout(function(){n("#swipebox-slider").removeClass("rightSpring")},500)}},getPrev:function(){var e=this;index=n("#swipebox-slider .slide").index(n("#swipebox-slider .slide.current"));if(index>0){index--;e.setSlide(index);e.preloadImg(index-1)}else{n("#swipebox-slider").addClass("leftSpring");setTimeout(function(){n("#swipebox-slider").removeClass("leftSpring")},500)}},closeSlide:function(){var t=this;n(e).trigger("resize");n("html").removeClass("swipebox");t.destroy()},destroy:function(){var t=this;n(e).unbind("keyup");n("body").unbind("touchstart");n("body").unbind("touchmove");n("body").unbind("touchend");n("#swipebox-slider").unbind();n("#swipebox-overlay").remove();a.removeData("_swipebox");t.target.trigger("swipebox-destroy")}};u.init()};n.fn.swipebox=function(e){if(!n.data(this,"_swipebox")){var t=new n.swipebox(this,e);this.data("_swipebox",t)}}})(window,document,jQuery);
|
|
assets/swipebox/source/swipebox.css
DELETED
@@ -1,223 +0,0 @@
|
|
1 |
-
.swipebox {
|
2 |
-
overflow: hidden!important;
|
3 |
-
}
|
4 |
-
|
5 |
-
#swipebox-overlay img {
|
6 |
-
border: none!important;
|
7 |
-
}
|
8 |
-
|
9 |
-
#swipebox-overlay {
|
10 |
-
width: 100%;
|
11 |
-
height: 100%;
|
12 |
-
position: fixed;
|
13 |
-
top: 0;
|
14 |
-
left: 0;
|
15 |
-
z-index: 99999!important;
|
16 |
-
overflow: hidden;
|
17 |
-
-webkit-user-select: none;
|
18 |
-
-moz-user-select: none;
|
19 |
-
user-select: none;
|
20 |
-
}
|
21 |
-
|
22 |
-
#swipebox-slider {
|
23 |
-
height: 100%;
|
24 |
-
left: 0;
|
25 |
-
top: 0;
|
26 |
-
width: 100%;
|
27 |
-
white-space: nowrap;
|
28 |
-
position: absolute;
|
29 |
-
display: none;
|
30 |
-
}
|
31 |
-
|
32 |
-
#swipebox-slider .slide {
|
33 |
-
background: url("img/loader.gif") no-repeat center center;
|
34 |
-
height: 100%;
|
35 |
-
width: 100%;
|
36 |
-
line-height: 1px;
|
37 |
-
text-align: center;
|
38 |
-
display: inline-block;
|
39 |
-
}
|
40 |
-
|
41 |
-
#swipebox-slider .slide:before {
|
42 |
-
content: "";
|
43 |
-
display: inline-block;
|
44 |
-
height: 50%;
|
45 |
-
width: 1px;
|
46 |
-
margin-right: -1px;
|
47 |
-
}
|
48 |
-
|
49 |
-
#swipebox-slider .slide img {
|
50 |
-
display: inline-block;
|
51 |
-
max-height: 100%;
|
52 |
-
max-width: 100%;
|
53 |
-
margin: 0;
|
54 |
-
padding: 0;
|
55 |
-
width: auto;
|
56 |
-
height: auto;
|
57 |
-
vertical-align: middle;
|
58 |
-
}
|
59 |
-
|
60 |
-
#swipebox-action, #swipebox-caption {
|
61 |
-
position: absolute;
|
62 |
-
left: 0;
|
63 |
-
z-index: 999;
|
64 |
-
height: 50px;
|
65 |
-
width: 100%;
|
66 |
-
}
|
67 |
-
|
68 |
-
#swipebox-action {
|
69 |
-
bottom: -50px;
|
70 |
-
}
|
71 |
-
#swipebox-action.visible-bars {
|
72 |
-
bottom: 0;
|
73 |
-
}
|
74 |
-
|
75 |
-
#swipebox-action.force-visible-bars {
|
76 |
-
bottom: 0!important;
|
77 |
-
}
|
78 |
-
|
79 |
-
#swipebox-caption {
|
80 |
-
top: -50px;
|
81 |
-
text-align: center;
|
82 |
-
}
|
83 |
-
#swipebox-caption.visible-bars {
|
84 |
-
top: 0;
|
85 |
-
}
|
86 |
-
|
87 |
-
#swipebox-caption.force-visible-bars {
|
88 |
-
top: 0!important;
|
89 |
-
}
|
90 |
-
|
91 |
-
#swipebox-action #swipebox-prev, #swipebox-action #swipebox-next,
|
92 |
-
#swipebox-action #swipebox-close {
|
93 |
-
background-image: url("img/icons.png");
|
94 |
-
background-repeat: no-repeat;
|
95 |
-
border: none!important;
|
96 |
-
text-decoration: none!important;
|
97 |
-
cursor: pointer;
|
98 |
-
position: absolute;
|
99 |
-
width: 50px;
|
100 |
-
height: 50px;
|
101 |
-
top: 0;
|
102 |
-
}
|
103 |
-
|
104 |
-
#swipebox-action #swipebox-close {
|
105 |
-
background-position: 15px 12px;
|
106 |
-
left: 40px;
|
107 |
-
}
|
108 |
-
|
109 |
-
#swipebox-action #swipebox-prev {
|
110 |
-
background-position: -32px 13px;
|
111 |
-
right: 100px;
|
112 |
-
}
|
113 |
-
|
114 |
-
#swipebox-action #swipebox-next {
|
115 |
-
background-position: -78px 13px;
|
116 |
-
right: 40px;
|
117 |
-
}
|
118 |
-
|
119 |
-
#swipebox-action #swipebox-prev.disabled,
|
120 |
-
#swipebox-action #swipebox-next.disabled {
|
121 |
-
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=30);
|
122 |
-
opacity: 0.3;
|
123 |
-
}
|
124 |
-
|
125 |
-
#swipebox-slider.rightSpring {
|
126 |
-
-moz-animation: rightSpring 0.3s;
|
127 |
-
-webkit-animation: rightSpring 0.3s;
|
128 |
-
}
|
129 |
-
|
130 |
-
#swipebox-slider.leftSpring {
|
131 |
-
-moz-animation: leftSpring 0.3s;
|
132 |
-
-webkit-animation: leftSpring 0.3s;
|
133 |
-
}
|
134 |
-
|
135 |
-
@-moz-keyframes rightSpring {
|
136 |
-
0% {
|
137 |
-
margin-left: 0px;
|
138 |
-
}
|
139 |
-
|
140 |
-
50% {
|
141 |
-
margin-left: -30px;
|
142 |
-
}
|
143 |
-
|
144 |
-
100% {
|
145 |
-
margin-left: 0px;
|
146 |
-
}
|
147 |
-
}
|
148 |
-
|
149 |
-
@-moz-keyframes leftSpring {
|
150 |
-
0% {
|
151 |
-
margin-left: 0px;
|
152 |
-
}
|
153 |
-
|
154 |
-
50% {
|
155 |
-
margin-left: 30px;
|
156 |
-
}
|
157 |
-
|
158 |
-
100% {
|
159 |
-
margin-left: 0px;
|
160 |
-
}
|
161 |
-
}
|
162 |
-
|
163 |
-
@-webkit-keyframes rightSpring {
|
164 |
-
0% {
|
165 |
-
margin-left: 0px;
|
166 |
-
}
|
167 |
-
|
168 |
-
50% {
|
169 |
-
margin-left: -30px;
|
170 |
-
}
|
171 |
-
|
172 |
-
100% {
|
173 |
-
margin-left: 0px;
|
174 |
-
}
|
175 |
-
}
|
176 |
-
|
177 |
-
@-webkit-keyframes leftSpring {
|
178 |
-
0% {
|
179 |
-
margin-left: 0px;
|
180 |
-
}
|
181 |
-
|
182 |
-
50% {
|
183 |
-
margin-left: 30px;
|
184 |
-
}
|
185 |
-
|
186 |
-
100% {
|
187 |
-
margin-left: 0px;
|
188 |
-
}
|
189 |
-
}
|
190 |
-
|
191 |
-
/* Skin
|
192 |
-
--------------------------*/
|
193 |
-
#swipebox-overlay {
|
194 |
-
background: #0d0d0d;
|
195 |
-
}
|
196 |
-
|
197 |
-
#swipebox-action, #swipebox-caption {
|
198 |
-
text-shadow: 1px 1px 1px black;
|
199 |
-
background-color: #0d0d0d;
|
200 |
-
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #0d0d0d), color-stop(100%, #000000));
|
201 |
-
background-image: -webkit-linear-gradient(#0d0d0d, #000000);
|
202 |
-
background-image: -moz-linear-gradient(#0d0d0d, #000000);
|
203 |
-
background-image: -o-linear-gradient(#0d0d0d, #000000);
|
204 |
-
background-image: linear-gradient(#0d0d0d, #000000);
|
205 |
-
-webkit-box-shadow: 0 1px 1px 1px #212121, inset 0 1px 1px 1px black;
|
206 |
-
-moz-box-shadow: 0 1px 1px 1px #212121, inset 0 1px 1px 1px black;
|
207 |
-
box-shadow: 0 1px 1px 1px #212121, inset 0 1px 1px 1px black;
|
208 |
-
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=95);
|
209 |
-
opacity: 0.95;
|
210 |
-
}
|
211 |
-
|
212 |
-
#swipebox-action {
|
213 |
-
-webkit-box-shadow: 0 -1px -1px 1px #212121, inset 0 -1px -1px 1px black;
|
214 |
-
-moz-box-shadow: 0 -1px -1px 1px #212121, inset 0 -1px -1px 1px black;
|
215 |
-
box-shadow: 0 -1px -1px 1px #212121, inset 0 -1px -1px 1px black;
|
216 |
-
}
|
217 |
-
|
218 |
-
#swipebox-caption {
|
219 |
-
color: white!important;
|
220 |
-
font-size: 15px;
|
221 |
-
line-height: 43px;
|
222 |
-
font-family: Helvetica, Arial, sans-serif;
|
223 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.dfactory.eu/
|
|
4 |
Tags: gallery, images, lightbox, links, photos, template, theme, photo, image, picture, slideshow, modal, overlay, YouTube, Vimeo, video, videos
|
5 |
Requires at least: 3.6
|
6 |
Tested up to: 4.2.2
|
7 |
-
Stable tag: 1.4.
|
8 |
License: MIT License
|
9 |
License URI: http://opensource.org/licenses/MIT
|
10 |
|
@@ -65,6 +65,11 @@ No questions yet.
|
|
65 |
|
66 |
== Changelog ==
|
67 |
|
|
|
|
|
|
|
|
|
|
|
68 |
= 1.4.11 =
|
69 |
* Tweak: Swipebox script updated to 1.3.0.2
|
70 |
* Tweak: prettyPhoto CSS tweaks
|
@@ -185,7 +190,5 @@ Initial release
|
|
185 |
|
186 |
== Upgrade Notice ==
|
187 |
|
188 |
-
= 1.4.
|
189 |
-
*
|
190 |
-
* Tweak: prettyPhoto CSS tweaks
|
191 |
-
* Tweak: fancyBox IE patch
|
4 |
Tags: gallery, images, lightbox, links, photos, template, theme, photo, image, picture, slideshow, modal, overlay, YouTube, Vimeo, video, videos
|
5 |
Requires at least: 3.6
|
6 |
Tested up to: 4.2.2
|
7 |
+
Stable tag: 1.4.12
|
8 |
License: MIT License
|
9 |
License URI: http://opensource.org/licenses/MIT
|
10 |
|
65 |
|
66 |
== Changelog ==
|
67 |
|
68 |
+
= 1.4.12 =
|
69 |
+
* Fix: jQuery prettyPhoto DOM Cross-Site Scripting (XSS) vulnerability
|
70 |
+
* Tweak: Added regex filetype check before applying lightbox selector to gallery links.
|
71 |
+
* Tweak: Switched from wp_generate_password() to custom function, without needless DB call.
|
72 |
+
|
73 |
= 1.4.11 =
|
74 |
* Tweak: Swipebox script updated to 1.3.0.2
|
75 |
* Tweak: prettyPhoto CSS tweaks
|
190 |
|
191 |
== Upgrade Notice ==
|
192 |
|
193 |
+
= 1.4.12 =
|
194 |
+
* Fix: jQuery prettyPhoto DOM Cross-Site Scripting (XSS) vulnerability
|
|
|
|
responsive-lightbox.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Responsive Lightbox
|
4 |
Description: Responsive Lightbox allows users to view larger versions of images and galleries in a lightbox (overlay) effect optimized for mobile devices.
|
5 |
-
Version: 1.4.
|
6 |
Author: dFactory
|
7 |
Author URI: http://www.dfactory.eu/
|
8 |
Plugin URI: http://www.dfactory.eu/plugins/responsive-lightbox/
|
@@ -28,7 +28,7 @@ if ( ! defined( 'ABSPATH' ) )
|
|
28 |
* Responsive Lightbox class.
|
29 |
*
|
30 |
* @class Responsive_Lightbox
|
31 |
-
* @version 1.4.
|
32 |
*/
|
33 |
class Responsive_Lightbox {
|
34 |
|
@@ -122,7 +122,7 @@ class Responsive_Lightbox {
|
|
122 |
'quit_on_document_click' => true
|
123 |
)
|
124 |
),
|
125 |
-
'version' => '1.4.
|
126 |
);
|
127 |
private $scripts = array();
|
128 |
private $options = array();
|
@@ -206,7 +206,7 @@ class Responsive_Lightbox {
|
|
206 |
|
207 |
$content = str_replace( $link, preg_replace( '/rel=(?:\'|")(.*?)(?:\'|")/', 'rel="' . ( ! empty( $new_rel ) ? simplode( ' ', $new_rels ) . ' ' : '') . $this->options['settings']['selector'] . '-video-' . $id . '"', $link ), $content );
|
208 |
} else
|
209 |
-
$content = str_replace( $link, preg_replace( '/rel=(?:\'|")(.*?)(?:\'|")/', 'rel="' . ($result[1] !== '' ? $result[1] . ' ' : '') . $this->options['settings']['selector'] . '-video-' . $id . '"', $link ), $content );
|
210 |
}
|
211 |
} else
|
212 |
$content = str_replace( $link, '<a' . $links[1][$id] . 'href="' . $links[2][$id] . '"' . $links[6][$id] . ' rel="' . $this->options['settings']['selector'] . '-video-' . $id . '">', $content );
|
@@ -221,12 +221,12 @@ class Responsive_Lightbox {
|
|
221 |
|
222 |
if ( isset( $links[0] ) ) {
|
223 |
if ( $this->options['settings']['images_as_gallery'] === true )
|
224 |
-
$rel_hash = '[gallery-' .
|
225 |
|
226 |
foreach ( $links[0] as $id => $link ) {
|
227 |
if ( preg_match( '/<a.*?rel=(?:\'|")(.*?)(?:\'|").*?>/', $link, $result ) === 1 ) {
|
228 |
if ( $this->options['settings']['images_as_gallery'] === true ) {
|
229 |
-
$content = str_replace( $link, preg_replace( '/rel=(?:\'|")(.*?)(?:\'|")/', 'rel="' . $this->options['settings']['selector'] . $rel_hash . '"' . ($this->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="' . $id . '"' : ''), $link ), $content );
|
230 |
} else {
|
231 |
if ( isset( $result[1] ) ) {
|
232 |
$new_rels = array();
|
@@ -238,13 +238,13 @@ class Responsive_Lightbox {
|
|
238 |
$new_rels[] = $rel;
|
239 |
}
|
240 |
|
241 |
-
$content = str_replace( $link, preg_replace( '/rel=(?:\'|")(.*?)(?:\'|")/', 'rel="' . ( ! empty( $new_rels ) ? implode( ' ', $new_rels ) . ' ' : '') . $this->options['settings']['selector'] . '-' . $id . '"' . ($this->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="' . $id . '"' : ''), $link ), $content );
|
242 |
} else
|
243 |
-
$content = str_replace( $link, preg_replace( '/rel=(?:\'|")(.*?)(?:\'|")/', 'rel="' . ($result[1] !== '' ? $result[1] . ' ' : '') . $this->options['settings']['selector'] . '-' . $id . '"' . ($this->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="' . $id . '"' : ''), $link ), $content );
|
244 |
}
|
245 |
}
|
246 |
} else
|
247 |
-
$content = str_replace( $link, '<a' . $links[1][$id] . 'href="' . $links[2][$id] . '.' . $links[3][$id] . '"' . $links[4][$id] . ' rel="' . $this->options['settings']['selector'] . ($this->options['settings']['images_as_gallery'] === true ? $rel_hash : '-' . $id) . '"' . ($this->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="' . $id . '"' : '') . '>', $content );
|
248 |
}
|
249 |
}
|
250 |
|
@@ -258,9 +258,12 @@ class Responsive_Lightbox {
|
|
258 |
}
|
259 |
|
260 |
public function add_gallery_lightbox_selector( $link, $id, $size, $permalink, $icon, $text ) {
|
261 |
-
|
262 |
-
|
263 |
-
|
|
|
|
|
|
|
264 |
}
|
265 |
|
266 |
public function load_defaults() {
|
@@ -2092,6 +2095,20 @@ class Responsive_Lightbox {
|
|
2092 |
return $content;
|
2093 |
}
|
2094 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2095 |
|
2096 |
}
|
2097 |
|
2 |
/*
|
3 |
Plugin Name: Responsive Lightbox
|
4 |
Description: Responsive Lightbox allows users to view larger versions of images and galleries in a lightbox (overlay) effect optimized for mobile devices.
|
5 |
+
Version: 1.4.12
|
6 |
Author: dFactory
|
7 |
Author URI: http://www.dfactory.eu/
|
8 |
Plugin URI: http://www.dfactory.eu/plugins/responsive-lightbox/
|
28 |
* Responsive Lightbox class.
|
29 |
*
|
30 |
* @class Responsive_Lightbox
|
31 |
+
* @version 1.4.12
|
32 |
*/
|
33 |
class Responsive_Lightbox {
|
34 |
|
122 |
'quit_on_document_click' => true
|
123 |
)
|
124 |
),
|
125 |
+
'version' => '1.4.12'
|
126 |
);
|
127 |
private $scripts = array();
|
128 |
private $options = array();
|
206 |
|
207 |
$content = str_replace( $link, preg_replace( '/rel=(?:\'|")(.*?)(?:\'|")/', 'rel="' . ( ! empty( $new_rel ) ? simplode( ' ', $new_rels ) . ' ' : '') . $this->options['settings']['selector'] . '-video-' . $id . '"', $link ), $content );
|
208 |
} else
|
209 |
+
$content = str_replace( $link, preg_replace( '/rel=(?:\'|")(.*?)(?:\'|")/', 'rel="' . ( $result[1] !== '' ? $result[1] . ' ' : '' ) . $this->options['settings']['selector'] . '-video-' . $id . '"', $link ), $content );
|
210 |
}
|
211 |
} else
|
212 |
$content = str_replace( $link, '<a' . $links[1][$id] . 'href="' . $links[2][$id] . '"' . $links[6][$id] . ' rel="' . $this->options['settings']['selector'] . '-video-' . $id . '">', $content );
|
221 |
|
222 |
if ( isset( $links[0] ) ) {
|
223 |
if ( $this->options['settings']['images_as_gallery'] === true )
|
224 |
+
$rel_hash = '[gallery-' . $this->generate_password( 4 ) . ']';
|
225 |
|
226 |
foreach ( $links[0] as $id => $link ) {
|
227 |
if ( preg_match( '/<a.*?rel=(?:\'|")(.*?)(?:\'|").*?>/', $link, $result ) === 1 ) {
|
228 |
if ( $this->options['settings']['images_as_gallery'] === true ) {
|
229 |
+
$content = str_replace( $link, preg_replace( '/rel=(?:\'|")(.*?)(?:\'|")/', 'rel="' . $this->options['settings']['selector'] . $rel_hash . '"' . ( $this->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="' . $id . '"' : '' ), $link ), $content );
|
230 |
} else {
|
231 |
if ( isset( $result[1] ) ) {
|
232 |
$new_rels = array();
|
238 |
$new_rels[] = $rel;
|
239 |
}
|
240 |
|
241 |
+
$content = str_replace( $link, preg_replace( '/rel=(?:\'|")(.*?)(?:\'|")/', 'rel="' . ( ! empty( $new_rels ) ? implode( ' ', $new_rels ) . ' ' : '' ) . $this->options['settings']['selector'] . '-' . $id . '"' . ( $this->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="' . $id . '"' : '' ), $link ), $content );
|
242 |
} else
|
243 |
+
$content = str_replace( $link, preg_replace( '/rel=(?:\'|")(.*?)(?:\'|")/', 'rel="' . ( $result[1] !== '' ? $result[1] . ' ' : '' ) . $this->options['settings']['selector'] . '-' . $id . '"' . ( $this->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="' . $id . '"' : '' ), $link ), $content );
|
244 |
}
|
245 |
}
|
246 |
} else
|
247 |
+
$content = str_replace( $link, '<a' . $links[1][$id] . 'href="' . $links[2][$id] . '.' . $links[3][$id] . '"' . $links[4][$id] . ' rel="' . $this->options['settings']['selector'] . ( $this->options['settings']['images_as_gallery'] === true ? $rel_hash : '-' . $id ) . '"' . ( $this->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="' . $id . '"' : '' ) . '>', $content );
|
248 |
}
|
249 |
}
|
250 |
|
258 |
}
|
259 |
|
260 |
public function add_gallery_lightbox_selector( $link, $id, $size, $permalink, $icon, $text ) {
|
261 |
+
if ( preg_match( '/<a(.*?)href=(?:\'|")([^<]*?).(bmp|gif|jpeg|jpg|png)(?:\'|")(.*?)>/i', $link ) === 1 ) {
|
262 |
+
$link = ( preg_match( '/<a.*? rel=("|\').*?("|\')>/', $link ) === 1 ? preg_replace( '/(<a.*? rel=(?:"|\').*?)((?:"|\').*?>)/', '$1 ' . $this->options['settings']['selector'] . '[gallery-' . $this->gallery_no . ']' . '$2', $link ) : preg_replace( '/(<a.*?)>/', '$1 rel="' . $this->options['settings']['selector'] . '[gallery-' . $this->gallery_no . ']' . '">', $link ) );
|
263 |
+
$link = ( preg_match( '/<a.*? href=("|\').*?("|\')>/', $link ) === 1 ? preg_replace( '/(<a.*? href=(?:"|\')).*?((?:"|\').*?>)/', '$1' . wp_get_attachment_url( $id ) . '$2', $link ) : preg_replace( '/(<a.*?)>/', '$1 href="' . wp_get_attachment_url( $id ) . '">', $link ) );
|
264 |
+
}
|
265 |
+
|
266 |
+
return apply_filters( 'rl_lightbox_attachment_link', $link, $id, $size, $permalink, $icon, $text );
|
267 |
}
|
268 |
|
269 |
public function load_defaults() {
|
2095 |
return $content;
|
2096 |
}
|
2097 |
}
|
2098 |
+
|
2099 |
+
/**
|
2100 |
+
* Generate password helper, without wp_rand() and DB call it uses
|
2101 |
+
*/
|
2102 |
+
private function generate_password( $length = 64 ) {
|
2103 |
+
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
2104 |
+
$password = '';
|
2105 |
+
|
2106 |
+
for( $i = 0; $i < $length; $i++ ) {
|
2107 |
+
$password .= substr( $chars, mt_rand( 0, strlen( $chars ) - 1 ), 1 );
|
2108 |
+
}
|
2109 |
+
|
2110 |
+
return $password;
|
2111 |
+
}
|
2112 |
|
2113 |
}
|
2114 |
|