mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
1 line
No EOL
3.7 KiB
JavaScript
1 line
No EOL
3.7 KiB
JavaScript
!function(a){function b(){var b,c,e,f,g,h=a(document.body);return d?(b=a("#xe_gallery_controls"),c=a("#xe_gallery_holder"),e=a("#xe_gallery_closebtn"),f=a("#xe_gallery_prevbtn"),g=a("#xe_gallery_nextbtn")):(d=a("<div>").attr("id","xe_gallery_screen").css({position:"fixed",display:"none",backgroundColor:"black",zIndex:500,opacity:.7}),b=a("<div>").attr("id","xe_gallery_controls").css({position:"fixed",display:"none",overflow:"hidden",zIndex:510}),f=a('<button type="button" id="xe_gallery_prevbtn" />').css({left:"10px",backgroundPosition:"0 -64px"}).click(function(){d.xePrev()}).appendTo(b),e=a('<button type="button" id="xe_gallery_closebtn" />').css({top:"10px",backgroundPosition:"0 0"}).click(function(){d.xeHide()}).appendTo(b),g=a('<button type="button" id="xe_gallery_nextbtn" />').attr("id","xe_gallery_nextbtn").css({right:"10px",backgroundPosition:"0 -128px"}).click(function(){d.xeNext()}).appendTo(b),b.find(">button").css({position:"absolute",width:"64px",height:"64px",zIndex:530,cursor:"pointer",border:0,margin:0,padding:0,backgroundColor:"transparent",backgroundImage:"url("+request_uri+"addons/resize_image/btn.png)",backgroundRepeat:"no-repeat",opacity:".5",filter:"alpha(opacity=50)"}).mouseover(function(){a(this).css({opacity:"1",filter:"alpha(opacity=100)"})}).mouseout(function(){a(this).css({opacity:".5",filter:"alpha(opacity=50)"})}).focus(function(){a(this).trigger("mouseover")}).blur(function(){a(this).trigger("mouseout")}),c=a(new Image),c.attr("id","xe_gallery_holder").css({border:"5px solid white",zindex:520,maxWidth:"none",borderRadius:"5px",boxShadow:"0 0 10px #000"}).appendTo(b).draggable(),h.append(d).append(b),c.live("load",function(){var b=a(window).width(),d=a(window).height();c.css({left:b/2-c.width()/2+"px",top:d/2-c.height()/2+"px"})}),d.xeShow=function(){var b=(a(window).width(),a(window).height());a("#xe_gallery_controls,#xe_gallery_screen").show().css({top:0,right:0,bottom:0,left:0}),a("#xe_gallery_prevbtn,#xe_gallery_nextbtn").css("top",Math.round(b/2-32)+"px"),this.xeMove(0)},d.xeHide=function(){d.hide(),b.hide()},d.xePrev=function(){this.xeMove(-1)},d.xeNext=function(){this.xeMove(1)},d.xeMove=function(b){var d=a(window).width(),h=a(window).height();this.index+=b,f.css("visibility",this.index>0?"visible":"hidden"),g.css("visibility",this.index<this.list.size()-1?"visible":"hidden");var i=this.list.eq(this.index).attr("rawsrc");i||(i=this.list.eq(this.index).attr("src")),c.attr("src",i).removeAttr("width").removeAttr("height"),c.width()>0&&c.css({left:d/2-c.width()/2+"px",top:h/2-c.height()/2+"px"}),e.css({left:d/2-32+"px",top:"10px"}).focus()},a(document).keydown(function(a){return 27==a.which?(d.xeHide(),!1):!0})),d}function c(){var c=a(this).closest(".xe_content"),d=c.find("img[rel=xe_gallery]"),e=a.inArray(a(this).get(0),d.get()),f=b();f.list=d,f.index=e,f.xeShow()}var d=null;a(window).load(function(){function b(a,c){if(c||(c=0),!(c>=10)){var d=this,e={width:d.width(),height:d.height()};if(!e.width||!e.height)return void setTimeout(function(){b.call(d,a,++c)},200);if(!(e.width<=a)){var f=a/e.width;d.removeAttr("width").removeAttr("height").css({width:a,height:parseInt(e.height*f,10)})}}}var d=/(?:(modules|addons|classes|common|layouts|libs|widgets|widgetstyles)\/)/i,e=/(?:common\/tpl\/images\/blank\.gif$)/i,f=a('<div style="height:1px;overflow:hidden;opacity:0;display:block;clear:both"></div>');a(".xe_content").each(function(){var g=f.appendTo(this).width();f.remove(),g&&(a("img",this).each(function(){var c=a(this),f=c.attr("src");(!d.test(f)||e.test(f))&&(c.attr("rel","xe_gallery"),b.call(c,g))}),a("img[rel=xe_gallery]",this).live("mouseover",function(){var b=a(this);b.parent("a").length||b.attr("onclick")||b.css("cursor","pointer").click(c)}))})})}(jQuery); |