dialog: added "focus" callback, whenever a dialog is focussed (moveToTop), implements #2728, fixed a couple jslint warnings

This commit is contained in:
Paul Bakaus 2008-07-04 10:56:29 +00:00
parent 539178291d
commit 3c14d55021

View File

@ -241,8 +241,8 @@ $.widget("ui.dialog", {
var container = this.uiDialogContainer, var container = this.uiDialogContainer,
titlebar = this.uiDialogTitlebar, titlebar = this.uiDialogTitlebar,
content = this.element, content = this.element,
tbMargin = parseInt(content.css('margin-top')) + parseInt(content.css('margin-bottom')), tbMargin = parseInt(content.css('margin-top'),10) + parseInt(content.css('margin-bottom'),10),
lrMargin = parseInt(content.css('margin-left')) + parseInt(content.css('margin-right')); lrMargin = parseInt(content.css('margin-left'),10) + parseInt(content.css('margin-right'),10);
content.height(container.height() - titlebar.outerHeight() - tbMargin); content.height(container.height() - titlebar.outerHeight() - tbMargin);
content.width(container.width() - lrMargin); content.width(container.width() - lrMargin);
}, },
@ -272,7 +272,7 @@ $.widget("ui.dialog", {
// position on open // position on open
moveToTop: function(force) { moveToTop: function(force) {
if ((this.options.modal && !force) if ((this.options.modal && !force)
|| (!this.options.stack && !this.options.modal)) { return; } || (!this.options.stack && !this.options.modal)) { return this.element.triggerHandler("dialogfocus", [null, { options: this.options }], this.options.focus); }
var maxZ = this.options.zIndex, options = this.options; var maxZ = this.options.zIndex, options = this.options;
$('.ui-dialog:visible').each(function() { $('.ui-dialog:visible').each(function() {
@ -280,6 +280,8 @@ $.widget("ui.dialog", {
}); });
(this.overlay && this.overlay.$el.css('z-index', ++maxZ)); (this.overlay && this.overlay.$el.css('z-index', ++maxZ));
this.uiDialog.css('z-index', ++maxZ); this.uiDialog.css('z-index', ++maxZ);
this.element.triggerHandler("dialogfocus", [null, { options: this.options }], this.options.focus);
}, },
close: function() { close: function() {