}
function oembed_iframe($src,$width,$height) {
+
if(! $width || strstr($width,'%'))
$width = '640';
- if(! $height || strstr($height,'%'))
+ if(! $height || strstr($height,'%')) {
$height = '300';
+ $resize = 'onload="resizeIframe(this);"';
+ } else
+ $resize = '';
+
// try and leave some room for the description line.
$height = intval($height) + 80;
$width = intval($width) + 40;
$a = get_app();
$s = $a->get_baseurl()."/oembed/".base64url_encode($src);
- return '<iframe class="embed_rich" height="' . $height . '" width="' . $width . '" src="' . $s . '" frameborder="no" >' . t('Embedded content') . '</iframe>';
+ return '<iframe '.$resize.' class="embed_rich" height="'.$height.'" width="'.$width.'" src="'.$s.'" frameborder="no">'.t('Embedded content').'</iframe>';
}
+ function resizeIframe(obj) {
+ obj.style.height = 0;
+ obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
+ }
function openClose(theID) {
if(document.getElementById(theID).style.display == "block") {