mirror of
				https://github.com/billz/raspap-webgui.git
				synced 2025-03-01 10:31:47 +00: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:
		| @@ -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') { | ||||
|             set_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 { | ||||
|             set_theme('custom.php'); | ||||
|             if (currentTheme == 'lightsout.css') { | ||||
|                 set_theme('custom.php'); | ||||
|             } else if (currentTheme == 'material-dark.php') { | ||||
|                 set_theme('material-light.php'); | ||||
|             } | ||||
|         } | ||||
|    }); | ||||
| }); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user