indicator.js
Summary
No overview generated for 'indicator.js'
Zapatec.Modal = function (config) {
if (arguments.length == 0) {
config = {};
}
this.visible = false;
Zapatec.Modal.SUPERconstructor.call(this, config);
}
Zapatec.Modal.id = "Zapatec.Indicator";
Zapatec.inherit(Zapatec.Modal, Zapatec.Widget);
Zapatec.Modal.prototype.init = function(config){
Zapatec.Modal.SUPERclass.init.call(this, config);
};
Zapatec.Modal.prototype.configure = function(config) {
this.defineConfigOption("zIndex", 1000);
this.defineConfigOption("x", null);
this.defineConfigOption("y", null);
this.defineConfigOption("width", null);
this.defineConfigOption("height", null);
this.defineConfigOption("container", window);
this.defineConfigOption("fixed", false);
Zapatec.Modal.SUPERclass.configure.call(this, config);
config = this.getConfiguration();
if (config.container != window) {
config.x = null;
config.y = null;
config.width = null;
config.height = null;
config.fixed = false;
}
};
Zapatec.Modal.prototype.create = function () {
var config = this.getConfiguration();
config.container = Zapatec.Widget.getElementById(config.container) || window;
this.WCH = Zapatec.Utils.createWCH();
if (Zapatec.windowLoaded) {
this.container = Zapatec.Utils.createElement("div", document.body);
} else {
document.write('<div id="zpModalContainer"></div>');
this.container = document.getElementById('zpModalContainer');
}
this.container.className = this.getClassName({prefix: "zpModal" + (Zapatec.is_opera ? "Opera" : "")})
var st = this.container.style;
st.dispaly = "none";
st.position = "absolute";
st.zIndex = config.zIndex;
};
Zapatec.Modal.prototype.show = function (zIndex) {
if (!this.container) {
this.create();
}
zIndex = zIndex || this.config.zIndex;
this.container.style.zIndex = zIndex;
if (this.WCH) {
this.WCH.style.visibility = "";
this.WCH.style.zIndex = zIndex - 1;
}
this.container.style.display = "block";
this.visible = true;
var config = this.getConfiguration();
if (config.container != window) {
var self = this;
var update = function() {
self.update();
}
if (!this.interval) {
this.interval = setInterval(update, 100);
}
this.update();
} else {
var dim = Zapatec.Utils.getWindowSize();
var width = config.width || dim.width;
var height = config.height || dim.height;
var x = config.x || Zapatec.Utils.getPageScrollX();
var y = config.y || Zapatec.Utils.getPageScrollY();
this.setWidth(width);
this.setHeight(height);
this.setPosition(x, y);
}
if(this.config.fixed == true){
Zapatec.FixateOnScreen.register(this.container);
if (this.WCH){
Zapatec.FixateOnScreen.register(this.WCH);
}
}
};
Zapatec.Modal.prototype.update = function() {
var config = this.getConfiguration();
if (config.container != window && this.visible) {
var offs = Zapatec.Utils.getElementOffset(config.container);
this.setWidth(offs.width);
this.setHeight(offs.height);
this.setPosition(offs.x, offs.y);
}
};
Zapatec.Modal.prototype.hide = function (destroy) {
var config = this.getConfiguration();
if(config.fixed == true){
Zapatec.FixateOnScreen.unregister(this.container);
if (this.WCH){
Zapatec.FixateOnScreen.unregister(this.WCH);
}
}
if (config.container != window) {
clearInterval(this.interval);
this.interval = null;
}
if (this.container) this.container.style.display = "none";
Zapatec.Utils.hideWCH(this.WCH);
if (destroy) {
if (this.WCH){
if (this.WCH.outerHTML) {
this.WCH.outerHTML = "";
} else {
Zapatec.Utils.destroy(this.WCH);
}
}
if (this.container.outerHTML) {
this.container.outerHTML = "";
} else {
Zapatec.Utils.destroy(this.container);
}
this.WCH = null;
this.container = null;
}
this.visible = false;
};
Zapatec.Modal.prototype.setWidth = function(width) {
if (!this.container) {
return;
}
if (Zapatec.Utils.setWidth) {
Zapatec.Utils.setWidth(this.container, width);
Zapatec.Utils.setWidth(this.WCH, width);
} else {
this.container.style.width = width + "px";
if (this.WCH) {
this.WCH.style.width = width + "px";
}
}
};
Zapatec.Modal.prototype.setHeight = function(height) {
if (!this.container) {
return;
}
if (Zapatec.Utils.setHeight) {
Zapatec.Utils.setHeight(this.container, height);
Zapatec.Utils.setHeight(this.WCH, height);
} else {
this.container.style.height = height + "px";
if (this.WCH) {
this.WCH.style.height = height + "px";
}
}
};
Zapatec.Modal.prototype.setPosition = function(x, y) {
if (!this.container) {
return;
}
if (Zapatec.Utils.moveTo) {
Zapatec.Utils.moveTo(this.container, x, y);
Zapatec.Utils.moveTo(this.WCH, x, y);
} else {
this.container.style.left = x + "px";
this.container.style.top = y + "px";
if (this.WCH) {
this.WCH.style.left = x + "px";
this.WCH.style.top = y + "px";
}
}
};
Zapatec.Indicator = function (config) {
if(arguments.length == 0){
config = {};
}
this.active = false;
Zapatec.Indicator.SUPERconstructor.call(this, config);
}
Zapatec.Indicator.id = "Zapatec.Indicator";
Zapatec.inherit(Zapatec.Indicator, Zapatec.Modal);
Zapatec.Indicator.prototype.init = function(config){
Zapatec.Indicator.SUPERclass.init.call(this, config);
};
Zapatec.Indicator.prototype.configure = function(config) {
this.defineConfigOption("themePath", Zapatec.zapatecPath + "../zpextra/themes/indicator/");
Zapatec.Indicator.SUPERclass.configure.call(this, config);
};
Zapatec.Indicator.prototype.create = function() {
Zapatec.Indicator.SUPERclass.create.call(this);
this.indicator = Zapatec.Utils.createElement("div", this.container);
this.indicator.className = "zpIndicator";
var st = this.indicator.style;
st.position = "absolute";
st.zIndex = this.getConfiguration().zIndex;
st.backgroundColor = "#aaaaaa";
};
Zapatec.Indicator.prototype.setWidth = function(width) {
if (!this.container) {
return;
}
Zapatec.Indicator.SUPERclass.setWidth.call(this, width);
var left = Math.round((this.container.offsetWidth - this.indicator.offsetWidth) / 2);
this.indicator.style.left = left + "px";
};
Zapatec.Indicator.prototype.setHeight = function(height) {
if (!this.container) {
return;
}
Zapatec.Indicator.SUPERclass.setHeight.call(this, height);
var top = Math.round((this.container.offsetHeight - this.indicator.offsetHeight) / 2);
this.indicator.style.top = top + "px";
};
Zapatec.Indicator.prototype.hide = function(destroy) {
if (destroy) {
this.indicator = null;
}
Zapatec.Indicator.SUPERclass.hide.call(this, destroy);
};
Zapatec.Indicator.prototype.start = function (message) {
this.active = true;
if (!this.indicator) {
this.create();
}
this.indicator.innerHTML = message;
this.show();
};
Zapatec.Indicator.prototype.stop = function () {
this.active = false;
this.hide(true);
};
Zapatec.Indicator.prototype.isActive = function () {
return this.active;
};
Documentation generated by
JSDoc on Thu Aug 16 12:18:39 2007