From 67a1529dc7d65ef2eb49a9b9a19ba16c6c260b2e Mon Sep 17 00:00:00 2001 From: Ludy Date: Thu, 21 Mar 2024 21:58:01 +0100 Subject: [PATCH] Change to html5 (#958) * Change to html5 with Nu Html Checker * Update scale-pages.html * Update sign.html * Update common.html * Update common.html * Update login.html --- src/main/resources/static/css/dark-mode.css | 12 +- src/main/resources/static/css/dragdrop.css | 4 +- src/main/resources/static/css/error.css | 4 +- src/main/resources/static/css/errorBanner.css | 4 +- src/main/resources/static/css/general.css | 8 +- src/main/resources/static/css/light-mode.css | 10 +- src/main/resources/static/css/multi-tool.css | 6 +- src/main/resources/static/css/pdfActions.css | 8 +- src/main/resources/static/css/rotate-pdf.css | 2 +- src/main/resources/static/js/downloader.js | 10 +- src/main/resources/static/js/game.js | 4 +- .../resources/static/js/languageSelection.js | 2 +- .../static/js/multitool/DragDropManager.js | 2 +- .../static/js/multitool/PdfActionsManager.js | 2 +- src/main/resources/static/js/pipeline.js | 32 +-- src/main/resources/templates/about.html | 4 +- src/main/resources/templates/account.html | 32 +-- src/main/resources/templates/addUsers.html | 8 +- .../resources/templates/auto-split-pdf.html | 8 +- .../resources/templates/change-creds.html | 9 +- .../templates/convert/book-to-pdf.html | 10 +- .../templates/convert/file-to-pdf.html | 45 ++-- .../templates/convert/html-to-pdf.html | 10 +- .../templates/convert/img-to-pdf.html | 24 +- .../templates/convert/markdown-to-pdf.html | 7 +- .../templates/convert/pdf-to-book.html | 6 +- .../templates/convert/pdf-to-csv.html | 18 +- .../templates/convert/pdf-to-html.html | 6 +- .../templates/convert/pdf-to-img.html | 6 +- .../templates/convert/pdf-to-pdfa.html | 4 +- .../convert/pdf-to-presentation.html | 6 +- .../templates/convert/pdf-to-text.html | 7 +- .../templates/convert/pdf-to-word.html | 9 +- .../templates/convert/pdf-to-xml.html | 6 +- .../templates/convert/url-to-pdf.html | 8 +- src/main/resources/templates/crop.html | 205 ++++++++-------- src/main/resources/templates/error.html | 6 +- .../resources/templates/extract-page.html | 4 +- .../resources/templates/fragments/card.html | 2 +- .../resources/templates/fragments/common.html | 49 ++-- .../templates/fragments/errorBanner.html | 4 +- .../fragments/errorBannerPerPage.html | 4 +- .../resources/templates/fragments/footer.html | 26 +- .../resources/templates/fragments/navbar.html | 46 ++-- src/main/resources/templates/home.html | 7 +- src/main/resources/templates/licenses.html | 13 +- src/main/resources/templates/login.html | 46 ++-- src/main/resources/templates/merge-pdfs.html | 6 +- .../resources/templates/misc/add-image.html | 73 +++--- .../templates/misc/add-page-numbers.html | 20 +- .../templates/misc/adjust-contrast.html | 45 ++-- .../resources/templates/misc/auto-crop.html | 4 +- .../resources/templates/misc/auto-rename.html | 6 +- .../templates/misc/change-metadata.html | 22 +- .../resources/templates/misc/compare.html | 6 +- .../templates/misc/compress-pdf.html | 6 +- .../templates/misc/extract-image-scans.html | 4 +- .../templates/misc/extract-images.html | 4 +- .../resources/templates/misc/flatten.html | 5 +- .../resources/templates/misc/ocr-pdf.html | 10 +- .../templates/misc/remove-annotations.html | 4 +- .../templates/misc/remove-blanks.html | 7 +- src/main/resources/templates/misc/repair.html | 4 +- .../templates/misc/show-javascript.html | 6 +- src/main/resources/templates/misc/stamp.html | 32 ++- .../templates/multi-page-layout.html | 16 +- src/main/resources/templates/multi-tool.html | 16 +- src/main/resources/templates/overlay-pdf.html | 14 +- .../resources/templates/pdf-organizer.html | 24 +- .../templates/pdf-to-single-page.html | 4 +- src/main/resources/templates/pipeline.html | 25 +- .../resources/templates/remove-pages.html | 6 +- src/main/resources/templates/rotate-pdf.html | 54 ++-- src/main/resources/templates/scale-pages.html | 26 +- .../templates/security/add-password.html | 6 +- .../templates/security/add-watermark.html | 230 +++++++++--------- .../templates/security/auto-redact.html | 22 +- .../templates/security/cert-sign.html | 39 +-- .../security/change-permissions.html | 6 +- .../templates/security/get-info-on-pdf.html | 4 +- .../templates/security/remove-password.html | 6 +- .../templates/security/remove-watermark.html | 6 +- .../templates/security/sanitize-pdf.html | 6 +- src/main/resources/templates/sign.html | 17 +- .../templates/split-by-size-or-count.html | 6 +- .../templates/split-pdf-by-sections.html | 109 +++++---- src/main/resources/templates/split-pdfs.html | 8 +- 87 files changed, 825 insertions(+), 844 deletions(-) diff --git a/src/main/resources/static/css/dark-mode.css b/src/main/resources/static/css/dark-mode.css index 8ddbf052..b874f410 100644 --- a/src/main/resources/static/css/dark-mode.css +++ b/src/main/resources/static/css/dark-mode.css @@ -114,28 +114,28 @@ hr { border-color: #fff; } -#global-buttons-container input { +.global-buttons-container input { background-color: #323948; caret-color: #ffffff; color: #ffffff; } -#global-buttons-container input::placeholder { +.global-buttons-container input::placeholder { color: #ffffff; } -#global-buttons-container input:disabled::-webkit-input-placeholder { +.global-buttons-container input:disabled::-webkit-input-placeholder { /* WebKit browsers */ color: #6e6865; } -#global-buttons-container input:disabled:-moz-placeholder { +.global-buttons-container input:disabled:-moz-placeholder { /* Mozilla Firefox 4 to 18 */ color: #6e6865; } -#global-buttons-container input:disabled::-moz-placeholder { +.global-buttons-container input:disabled::-moz-placeholder { /* Mozilla Firefox 19+ */ color: #6e6865; } -#global-buttons-container input:disabled:-ms-input-placeholder { +.global-buttons-container input:disabled:-ms-input-placeholder { /* Internet Explorer 10+ */ color: #6e6865; } diff --git a/src/main/resources/static/css/dragdrop.css b/src/main/resources/static/css/dragdrop.css index 14c3befe..7758bdd9 100644 --- a/src/main/resources/static/css/dragdrop.css +++ b/src/main/resources/static/css/dragdrop.css @@ -36,11 +36,11 @@ visibility: hidden !important; } -html[lang-direction="ltr"] .drag-manager_draghover img { +html[dir="ltr"] .drag-manager_draghover img { left: calc(50% + 62.5px) !important; } -html[lang-direction="rtl"] .drag-manager_draghover img { +html[dir="rtl"] .drag-manager_draghover img { left: 125px; } diff --git a/src/main/resources/static/css/error.css b/src/main/resources/static/css/error.css index 0477d7e0..5cc37b61 100644 --- a/src/main/resources/static/css/error.css +++ b/src/main/resources/static/css/error.css @@ -68,11 +68,11 @@ p { #github-button:hover, #discord-button:hover, -#home-button:hover { +.home-button:hover { background-color: #005b7f; } -#home-button { +.home-button { display: block; width: 200px; height: 50px; diff --git a/src/main/resources/static/css/errorBanner.css b/src/main/resources/static/css/errorBanner.css index 11b111ab..75618731 100644 --- a/src/main/resources/static/css/errorBanner.css +++ b/src/main/resources/static/css/errorBanner.css @@ -77,11 +77,11 @@ #github-button:hover, #discord-button:hover, -#home-button:hover { +.home-button:hover { background-color: #005b7f; } -#home-button { +.home-button { display: block; width: 200px; height: 50px; diff --git a/src/main/resources/static/css/general.css b/src/main/resources/static/css/general.css index 8d631bfd..72edf184 100644 --- a/src/main/resources/static/css/general.css +++ b/src/main/resources/static/css/general.css @@ -25,10 +25,10 @@ margin-right: auto; }*/ -html[lang-direction="ltr"] * { +html[dir="ltr"] * { direction: ltr; } -html[lang-direction="rtl"] * { +html[dir="rtl"] * { direction: rtl; text-align: right; } @@ -63,11 +63,11 @@ html[lang-direction="rtl"] * { border-bottom-left-radius: 0.25rem !important; } -html[lang-direction="rtl"] input.form-check-input { +html[dir="rtl"] input.form-check-input { position: relative; margin-left: 0px; } -html[lang-direction="rtl"] label.form-check-label { +html[dir="rtl"] label.form-check-label { display: inline; } diff --git a/src/main/resources/static/css/light-mode.css b/src/main/resources/static/css/light-mode.css index af84b0d5..f7e79b90 100644 --- a/src/main/resources/static/css/light-mode.css +++ b/src/main/resources/static/css/light-mode.css @@ -4,20 +4,20 @@ body { --base-font-color: 33, 37, 41; } -#global-buttons-container input { +.global-buttons-container input { background-color: #ffffff; /*caret-color: #ffffff;*/ /*color: #ffffff;*/ } -/*#global-buttons-container input:disabled::-webkit-input-placeholder { !* WebKit browsers *!*/ +/*.global-buttons-container input:disabled::-webkit-input-placeholder { !* WebKit browsers *!*/ /* color: #98A0AB;*/ /*}*/ -/*#global-buttons-container input:disabled:-moz-placeholder { !* Mozilla Firefox 4 to 18 *!*/ +/*.global-buttons-container input:disabled:-moz-placeholder { !* Mozilla Firefox 4 to 18 *!*/ /* color: #98A0AB;*/ /*}*/ -/*#global-buttons-container input:disabled::-moz-placeholder { !* Mozilla Firefox 19+ *!*/ +/*.global-buttons-container input:disabled::-moz-placeholder { !* Mozilla Firefox 19+ *!*/ /* color: #98A0AB;*/ /*}*/ -/*#global-buttons-container input:disabled:-ms-input-placeholder { !* Internet Explorer 10+ *!*/ +/*.global-buttons-container input:disabled:-ms-input-placeholder { !* Internet Explorer 10+ *!*/ /* color: #98A0AB;*/ /*}*/ diff --git a/src/main/resources/static/css/multi-tool.css b/src/main/resources/static/css/multi-tool.css index 9ed84f2b..50e038ce 100644 --- a/src/main/resources/static/css/multi-tool.css +++ b/src/main/resources/static/css/multi-tool.css @@ -3,7 +3,7 @@ margin: 0 auto; } -#global-buttons-container { +.global-buttons-container { display: flex; gap: 10px; align-items: start; @@ -17,11 +17,11 @@ padding: 10px; border-radius: 8px; } -#global-buttons-container > * { +.global-buttons-container > * { padding: 0.6rem 0.75rem; } -#global-buttons-container svg { +.global-buttons-container svg { width: 20px; height: 20px; } diff --git a/src/main/resources/static/css/pdfActions.css b/src/main/resources/static/css/pdfActions.css index ff680036..455de860 100644 --- a/src/main/resources/static/css/pdfActions.css +++ b/src/main/resources/static/css/pdfActions.css @@ -45,11 +45,11 @@ right: -20px; } -html[lang-direction="ltr"] .pdf-actions_insert-file-button-container.right { +html[dir="ltr"] .pdf-actions_insert-file-button-container.right { display: none; } -html[lang-direction="rtl"] .pdf-actions_insert-file-button-container.left { +html[dir="rtl"] .pdf-actions_insert-file-button-container.left { display: none; } @@ -63,11 +63,11 @@ html[lang-direction="rtl"] .pdf-actions_insert-file-button-container.left { translate: 0 -50%; } -html[lang-direction="ltr"] .pdf-actions_container:last-child > .pdf-actions_insert-file-button-container.right { +html[dir="ltr"] .pdf-actions_container:last-child > .pdf-actions_insert-file-button-container.right { display: block; } -html[lang-direction="rtl"] .pdf-actions_container:last-child > .pdf-actions_insert-file-button-container.left { +html[dir="rtl"] .pdf-actions_container:last-child > .pdf-actions_insert-file-button-container.left { display: block; } diff --git a/src/main/resources/static/css/rotate-pdf.css b/src/main/resources/static/css/rotate-pdf.css index 7c5d388d..57a30024 100644 --- a/src/main/resources/static/css/rotate-pdf.css +++ b/src/main/resources/static/css/rotate-pdf.css @@ -11,7 +11,7 @@ translate: -50% -50%; } -.previewContainer { +#previewContainer { aspect-ratio: 1; width: 100%; border: 1px solid rgba(0, 0, 0, 0.125); diff --git a/src/main/resources/static/js/downloader.js b/src/main/resources/static/js/downloader.js index 4d7fa783..c955bb1b 100644 --- a/src/main/resources/static/js/downloader.js +++ b/src/main/resources/static/js/downloader.js @@ -53,8 +53,8 @@ $(document).ready(function () { // Display a green banner at the bottom of the screen saying "Download complete" let downloadCompleteText = "Download Complete"; if(window.downloadCompleteText){ - downloadCompleteText = window.downloadCompleteText; - } + downloadCompleteText = window.downloadCompleteText; + } $("body").append('
'+ downloadCompleteText + '
'); setTimeout(function() { $("#download-complete-banner").fadeOut("slow", function() { @@ -79,8 +79,8 @@ async function handleSingleDownload(url, formData, isMulti = false, isZip = fals if (!response.ok) { if (contentType && contentType.includes("application/json")) { - return handleJsonResponse(response); console.error("Throwing error banner, response was not okay"); + return handleJsonResponse(response); } throw new Error(`HTTP error! status: ${response.status}`); } @@ -177,10 +177,10 @@ async function submitMultiPdfForm(url, files) { const zipFiles = files.length > zipThreshold; let jszip = null; // Show the progress bar - $("#progressBarContainer").show(); + $(".progressBarContainer").show(); // Initialize the progress bar - let progressBar = $("#progressBar"); + let progressBar = $(".progressBar"); progressBar.css("width", "0%"); progressBar.attr("aria-valuenow", 0); progressBar.attr("aria-valuemax", files.length); diff --git a/src/main/resources/static/js/game.js b/src/main/resources/static/js/game.js index c5162127..3746ef63 100644 --- a/src/main/resources/static/js/game.js +++ b/src/main/resources/static/js/game.js @@ -70,7 +70,7 @@ function initializeGame() { handleKeys(); } function onKeyUp(event) { - keysPressed[event.key] = false; + keysPressed[event.key] = false; } document.removeEventListener("keydown", onKeydown); @@ -123,7 +123,7 @@ function initializeGame() { function updateGame() { if (gameOver || paused) return; - handleKeys(); + handleKeys(); for (let pdfIndex = 0; pdfIndex < pdfs.length; pdfIndex++) { const pdf = pdfs[pdfIndex]; const pdfY = parseFloat(pdf.style.top) + pdfSpeed; diff --git a/src/main/resources/static/js/languageSelection.js b/src/main/resources/static/js/languageSelection.js index ee9ab03b..7af113d0 100644 --- a/src/main/resources/static/js/languageSelection.js +++ b/src/main/resources/static/js/languageSelection.js @@ -26,7 +26,7 @@ document.addEventListener("DOMContentLoaded", function () { }); function setLanguageForDropdown(dropdownClass) { - const defaultLocale = document.documentElement.language || "en_GB"; + const defaultLocale = document.documentElement.getAttribute("data-language") || "en_GB"; const storedLocale = localStorage.getItem("languageCode") || defaultLocale; const dropdownItems = document.querySelectorAll(dropdownClass); diff --git a/src/main/resources/static/js/multitool/DragDropManager.js b/src/main/resources/static/js/multitool/DragDropManager.js index 004412d4..eac92a8c 100644 --- a/src/main/resources/static/js/multitool/DragDropManager.js +++ b/src/main/resources/static/js/multitool/DragDropManager.js @@ -11,7 +11,7 @@ class DragDropManager { constructor(id, wrapperId) { this.dragContainer = document.getElementById(id); - this.pageDirection = document.documentElement.getAttribute("lang-direction"); + this.pageDirection = document.documentElement.getAttribute("dir"); this.wrapper = document.getElementById(wrapperId); this.pageDragging = false; this.hoveredEl = undefined; diff --git a/src/main/resources/static/js/multitool/PdfActionsManager.js b/src/main/resources/static/js/multitool/PdfActionsManager.js index 2fae22d3..163dff3a 100644 --- a/src/main/resources/static/js/multitool/PdfActionsManager.js +++ b/src/main/resources/static/js/multitool/PdfActionsManager.js @@ -4,7 +4,7 @@ class PdfActionsManager { constructor(id) { this.pagesContainer = document.getElementById(id); - this.pageDirection = document.documentElement.getAttribute("lang-direction"); + this.pageDirection = document.documentElement.getAttribute("dir"); var styleElement = document.createElement("link"); styleElement.rel = "stylesheet"; diff --git a/src/main/resources/static/js/pipeline.js b/src/main/resources/static/js/pipeline.js index 9ed3e608..afe1d4d7 100644 --- a/src/main/resources/static/js/pipeline.js +++ b/src/main/resources/static/js/pipeline.js @@ -248,20 +248,20 @@ document.getElementById("addOperationBtn").addEventListener("click", function () } listItem.innerHTML = ` -
-
${selectedOperation}
-
- - - + + - -
-
- `; + ⚙️ + + + + + `; pipelineList.appendChild(listItem); @@ -465,13 +465,13 @@ document.getElementById("addOperationBtn").addEventListener("click", function () //pipelineSettingsModal.style.display = "block"; //pipelineSettingsModal.getElementsByClassName("close")[0].onclick = function() { - // pipelineSettingsModal.style.display = "none"; + // pipelineSettingsModal.style.display = "none"; //} //window.onclick = function(event) { - // if (event.target == pipelineSettingsModal) { - // pipelineSettingsModal.style.display = "none"; - // } + // if (event.target == pipelineSettingsModal) { + // pipelineSettingsModal.style.display = "none"; + // } //} } showpipelineSettingsModal(selectedOperation); diff --git a/src/main/resources/templates/about.html b/src/main/resources/templates/about.html index 957bf45f..2870fb41 100644 --- a/src/main/resources/templates/about.html +++ b/src/main/resources/templates/about.html @@ -1,5 +1,5 @@ - + @@ -8,7 +8,7 @@
-

+

diff --git a/src/main/resources/templates/account.html b/src/main/resources/templates/account.html index 20501413..97e50af6 100644 --- a/src/main/resources/templates/account.html +++ b/src/main/resources/templates/account.html @@ -1,5 +1,5 @@ - + @@ -9,14 +9,14 @@
-

+

User Settings

-
+
Default message if not found @@ -42,7 +42,6 @@
-

@@ -50,14 +49,14 @@
- +
-
+

Change Password?

@@ -79,7 +78,7 @@
-
+
@@ -94,7 +93,7 @@ Toggle API Key Visibility
@@ -169,7 +168,6 @@ } } - document.addEventListener("DOMContentLoaded", function() { const form = document.querySelector('form[action="api/v1/user/change-password"]'); @@ -185,7 +183,7 @@ }); -
+

