mirror of https://github.com/arendst/Tasmota.git
parent
1effa25402
commit
48b96528fc
|
@ -61,6 +61,8 @@ const char HTTP_HEAD[] PROGMEM =
|
|||
"eb=s=>document.getElementById(s);" // Alias to save code space
|
||||
"qs=s=>document.querySelector(s);" // Alias to save code space
|
||||
"sp=i=>eb(i).type=(eb(i).type==='text'?'password':'text');" // Toggle password visibility
|
||||
"wl=f=>window.addEventListener('load',f);" // Execute multiple window.onload
|
||||
;
|
||||
#else
|
||||
"function eb(s){"
|
||||
"return document.getElementById(s);" // Alias to save code space
|
||||
|
@ -71,22 +73,10 @@ const char HTTP_HEAD[] PROGMEM =
|
|||
"function sp(i){" // Toggle password visibility
|
||||
"eb(i).type=(eb(i).type==='text'?'password':'text');"
|
||||
"}"
|
||||
#endif
|
||||
|
||||
// https://www.htmlgoodies.com/beyond/javascript/article.php/3724571/Using-Multiple-JavaScript-Onload-Functions.htm
|
||||
"function wl(f){" // Execute multiple window.onload
|
||||
"var o=window.onload;"
|
||||
"if(typeof window.onload!='function'){"
|
||||
"window.onload=f;"
|
||||
"}else{"
|
||||
"window.onload=function(){"
|
||||
"if(o){"
|
||||
"o();"
|
||||
"}"
|
||||
"f();"
|
||||
"}"
|
||||
"}"
|
||||
"window.addEventListener('load',f);"
|
||||
"}";
|
||||
#endif
|
||||
|
||||
const char HTTP_SCRIPT_COUNTER[] PROGMEM =
|
||||
"var cn=180;" // seconds
|
||||
|
@ -118,12 +108,19 @@ const char HTTP_SCRIPT_ROOT[] PROGMEM =
|
|||
"x.send();"
|
||||
"lt=setTimeout(la,%d);" // Settings.web_refresh
|
||||
"}"
|
||||
|
||||
#ifdef USE_JAVASCRIPT_ES6
|
||||
"lb=p=>la('&d='+p);" // Dark - Bright &d related to lb(value) and WebGetArg("d", tmp, sizeof(tmp));
|
||||
"lc=p=>la('&t='+p);" // Cold - Warm &t related to lc(value) and WebGetArg("t", tmp, sizeof(tmp));
|
||||
#else
|
||||
"function lb(p){"
|
||||
"la('&d='+p);" // &d related to WebGetArg("d", tmp, sizeof(tmp));
|
||||
"}"
|
||||
"function lc(p){"
|
||||
"la('&t='+p);" // &t related to WebGetArg("t", tmp, sizeof(tmp));
|
||||
"}"
|
||||
#endif
|
||||
|
||||
"wl(la);";
|
||||
|
||||
const char HTTP_SCRIPT_WIFI[] PROGMEM =
|
||||
|
@ -238,9 +235,15 @@ const char HTTP_SCRIPT_TEMPLATE[] PROGMEM =
|
|||
"sk(17,99);" // 17 = WEMOS
|
||||
"st(" STR(USER_MODULE) ");"
|
||||
"}"
|
||||
|
||||
#ifdef USE_JAVASCRIPT_ES6
|
||||
"sl=()=>ld('tp?m=1',x2);" // ?m related to WebServer->hasArg("m")
|
||||
#else
|
||||
"function sl(){"
|
||||
"ld('tp?m=1',x2);" // ?m related to WebServer->hasArg("m")
|
||||
"}"
|
||||
#endif
|
||||
|
||||
"wl(sl);";
|
||||
|
||||
const char HTTP_SCRIPT_MODULE1[] PROGMEM =
|
||||
|
|
Loading…
Reference in New Issue