/*! layer弹层拓展类 */
;layer.use("skin/layer.ext.css",function(){layer.layui_layer_extendlayerextjs=!0}),layer.prompt=function(a,b){a=a||{},"function"==typeof a&&(b=a);var c,d=2==a.formtype?'":function(){return''}();return layer.open($.extend({btn:["确定","取消"],content:d,skin:"layui-layer-prompt",success:function(a){c=a.find(".layui-layer-input"),c.focus()},yes:function(d){var e=c.val();""===e?c.focus():e.length>(a.maxlength||500)?layer.tips("最多输入"+(a.maxlength||500)+"个字数",c,{tips:1}):b&&b(e,d,c)}},a))},layer.tab=function(a){a=a||{};var b=a.tab||{};return layer.open($.extend({type:1,skin:"layui-layer-tab",title:function(){var a=b.length,c=1,d="";if(a>0)for(d=''+b[0].title+"";a>c;c++)d+=""+b[c].title+"";return d}(),content:'
'+function(){var a=b.length,c=1,d="";if(a>0)for(d='- '+(b[0].content||"no content")+"
";a>c;c++)d+='- '+(b[c].content||"no content")+"
";return d}()+"
",success:function(a){var b=a.find(".layui-layer-title").children(),c=a.find(".layui-layer-tabmain").children();b.on("mousedown",function(a){a.stoppropagation?a.stoppropagation():a.cancelbubble=!0;var b=$(this),d=b.index();b.addclass("layui-layer-tabnow").siblings().removeclass("layui-layer-tabnow"),c.eq(d).show().siblings().hide()})}},a))},layer.photos=function(a,b,c){function d(a,b,c){var d=new image;d.onload=function(){d.onload=null,b(d)},d.onerror=function(a){d.onload=null,c(a)},d.src=a}var e={};if(a=a||{},a.photos){var f=a.photos.constructor===object,g=f?a.photos:{},h=g.data||[],i=g.start||0;if(e.imgindex=i+1,f){if(0===h.length)return void layer.msg("没有图片")}else{var j=$(a.photos),k=j.find(a.img||"img");if(0===k.length)return;if(b||j.find(g.img||"img").each(function(b){var c=$(this);h.push({alt:c.attr("alt"),pid:c.attr("layer-pid"),src:c.attr("layer-src")||c.attr("src"),thumb:c.attr("src")}),c.on("click",function(){layer.photos($.extend(a,{photos:{start:b,data:h,tab:a.tab},full:a.full}),!0)})}),!b)return}e.imgprev=function(a){e.imgindex--,e.imgindex<1&&(e.imgindex=h.length),e.tabimg(a)},e.imgnext=function(a){e.imgindex++,e.imgindex>h.length&&(e.imgindex=1),e.tabimg(a)},e.keyup=function(a){if(!e.end){var b=a.keycode;a.preventdefault(),37===b?e.imgprev(!0):39===b?e.imgnext(!0):27===b&&layer.close(e.index)}},e.tabimg=function(b){g.start=e.imgindex-1,layer.close(e.index),layer.photos({photos:g,full:a.full,tab:a.tab},!0,b)},e.event=function(){e.bigimg.hover(function(){e.imgsee.show()},function(){e.imgsee.hide()}),e.bigimg.find(".layui-layer-imgprev").on("click",function(a){a.preventdefault(),e.imgprev()}),e.bigimg.find(".layui-layer-imgnext").on("click",function(a){a.preventdefault(),e.imgnext()}),$(document).on("keyup",e.keyup)},e.loadi=layer.load(1,{shade:.9,scrollbar:!1}),d(h[i].src,function(b){layer.close(e.loadi),e.index=layer.open($.extend({type:1,area:function(){var c=[b.width,b.height],d=[$(window).width()-100,$(window).height()-100];return!a.full&&c[0]>d[0]&&(c[0]=d[0],c[1]=c[0]*d[1]/c[0]),[c[0]+"px",c[1]+"px"]}(),title:!1,shade:.9,shadeclose:!0,closebtn:!1,move:".layui-layer-phimg img",movetype:1,scrollbar:!1,moveout:!0,shift:5*math.random()|0,skin:"layui-layer-photos",content:'",success:function(b){e.bigimg=b.find(".layui-layer-phimg"),e.imgsee=b.find(".layui-layer-imguide,.layui-layer-imgbar"),e.event(b),a.tab&&a.tab(h[i],b)},end:function(){e.end=!0,$(document).off("keyup",e.keyup)}},a))},function(){layer.close(e.loadi),layer.msg("当前图片地址异常",function(){h.length>1&&e.imgnext(!0)})})}};