Sync browser settings with Account

@@ -199,7 +197,7 @@ - + @@ -271,13 +269,9 @@ }); -
@@ -286,4 +280,4 @@
- + \ No newline at end of file diff --git a/src/main/resources/templates/addUsers.html b/src/main/resources/templates/addUsers.html index 397b054a..850beb9e 100644 --- a/src/main/resources/templates/addUsers.html +++ b/src/main/resources/templates/addUsers.html @@ -1,5 +1,5 @@ - + @@ -9,7 +9,7 @@
-

+

@@ -25,7 +25,7 @@ Username Roles - Actions + Actions @@ -76,4 +76,4 @@
- + \ No newline at end of file diff --git a/src/main/resources/templates/auto-split-pdf.html b/src/main/resources/templates/auto-split-pdf.html index 26106b46..914b9d60 100644 --- a/src/main/resources/templates/auto-split-pdf.html +++ b/src/main/resources/templates/auto-split-pdf.html @@ -1,5 +1,5 @@ - + @@ -9,7 +9,7 @@
-

+

@@ -29,8 +29,8 @@
-

-

+

+

diff --git a/src/main/resources/templates/change-creds.html b/src/main/resources/templates/change-creds.html index aab874e2..08a3ade7 100644 --- a/src/main/resources/templates/change-creds.html +++ b/src/main/resources/templates/change-creds.html @@ -1,5 +1,5 @@ - + @@ -9,14 +9,14 @@
-

