From 9b6e5bd1222c7fa3a807466caf2b27d48cb806ba Mon Sep 17 00:00:00 2001
From: Theo Arends <11044339+arendst@users.noreply.github.com>
Date: Sun, 24 Feb 2019 15:05:18 +0100
Subject: [PATCH] Webserver Ajax optimizations
Webserver Ajax optimizations
---
sonoff/xdrv_01_webserver.ino | 51 ++++++++++++++++++++----------------
1 file changed, 28 insertions(+), 23 deletions(-)
diff --git a/sonoff/xdrv_01_webserver.ino b/sonoff/xdrv_01_webserver.ino
index ef6083d2b..f954fae40 100644
--- a/sonoff/xdrv_01_webserver.ino
+++ b/sonoff/xdrv_01_webserver.ino
@@ -131,7 +131,7 @@ const char HTTP_SCRIPT_CONSOL[] PROGMEM =
"x.onreadystatechange=function(){"
"if(x.readyState==4&&x.status==200){"
"var z,d;"
- "d=x.responseText.split(/\1/);"
+ "d=x.responseText.split(/\1/);" // Field separator
"id=d.shift();"
"if(d.shift()==0){t.value='';}"
"z=d.shift();"
@@ -149,10 +149,13 @@ const char HTTP_SCRIPT_CONSOL[] PROGMEM =
"window.onload=l;"
"";
+const char HTTP_MODULE_TEMPLATE_REPLACE[] PROGMEM =
+ "\2%d'>%s (%d\3"; // \2 and \3 are used in below os.replace
+
const char HTTP_SCRIPT_MODULE_TEMPLATE[] PROGMEM =
"var os;"
"function sk(s,g){" // s = value, g = id and name
- "var o=os.replace(/}1/g,\"