diff --git a/CLAUDE.md b/CLAUDE.md index ed2e81f..32e5dd9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -105,6 +105,13 @@ GPIO0 to GND, tap RST to GND, then release GPIO0. SignalRGB LED 0 = left tube, `tubePixels` {0,1,2,3} is right. Settings `wledEnable` / `wledDarkWithTubes` / `wledUseBrightness` live in `prmExt`, stored in EEPROM after `prm` with their own magic value: never add fields to `prm` (a `MAGIC_VALUE` bump factory-resets the - clock, WiFi included). HA switch "SignalRGB". `page.js`/`site.css` were cached by browsers for a - year; now sent with `no-cache`. -7. Open: the user can create `secrets.h` (gitignored, never read it) for OTA and web passwords. + clock, WiFi included). HA switch "SignalRGB". +7. Done (2026-10-28, not yet on the clock): new web UI. Source `firmware/uniclock/web/index.html` + (one file, no jQuery, controls generated from the `PAGES` table), gzipped by `web/gzip_web.py` + to `data/index.html.gz` (12 KB, was 147 KB), served by one `serveStatic` with `no-cache`. + Opened from disk it runs on sample data; check it with headless Edge (`msedge --headless=new + --screenshot`). `/getConfiguration` no longer returns passwords (`*PswSet` flags instead); + new fields `ip`, `hasAlarm`, `hasRadar`, real `cathProtMin`; `/getCurrentInfos` has + `currentSec` and `mqtt` (0 off / 1 not connected / 2 connected). Network settings save with a + Save button and offer a restart. +8. Open: the user can create `secrets.h` (gitignored, never read it) for OTA and web passwords. diff --git a/README.md b/README.md index 3c0bbae..24ac9ba 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ Optional passwords for the web page and OTA updates go in ## SignalRGB -Turn on **SignalRGB (WLED)** on the RGB page of the web UI (or the SignalRGB switch in Home +Turn on **SignalRGB control** on the Light page of the web UI (or the SignalRGB switch in Home Assistant). The clock then answers like a WLED device with one LED per tube, LED 0 = left tube: mDNS `_wled._tcp`, `/json/info` and `/json/state` without a password, and colour frames over UDP (WLED realtime on port 21324, DDP on 4048). SignalRGB should find it by itself; if not, add it by diff --git a/firmware/uniclock/ESP32_UniClock2/ESP32_UniClock2.ino b/firmware/uniclock/ESP32_UniClock2/ESP32_UniClock2.ino index 74101d2..1c13f53 100644 --- a/firmware/uniclock/ESP32_UniClock2/ESP32_UniClock2.ino +++ b/firmware/uniclock/ESP32_UniClock2/ESP32_UniClock2.ino @@ -269,8 +269,7 @@ extern char tubeDriver[]; //human-readable driver name string, shown on the web char webName[] = WEBNAME; AsyncWebServer server(80); -#define CACHE_MAX_AGE "max-age=31536000" //maximum is: 31536000 -#define CACHE_REVALIDATE "no-cache" //page.js and site.css change with web UI updates (uploadfs): don't let browsers keep an old copy +#define CACHE_REVALIDATE "no-cache" //the web UI changes with uploadfs: don't let browsers keep an old copy #ifdef USE_WIFIMANAGER #include @@ -1140,14 +1139,13 @@ void doCathodeProtect() { cathodeProtRunning = false; } -// Sets up the ESPAsyncWebServer instance (port 80) that backs the web admin UI: static file routes -// serve the SPA's HTML/CSS/JS straight out of SPIFFS (uploaded separately via the IDE's filesystem -// uploader from the repo's data/ folder - see file header), plus a handful of action routes +// Sets up the ESPAsyncWebServer instance (port 80) that backs the web admin UI: a static route serves +// the single-file page out of SPIFFS (uploadfs from the data/ folder), plus a handful of action routes // (/reset, /factoryreset, /firmwareupdate, /cathodeProtect) and the JSON/form REST-ish API // (handleConfigChanged/handleSendConfig/handleSendCurrentInfos/handleSendClockDetails, defined below). // Optional password for the web UI (WEB_PASSWORD, and WEB_USER, default "admin", in secrets.h). // Everything except /generate_204 (captive-portal check) and /getCurrentInfos (time and sensor -// values only) needs it; /getConfiguration returns the stored WiFi and MQTT passwords. +// values only) needs it. /getConfiguration no longer sends the stored passwords (only whether one is set). #ifdef WEB_PASSWORD #ifndef WEB_USER #define WEB_USER "admin" @@ -1160,71 +1158,6 @@ void doCathodeProtect() { void startServer() { DPRINTLN("Starting Async Webserver..."); - server.on("/", HTTP_GET, [](AsyncWebServerRequest * request) { - DPRINTLN("Webserver: / -> index.html"); - if(SPIFFS.exists("/index.html")) { - AsyncWebServerResponse *response = request->beginResponse(SPIFFS, "/index.html", "text/html"); - request->send(response); - } - else { - request->send( 204, "text/html", "File Not Found" ); - DPRINTLN("/index.html not found"); - } - }) WEB_AUTH; - - server.on("/jquery_351.js", HTTP_GET, [](AsyncWebServerRequest * request) { - DPRINTLN("Webserver: /jquery_351.js"); - if (SPIFFS.exists("/jquery_351.js")) { - AsyncWebServerResponse *response = request->beginResponse(SPIFFS, "/jquery_351.js", "text/js"); - response->addHeader("Cache-Control", CACHE_MAX_AGE); - request->send(response); - } - else { - request->send( 204, "text/html", "File Not Found" ); - DPRINTLN("/jquery_351.js not found"); - } - }) WEB_AUTH; - - server.on("/jquery_360.js", HTTP_GET, [](AsyncWebServerRequest * request) { - DPRINTLN("Webserver: /jquery_360.js"); - if (SPIFFS.exists("/jquery_360.js")) { - AsyncWebServerResponse *response = request->beginResponse(SPIFFS, "/jquery_360.js", "text/js"); - response->addHeader("Cache-Control", CACHE_MAX_AGE); - request->send(response); - } - else { - request->send( 204, "text/html", "File Not Found" ); - DPRINTLN("/jquery_360.js not found"); - } - }) WEB_AUTH; - - server.on("/page.js", HTTP_GET, [](AsyncWebServerRequest * request) { - - DPRINTLN("Webserver: /page.js"); - if (SPIFFS.exists("/page.js")) { - AsyncWebServerResponse *response = request->beginResponse(SPIFFS, "/page.js", "text/js"); - response->addHeader("Cache-Control", CACHE_REVALIDATE); - request->send(response); - } - else { - request->send( 204, "text/html", "File Not Found" ); - DPRINTLN("/page.js not found"); - } - }) WEB_AUTH; - - server.on("/favicon.ico", HTTP_GET, [](AsyncWebServerRequest * request) { - DPRINTLN("Webserver: /favicon.ico"); - if (SPIFFS.exists("/favicon.ico")){ - AsyncWebServerResponse *response = request->beginResponse(SPIFFS, "/favicon.ico", "image/png"); - response->addHeader("Cache-Control", CACHE_MAX_AGE); - request->send(response); - } - else { - request->send( 204, "text/html", "File Not Found" ); - DPRINTLN("/favicon.ico not found"); - } - }) WEB_AUTH; - server.on("/generate_204", HTTP_GET, [](AsyncWebServerRequest * request) { DPRINTLN("Webserver: /generate_204"); AsyncWebServerResponse *response = request->beginResponse(302); // @@ -1243,19 +1176,6 @@ void startServer() { */ }); -//____________________________________________________________________________ - server.on("/site.css", HTTP_GET, [](AsyncWebServerRequest * request) { - DPRINTLN("Webserver: /site.css"); - if (SPIFFS.exists("/site.css")) { - AsyncWebServerResponse *response = request->beginResponse(SPIFFS, "/site.css", "text/css"); - response->addHeader("Cache-Control", CACHE_REVALIDATE); - request->send(response); - } - else { - request->send( 204, "text/html", "File Not Found" ); - DPRINTLN("/site.css not found"); - } - }) WEB_AUTH; //____________________________________________________________________________ server.on("/reset", HTTP_POST, [] (AsyncWebServerRequest *request) { DPRINTLN("/reset:"); @@ -1277,10 +1197,12 @@ void startServer() { //____________________________________________________________________________ server.on("/firmwareupdate", HTTP_POST, [](AsyncWebServerRequest * request) { makeFirmwareUpdate = true; + request->send(200, "text/plain", "OK"); //FIXED: no answer was sent, so the browser waited until it timed out }) WEB_AUTH; //____________________________________________________________________________ server.on("/cathodeProtect", HTTP_POST, [](AsyncWebServerRequest * request) { makeCathodeProtect = true; + request->send(200, "text/plain", "OK"); }) WEB_AUTH; @@ -1289,6 +1211,10 @@ void startServer() { server.on("/getCurrentInfos", HTTP_GET, handleSendCurrentInfos); server.on("/getClockDetails", HTTP_GET, handleSendClockDetails) WEB_AUTH; wledRoutes(); //WLED JSON API for SignalRGB, without password (wled.ino) + // The web UI (data/: index.html.gz, built from web/index.html, and favicon.ico). Registered last: it + // matches every GET path, and the routes above must win. A missing file falls through to handleNotFound. + // For "/" it sends index.html.gz with Content-Encoding: gzip; no-cache + ETag makes reloads a cheap 304. + server.serveStatic("/", SPIFFS, "/").setDefaultFile("index.html").setCacheControl(CACHE_REVALIDATE) WEB_AUTH; server.onNotFound(handleNotFound); server.begin(); @@ -1632,6 +1558,13 @@ void handleSendConfig(AsyncWebServerRequest *request) { doc["tubeDriver"] = tubeDriver; doc["maxDigits"] = maxDigits; //number of digits (tubes) doc["maxBrightness"] = MAXBRIGHTNESS; //Maximum tube brightness usually 10, sometimes 12 + doc["ip"] = ip.toString(); + doc["hasAlarm"] = (ALARMSPEAKER_PIN >= 0); //the web page hides the alarm and presence settings without the hardware + #if (RADAR_PIN >= 0) || defined(USE_MASTER_RADAR) + doc["hasRadar"] = true; + #else + doc["hasRadar"] = false; + #endif //Actual time and environment data sprintf(buf, "%4d.%02d.%02d", year(), month(), day()); @@ -1717,15 +1650,20 @@ if (useTemp > 1) #endif doc["wifiMode"] = prm.wifiMode; doc["wifiSsid"] = prm.wifiSsid; - doc["wifiPsw"] = prm.wifiPsw; + // Passwords are write-only: the page gets "" plus whether one is stored, and only sends a field the + // user typed in (so "" here never overwrites a stored password). + doc["wifiPsw"] = ""; + doc["wifiPswSet"] = prm.wifiPsw[0] != 0; doc["ApSsid"] = prm.ApSsid; - doc["ApPsw"] = prm.ApPsw; + doc["ApPsw"] = ""; + doc["ApPswSet"] = prm.ApPsw[0] != 0; doc["NtpServer"] = prm.NtpServer; doc["firmware"] = prm.firmwareServer; doc["mqttBrokerAddr"] = prm.mqttBrokerAddr; doc["mqttBrokerUser"] = prm.mqttBrokerUser; - doc["mqttBrokerPsw"] = prm.mqttBrokerPsw; + doc["mqttBrokerPsw"] = ""; + doc["mqttBrokerPswSet"] = prm.mqttBrokerPsw[0] != 0; doc["mqttEnable"] = prm.mqttEnable; #if defined(USE_MQTT) doc["mqttBrokerRefresh"] = prm.mqttBrokerRefresh; @@ -1756,9 +1694,10 @@ if (useTemp > 1) doc["corrT1"] = prm.corrT1; doc["corrH0"] = prm.corrH0; doc["corrH1"] = prm.corrH1; - doc["cathProtMin"] = 3; //default value for cathProtMin slider + doc["cathProtMin"] = cathProtMin; //FIXED: was always 3, whatever was set (not stored in EEPROM: 5 after a restart) String json; serializeJson(doc, json); + if (doc.overflowed()) DPRINTLN("handleSendConfig: JSON document too small, fields missing!"); request->send(200, "application/json", json); } @@ -1792,7 +1731,7 @@ void handleSendClockDetails(AsyncWebServerRequest *request) { // ("temperature1"/"humidity1") and legacy ("temperature"/"humidity") key names for backwards // compatibility with older versions of the web front-end. void handleSendCurrentInfos(AsyncWebServerRequest *request) { - StaticJsonDocument<400> doc; + StaticJsonDocument<512> doc; //400 was tight with "stalls", "mqtt" and "currentSec" //StaticJsonDocument<512> doc; char buf[20]; //conversion buffer @@ -1802,6 +1741,7 @@ void handleSendCurrentInfos(AsyncWebServerRequest *request) { doc["currentDate"] = buf; sprintf(buf, "%02d:%02d", hour(), minute()); doc["currentTime"] = buf; + doc["currentSec"] = second(); //the web page runs its clock from this between polls //DPRINT("useTemp:"); DPRINT(useTemp); DPRINT("useHumid:"); DPRINT(useHumid); if (useTemp > 0) { doc["temperature1"] = temperature[0] + prm.corrT0; @@ -1837,8 +1777,11 @@ if (useTemp > 1) doc["lux"] = lx; } else - doc["lx"] = 255; + doc["lux"] = 255; //FIXED: was "lx" doc["rssi"] = WiFi.RSSI(); + #ifdef USE_MQTT + doc["mqtt"] = !prm.mqttEnable ? 0 : mqttIsConnected() ? 2 : 1; //0 = off, 1 = not connected, 2 = connected + #endif doc["uptime"] = millis() / 1000; doc["heap"] = ESP.getFreeHeap(); #ifdef USE_WLED_REALTIME diff --git a/firmware/uniclock/ESP32_UniClock2/data/index.html b/firmware/uniclock/ESP32_UniClock2/data/index.html deleted file mode 100644 index 2302434..0000000 --- a/firmware/uniclock/ESP32_UniClock2/data/index.html +++ /dev/null @@ -1,454 +0,0 @@ - - - - Uniclock 3.0 - - - - - - - - - -
- -
- -
-
-
-
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
-
- - - off - - on -
- -
- -
- - : - -
-
- -
- - -
-
- - - off - - on -
-
- - -
-
- - - off - - on -
-
- -
-
-
- - - DAY - - NIGHT -
- -
- - - 12h - - 24h -
- -
- - - Hide - - Show -
- -
- - - off - - on -
-
- - - off - - on -
-
- - -
- -
- - - off - - on -
- -
- - - -
- -
- - -
- - -
- - - off - - on -
- -
- - -
-
- - -
- -
- -
- - : - -
-
-
- -
- - : - -
-
-
- - - off - - on -
-
- - -
-
- - -
-
- - -
-
- - - C - - F -
-
- -
- - - - -
-
-
- -
- - - - -
-
-
- -
- - - - -
-
-
- - -
-
-
- - -
-
- - -
-
- -
-
- -
-
-
-
-
-
- -
- - - left - - right -
- -
- - -
- -
- - - off - - on -
-
- - - off - - on -
-
- - - off - - on -
-
- - -
-
- -
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - - AP - - Client -
-
- - -
-
- - - off - - on -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
- -
- -
- - - - \ No newline at end of file diff --git a/firmware/uniclock/ESP32_UniClock2/data/index.html.gz b/firmware/uniclock/ESP32_UniClock2/data/index.html.gz new file mode 100644 index 0000000..7573394 Binary files /dev/null and b/firmware/uniclock/ESP32_UniClock2/data/index.html.gz differ diff --git a/firmware/uniclock/ESP32_UniClock2/data/jquery_351.js b/firmware/uniclock/ESP32_UniClock2/data/jquery_351.js deleted file mode 100644 index d467083..0000000 --- a/firmware/uniclock/ESP32_UniClock2/data/jquery_351.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! jQuery v3.5.1 | (c) JS Foundation and other contributors | jquery.org/license */ -!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.5.1",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function D(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||j,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,j=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",y.option=!!ce.lastChild;var ge={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function qe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function Le(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function He(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Oe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Ut,Xt=[],Vt=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xt.pop()||S.expando+"_"+Ct.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Vt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Vt,"$1"+r):!1!==e.jsonp&&(e.url+=(Et.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Xt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Ut=E.implementation.createHTMLDocument("").body).innerHTML="
",2===Ut.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):("number"==typeof f.top&&(f.top+="px"),"number"==typeof f.left&&(f.left+="px"),c.css(f))}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=$e(y.pixelPosition,function(e,t){if(t)return t=Be(e,n),Me.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||D,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,D=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",y.option=!!ce.lastChild;var ge={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function je(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function qe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Le(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var _t,zt=[],Ut=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=zt.pop()||S.expando+"_"+wt.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Ut.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ut.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Ut,"$1"+r):!1!==e.jsonp&&(e.url+=(Tt.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,zt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((_t=E.implementation.createHTMLDocument("").body).innerHTML="
",2===_t.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=Fe(y.pixelPosition,function(e,t){if(t)return t=We(e,n),Pe.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0https://github.com/gpeter62/ESP_UniClock', - "maxDigits": "Number of tubes", - "maxBrightness": "MAX Brightness", - "currentDate": "Date", - "currentTime": "Time", - "temperature": "Temperature sensor #1", - "temperature2": "Temperature sensor #2", - "humidity": "Humidity sensor #1", - "humidity2": "Humidity sensor #2", - "pressure": "Pressure sensor #1", - "lux": "Lux sensor current value", - "rssi": "WiFi RSSI level dB (connection quality)", - "wifiMode": "WiFi Client or Access Point", - "alarmEnable": "Switch ON/OFF alarm", - "alarmTime": "Alarm time (hour/minute)", - "alarmPeriod": "Alarm maximum length (sec)", - - //Tube display settings - "utc_offset": 'Timezone setting. https://en.wikipedia.org/wiki/List_of_time_zones_by_country', - "enableDST": "Daylight Saving Time ON/OFF", - "set12_24": "Clock display 12 / 24 hours", - "showZero": "Show starting zero on hours", - "enableBlink": "ON / OFF", - "interval": "Cathode protect interval (minutes)", - "enableAutoShutoff": "Enable automatic day/night switch", - "dayTime": "Day starts (manual brightness control)", - "nightTime": "Night starts (manual brightness control)", - "dayBright": "Day brightness", - "nightBright": "Night brightness", - "manualOverride": "Manual Day/Night change", - "animMode": "Tube animation mode: 0=OFF, 1-5: Animations 6-7: Random", - "dateMode": "0:dd/mm/yyyy 1:mm/dd/yyyy 2:yyyy/mm/dd", - "tempCF": "Celsius / Fahrenheit display", - "enableTimeDisplay": "Enable time&date display (Use OFF for thermometers)" , - "dateStart": "Date display start: Date is shown between Start/End seconds", - "dateEnd": "Date display end", - "tempStart": "Temperature display time slice start", - "tempEnd": "Temperature display end", - "humidStart": "Humidity display time slice start", - "humidEnd": "Humidity display end", - "dateRepeatMin": "Date is shown in every xx minutes. 0 = Disable date display", - "tempRepeatMin": "Temperature/humidity is shown in every xx minutes. 0 = Disable temp/humid display", - "enableDoubleBlink": "Enable both blinking dots", - "enableAutoDim": "Enable auto brightness control (if sensor is installed)", - "enableRadar": "Enable Radar/Pir tube switch (if sensor is installed)", - "radarTimeout": "If Radar is used, automatic switch off after this timeout (minutes)", - - //RGB settings - "rgbDir" : "RGB animation direction (left/right)", - "rgbEffect": "RGB animation#", - "rgbBrightness": "RGB leds brightness 0..255", - "rgbFixColor": "RGB color, if FixColor Effect is used", - "rgbSpeed": "RGB animation speed", - "wledEnable": "Let SignalRGB control the LEDs: the clock shows up there as a WLED device", - "wledDarkWithTubes": "LEDs stay dark while the tubes / backlight are off, also when SignalRGB is running", - "wledUseBrightness": "Scale SignalRGB colours by RGB Brightness (and auto dim). Off: colours as sent", - "wledLive": "SignalRGB is sending colours right now", - - //Wifi settings - "wifiSsid": "WiFi network SSID to connect", - "wifiPsw": "WiFI password", - "ApSsid": "AccessPoint name, if standalone mode is used", - "ApPsw": "AP password", - "NtpServer": "Timeserver name, using WiFi. (Default is: pool.ntp.org)", - "mqttBrokerAddr": "MQTT server address, if MQTT used", - "mqttBrokerUser": "MQTT user", - "mqttBrokerPsw": "MQTT password", - "mqttBrokerRefresh": "MQTT send data in every xx sec", - "mqttEnable": "Enable/Disable MQTT refresh", - "firmware": "http server + firmware name to download new firmware", - "corrT0": "Temperature sensor#1 correction", - "corrT1": "Temperature sensor#2 correction", - "corrH0": "Humidity sensor#1 correction", - "corrH1": "Humidity sensor#2 correction" , - "cathProtMin": "Cathode Protect procedure (minutes)", - "FW": "firmware code", - "tubeDriver": "Tube driver modul" -}; - -//Example config that UI recieves -var configuration = { - //Main screen - "version": "UniClock 3.0", - "maxDigits": 6, - "maxBrightness": 10, - "currentDate": "2020.10.24", - "currentTime": "15:01", - "temperature": 22.1, - "temperature2": 255, - "humidity": 45, - "humidity2": 255, - "pressure": 255, - "lux": 100, - "rssi": 0, - "wifiMode": true, - "alarmEnable": false, - "alarmTime": "6:30", - "alarmPeriod": 15, - "enableRadar": false, - "radarTimeout": 5, - - //Tube display settings - "utc_offset": 1, - "enableDST": true, - "set12_24": true, - "showZero": true, - "enableBlink": true, - "interval": 15, - "enableAutoShutoff": true, - "dayTime": "7:00", - "nightTime": "22:00", - "dayBright": 10, - "nightBright": 3, - "manualOverride": true, - "animMode": 6, - "dateMode": 2, // 0:dd/mm/yyyy 1:mm/dd/yyyy 2:yyyy/mm/dd - "tempCF": false, //Temperature Celsius / Fahrenheit - "enableTimeDisplay": true, - "dateStart": 45, - "dateEnd": 50, - "tempStart": 35, - "tempEnd": 40, - "humidStart": 40, - "humidEnd": 45, - "dateRepeatMin": 3, - "tempRepeatMin": 1, - "enableDoubleBlink": true, - "enableAutoDim": false, - - //RGB settings - "rgbDir" : true, - "rgbEffect": 1, - "rgbBrightness": 100, - "rgbFixColor": 150, - "rgbSpeed": 50, - "wledEnable": false, - "wledDarkWithTubes": true, - "wledUseBrightness": true, - "wledLive": false, - - //Wifi settings - "wifiSsid": "mywifi", - "wifiPsw": "mypsw", - "ApSsid": "UniClock", - "ApPsw": "uniclock", - "NtpServer": "pool.ntp.org", - "mqttBrokerAddr": "10.0.99.12", - "mqttBrokerUser": "mqtt", - "mqttBrokerPsw": "mqttPW", - "mqttBrokerRefresh": 30, - "mqttEnable": false, - "firmware": "http://server/fw.bin", - "corrT0": 0.0, - "corrT1": 0.0, - "corrH0": 0.0, - "corrH1": 0.0, - "cathProtMin": 5, - "FW": "fw", - "tubeDriver": "xxx" -}; - -var isMouseDown = 0; -//Runs, when HTML document is fully loaded -$(document).ready(function(){ - $(document).on('mousedown touchstart',function(event) { - ++isMouseDown; - }); - $(document).on('mouseup touchend',function(event) { - --isMouseDown; - }); - - if(isTest){ - Init(); - setCurrentInfos(); - } - else{ - getConfiguration(); - //Set current infos, like time, humidity and temperature - getCurrentInfos(); - } -}); - -function setLocalPagination(){ - $('[page]').not('[hidden]').each(function(){ - var page = $(this).attr('page'); - $('#menu tr').append(''); - }); -} - -function getConfiguration(){ - $.get('/getConfiguration/').done(function(data){ - configuration = data; - }).always(function(){ - Init(); - }); -} - -function sendMsgToArduino(key,value) { - if(isTest){ - console.log(key + " " + value); - } - else{ - $.post('/saveSetting/', {"key" : key ,"value" : value }).done(function(data){ - console.log(data); - }); - } -} - -var COLORSATURATION = 255; -var WHITE_INDEX = 192; -function getColorFrom(WheelPos){ - if (WheelPos == WHITE_INDEX) - return RgbColor(COLORSATURATION/2, COLORSATURATION/2, COLORSATURATION/2); - - WheelPos = 255 - WheelPos; - if(WheelPos < 85) { - return RgbColor(255 - WheelPos * 3, 0, WheelPos * 3); - } else if(WheelPos < 170) { - WheelPos -= 85; - return RgbColor(0, WheelPos * 3, 255 - WheelPos * 3); - } else { - WheelPos -= 170; - return RgbColor(WheelPos * 3, 255 - WheelPos * 3, 0); - } -} - -function RgbColor(r, g, b){ - return 'rgb('+r+','+g+','+b+')'; -} - -function setPreviewColor(){ - var color = getColorFrom($('#rgbFixColor').val()); - $('#selectedColor').css('background-color',color); -} - -function setCurrentInfos(){ - $('#currentTime').html(getCurrentDate(configuration["currentDate"]) + " " + configuration["currentTime"]); - $('#lux').html(configuration["lux"]); - $('#rssi').html(configuration["rssi"]); - $('#wledLive').html(configuration["wledLive"] ? "yes" : "no"); - $('#pressure').html(round(configuration["pressure"],1)); - $('#humidity').html(round(configuration["humidity"],1)); - $('#humidity2').html(round(configuration["humidity2"],1)); - $('#temperature').html(getTemperature(configuration["temperature"])); - $('#temperature2').html(getTemperature(configuration["temperature2"])); - $('#temperature, #temperature2').toggleClass('fahrenheit',configuration["tempCF"]); -} - -function round(value, decimals) { - return parseFloat(value).toFixed(decimals); - //return Number(Math.round(value+'e'+decimals)+'e-'+decimals); -} - -function getTemperature(temperatureInC){ - if(configuration["tempCF"]){ //Fahrenheit - return round(temperatureInC * 1.8 + 32,1); - } - else{ - return round(temperatureInC,1); - } -} - -function getControlInfo(index){ - return controlInfos[index]; -} - -//Contains the most important initializes -function Init(){ - - $('#dayBright, #nightBright').attr('max',configuration['maxBrightness']); - document.title = configuration['version']; - $('#versionHeader').html(configuration['version']); - - setLocalPagination(); - $('[pagemenu]').on('click',function(){ - $('.menu-item.active').removeClass('active'); - $('[page].active').removeClass('active'); - $(this).addClass('active'); - $('[page="'+$(this).attr('pagemenu')+'"]').addClass('active'); - if($(this).attr('pagemenu') == 'settings'){ - getClockDetails(); - } - }); - $('.menu-item').eq(0).trigger('click'); - - $('#rgbFixColor').on('input',function(){ - setPreviewColor(); - }); - - var sliderFadeOutTimer; - function setFadeOutTimer(element){ - setTimeout(function(){ - if(isMouseDown > 0){ - clearTimeout(sliderFadeOutTimer); - sliderFadeOutTimer = setFadeOutTimer(element); - } - else{ - $(element).addClass('fading').fadeOut('slow',function(){ - $(this).remove(); - }); - } - },600); - } - - $('input[type="range"]').on('mousedown touchstart input',function(){ - clearTimeout(sliderFadeOutTimer); - var id = $(this).attr('id'); - var parent = $(this).closest('.control-holder'); - $('[sliderfor]:not(.fading)').each(function(){ - if($(this).attr('sliderfor') != id && !$(this).hasClass('fading')){ - $(this).addClass('fading').fadeOut('slow',function(){ - $(this).remove(); - }); - } - }); - if($(parent).children('.slider-info').length == 0){ - $(parent).append('
'); - $(parent).children('.slider-info').fadeIn(300); - } - var _this = $(parent).children('.slider-info').text($(this).val()); - sliderFadeOutTimer = setFadeOutTimer(_this); - }); - - $('.form label').on('click',function(){ - var id = ''; - if(!!$(this).attr('for')){ - id = $(this).attr('for'); - } - else{ - id = $(this).closest('.control-holder').find('input, select, .info').eq(0).attr('id'); - } - - var info = getControlInfo(id); - if(!!info){ - showPopUp($(this).text(), info, 450, true); - } - }); - $('#popup-close-btn, #info-popup').on('click',function(){ - if($('#info-popup').hasClass('cantClose')){ - return; - } - else{ - $('#info-popup').fadeOut(450); - } - }); - $("#popup-box").click(function(event){ - event.stopPropagation(); - }); - - //binds custom switch functionality - $('.switcher').on('click',function(){ - $('#'+$(this).attr('for')).prop('checked',!$('#'+$(this).attr('for')).is(":checked")).trigger('change'); - }); - - //binds custom switch text functionality - $('.switcher-text').on('click',function(){ - $('#'+$(this).attr('for')).prop('checked',$(this).hasClass('right')).trigger('change'); - }); - - //fills autogenerated select drop downs - /* - Possible css class: - two-digit - fills with two digit values if value lower than 10 - Possible attributes: - min (mandatory) - auto generation's minimum value - max (mandatory) - auto generation's maximum value - step (optional) - auto generation's step, if not set, default is 1 - prefix (optional) - concatanate this string before value - suffix (optional) - concatanate this string after value - */ - $('.number-select').each(function(){ - let from = $(this).attr('min')*1; - let to = $(this).attr('max')*1; - let step = !!$(this).attr('step') ? $(this).attr('step') : 1; - - for(let i = from; i < to+1; i){ - let value = $(this).hasClass('two-digit') ? formatToTwoDigit(i) : i; - let text_value = value; - if($(this).attr('prefix') != null){ - text_value = $(this).attr('prefix') + text_value - } - if($(this).attr('suffix') != null){ - text_value += $(this).attr('suffix') - } - $(this).append(''); - i += step*1; - } - }); - - //fills the inputs with configuration values - for(var index in configuration){ - let value = configuration[index]; - if(index == 'dayTime' || index == 'nightTime' || index == 'alarmTime'){ - value = value.split(':'); - $('#'+index+'Hours').val(formatToTwoDigit(value[0])); - $('#'+index+'Minutes').val(formatToTwoDigit(value[1])); - } - else if(index == 'version' - ){ - $('#'+index).html(value); - } - else if(index == 'utc_offset' || index == 'maxBrightness' || - index == 'dayBright' || index == 'nightBright' || - index == 'animMode' || index == 'rgbBrightness' || - index == 'rgbFixColor' || index == 'rgbSpeed' || - index == 'rgbEffect' || index == 'interval' || - index == 'alarmPeriod' || index == 'radarTimeout' || - index == 'dateRepeatMin' || index == 'dateMode' || - index == 'dateStart' || index == 'dateEnd' || - index == 'timeStart' || index == 'timeEnd' || - index == 'tempStart' || index == 'tempEnd' || - index == 'humidStart' || index == 'humidEnd' || - index == 'mqttBrokerRefresh' || index == 'tempRepeatMin' || - index == 'wifiSsid' || index == 'wifiPsw' || - index == 'ApSsid' || index == 'ApPsw' || - index == 'mqttBrokerAddr' || index == 'NtpServer' || - index == 'mqttBrokerUser' || index =='mqttBrokerPsw' || - index == 'firmware' || index == 'corrT0' || index == 'corrT1' || - index == 'corrH0' || index == 'corrH1' || index == 'cathProtMin' - ){ - $('#'+index).val(value); - } - else if((index == 'enableDST' || index == 'set12_24' || - index == 'showZero' || index == 'enableBlink' || - index == 'enableAutoShutoff' || index == 'alarmEnable' || - index == 'rgbDir' || index == 'manualOverride' || - index == 'enableAutoDim' || index == 'enableRadar' || - index == 'enableDoubleBlink' || index == 'enableTimeDisplay' || - index == 'mqttEnable' || index == 'tempCF' || index == "wifiMode" || - index == 'wledEnable' || index == 'wledDarkWithTubes' || index == 'wledUseBrightness' - ) && !!value - ){ - $('#'+index).prop('checked',true); - } - else if(index == "maxDigits"){ - //TODO - } - } - $('.radar-holder').toggleClass('hidden',configuration['radarTimeout'] == 0); - $('.mqtt-holder').toggleClass('hidden',configuration['mqttBrokerRefresh'] == 0); - $('.lux-holder').toggleClass('hidden',configuration['lux'] == 255); - $('.pressure-holder').toggleClass('hidden',configuration['pressure'] == 255); - $('.humidity-holder').toggleClass('hidden',configuration['humidity'] == 255); - $('.humidity-holder2').toggleClass('hidden',configuration['humidity2'] == 255); - $('.temperature-holder').toggleClass('hidden',configuration['temperature'] == 255); - $('.temperature-holder2').toggleClass('hidden',configuration['temperature2'] == 255); - $('.rgb-holder').toggleClass('hidden',configuration['rgbEffect'] == 255); - $('.wled-holder').toggleClass('hidden',configuration['wledEnable'] === undefined); //firmware without USE_WLED_REALTIME - $('.tube-holder').toggleClass('hidden',configuration['tubeDriver'] == "DUMMY"); - $('.wordclock-holder').toggleClass('hidden',configuration['tubeDriver'] == "WORDCLOCK"); - $('.sensors-holder').toggleClass('hidden',configuration['temperature'] == 255); - setPreviewColor(); - - //sets a possible good timezone, if not already set - //if(!configuration['utc_offset']){ - // //Intl.DateTimeFormat().resolvedOptions().timeZone <- I am in this Zone - // var tryToFindCurrentZone = -(new Date().getTimezoneOffset() / 60); - // $('#utc_offset').val(tryToFindCurrentZone); - //} - - setTimeout(function(){ - $('input, select').on('change',function(){ - var value = ''; - if($(this).attr('id').indexOf("Hours") == -1 || $(this).attr('id').indexOf("Minutes") == -1){ - if($(this).attr('type') == 'checkbox'){ - value = $(this).is(':checked'); - } - else{ - value = $(this).val(); - } - sendMsgToArduino($(this).attr('id'), value); - } - else{ - var key = $(this).attr('id').replace('Hours','').replace('Minutes',''); - value = $('#'+key+'Hours').val() + ":" + $('#'+key+'Minutes').val(); - sendMsgToArduino(key, value); - } - }); - $('#dateMode').on('change',function(){ - configuration["dateMode"] = $(this).val(); - setCurrentInfos(); - }); - $('#tempCF').on('change',function(){ - configuration["tempCF"] = !configuration["tempCF"]; - setCurrentInfos(); - }); - },200); -} - -function showPopUp(header, content, timeout, canClose){ - $('#popup-box h2').text(header); - $('#popup-box .content').html(content); - $('#info-popup').toggleClass('cantClose',!canClose); - $('#info-popup').fadeIn(timeout); -} - -function areYouSure(fn){ - if (confirm("Are you sure to run " + fn + "?")) { - if(fn == "reset"){ - callReset(); - } - else if(fn == "factoryreset"){ - callFactoryReset(); - } - else if(fn == "firmwareupdate"){ - callFirmwareUpdate(); - } - else if(fn == "cathodeProtect"){ - callCathodeProtect(); - } - } -} - -function callReset(){ - if(isTest){return;} - $.post('/reset/', {}).done(function(data){ - location.reload(); - }).always(function(){ - - }); -} - -function callFactoryReset(){ - if(isTest){return;} - $.post('/factoryreset/', {}).done(function(data){ - location.reload(); - }).always(function(){ - - }); -} - -function callFirmwareUpdate(){ - if(isTest){return;} - showPopUp("Firmware is updating", "Please do not turn off the clock", 300, false); - $.post('/firmwareupdate/', {}).done(function(data){ - if(!!data.header){ - showPopUp(data.header, data.content, 300, data.canClose); - } - }).always(function(){ - - }); -} - -function callCathodeProtect(){ - if(isTest){return;} - $.post('/cathodeProtect/', {}).done(function(data){ - location.reload(); - }).always(function(){ - - }); -} - -function getClockDetails(){ - if(isTest){return;} - $.get('/getClockDetails/').done(function(data){ - $('#clock-details').html(data); - }).always(function(){ - - }); -} - -function getCurrentInfos(){ - if(isTest){return;} - $.get('/getCurrentInfos/').done(function(data){ - for(var i in data){ - configuration[i] = data[i]; - } - if(!!data["popupMsg"] && data["popupMsg"].length > 0){ - showPopUp("Info", data["popupMsg"], 300, true); - } - setCurrentInfos(); - setTimeout(getCurrentInfos,20000); //refreshes time every 20 second by calling itself - }).always(function(){ - - }); -} - -function getCurrentDate(date){ - var splittedDate = date.split('.'); - var yyyy = splittedDate[0]; - var mm = splittedDate[1]; - var dd = splittedDate[2]; - - if(configuration["dateMode"] == 0){ - return dd+"/"+mm+"/"+yyyy; - } - else if(configuration["dateMode"] == 1){ - return mm+"/"+dd+"/"+yyyy; - } - else if(configuration["dateMode"] == 2){ - return yyyy+"/"+mm+"/"+dd; - } - else{ - return yyyy+"/"+mm+"/"+dd; //if dateMode?? // 0:dd/mm/yyyy 1:mm/dd/yyyy 2:yyyy/mm/dd - } -} - -//Gets the current time from browser and gives back as readable format -function getCurrentTime(){ - var today = new Date(); - var dd = formatToTwoDigit(today.getDate()); - var mm = formatToTwoDigit(today.getMonth()+1); - var yyyy = today.getFullYear(); - var hour = formatToTwoDigit(today.getHours()); - var minute = formatToTwoDigit(today.getMinutes()); - - if(configuration["dateMode"] == 0){ - return dd+"-"+mm+"-"+yyyy+" "+hour+":"+minute; - } - else if(configuration["dateMode"] == 1){ - return mm+"-"+dd+"-"+yyyy+" "+hour+":"+minute; - } - else if(configuration["dateMode"] == 2){ - return yyyy+"-"+mm+"-"+dd+" "+hour+":"+minute; - } - else{ - return yyyy+"-"+mm+"-"+dd+" "+hour+":"+minute; //if dateMode?? // 0:dd/mm/yyyy 1:mm/dd/yyyy 2:yyyy/mm/dd - } -} - -//if number is lower than 10, adds a zero -function formatToTwoDigit(number){ - return ("0" + number).slice(-2); -} \ No newline at end of file diff --git a/firmware/uniclock/ESP32_UniClock2/data/site.css b/firmware/uniclock/ESP32_UniClock2/data/site.css deleted file mode 100644 index 80652dc..0000000 --- a/firmware/uniclock/ESP32_UniClock2/data/site.css +++ /dev/null @@ -1,479 +0,0 @@ -*, *:before, *:after{ - box-sizing: border-box; -} -.non-selectable{ - -webkit-touch-callout: none; /* iOS Safari */ - -webkit-user-select: none; /* Safari */ - -khtml-user-select: none; /* Konqueror HTML */ - -moz-user-select: none; /* Old versions of Firefox */ - -ms-user-select: none; /* Internet Explorer/Edge */ - user-select: none; /* Non-prefixed version, currently - supported by Chrome, Edge, Opera and Firefox */ -} -html { - -webkit-font-smoothing: antialiased; - background-image: radial-gradient(#222, #111); - min-height: 100%; - background-attachment: fixed; - color: #c35; -} -.hidden{ - display: none !important; -} -a, a:visited{ - color: #c35; - text-decoration: none; -} -a:hover{ - text-decoration: underline; - color: #777; -} -body { - font-family: "Helvetica Neue", Helvetica, Arial, "Liberation Sans", FreeSans, sans-serif; - margin: 0; -} -.form{ - overflow: auto; -} -.max-width{ - max-width: 800px; - margin: auto; -} -.row{ - clear: both; - overflow: auto; -} -.row + .row{ - margin-top: 15px; -} -.control-holder{ - width: 33.333333%; - display: block; - float: left; - padding: 5px; - min-height: 80px; - position: relative; -} -.header{ - overflow: auto; -} -.form label { - cursor: help; - width: 100%; - display: inline-block; - font-weight: bold; - padding-top: 0; - padding-left: 0; - letter-spacing: 0.025em; - font-size: 20px; - vertical-align: top; - line-height: 30px; - position: relative; - text-shadow: 1px 1px 0 black; - margin-bottom: 5px; -} -input, select, button{ - margin: 0; - font: inherit; - line-height: normal; - width: 100%; - max-width: 250px; - background: #222222; - color: #eee; - position: relative; - padding: 5px; - min-height: 30px; - outline: none; - line-height: normal; - border-radius: 3px; - border: 1px solid #666; - transition: 0.15s background; -} -input:not([type="text"]):not(:disabled),select:not(:disabled),button:not(:disabled){ - cursor: pointer; -} -input:hover, select:hover, button:hover{ - background: #333; -} -input:focus, select:focus, button:focus{ - background: #4E4E4E; - border-color: #888; -} -input:active, select:active, button:active{ - background: #5E5E5E; - border-color: #aaa; -} -button{ - border: 2px solid #c35; - color: #c35; - text-transform: uppercase; - font-weight: bold; -} -button:hover{ - color: #ddd; -} -.multiple-input span{ - color: white; - font-weight: bold; -} -.two-digit, .small{ - max-width: 60px; -} -[pagemenu="settings"]:hover{ - cursor: pointer; - text-decoration: underline; -} -[type="checkbox"].switch{ - position: fixed; - left: -300px; - top: -300px; -} -[type="checkbox"].switch ~ .switcher{ - width: 60px; - display: inline-block; - vertical-align: top; - height: 30px; - padding: 2px; - background: #222222; - border: 1px solid #666; - transition: 0.15s background; - border-radius: 30px; - position: relative; - cursor: pointer; -} -[type="checkbox"].switch:focus ~ .switcher{ - background: #5E5E5E; - border-color: #aaa; -} -[type="checkbox"].switch ~ .switcher:after{ - display: inline-block; - content: ''; - vertical-align: top; - width: 20px; - height: 20px; - position: absolute; - top: 4px; - left: 4px; - border-radius: 50%; - background: rgba(255,255,255,0.4); - transition: 0.3s all; -} -[type="checkbox"].switch:checked ~ .switcher:after{ - left: 34px; -} -[type="checkbox"].switch:not(.two-side):checked ~ .switcher:after{ - background: rgba(255,255,255,0.7); -} -[type="checkbox"].switch:not(.two-side):checked ~ .switcher{ - background: #37bfb9; - background-color: #c35; -} -[page]{ - display: none; -} -[page].active{ - display: block; -} -#menu-holder{ - padding-bottom: 40px; -} -#menu-holder > .floating-menu{ - position: fixed; - top: 0; - left: 0; - width: 100%; - z-index: 110; - background: #161616; -} -#menu{ - width: 100%; -} -#menu td{ - padding: 0 18px; -} -#menu td .menu-item{ - cursor: pointer; - border-bottom: 2px solid gray; - text-align: center; - text-transform: uppercase; - font-weight: bold; - line-height: 30px; - background-color: transparent; - transition: 0.3s border, 0.3s background, 0.3s color; -} -#menu td .menu-item:hover{ - background-color: #4E4E4E; - border-color: #ddd; -} -#menu td .menu-item.active{ - color: #ddd; - border-color: #c35; -} -.switcher-text{ - text-transform: uppercase; - font-weight: bold; - line-height: 30px; - cursor: pointer; - transition: 0.3s color; - text-shadow: 1px 1px 0 black; -} -.switcher-text:hover{ - color: #c35 !important; -} -.switcher-text.left{ - margin-right: 10px; -} -.switcher-text.right{ - margin-left: 10px; - color: #555; -} -[type="checkbox"].switch:checked ~ .switcher-text.left{ - color: #555; -} -[type="checkbox"].switch:checked ~ .switcher-text.right{ - color: inherit; -} -.footer{ - margin: auto; - display: block; - text-align: center; - text-shadow: 1px 1px 0 black; -} -.footer span{ - margin: 0 10px; - font-size: 26px; - color: #555; -} -.separator{ - border-top: 1px dotted #555; - margin-top: 20px; - margin-bottom: 20px; -} -.info{ - color: #555; - padding: 10px 0; - font-style: italic; - display: inline-block; - text-shadow: 1px 1px 0 black; -} -.info.medium{ - color: #888; - font-weight: bold; - font-size: 25px; - line-height: 32px; -} -.info.big{ - color: #888; - font-weight: bold; - font-size: 32px; - line-height: 32px; -} -.info:after{ - color: #666; - display: inline-block; - padding-left: 5px; - font-size: 28px; -} -#temperature:after{ - content: ' °C'; -} -#temperature.fahrenheit:after{ - content: ' °F'; -} -#temperature2:after{ - content: ' °C'; -} -#temperature2.fahrenheit:after{ - content: ' °F'; -} -#humidity:after{ - content: '%'; -} -#pressure:after{ - content: ' hPa'; -} -#lux:after{ - content: ' lux'; -} -#color-select-holder > div{ - float: left; -} -#color-select-holder > div:first-child{ - width: calc(100% - 40px); -} -#color-select-holder > div:last-child{ - width: 40px; -} - -#info-popup{ - display: none; - position: fixed; - top: 0; - left: 0; - bottom: 0; - right: 0; - z-index: 9999; - background: rgba(0,0,0,0.6); -} - -#popup-box{ - padding: 12px; - border: 2px solid; - margin: auto; - width: 100%; - background: #161616; - margin-top: 50px; - border-radius: 12px; - position: relative; -} -#popup-box h2{ - margin-top: 0; - color: #ddd; -} -#popup-close-btn{ - position: absolute; - left: 100%; - top: 0; - background: #161616; - width: 30px; - height: 30px; - border-radius: 50%; - border: 2px solid; - line-height: 30px; - text-align: center; - font-weight: bold; - cursor: pointer; - margin-left: -15px; - margin-top: -15px; - transition: 0.3s background, 0.3s color; -} -#popup-close-btn:hover{ - color: #ddd; -} -#info-popup.cantClose #popup-close-btn{ - display: none; -} - -#selectedColor{ - width: 30px; - height: 30px; - background-color: white; - border-radius: 50%; - margin: auto; -} - -.slider-info{ - display: none; - position: absolute; - padding: 3px; - font-weight: bold; - font-size: 24px; - background: #161616; - border: 2px solid #c35; - z-index: 3; - border-radius: 50%; - text-align: center; - color: #ddd; - min-width: 50px; - top: 0; - right: 10px; -} - -/* slider control */ - -.slidecontainer { - width: 100%; /* Width of the outside container */ -} - -/* The slider itself */ -.slider { - margin-top: 9px; - height: 10px; - min-height: auto; - -webkit-appearance: none; /* Override default CSS styles */ - appearance: none; - outline: none; /* Remove outline */ - opacity: 0.7; /* Set transparency (for mouse-over effects on hover) */ - -webkit-transition: .2s; /* 0.2 seconds transition on hover */ - transition: opacity .2s; -} - -/* Mouse-over effects */ -.slider:hover { - opacity: 1; /* Fully shown on mouse-over */ -} - -/* The slider handle (use -webkit- (Chrome, Opera, Safari, Edge) and -moz- (Firefox) to override default look) */ -.slider::-webkit-slider-thumb { - -webkit-appearance: none; /* Override default look */ - appearance: none; - width: 20px; /* Set a specific slider handle width */ - height: 20px; /* Slider handle height */ - background: #c35; - cursor: pointer; /* Cursor on hover */ - border-radius: 50%; - border: 2px solid #ddd; -} - -.slider::-moz-range-thumb { - width: 20px; /* Set a specific slider handle width */ - height: 20px; /* Slider handle height */ - background: #c35; - cursor: pointer; /* Cursor on hover */ - border-radius: 50%; - border: 2px solid #ddd; -} - -/* slider control end */ - - -/* width */ -::-webkit-scrollbar { - width: 10px; -} - -/* Track */ -::-webkit-scrollbar-track { - background: #333; -} - -/* Handle */ -::-webkit-scrollbar-thumb { - background: #c35; -} - -/* Handle on hover */ -::-webkit-scrollbar-thumb:hover { - background: #d43d5f; -} -@media screen and (max-width: 600px){ - .control-holder{ - width: 50%; - } - .form label{ - font-size: 15px; - } - .switcher-text{ - font-size: 14px; - } - .info{ - padding: 5px 0; - } - .info:after{ - font-size: 16px; - } - .info.big{ - font-size: 20px; - } - .info.medium{ - font-size: 15px; - } -} -@media screen and (max-width: 360px){ - body{ - text-align: center; - } - .control-holder{ - width: 100%; - } -} \ No newline at end of file diff --git a/firmware/uniclock/ESP32_UniClock2/mqtt.ino b/firmware/uniclock/ESP32_UniClock2/mqtt.ino index 47c2644..dc4ee51 100644 --- a/firmware/uniclock/ESP32_UniClock2/mqtt.ino +++ b/firmware/uniclock/ESP32_UniClock2/mqtt.ino @@ -467,6 +467,8 @@ void mqttSend() { DPRINTLN(" "); } +bool mqttIsConnected() { return mqtt.isConnected(); } //for /getCurrentInfos + #else void mqttSend() {} #endif diff --git a/firmware/uniclock/README.md b/firmware/uniclock/README.md index 978bbf4..2bf9a08 100644 --- a/firmware/uniclock/README.md +++ b/firmware/uniclock/README.md @@ -3,8 +3,12 @@ Firmware for this clock, based on [ESP_UniClock](https://github.com/gpeter62/ESP_UniClock) by Peter Gautier (GPL-3.0-or-later), vendored from upstream commit `1189810` (2026-09-07). -- `ESP32_UniClock2/`: the upstream sketch folder (all `.ino`/`.h` files and the web UI in `data/`). - It keeps the upstream layout, so it still opens in the Arduino IDE. +- `ESP32_UniClock2/`: the upstream sketch folder (all `.ino`/`.h` files; `data/` is the SPIFFS + content). It keeps the upstream layout, so it still opens in the Arduino IDE. +- `web/index.html`: the web UI (replaces the upstream jQuery page), one file with its CSS and JS. + `web/gzip_web.py` gzips it to `data/index.html.gz`; PlatformIO runs it before every build, in the + Arduino IDE run `python web/gzip_web.py` before uploading the data folder. Opened straight from + disk, the page runs on sample data, so layout changes can be checked without the clock. - `lib/`: the library versions bundled upstream (`libraries/*.zip`), only those the ESP8266 build needs. The upstream manuals, datasheets, photos and ESP32-only libraries were left out. Exception: `arduino-home-assistant` is v2.1.0 (upstream bundles 1.3.0, which has no light, @@ -18,7 +22,7 @@ Local changes are separate commits on top of the import (`git log -- firmware/un ```sh pio run # build pio run -t upload # flash the firmware over COM7 -pio run -t uploadfs # flash the web UI (data/) to SPIFFS +pio run -t uploadfs # flash the web UI (data/) to SPIFFS; over WiFi: -e nixie_in12_ota pio device monitor # serial log, 115200 Bd ``` diff --git a/firmware/uniclock/platformio.ini b/firmware/uniclock/platformio.ini index 2b4344f..03076ce 100644 --- a/firmware/uniclock/platformio.ini +++ b/firmware/uniclock/platformio.ini @@ -19,6 +19,8 @@ board_build.flash_mode = dio board_build.f_cpu = 80000000L ; evaluate #ifdefs when resolving includes: the sketch includes ESP32-only libraries inside #if lib_ldf_mode = chain+ +; the web UI source is web/index.html; this writes data/index.html.gz for uploadfs +extra_scripts = pre:web/gzip_web.py ; CH340C adapter on COM7 without auto-reset: put the clock in flash mode by hand ; (hold GPIO0 to GND, tap RST, release GPIO0) before every upload/uploadfs. upload_port = COM7 diff --git a/firmware/uniclock/web/gzip_web.py b/firmware/uniclock/web/gzip_web.py new file mode 100644 index 0000000..d8c8125 --- /dev/null +++ b/firmware/uniclock/web/gzip_web.py @@ -0,0 +1,23 @@ +# Gzips web/index.html into the SPIFFS data folder (ESP32_UniClock2/data/index.html.gz). +# Runs before every PlatformIO build/uploadfs (extra_scripts in platformio.ini); also runs on its own: +# python web/gzip_web.py +# The web server sends the .gz file with Content-Encoding: gzip (serveStatic in ESP32_UniClock2.ino). +import gzip +import os + +try: + Import("env") # noqa: F821 (PlatformIO/SCons) + root = env["PROJECT_DIR"] # noqa: F821 +except NameError: + root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + +src = os.path.join(root, "web", "index.html") +dst = os.path.join(root, "ESP32_UniClock2", "data", "index.html.gz") + +with open(src, "rb") as f: + packed = gzip.compress(f.read(), 9, mtime=0) # mtime=0: same input, same bytes (no git noise) +old = open(dst, "rb").read() if os.path.exists(dst) else b"" +if packed != old: + with open(dst, "wb") as f: + f.write(packed) + print("gzip_web: %s (%d bytes)" % (dst, len(packed))) diff --git a/firmware/uniclock/web/index.html b/firmware/uniclock/web/index.html new file mode 100644 index 0000000..dde255c --- /dev/null +++ b/firmware/uniclock/web/index.html @@ -0,0 +1,646 @@ + + + + + + +Nixie Clock + + + + + +
+
+
 
+
+
+
+ +
Loading…
+ +
+ + + +