/*! layer-v3.5.1 web 通用弹出层组件 mit license */ ; ! function(e, t) { "use strict"; var layerconfig; //layer配置的全局变量 var configarray = []; //存储layer每次创建的配置 var i, n, a = e.layui && layui.define, o = { getpath: function() { var t = document.currentscript ? document.currentscript.src : function() { for (var e, t = document.scripts, i = t.length - 1, n = i; n > 0; n--) if ("interactive" === t[n].readystate) { e = t[n].src; break } return e || t[i].src }(), i = e.layui_global || {}; return i.layer_dir || t.substring(0, t.lastindexof("/") + 1) }(), config: {}, end: {}, minindex: 0, minleft: [], btn: ["确定", "取消"], type: ["dialog", "page", "iframe", "loading", "tips"], getstyle: function(t, i) { var n = t.currentstyle ? t.currentstyle : e.getcomputedstyle(t, null); return n[n.getpropertyvalue ? "getpropertyvalue" : "getattribute"](i) }, link: function(t, i, n) { if (r.path) { var a = document.getelementsbytagname("head")[0], s = document.createelement("link"); "string" == typeof i && (n = i); var l = (n || t).replace(/\.|\//g, ""), f = "layuicss-" + l, c = "creating", u = 0; s.rel = "stylesheet", s.href = r.path + t, s.id = f, document.getelementbyid(f) || a.appendchild(s), "function" == typeof i && ! function d(t) { var n = 100, a = document.getelementbyid(f); return ++u > 1e4 / n ? e.console && console.error(l + ".css: invalid") : void(1989 === parseint(o.getstyle(a, "width")) ? (t === c && a.removeattribute("lay-status"), a.getattribute("lay-status") === c ? settimeout(d, n) : i()) : (a.setattribute("lay-status", c), settimeout(function() { d(c) }, n))) }() } } }, r = { v: "3.5.1", ie: function() { var t = navigator.useragent.tolowercase(); return !!(e.activexobject || "activexobject" in e) && ((t.match(/msie\s(\d+)/) || [])[1] || "11") }(), index: e.layer && e.layer.v ? 1e5 : 0, path: o.getpath, config: function(e, t) { return e = e || {}, r.cache = o.config = i.extend({}, o.config, e), r.path = o.config.path || r.path, "string" == typeof e.extend && (e.extend = [e.extend]), o.config.path && r.ready(), e.extend ? (a ? layui.addcss("modules/layer/" + e.extend) : o.link("theme/" + e.extend), this) : this }, ready: function(e) { var t = "layer", i = "", n = (a ? "modules/layer/" : "theme/") + "default/layer.css?v=" + r.v + i; return a ? layui.addcss(n, e, t) : o.link(n, e, t), this }, alert: function(e, t, n) { var a = "function" == typeof t; return a && (n = t), r.open(i.extend({ content: e, yes: n }, a ? {} : t)) }, confirm: function(e, t, n, a) { var s = "function" == typeof t; return s && (a = n, n = t), r.open(i.extend({ content: e, btn: o.btn, yes: n, btn2: a }, s ? {} : t)) }, msg: function(e, n, a) { var s = "function" == typeof n, f = o.config.skin, c = (f ? f + " " + f + "-msg" : "") || "layui-layer-msg", u = l.anim.length - 1; return s && (a = n), r.open(i.extend({ content: e, time: 3e3, shade: !1, skin: c, title: !1, closebtn: !1, btn: !1, resize: !1, end: a }, s && !o.config.skin ? { skin: c + " layui-layer-hui", anim: u } : function() { return n = n || {}, (n.icon === -1 || n.icon === t && !o.config.skin) && (n.skin = c + " " + (n.skin || "layui-layer-hui")), n }())) }, load: function(e, t) { return r.open(i.extend({ type: 3, icon: e || 0, resize: !1, shade: .01 }, t)) }, tips: function(e, t, n) { return r.open(i.extend({ type: 4, content: [e, t], closebtn: !1, time: 3e3, shade: !1, resize: !1, fixed: !1, maxwidth: 260 }, n)) } }, s = function(e) { var t = this, a = function() { t.creat() }; t.index = ++r.index, t.config.maxwidth = i(n).width() - 30, t.config = i.extend({}, t.config, o.config, e), document.body ? a() : settimeout(function() { a() }, 30) }; s.pt = s.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","layer-anim-07","layer-anim-08","layer-anim-09","layer-anim-10"], l.shade = "layui-layer-shade", l.move = "layui-layer-move", s.pt.config = { type: 0, shade: .3, fixed: !0, move: l[1], title: "信息", offset: "auto", area: "auto", closebtn: 1, time: 0, zindex: 100, maxwidth: 360, anim: 0, isoutanim: !0, minstack: !0, icon: -1, movetype: 1, resize: !0, scrollbar: !0, tips: 2, isdrawer:false, placement:'r' }, s.pt.vessel = function(e, t) { var n = this, a = n.index, r = n.config, s = r.zindex + a, f = "object" == typeof r.title, c = r.maxmin && (1 === r.type || 2 === r.type), u = r.title ? '
' + (f ? r.title[0] : r.title) + "
" : ""; return r.zindex = s, t([r.shade ? '
' : "", '
' + (e && 2 != r.type ? "" : u) + '
' + (0 == r.type && r.icon !== -1 ? '' : "") + (1 == r.type && e ? "" : r.content || "") + '
' + function() { var e = c ? '' : ""; return r.closebtn && (e += ''), e }() + "" + (r.btn ? function() { var e = ""; var drawerclass = ""; "string" == typeof r.btn && (r.btn = [r.btn]); if(layerconfig.isdrawer){ drawerclass = " layui-layer-btn-drawer" } for (var t = 0, i = r.btn.length; t < i; t++) e += '' + r.btn[t] + ""; return '
' + e + "
" }() : "") + (r.resize ? '' : "") + "
" ], u, i('
')), n }, s.pt.creat = function() { var e = this, t = e.config, a = e.index, s = t.content, f = "object" == typeof s, c = i("body"); layerconfig = e.config configarray.push(t) if(t.isdrawer){ switch(t.placement){ case 'r': t.anim = 7 break; case 'l': t.anim = 8 break; case 't': t.anim = 9 break; case 'b': t.anim = 10 break; } t.offset = t.placement } if (!t.id || !i("#" + t.id)[0]) { switch ("string" == typeof t.area && (t.area = "auto" === t.area ? ["", ""] : [t.area, ""]), t.shift && (t.anim = t.shift), 6 == r.ie && (t.fixed = !1), t.type) { case 0: t.btn = "btn" in t ? t.btn : o.btn[0], r.closeall("dialog"); break; case 2: var s = t.content = f ? t.content : [t.content || "", "auto"]; t.content = ''; break; case 3: delete t.title, delete t.closebtn, t.icon === -1 && 0 === t.icon, r.closeall("loading"); break; case 4: f || (t.content = [t.content, "body"]), t.follow = t.content[1], t.content = t.content[0] + '', delete t.title, t.tips = "object" == typeof t.tips ? t.tips : [t.tips, !0], t.tipsmore || r.closeall("tips") } if (e.vessel(f, function(n, r, u) { c.append(n[0]), f ? function() { 2 == t.type || 4 == t.type ? function() { i("body").append(n[1]) }() : function() { s.parents("." + l[0])[0] || (s.data("display", s.css("display")).show().addclass("layui-layer-wrap").wrap(n[1]), i("#" + l[0] + a).find("." + l[5]).before(r)) }() }() : c.append(n[1]), i("#" + l.move)[0] || c.append(o.moveelem = u), e.layero = i("#" + l[0] + a), e.shadeo = i("#" + l.shade + a), t.scrollbar || l.html.css("overflow", "hidden").attr("layer-full", a) }).auto(a), e.shadeo.css({ "background-color": t.shade[1] || "#000", opacity: t.shade[0] || t.shade }), 2 == t.type && 6 == r.ie && e.layero.find("iframe").attr("src", s[0]), 4 == t.type ? e.tips() : function() { e.offset(), parseint(o.getstyle(document.getelementbyid(l.move), "z-index")) || function() { e.layero.css("visibility", "hidden"), r.ready(function() { e.offset(), e.layero.css("visibility", "visible") }) }() }(), t.fixed && 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() { r.close(e.index) }, t.time), e.move().callback(), l.anim[t.anim]) { var u = "layer-anim " + l.anim[t.anim]; e.layero.addclass(u).one("webkitanimationend mozanimationend msanimationend oanimationend animationend", function() { i(this).removeclass(u) }) } t.isoutanim && e.layero.data("isoutanim", !0) } }, s.pt.auto = function(e) { var t = this, a = t.config, o = i("#" + l[0] + e); "" === a.area[0] && a.maxwidth > 0 && (r.ie && r.ie < 8 && a.btn && o.width(o.innerwidth()), o.outerwidth() > a.maxwidth && o.width(a.maxwidth)); var s = [o.innerwidth(), o.innerheight()], f = o.find(l[1]).outerheight() || 0, c = o.find("." + l[6]).outerheight() || 0, u = function(e) { e = o.find(e), e.height(s[1] - f - c - 2 * (0 | parsefloat(e.css("padding-top")))) }; switch (a.type) { case 2: u("iframe"); break; default: "" === a.area[1] ? a.maxheight > 0 && o.outerheight() > a.maxheight ? (s[1] = a.maxheight, u("." + l[5])) : a.fixed && s[1] >= n.height() && (s[1] = n.height(), u("." + l[5])) : u("." + l[5]) } return t }, s.pt.offset = function() { var e = this, t = e.config, i = e.layero, a = [i.outerwidth(), i.outerheight()], o = "object" == typeof t.offset; e.offsettop = (n.height() - a[1]) / 2, e.offsetleft = (n.width() - a[0]) / 2, o ? (e.offsettop = t.offset[0], e.offsetleft = t.offset[1] || e.offsetleft) : "auto" !== t.offset && ("t" === t.offset ? e.offsettop = 0 : "r" === t.offset ? e.offsetleft = n.width() - a[0] : "b" === t.offset ? e.offsettop = n.height() - a[1] : "l" === t.offset ? e.offsetleft = 0 : "lt" === t.offset ? (e.offsettop = 0, e.offsetleft = 0) : "lb" === t.offset ? (e.offsettop = n.height() - a[1], e.offsetleft = 0) : "rt" === t.offset ? (e.offsettop = 0, e.offsetleft = n.width() - a[0]) : "rb" === t.offset ? (e.offsettop = n.height() - a[1], e.offsetleft = n.width() - a[0]) : e.offsettop = t.offset), t.fixed || (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.attr("minleft") && (e.offsettop = n.height() - (i.find(l[1]).outerheight() || 0), e.offsetleft = i.css("left")), i.css({ top: e.offsettop, left: e.offsetleft }) }, s.pt.tips = function() { var e = this, t = e.config, a = e.layero, o = [a.outerwidth(), a.outerheight()], r = i(t.follow); r[0] || (r = i("body")); var s = { width: r.outerwidth(), height: r.outerheight(), top: r.offset().top, left: r.offset().left }, f = a.find(".layui-layer-tipsg"), c = t.tips[0]; t.tips[1] || f.remove(), s.autoleft = function() { s.left + o[0] - n.width() > 0 ? (s.tipleft = s.left + s.width - o[0], f.css({ right: 12, left: "auto" })) : s.tipleft = s.left }, s.where = [function() { s.autoleft(), s.tiptop = s.top - o[1] - 10, f.removeclass("layui-layer-tipsb").addclass("layui-layer-tipst").css("border-right-color", t.tips[1]) }, function() { s.tipleft = s.left + s.width + 10, s.tiptop = s.top, f.removeclass("layui-layer-tipsl").addclass("layui-layer-tipsr").css("border-bottom-color", t.tips[1]) }, function() { s.autoleft(), s.tiptop = s.top + s.height + 10, f.removeclass("layui-layer-tipst").addclass("layui-layer-tipsb").css("border-right-color", t.tips[1]) }, function() { s.tipleft = s.left - o[0] - 10, s.tiptop = s.top, f.removeclass("layui-layer-tipsr").addclass("layui-layer-tipsl").css("border-bottom-color", t.tips[1]) } ], s.where[c - 1](), 1 === c ? s.top - (n.scrolltop() + o[1] + 16) < 0 && s.where[2]() : 2 === c ? n.width() - (s.left + s.width + o[0] + 16) > 0 || s.where[3]() : 3 === c ? s.top - n.scrolltop() + s.height + o[1] + 16 - n.height() > 0 && s.where[0]() : 4 === c && o[0] + 16 - s.left > 0 && s.where[1](), a.find("." + l[5]).css({ "background-color": t.tips[1], "padding-right": t.closebtn ? "30px" : "" }), a.css({ left: s.tipleft - (t.fixed ? n.scrollleft() : 0), top: s.tiptop - (t.fixed ? n.scrolltop() : 0) }) }, s.pt.move = function() { var e = this, t = e.config, a = i(document), s = e.layero, l = s.find(t.move), f = s.find(".layui-layer-resize"), c = {}; return t.move && l.css("cursor", "move"), l.on("mousedown", function(e) { e.preventdefault(), t.move && (c.movestart = !0, c.offset = [e.clientx - parsefloat(s.css("left")), e.clienty - parsefloat(s.css("top"))], o.moveelem.css("cursor", "move").show()) }), f.on("mousedown", function(e) { e.preventdefault(), c.resizestart = !0, c.offset = [e.clientx, e.clienty], c.area = [s.outerwidth(), s.outerheight()], o.moveelem.css("cursor", "se-resize").show() }), a.on("mousemove", function(i) { if (c.movestart) { var a = i.clientx - c.offset[0], o = i.clienty - c.offset[1], l = "fixed" === s.css("position"); if (i.preventdefault(), c.stx = l ? 0 : n.scrollleft(), c.sty = l ? 0 : n.scrolltop(), !t.moveout) { var f = n.width() - s.outerwidth() + c.stx, u = n.height() - s.outerheight() + c.sty; a < c.stx && (a = c.stx), a > f && (a = f), o < c.sty && (o = c.sty), o > u && (o = u) } s.css({ left: a, top: o }) } if (t.resize && c.resizestart) { var a = i.clientx - c.offset[0], o = i.clienty - c.offset[1]; i.preventdefault(), r.style(e.index, { width: c.area[0] + a, height: c.area[1] + o }), c.isresize = !0, t.resizing && t.resizing(s) } }).on("mouseup", function(e) { c.movestart && (delete c.movestart, o.moveelem.hide(), t.moveend && t.moveend(s)), c.resizestart && (delete c.resizestart, o.moveelem.hide()) }), e }, s.pt.callback = function() { function e() { var e = a.cancel && a.cancel(t.index, n); e === !1 || r.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)), 6 == r.ie && t.ie6(n), n.find("." + l[6]).children("a").on("click", function() { var e = i(this).index(); if (0 === e) a.yes ? a.yes(t.index, n) : a.btn1 ? a.btn1(t.index, n) : r.close(t.index); else { var o = a["btn" + (e + 1)] && a["btn" + (e + 1)](t.index, n); o === !1 || r.close(t.index) } }), n.find("." + l[7]).on("click", e), a.shadeclose && t.shadeo.on("click", function() { r.close(t.index) }), n.find(".layui-layer-min").on("click", function() { var e = a.min && a.min(n, t.index); e === !1 || r.min(t.index, a) }), n.find(".layui-layer-max").on("click", function() { i(this).hasclass("layui-layer-maxmin") ? (r.restore(t.index), a.restore && a.restore(n, t.index)) : (r.full(t.index, a), settimeout(function() { a.full && a.full(n, t.index) }, 100)) }), a.end && (o.end[t.index] = a.end) }, o.reselect = function() { i.each(i("select"), function(e, t) { var n = i(this); n.parents("." + l[0])[0] || 1 == n.attr("layer") && i("." + l[0]).length < 1 && n.removeattr("layer").show(), n = null }) }, s.pt.ie6 = function(e) { i("select").each(function(e, t) { var n = i(this); n.parents("." + l[0])[0] || "none" === n.css("display") || n.attr({ layer: "1" }).hide(), n = null }) }, s.pt.openlayer = function() { var e = this; r.zindex = e.config.zindex, r.settop = function(e) { var t = function() { r.zindex++, e.css("z-index", r.zindex + 1) }; return r.zindex = parseint(e[0].style.zindex), e.on("mousedown", t), r.zindex } }, o.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 }) }, o.rescollbar = function(e) { l.html.attr("layer-full") == e && (l.html[0].style.removeproperty ? l.html[0].style.removeproperty("overflow") : l.html[0].style.removeattribute("overflow"), l.html.removeattr("layer-full")) }, e.layer = r, r.getchildframe = function(e, t) { return t = t || i("." + l[4]).attr("times"), i("#" + l[0] + t).find("iframe").contents().find(e) }, r.getframeindex = function(e) { return i("#" + e).parents("." + l[4]).attr("times") }, r.iframeauto = function(e) { if (e) { var t = r.getchildframe("html", e).outerheight(), n = i("#" + l[0] + e), a = n.find(l[1]).outerheight() || 0, o = n.find("." + l[6]).outerheight() || 0; n.css({ height: t + a + o }), n.find("iframe").css({ height: t }) } }, r.iframesrc = function(e, t) { i("#" + l[0] + e).find("iframe").attr("src", t) }, r.style = function(e, t, n) { var a = i("#" + l[0] + e), r = a.find(".layui-layer-content"), s = a.attr("type"), f = a.find(l[1]).outerheight() || 0, c = a.find("." + l[6]).outerheight() || 0; a.attr("minleft"); s !== o.type[3] && s !== o.type[4] && (n || (parsefloat(t.width) <= 260 && (t.width = 260), parsefloat(t.height) - f - c <= 64 && (t.height = 64 + f + c)), a.css(t), c = a.find("." + l[6]).outerheight(), s === o.type[2] ? a.find("iframe").css({ height: parsefloat(t.height) - f - c }) : r.css({ height: parsefloat(t.height) - f - c - parsefloat(r.css("padding-top")) - parsefloat(r.css("padding-bottom")) })) }, r.min = function(e, t) { t = t || {}; var a = i("#" + l[0] + e), s = i("#" + l.shade + e), f = a.find(l[1]).outerheight() || 0, c = a.attr("minleft") || 181 * o.minindex + "px", u = a.css("position"), d = { width: 180, height: f, position: "fixed", overflow: "hidden" }; o.record(a), o.minleft[0] && (c = o.minleft[0], o.minleft.shift()), t.minstack && (d.left = c, d.top = n.height() - f, a.attr("minleft") || o.minindex++, a.attr("minleft", c)), a.attr("position", u), r.style(e, d, !0), a.find(".layui-layer-min").hide(), "page" === a.attr("type") && a.find(l[4]).hide(), o.rescollbar(e), s.hide() }, r.restore = function(e) { var t = i("#" + l[0] + e), n = i("#" + l.shade + e), a = t.attr("area").split(","); t.attr("type"); r.style(e, { width: parsefloat(a[0]), height: parsefloat(a[1]), top: parsefloat(a[2]), left: parsefloat(a[3]), position: t.attr("position"), overflow: "visible" }, !0), t.find(".layui-layer-max").removeclass("layui-layer-maxmin"), t.find(".layui-layer-min").show(), "page" === t.attr("type") && t.find(l[4]).show(), o.rescollbar(e), n.show() }, r.full = function(e) { var t, a = i("#" + l[0] + e); o.record(a), l.html.attr("layer-full") || l.html.css("overflow", "hidden").attr("layer-full", e), cleartimeout(t), t = settimeout(function() { var t = "fixed" === a.css("position"); r.style(e, { top: t ? 0 : n.scrolltop(), left: t ? 0 : n.scrollleft(), width: n.width(), height: n.height() }, !0), a.find(".layui-layer-min").hide() }, 100) }, r.title = function(e, t) { var n = i("#" + l[0] + (t || r.index)).find(l[1]); n.html(e) }, r.close = function(e, t) { var n = i("#" + l[0] + e), a = n.attr("type"), s = "layer-anim-close",currentlayer; currentlayer = configarray[e-1]==undefined ? configarray[0]:configarray[e-1]; if(currentlayer && currentlayer.isdrawer == true){ switch(currentlayer.placement){ case('r'): s = "layer-anim-right-close" break; case('l'): s = "layer-anim-left-close" break; case('t'): s = "layer-anim-top-close" break; case('b'): s = "layer-anim-bottom-close" break; } } if (n[0]) { var f = "layui-layer-wrap", c = function() { if (a === o.type[1] && "object" === n.attr("contype")) { n.children(":not(." + l[5] + ")").remove(); for (var r = n.find("." + f), s = 0; s < 2; s++) r.unwrap(); r.css("display", r.data("display")).removeclass(f) } else { if (a === o.type[2]) try { var c = i("#" + l[4] + e)[0]; c.contentwindow.document.write(""), c.contentwindow.close(), n.find("." + l[5])[0].removechild(c) } catch (u) {} n[0].innerhtml = "", n.remove() } "function" == typeof o.end[e] && o.end[e](), delete o.end[e], "function" == typeof t && t() }; n.data("isoutanim") && n.addclass("layer-anim " + s), i("#layui-layer-moves, #" + l.shade + e).remove(), 6 == r.ie && o.reselect(), o.rescollbar(e), n.attr("minleft") && (o.minindex--, o.minleft.push(n.attr("minleft"))), r.ie && r.ie < 10 || !n.data("isoutanim") ? c() : settimeout(function() { c() }, 200) } }, r.closeall = function(e, t) { "function" == typeof e && (t = e, e = null); var n = i("." + l[0]); i.each(n, function(a) { var o = i(this), s = e ? o.attr("type") === e : 1; s && r.close(o.attr("times"), a === n.length - 1 ? t : null), s = null }), 0 === n.length && "function" == typeof t && t() }; var f = r.cache || {}, c = function(e) { return f.skin ? " " + f.skin + " " + f.skin + "-" + e : "" }; r.prompt = function(e, t) { var a = ""; if (e = e || {}, "function" == typeof e && (t = e), e.area) { var o = e.area; a = 'style="width: ' + o[0] + "; height: " + o[1] + ';"', delete e.area } var s, l = 2 == e.formtype ? '" : function() { return '' }(), f = e.success; return delete e.success, r.open(i.extend({ type: 1, btn: ["确定", "取消"], content: l, skin: "layui-layer-prompt" + c("prompt"), maxwidth: n.width(), success: function(t) { s = t.find(".layui-layer-input"), s.val(e.value || "").focus(), "function" == typeof f && f(t) }, resize: !1, yes: function(i) { var n = s.val(); "" === n ? s.focus() : n.length > (e.maxlength || 500) ? r.tips("最多输入" + (e.maxlength || 500) + "个字数", s, { tips: 1 }) : t && t(n, i, s) } }, e)) }, r.tab = function(e) { e = e || {}; var t = e.tab || {}, n = "layui-this", a = e.success; return delete e.success, r.open(i.extend({ type: 1, skin: "layui-layer-tab" + c("tab"), resize: !1, title: function() { var e = t.length, i = 1, a = ""; if (e > 0) for (a = '' + t[0].title + ""; i < e; i++) a += "" + t[i].title + ""; return a }(), content: '", success: function(t) { var o = t.find(".layui-layer-title").children(), r = t.find(".layui-layer-tabmain").children(); o.on("mousedown", function(t) { t.stoppropagation ? t.stoppropagation() : t.cancelbubble = !0; var a = i(this), o = a.index(); a.addclass(n).siblings().removeclass(n), r.eq(o).show().siblings().hide(), "function" == typeof e.change && e.change(o) }), "function" == typeof a && a(t) } }, e)) }, r.photos = function(t, n, a) { function o(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 s = {}; if (t = t || {}, t.photos) { var l = !("string" == typeof t.photos || t.photos instanceof i), f = l ? t.photos : {}, u = f.data || [], d = f.start || 0; s.imgindex = (0 | d) + 1, t.img = t.img || "img"; var y = t.success; if (delete t.success, l) { if (0 === u.length) return r.msg("没有图片") } else { var p = i(t.photos), h = function() { u = [], p.find(t.img).each(function(e) { var t = i(this); t.attr("layer-index", e), u.push({ alt: t.attr("alt"), pid: t.attr("layer-pid"), src: t.attr("layer-src") || t.attr("src"), thumb: t.attr("src") }) }) }; if (h(), 0 === u.length) return; if (n || p.on("click", t.img, function() { h(); var e = i(this), n = e.attr("layer-index"); r.photos(i.extend(t, { photos: { start: n, data: u, tab: t.tab }, full: t.full }), !0) }), !n) return } s.imgprev = function(e) { s.imgindex--, s.imgindex < 1 && (s.imgindex = u.length), s.tabimg(e) }, s.imgnext = function(e, t) { s.imgindex++, s.imgindex > u.length && (s.imgindex = 1, t) || s.tabimg(e) }, s.keyup = function(e) { if (!s.end) { var t = e.keycode; e.preventdefault(), 37 === t ? s.imgprev(!0) : 39 === t ? s.imgnext(!0) : 27 === t && r.close(s.index) } }, s.tabimg = function(e) { if (!(u.length <= 1)) return f.start = s.imgindex - 1, r.close(s.index), r.photos(t, !0, e) }, s.event = function() { s.bigimg.find(".layui-layer-imgprev").on("click", function(e) { e.preventdefault(), s.imgprev(!0) }), s.bigimg.find(".layui-layer-imgnext").on("click", function(e) { e.preventdefault(), s.imgnext(!0) }), i(document).on("keyup", s.keyup) }, s.loadi = r.load(1, { shade: !("shade" in t) && .9, scrollbar: !1 }), o(u[d].src, function(n) { r.close(s.loadi), a && (t.anim = -1), s.index = r.open(i.extend({ type: 1, id: "layui-layer-photos", area: function() { var a = [n.width, n.height], o = [i(e).width() - 100, i(e).height() - 100]; if (!t.full && (a[0] > o[0] || a[1] > o[1])) { var r = [a[0] / o[0], a[1] / o[1]]; r[0] > r[1] ? (a[0] = a[0] / r[0], a[1] = a[1] / r[0]) : r[0] < r[1] && (a[0] = a[0] / r[1], a[1] = a[1] / r[1]) } return [a[0] + "px", a[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" + c("photos"), content: '
' + (u[d].alt || ' + function() { return u.length > 1 ? '
' + (u[d].alt || "") + "" + s.imgindex + " / " + u.length + "
" : "" }() + "
", success: function(e, i) { s.bigimg = e.find(".layui-layer-phimg"), s.imgsee = e.find(".layui-layer-imgbar"), s.event(e), t.tab && t.tab(u[d], e), "function" == typeof y && y(e) }, end: function() { s.end = !0, i(document).off("keyup", s.keyup) } }, t)) }, function() { r.close(s.loadi), r.msg("当前图片地址异常
是否继续查看下一张?", { time: 3e4, btn: ["下一张", "不看了"], yes: function() { u.length > 1 && s.imgnext(!0, !0) } }) }) } }, o.run = function(t) { i = t, n = i(e), l.html = i("html"), r.open = function(e) { var t = new s(e); return t.index } }, e.layui && layui.define ? (r.ready(), layui.define("jquery", function(t) { r.path = layui.cache.dir, o.run(layui.$), e.layer = r, t("layer", r) })) : "function" == typeof define && define.amd ? define(["jquery"], function() { return o.run(e.jquery), r }) : function() { r.ready(), o.run(e.jquery) }() }(window);