var thermo = {
init: function() {
thermo.draw();
+ $('#thermo').click(function() {
+ thermo.draw_thermos();
+ });
},
draw: function() {
thermo.get_thermos();
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;
});
}
},
- 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);
}