mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
33 lines
605 B
JavaScript
33 lines
605 B
JavaScript
$("#night-mode-enabled").on("change", function()
|
|
{
|
|
var value = $(this).is(":checked");
|
|
|
|
jsonData = { };
|
|
jsonData.value = value;
|
|
console.log(jsonData);
|
|
Grocy.Api.Post('user/settings/night_mode_enabled', jsonData,
|
|
function(result)
|
|
{
|
|
// Nothing to do...
|
|
},
|
|
function(xhr)
|
|
{
|
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
|
}
|
|
);
|
|
|
|
if (value)
|
|
{
|
|
$("body").addClass("night-mode");
|
|
}
|
|
else
|
|
{
|
|
$("body").removeClass("night-mode");
|
|
}
|
|
});
|
|
|
|
if (Grocy.NightModeEnabled)
|
|
{
|
|
$("#night-mode-enabled").prop("checked", true);
|
|
}
|