X-Git-Url: https://hackdaworld.org/gitweb/?p=outofuni%2Fintres.git;a=blobdiff_plain;f=js%2Fintres.js;fp=js%2Fintres.js;h=84bc7059084e2222827a65fbfc92262eadb79adf;hp=edbf31725b19d8ff636c9fc35b4bfac8ed973c73;hb=53f9a32e5440e6f7916169b332a98dfb1fed0e3d;hpb=b7355fb9902ebc88d3112881cee8fda558b7025b 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); }