allow for dialog that does not gain focus
This commit is contained in:
parent
917608950d
commit
428744c8bf
1 changed files with 12 additions and 6 deletions
|
@ -19,6 +19,7 @@ Ox.Dialog = function(options, self) {
|
||||||
title: '',
|
title: '',
|
||||||
buttons: [],
|
buttons: [],
|
||||||
content: null,
|
content: null,
|
||||||
|
focus: true,
|
||||||
height: 216,
|
height: 216,
|
||||||
keys: {},
|
keys: {},
|
||||||
minHeight: 144,
|
minHeight: 144,
|
||||||
|
@ -318,8 +319,10 @@ Ox.Dialog = function(options, self) {
|
||||||
that.$buttons.forEach(function($button) {
|
that.$buttons.forEach(function($button) {
|
||||||
$button.removeElement();
|
$button.removeElement();
|
||||||
});
|
});
|
||||||
|
if (self.options.focus) {
|
||||||
that.loseFocus();
|
that.loseFocus();
|
||||||
that.$layer.removeElement();
|
that.$layer.removeElement();
|
||||||
|
}
|
||||||
that.removeElement();
|
that.removeElement();
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
|
@ -359,7 +362,9 @@ Ox.Dialog = function(options, self) {
|
||||||
|
|
||||||
that.open = function() {
|
that.open = function() {
|
||||||
//Ox.print('before open')
|
//Ox.print('before open')
|
||||||
|
if (self.options.focus) {
|
||||||
that.$layer.appendTo(Ox.UI.$body);
|
that.$layer.appendTo(Ox.UI.$body);
|
||||||
|
}
|
||||||
that.css({
|
that.css({
|
||||||
opacity: 0
|
opacity: 0
|
||||||
}).appendTo(Ox.UI.$body).animate({
|
}).appendTo(Ox.UI.$body).animate({
|
||||||
|
@ -367,9 +372,10 @@ Ox.Dialog = function(options, self) {
|
||||||
}, 200);
|
}, 200);
|
||||||
center();
|
center();
|
||||||
reset();
|
reset();
|
||||||
// fixme: the following line prevents preview-style dialog
|
if (self.options.focus) {
|
||||||
that.gainFocus();
|
that.gainFocus();
|
||||||
Ox.UI.$window.bind('mouseup', mouseupLayer);
|
Ox.UI.$window.bind('mouseup', mouseupLayer);
|
||||||
|
}
|
||||||
//Ox.print('after open')
|
//Ox.print('after open')
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue