layer-compiled.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  2. /*! layer-v3.1.0 Web弹层组件 MIT License http://layer.layui.com/ By 贤心 */
  3. ;!function (e, t) {
  4. "use strict";
  5. var i,
  6. n,
  7. a = e.layui && layui.define,
  8. o = { getPath: function () {
  9. var e = document.scripts,
  10. t = e[e.length - 1],
  11. i = t.src;if (!t.getAttribute("merge")) return i.substring(0, i.lastIndexOf("/") + 1);
  12. }(), config: {}, end: {}, minIndex: 0, minLeft: [], btn: ["确定", "取消"], type: ["dialog", "page", "iframe", "loading", "tips"], getStyle: function getStyle(t, i) {
  13. var n = t.currentStyle ? t.currentStyle : e.getComputedStyle(t, null);return n[n.getPropertyValue ? "getPropertyValue" : "getAttribute"](i);
  14. }, link: function link(t, i, n) {
  15. if (r.path) {
  16. var a = document.getElementsByTagName("head")[0],
  17. s = document.createElement("link");"string" == typeof i && (n = i);var l = (n || t).replace(/\.|\//g, ""),
  18. f = "layuicss-" + l,
  19. c = 0;s.rel = "stylesheet", s.href = r.path + t, s.id = f, document.getElementById(f) || a.appendChild(s), "function" == typeof i && !function u() {
  20. return ++c > 80 ? e.console && console.error("layer.css: Invalid") : void (1989 === parseInt(o.getStyle(document.getElementById(f), "width")) ? i() : setTimeout(u, 100));
  21. }();
  22. }
  23. } },
  24. r = { v: "3.1.0", ie: function () {
  25. var t = navigator.userAgent.toLowerCase();return !!(e.ActiveXObject || "ActiveXObject" in e) && ((t.match(/msie\s(\d+)/) || [])[1] || "11");
  26. }(), index: e.layer && e.layer.v ? 1e5 : 0, path: o.getPath, config: function config(e, t) {
  27. 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;
  28. }, ready: function ready(e) {
  29. var t = "layer",
  30. i = "",
  31. 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;
  32. }, alert: function alert(e, t, n) {
  33. var a = "function" == typeof t;return a && (n = t), r.open(i.extend({ content: e, yes: n }, a ? {} : t));
  34. }, confirm: function confirm(e, t, n, a) {
  35. 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));
  36. }, msg: function msg(e, n, a) {
  37. var s = "function" == typeof n,
  38. f = o.config.skin,
  39. c = (f ? f + " " + f + "-msg" : "") || "layui-layer-msg",
  40. 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 () {
  41. return n = n || {}, (n.icon === -1 || n.icon === t && !o.config.skin) && (n.skin = c + " " + (n.skin || "layui-layer-hui")), n;
  42. }()));
  43. }, load: function load(e, t) {
  44. return r.open(i.extend({ type: 3, icon: e || 0, resize: !1, shade: .01 }, t));
  45. }, tips: function tips(e, t, n) {
  46. return r.open(i.extend({ type: 4, content: [e, t], closeBtn: !1, time: 3e3, shade: !1, resize: !1, fixed: !1, maxWidth: 210 }, n));
  47. } },
  48. s = function s(e) {
  49. var t = this;t.index = ++r.index, t.config = i.extend({}, t.config, o.config, e), document.body ? t.creat() : setTimeout(function () {
  50. t.creat();
  51. }, 30);
  52. };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"], s.pt.config = { type: 0, shade: .3, fixed: !0, move: l[1], title: "信息", offset: "auto", area: "auto", closeBtn: 1, time: 0, zIndex: 19891014, maxWidth: 360, anim: 0, isOutAnim: !0, icon: -1, moveType: 1, resize: !0, scrollbar: !0, tips: 2 }, s.pt.vessel = function (e, t) {
  53. var n = this,
  54. a = n.index,
  55. r = n.config,
  56. s = r.zIndex + a,
  57. f = "object" == _typeof(r.title),
  58. c = r.maxmin && (1 === r.type || 2 === r.type),
  59. u = r.title ? '<div class="layui-layer-title" style="' + (f ? r.title[1] : "") + '">' + (f ? r.title[0] : r.title) + "</div>" : "";return r.zIndex = s, t([r.shade ? '<div class="layui-layer-shade" id="layui-layer-shade' + a + '" times="' + a + '" style="' + ("z-index:" + (s - 1) + "; ") + '"></div>' : "", '<div class="' + l[0] + (" layui-layer-" + o.type[r.type]) + (0 != r.type && 2 != r.type || r.shade ? "" : " layui-layer-border") + " " + (r.skin || "") + '" id="' + l[0] + a + '" type="' + o.type[r.type] + '" times="' + a + '" showtime="' + r.time + '" conType="' + (e ? "object" : "string") + '" style="z-index: ' + s + "; width:" + r.area[0] + ";height:" + r.area[1] + (r.fixed ? "" : ";position:absolute;") + '">' + (e && 2 != r.type ? "" : u) + '<div id="' + (r.id || "") + '" class="layui-layer-content' + (0 == r.type && r.icon !== -1 ? " layui-layer-padding" : "") + (3 == r.type ? " layui-layer-loading" + r.icon : "") + '">' + (0 == r.type && r.icon !== -1 ? '<i class="layui-layer-ico layui-layer-ico' + r.icon + '"></i>' : "") + (1 == r.type && e ? "" : r.content || "") + '</div><span class="layui-layer-setwin">' + function () {
  60. var e = c ? '<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>' : "";return r.closeBtn && (e += '<a class="layui-layer-ico ' + l[7] + " " + l[7] + (r.title ? r.closeBtn : 4 == r.type ? "1" : "2") + '" href="javascript:;"></a>'), e;
  61. }() + "</span>" + (r.btn ? function () {
  62. var e = "";"string" == typeof r.btn && (r.btn = [r.btn]);for (var t = 0, i = r.btn.length; t < i; t++) {
  63. e += '<a class="' + l[6] + t + '">' + r.btn[t] + "</a>";
  64. }return '<div class="' + l[6] + " layui-layer-btn-" + (r.btnAlign || "") + '">' + e + "</div>";
  65. }() : "") + (r.resize ? '<span class="layui-layer-resize"></span>' : "") + "</div>"], u, i('<div class="layui-layer-move"></div>')), n;
  66. }, s.pt.creat = function () {
  67. var e = this,
  68. t = e.config,
  69. a = e.index,
  70. s = t.content,
  71. f = "object" == (typeof s === "undefined" ? "undefined" : _typeof(s)),
  72. c = i("body");if (!t.id || !i("#" + t.id)[0]) {
  73. 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:
  74. t.btn = "btn" in t ? t.btn : o.btn[0], r.closeAll("dialog");break;case 2:
  75. var s = t.content = f ? t.content : [t.content || "http://layer.layui.com", "auto"];t.content = '<iframe scrolling="' + (t.content[1] || "auto") + '" allowtransparency="true" id="' + l[4] + a + '" name="' + l[4] + a + '" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="' + t.content[0] + '"></iframe>';break;case 3:
  76. delete t.title, delete t.closeBtn, t.icon === -1 && 0 === t.icon, r.closeAll("loading");break;case 4:
  77. f || (t.content = [t.content, "body"]), t.follow = t.content[1], t.content = t.content[0] + '<i class="layui-layer-TipsG"></i>', 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) {
  78. c.append(n[0]), f ? function () {
  79. 2 == t.type || 4 == t.type ? function () {
  80. i("body").append(n[1]);
  81. }() : function () {
  82. 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));
  83. }();
  84. }() : c.append(n[1]), i(".layui-layer-move")[0] || c.append(o.moveElem = u), e.layero = i("#" + l[0] + a), t.scrollbar || l.html.css("overflow", "hidden").attr("layer-full", a);
  85. }).auto(a), i("#layui-layer-shade" + e.index).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() : e.offset(), t.fixed && n.on("resize", function () {
  86. e.offset(), (/^\d+%$/.test(t.area[0]) || /^\d+%$/.test(t.area[1])) && e.auto(a), 4 == t.type && e.tips();
  87. }), t.time <= 0 || setTimeout(function () {
  88. r.close(e.index);
  89. }, t.time), e.move().callback(), l.anim[t.anim]) {
  90. var u = "layer-anim " + l.anim[t.anim];e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend", function () {
  91. i(this).removeClass(u);
  92. });
  93. }t.isOutAnim && e.layero.data("isOutAnim", !0);
  94. }
  95. }, s.pt.auto = function (e) {
  96. var t = this,
  97. a = t.config,
  98. 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()],
  99. f = o.find(l[1]).outerHeight() || 0,
  100. c = o.find("." + l[6]).outerHeight() || 0,
  101. u = function u(e) {
  102. e = o.find(e), e.height(s[1] - f - c - 2 * (0 | parseFloat(e.css("padding-top"))));
  103. };switch (a.type) {case 2:
  104. u("iframe");break;default:
  105. "" === 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;
  106. }, s.pt.offset = function () {
  107. var e = this,
  108. t = e.config,
  109. i = e.layero,
  110. a = [i.outerWidth(), i.outerHeight()],
  111. 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 });
  112. }, s.pt.tips = function () {
  113. var e = this,
  114. t = e.config,
  115. a = e.layero,
  116. o = [a.outerWidth(), a.outerHeight()],
  117. 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 },
  118. f = a.find(".layui-layer-TipsG"),
  119. c = t.tips[0];t.tips[1] || f.remove(), s.autoLeft = function () {
  120. 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;
  121. }, s.where = [function () {
  122. 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]);
  123. }, function () {
  124. 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]);
  125. }, function () {
  126. 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]);
  127. }, function () {
  128. 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]);
  129. }], 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) });
  130. }, s.pt.move = function () {
  131. var e = this,
  132. t = e.config,
  133. a = i(document),
  134. s = e.layero,
  135. l = s.find(t.move),
  136. f = s.find(".layui-layer-resize"),
  137. c = {};return t.move && l.css("cursor", "move"), l.on("mousedown", function (e) {
  138. 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());
  139. }), f.on("mousedown", function (e) {
  140. e.preventDefault(), c.resizeStart = !0, c.offset = [e.clientX, e.clientY], c.area = [s.outerWidth(), s.outerHeight()], o.moveElem.css("cursor", "se-resize").show();
  141. }), a.on("mousemove", function (i) {
  142. if (c.moveStart) {
  143. var a = i.clientX - c.offset[0],
  144. o = i.clientY - c.offset[1],
  145. l = "fixed" === s.css("position");if (i.preventDefault(), c.stX = l ? 0 : n.scrollLeft(), c.stY = l ? 0 : n.scrollTop(), !t.moveOut) {
  146. var f = n.width() - s.outerWidth() + c.stX,
  147. 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);
  148. }s.css({ left: a, top: o });
  149. }if (t.resize && c.resizeStart) {
  150. var a = i.clientX - c.offset[0],
  151. 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);
  152. }
  153. }).on("mouseup", function (e) {
  154. c.moveStart && (delete c.moveStart, o.moveElem.hide(), t.moveEnd && t.moveEnd(s)), c.resizeStart && (delete c.resizeStart, o.moveElem.hide());
  155. }), e;
  156. }, s.pt.callback = function () {
  157. function e() {
  158. var e = a.cancel && a.cancel(t.index, n);e === !1 || r.close(t.index);
  159. }var t = this,
  160. n = t.layero,
  161. a = t.config;t.openLayer(), a.success && (2 == a.type ? n.find("iframe").on("load", function () {
  162. a.success(n, t.index);
  163. }) : a.success(n, t.index)), 6 == r.ie && t.IE6(n), n.find("." + l[6]).children("a").on("click", function () {
  164. 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 {
  165. var o = a["btn" + (e + 1)] && a["btn" + (e + 1)](t.index, n);o === !1 || r.close(t.index);
  166. }
  167. }), n.find("." + l[7]).on("click", e), a.shadeClose && i("#layui-layer-shade" + t.index).on("click", function () {
  168. r.close(t.index);
  169. }), n.find(".layui-layer-min").on("click", function () {
  170. var e = a.min && a.min(n);e === !1 || r.min(t.index, a);
  171. }), n.find(".layui-layer-max").on("click", function () {
  172. i(this).hasClass("layui-layer-maxmin") ? (r.restore(t.index), a.restore && a.restore(n)) : (r.full(t.index, a), setTimeout(function () {
  173. a.full && a.full(n);
  174. }, 100));
  175. }), a.end && (o.end[t.index] = a.end);
  176. }, o.reselect = function () {
  177. i.each(i("select"), function (e, t) {
  178. var n = i(this);n.parents("." + l[0])[0] || 1 == n.attr("layer") && i("." + l[0]).length < 1 && n.removeAttr("layer").show(), n = null;
  179. });
  180. }, s.pt.IE6 = function (e) {
  181. i("select").each(function (e, t) {
  182. var n = i(this);n.parents("." + l[0])[0] || "none" === n.css("display") || n.attr({ layer: "1" }).hide(), n = null;
  183. });
  184. }, s.pt.openLayer = function () {
  185. var e = this;r.zIndex = e.config.zIndex, r.setTop = function (e) {
  186. var t = function t() {
  187. r.zIndex++, e.css("z-index", r.zIndex + 1);
  188. };return r.zIndex = parseInt(e[0].style.zIndex), e.on("mousedown", t), r.zIndex;
  189. };
  190. }, o.record = function (e) {
  191. 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 });
  192. }, o.rescollbar = function (e) {
  193. 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"));
  194. }, e.layer = r, r.getChildFrame = function (e, t) {
  195. return t = t || i("." + l[4]).attr("times"), i("#" + l[0] + t).find("iframe").contents().find(e);
  196. }, r.getFrameIndex = function (e) {
  197. return i("#" + e).parents("." + l[4]).attr("times");
  198. }, r.iframeAuto = function (e) {
  199. if (e) {
  200. var t = r.getChildFrame("html", e).outerHeight(),
  201. n = i("#" + l[0] + e),
  202. a = n.find(l[1]).outerHeight() || 0,
  203. o = n.find("." + l[6]).outerHeight() || 0;n.css({ height: t + a + o }), n.find("iframe").css({ height: t });
  204. }
  205. }, r.iframeSrc = function (e, t) {
  206. i("#" + l[0] + e).find("iframe").attr("src", t);
  207. }, r.style = function (e, t, n) {
  208. var a = i("#" + l[0] + e),
  209. r = a.find(".layui-layer-content"),
  210. s = a.attr("type"),
  211. f = a.find(l[1]).outerHeight() || 0,
  212. 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")) }));
  213. }, r.min = function (e, t) {
  214. var a = i("#" + l[0] + e),
  215. s = a.find(l[1]).outerHeight() || 0,
  216. f = a.attr("minLeft") || 181 * o.minIndex + "px",
  217. c = a.css("position");o.record(a), o.minLeft[0] && (f = o.minLeft[0], o.minLeft.shift()), a.attr("position", c), r.style(e, { width: 180, height: s, left: f, top: n.height() - s, position: "fixed", overflow: "hidden" }, !0), a.find(".layui-layer-min").hide(), "page" === a.attr("type") && a.find(l[4]).hide(), o.rescollbar(e), a.attr("minLeft") || o.minIndex++, a.attr("minLeft", f);
  218. }, r.restore = function (e) {
  219. var t = i("#" + l[0] + e),
  220. n = t.attr("area").split(",");t.attr("type");r.style(e, { width: parseFloat(n[0]), height: parseFloat(n[1]), top: parseFloat(n[2]), left: parseFloat(n[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);
  221. }, r.full = function (e) {
  222. var t,
  223. 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 () {
  224. 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();
  225. }, 100);
  226. }, r.title = function (e, t) {
  227. var n = i("#" + l[0] + (t || r.index)).find(l[1]);n.html(e);
  228. }, r.close = function (e) {
  229. var t = i("#" + l[0] + e),
  230. n = t.attr("type"),
  231. a = "layer-anim-close";if (t[0]) {
  232. var s = "layui-layer-wrap",
  233. f = function f() {
  234. if (n === o.type[1] && "object" === t.attr("conType")) {
  235. t.children(":not(." + l[5] + ")").remove();for (var a = t.find("." + s), r = 0; r < 2; r++) {
  236. a.unwrap();
  237. }a.css("display", a.data("display")).removeClass(s);
  238. } else {
  239. if (n === o.type[2]) try {
  240. var f = i("#" + l[4] + e)[0];f.contentWindow.document.write(""), f.contentWindow.close(), t.find("." + l[5])[0].removeChild(f);
  241. } catch (c) {}t[0].innerHTML = "", t.remove();
  242. }"function" == typeof o.end[e] && o.end[e](), delete o.end[e];
  243. };t.data("isOutAnim") && t.addClass("layer-anim " + a), i("#layui-layer-moves, #layui-layer-shade" + e).remove(), 6 == r.ie && o.reselect(), o.rescollbar(e), t.attr("minLeft") && (o.minIndex--, o.minLeft.push(t.attr("minLeft"))), r.ie && r.ie < 10 || !t.data("isOutAnim") ? f() : setTimeout(function () {
  244. f();
  245. }, 200);
  246. }
  247. }, r.closeAll = function (e) {
  248. i.each(i("." + l[0]), function () {
  249. var t = i(this),
  250. n = e ? t.attr("type") === e : 1;n && r.close(t.attr("times")), n = null;
  251. });
  252. };var f = r.cache || {},
  253. c = function c(e) {
  254. return f.skin ? " " + f.skin + " " + f.skin + "-" + e : "";
  255. };r.prompt = function (e, t) {
  256. var a = "";if (e = e || {}, "function" == typeof e && (t = e), e.area) {
  257. var o = e.area;a = 'style="width: ' + o[0] + "; height: " + o[1] + ';"', delete e.area;
  258. }var s,
  259. l = 2 == e.formType ? '<textarea class="layui-layer-input"' + a + ">" + (e.value || "") + "</textarea>" : function () {
  260. return '<input type="' + (1 == e.formType ? "password" : "text") + '" class="layui-layer-input" value="' + (e.value || "") + '">';
  261. }(),
  262. f = e.success;return delete e.success, r.open(i.extend({ type: 1, btn: ["&#x786E;&#x5B9A;", "&#x53D6;&#x6D88;"], content: l, skin: "layui-layer-prompt" + c("prompt"), maxWidth: n.width(), success: function success(e) {
  263. s = e.find(".layui-layer-input"), s.focus(), "function" == typeof f && f(e);
  264. }, resize: !1, yes: function yes(i) {
  265. var n = s.val();"" === n ? s.focus() : n.length > (e.maxlength || 500) ? r.tips("&#x6700;&#x591A;&#x8F93;&#x5165;" + (e.maxlength || 500) + "&#x4E2A;&#x5B57;&#x6570;", s, { tips: 1 }) : t && t(n, i, s);
  266. } }, e));
  267. }, r.tab = function (e) {
  268. e = e || {};var t = e.tab || {},
  269. n = "layui-this",
  270. a = e.success;return delete e.success, r.open(i.extend({ type: 1, skin: "layui-layer-tab" + c("tab"), resize: !1, title: function () {
  271. var e = t.length,
  272. i = 1,
  273. a = "";if (e > 0) for (a = '<span class="' + n + '">' + t[0].title + "</span>"; i < e; i++) {
  274. a += "<span>" + t[i].title + "</span>";
  275. }return a;
  276. }(), content: '<ul class="layui-layer-tabmain">' + function () {
  277. var e = t.length,
  278. i = 1,
  279. a = "";if (e > 0) for (a = '<li class="layui-layer-tabli ' + n + '">' + (t[0].content || "no content") + "</li>"; i < e; i++) {
  280. a += '<li class="layui-layer-tabli">' + (t[i].content || "no content") + "</li>";
  281. }return a;
  282. }() + "</ul>", success: function success(t) {
  283. var o = t.find(".layui-layer-title").children(),
  284. r = t.find(".layui-layer-tabmain").children();o.on("mousedown", function (t) {
  285. t.stopPropagation ? t.stopPropagation() : t.cancelBubble = !0;var a = i(this),
  286. o = a.index();a.addClass(n).siblings().removeClass(n), r.eq(o).show().siblings().hide(), "function" == typeof e.change && e.change(o);
  287. }), "function" == typeof a && a(t);
  288. } }, e));
  289. }, r.photos = function (t, n, a) {
  290. function o(e, t, i) {
  291. var n = new Image();return n.src = e, n.complete ? t(n) : (n.onload = function () {
  292. n.onload = null, t(n);
  293. }, void (n.onerror = function (e) {
  294. n.onerror = null, i(e);
  295. }));
  296. }var s = {};if (t = t || {}, t.photos) {
  297. var l = t.photos.constructor === Object,
  298. f = l ? t.photos : {},
  299. u = f.data || [],
  300. d = f.start || 0;s.imgIndex = (0 | d) + 1, t.img = t.img || "img";var y = t.success;if (delete t.success, l) {
  301. if (0 === u.length) return r.msg("&#x6CA1;&#x6709;&#x56FE;&#x7247;");
  302. } else {
  303. var p = i(t.photos),
  304. h = function h() {
  305. u = [], p.find(t.img).each(function (e) {
  306. 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") });
  307. });
  308. };if (h(), 0 === u.length) return;if (n || p.on("click", t.img, function () {
  309. var e = i(this),
  310. n = e.attr("layer-index");r.photos(i.extend(t, { photos: { start: n, data: u, tab: t.tab }, full: t.full }), !0), h();
  311. }), !n) return;
  312. }s.imgprev = function (e) {
  313. s.imgIndex--, s.imgIndex < 1 && (s.imgIndex = u.length), s.tabimg(e);
  314. }, s.imgnext = function (e, t) {
  315. s.imgIndex++, s.imgIndex > u.length && (s.imgIndex = 1, t) || s.tabimg(e);
  316. }, s.keyup = function (e) {
  317. if (!s.end) {
  318. var t = e.keyCode;e.preventDefault(), 37 === t ? s.imgprev(!0) : 39 === t ? s.imgnext(!0) : 27 === t && r.close(s.index);
  319. }
  320. }, s.tabimg = function (e) {
  321. if (!(u.length <= 1)) return f.start = s.imgIndex - 1, r.close(s.index), r.photos(t, !0, e);
  322. }, s.event = function () {
  323. s.bigimg.hover(function () {
  324. s.imgsee.show();
  325. }, function () {
  326. s.imgsee.hide();
  327. }), s.bigimg.find(".layui-layer-imgprev").on("click", function (e) {
  328. e.preventDefault(), s.imgprev();
  329. }), s.bigimg.find(".layui-layer-imgnext").on("click", function (e) {
  330. e.preventDefault(), s.imgnext();
  331. }), i(document).on("keyup", s.keyup);
  332. }, s.loadi = r.load(1, { shade: !("shade" in t) && .9, scrollbar: !1 }), o(u[d].src, function (n) {
  333. r.close(s.loadi), s.index = r.open(i.extend({ type: 1, id: "layui-layer-photos", area: function () {
  334. var a = [n.width, n.height],
  335. o = [i(e).width() - 100, i(e).height() - 100];if (!t.full && (a[0] > o[0] || a[1] > o[1])) {
  336. 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]);
  337. }return [a[0] + "px", a[1] + "px"];
  338. }(), title: !1, shade: .9, shadeClose: !0, closeBtn: !1, move: ".layui-layer-phimg img", moveType: 1, scrollbar: !1, moveOut: !0, isOutAnim: !1, skin: "layui-layer-photos" + c("photos"), content: '<div class="layui-layer-phimg"><img src="' + u[d].src + '" alt="' + (u[d].alt || "") + '" layer-pid="' + u[d].pid + '"><div class="layui-layer-imgsee">' + (u.length > 1 ? '<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:' + (a ? "block" : "") + '"><span class="layui-layer-imgtit"><a href="javascript:;">' + (u[d].alt || "") + "</a><em>" + s.imgIndex + "/" + u.length + "</em></span></div></div></div>", success: function success(e, i) {
  339. s.bigimg = e.find(".layui-layer-phimg"), s.imgsee = e.find(".layui-layer-imguide,.layui-layer-imgbar"), s.event(e), t.tab && t.tab(u[d], e), "function" == typeof y && y(e);
  340. }, end: function end() {
  341. s.end = !0, i(document).off("keyup", s.keyup);
  342. } }, t));
  343. }, function () {
  344. r.close(s.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 yes() {
  345. u.length > 1 && s.imgnext(!0, !0);
  346. } });
  347. });
  348. }
  349. }, o.run = function (t) {
  350. i = t, n = i(e), l.html = i("html"), r.open = function (e) {
  351. var t = new s(e);return t.index;
  352. };
  353. }, e.layui && layui.define ? (r.ready(), layui.define("jquery", function (t) {
  354. r.path = layui.cache.dir, o.run(layui.$), e.layer = r, t("layer", r);
  355. })) : "function" == typeof define && define.amd ? define(["jquery"], function () {
  356. return o.run(e.jQuery), r;
  357. }) : function () {
  358. o.run(e.jQuery), r.ready();
  359. }();
  360. }(window);
  361. //# sourceMappingURL=layer-compiled.js.map