From: hackbard Date: Sun, 31 Jan 2016 16:15:38 +0000 (+0100) Subject: thermos X-Git-Url: https://www.hackdaworld.org/gitweb/?p=outofuni%2Fintres.git;a=commitdiff_plain;h=b7355fb9902ebc88d3112881cee8fda558b7025b thermos --- diff --git a/css/intres.css b/css/intres.css index bf19843..59be9aa 100644 --- a/css/intres.css +++ b/css/intres.css @@ -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; +} + diff --git a/js/intres.js b/js/intres.js index abfce15..edbf317 100644 --- a/js/intres.js +++ b/js/intres.js @@ -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+="
"+alias+"
"; + html+="
"+name+"
"; + html+="
"+state+"
"; + html+="
"+eco+"
"; + html+="
"+comfort+"
"; + return html; + }, draw_thermos: function() { var html=""; for(var i in thermo.thermos) { var th=thermo.thermos[i]; - html+=th.alias+" "+th.temp+"
"; + html+=thermo.draw_thermo(th.alias,i,th.state, + th.eco,th.comfort); } - tdiv=$('div#thermobody'); - tdiv.html(html); + $('div#thermobody').html(html); } };