filesbox/web/dist/design/designstatic/front/js/layer.js
2024-07-26 14:10:54 +08:00

2 lines
22 KiB
JavaScript

(function(v,F){"use strict";var c,p,L=v.layui&&layui.define,d={getPath:function(){var t=document.currentScript?document.currentScript.src:function(){for(var e,n=document.scripts,a=n.length-1,i=a;i>0;i--)if(n[i].readyState==="interactive"){e=n[i].src;break}return e||n[a].src}();return t.substring(0,t.lastIndexOf("/")+1)}(),config:{},end:{},minIndex:0,minLeft:[],btn:["&#x786E;&#x5B9A;","&#x53D6;&#x6D88;"],type:["dialog","page","iframe","loading","tips"],getStyle:function(t,e){var n=t.currentStyle?t.currentStyle:v.getComputedStyle(t,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](e)},link:function(t,e,n){if(o.path){var a=document.getElementsByTagName("head")[0],i=document.createElement("link");typeof e=="string"&&(n=e);var r=(n||t).replace(/\.|\//g,""),s="layuicss-"+r,l=0;i.rel="stylesheet",i.href=o.path+t,i.id=s,document.getElementById(s)||a.appendChild(i),typeof e=="function"&&function u(){return++l>80?v.console&&console.error("layer.css: Invalid"):void(parseInt(d.getStyle(document.getElementById(s),"width"))===1989?e():setTimeout(u,100))}()}}},o={v:"3.1.1",ie:function(){var t=navigator.userAgent.toLowerCase();return!!(v.ActiveXObject||"ActiveXObject"in v)&&((t.match(/msie\s(\d+)/)||[])[1]||"11")}(),index:v.layer&&v.layer.v?1e5:0,path:d.getPath,config:function(t,e){return t=t||{},o.cache=d.config=c.extend({},d.config,t),o.path=d.config.path||o.path,typeof t.extend=="string"&&(t.extend=[t.extend]),d.config.path&&o.ready(),t.extend?(L?layui.addcss("modules/layer/"+t.extend):d.link("theme/"+t.extend),this):this},ready:function(t){var e="layer",n="",a=(L?"modules/layer/":"theme/")+"default/layer.css?v="+o.v+n;return L?layui.addcss(a,t,e):d.link(a,t,e),this},alert:function(t,e,n){var a=typeof e=="function";return a&&(n=e),o.open(c.extend({content:t,yes:n},a?{}:e))},confirm:function(t,e,n,a){var i=typeof e=="function";return i&&(a=n,n=e),o.open(c.extend({content:t,btn:d.btn,yes:n,btn2:a},i?{}:e))},msg:function(t,e,n){var a=typeof e=="function",i=d.config.skin,r=(i?i+" "+i+"-msg":"")||"layui-layer-msg",s=f.anim.length-1;return a&&(n=e),o.open(c.extend({content:t,time:3e3,shade:!1,skin:r,title:!1,closeBtn:!1,btn:!1,resize:!1,end:n},a&&!d.config.skin?{skin:r+" layui-layer-hui",anim:s}:function(){return e=e||{},(e.icon===-1||e.icon===F&&!d.config.skin)&&(e.skin=r+" "+(e.skin||"layui-layer-hui")),e}()))},load:function(t,e){return o.open(c.extend({type:3,icon:t||0,resize:!1,shade:.01},e))},tips:function(t,e,n){return o.open(c.extend({type:4,content:[t,e],closeBtn:!1,time:3e3,shade:!1,resize:!1,fixed:!1,maxWidth:210},n))}},x=function(t){var e=this;e.index=++o.index,e.config=c.extend({},e.config,d.config,t),document.body?e.creat():setTimeout(function(){e.creat()},30)};x.pt=x.prototype;var f=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];f.anim=["layer-anim-00","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],x.pt.config={type:0,shade:.3,fixed:!0,move:f[1],title:"&#x4FE1;&#x606F;",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,isOutAnim:!0,icon:-1,moveType:1,resize:!0,scrollbar:!0,tips:2},x.pt.vessel=function(t,e){var n=this,a=n.index,i=n.config,r=i.zIndex+a,s=typeof i.title=="object",l=i.maxmin&&(i.type===1||i.type===2),u=i.title?'<div class="layui-layer-title" style="'+(s?i.title[1]:"")+'">'+(s?i.title[0]:i.title)+"</div>":"";return i.zIndex=r,e([i.shade?'<div class="layui-layer-shade" id="layui-layer-shade'+a+'" times="'+a+'" style="'+("z-index:"+(r-1)+"; ")+'"></div>':"",'<div class="'+f[0]+(" layui-layer-"+d.type[i.type])+(i.type!=0&&i.type!=2||i.shade?"":" layui-layer-border")+" "+(i.skin||"")+'" id="'+f[0]+a+'" type="'+d.type[i.type]+'" times="'+a+'" showtime="'+i.time+'" conType="'+(t?"object":"string")+'" style="z-index: '+r+"; width:"+i.area[0]+";height:"+i.area[1]+(i.fixed?"":";position:absolute;")+'">'+(t&&i.type!=2?"":u)+'<div id="'+(i.id||"")+'" class="layui-layer-content'+(i.type==0&&i.icon!==-1?" layui-layer-padding":"")+(i.type==3?" layui-layer-loading"+i.icon:"")+'">'+(i.type==0&&i.icon!==-1?'<i class="layui-layer-ico layui-layer-ico'+i.icon+'"></i>':"")+(i.type==1&&t?"":i.content||"")+'</div><span class="layui-layer-setwin">'+function(){var m=l?'<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>':"";return i.closeBtn&&(m+='<a class="layui-layer-ico '+f[7]+" "+f[7]+(i.title?i.closeBtn:i.type==4?"1":"2")+'" href="javascript:;"></a>'),m}()+"</span>"+(i.btn?function(){var m="";typeof i.btn=="string"&&(i.btn=[i.btn]);for(var b=0,w=i.btn.length;b<w;b++)m+='<a class="'+f[6]+b+'">'+i.btn[b]+"</a>";return'<div class="'+f[6]+" layui-layer-btn-"+(i.btnAlign||"")+'">'+m+"</div>"}():"")+(i.resize?'<span class="layui-layer-resize"></span>':"")+"</div>"],u,c('<div class="layui-layer-move"></div>')),n},x.pt.creat=function(){var t=this,e=t.config,n=t.index,a=e.content,i=typeof a=="object",r=c("body");if(!e.id||!c("#"+e.id)[0]){switch(typeof e.area=="string"&&(e.area=e.area==="auto"?["",""]:[e.area,""]),e.shift&&(e.anim=e.shift),o.ie==6&&(e.fixed=!1),e.type){case 0:e.btn="btn"in e?e.btn:d.btn[0],o.closeAll("dialog");break;case 2:var a=e.content=i?e.content:[e.content||"","auto"];e.content='<iframe scrolling="'+(e.content[1]||"auto")+'" allowtransparency="true" id="'+f[4]+n+'" name="'+f[4]+n+`" onload="this.className='';" class="layui-layer-load" frameborder="0" src="`+e.content[0]+'"></iframe>';break;case 3:delete e.title,delete e.closeBtn,e.icon===-1&&e.icon,o.closeAll("loading");break;case 4:i||(e.content=[e.content,"body"]),e.follow=e.content[1],e.content=e.content[0]+'<i class="layui-layer-TipsG"></i>',delete e.title,e.tips=typeof e.tips=="object"?e.tips:[e.tips,!0],e.tipsMore||o.closeAll("tips")}if(t.vessel(i,function(l,u,m){r.append(l[0]),i?function(){e.type==2||e.type==4?function(){c("body").append(l[1])}():function(){a.parents("."+f[0])[0]||(a.data("display",a.css("display")).show().addClass("layui-layer-wrap").wrap(l[1]),c("#"+f[0]+n).find("."+f[5]).before(u))}()}():r.append(l[1]),c(".layui-layer-move")[0]||r.append(d.moveElem=m),t.layero=c("#"+f[0]+n),e.scrollbar||f.html.css("overflow","hidden").attr("layer-full",n)}).auto(n),c("#layui-layer-shade"+t.index).css({"background-color":e.shade[1]||"#000",opacity:e.shade[0]||e.shade}),e.type==2&&o.ie==6&&t.layero.find("iframe").attr("src",a[0]),e.type==4?t.tips():t.offset(),e.fixed&&p.on("resize",function(){t.offset(),(/^\d+%$/.test(e.area[0])||/^\d+%$/.test(e.area[1]))&&t.auto(n),e.type==4&&t.tips()}),e.time<=0||setTimeout(function(){o.close(t.index)},e.time),t.move().callback(),f.anim[e.anim]){var s="layer-anim "+f.anim[e.anim];t.layero.addClass(s).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){c(this).removeClass(s)})}e.isOutAnim&&t.layero.data("isOutAnim",!0)}},x.pt.auto=function(t){var e=this,n=e.config,a=c("#"+f[0]+t);n.area[0]===""&&n.maxWidth>0&&(o.ie&&o.ie<8&&n.btn&&a.width(a.innerWidth()),a.outerWidth()>n.maxWidth&&a.width(n.maxWidth));var i=[a.innerWidth(),a.innerHeight()],r=a.find(f[1]).outerHeight()||0,s=a.find("."+f[6]).outerHeight()||0,l=function(u){u=a.find(u),u.height(i[1]-r-s-2*(0|parseFloat(u.css("padding-top"))))};switch(n.type){case 2:l("iframe");break;default:n.area[1]===""?n.maxHeight>0&&a.outerHeight()>n.maxHeight?(i[1]=n.maxHeight,l("."+f[5])):n.fixed&&i[1]>=p.height()&&(i[1]=p.height(),l("."+f[5])):l("."+f[5])}return e},x.pt.offset=function(){var t=this,e=t.config,n=t.layero,a=[n.outerWidth(),n.outerHeight()],i=typeof e.offset=="object";t.offsetTop=(p.height()-a[1])/2,t.offsetLeft=(p.width()-a[0])/2,i?(t.offsetTop=e.offset[0],t.offsetLeft=e.offset[1]||t.offsetLeft):e.offset!=="auto"&&(e.offset==="t"?t.offsetTop=0:e.offset==="r"?t.offsetLeft=p.width()-a[0]:e.offset==="b"?t.offsetTop=p.height()-a[1]:e.offset==="l"?t.offsetLeft=0:e.offset==="lt"?(t.offsetTop=0,t.offsetLeft=0):e.offset==="lb"?(t.offsetTop=p.height()-a[1],t.offsetLeft=0):e.offset==="rt"?(t.offsetTop=0,t.offsetLeft=p.width()-a[0]):e.offset==="rb"?(t.offsetTop=p.height()-a[1],t.offsetLeft=p.width()-a[0]):t.offsetTop=e.offset),e.fixed||(t.offsetTop=/%$/.test(t.offsetTop)?p.height()*parseFloat(t.offsetTop)/100:parseFloat(t.offsetTop),t.offsetLeft=/%$/.test(t.offsetLeft)?p.width()*parseFloat(t.offsetLeft)/100:parseFloat(t.offsetLeft),t.offsetTop+=p.scrollTop(),t.offsetLeft+=p.scrollLeft()),n.attr("minLeft")&&(t.offsetTop=p.height()-(n.find(f[1]).outerHeight()||0),t.offsetLeft=n.css("left")),n.css({top:t.offsetTop,left:t.offsetLeft})},x.pt.tips=function(){var t=this,e=t.config,n=t.layero,a=[n.outerWidth(),n.outerHeight()],i=c(e.follow);i[0]||(i=c("body"));var r={width:i.outerWidth(),height:i.outerHeight(),top:i.offset().top,left:i.offset().left},s=n.find(".layui-layer-TipsG"),l=e.tips[0];e.tips[1]||s.remove(),r.autoLeft=function(){r.left+a[0]-p.width()>0?(r.tipLeft=r.left+r.width-a[0],s.css({right:12,left:"auto"})):r.tipLeft=r.left},r.where=[function(){r.autoLeft(),r.tipTop=r.top-a[1]-10,s.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",e.tips[1])},function(){r.tipLeft=r.left+r.width+10,r.tipTop=r.top,s.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",e.tips[1])},function(){r.autoLeft(),r.tipTop=r.top+r.height+10,s.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",e.tips[1])},function(){r.tipLeft=r.left-a[0]-10,r.tipTop=r.top,s.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",e.tips[1])}],r.where[l-1](),l===1?r.top-(p.scrollTop()+a[1]+16)<0&&r.where[2]():l===2?p.width()-(r.left+r.width+a[0]+16)>0||r.where[3]():l===3?r.top-p.scrollTop()+r.height+a[1]+16-p.height()>0&&r.where[0]():l===4&&a[0]+16-r.left>0&&r.where[1](),n.find("."+f[5]).css({"background-color":e.tips[1],"padding-right":e.closeBtn?"30px":""}),n.css({left:r.tipLeft-(e.fixed?p.scrollLeft():0),top:r.tipTop-(e.fixed?p.scrollTop():0)})},x.pt.move=function(){var t=this,e=t.config,n=c(document),a=t.layero,i=a.find(e.move),r=a.find(".layui-layer-resize"),s={};return e.move&&i.css("cursor","move"),i.on("mousedown",function(l){l.preventDefault(),e.move&&(s.moveStart=!0,s.offset=[l.clientX-parseFloat(a.css("left")),l.clientY-parseFloat(a.css("top"))],d.moveElem.css("cursor","move").show())}),r.on("mousedown",function(l){l.preventDefault(),s.resizeStart=!0,s.offset=[l.clientX,l.clientY],s.area=[a.outerWidth(),a.outerHeight()],d.moveElem.css("cursor","se-resize").show()}),n.on("mousemove",function(l){if(s.moveStart){var u=l.clientX-s.offset[0],m=l.clientY-s.offset[1],b=a.css("position")==="fixed";if(l.preventDefault(),s.stX=b?0:p.scrollLeft(),s.stY=b?0:p.scrollTop(),!e.moveOut){var w=p.width()-a.outerWidth()+s.stX,h=p.height()-a.outerHeight()+s.stY;u<s.stX&&(u=s.stX),u>w&&(u=w),m<s.stY&&(m=s.stY),m>h&&(m=h)}a.css({left:u,top:m})}if(e.resize&&s.resizeStart){var u=l.clientX-s.offset[0],m=l.clientY-s.offset[1];l.preventDefault(),o.style(t.index,{width:s.area[0]+u,height:s.area[1]+m}),s.isResize=!0,e.resizing&&e.resizing(a)}}).on("mouseup",function(l){s.moveStart&&(delete s.moveStart,d.moveElem.hide(),e.moveEnd&&e.moveEnd(a)),s.resizeStart&&(delete s.resizeStart,d.moveElem.hide())}),t},x.pt.callback=function(){function t(){var i=a.cancel&&a.cancel(e.index,n);i===!1||o.close(e.index)}var e=this,n=e.layero,a=e.config;e.openLayer(),a.success&&(a.type==2?n.find("iframe").on("load",function(){a.success(n,e.index)}):a.success(n,e.index)),o.ie==6&&e.IE6(n),n.find("."+f[6]).children("a").on("click",function(){var i=c(this).index();if(i===0)a.yes?a.yes(e.index,n):a.btn1?a.btn1(e.index,n):o.close(e.index);else{var r=a["btn"+(i+1)]&&a["btn"+(i+1)](e.index,n);r===!1||o.close(e.index)}}),n.find("."+f[7]).on("click",t),a.shadeClose&&c("#layui-layer-shade"+e.index).on("click",function(){o.close(e.index)}),n.find(".layui-layer-min").on("click",function(){var i=a.min&&a.min(n);i===!1||o.min(e.index,a)}),n.find(".layui-layer-max").on("click",function(){c(this).hasClass("layui-layer-maxmin")?(o.restore(e.index),a.restore&&a.restore(n)):(o.full(e.index,a),setTimeout(function(){a.full&&a.full(n)},100))}),a.end&&(d.end[e.index]=a.end)},d.reselect=function(){c.each(c("select"),function(t,e){var n=c(this);n.parents("."+f[0])[0]||n.attr("layer")==1&&c("."+f[0]).length<1&&n.removeAttr("layer").show(),n=null})},x.pt.IE6=function(t){c("select").each(function(e,n){var a=c(this);a.parents("."+f[0])[0]||a.css("display")==="none"||a.attr({layer:"1"}).hide(),a=null})},x.pt.openLayer=function(){var t=this;o.zIndex=t.config.zIndex,o.setTop=function(e){var n=function(){o.zIndex++,e.css("z-index",o.zIndex+1)};return o.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",n),o.zIndex}},d.record=function(t){var e=[t.width(),t.height(),t.position().top,t.position().left+parseFloat(t.css("margin-left"))];t.find(".layui-layer-max").addClass("layui-layer-maxmin"),t.attr({area:e})},d.rescollbar=function(t){f.html.attr("layer-full")==t&&(f.html[0].style.removeProperty?f.html[0].style.removeProperty("overflow"):f.html[0].style.removeAttribute("overflow"),f.html.removeAttr("layer-full"))},v.layer=o,o.getChildFrame=function(t,e){return e=e||c("."+f[4]).attr("times"),c("#"+f[0]+e).find("iframe").contents().find(t)},o.getFrameIndex=function(t){return c("#"+t).parents("."+f[4]).attr("times")},o.iframeAuto=function(t){if(t){var e=o.getChildFrame("html",t).outerHeight(),n=c("#"+f[0]+t),a=n.find(f[1]).outerHeight()||0,i=n.find("."+f[6]).outerHeight()||0;n.css({height:e+a+i}),n.find("iframe").css({height:e})}},o.iframeSrc=function(t,e){c("#"+f[0]+t).find("iframe").attr("src",e)},o.style=function(t,e,n){var a=c("#"+f[0]+t),i=a.find(".layui-layer-content"),r=a.attr("type"),s=a.find(f[1]).outerHeight()||0,l=a.find("."+f[6]).outerHeight()||0;a.attr("minLeft"),r!==d.type[3]&&r!==d.type[4]&&(n||(parseFloat(e.width)<=260&&(e.width=260),parseFloat(e.height)-s-l<=64&&(e.height=64+s+l)),a.css(e),l=a.find("."+f[6]).outerHeight(),r===d.type[2]?a.find("iframe").css({height:parseFloat(e.height)-s-l}):i.css({height:parseFloat(e.height)-s-l-parseFloat(i.css("padding-top"))-parseFloat(i.css("padding-bottom"))}))},o.min=function(t,e){var n=c("#"+f[0]+t),a=n.find(f[1]).outerHeight()||0,i=n.attr("minLeft")||181*d.minIndex+"px",r=n.css("position");d.record(n),d.minLeft[0]&&(i=d.minLeft[0],d.minLeft.shift()),n.attr("position",r),o.style(t,{width:180,height:a,left:i,top:p.height()-a,position:"fixed",overflow:"hidden"},!0),n.find(".layui-layer-min").hide(),n.attr("type")==="page"&&n.find(f[4]).hide(),d.rescollbar(t),n.attr("minLeft")||d.minIndex++,n.attr("minLeft",i)},o.restore=function(t){var e=c("#"+f[0]+t),n=e.attr("area").split(",");e.attr("type"),o.style(t,{width:parseFloat(n[0]),height:parseFloat(n[1]),top:parseFloat(n[2]),left:parseFloat(n[3]),position:e.attr("position"),overflow:"visible"},!0),e.find(".layui-layer-max").removeClass("layui-layer-maxmin"),e.find(".layui-layer-min").show(),e.attr("type")==="page"&&e.find(f[4]).show(),d.rescollbar(t)},o.full=function(t){var e,n=c("#"+f[0]+t);d.record(n),f.html.attr("layer-full")||f.html.css("overflow","hidden").attr("layer-full",t),clearTimeout(e),e=setTimeout(function(){var a=n.css("position")==="fixed";o.style(t,{top:a?0:p.scrollTop(),left:a?0:p.scrollLeft(),width:p.width(),height:p.height()},!0),n.find(".layui-layer-min").hide()},100)},o.title=function(t,e){var n=c("#"+f[0]+(e||o.index)).find(f[1]);n.html(t)},o.close=function(t){var e=c("#"+f[0]+t),n=e.attr("type"),a="layer-anim-close";if(e[0]){var i="layui-layer-wrap",r=function(){if(n===d.type[1]&&e.attr("conType")==="object"){e.children(":not(."+f[5]+")").remove();for(var s=e.find("."+i),l=0;l<2;l++)s.unwrap();s.css("display",s.data("display")).removeClass(i)}else{if(n===d.type[2])try{var u=c("#"+f[4]+t)[0];u.contentWindow.document.write(""),u.contentWindow.close(),e.find("."+f[5])[0].removeChild(u)}catch(m){}e[0].innerHTML="",e.remove()}typeof d.end[t]=="function"&&d.end[t](),delete d.end[t]};e.data("isOutAnim")&&e.addClass("layer-anim "+a),c("#layui-layer-moves, #layui-layer-shade"+t).remove(),o.ie==6&&d.reselect(),d.rescollbar(t),e.attr("minLeft")&&(d.minIndex--,d.minLeft.push(e.attr("minLeft"))),o.ie&&o.ie<10||!e.data("isOutAnim")?r():setTimeout(function(){r()},200)}},o.closeAll=function(t){c.each(c("."+f[0]),function(){var e=c(this),n=t?e.attr("type")===t:1;n&&o.close(e.attr("times")),n=null})};var k=o.cache||{},E=function(t){return k.skin?" "+k.skin+" "+k.skin+"-"+t:""};o.prompt=function(t,e){var n="";if(t=t||{},typeof t=="function"&&(e=t),t.area){var a=t.area;n='style="width: '+a[0]+"; height: "+a[1]+';"',delete t.area}var i,r=t.formType==2?'<textarea class="layui-layer-input"'+n+"></textarea>":function(){return'<input type="'+(t.formType==1?"password":"text")+'" class="layui-layer-input">'}(),s=t.success;return delete t.success,o.open(c.extend({type:1,btn:["&#x786E;&#x5B9A;","&#x53D6;&#x6D88;"],content:r,skin:"layui-layer-prompt"+E("prompt"),maxWidth:p.width(),success:function(l){i=l.find(".layui-layer-input"),i.val(t.value||"").focus(),typeof s=="function"&&s(l)},resize:!1,yes:function(l){var u=i.val();u===""?i.focus():u.length>(t.maxlength||500)?o.tips("&#x6700;&#x591A;&#x8F93;&#x5165;"+(t.maxlength||500)+"&#x4E2A;&#x5B57;&#x6570;",i,{tips:1}):e&&e(u,l,i)}},t))},o.tab=function(t){t=t||{};var e=t.tab||{},n="layui-this",a=t.success;return delete t.success,o.open(c.extend({type:1,skin:"layui-layer-tab"+E("tab"),resize:!1,title:function(){var i=e.length,r=1,s="";if(i>0)for(s='<span class="'+n+'">'+e[0].title+"</span>";r<i;r++)s+="<span>"+e[r].title+"</span>";return s}(),content:'<ul class="layui-layer-tabmain">'+function(){var i=e.length,r=1,s="";if(i>0)for(s='<li class="layui-layer-tabli '+n+'">'+(e[0].content||"no content")+"</li>";r<i;r++)s+='<li class="layui-layer-tabli">'+(e[r].content||"no content")+"</li>";return s}()+"</ul>",success:function(i){var r=i.find(".layui-layer-title").children(),s=i.find(".layui-layer-tabmain").children();r.on("mousedown",function(l){l.stopPropagation?l.stopPropagation():l.cancelBubble=!0;var u=c(this),m=u.index();u.addClass(n).siblings().removeClass(n),s.eq(m).show().siblings().hide(),typeof t.change=="function"&&t.change(m)}),typeof a=="function"&&a(i)}},t))},o.photos=function(t,e,n){function a(h,y,T){var g=new Image;return g.src=h,g.complete?y(g):(g.onload=function(){g.onload=null,y(g)},void(g.onerror=function(z){g.onerror=null,T(z)}))}var i={};if(t=t||{},t.photos){var r=t.photos.constructor===Object,s=r?t.photos:{},l=s.data||[],u=s.start||0;i.imgIndex=(0|u)+1,t.img=t.img||"img";var m=t.success;if(delete t.success,r){if(l.length===0)return o.msg("&#x6CA1;&#x6709;&#x56FE;&#x7247;")}else{var b=c(t.photos),w=function(){l=[],b.find(t.img).each(function(h){var y=c(this);y.attr("layer-index",h),l.push({alt:y.attr("alt"),pid:y.attr("layer-pid"),src:y.attr("layer-src")||y.attr("src"),thumb:y.attr("src")})})};if(w(),l.length===0||(e||b.on("click",t.img,function(){var h=c(this),y=h.attr("layer-index");o.photos(c.extend(t,{photos:{start:y,data:l,tab:t.tab},full:t.full}),!0),w()}),!e))return}i.imgprev=function(h){i.imgIndex--,i.imgIndex<1&&(i.imgIndex=l.length),i.tabimg(h)},i.imgnext=function(h,y){i.imgIndex++,i.imgIndex>l.length&&(i.imgIndex=1,y)||i.tabimg(h)},i.keyup=function(h){if(!i.end){var y=h.keyCode;h.preventDefault(),y===37?i.imgprev(!0):y===39?i.imgnext(!0):y===27&&o.close(i.index)}},i.tabimg=function(h){if(!(l.length<=1))return s.start=i.imgIndex-1,o.close(i.index),o.photos(t,!0,h)},i.event=function(){i.bigimg.hover(function(){i.imgsee.show()},function(){i.imgsee.hide()}),i.bigimg.find(".layui-layer-imgprev").on("click",function(h){h.preventDefault(),i.imgprev()}),i.bigimg.find(".layui-layer-imgnext").on("click",function(h){h.preventDefault(),i.imgnext()}),c(document).on("keyup",i.keyup)},i.loadi=o.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),a(l[u].src,function(h){o.close(i.loadi),i.index=o.open(c.extend({type:1,id:"layui-layer-photos",area:function(){var y=[h.width,h.height],T=[c(v).width()-100,c(v).height()-100];if(!t.full&&(y[0]>T[0]||y[1]>T[1])){var g=[y[0]/T[0],y[1]/T[1]];g[0]>g[1]?(y[0]=y[0]/g[0],y[1]=y[1]/g[0]):g[0]<g[1]&&(y[0]=y[0]/g[1],y[1]=y[1]/g[1])}return[y[0]+"px",y[1]+"px"]}(),title:!1,shade:.9,shadeClose:!0,closeBtn:!1,move:".layui-layer-phimg img",moveType:1,scrollbar:!1,moveOut:!0,isOutAnim:!1,skin:"layui-layer-photos"+E("photos"),content:'<div class="layui-layer-phimg"><img src="'+l[u].src+'" alt="'+(l[u].alt||"")+'" layer-pid="'+l[u].pid+'"><div class="layui-layer-imgsee">'+(l.length>1?'<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>':"")+'<div class="layui-layer-imgbar" style="display:'+(n?"block":"")+'"><span class="layui-layer-imgtit"><a href="javascript:;">'+(l[u].alt||"")+"</a><em>"+i.imgIndex+"/"+l.length+"</em></span></div></div></div>",success:function(y,T){i.bigimg=y.find(".layui-layer-phimg"),i.imgsee=y.find(".layui-layer-imguide,.layui-layer-imgbar"),i.event(y),t.tab&&t.tab(l[u],y),typeof m=="function"&&m(y)},end:function(){i.end=!0,c(document).off("keyup",i.keyup)}},t))},function(){o.close(i.loadi),o.msg("&#x5F53;&#x524D;&#x56FE;&#x7247;&#x5730;&#x5740;&#x5F02;&#x5E38;<br>&#x662F;&#x5426;&#x7EE7;&#x7EED;&#x67E5;&#x770B;&#x4E0B;&#x4E00;&#x5F20;&#xFF1F;",{time:3e4,btn:["&#x4E0B;&#x4E00;&#x5F20;","&#x4E0D;&#x770B;&#x4E86;"],yes:function(){l.length>1&&i.imgnext(!0,!0)}})})}},d.run=function(t){c=t,p=c(v),f.html=c("html"),o.open=function(e){var n=new x(e);return n.index}},v.layui&&layui.define?(o.ready(),layui.define("jquery",function(t){o.path=layui.cache.dir,d.run(layui.$),v.layer=o,t("layer",o)})):typeof define=="function"&&define.amd?define(["jquery"],function(){return d.run(v.jQuery),o}):function(){d.run(v.jQuery),o.ready()}()})(window);