Skip to content

Commit

Permalink
Merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
Arian committed May 27, 2010
2 parents b748281 + 64dc47f commit fc01ded
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions Source/MooDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,17 @@ var MooDialog = new Class({
}

this.ie6 = Browser.Engine.trident && Browser.Engine.version <= 4;
var options = this.options, optionsSize = options.size;

var x = this.options.size.width,
y = this.options.size.height;
var x = optionsSize.width,
y = optionsSize.height;

this.wrapper = new Element('div', {
var wrapper = this.wrapper = new Element('div', {
'class': 'MooDialog',
styles: {
width: x,
height: y,
position: this.options.scroll && !this.ie6 ? 'fixed' : 'absolute',
position: options.scroll && !this.ie6 ? 'fixed' : 'absolute',
'z-index': 6000,
opacity: 0
}
Expand All @@ -83,17 +84,17 @@ var MooDialog = new Class({
//overflow: 'auto' //fix
overflow: overflowBox //fix
}
}).inject(this.wrapper);
}).inject(wrapper);

if(this.options.title){
if(options.title){
this.title = new Element('div',{
'class': 'title',
'text': this.options.title
}).inject(this.wrapper);
this.wrapper.addClass('MooDialogTitle');
'text': options.title
}).inject(wrapper);
wrapper.addClass('MooDialogTitle');
}

if(this.options.closeButton){
if(options.closeButton){
this.closeButton = new Element('a',{
'class': 'close',
events: {
Expand All @@ -103,7 +104,7 @@ var MooDialog = new Class({

}.bind(this)
}
}).inject(this.wrapper);
}).inject(wrapper);
}


Expand All @@ -112,21 +113,21 @@ var MooDialog = new Class({
this.setPosition((docSize.x - x)/2,(docSize.y - y)/2);

// IE 6 scroll
if(this.options.scroll && this.ie6){
if(options.scroll && this.ie6){
window.addEvent('scroll',function(e){
this.setPosition((docSize.x - x)/2,(docSize.y - y)/2);
}.bind(this));
}

// Add the fade in/out effects if no other effect is defined
if(!this.fx){
this.fx = this.options.fx.type == 'morph' ?
new Fx.Morph(this.wrapper,this.options.fx.options) :
new Fx.Tween(this.wrapper,this.options.fx.options);
this.fx = options.fx.type == 'morph' ?
new Fx.Morph(wrapper,options.fx.options) :
new Fx.Tween(wrapper,options.fx.options);
}
this.fx.addEvent('complete',function(){
this.fireEvent(this.open ? 'show' : 'hide');
if (this.options.disposeOnClose && !this.open) {
if (options.disposeOnClose && !this.open) {
this.dispose();
}
}.bind(this));
Expand Down Expand Up @@ -154,16 +155,17 @@ var MooDialog = new Class({
},

setPosition: function(x,y){
x += this.options.offset.x;
y += this.options.offset.y;
var options = this.options, wrapper = this.wrapper;
x += options.offset.x;
y += options.offset.y;
x = x < 10 ? 10 : x;
y = y < 10 ? 10 : y;
if(this.wrapper.getStyle('position') != 'fixed'){
if(wrapper.getStyle('position') != 'fixed'){
var scroll = document.id(document.body).getScroll();
x += scroll.x;
y += scroll.y
}
this.wrapper.setStyles({
wrapper.setStyles({
left: x,
top: y
});
Expand Down

0 comments on commit fc01ded

Please sign in to comment.