X-Git-Url: https://git.realraum.at/?p=svn42.git;a=blobdiff_plain;f=raspberry-kiosk%2Fkiosk.js;h=d453cda77365277c6a4944c83878251098a9151f;hp=6d7c33e7ce6b451fb597eaa5726b9ac750a04e14;hb=d305767f69ed6aebf3cd1ccc8e2bf9746a63d822;hpb=7e8e5a5ba8dd7940ba01c14c218fd9dd36bb4774 diff --git a/raspberry-kiosk/kiosk.js b/raspberry-kiosk/kiosk.js index 6d7c33e..d453cda 100644 --- a/raspberry-kiosk/kiosk.js +++ b/raspberry-kiosk/kiosk.js @@ -44,7 +44,6 @@ function loadGooglePlusEvents() 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){ writeGooglePlusEvents(data, gpluscontainer); }); @@ -80,7 +79,6 @@ function loadCalendar() { //old URI: //grical.realraum.at/s/?query=!realraum&limit=9&view=json var calcontainer=document.getElementById("grical_upcoming"); - calcontainer.innerHTML="Calendar loading ...
please wait a second or two"; $.getJSON('/shmcache/grical_realraum.json', function(data){ writeCalendar(data, calcontainer); }); @@ -204,6 +202,16 @@ function showError(XMLHttpRequest, textStatus, errorThrown) alert("Error: " + textStatus); } +function IsImageOk(img) { + if (!img.complete) { + return false; + } + if (typeof img.naturalWidth != "undefined" && img.naturalWidth == 0) { + return false; + } + return true; +} + function reloadImg(element) { //var image = document.getElementById("theText"); @@ -213,7 +221,10 @@ function reloadImg(element) new_image.id = element.id; new_image.className = element.className; new_image.src = element.src; - element.parentNode.insertBefore(new_image,element); - element.parentNode.removeChild(element); + if (IsImageOk(new_image)) + { + element.parentNode.insertBefore(new_image,element); + element.parentNode.removeChild(element); + } } }