From 5524075b04e28548e71254ae01205a58d02ecaac Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 30 Nov 2019 16:05:09 +0100 Subject: [PATCH] Fix slider for devices without RGB Fix slider for devices with one or two channels like only white or white/yellow --- tasmota/CHANGELOG.md | 2 ++ tasmota/xdrv_01_webserver.ino | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tasmota/CHANGELOG.md b/tasmota/CHANGELOG.md index 2810f33736b9..235471a07e24 100644 --- a/tasmota/CHANGELOG.md +++ b/tasmota/CHANGELOG.md @@ -2,6 +2,8 @@ ### 7.1.0.1 20191130 +- Fix slider for devices with one or two channels like only white or white/yellow + ## Released ### 7.1.0 20191129 diff --git a/tasmota/xdrv_01_webserver.ino b/tasmota/xdrv_01_webserver.ino index 42630b8baa53..48e2cd26af76 100644 --- a/tasmota/xdrv_01_webserver.ino +++ b/tasmota/xdrv_01_webserver.ino @@ -154,9 +154,11 @@ const char HTTP_SCRIPT_ROOT[] PROGMEM = const char HTTP_SCRIPT_ROOT_PART2[] PROGMEM = "function lc(v,i,p){" - "if(v=='h'||v=='d'){" // Hue or Brightness changed so change Saturation colors too - "var sl=eb('sl4').value;" - "eb('s').style.background='linear-gradient(to right,rgb('+sl+'%%,'+sl+'%%,'+sl+'%%),hsl('+eb('sl2').value+',100%%,50%%))';" + "if(eb('s')){" // Check if Saturation is in DOM otherwise javascript fails on la() + "if(v=='h'||v=='d'){" // Hue or Brightness changed so change Saturation colors too + "var sl=eb('sl4').value;" + "eb('s').style.background='linear-gradient(to right,rgb('+sl+'%%,'+sl+'%%,'+sl+'%%),hsl('+eb('sl2').value+',100%%,50%%))';" + "}" "}" "la('&'+v+i+'='+p);" "}"