unified javascript for realraum pages
authorBernhard Tittelbach <xro@realraum.at>
Wed, 14 Aug 2013 21:34:08 +0000 (21:34 +0000)
committerBernhard Tittelbach <xro@realraum.at>
Wed, 14 Aug 2013 21:34:08 +0000 (21:34 +0000)
raspberry-kiosk/kiosk.css
raspberry-kiosk/kiosk.html
raspberry-kiosk/kiosk.js
raspberry-kiosk/kiosk1.html [new file with mode: 0644]
raspberry-kiosk/kiosk2cal.html [new file with mode: 0644]

index 145920e..9aa7ff1 100644 (file)
@@ -7,8 +7,6 @@ body {
   margin:0;
   background-color: #D0D0AF;
   overflow: hidden;
-  max-width:900px;
-  max-height:1440px;
 }
 
 div {
@@ -43,6 +41,21 @@ div.headerphoto {
   margin-top:10px;
 }
 
+img.headerphoto2 {
+  width:100%;
+  margin: -70px 0 0 0px;
+}
+
+div.headerphoto2 {
+  display:block;
+  width: 100%;
+  height: 285px;
+  overflow: hidden;
+  padding: 0.1em 0;
+  text-align: center;
+  margin-top:10px;
+}
+
 div.contentborder,
 div.calendar,
 div.sensorgraphs,
index 2aabd39..14645bf 100644 (file)
@@ -3,12 +3,12 @@
   <meta charset="utf-8">
   <title>Realraum Kiosk Seite</title>
   <link rel="stylesheet" href="kiosk.css" type="text/css" />
-  <script src="/jquery.min.js"></script>
+  <script type="text/javascript" src="/jquery.min.js"></script>
   <!--script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script-->
   <!--script src="/purl.js"></script-->
   <script type="text/javascript" src="kiosk.js"></script>
  </head>
- <body>
+ <body style="max-width:900px; max-height:1440px;">
   <div id="dateclock"></div>
   <div id="siteheader">Neuigkeiten auf <span style="font-size:110%;">http://realraum.at</span></div>
   <div id="headerphoto" class="headerphoto">
@@ -16,7 +16,7 @@
   </div>
   <div class="calendar">
     <p class="topic">Veranstaltungskalender</p>
-    <div id="grical_upcoming">Kalendar lädt ...</div>
+    <div id="grical_upcoming_kiosk">Kalendar lädt ...</div>
   </div>
    <!-- Sensor Data ------------------------ -->
  <table border="0" cellpadding="0" cellspacing="0"><tr>
@@ -25,7 +25,7 @@
     <p class="topic">Sensordaten</p>
     <div class="sensorelem">
     <table class="status" style="">
-    <tr><td id="anwesenheit_status" style="height:100px; border:0px none black;">Lädt ...</td></tr>
+    <tr><td id="anwesenheit_status_kiosk" style="height:100px; border:0px none black;">Lädt ...</td></tr>
     <tr><td id="sensor_status" style="border:0px none black; margin-top:5px;">Lädt ...</td></tr>
     </table>
     </div>
index 1553712..253b2d1 100644 (file)
@@ -107,7 +107,7 @@ function weekday2str(dow)
         return "";
 }
 
-function calendarItemIterator(data)
+function calendarItemEnhancer(data)
 {
     for (var s=0; s<data.length; s++)
     {
@@ -134,20 +134,19 @@ function calendarItemIterator(data)
         if (stime.length <= 2) { stime+="h"; }
         when = weekday + " " + dayofmonth+"."+month +", "+stime;
       }
-      var itm = data[s];
-         itm.when = when;
-         yield itm;
+      data[s].when = when
     }
