mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Update custom.js
Updated dark theme switcher so now it can switch between dark and light material theme while keeping it's functionality to stock theme.
This commit is contained in:
parent
3cf88d98b2
commit
7a1900d814
@ -536,12 +536,27 @@ function set_theme(theme) {
|
||||
}
|
||||
|
||||
$(function() {
|
||||
var currentTheme = getCookie('theme');
|
||||
// Check if the current theme is a dark theme
|
||||
var isDarkTheme = currentTheme === 'lightsout.css' || currentTheme === 'material-dark.php';
|
||||
|
||||
$('#night-mode').prop('checked', isDarkTheme);
|
||||
$('#night-mode').change(function() {
|
||||
var state = $(this).is(':checked');
|
||||
if (state == true && getCookie('theme') != 'lightsout.css') {
|
||||
var currentTheme = getCookie('theme');
|
||||
|
||||
if (state == true) {
|
||||
if (currentTheme == 'custom.php') {
|
||||
set_theme('lightsout.css');
|
||||
} else if (currentTheme == 'material-light.php') {
|
||||
set_theme('material-dark.php');
|
||||
}
|
||||
} else {
|
||||
if (currentTheme == 'lightsout.css') {
|
||||
set_theme('custom.php');
|
||||
} else if (currentTheme == 'material-dark.php') {
|
||||
set_theme('material-light.php');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user