From 186f795e398f2003b5620802b334b064d22e5622 Mon Sep 17 00:00:00 2001 From: Vincent LAURENT Date: Sat, 12 Oct 2024 12:46:28 +0200 Subject: [PATCH] [metadata] Page de chargement aussi pour la lecture pdf --- public/js/metadata.js | 10 ++++++---- templates/metadata.html.php | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/public/js/metadata.js b/public/js/metadata.js index c726e08..ee57363 100644 --- a/public/js/metadata.js +++ b/public/js/metadata.js @@ -4,6 +4,7 @@ let pdffile = null let deletedMetadata = []; let isLocalPath = false; let hasModifications = false; +const modalLoading = new bootstrap.Modal('#modalLoading') function responsiveDisplay() { let menu = document.getElementById('sidebarTools'); @@ -259,6 +260,7 @@ async function pageUpload() { } async function pageMetadata(url) { + modalLoading.show(); document.querySelector('body').classList.add('bg-light'); document.getElementById('page-upload').classList.add('d-none'); document.getElementById('page-metadata').classList.remove('d-none'); @@ -272,12 +274,11 @@ async function pageMetadata(url) { if(url && url.match(/^cache:\/\//)) { await loadFileFromCache(url.replace(/^cache:\/\//, '')); } else if (url) { - const modalLoading = new bootstrap.Modal('#modalLoading') - modalLoading.show(); await loadFileFromUrl(url); - modalLoading.hide(); } + document.getElementById('modalLoading').querySelector('p').innerText = 'Chargement du PDF' + if(!document.getElementById('input_pdf_upload').files.length) { alert("Chargement du PDF impossible"); document.location = '/metadata'; @@ -286,7 +287,8 @@ async function pageMetadata(url) { responsiveDisplay(); createEventsListener(); - loadPDF(document.getElementById('input_pdf_upload').files[0]); + await loadPDF(document.getElementById('input_pdf_upload').files[0]); + modalLoading.hide(); }; diff --git a/templates/metadata.html.php b/templates/metadata.html.php index b6f2eb3..d2f8c9b 100644 --- a/templates/metadata.html.php +++ b/templates/metadata.html.php @@ -87,7 +87,7 @@