]> hackdaworld.org Git - outofuni/intres.git/commitdiff
thermos
authorhackbard <hackbard@hackdaworld.org>
Sun, 31 Jan 2016 16:15:38 +0000 (17:15 +0100)
committerhackbard <hackbard@hackdaworld.org>
Sun, 31 Jan 2016 16:15:38 +0000 (17:15 +0100)
css/intres.css
js/intres.js

index bf19843f8932118865fe9172700767d36441ce84..59be9aa3e3a37404eca139f86faa45b8d55b89db 100644 (file)
@@ -27,3 +27,36 @@ body {
        width:95%;
 }
 
+
+/* thermos */
+
+.thermoalias {
+       margin:1%;
+       width:30%;
+       float:left;
+}
+
+.thermoname {
+       margin:1%;
+       width:20%;
+       float:left;
+}
+
+.thermostate {
+       margin:1%;
+       width:10%;
+       float:left;
+}
+
+.thermoeco {
+       margin:1%;
+       width:10%;
+       float:left;
+}
+
+.thermocomfort {
+       margin:1%;
+       width:10%;
+       float:left;
+}
+
index abfce1594e1003d83ef950bbbedad62fc9e7c7c7..edbf31725b19d8ff636c9fc35b4bfac8ed973c73 100644 (file)
@@ -38,21 +38,36 @@ var thermo = {
                                alias=alias.replace(/alias\s+/,"");
                                var state=ret.match(/STATE.*/)+'';
                                state=state.replace(/STATE\s+/,"");
+                               var eco=ret.match(/ecoTemperature.*/)+'';
+                               eco=eco.replace(/.*ecoTemperature\s+/,"");
+                               var comfort=ret.match(/comfortTemperature.*/)+'';
+                               comfort=comfort.replace(/.*comfortTemperature\s+/,"");
                                thermo.thermos[id]={};
                                thermo.thermos[id].alias=alias;
-                               thermo.thermos[id].temp=state;
+                               thermo.thermos[id].state=state;
+                               thermo.thermos[id].eco=eco;
+                               thermo.thermos[id].comfort=comfort;
                                thermo.draw_thermos();
                        });
                }
        },
+       draw_thermo: function(alias,name,state,eco,comfort) {
+               var html="";
+               html+="<div class=thermoalias>"+alias+"</div>";
+               html+="<div class=thermoname>"+name+"</div>";
+               html+="<div class=thermostate>"+state+"</div>";
+               html+="<div class=thermoeco>"+eco+"</div>";
+               html+="<div class=thermocomfort>"+comfort+"</div>";
+               return html;
+       },
        draw_thermos: function() {
                var html="";
                for(var i in thermo.thermos) {
                        var th=thermo.thermos[i];
-                       html+=th.alias+" "+th.temp+"<br>";
+                       html+=thermo.draw_thermo(th.alias,i,th.state,
+                                                th.eco,th.comfort);
                }
-               tdiv=$('div#thermobody');
-               tdiv.html(html);
+               $('div#thermobody').html(html);
        }
 };