diff --git a/media/com_wrapper/js/iframe-height.js b/media/com_wrapper/js/iframe-height.js index 7c0bf35e40919..aebbeca16ab0e 100644 --- a/media/com_wrapper/js/iframe-height.js +++ b/media/com_wrapper/js/iframe-height.js @@ -1,17 +1,14 @@ -function iFrameHeight() +function iFrameHeight(iframe) { - var height = 0; - var iframe = document.getElementById('blockrandom'); var doc = 'contentDocument' in iframe ? iframe.contentDocument : iframe.contentWindow.document; + var height = parseInt(doc.body.scrollHeight); if (!document.all) { - height = doc.body.scrollHeight; iframe.style.height = parseInt(height) + 60 + 'px'; } - else if (document.all) + else if (document.all && iframe.id) { - height = doc.body.scrollHeight; - document.all.blockrandom.style.height = parseInt(height) + 20 + 'px'; + document.all[iframe.id].style.height = parseInt(height) + 20 + 'px'; } } diff --git a/media/com_wrapper/js/iframe-height.min.js b/media/com_wrapper/js/iframe-height.min.js index 4e5489b305995..0a662a6898c14 100644 --- a/media/com_wrapper/js/iframe-height.min.js +++ b/media/com_wrapper/js/iframe-height.min.js @@ -1 +1 @@ -function iFrameHeight(){var a=0,b=document.getElementById("blockrandom"),c="contentDocument"in b?b.contentDocument:b.contentWindow.document;document.all?document.all&&(a=c.body.scrollHeight,document.all.blockrandom.style.height=parseInt(a)+20+"px"):(a=c.body.scrollHeight,b.style.height=parseInt(a)+60+"px")} \ No newline at end of file +function iFrameHeight(iframe){var doc="contentDocument"in iframe?iframe.contentDocument:iframe.contentWindow.document;var height=parseInt(doc.body.scrollHeight);if(!document.all){iframe.style.height=parseInt(height)+60+"px"}else if(document.all&&iframe.id){document.all[iframe.id].style.height=parseInt(height)+20+"px"}} diff --git a/modules/mod_wrapper/helper.php b/modules/mod_wrapper/helper.php index 32ead1497cecb..e524010991614 100644 --- a/modules/mod_wrapper/helper.php +++ b/modules/mod_wrapper/helper.php @@ -54,7 +54,7 @@ public static function getParams(&$params) // Auto height control if ($params->def('height_auto')) { - $load = 'onload="iFrameHeight()"'; + $load = 'onload="iFrameHeight(this)"'; } else { diff --git a/modules/mod_wrapper/mod_wrapper.php b/modules/mod_wrapper/mod_wrapper.php index e8805528db083..bba076a72dec3 100644 --- a/modules/mod_wrapper/mod_wrapper.php +++ b/modules/mod_wrapper/mod_wrapper.php @@ -23,5 +23,6 @@ $moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'), ENT_COMPAT, 'UTF-8'); $frameborder = htmlspecialchars($params->get('frameborder'), ENT_COMPAT, 'UTF-8'); $ititle = $module->title; +$id = $module->id; require JModuleHelper::getLayoutPath('mod_wrapper', $params->get('layout', 'default')); diff --git a/modules/mod_wrapper/tmpl/default.php b/modules/mod_wrapper/tmpl/default.php index cea60adafc5c0..8d05760085aa2 100644 --- a/modules/mod_wrapper/tmpl/default.php +++ b/modules/mod_wrapper/tmpl/default.php @@ -12,7 +12,7 @@ JHtml::_('script', 'com_wrapper/iframe-height.min.js', array('version' => 'auto', 'relative' => true)); ?>