17 lines
22 KiB
JavaScript
17 lines
22 KiB
JavaScript
|
|
/****************************************
|
|||
|
|
|
|||
|
|
@Name:layer v1.8.5 弹层组件压缩版
|
|||
|
|
@Author:贤心
|
|||
|
|
@Date:2014-08-13
|
|||
|
|
@Blog:http://sentsin.com
|
|||
|
|
@Copyright:Sentsin Xu(贤心)
|
|||
|
|
@官网:http://sentsin.com/jquery/layer
|
|||
|
|
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
; !function (a, b) {
|
|||
|
|
"use strict";
|
|||
|
|
var c, d,
|
|||
|
|
e = "", //组件存放目录,为空表示自动获取
|
|||
|
|
f = { getPath: function () { var a = document.scripts, b = a[a.length - 1].src; return e ? e : b.substring(0, b.lastIndexOf("/") + 1) }, type: ["dialog", "page", "iframe", "loading", "tips"] }; a.layer = { v: "1.8.5", ie6: !!a.ActiveXObject && !a.XMLHttpRequest, index: 0, path: f.getPath(), use: function (a, b) { var d = c("head")[0], a = a.replace(/\s/g, ""), e = /\.css$/.test(a), f = document.createElement(e ? "link" : "script"), g = a.replace(/\.|\//g, ""); e && (f.type = "text/css", f.rel = "stylesheet"), f[e ? "href" : "src"] = /^http:\/\//.test(a) ? a : layer.path + a, f.id = g, c("#" + g)[0] || d.appendChild(f), b && (document.all ? c(f).ready(b) : c(f).load(b)) }, alert: function (a, b, d, e) { var f = "function" == typeof d, g = { dialog: { msg: a, type: b, yes: f ? d : e }, area: ["auto", "auto"] }; return f || (g.title = d), c.layer(g) }, confirm: function (a, b, d, e) { var f = "function" == typeof d, g = { dialog: { msg: a, type: 4, btns: 2, yes: b, no: f ? d : e} }; return f || (g.title = d), c.layer(g) }, msg: function (a, d, e, f) { var g = { title: !1, closeBtn: !1, time: d === b ? 2 : d, dialog: { msg: "" === a || a === b ? " " : a }, end: f }; return "object" == typeof e ? (g.dialog.type = e.type, g.shade = e.shade, g.shift = e.rate) : "function" == typeof e ? g.end = e : g.dialog.type = e, c.layer(g) }, load: function (a, b) { return "string" == typeof a ? layer.msg(a, b || 0, 16) : c.layer({ time: a, loading: { type: b }, bgcolor: b ? "#fff" : "", shade: b ? [.1, "#000"] : [0], border: 3 !== b && b ? [6, .3, "#000"] : [0], type: 3, title: ["", !1], closeBtn: [0, !1] }) }, tips: function (a, b, d, e, f, g) { var h = { type: 4, shade: !1, success: function (a) { this.closeBtn || a.find(".xubox_tips").css({ "padding-right": 10 }) }, bgcolor: "", tips: { msg: a, follow: b} }; return h.time = "object" == typeof d ? d.time : 0 | d, d = d || {}, h.closeBtn = d.closeBtn || !1, h.maxWidth = d.maxWidth || e, h.tips.guide = d.guide || f, h.tips.style = d.style || g, h.tips.more = d.more, c.layer(h) } }; var g = ["xubox_layer", "xubox_iframe", ".xubox_title", ".xubox_text", ".xubox_page", ".xubox_main"], h = function (a) { var b = this, d = b.config; layer.index++, b.index = layer.index, b.config = c.extend({}, d, a), b.config.dialog = c.extend({}, d.dialog, a.dialog), b.config.page = c.extend({}, d.page, a.page), b.config.iframe = c.extend({}, d.iframe, a.iframe), b.config.loading = c.extend({}, d.loading, a.loading), b.config.tips = c.extend({}, d.tips, a.tips), b.creat() }; h.pt = h.prototype, h.pt.config = { type: 0, shade: [.3, "#000"], fix: !0, move: ".xubox_title", title: "信息", offset: ["", "50%"], area: ["310px", "auto"], closeBtn: [0, !0], time: 0, bgcolor: "#fff", border: [6, .3, "#000"], zIndex: 19891014, maxWidth: 400, dialog: { btns: 1, btn: ["确定", "取消"], type: 8, msg: "", yes: function (a) { layer.close(a) }, no: function (a) { layer.close(a) } }, page: { dom: "#xulayer", html: "", url: "" }, iframe: { src: "http://sentsin.com", scrolling: "auto" }, loading: { type: 0 }, tips: { msg: "", follow: "", guide: 0, isGuide: !0, style: ["background-color:#FF9900; color:#fff;", "#FF9900"] }, success: function () { }, close: function (a) { layer.close(a) }, end: function () { } }, h.pt.space = function (a) { var b = this, a = a || "", c = b.index, d = b.config, e = d.dialog, f = -1 === e.type ? "" : '<span class="xubox_msg xulayer_png32 xubox_msgico xubox_msgtype' + e.type + '"></span>', h = ['<div class="xubox_dialog">' + f + '<span class="xubox_msg xubox_text" style="' + (f ? "" : "padding-left:20px") + '">' + e.msg + "</span></div>", '<div class="xubox_page">' + a + "</div>", '<iframe scrolling="' + d.iframe.scrolling + '" allowtransparency="true" id="' + g[1] + c + '" name="' + g[1] + c + '" onload="this.className=\'' + g[1] + '\'" class="' + g[1] + '" frameborder="0" src="' + d.iframe.src + '"></iframe>', '<span class="xubox_loading xubox_loading_' + d.loading.type + '"></span>', '<div class="xubox_tips" style="' + d.tips.style[0] + '"><div class="xubox_t
|
|||
|
|
} (window);
|