Mercurial > code > home > repos > homeauto
annotate service/frontDoorLock/simple.html @ 1427:6bd36e5e109f
whitespace
Ignore-this: 8abcbd0552c4356db0073b464fc3816a
darcs-hash:2917f14b52fb149530a2369486ca9876cb0d334a
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Thu, 08 Aug 2019 16:48:40 -0700 |
parents | baf1acaa9ac9 |
children |
rev | line source |
---|---|
1379
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
1 <!doctype html> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
2 <html> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
3 <head> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
4 <title>front door lock simple</title> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
5 <meta charset="utf-8" /> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
6 <meta name="mobile-web-app-capable" content="yes"> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
7 <meta name="viewport" content="width=device-width, initial-scale=1"> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
8 </head> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
9 <body> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
10 |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
11 <style> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
12 button { |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
13 min-width: 60px; |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
14 min-height: 40px; |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
15 } |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
16 </style> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
17 |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
18 <p>Simple door control:</p> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
19 |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
20 <button id="lock">Lock now</button> <button id="unlock">Unlock now</button> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
21 |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
22 <div id="result"></div> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
23 |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
24 <script> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
25 (()=>{ |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
26 |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
27 const send = (state) => { |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
28 const resultReport = document.querySelector('#result'); |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
29 resultReport.innerText = 'sending..'; |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
30 fetch('../simpleState', { |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
31 method: 'POST', |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
32 body: state, |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
33 headers: new Headers({ |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
34 'Content-type': 'text/plain' |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
35 })}).then((resp) => { |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
36 resultReport.innerText = `ok=${resp.ok}`; |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
37 }); |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
38 resultReport.innerText = 'sending....'; |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
39 }; |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
40 document.querySelector('#lock').addEventListener('click', () => { send('lock'); }); |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
41 document.querySelector('#unlock').addEventListener('click', () => { send('unlock'); }); |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
42 })(); |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
43 </script> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
44 |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
45 <style> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
46 .served-resources { |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
47 margin-top: 4em; |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
48 border-top: 1px solid gray; |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
49 padding-top: 1em; |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
50 } |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
51 .served-resources a { |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
52 padding-right: 2em; |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
53 } |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
54 </style> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
55 |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
56 <div class="served-resources"> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
57 <a href="../">root</a> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
58 <a href="../simple">/simple/</a> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
59 <a href="../stats/">/stats/</a> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
60 <a href="../graph">/graph</a> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
61 <a href="../graph/events">/graph/events</a> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
62 <a href="../output">(post) output</a> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
63 </div> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
64 </body> |
baf1acaa9ac9
new simple mode that can set the door without rdf
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
65 </html> |