1/* 2* jQuery UI Dialog 1.8.2 3* 4* Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) 5* Dual licensed under the MIT (MIT-LICENSE.txt) 6* and GPL (GPL-LICENSE.txt) licenses. 7* 8* http://docs.jquery.com/UI/Dialog 9* 10* Depends: 11* jquery.ui.core.js 12* jquery.ui.widget.js 13* jquery.ui.button.js 14* jquery.ui.draggable.js 15* jquery.ui.mouse.js 16* jquery.ui.position.js 17* jquery.ui.resizable.js 18*/ 19(function (c) { 20 c.widget("ui.dialog", { options: { autoOpen: true, buttons: {}, closeOnEscape: true, closeText: "close", dialogClass: "", draggable: false, hide: null, height: "auto", maxHeight: false, maxWidth: false, minHeight: 150, minWidth: 150, modal: false, position: "center", resizable: false, show: null, stack: true, title: "", width: 300, zIndex: 1E3 }, _create: function () { 21 this.originalTitle = this.element.attr("title"); var a = this, b = a.options, d = b.title || a.originalTitle || " ", e = c.ui.dialog.getTitleId(a.element), g = (a.uiDialog = c("<div></div>")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all " + 22b.dialogClass).css({ zIndex: b.zIndex }).attr("tabIndex", -1).css("outline", 0).keydown(function (i) { if (b.closeOnEscape && i.keyCode && i.keyCode === c.ui.keyCode.ESCAPE) { a.close(i); i.preventDefault() } }).attr({ role: "dialog", "aria-labelledby": e }).mousedown(function (i) { a.moveToTop(false, i) }); a.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g); var f = (a.uiDialogTitlebar = c("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g), 23h = c('<a href="#"></a>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role", "button").hover(function () { h.addClass("ui-state-hover") }, function () { h.removeClass("ui-state-hover") }).focus(function () { h.addClass("ui-state-focus") }).blur(function () { h.removeClass("ui-state-focus") }).click(function (i) { a.close(i); return false }).appendTo(f); (a.uiDialogTitlebarCloseText = c("<span></span>")).addClass("ui-icon ui-icon-closethick").text(b.closeText).appendTo(h); c("<span></span>").addClass("ui-dialog-title").attr("id", 24e).html(d).prependTo(f); if (c.isFunction(b.beforeclose) && !c.isFunction(b.beforeClose)) b.beforeClose = b.beforeclose; f.find("*").add(f).disableSelection(); b.draggable && c.fn.draggable && a._makeDraggable(); b.resizable && c.fn.resizable && a._makeResizable(); a._createButtons(b.buttons); a._isOpen = false; c.fn.bgiframe && g.bgiframe() 25 }, _init: function () { this.options.autoOpen && this.open() }, destroy: function () { 26 var a = this; a.overlay && a.overlay.destroy(); a.uiDialog.hide(); a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"); 27 a.uiDialog.remove(); a.originalTitle && a.element.attr("title", a.originalTitle); return a 28 }, widget: function () { return this.uiDialog }, close: function (a) { 29 var b = this, d; if (false !== b._trigger("beforeClose", a)) { 30 b.overlay && b.overlay.destroy(); b.uiDialog.unbind("keypress.ui-dialog"); b._isOpen = false; if (b.options.hide) b.uiDialog.hide(b.options.hide, function () { b._trigger("close", a) }); else { b.uiDialog.hide(); b._trigger("close", a) } c.ui.dialog.overlay.resize(); if (b.options.modal) { 31 d = 0; c(".ui-dialog").each(function () { 32 if (this !== 33b.uiDialog[0]) d = Math.max(d, c(this).css("z-index")) 34 }); c.ui.dialog.maxZ = d 35 } return b 36 } 37 }, isOpen: function () { return this._isOpen }, moveToTop: function (a, b) { 38 var d = this, e = d.options; if (e.modal && !a || !e.stack && !e.modal) return d._trigger("focus", b); if (e.zIndex > c.ui.dialog.maxZ) c.ui.dialog.maxZ = e.zIndex; if (d.overlay) { c.ui.dialog.maxZ += 1; d.overlay.$el.css("z-index", c.ui.dialog.overlay.maxZ = c.ui.dialog.maxZ) } a = { scrollTop: d.element.attr("scrollTop"), scrollLeft: d.element.attr("scrollLeft") }; c.ui.dialog.maxZ += 1; d.uiDialog.css("z-index", 39c.ui.dialog.maxZ); d.element.attr(a); d._trigger("focus", b); return d 40 }, open: function () { 41 if (!this._isOpen) { 42 var a = this, b = a.options, d = a.uiDialog;
42 a.overlay = b.modal ? new c.ui.dialog.overlay(a) : null; d.next().length && d.appendTo("body"); a._size(); a._position(b.position); d.show(b.show); a.moveToTop(true); b.modal && d.bind("keypress.ui-dialog", function (e) { 43 if (e.keyCode === c.ui.keyCode.TAB) { 44 var g = c(":tabbable", this), f = g.filter(":first"); g = g.filter(":last"); if (e.target === g[0] && !e.shiftKey) { f.focus(1); return false } else if (e.target === 45f[0] && e.shiftKey) { g.focus(1); return false } 46 } 47 }); c([]).add(d.find(".ui-dialog-content :tabbable:first")).add(d.find(".ui-dialog-buttonpane :tabbable:first")).add(d).filter(":first").focus(); a._trigger("open"); a._isOpen = true; return a 48 } 49 }, _createButtons: function (a) { 50 var b = this, d = false, e = c("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"); b.uiDialog.find(".ui-dialog-buttonpane").remove(); typeof a === "object" && a !== null && c.each(a, function () { return !(d = true) }); if (d) { 51 c.each(a, 52function (g, f) { g = c('<button type="button"></button>').text(g).click(function () { f.apply(b.element[0], arguments) }).appendTo(e); c.fn.button && g.button() }); e.appendTo(b.uiDialog) 53 } 54 }, _makeDraggable: function () { 55 function a(f) { return { position: f.position, offset: f.offset} } var b = this, d = b.options, e = c(document), g; b.uiDialog.draggable({ cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", handle: ".ui-dialog-titlebar", containment: "document", start: function (f, h) { 56 g = d.height === "auto" ? "auto" : c(this).height(); c(this).height(c(this).height()).addClass("ui-dialog-dragging"); 57 b._trigger("dragStart", f, a(h)) 58 }, drag: function (f, h) { b._trigger("drag", f, a(h)) }, stop: function (f, h) { d.position = [h.position.left - e.scrollLeft(), h.position.top - e.scrollTop()]; c(this).removeClass("ui-dialog-dragging").height(g); b._trigger("dragStop", f, a(h)); c.ui.dialog.overlay.resize() } 59 }) 60 }, _makeResizable: function (a) { 61 function b(f) { return { originalPosition: f.originalPosition, originalSize: f.originalSize, position: f.position, size: f.size} } a = a === undefined ? this.options.resizable : a; var d = this, e = d.options, g = d.uiDialog.css("position"); 62 a = typeof a === "string" ? a : "n,e,s,w,se,sw,ne,nw"; d.uiDialog.resizable({ cancel: ".ui-dialog-content", containment: "document", alsoResize: d.element, maxWidth: e.maxWidth, maxHeight: e.maxHeight, minWidth: e.minWidth, minHeight: d._minHeight(), handles: a, start: function (f, h) { c(this).addClass("ui-dialog-resizing"); d._trigger("resizeStart", f, b(h)) }, resize: function (f, h) { d._trigger("resize", f, b(h)) }, stop: function (f, h) { 63 c(this).removeClass("ui-dialog-resizing"); e.height = c(this).height(); e.width = c(this).width(); d._trigger("resizeStop", 64f, b(h)); c.ui.dialog.overlay.resize() 65 } 66 }).css("position", g).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se") 67 }, _minHeight: function () { var a = this.options; return a.height === "auto" ? a.minHeight : Math.min(a.minHeight, a.height) }, _position: function (a) { 68 var b = [], d = [0, 0]; a = a || c.ui.dialog.prototype.options.position; if (typeof a === "string" || typeof a === "object" && "0" in a) { 69 b = a.split ? a.split(" ") : [a[0], a[1]]; if (b.length === 1) b[1] = b[0]; c.each(["left", "top"], function (e, g) { 70 if (+b[e] === b[e]) { 71 d[e] = b[e]; b[e] = 72g 73 } 74 }) 75 } else if (typeof a === "object") { if ("left" in a) { b[0] = "left"; d[0] = a.left } else if ("right" in a) { b[0] = "right"; d[0] = -a.right } if ("top" in a) { b[1] = "top"; d[1] = a.top } else if ("bottom" in a) { b[1] = "bottom"; d[1] = -a.bottom } } (a = this.uiDialog.is(":visible")) || this.uiDialog.show(); this.uiDialog.css({ top: 0, left: 0 }).position({ my: b.join(" "), at: b.join(" "), offset: d.join(" "), of: window, collision: "fit", using: function (e) { var g = c(this).css(e).offset().top; g < 0 && c(this).css("top", e.top - g) } }); a || this.uiDialog.hide() 76 }, _setOption: function (a, 77b) { 78 var d = this, e = d.uiDialog, g = e.is(":data(resizable)"), f = false; switch (a) { 79 case "beforeclose": a = "beforeClose"; break; case "buttons": d._createButtons(b); break; case "closeText": d.uiDialogTitlebarCloseText.text("" + b); break; case "dialogClass": e.removeClass(d.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all " + b); break; case "disabled": b ? e.addClass("ui-dialog-disabled") : e.removeClass("ui-dialog-disabled"); break; case "draggable": b ? d._makeDraggable() : e.draggable("destroy"); break; 80 case "height": f = true; break; case "maxHeight": g && e.resizable("option", "maxHeight", b); f = true; break; case "maxWidth": g && e.resizable("option", "maxWidth", b); f = true; break; case "minHeight": g && e.resizable("option", "minHeight", b); f = true; break; case "minWidth": g && e.resizable("option", "minWidth", b); f = true; break; case "position": d._position(b); break; case "resizable": g && !b && e.resizable("destroy"); g && typeof b === "string" && e.resizable("option", "handles", b); !g && b !== false && d._makeResizable(b); break; case "title": c(".ui-dialog-title", 81d.uiDialogTitlebar).html("" + (b || " ")); break; case "width": f = true; break 82 } c.Widget.prototype._setOption.apply(d, arguments); f && d._size() 83 }, _size: function () { 84 var a = this.options, b; this.element.css({ width: "auto", minHeight: 0, height: 0 }); b = this.uiDialog.css({ height: "auto", width: a.width }).height(); this.element.css(a.height === "auto" ? { minHeight: Math.max(a.minHeight - b, 0), height: "auto"} : { minHeight: 0, height: Math.max(a.height - b, 0) }).show(); this.uiDialog.is(":data(resizable)") && this.uiDialog.resizable("option", "minHeight", 85this._minHeight()) 86 } 87 }); c.extend(c.ui.dialog, { version: "1.8.2", uuid: 0, maxZ: 0, getTitleId: function (a) { a = a.attr("id"); if (!a) { this.uuid += 1; a = this.uuid } return "ui-dialog-title-" + a }, overlay: function (a) { this.$el = c.ui.dialog.overlay.create(a) } }); c.extend(c.ui.dialog.overlay, { instances: [], oldInstances: [], maxZ: 0, events: c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","), function (a) { return a + ".dialog-overlay" }).join(" "), create: function (a) { 88 if (this.instances.length === 0) { 89 setTimeout(function () { 90 c.ui.dialog.overlay.instances.length && 91c(document).bind(c.ui.dialog.overlay.events, function (d) { return c(d.target).zIndex() >= c.ui.dialog.overlay.maxZ }) 92 }, 1); c(document).bind("keydown.dialog-overlay", function (d) { if (a.options.closeOnEscape && d.keyCode && d.keyCode === c.ui.keyCode.ESCAPE) { a.close(d); d.preventDefault() } }); c(window).bind("resize.dialog-overlay", c.ui.dialog.overlay.resize) 93 } var b = (this.oldInstances.pop() || c("<div></div>").addClass("ui-widget-overlay")).appendTo(document.body).css({ width: this.width(), height: this.height() }); c.fn.bgiframe && 94b.bgiframe(); this.instances.push(b); return b 95 }, destroy: function (a) { this.oldInstances.push(this.instances.splice(c.inArray(a, this.instances), 1)[0]); this.instances.length === 0 && c([document, window]).unbind(".dialog-overlay"); a.remove(); var b = 0; c.each(this.instances, function () { b = Math.max(b, this.css("z-index")) }); this.maxZ = b }, height: function () { 96 var a, b; if (c.browser.msie && c.browser.version < 7) { 97 a = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight); b = Math.max(document.documentElement.offsetHeight, 98document.body.offsetHeight); return a < b ? c(window).height() + "px" : a + "px" 99 } else return c(document).height() + "px" 100 }, width: function () { var a, b; if (c.browser.msie && c.browser.version < 7) { a = Math.max(document.documentElement.scrollWidth, document.body.scrollWidth); b = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth); return a < b ? c(window).width() + "px" : a + "px" } else return c(document).width() + "px" }, resize: function () { 101 var a = c([]); c.each(c.ui.dialog.overlay.instances, function () { a = a.add(this) }); a.css({ width: 0, 102 height: 0 103 }).css({ width: c.ui.dialog.overlay.width(), height: c.ui.dialog.overlay.height() }) 104 } 105 }); c.extend(c.ui.dialog.overlay.prototype, { destroy: function () { c.ui.dialog.overlay.destroy(this.$el) } }) 106})(jQuery); 107;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.