2007-09-15 03:08:25 +02:00
|
|
|
/**
|
|
|
|
* @author Mateusz
|
|
|
|
*/
|
|
|
|
var ImageBox = {
|
|
|
|
|
|
|
|
initialize: function() {
|
2007-09-16 02:49:34 +02:00
|
|
|
this.indicatorWidth = 32;
|
|
|
|
this.indicatorHeight = 32;
|
2007-09-15 03:08:25 +02:00
|
|
|
this.showIndicator = ImageBox.showIndicator.bind(this);
|
|
|
|
this.hideIndicator = ImageBox.hideIndicator.bind(this);
|
|
|
|
this.reCenterIndicator = ImageBox.reCenterIndicator.bind(this);
|
|
|
|
this.centerIndicator = ImageBox.centerIndicator.bind(this);
|
|
|
|
this.center = ImageBox.center.bind(this);
|
2007-09-15 22:53:26 +02:00
|
|
|
this.imageContainer = Positioning.addBehaviour($('imageContainer'));
|
|
|
|
Element.hide(this.imageContainer);
|
|
|
|
this.indicator = Positioning.addBehaviour($('loadingIndicatorContainer'));
|
|
|
|
this.indicatorImage = Positioning.addBehaviour($('loadingIndicator'));
|
2007-09-16 04:23:10 +02:00
|
|
|
Positioning.addBehaviour($('Main'));
|
2007-09-15 03:08:25 +02:00
|
|
|
},
|
|
|
|
|
2007-09-15 22:53:26 +02:00
|
|
|
showIndicator: function(container) {
|
2007-09-16 02:49:34 +02:00
|
|
|
Element.show(this.indicator,this.indicatorImage);
|
2007-09-15 22:53:26 +02:00
|
|
|
if(container == null) container = this.imageContainer;
|
|
|
|
this.centerIndicator(container);
|
2007-09-15 03:08:25 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
hideIndicator: function() {
|
2007-09-16 02:49:34 +02:00
|
|
|
Element.hide(this.indicator,this.indicatorImage);
|
2007-09-15 03:08:25 +02:00
|
|
|
},
|
|
|
|
|
2007-09-15 22:53:26 +02:00
|
|
|
centerIndicator: function(container) {
|
|
|
|
var top = container.getTop();
|
|
|
|
var left = container.getLeft();
|
|
|
|
var width = container.getWidth();
|
|
|
|
var height = container.getHeight();
|
|
|
|
var parentTop = container.getParentTop();
|
|
|
|
var parentLeft = container.getParentLeft();
|
2007-09-16 03:30:43 +02:00
|
|
|
this.indicator.style.left = width/2 - this.indicatorWidth/2 + "px";
|
|
|
|
this.indicator.style.top = height/2 - this.indicatorHeight/2 + "px";
|
2007-09-15 03:08:25 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
reCenterIndicator: function() {
|
2007-09-16 03:30:43 +02:00
|
|
|
if(Element.visible(this.indicator)) {
|
2007-09-15 22:53:26 +02:00
|
|
|
this.centerIndicator(this.imageContainer);
|
2007-09-15 03:08:25 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
center: function() {
|
2007-09-15 22:53:26 +02:00
|
|
|
this.imageContainer.style.left = this.imageContainer.getParentWidth()/2 - this.imageContainer.getWidth()/2 + 'px';
|
|
|
|
this.imageContainer.style.top = this.imageContainer.getParentHeight()/2 - this.imageContainer.getHeight()/2 + 'px';
|
2007-09-15 03:08:25 +02:00
|
|
|
}
|
|
|
|
};
|