]> hackdaworld.org Git - outofuni/intres.git/commitdiff
beaglebone sync commit
authorhackbard <hackbard@hackdaworld.org>
Wed, 31 Aug 2016 10:06:21 +0000 (12:06 +0200)
committerhackbard <hackbard@hackdaworld.org>
Wed, 31 Aug 2016 10:06:21 +0000 (12:06 +0200)
css/intres.css
js/intres.js

index 59be9aa3e3a37404eca139f86faa45b8d55b89db..6331da75ad17adee81268c5f9716cc4766353c19 100644 (file)
@@ -30,6 +30,14 @@ body {
 
 /* thermos */
 
+.thermo {
+       width:99%;
+       margin-left:1%;
+       margin-bottom:1%;
+       background-color:#222;
+       float:left;
+}
+
 .thermoalias {
        margin:1%;
        width:30%;
index edbf31725b19d8ff636c9fc35b4bfac8ed973c73..84bc7059084e2222827a65fbfc92262eadb79adf 100644 (file)
@@ -13,6 +13,9 @@ var config = {
 var thermo = {
        init: function() {
                thermo.draw();
+               $('#thermo').click(function() {
+                       thermo.draw_thermos();
+               });
        },
        draw: function() {
                thermo.get_thermos();
@@ -40,8 +43,8 @@ var thermo = {
                                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+/,"");
+                               var comfort=ret.match(/comfortTem.*/)+'';
+                               comfort=comfort.replace(/.*comfortTem.*\s+/,"");
                                thermo.thermos[id]={};
                                thermo.thermos[id].alias=alias;
                                thermo.thermos[id].state=state;
@@ -51,21 +54,35 @@ var thermo = {
                        });
                }
        },
-       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>";
+       draw_thermo: function(alias,name,state,eco,comfort,type) {
+               var html="<div class=thermo>";
+               switch(type) {
+               case 'd':
+                       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>";
+                       break;
+               case 'h':
+                       html+="<div class=thermoalias><b>"+alias+"</b></div>";
+                       html+="<div class=thermoname><b>"+name+"</b></div>";
+                       html+="<div class=thermostate><b>"+state+"</b></div>";
+                       html+="<div class=thermoeco><b>"+eco+"</b></div>";
+                       html+="<div class=thermocomfort><b>"+comfort+
+                             "</b></div>";
+                       break;
+               }
+               html+="</div>";
                return html;
        },
        draw_thermos: function() {
-               var html="";
+               var html=thermo.draw_thermo('Alias','Name','State',
+                                           'Eco','Comfort','h');
                for(var i in thermo.thermos) {
                        var th=thermo.thermos[i];
                        html+=thermo.draw_thermo(th.alias,i,th.state,
-                                                th.eco,th.comfort);
+                                                th.eco,th.comfort,'d');
                }
                $('div#thermobody').html(html);
        }