use truncatedDescription
This commit is contained in:
@@ -26,6 +26,7 @@ if (empty($videoData) || isset($videoData['error'])) {
|
||||
'title' => $videoData['name'],
|
||||
'url' => PEERTUBE_URL . '/videos/embed/' . $videoData['uuid'],
|
||||
'description' => $videoData['description'] ?? '',
|
||||
'truncatedDescription' => $videoData['truncatedDescription'] ?? '',
|
||||
'channel' => $videoData['channel']['displayName'],
|
||||
'channelId' => $videoData['channel']['id'],
|
||||
'channelHandle' => $videoData['channel']['name'],
|
||||
@@ -257,7 +258,30 @@ if (empty($videoData) || isset($videoData['error'])) {
|
||||
</div>
|
||||
|
||||
<div class="video-description">
|
||||
<?php echo nl2br(htmlspecialchars($video['description'])); ?>
|
||||
<?php
|
||||
// Vérifier si on a une description tronquée et si la description complète est plus longue
|
||||
$hasTruncatedDesc = !empty($video['truncatedDescription']) &&
|
||||
strlen($video['truncatedDescription']) < strlen($video['description']);
|
||||
|
||||
if ($hasTruncatedDesc):
|
||||
?>
|
||||
<div class="truncated-description">
|
||||
<?php echo nl2br(htmlspecialchars($video['truncatedDescription'])); ?>
|
||||
<button class="show-more-btn">
|
||||
<span>Voir plus</span>
|
||||
<i class="fas fa-chevron-down"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="full-description" style="display: none;">
|
||||
<?php echo nl2br(htmlspecialchars($video['description'])); ?>
|
||||
<button class="show-less-btn">
|
||||
<span>Voir moins</span>
|
||||
<i class="fas fa-chevron-up"></i>
|
||||
</button>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php echo nl2br(htmlspecialchars($video['description'])); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($video['tags'])): ?>
|
||||
@@ -484,6 +508,24 @@ if (empty($videoData) || isset($videoData['error'])) {
|
||||
<script>
|
||||
// Script pour la modal de téléchargement
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Gestion de la description tronquée
|
||||
const showMoreBtn = document.querySelector('.show-more-btn');
|
||||
const showLessBtn = document.querySelector('.show-less-btn');
|
||||
|
||||
if (showMoreBtn) {
|
||||
showMoreBtn.addEventListener('click', function() {
|
||||
document.querySelector('.truncated-description').style.display = 'none';
|
||||
document.querySelector('.full-description').style.display = 'block';
|
||||
});
|
||||
}
|
||||
|
||||
if (showLessBtn) {
|
||||
showLessBtn.addEventListener('click', function() {
|
||||
document.querySelector('.full-description').style.display = 'none';
|
||||
document.querySelector('.truncated-description').style.display = 'block';
|
||||
});
|
||||
}
|
||||
|
||||
const downloadModal = document.getElementById('download-modal');
|
||||
const downloadBtn = document.getElementById('download-btn');
|
||||
const downloadCloseBtn = downloadModal.querySelector('.modal-close');
|
||||
|
||||
Reference in New Issue
Block a user