Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mod_Wrapper multiple instances #19136

Merged
merged 5 commits into from
Jan 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions media/com_wrapper/js/iframe-height.js
Original file line number Diff line number Diff line change
@@ -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';
}
}
2 changes: 1 addition & 1 deletion media/com_wrapper/js/iframe-height.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion modules/mod_wrapper/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
1 change: 1 addition & 0 deletions modules/mod_wrapper/mod_wrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
2 changes: 1 addition & 1 deletion modules/mod_wrapper/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
JHtml::_('script', 'com_wrapper/iframe-height.min.js', array('version' => 'auto', 'relative' => true));
?>
<iframe <?php echo $load; ?>
id="blockrandom"
id="blockrandom-<?php echo $id; ?>"
name="<?php echo $target; ?>"
src="<?php echo $url; ?>"
width="<?php echo $width; ?>"
Expand Down