1
0
Fork 0
forked from 0x2620/oxjs

update URL controller

This commit is contained in:
rlx 2011-11-09 17:39:06 +00:00
commit bb59e0a3b4
3 changed files with 72 additions and 68 deletions

View file

@ -38,6 +38,7 @@ Ox.Dialog = function(options, self) {
maxWidth: Infinity,
minHeight: 64,
minWidth: 128,
removeOnClose: false,
title: '',
width: 400
})
@ -647,22 +648,26 @@ Ox.Dialog = function(options, self) {
};
that.close = function(callback) {
that.animate({
opacity: 0
}, 250, function() {
// that.remove();
that.hide();
callback && callback();
});
if (self.maximized) {
self.$maximizeButton.toggleTitle();
self.maximized = false;
if (self.isOpen) {
self.isOpen = false;
that.animate({
opacity: 0
}, 250, function() {
// that.remove();
that.hide();
callback && callback();
});
if (self.maximized) {
self.$maximizeButton.toggleTitle();
self.maximized = false;
}
if (self.options.focus) {
self.$layer.hide();
that.loseFocus();
}
that.triggerEvent('close');
self.options.removeOnClose && that.remove();
}
if (self.options.focus) {
self.$layer.hide();
that.loseFocus();
}
that.triggerEvent('close');
return that;
};
@ -689,35 +694,38 @@ Ox.Dialog = function(options, self) {
};
that.open = function() {
self.initialHeight = self.options.height;
self.initialWidth = self.options.width;
setMinAndMax();
center();
reset();
that.css({
opacity: 0
}).show().animate({
opacity: 1
}, 250);
if (self.options.focus) {
self.$layer.show();
that.gainFocus();
}
Ox.UI.$window.bind({
resize: function() {
var offset = that.offset();
setMinAndMax();
if (self.centered) {
center();
} else {
that.css({
left: Math.min(offset.left, self.maxLeft) + 'px',
top: Math.min(offset.top, self.maxTop) + 'px'
});
}
if (!self.isOpen) {
self.isOpen = true;
self.initialHeight = self.options.height;
self.initialWidth = self.options.width;
setMinAndMax();
center();
reset();
that.css({
opacity: 0
}).show().animate({
opacity: 1
}, 250);
if (self.options.focus) {
self.$layer.show();
that.gainFocus();
}
});
that.triggerEvent('open');
Ox.UI.$window.bind({
resize: function() {
var offset = that.offset();
setMinAndMax();
if (self.centered) {
center();
} else {
that.css({
left: Math.min(offset.left, self.maxLeft) + 'px',
top: Math.min(offset.top, self.maxTop) + 'px'
});
}
}
});
that.triggerEvent('open');
}
return that;
};