/*! layer-v2.1 弹层组件 license lgpl http://layer.layui.com/ by 贤心 */ ;!function(a,b){"use strict";var c,d,e={getpath:function(){var a=document.scripts,b=a[a.length-1],c=b.src;if(!b.getattribute("merge"))return c.substring(0,c.lastindexof("/")+1)}(),enter:function(a){13===a.keycode&&a.preventdefault()},config:{},end:{},btn:["确定","取消"],type:["dialog","page","iframe","loading","tips"]},f={v:"2.1",ie6:!!a.activexobject&&!a.xmlhttprequest,index:0,path:e.getpath,config:function(a,b){var d=0;return a=a||{},f.cache=e.config=c.extend(e.config,a),f.path=e.config.path||f.path,"string"==typeof a.extend&&(a.extend=[a.extend]),f.use("skin/layer.css",a.extend&&a.extend.length>0?function g(){var c=a.extend;f.use(c[c[d]?d:d-1],d'+(i?f.title[0]:f.title)+"":"";return f.zindex=g,b([f.shade?'
':"",'
'+(a&&2!=f.type?"":k)+'
'+(0==f.type&&-1!==f.icon?'':"")+(1==f.type&&a?"":f.content||"")+'
'+function(){var a=j?'':"";return f.closebtn&&(a+=''),a}()+""+(f.btn?function(){var a="";"string"==typeof f.btn&&(f.btn=[f.btn]);for(var b=0,c=f.btn.length;c>b;b++)a+=''+f.btn[b]+"";return'
'+a+"
"}():"")+"
"],k),c},g.pt.creat=function(){var a=this,b=a.config,g=a.index,i=b.content,j="object"==typeof i;switch("string"==typeof b.area&&(b.area="auto"===b.area?["",""]:[b.area,""]),b.type){case 0:b.btn="btn"in b?b.btn:e.btn[0],f.closeall("dialog");break;case 2:var i=b.content=j?b.content:[b.content||"http://layer.layui.com","auto"];b.content='';break;case 3:b.title=!1,b.closebtn=!1,-1===b.icon&&0===b.icon,f.closeall("loading");break;case 4:j||(b.content=[b.content,"body"]),b.follow=b.content[1],b.content=b.content[0]+'',b.title=!1,b.shade=!1,b.fix=!1,b.tips="object"==typeof b.tips?b.tips:[b.tips,!0],b.tipsmore||f.closeall("tips")}a.vessel(j,function(d,e){c("body").append(d[0]),j?function(){2==b.type||4==b.type?function(){c("body").append(d[1])}():function(){i.parents("."+h[0])[0]||(i.show().addclass("layui-layer-wrap").wrap(d[1]),c("#"+h[0]+g).find("."+h[5]).before(e))}()}():c("body").append(d[1]),a.layero=c("#"+h[0]+g),b.scrollbar||h.html.css("overflow","hidden").attr("layer-full",g)}).auto(g),2==b.type&&f.ie6&&a.layero.find("iframe").attr("src",i[0]),c(document).off("keydown",e.enter).on("keydown",e.enter),a.layero.on("keydown",function(a){c(document).off("keydown",e.enter)}),4==b.type?a.tips():a.offset(),b.fix&&d.on("resize",function(){a.offset(),(/^\d+%$/.test(b.area[0])||/^\d+%$/.test(b.area[1]))&&a.auto(g),4==b.type&&a.tips()}),b.time<=0||settimeout(function(){f.close(a.index)},b.time),a.move().callback()},g.pt.auto=function(a){function b(a){a=g.find(a),a.height(i[1]-j-k-2*(0|parsefloat(a.css("padding"))))}var e=this,f=e.config,g=c("#"+h[0]+a);""===f.area[0]&&f.maxwidth>0&&(/msie 7/.test(navigator.useragent)&&f.btn&&g.width(g.innerwidth()),g.outerwidth()>f.maxwidth&&g.width(f.maxwidth));var i=[g.innerwidth(),g.innerheight()],j=g.find(h[1]).outerheight()||0,k=g.find("."+h[6]).outerheight()||0;switch(f.type){case 2:b("iframe");break;default:""===f.area[1]?f.fix&&i[1]>=d.height()&&(i[1]=d.height(),b("."+h[5])):b("."+h[5])}return e},g.pt.offset=function(){var a=this,b=a.config,c=a.layero,e=[c.outerwidth(),c.outerheight()],f="object"==typeof b.offset;a.offsettop=(d.height()-e[1])/2,a.offsetleft=(d.width()-e[0])/2,f?(a.offsettop=b.offset[0],a.offsetleft=b.offset[1]||a.offsetleft):"auto"!==b.offset&&(a.offsettop=b.offset,"rb"===b.offset&&(a.offsettop=d.height()-e[1],a.offsetleft=d.width()-e[0])),b.fix||(a.offsettop=/%$/.test(a.offsettop)?d.height()*parsefloat(a.offsettop)/100:parsefloat(a.offsettop),a.offsetleft=/%$/.test(a.offsetleft)?d.width()*parsefloat(a.offsetleft)/100:parsefloat(a.offsetleft),a.offsettop+=d.scrolltop(),a.offsetleft+=d.scrollleft()),c.css({top:a.offsettop,left:a.offsetleft})},g.pt.tips=function(){var a=this,b=a.config,e=a.layero,f=[e.outerwidth(),e.outerheight()],g=c(b.follow);g[0]||(g=c("body"));var i={width:g.outerwidth(),height:g.outerheight(),top:g.offset().top,left:g.offset().left},j=e.find(".layui-layer-tipsg"),k=b.tips[0];b.tips[1]||j.remove(),i.autoleft=function(){i.left+f[0]-d.width()>0?(i.tipleft=i.left+i.width-f[0],j.css({right:12,left:"auto"})):i.tipleft=i.left},i.where=[function(){i.autoleft(),i.tiptop=i.top-f[1]-10,j.removeclass("layui-layer-tipsb").addclass("layui-layer-tipst").css("border-right-color",b.tips[1])},function(){i.tipleft=i.left+i.width+10,i.tiptop=i.top,j.removeclass("layui-layer-tipsl").addclass("layui-layer-tipsr").css("border-bottom-color",b.tips[1])},function(){i.autoleft(),i.tiptop=i.top+i.height+10,j.removeclass("layui-layer-tipst").addclass("layui-layer-tipsb").css("border-right-color",b.tips[1])},function(){i.tipleft=i.left-f[0]-10,i.tiptop=i.top,j.removeclass("layui-layer-tipsr").addclass("layui-layer-tipsl").css("border-bottom-color",b.tips[1])}],i.where[k-1](),1===k?i.top-(d.scrolltop()+f[1]+16)<0&&i.where[2]():2===k?d.width()-(i.left+i.width+f[0]+16)>0||i.where[3]():3===k?i.top-d.scrolltop()+i.height+f[1]+16-d.height()>0&&i.where[0]():4===k&&f[0]+16-i.left>0&&i.where[1](),e.find("."+h[5]).css({"background-color":b.tips[1],"padding-right":b.closebtn?"30px":""}),e.css({left:i.tipleft,top:i.tiptop})},g.pt.move=function(){var a=this,b=a.config,e={sety:0,movelayer:function(){var a=e.layero,b=parseint(a.css("margin-left")),c=parseint(e.move.css("left"));0===b||(c-=b),"fixed"!==a.css("position")&&(c-=a.parent().offset().left,e.sety=0),a.css({left:c,top:parseint(e.move.css("top"))-e.sety})}},f=a.layero.find(b.move);return b.move&&f.attr("move","ok"),f.css({cursor:b.move?"move":"auto"}),c(b.move).on("mousedown",function(a){if(a.preventdefault(),"ok"===c(this).attr("move")){e.ismove=!0,e.layero=c(this).parents("."+h[0]);var f=e.layero.offset().left,g=e.layero.offset().top,i=e.layero.outerwidth()-6,j=e.layero.outerheight()-6;c("#layui-layer-moves")[0]||c("body").append('
'),e.move=c("#layui-layer-moves"),b.movetype&&e.move.css({visibility:"hidden"}),e.movex=a.pagex-e.move.position().left,e.movey=a.pagey-e.move.position().top,"fixed"!==e.layero.css("position")||(e.sety=d.scrolltop())}}),c(document).mousemove(function(a){if(e.ismove){var c=a.pagex-e.movex,f=a.pagey-e.movey;if(a.preventdefault(),!b.moveout){e.sety=d.scrolltop();var g=d.width()-e.move.outerwidth(),h=e.sety;0>c&&(c=0),c>g&&(c=g),h>f&&(f=h),f>d.height()-e.move.outerheight()+e.sety&&(f=d.height()-e.move.outerheight()+e.sety)}e.move.css({left:c,top:f}),b.movetype&&e.movelayer(),c=f=g=h=null}}).mouseup(function(){try{e.ismove&&(e.movelayer(),e.move.remove(),b.moveend&&b.moveend()),e.ismove=!1}catch(a){e.ismove=!1}}),a},g.pt.callback=function(){function a(){var a=g.cancel&&g.cancel(b.index);a===!1||f.close(b.index)}var b=this,d=b.layero,g=b.config;b.openlayer(),g.success&&(2==g.type?d.find("iframe").on("load",function(){g.success(d,b.index)}):g.success(d,b.index)),f.ie6&&b.ie6(d),d.find("."+h[6]).children("a").on("click",function(){var e=c(this).index();g["btn"+(e+1)]&&g["btn"+(e+1)](b.index,d),0===e?g.yes?g.yes(b.index,d):f.close(b.index):1===e?a():g["btn"+(e+1)]||f.close(b.index)}),d.find("."+h[7]).on("click",a),g.shadeclose&&c("#layui-layer-shade"+b.index).on("click",function(){f.close(b.index)}),d.find(".layui-layer-min").on("click",function(){f.min(b.index,g),g.min&&g.min(d)}),d.find(".layui-layer-max").on("click",function(){c(this).hasclass("layui-layer-maxmin")?(f.restore(b.index),g.restore&&g.restore(d)):(f.full(b.index,g),g.full&&g.full(d))}),g.end&&(e.end[b.index]=g.end)},e.reselect=function(){c.each(c("select"),function(a,b){var d=c(this);d.parents("."+h[0])[0]||1==d.attr("layer")&&c("."+h[0]).length<1&&d.removeattr("layer").show(),d=null})},g.pt.ie6=function(a){function b(){a.css({top:f+(e.config.fix?d.scrolltop():0)})}var e=this,f=a.offset().top;b(),d.scroll(b),c("select").each(function(a,b){var d=c(this);d.parents("."+h[0])[0]||"none"===d.css("display")||d.attr({layer:"1"}).hide(),d=null})},g.pt.openlayer=function(){var a=this;f.zindex=a.config.zindex,f.settop=function(a){var b=function(){f.zindex++,a.css("z-index",f.zindex+1)};return f.zindex=parseint(a[0].style.zindex),a.on("mousedown",b),f.zindex}},e.record=function(a){var b=[a.outerwidth(),a.outerheight(),a.position().top,a.position().left+parsefloat(a.css("margin-left"))];a.find(".layui-layer-max").addclass("layui-layer-maxmin"),a.attr({area:b})},e.rescollbar=function(a){h.html.attr("layer-full")==a&&(h.html[0].style.removeproperty?h.html[0].style.removeproperty("overflow"):h.html[0].style.removeattribute("overflow"),h.html.removeattr("layer-full"))},a.layer=f,f.getchildframe=function(a,b){return b=b||c("."+h[4]).attr("times"),c("#"+h[0]+b).find("iframe").contents().find(a)},f.getframeindex=function(a){return c("#"+a).parents("."+h[4]).attr("times")},f.iframeauto=function(a){if(a){var b=f.getchildframe("html",a).outerheight(),d=c("#"+h[0]+a),e=d.find(h[1]).outerheight()||0,g=d.find("."+h[6]).outerheight()||0;d.css({height:b+e+g}),d.find("iframe").css({height:b})}},f.iframesrc=function(a,b){c("#"+h[0]+a).find("iframe").attr("src",b)},f.style=function(a,b){var d=c("#"+h[0]+a),f=d.attr("type"),g=d.find(h[1]).outerheight()||0,i=d.find("."+h[6]).outerheight()||0;(f===e.type[1]||f===e.type[2])&&(d.css(b),f===e.type[2]&&d.find("iframe").css({height:parsefloat(b.height)-g-i}))},f.min=function(a,b){var d=c("#"+h[0]+a),g=d.find(h[1]).outerheight()||0;e.record(d),f.style(a,{width:180,height:g,overflow:"hidden"}),d.find(".layui-layer-min").hide(),"page"===d.attr("type")&&d.find(h[4]).hide(),e.rescollbar(a)},f.restore=function(a){var b=c("#"+h[0]+a),d=b.attr("area").split(",");b.attr("type");f.style(a,{width:parsefloat(d[0]),height:parsefloat(d[1]),top:parsefloat(d[2]),left:parsefloat(d[3]),overflow:"visible"}),b.find(".layui-layer-max").removeclass("layui-layer-maxmin"),b.find(".layui-layer-min").show(),"page"===b.attr("type")&&b.find(h[4]).show(),e.rescollbar(a)},f.full=function(a){var b,g=c("#"+h[0]+a);e.record(g),h.html.attr("layer-full")||h.html.css("overflow","hidden").attr("layer-full",a),cleartimeout(b),b=settimeout(function(){var b="fixed"===g.css("position");f.style(a,{top:b?0:d.scrolltop(),left:b?0:d.scrollleft(),width:d.width(),height:d.height()}),g.find(".layui-layer-min").hide()},100)},f.title=function(a,b){var d=c("#"+h[0]+(b||f.index)).find(h[1]);d.html(a)},f.close=function(a){var b=c("#"+h[0]+a),d=b.attr("type");if(b[0]){if(d===e.type[1]&&"object"===b.attr("contype")){b.children(":not(."+h[5]+")").remove();for(var g=0;2>g;g++)b.find(".layui-layer-wrap").unwrap().hide()}else{if(d===e.type[2])try{var i=c("#"+h[4]+a)[0];i.contentwindow.document.write(""),i.contentwindow.close(),b.find("."+h[5])[0].removechild(i)}catch(j){}b[0].innerhtml="",b.remove()}c("#layui-layer-moves, #layui-layer-shade"+a).remove(),f.ie6&&e.reselect(),e.rescollbar(a),c(document).off("keydown",e.enter),"function"==typeof e.end[a]&&e.end[a](),delete e.end[a]}},f.closeall=function(a){c.each(c("."+h[0]),function(){var b=c(this),d=a?b.attr("type")===a:1;d&&f.close(b.attr("times")),d=null})},e.run=function(){c=jquery,d=c(a),h.html=c("html"),f.open=function(a){var b=new g(a);return b.index}},"function"==typeof define?define(function(){return e.run(),f}):function(){e.run(),f.use("skin/layer.css")}()}(window);