Archive.org-omeka-module/view/common/block-layout/archiveOrg.phtml

60 lines
1.2 KiB
PHTML
Raw Normal View History

<?php
$this->headScript()->appendFile($this->assetUrl('js/height_calculator.js',
'ArchiveOrg'));
?>
<div class="archive_org-wrap">
2021-04-17 19:13:22 +02:00
<?php if ($renderSourceLink) { ?>
<div class="source-link">
<a href="<?= $item_url ?>">Source</a>
</div>
<?php } ?>
2021-04-17 19:13:22 +02:00
<?php
if ($title !== false && $title !== "") {
2021-04-17 19:39:48 +02:00
$title = sprintf('<p id="achive_org_media-title">%s</p>', $title);
2021-04-17 19:13:22 +02:00
} else {
$title = false;
}
?>
2021-04-17 19:39:48 +02:00
<iframe
id="<?= $id ?>"
src="<?= $url ?>"
frameborder="0"
webkitallowfullscreen="true"
mozallowfullscreen="true"
width="<?= $width ?>%"
height="<?= $height ?>"
user_defined_ratio="<?= $ratio ?>"
media_type="<?= $media_type ?>"
2021-04-17 19:39:48 +02:00
allowfullscreen >
</iframe>
2021-04-17 19:13:22 +02:00
<?php if ($title) { ?>
<div class="item_title">
<?= $title ?>
</div>
<?php } ?>
2021-04-17 19:13:22 +02:00
</div>
<script>
function adjust_height() {
$(".archive_org-wrap").each(function() {
var iframe = $(this).find('iframe')
if ($(iframe).attr("media_type") == 'video') {
var height = get_height(iframe, $(iframe).attr("user_defined_ratio"))
$(iframe).prop("height", height)
}
});
}
jQuery(document).ready(function() {
adjust_height();
});
$(window).resize(function() {
adjust_height();
});
</script>