fixes siema to expose source link

This commit is contained in:
buttle 2021-06-27 15:51:36 +02:00
parent 19d9fc9f3b
commit 622523a791
1 changed files with 65 additions and 57 deletions

View File

@ -1,46 +1,56 @@
<div style="position:relative;">
<?php <?php
$this->headLink()->appendStylesheet($this->assetUrl('css/carousel.css', 'SimpleCarousel')); $this->headLink()->appendStylesheet($this->assetUrl('css/carousel.css', 'SimpleCarousel'));
$this->headScript()->appendFile($this->assetUrl('js/siema.min.js', 'SimpleCarousel')); $this->headScript()->appendFile($this->assetUrl('js/siema.min.js', 'SimpleCarousel'));
$title = false; $title = false;
$caret = sprintf('<img class="caret" id="left" src="%s">', $this->assetUrl('caret.png', 'SimpleCarousel')); $caret = sprintf('<img class="caret" id="left" src="%s">', $this->assetUrl('caret.png', 'SimpleCarousel'));
$caret_r = sprintf('<img class="caret" id="right" src="%s">', $this->assetUrl('caret.png', 'SimpleCarousel')); $caret_r = sprintf('<img class="caret" id="right" src="%s">', $this->assetUrl('caret.png', 'SimpleCarousel'));
?> ?>
<style>
.siema { margin: 0; }
.siema-wrap { height: <?php echo $height ?>; }
.siema-img { width: 100%; }
#siema-ui {
/* background-color: <?php echo $ui_background ?>; */
}
</style>
<div class="archive-carousel"> <div class="archive-carousel">
<?php if ($renderSourceLink) { ?> <?php if ($renderSourceLink) { ?>
<div class="source-link"> <div class="source-link">
<a href="<?= $item_url ?>">Source</a> <a href="<?= $item_url ?>">Source</a>
</div> </div>
<?php } ?> <?php } ?>
<div style="position:relative;">
<div class="siema"> <div class="siema">
<?php <?php foreach ($urls as $url) { ?>
foreach ($urls as $url) { <div class="siema-wrap"
$html = sprintf('<div class="siema-wrap" style="%s"><img class="siema-img" style="%s" src="%s"></div>', $wrapStyle, $imgStyle, $url); style="<?= $wrapStyle ?>"
echo $html; >
} <img class="siema-img"
?> style="<?= $imgStyle ?>"
src="<?= $url ?>"
/>
</div>
<?php } ?>
</div> </div>
<div id="siema-ui"></div> <div id="siema-ui"></div>
</div> </div>
<?php if ($subTitle) { ?> <?php if ($subTitle) { ?>
<div class="item_title"> <div class="item_title">
<?= $subTitle ?> <?= $subTitle ?>
</div> </div>
<?php } ?> <?php } ?>
</div>
<style> <script>
.siema-wrap { height: <?php echo $height ?>; } $(document).ready(function() {
.siema-img { width: 100%; }
#siema-ui { background-color: <?php echo $ui_background ?>; }
</style>
<script>
$(document).ready(function() {
let siema = new Siema({ let siema = new Siema({
selector: '.siema', selector: '.siema',
easing: 'ease-out', easing: 'ease-out',
@ -53,21 +63,19 @@
let caret = '<?php echo $caret;?>'; let caret = '<?php echo $caret;?>';
let caret_r = '<?php echo $caret_r;?>'; let caret_r = '<?php echo $caret_r;?>';
$('#siema-ui').append(caret); $('#siema-ui').append(caret);
<?php if ($title !== false): ?> <?php if ($title !== false): ?>
$('#siema-ui').append('<?php echo $title;?>'); $('#siema-ui').append('<?php echo $title;?>');
<?php endif ?> <?php endif ?>
$('#siema-ui').append(caret_r); $('#siema-ui').append(caret_r);
$('.caret#left').click(function () {siema.prev()}); $('.caret#left').click(function () {siema.prev()});
$('.caret#right').click(function () {siema.next()}); $('.caret#right').click(function () {siema.next()});
<?php if ($autoSlide == true): ?> <?php if ($autoSlide == true): ?>
window.setInterval(() => { window.setInterval(() => {
siema.next(); siema.next();
}, <?php echo $autoSlideInt; ?>); }, <?php echo $autoSlideInt; ?>);
<?php endif ?> <?php endif ?>
}); });
</script> </script>
</div>