layer-xiugai

layer 修改

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greatest.deepsurf.us/scripts/519530/1495106/layer-xiugai.js

  1. /*! layer-v3.5.1 Web 通用弹出层组件 MIT License */ ;
  2. ! function(e, t) {
  3. "use strict";
  4. var i, n, a = e.layui && layui.define,
  5. o = {
  6. getPath: function() {
  7. var t = document.currentScript ? document.currentScript.src : function() {
  8. for (var e, t = document.scripts, i = t.length - 1, n = i; n > 0; n--)
  9. if ("interactive" === t[n].readyState) {
  10. e = t[n].src;
  11. break
  12. } return e || t[i].src
  13. }(),
  14. i = e.LAYUI_GLOBAL || {};
  15. return i.layer_dir || t.substring(0, t.lastIndexOf("/") + 1)
  16. }(),
  17. config: {},
  18. end: {},
  19. minIndex: 0,
  20. minLeft: [],
  21. btn: ["确定", "取消"],
  22. type: ["dialog", "page", "iframe", "loading", "tips"],
  23. getStyle: function(t, i) {
  24. var n = t.currentStyle ? t.currentStyle : e.getComputedStyle(t, null);
  25. return n[n.getPropertyValue ? "getPropertyValue" : "getAttribute"](i)
  26. },
  27. link: function(t, i, n) {
  28. if (r.path="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/layer/3.5.1/") {
  29. var a = document.getElementsByTagName("head")[0],
  30. s = document.createElement("link");
  31. "string" == typeof i && (n = i);
  32. var l = (n || t).replace(/\.|\//g, ""),
  33. f = "layuicss-" + l,
  34. c = "creating",
  35. u = 0;
  36. s.rel = "stylesheet", s.href = r.path + t, s.id = f, document.getElementById(f) || a.appendChild(s), "function" == typeof i && ! function d(t) {
  37. var n = 100,
  38. a = document.getElementById(f);
  39. 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() {
  40. d(c)
  41. }, n)))
  42. }()
  43. }
  44. }
  45. },
  46. r = {
  47. v: "3.5.1",
  48. ie: function() {
  49. var t = navigator.userAgent.toLowerCase();
  50. return !!(e.ActiveXObject || "ActiveXObject" in e) && ((t.match(/msie\s(\d+)/) || [])[1] || "11")
  51. }(),
  52. index: e.layer && e.layer.v ? 1e5 : 0,
  53. path: o.getPath,
  54. config: function(e, t) {
  55. 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
  56. },
  57. ready: function(e) {
  58. var t = "layer",
  59. i = "",
  60. n = (a ? "modules/layer/" : "theme/") + "default/layer.css?v=" + r.v + i;
  61. return a ? layui.addcss(n, e, t) : o.link(n, e, t), this
  62. },
  63. alert: function(e, t, n) {
  64. var a = "function" == typeof t;
  65. return a && (n = t), r.open(i.extend({
  66. content: e,
  67. yes: n
  68. }, a ? {} : t))
  69. },
  70. confirm: function(e, t, n, a) {
  71. var s = "function" == typeof t;
  72. return s && (a = n, n = t), r.open(i.extend({
  73. content: e,
  74. btn: o.btn,
  75. yes: n,
  76. btn2: a
  77. }, s ? {} : t))
  78. },
  79. msg: function(e, n, a) {
  80. var s = "function" == typeof n,
  81. f = o.config.skin,
  82. c = (f ? f + " " + f + "-msg" : "") || "layui-layer-msg",
  83. u = l.anim.length - 1;
  84. return s && (a = n), r.open(i.extend({
  85. content: e,
  86. time: 3e3,
  87. shade: !1,
  88. skin: c,
  89. title: !1,
  90. closeBtn: !1,
  91. btn: !1,
  92. resize: !1,
  93. end: a
  94. }, s && !o.config.skin ? {
  95. skin: c + " layui-layer-hui",
  96. anim: u
  97. } : function() {
  98. return n = n || {}, (n.icon === -1 || n.icon === t && !o.config.skin) && (n.skin = c + " " + (n.skin || "layui-layer-hui")), n
  99. }()))
  100. },
  101. load: function(e, t) {
  102. return r.open(i.extend({
  103. type: 3,
  104. icon: e || 0,
  105. resize: !1,
  106. shade: .01
  107. }, t))
  108. },
  109. tips: function(e, t, n) {
  110. return r.open(i.extend({
  111. type: 4,
  112. content: [e, t],
  113. closeBtn: !1,
  114. time: 3e3,
  115. shade: !1,
  116. resize: !1,
  117. fixed: !1,
  118. maxWidth: 260
  119. }, n))
  120. }
  121. },
  122. s = function(e) {
  123. var t = this,
  124. a = function() {
  125. t.creat()
  126. };
  127. 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() {
  128. a()
  129. }, 30)
  130. };
  131. s.pt = s.prototype;
  132. 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"];
  133. l.anim = ["layer-anim-00", "layer-anim-01", "layer-anim-02", "layer-anim-03", "layer-anim-04", "layer-anim-05", "layer-anim-06"], l.SHADE = "layui-layer-shade", l.MOVE = "layui-layer-move", s.pt.config = {
  134. type: 0,
  135. shade: .3,
  136. fixed: !0,
  137. move: l[1],
  138. title: "信息",
  139. offset: "auto",
  140. area: "auto",
  141. closeBtn: 1,
  142. time: 0,
  143. zIndex: 19891014,
  144. maxWidth: 360,
  145. anim: 0,
  146. isOutAnim: !0,
  147. minStack: !0,
  148. icon: -1,
  149. moveType: 1,
  150. resize: !0,
  151. scrollbar: !0,
  152. tips: 2
  153. }, s.pt.vessel = function(e, t) {
  154. var n = this,
  155. a = n.index,
  156. r = n.config,
  157. s = r.zIndex + a,
  158. f = "object" == typeof r.title,
  159. c = r.maxmin && (1 === r.type || 2 === r.type),
  160. u = r.title ? '<div class="layui-layer-title" style="' + (f ? r.title[1] : "") + '">' + (f ? r.title[0] : r.title) + "</div>" : "";
  161. return r.zIndex = s, t([r.shade ? '<div class="' + l.SHADE + '" id="' + l.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] + ";position:" + (r.fixed ? "fixed;" : "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() {
  162. var e = c ? '<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>' : "";
  163. 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
  164. }() + "</span>" + (r.btn ? function() {
  165. var e = "";
  166. "string" == typeof r.btn && (r.btn = [r.btn]);
  167. for (var t = 0, i = r.btn.length; t < i; t++) e += '<a class="' + l[6] + t + '">' + r.btn[t] + "</a>";
  168. return '<div class="' + l[6] + " layui-layer-btn-" + (r.btnAlign || "") + '">' + e + "</div>"
  169. }() : "") + (r.resize ? '<span class="layui-layer-resize"></span>' : "") + "</div>"], u, i('<div class="' + l.MOVE + '" id="' + l.MOVE + '"></div>')), n
  170. }, s.pt.creat = function() {
  171. var e = this,
  172. t = e.config,
  173. a = e.index,
  174. s = t.content,
  175. f = "object" == typeof s,
  176. c = i("body");
  177. if (!t.id || !i("#" + t.id)[0]) {
  178. 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) {
  179. case 0:
  180. t.btn = "btn" in t ? t.btn : o.btn[0], r.closeAll("dialog");
  181. break;
  182. case 2:
  183. var s = t.content = f ? t.content : [t.content || "", "auto"];
  184. 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>';
  185. break;
  186. case 3:
  187. delete t.title, delete t.closeBtn, t.icon === -1 && 0 === t.icon, r.closeAll("loading");
  188. break;
  189. case 4:
  190. 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")
  191. }
  192. if (e.vessel(f, function(n, r, u) {
  193. c.append(n[0]), f ? function() {
  194. 2 == t.type || 4 == t.type ? function() {
  195. i("body").append(n[1])
  196. }() : function() {
  197. 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))
  198. }()
  199. }() : 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)
  200. }).auto(a), e.shadeo.css({
  201. "background-color": t.shade[1] || "#000",
  202. opacity: t.shade[0] || t.shade
  203. }), 2 == t.type && 6 == r.ie && e.layero.find("iframe").attr("src", s[0]), 4 == t.type ? e.tips() : function() {
  204. e.offset(), parseInt(o.getStyle(document.getElementById(l.MOVE), "z-index")) || function() {
  205. e.layero.css("visibility", "hidden"), r.ready(function() {
  206. e.offset(), e.layero.css("visibility", "visible")
  207. })
  208. }()
  209. }(), t.fixed && n.on("resize", function() {
  210. e.offset(), (/^\d+%$/.test(t.area[0]) || /^\d+%$/.test(t.area[1])) && e.auto(a), 4 == t.type && e.tips()
  211. }), t.time <= 0 || setTimeout(function() {
  212. r.close(e.index)
  213. }, t.time), e.move().callback(), l.anim[t.anim]) {
  214. var u = "layer-anim " + l.anim[t.anim];
  215. e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend", function() {
  216. i(this).removeClass(u)
  217. })
  218. }
  219. t.isOutAnim && e.layero.data("isOutAnim", !0)
  220. }
  221. }, s.pt.auto = function(e) {
  222. var t = this,
  223. a = t.config,
  224. o = i("#" + l[0] + e);
  225. "" === 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));
  226. var s = [o.innerWidth(), o.innerHeight()],
  227. f = o.find(l[1]).outerHeight() || 0,
  228. c = o.find("." + l[6]).outerHeight() || 0,
  229. u = function(e) {
  230. e = o.find(e), e.height(s[1] - f - c - 2 * (0 | parseFloat(e.css("padding-top"))))
  231. };
  232. switch (a.type) {
  233. case 2:
  234. u("iframe");
  235. break;
  236. default:
  237. "" === 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])
  238. }
  239. return t
  240. }, s.pt.offset = function() {
  241. var e = this,
  242. t = e.config,
  243. i = e.layero,
  244. a = [i.outerWidth(), i.outerHeight()],
  245. o = "object" == typeof t.offset;
  246. 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({
  247. top: e.offsetTop,
  248. left: e.offsetLeft
  249. })
  250. }, s.pt.tips = function() {
  251. var e = this,
  252. t = e.config,
  253. a = e.layero,
  254. o = [a.outerWidth(), a.outerHeight()],
  255. r = i(t.follow);
  256. r[0] || (r = i("body"));
  257. var s = {
  258. width: r.outerWidth(),
  259. height: r.outerHeight(),
  260. top: r.offset().top,
  261. left: r.offset().left
  262. },
  263. f = a.find(".layui-layer-TipsG"),
  264. c = t.tips[0];
  265. t.tips[1] || f.remove(), s.autoLeft = function() {
  266. s.left + o[0] - n.width() > 0 ? (s.tipLeft = s.left + s.width - o[0], f.css({
  267. right: 12,
  268. left: "auto"
  269. })) : s.tipLeft = s.left
  270. }, s.where = [function() {
  271. 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])
  272. }, function() {
  273. 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])
  274. }, function() {
  275. 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])
  276. }, function() {
  277. 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])
  278. }], 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({
  279. "background-color": t.tips[1],
  280. "padding-right": t.closeBtn ? "30px" : ""
  281. }), a.css({
  282. left: s.tipLeft - (t.fixed ? n.scrollLeft() : 0),
  283. top: s.tipTop - (t.fixed ? n.scrollTop() : 0)
  284. })
  285. }, s.pt.move = function() {
  286. var e = this,
  287. t = e.config,
  288. a = i(document),
  289. s = e.layero,
  290. l = s.find(t.move),
  291. f = s.find(".layui-layer-resize"),
  292. c = {};
  293. return t.move && l.css("cursor", "move"), l.on("mousedown", function(e) {
  294. 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())
  295. }), f.on("mousedown", function(e) {
  296. e.preventDefault(), c.resizeStart = !0, c.offset = [e.clientX, e.clientY], c.area = [s.outerWidth(), s.outerHeight()], o.moveElem.css("cursor", "se-resize").show()
  297. }), a.on("mousemove", function(i) {
  298. if (c.moveStart) {
  299. var a = i.clientX - c.offset[0],
  300. o = i.clientY - c.offset[1],
  301. l = "fixed" === s.css("position");
  302. if (i.preventDefault(), c.stX = l ? 0 : n.scrollLeft(), c.stY = l ? 0 : n.scrollTop(), !t.moveOut) {
  303. var f = n.width() - s.outerWidth() + c.stX,
  304. u = n.height() - s.outerHeight() + c.stY;
  305. a < c.stX && (a = c.stX), a > f && (a = f), o < c.stY && (o = c.stY), o > u && (o = u)
  306. }
  307. s.css({
  308. left: a,
  309. top: o
  310. })
  311. }
  312. if (t.resize && c.resizeStart) {
  313. var a = i.clientX - c.offset[0],
  314. o = i.clientY - c.offset[1];
  315. i.preventDefault(), r.style(e.index, {
  316. width: c.area[0] + a,
  317. height: c.area[1] + o
  318. }), c.isResize = !0, t.resizing && t.resizing(s)
  319. }
  320. }).on("mouseup", function(e) {
  321. c.moveStart && (delete c.moveStart, o.moveElem.hide(), t.moveEnd && t.moveEnd(s)), c.resizeStart && (delete c.resizeStart, o.moveElem.hide())
  322. }), e
  323. }, s.pt.callback = function() {
  324. function e() {
  325. var e = a.cancel && a.cancel(t.index, n);
  326. e === !1 || r.close(t.index)
  327. }
  328. var t = this,
  329. n = t.layero,
  330. a = t.config;
  331. t.openLayer(), a.success && (2 == a.type ? n.find("iframe").on("load", function() {
  332. a.success(n, t.index)
  333. }) : a.success(n, t.index)), 6 == r.ie && t.IE6(n), n.find("." + l[6]).children("a").on("click", function() {
  334. var e = i(this).index();
  335. if (0 === e) a.yes ? a.yes(t.index, n) : a.btn1 ? a.btn1(t.index, n) : r.close(t.index);
  336. else {
  337. var o = a["btn" + (e + 1)] && a["btn" + (e + 1)](t.index, n);
  338. o === !1 || r.close(t.index)
  339. }
  340. }), n.find("." + l[7]).on("click", e), a.shadeClose && t.shadeo.on("click", function() {
  341. r.close(t.index)
  342. }), n.find(".layui-layer-min").on("click", function() {
  343. var e = a.min && a.min(n, t.index);
  344. e === !1 || r.min(t.index, a)
  345. }), n.find(".layui-layer-max").on("click", function() {
  346. i(this).hasClass("layui-layer-maxmin") ? (r.restore(t.index), a.restore && a.restore(n, t.index)) : (r.full(t.index, a), setTimeout(function() {
  347. a.full && a.full(n, t.index)
  348. }, 100))
  349. }), a.end && (o.end[t.index] = a.end)
  350. }, o.reselect = function() {
  351. i.each(i("select"), function(e, t) {
  352. var n = i(this);
  353. n.parents("." + l[0])[0] || 1 == n.attr("layer") && i("." + l[0]).length < 1 && n.removeAttr("layer").show(), n = null
  354. })
  355. }, s.pt.IE6 = function(e) {
  356. i("select").each(function(e, t) {
  357. var n = i(this);
  358. n.parents("." + l[0])[0] || "none" === n.css("display") || n.attr({
  359. layer: "1"
  360. }).hide(), n = null
  361. })
  362. }, s.pt.openLayer = function() {
  363. var e = this;
  364. r.zIndex = e.config.zIndex, r.setTop = function(e) {
  365. var t = function() {
  366. r.zIndex++, e.css("z-index", r.zIndex + 1)
  367. };
  368. return r.zIndex = parseInt(e[0].style.zIndex), e.on("mousedown", t), r.zIndex
  369. }
  370. }, o.record = function(e) {
  371. var t = [e.width(), e.height(), e.position().top, e.position().left + parseFloat(e.css("margin-left"))];
  372. e.find(".layui-layer-max").addClass("layui-layer-maxmin"), e.attr({
  373. area: t
  374. })
  375. }, o.rescollbar = function(e) {
  376. 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"))
  377. }, e.layer = r, r.getChildFrame = function(e, t) {
  378. return t = t || i("." + l[4]).attr("times"), i("#" + l[0] + t).find("iframe").contents().find(e)
  379. }, r.getFrameIndex = function(e) {
  380. return i("#" + e).parents("." + l[4]).attr("times")
  381. }, r.iframeAuto = function(e) {
  382. if (e) {
  383. var t = r.getChildFrame("html", e).outerHeight(),
  384. n = i("#" + l[0] + e),
  385. a = n.find(l[1]).outerHeight() || 0,
  386. o = n.find("." + l[6]).outerHeight() || 0;
  387. n.css({
  388. height: t + a + o
  389. }), n.find("iframe").css({
  390. height: t
  391. })
  392. }
  393. }, r.iframeSrc = function(e, t) {
  394. i("#" + l[0] + e).find("iframe").attr("src", t)
  395. }, r.style = function(e, t, n) {
  396. var a = i("#" + l[0] + e),
  397. r = a.find(".layui-layer-content"),
  398. s = a.attr("type"),
  399. f = a.find(l[1]).outerHeight() || 0,
  400. c = a.find("." + l[6]).outerHeight() || 0;
  401. a.attr("minLeft");
  402. 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({
  403. height: parseFloat(t.height) - f - c
  404. }) : r.css({
  405. height: parseFloat(t.height) - f - c - parseFloat(r.css("padding-top")) - parseFloat(r.css("padding-bottom"))
  406. }))
  407. }, r.min = function(e, t) {
  408. t = t || {};
  409. var a = i("#" + l[0] + e),
  410. s = i("#" + l.SHADE + e),
  411. f = a.find(l[1]).outerHeight() || 0,
  412. c = a.attr("minLeft") || 181 * o.minIndex + "px",
  413. u = a.css("position"),
  414. d = {
  415. width: 180,
  416. height: f,
  417. position: "fixed",
  418. overflow: "hidden"
  419. };
  420. 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()
  421. }, r.restore = function(e) {
  422. var t = i("#" + l[0] + e),
  423. n = i("#" + l.SHADE + e),
  424. a = t.attr("area").split(",");
  425. t.attr("type");
  426. r.style(e, {
  427. width: parseFloat(a[0]),
  428. height: parseFloat(a[1]),
  429. top: parseFloat(a[2]),
  430. left: parseFloat(a[3]),
  431. position: t.attr("position"),
  432. overflow: "visible"
  433. }, !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()
  434. }, r.full = function(e) {
  435. var t, a = i("#" + l[0] + e);
  436. o.record(a), l.html.attr("layer-full") || l.html.css("overflow", "hidden").attr("layer-full", e), clearTimeout(t), t = setTimeout(function() {
  437. var t = "fixed" === a.css("position");
  438. r.style(e, {
  439. top: t ? 0 : n.scrollTop(),
  440. left: t ? 0 : n.scrollLeft(),
  441. width: n.width(),
  442. height: n.height()
  443. }, !0), a.find(".layui-layer-min").hide()
  444. }, 100)
  445. }, r.title = function(e, t) {
  446. var n = i("#" + l[0] + (t || r.index)).find(l[1]);
  447. n.html(e)
  448. }, r.close = function(e, t) {
  449. var n = i("#" + l[0] + e),
  450. a = n.attr("type"),
  451. s = "layer-anim-close";
  452. if (n[0]) {
  453. var f = "layui-layer-wrap",
  454. c = function() {
  455. if (a === o.type[1] && "object" === n.attr("conType")) {
  456. n.children(":not(." + l[5] + ")").remove();
  457. for (var r = n.find("." + f), s = 0; s < 2; s++) r.unwrap();
  458. r.css("display", r.data("display")).removeClass(f)
  459. } else {
  460. if (a === o.type[2]) try {
  461. var c = i("#" + l[4] + e)[0];
  462. c.contentWindow.document.write(""), c.contentWindow.close(), n.find("." + l[5])[0].removeChild(c)
  463. } catch (u) {}
  464. n[0].innerHTML = "", n.remove()
  465. }
  466. "function" == typeof o.end[e] && o.end[e](), delete o.end[e], "function" == typeof t && t()
  467. };
  468. 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() {
  469. c()
  470. }, 200)
  471. }
  472. }, r.closeAll = function(e, t) {
  473. "function" == typeof e && (t = e, e = null);
  474. var n = i("." + l[0]);
  475. i.each(n, function(a) {
  476. var o = i(this),
  477. s = e ? o.attr("type") === e : 1;
  478. s && r.close(o.attr("times"), a === n.length - 1 ? t : null), s = null
  479. }), 0 === n.length && "function" == typeof t && t()
  480. };
  481. var f = r.cache || {},
  482. c = function(e) {
  483. return f.skin ? " " + f.skin + " " + f.skin + "-" + e : ""
  484. };
  485. r.prompt = function(e, t) {
  486. var a = "";
  487. if (e = e || {}, "function" == typeof e && (t = e), e.area) {
  488. var o = e.area;
  489. a = 'style="width: ' + o[0] + "; height: " + o[1] + ';"', delete e.area
  490. }
  491. var s, l = 2 == e.formType ? '<textarea class="layui-layer-input"' + a + "></textarea>" : function() {
  492. return '<input type="' + (1 == e.formType ? "password" : "text") + '" class="layui-layer-input">'
  493. }(),
  494. f = e.success;
  495. return delete e.success, r.open(i.extend({
  496. type: 1,
  497. btn: ["&#x786E;&#x5B9A;", "&#x53D6;&#x6D88;"],
  498. content: l,
  499. skin: "layui-layer-prompt" + c("prompt"),
  500. maxWidth: n.width(),
  501. success: function(t) {
  502. s = t.find(".layui-layer-input"), s.val(e.value || "").focus(), "function" == typeof f && f(t)
  503. },
  504. resize: !1,
  505. yes: function(i) {
  506. var n = s.val();
  507. "" === n ? s.focus() : n.length > (e.maxlength || 500) ? r.tips("&#x6700;&#x591A;&#x8F93;&#x5165;" + (e.maxlength || 500) + "&#x4E2A;&#x5B57;&#x6570;", s, {
  508. tips: 1
  509. }) : t && t(n, i, s)
  510. }
  511. }, e))
  512. }, r.tab = function(e) {
  513. e = e || {};
  514. var t = e.tab || {},
  515. n = "layui-this",
  516. a = e.success;
  517. return delete e.success, r.open(i.extend({
  518. type: 1,
  519. skin: "layui-layer-tab" + c("tab"),
  520. resize: !1,
  521. title: function() {
  522. var e = t.length,
  523. i = 1,
  524. a = "";
  525. if (e > 0)
  526. for (a = '<span class="' + n + '">' + t[0].title + "</span>"; i < e; i++) a += "<span>" + t[i].title + "</span>";
  527. return a
  528. }(),
  529. content: '<ul class="layui-layer-tabmain">' + function() {
  530. var e = t.length,
  531. i = 1,
  532. a = "";
  533. if (e > 0)
  534. for (a = '<li class="layui-layer-tabli ' + n + '">' + (t[0].content || "no content") + "</li>"; i < e; i++) a += '<li class="layui-layer-tabli">' + (t[i].content || "no content") + "</li>";
  535. return a
  536. }() + "</ul>",
  537. success: function(t) {
  538. var o = t.find(".layui-layer-title").children(),
  539. r = t.find(".layui-layer-tabmain").children();
  540. o.on("mousedown", function(t) {
  541. t.stopPropagation ? t.stopPropagation() : t.cancelBubble = !0;
  542. var a = i(this),
  543. o = a.index();
  544. a.addClass(n).siblings().removeClass(n), r.eq(o).show().siblings().hide(), "function" == typeof e.change && e.change(o)
  545. }), "function" == typeof a && a(t)
  546. }
  547. }, e))
  548. }, r.photos = function(t, n, a) {
  549. function o(e, t, i) {
  550. var n = new Image;
  551. return n.src = e, n.complete ? t(n) : (n.onload = function() {
  552. n.onload = null, t(n)
  553. }, void(n.onerror = function(e) {
  554. n.onerror = null, i(e)
  555. }))
  556. }
  557. var s = {};
  558. if (t = t || {}, t.photos) {
  559. var l = !("string" == typeof t.photos || t.photos instanceof i),
  560. f = l ? t.photos : {},
  561. u = f.data || [],
  562. d = f.start || 0;
  563. s.imgIndex = (0 | d) + 1, t.img = t.img || "img";
  564. var y = t.success;
  565. if (delete t.success, l) {
  566. if (0 === u.length) return r.msg("&#x6CA1;&#x6709;&#x56FE;&#x7247;")
  567. } else {
  568. var p = i(t.photos),
  569. h = function() {
  570. u = [], p.find(t.img).each(function(e) {
  571. var t = i(this);
  572. t.attr("layer-index", e), u.push({
  573. alt: t.attr("alt"),
  574. pid: t.attr("layer-pid"),
  575. src: t.attr("layer-src") || t.attr("src"),
  576. thumb: t.attr("src")
  577. })
  578. })
  579. };
  580. if (h(), 0 === u.length) return;
  581. if (n || p.on("click", t.img, function() {
  582. h();
  583. var e = i(this),
  584. n = e.attr("layer-index");
  585. r.photos(i.extend(t, {
  586. photos: {
  587. start: n,
  588. data: u,
  589. tab: t.tab
  590. },
  591. full: t.full
  592. }), !0)
  593. }), !n) return
  594. }
  595. s.imgprev = function(e) {
  596. s.imgIndex--, s.imgIndex < 1 && (s.imgIndex = u.length), s.tabimg(e)
  597. }, s.imgnext = function(e, t) {
  598. s.imgIndex++, s.imgIndex > u.length && (s.imgIndex = 1, t) || s.tabimg(e)
  599. }, s.keyup = function(e) {
  600. if (!s.end) {
  601. var t = e.keyCode;
  602. e.preventDefault(), 37 === t ? s.imgprev(!0) : 39 === t ? s.imgnext(!0) : 27 === t && r.close(s.index)
  603. }
  604. }, s.tabimg = function(e) {
  605. if (!(u.length <= 1)) return f.start = s.imgIndex - 1, r.close(s.index), r.photos(t, !0, e)
  606. }, s.event = function() {
  607. s.bigimg.find(".layui-layer-imgprev").on("click", function(e) {
  608. e.preventDefault(), s.imgprev(!0)
  609. }), s.bigimg.find(".layui-layer-imgnext").on("click", function(e) {
  610. e.preventDefault(), s.imgnext(!0)
  611. }), i(document).on("keyup", s.keyup)
  612. }, s.loadi = r.load(1, {
  613. shade: !("shade" in t) && .9,
  614. scrollbar: !1
  615. }), o(u[d].src, function(n) {
  616. r.close(s.loadi), a && (t.anim = -1), s.index = r.open(i.extend({
  617. type: 1,
  618. id: "layui-layer-photos",
  619. area: function() {
  620. var a = [n.width, n.height],
  621. o = [i(e).width() - 100, i(e).height() - 100];
  622. if (!t.full && (a[0] > o[0] || a[1] > o[1])) {
  623. var r = [a[0] / o[0], a[1] / o[1]];
  624. 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])
  625. }
  626. return [a[0] + "px", a[1] + "px"]
  627. }(),
  628. title: !1,
  629. shade: .9,
  630. shadeClose: !0,
  631. closeBtn: !1,
  632. move: ".layui-layer-phimg img",
  633. moveType: 1,
  634. scrollbar: !1,
  635. moveOut: !0,
  636. anim: 5,
  637. isOutAnim: !1,
  638. skin: "layui-layer-photos" + c("photos"),
  639. content: '<div class="layui-layer-phimg"><img src="' + u[d].src + '" alt="' + (u[d].alt || "") + '" layer-pid="' + u[d].pid + '">' + function() {
  640. return u.length > 1 ? '<div class="layui-layer-imgsee"><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>" : ""
  641. }() + "</div>",
  642. success: function(e, i) {
  643. 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)
  644. },
  645. end: function() {
  646. s.end = !0, i(document).off("keyup", s.keyup)
  647. }
  648. }, t))
  649. }, function() {
  650. 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;", {
  651. time: 3e4,
  652. btn: ["&#x4E0B;&#x4E00;&#x5F20;", "&#x4E0D;&#x770B;&#x4E86;"],
  653. yes: function() {
  654. u.length > 1 && s.imgnext(!0, !0)
  655. }
  656. })
  657. })
  658. }
  659. }, o.run = function(t) {
  660. i = t, n = i(e), l.html = i("html"), r.open = function(e) {
  661. var t = new s(e);
  662. return t.index
  663. }
  664. }, e.layui && layui.define ? (r.ready(), layui.define("jquery", function(t) {
  665. r.path = layui.cache.dir, o.run(layui.$), e.layer = r, t("layer", r)
  666. })) : "function" == typeof define && define.amd ? define(["jquery"], function() {
  667. return o.run(e.jQuery), r
  668. }) : function() {
  669. r.ready(), o.run(e.jQuery)
  670. }()
  671. }(window);