js inhibit caching of sensor pic
authorBernhard Tittelbach <xro@realraum.at>
Wed, 24 Apr 2013 12:07:40 +0000 (12:07 +0000)
committerBernhard Tittelbach <xro@realraum.at>
Wed, 24 Apr 2013 12:07:40 +0000 (12:07 +0000)
raspberry-kiosk/kiosk.html
raspberry-kiosk/kiosk.js

index e7e4c20..3c535c1 100644 (file)
@@ -4,6 +4,7 @@
   <title>Realraum Kiosk Seite</title>
   <script 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>
   <link rel="stylesheet" href="kiosk.css" type="text/css" />
  </head>
index a4c31d6..29f7ba8 100644 (file)
@@ -148,7 +148,7 @@ $(document).ready(function()
   loadGooglePlusEvents();
   setInterval("updateAnwesenheitStatus()", 10*1000);
   setInterval("loadCalendar()", 123*1000);
-  setInterval("updateSensors()",125*1000);
+  setInterval("updateSensors()",145*1000);
   setInterval("loadGooglePlusEvents()", 1207*1000);
 });
 
@@ -212,16 +212,20 @@ function IsImageOk(img) {
     return true;
 }
 
+var img_orig_src = {};
 function reloadImg(element)
 {
-    //var image = document.getElementById("theText");
     if(element.complete)
     {
       var new_image = new Image();
       //set up the new image
       new_image.id = element.id;
       new_image.className = element.className;
-      new_image.src = element.src;
+      if (! img_orig_src[element.id])
+      {
+        img_orig_src[element.id] = element.src;
+      }
+      new_image.src = img_orig_src[element.id] + "&dt="+Math.floor(new Date().getTime() / 1000).toString();
       if (IsImageOk(new_image))
       {
         element.parentNode.insertBefore(new_image,element);