diff --git a/app/js/custom.js b/app/js/custom.js index dcb05797..28609abe 100644 --- a/app/js/custom.js +++ b/app/js/custom.js @@ -397,6 +397,17 @@ function set_theme(theme) { setCookie('theme',theme,90); } +$(function() { + $('#night-mode').change(function() { + var state = $(this).is(':checked'); + if (state == true && getCookie('theme') != 'lightsout.css') { + set_theme('lightsout.css'); + } else { + set_theme('custom.php'); + } + }); +}); + function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); diff --git a/includes/functions.php b/includes/functions.php index 7593df18..1ca27d7d 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -720,3 +720,13 @@ function validate_host($host) { return preg_match('/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i', $host); } +// Gets night mode toggle value +// @return boolean +function getNightmode(){ + if ($_COOKIE['theme'] == 'lightsout.css') { + return true; + } else { + return false; + } +} + diff --git a/index.php b/index.php index 805ef863..b7552c14 100755 --- a/index.php +++ b/index.php @@ -214,8 +214,13 @@ $bridgedEnabled = getBridgedState(); -

+