Enabled HTTP chunked transfer encoding
[ampy.git] / html / index_unchuncked.php
1 <!DOCTYPE html>
2 <meta charset="UTF-8">
3 <link rel="shortcut icon" href="favicon.svg">
4 <title>ampy - Le compteur espion qui ne moucharde pas</title>
5 <script src='/javascript/jquery/jquery.js'></script>
6 <script src=ampy.js></script>
7 div#errorpannel
8 {
9     position: absolute;
10     top: 3px;
11     right: 15px;
12     height: 18px;
13     padding: 1px 2px 1px 2px;
14     background: red;
15 }
16 </style>
17 <div id=errorpannel style="display:none;">
18 </div>
19
20 Puissance instantannĂ©e: <span id=currentpower>unknown</span> watts
21
22 -
23
24 Compteur: <span id=totalpower>unknown</span> kWh
25
26 -
27
28 Graphique:
29 <a href='javascript:refresh_graph(0,5)'>5m</a> 
30 <a href='javascript:refresh_graph(0,30)'>30m</a> 
31 <a href='javascript:refresh_graph(1)'>1h</a> 
32 <a href='javascript:refresh_graph(2)'>2h</a>
33 <a href='javascript:refresh_graph(6)'>6h</a>
34 <a href='javascript:refresh_graph(12)'>12h</a>
35 <a href='javascript:refresh_graph(24)'>1d</a>
36 <a href='javascript:refresh_graph(2*24)'>2d</a>
37 <a href='javascript:refresh_graph(7*24)'>7d</a>
38 <a href='javascript:refresh_graph(30*24)'>30d</a>
39
40 <br>
41
42 <img id='loadcurve' src='graph.php'>
43
44
45
46 <script>
47 function refresh_data() {
48         $.ajax({
49                 url : 'currentjson.php',
50                 dataType: 'text',
51                 success : function(result) {
52                         updatePage(result);
53                 },
54                 complete : function() {
55                         setTimeout(refresh_data, 1000);
56                 }
57         });
58 }
59 function refresh_graph(hours=0, minutes=0) {
60         img = document.getElementById('loadcurve');
61         img.src = 'graph.php?h='+hours+'&m='+minutes+'&t='+new Date().getTime();
62 }
63 </script>
64 <script>refresh_data();</script>