diff --git a/source/Ox.UI/js/Window/Ox.Dialog.js b/source/Ox.UI/js/Window/Ox.Dialog.js index 3866a610..afb9a4f7 100644 --- a/source/Ox.UI/js/Window/Ox.Dialog.js +++ b/source/Ox.UI/js/Window/Ox.Dialog.js @@ -19,6 +19,7 @@ Ox.Dialog = function(options, self) { title: '', buttons: [], content: null, + focus: true, height: 216, keys: {}, minHeight: 144, @@ -318,8 +319,10 @@ Ox.Dialog = function(options, self) { that.$buttons.forEach(function($button) { $button.removeElement(); }); - that.loseFocus(); - that.$layer.removeElement(); + if (self.options.focus) { + that.loseFocus(); + that.$layer.removeElement(); + } that.removeElement(); callback(); }); @@ -359,7 +362,9 @@ Ox.Dialog = function(options, self) { that.open = function() { //Ox.print('before open') - that.$layer.appendTo(Ox.UI.$body); + if (self.options.focus) { + that.$layer.appendTo(Ox.UI.$body); + } that.css({ opacity: 0 }).appendTo(Ox.UI.$body).animate({ @@ -367,9 +372,10 @@ Ox.Dialog = function(options, self) { }, 200); center(); reset(); - // fixme: the following line prevents preview-style dialog - that.gainFocus(); - Ox.UI.$window.bind('mouseup', mouseupLayer); + if (self.options.focus) { + that.gainFocus(); + Ox.UI.$window.bind('mouseup', mouseupLayer); + } //Ox.print('after open') return that; };