+

User Settings

-
+
Default message if not found @@ -35,7 +35,6 @@

User!

-

Change password

@@ -76,4 +75,4 @@
- + \ No newline at end of file diff --git a/src/main/resources/templates/convert/book-to-pdf.html b/src/main/resources/templates/convert/book-to-pdf.html index d614af0d..acd40b21 100644 --- a/src/main/resources/templates/convert/book-to-pdf.html +++ b/src/main/resources/templates/convert/book-to-pdf.html @@ -1,5 +1,5 @@ - + @@ -9,14 +9,14 @@
-

+

-
- +
+

@@ -26,4 +26,4 @@
- + \ No newline at end of file diff --git a/src/main/resources/templates/convert/file-to-pdf.html b/src/main/resources/templates/convert/file-to-pdf.html index c0553c26..d8c8b969 100644 --- a/src/main/resources/templates/convert/file-to-pdf.html +++ b/src/main/resources/templates/convert/file-to-pdf.html @@ -1,5 +1,5 @@ - + @@ -9,31 +9,30 @@
-

+

-

-

-
-
-
- -
-

-

-

Microsoft Word: (DOC, DOCX, DOT, DOTX)

-

Microsoft Excel: (CSV, XLS, XLSX, XLT, XLTX, SLK, DIF)

