2020-12-29 09:53:15 +00:00
|
|
|
const char HTTP_SCRIPT_ROOT[] PROGMEM =
|
2020-12-31 12:31:22 +00:00
|
|
|
"var rfsh=1,ft;"
|
2020-12-29 09:53:15 +00:00
|
|
|
"function la(p){"
|
2020-12-31 12:31:22 +00:00
|
|
|
"a=p||'';"
|
|
|
|
"clearTimeout(ft);clearTimeout(lt);"
|
2020-12-29 09:53:15 +00:00
|
|
|
"if(x!=null){x.abort();}" // Abort if no response within 2 seconds (happens on restart 1)
|
|
|
|
"x=new XMLHttpRequest();"
|
2022-04-03 11:30:07 +01:00
|
|
|
"x.onreadystatechange=()=>{"
|
2020-12-29 09:53:15 +00:00
|
|
|
"if(x.readyState==4&&x.status==200){"
|
|
|
|
"var s=x.responseText.replace(/{t}/g,\"<table style='width:100%%'>\")"
|
|
|
|
".replace(/{s}/g,\"<tr><th>\")"
|
|
|
|
// ".replace(/{m}/g,\"</th><td>\")"
|
|
|
|
".replace(/{m}/g,\"</th><td style='width:20px;white-space:nowrap'>\")" // I want a right justified column with left justified text
|
2021-04-03 15:17:48 +01:00
|
|
|
".replace(/{e}/g,\"</td></tr>\");"
|
2020-12-29 09:53:15 +00:00
|
|
|
"eb('l1').innerHTML=s;"
|
2020-12-31 12:31:22 +00:00
|
|
|
"clearTimeout(ft);clearTimeout(lt);"
|
|
|
|
"if(rfsh){"
|
|
|
|
"lt=setTimeout(la,%d);" // Settings.web_refresh
|
|
|
|
"}"
|
2020-12-29 09:53:15 +00:00
|
|
|
"}"
|
|
|
|
"};"
|
2020-12-31 12:31:22 +00:00
|
|
|
"if(rfsh){"
|
2020-12-29 09:53:15 +00:00
|
|
|
"x.open('GET','.?m=1'+a,true);" // ?m related to Webserver->hasArg("m")
|
|
|
|
"x.send();"
|
2022-04-03 11:34:43 +01:00
|
|
|
"ft=setTimeout(la,2e4);" // 20s failure timeout
|
2020-12-29 09:53:15 +00:00
|
|
|
"}"
|
|
|
|
"}"
|
|
|
|
"function seva(par,ivar){"
|
|
|
|
"la('&sv='+ivar+'_'+par);"
|
|
|
|
"}"
|
|
|
|
"function siva(par,ivar){"
|
|
|
|
"rfsh=1;"
|
|
|
|
"la('&sv='+ivar+'_'+par);"
|
|
|
|
"rfsh=0;"
|
|
|
|
"}"
|
2022-01-25 09:58:22 +00:00
|
|
|
"function sivat(par,ivar){"
|
|
|
|
"rfsh=1;"
|
|
|
|
"par = par.slice(0, 2) + par.slice(3);"
|
|
|
|
"la('&sv='+ivar+'_'+par);"
|
|
|
|
"rfsh=0;"
|
|
|
|
"}"
|
2020-12-29 09:53:15 +00:00
|
|
|
"function pr(f){"
|
2020-12-31 12:31:22 +00:00
|
|
|
"if(f){"
|
|
|
|
"clearTimeout(lt);clearTimeout(ft);"
|
2020-12-29 09:53:15 +00:00
|
|
|
"lt=setTimeout(la,%d);"
|
|
|
|
"rfsh=1;"
|
2020-12-31 12:31:22 +00:00
|
|
|
"}else{"
|
|
|
|
"clearTimeout(lt);clearTimeout(ft);"
|
2020-12-29 09:53:15 +00:00
|
|
|
"rfsh=0;"
|
|
|
|
"}"
|
2020-12-31 12:31:22 +00:00
|
|
|
"}"
|
|
|
|
;
|