mirror of https://github.com/arendst/Tasmota.git
Start using optional ES6 saving code space
Start using optional ES6 saving code space
This commit is contained in:
parent
2e7c72724d
commit
9d706c9864
|
@ -278,6 +278,7 @@
|
||||||
#define USE_WEBSERVER // Enable web server and Wifi Manager (+66k code, +8k mem)
|
#define USE_WEBSERVER // Enable web server and Wifi Manager (+66k code, +8k mem)
|
||||||
#define WEB_PORT 80 // Web server Port for User and Admin mode
|
#define WEB_PORT 80 // Web server Port for User and Admin mode
|
||||||
#define WEB_USERNAME "admin" // Web server Admin mode user name
|
#define WEB_USERNAME "admin" // Web server Admin mode user name
|
||||||
|
// #define USE_JAVASCRIPT_ES6 // Enable ECMAScript6 syntax using less JavaScript code bytes (fails on IE11)
|
||||||
#define USE_EMULATION_HUE // Enable Hue Bridge emulation for Alexa (+14k code, +2k mem common)
|
#define USE_EMULATION_HUE // Enable Hue Bridge emulation for Alexa (+14k code, +2k mem common)
|
||||||
#define USE_EMULATION_WEMO // Enable Belkin WeMo emulation for Alexa (+6k code, +2k mem common)
|
#define USE_EMULATION_WEMO // Enable Belkin WeMo emulation for Alexa (+6k code, +2k mem common)
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,12 @@ const char HTTP_HEAD[] PROGMEM =
|
||||||
"<script>"
|
"<script>"
|
||||||
"var x=null,lt,to,tp,pc='';" // x=null allow for abortion
|
"var x=null,lt,to,tp,pc='';" // x=null allow for abortion
|
||||||
|
|
||||||
|
#ifdef USE_JAVASCRIPT_ES6
|
||||||
|
// Following bytes saving ES6 syntax fails on old browsers like IE 11 - https://kangax.github.io/compat-table/es6/
|
||||||
|
"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
|
||||||
|
#else
|
||||||
"function eb(s){"
|
"function eb(s){"
|
||||||
"return document.getElementById(s);" // Alias to save code space
|
"return document.getElementById(s);" // Alias to save code space
|
||||||
"}"
|
"}"
|
||||||
|
@ -65,10 +71,7 @@ const char HTTP_HEAD[] PROGMEM =
|
||||||
"function sp(i){" // Toggle password visibility
|
"function sp(i){" // Toggle password visibility
|
||||||
"eb(i).type=(eb(i).type==='text'?'password':'text');"
|
"eb(i).type=(eb(i).type==='text'?'password':'text');"
|
||||||
"}"
|
"}"
|
||||||
// Following bytes saving ES6 syntax fails on old browsers like IE 11 - https://kangax.github.io/compat-table/es6/
|
#endif
|
||||||
// "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
|
|
||||||
|
|
||||||
// https://www.htmlgoodies.com/beyond/javascript/article.php/3724571/Using-Multiple-JavaScript-Onload-Functions.htm
|
// https://www.htmlgoodies.com/beyond/javascript/article.php/3724571/Using-Multiple-JavaScript-Onload-Functions.htm
|
||||||
"function wl(f){" // Execute multiple window.onload
|
"function wl(f){" // Execute multiple window.onload
|
||||||
|
|
Loading…
Reference in New Issue