-

Microsoft PowerPoint: (PPT, PPTX)

-

OpenDocument Formats: (ODT, OTT, ODS, OTS, ODP, OTP, ODG, OTG)

-

Plain Text: (TXT, TEXT, XML)

-

Rich Text Format: (RTF)

-

Images: (BMP, GIF, JPEG, PNG, TIF, PBM, PGM, PPM, RAS, XBM, XPM, SVG, SVM, WMF)

-

HTML: (HTML)

-

Lotus Word Pro: (LWP)

-

StarOffice: (SDA, SDC, SDD, SDW, STC, STD, STI, STW, SXD, SXG, SXI, SXW)

-

Other: (DBF, FODS, VSD, VOR, VOR3, VOR4, UOP, PCT, PS, PDF)

- https://help.libreoffice.org/latest/en-US/text/shared/guide/supported_formats.html +

+

+
+
+ +
+

+

+

Microsoft Word: (DOC, DOCX, DOT, DOTX)

+

Microsoft Excel: (CSV, XLS, XLSX, XLT, XLTX, SLK, DIF)

+

Microsoft PowerPoint: (PPT, PPTX)

+

OpenDocument Formats: (ODT, OTT, ODS, OTS, ODP, OTP, ODG, OTG)

+

Plain Text: (TXT, TEXT, XML)

