From 0b96bf810144d6a7700c177533fe86a70219cf38 Mon Sep 17 00:00:00 2001 From: Joshua Orvis Date: Fri, 5 Jan 2024 02:01:36 -0600 Subject: [PATCH] Sidebar collapsed state now stored/displayed via Cookie --- www/js/common.v2.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/www/js/common.v2.js b/www/js/common.v2.js index baa161b6..601c1070 100644 --- a/www/js/common.v2.js +++ b/www/js/common.v2.js @@ -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 */