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