X-Git-Url: https://git.realraum.at/?a=blobdiff_plain;f=raspberry-kiosk%2Fkiosk.js;h=da4df7704576bf948524ca9594a13df7b83aa265;hb=a5a4ac7a8733c31c14065230127c7836ac0de4f6;hp=cb3c3c4e5c05664aec28bb54ec5083b97532b726;hpb=51c1575c1ed3eeee6099bc1b4760a4ebc75ac876;p=svn42.git diff --git a/raspberry-kiosk/kiosk.js b/raspberry-kiosk/kiosk.js index cb3c3c4..da4df77 100644 --- a/raspberry-kiosk/kiosk.js +++ b/raspberry-kiosk/kiosk.js @@ -1,6 +1,17 @@ +function min(a,b) +{ + if (a > b) + return b; + else + return a; +} + function writeGooglePlusEvents(data, elem) { var ghtml = ""; + //var gplusimgwidth = parseInt($('').css("width")); + var gplusimgwidth = 495; + var minimgwidth=78; for (var i=0; i< data.items.length; i++) { var item = data.items[i]; @@ -33,11 +44,33 @@ function writeGooglePlusEvents(data, elem) ghtml += '

'+item.updated.substring(0,16).replace("T"," ")+'

'; ghtml += '

'+notetxt+'

'; if (noteimgs.length>0) - { + { + var bigimglimit; ghtml += '
'; - for (var ni=0; ni 3) + { + var gplusimgmaxwidth = gplusimgwidth - (minimgwidth * ((noteimgs.length -1) / 3)); + bigimglimit = "max-height:"+(minimgwidth*3)+"px; max-width:"+gplusimgmaxwidth+"px;" + ghtml += ''; + for (var ni=1; ni
'; + } + ghtml += ''; + } + } + else { - ghtml += '
'; + var gplusimgmaxwidth = gplusimgwidth / noteimgs.length; + bigimglimit = "max-width:"+gplusimgmaxwidth+"px;" + for (var ni=0; ni'; + } } ghtml += '
'; } @@ -133,21 +166,58 @@ function writeAnwesenheitStatus(data) html='
'+data.status+'
'; document.getElementById('anwesenheit_status').innerHTML=html; - if (data.sensors) +if (data.sensors) { - for (var s=0; s
'+swhere+': '+svalue+''; - }); + sensorstd+='Temperatur'; + $.each( data.sensors.temperature, function(s, sensorobj) { + sensorstd+='
'+sensorobj.location+': '+sensorobj.value.toFixed(2)+sensorobj.unit; }); + sensorstd+=''; + } + if (data.sensors.ext_illumination) + { + sensorstd+='Licht'; + $.each( data.sensors.ext_illumination, function(s, sensorobj) { + sensorstd+='
'+sensorobj.location+': '+sensorobj.value; + }); + sensorstd+=''; + } + if (data.sensors.door_locked) + { + sensorstd+='Eingangstür'; + $.each( data.sensors.door_locked, function(s, sensorobj) { + var lockstatus="Auf"; + if (sensorobj.value) { lockstatus = "Zu"; } + sensorstd+='
'+sensorobj.location+': '+lockstatus; + }); + sensorstd+=''; + } + if (data.sensors.ext_door_ajar) + { + sensorstd+='Türkontakt'; + $.each( data.sensors.ext_door_ajar, function(s, sensorobj) { + var lockstatus="Auf"; + if (sensorobj.value) { lockstatus = "Zu"; } + sensorstd+='
'+sensorobj.location+': '+lockstatus; + }); + sensorstd+=''; + } + if (data.sensors.ext_dust) + { + sensorstd+='Staub'; + $.each( data.sensors.ext_dust, function(s, sensorobj) { + sensorstd+='
'+sensorobj.location+': '+sensorobj.value+sensorobj.unit+''; + }); + sensorstd+=''; + + } + if (sensorstd != "") + { + sensorshtml=''+sensorstd+'
'; + document.getElementById('sensor_status').innerHTML=sensorshtml; } - } - if (sensorstd != "") - { - sensorshtml=''+sensorstd+'
'; - document.getElementById('sensor_status').innerHTML=sensorshtml; } }