X-Git-Url: https://git.realraum.at/?a=blobdiff_plain;f=raspberry-kiosk%2Fkiosk.js;h=0c90e4ed720ce0981dd838402519896e7c87f32b;hb=7867988775a7b6ec1604a863b665e46ac91e70ac;hp=cb3c3c4e5c05664aec28bb54ec5083b97532b726;hpb=51c1575c1ed3eeee6099bc1b4760a4ebc75ac876;p=svn42.git
diff --git a/raspberry-kiosk/kiosk.js b/raspberry-kiosk/kiosk.js
index cb3c3c4..0c90e4e 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.actor.image.url+')
'+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 += '![]('+noteimgs[0]+') | ';
+ for (var ni=1; ni';
+ var niimax = min(noteimgs.length, ni+3);
+ for (var nii=ni; nii
';
+ }
+ ghtml += '';
+ }
+ }
+ else
{
- ghtml += '![]('+noteimgs[ni]+') | ';
+ var gplusimgmaxwidth = gplusimgwidth / noteimgs.length;
+ bigimglimit = "max-width:"+gplusimgmaxwidth+"px;"
+ for (var ni=0; ni
';
+ }
}
ghtml += '
';
}
@@ -135,20 +168,47 @@ function writeAnwesenheitStatus(data)
if (data.sensors)
{
- for (var s=0; s'+stype+'
'+swhere+': '+svalue+'';
- });
+ $.each( data.sensors.temperature, function(s, sensorobj) {
+ sensorstd+='Temperatur '+sensorobj.location+': '+sensorobj.value.toFixed(2)+sensorobj.unit+' | ';
});
}
- }
- if (sensorstd != "")
- {
- sensorshtml='';
- document.getElementById('sensor_status').innerHTML=sensorshtml;
- }
+ if (data.sensors.ext_illumination)
+ {
+ $.each( data.sensors.ext_illumination, function(s, sensorobj) {
+ sensorstd+='Licht '+sensorobj.location+': '+sensorobj.value+' | ';
+ });
+ }
+ if (data.sensors.door_locked)
+ {
+ $.each( data.sensors.door_locked, function(s, sensorobj) {
+ var lockstatus="Unlocked";
+ if (sensorobj.value) { lockstatus = "Locked"; }
+ sensorstd+='Türschloà '+sensorobj.location+': '+lockstatus+' | ';
+ });
+ }
+ if (data.sensors.ext_door_ajar)
+ {
+ $.each( data.sensors.ext_door_ajar, function(s, sensorobj) {
+ var lockstatus="Shut";
+ if (sensorobj.value) { lockstatus = "Ajar"; }
+ sensorstd+='Türkontakt '+sensorobj.location+': '+lockstatus+' | ';
+ });
+ }
+ if (data.sensors.ext_dust)
+ {
+ $.each( data.sensors.ext_dust, function(s, sensorobj) {
+ sensorstd+='Staub '+sensorobj.location+': '+sensorobj.value+sensorobj.unit+' | ';
+ });
+
+ }
+ if (sensorstd != "")
+ {
+ sensorshtml='';
+ document.getElementById('sensor_status').innerHTML=sensorshtml;
+ }
+ }
}
function updateAnwesenheitStatus()