diff options
Diffstat (limited to 'appdata/index.html.tmpl')
-rw-r--r-- | appdata/index.html.tmpl | 49 |
1 files changed, 49 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> |