html page improved.
This commit is contained in:
parent
75e5541e5e
commit
eb33c94bf2
1 changed files with 58 additions and 51 deletions
|
@ -628,13 +628,66 @@ void init_webserver()
|
||||||
http_content += "<fieldset>";
|
http_content += "<fieldset>";
|
||||||
http_content += "<h3>" + (String)light_name + "</h3>";
|
http_content += "<h3>" + (String)light_name + "</h3>";
|
||||||
|
|
||||||
|
http_content += "<div class=\"pure-form pure-form-aligned\">";
|
||||||
|
|
||||||
http_content += "<div class=\"pure-controls\">";
|
http_content += "<div class=\"pure-controls\">";
|
||||||
http_content += "<span class=\"pure-form-message\"><a href=\"/?alert=1\">alert</a> <a href=\"/?reset=1\">reset</a> <a href=\"/?resettc\">reset timing control data</a> <a href=\"/update\">update</a></span>";
|
http_content += "<span class=\"pure-form-message\"><a href=\"/?alert=1\">alert</a> <a href=\"/?reset=1\">reset</a> <a href=\"/?resettc\">reset timing control data</a> <a href=\"/update\">update</a></span>";
|
||||||
http_content += "<label for=\"cb\" class=\"pure-checkbox\">";
|
http_content += "<label for=\"cb\" class=\"pure-checkbox\">";
|
||||||
http_content += "</label>";
|
http_content += "</label>";
|
||||||
http_content += "</div>";
|
http_content += "</div>";
|
||||||
|
|
||||||
http_content += "<form class=\"pure-form pure-form-aligned\" action=\"/\" method=\"post\">";
|
// timing control button
|
||||||
|
http_content += "<br>";
|
||||||
|
http_content += "<div class=\"pure-control-group\">";
|
||||||
|
http_content += "<label for=\"tc_on\"><strong>Timing control</strong></label>";
|
||||||
|
int tc_val = EEPROM.read(EEPROM_TIMING_CONTROL_ENABLED_ADDRESS);
|
||||||
|
http_content += "<a id=\"tc_on\" class=\"pure-button";
|
||||||
|
if (tc_val == TIMING_CONTROL_ENABLED) http_content += " pure-button-primary";
|
||||||
|
http_content += "\" href=\"#\">ON</a>";
|
||||||
|
http_content += "<a id=\"tc_off\" class=\"pure-button";
|
||||||
|
if (tc_val == TIMING_CONTROL_DISABLED) http_content += " pure-button-primary";
|
||||||
|
http_content += "\" href=\"#\">OFF</a>";
|
||||||
|
http_content += "</div>";
|
||||||
|
http_content += "<script>"
|
||||||
|
// Suche nach allen tc Links auf der Seite mit IDs tc_on
|
||||||
|
"var links = document.querySelectorAll('[id^=\"tc_on\"]');"
|
||||||
|
// Füge einen Klick-Listener zu jedem Link hinzu
|
||||||
|
"links.forEach(function(link) {"
|
||||||
|
"link.addEventListener('click', function(event) {"
|
||||||
|
// Verhindere, dass der Link die Seite neu lädt
|
||||||
|
"event.preventDefault();"
|
||||||
|
// Erstelle eine neue Anfrage an die entsprechende URL
|
||||||
|
"var xhr = new XMLHttpRequest();"
|
||||||
|
"xhr.open('GET', 'http://192.168.0.26/?tc=true', true);"
|
||||||
|
// Sende die Anfrage im Hintergrund
|
||||||
|
"xhr.send();"
|
||||||
|
"console.log('tc=true call')"
|
||||||
|
"});"
|
||||||
|
"});"
|
||||||
|
// Suche nach allen tc Links auf der Seite mit IDs tc_off
|
||||||
|
"var links = document.querySelectorAll('[id^=\"tc_off\"]');"
|
||||||
|
// Füge einen Klick-Listener zu jedem Link hinzu
|
||||||
|
"links.forEach(function(link) {"
|
||||||
|
"link.addEventListener('click', function(event) {"
|
||||||
|
// Verhindere, dass der Link die Seite neu lädt
|
||||||
|
"event.preventDefault();"
|
||||||
|
// Erstelle eine neue Anfrage an die entsprechende URL
|
||||||
|
"var xhr = new XMLHttpRequest();"
|
||||||
|
"xhr.open('GET', 'http://192.168.0.26/?tc=false', true);"
|
||||||
|
// Sende die Anfrage im Hintergrund
|
||||||
|
"xhr.send();"
|
||||||
|
"console.log('tc=false call')"
|
||||||
|
"});"
|
||||||
|
"});"
|
||||||
|
"</script>";
|
||||||
|
http_content += "<br>";
|
||||||
|
|
||||||
|
http_content += "<div class=\"pure-control-group\">";
|
||||||
|
http_content += "<label for=\"transition\">Transition time (s)</label>";
|
||||||
|
http_content += "<input id=\"transition\" name=\"transition\" type=\"text\" placeholder=\"10\" value=\"" + (String)default_transitiontime + "\">";
|
||||||
|
http_content += "</div>";
|
||||||
|
http_content += "<br>";
|
||||||
|
|
||||||
http_content += "<script>"
|
http_content += "<script>"
|
||||||
"let timeoutId;" // slider value change submit to server
|
"let timeoutId;" // slider value change submit to server
|
||||||
"function sendSliderValue(x) {"
|
"function sendSliderValue(x) {"
|
||||||
|
@ -722,39 +775,10 @@ void init_webserver()
|
||||||
"updateLightState();"
|
"updateLightState();"
|
||||||
"});"
|
"});"
|
||||||
"});"
|
"});"
|
||||||
|
|
||||||
// Suche nach allen tc Links auf der Seite mit IDs tc_on
|
|
||||||
"var links = document.querySelectorAll('[id^=\"tc_on\"]');"
|
|
||||||
// Füge einen Klick-Listener zu jedem Link hinzu
|
|
||||||
"links.forEach(function(link) {"
|
|
||||||
"link.addEventListener('click', function(event) {"
|
|
||||||
// Verhindere, dass der Link die Seite neu lädt
|
|
||||||
"event.preventDefault();"
|
|
||||||
// Erstelle eine neue Anfrage an die entsprechende URL
|
|
||||||
"var xhr = new XMLHttpRequest();"
|
|
||||||
"xhr.open('GET', 'http://192.168.0.26/?tc=true', true);"
|
|
||||||
// Sende die Anfrage im Hintergrund
|
|
||||||
"xhr.send();"
|
|
||||||
"updateLightState();"
|
|
||||||
"});"
|
|
||||||
"});"
|
|
||||||
// Suche nach allen tc Links auf der Seite mit IDs tc_off
|
|
||||||
"var links = document.querySelectorAll('[id^=\"tc_off\"]');"
|
|
||||||
// Füge einen Klick-Listener zu jedem Link hinzu
|
|
||||||
"links.forEach(function(link) {"
|
|
||||||
"link.addEventListener('click', function(event) {"
|
|
||||||
// Verhindere, dass der Link die Seite neu lädt
|
|
||||||
"event.preventDefault();"
|
|
||||||
// Erstelle eine neue Anfrage an die entsprechende URL
|
|
||||||
"var xhr = new XMLHttpRequest();"
|
|
||||||
"xhr.open('GET', 'http://192.168.0.26/?tc=false', true);"
|
|
||||||
// Sende die Anfrage im Hintergrund
|
|
||||||
"xhr.send();"
|
|
||||||
"updateLightState();"
|
|
||||||
"});"
|
|
||||||
"});"
|
|
||||||
"</script>";
|
"</script>";
|
||||||
|
|
||||||
|
http_content += "<form class=\"pure-form pure-form-aligned\" action=\"/\" method=\"post\">";
|
||||||
|
|
||||||
// startup state and scene for all of the lights
|
// startup state and scene for all of the lights
|
||||||
http_content += "</td><td>";
|
http_content += "</td><td>";
|
||||||
http_content += "<div id=\"plot_chart\"></div>";
|
http_content += "<div id=\"plot_chart\"></div>";
|
||||||
|
@ -793,24 +817,6 @@ void init_webserver()
|
||||||
http_content += "</select>";
|
http_content += "</select>";
|
||||||
http_content += "</div>";
|
http_content += "</div>";
|
||||||
|
|
||||||
// timing control button
|
|
||||||
http_content += "<div class=\"pure-control-group\">";
|
|
||||||
http_content += "<label for=\"tc\"><strong>Timing control</strong></label>";
|
|
||||||
int tc_val = EEPROM.read(EEPROM_TIMING_CONTROL_ENABLED_ADDRESS);
|
|
||||||
http_content += "<a id=\"tc_on\" class=\"pure-button";
|
|
||||||
if (tc_val == TIMING_CONTROL_ENABLED) http_content += " pure-button-primary";
|
|
||||||
http_content += "\" href=\"#\">ON</a>";
|
|
||||||
http_content += "<a id=\"tc_off\" class=\"pure-button";
|
|
||||||
if (tc_val == TIMING_CONTROL_DISABLED) http_content += " pure-button-primary";
|
|
||||||
http_content += "\" href=\"#\">OFF</a>";
|
|
||||||
http_content += "</div>";
|
|
||||||
http_content += "<br>";
|
|
||||||
|
|
||||||
http_content += "<div class=\"pure-control-group\">";
|
|
||||||
http_content += "<label for=\"transition\">Transition time (s)</label>";
|
|
||||||
http_content += "<input id=\"transition\" name=\"transition\" type=\"text\" placeholder=\"10\" value=\"" + (String)default_transitiontime + "\">";
|
|
||||||
http_content += "</div>";
|
|
||||||
|
|
||||||
// Wifi settings
|
// Wifi settings
|
||||||
http_content += "<br>";
|
http_content += "<br>";
|
||||||
http_content += "<h3>Wifi</h3>";
|
http_content += "<h3>Wifi</h3>";
|
||||||
|
@ -1050,8 +1056,9 @@ void init_webserver()
|
||||||
|
|
||||||
#endif // DISABLE_WEB_CONTROL
|
#endif // DISABLE_WEB_CONTROL
|
||||||
|
|
||||||
http_content += "</fieldset>";
|
|
||||||
http_content += "</form>";
|
http_content += "</form>";
|
||||||
|
http_content += "</div>";
|
||||||
|
http_content += "</fieldset>";
|
||||||
http_content += "</body>";
|
http_content += "</body>";
|
||||||
http_content += "</html>";
|
http_content += "</html>";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue