updated to modul etichete

This commit is contained in:
2025-04-30 11:57:48 +03:00
parent e6878495a1
commit 56f3f8805d
7 changed files with 48 additions and 3 deletions

View File

@@ -7,16 +7,29 @@ document.addEventListener('DOMContentLoaded', () => {
const themeToggleButton = document.getElementById('theme-toggle');
const body = document.body;
// Helper function to update the theme toggle button text
function updateThemeToggleButtonText() {
if (body.classList.contains('dark-mode')) {
themeToggleButton.textContent = 'Change to Light Mode';
} else {
themeToggleButton.textContent = 'Change to Dark Mode';
}
}
// Check and apply the saved theme from localStorage
const savedTheme = localStorage.getItem('theme');
if (savedTheme) {
body.classList.toggle('dark-mode', savedTheme === 'dark');
}
// Update the button text based on the current theme
updateThemeToggleButtonText();
// Toggle the theme on button click
themeToggleButton.addEventListener('click', () => {
const isDarkMode = body.classList.toggle('dark-mode');
localStorage.setItem('theme', isDarkMode ? 'dark' : 'light');
updateThemeToggleButtonText(); // Update the button text after toggling
});
// Helper function to format dates
@@ -145,4 +158,11 @@ document.addEventListener('DOMContentLoaded', () => {
alert('Exporting current report as PDF...');
// Add logic to export the current report as PDF
});
});