diff --git a/data/edit.htm b/data/edit.htm
index 71a6f701..27cac438 100644
--- a/data/edit.htm
+++ b/data/edit.htm
@@ -1 +1 @@
-
File Editor
\ No newline at end of file
+File Editor
\ No newline at end of file
diff --git a/data/edit.htm.gz b/data/edit.htm.gz
index 095e2d43..a5fd1979 100644
Binary files a/data/edit.htm.gz and b/data/edit.htm.gz differ
diff --git a/data/script.js b/data/script.js
index 57bf1e09..d54c4de6 100644
--- a/data/script.js
+++ b/data/script.js
@@ -1,150 +1,126 @@
-function aref(e) { setTimeout(function() { ref("") }, 1e3 * e) }
-
-function upd(e) {var o = (new Date).getTime(); return document.getElementById("bmp").src = "?a=" + e + "&q=" + o, !1 }
-
-async function ref(e) {var o = (new Date).getTime(); const response = await fetch("/screenshot?d="+ o + "&a=" + e); if (response.ok) {upd(e)} else {aref(2)} }
-
-function license(tft) {
- var lic = 'openHASP
Copyright© 2019-2022 Francis Van RoieMIT LicensePermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
';
- document.getElementById("lic").innerHTML = lic ;
-
- var libs = '
Based on the previous work of the following open source developers:
';
- libs += 'HASwitchPlate
Copyright© 2019 Allen Derusha allen @derusha.orgMIT License
LVGL
Copyright© 2021 LVGL KftMIT License
';
- if (tft == 1) libs += 'LovyanGFX
Copyright© 2020 lovyan03 (https://github.com/lovyan03) All rights reserved.FreeBSD License
';
- libs += 'TFT_eSPI
Copyright© 2020 Bodmer (https://github.com/Bodmer) All rights reserved.FreeBSD License
';
- libs += 'Adafruit_GFX
Copyright© 2012 Adafruit Industries. All rights reservedBSD License
';
- libs += 'ArduinoJson
Copyright© 2014-2021 Benoit BLANCHONMIT License
';
- libs += 'PubSubClient
Copyright© 2008-2015 Nicholas O'LearyMIT License
';
- libs += 'ArduinoLog
Copyright© 2017,2018 Thijs Elenbaas, MrRobot62, rahuldeo2047, NOX73, dhylands, Josha blemasle, mfalkviddMIT License
';
- libs += 'QR Code generator
Copyright© Project NayukiMIT License
';
- libs += 'SimpleFTPServer
Copyright© 2017 Renzo Mischianti www.mischianti.org All right reserved.MIT License
';
- libs += 'AceButton
Copyright© 2018 Brian T. ParkMIT License
';
- document.getElementById("pkg").innerHTML = libs;
+function aref(e) {
+ setTimeout(function () {
+ ref("");
+ }, 1e3 * e);
}
-function about() {license(1);}
-
-function handleSubmit(event) {
- event.preventDefault();
- const data = new FormData(event.target);
- const value = Object.fromEntries(data.entries());
- console.log({ value });
+function upd(e) {
+ var t = new Date().getTime();
+ return (document.getElementById("bmp").src = "?a=" + e + "&q=" + t), !1;
+}
+async function ref(e) {
+ var t = new Date().getTime();
+ (await fetch("/screenshot?d=" + t + "&a=" + e)).ok ? upd(e) : aref(2);
+}
+function about() {
+ document.getElementById("lic").innerHTML =
+ 'openHASP
Copyright© 2019-2022 Francis Van RoieMIT LicensePermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
';
+ var e =
+ "
Based on the previous work of the following open source developers:
";
+ (e +=
+ "HASwitchPlate
Copyright© 2019 Allen Derusha allen @derusha.orgMIT License
LVGL
Copyright© 2021 LVGL KftMIT License
"),
+ 1 == tft &&
+ (e +=
+ "LovyanGFX
Copyright© 2020 lovyan03 (https://github.com/lovyan03) All rights reserved.FreeBSD License
"),
+ (e +=
+ "TFT_eSPI
Copyright© 2020 Bodmer (https://github.com/Bodmer) All rights reserved.FreeBSD License
"),
+ (e +=
+ "Adafruit_GFX
Copyright© 2012 Adafruit Industries. All rights reservedBSD License
"),
+ (e +=
+ "ArduinoJson
Copyright© 2014-2021 Benoit BLANCHONMIT License
"),
+ (e +=
+ "PubSubClient
Copyright© 2008-2015 Nicholas O'LearyMIT License
"),
+ (e +=
+ "ArduinoLog
Copyright© 2017,2018 Thijs Elenbaas, MrRobot62, rahuldeo2047, NOX73, dhylands, Josha blemasle, mfalkviddMIT License
"),
+ (e +=
+ "QR Code generator
Copyright© Project NayukiMIT License
"),
+ (e +=
+ "SimpleFTPServer
Copyright© 2017 Renzo Mischianti www.mischianti.org All right reserved.MIT License
"),
+ (e +=
+ "AceButton
Copyright© 2018 Brian T. ParkMIT License
"),
+ (document.getElementById("pkg").innerHTML = e);
+}
+function handleSubmit(e) {
+ e.preventDefault();
+ const t = new FormData(e.target),
+ o = Object.fromEntries(t.entries());
+ console.log({ value: o });
}
-
function info() {
data = JSON.parse(this.response);
- var table = "";
- for (let header in data) { table += ` |
${header} |
`; for (let key in data[header]) { table += `${key}: | ${data[header][key]} |
`; } }
- table += "
";
- document.getElementById("info").innerHTML = table;
-}
-
-function loader(method, uri, func) {
- window.addEventListener("load", function() {
- var rq = new XMLHttpRequest();
- rq.addEventListener("load", func);
- rq.open(method, uri);
- rq.send();
- })
-}
-
-function fill() {
- data = JSON.parse(this.response);
- form = document.forms.item(0);
- populate(form, data);
-}
-
-function filler(method, uri) {
- window.addEventListener("load", function() {
- var rq = new XMLHttpRequest();
- rq.addEventListener("load", fill);
- rq.open(method, uri);
- rq.send();
- })
-}
-
-function filler2(method, uri) {
- var rq = new XMLHttpRequest();
- rq.addEventListener("load", fill);
- rq.open(method, uri);
- rq.send();
-}
-
-/** https://github.com/dannyvankooten/populate.js
- * Populate form fields from a JSON object.
- *
- * @param form object The form element containing your input fields.
- * @param data array JSON data to populate the fields with.
- * @param basename string Optional basename which is added to `name` attributes
- */
-function populate(form, data, basename) {
- for (var key in data) {
- if (!data.hasOwnProperty(key)) {
- continue;
- }
-
- var name = key;
- var value = data[key];
-
- if ('undefined' === typeof value) {
- value = '';
- }
-
- if (null === value) {
- value = '';
- }
-
- // handle array name attributes
- if (typeof(basename) !== "undefined") {
- name = basename + "[" + key + "]";
- }
-
- if (value.constructor === Array) {
- name += '[]';
- } else if (typeof value == "object") {
- populate(form, value, name);
- continue;
- }
-
- // only proceed if element is set
- var element = form.elements.namedItem(name);
- if (!element) {
- continue;
- }
-
- var type = element.type || element[0].type;
-
- switch (type) {
- default: element.value = value;
- break;
-
- case 'radio':
- var values = value.constructor === Array ? value : [value];
- for (var j = 0; j < element.length; j++) {
- element[j].checked = values.indexOf(Number(element[j].value)) > -1;
- }
- break;
-
- case 'checkbox':
- var values = value.constructor === Array ? value : [value];
- element.checked = values.indexOf(Number(element.value)) > -1;
- break;
-
- case 'select-multiple':
- var values = value.constructor === Array ? value : [value];
- for (var k = 0; k < element.options.length; k++) {
- element.options[k].selected = (values.indexOf(element.options[k].value) > -1);
- }
- break;
-
- case 'select':
- case 'select-one':
- element.value = value.toString() || value;
- break;
-
- case 'date':
- element.value = new Date(value).toISOString().split('T')[0];
- break;
- }
-
+ var e = "";
+ for (let t in data) {
+ e += ` |
${t} |
`;
+ for (let o in data[t])
+ e += `${o}: | ${data[t][o]} |
`;
}
-};
\ No newline at end of file
+ (e += "
"), (document.getElementById("info").innerHTML = e);
+}
+function loader(e, t, o) {
+ window.addEventListener("load", function () {
+ var n = new XMLHttpRequest();
+ n.addEventListener("load", o), n.open(e, t), n.send();
+ });
+}
+function fill() {
+ (data = JSON.parse(this.response)),
+ (form = document.forms.item(0)),
+ populate(form, data);
+}
+function filler(e, t) {
+ window.addEventListener("load", function () {
+ var o = new XMLHttpRequest();
+ o.addEventListener("load", fill), o.open(e, t), o.send();
+ });
+}
+function filler2(e, t) {
+ var o = new XMLHttpRequest();
+ o.addEventListener("load", fill), o.open(e, t), o.send();
+}
+function populate(e, t, o) {
+ for (var n in t)
+ if (t.hasOwnProperty(n)) {
+ var r = n,
+ i = t[n];
+ if (
+ (void 0 === i && (i = ""),
+ null === i && (i = ""),
+ void 0 !== o && (r = o + "[" + n + "]"),
+ i.constructor === Array)
+ )
+ r += "[]";
+ else if ("object" == typeof i) {
+ populate(e, i, r);
+ continue;
+ }
+ var a = e.elements.namedItem(r);
+ if (a)
+ switch (a.type || a[0].type) {
+ default:
+ a.value = i;
+ break;
+ case "radio":
+ for (
+ var s = i.constructor === Array ? i : [i], c = 0;
+ c < a.length;
+ c++
+ )
+ a[c].checked = s.indexOf(Number(a[c].value)) > -1;
+ break;
+ case "checkbox":
+ s = i.constructor === Array ? i : [i];
+ a.checked = s.indexOf(Number(a.value)) > -1;
+ break;
+ case "select-multiple":
+ s = i.constructor === Array ? i : [i];
+ for (var p = 0; p < a.options.length; p++)
+ a.options[p].selected = s.indexOf(a.options[p].value) > -1;
+ break;
+ case "select":
+ case "select-one":
+ a.value = i.toString() || i;
+ break;
+ case "date":
+ a.value = new Date(i).toISOString().split("T")[0];
+ }
+ }
+}
diff --git a/data/script.js.gz b/data/script.js.gz
index 9ca8f554..5a9e415b 100644
Binary files a/data/script.js.gz and b/data/script.js.gz differ
diff --git a/data/style.css b/data/style.css
index 68f4b5d2..75251adb 100644
--- a/data/style.css
+++ b/data/style.css
@@ -18,6 +18,11 @@ input[type=radio] {
width: 1em
}
+input[type=color] {
+ width: 30%;
+ padding: 5px
+}
+
select {
background-color: var(--fldbg);
color: var(--fldfg)
diff --git a/data/style.css.gz b/data/style.css.gz
index de937799..185a8989 100644
Binary files a/data/style.css.gz and b/data/style.css.gz differ