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

2 lines
22 KiB
JavaScript

/*! layer-v3.5.1 Web 通用弹出层组件 MIT License */(function(v,A){"use strict";var c,p,L=v.layui&&layui.define,d={getPath:function(){var t=document.currentScript?document.currentScript.src:function(){for(var n,a=document.scripts,i=a.length-1,o=i;o>0;o--)if(a[o].readyState==="interactive"){n=a[o].src;break}return n||a[i].src}(),e=v.LAYUI_GLOBAL||{};return e.layer_dir||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(r.path){var a=document.getElementsByTagName("head")[0],i=document.createElement("link");typeof e=="string"&&(n=e);var o=(n||t).replace(/\.|\//g,""),f="layuicss-"+o,s="creating",y=0;i.rel="stylesheet",i.href=r.path+t,i.id=f,document.getElementById(f)||a.appendChild(i),typeof e=="function"&&function m(b){var w=100,h=document.getElementById(f);return++y>1e4/w?v.console&&console.error(o+".css: Invalid"):void(parseInt(d.getStyle(h,"width"))===1989?(b===s&&h.removeAttribute("lay-status"),h.getAttribute("lay-status")===s?setTimeout(m,w):e()):(h.setAttribute("lay-status",s),setTimeout(function(){m(s)},w)))}()}}},r={v:"3.5.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||{},r.cache=d.config=c.extend({},d.config,t),r.path=d.config.path||r.path,typeof t.extend=="string"&&(t.extend=[t.extend]),d.config.path&&r.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="+r.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),r.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),r.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,o=(i?i+" "+i+"-msg":"")||"layui-layer-msg",f=l.anim.length-1;return a&&(n=e),r.open(c.extend({content:t,time:3e3,shade:!1,skin:o,title:!1,closeBtn:!1,btn:!1,resize:!1,end:n},a&&!d.config.skin?{skin:o+" layui-layer-hui",anim:f}:function(){return e=e||{},(e.icon===-1||e.icon===A&&!d.config.skin)&&(e.skin=o+" "+(e.skin||"layui-layer-hui")),e}()))},load:function(t,e){return r.open(c.extend({type:3,icon:t||0,resize:!1,shade:.01},e))},tips:function(t,e,n){return r.open(c.extend({type:4,content:[t,e],closeBtn:!1,time:3e3,shade:!1,resize:!1,fixed:!1,maxWidth:260},n))}},x=function(t){var e=this,n=function(){e.creat()};e.index=++r.index,e.config.maxWidth=c(p).width()-30,e.config=c.extend({},e.config,d.config,t),document.body?n():setTimeout(function(){n()},30)};x.pt=x.prototype;var l=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];l.anim=["layer-anim-00","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],l.SHADE="layui-layer-shade",l.MOVE="layui-layer-move",x.pt.config={type:0,shade:.3,fixed:!0,move:l[1],title:"&#x4FE1;&#x606F;",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,isOutAnim:!0,minStack:!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,o=i.zIndex+a,f=typeof i.title=="object",s=i.maxmin&&(i.type===1||i.type===2),y=i.title?'<div class="layui-layer-title" style="'+(f?i.title[1]:"")+'">'+(f?i.title[0]:i.title)+"</div>":"";return i.zIndex=o,e([i.shade?'<div class="'+l.SHADE+'" id="'+l.SHADE+a+'" times="'+a+'" style="'+("z-index:"+(o-1)+"; ")+'"></div>':"",'<div class="'+l[0]+(" layui-layer-"+d.type[i.type])+(i.type!=0&&i.type!=2||i.shade?"":" layui-layer-border")+" "+(i.skin||"")+'" id="'+l[0]+a+'" type="'+d.type[i.type]+'" times="'+a+'" showtime="'+i.time+'" conType="'+(t?"object":"string")+'" style="z-index: '+o+"; width:"+i.area[0]+";height:"+i.area[1]+";position:"+(i.fixed?"fixed;":"absolute;")+'">'+(t&&i.type!=2?"":y)+'<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=s?'<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 '+l[7]+" "+l[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="'+l[6]+b+'">'+i.btn[b]+"</a>";return'<div class="'+l[6]+" layui-layer-btn-"+(i.btnAlign||"")+'">'+m+"</div>"}():"")+(i.resize?'<span class="layui-layer-resize"></span>':"")+"</div>"],y,c('<div class="'+l.MOVE+'" id="'+l.MOVE+'"></div>')),n},x.pt.creat=function(){var t=this,e=t.config,n=t.index,a=e.content,i=typeof a=="object",o=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),r.ie==6&&(e.fixed=!1),e.type){case 0:e.btn="btn"in e?e.btn:d.btn[0],r.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="'+l[4]+n+'" name="'+l[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,r.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||r.closeAll("tips")}if(t.vessel(i,function(s,y,m){o.append(s[0]),i?function(){e.type==2||e.type==4?function(){c("body").append(s[1])}():function(){a.parents("."+l[0])[0]||(a.data("display",a.css("display")).show().addClass("layui-layer-wrap").wrap(s[1]),c("#"+l[0]+n).find("."+l[5]).before(y))}()}():o.append(s[1]),c("#"+l.MOVE)[0]||o.append(d.moveElem=m),t.layero=c("#"+l[0]+n),t.shadeo=c("#"+l.SHADE+n),e.scrollbar||l.html.css("overflow","hidden").attr("layer-full",n)}).auto(n),t.shadeo.css({"background-color":e.shade[1]||"#000",opacity:e.shade[0]||e.shade}),e.type==2&&r.ie==6&&t.layero.find("iframe").attr("src",a[0]),e.type==4?t.tips():function(){t.offset(),parseInt(d.getStyle(document.getElementById(l.MOVE),"z-index"))||function(){t.layero.css("visibility","hidden"),r.ready(function(){t.offset(),t.layero.css("visibility","visible")})}()}(),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(){r.close(t.index)},e.time),t.move().callback(),l.anim[e.anim]){var f="layer-anim "+l.anim[e.anim];t.layero.addClass(f).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){c(this).removeClass(f)})}e.isOutAnim&&t.layero.data("isOutAnim",!0)}},x.pt.auto=function(t){var e=this,n=e.config,a=c("#"+l[0]+t);n.area[0]===""&&n.maxWidth>0&&(r.ie&&r.ie<8&&n.btn&&a.width(a.innerWidth()),a.outerWidth()>n.maxWidth&&a.width(n.maxWidth));var i=[a.innerWidth(),a.innerHeight()],o=a.find(l[1]).outerHeight()||0,f=a.find("."+l[6]).outerHeight()||0,s=function(y){y=a.find(y),y.height(i[1]-o-f-2*(0|parseFloat(y.css("padding-top"))))};switch(n.type){case 2:s("iframe");break;default:n.area[1]===""?n.maxHeight>0&&a.outerHeight()>n.maxHeight?(i[1]=n.maxHeight,s("."+l[5])):n.fixed&&i[1]>=p.height()&&(i[1]=p.height(),s("."+l[5])):s("."+l[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(l[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 o={width:i.outerWidth(),height:i.outerHeight(),top:i.offset().top,left:i.offset().left},f=n.find(".layui-layer-TipsG"),s=e.tips[0];e.tips[1]||f.remove(),o.autoLeft=function(){o.left+a[0]-p.width()>0?(o.tipLeft=o.left+o.width-a[0],f.css({right:12,left:"auto"})):o.tipLeft=o.left},o.where=[function(){o.autoLeft(),o.tipTop=o.top-a[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",e.tips[1])},function(){o.tipLeft=o.left+o.width+10,o.tipTop=o.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",e.tips[1])},function(){o.autoLeft(),o.tipTop=o.top+o.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",e.tips[1])},function(){o.tipLeft=o.left-a[0]-10,o.tipTop=o.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",e.tips[1])}],o.where[s-1](),s===1?o.top-(p.scrollTop()+a[1]+16)<0&&o.where[2]():s===2?p.width()-(o.left+o.width+a[0]+16)>0||o.where[3]():s===3?o.top-p.scrollTop()+o.height+a[1]+16-p.height()>0&&o.where[0]():s===4&&a[0]+16-o.left>0&&o.where[1](),n.find("."+l[5]).css({"background-color":e.tips[1],"padding-right":e.closeBtn?"30px":""}),n.css({left:o.tipLeft-(e.fixed?p.scrollLeft():0),top:o.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),o=a.find(".layui-layer-resize"),f={};return e.move&&i.css("cursor","move"),i.on("mousedown",function(s){s.preventDefault(),e.move&&(f.moveStart=!0,f.offset=[s.clientX-parseFloat(a.css("left")),s.clientY-parseFloat(a.css("top"))],d.moveElem.css("cursor","move").show())}),o.on("mousedown",function(s){s.preventDefault(),f.resizeStart=!0,f.offset=[s.clientX,s.clientY],f.area=[a.outerWidth(),a.outerHeight()],d.moveElem.css("cursor","se-resize").show()}),n.on("mousemove",function(s){if(f.moveStart){var y=s.clientX-f.offset[0],m=s.clientY-f.offset[1],b=a.css("position")==="fixed";if(s.preventDefault(),f.stX=b?0:p.scrollLeft(),f.stY=b?0:p.scrollTop(),!e.moveOut){var w=p.width()-a.outerWidth()+f.stX,h=p.height()-a.outerHeight()+f.stY;y<f.stX&&(y=f.stX),y>w&&(y=w),m<f.stY&&(m=f.stY),m>h&&(m=h)}a.css({left:y,top:m})}if(e.resize&&f.resizeStart){var y=s.clientX-f.offset[0],m=s.clientY-f.offset[1];s.preventDefault(),r.style(t.index,{width:f.area[0]+y,height:f.area[1]+m}),f.isResize=!0,e.resizing&&e.resizing(a)}}).on("mouseup",function(s){f.moveStart&&(delete f.moveStart,d.moveElem.hide(),e.moveEnd&&e.moveEnd(a)),f.resizeStart&&(delete f.resizeStart,d.moveElem.hide())}),t},x.pt.callback=function(){function t(){var i=a.cancel&&a.cancel(e.index,n);i===!1||r.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)),r.ie==6&&e.IE6(n),n.find("."+l[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):r.close(e.index);else{var o=a["btn"+(i+1)]&&a["btn"+(i+1)](e.index,n);o===!1||r.close(e.index)}}),n.find("."+l[7]).on("click",t),a.shadeClose&&e.shadeo.on("click",function(){r.close(e.index)}),n.find(".layui-layer-min").on("click",function(){var i=a.min&&a.min(n,e.index);i===!1||r.min(e.index,a)}),n.find(".layui-layer-max").on("click",function(){c(this).hasClass("layui-layer-maxmin")?(r.restore(e.index),a.restore&&a.restore(n,e.index)):(r.full(e.index,a),setTimeout(function(){a.full&&a.full(n,e.index)},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("."+l[0])[0]||n.attr("layer")==1&&c("."+l[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("."+l[0])[0]||a.css("display")==="none"||a.attr({layer:"1"}).hide(),a=null})},x.pt.openLayer=function(){var t=this;r.zIndex=t.config.zIndex,r.setTop=function(e){var n=function(){r.zIndex++,e.css("z-index",r.zIndex+1)};return r.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",n),r.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){l.html.attr("layer-full")==t&&(l.html[0].style.removeProperty?l.html[0].style.removeProperty("overflow"):l.html[0].style.removeAttribute("overflow"),l.html.removeAttr("layer-full"))},v.layer=r,r.getChildFrame=function(t,e){return e=e||c("."+l[4]).attr("times"),c("#"+l[0]+e).find("iframe").contents().find(t)},r.getFrameIndex=function(t){return c("#"+t).parents("."+l[4]).attr("times")},r.iframeAuto=function(t){if(t){var e=r.getChildFrame("html",t).outerHeight(),n=c("#"+l[0]+t),a=n.find(l[1]).outerHeight()||0,i=n.find("."+l[6]).outerHeight()||0;n.css({height:e+a+i}),n.find("iframe").css({height:e})}},r.iframeSrc=function(t,e){c("#"+l[0]+t).find("iframe").attr("src",e)},r.style=function(t,e,n){var a=c("#"+l[0]+t),i=a.find(".layui-layer-content"),o=a.attr("type"),f=a.find(l[1]).outerHeight()||0,s=a.find("."+l[6]).outerHeight()||0;a.attr("minLeft"),o!==d.type[3]&&o!==d.type[4]&&(n||(parseFloat(e.width)<=260&&(e.width=260),parseFloat(e.height)-f-s<=64&&(e.height=64+f+s)),a.css(e),s=a.find("."+l[6]).outerHeight(),o===d.type[2]?a.find("iframe").css({height:parseFloat(e.height)-f-s}):i.css({height:parseFloat(e.height)-f-s-parseFloat(i.css("padding-top"))-parseFloat(i.css("padding-bottom"))}))},r.min=function(t,e){e=e||{};var n=c("#"+l[0]+t),a=c("#"+l.SHADE+t),i=n.find(l[1]).outerHeight()||0,o=n.attr("minLeft")||181*d.minIndex+"px",f=n.css("position"),s={width:180,height:i,position:"fixed",overflow:"hidden"};d.record(n),d.minLeft[0]&&(o=d.minLeft[0],d.minLeft.shift()),e.minStack&&(s.left=o,s.top=p.height()-i,n.attr("minLeft")||d.minIndex++,n.attr("minLeft",o)),n.attr("position",f),r.style(t,s,!0),n.find(".layui-layer-min").hide(),n.attr("type")==="page"&&n.find(l[4]).hide(),d.rescollbar(t),a.hide()},r.restore=function(t){var e=c("#"+l[0]+t),n=c("#"+l.SHADE+t),a=e.attr("area").split(",");e.attr("type"),r.style(t,{width:parseFloat(a[0]),height:parseFloat(a[1]),top:parseFloat(a[2]),left:parseFloat(a[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(l[4]).show(),d.rescollbar(t),n.show()},r.full=function(t){var e,n=c("#"+l[0]+t);d.record(n),l.html.attr("layer-full")||l.html.css("overflow","hidden").attr("layer-full",t),clearTimeout(e),e=setTimeout(function(){var a=n.css("position")==="fixed";r.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)},r.title=function(t,e){var n=c("#"+l[0]+(e||r.index)).find(l[1]);n.html(t)},r.close=function(t,e){var n=c("#"+l[0]+t),a=n.attr("type"),i="layer-anim-close";if(n[0]){var o="layui-layer-wrap",f=function(){if(a===d.type[1]&&n.attr("conType")==="object"){n.children(":not(."+l[5]+")").remove();for(var s=n.find("."+o),y=0;y<2;y++)s.unwrap();s.css("display",s.data("display")).removeClass(o)}else{if(a===d.type[2])try{var m=c("#"+l[4]+t)[0];m.contentWindow.document.write(""),m.contentWindow.close(),n.find("."+l[5])[0].removeChild(m)}catch(b){}n[0].innerHTML="",n.remove()}typeof d.end[t]=="function"&&d.end[t](),delete d.end[t],typeof e=="function"&&e()};n.data("isOutAnim")&&n.addClass("layer-anim "+i),c("#layui-layer-moves, #"+l.SHADE+t).remove(),r.ie==6&&d.reselect(),d.rescollbar(t),n.attr("minLeft")&&(d.minIndex--,d.minLeft.push(n.attr("minLeft"))),r.ie&&r.ie<10||!n.data("isOutAnim")?f():setTimeout(function(){f()},200)}},r.closeAll=function(t,e){typeof t=="function"&&(e=t,t=null);var n=c("."+l[0]);c.each(n,function(a){var i=c(this),o=t?i.attr("type")===t:1;o&&r.close(i.attr("times"),a===n.length-1?e:null),o=null}),n.length===0&&typeof e=="function"&&e()};var E=r.cache||{},k=function(t){return E.skin?" "+E.skin+" "+E.skin+"-"+t:""};r.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,o=t.formType==2?'<textarea class="layui-layer-input"'+n+"></textarea>":function(){return'<input type="'+(t.formType==1?"password":"text")+'" class="layui-layer-input">'}(),f=t.success;return delete t.success,r.open(c.extend({type:1,btn:["&#x786E;&#x5B9A;","&#x53D6;&#x6D88;"],content:o,skin:"layui-layer-prompt"+k("prompt"),maxWidth:p.width(),success:function(s){i=s.find(".layui-layer-input"),i.val(t.value||"").focus(),typeof f=="function"&&f(s)},resize:!1,yes:function(s){var y=i.val();y===""?i.focus():y.length>(t.maxlength||500)?r.tips("&#x6700;&#x591A;&#x8F93;&#x5165;"+(t.maxlength||500)+"&#x4E2A;&#x5B57;&#x6570;",i,{tips:1}):e&&e(y,s,i)}},t))},r.tab=function(t){t=t||{};var e=t.tab||{},n="layui-this",a=t.success;return delete t.success,r.open(c.extend({type:1,skin:"layui-layer-tab"+k("tab"),resize:!1,title:function(){var i=e.length,o=1,f="";if(i>0)for(f='<span class="'+n+'">'+e[0].title+"</span>";o<i;o++)f+="<span>"+e[o].title+"</span>";return f}(),content:'<ul class="layui-layer-tabmain">'+function(){var i=e.length,o=1,f="";if(i>0)for(f='<li class="layui-layer-tabli '+n+'">'+(e[0].content||"no content")+"</li>";o<i;o++)f+='<li class="layui-layer-tabli">'+(e[o].content||"no content")+"</li>";return f}()+"</ul>",success:function(i){var o=i.find(".layui-layer-title").children(),f=i.find(".layui-layer-tabmain").children();o.on("mousedown",function(s){s.stopPropagation?s.stopPropagation():s.cancelBubble=!0;var y=c(this),m=y.index();y.addClass(n).siblings().removeClass(n),f.eq(m).show().siblings().hide(),typeof t.change=="function"&&t.change(m)}),typeof a=="function"&&a(i)}},t))},r.photos=function(t,e,n){function a(h,u,T){var g=new Image;return g.src=h,g.complete?u(g):(g.onload=function(){g.onload=null,u(g)},void(g.onerror=function(I){g.onerror=null,T(I)}))}var i={};if(t=t||{},t.photos){var o=!(typeof t.photos=="string"||t.photos instanceof c),f=o?t.photos:{},s=f.data||[],y=f.start||0;i.imgIndex=(0|y)+1,t.img=t.img||"img";var m=t.success;if(delete t.success,o){if(s.length===0)return r.msg("&#x6CA1;&#x6709;&#x56FE;&#x7247;")}else{var b=c(t.photos),w=function(){s=[],b.find(t.img).each(function(h){var u=c(this);u.attr("layer-index",h),s.push({alt:u.attr("alt"),pid:u.attr("layer-pid"),src:u.attr("layer-src")||u.attr("src"),thumb:u.attr("src")})})};if(w(),s.length===0||(e||b.on("click",t.img,function(){w();var h=c(this),u=h.attr("layer-index");r.photos(c.extend(t,{photos:{start:u,data:s,tab:t.tab},full:t.full}),!0)}),!e))return}i.imgprev=function(h){i.imgIndex--,i.imgIndex<1&&(i.imgIndex=s.length),i.tabimg(h)},i.imgnext=function(h,u){i.imgIndex++,i.imgIndex>s.length&&(i.imgIndex=1,u)||i.tabimg(h)},i.keyup=function(h){if(!i.end){var u=h.keyCode;h.preventDefault(),u===37?i.imgprev(!0):u===39?i.imgnext(!0):u===27&&r.close(i.index)}},i.tabimg=function(h){if(!(s.length<=1))return f.start=i.imgIndex-1,r.close(i.index),r.photos(t,!0,h)},i.event=function(){i.bigimg.find(".layui-layer-imgprev").on("click",function(h){h.preventDefault(),i.imgprev(!0)}),i.bigimg.find(".layui-layer-imgnext").on("click",function(h){h.preventDefault(),i.imgnext(!0)}),c(document).on("keyup",i.keyup)},i.loadi=r.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),a(s[y].src,function(h){r.close(i.loadi),n&&(t.anim=-1),i.index=r.open(c.extend({type:1,id:"layui-layer-photos",area:function(){var u=[h.width,h.height],T=[c(v).width()-100,c(v).height()-100];if(!t.full&&(u[0]>T[0]||u[1]>T[1])){var g=[u[0]/T[0],u[1]/T[1]];g[0]>g[1]?(u[0]=u[0]/g[0],u[1]=u[1]/g[0]):g[0]<g[1]&&(u[0]=u[0]/g[1],u[1]=u[1]/g[1])}return[u[0]+"px",u[1]+"px"]}(),title:!1,shade:.9,shadeClose:!0,closeBtn:!1,move:".layui-layer-phimg img",moveType:1,scrollbar:!1,moveOut:!0,anim:5,isOutAnim:!1,skin:"layui-layer-photos"+k("photos"),content:'<div class="layui-layer-phimg"><img src="'+s[y].src+'" alt="'+(s[y].alt||"")+'" layer-pid="'+s[y].pid+'">'+function(){return s.length>1?'<div class="layui-layer-imgsee"><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:;">'+(s[y].alt||"")+"</a><em>"+i.imgIndex+" / "+s.length+"</em></span></div></div>":""}()+"</div>",success:function(u,T){i.bigimg=u.find(".layui-layer-phimg"),i.imgsee=u.find(".layui-layer-imgbar"),i.event(u),t.tab&&t.tab(s[y],u),typeof m=="function"&&m(u)},end:function(){i.end=!0,c(document).off("keyup",i.keyup)}},t))},function(){r.close(i.loadi),r.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(){s.length>1&&i.imgnext(!0,!0)}})})}},d.run=function(t){c=t,p=c(v),l.html=c("html"),r.open=function(e){var n=new x(e);return n.index}},v.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,d.run(layui.$),v.layer=r,t("layer",r)})):typeof define=="function"&&define.amd?define(["jquery"],function(){return d.run(v.jQuery),r}):function(){r.ready(),d.run(v.jQuery)}()})(window);