shelfy/templates/media_detail.pages.tmpl

87 lines
2.8 KiB
Cheetah
Raw Permalink Normal View History

2025-06-22 10:37:49 +00:00
{{define "media_detail.pages.tmpl"}}
2025-06-21 18:01:24 +00:00
<section class="section">
<div class="container">
2025-06-22 10:37:49 +00:00
<!-- Fil dAriane -->
<nav class="breadcrumb mb-4" aria-label="breadcrumbs">
<ul>
<li>
<a
hx-get="/api/paths/{{.PathID}}/media"
hx-push-url="/api/paths/{{.PathID}}/media"
hx-target="#content"
hx-swap="innerHTML">
Accueil
</a>
</li>
{{if .CurrentSub}}
<li>
<a>{{.CurrentSub}}</a>
</li>
{{end}}
<li class="is-active">
<a aria-current="page">{{.item.Title}}</a>
</li>
</ul>
</nav>
2025-06-21 18:36:57 +00:00
2025-06-22 10:37:49 +00:00
<div class="box">
2025-06-21 18:11:03 +00:00
<!-- Bloc détail -->
2025-06-21 18:05:03 +00:00
<div id="detail-block">
<div class="columns is-vcentered">
<div class="column is-one-third">
<figure class="image is-3by4">
<img src="{{.item.ThumbURL}}" alt="{{.item.Title}}" />
</figure>
</div>
<div class="column">
<h1 class="title">{{.item.Title}}</h1>
2025-06-21 18:07:31 +00:00
{{with .item.Summary}}<p class="content">{{.}}</p>{{end}}
{{with .item.DurationFmt}}<p class="subtitle is-6">Durée : {{.}}</p>{{end}}
2025-06-21 18:11:03 +00:00
<button class="button is-primary js-play-btn" data-hlsurl="{{.item.HLSURL}}">
2025-06-21 18:05:03 +00:00
<span class="icon"><i class="fas fa-play"></i></span>
<span>Play</span>
</button>
</div>
2025-06-21 18:01:24 +00:00
</div>
2025-06-21 18:05:03 +00:00
</div>
2025-06-21 18:07:31 +00:00
2025-06-21 18:11:03 +00:00
<!-- Bloc player -->
<div class="box js-player-block" style="display:none;">
<video id="hls-video" controls autoplay style="width:100%; height:auto;"></video>
<button class="button is-light mt-4 js-close-btn">
<span class="icon"><i class="fas fa-times"></i></span>
<span>Fermer</span>
</button>
2025-06-21 18:01:24 +00:00
</div>
2025-06-21 18:07:31 +00:00
2025-06-21 18:01:24 +00:00
</div>
</div>
</section>
2025-06-21 18:12:59 +00:00
2025-06-22 10:37:49 +00:00
<script>
// Gestion des boutons Play et Fermer
document.body.addEventListener('click', function(e) {
const playBtn = e.target.closest('.js-play-btn');
if (playBtn) {
document.getElementById('detail-block').style.display = 'none';
document.querySelector('.js-player-block').style.display = 'block';
const video = document.getElementById('hls-video');
const url = playBtn.dataset.hlsurl;
if (Hls.isSupported()) {
const hls = new Hls(); hls.loadSource(url); hls.attachMedia(video);
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = url;
}
return;
2025-06-21 18:30:58 +00:00
}
2025-06-22 10:37:49 +00:00
const closeBtn = e.target.closest('.js-close-btn');
if (closeBtn) {
const video = document.getElementById('hls-video');
video.pause(); video.src = '';
document.querySelector('.js-player-block').style.display = 'none';
document.getElementById('detail-block').style.display = 'block';
}
});
2025-06-21 18:12:59 +00:00
</script>
2025-06-22 10:37:49 +00:00
{{end}}