mirrored from git://git.moodle.org/moodle.git
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-17702 replace iframe with object to be compatible with XHTML 1.0 …
…strict
- Loading branch information
Gordon Bateson
committed
May 1, 2010
1 parent
d55e516
commit f5bf248
Showing
2 changed files
with
111 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,57 @@ | ||
<!-- | ||
function domSniffer() { | ||
var t = true; | ||
var s = navigator.userAgent; | ||
if (s.indexOf("Mac") >=0) this.mac = t; | ||
if (s.indexOf("Opera") >=0) this.opera = t; | ||
var d = document; | ||
if (d.layers) this.n4 = t; | ||
if (d.childNodes) this.dom = t; | ||
if (d.all && d.plugins) this.ie = t; | ||
var t = true; | ||
var s = navigator.userAgent; | ||
if (s.indexOf("Mac") >=0) this.mac = t; | ||
if (s.indexOf("Opera") >=0) this.opera = t; | ||
var d = document; | ||
if (d.layers) this.n4 = t; | ||
if (d.childNodes) this.dom = t; | ||
if (d.all && d.plugins) this.ie = t; | ||
} | ||
function getContentH(lyr) { | ||
return (is.n4) ? lyr.document.height : (is.ie) ? (is.mac ? lyr.offsetHeight : lyr.scrollHeight) : (is.opera) ? lyr.style.pixelHeight : (is.dom) ? lyr.offsetHeight : 0; | ||
return (is.n4) ? lyr.document.height : (is.ie) ? (is.mac ? lyr.offsetHeight : lyr.scrollHeight) : (is.opera) ? lyr.style.pixelHeight : (is.dom) ? lyr.offsetHeight : 0; | ||
} | ||
function px(i) { | ||
return i + "px"; | ||
return i + "px"; | ||
} | ||
function setSize(obj, w, h) { | ||
if (is.n4) { | ||
if (w) obj.width = w; | ||
if (h) obj.height = h; | ||
} else if (is.opera) { | ||
// opera 5 needs pixelWidth/Height | ||
if (w) obj.style.pixelWidth = w; | ||
if (h) obj.style.pixelHeight = h; | ||
} else { | ||
if (w) obj.style.width = px(w); | ||
if (h) obj.style.height = px(h); | ||
} | ||
if (is.n4) { | ||
if (w) obj.width = w; | ||
if (h) obj.height = h; | ||
} else if (is.opera) { | ||
// opera 5 needs pixelWidth/Height | ||
if (w) obj.style.pixelWidth = w; | ||
if (h) obj.style.pixelHeight = h; | ||
} else { | ||
if (w) obj.style.width = px(w); | ||
if (h) obj.style.height = px(h); | ||
} | ||
} | ||
function getElement(id, lyr) { | ||
var d = (document.layers && lyr) ? lyr.document : document; | ||
var obj = (document.layers) ? eval("d."+id) : (d.all) ? d.all[id] : (d.getElementById) ? d.getElementById(id) : null; | ||
return obj; | ||
var d = (document.layers && lyr) ? lyr.document : document; | ||
var obj = (document.layers) ? eval("d."+id) : (d.all) ? d.all[id] : (d.getElementById) ? d.getElementById(id) : null; | ||
return obj; | ||
} | ||
is = new domSniffer(); | ||
function set_iframe_height(id) { | ||
var iframe = getElement(id); | ||
if (iframe) { | ||
var obj = iframe.document || iframe.contentDocument || null; // IE || FireFox | ||
if (obj) { | ||
if (obj.body) { | ||
obj = obj.body; | ||
} | ||
var h = getContentH(obj); | ||
if (h) { | ||
setSize(iframe, 0, h); | ||
} | ||
} | ||
} | ||
function set_object_height(myObject) { | ||
if (myObject) { | ||
if (document.frames) { | ||
var obj = myObject; // IE - obj is alaredy a document element | ||
} else { | ||
var obj = myObject.document || myObject.contentDocument || null; // IE || FireFox | ||
} | ||
if (obj) { | ||
if (obj.body) { | ||
obj = obj.body; | ||
} | ||
var h = getContentH(obj); | ||
if (h) { | ||
setSize(myObject, 0, h + 65); | ||
} | ||
if (document.all) { | ||
myObject.allowTransparency = true; | ||
obj.style.backgroundColor = 'transparent'; | ||
} | ||
} | ||
} | ||
} | ||
//--> | ||
is = new domSniffer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters