From 2c7dca2d2d0708d32cd2ee865c06a594bab39de2 Mon Sep 17 00:00:00 2001 From: Ray Hollister Date: Mon, 24 Feb 2025 12:27:17 -0500 Subject: [PATCH 1/3] Fix style issues and improve paginator logic in embed-pdf shortcode --- layouts/shortcodes/embed-pdf.html | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/layouts/shortcodes/embed-pdf.html b/layouts/shortcodes/embed-pdf.html index 1c2ecd6..8d073fc 100644 --- a/layouts/shortcodes/embed-pdf.html +++ b/layouts/shortcodes/embed-pdf.html @@ -40,7 +40,7 @@ display: inline-block; width: 50px; height: 50px; - border: 3px solid #d2d0d0;; + border: 3px solid #d2d0d0; border-radius: 50%; border-top-color: #383838; animation: spin 1s ease-in-out infinite; @@ -49,8 +49,6 @@ {{/* Download link */}} - - #overlayText { word-wrap: break-word; display: grid; @@ -76,15 +74,13 @@ width: clamp(1em, 2vw, 1.4em); } - - @keyframes spin { to { -webkit-transform: rotate(360deg); } } @-webkit-keyframes spin { to { -webkit-transform: rotate(360deg); } } - + {{- end -}} {{- $.Page.Scratch.Add "embed-pdf-count" 1 -}} @@ -194,21 +190,24 @@ * If we haven't disabled the loader, show loader and hide canvas */ function showLoader() { - if(hideLoader) return + if(hideLoader) return; loadingWrapper.style.display = 'flex'; canvas.style.display = 'none'; } /** - * If we haven't disabled the paginator, show paginator + * Controls paginator display based on hidePaginator value. */ function showPaginator() { - if(hidePaginator) return - paginator.style.display = 'block'; + if(hidePaginator) { + paginator.style.display = 'none'; + } else { + paginator.style.display = 'block'; + } } /** - * If another page rendering in progress, waits until the rendering is + * If another page rendering is in progress, waits until the rendering is * finished. Otherwise, executes rendering immediately. */ function queueRenderPage(num) { @@ -253,7 +252,7 @@ // If the user passed in a number that is out of range, render the last page. if(pageNum > numPages) { - pageNum = numPages + pageNum = numPages; } // Initial/first page rendering From 3e674ffcabbfa4305c9dd662a47dfa8dac9363ad Mon Sep 17 00:00:00 2001 From: Ray Hollister Date: Mon, 24 Feb 2025 13:07:04 -0500 Subject: [PATCH 2/3] Added download and width options to shortcode --- layouts/shortcodes/embed-pdf.html | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/layouts/shortcodes/embed-pdf.html b/layouts/shortcodes/embed-pdf.html index 8d073fc..3536f82 100644 --- a/layouts/shortcodes/embed-pdf.html +++ b/layouts/shortcodes/embed-pdf.html @@ -1,9 +1,9 @@ {{- if not ($.Page.Scratch.Get "embed-pdf-count") -}} - +