From 83da9ae08990d8c800a166b5beb873b4dca6c409 Mon Sep 17 00:00:00 2001 From: msramalho <19508417+msramalho@users.noreply.github.com> Date: Mon, 23 Dec 2024 18:19:26 +0000 Subject: [PATCH] adds pdf preview support for html formatter --- src/auto_archiver/formatters/templates/html_template.html | 6 +++--- src/auto_archiver/formatters/templates/macros.html | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/auto_archiver/formatters/templates/html_template.html b/src/auto_archiver/formatters/templates/html_template.html index 13ec15a..8bdf5ef 100644 --- a/src/auto_archiver/formatters/templates/html_template.html +++ b/src/auto_archiver/formatters/templates/html_template.html @@ -286,11 +286,11 @@ // logic for enabled/disabled greyscale // Get references to the checkboxes and images/videos const safeImageViewCheckbox = document.getElementById('safe-media-view'); - const imagesVideos = document.querySelectorAll('img, video'); + const visualPreviews = document.querySelectorAll('img, video,embed'); // Function to toggle grayscale effect function toggleGrayscale() { - imagesVideos.forEach(element => { + visualPreviews.forEach(element => { if (safeImageViewCheckbox.checked) { // Enable grayscale effect element.style.filter = 'grayscale(1)'; @@ -307,7 +307,7 @@ safeImageViewCheckbox.addEventListener('change', toggleGrayscale); // Handle the hover effect using JavaScript - imagesVideos.forEach(element => { + visualPreviews.forEach(element => { element.addEventListener('mouseenter', () => { // Disable grayscale effect on hover element.style.filter = 'none'; diff --git a/src/auto_archiver/formatters/templates/macros.html b/src/auto_archiver/formatters/templates/macros.html index c2281c2..1373b43 100644 --- a/src/auto_archiver/formatters/templates/macros.html +++ b/src/auto_archiver/formatters/templates/macros.html @@ -32,6 +32,10 @@ No URL available for {{ m.key }}. Your browser does not support the video element. +{% elif 'application/pdf' in m.mimetype %} +