From 7c26c56210ef09691c9de897029f4cd6bb94e571 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Sun, 20 Aug 2023 21:57:19 +0100 Subject: [PATCH] test --- src/main/resources/static/css/home.css | 2 +- .../resources/static/js/draggable-utils.js | 20 ++--- src/main/resources/static/js/fileInput.js | 6 +- src/main/resources/static/js/homecard.js | 2 +- .../resources/static/js/languageSelection.js | 53 +++++++------ src/main/resources/static/js/pipeline.js | 2 +- src/main/resources/static/js/search.js | 2 +- src/main/resources/templates/account.html | 18 ++--- src/main/resources/templates/addUsers.html | 6 +- .../resources/templates/auto-split-pdf.html | 2 +- .../templates/convert/img-to-pdf.html | 8 +- .../templates/convert/pdf-to-img.html | 8 +- .../convert/pdf-to-presentation.html | 2 +- .../templates/convert/pdf-to-text.html | 2 +- .../templates/convert/pdf-to-word.html | 2 +- .../resources/templates/extract-page.html | 2 +- .../resources/templates/fragments/card.html | 4 +- .../resources/templates/fragments/common.html | 33 ++++---- .../templates/fragments/errorBanner.html | 2 +- .../fragments/errorBannerPerPage.html | 6 +- .../templates/fragments/langAndDarkMode.html | 75 +++++++++++++++++++ .../resources/templates/fragments/navbar.html | 68 ++++++++--------- .../templates/fragments/navbarEntry.html | 2 +- src/main/resources/templates/home.html | 2 +- src/main/resources/templates/login.html | 10 +-- src/main/resources/templates/merge-pdfs.html | 6 +- .../templates/other/add-page-numbers.html | 10 +-- .../templates/other/change-metadata.html | 34 ++++----- .../templates/other/extract-image-scans.html | 10 +-- .../templates/other/extract-images.html | 2 +- .../templates/other/multi-page-layout.html | 2 +- .../resources/templates/other/ocr-pdf.html | 6 +- .../templates/other/remove-blanks.html | 4 +- .../templates/other/scale-pages.html | 4 +- .../resources/templates/pdf-organizer.html | 4 +- src/main/resources/templates/pipeline.html | 8 +- .../resources/templates/remove-pages.html | 2 +- .../templates/security/add-password.html | 12 +-- .../templates/security/add-watermark.html | 20 ++--- .../templates/security/cert-sign.html | 24 +++--- .../security/change-permissions.html | 6 +- .../templates/security/remove-password.html | 6 +- .../templates/security/remove-watermark.html | 6 +- .../templates/security/sanitize-pdf.html | 4 +- src/main/resources/templates/split-pdfs.html | 2 +- 45 files changed, 297 insertions(+), 214 deletions(-) create mode 100644 src/main/resources/templates/fragments/langAndDarkMode.html diff --git a/src/main/resources/static/css/home.css b/src/main/resources/static/css/home.css index 998278e1..f7549167 100644 --- a/src/main/resources/static/css/home.css +++ b/src/main/resources/static/css/home.css @@ -14,7 +14,7 @@ .features-container { display: grid; - grid-template-columns: repeat(auto-fill, minmax(21rem, 3fr)); + grid-template-columns: repeat(auto-fill, minmax(15rem, 3fr)); gap: 25px 30px; } diff --git a/src/main/resources/static/js/draggable-utils.js b/src/main/resources/static/js/draggable-utils.js index f90a80f1..4dadf920 100644 --- a/src/main/resources/static/js/draggable-utils.js +++ b/src/main/resources/static/js/draggable-utils.js @@ -13,12 +13,12 @@ const DraggableUtils = { listeners: { move: (event) => { const target = event.target; - const x = (parseFloat(target.getAttribute('data-x')) || 0) + event.dx; - const y = (parseFloat(target.getAttribute('data-y')) || 0) + event.dy; + const x = (parseFloat(target.getAttribute('data-bs-x')) || 0) + event.dx; + const y = (parseFloat(target.getAttribute('data-bs-y')) || 0) + event.dy; target.style.transform = `translate(${x}px, ${y}px)`; - target.setAttribute('data-x', x); - target.setAttribute('data-y', y); + target.setAttribute('data-bs-x', x); + target.setAttribute('data-bs-y', y); this.onInteraction(target); }, @@ -29,8 +29,8 @@ const DraggableUtils = { listeners: { move: (event) => { var target = event.target - var x = (parseFloat(target.getAttribute('data-x')) || 0) - var y = (parseFloat(target.getAttribute('data-y')) || 0) + var x = (parseFloat(target.getAttribute('data-bs-x')) || 0) + var y = (parseFloat(target.getAttribute('data-bs-y')) || 0) // check if control key is pressed if (event.ctrlKey) { @@ -58,8 +58,8 @@ const DraggableUtils = { target.style.transform = 'translate(' + x + 'px,' + y + 'px)' - target.setAttribute('data-x', x) - target.setAttribute('data-y', y) + target.setAttribute('data-bs-x', x) + target.setAttribute('data-bs-y', y) target.textContent = Math.round(event.rect.width) + '\u00D7' + Math.round(event.rect.height) this.onInteraction(target); @@ -86,8 +86,8 @@ const DraggableUtils = { const x = 0; const y = 20; createdCanvas.style.transform = `translate(${x}px, ${y}px)`; - createdCanvas.setAttribute('data-x', x); - createdCanvas.setAttribute('data-y', y); + createdCanvas.setAttribute('data-bs-x', x); + createdCanvas.setAttribute('data-bs-y', y); createdCanvas.onclick = e => this.onInteraction(e.target); diff --git a/src/main/resources/static/js/fileInput.js b/src/main/resources/static/js/fileInput.js index 7825af8b..12d50b3f 100644 --- a/src/main/resources/static/js/fileInput.js +++ b/src/main/resources/static/js/fileInput.js @@ -3,9 +3,9 @@ document.addEventListener('DOMContentLoaded', function() { }); function setupFileInput(chooser) { - const elementId = chooser.getAttribute('data-element-id'); - const filesSelected = chooser.getAttribute('data-files-selected'); - const pdfPrompt = chooser.getAttribute('data-pdf-prompt'); + const elementId = chooser.getAttribute('data-bs-element-id'); + const filesSelected = chooser.getAttribute('data-bs-files-selected'); + const pdfPrompt = chooser.getAttribute('data-bs-pdf-prompt'); let allFiles = []; let overlay; diff --git a/src/main/resources/static/js/homecard.js b/src/main/resources/static/js/homecard.js index 72997a02..d0d56185 100644 --- a/src/main/resources/static/js/homecard.js +++ b/src/main/resources/static/js/homecard.js @@ -10,7 +10,7 @@ function filterCards() { // Get the navbar tags associated with the card var navbarItem = document.querySelector(`a.dropdown-item[href="${card.id}"]`); - var navbarTags = navbarItem ? navbarItem.getAttribute('data-tags') : ''; + var navbarTags = navbarItem ? navbarItem.getAttribute('data-bs-tags') : ''; var content = title + ' ' + text + ' ' + navbarTags; diff --git a/src/main/resources/static/js/languageSelection.js b/src/main/resources/static/js/languageSelection.js index e9d141f5..359a2be3 100644 --- a/src/main/resources/static/js/languageSelection.js +++ b/src/main/resources/static/js/languageSelection.js @@ -14,33 +14,40 @@ document.addEventListener('DOMContentLoaded', function() { }); function handleDropdownItemClick(event) { - event.preventDefault(); - const languageCode = this.dataset.languageCode; - localStorage.setItem('languageCode', languageCode); + event.preventDefault(); + const languageCode = event.currentTarget.dataset.bsLanguageCode; // change this to event.currentTarget + if (languageCode) { + localStorage.setItem('languageCode', languageCode); - const currentUrl = window.location.href; - if (currentUrl.indexOf('?lang=') === -1) { - window.location.href = currentUrl + '?lang=' + languageCode; - } else { - window.location.href = currentUrl.replace(/\?lang=\w{2,}/, '?lang=' + languageCode); - } + const currentUrl = window.location.href; + if (currentUrl.indexOf('?lang=') === -1) { + window.location.href = currentUrl + '?lang=' + languageCode; + } else { + window.location.href = currentUrl.replace(/\?lang=\w{2,}/, '?lang=' + languageCode); + } + } else { + console.error("Language code is not set for this item."); // for debugging + } } -$(document).ready(function() { - $(".nav-item.dropdown").each(function() { - var $dropdownMenu = $(this).find(".dropdown-menu"); - if ($dropdownMenu.children().length <= 2 && $dropdownMenu.children("hr.dropdown-divider").length === $dropdownMenu.children().length) { - $(this).prev('.nav-item.nav-item-separator').remove(); - $(this).remove(); - } - }); +document.addEventListener('DOMContentLoaded', function() { + document.querySelectorAll('.nav-item.dropdown').forEach((element) => { + const dropdownMenu = element.querySelector(".dropdown-menu"); + if (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.remove(); + } + }); + //Sort languages by alphabet - var list = $('.dropdown-menu[aria-labelledby="languageDropdown"]').children("a"); + const list = Array.from(document.querySelector('.dropdown-menu[aria-labelledby="languageDropdown"]').children).filter(child => child.matches('a')); list.sort(function(a, b) { - var A = $(a).text().toUpperCase(); - var B = $(b).text().toUpperCase(); - return (A < B) ? -1 : (A > B) ? 1 : 0; - }) - .appendTo('.dropdown-menu[aria-labelledby="languageDropdown"]'); + var A = a.textContent.toUpperCase(); + var B = b.textContent.toUpperCase(); + return (A < B) ? -1 : (A > B) ? 1 : 0; + }).forEach(node => document.querySelector('.dropdown-menu[aria-labelledby="languageDropdown"]').appendChild(node)); + }); \ No newline at end of file diff --git a/src/main/resources/static/js/pipeline.js b/src/main/resources/static/js/pipeline.js index 8b2c263d..06810743 100644 --- a/src/main/resources/static/js/pipeline.js +++ b/src/main/resources/static/js/pipeline.js @@ -241,7 +241,7 @@ document.getElementById('addOperationBtn').addEventListener('click', function() if (parameter.name === 'fileInput') return; let parameterDiv = document.createElement('div'); - parameterDiv.className = "form-group"; + parameterDiv.className = "mb-3"; let parameterLabel = document.createElement('label'); parameterLabel.textContent = `${parameter.name} (${parameter.schema.type}): `; diff --git a/src/main/resources/static/js/search.js b/src/main/resources/static/js/search.js index a4007206..5dd4acf5 100644 --- a/src/main/resources/static/js/search.js +++ b/src/main/resources/static/js/search.js @@ -43,7 +43,7 @@ document.querySelector('#navbarSearchInput').addEventListener('input', function( var titleElement = item.querySelector('.icon-text'); var iconElement = item.querySelector('.icon'); var itemHref = item.getAttribute('href'); - var tags = item.getAttribute('data-tags') || ""; // If no tags, default to empty string + var tags = item.getAttribute('data-bs-tags') || ""; // If no tags, default to empty string if (titleElement && iconElement && itemHref !== '#') { var title = titleElement.innerText; diff --git a/src/main/resources/templates/account.html b/src/main/resources/templates/account.html index bd01c24e..5a4882e5 100644 --- a/src/main/resources/templates/account.html +++ b/src/main/resources/templates/account.html @@ -1,4 +1,4 @@ - + @@ -24,15 +24,15 @@

-
+
-
+
-
+
@@ -42,19 +42,19 @@

Change Password?

-
+
-
+
-
+
-
+
@@ -286,7 +286,7 @@ -
+
diff --git a/src/main/resources/templates/addUsers.html b/src/main/resources/templates/addUsers.html index fe37e71c..c590988a 100644 --- a/src/main/resources/templates/addUsers.html +++ b/src/main/resources/templates/addUsers.html @@ -41,15 +41,15 @@

Add New User

-
+
-
+
-
+
- +

diff --git a/src/main/resources/templates/convert/img-to-pdf.html b/src/main/resources/templates/convert/img-to-pdf.html index 3182eb9d..78da1934 100644 --- a/src/main/resources/templates/convert/img-to-pdf.html +++ b/src/main/resources/templates/convert/img-to-pdf.html @@ -23,13 +23,13 @@
- +
- +
-
+
-
+
@@ -26,14 +26,14 @@
-
+
-
+
-
+
diff --git a/src/main/resources/templates/convert/pdf-to-presentation.html b/src/main/resources/templates/convert/pdf-to-presentation.html index f5f73397..4c784017 100644 --- a/src/main/resources/templates/convert/pdf-to-presentation.html +++ b/src/main/resources/templates/convert/pdf-to-presentation.html @@ -15,7 +15,7 @@
-
+
diff --git a/src/main/resources/templates/convert/pdf-to-word.html b/src/main/resources/templates/convert/pdf-to-word.html index c183d1bc..a10ca12f 100644 --- a/src/main/resources/templates/convert/pdf-to-word.html +++ b/src/main/resources/templates/convert/pdf-to-word.html @@ -15,7 +15,7 @@
-
+
-
+
diff --git a/src/main/resources/templates/fragments/card.html b/src/main/resources/templates/fragments/card.html index 48142b03..c3583da6 100644 --- a/src/main/resources/templates/fragments/card.html +++ b/src/main/resources/templates/fragments/card.html @@ -1,8 +1,8 @@ -
+
Icon -
+

diff --git a/src/main/resources/templates/fragments/common.html b/src/main/resources/templates/fragments/common.html index 74536458..7c6b785d 100644 --- a/src/main/resources/templates/fragments/common.html +++ b/src/main/resources/templates/fragments/common.html @@ -32,10 +32,11 @@ - - - - + + + + + @@ -57,7 +58,7 @@ - + -
-
- - -
-
-
+
+
+ +
+
+
+ diff --git a/src/main/resources/templates/fragments/errorBanner.html b/src/main/resources/templates/fragments/errorBanner.html index 98fd9aeb..1d2153ab 100644 --- a/src/main/resources/templates/fragments/errorBanner.html +++ b/src/main/resources/templates/fragments/errorBanner.html @@ -24,7 +24,7 @@

- diff --git a/src/main/resources/templates/fragments/errorBannerPerPage.html b/src/main/resources/templates/fragments/errorBannerPerPage.html index e1365513..ccc2f7b4 100644 --- a/src/main/resources/templates/fragments/errorBannerPerPage.html +++ b/src/main/resources/templates/fragments/errorBannerPerPage.html @@ -7,7 +7,7 @@ - @@ -29,7 +29,7 @@ Go to Homepage - Close + Close
diff --git a/src/main/resources/templates/fragments/langAndDarkMode.html b/src/main/resources/templates/fragments/langAndDarkMode.html new file mode 100644 index 00000000..b587e88e --- /dev/null +++ b/src/main/resources/templates/fragments/langAndDarkMode.html @@ -0,0 +1,75 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/fragments/navbar.html b/src/main/resources/templates/fragments/navbar.html index c6dcadd5..060ebaf0 100644 --- a/src/main/resources/templates/fragments/navbar.html +++ b/src/main/resources/templates/fragments/navbar.html @@ -18,13 +18,13 @@ - -