Browse files

added minified widget

  • Loading branch information...
1 parent 98d9cdd commit e3468886bfc32329a93fec352f038d6414d114bb Wojciech Ryrych committed Oct 14, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 widget/lib/jquery.ui.rlightbox.min.js
View
2 widget/lib/jquery.ui.rlightbox.min.js
@@ -1 +1 @@
-(function(a,b){a.widget("ui.rlightbox",{options:{animationSpeed:"fast",setPrefix:"lb",showMap:true,counterDelimiter:" / ",videoWidth:640,videoHeight:385,errorMessage:"Oh dear! Something went wrong! If the problem still appears let the page’s admin know. Would you like to try again or reject the content?",againButtonLabel:"Try again",rejectButtonLabel:"Reject this content",overwriteTitle:false,keys:{next:[78,39],previous:[80,37],close:[67,27],panorama:[90,null]}},_create:function(){var d,e=a.ui.rlightbox.global,c=this;e.getLightbox();d=e.extractAnchor(this);if(d.type!==b){e.addToSet(d);this.element.click(function(f){e.open(c);f.preventDefault()})}},_setOption:function(c,d){}});a.extend(a.ui.rlightbox,{global:{addToSet:function(f){var g=this.getSetName(f.self),e=a.ui.rlightbox.global.sets,c=f.self.options,h=c.setPrefix,d="."+h+"_"+g,i=a(d).index(f.element);if(!e[g]){e[g]=[];e[g].push(f)}else{e[g].splice(i,0,f)}},checkMinimalSize:function(c,f){var g=this.data,e=g.minimalLightboxSize,h=e.width,d=e.height;if(c==="width"){if(f<h){return h}else{return f}}else{if(c==="height"){if(f<d){return d}else{return f}}}},closeLightbox:function(){var d=this.data,c=this.$lightbox;if(d.ready){c.overlay.add(c.root).add(c.header).hide();a("body").css("overflow","visible");c.content.empty().width(20).height(20);this.panoramaHideIcon();d.currentElementNumber=null;d.totalElementsNumber=null;c.title.empty();this.panoramaHideMap();d.ready=false}},createStructure:function(){var e="<div id='ui-lightbox' class='ui-widget ui-widget-content ui-corner-all' style='display: none'><div id='ui-lightbox-panorama-icon' style='display: none'></div><div id='ui-lightbox-content' class='ui-widget-content'></div><div id='ui-lightbox-header' class='ui-widget-header ui-corner-all' style='display: none'><p id='ui-lightbox-header-wrapper'><span id='ui-lightbox-header-title'></span></p><p id='ui-lightbox-header-counter'></p><a id='ui-lightbox-header-close'><span class='ui-icon ui-icon-closethick'>close</span></a></div></div>",d="<div id='ui-lightbox-map' style='display: none'><div id='ui-lightbox-map-viewport'></div></div>",c="<div id='ui-lightbox-overlay' class='ui-widget-overlay' title='click to close' style='display: none'></div>";a(e).appendTo("body").after(d).after(c)},destroy:function(){var d=this.data,c=d.currentSetElement.element;c.unbind(".rlightbox").unbind("click").removeData("rlightbox")},extractAnchor:function(e){var d={type:b},f=a(e.element),c=f.attr("href"),g={youtube:{urls:[/(http:\/\/www\.youtube\.com\/watch\?v=([\w-_]+))&?/],type:"youtube"},image:{urls:[/.jpg$|.png$|.gif$/],type:"image"},vimeo:{urls:[/(http:\/\/vimeo\.com\/groups\/\w+\/videos\/(\w+))&?/,/(http:\/\/vimeo\.com\/(\w+))&?/],type:"vimeo"},flash:{urls:[/.swf/],type:"flash"}};a.each(g,function(i,j){var h=false;a.each(j.urls,function(l,k){var m=k.exec(c);if(m!==null){d={url:m[1],id:m[2],type:j.type,element:f,self:e};if(j.type==="image"||j.type==="flash"||e.options.overwriteTitle){d.title=f.attr("title");d.url=c}h=true;return false}});if(h){return false}});return d},getAvailableScreenSize:function(){var d=this.data,c=d.lightboxPadding;return{width:this.getWindowSize("width")-c,height:this.getWindowSize("height")-d.headerHeight-c}},getCurrentElementNumber:function(f){var e,h=this.data,g=this.sets,d=this,c=g[h.currentSet];a.each(c,function(k,j){if(a(f).get(0)===j.element.get(0)){e=k+1;return false}});return e},getImageStatus:function(d,p){var j,o,g=this.data,k=g.currentSetElement,e=this.getWindowSize("width"),c=this.getWindowSize("height"),n=g.minimalLightboxSize.width,i=g.minimalLightboxSize.height,m=k.width,l=k.height,f=g.lightboxPadding,h=g.headerHeight;if(d<=n){j=-1}else{if(d>n&&d+f<=e){j=1}else{j=2}}if(p<=i){o=-1}else{if(p>i&&c>=p+f+h){o=1}else{o=2}}return{statusWidth:j,statusHeight:o}},getLightbox:function(){var e=this.data,d=this.$lightbox,c=this;if(!d.root){this.createStructure();this.setReferences();d.close.add(d.overlay).click(a.proxy(this.closeLightbox,this));d.close.hover(function(){a(this).toggleClass("ui-state-hover")});d.content.mousemove(a.proxy(this.navigationCheckSide,this)).click(a.proxy(this.navigationNext,this)).mousedown(a.proxy(this.panoramaStart,this)).mouseup(a.proxy(this.panoramaStop,this));d.panoramaIcon.click(a.proxy(this.panoramaToggle,this)).hover(a.proxy(this.panoramaHighlight,this));a(window).bind("resize.rlightbox",a.proxy(this.liveResize,this));a(document).keyup(a.proxy(this.handleKeyboard,this))}},getOptimalSize:function(k,e){var h=this.data,f=h.minimalLightboxSize,j=f.width,i=f.height,g=this.getAvailableScreenSize(),d=g.width,c=g.height;if(k==="width"){if(e<j){return j}else{if(e>d){return d}else{return e}}}else{if(k==="height"){if(e<i){return i}else{if(e>c){return c}else{return e}}}}},getParam:function(g,c){var d,e="[\\?&]"+g+"=(\\w+)",f=new RegExp(e);d=f.exec(c);if(d!==null){return d[1]}else{return null}},getSetName:function(e){var g=a(e.element).attr("class"),f=e.options.setPrefix+"_",d=new RegExp(f+"([\\w-_]+)"),c=d.exec(g);return c?c[1]:"single"},getSizes:function(){var k,j,r,p,c,h,e,f,i,l=this.$lightbox,x=this.data,m=this,o=x.currentSetElement,s=this.getWindowSize("width"),t=this.getWindowSize("height"),n=x.minimalLightboxSize.width,v=x.minimalLightboxSize.height,g=o.width,q=o.height,u=x.lightboxPadding,d=x.headerHeight;function w(y,z){k=m.getImageStatus(y,z);j=k.statusWidth;r=k.statusHeight;if(((j===1||j===-1)&&r!==2)&&((r===1||r===-1)&&j!==2)){if(j===1){h=y}else{if(j===-1){h=n}}p=y;if(r===1){e=z}else{if(r===-1){e=v}}c=z}else{if(j===2||r===2){if(j===1||j===-1){e=t-d-u;c=e;f=e/z;if(j===-1){h=n;p=Math.ceil(y*f)}else{h=Math.ceil(y*f)-u;p=h;if(p<=n){w(p,c)}}}else{if(r===1||r===-1){h=s-u;p=h;i=h/y;if(r===-1){e=v;c=Math.ceil(z*i)}else{e=Math.ceil(z*i)-d-u;c=e;if(c<=v){w(p,c)}}}else{if(y>z){h=s-u;p=h;i=h/y;e=Math.ceil(z*i)-u-d;c=e;if(c<=v||e+u+d>t){w(p,c)}}else{e=t-d-u;c=e;f=e/z;h=Math.ceil(y*f)-u;p=h;if(p<=n||h>s){w(p,c)}}}}}}}w(g,q);return{imageTargetWidth:p,imageTargetHeight:c,lightboxTargetWidth:h,lightboxTargetHeight:e,statusWidth:j,statusHeight:r}},getWindowSize:function(k){var g=this.data,e=a(window).width(),c=a(window).height(),d=g.minimalLightboxSize,f=g.lightboxPadding,i=g.headerHeight,j=d.width+f,h=d.height+f+i;if(k==="width"){if(e<j){return j}else{return e}}else{if(c<h){return h}else{return c}}},handleKeyboard:function(g){var h=this.data,d=h.currentSetElement,c=d.self.options,e=c.keys,f=g.which;if(h.ready===false){return}if(f===e.next[0]||f===e.next[1]){h.side="right";this.navigationNext()}else{if(f===e.previous[0]||f===e.previous[1]){h.side="left";this.navigationNext()}else{if(f===e.close[0]||f===e.close[1]){this.closeLightbox()}else{if((f===e.panorama[0]||f===e.panorama[1])&&d.type==="image"){this.panoramaToggle(g)}}}}},liveResize:function(){var e=this.data,c=this,d=this.$lightbox,f=e.currentSetElement.type;if(e.ready&&e.panoramaOn===false&&f==="image"){this.queueResizeLightbox();this.updateTitleWidth();this.queueCenterContent();this.panoramaCheckAvailability()}else{if(e.ready&&e.panoramaOn&&f==="image"){this.queueCenterLightbox();this.panoramaShrink();this.panoramaCheckAvailability()}else{if(e.ready&&f!=="image"){this.queueCenterLightbox()}}}},loadContentFlash:function(c){var g,h,k,i=this.data,o=this.$lightbox,n=this,d=o.content,e=a.Deferred(),f=i.htmlFlash,j=i.currentSetElement,m=j.self.options;d.addClass("ui-lightbox-loader");function l(){g=n.getParam("width",c);h=n.getParam("height",c);if(g===null||isNaN(g)){g=m.videoWidth}if(h===null||isNaN(h)){h=m.videoHeight}j.width=g;j.height=h;f=n.replaceHtmlPatterns(f,{width:g,height:h,url:c});k=a("<div></div>");k.css({display:"none",width:g,height:h});d.removeClass("ui-lightbox-loader").empty().append(f).children().wrap(k);e.resolve()}setTimeout(l,1000);return e.promise()},loadContentImage:function(f){var g=this.$lightbox,i=this.data,d=this,e=i.currentSetElement,c=a.Deferred(),h=a("<img />");g.content.addClass("ui-lightbox-loader");h.attr("src",f+"?"+new Date().getTime()).load(function(){e.width=this.width;e.height=this.height;g.content.removeClass("ui-lightbox-loader").empty().append(this).children().hide();c.resolve()}).error(function(){g.content.removeClass("ui-lightbox-loader");d.showErrorMessage();c.resolve()});return c.promise()},loadContentVimeo:function(c){var e,g,h=this.data,m=this.$lightbox,l=this,d=a.Deferred(),j=h.providers.vimeo,i=h.currentSetElement,k=i.self.options,f=h.minimalLightboxSize;m.content.addClass("ui-lightbox-loader");a.ajax({url:j,data:{url:c,maxwidth:k.videoWidth,maxheight:k.videoHeight},dataType:"jsonp",timeout:5000}).success(function(n){m.content.removeClass("ui-lightbox-loader").empty().append(n.html).children().wrap("<div style='display: none'></div>").end().find("div:first").width(n.width).height(n.height);if(k.overwriteTitle===false){i.title=n.title}i.width=n.width;i.height=n.height;d.resolve()}).error(function(){m.content.removeClass("ui-lightbox-loader");l.showErrorMessage();d.resolve()});return d.promise()},loadContentYoutube:function(c){var n,k=this.data,q=this.$lightbox,d=q.content,p=this,e=a.Deferred(),m=k.providers.youtube,l=k.currentSetElement,o=l.self.options,i=k.minimalLightboxSize,g=o.videoWidth,j=o.videoHeight,f=k.htmlYoutube;q.content.addClass("ui-lightbox-loader");a.ajax({url:m+l.id+"?callback=?",data:{v:2,alt:"jsonc",prettyprint:true},dataType:"jsonp",timeout:5000}).success(function(r){if(r.error){h();return}f=p.replaceHtmlPatterns(f,{width:g,height:j,url:l.id});n=a("<div></div>");n.css({display:"none",width:g,height:j});d.removeClass("ui-lightbox-loader").empty().append(f).children().wrap(n);if(o.overwriteTitle===false){l.title=r.data.title}l.width=g;l.height=j;e.resolve()}).error(function(){h()});function h(){q.content.removeClass("ui-lightbox-loader");p.showErrorMessage();e.resolve()}return e.promise()},navigationCheckSide:function(i){var j=this.data,h=this.$lightbox,f=h.content,e=j.currentElementNumber,d=j.totalElementsNumber;if(j.ready&&j.currentSet!=="single"&&j.currentSetElement.type==="image"&&j.panoramaOn===false){var c=i.pageX-f.offset().left,g=Math.round(f.width()/2);if(c<=g&&e>1){j.side="left";f.css("cursor","w-resize")}else{if(c>g&&e<d){j.side="right";f.css("cursor","e-resize")}else{j.side="";f.css("cursor","default")}}}else{if(j.panoramaDrag===false){j.side="";f.css("cursor","default")}else{j.side="";f.css("cursor","move")}}i.preventDefault()},navigationGoToElement:function(f){var g=this.data,d=this.sets,e=this.$lightbox,c=g.currentSet;g.currentElementNumber=f;g.currentSetElement=d[c][f-1];this.setNextQueue();e.queueContainer.next.dequeue("lightboxNext")},navigationNext:function(){var d,h,g=this.data,e=this.sets,f=this.$lightbox,c=g.currentSet;if(g.ready&&c!=="single"){d=g.currentElementNumber;if(d+1<=g.totalElementsNumber&&g.side==="right"){g.currentElementNumber=d+1;h=e[c][d];g.currentSetElement=h;this.setNextQueue();f.queueContainer.next.dequeue("lightboxNext")}else{if(d-1>=1&&g.side==="left"){g.currentElementNumber=d-1;h=e[c][d-2];g.currentSetElement=h;this.setNextQueue();f.queueContainer.next.dequeue("lightboxNext")}}}},open:function(f){var i=this.data,e=this.sets,g=this.$lightbox,h=f.element,c=this.getSetName(f),d=a(h).attr("href");i.currentSet=c;i.totalElementsNumber=e[c].length;i.currentElementNumber=this.getCurrentElementNumber(h);i.currentSetElement=e[c][i.currentElementNumber-1];this.setOpenQueue();this.setNextQueue();g.queueContainer.open.dequeue("lightboxOpen")},panoramaCenterContent:function(){var m,l,h=this.data,n=this.$lightbox,i=h.currentSetElement,g=this.getAvailableScreenSize(),f=g.width,e=g.height,k=i.width,j=i.height,d=n.content,c=d.find("img");if(f<k){m=0}else{m=d.width()/2-c.width()/2}if(e<j){l=0}else{l=d.height()/2-c.height()/2}c.css({top:l,left:m})},panoramaCheckAvailability:function(){var h=this.data,e=h.currentSetElement,f=e.width,c=e.height,g=e.currentWidth,d=e.currentHeight;if(g<f||d<c){this.panoramaShowIcon("expand");h.enablePanorama=true}else{h.enablePanorama=false;this.panoramaHideIcon()}},panoramaExpand:function(f){var g=this.data,e=this.$lightbox,d=g.currentSetElement,c=d.self.options;g.panoramaOn=true;if(f.type==="click"){this.panoramaShowIcon("shrink","-hover")}else{this.panoramaShowIcon("shrink")}e.content.find("img").width(d.width).height(d.height);this.panoramaSetContentSize();this.panoramaCenterContent();this.queueCenterLightbox();this.updateTitleWidth();if(c.showMap){this.panoramaShowMap()}},panoramaHideIcon:function(){var d=this.data,c=this.$lightbox;c.panoramaIcon.hide().removeClass("ui-lightbox-panorama-icon-expand ui-lightbox-panorama-icon-shrink");d.panoramaOn=false},panoramaHideMap:function(){var c=this.$lightbox;c.map.hide();c.viewport.css({left:-1,top:-1})},panoramaHighlight:function(){var d,e=this.$lightbox,c="-hover";e.panoramaIcon.attr("class",function(g,f){d=f.indexOf(c);if(d!==-1){return f.slice(0,d)}else{return f+c}})},panoramaSetContentSize:function(){var c,j,i=this.data,o=this.$lightbox,k=i.currentSetElement,h=i.minimalLightboxSize,n=h.width,f=h.height,g=this.getAvailableScreenSize(),e=g.width,d=g.height,m=k.width,l=k.height;if(m>e){c=e}else{if(m<=n){c=n}else{c=m}}if(l>d){j=d}else{if(l<=f){j=f}else{j=l}}o.content.width(c).height(j)},panoramaShowIcon:function(d,f){var e=this.$lightbox,c=f||"",g="ui-lightbox-panorama-icon-"+d+c;e.panoramaIcon.show().removeClass().addClass(g)},panoramaShowMap:function(){var o,d,p,m,e,n,i=this.data,g=i.minimalLightboxSize,q=this.$lightbox,c=q.content,f=c.find("img"),l=f.width(),k=f.height(),j=i.currentSetElement,h=i.mapSize;p=h.width/j.width;m=h.height/j.height;if(l<g.width){e=l}else{e=c.width()}if(k<g.height){n=k}else{n=c.height()}o=Math.ceil(e*p);d=Math.ceil(n*m);q.viewport.width(o).height(d);q.map.show();i.viewportRatio={width:p,height:m}},panoramaShrink:function(d){var e=this.data,c=this.$lightbox;e.panoramaOn=false;if(d&&d.type==="click"){this.panoramaShowIcon("expand","-hover")}else{this.panoramaShowIcon("expand")}this.queueResizeLightbox();this.queueCenterContent();this.updateTitleWidth();this.panoramaHideMap()},panoramaStart:function(d){var e=this.data,c=this.$lightbox;e.panoramaPosition={xStart:d.pageX,yStart:d.pageY};e.panoramaDrag=true;if(e.panoramaOn){c.content.css("cursor","move")}d.preventDefault()},panoramaStop:function(f){var h=this.data,e=this.$lightbox,g=(f.pageX-h.panoramaPosition.xStart)*-1,d=(f.pageY-h.panoramaPosition.yStart)*-1,c=e.content,i=h.viewportRatio;h.panoramaDrag=false;if(h.panoramaOn){c.scrollLeft(c.scrollLeft()+g).scrollTop(c.scrollTop()+d);e.viewport.css({left:c.scrollLeft()*i.width-1,top:c.scrollTop()*i.height-1})}f.stopPropagation()},panoramaToggle:function(d){var e=this.data,f=e.panoramaOn,c=e.enablePanorama;if(c&&f===false){this.panoramaExpand(d)}else{if(c&&f){this.panoramaShrink(d)}}},removeSetElement:function(f){var g=this.data,e=this.sets,c=g.currentSet,d=g.totalElementsNumber;e[c].splice(f-1,1);if(d===1||c==="single"){this.closeLightbox();this.destroy()}else{this.destroy();g.totalElementsNumber=e[c].length;if(f===d){this.navigationGoToElement(f-1)}else{this.navigationGoToElement(f)}}},replaceHtmlPatterns:function(d,c){a.each(c,function(e,g){var f=new RegExp("{"+e+"}","g");d=d.replace(f,g)});return d},setNextQueue:function(){var d=this.$lightbox,c=[a.proxy(this.queueSlideUpHeader,this),a.proxy(this.queueHideContent,this),a.proxy(this.queueLoadContent,this),a.proxy(this.queueResizeLightbox,this),a.proxy(this.queueCenterContent,this),a.proxy(this.queueShowContent,this),a.proxy(this.queueSlideDownHeader,this)];d.queueContainer.next.queue("lightboxNext",c)},setOpenQueue:function(){var d=this.$lightbox,c=[a.proxy(this.queueShowOverlay,this),a.proxy(this.queueCenterLightbox,this),a.proxy(this.queueLoadContent,this),a.proxy(this.queueResizeLightbox,this),a.proxy(this.queueCenterContent,this),a.proxy(this.queueShowContent,this),a.proxy(this.queueSlideDownHeader,this)];d.queueContainer.open.queue("lightboxOpen",c)},setReferences:function(){var c=this.$lightbox;c.root=a("#ui-lightbox");c.panoramaIcon=c.root.find("#ui-lightbox-panorama-icon");c.content=c.root.find("#ui-lightbox-content");c.header=c.root.find("#ui-lightbox-header");c.headerWrapper=c.header.find("#ui-lightbox-header-wrapper");c.overlay=a("#ui-lightbox-overlay");c.close=a("#ui-lightbox-header-close");c.counter=c.root.find("#ui-lightbox-header-counter");c.title=c.root.find("#ui-lightbox-header-title");c.map=a("#ui-lightbox-map");c.viewport=c.map.children().eq(0);c.queueContainer={open:a({}),next:a({})}},showErrorMessage:function(){var g,j,n,f=this.data,r=this.$lightbox,q=this,h=f.currentSetElement,o=h.self.options,l=f.currentElementNumber,k=o.errorMessage,e=o.againButtonLabel,d=o.rejectButtonLabel,c=f.htmlErrorScreen,i=f.errorScreenSize,p=i.width,m=i.height;c=q.replaceHtmlPatterns(c,{message:k,labelAgain:e,labelReject:d});n=a(c);g=n.find("#ui-lightbox-error-footer-again");j=n.find("#ui-lightbox-error-footer-reject");g.click(function(){q.navigationGoToElement(l)}).hover(function(){a(this).toggleClass("ui-state-hover")});j.click(function(){q.removeSetElement(l)}).hover(function(){a(this).toggleClass("ui-state-hover")});r.content.empty().append(n).find("#ui-lightbox-error").width(p).height(m).end().children().hide();f.showErrorMessage=true},updateCounter:function(){var h,e,g,j=this.data,i=this.$lightbox,f=j.currentSetElement,d=f.self.options,c=j.currentSet;if(c!=="single"){h=j.currentElementNumber;e=j.totalElementsNumber}else{h=1;e=1}g=h+d.counterDelimiter+e;i.counter.text(g)},updateTitle:function(){var e=this.data,d=this.$lightbox,c=e.currentSetElement;if(c.title!==""){d.title.empty().append(c.title)}else{d.title.append("&nbsp;")}},updateTitleWidth:function(){var c=this.$lightbox;c.header.width(c.content.width()-12)},queueHideContent:function(e){var g=this.data,f=this.$lightbox,d=g.currentSetElement,c=d.self.options;f.content.children().fadeOut(c.animationSpeed,function(){a(this).remove();e()});f.panoramaIcon.hide().removeClass("ui-lightbox-panorama-icon-expand ui-lightbox-panorama-icon-shrink");g.panoramaOn=false;this.panoramaHideMap()},queueShowOverlay:function(d){var f=this.data,e=this.$lightbox,c=f.currentSetElement.self;f.ready=false;a("body").css("overflow","hidden");e.overlay.fadeIn(c.options.animationSpeed,d)},queueCenterLightbox:function(f){var g=this.$lightbox,h=g.root,d=this.getWindowSize("width"),c=this.getWindowSize("height"),i=h.outerWidth(),e=h.outerHeight();h.css({left:Math.round((d-i)/2)+"px",top:Math.round((c-e)/2)+"px"}).show(0,f)},queueLoadContent:function(d){var c,e=this.data,f=e.currentSetElement;e.showErrorMessage=false;switch(f.type){case"image":c="loadContentImage";break;case"youtube":c="loadContentYoutube";break;case"vimeo":c="loadContentVimeo";break;case"flash":c="loadContentFlash"}a.when(this[c](f.url)).then(function(){d()})},queueResizeLightbox:function(p){var j,r,n,s,c,i,e,f,w=this.data,m=this.$lightbox,x=w.lightboxPadding,d=w.headerHeight,q=w.currentSetElement,o=q.self.options,t=w.showErrorMessage,h=w.errorScreenSize,g=h.width,k=h.height,v=w.minimalLightboxSize,l=v.width,u=v.height;j=o.animationSpeed;if(q.type==="image"&&t===false){n=this.getSizes();s=n.imageTargetWidth;c=n.imageTargetHeight;i=n.lightboxTargetWidth;e=n.lightboxTargetHeight;f=m.content.find("img");q.currentWidth=s;q.currentHeight=c;f.width(s).height(c);if(a.isFunction(p)){j=o.animationSpeed}else{j=0}}else{if((q.type==="youtube"||q.type==="vimeo")&&t===false){i=this.checkMinimalSize("width",q.width);e=this.checkMinimalSize("height",q.height)}else{if(q.type==="flash"&&t===false){i=this.getOptimalSize("width",q.width);e=this.getOptimalSize("height",q.height)}else{if(t){j=0;i=g;e=k}}}}m.root.find("#ui-lightbox-content").animate({width:i},j).animate({height:e},j).end().animate({left:(this.getWindowSize("width")-i-x)/2},j).animate({top:(this.getWindowSize("height")-e-x-d)/2},j,p)},queueCenterContent:function(e){var d,f=this.$lightbox,g=f.content,c=g.children();g.children().css({top:g.height()/2-c.outerHeight()/2,left:g.width()/2-c.outerWidth()/2});if(e){e()}},queueShowContent:function(g){var i=this.data,h=this.$lightbox,d=this,e=i.currentSetElement,c=e.self.options,f=i.showErrorMessage;h.content.children().fadeIn(c.animationSpeed,function(){if(e.type==="image"&&f===false){d.panoramaCheckAvailability()}g()})},queueSlideDownHeader:function(d){var f=this.data,e=this.$lightbox,c=f.currentSetElement.self.options;e.header.slideDown(c.animationSpeed,d);this.updateCounter();this.updateTitleWidth();this.updateTitle();f.ready=true},queueSlideUpHeader:function(e){var g=this.data,f=this.$lightbox,d=g.currentSetElement,c=d.self.options;g.ready=false;f.header.slideUp(c.animationSpeed,e)},$lightbox:{},sets:{},data:{minimalLightboxSize:{width:300,height:300},lightboxPadding:12,headerHeight:57,ready:false,panoramaOn:false,mapSize:{width:150,height:100},providers:{vimeo:"http://www.vimeo.com/api/oembed.json?callback=?",youtube:"http://gdata.youtube.com/feeds/api/videos/"},showErrorMessage:false,currentSetElement:{},enablePanorama:false,errorScreenSize:{width:500,height:500},htmlFlash:"<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='{width}' height='{height}'><param name='movie' value='{url}' /><!--[if !IE]>--><object type='application/x-shockwave-flash' data='{url}' width='{width}' height='{height}'><!--<![endif]--><!--[if !IE]>--></object><!--<![endif]--></object>",htmlErrorScreen:"<div id='ui-lightbox-error'><div id='ui-lightbox-error-message' class='ui-lightbox-error-icon-sign'>{message}</div><div id='ui-lightbox-error-footer'><button aria-disabled='false' role='button' id='ui-lightbox-error-footer-again' class='ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary'><span class='ui-button-icon-primary ui-icon ui-icon-refresh'></span><span class='ui-button-text'>{labelAgain}</span></button><button aria-disabled='false' role='button' id='ui-lightbox-error-footer-reject' class='ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary'><span class='ui-button-icon-primary ui-icon ui-icon-trash'></span><span class='ui-button-text'>{labelReject}</span></button></div></div>",htmlYoutube:"<iframe class='youtube-player' type='text/html' width='{width}' height='{height}' src='http://www.youtube.com/embed/{url}' frameborder='0'></iframe>"}}})})(jQuery);
+(function(a,b){a.widget("ui.rlightbox",{options:{animationSpeed:"fast",setPrefix:"lb",showMap:true,counterDelimiter:" / ",videoWidth:640,videoHeight:385,errorMessage:"Oh dear! Something went wrong! If the problem still appears let the page’s admin know. Would you like to try again or reject the content?",againButtonLabel:"Try again",rejectButtonLabel:"Reject this content",overwriteTitle:false,keys:{next:[78,39],previous:[80,37],close:[67,27],panorama:[90,null]},loop:false},_create:function(){var d,e=a.ui.rlightbox.global,c=this;e.getLightbox();d=e.extractAnchor(this);if(d.type!==b){e.addToSet(d);this.element.click(function(f){e.open(c);f.preventDefault()})}},_setOption:function(c,d){}});a.extend(a.ui.rlightbox,{global:{addToSet:function(f){var g=this.getSetName(f.self),e=a.ui.rlightbox.global.sets,c=f.self.options,h=c.setPrefix,d="."+h+"_"+g,i=a(d).index(f.element);if(!e[g]){e[g]=[];e[g].push(f)}else{e[g].splice(i,0,f)}},checkButtonsState:function(){var g=this.data,f=this.$lightbox,c=g.currentSet,h=g.totalElementsNumber,d=g.currentElementNumber,e=g.currentSetElement.self.options.loop;if(c==="single"||h===1){this.setButtonState("disabled")}else{if(d===1&&e===false){this.setButtonState("disabled",f.prev);this.setButtonState("default",f.next)}else{if(d===h&&e===false){this.setButtonState("disabled",f.next);this.setButtonState("default",f.prev)}else{this.setButtonState("default")}}}},checkMinimalSize:function(c,f){var g=this.data,e=g.minimalLightboxSize,h=e.width,d=e.height;if(c==="width"){if(f<h){return h}else{return f}}else{if(c==="height"){if(f<d){return d}else{return f}}}},closeLightbox:function(){var d=this.data,c=this.$lightbox;if(d.ready){c.overlay.add(c.root).add(c.header).hide();a("body").css("overflow","visible");c.content.empty().width(20).height(20);this.hideArrow();this.setButtonState("default");this.panoramaHideIcon();d.currentElementNumber=null;d.totalElementsNumber=null;c.title.empty();this.panoramaHideMap();d.ready=false}},createStructure:function(){var c=this.data;a(c.htmlLightbox).appendTo("body").after(c.htmlMap).after(c.htmlOverlay)},destroy:function(){var d=this.data,c=d.currentSetElement.element;c.unbind(".rlightbox").unbind("click").removeData("rlightbox")},extractAnchor:function(e){var d={type:b},f=a(e.element),c=f.attr("href"),g={youtube:{urls:[/(http:\/\/www\.youtube\.com\/watch\?v=([\w-_]+))&?/],type:"youtube"},image:{urls:[/.jpg$|.png$|.gif$/],type:"image"},vimeo:{urls:[/(http:\/\/vimeo\.com\/groups\/\w+\/videos\/(\w+))&?/,/(http:\/\/vimeo\.com\/(\w+))&?/],type:"vimeo"},flash:{urls:[/.swf/],type:"flash"}};a.each(g,function(i,j){var h=false;a.each(j.urls,function(l,k){var m=k.exec(c);if(m!==null){d={url:m[1],id:m[2],type:j.type,element:f,self:e};if(j.type==="image"||j.type==="flash"||e.options.overwriteTitle){d.title=f.attr("title");d.url=c}h=true;return false}});if(h){return false}});return d},getAvailableScreenSize:function(){var d=this.data,c=d.lightboxPadding;return{width:this.getWindowSize("width")-c,height:this.getWindowSize("height")-d.headerHeight-c}},getCurrentElementNumber:function(f){var e,h=this.data,g=this.sets,d=this,c=g[h.currentSet];a.each(c,function(k,j){if(a(f).get(0)===j.element.get(0)){e=k+1;return false}});return e},getImageStatus:function(d,p){var j,o,g=this.data,k=g.currentSetElement,e=this.getWindowSize("width"),c=this.getWindowSize("height"),n=g.minimalLightboxSize.width,i=g.minimalLightboxSize.height,m=k.width,l=k.height,f=g.lightboxPadding,h=g.headerHeight;if(d<=n){j=-1}else{if(d>n&&d+f<=e){j=1}else{j=2}}if(p<=i){o=-1}else{if(p>i&&c>=p+f+h){o=1}else{o=2}}return{statusWidth:j,statusHeight:o}},getLightbox:function(){var e=this.data,d=this.$lightbox,c=this;if(!d.root){this.createStructure();this.setReferences();d.close.add(d.overlay).click(a.proxy(this.closeLightbox,this));d.next.click(a.proxy(this.next,this));d.prev.click(a.proxy(this.prev,this));d.next.add(d.prev).add(d.next).add(d.close).hover(function(){if(a(this).is(":not(.ui-state-disabled)")){c.setButtonState("highlight",a(this))}},function(){if(a(this).is(":not(.ui-state-disabled)")){c.setButtonState("default",a(this))}});d.contentContainer.mousemove(a.proxy(this.showArrow,this)).mousemove(a.proxy(this.checkSide,this)).mousemove(a.proxy(this.setCursor,this)).click(function(){if(e.side==="left"){c.prev.apply(c)}else{if(e.side==="right"){c.next.apply(c)}}}).mousedown(a.proxy(this.panoramaStart,this)).mouseup(a.proxy(this.panoramaStop,this)).mouseleave(function(){c.hideArrow.apply(c);e.side=""});d.panoramaIcon.click(a.proxy(this.panoramaToggle,this)).hover(a.proxy(this.panoramaHighlight,this));a(window).bind("resize.rlightbox",a.proxy(this.liveResize,this));a(document).keyup(a.proxy(this.handleKeyboard,this))}},getOptimalSize:function(k,e){var h=this.data,f=h.minimalLightboxSize,j=f.width,i=f.height,g=this.getAvailableScreenSize(),d=g.width,c=g.height;if(k==="width"){if(e<j){return j}else{if(e>d){return d}else{return e}}}else{if(k==="height"){if(e<i){return i}else{if(e>c){return c}else{return e}}}}},getParam:function(g,c){var d,e="[\\?&]"+g+"=(\\w+)",f=new RegExp(e);d=f.exec(c);if(d!==null){return d[1]}else{return null}},getSetName:function(e){var g=a(e.element).attr("class"),f=e.options.setPrefix+"_",d=new RegExp(f+"([\\w-_]+)"),c=d.exec(g);return c?c[1]:"single"},checkSide:function(h){var i=this.data,g=this.$lightbox,j=g.contentContainer,c=h.pageX-j.offset().left,f=Math.round(j.width()/2),e=i.currentElementNumber,d=i.totalElementsNumber;if(c<=f){i.side="left"}else{if(c>f){i.side="right"}}h.preventDefault()},getSizes:function(){var k,j,r,p,c,h,e,f,i,l=this.$lightbox,x=this.data,m=this,o=x.currentSetElement,s=this.getWindowSize("width"),t=this.getWindowSize("height"),n=x.minimalLightboxSize.width,v=x.minimalLightboxSize.height,g=o.width,q=o.height,u=x.lightboxPadding,d=x.headerHeight;function w(y,z){k=m.getImageStatus(y,z);j=k.statusWidth;r=k.statusHeight;if(((j===1||j===-1)&&r!==2)&&((r===1||r===-1)&&j!==2)){if(j===1){h=y}else{if(j===-1){h=n}}p=y;if(r===1){e=z}else{if(r===-1){e=v}}c=z}else{if(j===2||r===2){if(j===1||j===-1){e=t-d-u;c=e;f=e/z;if(j===-1){h=n;p=Math.ceil(y*f)}else{h=Math.ceil(y*f)-u;p=h;if(p<=n){w(p,c)}}}else{if(r===1||r===-1){h=s-u;p=h;i=h/y;if(r===-1){e=v;c=Math.ceil(z*i)}else{e=Math.ceil(z*i)-d-u;c=e;if(c<=v){w(p,c)}}}else{if(y>z){h=s-u;p=h;i=h/y;e=Math.ceil(z*i)-u-d;c=e;if(c<=v||e+u+d>t){w(p,c)}}else{e=t-d-u;c=e;f=e/z;h=Math.ceil(y*f)-u;p=h;if(p<=n||h>s){w(p,c)}}}}}}}w(g,q);return{imageTargetWidth:p,imageTargetHeight:c,lightboxTargetWidth:h,lightboxTargetHeight:e,statusWidth:j,statusHeight:r}},getWindowSize:function(k){var g=this.data,e=a(window).width(),c=a(window).height(),d=g.minimalLightboxSize,f=g.lightboxPadding,i=g.headerHeight,j=d.width+f,h=d.height+f+i;if(k==="width"){if(e<j){return j}else{return e}}else{if(c<h){return h}else{return c}}},handleKeyboard:function(g){var h=this.data,d=h.currentSetElement,c=d.self.options,e=c.keys,f=g.which;if(h.ready===false){return}if(f===e.next[0]||f===e.next[1]){this.next()}else{if(f===e.previous[0]||f===e.previous[1]){this.prev()}else{if(f===e.close[0]||f===e.close[1]){this.closeLightbox()}else{if((f===e.panorama[0]||f===e.panorama[1])&&d.type==="image"){this.panoramaToggle(g)}}}}},hideArrow:function(){var d=this.$lightbox,c=d.arrow;c.hide()},liveResize:function(){var e=this.data,c=this,d=this.$lightbox,f=e.currentSetElement.type;if(e.ready&&e.panoramaOn===false&&f==="image"){this.queueResizeLightbox();this.updateTitleWidth();this.queueCenterContent();this.panoramaCheckAvailability()}else{if(e.ready&&e.panoramaOn&&f==="image"){this.queueCenterLightbox();this.panoramaShrink();this.panoramaCheckAvailability()}else{if(e.ready&&f!=="image"){this.queueCenterLightbox()}}}},loadContentFlash:function(c){var g,h,k,i=this.data,o=this.$lightbox,n=this,d=o.content,e=a.Deferred(),f=i.htmlFlash,j=i.currentSetElement,m=j.self.options;d.addClass("ui-lightbox-loader");function l(){g=n.getParam("width",c);h=n.getParam("height",c);if(g===null||isNaN(g)){g=m.videoWidth}if(h===null||isNaN(h)){h=m.videoHeight}j.width=g;j.height=h;f=n.replaceHtmlPatterns(f,{width:g,height:h,url:c});k=a("<div></div>");k.css({display:"none",width:g,height:h});d.removeClass("ui-lightbox-loader").empty().append(f).children().wrap(k);e.resolve()}setTimeout(l,1000);return e.promise()},loadContentImage:function(f){var g=this.$lightbox,i=this.data,d=this,e=i.currentSetElement,c=a.Deferred(),h=a("<img />");g.content.addClass("ui-lightbox-loader");h.attr("src",f).bind("load",function(){a(this).unbind("load");e.width=this.width;e.height=this.height;g.content.removeClass("ui-lightbox-loader").empty().append(this).children().hide();c.resolve()}).error(function(){g.content.removeClass("ui-lightbox-loader");d.showErrorMessage();c.resolve()}).each(function(){if(this.complete||this.complete===b){var j=this.src;this.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";this.src=j}});return c.promise()},loadContentVimeo:function(c){var e,g,h=this.data,m=this.$lightbox,l=this,d=a.Deferred(),j=h.providers.vimeo,i=h.currentSetElement,k=i.self.options,f=h.minimalLightboxSize;m.content.addClass("ui-lightbox-loader");a.ajax({url:j,data:{url:c,maxwidth:k.videoWidth,maxheight:k.videoHeight},dataType:"jsonp",timeout:5000}).success(function(n){m.content.removeClass("ui-lightbox-loader").empty().append(n.html).children().wrap("<div style='display: none'></div>").end().find("div:first").width(n.width).height(n.height);if(k.overwriteTitle===false){i.title=n.title}i.width=n.width;i.height=n.height;d.resolve()}).error(function(){m.content.removeClass("ui-lightbox-loader");l.showErrorMessage();d.resolve()});return d.promise()},loadContentYoutube:function(c){var n,k=this.data,q=this.$lightbox,d=q.content,p=this,e=a.Deferred(),m=k.providers.youtube,l=k.currentSetElement,o=l.self.options,i=k.minimalLightboxSize,g=o.videoWidth,j=o.videoHeight,f=k.htmlYoutube;function h(){q.content.removeClass("ui-lightbox-loader");p.showErrorMessage();e.resolve()}q.content.addClass("ui-lightbox-loader");a.ajax({url:m+l.id+"?callback=?",data:{v:2,alt:"jsonc",prettyprint:true},dataType:"jsonp",timeout:5000}).success(function(r){if(r.error){h();return}f=p.replaceHtmlPatterns(f,{width:g,height:j,url:l.id});n=a("<div></div>");n.css({display:"none",width:g,height:j});d.removeClass("ui-lightbox-loader").empty().append(f).children().wrap(n);if(o.overwriteTitle===false){l.title=r.data.title}l.width=g;l.height=j;e.resolve()}).error(function(){h()});return e.promise()},navigationGoToElement:function(f){var g=this.data,d=this.sets,e=this.$lightbox,c=g.currentSet;g.currentElementNumber=f;g.currentSetElement=d[c][f-1];this.setNextQueue();e.queueContainer.next.dequeue("lightboxNext")},next:function(){var e=this.data,h=this.sets,m=this.$lightbox,j=e.ready,c=e.panoramaOn,d=e.currentSet,i=e.currentElementNumber,g=e.totalElementsNumber,k=e.currentSetElement.self.options,f=k.loop,l=true;if(j&&d!=="single"&&c===false){if(i+1<=g){e.currentElementNumber=i=i+1}else{if(i+1>g&&f){e.currentElementNumber=i=1}else{l=false}}if(l){e.currentSetElement=h[d][i-1];this.setNextQueue();m.queueContainer.next.dequeue("lightboxNext")}}},open:function(f){var i=this.data,e=this.sets,g=this.$lightbox,h=f.element,c=this.getSetName(f),d=a(h).attr("href");i.currentSet=c;i.totalElementsNumber=e[c].length;i.currentElementNumber=this.getCurrentElementNumber(h);i.currentSetElement=e[c][i.currentElementNumber-1];this.setOpenQueue();this.setNextQueue();this.checkButtonsState();g.queueContainer.open.dequeue("lightboxOpen")},panoramaCenterContent:function(){var m,l,h=this.data,n=this.$lightbox,i=h.currentSetElement,g=this.getAvailableScreenSize(),f=g.width,e=g.height,k=i.width,j=i.height,d=n.content,c=d.find("img");if(f<k){m=0}else{m=d.width()/2-c.width()/2}if(e<j){l=0}else{l=d.height()/2-c.height()/2}c.css({top:l,left:m})},panoramaCheckAvailability:function(){var h=this.data,e=h.currentSetElement,f=e.width,c=e.height,g=e.currentWidth,d=e.currentHeight;if(g<f||d<c){this.panoramaShowIcon("expand");h.enablePanorama=true}else{h.enablePanorama=false;this.panoramaHideIcon()}},panoramaExpand:function(f){var g=this.data,e=this.$lightbox,d=g.currentSetElement,c=d.self.options;g.panoramaOn=true;if(f.type==="click"){this.panoramaShowIcon("shrink","-hover")}else{this.panoramaShowIcon("shrink")}e.content.css("overflow","hidden");e.content.find("img").width(d.width).height(d.height);this.panoramaSetContentSize();this.panoramaCenterContent();this.queueCenterLightbox();this.updateTitleWidth();if(c.showMap){this.panoramaShowMap()}this.hideArrow();this.setCursor()},panoramaHideIcon:function(){var d=this.data,c=this.$lightbox;c.panoramaIcon.hide().removeClass("ui-lightbox-panorama-icon-expand ui-lightbox-panorama-icon-shrink");d.panoramaOn=false},panoramaHideMap:function(){var c=this.$lightbox;c.map.hide();c.viewport.css({left:-1,top:-1})},panoramaHighlight:function(){var d,e=this.$lightbox,c="-hover";e.panoramaIcon.attr("class",function(g,f){d=f.indexOf(c);if(d!==-1){return f.slice(0,d)}else{return f+c}})},panoramaSetContentSize:function(){var c,j,i=this.data,o=this.$lightbox,k=i.currentSetElement,h=i.minimalLightboxSize,n=h.width,f=h.height,g=this.getAvailableScreenSize(),e=g.width,d=g.height,m=k.width,l=k.height;if(m>e){c=e}else{if(m<=n){c=n}else{c=m}}if(l>d){j=d}else{if(l<=f){j=f}else{j=l}}o.content.width(c).height(j)},panoramaShowIcon:function(d,f){var e=this.$lightbox,c=f||"",g="ui-lightbox-panorama-icon-"+d+c;e.panoramaIcon.show().removeClass().addClass(g)},panoramaShowMap:function(){var o,d,p,m,e,n,i=this.data,g=i.minimalLightboxSize,q=this.$lightbox,c=q.content,f=c.find("img"),l=f.width(),k=f.height(),j=i.currentSetElement,h=i.mapSize;p=h.width/j.width;m=h.height/j.height;if(l<g.width){e=l}else{e=c.width()}if(k<g.height){n=k}else{n=c.height()}o=Math.ceil(e*p);d=Math.ceil(n*m);q.viewport.width(o).height(d);q.map.show();i.viewportRatio={width:p,height:m}},panoramaShrink:function(d){var e=this.data,c=this.$lightbox;e.panoramaOn=false;if(d&&d.type==="click"){this.panoramaShowIcon("expand","-hover")}else{this.panoramaShowIcon("expand")}this.queueResizeLightbox();this.queueCenterContent();c.content.css("overflow","visible");this.updateTitleWidth();this.panoramaHideMap();this.setCursor()},panoramaStart:function(d){var e=this.data,c=this.$lightbox;e.panoramaPosition={xStart:d.pageX,yStart:d.pageY};d.preventDefault()},panoramaStop:function(f){var h=this.data,e=this.$lightbox,g=(f.pageX-h.panoramaPosition.xStart)*-1,d=(f.pageY-h.panoramaPosition.yStart)*-1,c=e.content,i=h.viewportRatio;if(h.panoramaOn){c.scrollLeft(c.scrollLeft()+g).scrollTop(c.scrollTop()+d);e.viewport.css({left:c.scrollLeft()*i.width-1,top:c.scrollTop()*i.height-1})}f.stopPropagation()},panoramaToggle:function(d){var e=this.data,f=e.panoramaOn,c=e.enablePanorama;if(c&&f===false){this.panoramaExpand(d)}else{if(c&&f){this.panoramaShrink(d)}}},prev:function(){var e=this.data,h=this.sets,m=this.$lightbox,j=e.ready,c=e.panoramaOn,d=e.currentSet,i=e.currentElementNumber,g=e.totalElementsNumber,k=e.currentSetElement.self.options,f=k.loop,l=true;if(j&&d!=="single"&&c===false){if(i-1>=1){e.currentElementNumber=i=i-1}else{if(i-1<1&&f){e.currentElementNumber=i=g}else{l=false}}if(l){e.currentSetElement=h[d][i-1];this.setNextQueue();m.queueContainer.next.dequeue("lightboxNext")}}},removeSetElement:function(f){var g=this.data,e=this.sets,c=g.currentSet,d=g.totalElementsNumber;e[c].splice(f-1,1);if(d===1||c==="single"){this.closeLightbox();this.destroy()}else{this.destroy();g.totalElementsNumber=e[c].length;if(f===d){this.navigationGoToElement(f-1)}else{this.navigationGoToElement(f)}}},replaceHtmlPatterns:function(d,c){a.each(c,function(e,g){var f=new RegExp("{"+e+"}","g");d=d.replace(f,g)});return d},setButtonState:function(f,e){var d=this.$lightbox,c=e||d.controlButtons;switch(f){case"default":c.removeClass("ui-state-highlight ui-state-disabled");break;case"highlight":c.addClass("ui-state-highlight");break;case"disabled":c.addClass("ui-state-disabled");break}},setCursor:function(e){var i=this.data,p=this.$lightbox,c=p.contentContainer,m=i.currentSet,l=i.currentSetElement,d=i.currentSetElement.type,f=i.totalElementsNumber,k=i.currentElementNumber,h=i.side,g=i.panoramaOn,n=i.showErrorMessage,o=l.self.options,j=o.loop;if(i.ready){if((m==="single"||f===1||k===1&&h==="left"||k===f&&h==="right")&&g===false&&(d==="image"||(d!=="image"&&n))){if(j===false){c.css("cursor","default")}else{c.css("cursor","pointer")}}else{if(g){c.css("cursor","move")}else{if(d==="image"||(d!=="image"&&n)){c.css("cursor","pointer")}else{c.css("cursor","auto")}}}}else{c.css("cursor","default")}if(e){e.preventDefault()}},setNextQueue:function(){var d=this.$lightbox,c=[a.proxy(this.queueSlideUpHeader,this),a.proxy(this.queueHideContent,this),a.proxy(this.queueLoadContent,this),a.proxy(this.queueResizeLightbox,this),a.proxy(this.queueCenterContent,this),a.proxy(this.queueShowContent,this),a.proxy(this.queueSlideDownHeader,this)];d.queueContainer.next.queue("lightboxNext",c)},setOpenQueue:function(){var d=this.$lightbox,c=[a.proxy(this.queueShowOverlay,this),a.proxy(this.queueCenterLightbox,this),a.proxy(this.queueLoadContent,this),a.proxy(this.queueResizeLightbox,this),a.proxy(this.queueCenterContent,this),a.proxy(this.queueShowContent,this),a.proxy(this.queueSlideDownHeader,this)];d.queueContainer.open.queue("lightboxOpen",c)},setReferences:function(){var c=this.$lightbox;c.root=a("#ui-lightbox");c.panoramaIcon=c.root.find("#ui-lightbox-panorama-icon");c.contentContainer=c.root.find("#ui-lightbox-content-container");c.content=c.contentContainer.find("#ui-lightbox-content");c.arrow=c.contentContainer.find("#ui-lightbox-arrow");c.header=c.root.find("#ui-lightbox-bottombar");c.headerWrapper=c.header.find("#ui-lightbox-title-wrapper");c.overlay=a("#ui-lightbox-overlay");c.next=c.root.find("#ui-lightbox-button-next");c.prev=c.root.find("#ui-lightbox-button-prev");c.controlButtons=c.next.add(c.prev);c.close=c.root.find("#ui-lightbox-button-close");c.counter=c.root.find("#ui-lightbox-counter");c.title=c.root.find("#ui-lightbox-title");c.map=a("#ui-lightbox-map");c.viewport=c.map.children().eq(0);c.queueContainer={open:a({}),next:a({})}},showArrow:function(c){var f=this.data,k=this.$lightbox,i=k.arrow,j=f.showErrorMessage,e=f.side,h=f.currentElementNumber,d=f.totalElementsNumber,g=f.currentSetElement.self.options.loop;if(f.ready&&f.currentSet!=="single"&&(f.currentSetElement.type==="image"||j)&&f.panoramaOn===false){if(e==="left"&&(h>1||g)){i.show().removeClass("ui-lightbox-arrow-next ui-corner-left").addClass("ui-lightbox-arrow-prev ui-corner-right").find("span").removeClass("ui-icon-carat-1-e").addClass("ui-icon-carat-1-w")}else{if(e==="right"&&(h<d||g)){i.show().removeClass("ui-lightbox-arrow-prev ui-corner-right").addClass("ui-lightbox-arrow-next ui-corner-left").find("span").removeClass("ui-icon-carat-1-w").addClass("ui-icon-carat-1-e")}else{this.hideArrow()}}}if(c){c.preventDefault()}},showErrorMessage:function(){var g,j,n,f=this.data,r=this.$lightbox,q=this,h=f.currentSetElement,o=h.self.options,l=f.currentElementNumber,k=o.errorMessage,e=o.againButtonLabel,d=o.rejectButtonLabel,c=f.htmlErrorScreen,i=f.errorScreenSize,p=i.width,m=i.height;c=q.replaceHtmlPatterns(c,{message:k,labelAgain:e,labelReject:d});n=a(c);g=n.find("#ui-lightbox-error-footer-again");j=n.find("#ui-lightbox-error-footer-reject");g.click(function(){q.navigationGoToElement(l)}).hover(function(){a(this).toggleClass("ui-state-hover")});j.click(function(){q.removeSetElement(l)}).hover(function(){a(this).toggleClass("ui-state-hover")});r.content.empty().append(n).find("#ui-lightbox-error").width(p).height(m).end().children().hide();f.showErrorMessage=true},updateCounter:function(){var h,e,g,j=this.data,i=this.$lightbox,f=j.currentSetElement,d=f.self.options,c=j.currentSet;if(c!=="single"){h=j.currentElementNumber;e=j.totalElementsNumber}else{h=1;e=1}g=h+d.counterDelimiter+e;i.counter.text(g)},updateTitle:function(){var e=this.data,d=this.$lightbox,c=e.currentSetElement;if(c.title!==""){d.title.empty().append(c.title)}else{d.title.append("&nbsp;")}},updateTitleWidth:function(){var c=this.$lightbox;c.header.width(c.content.width()-12)},queueHideContent:function(e){var g=this.data,f=this.$lightbox,d=g.currentSetElement,c=d.self.options;f.content.children().fadeOut(c.animationSpeed,function(){a(this).remove();e()});f.panoramaIcon.hide().removeClass("ui-lightbox-panorama-icon-expand ui-lightbox-panorama-icon-shrink");g.panoramaOn=false;this.panoramaHideMap()},queueShowOverlay:function(d){var f=this.data,e=this.$lightbox,c=f.currentSetElement.self;f.ready=false;this.setCursor();a("body").css("overflow","hidden");e.overlay.fadeIn(c.options.animationSpeed,d)},queueCenterLightbox:function(f){var g=this.$lightbox,h=g.root,d=this.getWindowSize("width"),c=this.getWindowSize("height"),i=h.outerWidth(),e=h.outerHeight();h.css({left:Math.round((d-i)/2)+"px",top:Math.round((c-e)/2)+"px"}).show(0,f)},queueLoadContent:function(d){var c,e=this.data,f=e.currentSetElement;e.showErrorMessage=false;switch(f.type){case"image":c="loadContentImage";break;case"youtube":c="loadContentYoutube";break;case"vimeo":c="loadContentVimeo";break;case"flash":c="loadContentFlash"}a.when(this[c](f.url)).then(function(){d()})},queueResizeLightbox:function(p){var j,r,n,s,c,i,e,f,w=this.data,m=this.$lightbox,x=w.lightboxPadding,d=w.headerHeight,q=w.currentSetElement,o=q.self.options,t=w.showErrorMessage,h=w.errorScreenSize,g=h.width,k=h.height,v=w.minimalLightboxSize,l=v.width,u=v.height;j=o.animationSpeed;if(q.type==="image"&&t===false){n=this.getSizes();s=n.imageTargetWidth;c=n.imageTargetHeight;i=n.lightboxTargetWidth;e=n.lightboxTargetHeight;f=m.content.find("img");q.currentWidth=s;q.currentHeight=c;f.width(s).height(c);if(a.isFunction(p)){j=o.animationSpeed}else{j=0}}else{if((q.type==="youtube"||q.type==="vimeo")&&t===false){i=this.checkMinimalSize("width",q.width);e=this.checkMinimalSize("height",q.height)}else{if(q.type==="flash"&&t===false){i=this.getOptimalSize("width",q.width);e=this.getOptimalSize("height",q.height)}else{if(t){j=0;i=g;e=k}}}}m.root.find("#ui-lightbox-content").animate({width:i},j).animate({height:e},j).end().animate({left:(this.getWindowSize("width")-i-x)/2},j).animate({top:(this.getWindowSize("height")-e-x-d)/2},j,p)},queueCenterContent:function(e){var d,f=this.$lightbox,g=f.content,c=g.children();g.children().css({top:g.height()/2-c.outerHeight()/2,left:g.width()/2-c.outerWidth()/2});if(e){e()}},queueShowContent:function(g){var i=this.data,h=this.$lightbox,d=this,e=i.currentSetElement,c=e.self.options,f=i.showErrorMessage;h.content.children().fadeIn(c.animationSpeed,function(){if(e.type==="image"&&f===false){d.panoramaCheckAvailability()}g()})},queueSlideDownHeader:function(d){var f=this.data,e=this.$lightbox,c=f.currentSetElement.self.options;e.header.slideDown(c.animationSpeed,d);this.updateCounter();this.updateTitleWidth();this.updateTitle();this.checkButtonsState();f.ready=true;this.setCursor();this.showArrow()},queueSlideUpHeader:function(e){var g=this.data,f=this.$lightbox,d=g.currentSetElement,c=d.self.options;g.ready=false;this.hideArrow();this.setCursor();f.header.slideUp(c.animationSpeed,e)},$lightbox:{},sets:{},data:{minimalLightboxSize:{width:300,height:300},lightboxPadding:12,headerHeight:57,ready:false,panoramaOn:false,mapSize:{width:150,height:100},providers:{vimeo:"http://www.vimeo.com/api/oembed.json?callback=?",youtube:"http://gdata.youtube.com/feeds/api/videos/"},showErrorMessage:false,currentSetElement:{},enablePanorama:false,errorScreenSize:{width:500,height:500},htmlFlash:"<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='{width}' height='{height}'><param name='movie' value='{url}' /><!--[if !IE]>--><object type='application/x-shockwave-flash' data='{url}' width='{width}' height='{height}'><!--<![endif]--><!--[if !IE]>--></object><!--<![endif]--></object>",htmlErrorScreen:"<div id='ui-lightbox-error'><div id='ui-lightbox-error-message' class='ui-lightbox-error-icon-sign'>{message}</div><div id='ui-lightbox-error-footer'><button aria-disabled='false' role='button' id='ui-lightbox-error-footer-again' class='ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary'><span class='ui-button-icon-primary ui-icon ui-icon-refresh'></span><span class='ui-button-text'>{labelAgain}</span></button><button aria-disabled='false' role='button' id='ui-lightbox-error-footer-reject' class='ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary'><span class='ui-button-icon-primary ui-icon ui-icon-trash'></span><span class='ui-button-text'>{labelReject}</span></button></div></div>",htmlYoutube:"<iframe class='youtube-player' type='text/html' width='{width}' height='{height}' src='http://www.youtube.com/embed/{url}' frameborder='0'></iframe>",htmlLightbox:"<div id='ui-lightbox' class='ui-widget ui-widget-content ui-corner-all' style='display: none'><div id='ui-lightbox-panorama-icon' style='display: none'></div><div id='ui-lightbox-content-container'><div id='ui-lightbox-content' class='ui-widget-content'></div><a id='ui-lightbox-arrow' class='ui-widget-header' style='display: none'><span class='ui-icon'>go</span></a></div><div id='ui-lightbox-bottombar' class='ui-widget-header ui-corner-all' style='display: none'><p id='ui-lightbox-title-wrapper'><span id='ui-lightbox-title'></span></p><p id='ui-lightbox-bottombar-bottom'><a id='ui-lightbox-button-prev' class='ui-lightbox-button'><span class='ui-icon ui-icon-circle-arrow-w'>prev</span></a><span id='ui-lightbox-counter'></span><a id='ui-lightbox-button-next' class='ui-lightbox-button'><span class='ui-icon ui-icon-circle-arrow-e'>next</span></a></p><a id='ui-lightbox-button-close' class='ui-lightbox-button'><span class='ui-icon ui-icon-closethick'>close</span></a></div></div>",htmlMap:"<div id='ui-lightbox-map' style='display: none'><div id='ui-lightbox-map-viewport'></div></div>",htmlOverlay:"<div id='ui-lightbox-overlay' class='ui-widget-overlay' style='display: none'></div>"}}})})(jQuery);

0 comments on commit e346888

Please sign in to comment.