Skip to content

Commit

Permalink
Sidebar collapsed state now stored/displayed via Cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
jorvis committed Jan 5, 2024
1 parent 66d59c2 commit 0b96bf8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions www/js/common.v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,24 @@ document.addEventListener('DOMContentLoaded', () => {
if (SIDEBAR_COLLAPSED == false) {
hideNavbarElementsWithAnimation();
SIDEBAR_COLLAPSED = true;
Cookies.set('gear_sidebar_collapsed', true, { expires: 7 });
} else {
showNavbarElementsWithAnimation();
SIDEBAR_COLLAPSED = false;
Cookies.set('gear_sidebar_collapsed', false, { expires: 7 });
}
});

// now, if the page was initially loaded check and see if this has already been toggled via a cookie
const sidebar_cookie = Cookies.get('gear_sidebar_collapsed');
if (sidebar_cookie == "true") {
hideNavbarElementsWithAnimation();
SIDEBAR_COLLAPSED = true;
} else {
showNavbarElementsWithAnimation();
SIDEBAR_COLLAPSED = false;
}

/**
* / End controls for the left navbar visibility
*/
Expand Down

0 comments on commit 0b96bf8

Please sign in to comment.