mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
Remember sidebar collapsed state
This commit is contained in:
parent
e5a4d11c0b
commit
aa0771877f
@ -32,6 +32,32 @@ if (!Grocy.ActiveNav.isEmpty())
|
||||
}
|
||||
}
|
||||
|
||||
var observer = new MutationObserver(function(mutations)
|
||||
{
|
||||
mutations.forEach(function(mutation)
|
||||
{
|
||||
if (mutation.attributeName === "class")
|
||||
{
|
||||
var attributeValue = $(mutation.target).prop(mutation.attributeName);
|
||||
if (attributeValue.contains("sidenav-toggled"))
|
||||
{
|
||||
window.localStorage.setItem("sidebar_state", "collapsed");
|
||||
}
|
||||
else
|
||||
{
|
||||
window.localStorage.setItem("sidebar_state", "expanded");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
observer.observe(document.body, {
|
||||
attributes: true
|
||||
});
|
||||
if (window.localStorage.getItem("sidebar_state") === "collapsed")
|
||||
{
|
||||
$("#sidenavToggler").click();
|
||||
}
|
||||
|
||||
$.timeago.settings.allowFuture = true;
|
||||
RefreshContextualTimeago = function()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user