TinyMCE_Layer.class.js
Summary
No overview generated for 'TinyMCE_Layer.class.js'
function TinyMCE_Layer(id, bm) {
this.id = id;
this.blockerElement = null;
this.events = false;
this.element = null;
this.blockMode = typeof(bm) != 'undefined' ? bm : true;
this.doc = document;
};
TinyMCE_Layer.prototype = {
moveRelativeTo : function(re, p) {
var rep = this.getAbsPosition(re);
var w = parseInt(re.offsetWidth);
var h = parseInt(re.offsetHeight);
var e = this.getElement();
var ew = parseInt(e.offsetWidth);
var eh = parseInt(e.offsetHeight);
var x, y;
switch (p) {
case "tl":
x = rep.absLeft;
y = rep.absTop;
break;
case "tr":
x = rep.absLeft + w;
y = rep.absTop;
break;
case "bl":
x = rep.absLeft;
y = rep.absTop + h;
break;
case "br":
x = rep.absLeft + w;
y = rep.absTop + h;
break;
case "cc":
x = rep.absLeft + (w / 2) - (ew / 2);
y = rep.absTop + (h / 2) - (eh / 2);
break;
}
this.moveTo(x, y);
},
moveBy : function(x, y) {
var e = this.getElement();
this.moveTo(parseInt(e.style.left) + x, parseInt(e.style.top) + y);
},
moveTo : function(x, y) {
var e = this.getElement();
e.style.left = x + "px";
e.style.top = y + "px";
this.updateBlocker();
},
resizeBy : function(w, h) {
var e = this.getElement();
this.resizeTo(parseInt(e.style.width) + w, parseInt(e.style.height) + h);
},
resizeTo : function(w, h) {
var e = this.getElement();
if (w != null)
e.style.width = w + "px";
if (h != null)
e.style.height = h + "px";
this.updateBlocker();
},
show : function() {
this.getElement().style.display = 'block';
this.updateBlocker();
},
hide : function() {
this.getElement().style.display = 'none';
this.updateBlocker();
},
isVisible : function() {
return this.getElement().style.display == 'block';
},
getElement : function() {
if (!this.element)
this.element = this.doc.getElementById(this.id);
return this.element;
},
setBlockMode : function(s) {
this.blockMode = s;
},
updateBlocker : function() {
var e, b, x, y, w, h;
b = this.getBlocker();
if (b) {
if (this.blockMode) {
e = this.getElement();
x = this.parseInt(e.style.left);
y = this.parseInt(e.style.top);
w = this.parseInt(e.offsetWidth);
h = this.parseInt(e.offsetHeight);
b.style.left = x + 'px';
b.style.top = y + 'px';
b.style.width = w + 'px';
b.style.height = h + 'px';
b.style.display = e.style.display;
} else
b.style.display = 'none';
}
},
getBlocker : function() {
var d, b;
if (!this.blockerElement && this.blockMode) {
d = this.doc;
b = d.createElement("iframe");
b.style.cssText = 'display: none; position: absolute; left: 0; top: 0';
b.src = 'javascript:false;';
b.frameBorder = '0';
b.scrolling = 'no';
d.body.appendChild(b);
this.blockerElement = b;
}
return this.blockerElement;
},
getAbsPosition : function(n) {
var p = {absLeft : 0, absTop : 0};
while (n) {
p.absLeft += n.offsetLeft;
p.absTop += n.offsetTop;
n = n.offsetParent;
}
return p;
},
create : function(n, c, p) {
var d = this.doc, e = d.createElement(n);
e.setAttribute('id', this.id);
if (c)
e.className = c;
if (!p)
p = d.body;
p.appendChild(e);
return this.element = e;
},
parseInt : function(s) {
if (s == null || s == '')
return 0;
return parseInt(s);
}
};
Documentation generated by
JSDoc on Fri Apr 14 21:59:23 2006