+    return data
 }
 
 function loadCalendarKiosk()
 {
-  var calcontainer=document.getElementById("grical_upcoming");
+  var calcontainer=document.getElementById("grical_upcoming_kiosk");
   $.getJSON('/shmcache/grical_realraum.json', function(data){
     var calhtml = "";
-    for (var itm in calendarItemIterator(data)) {
-      calhtml += '<li class="level1">'+when+' - <span class="r3red">'+data[s].title+'</span></li>'+"\n";
-    }
+    $.each(calendarItemEnhancer(data), function(index, itm) {
+      calhtml += '<li class="level1">'+itm.when+' - <span class="r3red">'+itm.title+'</span></li>'+"\n";        
+    });
     calcontainer.innerHTML='<ul>'+calhtml+'</ul>';
   });
 }
@@ -158,9 +157,9 @@ function loadCalendarMainPage()
   var calcontainer=document.getElementById("grical_upcoming");
   $.getJSON('/shmcache/grical_realraum.json', function(data){
     var calhtml = "";
-    for (var itm in calendarItemIterator(data)) {
-      calhtml += '<li class="level1"><div class="li">'+when+' - <a href="'+data[s].url+'" class="urlextern" title="'+data[s].title+'"  rel="nofollow">'+data[s].title+'</a></div></li>'+"\n";
-    }
+    $.each(calendarItemEnhancer(data), function(index, itm) {
+      calhtml += '<li class="level1"><div class="li">'+itm.when+' - <a href="'+itm.url+'" class="urlextern" title="'+itm.title+'"  rel="nofollow">'+itm.title+'</a></div></li>'+"\n";
+    });
     calcontainer.innerHTML='<ul>'+calhtml+'</ul>';
   });
 }
@@ -181,8 +180,16 @@ function writeAnwesenheitStatus(data)
    iconuri=data.icon.closed;
    statuscolor="red";
   }
