/* ui/dialog-1.0.0.js Date:2015-09-15 18:39:14 */ //alert('load ui/dialog-1.0.0') !function(a) { a.ui.define("dialog", { options: { hasCssLink: !0, baseVersion: "1.0.0", cssLinkVersion: "1.0.0", maskHas: !0, maskClass: "ui-mask", maskIframe: !1, maskClose: !1, opacity: .15, zIndex: 9998, type: "text", source: null, extendMainClass: null, autoIframe: !0, autoOpen: !0, autoCloseTime: 0, title: !0, hasButton: !1, submitButton: "\u786e\u8ba4", cancelButton: "\u53d6\u6d88", onSubmit: null, onCancel: null, closeButton: !0, onReady: null, width: 480, height: null, fixed: !1, autoUpdate: !1, maskId: null, mainId: null, contentId: null, titleId: null, iframeName: "dialogIframe", iframeTimestamp: !0, x:null, y:null, }, init: function() { var b = this.options; a.browser.isIE6() && (b.fixed = !1), this.createMain(), this.createMask(), this.mainStyle(), b.autoOpen ? this.open() : this.hide(), this.bind(); }, show: function() { this.mask && this.mask.show(), this.el.show() }, hide: function() { this.mask && this.mask.hide(), this.el.hide() }, tpl: { mask: '
', close: '', title: '
<%=title%>
', wrap: '
', conten: '
', button: '
<%if($.trim(submit)){%><%=submit%><%}%>' + '<%if($.trim(cancel)){%><%=cancel%><%}%>
' }, createMain: function() { var c = this.options; var d = ""; c.title && (d = a.tpl(this.tpl.title, { title: c.title })); var e = a.tpl(this.tpl.button, { submit: this.options.submitButton, cancel: this.options.cancelButton }); var f = d + this.tpl.conten + (c.hasButton ? e: ""); this.el = a(this.tpl.wrap), c.extendMainClass && this.el.addClass(c.extendMainClass), a(f).appendTo(this.el), this.el.appendTo("body"), this.content = this.el.find(".ui-dialog-content"), this.title = this.el.find(".ui-dialog-title"), c.mainId && this.el.attr("id", c.mainId), c.contentId && this.content.attr("id", c.contentId), c.titleId && this.title.attr("id", c.titleId), c.closeButton && this.el.append(this.tpl.close) }, createMask: function() { var b = this; var c = this.options; if (c.maskHas) { { this.mask = a(document.createElement("div")) } this.mask.addClass(c.maskClass).css({ position: "absolute", left: 0, top: 0, opacity: c.opacity, zIndex: c.zIndex, backgroundColor: "#000", width: a.page.docWidth(), height: a.page.docHeight() }), c.maskId && this.mask.attr("id", c.maskId), a("." + c.maskClass)[0] || this.mask.appendTo("body"), (a.browser.isIE6() || c.maskIframe) && this.mask.append('').css(d).appendTo(this.content); break; case "image": var e = b.width ? 'width="' + b.width + '"': ""; var f = b.height ? 'height="' + b.height + '"': ""; var g = a(""); g.appendTo(this.content), g.bind("load", function() { c.updateMain() }); break; case "json": } c.updateMain() }, close: function() { var a = this.options; this.options.autoCloseTime; this.el.remove(), this.mask && this.mask.remove(), a.onCancel && a.onCancel.call(this) }, autoClose: function() { var b = this; var c = this.options.autoCloseTime; if (c) { var d = c; a("
" + d + "\u79d2\u540e\u81ea\u52a8\u5173\u95ed
").appendTo(this.el), clearInterval(window.autoCloseTimerDialog), window.autoCloseTimerDialog = setInterval(function() { d--, a("#ui-autoclose").html(d), 0 == d && (d = c, b.close(), clearInterval(window.autoCloseTimerDialog)) }, 1e3), this.updateMain() } }, getIframeHeight: function(a) { var b = a[0].contentWindow.document; return b.body.scrollHeight && b.documentElement.scrollHeight ? Math.min(b.body.scrollHeight, b.documentElement.scrollHeight) : b.documentElement.scrollHeight ? b.documentElement.scrollHeight: b.body.scrollHeight ? b.body.scrollHeight: void 0 }, syncHeight: function() { this.options; var b; try { b = this.getIframeHeight(this.iframe) } catch(c) { b = 100 } this.iframe.css({ height: b }), this.updateMain() }, iframeSet: function() { var a = this; var b = this.options; "iframe" == b.type && b.autoIframe && this.iframe.one("load", function() { a.syncHeight() }) } }), a.closeDialog = function() { a(".ui-dialog,.ui-mask").remove(), clearInterval(window.autoCloseTimerDialog) } } (jQuery);