+

Rich Text Format: (RTF)

+

Images: (BMP, GIF, JPEG, PNG, TIF, PBM, PGM, PPM, RAS, XBM, XPM, SVG, SVM, WMF)

+

HTML: (HTML)

+

Lotus Word Pro: (LWP)

+

StarOffice: (SDA, SDC, SDD, SDW, STC, STD, STI, STW, SXD, SXG, SXI, SXW)

+

Other: (DBF, FODS, VSD, VOR, VOR3, VOR4, UOP, PCT, PS, PDF)

+ https://help.libreoffice.org/latest/en-US/text/shared/guide/supported_formats.html
diff --git a/src/main/resources/templates/convert/html-to-pdf.html b/src/main/resources/templates/convert/html-to-pdf.html index c9a26a6b..3c426917 100644 --- a/src/main/resources/templates/convert/html-to-pdf.html +++ b/src/main/resources/templates/convert/html-to-pdf.html @@ -1,5 +1,5 @@ - + @@ -9,16 +9,16 @@
-

+

-
+
- +

@@ -32,4 +32,4 @@
- + \ No newline at end of file diff --git a/src/main/resources/templates/convert/img-to-pdf.html b/src/main/resources/templates/convert/img-to-pdf.html index 6d68fdec..a8633ad1 100644 --- a/src/main/resources/templates/convert/img-to-pdf.html +++ b/src/main/resources/templates/convert/img-to-pdf.html @@ -1,5 +1,5 @@ - + @@ -9,7 +9,7 @@
-

