diff options
Diffstat (limited to 'appdata')
-rw-r--r-- | appdata/index.html.tmpl | 49 | ||||
l--------- | appdata/webiot.css | 1 |
2 files changed, 50 insertions, 0 deletions
diff --git a/appdata/index.html.tmpl b/appdata/index.html.tmpl new file mode 100644 index 0000000..17c67c1 --- /dev/null +++ b/appdata/index.html.tmpl @@ -0,0 +1,49 @@ +<!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> + + {{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> diff --git a/appdata/webiot.css b/appdata/webiot.css new file mode 120000 index 0000000..9dd798c --- /dev/null +++ b/appdata/webiot.css @@ -0,0 +1 @@ +../libweb/libweb.css
\ No newline at end of file |