From: hackbard Date: Wed, 31 Aug 2016 10:06:21 +0000 (+0200) Subject: beaglebone sync commit X-Git-Url: https://www.hackdaworld.org/gitweb/?p=outofuni%2Fintres.git;a=commitdiff_plain;h=53f9a32e5440e6f7916169b332a98dfb1fed0e3d beaglebone sync commit --- diff --git a/css/intres.css b/css/intres.css index 59be9aa..6331da7 100644 --- a/css/intres.css +++ b/css/intres.css @@ -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%; diff --git a/js/intres.js b/js/intres.js index edbf317..84bc705 100644 --- a/js/intres.js +++ b/js/intres.js @@ -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+="
"+alias+"
"; - html+="
"+name+"
"; - html+="
"+state+"
"; - html+="
"+eco+"
"; - html+="
"+comfort+"
"; + draw_thermo: function(alias,name,state,eco,comfort,type) { + var html="
"; + switch(type) { + case 'd': + html+="
"+alias+"
"; + html+="
"+name+"
"; + html+="
"+state+"
"; + html+="
"+eco+"
"; + html+="
"+comfort+"
"; + break; + case 'h': + html+="
"+alias+"
"; + html+="
"+name+"
"; + html+="
"+state+"
"; + html+="
"+eco+"
"; + html+="
"+comfort+ + "
"; + break; + } + html+="
"; 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); }