maximizable.js
Summary
No overview generated for 'maximizable.js'
Zapatec.Utils.Maximizable = function(config) {
Zapatec.Utils.Maximizable.SUPERconstructor.call(this, config);
};
Zapatec.Utils.Maximizable.id = "Zapatec.Utils.Maximizable";
Zapatec.inherit(Zapatec.Utils.Maximizable, Zapatec.Widget);
Zapatec.Utils.Maximizable.prototype.init = function(config) {
Zapatec.Utils.Maximizable.SUPERclass.init.call(this, config);
this.isMaximized = false;
};
Zapatec.Utils.Maximizable.prototype.configure = function(config) {
this.defineConfigOption("container", null);
this.defineConfigOption("theme", null);
this.defineConfigOption('maximizedBorder', 6);
Zapatec.Utils.Maximizable.SUPERclass.configure.call(this, config);
config = this.getConfiguration();
if(typeof(config.container) == "string"){
config.container = document.getElementById(this.config.container);
}
};
Zapatec.Utils.Maximizable.prototype.reconfigure = function(config) {
Zapatec.Utils.Maximizable.SUPERclass.reconfigure.call(this, config);
};
Zapatec.Utils.Maximizable.prototype.getContainer = function() {
return this.getConfiguration().container;
};
Zapatec.Utils.Maximizable.prototype.setMaximized = function(isMaximized) {
if (isMaximized == this.isMaximized) {
return;
}
this.isMaximized = isMaximized;
var body;
if (Zapatec.is_ie) {
body = document.getElementsByTagName('html');
}
else {
body = document.getElementsByTagName('body');
}
if (true == isMaximized) {
this.restoreState = {};
this.restoreState.containerRestorer = new Zapatec.SRProp(
this.config.container);
this.restoreState.containerRestorer.saveProps("style.left", "style.top",
"style.width", "style.height", "style.position");
this.fireEvent('onBeforeMaximize', this.restoreState);
this.restoreState.scrollTop = Zapatec.Utils.getPageScrollY();
this.restoreState.onresize = window.onresize;
this.config.container.style.position = 'absolute';
this.config.container.style.left = this.config.maximizedBorder + 'px';
this.config.container.style.top = this.config.maximizedBorder + 'px';
window.scroll(0,0);
this.restoreState.oldBodyOverflow = body[0].style.overflow;
body[0].style.overflow = "hidden";
var self = this;
var resizeFunc = function() {
var size = Zapatec.Utils.getWindowSize();
var width = size.width - 2*self.config.maximizedBorder -4;
var height = size.height - 2*self.config.maximizedBorder;
self.setSize(width, height);
}
resizeFunc();
window.onresize = resizeFunc;
}
else {
this.fireEvent('onBeforeRestore', this.restoreState);
window.onresize = this.restoreState.onresize;
body[0].style.overflow = this.restoreState.oldBodyOverflow;
this.restoreState.containerRestorer.restoreProps("style.left", "style.top",
"style.width", "style.height", "style.position");
window.scroll(0, this.restoreState.scrollTop);
this.fireEvent('onAfterRestore', this.restoreState);
this.restoreState = null;
}
}
Zapatec.Utils.Maximizable.prototype.setSize = function(width, height) {
if (!width && !height) {
width = parseInt(this.config.container.style.width);
height = parseInt(this.config.container.style.height);
}
this.config.container.style.width = width + 'px';
this.config.container.style.height = height + 'px';
this.fireEvent('onAfterSize', width, height);
}
Documentation generated by
JSDoc on Thu Aug 16 12:18:39 2007