From 671231053afeb20a9fd9a5286b14b217816a8283 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 10 Nov 2018 17:30:23 +0100 Subject: [PATCH] More webserver GUI tuning More webserver GUI tuning --- sonoff/xdrv_01_webserver.ino | 113 ++++++++++++++++++++--------------- 1 file changed, 64 insertions(+), 49 deletions(-) diff --git a/sonoff/xdrv_01_webserver.ino b/sonoff/xdrv_01_webserver.ino index 2d116f73c..74e6d32f6 100644 --- a/sonoff/xdrv_01_webserver.ino +++ b/sonoff/xdrv_01_webserver.ino @@ -43,12 +43,13 @@ const char HTTP_HEAD[] PROGMEM = "{h} - {v}" ""; + +const char HTTP_SCRIPT_ROOT[] PROGMEM = "function la(p){" "var a='';" "if(la.arguments.length==1){" @@ -85,43 +85,16 @@ const char HTTP_HEAD[] PROGMEM = "la('?t='+p);" // ?t related to WebGetArg("t", tmp, sizeof(tmp)); "}"; -const char HTTP_HEAD_RELOAD[] PROGMEM = - "setTimeout(function(){location.href='.';},4000);"; +const char HTTP_SCRIPT_WIFI[] PROGMEM = + "function c(l){" + "eb('s1').value=l.innerText||l.textContent;" + "eb('p1').focus();" + "}"; -const char HTTP_HEAD_STYLE[] PROGMEM = - "" +const char HTTP_SCRIPT_RELOAD[] PROGMEM = + "setTimeout(function(){location.href='.';},5000);" + ""; - "" - - "" - "" - "
" -#ifdef BE_MINIMAL - "

" D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "

" -#endif - "
" -#ifdef LANGUAGE_MODULE_NAME - "

" D_MODULE " {ha

" -#else - "

{ha " D_MODULE "

" -#endif - "

{h}

{j}
"; const char HTTP_SCRIPT_CONSOL[] PROGMEM = "var sn=0;" // Scroll position "var id=0;" // Get most of weblog initially @@ -158,19 +131,20 @@ const char HTTP_SCRIPT_CONSOL[] PROGMEM = "return false;" "}" ""; + const char HTTP_SCRIPT_MODULE1[] PROGMEM = "var os;" - "function sk(s,g){" // s = value, g = id and name + "function sk(s,g){" // s = value, g = id and name "var o=os.replace(\"value='\"+s+\"'\",\"selected value='\"+s+\"'\");" "eb('g'+g).innerHTML=o;" "}" "function sl(){" - "if(x!=null){x.abort();}" // Abort any request pending + "if(x!=null){x.abort();}" // Abort any request pending "x=new XMLHttpRequest();" "x.onreadystatechange=function(){" "if(x.readyState==4&&x.status==200){" "var i,o=x.responseText.replace(/}1/g,\"