+

@@ -46,7 +46,7 @@
-

+

@@ -79,4 +79,4 @@
- + \ No newline at end of file diff --git a/src/main/resources/templates/convert/markdown-to-pdf.html b/src/main/resources/templates/convert/markdown-to-pdf.html index 8df3ad17..7a51a29c 100644 --- a/src/main/resources/templates/convert/markdown-to-pdf.html +++ b/src/main/resources/templates/convert/markdown-to-pdf.html @@ -1,5 +1,5 @@ - + @@ -9,14 +9,13 @@
-

+

-

@@ -28,4 +27,4 @@
- + \ No newline at end of file diff --git a/src/main/resources/templates/convert/pdf-to-book.html b/src/main/resources/templates/convert/pdf-to-book.html index db9b4692..33fbd2e1 100644 --- a/src/main/resources/templates/convert/pdf-to-book.html +++ b/src/main/resources/templates/convert/pdf-to-book.html @@ -1,5 +1,5 @@ - + @@ -9,7 +9,7 @@
-

+

@@ -42,4 +42,4 @@
- + \ No newline at end of file diff --git a/src/main/resources/templates/convert/pdf-to-csv.html b/src/main/resources/templates/convert/pdf-to-csv.html index 16da051e..9fba9430 100644 --- a/src/main/resources/templates/convert/pdf-to-csv.html +++ b/src/main/resources/templates/convert/pdf-to-csv.html @@ -1,5 +1,5 @@ - + @@ -8,13 +8,13 @@
-

+

- +
@@ -23,8 +23,8 @@
@@ -106,9 +106,9 @@ let typedArray = new Uint8Array(reader.result); pdfjsLib.GlobalWorkerOptions.workerSrc = 'pdfjs/pdf.worker.js'; pdfjsLib.getDocument(typedArray).promise.then(function(pdf) { - pdfDoc = pdf; - totalPages = pdf.numPages; - renderPage(currentPage); + pdfDoc = pdf; + totalPages = pdf.numPages; + renderPage(currentPage); }); pageId.value = currentPage; }; @@ -140,4 +140,4 @@
- + \ No newline at end of file diff --git a/src/main/resources/templates/convert/pdf-to-html.html b/src/main/resources/templates/convert/pdf-to-html.html index f2e914f9..c9256805 100644 --- a/src/main/resources/templates/convert/pdf-to-html.html +++ b/src/main/resources/templates/convert/pdf-to-html.html @@ -1,5 +1,5 @@ - + @@ -9,7 +9,7 @@
-

+

@@ -27,4 +27,4 @@
- + \ No newline at end of file diff --git a/src/main/resources/templates/convert/pdf-to-img.html b/src/main/resources/templates/convert/pdf-to-img.html index bcf3e8b3..039c52e0 100644 --- a/src/main/resources/templates/convert/pdf-to-img.html +++ b/src/main/resources/templates/convert/pdf-to-img.html @@ -1,5 +1,5 @@ - + @@ -9,7 +9,7 @@
-

+

@@ -55,4 +55,4 @@
- + \ No newline at end of file diff --git a/src/main/resources/templates/convert/pdf-to-pdfa.html b/src/main/resources/templates/convert/pdf-to-pdfa.html index 866449f1..e9b8ac88 100644 --- a/src/main/resources/templates/convert/pdf-to-pdfa.html +++ b/src/main/resources/templates/convert/pdf-to-pdfa.html @@ -1,5 +1,5 @@ - + @@ -9,7 +9,7 @@
-

+

diff --git a/src/main/resources/templates/convert/pdf-to-presentation.html b/src/main/resources/templates/convert/pdf-to-presentation.html index 408ff151..48d27d24 100644 --- a/src/main/resources/templates/convert/pdf-to-presentation.html +++ b/src/main/resources/templates/convert/pdf-to-presentation.html @@ -1,5 +1,5 @@ - + @@ -9,7 +9,7 @@
-

