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