layer.min.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
  1. /*! layer-v2.0 弹层组件 License LGPL http://layer.layui.com/ By 贤心 */
  2. ; !
  3. function(a, b) {
  4. "use strict";
  5. var c, d, e = {
  6. getPath: function() {
  7. var a = document.scripts,
  8. b = a[a.length - 1],
  9. c = b.src;
  10. if (!b.getAttribute("merge")) return c.substring(0, c.lastIndexOf("/") + 1)
  11. } (),
  12. enter: function(a) {
  13. 13 === a.keyCode && a.preventDefault()
  14. },
  15. config: {},
  16. end: {},
  17. btn: ["确定", "取消"],
  18. type: ["dialog", "page", "iframe", "loading", "tips"]
  19. },
  20. f = {
  21. v: "2.0",
  22. ie6: !!a.ActiveXObject && !a.XMLHttpRequest,
  23. index: 0,
  24. path: e.getPath,
  25. config: function(a, b) {
  26. var d = 0;
  27. return a = a || {},
  28. f.cache = e.config = c.extend(e.config, a),
  29. f.path = e.config.path || f.path,
  30. "string" == typeof a.extend && (a.extend = [a.extend]),
  31. f.use("skin/layer.css", a.extend && a.extend.length > 0 ?
  32. function g() {
  33. var c = a.extend;
  34. f.use(c[c[d] ? d: d - 1], d < c.length ?
  35. function() {
  36. return++d,
  37. g
  38. } () : b)
  39. } () : b),
  40. this
  41. },
  42. use: function(a, b, d) {
  43. var e = c("head")[0],
  44. a = a.replace(/\s/g, ""),
  45. g = /\.css$/.test(a),
  46. h = document.createElement(g ? "link": "script"),
  47. i = "layui_layer_" + a.replace(/\.|\//g, "");
  48. return f.path ? (g && (h.rel = "stylesheet"), h[g ? "href": "src"] = /^http:\/\//.test(a) ? a: f.path + a, h.id = i, c("#" + i)[0] || e.appendChild(h),
  49. function j() { (g ? 1989 === parseInt(c("#" + i).css("width")) : f[d || i]) ?
  50. function() {
  51. b && b();
  52. try {
  53. g || e.removeChild(h)
  54. } catch(a) {}
  55. } () : setTimeout(j, 100)
  56. } (), this) : void 0
  57. },
  58. ready: function(a, b) {
  59. var d = "function" == typeof a;
  60. return d && (b = a),
  61. f.config(c.extend(e.config,
  62. function() {
  63. return d ? {}: {
  64. path: a
  65. }
  66. } ()), b),
  67. this
  68. },
  69. alert: function(a, b, d) {
  70. var e = "function" == typeof b;
  71. return e && (d = b),
  72. f.open(c.extend({
  73. content: a,
  74. yes: d
  75. },
  76. e ? {}: b))
  77. },
  78. confirm: function(a, b, d, g) {
  79. var h = "function" == typeof b;
  80. return h && (g = d, d = b),
  81. f.open(c.extend({
  82. content: a,
  83. btn: e.btn,
  84. yes: d,
  85. cancel: g
  86. },
  87. h ? {}: b))
  88. },
  89. msg: function(a, d, g) {
  90. var i = "function" == typeof d,
  91. j = e.config.skin,
  92. k = (j ? j + " " + j + "-msg": "") || "layui-layer-msg",
  93. l = h.anim.length - 1;
  94. return i && (g = d),
  95. f.open(c.extend({
  96. content: a,
  97. time: 3e3,
  98. shade: !1,
  99. skin: k,
  100. title: !1,
  101. closeBtn: !1,
  102. btn: !1,
  103. end: g
  104. },
  105. i && !e.config.skin ? {
  106. skin: k + " layui-layer-hui",
  107. shift: l
  108. }: function() {
  109. return d = d || {},
  110. ( - 1 === d.icon || d.icon === b && !e.config.skin) && (d.skin = k + " " + (d.skin || "layui-layer-hui")),
  111. d
  112. } ()))
  113. },
  114. load: function(a, b) {
  115. return f.open(c.extend({
  116. type: 3,
  117. icon: a || 0,
  118. shade: .01
  119. },
  120. b))
  121. },
  122. tips: function(a, b, d) {
  123. return f.open(c.extend({
  124. type: 4,
  125. content: [a, b],
  126. closeBtn: !1,
  127. time: 3e3,
  128. maxWidth: 210
  129. },
  130. d))
  131. }
  132. },
  133. g = function(a) {
  134. var b = this;
  135. b.index = ++f.index,
  136. b.config = c.extend({},
  137. b.config, e.config, a),
  138. b.creat()
  139. };
  140. g.pt = g.prototype;
  141. var h = ["layui-layer", ".layui-layer-title", ".layui-layer-main", ".layui-layer-dialog", "layui-layer-iframe", "layui-layer-content", "layui-layer-btn", "layui-layer-close"];
  142. h.anim = ["layui-anim", "layui-anim-01", "layui-anim-02", "layui-anim-03", "layui-anim-04", "layui-anim-05", "layui-anim-06"],
  143. g.pt.config = {
  144. type: 0,
  145. shade: .3,
  146. fix: !0,
  147. move: h[1],
  148. title: "&#x4FE1;&#x606F;",
  149. offset: "auto",
  150. area: "auto",
  151. closeBtn: 1,
  152. time: 0,
  153. zIndex: 19891014,
  154. maxWidth: 360,
  155. shift: 0,
  156. icon: -1,
  157. scrollbar: !0,
  158. tips: 2
  159. },
  160. g.pt.vessel = function(a, b) {
  161. var c = this,
  162. d = c.index,
  163. f = c.config,
  164. g = f.zIndex + d,
  165. i = "object" == typeof f.title,
  166. j = f.maxmin && (1 === f.type || 2 === f.type),
  167. k = f.title ? '<div class="layui-layer-title" style="' + (i ? f.title[1] : "") + '">' + (i ? f.title[0] : f.title) + "</div>": "";
  168. return f.zIndex = g,
  169. b([f.shade ? '<div class="layui-layer-shade" id="layui-layer-shade' + d + '" times="' + d + '" style="' + ("z-index:" + (g - 1) + "; background-color:" + (f.shade[1] || "#000") + "; opacity:" + (f.shade[0] || f.shade) + "; filter:alpha(opacity=" + (100 * f.shade[0] || 100 * f.shade) + ");") + '"></div>': "", '<div class="' + h[0] + " " + (h.anim[f.shift] || "") + (" layui-layer-" + e.type[f.type]) + (0 != f.type && 2 != f.type || f.shade ? "": " layui-layer-border") + " " + (f.skin || "") + '" id="' + h[0] + d + '" type="' + e.type[f.type] + '" times="' + d + '" showtime="' + f.time + '" conType="' + (a ? "object": "string") + '" style="z-index: ' + g + "; width:" + f.area[0] + ";height:" + f.area[1] + (f.fix ? "": ";position:absolute;") + '">' + (a && 2 != f.type ? "": k) + '<div class="layui-layer-content' + (0 == f.type && -1 !== f.icon ? " layui-layer-padding": "") + (3 == f.type ? " layui-layer-loading" + f.icon: "") + '">' + (0 == f.type && -1 !== f.icon ? '<i class="layui-layer-ico layui-layer-ico' + f.icon + '"></i>': "") + (1 == f.type && a ? "": f.content || "") + '</div><span class="layui-layer-setwin">' +
  170. function() {
  171. var a = j ? '<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>': "";
  172. return f.closeBtn && (a += '<a class="layui-layer-ico ' + h[7] + " " + h[7] + (f.title ? f.closeBtn: 4 == f.type ? "1": "2") + '" href="javascript:;"></a>'),
  173. a
  174. } () + "</span>" + (f.btn ?
  175. function() {
  176. var a = "";
  177. "string" == typeof f.btn && (f.btn = [f.btn]);
  178. for (var b = 0,
  179. c = f.btn.length; c > b; b++) a += '<a class="' + h[6] + b + '">' + f.btn[b] + "</a>";
  180. return '<div class="' + h[6] + '">' + a + "</div>"
  181. } () : "") + "</div>"], k),
  182. c
  183. },
  184. g.pt.creat = function() {
  185. var a = this,
  186. b = a.config,
  187. g = a.index,
  188. i = b.content,
  189. j = "object" == typeof i;
  190. switch ("string" == typeof b.area && (b.area = "auto" === b.area ? ["", ""] : [b.area, ""]), b.type) {
  191. case 0:
  192. b.btn = "btn" in b ? b.btn: e.btn[0],
  193. f.closeAll("dialog");
  194. break;
  195. case 2:
  196. var i = b.content = j ? b.content: [b.content || "http://sentsin.com?from=layer", "auto"];
  197. b.content = '<iframe scrolling="' + (b.content[1] || "auto") + '" allowtransparency="true" id="' + h[4] + g + '" name="' + h[4] + g + '" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="' + b.content[0] + '"></iframe>';
  198. break;
  199. case 3:
  200. b.title = !1,
  201. b.closeBtn = !1,
  202. -1 === b.icon && 0 === b.icon,
  203. f.closeAll("loading");
  204. break;
  205. case 4:
  206. j || (b.content = [b.content, "body"]),
  207. b.follow = b.content[1],
  208. b.content = b.content[0] + '<i class="layui-layer-TipsG"></i>',
  209. b.title = !1,
  210. b.shade = !1,
  211. b.fix = !1,
  212. b.tips = "object" == typeof b.tips ? b.tips: [b.tips, !0],
  213. b.tipsMore || f.closeAll("tips")
  214. }
  215. a.vessel(j,
  216. function(d, e) {
  217. c("body").append(d[0]),
  218. j ?
  219. function() {
  220. 2 == b.type || 4 == b.type ?
  221. function() {
  222. c("body").append(d[1])
  223. } () : function() {
  224. i.parents("." + h[0])[0] || (i.show().addClass("layui-layer-wrap").wrap(d[1]), c("#" + h[0] + g).find("." + h[5]).before(e))
  225. } ()
  226. } () : c("body").append(d[1]),
  227. a.layero = c("#" + h[0] + g),
  228. b.scrollbar || h.html.css("overflow", "hidden").attr("layer-full", g)
  229. }).auto(g),
  230. 2 == b.type && f.ie6 && a.layero.find("iframe").attr("src", i[0]),
  231. c(document).off("keydown", e.enter).on("keydown", e.enter),
  232. 4 == b.type ? a.tips() : a.offset(),
  233. b.fix && d.on("resize",
  234. function() {
  235. a.offset(),
  236. (/^\d+%$/.test(b.area[0]) || /^\d+%$/.test(b.area[1])) && a.auto(g),
  237. 4 == b.type && a.tips()
  238. }),
  239. b.time <= 0 || setTimeout(function() {
  240. f.close(a.index)
  241. },
  242. b.time),
  243. a.move().callback()
  244. },
  245. g.pt.auto = function(a) {
  246. function b(a) {
  247. a = g.find(a),
  248. a.height(i[1] - j - k - 2 * (0 | parseFloat(a.css("padding"))))
  249. }
  250. var e = this,
  251. f = e.config,
  252. g = c("#" + h[0] + a);
  253. "" === f.area[0] && f.maxWidth > 0 && (/MSIE 7/.test(navigator.userAgent) && f.btn && g.width(g.innerWidth()), g.outerWidth() > f.maxWidth && g.width(f.maxWidth));
  254. var i = [g.innerWidth(), g.innerHeight()],
  255. j = g.find(h[1]).outerHeight() || 0,
  256. k = g.find("." + h[6]).outerHeight() || 0;
  257. switch (f.type) {
  258. case 2:
  259. b("iframe");
  260. break;
  261. default:
  262. "" === f.area[1] ? f.fix && i[1] >= d.height() && (i[1] = d.height(), b("." + h[5])) : b("." + h[5])
  263. }
  264. return e
  265. },
  266. g.pt.offset = function() {
  267. var a = this,
  268. b = a.config,
  269. c = a.layero,
  270. e = [c.outerWidth(), c.outerHeight()],
  271. f = "object" == typeof b.offset;
  272. a.offsetTop = (d.height() - e[1]) / 2,
  273. a.offsetLeft = (d.width() - e[0]) / 2,
  274. f ? (a.offsetTop = b.offset[0], a.offsetLeft = b.offset[1] || a.offsetLeft) : "auto" !== b.offset && (a.offsetTop = b.offset, "rb" === b.offset && (a.offsetTop = d.height() - e[1], a.offsetLeft = d.width() - e[0])),
  275. b.fix || (a.offsetTop = /%$/.test(a.offsetTop) ? d.height() * parseFloat(a.offsetTop) / 100 : parseFloat(a.offsetTop), a.offsetLeft = /%$/.test(a.offsetLeft) ? d.width() * parseFloat(a.offsetLeft) / 100 : parseFloat(a.offsetLeft), a.offsetTop += d.scrollTop(), a.offsetLeft += d.scrollLeft()),
  276. c.css({
  277. top: a.offsetTop,
  278. left: a.offsetLeft
  279. })
  280. },
  281. g.pt.tips = function() {
  282. var a = this,
  283. b = a.config,
  284. e = a.layero,
  285. f = [e.outerWidth(), e.outerHeight()],
  286. g = c(b.follow);
  287. g[0] || (g = c("body"));
  288. var i = {
  289. width: g.outerWidth(),
  290. height: g.outerHeight(),
  291. top: g.offset().top,
  292. left: g.offset().left
  293. },
  294. j = e.find(".layui-layer-TipsG"),
  295. k = b.tips[0];
  296. b.tips[1] || j.remove(),
  297. i.autoLeft = function() {
  298. i.left + f[0] - d.width() > 0 ? (i.tipLeft = i.left + i.width - f[0], j.css({
  299. right: 12,
  300. left: "auto"
  301. })) : i.tipLeft = i.left
  302. },
  303. i.where = [function() {
  304. i.autoLeft(),
  305. i.tipTop = i.top - f[1] - 10,
  306. j.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color", b.tips[1])
  307. },
  308. function() {
  309. i.tipLeft = i.left + i.width + 10,
  310. i.tipTop = i.top,
  311. j.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color", b.tips[1])
  312. },
  313. function() {
  314. i.autoLeft(),
  315. i.tipTop = i.top + i.height + 10,
  316. j.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color", b.tips[1])
  317. },
  318. function() {
  319. i.tipLeft = i.left - f[0] - 10,
  320. i.tipTop = i.top,
  321. j.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color", b.tips[1])
  322. }],
  323. i.where[k - 1](),
  324. 1 === k ? i.top - (d.scrollTop() + f[1] + 16) < 0 && i.where[2]() : 2 === k ? d.width() - (i.left + i.width + f[0] + 16) > 0 || i.where[3]() : 3 === k ? i.top - d.scrollTop() + i.height + f[1] + 16 - d.height() > 0 && i.where[0]() : 4 === k && f[0] + 16 - i.left > 0 && i.where[1](),
  325. e.find("." + h[5]).css({
  326. "background-color": b.tips[1],
  327. "padding-right": b.closeBtn ? "30px": ""
  328. }),
  329. e.css({
  330. left: i.tipLeft,
  331. top: i.tipTop
  332. })
  333. },
  334. g.pt.move = function() {
  335. var a = this,
  336. b = a.config,
  337. e = {
  338. setY: 0,
  339. moveLayer: function() {
  340. var a = e.layero,
  341. b = parseInt(a.css("margin-left")),
  342. c = parseInt(e.move.css("left"));
  343. 0 === b || (c -= b),
  344. "fixed" !== a.css("position") && (c -= a.parent().offset().left, e.setY = 0),
  345. a.css({
  346. left: c,
  347. top: parseInt(e.move.css("top")) - e.setY
  348. })
  349. }
  350. },
  351. f = a.layero.find(b.move);
  352. return b.move && f.attr("move", "ok"),
  353. f.css({
  354. cursor: b.move ? "move": "auto"
  355. }),
  356. c(b.move).on("mousedown",
  357. function(a) {
  358. if (a.preventDefault(), "ok" === c(this).attr("move")) {
  359. e.ismove = !0,
  360. e.layero = c(this).parents("." + h[0]);
  361. var f = e.layero.offset().left,
  362. g = e.layero.offset().top,
  363. i = e.layero.outerWidth() - 6,
  364. j = e.layero.outerHeight() - 6;
  365. c("#layui-layer-moves")[0] || c("body").append('<div id="layui-layer-moves" class="layui-layer-moves" style="left:' + f + "px; top:" + g + "px; width:" + i + "px; height:" + j + 'px; z-index:2147483584"></div>'),
  366. e.move = c("#layui-layer-moves"),
  367. b.moveType && e.move.css({
  368. visibility: "hidden"
  369. }),
  370. e.moveX = a.pageX - e.move.position().left,
  371. e.moveY = a.pageY - e.move.position().top,
  372. "fixed" !== e.layero.css("position") || (e.setY = d.scrollTop())
  373. }
  374. }),
  375. c(document).mousemove(function(a) {
  376. if (e.ismove) {
  377. var c = a.pageX - e.moveX,
  378. f = a.pageY - e.moveY;
  379. if (a.preventDefault(), !b.moveOut) {
  380. e.setY = d.scrollTop();
  381. var g = d.width() - e.move.outerWidth(),
  382. h = e.setY;
  383. 0 > c && (c = 0),
  384. c > g && (c = g),
  385. h > f && (f = h),
  386. f > d.height() - e.move.outerHeight() + e.setY && (f = d.height() - e.move.outerHeight() + e.setY)
  387. }
  388. e.move.css({
  389. left: c,
  390. top: f
  391. }),
  392. b.moveType && e.moveLayer(),
  393. c = f = g = h = null
  394. }
  395. }).mouseup(function() {
  396. try {
  397. e.ismove && (e.moveLayer(), e.move.remove(), b.moveEnd && b.moveEnd()),
  398. e.ismove = !1
  399. } catch(a) {
  400. e.ismove = !1
  401. }
  402. }),
  403. a
  404. },
  405. g.pt.callback = function() {
  406. function a() {
  407. var a = g.cancel && g.cancel(b.index);
  408. a === !1 || f.close(b.index)
  409. }
  410. var b = this,
  411. d = b.layero,
  412. g = b.config;
  413. b.openLayer(),
  414. g.success && (2 == g.type ? d.find("iframe")[0].onload = function() {
  415. this.className = "",
  416. g.success(d, b.index)
  417. }: g.success(d, b.index)),
  418. f.ie6 && b.IE6(d),
  419. d.find("." + h[6]).children("a").on("click",
  420. function() {
  421. var e = c(this).index();
  422. g["btn" + (e + 1)] && g["btn" + (e + 1)](b.index, d),
  423. 0 === e ? g.yes ? g.yes(b.index, d) : f.close(b.index) : 1 === e ? a() : g["btn" + (e + 1)] || f.close(b.index)
  424. }),
  425. d.find("." + h[7]).on("click", a),
  426. g.shadeClose && c("#layui-layer-shade" + b.index).on("click",
  427. function() {
  428. f.close(b.index)
  429. }),
  430. d.find(".layui-layer-min").on("click",
  431. function() {
  432. f.min(b.index, g),
  433. g.min && g.min(d)
  434. }),
  435. d.find(".layui-layer-max").on("click",
  436. function() {
  437. c(this).hasClass("layui-layer-maxmin") ? (f.restore(b.index), g.restore && g.restore(d)) : (f.full(b.index, g), g.full && g.full(d))
  438. }),
  439. g.end && (e.end[b.index] = g.end)
  440. },
  441. e.reselect = function() {
  442. c.each(c("select"),
  443. function(a, b) {
  444. var d = c(this);
  445. d.parents("." + h[0])[0] || 1 == d.attr("layer") && c("." + h[0]).length < 1 && d.removeAttr("layer").show(),
  446. d = null
  447. })
  448. },
  449. g.pt.IE6 = function(a) {
  450. function b() {
  451. a.css({
  452. top: f + (e.config.fix ? d.scrollTop() : 0)
  453. })
  454. }
  455. var e = this,
  456. f = a.offset().top;
  457. b(),
  458. d.scroll(b),
  459. c("select").each(function(a, b) {
  460. var d = c(this);
  461. d.parents("." + h[0])[0] || "none" === d.css("display") || d.attr({
  462. layer: "1"
  463. }).hide(),
  464. d = null
  465. })
  466. },
  467. g.pt.openLayer = function() {
  468. var a = this;
  469. f.zIndex = a.config.zIndex,
  470. f.setTop = function(a) {
  471. var b = function() {
  472. f.zIndex++,
  473. a.css("z-index", f.zIndex + 1)
  474. };
  475. return f.zIndex = parseInt(a[0].style.zIndex),
  476. a.on("mousedown", b),
  477. f.zIndex
  478. }
  479. },
  480. e.record = function(a) {
  481. var b = [a.outerWidth(), a.outerHeight(), a.position().top, a.position().left + parseFloat(a.css("margin-left"))];
  482. a.find(".layui-layer-max").addClass("layui-layer-maxmin"),
  483. a.attr({
  484. area: b
  485. })
  486. },
  487. e.rescollbar = function(a) {
  488. h.html.attr("layer-full") == a && (h.html[0].style.removeProperty ? h.html[0].style.removeProperty("overflow") : h.html[0].style.removeAttribute("overflow"), h.html.removeAttr("layer-full"))
  489. },
  490. f.getChildFrame = function(a, b) {
  491. return b = b || c("." + h[4]).attr("times"),
  492. c("#" + h[0] + b).find("iframe").contents().find(a)
  493. },
  494. f.getFrameIndex = function(a) {
  495. return c("#" + a).parents("." + h[4]).attr("times")
  496. },
  497. f.iframeAuto = function(a) {
  498. if (a) {
  499. var b = f.getChildFrame("body", a).outerHeight(),
  500. d = c("#" + h[0] + a),
  501. e = d.find(h[1]).outerHeight() || 0,
  502. g = d.find("." + h[6]).outerHeight() || 0;
  503. d.css({
  504. height: b + e + g
  505. }),
  506. d.find("iframe").css({
  507. height: b
  508. })
  509. }
  510. },
  511. f.iframeSrc = function(a, b) {
  512. c("#" + h[0] + a).find("iframe").attr("src", b)
  513. },
  514. f.style = function(a, b) {
  515. var d = c("#" + h[0] + a),
  516. f = d.attr("type"),
  517. g = d.find(h[1]).outerHeight() || 0,
  518. i = d.find("." + h[6]).outerHeight() || 0; (f === e.type[1] || f === e.type[2]) && (d.css(b), f === e.type[2] && d.find("iframe").css({
  519. height: parseFloat(b.height) - g - i
  520. }))
  521. },
  522. f.min = function(a, b) {
  523. var d = c("#" + h[0] + a),
  524. g = d.find(h[1]).outerHeight() || 0;
  525. e.record(d),
  526. f.style(a, {
  527. width: 180,
  528. height: g,
  529. overflow: "hidden"
  530. }),
  531. d.find(".layui-layer-min").hide(),
  532. "page" === d.attr("type") && d.find(h[4]).hide(),
  533. e.rescollbar(a)
  534. },
  535. f.restore = function(a) {
  536. var b = c("#" + h[0] + a),
  537. d = b.attr("area").split(",");
  538. b.attr("type");
  539. f.style(a, {
  540. width: parseFloat(d[0]),
  541. height: parseFloat(d[1]),
  542. top: parseFloat(d[2]),
  543. left: parseFloat(d[3]),
  544. overflow: "visible"
  545. }),
  546. b.find(".layui-layer-max").removeClass("layui-layer-maxmin"),
  547. b.find(".layui-layer-min").show(),
  548. "page" === b.attr("type") && b.find(h[4]).show(),
  549. e.rescollbar(a)
  550. },
  551. f.full = function(a) {
  552. var b, g = c("#" + h[0] + a);
  553. e.record(g),
  554. h.html.attr("layer-full") || h.html.css("overflow", "hidden").attr("layer-full", a),
  555. clearTimeout(b),
  556. b = setTimeout(function() {
  557. var b = "fixed" === g.css("position");
  558. f.style(a, {
  559. top: b ? 0 : d.scrollTop(),
  560. left: b ? 0 : d.scrollLeft(),
  561. width: d.width(),
  562. height: d.height()
  563. }),
  564. g.find(".layui-layer-min").hide()
  565. },
  566. 100)
  567. },
  568. f.title = function(a, b) {
  569. var d = c("#" + h[0] + (b || f.index)).find(h[1]);
  570. d.html(a)
  571. },
  572. f.close = function(a) {
  573. var b = c("#" + h[0] + a),
  574. d = b.attr("type");
  575. if (b[0]) {
  576. if (d === e.type[1] && "object" === b.attr("conType")) {
  577. b.children(":not(." + h[5] + ")").remove();
  578. for (var g = 0; 2 > g; g++) b.find(".layui-layer-wrap").unwrap().hide()
  579. } else {
  580. if (d === e.type[2]) try {
  581. var i = c("#" + h[4] + a)[0];
  582. i.contentWindow.document.write(""),
  583. i.contentWindow.close(),
  584. b.find("." + h[5])[0].removeChild(i)
  585. } catch(j) {}
  586. b[0].innerHTML = "",
  587. b.remove()
  588. }
  589. c("#layui-layer-moves, #layui-layer-shade" + a).remove(),
  590. f.ie6 && e.reselect(),
  591. e.rescollbar(a),
  592. c(document).off("keydown", e.enter),
  593. "function" == typeof e.end[a] && e.end[a](),
  594. delete e.end[a]
  595. }
  596. },
  597. f.closeAll = function(a) {
  598. c.each(c("." + h[0]),
  599. function() {
  600. var b = c(this),
  601. d = a ? b.attr("type") === a: 1;
  602. d && f.close(b.attr("times")),
  603. d = null
  604. })
  605. },
  606. e.run = function() {
  607. c = jQuery,
  608. d = c(a),
  609. h.html = c("html"),
  610. f.open = function(a) {
  611. var b = new g(a);
  612. return b.index
  613. }
  614. },
  615. "function" == typeof define ? define(function() {
  616. return e.run(),
  617. f
  618. }) : function() {
  619. a.layer = f,
  620. e.run(),
  621. f.use("skin/layer.css")
  622. } ()
  623. } (window);