+

@@ -35,4 +35,4 @@
- + \ No newline at end of file diff --git a/src/main/resources/templates/convert/pdf-to-text.html b/src/main/resources/templates/convert/pdf-to-text.html index d1616589..9877be8f 100644 --- a/src/main/resources/templates/convert/pdf-to-text.html +++ b/src/main/resources/templates/convert/pdf-to-text.html @@ -1,5 +1,5 @@ - + @@ -9,7 +9,7 @@
-

+

@@ -34,5 +34,4 @@
- - + \ No newline at end of file diff --git a/src/main/resources/templates/convert/pdf-to-word.html b/src/main/resources/templates/convert/pdf-to-word.html index 6fd76f4e..fbbbf45d 100644 --- a/src/main/resources/templates/convert/pdf-to-word.html +++ b/src/main/resources/templates/convert/pdf-to-word.html @@ -1,5 +1,5 @@ - + @@ -9,7 +9,7 @@
-

+

@@ -35,7 +35,4 @@
- - - - + \ No newline at end of file diff --git a/src/main/resources/templates/convert/pdf-to-xml.html b/src/main/resources/templates/convert/pdf-to-xml.html index a7d020b0..cad43da2 100644 --- a/src/main/resources/templates/convert/pdf-to-xml.html +++ b/src/main/resources/templates/convert/pdf-to-xml.html @@ -1,5 +1,5 @@ - + @@ -9,7 +9,7 @@
-

+

@@ -27,4 +27,4 @@
- + \ No newline at end of file diff --git a/src/main/resources/templates/convert/url-to-pdf.html b/src/main/resources/templates/convert/url-to-pdf.html index 94f0bfa5..714bd1c4 100644 --- a/src/main/resources/templates/convert/url-to-pdf.html +++ b/src/main/resources/templates/convert/url-to-pdf.html @@ -1,5 +1,5 @@ - + @@ -9,13 +9,13 @@
-

+

- +
@@ -27,4 +27,4 @@
- + \ No newline at end of file diff --git a/src/main/resources/templates/crop.html b/src/main/resources/templates/crop.html index 05de3516..f2049572 100644 --- a/src/main/resources/templates/crop.html +++ b/src/main/resources/templates/crop.html @@ -1,5 +1,5 @@ - + @@ -8,7 +8,7 @@
-

+

