diff --git a/.DS_Store b/.DS_Store index 73d60e860dbe..60d3b1e94e3c 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/tasmota/html_uncompressed/HTTP_SCRIPT_ROOT_WEB_DISPLAY.h b/tasmota/html_uncompressed/HTTP_SCRIPT_ROOT_WEB_DISPLAY.h index a3afc2a97b7c..41f9d2f57c1d 100644 --- a/tasmota/html_uncompressed/HTTP_SCRIPT_ROOT_WEB_DISPLAY.h +++ b/tasmota/html_uncompressed/HTTP_SCRIPT_ROOT_WEB_DISPLAY.h @@ -13,6 +13,9 @@ const char HTTP_SCRIPT_ROOT[] PROGMEM = ".replace(/{m}/g,\"\")" // I want a right justified column with left justified text ".replace(/{e}/g,\"\");" "eb('l1').innerHTML=s;" + "if(s.indexOf(\"{loader}\") != -1){" + "eb('loader').style.display=\"\";" + "} else {eb('loader').style.display=\"none\";}" "clearTimeout(ft);clearTimeout(lt);" "if(rfsh){" "lt=setTimeout(la,%d);" // Settings.web_refresh diff --git a/tasmota/xdrv_01_webserver.ino b/tasmota/xdrv_01_webserver.ino index 0244c3e69350..0cdd1e1a2057 100644 --- a/tasmota/xdrv_01_webserver.ino +++ b/tasmota/xdrv_01_webserver.ino @@ -61,6 +61,57 @@ const uint16_t HTTP_OTA_RESTART_RECONNECT_TIME = 10000; // milliseconds - Allow #include #include +const char HTTP_SCRIPT_ROOT2[] PROGMEM = + "var rfsh=1,ft;" + "function la(p){" + "a=p||'';" + "clearTimeout(ft);clearTimeout(lt);" + "if(x!=null){x.abort();}" // Abort if no response within 2 seconds (happens on restart 1) + "x=new XMLHttpRequest();" + "x.onreadystatechange=function(){" + "if(x.readyState==4&&x.status==200){" + "var s=x.responseText.replace(/{t}/g,\"\")" + ".replace(/{s}/g,\"\");" + "eb('l1').innerHTML=s;" + "if(s.indexOf(\"{loader}\") != -1){" + "eb('loader').style.display=\"\";" + "} else {eb('loader').style.display=\"none\";}" + "clearTimeout(ft);clearTimeout(lt);" + "if(rfsh){" + "lt=setTimeout(la,%d);" // Settings.web_refresh + "}" + "}" + "};" + "if(rfsh){" + "x.open('GET','.?m=1'+a,true);" // ?m related to Webserver->hasArg("m") + "x.send();" + "ft=setTimeout(la,20000);" // 20s failure timeout + "}" + "}" + "function seva(par,ivar){" + "la('&sv='+ivar+'_'+par);" + "}" + "function siva(par,ivar){" + "rfsh=1;" + "la('&sv='+ivar+'_'+par);" + "rfsh=0;" + "}" + "function pr(f){" + "if(f){" + "clearTimeout(lt);clearTimeout(ft);" + "lt=setTimeout(la,%d);" + "rfsh=1;" + "}else{" + "clearTimeout(lt);clearTimeout(ft);" + "rfsh=0;" + "}" + "}" + ; + + #ifdef USE_UNISHOX_COMPRESSION #ifdef USE_JAVASCRIPT_ES6 #include "./html_compressed/HTTP_HEADER1_ES6.h" @@ -199,15 +250,6 @@ const char HTTP_SCRIPT_INFO_END[] PROGMEM = "}" "wl(i);"; -const char HTTP_SCRIPT_LOADER[] PROGMEM = - ""; - #ifdef USE_UNISHOX_COMPRESSION #include "./html_compressed/HTTP_HEAD_LAST_SCRIPT.h" #include "./html_compressed/HTTP_HEAD_STYLE1.h" @@ -236,16 +278,15 @@ const char HTTP_HEAD_STYLE_SSI[] PROGMEM = ".si .b0{height:25%%}.si .b1{height:50%%}.si .b2{height:75%%}.si .b3{height:100%%}.o30{opacity:.3}"; const char HTTP_HEAD_STYLE_LOADER[] PROGMEM = - ".loader{margin:auto;" - "border: 5px solid #31353c; border-radius:50%%; border-top:5px solid #ffa400; width:40px; height:40px;" - "-webkit-animation: spin 1.4s linear infinite;" - "animation: spin 1.4s linear infinite;}" - "@-webkit-keyframes spin{" - "0%% {-webkit-transform: rotate(0deg);}" - "100%% {-webkit-transform: rotate(360deg);}}" - "@keyframes spin{" - "0%% {transform:rotate(0deg);}" - "100%% {transform:rotate(360deg);}}"; +"#loader, #loader:before, #loader:after {border-radius: 50%%;width: 1.5em;height: 1.5em;-webkit-animation-fill-mode: both;" + "animation-fill-mode: both;-webkit-animation: load7 1.8s infinite ease-in-out;animation: load7 1.5s infinite ease-in-out;}" +"#loader {color: #ffa400;font-size: 10px;margin: auto;margin-bottom:2rem;position: relative;text-indent: -9999em;" +"-webkit-transform: translateZ(0);-ms-transform: translateZ(0);transform: translateZ(0);-webkit-animation-delay: -0.16s;animation-delay: -0.16s;}" +"#loader:before,#loader:after {content: '';position: absolute;top: 0;}" +"#loader:before {left: -3.5em;-webkit-animation-delay: -0.32s;animation-delay: -0.32s;}" +"#loader:after {left: 3.5em;}" +"@-webkit-keyframes load7 {0%%,80%%,100%% {box-shadow: 0 2.5em 0 -1.3em;}40%% {box-shadow: 0 2.5em 0 0;}}" +"@keyframes load7 {0%%,80%%,100%% {box-shadow: 0 2.5em 0 -1.3em;}40%% {box-shadow: 0 2.5em 0 0;}}"; const char HTTP_HEAD_STYLE3[] PROGMEM = "" @@ -1067,16 +1108,15 @@ void HandleRoot(void) WSContentStart_P(PSTR(D_MAIN_MENU)); #ifdef USE_SCRIPT_WEB_DISPLAY - WSContentSend_P(HTTP_SCRIPT_ROOT, Settings->web_refresh, Settings->web_refresh); + WSContentSend_P(HTTP_SCRIPT_ROOT2, Settings->web_refresh, Settings->web_refresh); #else - WSContentSend_P(HTTP_SCRIPT_ROOT, Settings->web_refresh); + WSContentSend_P(HTTP_SCRIPT_ROOT2, Settings->web_refresh); #endif WSContentSend_P(HTTP_SCRIPT_ROOT_PART2); WSContentSendStyle(); - WSContentSend_P(HTTP_SCRIPT_LOADER); - WSContentSend_P("
"); - WSContentSend_P("
"); + WSContentSend_P("
"); + WSContentSend_P("
"); WSContentSend_P(PSTR("
")); @@ -1109,10 +1149,12 @@ bool HandleRootStatusRefresh(void) #endif WSContentSend_P(PSTR("{t}")); - WSContentSend_P(HTTP_DEVICE_STATE, 40, PSTR("normal"), 17, TasmotaGlobal.mqtt_connected ? "홈 IoT 서비스가 동작 중입니다.":"홈 IoT 서비스에 연결 중입니다..."); - WSContentSend_P(PSTR("
\")" +// ".replace(/{m}/g,\"\")" + ".replace(/{m}/g,\"\")" // I want a right justified column with left justified text + ".replace(/{e}/g,\"
")); + WSContentSend_P(HTTP_DEVICE_STATE, 40, PSTR("normal"), 17, TasmotaGlobal.mqtt_connected ? "홈 IoT 서비스가 동작 중입니다.":"홈 IoT 서비스에 연결중입니다.."); + WSContentSend_P(PSTR("
")); WSContentSend_P(PSTR("\n\n")); // Prep for SSE - WSContentSend_P(PSTR(""), TasmotaGlobal.mqtt_connected); + if (!TasmotaGlobal.mqtt_connected) { + WSContentSend_P("
{loader}
"); + } WSContentEnd(); return true;