Fix colorpicker when using USE_JAVASCRIPT_ES6

Fix colorpicker when using USE_JAVASCRIPT_ES6 (#6994)
This commit is contained in:
Theo Arends 2019-11-22 10:49:15 +01:00
parent 212b71bebe
commit 1ed0a372c6
1 changed files with 24 additions and 18 deletions

View File

@ -162,11 +162,11 @@ const char HTTP_SCRIPT_ROOT[] PROGMEM =
"function lc(v,i,p){"
"la('&'+v+i+'='+p);"
"}"
#endif // USE_JAVASCRIPT_ES6
"function ld(v,p){"
"eb('s').style.backgroundImage='linear-gradient(to right,grey,hsl('+p+',100%%,50%%))';"
"la('&'+v+'='+p);"
"}"
#endif // USE_JAVASCRIPT_ES6
"wl(la);";
@ -378,14 +378,20 @@ const char HTTP_HEAD_STYLE3[] PROGMEM =
const char HTTP_MSG_SLIDER1[] PROGMEM =
"<div><span class='p'>%s</span><span class='q'>%s</span></div>"
"<div><input type='range' min='%d' max='%d' value='%d' onchange='lb(\"%c\", value)'></div>";
"<div><input type='range' min='%d' max='%d' value='%d' onchange='lb(\"%c\",value)'></div>"
"<div></div>";
const char HTTP_MSG_SLIDER2[] PROGMEM =
"<div><span class='p'>%s</span><span class='q'>%s</span></div>"
"<div><input type='range' min='%d' max='%d' value='%d' onchange='lc(\"%c\", %d, value)'></div>";
"<div><input type='range' min='%d' max='%d' value='%d' onchange='lc(\"%c\",%d,value)'></div>"
"<div></div>";
const char HTTP_MSG_SLIDER3[] PROGMEM = // HUE
"<br><div style='background-image:linear-gradient(to right, %s'><input type='range' min='%d' max='%d' value='%d' onchange='ld(\"%c\", value)'></div><br>";
// "<br><div style='background-image:linear-gradient(to right, %s'><input type='range' min='%d' max='%d' value='%d' onchange='ld(\"%c\", value)'></div><br>";
"<div style='background-image:linear-gradient(to right,%s'><input type='range' min='%d' max='%d' value='%d' onchange='ld(\"%c\",value)'></div>"
"<div></div>";
const char HTTP_MSG_SLIDER4[] PROGMEM = // SATURATION
"<br><div id='s' style='background-image:linear-gradient(to right, %s'><input type='range' min='%d' max='%d' value='%d' onchange='lb(\"%c\", value)'></div><br>";
// "<br><div id='s' style='background-image:linear-gradient(to right, %s'><input type='range' min='%d' max='%d' value='%d' onchange='lb(\"%c\", value)'></div><br>";
"<div id='s' style='background-image:linear-gradient(to right,%s'><input type='range' min='%d' max='%d' value='%d' onchange='lb(\"%c\",value)'></div>"
"<div></div>";
const char HTTP_MSG_RSTRT[] PROGMEM =
"<br><div style='text-align:center;'>" D_DEVICE_WILL_RESTART "</div><br>";
@ -1016,7 +1022,7 @@ void HandleRoot(void)
} else { // Settings.flag3.pwm_multi_channels - SetOption68 1 - Enable multi-channels PWM instead of Color PWM
uint32_t pwm_channels = (light_type & 7) > LST_MAX ? LST_MAX : (light_type & 7);
for (uint32_t i = 0; i < pwm_channels; i++) {
snprintf_P(stemp, sizeof(stemp), PSTR("c%d"), i);
snprintf_P(stemp, sizeof(stemp), PSTR("C%d"), i);
WSContentSend_P(HTTP_MSG_SLIDER2, stemp, FPSTR("100%"),
1, 100,
changeUIntScale(Settings.light_color[i], 0, 255, 0, 100), 'd', i+1);