-  html='<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100"><tr><td style="width:100px;"><img style="float:left;" src="'+iconuri+'" height="100" width="100"/></td><td style="width:4px;"></td><td class="anwesenheitsstatus" style="background-color:'+statuscolor+'; ">'+data.status+'</td></tr></table>';
-  document.getElementById('anwesenheit_status').innerHTML=html;
+  var anwesenheit_status_kiosk = document.getElementById('anwesenheit_status_kiosk');
+  var anwesenheit_status_frontpage = document.getElementById('anwesenheit_status');
+  if (anwesenheit_status_kiosk)
+  {
+    anwesenheit_status_kiosk.innerHTML='<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100"><tr><td style="width:100px;"><img style="float:left;" src="'+iconuri+'" height="100" width="100"/></td><td style="width:4px;"></td><td class="anwesenheitsstatus" style="background-color:'+statuscolor+'; ">'+data.status+'</td></tr></table>';
+  }
+  if (anwesenheit_status_frontpage)
+  {
+    anwesenheit_status_frontpage.innerHTML='<table border="0" cellpadding="0" cellspacing="0" width="100%" height="42"><tr><td style="width:42px;"><img style="float:left;" src="'+iconuri+'" height="42" width="42"/></td><td style="width:4px;"></td><td style="background-color:'+statuscolor+'; height:42px; text-align:center; margin-left:48px; margin-right:auto; font-size:larger; font-weight:bold; vertical-align:middle; display:table-cell;">'+data.status+'</td></tr></table>';
+  }
   
   if (data.sensors)
   {
@@ -342,13 +349,30 @@ function reloadImg(element)
 
 $(document).ready(function()
 {
-  updateDateClock(new Date());
-  setInterval("clock()", 500);
   updateAnwesenheitStatus();
-  loadCalendarKiosk();
-  loadGooglePlusEvents();
-  setInterval("updateAnwesenheitStatus()", 10*1000);
-  setInterval("loadCalendarKiosk()", 123*1000);
-  setInterval("updateSensors()",145*1000);
-  setInterval("loadGooglePlusEvents()", 1207*1000);
+  setInterval("updateAnwesenheitStatus()", 10*1000);    
+  if (document.getElementById("dateclock"))
+  {
+    updateDateClock(new Date());
+    setInterval("clock()", 500);
+  }
+  if (document.getElementById("grical_upcoming_kiosk"))
+  {
+    loadCalendarKiosk();
+    setInterval("loadCalendarKiosk()", 123*1000);
+  }
+  if (document.getElementById("grical_upcoming"))
+  {
+    loadCalendarMainPage();
+    setInterval("loadCalendarMainPage()", 123*1000);
+  }
+  if (document.getElementById("sensorgraphs"))
+  {
+    setInterval("updateSensors()",145*1000);
+  }
+  if (document.getElementById("gplusevents"))
+  {
+    loadGooglePlusEvents();
+    setInterval("loadGooglePlusEvents()", 1207*1000);
+  }
 });
diff --git a/raspberry-kiosk/kiosk1.html b/raspberry-kiosk/kiosk1.html
new file mode 100644 (file)
index 0000000..33f3426
--- /dev/null
@@ -0,0 +1,47 @@
+<html>
+  <head>
+  <meta charset="utf-8">
+  <title>Realraum Kiosk Seite</title>
+  <link rel="stylesheet" href="kiosk.css" type="text/css" />
+  <script type="text/javascript" src="/jquery.min.js"></script>
+  <!--script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script-->
+  <!--script src="/purl.js"></script-->
+  <script type="text/javascript" src="kiosk.js"></script>
+ </head>
+ <body style="max-width:900px; max-height:1440px;">
+  <div id="dateclock"></div>
+  <div id="headerphoto" class="headerphoto">
+  <img class="headerphoto" src="http://realraum.at/wiki/lib/exe/fetch.php?media=xro:realraum_hdr.jpg"></img>
+  </div>
+   <!-- Sensor Data ------------------------ -->
+ <table border="0" cellpadding="0" cellspacing="0"><tr>
+ <td style="vertical-align:top; padding-right:2px;">
+  <div class="sensorgraphs">
+    <p class="topic">Sensordaten</p>
+    <div class="sensorelem">
+    <table class="status" style="">
+    <tr><td id="anwesenheit_status_kiosk" style="height:100px; border:0px none black;">Lädt ...</td></tr>
+    <tr><td id="sensor_status" style="border:0px none black; margin-top:5px;">Lädt ...</td></tr>
+    </table>
+    </div>
+    <div class="sensorelem">
+     <img id="tempsensor" class="sensorimg" src="http://realraum.at/shmcache/temp0.png"/>
+    </div>
+    <div class="sensorelem">
+      <img id="lightsensor" class="sensorimg" src="http://realraum.at/shmcache/light0.png"/>
+    </div>
+    <div class="sensorelem">
+      <img id="movementsensor" class="sensorimg" src="http://realraum.at/shmcache/movement.png"/>
+    </div>
+  </div>
+  
+  </td><td style="vertical-align:top;">
+
+   <div class="gpluswall">
+    <p class="topic">Google+</p>
+    <div id="gplusevents">Lädt ...</div>
+   </div>
+  </td></tr>
+  </table>
+</body>
+</html>
diff --git a/raspberry-kiosk/kiosk2cal.html b/raspberry-kiosk/kiosk2cal.html
new file mode 100644 (file)
index 0000000..6252fea
--- /dev/null
@@ -0,0 +1,22 @@
+<html>
+  <head>
+  <meta charset="utf-8">
+  <title>Realraum Kiosk Seite</title>
+  <link rel="stylesheet" href="kiosk.css" type="text/css" />
+  <script type="text/javascript" src="/jquery.min.js"></script>
+  <!--script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script-->
+  <!--script src="/purl.js"></script-->
+  <script type="text/javascript" src="kiosk.js"></script>
+ </head>
+ <body style="max-width:1024px; max-height:768px;">
+  <div id="dateclock"></div>
+  <div id="siteheader">Neuigkeiten auf <span style="font-size:110%;">http://realraum.at</span></div>
+  <div id="headerphoto2" class="headerphoto2">
+  <img class="headerphoto2" src="http://realraum.at/wiki/lib/exe/fetch.php?media=xro:realraum_hdr.jpg"></img>
+  </div>
+  <div class="calendar">
+    <p class="topic">Veranstaltungskalender</p>
+    <div id="grical_upcoming_kiosk">Kalendar lädt ...</div>
+  </div>
+</body>
+</html>