Team:Paris Saclay/gallery js
/*
- Exposure (http://http://exposure.blogocracy.org/)
- Copyright 2013, Kristoffer Jelbring
- Licensed under the MIT license.
- /
- (function(e){e.exposure={v
- "1.0.2",defaultTargetId:"exposure",wrapperClass:"exposureWrapper",targetClass:"exposureTarget",currentImageClass:"exposureCurrentImage",lastImageClass:"exposureLastImage",captionClass:"caption",imageDataClass:"extra",dataContainerClass:"exposureData",controlsClass:"exposureControls",slideshowControlsClass:"exposureSlideshowControls",firstPageClass:"exposureFirstPage",prevPageClass:"exposurePrevPage",nextPageClass:"exposureNextPage",lastPageClass:"exposureLastPage",pagingClass:"exposurePaging",playSlideshowClass:"exposurePlaySlideshow",pauseSlideshowClass:"exposurePauseSlideshow",maskClass:"exposureMask",thumbsClass:"exposureThumbs",imageClass:"exposureImage",imageHoverClass:"exposureHover",selectedImageClass:"selected",activeThumbClass:"active",currentThumbClass:"current",firstThumbClass:"first",lastThumbClass:"last",loadedClass:"loaded",activeLinkClass:"active",disabledLinkClass:"disabled",isDefined:function(e){return typeof e!=="undefined"},isObject:function(e){return typeof e==="object"},startsWith:function(e,t){if(e&&t){return e.indexOf(t)===0}return false},widthDiff:function(e){return e?e.outerWidth(true)-e.width():0},heightDiff:function(e){return e?e.outerHeight(true)-e.height():0},createLink:function(t,n,r){var i=e('<a href="javascript:void(0);"></a>').text(t).click(n);if(r){i.addClass(r)}return i},texts:{first:"First",previous:"Prev",next:"Next",last:"Last",play:"Play slideshow",pause:"Pause slideshow"}};var t={target:"#"+e.exposure.defaultTargetId,showThumbs:true,showControls:true,imageControls:false,controls:{prevNext:true,firstLast:true,pageNumbers:true},carouselControls:false,enableSlideshow:true,slideshowControlsTarget:null,autostartSlideshow:false,slideshowDelay:3e3,onSlideshowPlayed:function(){},onSlideshowPaused:function(){},showCaptions:true,showExtraData:true,dataTarget:null,controlsTarget:null,onThumb:function(e){},onImage:function(t,n,r){t.siblings("."+e.exposure.lastImageClass).remove()},onImageHoverOver:function(){},onImageHoverOut:function(){},onCarousel:function(e,t){},onNext:function(){},onPrev:function(){},onPageChanged:function(){},onPagingLink:function(e){return e},onActivePageLink:function(e){return e},separatePageBrowsing:false,loop:true,onEndOfLoop:function(){},pageSize:5,viewFirstImage:true,visiblePages:5,preloadBuffer:3,keyboardNavigation:true,clickingNavigation:true,fixedContainerSize:false,maxWidth:null,maxHeight:null,stretchToMaxSize:false,fullScreen:false,onEnterFullScreen:function(e){e.show()},onExitFullScreen:function(e,t){e.hide();t.hide()},showThumbToolTip:true,onEmpty:function(e){e.hide();e.targetElement.remove();if(e.showControls){e.controlsElement.remove()}if(e.slideshowControlsTarget){e.slideshowControlsElement.remove()}},onInit:function(){},allowDuplicates:true,jsonSource:null};var n=function(e,t,n,r){this.src=e;this.thumb=t;this.caption=n;this.data=r;this.loaded=false};e.fn.exposure=function(r){var i=this;var s=e.exposure;var o=s.texts;e.extend(this,{images:[],sources:{},newImage:function(e,t,r,o){var u=s.isDefined(i.sources[e]);if(u&&!i.allowDuplicates){return-1}var a=new n(e,t,r,o);var f=i.images.push(a)-1;if(!u){i.sources[e]=f}return f},initialized:false,current:-1,deselectCurrentImage:function(){i.current=-1;i.find("li."+s.activeThumbClass).removeClass(s.activeThumbClass)},loadQueue:[],addToLoadQueue:function(e){if(!i.loaded(e)&&!i.queued(e)){i.loadQueue.push(e)}},queued:function(t){return e.inArray(t,i.loadQueue)>-1},loaded:function(e){var t=i.getImage(e);if(t!==null){return t.loaded}return false},nextInLoadQueue:function(){var t;if(i.loadQueue.length>0){var n=i.loadQueue.shift();if(i.loaded(n)){t=e.inArray(n,this.loadQueue);i.loadQueue.splice(t,1);return i.nextInLoadQueue()}return n}return null},preloadNextInQueue:function(){if(i.loadQueue.length>0){var e=i.nextInLoadQueue();if(e!==null){i.loadImage(e,i.preloadNextInQueue)}}},loadImage:function(t,n){var r=i.getImage(t);var o=e("<img />").addClass(s.imageClass);var u;if(r!==null){r.loaded=true;if(i.queued(t)){u=e.inArray(t,i.loadQueue);i.loadQueue.splice(u,1)}if(typeof n==="function"){o.load(n)}o.attr("src",r.src)}return o},pageNumberForImage:function(e){return Math.ceil((e+1)/i.pageSize)},numberOfPages:function(){return this.pageNumberForImage(i.images.length-1)},atFirstPage:function(){return i.currentPage===1},atLastPage:function(){return i.currentPage===i.numberOfPages()},validPage:function(e){return e>0&&e<=i.numberOfPages()},createPaging:function(){var t;if(i.showControls&&i.controls.pageNumbers){var n=i.imageControls?i.numberOfImages():i.numberOfPages();i.controlsElement.find("."+s.pagingClass).each(function(){for(t=1;t<=n;t++){e(this).append(i.newPagingLink(t))}})}},updatePaging:function(t){if(i.showControls&&i.controls.pageNumbers){var n=i.imageControls?i.current+1:i.currentPage;var r=i.controlsElement.find("."+s.pagingClass);r.find(" span."+s.activeLinkClass).each(function(){e(this).replaceWith(i.newPagingLink(n))});r.find('a[rel="'+t+'"]').each(function(){e(this).replaceWith(i.onActivePageLink(e(""+t+"")).addClass(s.activeLinkClass))});var o=i.imageControls?i.numberOfImages():i.numberOfPages();if(i.visiblePages>0&&o>i.visiblePages){var u=t;var a=i.visiblePages;var f=Math.floor(i.visiblePages/2);if(t<=f){u=1}else if(t>o-f){a=o;u=a-i.visiblePages+1}else{u-=f;a=u+i.visiblePages-1}r.each(function(){e(this).children().each(function(t){var n=t+1;if(n>=u&&n<=a){e(this).show()}else{e(this).hide()}})})}}},newPagingLink:function(t){var n=function(){var t=Number(e(this).attr("rel"));if(i.imageControls){i.viewImage(t-1)}else{i.goToPage(t)}};return i.onPagingLink(s.createLink(t,n).attr("rel",t))},getNextImage:function(){if(i.current===i.images.length-1){if(i.loop){return 0}else{i.onEndOfLoop()}}else{return i.current+1}return null},getPrevImage:function(){if(i.current===0){if(i.loop){return i.images.length-1}}else{return i.current-1}return null},currentPage:1,goToPage:function(t,n){if(this.validPage(t)){i.find("li").removeClass(s.currentThumbClass).hide();i.loadPage(t,n);if(!i.imageControls){i.updatePaging(t)}i.currentPage=t;var r=s.disabledLinkClass;if(i.showControls){if(i.atFirstPage()){if(i.controls.firstLast){i.find("."+s.firstPageClass).addClass(r)}if(!i.loop&&i.controls.prevNext){i.find("."+s.prevPageClass).hide()}}else{if(i.controls.firstLast){i.find("."+s.firstPageClass).removeClass(r)}if(!i.loop&&i.controls.prevNext){i.find("."+s.prevPageClass).show()}}if(i.atLastPage()){if(i.controls.firstLast){i.find("."+s.lastPageClass).addClass(r)}if(!i.loop&&i.controls.prevNext){i.find("."+s.nextPageClass).hide()}}else{if(i.controls.firstLast){i.find("."+s.lastPageClass).removeClass(r)}if(!i.loop&&i.controls.prevNext){i.find("."+s.nextPageClass).show()}}}if(!i.carouselControls){i.find("li."+s.currentThumbClass).show().each(function(t){var n=e(this).find("img").height();if(n>0){e(this).height(n)}});i.onPageChanged(i)}}},loadPage:function(e,t){if(i.validPage(e)){var n=e*i.pageSize;var r=n-i.pageSize;if(n>i.images.length){n=i.images.length}i.pageTransition=true;i.viewThumbs(r,n-1);if(!i.separatePageBrowsing){if(t){i.viewImage(t)}else{if(e>1||e===1&&i.viewFirstImage||i.initialized){i.viewImage(r)}}}i.pageTransition=false}},viewThumbs:function(e,t){var n;if(i.showThumbs){for(n=e;n<=t;n++){i.viewThumb(n,n===e,n===t,true)}if(!i.carouselControls&&i.currentPage<i.numberOfPages()){var r=t+1;var s=t+i.pageSize;if(s>=i.images.length){s=i.images.length-1}for(n=r;n<=s;n++){var o=i.viewThumb(n,n===r,n===s,false);if(o&&o.length){o.hide()}}}}},viewThumb:function(e,t,n,r){if(e<0){e=i.images.length+e}else if(e>=i.images.length){e=e-i.images.length}var o=i.images[e];var u=i.getThumb(e).parent();if(!u.length){u=i.createThumbForImage(o,e);u.attr("rel",i.pageNumberForImage(e))}if(u.length){u.parent().append(u);if(t){u.addClass(s.firstThumbClass)}else{u.removeClass(s.firstThumbClass)}if(n){u.addClass(s.lastThumbClass)}else{u.removeClass(s.lastThumbClass)}if(r){if(i.carouselControls){u.show()}else{u.addClass(s.currentThumbClass)}}}return u},getThumb:function(e){return i.find('img[rel="'+e+'"]')},createThumbForImage:function(t,n){if(i.showThumbs){var r=i.getThumb(n);if(r===null||!r.length){var s=e("");i.append(s);r=e("<img />");if(t.thumb){r.attr("src",t.thumb)}else{r.attr("src",t.src);var o=Math.ceil(r.width()/r.height()*s.height());var u=Math.ceil(r.height()/r.width()*s.width());if(o<u){r.css({height:"auto",maxWidth:s.width()})}else{r.css({width:"auto",maxHeight:s.height()})}}s.append(r.css("display","block"));r.attr("rel",n);if(t.caption&&i.showThumbToolTip){r.attr("title",t.caption)}r.data("data",t.data);r.click(function(){i.viewImage(Number(e(this).attr("rel")))});r.load(function(){var t=e(this).height();if(t>0){e(this).parent().height(t)}});i.onThumb(r);return s}}return null},firstPage:function(){if(!i.atFirstPage()){i.goToPage(1)}},lastPage:function(){if(!i.atLastPage()){i.goToPage(i.numberOfPages())}},prevPage:function(){if(!i.atFirstPage()){i.goToPage(i.currentPage-1)}else if(i.loop){i.goToPage(i.numberOfPages())}},nextPage:function(){if(!i.atLastPage()){i.goToPage(i.currentPage+1)}else if(i.loop){i.goToPage(1)}},firstImageOnPage:function(e){if(!e){e=i.current}return i.pageSize===1||e%i.pageSize===0},lastImageOnPage:function(e){if(!e){e=i.current}var t=i.images.length;if(i.pageSize===1||t===1){return true}if(e>0){var n=i.pageSize;var r=i.pageNumberForImage(e);if(r===i.numberOfPages()){var s=t%i.pageSize;if(s>0){n=s}}var o=e;if(r>1){o-=(r-1)*i.pageSize}return(o+1)%n===0}return false},currentPageNumber:function(){return i.currentPage},numberOfImages:function(){return i.images.length},atFirstImage:function(){return i.current===0},atLastImage:function(){return i.current===i.numberOfImages()-1},getImage:function(e){if(e!==null&&e>-1&&e<i.images.length){return i.images[e]}return null},indexOfImage:function(e){if(e&&s.isDefined(i.sources[e])){return i.sources[e]}return-1},currentImage:function(){return i.current},addImage:function(t,n,r,o){var u=i.numberOfPages();var a=i.newImage(t,n,r,o);if(a>-1){var f=i.pageNumberForImage(a);var l=e("."+s.thumbsClass+' li[rel="'+f+'"]');if(l.length){l.removeClass(s.lastThumbClass)}var c=f>u;if(c){e("."+s.pagingClass).empty();i.createPaging()}if(c||f===i.currentPage){i.goToPage(i.currentPage)}}},removeImage:function(t){if(i.images.length===1){i.removeAllImages()}else{if(i.enableSlideshow){i.pauseSlideshow()}var n=i.numberOfPages();i.images.splice(t,1);var r=e.inArray(t,i.loadQueue);if(r>-1){i.loadQueue.splice(r,1)}var o=i.getThumb(t).parent();o.remove();e("."+s.thumbsClass+" > li").each(function(n){if(n>=t){var r=i.pageNumberForImage(n);e(this).attr("rel",r);e(this).find("img").attr("rel",n);if(i.firstImageOnPage(n)){e(this).addClass(s.firstThumbClass)}else{e(this).removeClass(s.firstThumbClass)}if(i.lastImageOnPage(n)){e(this).addClass(s.lastThumbClass)}else{e(this).removeClass(s.lastThumbClass)}if(i.currentPage===r){e(this).show()}else{e(this).hide()}}});var u=e.exposure.numberOfPages<n;if(u){e("."+s.pagingClass).empty();i.createPaging()}if(i.current===t){i.current=-1;var a=t;if(t===i.numberOfImages()){a=0}i.viewImage(a)}}},removeAllImages:function(){i.images=[];i.sources={};i.loadQueue=[];if(i.enableSlideshow){i.pauseSlideshow()}e("."+s.thumbsClass+", "+"."+s.pagingClass).empty();i.current=-1},viewImage:function(t){if(i.current!==t){if(i.enableSlideshow&&!i.slideshowTransition){i.pauseSlideshow()}var n=i.wrapper;var r=false;var o=i.images[t];if(o){var u=o.src;var a=o.caption;var f=o.data;if(u){r=true;var l=i.showThumbs;var c=null;if(i.showThumbs){c=i.find('img[rel="'+t+'"]');l=c&&c.length;var h=s.activeThumbClass;if(l){c.parent().siblings().removeClass(h);c.parent().addClass(h)}else{i.find("li."+h).removeClass(h)}}n.parent().removeClass(s.loadedClass);if(i.loaded(t)){n.parent().addClass(s.loadedClass)}var p=i.loadImage(t,function(){var t=n.find("."+s.imageClass);if(t.length){t.removeClass(s.currentImageClass);t.addClass(s.lastImageClass)}e(this).addClass(s.currentImageClass);n.append(e(this));if(i.clickingNavigation){e(this).click(i.nextImage)}if(!e(this).width()||!e(this).height()){var r=e(this);var o=setInterval(function(){i.resizeContainer(r);clearTimeout(o)},2)}else{i.resizeContainer(e(this))}if(i.fullScreen&&!i.infullScreen){i.onEnterFullScreen(i.mask);i.infullScreen=true}if(i.dataElement&&i.dataElement.length){if(i.showCaptions){var u=i.dataElement.find("."+s.captionClass);if(u.length){u.empty();if(!a&&l){a=c.attr("title")}}u.html(a)}if(i.showExtraData){var h=i.dataElement.find("."+s.imageDataClass);if(h.length){h.empty();if(!f&&l){f=c.data("data")}h.html(f)}}}n.hover(function(){n.addClass(s.imageHoverClass);i.onImageHoverOver()},function(){n.removeClass(s.imageHoverClass);i.onImageHoverOut()});i.onImage(e(this),i.dataElement,c);i.preloadNextInQueue()})}}if(!r){n.siblings().andSelf().empty();i.find("li."+s.activeThumbClass).removeClass(s.activeThumbClass)}if(i.imageControls){var d=i.pageNumberForImage(t);if(i.currentPage!==d&&!i.pageTransition){i.goToPage(d,t)}i.updatePaging(t+1)}i.current=t;if(i.carouselControls&&(i.images.length>i.pageSize||i.images.length<=i.pageSize)){var v=t;var m=i.pageSize-1;var g=Math.floor(i.pageSize/2);if(!i.loop&&t<g){v=0}else if(!i.loop&&t>=i.length-g){m=i.length-1;v=m-i.pageSize+1}else{v-=g;m=v+i.pageSize-1}i.onCarousel(v,m);i.find("li").removeClass(s.currentThumbClass).hide();i.viewThumbs(v,m);i.currentPage=i.pageNumberForImage(t)}}},firstImage:function(){if(!i.atFirstImage()){if(i.separatePageBrowsing||i.atFirstPage()){i.viewImage(0)}else{i.goToPage(1)}}},nextImage:function(){if(!i.separatePageBrowsing&&i.lastImageOnPage()){if(i.atLastPage()&&i.loop){i.goToPage(1)}else{i.goToPage(i.currentPage+1)}i.onNext()}else{var e=i.getNextImage();if(e!==null){i.viewImage(e);i.onNext()}}var t=i.getNextImage();if(t!==null){i.addToLoadQueue(t)}},prevImage:function(){if(!i.separatePageBrowsing&&i.firstImageOnPage()){if(i.atFirstPage()&&i.loop){i.goToPage(i.numberOfPages(),i.numberOfImages()-1)}else{var e=i.currentPage-1;i.goToPage(e,e*i.pageSize-1)}i.onPrev()}else{var t=i.getPrevImage();if(t!==null){i.viewImage(t);i.onPrev()}}var n=i.getPrevImage();if(n!==null){i.addToLoadQueue(n)}},lastImage:function(){if(!i.atLastImage()){if(i.separatePageBrowsing||i.atLastPage()){i.viewImage(i.numberOfImages()-1)}else{i.goToPage(i.numberOfPages(),i.numberOfImages()-1)}}},imageHasData:function(){if(i.dataElement&&i.dataElement.length){var t=i.dataElement.find("."+e.exposure.captionClass).html();var n=i.dataElement.find("."+e.exposure.imageDataClass).html();return t&&t.length>0||n&&n.length>0}return false},pageTransition:false,playingSlideshow:false,slideshowTimer:null,slideshowTransition:false,slideshow:function(){i.slideshowTimer=setTimeout(function(){i.slideshowTransition=true;i.nextImage();i.slideshowTransition=false;i.slideshow()},i.slideshowDelay)},playSlideshow:function(){if(!i.playingSlideshow){if(i.slideshowControlsTarget){i.slideshowControlsElement.find("."+s.playSlideshowClass).hide();i.slideshowControlsElement.find("."+s.pauseSlideshowClass).show()}i.slideshow();i.playingSlideshow=true}i.onSlideshowPlayed()},pauseSlideshow:function(){if(i.playingSlideshow){if(i.slideshowControlsTarget){i.slideshowControlsElement.find("."+s.playSlideshowClass).show();i.slideshowControlsElement.find("."+s.pauseSlideshowClass).hide()}i.playingSlideshow=false;if(i.slideshowTimer){clearTimeout(i.slideshowTimer)}i.onSlideshowPaused()}},toggleSlideshow:function(){if(i.playingSlideshow){i.pauseSlideshow()}else{i.playSlideshow()}},first:function(){if(i.imageControls){i.firstImage()}else{i.firstPage()}},prev:function(){if(i.imageControls){i.prevImage()}else{i.prevPage()}},next:function(){if(i.imageControls){i.nextImage()}else{i.nextPage()}},last:function(){if(i.imageControls){i.lastImage()}else{i.lastPage()}},infullScreen:false,exitFullScreen:function(){if(i.infullScreen){i.pauseSlideshow();i.deselectCurrentImage();i.onExitFullScreen(i.targetElement,i.mask);i.infullScreen=false}},actualMaxWidth:function(e,t){return i.maxWidth?i.maxWidth-(s.widthDiff(e)+s.widthDiff(t)):0},actualMaxHeight:function(e,t){return i.maxHeight?i.maxHeight-(s.heightDiff(e)+s.heightDiff(t)):0},fitToMaxSize:function(e){var t=i.targetElement;if(i.stretchToMaxSize){if(i.maxWidth){e.width(i.actualMaxWidth(e,t))}if(i.maxHeight){e.height(i.actualMaxHeight(e,t))}}else{if(e.width()>e.height()){i.fitToMaxWidth(e,t);i.fitToMaxHeight(e,t)}else if(e.height()>e.width()){i.fitToMaxHeight(e,t);i.fitToMaxWidth(e,t)}else{var n=i.actualMaxHeight(e,t);var r=i.actualMaxWidth(e,t);if(!r||n&&r&&n<r){r=n}if(r&&e.width()>r){e.width(r);e.height(r)}}}},centerImageInWindow:function(t){var n=i.targetElement;n.width(t.width()).height(t.height());n.css({top:(e(window).height()-n.outerHeight(true))/2,left:(e(window).width()-n.outerWidth(true))/2});n.find("."+s.lastImageClass).each(function(){e(this).css({top:(n.height()-e(this).height())/2,left:(n.width()-e(this).width())/2})})},fitToWindow:function(){i.maxWidth=e(window).width();i.maxHeight=e(window).height();var t=i.targetElement.find("."+e.exposure.currentImageClass).width("auto").height("auto");if(!t.width()||!t.height()){var n=setInterval(function(){i.fitToMaxSize(t);i.centerImageInWindow(t);clearTimeout(n)},2)}else{i.fitToMaxSize(t);i.centerImageInWindow(t)}},fitToMaxWidth:function(e,t){var n=i.actualMaxWidth(e,t);if(n&&e.width()>n){var r=Math.round(n*e.height()/e.width());e.height(r);e.width(n)}},fitToMaxHeight:function(e,t){var n=i.actualMaxHeight(e,t);if(n&&e.height()>n){var r=Math.round(n*e.width()/e.height());e.width(r);e.height(n)}},resizeContainer:function(e){i.fitToMaxSize(e);if(!i.fixedContainerSize){i.targetElement.show().width(e.width()).height(e.height())}}});e.extend(this,t,r);this.targetElement=e(this.target);if(!this.targetElement.length){this.target=t.target;this.targetElement=e('').insertBefore(e(this))}var u=this.wrapper=e('');var a=this.targetElement.addClass(s.targetClass).append(u);if(this.showCaptions||this.showExtraData){var f="";if(this.showCaptions){f+=''}if(this.showExtraData){f+=''}var l=e(f);if(l.length){this.dataElement=e(this.dataTarget);if(this.dataTarget&&this.dataElement.length){this.dataElement.addClass(s.dataContainerClass).append(l)}else{this.dataElement=e('');a.append(this.dataElement.append(l))}}}if(!this.showThumbs){this.carouselControls=false}if(this.carouselControls||!this.controlsTarget||!this.controls.prevNext&&!this.controls.firstLast&&!this.controls.pageNumbers){this.showControls=false}if(this.showControls){this.controlsElement=e(this.controlsTarget).addClass(s.controlsClass).each(function(){if(i.controls.firstLast){e(this).append(s.createLink(o.first,i.first,s.firstPageClass))}if(i.controls.prevNext){e(this).append(s.createLink(o.previous,i.prev,s.prevPageClass))}if(i.controls.pageNumbers){e(this).append(e(''))}if(i.controls.prevNext){e(this).append(s.createLink(o.next,i.next,s.nextPageClass))}if(i.controls.firstLast){e(this).append(s.createLink(o.last,i.last,s.lastPageClass))}})}if(this.enableSlideshow&&this.slideshowControlsTarget){this.slideshowControlsElement=e(this.slideshowControlsTarget).addClass(s.slideshowControlsClass).each(function(){e(this).append(s.createLink(o.play,i.playSlideshow,s.playSlideshowClass));e(this).append(s.createLink(o.pause,i.pauseSlideshow,s.pauseSlideshowClass).hide())})}if(this.keyboardNavigation){if(this.carouselControls){e(document).bind("keyup","left",this.nextImage);e(document).bind("keyup","right",this.prevImage)}else{e(document).bind("keyup","left",this.prevImage);e(document).bind("keyup","right",this.nextImage);e(document).bind("keyup","ctrl+left",this.prevPage);e(document).bind("keyup","ctrl+right",this.nextPage);e(document).bind("keyup","up",this.lastImage);e(document).bind("keyup","down",this.firstImage);e(document).bind("keyup","ctrl+up",this.lastPage);e(document).bind("keyup","ctrl+down",this.firstPage)}if(this.enableSlideshow){e(document).bind("keyup","space",this.toggleSlideshow)}}if(this.fullScreen){e(window).resize(this.fitToWindow);this.mask=e('').click(this.exitFullScreen).insertAfter(this.target);if(this.keyboardNavigation){e(document).bind("keyup","esc",this.exitFullScreen)}}var c=null;if(this.jsonSource){if(s.isObject(this.jsonSource)){c=this.jsonSource}else if(this.jsonSource.length){if(s.startsWith(this.jsonSource,"http://")||s.startsWith(this.jsonSource,"https://")){c=e.ajax({url:this.jsonSource,type:"GET",async:false}).responseText}else{c=this.jsonSource}}}return this.addClass(s.thumbsClass).each(function(){var t;if(c){var n=s.isObject(c)?c:e.parseJSON(c);if(n&&n.data){for(t in n.data){var r=n.data[t];if(r.source&&r.source.length){var o=e("");var u=e("<a></a>").attr("href",r.source);if(r.thumb_source&&r.thumb_source.length){var a=e("<img />").attr("src",r.thumb_source);if(r.caption&&r.caption.length){a.attr("title",r.caption)}u.append(a)}else if(r.caption&&r.caption.length){u.attr("title",r.caption)}o.append(u);if(r.extra_data&&r.extra_data.length){o.append(e(r.extra_data))}e(this).append(o)}}}}var f=false;var l=false;if(e(this).children("li").length){var h=null;e(this).show().children("li").each(function(){f=true;var t=e(this).find("a");if(t.length){t=e(t[0]);var n=t.attr("href");var r=t.find("img");var o=r.length?r.attr("src"):t.attr("rel");var u=r.length?r.attr("title"):t.attr("title");var a=t.hasClass(s.selectedImageClass)&&!h;t.remove();var c=e(this).html();if(o){l=true}e(this).remove();var p=i.newImage(n,o,u,c);if(p>-1){if(a){h=p}if(i.loadQueue.length<i.preloadBuffer){i.addToLoadQueue(p)}}}else{e(this).remove()}});if(!i.showThumbs){i.pageSize=1;e("."+s.thumbsClass).remove()}if(f){i.preloadNextInQueue();i.createPaging();if(h){i.goToPage(i.pageNumberForImage(h));i.viewImage(h)}else{i.goToPage(1)}if(i.enableSlideshow&&i.autostartSlideshow){i.playSlideshow()}}else{i.onEmpty(i)}}else{i.onEmpty(i)}i.onInit();i.initialized=true})}})(jQuery);
/*
- jQuery Hotkeys Plugin
- Copyright 2010, John Resig
- Dual licensed under the MIT or GPL Version 2 licenses.
- Based upon the plugin by Tzury Bar Yochay:
- http://github.com/tzuryby/hotkeys
- Original idea by:
- Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/
- /
(function(jQuery){jQuery.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":": ","'":"\"",",":"<",".":">","/":"?","\\":"|"}};function keyHandler(handleObj){if(typeof handleObj.data!=="string"){return}var origHandler=handleObj.handler,keys=handleObj.data.toLowerCase().split(" ");handleObj.handler=function(event){if(this!==event.target&&(/textarea|select/i.test(event.target.nodeName)||event.target.type==="text")){return}var special=event.type!=="keypress"&&jQuery.hotkeys.specialKeys[event.which],character=String.fromCharCode(event.which).toLowerCase(),key,modif="",possible={};if(event.altKey&&special!=="alt"){modif+="alt+"}if(event.ctrlKey&&special!=="ctrl"){modif+="ctrl+"}if(event.metaKey&&!event.ctrlKey&&special!=="meta"){modif+="meta+"}if(event.shiftKey&&special!=="shift"){modif+="shift+"}if(special){possible[modif+special]=true}else{possible[modif+character]=true;possible[modif+jQuery.hotkeys.shiftNums[character]]=true;if(modif==="shift+"){possible[jQuery.hotkeys.shiftNums[character]]=true}}for(var i=0,l=keys.length;i<l;i++){if(possible[keys[i]]){return origHandler.apply(this,arguments)}}}}jQuery.each(["keydown","keyup","keypress"],function(){jQuery.event.special[this]={add:keyHandler}})})(jQuery);