source: extensions/gally/gally-default/js/gallyjs-tpp.min.js @ 14263

Last change on this file since 14263 was 12592, checked in by grum, 13 years ago

feature:2499 - compatibility with Piwigo 2.3

  • Property svn:executable set to *
File size: 10.8 KB
Line 
1/* file: gally-tpp.js - v1.4.4 | minified on 2011/11/09 with http://jscompress.com/ */
2function GallyPP(){var a={show:"n",current:-1,selected:-1},b={visible:false,initialized:0,timerDelay:null},c={isScrollable:false,highWidth:0,highHeight:0,leftPos:0,zoomMode:""},d=null,e=function(){var d=/[1234567]\./i;if(jQuery.browser.msie&&jQuery.browser.version.match(d)){options.interfaceAnimated="none";options.imageAutoScroll=false}if(options.imageAutoScroll){$("html").css("overflow-x","hidden")}else{$("html").css("overflow-x","scroll")}if(options.imageCenterTopBorder=="imageHeaderBar"){options.imageCenterTopMin+=$("#imageHeaderBar").get(0).offsetTop+$("#imageHeaderBar").get(0).offsetHeight}if(!options.interfaceCanSwitch){options.interfaceHidden=false}c.zoomMode=options.defaultZoomSize;h("0",true);g("init");if((options.interfaceOnImage=="always"||options.interfaceOnImage=="noscroll"&&!c.isScrollable)&&options.interfaceCanSwitch){$("#theMainImage").bind("mouseenter",function(){h("y",true)}).bind("mouseleave",function(){h("n",true)}).bind("mousemove",function(){h("y",true)})}if(options.interfaceCanSwitch){$("#imageHeaderBar").bind("mouseenter",function(){h("y",false)}).bind("mousemove",function(){h("y",false)});$("#imageToolBar").bind("mouseenter",function(){h("y",true)}).bind("mouseleave",function(){h("n",true)}).bind("mousemove",function(){h("y",true)});$("#navThumbPrev").bind("mouseenter",function(){h("Y",true)}).bind("mouseleave",function(){h("n",true)}).bind("mousemove",function(){h("y",true)});$("#navThumbNext").bind("mouseenter",function(){h("Y",true)}).bind("mouseleave",function(){h("n",true)}).bind("mousemove",function(){h("y",true)})}$("#navThumbPrev").css("top",$("#navThumbPrev").prop("offsetTop")+$("#theHeader").prop("offsetHeight")+$("#theHeaderAlt").prop("offsetHeight")+"px");$("#navThumbNext").css("top",$("#navThumbNext").prop("offsetTop")+$("#theHeader").prop("offsetHeight")+$("#theHeaderAlt").prop("offsetHeight")+"px");$("#theImage").css("top",$("#theImage").prop("offsetTop")+$("#theHeader").prop("offsetHeight")+$("#theHeaderAlt").prop("offsetHeight")+"px");$("#contentid").attr("rows",options.commentRows);if(options.animateDelay>0){$("#theTabs").tabs({fx:{opacity:"toggle",duration:options.animateDelay}})}else{$("#theTabs").tabs()}i("n");if(options.interfaceCanSwitch){$("#theTabsContainer").bind("mouseenter",function(){h("Y",false)}).bind("mouseleave",function(){h("n")}).bind("mousemove",function(){h("y",false)})}$("#theTabs").bind("tabsselect",function(b,c){a.selected=c.index});$(".tab a").click(function(){$(this).get(0).blur();if(a.selected==a.current){if(a.current!=-1)i("n");a.current=-1;a.selected=-1}else{if(a.current==-1)i("y");a.current=a.selected}});$(window).resize(function(){g("resize")});b.initialized=1;$(document).trigger("gallyInterfaceReady")},f=function(){if(c.isScrollable&&options.imageHaveHighRes==false&&options.imageSimulateHighRes){$("#theImgContainer").bind("click",function(){l($("#theMainImage").attr("src"))}).addClass("pointer")}},g=function(a){var b=0,d=0,e=new Object;e.height=$("#theMainImage").prop("height")+"px";if(options.imageAutoScroll&&$("#theMainImage").prop("scrollWidth")>$("#theImage").prop("clientWidth")-2*options.marginContainer){e.width=$("#theImage").prop("clientWidth")-2*(options.marginContainer+options.paddingContainer)+"px";$("#theImage").bind("mousemove",function(a){if($("#navThumbPrev").length>0)b=$("#navThumbPrev").prop("clientWidth");deadArea=Math.max(options.imageScrollMinDeadArea,b*1.2);mouse=Math.max(Math.min(a.clientX-c.leftPos,this.clientWidth-deadArea),deadArea);$("#theMainImage").css("left",Math.round(($("#theMainImage").prop("scrollWidth")-this.clientWidth)*-(mouse-deadArea)/(this.clientWidth-2*deadArea))+"px").trigger("scrolled")});c.isScrollable=true}else{$("#theImage").unbind("mousemove");$("#theMainImage").css("left","0px");e.width=$("#theMainImage").prop("scrollWidth")+"px";c.isScrollable=false}$("#theImgContainer").css(e);if($("#copyright").css("position")=="fixed"){$("#theImage").css("padding-bottom",$("#copyright").prop("offsetHeight")+"px")}switch(options.imageCenterMode){case"img":d=$("#theImgContainer").prop("offsetHeight");break;case"all":d=$("#theImage").prop("offsetHeight");break;default:d=-1e4;break}d=($("#copyright").prop("offsetTop")-($("#imageHeaderBar").prop("offsetTop")+$("#imageHeaderBar").prop("offsetHeight"))-d)/2+options.imageCenterOffset;switch($("#theImage").css("position")){case"static":$("#theImage").css("padding-top",d);break;default:if(d<options.imageCenterTopMin){d=options.imageCenterTopMin}d=d+"px";$("#theImage").css("top",d);break}c.leftPos=$("#theImage").offset().left;if(a=="init"){theHeaderHeight=$("#theHeader").prop("offsetHeight")+$("#theHeaderAlt").prop("offsetHeight");$("#imageToolBar").css("top",$("#imageToolBar").prop("offsetTop")+theHeaderHeight+$("#imageHeaderBar").prop("offsetHeight")+"px");if($("#navThumbPrev").length>0){$("#navThumbPrev").css("height",$("#copyright").prop("offsetTop")-$("#navThumbPrev").prop("offsetTop")-options.tabsHidden+"px")}if($("#navThumbNext").length>0){$("#navThumbNext").css("height",$("#copyright").prop("offsetTop")-$("#navThumbNext").prop("offsetTop")-options.tabsHidden+"px")}}switch(options.tabsPosition){case"top":toolBarArea=$("#imageToolBar").prop("offsetTop")+$("#imageToolBar").prop("offsetHeight");$("#theTabsContainer").css("top",toolBarArea+"px");break;case"bottom":copyrightArea=$("#copyright").prop("clientHeight")+1;$("#theTabsContainer").css("bottom",copyrightArea+"px");break;case"pictureTop":$("#theTabsContainer").css({top:$("#theMainImage").prop("offsetTop")+"px",left:$("#theMainImage").prop("offsetLeft")+"px",width:$("#theImgContainer").innerWidth()+"px"});break;case"pictureBottom":pictureArea=$("#theMainImage").prop("offsetTop")+$("#theMainImage").prop("offsetHeight");$("#theTabsContainer").css({top:pictureArea+"px",left:$("#theMainImage").prop("offsetLeft")+"px",width:$("#theMainImage").prop("offsetWidth")+"px"});break}f()},h=function(a,c){if(b.initialized==1&&options.interfaceHidden){b.initialized=2;if(a=="Y")return""}if(!options.interfaceHidden&&a=="0"){a="1"}if(options.interfaceAnimated=="fade"){switch(a){case"0":$(".uiImg").css({opacity:0,visibility:"hidden"});b.visible=false;break;case"1":if(!b.visible)$(".uiImg").css({opacity:1,visibility:"visible"});b.visible=true;if(c)k();break;case"2":case"Y":case"y":if(!b.visible)$(".uiImg").css("visibility","visible").stop(true,false).fadeTo(options.animateDelay,1);b.visible=true;if(c)k();break;default:$(".uiImg").stop(true,false).fadeTo(options.animateDelay,0,function(){this.style.visibility="hidden";b.visible=false});j();break}}else{switch(a){case"y":case"Y":case"1":case"2":if(!b.visible)$(".uiImg").css("visibility","visible");b.visible=true;if(c)k();break;default:$(".uiImg").css("visibility","hidden");b.visible=false;j();break}}},i=function(b){if(b!=""){a.show=b}else{if(a.show!="n"){a.show="n"}else{a.show="y"}}if(options.tabsAnimated){if(a.show=="y"){$("#theTabsContainer").animate({height:options.tabsVisible+"px"},options.animateDelay).trigger("resize")}else{$("#theTabs div.tabPanel").addClass("ui-tabs-hide").css("display","");$("#theTabs li").removeClass("ui-tabs-selected");$("#theTabsContainer").animate({height:options.tabsHidden+"px"},options.animateDelay).trigger("resize")}}else{if(a.show=="y"){$("#theTabsContainer").css({height:options.tabsVisible+"px"}).trigger("resize")}else{$("#theTabs div.tabPanel").addClass("ui-tabs-hide").css("display","");$("#theTabs li").removeClass("ui-tabs-selected");$("#theTabsContainer").css({height:options.tabsHidden+"px"}).trigger("resize")}}},j=function(){if(b.timerDelay!=null){window.clearInterval(b.timerDelay);b.timerDelay=null}},k=function(){j();if(options.interfaceTimerDelay>0&&options.interfaceCanSwitch)b.timerDelay=window.setInterval(h,options.interfaceTimerDelay,"n",false)},l=function(a){$("#theImageHigh").css({width:$("html").get(0).scrollWidth+"px",height:$("html").get(0).scrollHeight+"px",display:"block"});if($("#theImgHigh").attr("src")==""){p=new Object;p.left=($(window).width()-$("#theImgHighContainer").prop("clientWidth")-options.paddingContainer*2)/2+"px";p.top=($(window).height()-$("#theImgHighContainer").prop("clientHeight")-options.paddingContainer*2)/2+"px";$("#theImgHighContainer").css({left:p.left,top:p.top,padding:options.paddingContainer+"px"});$("#theImgHigh").load(function(){c.highWidth=$("#theImgHigh").width();c.highHeight=$("#theImgHigh").height();p=m(c.zoomMode);$("#theImgHighContainer").css("background-image","none");n();$("#theImgHigh").css({display:"block"})}).attr("src",a);if(options.highResClickMode=="close"){$("#theImgHigh").bind("click",o)}else{$("#theImgHigh").bind("click",q)}}else{p=m(c.zoomMode);$("#theImgHighContainer").css({left:p.left+"px",top:p.top+"px",width:p.width+"px",height:p.height+"px"})}},m=function(a){var b={left:options.marginContainer,top:options.marginContainer,width:0,height:0},d=(options.marginContainer+options.paddingContainer)*2;if(a=="full"){b.width=$("html").get(0).clientWidth-d;b.height=$("html").get(0).clientHeight-d}else{ratioImg=c.highWidth/c.highHeight;ratioPage=$("html").get(0).clientWidth/$("html").get(0).clientHeight;if(ratioPage>1&&ratioPage>ratioImg||ratioPage<1&&ratioPage<ratioImg){b.height=$("html").get(0).clientHeight-d;b.width=b.height*ratioImg}else{b.width=$("html").get(0).clientWidth-d;b.height=b.width/ratioImg}b.left=($("html").get(0).clientWidth-b.width)/2-options.paddingContainer;b.top=($("html").get(0).clientHeight-b.height)/2-options.paddingContainer}if(b.width>c.highWidth){b.width=c.highWidth;b.left=($("html").get(0).clientWidth-b.width)/2}if(b.height>c.highHeight){b.height=c.highHeight;b.top=($("html").get(0).clientHeight-b.height)/2}return b},n=function(){var a=m(c.zoomMode);$("#theImgHighContainer").css({left:a.left+"px",top:a.top+"px",width:a.width+"px",height:a.height+"px"});if(c.zoomMode=="full"){$("#theImgHigh").css({width:c.highWidth+"px",height:c.highHeight+"px"});$("#theImgHighContainer").bind("mousemove",function(b){var d=Math.max(options.marginContainer*2,options.imageScrollMinDeadArea);mouseX=Math.max(Math.min(b.clientX-a.left,a.width-d),d),mouseY=Math.max(Math.min(b.clientY-a.top,a.height-d),d);$("#theImgHigh").css("left",Math.round((c.highWidth-a.width)*-(mouseX-d)/(a.width-2*d))+"px").css("top",Math.round((c.highHeight-a.height)*-(mouseY-d)/(a.height-2*d))+"px")})}else{$("#theImgHigh").css({width:a.width+"px",height:a.height+"px",left:"0px",top:"0px"});$("#theImgHighContainer").unbind("mousemove")}},o=function(){$("#theImageHigh").css("display","none")},q=function(){if(c.zoomMode=="full"){c.zoomMode="fit"}else{c.zoomMode="full"}$("#theImgHighZoomButton").toggleClass("full").toggleClass("fit");n()};this.closeDisplayHigh=function(){o()};this.switchZoomHigh=function(){q()};this.getImageProp=function(){return c};this.getInterfaceProp=function(){return b};this.getTabsProp=function(){return a};this.openDisplayHigh=function(a){l(a)};e()}var gallyPP=null;$(document).ready(function(){gallyPP=new GallyPP})
Note: See TracBrowser for help on using the repository browser.