/*! layer-v2.4 弹层组件 license lgpl http://layer.layui.com/ by 贤心 */ !function(e,t){"use strict";var i,n,o,a,r,l={getpath:function(){var e=document.scripts,t=e[e.length-1],i=t.src;if(!t.getattribute("merge"))return i.substring(0,i.lastindexof("/")+1)}(),enter:function(e){13===e.keycode&&e.preventdefault()},config:{},end:{},btn:["确定","取消"],type:["dialog","page","iframe","loading","tips"]},s={v:"2.4",ie6:!!e.activexobject&&!e.xmlhttprequest,index:0,path:l.getpath,config:function(e,t){var n=0;return e=e||{},s.cache=l.config=i.extend(l.config,e),s.path=l.config.path||s.path,"string"==typeof e.extend&&(e.extend=[e.extend]),s.use("skin/layer.css",e.extend&&e.extend.length>0?function i(){var o=e.extend;s.use(o[o[n]?n:n-1],n'+(s?a.title[0]:a.title)+"":"";return a.zindex=r,t([a.shade?'
':"",'
'+(e&&2!=a.type?"":f)+'
'+(0==a.type&&-1!==a.icon?'':"")+(1==a.type&&e?"":a.content||"")+'
'+function(){var e=c?'':"";return a.closebtn&&(e+=''),e}()+""+(a.btn?function(){var e,t,i="";for("string"==typeof a.btn&&(a.btn=[a.btn]),e=0,t=a.btn.length;t>e;e++)i+=''+a.btn[e]+"";return'
'+i+"
"}():"")+"
"],f),i},c.pt.creat=function(){var e=this,t=e.config,a=e.index,r=t.content,c="object"==typeof r;if(!i("#"+t.id)[0]){switch("string"==typeof t.area&&(t.area="auto"===t.area?["",""]:[t.area,""]),t.type){case 0:t.btn="btn"in t?t.btn:l.btn[0],s.closeall("dialog");break;case 2:r=t.content=c?t.content:[t.content||"http://layer.layui.com","auto"],t.content='';break;case 3:t.title=!1,t.closebtn=!1,-1===t.icon&&0===t.icon,s.closeall("loading");break;case 4:c||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'',t.title=!1,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsmore||s.closeall("tips")}e.vessel(c,function(n,l){i("body").append(n[0]),c?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){r.parents("."+o[0])[0]||(r.show().addclass("layui-layer-wrap").wrap(n[1]),i("#"+o[0]+a).find("."+o[5]).before(l))}()}():i("body").append(n[1]),e.layero=i("#"+o[0]+a),t.scrollbar||o.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),2==t.type&&s.ie6&&e.layero.find("iframe").attr("src",r[0]),i(document).off("keydown",l.enter).on("keydown",l.enter),e.layero.on("keydown",function(e){i(document).off("keydown",l.enter)}),4==t.type?e.tips():e.offset(),t.fix&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||settimeout(function(){s.close(e.index)},t.time),e.move().callback(),o.anim[t.shift]&&e.layero.addclass(o.anim[t.shift])}},c.pt.auto=function(e){function t(e){e=f.find(e),e.height(a[1]-r-l-2*(0|parsefloat(e.css("padding"))))}var a,r,l,s=this,c=s.config,f=i("#"+o[0]+e);switch(""===c.area[0]&&c.maxwidth>0&&(/msie 7/.test(navigator.useragent)&&c.btn&&f.width(f.innerwidth()),f.outerwidth()>c.maxwidth&&f.width(c.maxwidth)),a=[f.innerwidth(),f.innerheight()],r=f.find(o[1]).outerheight()||0,l=f.find("."+o[6]).outerheight()||0,c.type){case 2:t("iframe");break;default:""===c.area[1]?c.fix&&a[1]>=n.height()&&(a[1]=n.height(),t("."+o[5])):t("."+o[5])}return s},c.pt.offset=function(){var e=this,t=e.config,i=e.layero,o=[i.outerwidth(),i.outerheight()],a="object"==typeof t.offset;e.offsettop=(n.height()-o[1])/2,e.offsetleft=(n.width()-o[0])/2,a?(e.offsettop=t.offset[0],e.offsetleft=t.offset[1]||e.offsetleft):"auto"!==t.offset&&(e.offsettop=t.offset,"rb"===t.offset&&(e.offsettop=n.height()-o[1],e.offsetleft=n.width()-o[0])),t.fix||(e.offsettop=/%$/.test(e.offsettop)?n.height()*parsefloat(e.offsettop)/100:parsefloat(e.offsettop),e.offsetleft=/%$/.test(e.offsetleft)?n.width()*parsefloat(e.offsetleft)/100:parsefloat(e.offsetleft),e.offsettop+=n.scrolltop(),e.offsetleft+=n.scrollleft()),i.css({top:e.offsettop,left:e.offsetleft})},c.pt.tips=function(){var e,t,a,r=this,l=r.config,s=r.layero,c=[s.outerwidth(),s.outerheight()],f=i(l.follow);f[0]||(f=i("body")),e={width:f.outerwidth(),height:f.outerheight(),top:f.offset().top,left:f.offset().left},t=s.find(".layui-layer-tipsg"),a=l.tips[0],l.tips[1]||t.remove(),e.autoleft=function(){e.left+c[0]-n.width()>0?(e.tipleft=e.left+e.width-c[0],t.css({right:12,left:"auto"})):e.tipleft=e.left},e.where=[function(){e.autoleft(),e.tiptop=e.top-c[1]-10,t.removeclass("layui-layer-tipsb").addclass("layui-layer-tipst").css("border-right-color",l.tips[1])},function(){e.tipleft=e.left+e.width+10,e.tiptop=e.top,t.removeclass("layui-layer-tipsl").addclass("layui-layer-tipsr").css("border-bottom-color",l.tips[1])},function(){e.autoleft(),e.tiptop=e.top+e.height+10,t.removeclass("layui-layer-tipst").addclass("layui-layer-tipsb").css("border-right-color",l.tips[1])},function(){e.tipleft=e.left-c[0]-10,e.tiptop=e.top,t.removeclass("layui-layer-tipsr").addclass("layui-layer-tipsl").css("border-bottom-color",l.tips[1])}],e.where[a-1](),1===a?e.top-(n.scrolltop()+c[1]+16)<0&&e.where[2]():2===a?n.width()-(e.left+e.width+c[0]+16)>0||e.where[3]():3===a?e.top-n.scrolltop()+e.height+c[1]+16-n.height()>0&&e.where[0]():4===a&&c[0]+16-e.left>0&&e.where[1](),s.find("."+o[5]).css({"background-color":l.tips[1],"padding-right":l.closebtn?"30px":""}),s.css({left:e.tipleft-(l.fix?n.scrollleft():0),top:e.tiptop-(l.fix?n.scrolltop():0)})},c.pt.move=function(){var e=this,t=e.config,a={sety:0,movelayer:function(){var e=a.layero,t=parseint(e.css("margin-left")),i=parseint(a.move.css("left"));0===t||(i-=t),"fixed"!==e.css("position")&&(i-=e.parent().offset().left,a.sety=0),e.css({left:i,top:parseint(a.move.css("top"))-a.sety})}},r=e.layero.find(t.move);return t.move&&r.attr("move","ok"),r.css({cursor:t.move?"move":"auto"}),i(t.move).on("mousedown",function(e){if(e.preventdefault(),"ok"===i(this).attr("move")){a.ismove=!0,a.layero=i(this).parents("."+o[0]);var r=a.layero.offset().left,l=a.layero.offset().top,s=a.layero.outerwidth()-6,c=a.layero.outerheight()-6;i("#layui-layer-moves")[0]||i("body").append('
'),a.move=i("#layui-layer-moves"),t.movetype&&a.move.css({visibility:"hidden"}),a.movex=e.pagex-a.move.position().left,a.movey=e.pagey-a.move.position().top,"fixed"!==a.layero.css("position")||(a.sety=n.scrolltop())}}),i(document).mousemove(function(e){var i,o,r,l;a.ismove&&(i=e.pagex-a.movex,o=e.pagey-a.movey,e.preventdefault(),t.moveout||(a.sety=n.scrolltop(),r=n.width()-a.move.outerwidth(),l=a.sety,0>i&&(i=0),i>r&&(i=r),l>o&&(o=l),o>n.height()-a.move.outerheight()+a.sety&&(o=n.height()-a.move.outerheight()+a.sety)),a.move.css({left:i,top:o}),t.movetype&&a.movelayer(),i=o=r=l=null)}).mouseup(function(){try{a.ismove&&(a.movelayer(),a.move.remove(),t.moveend&&t.moveend()),a.ismove=!1}catch(e){a.ismove=!1}}),e},c.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||s.close(t.index)}var t=this,n=t.layero,a=t.config;t.openlayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index)}):a.success(n,t.index)),s.ie6&&t.ie6(n),n.find("."+o[6]).children("a").on("click",function(){var e,o=i(this).index();0===o?a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):s.close(t.index):(e=a["btn"+(o+1)]&&a["btn"+(o+1)](t.index,n),e===!1||s.close(t.index))}),n.find("."+o[7]).on("click",e),a.shadeclose&&i("#layui-layer-shade"+t.index).on("click",function(){s.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n);e===!1||s.min(t.index,a)}),n.find(".layui-layer-max").on("click",function(){i(this).hasclass("layui-layer-maxmin")?(s.restore(t.index),a.restore&&a.restore(n)):(s.full(t.index,a),settimeout(function(){a.full&&a.full(n)},100))}),a.end&&(l.end[t.index]=a.end)},l.reselect=function(){i.each(i("select"),function(e,t){var n=i(this);n.parents("."+o[0])[0]||1==n.attr("layer")&&i("."+o[0]).length<1&&n.removeattr("layer").show(),n=null})},c.pt.ie6=function(e){function t(){e.css({top:r+(a.config.fix?n.scrolltop():0)})}var a=this,r=e.offset().top;t(),n.scroll(t),i("select").each(function(e,t){var n=i(this);n.parents("."+o[0])[0]||"none"===n.css("display")||n.attr({layer:"1"}).hide(),n=null})},c.pt.openlayer=function(){var e=this;s.zindex=e.config.zindex,s.settop=function(e){var t=function(){s.zindex++,e.css("z-index",s.zindex+1)};return s.zindex=parseint(e[0].style.zindex),e.on("mousedown",t),s.zindex}},l.record=function(e){var t=[e.width(),e.height(),e.position().top,e.position().left+parsefloat(e.css("margin-left"))];e.find(".layui-layer-max").addclass("layui-layer-maxmin"),e.attr({area:t})},l.rescollbar=function(e){o.html.attr("layer-full")==e&&(o.html[0].style.removeproperty?o.html[0].style.removeproperty("overflow"):o.html[0].style.removeattribute("overflow"),o.html.removeattr("layer-full"))},e.layer=s,s.getchildframe=function(e,t){return t=t||i("."+o[4]).attr("times"),i("#"+o[0]+t).find("iframe").contents().find(e)},s.getframeindex=function(e){return i("#"+e).parents("."+o[4]).attr("times")},s.iframeauto=function(e){if(e){var t=s.getchildframe("html",e).outerheight(),n=i("#"+o[0]+e),a=n.find(o[1]).outerheight()||0,r=n.find("."+o[6]).outerheight()||0;n.css({height:t+a+r}),n.find("iframe").css({height:t})}},s.iframesrc=function(e,t){i("#"+o[0]+e).find("iframe").attr("src",t)},s.style=function(e,t){var n=i("#"+o[0]+e),a=n.attr("type"),r=n.find(o[1]).outerheight()||0,s=n.find("."+o[6]).outerheight()||0;(a===l.type[1]||a===l.type[2])&&(n.css(t),a===l.type[2]&&n.find("iframe").css({height:parsefloat(t.height)-r-s}))},s.min=function(e,t){var n=i("#"+o[0]+e),a=n.find(o[1]).outerheight()||0;l.record(n),s.style(e,{width:180,height:a,overflow:"hidden"}),n.find(".layui-layer-min").hide(),"page"===n.attr("type")&&n.find(o[4]).hide(),l.rescollbar(e)},s.restore=function(e){var t=i("#"+o[0]+e),n=t.attr("area").split(",");t.attr("type"),s.style(e,{width:parsefloat(n[0]),height:parsefloat(n[1]),top:parsefloat(n[2]),left:parsefloat(n[3]),overflow:"visible"}),t.find(".layui-layer-max").removeclass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===t.attr("type")&&t.find(o[4]).show(),l.rescollbar(e)},s.full=function(e){var t,a=i("#"+o[0]+e);l.record(a),o.html.attr("layer-full")||o.html.css("overflow","hidden").attr("layer-full",e),cleartimeout(t),t=settimeout(function(){var t="fixed"===a.css("position");s.style(e,{top:t?0:n.scrolltop(),left:t?0:n.scrollleft(),width:n.width(),height:n.height()}),a.find(".layui-layer-min").hide()},100)},s.title=function(e,t){var n=i("#"+o[0]+(t||s.index)).find(o[1]);n.html(e)},s.close=function(e){var t,n,a=i("#"+o[0]+e),r=a.attr("type");if(a[0]){if(r===l.type[1]&&"object"===a.attr("contype"))for(a.children(":not(."+o[5]+")").remove(),t=0;2>t;t++)a.find(".layui-layer-wrap").unwrap().hide();else{if(r===l.type[2])try{n=i("#"+o[4]+e)[0],n.contentwindow.document.write(""),n.contentwindow.close(),a.find("."+o[5])[0].removechild(n)}catch(e){}a[0].innerhtml="",a.remove()}i("#layui-layer-moves, #layui-layer-shade"+e).remove(),s.ie6&&l.reselect(),l.rescollbar(e),i(document).off("keydown",l.enter),"function"==typeof l.end[e]&&l.end[e](),delete l.end[e]}},s.closeall=function(e){i.each(i("."+o[0]),function(){var t=i(this),n=e?t.attr("type")===e:1;n&&s.close(t.attr("times")),n=null})},a=s.cache||{},r=function(e){return a.skin?" "+a.skin+" "+a.skin+"-"+e:""},s.prompt=function(e,t){e=e||{},"function"==typeof e&&(t=e);var n,o=2==e.formtype?'":function(){return''}();return s.open(i.extend({btn:["确定","取消"],content:o,skin:"layui-layer-prompt"+r("prompt"),success:function(e){n=e.find(".layui-layer-input"),n.focus()},yes:function(i){var o=n.val();""===o?n.focus():o.length>(e.maxlength||500)?s.tips("最多输入"+(e.maxlength||500)+"个字数",n,{tips:1}):t&&t(o,i,n)}},e))},s.tab=function(e){e=e||{};var t=e.tab||{};return s.open(i.extend({type:1,skin:"layui-layer-tab"+r("tab"),title:function(){var e=t.length,i=1,n="";if(e>0)for(n=''+t[0].title+"";e>i;i++)n+=""+t[i].title+"";return n}(),content:'",success:function(t){var n=t.find(".layui-layer-title").children(),o=t.find(".layui-layer-tabmain").children();n.on("mousedown",function(t){t.stoppropagation?t.stoppropagation():t.cancelbubble=!0;var n=i(this),a=n.index();n.addclass("layui-layer-tabnow").siblings().removeclass("layui-layer-tabnow"),o.eq(a).show().siblings().hide(),"function"==typeof e.change&&e.change(a)})}},e))},s.photos=function(t,n,o){function a(e,t,i){var n=new image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var l,c,f,u,d,y,p={};if(t=t||{},t.photos){if(l=t.photos.constructor===object,c=l?t.photos:{},f=c.data||[],u=c.start||0,p.imgindex=(0|u)+1,t.img=t.img||"img",l){if(0===f.length)return s.msg("没有图片")}else{if(d=i(t.photos),y=function(){f=[],d.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),f.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})},y(),0===f.length)return;if(n||d.on("click",t.img,function(){var e=i(this),n=e.attr("layer-index");s.photos(i.extend(t,{photos:{start:n,data:f,tab:t.tab},full:t.full}),!0),y()}),!n)return}p.imgprev=function(e){p.imgindex--,p.imgindex<1&&(p.imgindex=f.length),p.tabimg(e)},p.imgnext=function(e,t){p.imgindex++,p.imgindex>f.length&&(p.imgindex=1,t)||p.tabimg(e)},p.keyup=function(e){if(!p.end){var t=e.keycode;e.preventdefault(),37===t?p.imgprev(!0):39===t?p.imgnext(!0):27===t&&s.close(p.index)}},p.tabimg=function(e){f.length<=1||(c.start=p.imgindex-1,s.close(p.index),s.photos(t,!0,e))},p.event=function(){p.bigimg.hover(function(){p.imgsee.show()},function(){p.imgsee.hide()}),p.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventdefault(),p.imgprev()}),p.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventdefault(),p.imgnext()}),i(document).on("keyup",p.keyup)},p.loadi=s.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),a(f[u].src,function(n){s.close(p.loadi),p.index=s.open(i.extend({type:1,area:function(){var o=[n.width,n.height],a=[i(e).width()-50,i(e).height()-50];return!t.full&&o[0]>a[0]&&(o[0]=a[0],o[1]=o[0]*n.height/n.width),[o[0]+"px",o[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"+r("photos"),content:'
'+(f[u].alt||
'+(f.length>1?'':"")+'
'+(f[u].alt||"")+""+p.imgindex+"/"+f.length+"
",success:function(e,i){p.bigimg=e.find(".layui-layer-phimg"),p.imgsee=e.find(".layui-layer-imguide,.layui-layer-imgbar"),p.event(e),t.tab&&t.tab(f[u],e)},end:function(){p.end=!0,i(document).off("keyup",p.keyup)}},t))},function(){s.close(p.loadi),s.msg("当前图片地址异常
是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){f.length>1&&p.imgnext(!0,!0)}})})}},l.run=function(){i=jquery,n=i(e),o.html=i("html"),s.open=function(e){var t=new c(e);return t.index}},"function"==typeof define?define(function(){return l.run(),s}):function(){l.run(),s.use("skin/layer.css")}()}(window);