From 1b0c1b6cff3a85d5f71661c9fee616b6ac46470a Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Thu, 7 Nov 2024 21:50:47 +0000 Subject: [PATCH] Searchbar in nav auto select, and exe nolonger disable CLI (#2197) * fix remmeber me * remove uselss comment * Update translation files (#2185) Signed-off-by: GitHub Action Co-authored-by: GitHub Action * exe no longer disable CLI --------- Signed-off-by: GitHub Action Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: GitHub Action Co-authored-by: a --- build.gradle | 2 +- .../SPDF/config/EndpointConfiguration.java | 1 + .../SPDF/config/ExternalAppDepConfig.java | 2 ++ src/main/resources/static/js/search.js | 34 +++++++++++++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 8302ffdf..bb0b6bac 100644 --- a/build.gradle +++ b/build.gradle @@ -78,7 +78,7 @@ launch4j { errTitle="Encountered error, Do you have Java 21?" downloadUrl="https://download.oracle.com/java/21/latest/jdk-21_windows-x64_bin.exe" - variables=["BROWSER_OPEN=true", "ENDPOINTS_GROUPS_TO_REMOVE=CLI"] + variables=["BROWSER_OPEN=true"] jreMinVersion="17" mutexName="Stirling-PDF" diff --git a/src/main/java/stirling/software/SPDF/config/EndpointConfiguration.java b/src/main/java/stirling/software/SPDF/config/EndpointConfiguration.java index 9c0b3bf4..45b658e8 100644 --- a/src/main/java/stirling/software/SPDF/config/EndpointConfiguration.java +++ b/src/main/java/stirling/software/SPDF/config/EndpointConfiguration.java @@ -191,6 +191,7 @@ public class EndpointConfiguration { // LibreOffice addEndpointToGroup("LibreOffice", "repair"); addEndpointToGroup("LibreOffice", "file-to-pdf"); + addEndpointToGroup("Unoconv", "file-to-pdf"); addEndpointToGroup("LibreOffice", "xlsx-to-pdf"); addEndpointToGroup("LibreOffice", "pdf-to-word"); addEndpointToGroup("LibreOffice", "pdf-to-presentation"); diff --git a/src/main/java/stirling/software/SPDF/config/ExternalAppDepConfig.java b/src/main/java/stirling/software/SPDF/config/ExternalAppDepConfig.java index c939bd60..f8ab43ad 100644 --- a/src/main/java/stirling/software/SPDF/config/ExternalAppDepConfig.java +++ b/src/main/java/stirling/software/SPDF/config/ExternalAppDepConfig.java @@ -42,6 +42,7 @@ public class ExternalAppDepConfig { put("ocrmypdf", List.of("OCRmyPDF")); put("weasyprint", List.of("Weasyprint")); put("pdftohtml", List.of("Pdftohtml")); + put("unoconv", List.of("Unoconv")); } }; @@ -101,6 +102,7 @@ public class ExternalAppDepConfig { checkDependencyAndDisableGroup("ocrmypdf"); checkDependencyAndDisableGroup("weasyprint"); checkDependencyAndDisableGroup("pdftohtml"); + checkDependencyAndDisableGroup("unoconv"); // Special handling for Python/OpenCV dependencies boolean pythonAvailable = isCommandAvailable("python3") || isCommandAvailable("python"); diff --git a/src/main/resources/static/js/search.js b/src/main/resources/static/js/search.js index aec3e6c1..a4d292ea 100644 --- a/src/main/resources/static/js/search.js +++ b/src/main/resources/static/js/search.js @@ -70,3 +70,37 @@ document.querySelector("#navbarSearchInput").addEventListener("input", function resultsBox.style.width = window.navItemMaxWidth + "px"; }); +const searchDropdown = document.getElementById('searchDropdown'); +const searchInput = document.getElementById('navbarSearchInput'); +const dropdownMenu = searchDropdown.querySelector('.dropdown-menu'); + +// Handle dropdown shown event +searchDropdown.addEventListener('shown.bs.dropdown', function () { + searchInput.focus(); +}); + +// Handle hover opening +searchDropdown.addEventListener('mouseenter', function () { + const dropdownInstance = new bootstrap.Dropdown(searchDropdown); + dropdownInstance.show(); + + setTimeout(() => { + searchInput.focus(); + }, 100); +}); + +// Handle mouse leave +searchDropdown.addEventListener('mouseleave', function () { + // Check if current value is empty (including if user typed and then deleted) + if (searchInput.value.trim().length === 0) { + searchInput.blur(); + const dropdownInstance = new bootstrap.Dropdown(searchDropdown); + dropdownInstance.hide(); + } +}); + +searchDropdown.addEventListener('hidden.bs.dropdown', function () { + if (searchInput.value.trim().length === 0) { + searchInput.blur(); + } +});