Hides time when the sidebar is collapsed

main
Yasen Pramatarov 2024-09-23 19:37:58 +03:00
parent 950ea8ff95
commit eabbd67b9a
1 changed files with 5 additions and 0 deletions

View File

@ -3,6 +3,7 @@ document.addEventListener('DOMContentLoaded', function () {
var sidebar = document.getElementById('sidebar');
var mainContent = document.getElementById('mainContent');
var toggleButton = document.getElementById('toggleSidebarButton');
var timeNow = document.getElementById('time_now');
// update localStorage based on the current state
function updateStorage() {
@ -18,11 +19,13 @@ document.addEventListener('DOMContentLoaded', function () {
toggleButton.textContent = ">>";
sidebar.classList.add('collapsed');
mainContent.classList.add('expanded');
timeNow.style.display = 'none';
} else {
toggleButton.value = "<<";
toggleButton.textContent = "<<";
sidebar.classList.remove('collapsed');
mainContent.classList.remove('expanded');
timeNow.style.display = 'block';
}
}
@ -38,9 +41,11 @@ document.addEventListener('DOMContentLoaded', function () {
if (toggleButton.value === ">>") {
toggleButton.value = "<<";
toggleButton.textContent = "<<";
timeNow.style.display = 'block';
} else {
toggleButton.value = ">>";
toggleButton.textContent = ">>";
timeNow.style.display = 'none';
}
// Update with the new state