@@ -22,114 +22,117 @@
- - -
- + + overlayCanvas.addEventListener('mousedown', function(e) { + // Clear previously drawn rectangle on the main canvas + context.clearRect(0, 0, pdfCanvas.width, pdfCanvas.height); + renderPage(currentPage); // Re-render the PDF + + // Clear the overlay canvas to ensure old drawings are removed + overlayContext.clearRect(0, 0, overlayCanvas.width, overlayCanvas.height); + + startX = e.offsetX; + startY = e.offsetY; + isDrawing = true; + }); + + overlayCanvas.addEventListener('mousemove', function(e) { + if (!isDrawing) return; + overlayContext.clearRect(0, 0, overlayCanvas.width, overlayCanvas.height); // Clear previous rectangle + + rectWidth = e.offsetX - startX; + rectHeight = e.offsetY - startY; + overlayContext.strokeStyle = 'red'; + overlayContext.strokeRect(startX, startY, rectWidth, rectHeight); + }); + + overlayCanvas.addEventListener('mouseup', function(e) { + isDrawing = false; + + rectWidth = e.offsetX - startX; + rectHeight = e.offsetY - startY; + + let flippedY = pdfCanvas.height - e.offsetY; + + xInput.value = startX; + yInput.value = flippedY; + widthInput.value = rectWidth; + heightInput.value = rectHeight; + + // Draw the final rectangle on the main canvas + context.strokeStyle = 'red'; + context.strokeRect(startX, startY, rectWidth, rectHeight); + + overlayContext.clearRect(0, 0, overlayCanvas.width, overlayCanvas.height); // Clear the overlay + }); + + function renderPage(pageNumber) { + pdfDoc.getPage(pageNumber).then(function(page) { + let viewport = page.getViewport({ scale: 1.0 }); + pdfCanvas.width = viewport.width; + pdfCanvas.height = viewport.height; + + overlayCanvas.width = viewport.width; // Match overlay canvas size with PDF canvas + overlayCanvas.height = viewport.height; + + let renderContext = { canvasContext: context, viewport: viewport }; + page.render(renderContext); + pdfCanvas.classList.add("shadow-canvas"); + }); + } + +
- + \ No newline at end of file diff --git a/src/main/resources/templates/error.html b/src/main/resources/templates/error.html index 954bcd7d..57f2f4ad 100644 --- a/src/main/resources/templates/error.html +++ b/src/main/resources/templates/error.html @@ -1,5 +1,5 @@ - + @@ -29,11 +29,11 @@ Submit a ticket on GitHub Join our Discord server
- Go back to homepage + Go back to homepage
- + \ No newline at end of file diff --git a/src/main/resources/templates/extract-page.html b/src/main/resources/templates/extract-page.html index 4bbd8b22..c10485b8 100644 --- a/src/main/resources/templates/extract-page.html +++ b/src/main/resources/templates/extract-page.html @@ -1,5 +1,5 @@ - + @@ -8,7 +8,7 @@
-

+

diff --git a/src/main/resources/templates/fragments/card.html b/src/main/resources/templates/fragments/card.html index 6fa05163..3f5517d6 100644 --- a/src/main/resources/templates/fragments/card.html +++ b/src/main/resources/templates/fragments/card.html @@ -1,7 +1,7 @@ - - - + + -
diff --git a/src/main/resources/templates/fragments/footer.html b/src/main/resources/templates/fragments/footer.html index e382553b..3d32604d 100644 --- a/src/main/resources/templates/fragments/footer.html +++ b/src/main/resources/templates/fragments/footer.html @@ -1,19 +1,19 @@ diff --git a/src/main/resources/templates/fragments/navbar.html b/src/main/resources/templates/fragments/navbar.html index f7d01c0e..926f494d 100644 --- a/src/main/resources/templates/fragments/navbar.html +++ b/src/main/resources/templates/fragments/navbar.html @@ -31,11 +31,11 @@
+
\ No newline at end of file diff --git a/src/main/resources/templates/home.html b/src/main/resources/templates/home.html index 8ddb7dea..ed1c6a18 100644 --- a/src/main/resources/templates/home.html +++ b/src/main/resources/templates/home.html @@ -1,5 +1,5 @@ - + @@ -21,7 +21,7 @@

- +
@@ -75,7 +75,6 @@
-
@@ -102,4 +101,4 @@
- + \ No newline at end of file diff --git a/src/main/resources/templates/licenses.html b/src/main/resources/templates/licenses.html index 9d7cd250..f9d6c641 100644 --- a/src/main/resources/templates/licenses.html +++ b/src/main/resources/templates/licenses.html @@ -1,5 +1,5 @@ - + @@ -8,7 +8,7 @@
-

+

@@ -23,15 +23,12 @@ - + - + -
@@ -39,4 +36,4 @@
- + \ No newline at end of file diff --git a/src/main/resources/templates/login.html b/src/main/resources/templates/login.html index 19a4b728..02c9cfed 100644 --- a/src/main/resources/templates/login.html +++ b/src/main/resources/templates/login.html @@ -1,5 +1,5 @@ - + @@ -52,7 +52,7 @@ document.addEventListener('DOMContentLoaded', function() { - const defaultLocale = document.documentElement.language || 'en_GB'; + const defaultLocale = document.documentElement.getAttribute('language') || 'en_GB'; const storedLocale = localStorage.getItem('languageCode') || defaultLocale; const currentURL = new URL(window.location.href); @@ -61,10 +61,10 @@ if (defaultLocale !== storedLocale && currentLangParam !== storedLocale) { - urlParams.set('lang', storedLocale); - currentURL.search = urlParams.toString(); - window.location.href = currentURL.toString(); - return; + urlParams.set('lang', storedLocale); + currentURL.search = urlParams.toString(); + window.location.href = currentURL.toString(); + return; } const dropdown = document.getElementById('languageDropdown'); @@ -72,17 +72,17 @@ let activeItem; for (let i = 0; i < dropdownItems.length; i++) { - const item = dropdownItems[i]; - item.classList.remove('active'); - if (item.dataset.bsLanguageCode === storedLocale) { - item.classList.add('active'); - activeItem = item; - } - item.addEventListener('click', handleDropdownItemClick); + const item = dropdownItems[i]; + item.classList.remove('active'); + if (item.dataset.bsLanguageCode === storedLocale) { + item.classList.add('active'); + activeItem = item; + } + item.addEventListener('click', handleDropdownItemClick); } if (activeItem) { - dropdown.innerHTML = activeItem.innerHTML; // This will set the dropdown button's content to the active language's flag and name + dropdown.innerHTML = activeItem.innerHTML; // This will set the dropdown button's content to the active language's flag and name } // Additional functionality that was in your provided code: @@ -91,7 +91,7 @@ const dropdownMenu = element.querySelector(".dropdown-menu"); if (dropdownMenu.id !== 'favoritesDropdown' && dropdownMenu.children.length <= 2 && dropdownMenu.querySelectorAll("hr.dropdown-divider").length === dropdownMenu.children.length) { if (element.previousElementSibling && element.previousElementSibling.classList.contains('nav-item') && element.previousElementSibling.classList.contains('nav-item-separator')) { - element.previousElementSibling.remove(); + element.previousElementSibling.remove(); } element.remove(); } @@ -142,23 +142,25 @@

Please sign in

- + +
- + +
- + +