All Downloads are FREE. Search and download functionalities are using the official Maven repository.

template.js.base.jquery.ui.dialog.min.js Maven / Gradle / Ivy

There is a newer version: 5.0.3
Show newest version
/*! jQuery UI - v1.10.4 - 2014-04-02
 * http://jqueryui.com
 * Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */

(function (e) {
    var t = {buttons: !0, height: !0, maxHeight: !0, maxWidth: !0, minHeight: !0, minWidth: !0, width: !0}, i = {maxHeight: !0, maxWidth: !0, minHeight: !0, minWidth: !0};
    e.widget("ui.dialog", {version: "1.10.4", options: {appendTo: "body", autoOpen: !0, buttons: [], closeOnEscape: !0, closeText: "close", dialogClass: "", draggable: !0, hide: null, height: "auto", maxHeight: null, maxWidth: null, minHeight: 150, minWidth: 150, modal: !1, position: {my: "center", at: "center", of: window, collision: "fit", using: function (t) {
        var i = e(this).css(t).offset().top;
        0 > i && e(this).css("top", t.top - i)
    }}, resizable: !0, show: null, title: null, width: 300, beforeClose: null, close: null, drag: null, dragStart: null, dragStop: null, focus: null, open: null, resize: null, resizeStart: null, resizeStop: null}, _create: function () {
        this.originalCss = {display: this.element[0].style.display, width: this.element[0].style.width, minHeight: this.element[0].style.minHeight, maxHeight: this.element[0].style.maxHeight, height: this.element[0].style.height}, this.originalPosition = {parent: this.element.parent(), index: this.element.parent().children().index(this.element)}, this.originalTitle = this.element.attr("title"), this.options.title = this.options.title || this.originalTitle, this._createWrapper(), this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog), this._createTitlebar(), this._createButtonPane(), this.options.draggable && e.fn.draggable && this._makeDraggable(), this.options.resizable && e.fn.resizable && this._makeResizable(), this._isOpen = !1
    }, _init: function () {
        this.options.autoOpen && this.open()
    }, _appendTo: function () {
        var t = this.options.appendTo;
        return t && (t.jquery || t.nodeType) ? e(t) : this.document.find(t || "body").eq(0)
    }, _destroy: function () {
        var e, t = this.originalPosition;
        this._destroyOverlay(), this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach(), this.uiDialog.stop(!0, !0).remove(), this.originalTitle && this.element.attr("title", this.originalTitle), e = t.parent.children().eq(t.index), e.length && e[0] !== this.element[0] ? e.before(this.element) : t.parent.append(this.element)
    }, widget: function () {
        return this.uiDialog
    }, disable: e.noop, enable: e.noop, close: function (t) {
        var i, a = this;
        if (this._isOpen && this._trigger("beforeClose", t) !== !1) {
            if (this._isOpen = !1, this._destroyOverlay(), !this.opener.filter(":focusable").focus().length)try {
                i = this.document[0].activeElement, i && "body" !== i.nodeName.toLowerCase() && e(i).blur()
            } catch (s) {
            }
            this._hide(this.uiDialog, this.options.hide, function () {
                a._trigger("close", t)
            })
        }
    }, isOpen: function () {
        return this._isOpen
    }, moveToTop: function () {
        this._moveToTop()
    }, _moveToTop: function (e, t) {
        var i = !!this.uiDialog.nextAll(":visible").insertBefore(this.uiDialog).length;
        return i && !t && this._trigger("focus", e), i
    }, open: function () {
        var t = this;
        return this._isOpen ? (this._moveToTop() && this._focusTabbable(), undefined) : (this._isOpen = !0, this.opener = e(this.document[0].activeElement), this._size(), this._position(), this._createOverlay(), this._moveToTop(null, !0), this._show(this.uiDialog, this.options.show, function () {
            t._focusTabbable(), t._trigger("focus")
        }), this._trigger("open"), undefined)
    }, _focusTabbable: function () {
        var e = this.element.find("[autofocus]");
        e.length || (e = this.element.find(":tabbable")), e.length || (e = this.uiDialogButtonPane.find(":tabbable")), e.length || (e = this.uiDialogTitlebarClose.filter(":tabbable")), e.length || (e = this.uiDialog), e.eq(0).focus()
    }, _keepFocus: function (t) {
        function i() {
            var t = this.document[0].activeElement, i = this.uiDialog[0] === t || e.contains(this.uiDialog[0], t);
            i || this._focusTabbable()
        }

        t.preventDefault(), i.call(this), this._delay(i)
    }, _createWrapper: function () {
        this.uiDialog = e("
").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front " + this.options.dialogClass).hide().attr({tabIndex: -1, role: "dialog"}).appendTo(this._appendTo()), this._on(this.uiDialog, {keydown: function (t) { if (this.options.closeOnEscape && !t.isDefaultPrevented() && t.keyCode && t.keyCode === e.ui.keyCode.ESCAPE)return t.preventDefault(), this.close(t), undefined; if (t.keyCode === e.ui.keyCode.TAB) { var i = this.uiDialog.find(":tabbable"), a = i.filter(":first"), s = i.filter(":last"); t.target !== s[0] && t.target !== this.uiDialog[0] || t.shiftKey ? t.target !== a[0] && t.target !== this.uiDialog[0] || !t.shiftKey || (s.focus(1), t.preventDefault()) : (a.focus(1), t.preventDefault()) } }, mousedown: function (e) { this._moveToTop(e) && this._focusTabbable() }}), this.element.find("[aria-describedby]").length || this.uiDialog.attr({"aria-describedby": this.element.uniqueId().attr("id")}) }, _createTitlebar: function () { var t; this.uiDialogTitlebar = e("
").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog), this._on(this.uiDialogTitlebar, {mousedown: function (t) { e(t.target).closest(".ui-dialog-titlebar-close") || this.uiDialog.focus() }}), this.uiDialogTitlebarClose = e("").button({label: this.options.closeText, icons: {primary: "ui-icon-closethick"}, text: !1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar), this._on(this.uiDialogTitlebarClose, {click: function (e) { e.preventDefault(), this.close(e) }}), t = e("").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar), this._title(t), this.uiDialog.attr({"aria-labelledby": t.attr("id")}) }, _title: function (e) { this.options.title || e.html(" "), e.text(this.options.title) }, _createButtonPane: function () { this.uiDialogButtonPane = e("
").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"), this.uiButtonSet = e("
").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane), this._createButtons() }, _createButtons: function () { var t = this, i = this.options.buttons; return this.uiDialogButtonPane.remove(), this.uiButtonSet.empty(), e.isEmptyObject(i) || e.isArray(i) && !i.length ? (this.uiDialog.removeClass("ui-dialog-buttons"), undefined) : (e.each(i, function (i, a) { var s, n; a = e.isFunction(a) ? {click: a, text: i} : a, a = e.extend({type: "button"}, a), s = a.click, a.click = function () { s.apply(t.element[0], arguments) }, n = {icons: a.icons, text: a.showText}, delete a.icons, delete a.showText, e("", a).button(n).appendTo(t.uiButtonSet) }), this.uiDialog.addClass("ui-dialog-buttons"), this.uiDialogButtonPane.appendTo(this.uiDialog), undefined) }, _makeDraggable: function () { function t(e) { return{position: e.position, offset: e.offset} } var i = this, a = this.options; this.uiDialog.draggable({cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", handle: ".ui-dialog-titlebar", containment: "document", start: function (a, s) { e(this).addClass("ui-dialog-dragging"), i._blockFrames(), i._trigger("dragStart", a, t(s)) }, drag: function (e, a) { i._trigger("drag", e, t(a)) }, stop: function (s, n) { a.position = [n.position.left - i.document.scrollLeft(), n.position.top - i.document.scrollTop()], e(this).removeClass("ui-dialog-dragging"), i._unblockFrames(), i._trigger("dragStop", s, t(n)) }}) }, _makeResizable: function () { function t(e) { return{originalPosition: e.originalPosition, originalSize: e.originalSize, position: e.position, size: e.size} } var i = this, a = this.options, s = a.resizable, n = this.uiDialog.css("position"), r = "string" == typeof s ? s : "n,e,s,w,se,sw,ne,nw"; this.uiDialog.resizable({cancel: ".ui-dialog-content", containment: "document", alsoResize: this.element, maxWidth: a.maxWidth, maxHeight: a.maxHeight, minWidth: a.minWidth, minHeight: this._minHeight(), handles: r, start: function (a, s) { e(this).addClass("ui-dialog-resizing"), i._blockFrames(), i._trigger("resizeStart", a, t(s)) }, resize: function (e, a) { i._trigger("resize", e, t(a)) }, stop: function (s, n) { a.height = e(this).height(), a.width = e(this).width(), e(this).removeClass("ui-dialog-resizing"), i._unblockFrames(), i._trigger("resizeStop", s, t(n)) }}).css("position", n) }, _minHeight: function () { var e = this.options; return"auto" === e.height ? e.minHeight : Math.min(e.minHeight, e.height) }, _position: function () { var e = this.uiDialog.is(":visible"); e || this.uiDialog.show(), this.uiDialog.position(this.options.position), e || this.uiDialog.hide() }, _setOptions: function (a) { var s = this, n = !1, r = {}; e.each(a, function (e, a) { s._setOption(e, a), e in t && (n = !0), e in i && (r[e] = a) }), n && (this._size(), this._position()), this.uiDialog.is(":data(ui-resizable)") && this.uiDialog.resizable("option", r) }, _setOption: function (e, t) { var i, a, s = this.uiDialog; "dialogClass" === e && s.removeClass(this.options.dialogClass).addClass(t), "disabled" !== e && (this._super(e, t), "appendTo" === e && this.uiDialog.appendTo(this._appendTo()), "buttons" === e && this._createButtons(), "closeText" === e && this.uiDialogTitlebarClose.button({label: "" + t}), "draggable" === e && (i = s.is(":data(ui-draggable)"), i && !t && s.draggable("destroy"), !i && t && this._makeDraggable()), "position" === e && this._position(), "resizable" === e && (a = s.is(":data(ui-resizable)"), a && !t && s.resizable("destroy"), a && "string" == typeof t && s.resizable("option", "handles", t), a || t === !1 || this._makeResizable()), "title" === e && this._title(this.uiDialogTitlebar.find(".ui-dialog-title"))) }, _size: function () { var e, t, i, a = this.options; this.element.show().css({width: "auto", minHeight: 0, maxHeight: "none", height: 0}), a.minWidth > a.width && (a.width = a.minWidth), e = this.uiDialog.css({height: "auto", width: a.width}).outerHeight(), t = Math.max(0, a.minHeight - e), i = "number" == typeof a.maxHeight ? Math.max(0, a.maxHeight - e) : "none", "auto" === a.height ? this.element.css({minHeight: t, maxHeight: i, height: "auto"}) : this.element.height(Math.max(0, a.height - e)), this.uiDialog.is(":data(ui-resizable)") && this.uiDialog.resizable("option", "minHeight", this._minHeight()) }, _blockFrames: function () { this.iframeBlocks = this.document.find("iframe").map(function () { var t = e(this); return e("
").css({position: "absolute", width: t.outerWidth(), height: t.outerHeight()}).appendTo(t.parent()).offset(t.offset())[0] }) }, _unblockFrames: function () { this.iframeBlocks && (this.iframeBlocks.remove(), delete this.iframeBlocks) }, _allowInteraction: function (t) { return e(t.target).closest(".ui-dialog").length ? !0 : !!e(t.target).closest(".ui-datepicker").length }, _createOverlay: function () { if (this.options.modal) { var t = this, i = this.widgetFullName; e.ui.dialog.overlayInstances || this._delay(function () { e.ui.dialog.overlayInstances && this.document.bind("focusin.dialog", function (a) { t._allowInteraction(a) || (a.preventDefault(), e(".ui-dialog:visible:last .ui-dialog-content").data(i)._focusTabbable()) }) }), this.overlay = e("
").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()), this._on(this.overlay, {mousedown: "_keepFocus"}), e.ui.dialog.overlayInstances++ } }, _destroyOverlay: function () { this.options.modal && this.overlay && (e.ui.dialog.overlayInstances--, e.ui.dialog.overlayInstances || this.document.unbind("focusin.dialog"), this.overlay.remove(), this.overlay = null) }}), e.ui.dialog.overlayInstances = 0, e.uiBackCompat !== !1 && e.widget("ui.dialog", e.ui.dialog, {_position: function () { var t, i = this.options.position, a = [], s = [0, 0]; i ? (("string" == typeof i || "object" == typeof i && "0"in i) && (a = i.split ? i.split(" ") : [i[0], i[1]], 1 === a.length && (a[1] = a[0]), e.each(["left", "top"], function (e, t) { +a[e] === a[e] && (s[e] = a[e], a[e] = t) }), i = {my: a[0] + (0 > s[0] ? s[0] : "+" + s[0]) + " " + a[1] + (0 > s[1] ? s[1] : "+" + s[1]), at: a.join(" ")}), i = e.extend({}, e.ui.dialog.prototype.options.position, i)) : i = e.ui.dialog.prototype.options.position, t = this.uiDialog.is(":visible"), t || this.uiDialog.show(), this.uiDialog.position(i), t || this.uiDialog.hide() }}) })(jQuery);




© 2015 - 2024 Weber Informatics LLC | Privacy Policy