bootstrap 5

This commit is contained in:
Anthony Stirling 2023-08-22 23:03:21 +01:00
parent 8aac0c0327
commit 7741d60afd
7 changed files with 58 additions and 50 deletions

File diff suppressed because one or more lines are too long

View file

@ -1,9 +1,13 @@
function updateFavoritesDropdown() { function updateFavoritesDropdown() {
var dropdown = document.querySelector('#favoritesDropdown'); var dropdown = document.querySelector('#favoritesDropdown');
// 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 dropdown.innerHTML = ''; // Clear the current favorites
var hasFavorites = false; var hasFavorites = false;
for (var i = 0; i < localStorage.length; i++) { for (var i = 0; i < localStorage.length; i++) {
@ -19,6 +23,8 @@ function updateFavoritesDropdown() {
dropdownItem.innerHTML = navbarEntry.innerHTML; dropdownItem.innerHTML = navbarEntry.innerHTML;
dropdown.appendChild(dropdownItem); dropdown.appendChild(dropdownItem);
hasFavorites = true; hasFavorites = true;
} else {
console.warn(`Navbar entry not found for key: ${key}`);
} }
} }
} }
@ -31,7 +37,9 @@ function updateFavoritesDropdown() {
dropdown.appendChild(defaultItem); dropdown.appendChild(defaultItem);
} }
} }
document.addEventListener('DOMContentLoaded', function() {
// Ensure that the DOM content has been fully loaded before calling the function
document.addEventListener('DOMContentLoaded', function() {
console.log('DOMContentLoaded event fired');
updateFavoritesDropdown(); updateFavoritesDropdown();
}); });

View file

@ -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

View file

@ -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"
} }

View file

@ -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>