mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-09-08 17:51:20 +02:00
only allow one nav bar item to be open at a time
This commit is contained in:
parent
8bcdb4cf9e
commit
22a6567cc9
@ -10,7 +10,6 @@ import java.util.Properties;
|
|||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@ -151,9 +150,8 @@ public class AppConfig {
|
|||||||
@Bean(name = "activeSecurity")
|
@Bean(name = "activeSecurity")
|
||||||
public boolean missingActiveSecurity() {
|
public boolean missingActiveSecurity() {
|
||||||
return ClassUtils.isPresent(
|
return ClassUtils.isPresent(
|
||||||
"stirling.software.proprietary.security.configuration.SecurityConfiguration",
|
"stirling.software.proprietary.security.configuration.SecurityConfiguration",
|
||||||
this.getClass().getClassLoader()
|
this.getClass().getClassLoader());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean(name = "directoryFilter")
|
@Bean(name = "directoryFilter")
|
||||||
|
@ -40,7 +40,7 @@ textarea {
|
|||||||
}
|
}
|
||||||
|
|
||||||
*::-webkit-scrollbar-corner {
|
*::-webkit-scrollbar-corner {
|
||||||
background-color: var(--md-sys-color-surface);
|
background-color: var(--md-sys-color-surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Alerts */
|
/* Alerts */
|
||||||
@ -66,6 +66,9 @@ td {
|
|||||||
background-color: var(--md-sys-color-surface-5);
|
background-color: var(--md-sys-color-surface-5);
|
||||||
border-radius: 3rem;
|
border-radius: 3rem;
|
||||||
padding: 2.5rem;
|
padding: 2.5rem;
|
||||||
|
|
||||||
|
max-width: 95vw;
|
||||||
|
margin-left: 2vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
|
@ -42,58 +42,29 @@ function toolsManager() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupDropdownHovers() {
|
function setupDropdowns() {
|
||||||
const dropdowns = document.querySelectorAll('.navbar-nav > .nav-item.dropdown');
|
const dropdowns = document.querySelectorAll('.navbar-nav > .nav-item.dropdown');
|
||||||
|
|
||||||
dropdowns.forEach(dropdown => {
|
dropdowns.forEach((dropdown) => {
|
||||||
const toggle = dropdown.querySelector('[data-bs-toggle="dropdown"]');
|
const toggle = dropdown.querySelector('[data-bs-toggle="dropdown"]');
|
||||||
if (!toggle) return;
|
if (!toggle) return;
|
||||||
|
|
||||||
// Skip search dropdown, it has its own logic
|
// Skip search dropdown, it has its own logic
|
||||||
if (toggle.id === 'searchDropdown') {
|
if (toggle.id === 'searchDropdown') {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dropdown.addEventListener('show.bs.dropdown', () => {
|
||||||
|
// Find all other dropdowns and hide them
|
||||||
|
bootstrap.Dropdown.getAllInstances().forEach((instance) => {
|
||||||
|
if (instance._element !== toggle) {
|
||||||
|
instance.hide();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
let timeout;
|
|
||||||
const instance = bootstrap.Dropdown.getOrCreateInstance(toggle);
|
|
||||||
|
|
||||||
dropdown.addEventListener('mouseenter', () => {
|
|
||||||
if (window.innerWidth >= 1200) {
|
|
||||||
clearTimeout(timeout);
|
|
||||||
if (!instance._isShown()) {
|
|
||||||
instance.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
dropdown.addEventListener('mouseleave', () => {
|
|
||||||
if (window.innerWidth >= 1200) {
|
|
||||||
timeout = setTimeout(() => {
|
|
||||||
if (instance._isShown()) {
|
|
||||||
instance.hide();
|
|
||||||
}
|
|
||||||
}, 200);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
toggle.addEventListener('click', (e) => {
|
|
||||||
if (window.innerWidth >= 1200) {
|
|
||||||
// On desktop, prevent Bootstrap's default click toggle
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
|
|
||||||
// Still allow navigation if it's a link
|
|
||||||
const href = toggle.getAttribute('href');
|
|
||||||
if (href && href !== '#') {
|
|
||||||
window.location.href = href;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// On mobile (< 1200px), this listener does nothing, allowing default click behavior.
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
window.tooltipSetup = () => {
|
window.tooltipSetup = () => {
|
||||||
const tooltipElements = document.querySelectorAll('[title]');
|
const tooltipElements = document.querySelectorAll('[title]');
|
||||||
|
|
||||||
@ -130,5 +101,5 @@ window.tooltipSetup = () => {
|
|||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
tooltipSetup();
|
tooltipSetup();
|
||||||
setupDropdownHovers();
|
setupDropdowns();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user