kiosk g+ support albums
[svn42.git] / raspberry-kiosk / kiosk.js
index b090f24..6d7c33e 100644 (file)
@@ -12,7 +12,11 @@ function writeGooglePlusEvents(data, elem)
     {
       for (var a=0; a<attach.length; a++)
       {
-        if ( attach[a].objectType == "photo")
+        if ( attach[a].objectType == "album")
+        {
+          noteimg = attach[a].thumbnails[0].image.url;
+        }
+        else if ( attach[a].objectType == "photo")
         {
           noteimg = attach[a].image.url;
         }
@@ -23,7 +27,7 @@ function writeGooglePlusEvents(data, elem)
       }
     }
     ghtml += '<div class="gpluspost">'
-    ghtml += '<img class="gplusactor" src="'+item.actor.image.url+'"/><p class="gplustimestamp">'+item.updated+'</p>';
+    ghtml += '<img class="gplusactor" src="'+item.actor.image.url+'"/><p class="gplustimestamp">'+item.updated.substring(0,16).replace("T"," ")+'</p>';
     ghtml += '<p class="gplustxt">'+notetxt+'</p>';
     if (noteimg)
     {
@@ -37,7 +41,8 @@ function writeGooglePlusEvents(data, elem)
 
 function loadGooglePlusEvents()
 {
-  var gplusuri = "https://www.googleapis.com/plus/v1/people/113737596421797426873/activities/public?maxResults=3&key="+gplusapikey;
+  var gpak = "AIzaSyD9xBFM-KWwSYBgZ8VzftJ5wYYvurOxEHg";
+  var gplusuri = "https://www.googleapis.com/plus/v1/people/113737596421797426873/activities/public?maxResults=4&key="+gpak;
   var gpluscontainer=document.getElementById("gplusevents");
   gpluscontainer.innerHTML="Plus loading ...";
   $.getJSON(gplusuri, function(data){
@@ -64,9 +69,10 @@ function writeCalendar(data, elem)
         {
           stime=stime.substring(0,stime.length-3);
         }
-        when = data[s].start +", "+stime+" Uhr";
+        if (stime.length <= 2) { stime+="h"; }
+        when = data[s].start.substring(8,10)+"."+data[s].start.substring(5,7) +", "+stime;
       }
-      calhtml += '<li class="level1"><span class="r3red">'+when+'</span> - '+data[s].title+'</li>'+"\n";
+      calhtml += '<li class="level1">'+when+' - <span class="r3red">'+data[s].title+'</span></li>'+"\n";
     }
     elem.innerHTML='<ul>'+calhtml+'</ul>';
 }
@@ -104,7 +110,7 @@ function writeAnwesenheitStatus(data)
     {
       $.each( data.sensors[s], function(stype, std){
         $.each( std, function(swhere, svalue){
-           sensorstd+='<td style="background-color:white; height:42px; text-align:center; vertical-align:middle; display:table-cell;"><b>'+stype+'</b><br/>'+swhere+': '+svalue+'</td>';
+           sensorstd+='<td class="sensorstatus"><b>'+stype+'</b><br/>'+swhere+': '+svalue+'</td>';
         });
       });
     }
@@ -147,9 +153,9 @@ $(document).ready(function()
   loadCalendar();
   loadGooglePlusEvents();
   setInterval("updateAnwesenheitStatus()", 10000);
-  setInterval("loadCalendar()", 100000);
-  setInterval("updateSensors()", 50000);
-  setInterval("loadGooglePlusEvents()", 3600*1000);
+  setInterval("loadCalendar()", 123*1000);
+  setInterval("updateSensors()",125*1000);
+  setInterval("loadGooglePlusEvents()", 1207*1000);
 });
 
 function updateDateClock(now)