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:
|
test-build-docker-images:
|
||||||
if: github.event_name == 'pull_request' && needs.files-changed.outputs.project == 'true'
|
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
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
@ -82,55 +82,62 @@ document.querySelector("#navbarSearchInput").addEventListener("input", function
|
|||||||
resultsBox.style.width = window.navItemMaxWidth + "px";
|
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');
|
// Check if elements are missing and skip initialization if necessary
|
||||||
const searchInput = document.getElementById('navbarSearchInput');
|
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
|
// Create a single dropdown instance
|
||||||
if (searchDropdown && searchInput) {
|
const dropdownInstance = new bootstrap.Dropdown(searchDropdown);
|
||||||
const dropdownMenu = searchDropdown.querySelector('.dropdown-menu');
|
|
||||||
|
|
||||||
// Create a single dropdown instance
|
// Handle click for mobile
|
||||||
const dropdownInstance = new bootstrap.Dropdown(searchDropdown);
|
searchDropdown.addEventListener('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
// Handle click for mobile
|
const isOpen = dropdownMenu.classList.contains('show');
|
||||||
searchDropdown.addEventListener('click', function (e) {
|
// Close all other open dropdowns
|
||||||
e.preventDefault();
|
document.querySelectorAll('.navbar-nav .dropdown-menu.show').forEach((menu) => {
|
||||||
const isOpen = dropdownMenu.classList.contains('show');
|
if (menu !== dropdownMenu) {
|
||||||
// Close all other open dropdowns
|
const parentDropdown = menu.closest('.dropdown');
|
||||||
document.querySelectorAll('.navbar-nav .dropdown-menu.show').forEach((menu) => {
|
if (parentDropdown) {
|
||||||
if (menu !== dropdownMenu) {
|
const parentToggle = parentDropdown.querySelector('[data-bs-toggle="dropdown"]');
|
||||||
const parentDropdown = menu.closest('.dropdown');
|
if (parentToggle) {
|
||||||
if (parentDropdown) {
|
let instance = bootstrap.Dropdown.getInstance(parentToggle);
|
||||||
const parentToggle = parentDropdown.querySelector('[data-bs-toggle="dropdown"]');
|
if (!instance) {
|
||||||
if (parentToggle) {
|
instance = new bootstrap.Dropdown(parentToggle);
|
||||||
let instance = bootstrap.Dropdown.getInstance(parentToggle);
|
|
||||||
if (!instance) {
|
|
||||||
instance = new bootstrap.Dropdown(parentToggle);
|
|
||||||
}
|
|
||||||
instance.hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
instance.hide();
|
||||||
if (!isOpen) {
|
}
|
||||||
dropdownInstance.show();
|
|
||||||
setTimeout(() => searchInput.focus(), 150);
|
|
||||||
} else {
|
|
||||||
dropdownInstance.hide();
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
if (!isOpen) {
|
||||||
|
dropdownInstance.show();
|
||||||
|
setTimeout(() => searchInput.focus(), 150);
|
||||||
|
} else {
|
||||||
|
dropdownInstance.hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Hide dropdown if it's open and user clicks outside
|
// Hide dropdown if it's open and user clicks outside
|
||||||
document.addEventListener('click', function(e) {
|
document.addEventListener('click', function (e) {
|
||||||
if (!searchDropdown.contains(e.target) && dropdownMenu.classList.contains('show')) {
|
if (!searchDropdown.contains(e.target) && dropdownMenu.classList.contains('show')) {
|
||||||
dropdownInstance.hide();
|
dropdownInstance.hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Keep dropdown open if search input is clicked
|
// Keep dropdown open if search input is clicked
|
||||||
searchInput.addEventListener('click', function (e) {
|
searchInput.addEventListener('click', function (e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user