Update of /cvsroot/dynapi/dynapi/src/lib/dynapi/gui
In directory usw-pr-cvs1:/tmp/cvs-serv25321
Modified Files:
loadpanel.js
Log Message:
Changed the way LoadPanel loads documents in IE5. Fixes problems I was having with IE5
not loading images. Now also works in IE5 Mac.
Index: loadpanel.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi/src/lib/dynapi/gui/loadpanel.js,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** loadpanel.js 2001/03/01 11:21:19 1.9
--- loadpanel.js 2001/03/22 18:03:48 1.10
***************
*** 23,28 ****
l.oncreate=function(e) {
var o=e.getTarget();
- if (o.isILayer || o.isIFrame) o.insertInlineElements();
- o.findInlineElements();
o.setURL(o.url);
if (!o.isReloading && o.tempURL) {
--- 23,26 ----
***************
*** 54,92 ****
}
};
! LoadPanel.prototype.insertInlineElements = function() {
! if (is.ns4 && this.isILayer) {
! this.setHTML('<ilayer></ilayer>',false);
! }
! else if (is.ns6) {
! this.setHTML('<IFRAME ID="'+this.id+'loadElement" STYLE="visibility:
hidden;"></IFRAME>',false);
! }
! else if (is.ie5) this.setHTML('<DIV ID="'+this.id+'loadElement"
STYLE="behavior:url(#default#download)" style="display: none;"></DIV>',false);
else if (is.ie4) {
! if (this.useBuffer) {
! this.setHTML('<IFRAME ID="'+this.id+'loadElement"
STYLE="visibility: hidden; display: none;"
onLoad="LoadQueue.loadHandler()"></IFRAME>',false);
! }
! else {
! this.setHTML('<IFRAME ID="'+this.id+'loadElement"
WIDTH="+this.getWidth()+" HEIGHT="+this.getHeight()+" STYLE="visibility: hidden;
display: none;" onLoad="LoadQueue.loadHandler()"></IFRAME>',false);
! }
}
};
! LoadPanel.prototype.findInlineElements = function() {
if (is.ns4) {
! if (this.isILayer) {
! this.loadElement = this.doc.layers[0];
! }
! else {
! this.loadElement = this.elm;
! }
}
! else if (is.ns6) {
! this.loadElement = document.getElementById(this.id+'loadElement');
! }
! else if (is.ie) {
! if (this.isIFrame) {
! this.loadElement=document.all[this.id+'loadElement'];
! } else {
! this.loadElement=this.elm;
! }
}
};
--- 52,74 ----
}
};
! LoadPanel.prototype.insertInlineElements=function() {
! if (is.ns4 && this.isILayer) this.setHTML('<ilayer></ilayer>',false);
! else if (is.ns6) this.setHTML('<IFRAME ID="'+this.id+'loadElement"
STYLE="visibility: hidden;"></IFRAME>',false);
! else if (is.ie5) this.setHTML('<IFRAME ID="'+this.id+'loadElement"
STYLE="visibility: hidden; display: none;"></IFRAME>',false);
else if (is.ie4) {
! if (this.useBuffer) this.setHTML('<IFRAME ID="'+this.id+'loadElement"
STYLE="visibility: hidden; display: none;"
onLoad="LoadQueue.loadHandler()"></IFRAME>',false);
! else this.setHTML('<IFRAME ID="'+this.id+'loadElement"
WIDTH="'+this.getWidth()+'" HEIGHT="'+this.getHeight()+'" STYLE="visibility: hidden;
display: none;" onLoad="LoadQueue.loadHandler()"></IFRAME>',false);
}
};
! LoadPanel.prototype.findInlineElements=function() {
if (is.ns4) {
! if (this.isILayer) this.loadElement=this.doc.layers[0];
! else this.loadElement=this.elm;
}
! else if (is.ns6)
this.loadElement=document.getElementById(this.id+'loadElement');
! else if (is.ie5) this.loadElement=document.frames(this.id+'loadElement');
! else if (is.ie4) {
! if (this.isIFrame)
this.loadElement=document.all[this.id+'loadElement'];
! else this.loadElement=this.elm;
}
};
***************
*** 96,162 ****
};
LoadPanel.prototype.clearFile=function() {
! this.url = null
if (this.isILayer) {
this.loadElement.document.write('');
this.loadElement.document.close();
}
! else {
! this.reload();
! }
};
! LoadPanel.prototype.getURL = function() {
return this.url;
};
! LoadPanel.prototype.setURL = function(url) {
if (!url) return;
if (!this.created) this.url=url;
else LoadPanel.queue.add(url,this);
};
! LoadPanel.prototype.reload = function() {
! this.isReloading = true;
! var url = this.url;
! var p = this.parent;
this.removeFromParent();
this.html = '';
p.addChild(this);
! this.isReloading = false;
}
! LoadPanel.prototype.loadHandler = function(url) {
! this.url = url;
if (is.ns4 && this.isILayer) {
! var w = this.loadElement.document.width;
! var h = this.loadElement.document.height;
! }
! else if (is.ns6) {
! var w = this.loadElement.offsetWidth;
! var h = this.loadElement.offsetHeight;
}
else {
! var w = this.getContentWidth();
! var h = this.getContentHeight();
}
if (this.autoW) this.setWidth(w,false);
if (this.autoH) this.setHeight(h,false);
! this.isReloading = false;
this.invokeEvent('load');
};
function LoadQueue() {
! this.queue = new Array();
! this.index = 0;
};
! LoadQueue.prototype.toString = function() {
return "LoadPanel.queue";
};
! LoadQueue.prototype.add = function(url,loadpanel) {
! var q = this.queue.length;
! this.queue[q] = [url,loadpanel];
this.loadNext();
};
! LoadQueue.prototype.loadNext = function() {
if (!this.busy && this.queue[this.index]) {
! this.busy = true;
! var lpanel = this.currentLoadPanel = this.queue[this.index][1];
! var url = this.currentURL = this.queue[this.index][0];
if (is.ns4) {
DynAPI.document.releaseMouseEvents();
var lyr=lpanel.elm;
--- 78,140 ----
};
LoadPanel.prototype.clearFile=function() {
! this.url=null
if (this.isILayer) {
this.loadElement.document.write('');
this.loadElement.document.close();
}
! else this.reload();
};
! LoadPanel.prototype.getURL=function() {
return this.url;
};
! LoadPanel.prototype.setURL=function(url) {
if (!url) return;
if (!this.created) this.url=url;
else LoadPanel.queue.add(url,this);
};
! LoadPanel.prototype.reload=function() {
! this.isReloading=true;
! var url=this.url;
! var p=this.parent;
this.removeFromParent();
this.html = '';
p.addChild(this);
! this.isReloading=false;
}
! LoadPanel.prototype.loadHandler=function(url) {
! this.url=url;
if (is.ns4 && this.isILayer) {
! var w=this.loadElement.document.width;
! var h=this.loadElement.document.height;
}
else {
! var w=this.getContentWidth();
! var h=this.getContentHeight();
}
if (this.autoW) this.setWidth(w,false);
if (this.autoH) this.setHeight(h,false);
! this.isReloading=false;
this.invokeEvent('load');
};
function LoadQueue() {
! this.queue=new Array();
! this.index=0;
};
! LoadQueue.prototype.toString=function() {
return "LoadPanel.queue";
};
! LoadQueue.prototype.add=function(url,loadpanel) {
! var q=this.queue.length;
! this.queue[q]=[url,loadpanel];
this.loadNext();
};
! LoadQueue.prototype.loadNext=function() {
if (!this.busy && this.queue[this.index]) {
! this.busy=true;
! var lpanel=this.currentLoadPanel=this.queue[this.index][1];
! var url=this.currentURL=this.queue[this.index][0];
if (is.ns4) {
+ if (is.ILayer) lpanel.insertInlineElements();
+ lpanel.findInlineElements();
DynAPI.document.releaseMouseEvents();
var lyr=lpanel.elm;
***************
*** 165,216 ****
lpanel.loadElement.onload=LoadQueue.loadHandler;
lpanel.loadElement.src=url;
! }
! else if (is.ns6) {
! if (!document.getElementById(lpanel.id+"loadElement")) {
lpanel.insertInlineElements();
lpanel.findInlineElements();
}
! lpanel.timerID=setInterval(this.toString() +
'.loadTimer()',250);
! lpanel.loadElement.src=url;
! }
! else if (is.ie5) {
! lpanel.loadElement.startDownload(url,LoadQueue.loadHandler);
! }
! else if (is.ie4) {
! if (lpanel.elm.innerHTML.indexOf("<IFRAME") == -1)
lpanel.insertInlineElements();
! lpanel.timerID=setInterval("if
(document.frames['"+lpanel.id+"loadElement'].document.readyState=='interactive')
{clearInterval("+lpanel.toString()+".timerID);LoadQueue.loadHandler(document.frames['"+lpanel.id+"loadElement'].document.body.innerHTML)}",250);
! document.frames[lpanel.id+"loadElement"].document.location=url;
}
DynAPI.removeFromArray(this.queue,this.index);
}
};
! // This function checks the LoadPanel has not been destroyed while the document was
still loading. Should be used for IE4 also.
! LoadQueue.prototype.loadTimer = function() {
! var lpanel = this.currentLoadPanel;
! if (!document.getElementById(lpanel.id+'loadElement')) {
! clearInterval(lpanel.timerID);
! LoadQueue.continueLoad();
! }
! else if (lpanel.loadElement.contentDocument &&
lpanel.loadElement.contentDocument.body.innerHTML != document.body.innerHTML) {
! clearInterval(lpanel.timerID);
! LoadQueue.loadHandler(lpanel.loadElement.contentDocument);
}
}
! LoadQueue.loadHandler = function(e) {
! var q = LoadPanel.queue;
! var lp = q.currentLoadPanel;
if (q.currentLoadPanel) {
if (is.ie) {
! var lyr=lp.elm;
! lyr.innerHTML=e;
}
- else if (is.ns6) {
- var html = e.body.innerHTML;
- var buffer = document.createElement("DIV");
- buffer.innerHTML = html;
- while (lp.elm.hasChildNodes())
lp.elm.removeChild(lp.elm.firstChild);
- lp.elm.appendChild(buffer);
- lp.loadElement = buffer;
- }
else if (is.ns4) {
var lyr = lp.elm;
--- 143,200 ----
lpanel.loadElement.onload=LoadQueue.loadHandler;
lpanel.loadElement.src=url;
! } else {
! if (!lpanel.loadElement) {
lpanel.insertInlineElements();
lpanel.findInlineElements();
}
! if (is.ie5) {
! lpanel.loadElement.location=url;
! lpanel.timerID=setInterval(this.toString() +
'.loadTimer()',250);
! }
! else if (is.ie4) {
! lpanel.timerID=setInterval("if
(document.frames['"+lpanel.id+"loadElement'].document.readyState=='interactive')
{clearInterval("+lpanel.toString()+".timerID);LoadQueue.loadHandler(document.frames['"+lpanel.id+"loadElement'].document.body.innerHTML)}",250);
!
document.frames[lpanel.id+"loadElement"].document.location=url;
! }
! else if (is.ns6) {
! lpanel.timerID=setInterval(this.toString() +
'.loadTimer()',250);
! lpanel.loadElement.src=url;
! }
}
DynAPI.removeFromArray(this.queue,this.index);
}
};
! if (is.ns6) {
! LoadQueue.prototype.loadTimer=function() {
! var lpanel=this.currentLoadPanel;
! if (!document.getElementById(lpanel.id+'loadElement')) {
! clearInterval(lpanel.timerID);
! LoadQueue.continueLoad();
! }
! else if (lpanel.loadElement.contentDocument &&
lpanel.loadElement.contentDocument.body.innerHTML != document.body.innerHTML) {
! clearInterval(lpanel.timerID);
!
LoadQueue.loadHandler(lpanel.loadElement.contentDocument.body.innerHTML);
! }
! }
! } else if (is.ie5) {
! LoadQueue.prototype.loadTimer=function() {
! var lpanel=this.currentLoadPanel;
! if (!document.frames(lpanel.id+'loadElement')) {
! clearInterval(lpanel.timerID);
! LoadQueue.continueLoad();
! }
! else if (lpanel.loadElement.document.readyState=='complete') {
! clearInterval(lpanel.timerID);
!
LoadQueue.loadHandler(lpanel.loadElement.document.body.innerHTML);
! }
}
}
! LoadQueue.loadHandler=function(e) {
! var q=LoadPanel.queue;
! var lp=q.currentLoadPanel;
if (q.currentLoadPanel) {
if (is.ie) {
! lp.elm.innerHTML=e;
! lp.loadElement=null;
}
else if (is.ns4) {
var lyr = lp.elm;
***************
*** 219,233 ****
lp.loadElement.onload = function(){};
}
setTimeout('LoadQueue.continueLoad()',200);
}
};
! LoadQueue.continueLoad = function() {
! var q = LoadPanel.queue;
q.currentLoadPanel.loadHandler(q.currentURL);
q.busy=false;
- // CAM 2001-01-15 The line below breaks netscape when loading large pages
- //if (is.ns4) window.stop();
if (q.queue[q.index]) q.loadNext();
else DynAPI.document.captureMouseEvents();
};
! LoadPanel.queue = new LoadQueue();
\ No newline at end of file
--- 203,219 ----
lp.loadElement.onload = function(){};
}
+ else if (is.ns6) {
+ lp.elm.innerHTML=e;
+ lp.loadElement=null;
+ }
setTimeout('LoadQueue.continueLoad()',200);
}
};
! LoadQueue.continueLoad=function() {
! var q=LoadPanel.queue;
q.currentLoadPanel.loadHandler(q.currentURL);
q.busy=false;
if (q.queue[q.index]) q.loadNext();
else DynAPI.document.captureMouseEvents();
};
! LoadPanel.queue=new LoadQueue();
\ No newline at end of file
_______________________________________________
Dynapi-CVS mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-cvs