bootstrap 5
This commit is contained in:
parent
8aac0c0327
commit
7741d60afd
7 changed files with 58 additions and 50 deletions
11
src/main/resources/static/css/bootstrap.min.css
vendored
11
src/main/resources/static/css/bootstrap.min.css
vendored
File diff suppressed because one or more lines are too long
|
@ -1,37 +1,45 @@
|
||||||
function updateFavoritesDropdown() {
|
function updateFavoritesDropdown() {
|
||||||
var dropdown = document.querySelector('#favoritesDropdown');
|
var dropdown = document.querySelector('#favoritesDropdown');
|
||||||
dropdown.innerHTML = ''; // Clear the current favorites
|
|
||||||
|
// Check if dropdown exists
|
||||||
|
if (!dropdown) {
|
||||||
|
console.error('Dropdown element with ID "favoritesDropdown" not found!');
|
||||||
|
return; // Exit the function
|
||||||
|
}
|
||||||
|
dropdown.innerHTML = ''; // Clear the current favorites
|
||||||
|
|
||||||
|
var hasFavorites = false;
|
||||||
|
|
||||||
|
for (var i = 0; i < localStorage.length; i++) {
|
||||||
|
var key = localStorage.key(i);
|
||||||
|
if (localStorage.getItem(key) === 'favorite') {
|
||||||
|
// Find the corresponding navbar entry
|
||||||
|
var navbarEntry = document.querySelector(`a[href='${key}']`);
|
||||||
|
if (navbarEntry) {
|
||||||
|
// Create a new dropdown entry
|
||||||
|
var dropdownItem = document.createElement('a');
|
||||||
|
dropdownItem.className = 'dropdown-item';
|
||||||
|
dropdownItem.href = navbarEntry.href;
|
||||||
|
dropdownItem.innerHTML = navbarEntry.innerHTML;
|
||||||
|
dropdown.appendChild(dropdownItem);
|
||||||
|
hasFavorites = true;
|
||||||
|
} else {
|
||||||
|
console.warn(`Navbar entry not found for key: ${key}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var hasFavorites = false;
|
// Show or hide the default item based on whether there are any favorites
|
||||||
|
if (!hasFavorites) {
|
||||||
for (var i = 0; i < localStorage.length; i++) {
|
var defaultItem = document.createElement('a');
|
||||||
var key = localStorage.key(i);
|
defaultItem.className = 'dropdown-item';
|
||||||
if (localStorage.getItem(key) === 'favorite') {
|
defaultItem.textContent = noFavourites;
|
||||||
// Find the corresponding navbar entry
|
dropdown.appendChild(defaultItem);
|
||||||
var navbarEntry = document.querySelector(`a[href='${key}']`);
|
}
|
||||||
if (navbarEntry) {
|
|
||||||
// Create a new dropdown entry
|
|
||||||
var dropdownItem = document.createElement('a');
|
|
||||||
dropdownItem.className = 'dropdown-item';
|
|
||||||
dropdownItem.href = navbarEntry.href;
|
|
||||||
dropdownItem.innerHTML = navbarEntry.innerHTML;
|
|
||||||
dropdown.appendChild(dropdownItem);
|
|
||||||
hasFavorites = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show or hide the default item based on whether there are any favorites
|
|
||||||
if (!hasFavorites) {
|
|
||||||
var defaultItem = document.createElement('a');
|
|
||||||
defaultItem.className = 'dropdown-item';
|
|
||||||
defaultItem.textContent = noFavourites;
|
|
||||||
dropdown.appendChild(defaultItem);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
|
|
||||||
updateFavoritesDropdown();
|
// Ensure that the DOM content has been fully loaded before calling the function
|
||||||
});
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
console.log('DOMContentLoaded event fired');
|
||||||
|
updateFavoritesDropdown();
|
||||||
|
});
|
||||||
|
|
|
@ -34,7 +34,7 @@ function handleDropdownItemClick(event) {
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
document.querySelectorAll('.nav-item.dropdown').forEach((element) => {
|
document.querySelectorAll('.nav-item.dropdown').forEach((element) => {
|
||||||
const dropdownMenu = element.querySelector(".dropdown-menu");
|
const dropdownMenu = element.querySelector(".dropdown-menu");
|
||||||
if (dropdownMenu.children.length <= 2 && dropdownMenu.querySelectorAll("hr.dropdown-divider").length === dropdownMenu.children.length) {
|
if (dropdownMenu.id !== 'favoritesDropdown' && 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')) {
|
if (element.previousElementSibling && element.previousElementSibling.classList.contains('nav-item') && element.previousElementSibling.classList.contains('nav-item-separator')) {
|
||||||
element.previousElementSibling.remove();
|
element.previousElementSibling.remove();
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -3,12 +3,12 @@
|
||||||
"short_name": "Stirling PDF",
|
"short_name": "Stirling PDF",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "/android-chrome-192x192.png",
|
"src": "android-chrome-192x192.png",
|
||||||
"sizes": "192x192",
|
"sizes": "192x192",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "/android-chrome-512x512.png",
|
"src": "android-chrome-512x512.png",
|
||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
}
|
}
|
||||||
|
@ -16,4 +16,4 @@
|
||||||
"theme_color": "#ffffff",
|
"theme_color": "#ffffff",
|
||||||
"background_color": "#ffffff",
|
"background_color": "#ffffff",
|
||||||
"display": "standalone"
|
"display": "standalone"
|
||||||
}
|
}
|
|
@ -32,11 +32,9 @@
|
||||||
<script src="js/thirdParty/jszip.min.js"></script>
|
<script src="js/thirdParty/jszip.min.js"></script>
|
||||||
|
|
||||||
<!-- Bootstrap -->
|
<!-- Bootstrap -->
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
|
<script src="js/thirdParty/popper.min.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
|
<script src="js/thirdParty/bootstrap.min.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
|
<link rel="stylesheet" href="css/bootstrap.min.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- PDF.js -->
|
<!-- PDF.js -->
|
||||||
<script src="pdfjs/pdf.js"></script>
|
<script src="pdfjs/pdf.js"></script>
|
||||||
|
|
Loading…
Reference in a new issue