diff options
author | xengineering <me@xengineering.eu> | 2022-05-15 11:53:40 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2022-05-15 11:56:00 +0200 |
commit | 466dd4caeac90dace337c6604e770f0470aee495 (patch) | |
tree | 0f9cbde1a5e67f62ca90e045cf1f3d0c7ea4ff18 /index.html.tmpl | |
download | webiot-466dd4caeac90dace337c6604e770f0470aee495.tar webiot-466dd4caeac90dace337c6604e770f0470aee495.tar.zst webiot-466dd4caeac90dace337c6604e770f0470aee495.zip |
Publish code
Diffstat (limited to 'index.html.tmpl')
-rw-r--r-- | index.html.tmpl | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/index.html.tmpl b/index.html.tmpl new file mode 100644 index 0000000..0991771 --- /dev/null +++ b/index.html.tmpl @@ -0,0 +1,50 @@ +<!DOCTYPE html> + +<!-- + vim: shiftwidth=4 tabstop=4 noexpandtab +--> + +<html> + + <head> + + <title>IoT</title> + + <meta charset="utf-8"/> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <link rel="stylesheet" href="./webiot.css" type="text/css"> + + </head> + + <body> + + <main> + + <h1>IoT</h1> + <h3>WiFi plugs</h3> + + {{range .Hs100}} + <div class="card"> + <h3 class="card-first-item">{{.Name}}</h3> + <button onclick="api('{{.Ip}}', 'on')">on</button> + <button class="card-last-item" onclick="api('{{.Ip}}', 'off')">off</button> + </div> + {{end}} + + <script> + function api(host, state) { + const xhttp = new XMLHttpRequest(); + xhttp.open( + "POST", + "/api?host=" + host + "&state=" + state, + true + ); + xhttp.send(); + } + </script> + + </main> + + </body> + +</html> |