Added support to show PDF files.

This commit is contained in:
Juan Pablo Corredor 2026-06-01 09:34:37 +02:00
parent c55e0c7920
commit c862dcb5e1
4 changed files with 21 additions and 6 deletions

View File

@ -0,0 +1,7 @@
ario 1 Germogli 10 cm
Giorno in corso
Giorno in corso
2
ario 3

View File

@ -206,3 +206,11 @@ h2 {
border-radius: 6px;
display: none;
}
#modal-pdf {
width: 100%;
height: 100%;
border: none;
border-radius: 6px;
display: none;
}

Binary file not shown.

View File

@ -52,7 +52,7 @@
<h3 class="card-title">{{ t.card3_title }}</h3>
<p class="card-text">{{ t.card3_text }}</p>
</div>
<div class="action-card" data-action="video" data-src="/resources/videos/assistant.mp4">
<div class="action-card" data-action="pdf" data-src="/resources/AI_Agro_Support.pdf">
<div class="card-icon">
<img src="/resources/assistente-virtuale.png" alt="Assistente Virtuale Icon" width="100%" height="100%"/>
</div>
@ -67,6 +67,7 @@
<button class="modal-close" id="modal-close" aria-label="{{ t.close_label }}">&times;</button>
<video id="modal-video" controls></video>
<iframe id="modal-iframe" src="" allowfullscreen></iframe>
<iframe id="modal-pdf" src=""></iframe>
</div>
</div>
@ -74,20 +75,25 @@
const modal = document.getElementById('modal');
const modalVideo = document.getElementById('modal-video');
const modalIframe = document.getElementById('modal-iframe');
const modalPdf = document.getElementById('modal-pdf');
const closeBtn = document.getElementById('modal-close');
function openModal(action, src) {
if (action === 'video') {
modalVideo.src = src;
modalVideo.style.display = 'block';
modalIframe.style.display = 'none';
modalIframe.src = '';
modalIframe.style.display = 'none'; modalIframe.src = '';
modalPdf.style.display = 'none'; modalPdf.src = '';
} else if (action === 'pdf') {
modalPdf.src = src;
modalPdf.style.display = 'block';
modalVideo.style.display = 'none'; modalVideo.pause(); modalVideo.src = '';
modalIframe.style.display = 'none'; modalIframe.src = '';
} else {
modalIframe.src = src;
modalIframe.style.display = 'block';
modalVideo.style.display = 'none';
modalVideo.pause();
modalVideo.src = '';
modalVideo.style.display = 'none'; modalVideo.pause(); modalVideo.src = '';
modalPdf.style.display = 'none'; modalPdf.src = '';
}
modal.classList.remove('hidden');
}
@ -97,6 +103,7 @@
modalVideo.pause();
modalVideo.src = '';
modalIframe.src = '';
modalPdf.src = '';
}
document.querySelectorAll('[data-action]').forEach(btn => {