Files

10 lines
94 KiB
JavaScript
Raw Permalink Normal View History

2026-02-06 18:34:35 +08:00
/*!
* file : layx.js
* gitee : https://gitee.com/monksoul/LayX
* github : https://github.com/MonkSoul/Layx/
* author : 百小僧/MonkSoul
* version : v2.5.4
* create time : 2018.05.11
* update time : 2018.11.03
*/
!function (n, t) { var r = { version: "2.5.4", defaults: { id: "", icon: !0, title: "", width: 800, height: 600, minWidth: 200, minHeight: 200, position: "ct", storeStatus: !0, control: !0, style: "", controlStyle: "", existFlicker: !0, bgColor: "#fff", shadow: !0, border: !0, borderRadius: "3px", skin: "default", type: "html", focusToReveal: !0, enableDomainFocus: !0, dialogType: "", frames: [], frameIndex: 0, preload: 1, mergeTitle: !0, content: "", dialogIcon: !1, cloneElementContent: !0, url: "", useFrameTitle: !1, opacity: 1, escKey: !0, floatTarget: !1, floatDirection: "bottom", shadable: !1, shadeDestroy: !1, readonly: !1, loadingText: "内容正在加载中,请稍后", dragInTopToMax: !0, isOverToMax: !0, stickMenu: !1, stickable: !0, minMenu: !0, minable: !0, maxMenu: !0, maxable: !0, closeMenu: !0, closable: !0, debugMenu: !1, restorable: !0, resizable: !0, autodestroy: !1, autodestroyText: "此窗口将在 <strong>{second}<\/strong> 秒内自动关闭.", resizeLimit: { t: !1, r: !1, b: !1, l: !1, lt: !1, rt: !1, lb: !1, rb: !1 }, buttonKey: "enter", buttons: [], movable: !0, moveLimit: { vertical: !1, horizontal: !1, leftOut: !0, rightOut: !0, topOut: !0, bottomOut: !0 }, focusable: !0, alwaysOnTop: !1, allowControlDbclick: !0, statusBar: !1, statusBarStyle: "", event: { onload: { before: function () { }, after: function () { } }, onmin: { before: function () { }, after: function () { } }, onmax: { before: function () { }, after: function () { } }, onrestore: { before: function () { }, after: function () { } }, ondestroy: { before: function () { }, after: function () { } }, onvisual: { before: function () { }, after: function () { } }, onmove: { before: function () { }, progress: function () { }, after: function () { } }, onresize: { before: function () { }, progress: function () { }, after: function () { } }, onfocus: function () { }, onexist: function () { }, onswitch: { before: function () { }, after: function () { } }, onstick: { before: function () { }, after: function () { } } } }, defaultButtons: { label: "确定", callback: function () { }, id: "", classes: [], style: "" }, defaultFrames: { id: "", title: "", type: "html", url: "", content: "", useFrameTitle: !1, cloneElementContent: !0, bgColor: "#fff" }, zIndex: 1e7, windows: {}, stickZIndex: 2e7, prevFocusId: null, focusId: null, create: function (n) { var s = this, e = layxDeepClone({}, s.defaults, n || {}), o = {}, ct, lt, at, h, vi, yi, d, rt, ut, ft, ki, yt, oi, pi, l, p, pt, wt, v, bt, g, y, si, kt, wi, et, ot, k, nt, tt, st, a, hi, dt, vt, gi, c, b, ht, bi, ci, li, w, gt, ni, ti, ii, ri, ui, fi, ei, it, di, ai; if (!e.id) { console.error("窗口id不能为空且唯一"); return } if (r.prevFocusId = r.focusId, r.focusId = e.id, ct = s.windows[e.id], ct) { if (ct.status === "min" && s.restore(ct.id), ct.existFlicker === !0 && s.flicker(e.id), i.isFunction(e.event.onexist)) e.event.onexist(ct.layxWindow, ct); return ai = setInterval(function () { e.id !== r.focusId ? s.updateZIndex(e.id) : clearInterval(ai) }, 0), ct } if (i.isArray(e.frames)) for (c = 0; c < e.frames.length; c++)if (e.frames[c] = layxDeepClone({}, s.defaultFrames, e.frames[c]), !e.frames[c].id) { console.error("窗口组窗口id不能为空且窗口组内唯一"); return } if (i.isArray(e.buttons)) for (c = 0; c < e.buttons.length; c++)e.buttons[c] = layxDeepClone({}, s.defaultButtons, e.buttons[c]); if ((e.shadable === !0 || /^(0(\.[0-9])?$)|(1)$/.test(e.shadable)) && (lt = document.createElement("div"), lt.setAttribute("id", "layx-" + e.id + "-shade"), lt.classList.add("layx-shade"), lt.style.zIndex = e.alwaysOnTop === !0 ? ++s.stickZIndex : ++s.zIndex, /^(0(\.[0-9])?$)|(1)$/.test(e.shadable) && (lt.style.backgroundColor = "rgba(0,0,0," + e.shadable + ")"), lt.oncontextmenu = function (n) { return n = n || window.event, n.returnValue = !1, !1 }, lt.onclick = function (n) { n = n || window.event; e.shadeDestroy === !0 ? s.destroy(e.id, null, !0) : e.existFlicker === !0 && s.flicker(e.id); n.stopPropagation() }, document.body.appendChild(lt)), e.style && (at = document.getEl