mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-08-02 13:48:15 +02:00
Merge 47df8ce1b4
into 043db37dfb
This commit is contained in:
commit
52850e5182
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -247,7 +247,7 @@ jobs:
|
||||
|
||||
test-build-docker-images:
|
||||
if: github.event_name == 'pull_request' && needs.files-changed.outputs.project == 'true'
|
||||
needs: [files-changed, build, check-generateOpenApiDocs, check-licence]
|
||||
needs: [files-changed, build]
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
@ -82,55 +82,62 @@ document.querySelector("#navbarSearchInput").addEventListener("input", function
|
||||
resultsBox.style.width = window.navItemMaxWidth + "px";
|
||||
});
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const searchDropdown = document.getElementById('searchDropdown');
|
||||
const searchInput = document.getElementById('navbarSearchInput');
|
||||
|
||||
const searchDropdown = document.getElementById('searchDropdown');
|
||||
const searchInput = document.getElementById('navbarSearchInput');
|
||||
// Check if elements are missing and skip initialization if necessary
|
||||
if (!searchDropdown || !searchInput) {
|
||||
console.warn('Search dropdown or input not found. Skipping initialization.');
|
||||
return;
|
||||
}
|
||||
const dropdownMenu = searchDropdown.querySelector('.dropdown-menu');
|
||||
if (!dropdownMenu) {
|
||||
console.warn('Dropdown menu not found within the search dropdown. Skipping initialization.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if elements exist before proceeding
|
||||
if (searchDropdown && searchInput) {
|
||||
const dropdownMenu = searchDropdown.querySelector('.dropdown-menu');
|
||||
// Create a single dropdown instance
|
||||
const dropdownInstance = new bootstrap.Dropdown(searchDropdown);
|
||||
|
||||
// Create a single dropdown instance
|
||||
const dropdownInstance = new bootstrap.Dropdown(searchDropdown);
|
||||
|
||||
// Handle click for mobile
|
||||
searchDropdown.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
const isOpen = dropdownMenu.classList.contains('show');
|
||||
// Close all other open dropdowns
|
||||
document.querySelectorAll('.navbar-nav .dropdown-menu.show').forEach((menu) => {
|
||||
if (menu !== dropdownMenu) {
|
||||
const parentDropdown = menu.closest('.dropdown');
|
||||
if (parentDropdown) {
|
||||
const parentToggle = parentDropdown.querySelector('[data-bs-toggle="dropdown"]');
|
||||
if (parentToggle) {
|
||||
let instance = bootstrap.Dropdown.getInstance(parentToggle);
|
||||
if (!instance) {
|
||||
instance = new bootstrap.Dropdown(parentToggle);
|
||||
}
|
||||
instance.hide();
|
||||
}
|
||||
}
|
||||
// Handle click for mobile
|
||||
searchDropdown.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
const isOpen = dropdownMenu.classList.contains('show');
|
||||
// Close all other open dropdowns
|
||||
document.querySelectorAll('.navbar-nav .dropdown-menu.show').forEach((menu) => {
|
||||
if (menu !== dropdownMenu) {
|
||||
const parentDropdown = menu.closest('.dropdown');
|
||||
if (parentDropdown) {
|
||||
const parentToggle = parentDropdown.querySelector('[data-bs-toggle="dropdown"]');
|
||||
if (parentToggle) {
|
||||
let instance = bootstrap.Dropdown.getInstance(parentToggle);
|
||||
if (!instance) {
|
||||
instance = new bootstrap.Dropdown(parentToggle);
|
||||
}
|
||||
});
|
||||
if (!isOpen) {
|
||||
dropdownInstance.show();
|
||||
setTimeout(() => searchInput.focus(), 150);
|
||||
} else {
|
||||
dropdownInstance.hide();
|
||||
instance.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!isOpen) {
|
||||
dropdownInstance.show();
|
||||
setTimeout(() => searchInput.focus(), 150);
|
||||
} else {
|
||||
dropdownInstance.hide();
|
||||
}
|
||||
});
|
||||
|
||||
// Hide dropdown if it's open and user clicks outside
|
||||
document.addEventListener('click', function(e) {
|
||||
if (!searchDropdown.contains(e.target) && dropdownMenu.classList.contains('show')) {
|
||||
dropdownInstance.hide();
|
||||
}
|
||||
});
|
||||
// Hide dropdown if it's open and user clicks outside
|
||||
document.addEventListener('click', function (e) {
|
||||
if (!searchDropdown.contains(e.target) && dropdownMenu.classList.contains('show')) {
|
||||
dropdownInstance.hide();
|
||||
}
|
||||
});
|
||||
|
||||
// Keep dropdown open if search input is clicked
|
||||
searchInput.addEventListener('click', function (e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
// Keep dropdown open if search input is clicked
|
||||
searchInput.addEventListener('click', function (e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user