....
width = Math.max(doc.body.scrollWidth, width);
height = Math.max(doc.body.scrollHeight+1, 20);
if (AW.getTop(ref) + height > document.body.scrollHeight+1)
{
top = -height;
}
else
{
top = ref.offsetHeight
}
this.setTimeout(function(){
try {
if (AW.getTop(this.element()) + height > document.body.scrollHeight+1)
{
top = -height;
}
else
{
top = this.element().offsetHeight;
}
width = Math.max(doc.body.scrollWidth, width);
height = Math.max(doc.body.scrollHeight+1, 20);
if (popup.isOpen){
popup.show(left, top, width, height, ref);
}
popup = null;
ref = null;
}
catch(err){
}
}, 500); // timeout for resizing popup
....
var height = this.getPopupTemplate().getStyle('height').replace("px","")/1;
var left = AW.getLeft(ref);
var top;
var refTop = AW.getTop(ref);
if (refTop + height > document.body.scrollHeight+1)
{
top = refTop - height -4;// -4 ??? borders ? paddings ? margins ?
}
else
{
top = refTop + ref.offsetHeight;
}
....
AW.Templates.Popup.create = function(){
var obj = this.prototype;
obj.setClass("popup", "normal");
obj.showPopup = function(){
var popup = window.createPopup();
this.$popup = popup;
AW.$popup = this;
var doc = popup.document;
doc.open();
if (AW.strict){
doc.write("<!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.01\/\/EN\" \"http:\/\/www.w3.org/TR/html4/strict.dtd\">");
}
doc.write("<html class=\"aw-popup-window aw-system-control " + AW._htmlClasses + "\"><head>");
AW.register(doc.parentWindow);
for (var i=0; i<document.styleSheets.length; i++){
doc.write(document.styleSheets[i].owningElement.outerHTML);
}
doc.write("</head><body onselectstart=\"return false\" oncontextmenu=\"return false\">");
doc.write(this.getPopupTemplate().toString());
doc.write("</body></html>");
doc.close();
var ref = this.element();
var left = 0;
var top = ref.offsetHeight;
var width = ref.offsetWidth;
var height = 1;
popup.show(left, top, width, height, ref);
width = Math.max(doc.body.scrollWidth, width);
height = Math.max(doc.body.scrollHeight+1, 20);
if (AW.getTop(ref) + height > document.body.scrollHeight+1)
{
top = -height;
}
else
{
top = ref.offsetHeight
}
popup.show(left, top, width, height, ref);
this.setTimeout(function(){
try {
if (AW.getTop(this.element()) + height > document.body.scrollHeight+1)
{
top = -height;
}
else
{
top = this.element().offsetHeight;
}
width = Math.max(doc.body.scrollWidth, width);
height = Math.max(doc.body.scrollHeight+1, 20);
if (popup.isOpen){
popup.show(left, top, width, height, ref);
}
popup = null;
ref = null;
}
catch(err){
}
}, 500); // timeout for resizing popup
};
obj.hidePopup = function(){
if (this.$popup && this.$popup.isOpen ){
this.$popup.hide();
}
if (this.$popup){
this.$popup = null;
}
if (AW.$popup){
AW.$popup = null;
}
};
if (!AW.ie){
obj.showPopup = function(){
if (this.$popup){
document.body.removeChild(this.$popup);
this.$popup = null;
}
var ref = this.element() ? this.element() : document.body;
var height = this.getPopupTemplate().getStyle('height').replace("px","")/1;
var left = AW.getLeft(ref);
var top;
var refTop = AW.getTop(ref);
if (refTop + height > document.body.scrollHeight+1)
{
top = refTop - height -4;// -4 ??? borders ? paddings ? margins ?
}
else
{
top = refTop + ref.offsetHeight;
}
var popup = document.createElement("div");
this.$popup = popup;
AW.$popup = this;
document.body.appendChild(popup);
popup.className = "aw-popup-window aw-system-control";
popup.style.left = left + "px";
popup.style.top = top + "px";
popup.innerHTML = this.getPopupTemplate().toString();
};
obj.hidePopup = function(){
if (this.$popup){
this.setTimeout(function(){
document.body.removeChild(this.$popup);
this.$popup = null;
AW.$popup = null;
});
}
};
obj.onControlDeactivated = function(){
this.hidePopup();
}
}
};
This topic is archived.